File tree Expand file tree Collapse file tree 7 files changed +242
-211
lines changed
compose-html-material3/src/jsMain/kotlin/com/huanshankeji/compose/html/material3 Expand file tree Collapse file tree 7 files changed +242
-211
lines changed Original file line number Diff line number Diff line change 11.gradle
2+ .kotlin
23build
34.idea
Original file line number Diff line number Diff line change @@ -10,9 +10,11 @@ repositories {
1010val huanshankejiGradlePluginsVersion = " 0.5.1"
1111
1212dependencies {
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}
Original file line number Diff line number Diff line change 11plugins {
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}
Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ https://material-web.dev/components/fab/
1616https://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
2024private 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
4143fun MdFab (
Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ https://github.com/material-components/material-web/blob/main/labs/navigationtab
1616https://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
2125fun 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
4549class MdNavigationTabScope (val elementScope : ElementScope <HTMLElement >) {
Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ https://material-web.dev/components/text-field/
1919https://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
2327private 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
8690fun MdFilledTextField (
You can’t perform that action at this time.
0 commit comments