From f59fd7fe07b4ceaddf4114252c73da0b24c7adaa Mon Sep 17 00:00:00 2001 From: Sebastiano Poggi Date: Wed, 21 Feb 2024 05:42:00 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=80=20Rename=20`textStyle`=20->=20`def?= =?UTF-8?q?aultTextStyle`=20(#309)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update standalone bundled Inter font to 4.0 * Rename textStyle -> defaultTextStyle This makes the extension function on JewelTheme clearer in its intent of accessing the default TextStyle from the composition locals. The former defaultTextStyle has been transformed to a function, which is also making clearer it's a creation and not a field access. It has contextually been renamed to createDefaultTextStyle(). --- foundation/api/foundation.api | 1 + .../jewel/foundation/theme/JewelTheme.kt | 6 ++++ .../org/jetbrains/jewel/bridge/Typography.kt | 2 +- .../api/int-ui-standalone.api | 2 +- .../styling/IntUiDropdownStyling.kt | 10 +++---- .../standalone/styling/IntUiLinkStyling.kt | 10 +++---- .../styling/IntUiTextAreaStyling.kt | 6 ++-- .../styling/IntUiTextFieldStyling.kt | 6 ++-- .../intui/standalone/theme/IntUiTheme.kt | 8 ++--- .../view/markdown/MarkdownEditor.kt | 2 +- .../jetbrains/jewel/ui/component/Button.kt | 4 +-- .../jewel/ui/component/RadioButton.kt | 6 ++-- .../org/jetbrains/jewel/ui/component/Text.kt | 4 +-- .../jetbrains/jewel/ui/component/TextArea.kt | 4 +-- .../jetbrains/jewel/ui/component/TextField.kt | 2 +- .../jewel/ui/component/Typography.kt | 30 +++++++++---------- 16 files changed, 55 insertions(+), 48 deletions(-) diff --git a/foundation/api/foundation.api b/foundation/api/foundation.api index d32e6e6710..9e1343262e 100644 --- a/foundation/api/foundation.api +++ b/foundation/api/foundation.api @@ -751,6 +751,7 @@ public abstract interface class org/jetbrains/jewel/foundation/theme/JewelTheme public final class org/jetbrains/jewel/foundation/theme/JewelTheme$Companion { public final fun getContentColor (Landroidx/compose/runtime/Composer;I)J + public final fun getDefaultTextStyle (Landroidx/compose/runtime/Composer;I)Landroidx/compose/ui/text/TextStyle; public final fun getGlobalColors (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/foundation/GlobalColors; public final fun getGlobalMetrics (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/foundation/GlobalMetrics; public final fun getTextStyle (Landroidx/compose/runtime/Composer;I)Landroidx/compose/ui/text/TextStyle; diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/theme/JewelTheme.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/theme/JewelTheme.kt index cbfd661fac..47d9703b39 100644 --- a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/theme/JewelTheme.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/theme/JewelTheme.kt @@ -26,7 +26,13 @@ public interface JewelTheme { @ReadOnlyComposable get() = LocalGlobalMetrics.current + @Deprecated("Use defaultTextStyle instead", ReplaceWith("JewelTheme.defaultTextStyle"), DeprecationLevel.ERROR) public val textStyle: TextStyle + @Composable + @ReadOnlyComposable + get() = defaultTextStyle + + public val defaultTextStyle: TextStyle @Composable @ReadOnlyComposable get() = LocalTextStyle.current diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/Typography.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/Typography.kt index ef2be56f0f..e81f878850 100644 --- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/Typography.kt +++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/Typography.kt @@ -11,7 +11,7 @@ import org.jetbrains.jewel.ui.component.minus /** * The text style to use for regular text. Identical to - * [JewelTheme.textStyle]. + * [JewelTheme.defaultTextStyle]. * * Only available when running in the IntelliJ Platform. */ diff --git a/int-ui/int-ui-standalone/api/int-ui-standalone.api b/int-ui/int-ui-standalone/api/int-ui-standalone.api index 1967c2698f..e5a47847d7 100644 --- a/int-ui/int-ui-standalone/api/int-ui-standalone.api +++ b/int-ui/int-ui-standalone/api/int-ui-standalone.api @@ -333,10 +333,10 @@ public final class org/jetbrains/jewel/intui/standalone/theme/IntUiGlobalMetrics public final class org/jetbrains/jewel/intui/standalone/theme/IntUiThemeKt { public static final fun IntUiTheme (Lorg/jetbrains/jewel/foundation/theme/ThemeDefinition;Lorg/jetbrains/jewel/ui/ComponentStyling;ZLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V public static final fun IntUiTheme (ZZLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V + public static final fun createDefaultTextStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;)Landroidx/compose/ui/text/TextStyle; public static final fun dark (Lorg/jetbrains/jewel/ui/ComponentStyling;Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle;Lorg/jetbrains/jewel/ui/component/styling/ChipStyle;Lorg/jetbrains/jewel/ui/component/styling/CircularProgressStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lorg/jetbrains/jewel/ui/component/styling/LinkStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;Lorg/jetbrains/jewel/ui/component/styling/SliderStyle;Lorg/jetbrains/jewel/ui/component/styling/TextAreaStyle;Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle;Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Landroidx/compose/runtime/Composer;IIII)Lorg/jetbrains/jewel/ui/ComponentStyling; public static final fun darkThemeDefinition-RFMEUTM (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Lorg/jetbrains/jewel/foundation/GlobalColors;Lorg/jetbrains/jewel/foundation/GlobalMetrics;Lorg/jetbrains/jewel/foundation/theme/ThemeColorPalette;Lorg/jetbrains/jewel/foundation/theme/ThemeIconData;Landroidx/compose/ui/text/TextStyle;JLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/foundation/theme/ThemeDefinition; public static final fun default (Lorg/jetbrains/jewel/ui/ComponentStyling;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/ComponentStyling; - public static final fun getDefaultTextStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;)Landroidx/compose/ui/text/TextStyle; public static final fun light (Lorg/jetbrains/jewel/ui/ComponentStyling;Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle;Lorg/jetbrains/jewel/ui/component/styling/ChipStyle;Lorg/jetbrains/jewel/ui/component/styling/CircularProgressStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lorg/jetbrains/jewel/ui/component/styling/LinkStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;Lorg/jetbrains/jewel/ui/component/styling/SliderStyle;Lorg/jetbrains/jewel/ui/component/styling/TextAreaStyle;Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle;Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Landroidx/compose/runtime/Composer;IIII)Lorg/jetbrains/jewel/ui/ComponentStyling; public static final fun lightThemeDefinition-RFMEUTM (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Lorg/jetbrains/jewel/foundation/GlobalColors;Lorg/jetbrains/jewel/foundation/GlobalMetrics;Lorg/jetbrains/jewel/foundation/theme/ThemeColorPalette;Lorg/jetbrains/jewel/foundation/theme/ThemeIconData;Landroidx/compose/ui/text/TextStyle;JLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/foundation/theme/ThemeDefinition; } diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiDropdownStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiDropdownStyling.kt index dc600cfd7a..f777333b5a 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiDropdownStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiDropdownStyling.kt @@ -12,7 +12,7 @@ import org.jetbrains.jewel.foundation.theme.JewelTheme 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.intui.standalone.theme.createDefaultTextStyle import org.jetbrains.jewel.ui.component.styling.DropdownColors import org.jetbrains.jewel.ui.component.styling.DropdownIcons import org.jetbrains.jewel.ui.component.styling.DropdownMetrics @@ -30,7 +30,7 @@ public object IntUiDefaultDropdownStyleFactory { colors: DropdownColors = DropdownColors.Default.light(), metrics: DropdownMetrics = DropdownMetrics.default(), icons: DropdownIcons = DropdownIcons.defaults(), - textStyle: TextStyle = JewelTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.createDefaultTextStyle(), menuStyle: MenuStyle = MenuStyle.light(), ): DropdownStyle = DropdownStyle(colors, metrics, icons, textStyle, menuStyle) @@ -40,7 +40,7 @@ public object IntUiDefaultDropdownStyleFactory { colors: DropdownColors = DropdownColors.Default.dark(), metrics: DropdownMetrics = DropdownMetrics.default(), icons: DropdownIcons = DropdownIcons.defaults(), - textStyle: TextStyle = JewelTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.createDefaultTextStyle(), menuStyle: MenuStyle = MenuStyle.dark(), ): DropdownStyle = DropdownStyle(colors, metrics, icons, textStyle, menuStyle) @@ -56,7 +56,7 @@ public object IntUiUndecoratedDropdownStyleFactory { colors: DropdownColors = DropdownColors.Undecorated.light(), metrics: DropdownMetrics = DropdownMetrics.undecorated(), icons: DropdownIcons = DropdownIcons.defaults(), - textStyle: TextStyle = JewelTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.createDefaultTextStyle(), menuStyle: MenuStyle = MenuStyle.light(), ): DropdownStyle = DropdownStyle(colors, metrics, icons, textStyle, menuStyle) @@ -66,7 +66,7 @@ public object IntUiUndecoratedDropdownStyleFactory { colors: DropdownColors = DropdownColors.Undecorated.dark(), metrics: DropdownMetrics = DropdownMetrics.undecorated(), icons: DropdownIcons = DropdownIcons.defaults(), - textStyle: TextStyle = JewelTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.createDefaultTextStyle(), menuStyle: MenuStyle = MenuStyle.dark(), ): DropdownStyle = DropdownStyle(colors, metrics, icons, textStyle, menuStyle) 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 4e06d48fef..ee033f640c 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 @@ -12,7 +12,7 @@ import org.jetbrains.jewel.foundation.theme.JewelTheme 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.intui.standalone.theme.createDefaultTextStyle import org.jetbrains.jewel.ui.component.styling.LinkColors import org.jetbrains.jewel.ui.component.styling.LinkIcons import org.jetbrains.jewel.ui.component.styling.LinkMetrics @@ -89,8 +89,8 @@ public fun LinkIcons.Companion.defaults( @Composable public fun LinkTextStyles.Companion.light( - normal: TextStyle = JewelTheme.defaultTextStyle.copy(textDecoration = TextDecoration.Underline), - disabled: TextStyle = JewelTheme.defaultTextStyle, + normal: TextStyle = JewelTheme.createDefaultTextStyle().copy(textDecoration = TextDecoration.Underline), + disabled: TextStyle = JewelTheme.createDefaultTextStyle(), focused: TextStyle = normal, pressed: TextStyle = normal, hovered: TextStyle = normal, @@ -100,8 +100,8 @@ public fun LinkTextStyles.Companion.light( @Composable public fun LinkTextStyles.Companion.dark( - normal: TextStyle = JewelTheme.defaultTextStyle.copy(textDecoration = TextDecoration.Underline), - disabled: TextStyle = JewelTheme.defaultTextStyle, + normal: TextStyle = JewelTheme.createDefaultTextStyle().copy(textDecoration = TextDecoration.Underline), + disabled: TextStyle = JewelTheme.createDefaultTextStyle(), focused: TextStyle = normal, pressed: TextStyle = normal, hovered: TextStyle = normal, diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextAreaStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextAreaStyling.kt index 77bdeaeec9..b20e42ae58 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextAreaStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextAreaStyling.kt @@ -11,7 +11,7 @@ import androidx.compose.ui.unit.dp import org.jetbrains.jewel.foundation.theme.JewelTheme import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme -import org.jetbrains.jewel.intui.standalone.theme.defaultTextStyle +import org.jetbrains.jewel.intui.standalone.theme.createDefaultTextStyle import org.jetbrains.jewel.ui.component.styling.TextAreaColors import org.jetbrains.jewel.ui.component.styling.TextAreaMetrics import org.jetbrains.jewel.ui.component.styling.TextAreaStyle @@ -20,7 +20,7 @@ import org.jetbrains.jewel.ui.component.styling.TextAreaStyle public fun TextAreaStyle.Companion.light( colors: TextAreaColors = TextAreaColors.light(), metrics: TextAreaMetrics = TextAreaMetrics.defaults(), - textStyle: TextStyle = JewelTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.createDefaultTextStyle(), ): TextAreaStyle = TextAreaStyle(colors, metrics, textStyle) @@ -28,7 +28,7 @@ public fun TextAreaStyle.Companion.light( public fun TextAreaStyle.Companion.dark( colors: TextAreaColors = TextAreaColors.dark(), metrics: TextAreaMetrics = TextAreaMetrics.defaults(), - textStyle: TextStyle = JewelTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.createDefaultTextStyle(), ): TextAreaStyle = TextAreaStyle(colors, metrics, textStyle) diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextFieldStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextFieldStyling.kt index 7939f3c811..26aaea3495 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextFieldStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextFieldStyling.kt @@ -11,7 +11,7 @@ import androidx.compose.ui.unit.dp import org.jetbrains.jewel.foundation.theme.JewelTheme import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme -import org.jetbrains.jewel.intui.standalone.theme.defaultTextStyle +import org.jetbrains.jewel.intui.standalone.theme.createDefaultTextStyle import org.jetbrains.jewel.ui.component.styling.TextFieldColors import org.jetbrains.jewel.ui.component.styling.TextFieldMetrics import org.jetbrains.jewel.ui.component.styling.TextFieldStyle @@ -20,7 +20,7 @@ import org.jetbrains.jewel.ui.component.styling.TextFieldStyle public fun TextFieldStyle.Companion.light( colors: TextFieldColors = TextFieldColors.light(), metrics: TextFieldMetrics = TextFieldMetrics.defaults(), - textStyle: TextStyle = JewelTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.createDefaultTextStyle(), ): TextFieldStyle = TextFieldStyle(colors, metrics, textStyle) @@ -28,7 +28,7 @@ public fun TextFieldStyle.Companion.light( public fun TextFieldStyle.Companion.dark( colors: TextFieldColors = TextFieldColors.dark(), metrics: TextFieldMetrics = TextFieldMetrics.defaults(), - textStyle: TextStyle = JewelTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.createDefaultTextStyle(), ): TextFieldStyle = TextFieldStyle(colors, metrics, textStyle) diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt index 4fcecd1359..917d26083c 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt @@ -48,8 +48,8 @@ import org.jetbrains.jewel.ui.component.styling.TooltipStyle import org.jetbrains.jewel.ui.painter.LocalPainterHintsProvider import org.jetbrains.jewel.ui.theme.BaseJewelTheme -public val JewelTheme.Companion.defaultTextStyle: TextStyle - get() = TextStyle.Default.copy( +public fun JewelTheme.Companion.createDefaultTextStyle(): TextStyle = + TextStyle.Default.copy( fontFamily = FontFamily.Inter, fontSize = 13.sp, fontWeight = FontWeight.Normal, @@ -62,7 +62,7 @@ public fun JewelTheme.Companion.lightThemeDefinition( metrics: GlobalMetrics = GlobalMetrics.defaults(), palette: ThemeColorPalette = IntUiLightTheme.colors, iconData: ThemeIconData = IntUiLightTheme.iconData, - defaultTextStyle: TextStyle = JewelTheme.defaultTextStyle, + defaultTextStyle: TextStyle = JewelTheme.createDefaultTextStyle(), contentColor: Color = IntUiLightTheme.colors.grey(1), ): ThemeDefinition = ThemeDefinition(isDark = false, colors, metrics, defaultTextStyle, contentColor, palette, iconData) @@ -73,7 +73,7 @@ public fun JewelTheme.Companion.darkThemeDefinition( metrics: GlobalMetrics = GlobalMetrics.defaults(), palette: ThemeColorPalette = IntUiDarkTheme.colors, iconData: ThemeIconData = IntUiDarkTheme.iconData, - defaultTextStyle: TextStyle = JewelTheme.defaultTextStyle, + defaultTextStyle: TextStyle = JewelTheme.createDefaultTextStyle(), contentColor: Color = IntUiDarkTheme.colors.grey(12), ): ThemeDefinition = ThemeDefinition(isDark = true, colors, metrics, defaultTextStyle, contentColor, palette, iconData) diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/markdown/MarkdownEditor.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/markdown/MarkdownEditor.kt index 2ab6579ca7..2b1f473310 100644 --- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/markdown/MarkdownEditor.kt +++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/markdown/MarkdownEditor.kt @@ -121,7 +121,7 @@ private fun Editor( onMarkdownChange: (String) -> Unit, modifier: Modifier, ) { - val monospacedTextStyle = JewelTheme.textStyle.copy(fontFamily = FontFamily.Monospace) + val monospacedTextStyle = JewelTheme.defaultTextStyle.copy(fontFamily = FontFamily.Monospace) TextArea( value = currentMarkdown, diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Button.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Button.kt index 187b810df6..311c8a4ec3 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Button.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Button.kt @@ -49,7 +49,7 @@ public fun DefaultButton( enabled: Boolean = true, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, style: ButtonStyle = JewelTheme.defaultButtonStyle, - textStyle: TextStyle = JewelTheme.textStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, content: @Composable RowScope.() -> Unit, ) { ButtonImpl( @@ -70,7 +70,7 @@ public fun OutlinedButton( enabled: Boolean = true, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, style: ButtonStyle = JewelTheme.outlinedButtonStyle, - textStyle: TextStyle = JewelTheme.textStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, content: @Composable RowScope.() -> Unit, ) { ButtonImpl( diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/RadioButton.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/RadioButton.kt index e23d71d3ed..8aa2f12b2b 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/RadioButton.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/RadioButton.kt @@ -54,7 +54,7 @@ public fun RadioButton( outline: Outline = Outline.None, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, style: RadioButtonStyle = JewelTheme.radioButtonStyle, - textStyle: TextStyle = JewelTheme.textStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, ) { RadioButtonImpl( selected = selected, @@ -79,7 +79,7 @@ public fun RadioButtonRow( outline: Outline = Outline.None, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, style: RadioButtonStyle = JewelTheme.radioButtonStyle, - textStyle: TextStyle = JewelTheme.textStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, ) { RadioButtonImpl( selected = selected, @@ -104,7 +104,7 @@ public fun RadioButtonRow( outline: Outline = Outline.None, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, style: RadioButtonStyle = JewelTheme.radioButtonStyle, - textStyle: TextStyle = JewelTheme.textStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, content: @Composable RowScope.() -> Unit, ) { RadioButtonImpl( diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Text.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Text.kt index f79258d69a..9f007876a2 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Text.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Text.kt @@ -36,7 +36,7 @@ public fun Text( softWrap: Boolean = true, maxLines: Int = Int.MAX_VALUE, onTextLayout: (TextLayoutResult) -> Unit = {}, - style: TextStyle = JewelTheme.textStyle, + style: TextStyle = JewelTheme.defaultTextStyle, ) { Text( AnnotatedString(text), @@ -77,7 +77,7 @@ public fun Text( maxLines: Int = Int.MAX_VALUE, inlineContent: Map = emptyMap(), onTextLayout: (TextLayoutResult) -> Unit = {}, - style: TextStyle = JewelTheme.textStyle, + style: TextStyle = JewelTheme.defaultTextStyle, ) { val textColor = color.takeOrElse { LocalContentColor.current.takeOrElse { style.color } } diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/TextArea.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/TextArea.kt index 621da462de..45ff76812e 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/TextArea.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/TextArea.kt @@ -51,7 +51,7 @@ public fun TextArea( maxLines: Int = Int.MAX_VALUE, onTextLayout: (TextLayoutResult) -> Unit = {}, style: TextAreaStyle = JewelTheme.textAreaStyle, - textStyle: TextStyle = JewelTheme.textStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, ) { var textFieldValueState by remember { mutableStateOf(TextFieldValue(text = value)) } @@ -107,7 +107,7 @@ public fun TextArea( maxLines: Int = Int.MAX_VALUE, onTextLayout: (TextLayoutResult) -> Unit = {}, style: TextAreaStyle = JewelTheme.textAreaStyle, - textStyle: TextStyle = JewelTheme.textStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, ) { val minSize = style.metrics.minSize diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/TextField.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/TextField.kt index fdaac2a2b8..45ed6ebc61 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/TextField.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/TextField.kt @@ -109,7 +109,7 @@ public fun TextField( keyboardActions: KeyboardActions = KeyboardActions(), onTextLayout: (TextLayoutResult) -> Unit = {}, style: TextFieldStyle = JewelTheme.textFieldStyle, - textStyle: TextStyle = JewelTheme.textStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, ) { InputField( diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Typography.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Typography.kt index 1e99582ff3..ad78ae2a8b 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Typography.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Typography.kt @@ -11,61 +11,61 @@ import org.jetbrains.jewel.foundation.theme.JewelTheme /** * A quick way to obtain text styles derived from - * [the default `TextStyle`][JewelTheme.textStyle]. These match the + * [the default `TextStyle`][JewelTheme.defaultTextStyle]. These match the * functionality provided by `JBFont` in the IntelliJ Platform. */ public object Typography { - /** The text style to use for labels. Identical to [JewelTheme.textStyle]. */ + /** The text style to use for labels. Identical to [JewelTheme.defaultTextStyle]. */ @Composable - public fun labelTextStyle(): TextStyle = JewelTheme.textStyle + public fun labelTextStyle(): TextStyle = JewelTheme.defaultTextStyle /** * The text size to use for labels. Identical to the size set in - * [JewelTheme.textStyle]. + * [JewelTheme.defaultTextStyle]. */ @Composable - public fun labelTextSize(): TextUnit = JewelTheme.textStyle.fontSize + public fun labelTextSize(): TextUnit = JewelTheme.defaultTextStyle.fontSize /** * The text style to use for h0 titles. Derived from - * [JewelTheme.textStyle]. + * [JewelTheme.defaultTextStyle]. */ @Composable public fun h0TextStyle(): TextStyle = - JewelTheme.textStyle.copy(fontSize = labelTextSize() + 12.sp, fontWeight = FontWeight.Bold) + JewelTheme.defaultTextStyle.copy(fontSize = labelTextSize() + 12.sp, fontWeight = FontWeight.Bold) /** * The text style to use for h1 titles. Derived from - * [JewelTheme.textStyle]. + * [JewelTheme.defaultTextStyle]. */ @Composable public fun h1TextStyle(): TextStyle = - JewelTheme.textStyle.copy(fontSize = labelTextSize() + 9.sp, fontWeight = FontWeight.Bold) + JewelTheme.defaultTextStyle.copy(fontSize = labelTextSize() + 9.sp, fontWeight = FontWeight.Bold) /** * The text style to use for h2 titles. Derived from - * [JewelTheme.textStyle]. + * [JewelTheme.defaultTextStyle]. */ @Composable public fun h2TextStyle(): TextStyle = - JewelTheme.textStyle.copy(fontSize = labelTextSize() + 5.sp) + JewelTheme.defaultTextStyle.copy(fontSize = labelTextSize() + 5.sp) /** * The text style to use for h3 titles. Derived from - * [JewelTheme.textStyle]. + * [JewelTheme.defaultTextStyle]. */ @Composable public fun h3TextStyle(): TextStyle = - JewelTheme.textStyle.copy(fontSize = labelTextSize() + 3.sp) + JewelTheme.defaultTextStyle.copy(fontSize = labelTextSize() + 3.sp) /** * The text style to use for h4 titles. Derived from - * [JewelTheme.textStyle]. + * [JewelTheme.defaultTextStyle]. */ @Composable public fun h4TextStyle(): TextStyle = - JewelTheme.textStyle.copy(fontSize = labelTextSize() + 1.sp, fontWeight = FontWeight.Bold) + JewelTheme.defaultTextStyle.copy(fontSize = labelTextSize() + 1.sp, fontWeight = FontWeight.Bold) } public operator fun TextUnit.plus(other: TextUnit): TextUnit =