diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiButtonStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiButtonStyling.kt index 923c8d9e4..960670959 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiButtonStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiButtonStyling.kt @@ -11,44 +11,47 @@ import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme +import org.jetbrains.jewel.ui.component.styling.ButtonColors +import org.jetbrains.jewel.ui.component.styling.ButtonMetrics +import org.jetbrains.jewel.ui.component.styling.ButtonStyle -val org.jetbrains.jewel.ui.component.styling.ButtonStyle.Companion.Default: IntUiDefaultButtonStyleFactory +val ButtonStyle.Companion.Default: IntUiDefaultButtonStyleFactory get() = IntUiDefaultButtonStyleFactory object IntUiDefaultButtonStyleFactory { @Composable fun light( - colors: org.jetbrains.jewel.ui.component.styling.ButtonColors = org.jetbrains.jewel.ui.component.styling.ButtonColors.Default.light(), - metrics: org.jetbrains.jewel.ui.component.styling.ButtonMetrics = org.jetbrains.jewel.ui.component.styling.ButtonMetrics.default(), - ) = org.jetbrains.jewel.ui.component.styling.ButtonStyle(colors, metrics) + colors: ButtonColors = ButtonColors.Default.light(), + metrics: ButtonMetrics = ButtonMetrics.default(), + ) = ButtonStyle(colors, metrics) @Composable fun dark( - colors: org.jetbrains.jewel.ui.component.styling.ButtonColors = org.jetbrains.jewel.ui.component.styling.ButtonColors.Default.dark(), - metrics: org.jetbrains.jewel.ui.component.styling.ButtonMetrics = org.jetbrains.jewel.ui.component.styling.ButtonMetrics.default(), - ) = org.jetbrains.jewel.ui.component.styling.ButtonStyle(colors, metrics) + colors: ButtonColors = ButtonColors.Default.dark(), + metrics: ButtonMetrics = ButtonMetrics.default(), + ) = ButtonStyle(colors, metrics) } -val org.jetbrains.jewel.ui.component.styling.ButtonStyle.Companion.Outlined: IntUiOutlinedButtonStyleFactory +val ButtonStyle.Companion.Outlined: IntUiOutlinedButtonStyleFactory get() = IntUiOutlinedButtonStyleFactory object IntUiOutlinedButtonStyleFactory { @Composable fun light( - colors: org.jetbrains.jewel.ui.component.styling.ButtonColors = org.jetbrains.jewel.ui.component.styling.ButtonColors.Outlined.light(), - metrics: org.jetbrains.jewel.ui.component.styling.ButtonMetrics = org.jetbrains.jewel.ui.component.styling.ButtonMetrics.outlined(), - ) = org.jetbrains.jewel.ui.component.styling.ButtonStyle(colors, metrics) + colors: ButtonColors = ButtonColors.Outlined.light(), + metrics: ButtonMetrics = ButtonMetrics.outlined(), + ) = ButtonStyle(colors, metrics) @Composable fun dark( - colors: org.jetbrains.jewel.ui.component.styling.ButtonColors = org.jetbrains.jewel.ui.component.styling.ButtonColors.Outlined.dark(), - metrics: org.jetbrains.jewel.ui.component.styling.ButtonMetrics = org.jetbrains.jewel.ui.component.styling.ButtonMetrics.outlined(), - ) = org.jetbrains.jewel.ui.component.styling.ButtonStyle(colors, metrics) + colors: ButtonColors = ButtonColors.Outlined.dark(), + metrics: ButtonMetrics = ButtonMetrics.outlined(), + ) = ButtonStyle(colors, metrics) } -val org.jetbrains.jewel.ui.component.styling.ButtonColors.Companion.Default: IntUiDefaultButtonColorFactory +val ButtonColors.Companion.Default: IntUiDefaultButtonColorFactory get() = IntUiDefaultButtonColorFactory object IntUiDefaultButtonColorFactory { @@ -70,7 +73,7 @@ object IntUiDefaultButtonColorFactory { borderFocused: Brush = SolidColor(IntUiLightTheme.colors.blue(4)), borderPressed: Brush = border, borderHovered: Brush = border, - ) = org.jetbrains.jewel.ui.component.styling.ButtonColors( + ) = ButtonColors( background, backgroundDisabled, backgroundFocused, @@ -105,7 +108,7 @@ object IntUiDefaultButtonColorFactory { borderFocused: Brush = SolidColor(IntUiDarkTheme.colors.grey(1)), borderPressed: Brush = border, borderHovered: Brush = border, - ) = org.jetbrains.jewel.ui.component.styling.ButtonColors( + ) = ButtonColors( background, backgroundDisabled, backgroundFocused, @@ -124,7 +127,7 @@ object IntUiDefaultButtonColorFactory { ) } -val org.jetbrains.jewel.ui.component.styling.ButtonColors.Companion.Outlined: IntUiOutlinedButtonColorFactory +val ButtonColors.Companion.Outlined: IntUiOutlinedButtonColorFactory get() = IntUiOutlinedButtonColorFactory object IntUiOutlinedButtonColorFactory { @@ -146,7 +149,7 @@ object IntUiOutlinedButtonColorFactory { borderFocused: Brush = SolidColor(IntUiLightTheme.colors.blue(4)), borderPressed: Brush = SolidColor(IntUiLightTheme.colors.grey(7)), borderHovered: Brush = SolidColor(IntUiLightTheme.colors.grey(8)), - ) = org.jetbrains.jewel.ui.component.styling.ButtonColors( + ) = ButtonColors( background, backgroundDisabled, backgroundFocused, @@ -181,7 +184,7 @@ object IntUiOutlinedButtonColorFactory { borderFocused: Brush = SolidColor(IntUiDarkTheme.colors.grey(2)), borderPressed: Brush = SolidColor(IntUiDarkTheme.colors.grey(7)), borderHovered: Brush = SolidColor(IntUiDarkTheme.colors.grey(7)), - ) = org.jetbrains.jewel.ui.component.styling.ButtonColors( + ) = ButtonColors( background, backgroundDisabled, backgroundFocused, @@ -200,16 +203,16 @@ object IntUiOutlinedButtonColorFactory { ) } -fun org.jetbrains.jewel.ui.component.styling.ButtonMetrics.Companion.default( +fun ButtonMetrics.Companion.default( cornerSize: CornerSize = CornerSize(4.dp), padding: PaddingValues = PaddingValues(horizontal = 12.dp, vertical = 6.dp), minSize: DpSize = DpSize(72.dp, 28.dp), borderWidth: Dp = 0.dp, -) = org.jetbrains.jewel.ui.component.styling.ButtonMetrics(cornerSize, padding, minSize, borderWidth) +) = ButtonMetrics(cornerSize, padding, minSize, borderWidth) -fun org.jetbrains.jewel.ui.component.styling.ButtonMetrics.Companion.outlined( +fun ButtonMetrics.Companion.outlined( cornerSize: CornerSize = CornerSize(4.dp), padding: PaddingValues = PaddingValues(horizontal = 12.dp, vertical = 6.dp), minSize: DpSize = DpSize(72.dp, 28.dp), borderWidth: Dp = 1.dp, -) = org.jetbrains.jewel.ui.component.styling.ButtonMetrics(cornerSize, padding, minSize, borderWidth) +) = ButtonMetrics(cornerSize, padding, minSize, borderWidth) diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiCheckboxStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiCheckboxStyling.kt index e94f8ce31..965d3f49f 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiCheckboxStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiCheckboxStyling.kt @@ -10,43 +10,47 @@ import androidx.compose.ui.unit.dp import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme import org.jetbrains.jewel.intui.standalone.standalonePainterProvider +import org.jetbrains.jewel.ui.component.styling.CheckboxColors +import org.jetbrains.jewel.ui.component.styling.CheckboxIcons +import org.jetbrains.jewel.ui.component.styling.CheckboxMetrics +import org.jetbrains.jewel.ui.component.styling.CheckboxStyle import org.jetbrains.jewel.ui.painter.PainterProvider @Composable -fun org.jetbrains.jewel.ui.component.styling.CheckboxStyle.Companion.light( - colors: org.jetbrains.jewel.ui.component.styling.CheckboxColors = org.jetbrains.jewel.ui.component.styling.CheckboxColors.light(), - metrics: org.jetbrains.jewel.ui.component.styling.CheckboxMetrics = org.jetbrains.jewel.ui.component.styling.CheckboxMetrics.defaults(), - icons: org.jetbrains.jewel.ui.component.styling.CheckboxIcons = org.jetbrains.jewel.ui.component.styling.CheckboxIcons.light(), -) = org.jetbrains.jewel.ui.component.styling.CheckboxStyle(colors, metrics, icons) +fun CheckboxStyle.Companion.light( + colors: CheckboxColors = CheckboxColors.light(), + metrics: CheckboxMetrics = CheckboxMetrics.defaults(), + icons: CheckboxIcons = CheckboxIcons.light(), +) = CheckboxStyle(colors, metrics, icons) @Composable -fun org.jetbrains.jewel.ui.component.styling.CheckboxStyle.Companion.dark( - colors: org.jetbrains.jewel.ui.component.styling.CheckboxColors = org.jetbrains.jewel.ui.component.styling.CheckboxColors.dark(), - metrics: org.jetbrains.jewel.ui.component.styling.CheckboxMetrics = org.jetbrains.jewel.ui.component.styling.CheckboxMetrics.defaults(), - icons: org.jetbrains.jewel.ui.component.styling.CheckboxIcons = org.jetbrains.jewel.ui.component.styling.CheckboxIcons.dark(), -) = org.jetbrains.jewel.ui.component.styling.CheckboxStyle(colors, metrics, icons) +fun CheckboxStyle.Companion.dark( + colors: CheckboxColors = CheckboxColors.dark(), + metrics: CheckboxMetrics = CheckboxMetrics.defaults(), + icons: CheckboxIcons = CheckboxIcons.dark(), +) = CheckboxStyle(colors, metrics, icons) @Composable -fun org.jetbrains.jewel.ui.component.styling.CheckboxColors.Companion.light( +fun CheckboxColors.Companion.light( content: Color = Color.Unspecified, contentDisabled: Color = IntUiLightTheme.colors.grey(8), contentSelected: Color = content, -) = org.jetbrains.jewel.ui.component.styling.CheckboxColors(content, contentDisabled, contentSelected) +) = CheckboxColors(content, contentDisabled, contentSelected) @Composable -fun org.jetbrains.jewel.ui.component.styling.CheckboxColors.Companion.dark( +fun CheckboxColors.Companion.dark( content: Color = Color.Unspecified, contentDisabled: Color = IntUiDarkTheme.colors.grey(7), contentSelected: Color = content, -) = org.jetbrains.jewel.ui.component.styling.CheckboxColors(content, contentDisabled, contentSelected) +) = CheckboxColors(content, contentDisabled, contentSelected) -fun org.jetbrains.jewel.ui.component.styling.CheckboxMetrics.Companion.defaults( +fun CheckboxMetrics.Companion.defaults( checkboxSize: DpSize = DpSize(19.dp, 19.dp), checkboxCornerSize: CornerSize = CornerSize(3.dp), outlineSize: DpSize = DpSize(15.dp, 15.dp), outlineOffset: DpOffset = DpOffset(2.5.dp, 1.5.dp), iconContentGap: Dp = 5.dp, -) = org.jetbrains.jewel.ui.component.styling.CheckboxMetrics( +) = CheckboxMetrics( checkboxSize, checkboxCornerSize, outlineSize, @@ -55,14 +59,14 @@ fun org.jetbrains.jewel.ui.component.styling.CheckboxMetrics.Companion.defaults( ) @Composable -fun org.jetbrains.jewel.ui.component.styling.CheckboxIcons.Companion.light( +fun CheckboxIcons.Companion.light( checkbox: PainterProvider = checkbox("com/intellij/ide/ui/laf/icons/intellij/checkBox.svg"), -) = org.jetbrains.jewel.ui.component.styling.CheckboxIcons(checkbox) +) = CheckboxIcons(checkbox) @Composable -fun org.jetbrains.jewel.ui.component.styling.CheckboxIcons.Companion.dark( +fun CheckboxIcons.Companion.dark( checkbox: PainterProvider = checkbox("com/intellij/ide/ui/laf/icons/darcula/checkBox.svg"), -) = org.jetbrains.jewel.ui.component.styling.CheckboxIcons(checkbox) +) = CheckboxIcons(checkbox) @Composable private fun checkbox(basePath: String): PainterProvider = diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLinkStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLinkStyling.kt index 062c7bb79..cc95ecfc6 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLinkStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLinkStyling.kt @@ -13,33 +13,38 @@ import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme import org.jetbrains.jewel.intui.standalone.standalonePainterProvider import org.jetbrains.jewel.intui.standalone.theme.defaultTextStyle +import org.jetbrains.jewel.ui.component.styling.LinkColors +import org.jetbrains.jewel.ui.component.styling.LinkIcons +import org.jetbrains.jewel.ui.component.styling.LinkMetrics +import org.jetbrains.jewel.ui.component.styling.LinkStyle +import org.jetbrains.jewel.ui.component.styling.LinkTextStyles import org.jetbrains.jewel.ui.painter.PainterProvider @Composable -fun org.jetbrains.jewel.ui.component.styling.LinkStyle.Companion.light( - colors: org.jetbrains.jewel.ui.component.styling.LinkColors = org.jetbrains.jewel.ui.component.styling.LinkColors.light(), - metrics: org.jetbrains.jewel.ui.component.styling.LinkMetrics = org.jetbrains.jewel.ui.component.styling.LinkMetrics.defaults(), - icons: org.jetbrains.jewel.ui.component.styling.LinkIcons = org.jetbrains.jewel.ui.component.styling.LinkIcons.defaults(), - textStyles: org.jetbrains.jewel.ui.component.styling.LinkTextStyles = org.jetbrains.jewel.ui.component.styling.LinkTextStyles.light(), -) = org.jetbrains.jewel.ui.component.styling.LinkStyle(colors, metrics, icons, textStyles) +fun LinkStyle.Companion.light( + colors: LinkColors = LinkColors.light(), + metrics: LinkMetrics = LinkMetrics.defaults(), + icons: LinkIcons = LinkIcons.defaults(), + textStyles: LinkTextStyles = LinkTextStyles.light(), +) = LinkStyle(colors, metrics, icons, textStyles) @Composable -fun org.jetbrains.jewel.ui.component.styling.LinkStyle.Companion.dark( - colors: org.jetbrains.jewel.ui.component.styling.LinkColors = org.jetbrains.jewel.ui.component.styling.LinkColors.dark(), - metrics: org.jetbrains.jewel.ui.component.styling.LinkMetrics = org.jetbrains.jewel.ui.component.styling.LinkMetrics.defaults(), - icons: org.jetbrains.jewel.ui.component.styling.LinkIcons = org.jetbrains.jewel.ui.component.styling.LinkIcons.defaults(), - textStyles: org.jetbrains.jewel.ui.component.styling.LinkTextStyles = org.jetbrains.jewel.ui.component.styling.LinkTextStyles.dark(), -) = org.jetbrains.jewel.ui.component.styling.LinkStyle(colors, metrics, icons, textStyles) +fun LinkStyle.Companion.dark( + colors: LinkColors = LinkColors.dark(), + metrics: LinkMetrics = LinkMetrics.defaults(), + icons: LinkIcons = LinkIcons.defaults(), + textStyles: LinkTextStyles = LinkTextStyles.dark(), +) = LinkStyle(colors, metrics, icons, textStyles) @Composable -fun org.jetbrains.jewel.ui.component.styling.LinkColors.Companion.light( +fun LinkColors.Companion.light( content: Color = IntUiLightTheme.colors.blue(2), contentDisabled: Color = IntUiLightTheme.colors.grey(8), contentFocused: Color = content, contentPressed: Color = content, contentHovered: Color = content, contentVisited: Color = content, -) = org.jetbrains.jewel.ui.component.styling.LinkColors( +) = LinkColors( content, contentDisabled, contentFocused, @@ -49,14 +54,14 @@ fun org.jetbrains.jewel.ui.component.styling.LinkColors.Companion.light( ) @Composable -fun org.jetbrains.jewel.ui.component.styling.LinkColors.Companion.dark( +fun LinkColors.Companion.dark( content: Color = IntUiDarkTheme.colors.blue(9), contentDisabled: Color = IntUiDarkTheme.colors.grey(7), contentFocused: Color = content, contentPressed: Color = content, contentHovered: Color = content, contentVisited: Color = content, -) = org.jetbrains.jewel.ui.component.styling.LinkColors( +) = LinkColors( content, contentDisabled, contentFocused, @@ -65,35 +70,35 @@ fun org.jetbrains.jewel.ui.component.styling.LinkColors.Companion.dark( contentVisited, ) -fun org.jetbrains.jewel.ui.component.styling.LinkMetrics.Companion.defaults( +fun LinkMetrics.Companion.defaults( focusHaloCornerSize: CornerSize = CornerSize(2.dp), textIconGap: Dp = 0.dp, iconSize: DpSize = DpSize(16.dp, 16.dp), -) = org.jetbrains.jewel.ui.component.styling.LinkMetrics(focusHaloCornerSize, textIconGap, iconSize) +) = LinkMetrics(focusHaloCornerSize, textIconGap, iconSize) -fun org.jetbrains.jewel.ui.component.styling.LinkIcons.Companion.defaults( +fun LinkIcons.Companion.defaults( dropdownChevron: PainterProvider = standalonePainterProvider("expui/general/chevronDown.svg"), externalLink: PainterProvider = standalonePainterProvider("expui/ide/externalLink.svg"), -) = org.jetbrains.jewel.ui.component.styling.LinkIcons(dropdownChevron, externalLink) +) = LinkIcons(dropdownChevron, externalLink) @Composable -fun org.jetbrains.jewel.ui.component.styling.LinkTextStyles.Companion.light( +fun LinkTextStyles.Companion.light( normal: TextStyle = JewelTheme.defaultTextStyle.copy(textDecoration = TextDecoration.Underline), disabled: TextStyle = JewelTheme.defaultTextStyle, focused: TextStyle = normal, pressed: TextStyle = normal, hovered: TextStyle = normal, visited: TextStyle = normal, -): org.jetbrains.jewel.ui.component.styling.LinkTextStyles = - org.jetbrains.jewel.ui.component.styling.LinkTextStyles(normal, disabled, focused, pressed, hovered, visited) +): LinkTextStyles = + LinkTextStyles(normal, disabled, focused, pressed, hovered, visited) @Composable -fun org.jetbrains.jewel.ui.component.styling.LinkTextStyles.Companion.dark( +fun LinkTextStyles.Companion.dark( normal: TextStyle = JewelTheme.defaultTextStyle.copy(textDecoration = TextDecoration.Underline), disabled: TextStyle = JewelTheme.defaultTextStyle, focused: TextStyle = normal, pressed: TextStyle = normal, hovered: TextStyle = normal, visited: TextStyle = normal, -): org.jetbrains.jewel.ui.component.styling.LinkTextStyles = - org.jetbrains.jewel.ui.component.styling.LinkTextStyles(normal, disabled, focused, pressed, hovered, visited) +): LinkTextStyles = + LinkTextStyles(normal, disabled, focused, pressed, hovered, visited)