Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert the changes made due to Kotlin 2.0.0's type inference issue #14

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLElement>.() -> Unit =
{ MdFabScope(this).this@toHTMLElementContent() }

@Composable
private fun CommonMdFab(
tagName: String,
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLElement>.() -> Unit =
{ MdNavigationTabScope(this).(this@toHTMLElementContent)() }

@MaterialWebLabsApi
@Composable
fun MdNavigationTab(
Expand All @@ -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<HTMLElement>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLElement>.() -> Unit =
{ MdTextFieldScope(this).(this@toHTMLElementContent)() }

@Composable
private fun CommonTextField(
tagName: String,
Expand Down Expand Up @@ -53,7 +49,7 @@ private fun CommonTextField(
type: InputType<*>?,
autocomplete: AutoComplete?,
attrs: Attrs<HTMLElement>?,
content: @Composable (MdTextFieldScope.() -> Unit)?
content: (@Composable MdTextFieldScope.() -> Unit)?
) =
TagElement(tagName, {
disabled(disabled)
Expand Down Expand Up @@ -84,7 +80,7 @@ private fun CommonTextField(
autoComplete(autocomplete)

attrs?.invoke(this)
}, content?.toHTMLElementContent())
}, content?.let { { MdTextFieldScope(this).it() } })

@Composable
fun MdFilledTextField(
Expand Down
Loading