diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..c981a3f3a --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,73 @@ +name: "CodeQL" + +on: + push: + branches: [ "main", "*" ] + pull_request: + branches: [ "main", "*" ] + schedule: + - cron: '21 15 * * 0' + +jobs: + analyze: + name: Analyze + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners + # Consider using larger runners for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} + permissions: + # required for all workflows + security-events: write + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + language: [ 'java-kotlin' ] + # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] + # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/foundation/api/foundation.api b/foundation/api/foundation.api index c63df0506..9e1343262 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; @@ -843,3 +844,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/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/theme/JewelTheme.kt b/foundation/src/main/kotlin/org/jetbrains/jewel/foundation/theme/JewelTheme.kt index cbfd661fa..47d9703b3 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/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/gradle.properties b/gradle.properties index 91b05be54..380f97d19 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,4 +7,4 @@ kotlin.stdlib.default.dependency=false kotlin.incremental.useClasspathSnapshot=false bridge.ijp.target=232 -jewel.release.version=0.14.1 +jewel.release.version=0.15.0 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4ebc2ea3c..f9875d160 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,10 +1,10 @@ [versions] commonmark = "0.21.0" -composeDesktop = "1.6.0-dev1397" +composeDesktop = "1.6.0-dev1440" detekt = "1.23.4" dokka = "1.8.20" idea = "232.10300.40" -ideaGradlePlugin = "1.17.0" +ideaGradlePlugin = "1.17.1" jna = "5.14.0" kotlin = "1.8.21" kotlinSarif = "0.4.0" 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 6f600491c..7c4e1e094 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 @@ -22,8 +22,8 @@ public class BridgePainterHintsProvider private constructor( @Composable override fun hints(path: String): List = buildList { - add(getPaletteHint(path)) add(BridgeOverride) + add(getPaletteHint(path)) add(HiDpi()) add(Dark(JewelTheme.isDark)) } 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 ef2be56f0..e81f87885 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/samples/ide-plugin/build.gradle.kts b/samples/ide-plugin/build.gradle.kts index ce2585cc3..6ee74b96a 100644 --- a/samples/ide-plugin/build.gradle.kts +++ b/samples/ide-plugin/build.gradle.kts @@ -17,7 +17,9 @@ repositories { maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") maven("https://www.jetbrains.com/intellij-repository/releases") maven("https://cache-redirector.jetbrains.com/intellij-dependencies") + google() mavenCentral() + } dependencies { diff --git a/ui/api/ui.api b/ui/api/ui.api index 499cc640e..6358a1ecb 100644 --- a/ui/api/ui.api +++ b/ui/api/ui.api @@ -737,7 +737,6 @@ public final class org/jetbrains/jewel/ui/component/TooltipPlacement : androidx/ public static final field $stable I public synthetic fun (JLandroidx/compose/ui/Alignment$Horizontal;Landroidx/compose/ui/unit/Density;FILkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (JLandroidx/compose/ui/Alignment$Horizontal;Landroidx/compose/ui/unit/Density;FLkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun positionProvider (Landroidx/compose/runtime/Composer;I)Landroidx/compose/ui/window/PopupPositionProvider; public fun positionProvider-9KIMszo (JLandroidx/compose/runtime/Composer;I)Landroidx/compose/ui/window/PopupPositionProvider; } @@ -2369,10 +2368,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/component/Button.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Button.kt index 187b810df..311c8a4ec 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 7c992493a..4e886b32b 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 f79258d69..9f007876a 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 621da462d..45ff76812 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 fdaac2a2b..45ed6ebc6 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/Tooltip.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Tooltip.kt index 5fd315955..c7766bb3d 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Tooltip.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Tooltip.kt @@ -89,13 +89,7 @@ public class TooltipPlacement( ) : TooltipPlacement { @Composable - @Suppress("OVERRIDE_DEPRECATION") - override fun positionProvider(): PopupPositionProvider { - error("Not supported") - } - - @Composable - override fun positionProvider(cursorPosition: Offset): PopupPositionProvider = + public override fun positionProvider(cursorPosition: Offset): PopupPositionProvider = rememberTooltipPositionProvider( cursorPosition = cursorPosition, contentOffset = contentOffset, 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 1e99582ff..ad78ae2a8 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 = 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..0c4a5c535 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 @@ -126,7 +126,7 @@ public class ResourcePainterProvider( when (extension) { "svg" -> createSvgPainter(chosenScope, url) "xml" -> createVectorDrawablePainter(chosenScope, url) - else -> createBitmapPainter(chosenScope, url) + else -> createBitmapPainter(url) } for (hint in scope.acceptedHints) { @@ -166,7 +166,7 @@ public class ResourcePainterProvider( loadSvgPainter(inputStream, scope) } }, - rememberAction = { remember(url, scope.density) { it } }, + paintAction = { it }, ) private fun patchSvg( @@ -205,12 +205,11 @@ public class ResourcePainterProvider( loadingAction = { resourceUrl -> resourceUrl.openStream().use { loadXmlImageVector(InputSource(it), scope) } }, - rememberAction = { rememberVectorPainter(it) }, + paintAction = { rememberVectorPainter(it) }, ) @Composable private fun createBitmapPainter( - scope: Scope, url: URL, ) = tryLoadingResource( url = url, @@ -218,14 +217,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 +240,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() } /**