From f906232ed736f888e71b4f1f9d6cd2b70658a2ee Mon Sep 17 00:00:00 2001 From: Sebastiano Poggi Date: Fri, 20 Oct 2023 21:01:46 +0200 Subject: [PATCH] Fix issues --- .../org/jetbrains/jewel/bridge/IntUiBridge.kt | 4 +-- int-ui/int-ui-core/api/int-ui-core.api | 7 +++++ .../jewel/intui/core/styling/CommonMetrics.kt | 27 +++++++++++++++++++ .../api/int-ui-standalone.api | 4 --- .../standalone/styling/IntUiDividerStyle.kt | 8 +----- .../standalone/styling/IntUiTooltipStyling.kt | 19 +------------ 6 files changed, 38 insertions(+), 31 deletions(-) create mode 100644 int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/styling/CommonMetrics.kt diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/IntUiBridge.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/IntUiBridge.kt index 860b0d62c..3c633bd66 100644 --- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/IntUiBridge.kt +++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/IntUiBridge.kt @@ -23,7 +23,7 @@ import com.intellij.util.ui.NamedColorUtil import com.intellij.util.ui.StatusText import org.jetbrains.jewel.IntelliJComponentStyling import org.jetbrains.jewel.intui.core.IntUiThemeDefinition -import org.jetbrains.jewel.intui.standalone.styling.defaults +import org.jetbrains.jewel.intui.core.styling.defaults import org.jetbrains.jewel.styling.ButtonColors import org.jetbrains.jewel.styling.ButtonMetrics import org.jetbrains.jewel.styling.ButtonStyle @@ -436,7 +436,7 @@ private fun readUndecoratedDropdownStyle( DarculaUIUtil.MINIMUM_HEIGHT.dp, ), cornerSize = CornerSize(JBUI.CurrentTheme.MainToolbar.Dropdown.hoverArc().dp), - contentPadding = JBUI.CurrentTheme.MainToolbar.Dropdown.margin().toPaddingValues(), + contentPadding = JBUI.CurrentTheme.MainToolbar.Dropdown.borderInsets().toPaddingValues(), borderWidth = 0.dp, ), icons = DropdownIcons( diff --git a/int-ui/int-ui-core/api/int-ui-core.api b/int-ui/int-ui-core/api/int-ui-core.api index d153570ec..745aa713a 100644 --- a/int-ui/int-ui-core/api/int-ui-core.api +++ b/int-ui/int-ui-core/api/int-ui-core.api @@ -110,6 +110,13 @@ public final class org/jetbrains/jewel/intui/core/IntUiThemeDefinition : org/jet public fun toString ()Ljava/lang/String; } +public final class org/jetbrains/jewel/intui/core/styling/CommonMetricsKt { + public static final fun defaults-VpY3zN4 (Lorg/jetbrains/jewel/styling/DividerMetrics$Companion;FF)Lorg/jetbrains/jewel/styling/DividerMetrics; + public static synthetic fun defaults-VpY3zN4$default (Lorg/jetbrains/jewel/styling/DividerMetrics$Companion;FFILjava/lang/Object;)Lorg/jetbrains/jewel/styling/DividerMetrics; + public static final fun defaults-_3NXNO4 (Lorg/jetbrains/jewel/styling/TooltipMetrics$Companion;Landroidx/compose/foundation/layout/PaddingValues;JLandroidx/compose/foundation/shape/CornerSize;FFJLandroidx/compose/ui/Alignment$Horizontal;)Lorg/jetbrains/jewel/styling/TooltipMetrics; + public static synthetic fun defaults-_3NXNO4$default (Lorg/jetbrains/jewel/styling/TooltipMetrics$Companion;Landroidx/compose/foundation/layout/PaddingValues;JLandroidx/compose/foundation/shape/CornerSize;FFJLandroidx/compose/ui/Alignment$Horizontal;ILjava/lang/Object;)Lorg/jetbrains/jewel/styling/TooltipMetrics; +} + public final class org/jetbrains/jewel/intui/core/theme/IntUiDarkTheme : org/jetbrains/jewel/IntelliJThemeDescriptor { public static final field $stable I public static final field INSTANCE Lorg/jetbrains/jewel/intui/core/theme/IntUiDarkTheme; diff --git a/int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/styling/CommonMetrics.kt b/int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/styling/CommonMetrics.kt new file mode 100644 index 000000000..d0604b351 --- /dev/null +++ b/int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/styling/CommonMetrics.kt @@ -0,0 +1,27 @@ +package org.jetbrains.jewel.intui.core.styling + +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.shape.CornerSize +import androidx.compose.ui.Alignment +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.DpOffset +import androidx.compose.ui.unit.dp +import org.jetbrains.jewel.styling.DividerMetrics +import org.jetbrains.jewel.styling.TooltipMetrics +import kotlin.time.Duration +import kotlin.time.Duration.Companion.milliseconds + +fun TooltipMetrics.Companion.defaults( + contentPadding: PaddingValues = PaddingValues(vertical = 9.dp, horizontal = 12.dp), + showDelay: Duration = 0.milliseconds, + cornerSize: CornerSize = CornerSize(5.dp), + borderWidth: Dp = 1.dp, + shadowSize: Dp = 12.dp, + tooltipOffset: DpOffset = DpOffset(0.dp, 20.dp), + tooltipAlignment: Alignment.Horizontal = Alignment.Start, +) = TooltipMetrics(contentPadding, showDelay, cornerSize, borderWidth, shadowSize, tooltipOffset, tooltipAlignment) + +fun DividerMetrics.Companion.defaults( + thickness: Dp = 1.dp, + startIndent: Dp = 0.dp, +) = DividerMetrics(thickness, startIndent) 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 1bd14c54e..65ed058ba 100644 --- a/int-ui/int-ui-standalone/api/int-ui-standalone.api +++ b/int-ui/int-ui-standalone/api/int-ui-standalone.api @@ -207,8 +207,6 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDefaultTabS public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDividerStyleKt { public static final fun dark-3IgeMak (Lorg/jetbrains/jewel/styling/DividerStyle$Companion;JLorg/jetbrains/jewel/styling/DividerMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/styling/DividerStyle; - public static final fun defaults-VpY3zN4 (Lorg/jetbrains/jewel/styling/DividerMetrics$Companion;FF)Lorg/jetbrains/jewel/styling/DividerMetrics; - public static synthetic fun defaults-VpY3zN4$default (Lorg/jetbrains/jewel/styling/DividerMetrics$Companion;FFILjava/lang/Object;)Lorg/jetbrains/jewel/styling/DividerMetrics; public static final fun light-3IgeMak (Lorg/jetbrains/jewel/styling/DividerStyle$Companion;JLorg/jetbrains/jewel/styling/DividerMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/styling/DividerStyle; } @@ -394,8 +392,6 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiTextFieldSt public final class org/jetbrains/jewel/intui/standalone/styling/IntUiTooltipStylingKt { public static final fun dark (Lorg/jetbrains/jewel/styling/TooltipStyle$Companion;Lorg/jetbrains/jewel/styling/TooltipColors;Lorg/jetbrains/jewel/styling/TooltipMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/styling/TooltipStyle; public static final fun dark-zf8z9n0 (Lorg/jetbrains/jewel/styling/TooltipColors$Companion;JJJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/styling/TooltipColors; - public static final fun defaults-_3NXNO4 (Lorg/jetbrains/jewel/styling/TooltipMetrics$Companion;Landroidx/compose/foundation/layout/PaddingValues;JLandroidx/compose/foundation/shape/CornerSize;FFJLandroidx/compose/ui/Alignment$Horizontal;)Lorg/jetbrains/jewel/styling/TooltipMetrics; - public static synthetic fun defaults-_3NXNO4$default (Lorg/jetbrains/jewel/styling/TooltipMetrics$Companion;Landroidx/compose/foundation/layout/PaddingValues;JLandroidx/compose/foundation/shape/CornerSize;FFJLandroidx/compose/ui/Alignment$Horizontal;ILjava/lang/Object;)Lorg/jetbrains/jewel/styling/TooltipMetrics; public static final fun light (Lorg/jetbrains/jewel/styling/TooltipStyle$Companion;Lorg/jetbrains/jewel/styling/TooltipColors;Lorg/jetbrains/jewel/styling/TooltipMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/styling/TooltipStyle; public static final fun light-zf8z9n0 (Lorg/jetbrains/jewel/styling/TooltipColors$Companion;JJJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/styling/TooltipColors; } diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiDividerStyle.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiDividerStyle.kt index bfbd61389..0a22d2edc 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiDividerStyle.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiDividerStyle.kt @@ -2,8 +2,7 @@ package org.jetbrains.jewel.intui.standalone.styling import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.dp +import org.jetbrains.jewel.intui.core.styling.defaults import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme import org.jetbrains.jewel.styling.DividerMetrics @@ -20,8 +19,3 @@ fun DividerStyle.Companion.dark( color: Color = IntUiDarkTheme.colors.grey(1), metrics: DividerMetrics = DividerMetrics.defaults(), ) = DividerStyle(color, metrics) - -fun DividerMetrics.Companion.defaults( - thickness: Dp = 1.dp, - startIndent: Dp = 0.dp, -) = DividerMetrics(thickness, startIndent) diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTooltipStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTooltipStyling.kt index a8c396637..a71925f37 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTooltipStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTooltipStyling.kt @@ -1,20 +1,13 @@ package org.jetbrains.jewel.intui.standalone.styling -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.shape.CornerSize import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.DpOffset -import androidx.compose.ui.unit.dp +import org.jetbrains.jewel.intui.core.styling.defaults import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme import org.jetbrains.jewel.styling.TooltipColors import org.jetbrains.jewel.styling.TooltipMetrics import org.jetbrains.jewel.styling.TooltipStyle -import kotlin.time.Duration -import kotlin.time.Duration.Companion.milliseconds @Composable fun TooltipStyle.Companion.light( @@ -49,13 +42,3 @@ fun TooltipColors.Companion.dark( borderColor: Color = IntUiDarkTheme.colors.grey(3), shadow: Color = Color(0x66000000), // Not a palette color ) = TooltipColors(backgroundColor, contentColor, borderColor, shadow) - -fun TooltipMetrics.Companion.defaults( - contentPadding: PaddingValues = PaddingValues(vertical = 9.dp, horizontal = 12.dp), - showDelay: Duration = 0.milliseconds, - cornerSize: CornerSize = CornerSize(5.dp), - borderWidth: Dp = 1.dp, - shadowSize: Dp = 12.dp, - tooltipOffset: DpOffset = DpOffset(0.dp, 20.dp), - tooltipAlignment: Alignment.Horizontal = Alignment.Start, -) = TooltipMetrics(contentPadding, showDelay, cornerSize, borderWidth, shadowSize, tooltipOffset, tooltipAlignment)