Skip to content

Commit b303674

Browse files
committed
Merge branch 'init-project-with-gradle-init'
2 parents 164e4ef + 1664af8 commit b303674

File tree

14 files changed

+3088
-0
lines changed

14 files changed

+3088
-0
lines changed

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.gradle
2+
build
3+
local.properties
4+
5+
.idea

README.md

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

33
Compose Multiplatform Material Design component wrappers for Desktop, Android, and Web (mainly based on [KMDC](https://github.com/mpetuska/kmdc))
4+
5+
We try to make sure the styles of the `Composable` components follow those in `com.huanshankeji.compose.material`, with, however, only a subset of the `Composable` arguments supported due to the API differences and limitations of the JS components this project depends on.

build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tasks.wrapper {
2+
distributionType = Wrapper.DistributionType.ALL
3+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
plugins {
2+
kotlin("multiplatform")
3+
id("org.jetbrains.compose") version "1.2.1"
4+
// TODO: `id("com.android.library") version "7.2.2"`?
5+
id("com.huanshankeji.kotlin-multiplatform-jvm-and-js-browser-sonatype-ossrh-publish-conventions")
6+
}
7+
8+
group = "com.huanshankeji"
9+
version = "0.1.0-SNAPSHOT"
10+
11+
repositories {
12+
mavenCentral()
13+
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
14+
google()
15+
}
16+
17+
kotlin {
18+
jvm() // TODO: `jvm("desktop")`?
19+
// TODO: `android()`?
20+
js(IR) {
21+
browser()
22+
}
23+
24+
sourceSets {
25+
val commonMain by getting {
26+
dependencies {
27+
implementation(compose.runtime)
28+
}
29+
}
30+
// TODO: a `jvmCommon` source set to share code for `jvm`/`desktop` and `android`
31+
named("jvmMain") {
32+
dependencies {
33+
implementation(compose.foundation)
34+
implementation(compose.material)
35+
}
36+
}
37+
named("jsMain") {
38+
dependencies {
39+
// Be lazy and use the shortcut
40+
implementation("dev.petuska:kmdc:0.0.5")
41+
implementation("dev.petuska:kmdcx:0.0.5")
42+
// TODO: pick and choose exact components to reduce bundle size
43+
}
44+
}
45+
}
46+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.huanshankeji.compose.material
2+
3+
import androidx.compose.runtime.Composable
4+
5+
expect /*value*/ class ButtonScope {
6+
@Composable
7+
fun Label(text: String)
8+
}
9+
10+
@Composable
11+
expect fun Button(onClick: () -> Unit, content: @Composable ButtonScope.() -> Unit)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.huanshankeji.compose.material
2+
3+
import androidx.compose.runtime.Composable
4+
import dev.petuska.kmdc.button.Label
5+
import dev.petuska.kmdc.button.MDCButton
6+
import dev.petuska.kmdc.button.MDCButtonScope
7+
import org.w3c.dom.HTMLButtonElement
8+
9+
actual class ButtonScope(val mdcButtonScope: MDCButtonScope<HTMLButtonElement>) {
10+
@Composable
11+
actual fun Label(text: String) =
12+
mdcButtonScope.Label(text)
13+
}
14+
15+
@Composable
16+
actual fun Button(onClick: () -> Unit, content: @Composable ButtonScope.() -> Unit) =
17+
MDCButton(attrs = { onClick { onClick() } }) { ButtonScope(this).content() }
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.huanshankeji.compose.material
2+
3+
import androidx.compose.foundation.layout.RowScope
4+
import androidx.compose.material.Text
5+
import androidx.compose.runtime.Composable
6+
7+
actual class ButtonScope(val rowScope: RowScope) {
8+
@Composable
9+
actual fun Label(text: String) =
10+
Text(text)
11+
}
12+
13+
@Composable
14+
actual fun Button(onClick: () -> Unit, content: @Composable ButtonScope.() -> Unit) =
15+
androidx.compose.material.Button(onClick = onClick) { ButtonScope(this).content() }

gradle/wrapper/gradle-wrapper.jar

60.1 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
4+
networkTimeout=10000
5+
zipStoreBase=GRADLE_USER_HOME
6+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)