diff --git a/compose-html-material3/src/jsMain/kotlin/com/huanshankeji/compose/html/material3/MdFab.kt b/compose-html-material3/src/jsMain/kotlin/com/huanshankeji/compose/html/material3/MdFab.kt index f1cb266..ff4c93a 100644 --- a/compose-html-material3/src/jsMain/kotlin/com/huanshankeji/compose/html/material3/MdFab.kt +++ b/compose-html-material3/src/jsMain/kotlin/com/huanshankeji/compose/html/material3/MdFab.kt @@ -16,10 +16,6 @@ https://material-web.dev/components/fab/ https://material-web.dev/components/fab/stories/ */ -// a workaround for probably a bug, needed since Kotlin 2.0.0 because of "Cannot infer type for this parameter. Please specify it explicitly." -private fun (@Composable MdFabScope.() -> Unit).toHTMLElementContent(): @Composable ElementScope.() -> Unit = - { MdFabScope(this).this@toHTMLElementContent() } - @Composable private fun CommonMdFab( tagName: String, @@ -37,7 +33,9 @@ private fun CommonMdFab( lowered?.let { attr("lowered", it) } attrs?.invoke(this) - }, content?.toHTMLElementContent()) + }, content?.let { + { MdFabScope(this).it() } + }) @Composable fun MdFab( diff --git a/compose-html-material3/src/jsMain/kotlin/com/huanshankeji/compose/html/material3/MdNavigationTab.kt b/compose-html-material3/src/jsMain/kotlin/com/huanshankeji/compose/html/material3/MdNavigationTab.kt index 0f13dca..9537eb4 100644 --- a/compose-html-material3/src/jsMain/kotlin/com/huanshankeji/compose/html/material3/MdNavigationTab.kt +++ b/compose-html-material3/src/jsMain/kotlin/com/huanshankeji/compose/html/material3/MdNavigationTab.kt @@ -16,10 +16,6 @@ https://github.com/material-components/material-web/blob/main/labs/navigationtab https://github.com/material-components/material-web/blob/main/labs/navigationbar/demo/stories.ts (navigation bar storybook) */ -// a workaround for probably a bug, needed since Kotlin 2.0.0 because of "Cannot infer type for this parameter. Please specify it explicitly." -private fun (@Composable MdNavigationTabScope.() -> Unit).toHTMLElementContent(): @Composable ElementScope.() -> Unit = - { MdNavigationTabScope(this).(this@toHTMLElementContent)() } - @MaterialWebLabsApi @Composable fun MdNavigationTab( @@ -43,7 +39,7 @@ fun MdNavigationTab( attrIfNotNull("show-badge", showBadge) attrs?.invoke(this) - }, content?.toHTMLElementContent()) + }, content?.let { { MdNavigationTabScope(this).it() } }) } class MdNavigationTabScope(val elementScope: ElementScope) { diff --git a/compose-html-material3/src/jsMain/kotlin/com/huanshankeji/compose/html/material3/MdTextField.kt b/compose-html-material3/src/jsMain/kotlin/com/huanshankeji/compose/html/material3/MdTextField.kt index 6ec9854..20bb39f 100644 --- a/compose-html-material3/src/jsMain/kotlin/com/huanshankeji/compose/html/material3/MdTextField.kt +++ b/compose-html-material3/src/jsMain/kotlin/com/huanshankeji/compose/html/material3/MdTextField.kt @@ -19,10 +19,6 @@ https://material-web.dev/components/text-field/ https://material-web.dev/components/text-field/stories/ */ -// a workaround for probably a bug, needed since Kotlin 2.0.0 because of "Cannot infer type for this parameter. Please specify it explicitly." -private fun (@Composable MdTextFieldScope.() -> Unit).toHTMLElementContent(): @Composable ElementScope.() -> Unit = - { MdTextFieldScope(this).(this@toHTMLElementContent)() } - @Composable private fun CommonTextField( tagName: String, @@ -53,7 +49,7 @@ private fun CommonTextField( type: InputType<*>?, autocomplete: AutoComplete?, attrs: Attrs?, - content: @Composable (MdTextFieldScope.() -> Unit)? + content: (@Composable MdTextFieldScope.() -> Unit)? ) = TagElement(tagName, { disabled(disabled) @@ -84,7 +80,7 @@ private fun CommonTextField( autoComplete(autocomplete) attrs?.invoke(this) - }, content?.toHTMLElementContent()) + }, content?.let { { MdTextFieldScope(this).it() } }) @Composable fun MdFilledTextField(