diff --git a/ide-laf-bridge/api/ide-laf-bridge.api b/ide-laf-bridge/api/ide-laf-bridge.api index d83b24c50..f2f1d4194 100644 --- a/ide-laf-bridge/api/ide-laf-bridge.api +++ b/ide-laf-bridge/api/ide-laf-bridge.api @@ -15,6 +15,7 @@ public final class org/jetbrains/jewel/bridge/BridgePainterHintsProvider$Compani public final class org/jetbrains/jewel/bridge/BridgeResourceResolverKt { public static final fun bridgePainterProvider (Ljava/lang/String;)Lorg/jetbrains/jewel/ui/painter/ResourcePainterProvider; + public static final fun bridgePainterProvider (Lorg/jetbrains/jewel/ui/icon/IconKey;)Lorg/jetbrains/jewel/ui/painter/ResourcePainterProvider; } public final class org/jetbrains/jewel/bridge/BridgeUtilsKt { diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeResourceResolver.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeResourceResolver.kt index 58918c143..d960f6d4e 100644 --- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeResourceResolver.kt +++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeResourceResolver.kt @@ -1,11 +1,25 @@ package org.jetbrains.jewel.bridge import com.intellij.util.ui.DirProvider +import org.jetbrains.jewel.ui.icon.IconKey import org.jetbrains.jewel.ui.painter.ResourcePainterProvider /** - * [ResourcePainterProvider] to resolve resource in Intellij Module and + * [ResourcePainterProvider] to resolve resources in Intellij Module and * Bridge module. */ public fun bridgePainterProvider(path: String): ResourcePainterProvider = ResourcePainterProvider(path, DirProvider::class.java.classLoader, SwingBridgeService::class.java.classLoader) + +/** + * [ResourcePainterProvider] to resolve resources in Intellij Module and + * Bridge module. + */ +public fun bridgePainterProvider(iconKey: IconKey): ResourcePainterProvider { + val isNewUi = isNewUiTheme() + return ResourcePainterProvider( + iconKey.path(isNewUi), + DirProvider::class.java.classLoader, + SwingBridgeService::class.java.classLoader, + ) +} diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt index 869b78156..983f82f88 100644 --- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt +++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt @@ -26,7 +26,6 @@ import com.intellij.ui.JBColor import com.intellij.util.ui.DirProvider import com.intellij.util.ui.JBUI import com.intellij.util.ui.NamedColorUtil -import org.jetbrains.jewel.bridge.bridgePainterProvider import org.jetbrains.jewel.bridge.createVerticalBrush import org.jetbrains.jewel.bridge.dp import org.jetbrains.jewel.bridge.isNewUiTheme @@ -118,6 +117,8 @@ import org.jetbrains.jewel.ui.component.styling.TextFieldStyle import org.jetbrains.jewel.ui.component.styling.TooltipColors import org.jetbrains.jewel.ui.component.styling.TooltipMetrics import org.jetbrains.jewel.ui.component.styling.TooltipStyle +import org.jetbrains.jewel.ui.icon.PathIconKey +import org.jetbrains.jewel.ui.icons.AllIconsKeys import javax.swing.UIManager import kotlin.time.Duration.Companion.milliseconds @@ -378,7 +379,7 @@ private fun readCheckboxStyle(): CheckboxStyle { outlineSelectedFocusedSize = metrics.outlineSelectedFocusedSize, iconContentGap = metrics.iconContentGap, ), - icons = CheckboxIcons(checkbox = bridgePainterProvider("${iconsBasePath}checkBox.svg")), + icons = CheckboxIcons(checkbox = PathIconKey("${iconsBasePath}checkBox.svg")), ) } @@ -539,7 +540,7 @@ private fun readDefaultDropdownStyle( contentPadding = retrieveInsetsAsPaddingValues("ComboBox.padding"), borderWidth = DarculaUIUtil.LW.dp, ), - icons = DropdownIcons(chevronDown = bridgePainterProvider("general/chevron-down.svg")), + icons = DropdownIcons(chevronDown = AllIconsKeys.General.ChevronDown), textStyle = dropdownTextStyle, menuStyle = menuStyle, ) @@ -590,7 +591,7 @@ private fun readUndecoratedDropdownStyle( contentPadding = PaddingValues(3.dp), // from com.intellij.ide.ui.laf.darcula.ui.DarculaComboBoxUI.getDefaultComboBoxInsets borderWidth = 0.dp, ), - icons = DropdownIcons(chevronDown = bridgePainterProvider("general/chevron-down.svg")), + icons = DropdownIcons(chevronDown = AllIconsKeys.General.ChevronDown), textStyle = dropdownTextStyle, menuStyle = menuStyle, ) @@ -664,8 +665,8 @@ private fun readLinkStyle(linkTextStyle: TextStyle): LinkStyle { ), icons = LinkIcons( - dropdownChevron = bridgePainterProvider("general/chevron-down.svg"), - externalLink = bridgePainterProvider("ide/external_link_arrow.svg"), + dropdownChevron = AllIconsKeys.General.ChevronDown, + externalLink = AllIconsKeys.Ide.External_link_arrow, ), textStyles = LinkTextStyles( @@ -755,7 +756,7 @@ private fun readMenuStyle(): MenuStyle { ), submenuMetrics = SubmenuMetrics(offset = DpOffset(0.dp, (-8).dp)), ), - icons = MenuIcons(submenuChevron = bridgePainterProvider("general/chevron-right.svg")), + icons = MenuIcons(submenuChevron = AllIconsKeys.General.ChevronRight), ) } @@ -798,7 +799,7 @@ private fun readRadioButtonStyle(): RadioButtonStyle { retrieveIntAsDpOrUnspecified("RadioButton.textIconGap") .takeOrElse { metrics.iconContentGap }, ), - icons = RadioButtonIcons(radioButton = bridgePainterProvider("${iconsBasePath}radio.svg")), + icons = RadioButtonIcons(radioButton = PathIconKey("${iconsBasePath}radio.svg")), ) } @@ -976,11 +977,9 @@ private fun readLazyTreeStyle(): LazyTreeStyle { elementBackgroundSelectedFocused = selectedElementBackground, ) - val chevronCollapsed = bridgePainterProvider("general/chevron-right.svg") - val chevronExpanded = bridgePainterProvider("general/chevron-down.svg") - val leftIndent = retrieveIntAsDpOrUnspecified("Tree.leftChildIndent").takeOrElse { 7.dp } val rightIndent = retrieveIntAsDpOrUnspecified("Tree.rightChildIndent").takeOrElse { 11.dp } + return LazyTreeStyle( colors = colors, metrics = @@ -994,10 +993,10 @@ private fun readLazyTreeStyle(): LazyTreeStyle { ), icons = LazyTreeIcons( - chevronCollapsed = chevronCollapsed, - chevronExpanded = chevronExpanded, - chevronSelectedCollapsed = chevronCollapsed, - chevronSelectedExpanded = chevronExpanded, + chevronCollapsed = AllIconsKeys.General.ChevronRight, + chevronExpanded = AllIconsKeys.General.ChevronDown, + chevronSelectedCollapsed = AllIconsKeys.General.ChevronRight, + chevronSelectedExpanded = AllIconsKeys.General.ChevronDown, ), ) } @@ -1040,7 +1039,7 @@ private fun readDefaultTabStyle(): TabStyle { tabContentSpacing = 4.dp, tabHeight = retrieveIntAsDpOrUnspecified("TabbedPane.tabHeight").takeOrElse { 24.dp }, ), - icons = TabIcons(close = bridgePainterProvider("expui/general/closeSmall.svg")), + icons = TabIcons(close = AllIconsKeys.General.CloseSmall), contentAlpha = TabContentAlpha( iconNormal = 1f, @@ -1096,7 +1095,7 @@ private fun readEditorTabStyle(): TabStyle { retrieveIntAsDpOrUnspecified("TabbedPane.tabHeight") .takeOrElse { 24.dp }, ), - icons = TabIcons(close = bridgePainterProvider("expui/general/closeSmall.svg")), + icons = TabIcons(close = AllIconsKeys.General.CloseSmall), contentAlpha = TabContentAlpha( iconNormal = .7f, 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 f3870f959..771d94081 100644 --- a/int-ui/int-ui-standalone/api/int-ui-standalone.api +++ b/int-ui/int-ui-standalone/api/int-ui-standalone.api @@ -50,12 +50,12 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiButtonStyli } public final class org/jetbrains/jewel/intui/standalone/styling/IntUiCheckboxStylingKt { - public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/CheckboxIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/CheckboxIcons; + public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/CheckboxIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/CheckboxIcons; public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle$Companion;Lorg/jetbrains/jewel/ui/component/styling/CheckboxColors;Lorg/jetbrains/jewel/ui/component/styling/CheckboxMetrics;Lorg/jetbrains/jewel/ui/component/styling/CheckboxIcons;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle; public static final fun dark-GyCwops (Lorg/jetbrains/jewel/ui/component/styling/CheckboxColors$Companion;JJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/CheckboxColors; public static final fun defaults-xtx8w0A (Lorg/jetbrains/jewel/ui/component/styling/CheckboxMetrics$Companion;JLandroidx/compose/foundation/shape/CornerSize;Landroidx/compose/foundation/shape/CornerSize;Landroidx/compose/foundation/shape/CornerSize;Landroidx/compose/foundation/shape/CornerSize;JJJJF)Lorg/jetbrains/jewel/ui/component/styling/CheckboxMetrics; public static synthetic fun defaults-xtx8w0A$default (Lorg/jetbrains/jewel/ui/component/styling/CheckboxMetrics$Companion;JLandroidx/compose/foundation/shape/CornerSize;Landroidx/compose/foundation/shape/CornerSize;Landroidx/compose/foundation/shape/CornerSize;Landroidx/compose/foundation/shape/CornerSize;JJJJFILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/CheckboxMetrics; - public static final fun light (Lorg/jetbrains/jewel/ui/component/styling/CheckboxIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/CheckboxIcons; + public static final fun light (Lorg/jetbrains/jewel/ui/component/styling/CheckboxIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/CheckboxIcons; public static final fun light (Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle$Companion;Lorg/jetbrains/jewel/ui/component/styling/CheckboxColors;Lorg/jetbrains/jewel/ui/component/styling/CheckboxMetrics;Lorg/jetbrains/jewel/ui/component/styling/CheckboxIcons;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle; public static final fun light-GyCwops (Lorg/jetbrains/jewel/ui/component/styling/CheckboxColors$Companion;JJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/CheckboxColors; } @@ -128,8 +128,8 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDividerStyl public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDropdownStylingKt { public static final fun default-Sq-BF7M (Lorg/jetbrains/jewel/ui/component/styling/DropdownMetrics$Companion;JJLandroidx/compose/foundation/shape/CornerSize;Landroidx/compose/foundation/layout/PaddingValues;F)Lorg/jetbrains/jewel/ui/component/styling/DropdownMetrics; public static synthetic fun default-Sq-BF7M$default (Lorg/jetbrains/jewel/ui/component/styling/DropdownMetrics$Companion;JJLandroidx/compose/foundation/shape/CornerSize;Landroidx/compose/foundation/layout/PaddingValues;FILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/DropdownMetrics; - public static final fun defaults (Lorg/jetbrains/jewel/ui/component/styling/DropdownIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;)Lorg/jetbrains/jewel/ui/component/styling/DropdownIcons; - public static synthetic fun defaults$default (Lorg/jetbrains/jewel/ui/component/styling/DropdownIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/DropdownIcons; + public static final fun defaults (Lorg/jetbrains/jewel/ui/component/styling/DropdownIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;)Lorg/jetbrains/jewel/ui/component/styling/DropdownIcons; + public static synthetic fun defaults$default (Lorg/jetbrains/jewel/ui/component/styling/DropdownIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/DropdownIcons; public static final fun getDefault (Lorg/jetbrains/jewel/ui/component/styling/DropdownColors$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultDropdownColorsFactory; public static final fun getDefault (Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultDropdownStyleFactory; public static final fun getUndecorated (Lorg/jetbrains/jewel/ui/component/styling/DropdownColors$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiUndecoratedDropdownColorsFactory; @@ -184,8 +184,8 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiIconButtonS public final class org/jetbrains/jewel/intui/standalone/styling/IntUiLazyTreeStylingKt { public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle$Companion;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeColors;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeMetrics;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeIcons;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle; public static final fun dark-v1fvUNM (Lorg/jetbrains/jewel/ui/component/styling/LazyTreeColors$Companion;JJJJJJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/LazyTreeColors; - public static final fun defaults (Lorg/jetbrains/jewel/ui/component/styling/LazyTreeIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;Lorg/jetbrains/jewel/ui/painter/PainterProvider;Lorg/jetbrains/jewel/ui/painter/PainterProvider;Lorg/jetbrains/jewel/ui/painter/PainterProvider;)Lorg/jetbrains/jewel/ui/component/styling/LazyTreeIcons; - public static synthetic fun defaults$default (Lorg/jetbrains/jewel/ui/component/styling/LazyTreeIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;Lorg/jetbrains/jewel/ui/painter/PainterProvider;Lorg/jetbrains/jewel/ui/painter/PainterProvider;Lorg/jetbrains/jewel/ui/painter/PainterProvider;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/LazyTreeIcons; + public static final fun defaults (Lorg/jetbrains/jewel/ui/component/styling/LazyTreeIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/ui/icon/IconKey;)Lorg/jetbrains/jewel/ui/component/styling/LazyTreeIcons; + public static synthetic fun defaults$default (Lorg/jetbrains/jewel/ui/component/styling/LazyTreeIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/ui/icon/IconKey;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/LazyTreeIcons; public static final fun defaults-hRm7RI8 (Lorg/jetbrains/jewel/ui/component/styling/LazyTreeMetrics$Companion;FLandroidx/compose/foundation/shape/CornerSize;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/layout/PaddingValues;FF)Lorg/jetbrains/jewel/ui/component/styling/LazyTreeMetrics; public static synthetic fun defaults-hRm7RI8$default (Lorg/jetbrains/jewel/ui/component/styling/LazyTreeMetrics$Companion;FLandroidx/compose/foundation/shape/CornerSize;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/layout/PaddingValues;FFILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/LazyTreeMetrics; public static final fun light (Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle$Companion;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeColors;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeMetrics;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeIcons;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle; @@ -196,8 +196,8 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiLinkStyling public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/LinkStyle$Companion;Lorg/jetbrains/jewel/ui/component/styling/LinkColors;Lorg/jetbrains/jewel/ui/component/styling/LinkMetrics;Lorg/jetbrains/jewel/ui/component/styling/LinkIcons;Lorg/jetbrains/jewel/ui/component/styling/LinkTextStyles;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/LinkStyle; public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/LinkTextStyles$Companion;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/LinkTextStyles; public static final fun dark-dPtIKUs (Lorg/jetbrains/jewel/ui/component/styling/LinkColors$Companion;JJJJJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/LinkColors; - public static final fun defaults (Lorg/jetbrains/jewel/ui/component/styling/LinkIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;Lorg/jetbrains/jewel/ui/painter/PainterProvider;)Lorg/jetbrains/jewel/ui/component/styling/LinkIcons; - public static synthetic fun defaults$default (Lorg/jetbrains/jewel/ui/component/styling/LinkIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;Lorg/jetbrains/jewel/ui/painter/PainterProvider;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/LinkIcons; + public static final fun defaults (Lorg/jetbrains/jewel/ui/component/styling/LinkIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/ui/icon/IconKey;)Lorg/jetbrains/jewel/ui/component/styling/LinkIcons; + public static synthetic fun defaults$default (Lorg/jetbrains/jewel/ui/component/styling/LinkIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/ui/icon/IconKey;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/LinkIcons; public static final fun defaults-7dA9OmY (Lorg/jetbrains/jewel/ui/component/styling/LinkMetrics$Companion;Landroidx/compose/foundation/shape/CornerSize;FJ)Lorg/jetbrains/jewel/ui/component/styling/LinkMetrics; public static synthetic fun defaults-7dA9OmY$default (Lorg/jetbrains/jewel/ui/component/styling/LinkMetrics$Companion;Landroidx/compose/foundation/shape/CornerSize;FJILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/LinkMetrics; public static final fun light (Lorg/jetbrains/jewel/ui/component/styling/LinkStyle$Companion;Lorg/jetbrains/jewel/ui/component/styling/LinkColors;Lorg/jetbrains/jewel/ui/component/styling/LinkMetrics;Lorg/jetbrains/jewel/ui/component/styling/LinkIcons;Lorg/jetbrains/jewel/ui/component/styling/LinkTextStyles;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/LinkStyle; @@ -209,8 +209,8 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiMenuStyling public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/MenuStyle$Companion;Lorg/jetbrains/jewel/ui/component/styling/MenuColors;Lorg/jetbrains/jewel/ui/component/styling/MenuMetrics;Lorg/jetbrains/jewel/ui/component/styling/MenuIcons;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/MenuStyle; public static final fun dark-Jy8F4Js (Lorg/jetbrains/jewel/ui/component/styling/MenuColors$Companion;JJJLorg/jetbrains/jewel/ui/component/styling/MenuItemColors;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/MenuColors; public static final fun dark-a3tHFA8 (Lorg/jetbrains/jewel/ui/component/styling/MenuItemColors$Companion;JJJJJJJJJJJJJJJJJJJJJLandroidx/compose/runtime/Composer;IIII)Lorg/jetbrains/jewel/ui/component/styling/MenuItemColors; - public static final fun defaults (Lorg/jetbrains/jewel/ui/component/styling/MenuIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;)Lorg/jetbrains/jewel/ui/component/styling/MenuIcons; - public static synthetic fun defaults$default (Lorg/jetbrains/jewel/ui/component/styling/MenuIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/MenuIcons; + public static final fun defaults (Lorg/jetbrains/jewel/ui/component/styling/MenuIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;)Lorg/jetbrains/jewel/ui/component/styling/MenuIcons; + public static synthetic fun defaults$default (Lorg/jetbrains/jewel/ui/component/styling/MenuIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/MenuIcons; public static final fun defaults-BkVx2pU (Lorg/jetbrains/jewel/ui/component/styling/SubmenuMetrics$Companion;J)Lorg/jetbrains/jewel/ui/component/styling/SubmenuMetrics; public static synthetic fun defaults-BkVx2pU$default (Lorg/jetbrains/jewel/ui/component/styling/SubmenuMetrics$Companion;JILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/SubmenuMetrics; public static final fun defaults-ORMxH6s (Lorg/jetbrains/jewel/ui/component/styling/MenuMetrics$Companion;Landroidx/compose/foundation/shape/CornerSize;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/layout/PaddingValues;JFFLorg/jetbrains/jewel/ui/component/styling/MenuItemMetrics;Lorg/jetbrains/jewel/ui/component/styling/SubmenuMetrics;)Lorg/jetbrains/jewel/ui/component/styling/MenuMetrics; @@ -237,15 +237,15 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiOutlinedBut } public final class org/jetbrains/jewel/intui/standalone/styling/IntUiRadioButtonStylingKt { - public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons; + public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons; public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle$Companion;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonColors;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonMetrics;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle; - public static synthetic fun dark$default (Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons; + public static synthetic fun dark$default (Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons; public static final fun dark-dPtIKUs (Lorg/jetbrains/jewel/ui/component/styling/RadioButtonColors$Companion;JJJJJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonColors; public static final fun defaults-Wf7Cy8o (Lorg/jetbrains/jewel/ui/component/styling/RadioButtonMetrics$Companion;JJJJJF)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonMetrics; public static synthetic fun defaults-Wf7Cy8o$default (Lorg/jetbrains/jewel/ui/component/styling/RadioButtonMetrics$Companion;JJJJJFILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonMetrics; - public static final fun light (Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons; + public static final fun light (Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons; public static final fun light (Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle$Companion;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonColors;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonMetrics;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle; - public static synthetic fun light$default (Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons; + public static synthetic fun light$default (Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons; public static final fun light-dPtIKUs (Lorg/jetbrains/jewel/ui/component/styling/RadioButtonColors$Companion;JJJJJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonColors; } @@ -269,8 +269,8 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiSliderStyli public final class org/jetbrains/jewel/intui/standalone/styling/IntUiTabStylingKt { public static final fun default (Lorg/jetbrains/jewel/ui/component/styling/TabContentAlpha$Companion;FFFFFFFFFF)Lorg/jetbrains/jewel/ui/component/styling/TabContentAlpha; public static synthetic fun default$default (Lorg/jetbrains/jewel/ui/component/styling/TabContentAlpha$Companion;FFFFFFFFFFILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/TabContentAlpha; - public static final fun defaults (Lorg/jetbrains/jewel/ui/component/styling/TabIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;)Lorg/jetbrains/jewel/ui/component/styling/TabIcons; - public static synthetic fun defaults$default (Lorg/jetbrains/jewel/ui/component/styling/TabIcons$Companion;Lorg/jetbrains/jewel/ui/painter/PainterProvider;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/TabIcons; + public static final fun defaults (Lorg/jetbrains/jewel/ui/component/styling/TabIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;)Lorg/jetbrains/jewel/ui/component/styling/TabIcons; + public static synthetic fun defaults$default (Lorg/jetbrains/jewel/ui/component/styling/TabIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/TabIcons; public static final fun defaults-t6ZgxxQ (Lorg/jetbrains/jewel/ui/component/styling/TabMetrics$Companion;FLandroidx/compose/foundation/layout/PaddingValues;FFF)Lorg/jetbrains/jewel/ui/component/styling/TabMetrics; public static synthetic fun defaults-t6ZgxxQ$default (Lorg/jetbrains/jewel/ui/component/styling/TabMetrics$Companion;FLandroidx/compose/foundation/layout/PaddingValues;FFFILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/TabMetrics; public static final fun editor (Lorg/jetbrains/jewel/ui/component/styling/TabContentAlpha$Companion;FFFFFFFFFF)Lorg/jetbrains/jewel/ui/component/styling/TabContentAlpha; 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 65e0df634..335dfb643 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 @@ -8,12 +8,12 @@ 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.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 +import org.jetbrains.jewel.ui.icon.IconKey +import org.jetbrains.jewel.ui.icon.PathIconKey @Composable public fun CheckboxStyle.Companion.light( @@ -69,11 +69,9 @@ public fun CheckboxMetrics.Companion.defaults( ) @Composable -public fun CheckboxIcons.Companion.light( - checkbox: PainterProvider = standalonePainterProvider("com/intellij/ide/ui/laf/icons/intellij/checkBox.svg"), -): CheckboxIcons = CheckboxIcons(checkbox) +public fun CheckboxIcons.Companion.light(checkbox: IconKey = PathIconKey("com/intellij/ide/ui/laf/icons/intellij/checkBox.svg")): CheckboxIcons = + CheckboxIcons(checkbox) @Composable -public fun CheckboxIcons.Companion.dark( - checkbox: PainterProvider = standalonePainterProvider("com/intellij/ide/ui/laf/icons/darcula/checkBox.svg"), -): CheckboxIcons = CheckboxIcons(checkbox) +public fun CheckboxIcons.Companion.dark(checkbox: IconKey = PathIconKey("com/intellij/ide/ui/laf/icons/darcula/checkBox.svg")): CheckboxIcons = + CheckboxIcons(checkbox) 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 b314ce04a..b076d3a78 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 @@ -11,14 +11,14 @@ 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.standalonePainterProvider 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 import org.jetbrains.jewel.ui.component.styling.DropdownStyle import org.jetbrains.jewel.ui.component.styling.MenuStyle -import org.jetbrains.jewel.ui.painter.PainterProvider +import org.jetbrains.jewel.ui.icon.IconKey +import org.jetbrains.jewel.ui.icons.AllIconsKeys public val DropdownStyle.Companion.Default: IntUiDefaultDropdownStyleFactory get() = IntUiDefaultDropdownStyleFactory @@ -266,6 +266,4 @@ public fun DropdownMetrics.Companion.undecorated( borderWidth: Dp = 0.dp, ): DropdownMetrics = DropdownMetrics(arrowMinSize, minSize, cornerSize, contentPadding, borderWidth) -public fun DropdownIcons.Companion.defaults( - chevronDown: PainterProvider = standalonePainterProvider("expui/general/chevronDown.svg"), -): DropdownIcons = DropdownIcons(chevronDown) +public fun DropdownIcons.Companion.defaults(chevronDown: IconKey = AllIconsKeys.General.ChevronDown): DropdownIcons = DropdownIcons(chevronDown) diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLazyTreeStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLazyTreeStyling.kt index f1993f32f..2930a4891 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLazyTreeStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLazyTreeStyling.kt @@ -8,12 +8,12 @@ import androidx.compose.ui.unit.Dp 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.LazyTreeColors import org.jetbrains.jewel.ui.component.styling.LazyTreeIcons import org.jetbrains.jewel.ui.component.styling.LazyTreeMetrics import org.jetbrains.jewel.ui.component.styling.LazyTreeStyle -import org.jetbrains.jewel.ui.painter.PainterProvider +import org.jetbrains.jewel.ui.icon.IconKey +import org.jetbrains.jewel.ui.icons.AllIconsKeys @Composable public fun LazyTreeStyle.Companion.light( @@ -87,10 +87,10 @@ public fun LazyTreeMetrics.Companion.defaults( ) public fun LazyTreeIcons.Companion.defaults( - chevronCollapsed: PainterProvider = standalonePainterProvider("expui/general/chevronRight.svg"), - chevronExpanded: PainterProvider = standalonePainterProvider("expui/general/chevronDown.svg"), - chevronSelectedCollapsed: PainterProvider = chevronCollapsed, - chevronSelectedExpanded: PainterProvider = chevronExpanded, + chevronCollapsed: IconKey = AllIconsKeys.General.ChevronRight, + chevronExpanded: IconKey = AllIconsKeys.General.ChevronDown, + chevronSelectedCollapsed: IconKey = chevronCollapsed, + chevronSelectedExpanded: IconKey = chevronExpanded, ): LazyTreeIcons = LazyTreeIcons( chevronCollapsed, 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 00e1f7116..7323870aa 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 @@ -11,14 +11,14 @@ 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.standalonePainterProvider 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 import org.jetbrains.jewel.ui.component.styling.LinkStyle import org.jetbrains.jewel.ui.component.styling.LinkTextStyles -import org.jetbrains.jewel.ui.painter.PainterProvider +import org.jetbrains.jewel.ui.icon.IconKey +import org.jetbrains.jewel.ui.icons.AllIconsKeys @Composable public fun LinkStyle.Companion.light( @@ -79,8 +79,8 @@ public fun LinkMetrics.Companion.defaults( ): LinkMetrics = LinkMetrics(focusHaloCornerSize, textIconGap, iconSize) public fun LinkIcons.Companion.defaults( - dropdownChevron: PainterProvider = standalonePainterProvider("expui/general/chevronDown.svg"), - externalLink: PainterProvider = standalonePainterProvider("expui/ide/externalLink.svg"), + dropdownChevron: IconKey = AllIconsKeys.General.ChevronDown, + externalLink: IconKey = AllIconsKeys.Ide.External_link_arrow, ): LinkIcons = LinkIcons(dropdownChevron, externalLink) @Composable diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiMenuStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiMenuStyling.kt index e3f18d7b8..d0ba2058a 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiMenuStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiMenuStyling.kt @@ -9,7 +9,6 @@ import androidx.compose.ui.unit.DpOffset 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.MenuColors import org.jetbrains.jewel.ui.component.styling.MenuIcons import org.jetbrains.jewel.ui.component.styling.MenuItemColors @@ -17,7 +16,8 @@ import org.jetbrains.jewel.ui.component.styling.MenuItemMetrics import org.jetbrains.jewel.ui.component.styling.MenuMetrics import org.jetbrains.jewel.ui.component.styling.MenuStyle import org.jetbrains.jewel.ui.component.styling.SubmenuMetrics -import org.jetbrains.jewel.ui.painter.PainterProvider +import org.jetbrains.jewel.ui.icon.IconKey +import org.jetbrains.jewel.ui.icons.AllIconsKeys @Composable public fun MenuStyle.Companion.light( @@ -203,5 +203,4 @@ public fun MenuItemMetrics.Companion.defaults( public fun SubmenuMetrics.Companion.defaults(offset: DpOffset = DpOffset(0.dp, (-8).dp)): SubmenuMetrics = SubmenuMetrics(offset) -public fun MenuIcons.Companion.defaults(submenuChevron: PainterProvider = standalonePainterProvider("expui/general/chevronRight.svg")): MenuIcons = - MenuIcons(submenuChevron) +public fun MenuIcons.Companion.defaults(submenuChevron: IconKey = AllIconsKeys.General.ChevronRight): MenuIcons = MenuIcons(submenuChevron) diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiRadioButtonStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiRadioButtonStyling.kt index 3d45a0e12..e837e9656 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiRadioButtonStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiRadioButtonStyling.kt @@ -7,12 +7,12 @@ 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.intui.standalone.standalonePainterProvider import org.jetbrains.jewel.ui.component.styling.RadioButtonColors import org.jetbrains.jewel.ui.component.styling.RadioButtonIcons import org.jetbrains.jewel.ui.component.styling.RadioButtonMetrics import org.jetbrains.jewel.ui.component.styling.RadioButtonStyle -import org.jetbrains.jewel.ui.painter.PainterProvider +import org.jetbrains.jewel.ui.icon.IconKey +import org.jetbrains.jewel.ui.icon.PathIconKey @Composable public fun RadioButtonStyle.Companion.light( @@ -82,11 +82,8 @@ public fun RadioButtonMetrics.Companion.defaults( ) public fun RadioButtonIcons.Companion.light( - radioButton: PainterProvider = - standalonePainterProvider("com/intellij/ide/ui/laf/icons/intellij/radio.svg"), + radioButton: IconKey = PathIconKey("com/intellij/ide/ui/laf/icons/intellij/radio.svg"), ): RadioButtonIcons = RadioButtonIcons(radioButton) -public fun RadioButtonIcons.Companion.dark( - radioButton: PainterProvider = - standalonePainterProvider("com/intellij/ide/ui/laf/icons/darcula/radio.svg"), -): RadioButtonIcons = RadioButtonIcons(radioButton) +public fun RadioButtonIcons.Companion.dark(radioButton: IconKey = PathIconKey("com/intellij/ide/ui/laf/icons/darcula/radio.svg")): RadioButtonIcons = + RadioButtonIcons(radioButton) diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTabStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTabStyling.kt index d42e758ff..4984b19f9 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTabStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTabStyling.kt @@ -7,13 +7,13 @@ import androidx.compose.ui.unit.Dp 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.TabColors import org.jetbrains.jewel.ui.component.styling.TabContentAlpha import org.jetbrains.jewel.ui.component.styling.TabIcons import org.jetbrains.jewel.ui.component.styling.TabMetrics import org.jetbrains.jewel.ui.component.styling.TabStyle -import org.jetbrains.jewel.ui.painter.PainterProvider +import org.jetbrains.jewel.ui.icon.IconKey +import org.jetbrains.jewel.ui.icons.AllIconsKeys public val TabStyle.Companion.Default: IntUiDefaultTabStyleFactory get() = IntUiDefaultTabStyleFactory @@ -265,4 +265,4 @@ public fun TabContentAlpha.Companion.editor( contentSelected = contentSelected, ) -public fun TabIcons.Companion.defaults(close: PainterProvider = standalonePainterProvider("expui/general/closeSmall.svg")): TabIcons = TabIcons(close) +public fun TabIcons.Companion.defaults(close: IconKey = AllIconsKeys.General.CloseSmall): TabIcons = TabIcons(close) diff --git a/samples/standalone/build.gradle.kts b/samples/standalone/build.gradle.kts index bf4fd0415..4fa8e48bf 100644 --- a/samples/standalone/build.gradle.kts +++ b/samples/standalone/build.gradle.kts @@ -21,6 +21,18 @@ dependencies { implementation(libs.intellijPlatform.icons) } +java { + toolchain { + vendor = JvmVendorSpec.JETBRAINS + } +} + +kotlin { + jvmToolchain { + vendor = JvmVendorSpec.JETBRAINS + } +} + compose.desktop { application { mainClass = "org.jetbrains.jewel.samples.standalone.MainKt" diff --git a/ui/api/ui.api b/ui/api/ui.api index abba627f4..6468be5e1 100644 --- a/ui/api/ui.api +++ b/ui/api/ui.api @@ -344,10 +344,11 @@ public final class org/jetbrains/jewel/ui/component/IconKt { public static final fun Icon (Landroidx/compose/ui/graphics/painter/Painter;Ljava/lang/String;Landroidx/compose/ui/graphics/ColorFilter;Landroidx/compose/ui/Modifier;Landroidx/compose/runtime/Composer;II)V public static final fun Icon (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;Landroidx/compose/ui/graphics/ColorFilter;Landroidx/compose/ui/Modifier;Lorg/jetbrains/jewel/ui/painter/PainterHint;Landroidx/compose/runtime/Composer;II)V public static final fun Icon (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;Landroidx/compose/ui/graphics/ColorFilter;Landroidx/compose/ui/Modifier;[Lorg/jetbrains/jewel/ui/painter/PainterHint;Landroidx/compose/runtime/Composer;II)V + public static final fun Icon (Lorg/jetbrains/jewel/ui/icon/IconKey;Ljava/lang/String;Landroidx/compose/ui/Modifier;Ljava/lang/Class;Landroidx/compose/ui/graphics/ColorFilter;Lorg/jetbrains/jewel/ui/painter/PainterHint;Landroidx/compose/runtime/Composer;II)V public static final fun Icon-FHprtrg (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;Landroidx/compose/ui/Modifier;JLorg/jetbrains/jewel/ui/painter/PainterHint;Landroidx/compose/runtime/Composer;II)V public static final fun Icon-FHprtrg (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;Landroidx/compose/ui/Modifier;J[Lorg/jetbrains/jewel/ui/painter/PainterHint;Landroidx/compose/runtime/Composer;II)V - public static final fun Icon-FHprtrg (Lorg/jetbrains/jewel/ui/icon/IconKey;Ljava/lang/String;Ljava/lang/Class;Landroidx/compose/ui/Modifier;JLorg/jetbrains/jewel/ui/painter/PainterHint;Landroidx/compose/runtime/Composer;II)V - public static final fun Icon-FHprtrg (Lorg/jetbrains/jewel/ui/icon/IconKey;Ljava/lang/String;Ljava/lang/Class;Landroidx/compose/ui/Modifier;J[Lorg/jetbrains/jewel/ui/painter/PainterHint;Landroidx/compose/runtime/Composer;II)V + public static final fun Icon-FHprtrg (Lorg/jetbrains/jewel/ui/icon/IconKey;Ljava/lang/String;Landroidx/compose/ui/Modifier;Ljava/lang/Class;JLorg/jetbrains/jewel/ui/painter/PainterHint;Landroidx/compose/runtime/Composer;II)V + public static final fun Icon-FHprtrg (Lorg/jetbrains/jewel/ui/icon/IconKey;Ljava/lang/String;Landroidx/compose/ui/Modifier;Ljava/lang/Class;J[Lorg/jetbrains/jewel/ui/painter/PainterHint;Landroidx/compose/runtime/Composer;II)V public static final fun Icon-ww6aTOc (Landroidx/compose/ui/graphics/ImageBitmap;Ljava/lang/String;Landroidx/compose/ui/Modifier;JLandroidx/compose/runtime/Composer;II)V public static final fun Icon-ww6aTOc (Landroidx/compose/ui/graphics/painter/Painter;Ljava/lang/String;Landroidx/compose/ui/Modifier;JLandroidx/compose/runtime/Composer;II)V public static final fun Icon-ww6aTOc (Landroidx/compose/ui/graphics/vector/ImageVector;Ljava/lang/String;Landroidx/compose/ui/Modifier;JLandroidx/compose/runtime/Composer;II)V @@ -852,9 +853,9 @@ public final class org/jetbrains/jewel/ui/component/styling/CheckboxColors$Compa public final class org/jetbrains/jewel/ui/component/styling/CheckboxIcons { public static final field $stable I public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/CheckboxIcons$Companion; - public fun (Lorg/jetbrains/jewel/ui/painter/PainterProvider;)V + public fun (Lorg/jetbrains/jewel/ui/icon/IconKey;)V public fun equals (Ljava/lang/Object;)Z - public final fun getCheckbox ()Lorg/jetbrains/jewel/ui/painter/PainterProvider; + public final fun getCheckbox ()Lorg/jetbrains/jewel/ui/icon/IconKey; public fun hashCode ()I public fun toString ()Ljava/lang/String; } @@ -1072,9 +1073,9 @@ public final class org/jetbrains/jewel/ui/component/styling/DropdownColors$Compa public final class org/jetbrains/jewel/ui/component/styling/DropdownIcons { public static final field $stable I public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/DropdownIcons$Companion; - public fun (Lorg/jetbrains/jewel/ui/painter/PainterProvider;)V + public fun (Lorg/jetbrains/jewel/ui/icon/IconKey;)V public fun equals (Ljava/lang/Object;)Z - public final fun getChevronDown ()Lorg/jetbrains/jewel/ui/painter/PainterProvider; + public final fun getChevronDown ()Lorg/jetbrains/jewel/ui/icon/IconKey; public fun hashCode ()I public fun toString ()Ljava/lang/String; } @@ -1350,13 +1351,13 @@ public final class org/jetbrains/jewel/ui/component/styling/LazyTreeColors$Compa public final class org/jetbrains/jewel/ui/component/styling/LazyTreeIcons { public static final field $stable I public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/LazyTreeIcons$Companion; - public fun (Lorg/jetbrains/jewel/ui/painter/PainterProvider;Lorg/jetbrains/jewel/ui/painter/PainterProvider;Lorg/jetbrains/jewel/ui/painter/PainterProvider;Lorg/jetbrains/jewel/ui/painter/PainterProvider;)V - public final fun chevron (ZZLandroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/painter/PainterProvider; + public fun (Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/ui/icon/IconKey;)V + public final fun chevron (ZZLandroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/icon/IconKey; public fun equals (Ljava/lang/Object;)Z - public final fun getChevronCollapsed ()Lorg/jetbrains/jewel/ui/painter/PainterProvider; - public final fun getChevronExpanded ()Lorg/jetbrains/jewel/ui/painter/PainterProvider; - public final fun getChevronSelectedCollapsed ()Lorg/jetbrains/jewel/ui/painter/PainterProvider; - public final fun getChevronSelectedExpanded ()Lorg/jetbrains/jewel/ui/painter/PainterProvider; + public final fun getChevronCollapsed ()Lorg/jetbrains/jewel/ui/icon/IconKey; + public final fun getChevronExpanded ()Lorg/jetbrains/jewel/ui/icon/IconKey; + public final fun getChevronSelectedCollapsed ()Lorg/jetbrains/jewel/ui/icon/IconKey; + public final fun getChevronSelectedExpanded ()Lorg/jetbrains/jewel/ui/icon/IconKey; public fun hashCode ()I public fun toString ()Ljava/lang/String; } @@ -1423,10 +1424,10 @@ public final class org/jetbrains/jewel/ui/component/styling/LinkColors$Companion public final class org/jetbrains/jewel/ui/component/styling/LinkIcons { public static final field $stable I public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/LinkIcons$Companion; - public fun (Lorg/jetbrains/jewel/ui/painter/PainterProvider;Lorg/jetbrains/jewel/ui/painter/PainterProvider;)V + public fun (Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/ui/icon/IconKey;)V public fun equals (Ljava/lang/Object;)Z - public final fun getDropdownChevron ()Lorg/jetbrains/jewel/ui/painter/PainterProvider; - public final fun getExternalLink ()Lorg/jetbrains/jewel/ui/painter/PainterProvider; + public final fun getDropdownChevron ()Lorg/jetbrains/jewel/ui/icon/IconKey; + public final fun getExternalLink ()Lorg/jetbrains/jewel/ui/icon/IconKey; public fun hashCode ()I public fun toString ()Ljava/lang/String; } @@ -1507,9 +1508,9 @@ public final class org/jetbrains/jewel/ui/component/styling/MenuColors$Companion public final class org/jetbrains/jewel/ui/component/styling/MenuIcons { public static final field $stable I public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/MenuIcons$Companion; - public fun (Lorg/jetbrains/jewel/ui/painter/PainterProvider;)V + public fun (Lorg/jetbrains/jewel/ui/icon/IconKey;)V public fun equals (Ljava/lang/Object;)Z - public final fun getSubmenuChevron ()Lorg/jetbrains/jewel/ui/painter/PainterProvider; + public final fun getSubmenuChevron ()Lorg/jetbrains/jewel/ui/icon/IconKey; public fun hashCode ()I public fun toString ()Ljava/lang/String; } @@ -1637,9 +1638,9 @@ public final class org/jetbrains/jewel/ui/component/styling/RadioButtonColors$Co public final class org/jetbrains/jewel/ui/component/styling/RadioButtonIcons { public static final field $stable I public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/RadioButtonIcons$Companion; - public fun (Lorg/jetbrains/jewel/ui/painter/PainterProvider;)V + public fun (Lorg/jetbrains/jewel/ui/icon/IconKey;)V public fun equals (Ljava/lang/Object;)Z - public final fun getRadioButton ()Lorg/jetbrains/jewel/ui/painter/PainterProvider; + public final fun getRadioButton ()Lorg/jetbrains/jewel/ui/icon/IconKey; public fun hashCode ()I public fun toString ()Ljava/lang/String; } @@ -1870,9 +1871,9 @@ public final class org/jetbrains/jewel/ui/component/styling/TabContentAlpha$Comp public final class org/jetbrains/jewel/ui/component/styling/TabIcons { public static final field $stable I public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/TabIcons$Companion; - public fun (Lorg/jetbrains/jewel/ui/painter/PainterProvider;)V + public fun (Lorg/jetbrains/jewel/ui/icon/IconKey;)V public fun equals (Ljava/lang/Object;)Z - public final fun getClose ()Lorg/jetbrains/jewel/ui/painter/PainterProvider; + public final fun getClose ()Lorg/jetbrains/jewel/ui/icon/IconKey; public fun hashCode ()I public fun toString ()Ljava/lang/String; } @@ -3786,6 +3787,7 @@ public final class org/jetbrains/jewel/ui/painter/ResourcePainterProvider : org/ public final class org/jetbrains/jewel/ui/painter/ResourcePainterProviderKt { public static final fun rememberResourcePainterProvider (Ljava/lang/String;Ljava/lang/Class;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/painter/PainterProvider; + public static final fun rememberResourcePainterProvider (Lorg/jetbrains/jewel/ui/icon/IconKey;Ljava/lang/Class;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/painter/PainterProvider; } public abstract interface class org/jetbrains/jewel/ui/painter/ResourcePainterProviderScope : org/jetbrains/jewel/ui/painter/PainterProviderScope { diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Checkbox.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Checkbox.kt index 8e4151873..e42bbf66a 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Checkbox.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Checkbox.kt @@ -52,6 +52,7 @@ import org.jetbrains.jewel.ui.painter.PainterProviderScope import org.jetbrains.jewel.ui.painter.PainterSuffixHint import org.jetbrains.jewel.ui.painter.hints.Selected import org.jetbrains.jewel.ui.painter.hints.Stateful +import org.jetbrains.jewel.ui.painter.rememberResourcePainterProvider import org.jetbrains.jewel.ui.theme.checkboxStyle @Composable @@ -311,7 +312,8 @@ private fun CheckboxImpl( alignment = Stroke.Alignment.Center, ) - val checkboxPainter by icons.checkbox.getPainter( + val painterProvider = rememberResourcePainterProvider(icons.checkbox) + val checkboxPainter by painterProvider.getPainter( if (checkboxState.toggleableState == ToggleableState.Indeterminate) { CheckBoxIndeterminate } else { diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Dropdown.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Dropdown.kt index 65d570edb..b73d7fba3 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Dropdown.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Dropdown.kt @@ -134,11 +134,11 @@ public fun Dropdown( modifier = Modifier.size(arrowMinSize).align(Alignment.CenterEnd), contentAlignment = Alignment.Center, ) { - val chevronIcon by style.icons.chevronDown.getPainter(Stateful(dropdownState)) Icon( - painter = chevronIcon, + key = style.icons.chevronDown, contentDescription = null, tint = colors.iconTintFor(dropdownState).value, + hint = Stateful(dropdownState) ) } } diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Icon.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Icon.kt index ac6062cf5..a3646b899 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Icon.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Icon.kt @@ -124,8 +124,8 @@ public fun Icon( public fun Icon( key: IconKey, contentDescription: String?, - iconClass: Class<*>, modifier: Modifier = Modifier, + iconClass: Class<*> = key::class.java, tint: Color = Color.Unspecified, vararg hints: PainterHint, ) { @@ -138,8 +138,8 @@ public fun Icon( public fun Icon( key: IconKey, contentDescription: String?, - iconClass: Class<*>, modifier: Modifier = Modifier, + iconClass: Class<*> = key::class.java, tint: Color = Color.Unspecified, hint: PainterHint, ) { @@ -148,18 +148,32 @@ public fun Icon( Icon(path, contentDescription, iconClass, modifier, tint, hint) } +@Composable +public fun Icon( + key: IconKey, + contentDescription: String?, + modifier: Modifier = Modifier, + iconClass: Class<*> = key::class.java, + colorFilter: ColorFilter?, + hint: PainterHint, +) { + val isNewUi = JewelTheme.newUiChecker.isNewUi() + val path = remember(key, isNewUi) { key.path(isNewUi) } + Icon(path, contentDescription, iconClass, colorFilter, modifier, hint) +} + /** * Icon component that draws [imageVector] using [tint], defaulting to * [Color.Unspecified]. * * @param imageVector [ImageVector] to draw inside this Icon * @param contentDescription text used by accessibility services to - * describe what this icon represents. This should always be provided - * unless this icon is used for decorative purposes, and does not - * represent a meaningful action that a user can take. + * describe what this icon represents. This should always be provided + * unless this icon is used for decorative purposes, and does not + * represent a meaningful action that a user can take. * @param modifier optional [Modifier] for this Icon * @param tint tint to be applied to [imageVector]. If [Color.Unspecified] - * is provided, then no tint is applied + * is provided, then no tint is applied */ @Composable public fun Icon( @@ -182,12 +196,12 @@ public fun Icon( * * @param bitmap [ImageBitmap] to draw inside this Icon * @param contentDescription text used by accessibility services to - * describe what this icon represents. This should always be provided - * unless this icon is used for decorative purposes, and does not - * represent a meaningful action that a user can take. + * describe what this icon represents. This should always be provided + * unless this icon is used for decorative purposes, and does not + * represent a meaningful action that a user can take. * @param modifier optional [Modifier] for this Icon * @param tint tint to be applied to [bitmap]. If [Color.Unspecified] is - * provided, then no tint is applied + * provided, then no tint is applied */ @Composable public fun Icon( @@ -211,12 +225,12 @@ public fun Icon( * * @param painter [Painter] to draw inside this Icon * @param contentDescription text used by accessibility services to - * describe what this icon represents. This should always be provided - * unless this icon is used for decorative purposes, and does not - * represent a meaningful action that a user can take. + * describe what this icon represents. This should always be provided + * unless this icon is used for decorative purposes, and does not + * represent a meaningful action that a user can take. * @param modifier optional [Modifier] for this Icon * @param tint tint to be applied to [painter]. If [Color.Unspecified] is - * provided, then no tint is applied + * provided, then no tint is applied */ @Composable public fun Icon( @@ -234,9 +248,9 @@ public fun Icon( * * @param painter [Painter] to draw inside this Icon * @param contentDescription text used by accessibility services to - * describe what this icon represents. This should always be provided - * unless this icon is used for decorative purposes, and does not - * represent a meaningful action that a user can take. + * describe what this icon represents. This should always be provided + * unless this icon is used for decorative purposes, and does not + * represent a meaningful action that a user can take. * @param colorFilter color filter to be applied to [painter] * @param modifier optional [Modifier] for this Icon */ diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/LazyTree.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/LazyTree.kt index 5b58c023e..74bc2dd2f 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/LazyTree.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/LazyTree.kt @@ -53,9 +53,8 @@ public fun LazyTree( onSelectionChange = onSelectionChange, keyActions = keyActions, chevronContent = { elementState -> - val painterProvider = style.icons.chevron(elementState.isExpanded, elementState.isSelected) - val painter by painterProvider.getPainter() - Icon(painter = painter, contentDescription = null) + val iconKey = style.icons.chevron(elementState.isExpanded, elementState.isSelected) + Icon(iconKey, contentDescription = null) }, ) { val resolvedContentColor = diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Link.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Link.kt index 7448c77a1..3cc973ae2 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Link.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Link.kt @@ -48,7 +48,7 @@ import org.jetbrains.jewel.ui.component.styling.LocalMenuStyle import org.jetbrains.jewel.ui.component.styling.MenuStyle import org.jetbrains.jewel.ui.disabled import org.jetbrains.jewel.ui.focusOutline -import org.jetbrains.jewel.ui.painter.PainterProvider +import org.jetbrains.jewel.ui.icon.IconKey import org.jetbrains.jewel.ui.painter.hints.Stateful import org.jetbrains.jewel.ui.util.thenIf import java.awt.Cursor @@ -206,7 +206,7 @@ private fun LinkImpl( overflow: TextOverflow, lineHeight: TextUnit, interactionSource: MutableInteractionSource, - icon: PainterProvider?, + icon: IconKey?, ) { var linkState by remember(interactionSource, enabled) { mutableStateOf(LinkState.of(enabled = enabled)) } remember(enabled) { linkState = linkState.copy(enabled = enabled) } @@ -267,8 +267,7 @@ private fun LinkImpl( role = Role.Button, interactionSource = interactionSource, indication = null, - ) - .focusOutline(linkState, RoundedCornerShape(style.metrics.focusHaloCornerSize)), + ).focusOutline(linkState, RoundedCornerShape(style.metrics.focusHaloCornerSize)), horizontalArrangement = Arrangement.spacedBy(style.metrics.textIconGap), verticalAlignment = Alignment.CenterVertically, ) { @@ -281,12 +280,12 @@ private fun LinkImpl( ) if (icon != null) { - val iconPainter by icon.getPainter(Stateful(linkState)) Icon( - iconPainter, + key = icon, contentDescription = null, modifier = Modifier.size(style.metrics.iconSize), colorFilter = if (!linkState.isEnabled) ColorFilter.disabled() else null, + hint = Stateful(linkState), ) } } @@ -294,7 +293,9 @@ private fun LinkImpl( @Immutable @JvmInline -public value class LinkState(public val state: ULong) : FocusableComponentState { +public value class LinkState( + public val state: ULong, +) : FocusableComponentState { override val isActive: Boolean get() = state and Active != 0UL diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Menu.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Menu.kt index 970df0e9a..e0c201c3d 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Menu.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Menu.kt @@ -553,12 +553,12 @@ public fun MenuSubmenuItem( Box(Modifier.weight(1f)) { content() } - val chevronPainter by style.icons.submenuChevron.getPainter(Stateful(itemState)) Icon( - painter = chevronPainter, + key = style.icons.submenuChevron, tint = itemColors.iconTintFor(itemState).value, contentDescription = null, modifier = Modifier.size(style.metrics.itemMetrics.iconSize), + hint = Stateful(itemState) ) } } diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/PlatformIcon.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/PlatformIcon.kt index 66a5a1feb..7309a54ff 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/PlatformIcon.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/PlatformIcon.kt @@ -4,7 +4,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import org.jetbrains.jewel.ui.icon.IntelliJIconKey -import org.jetbrains.jewel.ui.icons.AllIconsKeys import org.jetbrains.jewel.ui.painter.PainterHint @Composable @@ -26,5 +25,5 @@ public fun PlatformIcon( tint: Color = Color.Unspecified, vararg hints: PainterHint, ) { - Icon(key, contentDescription, AllIconsKeys::class.java, modifier, tint, *hints) + Icon(key, contentDescription, modifier, key::class.java, tint, *hints) } 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 e6ffdc074..6b7609f64 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 @@ -43,6 +43,7 @@ import org.jetbrains.jewel.ui.component.styling.RadioButtonStyle import org.jetbrains.jewel.ui.outline import org.jetbrains.jewel.ui.painter.hints.Selected import org.jetbrains.jewel.ui.painter.hints.Stateful +import org.jetbrains.jewel.ui.painter.rememberResourcePainterProvider import org.jetbrains.jewel.ui.theme.radioButtonStyle @Composable @@ -161,6 +162,7 @@ private fun RadioButtonImpl( is HoverInteraction.Enter -> radioButtonState = radioButtonState.copy(hovered = !swingCompatMode) + is HoverInteraction.Exit -> radioButtonState = radioButtonState.copy(hovered = false) is FocusInteraction.Focus -> radioButtonState = radioButtonState.copy(focused = true) is FocusInteraction.Unfocus -> radioButtonState = radioButtonState.copy(focused = false) @@ -189,7 +191,8 @@ private fun RadioButtonImpl( alignment = Stroke.Alignment.Center, ) - val radioButtonPainter by style.icons.radioButton.getPainter( + val radioButtonPainterProvider = rememberResourcePainterProvider(style.icons.radioButton) + val radioButtonPainter by radioButtonPainterProvider.getPainter( Selected(radioButtonState), Stateful(radioButtonState), ) diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Tabs.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Tabs.kt index 2c2d818c7..8d6ceabca 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Tabs.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Tabs.kt @@ -1,6 +1,5 @@ package org.jetbrains.jewel.ui.component -import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.HoverInteraction @@ -50,7 +49,8 @@ import org.jetbrains.jewel.ui.theme.editorTabStyle public interface TabContentScope { @Composable - public fun Modifier.tabContentAlpha(state: TabState): Modifier = alpha(JewelTheme.editorTabStyle.contentAlpha.contentFor(state).value) + public fun Modifier.tabContentAlpha(state: TabState): Modifier = + alpha(JewelTheme.editorTabStyle.contentAlpha.contentFor(state).value) } internal class TabContentScopeContainer : TabContentScope @@ -184,19 +184,19 @@ internal fun TabImpl( } } - val closePainter by tabStyle.icons.close.getPainter(Stateful(closeButtonState)) - Image( + Icon( + key = tabStyle.icons.close, modifier = - Modifier - .clickable( - interactionSource = closeActionInteractionSource, - indication = null, - onClick = tabData.onClose, - role = Role.Button, - ) - .size(16.dp), - painter = closePainter, + Modifier + .clickable( + interactionSource = closeActionInteractionSource, + indication = null, + onClick = tabData.onClose, + role = Role.Button, + ) + .size(16.dp), contentDescription = "Close tab", + hint = Stateful(closeButtonState), ) } else if (tabData.closable) { Spacer(Modifier.size(16.dp)) diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/CheckboxStyling.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/CheckboxStyling.kt index c36976183..31c32af1d 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/CheckboxStyling.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/CheckboxStyling.kt @@ -13,7 +13,7 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.DpSize import org.jetbrains.jewel.foundation.GenerateDataFunctions import org.jetbrains.jewel.ui.component.CheckboxState -import org.jetbrains.jewel.ui.painter.PainterProvider +import org.jetbrains.jewel.ui.icon.IconKey @Immutable @GenerateDataFunctions @@ -86,7 +86,7 @@ public class CheckboxMetrics( @Immutable @GenerateDataFunctions -public class CheckboxIcons(public val checkbox: PainterProvider) { +public class CheckboxIcons(public val checkbox: IconKey) { public companion object } diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/DropdownStyling.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/DropdownStyling.kt index 2ca038409..c2999395f 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/DropdownStyling.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/DropdownStyling.kt @@ -15,7 +15,7 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.DpSize import org.jetbrains.jewel.foundation.GenerateDataFunctions import org.jetbrains.jewel.ui.component.DropdownState -import org.jetbrains.jewel.ui.painter.PainterProvider +import org.jetbrains.jewel.ui.icon.IconKey @Stable @GenerateDataFunctions @@ -122,7 +122,7 @@ public class DropdownMetrics( @Immutable @GenerateDataFunctions -public class DropdownIcons(public val chevronDown: PainterProvider) { +public class DropdownIcons(public val chevronDown: IconKey) { public companion object } diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/LazyTreeStyling.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/LazyTreeStyling.kt index f482a16ac..3990ff0c9 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/LazyTreeStyling.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/LazyTreeStyling.kt @@ -13,7 +13,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import org.jetbrains.jewel.foundation.GenerateDataFunctions import org.jetbrains.jewel.foundation.lazy.tree.TreeElementState -import org.jetbrains.jewel.ui.painter.PainterProvider +import org.jetbrains.jewel.ui.icon.IconKey @Stable @GenerateDataFunctions @@ -66,16 +66,16 @@ public class LazyTreeMetrics( @Immutable @GenerateDataFunctions public class LazyTreeIcons( - public val chevronCollapsed: PainterProvider, - public val chevronExpanded: PainterProvider, - public val chevronSelectedCollapsed: PainterProvider, - public val chevronSelectedExpanded: PainterProvider, + public val chevronCollapsed: IconKey, + public val chevronExpanded: IconKey, + public val chevronSelectedCollapsed: IconKey, + public val chevronSelectedExpanded: IconKey, ) { @Composable public fun chevron( isExpanded: Boolean, isSelected: Boolean, - ): PainterProvider = + ): IconKey = when { isSelected && isExpanded -> chevronSelectedExpanded isSelected && !isExpanded -> chevronSelectedCollapsed diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/LinkStyling.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/LinkStyling.kt index 10b0a540e..65b9094e4 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/LinkStyling.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/LinkStyling.kt @@ -13,7 +13,7 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.DpSize import org.jetbrains.jewel.foundation.GenerateDataFunctions import org.jetbrains.jewel.ui.component.LinkState -import org.jetbrains.jewel.ui.painter.PainterProvider +import org.jetbrains.jewel.ui.icon.IconKey @Immutable @GenerateDataFunctions @@ -66,8 +66,8 @@ public class LinkMetrics( @Immutable @GenerateDataFunctions public class LinkIcons( - public val dropdownChevron: PainterProvider, - public val externalLink: PainterProvider, + public val dropdownChevron: IconKey, + public val externalLink: IconKey, ) { public companion object } diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/MenuStyling.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/MenuStyling.kt index fb8d91a16..98566b4ed 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/MenuStyling.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/MenuStyling.kt @@ -14,7 +14,7 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.DpOffset import org.jetbrains.jewel.foundation.GenerateDataFunctions import org.jetbrains.jewel.ui.component.MenuItemState -import org.jetbrains.jewel.ui.painter.PainterProvider +import org.jetbrains.jewel.ui.icon.IconKey @Stable @GenerateDataFunctions @@ -157,7 +157,7 @@ public class SubmenuMetrics(public val offset: DpOffset) { @Immutable @GenerateDataFunctions -public class MenuIcons(public val submenuChevron: PainterProvider) { +public class MenuIcons(public val submenuChevron: IconKey) { public companion object } diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/RadioButtonStyling.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/RadioButtonStyling.kt index e57dcec09..31973ad02 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/RadioButtonStyling.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/RadioButtonStyling.kt @@ -11,7 +11,7 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.DpSize import org.jetbrains.jewel.foundation.GenerateDataFunctions import org.jetbrains.jewel.ui.component.RadioButtonState -import org.jetbrains.jewel.ui.painter.PainterProvider +import org.jetbrains.jewel.ui.icon.IconKey @Immutable @GenerateDataFunctions @@ -75,7 +75,7 @@ public class RadioButtonMetrics( @Immutable @GenerateDataFunctions -public class RadioButtonIcons(public val radioButton: PainterProvider) { +public class RadioButtonIcons(public val radioButton: IconKey) { public companion object } diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/TabStyling.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/TabStyling.kt index eabaa5142..10a42bcf9 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/TabStyling.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/TabStyling.kt @@ -12,7 +12,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import org.jetbrains.jewel.foundation.GenerateDataFunctions import org.jetbrains.jewel.ui.component.TabState -import org.jetbrains.jewel.ui.painter.PainterProvider +import org.jetbrains.jewel.ui.icon.IconKey @Stable @GenerateDataFunctions @@ -39,7 +39,7 @@ public class TabMetrics( @Immutable @GenerateDataFunctions -public class TabIcons(public val close: PainterProvider) { +public class TabIcons(public val close: IconKey) { public companion object } 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 afccfdea2..f78b0a38c 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,6 +15,8 @@ import androidx.compose.ui.res.loadSvgPainter import androidx.compose.ui.res.loadXmlImageVector import androidx.compose.ui.unit.Density import org.jetbrains.jewel.foundation.util.inDebugMode +import org.jetbrains.jewel.ui.icon.IconKey +import org.jetbrains.jewel.ui.icon.LocalNewUiChecker import org.w3c.dom.Document import org.xml.sax.InputSource import java.io.IOException @@ -282,6 +284,20 @@ internal fun Document.writeToString(): String { } } +@Composable +public fun rememberResourcePainterProvider( + iconKey: IconKey, + iconClass: Class<*> = iconKey::class.java, +): PainterProvider { + val isNewUi = LocalNewUiChecker.current.isNewUi() + return remember(iconKey, iconClass.classLoader, isNewUi) { + ResourcePainterProvider( + iconKey.path(isNewUi), + iconClass.classLoader + ) + } +} + @Composable public fun rememberResourcePainterProvider( path: String,