Skip to content

Commit ef04079

Browse files
committed
Update README.md and extract a legacy README according to the latest Material 3 updates, and slight update the project structure
1 parent 4f0879c commit ef04079

File tree

8 files changed

+63
-47
lines changed

8 files changed

+63
-47
lines changed

LEGACY_README.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,33 @@
1-
# Compose HTML Material
1+
# Compose HTML Material (legacy Material 2)
22

3-
[![Maven Central](https://img.shields.io/maven-central/v/com.huanshankeji/compose-web-material)](https://search.maven.org/artifact/com.huanshankeji/compose-web-material)
4-
[![Gradle Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/com.huanshankeji.compose-web-material-conventions)](https://plugins.gradle.org/plugin/com.huanshankeji.compose-web-material-conventions)
3+
[![Maven Central](https://img.shields.io/maven-central/v/com.huanshankeji/compose-html-material-legacy)](https://search.maven.org/artifact/com.huanshankeji/compose-html-material-legacy)
4+
[![Gradle Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/com.huanshankeji.compose-html-material-conventions-legacy)](https://plugins.gradle.org/plugin/com.huanshankeji.compose-html-material-conventions-legacy)
55

6-
Some Material components for Compose HTML, based on [Material Web (with Web Components) (or material-web, or `mwc`)](https://github.com/material-components/material-web) (preferred) and [Material Components for the web (or material-components-web, or `mdc`)](https://github.com/material-components/material-components-web) (fallback)
6+
Some legacy Material 2 components for Compose HTML, based on [the obsolete `mwc` branch of Material Web](https://github.com/material-components/material-web/tree/mwc) (preferred) and [Material Components for the web (or material-components-web, or `mdc`)](https://github.com/material-components/material-components-web) (fallback)
77

8-
~~This project is in prototype and the components are not complete. More components will be added. It will probably go through huge refactors and API changes, too.~~
8+
**There will be no further development effort in this legacy Material 2 portion of this project. Here is a list of reasons and alternatives:**
99

10-
**This project is not currently under active development. Here is a list of reasons and alternatives:**
11-
12-
1. The [material-web](https://github.com/material-components/material-web) team is working on Material You (Material Design 3) support and [the Material 2 branch (`mwc`)](https://github.com/material-components/material-web/tree/mwc) is no longer under active development. Existing Compose wrappers of their Material 2 components are still kept in [the `:compose-web-material` subproject](compose-web-material) but not updated.
10+
1. The [material-web](https://github.com/material-components/material-web) team is working on Material 3 support and [the Material 2 branch (`mwc`)](https://github.com/material-components/material-web/tree/mwc) is no longer under active development. Existing Compose wrappers of their Material 2 components are still kept in [the `:compose-html-material-legacy` subproject](/compose-html-material-legacy) but not updated.
1311
1. [KMDC](https://github.com/mpetuska/kmdc) wrapping around [material-components-web (`mdc`)](https://github.com/material-components/material-components-web) provides a much more complete set of Material Design components for Compose HTML.
14-
1. We are currently focusing more on [compose-multiplatform-material](https://github.com/huanshankeji/compose-multiplatform-material) to provide multiplatform Compose Material wrappers, whose web portion depends on KMDC and [the `:compose-web-common` subproject](compose-web-common), which may be occasionally updated for the dependent project.
1512

1613
## Instructions on how to use
1714

1815
Some configurations are needed to use this library due to the immaturities of this project and Kotlin/JS.
1916

2017
### Add the dependency
2118

19+
Prior to v0.3.0:
20+
2221
```kotlin
2322
implementation("com.huanshankeji:compose-web-material:$version")
2423
```
2524

25+
Since v0.3.0:
26+
27+
```kotlin
28+
implementation("com.huanshankeji:compose-html-material-legacy:$version")
29+
```
30+
2631
### In code
2732

2833
Call `mwcRequires()` in your `main` function before calling any component Composable functions.
@@ -31,12 +36,24 @@ Call `mwcRequires()` in your `main` function before calling any component Compos
3136

3237
If you use this library in an app project with Webpack [which Kotlin/JS currently uses](https://kotlinlang.org/docs/js-project-setup.html), you might want to configure it as recommended by Material Web and Material Components for the web. Some instructions on how to do this simply are as below.
3338

34-
This plugin helps add the dependency to this project (if you do this you can skip the "Add the dependency" step above) and the `devNpm` dependencies:
39+
If you use a version prior to v0.3.0, this plugin helps add the dependency to this project (if you do this you can skip the "Add the dependency" step above) and the `devNpm` dependencies:
40+
41+
Prior to v0.3.0:
3542

3643
```kotlin
3744
plugins {
3845
id("com.huanshankeji.compose-web-material-conventions") version someVersion
3946
}
4047
```
4148

49+
Since v0.3.0:
50+
51+
```kotlin
52+
plugins {
53+
id("com.huanshankeji.compose-web-material-conventions-legacy") version someVersion
54+
}
55+
```
56+
4257
However, the plugin doesn't [make further adjustments to the webpack configuration](https://kotlinlang.org/docs/js-project-setup.html#webpack-configuration-file), so you also need to refer to [the demo further adjustments](demo/webpack.config.d/further_adjustments.js) and [the demo HTML page](demo/html/demo.html) to add your own. Just copy and possibly adapt them as you like.
58+
59+
Also note that there is [a new approach to adding CSS and SCSS support in the Kotlin Gradle Plugin since 1.8](https://kotlinlang.org/docs/whatsnew18.html#new-approach-to-adding-css-support-to-your-project), which replaces the function of this plugin.

README.md

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,57 @@
11
# Compose HTML Material
22

3-
[![Maven Central](https://img.shields.io/maven-central/v/com.huanshankeji/compose-html-material3)](https://search.maven.org/artifact/com.huanshankeji/compose-html-material)
4-
[![Gradle Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/com.huanshankeji.compose-html-material-conventions)](https://plugins.gradle.org/plugin/com.huanshankeji.compose-html-material-conventions)
3+
[![Maven Central](https://img.shields.io/maven-central/v/com.huanshankeji/compose-html-material3)](https://search.maven.org/artifact/com.huanshankeji/compose-html-material3)
54

6-
Some Material components for Compose HTML, with legacy Material 2 wrapper components based on [the obsolete `mwc` branch of Material Web](https://github.com/material-components/material-web/tree/mwc) (preferred) and [Material Components for the web (or material-components-web, or `mdc`)](https://github.com/material-components/material-components-web) (fallback), and Material 3 wrapper components based on [Material Web](https://github.com/material-components/material-web)
5+
Material 3 wrapper components for Compose HTML based on [Material Web](https://github.com/material-components/material-web)
76

8-
~~This project is in prototype and the components are not complete. More components will be added. It will probably go through huge refactors and API changes, too.~~
7+
For unified multiplatform APIs which are more akin to those in `androidx.compose`, check out [Compose Multiplatform Material](https://github.com/huanshankeji/compose-multiplatform-material).
98

10-
**The Material 2 portion of this project is not currently under active development. Here is a list of reasons and alternatives:**
9+
For Material 2 support, you are recommended to check out [KMDC](https://github.com/mpetuska/kmdc) instead. For information on our obsolete work on legacy Material 2 components, check out [the legacy README](LEGACY_README.md).
1110

12-
1. The [material-web](https://github.com/material-components/material-web) team is working on Material 3 support and [the Material 2 branch (`mwc`)](https://github.com/material-components/material-web/tree/mwc) is no longer under active development. Existing Compose wrappers of their Material 2 components are still kept in [the `:compose-html-material-legacy` subproject](compose-html-material-legacy) but not updated.
13-
1. [KMDC](https://github.com/mpetuska/kmdc) wrapping around [material-components-web (`mdc`)](https://github.com/material-components/material-components-web) provides a much more complete set of Material Design components for Compose HTML.
14-
1. We are currently focusing more on [compose-multiplatform-material](https://github.com/huanshankeji/compose-multiplatform-material) to provide multiplatform Compose Material wrappers, whose web portion depends on KMDC and [the `:compose-html-common` subproject](compose-html-common), which may be occasionally updated for the dependent project.
11+
## Supported components
1512

16-
## Instructions on how to use
13+
Not all components of Material Web are supported yet. Also, not all Material Design components are supported by Material Web yet (see [their roadmap](https://github.com/material-components/material-web/blob/main/docs/roadmap.md)).
1714

18-
Some configurations are needed to use this library due to the immaturities of this project and Kotlin/JS.
15+
Here is a list of supported compoent APIs:
1916

20-
### Add the dependency
21-
22-
Prior to v0.3.0:
23-
24-
```kotlin
25-
implementation("com.huanshankeji:compose-web-common:$version")
26-
implementation("com.huanshankeji:compose-web-material:$version")
27-
```
17+
- `MdElevatedButton`, `MdFilledButton`, `MdFilledTonalButton`, `MdOutlinedButton`, `MdTextButton`
18+
- `MdCheckbox`
19+
- `MdFab`, `MdBrandedFab`
20+
- `MdIcon`
21+
- `MdIconButton`, `MdFilledIconButton`, `MdFilledTonalIconButton`, `MdOutlinedIconButton`
22+
- `MdList`, `MdListItem`
23+
- `MdSwitch`, `LabelWithMdSwitch`
24+
- `MdFilledTextField`, `MdOutlinedTextField`
2825

29-
Since v0.3.0:
26+
### "labs" components
3027

31-
```kotlin
32-
implementation("com.huanshankeji:compose-html-common:$version")
33-
implementation("com.huanshankeji:compose-html-material3:$version")
34-
35-
implementation("com.huanshankeji:compose-html-material-legacy:$version") // Legacy Material 2
36-
```
28+
Here is a list of supported component APIs in the [Material Web "labs" directory](https://github.com/material-components/material-web/tree/main/labs), which "contains experimental features that are not recommended for production" as they state:
3729

38-
### In code
30+
- `MdElevatedCard`, `MdOutlinedCard`
31+
- `MdNavigationBar`
32+
- `MdNavigationTab`
3933

40-
Call `mwcRequires()` in your `main` function before calling any component Composable functions.
34+
You should opt-in to `@MaterialWebLabsApi` to use them.
4135

42-
### Kotlin/JS Webpack configuration
36+
## Brief Instructions
4337

44-
If you use this library in an app project with Webpack [which Kotlin/JS currently uses](https://kotlinlang.org/docs/js-project-setup.html), you might want to configure it as recommended by Material Web and Material Components for the web. Some instructions on how to do this simply are as below.
38+
### Add the dependency
4539

46-
If you use a version prior to v0.3.0, this plugin helps add the dependency to this project (if you do this you can skip the "Add the dependency" step above) and the `devNpm` dependencies:
40+
With Gradle:
4741

4842
```kotlin
49-
plugins {
50-
id("com.huanshankeji.compose-web-material-conventions") version someVersion
43+
kotlin {
44+
sourceSets {
45+
jsMain {
46+
dependencies {
47+
// ...
48+
implementation("com.huanshankeji:compose-html-material3:$version")
49+
}
50+
}
51+
}
5152
}
5253
```
5354

54-
However, the plugin doesn't [make further adjustments to the webpack configuration](https://kotlinlang.org/docs/js-project-setup.html#webpack-configuration-file), so you also need to refer to [the demo further adjustments](demo/webpack.config.d/further_adjustments.js) and [the demo HTML page](demo/html/demo.html) to add your own. Just copy and possibly adapt them as you like.
55-
5655
### Material Symbols & Icons
5756

5857
The Material 3 module uses [Material Symbols & Icons](https://fonts.google.com/icons), but doesn't depend on the stylesheet directly. For Material Icons to work properly, you may need to configure your project following the quick instructions below or [the developer guide](https://developers.google.com/fonts/docs/material_symbols).

compose-html-material3/src/jsMain/kotlin/com/huanshankeji/compose/html/material3/MaterialWebLabsApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.huanshankeji.compose.html.material3
22

33
@RequiresOptIn(
4-
"This API depends on components in the Material Web labs directory, which contains experimental features that are not recommended for production. " +
4+
"This API depends on components in the Material Web \"labs\" directory, which contains experimental features that are not recommended for production. " +
55
"See https://github.com/material-components/material-web/tree/main/labs for more details.",
66
RequiresOptIn.Level.WARNING
77
)

gradle-plugins/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ gradlePlugin {
3535
vcsUrl.set("${website.get()}.git")
3636

3737
plugins {
38-
getByName("com.huanshankeji.compose-html-material-conventions") {
38+
getByName("com.huanshankeji.compose-html-material-conventions-legacy") {
3939
displayName = "Compose HTML Material conventions"
4040
description =
4141
"This plugin adds the needed Maven dependencies and npm devDependencies (mainly for Webpack) for a Compose HTML project with Material components."
File renamed without changes.

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ include("compose-html-common")
44
include("compose-html-material-legacy")
55
include("compose-html-material3")
66
include("gradle-plugins")
7-
project(":gradle-plugins").name = rootProject.name + "-gradle-plugins"
7+
project(":gradle-plugins").name = "compose-html-material-gradle-plugins-legacy"

0 commit comments

Comments
 (0)