Skip to content

Commit c558d8e

Browse files
committed
Partially revert "Bump Kotlin to 2.0.0 and Compose Multiplatform to 1.6.10", reverting the changes made due to Kotlin 2.0.0's type inference issue
This partially reverts commit a6cedc4.
1 parent a1d8335 commit c558d8e

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ 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-
2319
@Composable
2420
private fun CommonMdFab(
2521
tagName: String,
@@ -37,7 +33,9 @@ private fun CommonMdFab(
3733
lowered?.let { attr("lowered", it) }
3834

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

4240
@Composable
4341
fun MdFab(

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ 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-
2319
@MaterialWebLabsApi
2420
@Composable
2521
fun MdNavigationTab(
@@ -43,7 +39,7 @@ fun MdNavigationTab(
4339
attrIfNotNull("show-badge", showBadge)
4440

4541
attrs?.invoke(this)
46-
}, content?.toHTMLElementContent())
42+
}, content?.let { { MdNavigationTabScope(this).it() } })
4743
}
4844

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

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ 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-
2622
@Composable
2723
private fun CommonTextField(
2824
tagName: String,
@@ -53,7 +49,7 @@ private fun CommonTextField(
5349
type: InputType<*>?,
5450
autocomplete: AutoComplete?,
5551
attrs: Attrs<HTMLElement>?,
56-
content: @Composable (MdTextFieldScope.() -> Unit)?
52+
content: (@Composable MdTextFieldScope.() -> Unit)?
5753
) =
5854
TagElement(tagName, {
5955
disabled(disabled)
@@ -84,7 +80,7 @@ private fun CommonTextField(
8480
autoComplete(autocomplete)
8581

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

8985
@Composable
9086
fun MdFilledTextField(

0 commit comments

Comments
 (0)