Skip to content

Commit a6cedc4

Browse files
committed
Bump Kotlin to 2.0.0 and Compose Multiplatform to 1.6.10
1 parent 830dfcf commit a6cedc4

File tree

7 files changed

+242
-211
lines changed

7 files changed

+242
-211
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.gradle
2+
.kotlin
23
build
34
.idea

buildSrc/build.gradle.kts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ repositories {
1010
val huanshankejiGradlePluginsVersion = "0.5.1"
1111

1212
dependencies {
13-
implementation(kotlin("gradle-plugin", "1.9.23"))
14-
implementation("org.jetbrains.compose:compose-gradle-plugin:1.6.2")
13+
val kotlinVersion = "2.0.0"
14+
implementation(kotlin("gradle-plugin", kotlinVersion))
15+
implementation("org.jetbrains.kotlin:compose-compiler-gradle-plugin:$kotlinVersion")
16+
implementation("org.jetbrains.compose:compose-gradle-plugin:1.6.10")
1517
implementation("com.huanshankeji:kotlin-common-gradle-plugins:$huanshankejiGradlePluginsVersion")
1618
implementation("com.huanshankeji.team:gradle-plugins:$huanshankejiGradlePluginsVersion")
17-
implementation("com.huanshankeji:common-gradle-dependencies:0.7.1-20240314")
19+
implementation("com.huanshankeji:common-gradle-dependencies:0.7.1-20240516")
1820
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id("com.huanshankeji.kotlin-multiplatform-js-browser-conventions")
3+
kotlin("plugin.compose")
34
id("org.jetbrains.compose")
45
id("com.huanshankeji.kotlin-multiplatform-sonatype-ossrh-publish-conventions")
56
}

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ https://material-web.dev/components/fab/
1616
https://material-web.dev/components/fab/stories/
1717
*/
1818

19+
// a workaround for probably a bug, needed since Kotlin 2.0.0 because of "Cannot infer type for this parameter. Please specify it explicitly."
20+
private fun (@Composable MdFabScope.() -> Unit).toHTMLElementContent(): @Composable ElementScope<HTMLElement>.() -> Unit =
21+
{ MdFabScope(this).this@toHTMLElementContent() }
22+
1923
@Composable
2024
private fun CommonMdFab(
2125
tagName: String,
@@ -33,9 +37,7 @@ private fun CommonMdFab(
3337
lowered?.let { attr("lowered", it) }
3438

3539
attrs?.invoke(this)
36-
}, content?.let {
37-
{ MdFabScope(this).it() }
38-
})
40+
}, content?.toHTMLElementContent())
3941

4042
@Composable
4143
fun MdFab(

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ https://github.com/material-components/material-web/blob/main/labs/navigationtab
1616
https://github.com/material-components/material-web/blob/main/labs/navigationbar/demo/stories.ts (navigation bar storybook)
1717
*/
1818

19+
// a workaround for probably a bug, needed since Kotlin 2.0.0 because of "Cannot infer type for this parameter. Please specify it explicitly."
20+
private fun (@Composable MdNavigationTabScope.() -> Unit).toHTMLElementContent(): @Composable ElementScope<HTMLElement>.() -> Unit =
21+
{ MdNavigationTabScope(this).(this@toHTMLElementContent)() }
22+
1923
@MaterialWebLabsApi
2024
@Composable
2125
fun MdNavigationTab(
@@ -39,7 +43,7 @@ fun MdNavigationTab(
3943
attrIfNotNull("show-badge", showBadge)
4044

4145
attrs?.invoke(this)
42-
}, content?.let { { MdNavigationTabScope(this).it() } })
46+
}, content?.toHTMLElementContent())
4347
}
4448

4549
class MdNavigationTabScope(val elementScope: ElementScope<HTMLElement>) {

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ https://material-web.dev/components/text-field/
1919
https://material-web.dev/components/text-field/stories/
2020
*/
2121

22+
// a workaround for probably a bug, needed since Kotlin 2.0.0 because of "Cannot infer type for this parameter. Please specify it explicitly."
23+
private fun (@Composable MdTextFieldScope.() -> Unit).toHTMLElementContent(): @Composable ElementScope<HTMLElement>.() -> Unit =
24+
{ MdTextFieldScope(this).(this@toHTMLElementContent)() }
25+
2226
@Composable
2327
private fun CommonTextField(
2428
tagName: String,
@@ -49,7 +53,7 @@ private fun CommonTextField(
4953
type: InputType<*>?,
5054
autocomplete: AutoComplete?,
5155
attrs: Attrs<HTMLElement>?,
52-
content: (@Composable MdTextFieldScope.() -> Unit)?
56+
content: @Composable (MdTextFieldScope.() -> Unit)?
5357
) =
5458
TagElement(tagName, {
5559
disabled(disabled)
@@ -80,7 +84,7 @@ private fun CommonTextField(
8084
autoComplete(autocomplete)
8185

8286
attrs?.invoke(this)
83-
}, content?.let { { MdTextFieldScope(this).it() } })
87+
}, content?.toHTMLElementContent())
8488

8589
@Composable
8690
fun MdFilledTextField(

0 commit comments

Comments
 (0)