diff --git a/foundation/api/foundation.api b/foundation/api/foundation.api index c63df0506..d32e6e671 100644 --- a/foundation/api/foundation.api +++ b/foundation/api/foundation.api @@ -843,3 +843,7 @@ public final class org/jetbrains/jewel/foundation/theme/ThemeIconData$Companion public final fun getEmpty ()Lorg/jetbrains/jewel/foundation/theme/ThemeIconData; } +public final class org/jetbrains/jewel/foundation/util/DebugKt { + public static final fun getInDebugMode ()Z +} + diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/util/Debug.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/util/Debug.kt similarity index 88% rename from ui/src/main/kotlin/org/jetbrains/jewel/ui/util/Debug.kt rename to foundation/src/main/kotlin/org/jetbrains/jewel/foundation/util/Debug.kt index 1dd91b0cd..c487b3bdc 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/util/Debug.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/util/Debug.kt @@ -1,4 +1,4 @@ -package org.jetbrains.jewel.ui.util +package org.jetbrains.jewel.foundation.util import org.jetbrains.jewel.foundation.InternalJewelApi diff --git a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/utils/Logger.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/util/Logger.kt similarity index 95% rename from foundation/src/main/kotlin/org/jetbrains/jewel/foundation/utils/Logger.kt rename to foundation/src/main/kotlin/org/jetbrains/jewel/foundation/util/Logger.kt index 5b9dda14a..44dbe0230 100644 --- a/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/utils/Logger.kt +++ b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/util/Logger.kt @@ -1,4 +1,4 @@ -package org.jetbrains.jewel.foundation.utils +package org.jetbrains.jewel.foundation.util internal enum class LogLevel(val color: String) { Trace("\u001b[38;5;33m"), diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgePainterHintsProvider.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgePainterHintsProvider.kt index d87425c58..9c2f2a750 100644 --- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgePainterHintsProvider.kt +++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgePainterHintsProvider.kt @@ -14,7 +14,7 @@ import org.jetbrains.jewel.ui.painter.hints.ColorBasedPaletteReplacement import org.jetbrains.jewel.ui.painter.hints.Dark import org.jetbrains.jewel.ui.painter.hints.HiDpi import org.jetbrains.jewel.ui.painter.hints.KeyBasedPaletteReplacement -import org.jetbrains.jewel.ui.util.inDebugMode +import org.jetbrains.jewel.foundation.util.inDebugMode import org.jetbrains.jewel.ui.util.toRgbaHexString /** diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/StandalonePainterHintsProvider.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/StandalonePainterHintsProvider.kt index 141afaadd..6c6204d58 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/StandalonePainterHintsProvider.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/StandalonePainterHintsProvider.kt @@ -11,7 +11,7 @@ import org.jetbrains.jewel.ui.painter.hints.Dark import org.jetbrains.jewel.ui.painter.hints.HiDpi import org.jetbrains.jewel.ui.painter.hints.KeyBasedPaletteReplacement import org.jetbrains.jewel.ui.painter.hints.PathOverride -import org.jetbrains.jewel.ui.util.inDebugMode +import org.jetbrains.jewel.foundation.util.inDebugMode /** Provides the default [PainterHint]s to use to load images. */ public class StandalonePainterHintsProvider( diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/ChipsAndTree.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/ChipsAndTree.kt index 8786b915b..9fddfb5e1 100644 --- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/ChipsAndTree.kt +++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/ChipsAndTree.kt @@ -44,7 +44,7 @@ import org.jetbrains.jewel.ui.component.ToggleableChip import org.jetbrains.jewel.ui.theme.colorPalette @Composable -@View(title = "ChipsAndTree", position = 11) +@View(title = "ChipsAndTree", position = 11, icon = "icons/showAsTree.svg") fun ChipsAndTree() { Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(16.dp)) { Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(8.dp)) { diff --git a/samples/standalone/src/main/resources/icons/showAsTree.svg b/samples/standalone/src/main/resources/icons/showAsTree.svg new file mode 100644 index 000000000..4d949713e --- /dev/null +++ b/samples/standalone/src/main/resources/icons/showAsTree.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/samples/standalone/src/main/resources/icons/showAsTree_dark.svg b/samples/standalone/src/main/resources/icons/showAsTree_dark.svg new file mode 100644 index 000000000..0ff8904a5 --- /dev/null +++ b/samples/standalone/src/main/resources/icons/showAsTree_dark.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/ui/api/ui.api b/ui/api/ui.api index e39190711..462ae6a42 100644 --- a/ui/api/ui.api +++ b/ui/api/ui.api @@ -2378,10 +2378,6 @@ public final class org/jetbrains/jewel/ui/util/ColorExtensionsKt { public static final fun toRgbaHexString-8_81llA (J)Ljava/lang/String; } -public final class org/jetbrains/jewel/ui/util/DebugKt { - public static final fun getInDebugMode ()Z -} - public final class org/jetbrains/jewel/ui/util/ModifierExtensionsKt { public static final fun thenIf (Landroidx/compose/ui/Modifier;ZLkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier; } diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/painter/ResourcePainterProvider.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/painter/ResourcePainterProvider.kt index 9a01b3cfa..77a427985 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/painter/ResourcePainterProvider.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/painter/ResourcePainterProvider.kt @@ -15,7 +15,7 @@ import androidx.compose.ui.res.loadImageBitmap import androidx.compose.ui.res.loadSvgPainter import androidx.compose.ui.res.loadXmlImageVector import androidx.compose.ui.unit.Density -import org.jetbrains.jewel.ui.util.inDebugMode +import org.jetbrains.jewel.foundation.util.inDebugMode import org.w3c.dom.Document import org.xml.sax.InputSource import java.io.IOException @@ -166,7 +166,7 @@ public class ResourcePainterProvider( loadSvgPainter(inputStream, scope) } }, - rememberAction = { remember(url, scope.density) { it } }, + paintAction = { it }, ) private fun patchSvg( @@ -205,7 +205,7 @@ public class ResourcePainterProvider( loadingAction = { resourceUrl -> resourceUrl.openStream().use { loadXmlImageVector(InputSource(it), scope) } }, - rememberAction = { rememberVectorPainter(it) }, + paintAction = { rememberVectorPainter(it) }, ) @Composable @@ -218,14 +218,14 @@ public class ResourcePainterProvider( val bitmap = resourceUrl.openStream().use { loadImageBitmap(it) } BitmapPainter(bitmap) }, - rememberAction = { remember(url, scope.density) { it } }, + paintAction = { it }, ) @Composable private fun tryLoadingResource( url: URL, loadingAction: (URL) -> T, - rememberAction: @Composable (T) -> Painter, + paintAction: @Composable (T) -> Painter, ): Painter { @Suppress("TooGenericExceptionCaught") // This is a last-resort fallback when icons fail to load val painter = @@ -241,7 +241,7 @@ public class ResourcePainterProvider( return errorPainter } - return rememberAction(painter) + return paintAction(painter) } private class Scope( diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/painter/hints/DarkAndStroke.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/painter/hints/DarkAndStroke.kt index d1c179703..4d0bb83fb 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/painter/hints/DarkAndStroke.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/painter/hints/DarkAndStroke.kt @@ -60,6 +60,19 @@ private class StrokeImpl(private val color: Color) : PainterSuffixHint(), Painte Color(0xFFF28C35), Color(0xFF955AE0), ) + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is StrokeImpl) return false + + if (color != other.color) return false + + return true + } + + override fun toString(): String = "Stroke(color=$color)" + + override fun hashCode(): Int = color.hashCode() } /**