Skip to content

Commit bc5afe6

Browse files
committed
Merge branch 'main' into github-pages-deployment-with-dokka
2 parents 6dfb668 + 8d7a18f commit bc5afe6

File tree

348 files changed

+5734
-755
lines changed

Some content is hidden

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

348 files changed

+5734
-755
lines changed

.github/workflows/demo-gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
uses: gradle/actions/setup-gradle@v4
4242

4343
- name: Build the distribution with Gradle Wrapper
44-
run: ./gradlew :demo:sideBySideBrowserDistribution
44+
run: ./gradlew :compose-multiplatform-html-unified-demo:sideBySideBrowserDistribution
4545

4646
- name: Upload artifact
4747
uses: actions/upload-pages-artifact@v3

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Change log
22

3+
## v0.5.0 / 2024-12-05
4+
5+
Important changes:
6+
7+
* This library is renamed from **Compose Multiplatform Material** to **Compose Multiplatform HTML Unified** which better describes its purpose since this release. The **Maven coordinates** have changed accordingly. Please adapt to these changes following the updated README.md.
8+
* replace the terms "Androidx"/"androidx"/"AndroidxCommon"/"androidxCommon" with Compose UI / "ComposeUi" / "composeUi" at appropriate places, both in docs and in code
9+
10+
This introduces some breaking changes. Please adapt accordingly. We are sorry for the inconvenience.
11+
12+
Functional change:
13+
14+
* delegate `Spacer` just to `DivBox` on JS DOM because the Kobweb `Spacer` has a different semantic from the Compose UI one
15+
16+
Miscellaneous changes:
17+
18+
* bump Kotlin to 2.1.0, Compose Multiplatform to 1.7.1, and Kobweb to 0.20.0
19+
* add a "side by side" demo hosted at <https://huanshankeji.github.io/compose-multiplatform-html-unified/>
20+
* add CODE_OF_CONDUCT.md and CONTRIBUTING.md
21+
* use the Kotlin binary compatibility validator
22+
* run IntelliJ IDEA Code Cleanup and Reformat Code for the whole project
23+
324
## v0.4.0 / 2024-10-24
425

526
* fix a bug that a dependent project might crash on Android and add the Android target explicitly for all modules

CODE_OF_CONDUCT.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
shreckye@gmail.com.
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Contributing guidelines
2+
3+
Hello, thank you for your interest in contributing to our project.
4+
5+
## Issues and Discussions
6+
7+
You are welcome to submit issues on bugs or feature requests. If you have questions, please ask them in GitHub Discussions.
8+
9+
## Pull requests
10+
11+
If you want to contribute to the code of our project, you are welcome to open pull requests. However, it's always a good idea to open a related issue or talk with us in Discussions first.
12+
13+
## Development
14+
15+
Please make sure you have a valid JDK installed. Some projects may require multiple JDKs of different versions. The JDK version we use can be found in the [GitHub Actions workflow files](.github/workflows).
16+
17+
We recommend developing with IntelliJ IDEA. In IntelliJ IDEA, select the correct [Project SDK in Project Structure](https://www.jetbrains.com/help/idea/project-settings-and-structure.html#project-sdk) and it's recommended to set [Gradle JVM](https://www.jetbrains.com/help/idea/gradle-jvm-selection.html#jvm_settings) to "Project SDK".
18+
19+
Run the `publishToMavenLocal` Gradle task to publish the libraries to your machine's Maven Local Repository so your projects can depend on the changes you have made, run `check` to ensure our limited number of tests pass.
20+
21+
## Furthur notice
22+
23+
We are currently a small team with limited effort. While we may not always implement your requested features, merge your pull requests, or do such things in time, you are always welcome to create your own fork and make any changes you like.

README.md

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
1-
# Compose Multiplatform Material (better name pending): unified Compose Multiplatform common extensions and Material wrappers for `androidx.compose` and Compose HTML
1+
# Compose Multiplatform HTML Unified
22

3-
[![Maven Central](https://img.shields.io/maven-central/v/com.huanshankeji/compose-multiplatform-material3)](https://search.maven.org/search?q=g:com.huanshankeji%20AND%20a:compose-multiplatform-*)
4-
![Kotlin version](https://kotlin-version.aws.icerock.dev/kotlin-version?group=com.huanshankeji&name=compose-multiplatform-material3)
3+
[![Maven Central](https://img.shields.io/maven-central/v/com.huanshankeji/compose-multiplatform-html-unified-common)](https://search.maven.org/search?q=g:com.huanshankeji%20AND%20a:compose-multiplatform-html-unified-*)
4+
![Kotlin version](https://kotlin-version.aws.icerock.dev/kotlin-version?group=com.huanshankeji&name=compose-multiplatform-html-unified-common)
55

6-
Unified Compose Multiplatform wrappers of common components, layouts, and Material Design components for `androidx.compose` (officially supported on Android, desktop (JVM), iOS, and web (Kotlin/Wasm)) and Compose HTML (mainly based on [Kobweb Silk](https://github.com/varabyte/kobweb?tab=readme-ov-file#silk) [Compose](https://github.com/varabyte/kobweb/tree/main/frontend/kobweb-compose), [KMDC](https://github.com/mpetuska/kmdc), and [Compose HTML Material](https://github.com/huanshankeji/compose-html-material) (which is then based on [Material Web](https://github.com/material-components/material-web)))
6+
Unified Compose Multiplatform wrappers of common and **Material Design** APIs for **rendering-based Compose UI** (officially supported on Android, desktop (JVM), iOS, and web (Kotlin/Wasm)) and **DOM-based Compose HTML**
77

8-
We try to provide a set of common extensions and composable component APIs akin to those in `androidx.compose` (`androidx.compose.foundation`, `androidx.compose.material`, and `androidx.compose.material3`), meanwhile making them compatible with the Compose HTML APIs. However, only subsets of the composables and composable parameters are supported due to the API differences, limitations of the JS (web) platform and the Compose HTML composables this project depends on, and our limited effort.
8+
This library was previously named "Compose Multiplatform Material".
99

10-
Complete visual consistency across different platforms is not guaranteed. See the [the side-by-side demo site](https://huanshankeji.github.io/compose-multiplatform-material/) for the visual effects and their differences.
10+
## The scope and implementations of the APIs provided
1111

12-
This project is still in development and has not reached the stable state yet. Some APIs are likely to be changed and there is no detailed documentation yet. Check out [the demo project source](demo) on how to use the components in addition to the information below.
12+
We try to provide a set of common APIs including composable component APIs akin to those in `androidx.compose` (`androidx.compose.foundation`, `androidx.compose.material`, and `androidx.compose.material3`), meanwhile making them compatible with the Compose HTML APIs. However, only subsets of the composables and composable parameters are supported due to the underlying API differences, limitations of the JS platform and the available Compose HTML composables this project depends on, and our limited effort.
1313

14-
## Supported features
14+
The modules of this library correspond to the Compose Multiplatform modules (or Compose modules in AndroidX) that are not available for Compose HTML, aka those that depend on [the UI module](https://github.com/JetBrains/compose-multiplatform-core/tree/jb-main/compose/ui), more specifically [`ui-graphics`](https://github.com/JetBrains/compose-multiplatform-core/tree/jb-main/compose/ui/ui-graphics). The `common` module of this library corresponds to the `ui` and `foundation` modules, offering UI components (including layouts), modifiers, UI configuration classes, etc.
15+
16+
The Compose HTML / JS DOM source is mainly based on [Kobweb Silk](https://github.com/varabyte/kobweb?tab=readme-ov-file#silk) [Compose](https://github.com/varabyte/kobweb/tree/main/frontend/kobweb-compose), [KMDC](https://github.com/mpetuska/kmdc), and [Compose HTML Material](https://github.com/huanshankeji/compose-html-material) (which is then based on [Material Web](https://github.com/material-components/material-web)).
17+
18+
## References and limitations
19+
20+
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.
21+
22+
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.
23+
24+
## Supported API catalog
1525

1626
### Components
1727

@@ -32,7 +42,7 @@ This project is still in development and has not reached the stable state yet. S
3242

3343
###### `ext` layouts
3444

35-
- `BoxWithConstraints`
45+
- `BoxWithConstraints`
3646

3747
##### Lazy
3848

@@ -82,7 +92,7 @@ This project is still in development and has not reached the stable state yet. S
8292
- `Button` (`FilledButton`), `ElevatedButton`, `FilledTonalButton`, `OutlinedButton`, `TextButton`
8393
- `Card` (`FilledCard`), `ElevatedCard`, `OutlinedCard`
8494
- `DropdownMenu`, `DropdownMenuItem`
85-
- `ExposedDropdownMenuBox`, `ExposedDropdownMenuBoxScope.ExposedDropdownMenuBoxTextField`, `ExposedDropdownMenuBoxScope.ExposedDropdownMenu`, `ExposedDropdownMenuWithTextField`
95+
- `ExposedDropdownMenuBox`, `ExposedDropdownMenuBoxScope.ExposedDropdownMenuBoxTextField`, `ExposedDropdownMenuBoxScope.ExposedDropdownMenu`, `ExposedDropdownMenuWithTextField`
8696
- `FloatingActionButton`, `SmallFloatingActionButton`, `LargeFloatingActionButton`, `ExtendedFloatingActionButton`
8797
- `IconButton`, `IconToggleButton`, `FilledIconButton`, `FilledIconToggleButton`, `FilledTonalIconButton`, `FilledTonalIconToggleButton`, `OutlinedIconButton`, `OutlinedIconToggleButton`
8898
- `NavigationBar`, `NavigationBarItem`
@@ -95,12 +105,11 @@ This project is still in development and has not reached the stable state yet. S
95105

96106
#### About `ext` components (components in the `ext` packages)
97107

98-
The components in the `ext` packages don't follow the `androidx.compose` APIs exactly, but rather provide wrappers are more idiomatic and conventional on both kinds of targets, wrapping different APIs which can't be unified following the `androidx.compose` APIs.
108+
The components in the `ext` packages don't follow the `androidx.compose` APIs exactly, but rather provide wrappers that are more idiomatic and conventional on both kinds of targets, wrapping different APIs that can't be unified following the `androidx.compose` APIs.
99109

100110
#### About parameter names
101111

102-
The parameter names with suffixes such as "JsDom" or "AndroidxCommon" are platform-specific, and only apply on their respective platform(s), Compose HTML / JS DOM or
103-
`androidx.compose` platforms.
112+
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.
104113

105114
#### Material Icons
106115

@@ -144,31 +153,32 @@ transition or animation on Compose HTML / JS DOM. These APIs are also highly exp
144153
See [CMP-4966](https://youtrack.jetbrains.com/issue/CMP-4966) for a bug to avoid. Also, ViewModel-related functions
145154
are not implemented yet on Compose HTML / JS DOM.
146155

147-
## Add the libraries to your dependency
156+
## Add to your dependencies
148157

149158
Maven coordinate:
150159

151160
```kotlin
152-
"com.huanshankeji:compose-multiplatform-$module:$version"
161+
"com.huanshankeji:compose-multiplatform-html-unified-$module:$version"
153162
```
154163

155164
More specifically:
165+
156166
```kotlin
157-
"com.huanshankeji:compose-multiplatform-common:$version"
158-
"com.huanshankeji:compose-multiplatform-material-icons-core:$version"
159-
"com.huanshankeji:compose-multiplatform-material2:$version"
160-
"com.huanshankeji:compose-multiplatform-material3:$version"
167+
"com.huanshankeji:compose-multiplatform-html-unified-common:$version"
168+
"com.huanshankeji:compose-multiplatform-html-unified-material-icons-core:$version"
169+
"com.huanshankeji:compose-multiplatform-html-unified-material2:$version"
170+
"com.huanshankeji:compose-multiplatform-html-unified-material3:$version"
161171
```
162172

163-
For example, depend on the Material 3 module with Gradle:
173+
For example, to depend on the Material 3 module with Gradle:
164174

165175
```kotlin
166176
kotlin {
167177
sourceSets {
168178
commonMain {
169179
dependencies {
170180
// ...
171-
implementation("com.huanshankeji:compose-multiplatform-material3:$version")
181+
implementation("com.huanshankeji:compose-multiplatform-html-unified-material3:$version")
172182
}
173183
}
174184
}

build.gradle.kts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@ tasks.wrapper {
22
distributionType = Wrapper.DistributionType.ALL
33
}
44

5+
plugins {
6+
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.16.3"
7+
}
8+
9+
apiValidation {
10+
@OptIn(kotlinx.validation.ExperimentalBCVApi::class)
11+
klib {
12+
enabled = true
13+
}
14+
15+
ignoredProjects += "compose-multiplatform-html-unified".let {
16+
listOf("$it-demo", "$it-common-legacy")
17+
}
18+
}
19+
520
plugins {
621
id("org.jetbrains.dokka")
722
}

buildSrc/build.gradle.kts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,18 @@ plugins {
33
}
44

55
repositories {
6-
mavenLocal()
6+
//mavenLocal() // comment out when not needed
77
gradlePluginPortal()
88
google()
99
mavenCentral()
1010
}
1111

1212
dependencies {
13-
// With Kotlin 2.0.20, a "Could not parse POM" build error occurs in the JVM projects of some dependent projects.
14-
val kotlinVersion = "2.0.10"
13+
val kotlinVersion = "2.1.0"
1514
implementation(kotlin("gradle-plugin", kotlinVersion))
1615
implementation("org.jetbrains.kotlin:compose-compiler-gradle-plugin:$kotlinVersion")
17-
implementation("org.jetbrains.compose:compose-gradle-plugin:1.7.0")
18-
implementation("com.huanshankeji.team:gradle-plugins:0.7.0-SNAPSHOT") // TODO don't use a snapshot version in a main branch
19-
implementation("com.android.tools.build:gradle:8.5.2")
20-
implementation("com.huanshankeji:common-gradle-dependencies:0.8.0-20241016") // don't use a snapshot version in a main branch
21-
implementation("org.jetbrains.dokka:dokka-gradle-plugin:2.0.0")
16+
implementation("org.jetbrains.compose:compose-gradle-plugin:1.7.3")
17+
implementation("com.huanshankeji.team:gradle-plugins:0.9.0") // don't use a snapshot version in a main branch
18+
implementation("com.android.tools.build:gradle:8.7.3")
19+
implementation("com.huanshankeji:common-gradle-dependencies:0.9.0-20241203") // don't use a snapshot version in a main branch
2220
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const val FOR_COMPOSE_TARGETS_IN_TITLE = "for `androidx.compose` and Compose HTML"
1+
const val FOR_COMPOSE_TARGETS_IN_TITLE = "for Compose UI and Compose HTML"
22
const val FOR_COMPOSE_TARGETS_IN_DESCRIPTION =
3-
"for `androidx.compose` (Android, desktop (JVM), iOS, and web (Kotlin/Wasm)) and Compose HTML"
3+
"for Compose UI (Android, desktop (JVM), iOS, and web (Kotlin/Wasm)) and Compose HTML"

buildSrc/src/main/kotlin/VersionsAndDependencies.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import com.huanshankeji.CommonDependencies
22
import org.jetbrains.compose.ComposeBuildConfig
33

4-
val projectVersion = "0.4.1-SNAPSHOT"
4+
val projectVersion = "0.5.1-SNAPSHOT"
55

66
val commonDependencies = CommonDependencies()
77

0 commit comments

Comments
 (0)