From 1cb27f74dd51a8d5cdae5c2026b72f5f446ed563 Mon Sep 17 00:00:00 2001 From: Sebastiano Poggi Date: Sat, 21 Oct 2023 08:03:39 +0200 Subject: [PATCH] =?UTF-8?q?The=20big=20refactor=20=E2=80=94=20part=203:=20?= =?UTF-8?q?more=20interfaces=20(#195)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Collapse Global* interfaces * Collapse IconData interface, update generator * Collapse ThemeColorPalette interface, update generator * Collapse ThemeDefinition interface, update generator * Renamed theme to JewelTheme Cannot collapse the theme into JewelTheme since we get some nasty classloading issue with Composer. Will investigate separately. * Cleanup some more code * Rename ComponentStyling * Rename ContextMenuRepresentation * Clean up decorated window code, too * Final cleanup pass * Get rid of BaseIntUiTheme and IntUiTheme One theme to rule them all! --- .../theme/IntUiThemeDescriptorReader.kt | 186 ++---- core/api/core.api | 329 +++++----- .../main/kotlin/org/jetbrains/jewel/Button.kt | 8 +- .../kotlin/org/jetbrains/jewel/Checkbox.kt | 6 +- .../main/kotlin/org/jetbrains/jewel/Chip.kt | 6 +- .../jewel/CircularProgressIndicator.kt | 6 +- ...omponentStyling.kt => ComponentStyling.kt} | 4 +- .../kotlin/org/jetbrains/jewel/ContextMenu.kt | 6 +- .../kotlin/org/jetbrains/jewel/Divider.kt | 2 +- .../kotlin/org/jetbrains/jewel/Dropdown.kt | 8 +- .../jewel/FocusableComponentState.kt | 4 +- .../org/jetbrains/jewel/GlobalColors.kt | 54 +- .../org/jetbrains/jewel/GlobalMetrics.kt | 9 +- .../kotlin/org/jetbrains/jewel/IconButton.kt | 2 +- .../kotlin/org/jetbrains/jewel/InputField.kt | 8 +- .../jewel/IntelliJThemeColorPalette.kt | 19 - .../jewel/IntelliJThemeDefinition.kt | 18 - .../jewel/IntelliJThemeDescriptor.kt | 9 - .../jewel/{IntelliJTheme.kt => JewelTheme.kt} | 29 +- .../org/jetbrains/jewel/LabelledTextField.kt | 8 +- .../kotlin/org/jetbrains/jewel/LazyTree.kt | 2 +- .../org/jetbrains/jewel/LinearProgressBar.kt | 4 +- .../main/kotlin/org/jetbrains/jewel/Link.kt | 6 +- .../main/kotlin/org/jetbrains/jewel/Menu.kt | 14 +- .../kotlin/org/jetbrains/jewel/Outline.kt | 10 +- .../kotlin/org/jetbrains/jewel/RadioButton.kt | 12 +- .../kotlin/org/jetbrains/jewel/Scrollbars.kt | 6 +- .../kotlin/org/jetbrains/jewel/SplitLayout.kt | 4 +- .../main/kotlin/org/jetbrains/jewel/Tabs.kt | 4 +- .../main/kotlin/org/jetbrains/jewel/Text.kt | 4 +- .../kotlin/org/jetbrains/jewel/TextArea.kt | 8 +- .../kotlin/org/jetbrains/jewel/TextField.kt | 6 +- .../org/jetbrains/jewel/ThemeColorPalette.kt | 90 +++ .../org/jetbrains/jewel/ThemeDefinition.kt | 17 + .../org/jetbrains/jewel/ThemeDescriptor.kt | 12 + ...elliJThemeIconData.kt => ThemeIconData.kt} | 32 +- .../kotlin/org/jetbrains/jewel/Tooltip.kt | 17 +- .../jewel/foundation/utils/Logger.kt | 11 +- .../foundation/utils/ModifierExtensions.kt | 10 - .../jewel/painter/PainterHintsProvider.kt | 4 +- .../jetbrains/jewel/styling/ChipStyling.kt | 10 +- .../jewel/util/ModifierExtensions.kt | 7 + decorated-window/api/decorated-window.api | 167 ++++-- .../jetbrains/jewel/window/DecoratedWindow.kt | 4 +- .../org/jetbrains/jewel/window/Theme.kt | 6 +- .../jetbrains/jewel/window/TitleBar.Linux.kt | 8 +- .../jetbrains/jewel/window/TitleBar.MacOS.kt | 4 +- .../jewel/window/TitleBar.Windows.kt | 4 +- .../org/jetbrains/jewel/window/TitleBar.kt | 6 +- .../window/styling/DecoratedWindowStyling.kt | 33 +- .../jewel/window/styling/TitleBarStyling.kt | 96 +-- ide-laf-bridge/api/ide-laf-bridge.api | 39 +- ide-laf-bridge/build.gradle.kts | 5 +- .../api/ide-laf-bridge-232.api | 4 +- .../jetbrains/jewel/bridge/BridgeIconData.kt | 57 +- .../bridge/BridgePainterHintsProvider.kt | 4 +- .../api/ide-laf-bridge-233.api | 4 +- .../jetbrains/jewel/bridge/BridgeIconData.kt | 56 +- .../bridge/BridgePainterHintsProvider.kt | 4 +- .../jewel/bridge/BridgeGlobalColors.kt | 157 +---- .../jewel/bridge/BridgeGlobalMetrics.kt | 55 +- .../jewel/bridge/BridgeThemeColorPalette.kt | 183 +++--- .../org/jetbrains/jewel/bridge/IntUiBridge.kt | 40 +- .../jewel/bridge/SwingBridgeService.kt | 21 +- int-ui/int-ui-core/api/int-ui-core.api | 360 +---------- .../jewel/intui/core/BaseIntUiTheme.kt | 170 +----- .../intui/core/IntUiThemeColorPalette.kt | 99 --- .../jewel/intui/core/IntUiThemeDefinition.kt | 22 - .../api/int-ui-decorated-window.api | 153 +---- .../IntUiDecoratedWindowResourceResolver.kt | 6 +- .../jewel/intui/window/IntUiTheme.kt | 19 +- .../styling/IntUiDecoratedWindowStyling.kt | 134 +---- .../window/styling/IntUiTitleBarStyling.kt | 564 ++++++++---------- .../api/int-ui-standalone.api | 119 +--- .../intui/standalone/IntUiGlobalColors.kt | 227 ++----- .../intui/standalone/IntUiGlobalMetrics.kt | 32 +- .../jewel/intui/standalone/IntUiTheme.kt | 254 ++++---- .../jewel/intui/standalone/PainterProvider.kt | 3 +- .../StandalonePainterHintsProvider.kt | 22 +- .../styling/IntUiDropdownStyling.kt | 11 +- .../styling/IntUiLabelledTextFieldStyling.kt | 15 +- .../standalone/styling/IntUiLinkStyling.kt | 11 +- .../styling/IntUiTextAreaStyling.kt | 7 +- .../styling/IntUiTextFieldStyling.kt | 7 +- .../samples/ideplugin/ComponentShowcaseTab.kt | 6 +- .../releasessample/ReleasesSampleCompose.kt | 8 +- .../jewel/samples/standalone/Main.kt | 46 +- .../samples/standalone/components/Borders.kt | 10 +- .../standalone/components/ChipsAndTree.kt | 8 +- .../samples/standalone/components/Tabs.kt | 15 +- .../samples/standalone/components/Tooltips.kt | 4 +- 91 files changed, 1523 insertions(+), 2777 deletions(-) rename core/src/main/kotlin/org/jetbrains/jewel/{IntelliJComponentStyling.kt => ComponentStyling.kt} (97%) delete mode 100644 core/src/main/kotlin/org/jetbrains/jewel/IntelliJThemeColorPalette.kt delete mode 100644 core/src/main/kotlin/org/jetbrains/jewel/IntelliJThemeDefinition.kt delete mode 100644 core/src/main/kotlin/org/jetbrains/jewel/IntelliJThemeDescriptor.kt rename core/src/main/kotlin/org/jetbrains/jewel/{IntelliJTheme.kt => JewelTheme.kt} (92%) create mode 100644 core/src/main/kotlin/org/jetbrains/jewel/ThemeColorPalette.kt create mode 100644 core/src/main/kotlin/org/jetbrains/jewel/ThemeDefinition.kt create mode 100644 core/src/main/kotlin/org/jetbrains/jewel/ThemeDescriptor.kt rename core/src/main/kotlin/org/jetbrains/jewel/{IntelliJThemeIconData.kt => ThemeIconData.kt} (61%) delete mode 100644 core/src/main/kotlin/org/jetbrains/jewel/foundation/utils/ModifierExtensions.kt delete mode 100644 int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/IntUiThemeColorPalette.kt delete mode 100644 int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/IntUiThemeDefinition.kt diff --git a/buildSrc/src/main/kotlin/org/jetbrains/jewel/buildlogic/theme/IntUiThemeDescriptorReader.kt b/buildSrc/src/main/kotlin/org/jetbrains/jewel/buildlogic/theme/IntUiThemeDescriptorReader.kt index 829fe4634..2accb8eb3 100644 --- a/buildSrc/src/main/kotlin/org/jetbrains/jewel/buildlogic/theme/IntUiThemeDescriptorReader.kt +++ b/buildSrc/src/main/kotlin/org/jetbrains/jewel/buildlogic/theme/IntUiThemeDescriptorReader.kt @@ -3,23 +3,18 @@ package org.jetbrains.jewel.buildlogic.theme import com.squareup.kotlinpoet.ClassName import com.squareup.kotlinpoet.CodeBlock import com.squareup.kotlinpoet.FileSpec -import com.squareup.kotlinpoet.FunSpec import com.squareup.kotlinpoet.KModifier -import com.squareup.kotlinpoet.MemberName.Companion.member import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy import com.squareup.kotlinpoet.PropertySpec import com.squareup.kotlinpoet.TypeSpec -import com.squareup.kotlinpoet.asClassName import com.squareup.kotlinpoet.asTypeName import com.squareup.kotlinpoet.joinToCode import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.JsonPrimitive -import org.gradle.util.internal.GUtil internal object IntUiThemeDescriptorReader { private val colorGroups = setOf("Grey", "Blue", "Green", "Red", "Yellow", "Orange", "Purple", "Teal") - private val list = List::class.asClassName() private val colorClassName = ClassName("androidx.compose.ui.graphics", "Color") fun readThemeFrom( @@ -34,8 +29,10 @@ internal object IntUiThemeDescriptorReader { addFileComment("Generated from the IntelliJ Platform version $ideaVersion\n") addFileComment("Source: $descriptorUrl") + addImport(colorClassName.packageName, colorClassName.simpleName) + addType(TypeSpec.objectBuilder(className).apply { - addSuperinterface(ClassName.bestGuess("org.jetbrains.jewel.IntelliJThemeDescriptor")) + addSuperinterface(ClassName.bestGuess("org.jetbrains.jewel.ThemeDescriptor")) addProperty( PropertySpec.builder("isDark", Boolean::class, KModifier.OVERRIDE) @@ -49,147 +46,90 @@ internal object IntUiThemeDescriptorReader { .build() ) - readColors(className, themeDescriptor.colors) + readColors(themeDescriptor.colors) readIcons(themeDescriptor) }.build()) }.build() private val colorPaletteClassName = - ClassName.bestGuess("org.jetbrains.jewel.intui.core.IntUiThemeColorPalette") + ClassName.bestGuess("org.jetbrains.jewel.ThemeColorPalette") private val iconDataClassName = - ClassName.bestGuess("org.jetbrains.jewel.IntelliJThemeIconData") - - private fun TypeSpec.Builder.readColors( - className: ClassName, - colors: Map - ) { - addType(TypeSpec.objectBuilder("Colors").apply { - addSuperinterface(colorPaletteClassName) - - colors.forEach { (name, value) -> - readColor(name, value) - } + ClassName.bestGuess("org.jetbrains.jewel.ThemeIconData") + + private fun TypeSpec.Builder.readColors(colors: Map) { + val colorGroups = colors.entries.groupBy { + it.key.replace("""\d+""".toRegex(), "") + }.filterKeys { + colorGroups.contains(it) + }.map { (groupName, colors) -> + // We assume color lists are in the same order as in colorGroups + colors + .map { (_, value) -> + val colorHexString = value.replace("#", "0xFF") + CodeBlock.of("Color(%L)", colorHexString) + } + .joinToCode(prefix = "\n${groupName.lowercase()} = listOf(\n", separator = ",\n", suffix = "\n)") + } - colors.entries.groupBy { - it.key.replace("""\d+""".toRegex(), "") - }.filterKeys { - colorGroups.contains(it) - }.forEach { (group, colors) -> - readColorGroup(className, group, colors) + val rawMap = colors + .map { (key, value) -> + val colorHexString = value.replace("#", "0xFF") + CodeBlock.of("%S to Color(%L)", key, colorHexString) } - - val rawMapProperty = PropertySpec - .builder( - "rawMap", - Map::class.asClassName().parameterizedBy(String::class.asClassName(), colorClassName), - KModifier.OVERRIDE - ) - .initializer( - colors - .map { (key, value) -> - val colorHexString = value.replace("#", "0xFF") - CodeBlock.of("%S to Color(%L)", key, colorHexString) - } - .joinToCode(prefix = "mapOf(", separator = ",\n", suffix = ")") - ) - .build() - addProperty(rawMapProperty) - }.build()) + .joinToCode(prefix = "\nrawMap = mapOf(\n", separator = ",\n", suffix = "\n)") addProperty( PropertySpec.builder("colors", colorPaletteClassName, KModifier.OVERRIDE) - .initializer("Colors") + .initializer( + "ThemeColorPalette(%L,\n%L\n)", + colorGroups.joinToCode(","), + rawMap + ) .build() ) } - private fun TypeSpec.Builder.readColor(name: String, value: String) { - addProperty(PropertySpec.builder(GUtil.toLowerCamelCase(name), colorClassName).apply { - initializer("Color(%L)", value.replace("#", "0xFF")) - }.build()) - } - - private fun TypeSpec.Builder.readColorGroup( - paletteClassName: ClassName, - group: String, - colors: List> - ) { - val funcName = paletteClassName.member(GUtil.toLowerCamelCase(group)) - - addFunction(FunSpec.builder(funcName).apply { - returns(list.parameterizedBy(colorClassName)) - addModifiers(KModifier.OVERRIDE) - addCode(CodeBlock.builder().apply { - when { - colors.isEmpty() -> addStatement("return emptyList()") - colors.size <= 5 -> { - add("return listOf(") - colors.forEachIndexed { index, (name, _) -> - if (index != 0) add(",") - add("%N", paletteClassName.member(GUtil.toLowerCamelCase(name))) - } - add(")") - } - - else -> { - add("return listOf(\n").indent() - colors.forEach { (name, _) -> - add("%N,\n", paletteClassName.member(GUtil.toLowerCamelCase(name))) - } - unindent().add(")") - } - } - }.build()) - }.build()) - - addFunction(FunSpec.builder(funcName).apply { - returns(colorClassName) - addModifiers(KModifier.OVERRIDE) - addParameter("index", Int::class) - addCode(CodeBlock.builder().apply { - addStatement("return %N()[index - 1]", funcName) - }.build()) - }.build()) - } - private fun TypeSpec.Builder.readIcons(theme: IntellijThemeDescriptor) { - addType(TypeSpec.objectBuilder("Icons").apply { - addSuperinterface(iconDataClassName) - - val iconOverrides = mutableMapOf() - - for ((key, value) in theme.icons) { - if (value is JsonPrimitive && value.isString) { - iconOverrides += key to value.content - } else if (value is JsonObject && key == "ColorPalette") { - val colorPalette = value.entries - .mapNotNull { - val pairValue = it.value - if (pairValue is JsonPrimitive && pairValue.isString) { - it.key to pairValue.content - } else null - }.toMap() - - addProperty(createOverrideStringMapProperty("colorPalette", colorPalette)) - } + val iconOverrides = mutableMapOf() + val colorPalette = mutableMapOf() + + for ((key, value) in theme.icons) { + if (value is JsonPrimitive && value.isString) { + iconOverrides += key to value.content + } else if (value is JsonObject && key == "ColorPalette") { + value.entries + .mapNotNull { + val pairValue = it.value + if (pairValue is JsonPrimitive && pairValue.isString) { + it.key to pairValue.content + } else null + } + .forEach { colorPalette[it.first] = it.second } } + } - addProperty(createOverrideStringMapProperty("iconOverrides", iconOverrides)) - addProperty( - createOverrideStringMapProperty( - "selectionColorPalette", - theme.iconColorsOnSelection - ) - ) - }.build()) + val iconOverridesBlock = iconOverrides.toMapCodeBlock() + val selectionColorPaletteBlock = theme.iconColorsOnSelection.toMapCodeBlock() addProperty( - PropertySpec.builder("icons", iconDataClassName, KModifier.OVERRIDE) - .initializer("Icons") + PropertySpec.builder("iconData", iconDataClassName, KModifier.OVERRIDE) + .initializer( + CodeBlock.of( + "ThemeIconData(\n%L,\n%L,\n%L\n)", + colorPalette.toMapCodeBlock(), + iconOverridesBlock, + selectionColorPaletteBlock, + ) + ) .build() ) } + private inline fun Map.toMapCodeBlock() = + entries + .map { (key, value) -> CodeBlock.of("\"%L\" to \"%L\"", key, value) } + .joinToCode(prefix = "mapOf(", separator = ",\n", suffix = ")") + private inline fun createOverrideStringMapProperty(name: String, values: Map) = PropertySpec.builder( name = name, diff --git a/core/api/core.api b/core/api/core.api index ab0ce833b..2e5291c71 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -1,7 +1,16 @@ -public abstract interface class org/jetbrains/jewel/BorderColors { - public abstract fun getDisabled-0d7_KjU ()J - public abstract fun getFocused-0d7_KjU ()J - public abstract fun getNormal-0d7_KjU ()J +public final class org/jetbrains/jewel/BorderColors { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/BorderColors$Companion; + public synthetic fun (JJJLkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getDisabled-0d7_KjU ()J + public final fun getFocused-0d7_KjU ()J + public final fun getNormal-0d7_KjU ()J + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/BorderColors$Companion { } public final class org/jetbrains/jewel/ButtonKt { @@ -140,6 +149,37 @@ public abstract interface class org/jetbrains/jewel/ClassLoaderProvider { public abstract fun getClassLoaders ()Ljava/util/List; } +public final class org/jetbrains/jewel/ComponentStyling { + public static final field $stable I + public fun (Lorg/jetbrains/jewel/styling/CheckboxStyle;Lorg/jetbrains/jewel/styling/ChipStyle;Lorg/jetbrains/jewel/styling/CircularProgressStyle;Lorg/jetbrains/jewel/styling/ButtonStyle;Lorg/jetbrains/jewel/styling/DropdownStyle;Lorg/jetbrains/jewel/styling/TabStyle;Lorg/jetbrains/jewel/styling/DividerStyle;Lorg/jetbrains/jewel/styling/TabStyle;Lorg/jetbrains/jewel/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/styling/IconButtonStyle;Lorg/jetbrains/jewel/styling/LabelledTextFieldStyle;Lorg/jetbrains/jewel/styling/LazyTreeStyle;Lorg/jetbrains/jewel/styling/LinkStyle;Lorg/jetbrains/jewel/styling/MenuStyle;Lorg/jetbrains/jewel/styling/ButtonStyle;Lorg/jetbrains/jewel/styling/RadioButtonStyle;Lorg/jetbrains/jewel/styling/ScrollbarStyle;Lorg/jetbrains/jewel/styling/TextAreaStyle;Lorg/jetbrains/jewel/styling/TextFieldStyle;Lorg/jetbrains/jewel/styling/TooltipStyle;Lorg/jetbrains/jewel/styling/DropdownStyle;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getCheckboxStyle ()Lorg/jetbrains/jewel/styling/CheckboxStyle; + public final fun getChipStyle ()Lorg/jetbrains/jewel/styling/ChipStyle; + public final fun getCircularProgressStyle ()Lorg/jetbrains/jewel/styling/CircularProgressStyle; + public final fun getDefaultButtonStyle ()Lorg/jetbrains/jewel/styling/ButtonStyle; + public final fun getDefaultDropdownStyle ()Lorg/jetbrains/jewel/styling/DropdownStyle; + public final fun getDefaultTabStyle ()Lorg/jetbrains/jewel/styling/TabStyle; + public final fun getDividerStyle ()Lorg/jetbrains/jewel/styling/DividerStyle; + public final fun getEditorTabStyle ()Lorg/jetbrains/jewel/styling/TabStyle; + public final fun getGroupHeaderStyle ()Lorg/jetbrains/jewel/styling/GroupHeaderStyle; + public final fun getHorizontalProgressBarStyle ()Lorg/jetbrains/jewel/styling/HorizontalProgressBarStyle; + public final fun getIconButtonStyle ()Lorg/jetbrains/jewel/styling/IconButtonStyle; + public final fun getLabelledTextFieldStyle ()Lorg/jetbrains/jewel/styling/LabelledTextFieldStyle; + public final fun getLazyTreeStyle ()Lorg/jetbrains/jewel/styling/LazyTreeStyle; + public final fun getLinkStyle ()Lorg/jetbrains/jewel/styling/LinkStyle; + public final fun getMenuStyle ()Lorg/jetbrains/jewel/styling/MenuStyle; + public final fun getOutlinedButtonStyle ()Lorg/jetbrains/jewel/styling/ButtonStyle; + public final fun getRadioButtonStyle ()Lorg/jetbrains/jewel/styling/RadioButtonStyle; + public final fun getScrollbarStyle ()Lorg/jetbrains/jewel/styling/ScrollbarStyle; + public final fun getTextAreaStyle ()Lorg/jetbrains/jewel/styling/TextAreaStyle; + public final fun getTextFieldStyle ()Lorg/jetbrains/jewel/styling/TextFieldStyle; + public final fun getTooltipStyle ()Lorg/jetbrains/jewel/styling/TooltipStyle; + public final fun getUndecoratedDropdownStyle ()Lorg/jetbrains/jewel/styling/DropdownStyle; + public fun hashCode ()I + public final fun providedStyles (Landroidx/compose/runtime/Composer;I)[Landroidx/compose/runtime/ProvidedValue; + public fun toString ()Ljava/lang/String; +} + public final class org/jetbrains/jewel/ComposableSingletons$MenuKt { public static final field INSTANCE Lorg/jetbrains/jewel/ComposableSingletons$MenuKt; public static field lambda-1 Lkotlin/jvm/functions/Function2; @@ -152,6 +192,12 @@ public final class org/jetbrains/jewel/ContextMenuDivider : androidx/compose/fou public static final field INSTANCE Lorg/jetbrains/jewel/ContextMenuDivider; } +public final class org/jetbrains/jewel/ContextMenuRepresentation : androidx/compose/foundation/ContextMenuRepresentation { + public static final field $stable I + public static final field INSTANCE Lorg/jetbrains/jewel/ContextMenuRepresentation; + public fun Representation (Landroidx/compose/foundation/ContextMenuState;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V +} + public final class org/jetbrains/jewel/ContextSubmenu : androidx/compose/foundation/ContextMenuItem { public static final field $stable I public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function0;)V @@ -204,23 +250,6 @@ public final class org/jetbrains/jewel/DropdownState$Companion { public static synthetic fun of-eyYTm3Q$default (Lorg/jetbrains/jewel/DropdownState$Companion;ZZZZZILjava/lang/Object;)J } -public final class org/jetbrains/jewel/EmptyThemeColorPalette : org/jetbrains/jewel/IntelliJThemeColorPalette { - public static final field $stable I - public static final field INSTANCE Lorg/jetbrains/jewel/EmptyThemeColorPalette; - public fun getRawMap ()Ljava/util/Map; - public fun lookup-ijrfgN4 (Ljava/lang/String;)Landroidx/compose/ui/graphics/Color; -} - -public final class org/jetbrains/jewel/EmptyThemeIconData : org/jetbrains/jewel/IntelliJThemeIconData { - public static final field $stable I - public static final field INSTANCE Lorg/jetbrains/jewel/EmptyThemeIconData; - public fun getColorPalette ()Ljava/util/Map; - public fun getIconOverrides ()Ljava/util/Map; - public fun getSelectionColorPalette ()Ljava/util/Map; - public fun selectionColorMapping ()Ljava/util/Map; - public fun toString ()Ljava/lang/String; -} - public abstract interface annotation class org/jetbrains/jewel/ExperimentalJewelApi : java/lang/annotation/Annotation { } @@ -236,20 +265,38 @@ public final class org/jetbrains/jewel/FocusableComponentState$DefaultImpls { public abstract interface annotation class org/jetbrains/jewel/GenerateDataFunctions : java/lang/annotation/Annotation { } -public abstract interface class org/jetbrains/jewel/GlobalColors { - public abstract fun getBorders ()Lorg/jetbrains/jewel/BorderColors; - public abstract fun getInfoContent-0d7_KjU ()J - public abstract fun getOutlines ()Lorg/jetbrains/jewel/OutlineColors; - public abstract fun getPaneBackground-0d7_KjU ()J +public final class org/jetbrains/jewel/GlobalColors { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/GlobalColors$Companion; + public synthetic fun (Lorg/jetbrains/jewel/BorderColors;Lorg/jetbrains/jewel/OutlineColors;JJLkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getBorders ()Lorg/jetbrains/jewel/BorderColors; + public final fun getInfoContent-0d7_KjU ()J + public final fun getOutlines ()Lorg/jetbrains/jewel/OutlineColors; + public final fun getPaneBackground-0d7_KjU ()J + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/GlobalColors$Companion { } public final class org/jetbrains/jewel/GlobalColorsKt { public static final fun getLocalGlobalColors ()Landroidx/compose/runtime/ProvidableCompositionLocal; } -public abstract interface class org/jetbrains/jewel/GlobalMetrics { - public abstract fun getOutlineWidth-D9Ej5fM ()F - public abstract fun getRowHeight-D9Ej5fM ()F +public final class org/jetbrains/jewel/GlobalMetrics { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/GlobalMetrics$Companion; + public synthetic fun (FFLkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getOutlineWidth-D9Ej5fM ()F + public final fun getRowHeight-D9Ej5fM ()F + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/GlobalMetrics$Companion { } public final class org/jetbrains/jewel/GlobalMetricsKt { @@ -308,52 +355,25 @@ public final class org/jetbrains/jewel/InputFieldState$Companion { public static synthetic fun of-uqjUvac$default (Lorg/jetbrains/jewel/InputFieldState$Companion;ZZZZZILjava/lang/Object;)J } -public final class org/jetbrains/jewel/IntelliJComponentStyling { - public static final field $stable I - public fun (Lorg/jetbrains/jewel/styling/CheckboxStyle;Lorg/jetbrains/jewel/styling/ChipStyle;Lorg/jetbrains/jewel/styling/CircularProgressStyle;Lorg/jetbrains/jewel/styling/ButtonStyle;Lorg/jetbrains/jewel/styling/DropdownStyle;Lorg/jetbrains/jewel/styling/TabStyle;Lorg/jetbrains/jewel/styling/DividerStyle;Lorg/jetbrains/jewel/styling/TabStyle;Lorg/jetbrains/jewel/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/styling/IconButtonStyle;Lorg/jetbrains/jewel/styling/LabelledTextFieldStyle;Lorg/jetbrains/jewel/styling/LazyTreeStyle;Lorg/jetbrains/jewel/styling/LinkStyle;Lorg/jetbrains/jewel/styling/MenuStyle;Lorg/jetbrains/jewel/styling/ButtonStyle;Lorg/jetbrains/jewel/styling/RadioButtonStyle;Lorg/jetbrains/jewel/styling/ScrollbarStyle;Lorg/jetbrains/jewel/styling/TextAreaStyle;Lorg/jetbrains/jewel/styling/TextFieldStyle;Lorg/jetbrains/jewel/styling/TooltipStyle;Lorg/jetbrains/jewel/styling/DropdownStyle;)V - public fun equals (Ljava/lang/Object;)Z - public final fun getCheckboxStyle ()Lorg/jetbrains/jewel/styling/CheckboxStyle; - public final fun getChipStyle ()Lorg/jetbrains/jewel/styling/ChipStyle; - public final fun getCircularProgressStyle ()Lorg/jetbrains/jewel/styling/CircularProgressStyle; - public final fun getDefaultButtonStyle ()Lorg/jetbrains/jewel/styling/ButtonStyle; - public final fun getDefaultDropdownStyle ()Lorg/jetbrains/jewel/styling/DropdownStyle; - public final fun getDefaultTabStyle ()Lorg/jetbrains/jewel/styling/TabStyle; - public final fun getDividerStyle ()Lorg/jetbrains/jewel/styling/DividerStyle; - public final fun getEditorTabStyle ()Lorg/jetbrains/jewel/styling/TabStyle; - public final fun getGroupHeaderStyle ()Lorg/jetbrains/jewel/styling/GroupHeaderStyle; - public final fun getHorizontalProgressBarStyle ()Lorg/jetbrains/jewel/styling/HorizontalProgressBarStyle; - public final fun getIconButtonStyle ()Lorg/jetbrains/jewel/styling/IconButtonStyle; - public final fun getLabelledTextFieldStyle ()Lorg/jetbrains/jewel/styling/LabelledTextFieldStyle; - public final fun getLazyTreeStyle ()Lorg/jetbrains/jewel/styling/LazyTreeStyle; - public final fun getLinkStyle ()Lorg/jetbrains/jewel/styling/LinkStyle; - public final fun getMenuStyle ()Lorg/jetbrains/jewel/styling/MenuStyle; - public final fun getOutlinedButtonStyle ()Lorg/jetbrains/jewel/styling/ButtonStyle; - public final fun getRadioButtonStyle ()Lorg/jetbrains/jewel/styling/RadioButtonStyle; - public final fun getScrollbarStyle ()Lorg/jetbrains/jewel/styling/ScrollbarStyle; - public final fun getTextAreaStyle ()Lorg/jetbrains/jewel/styling/TextAreaStyle; - public final fun getTextFieldStyle ()Lorg/jetbrains/jewel/styling/TextFieldStyle; - public final fun getTooltipStyle ()Lorg/jetbrains/jewel/styling/TooltipStyle; - public final fun getUndecoratedDropdownStyle ()Lorg/jetbrains/jewel/styling/DropdownStyle; - public fun hashCode ()I - public final fun providedStyles (Landroidx/compose/runtime/Composer;I)[Landroidx/compose/runtime/ProvidedValue; - public fun toString ()Ljava/lang/String; +public abstract interface class org/jetbrains/jewel/InteractiveComponentState { + public abstract fun isActive ()Z + public abstract fun isEnabled ()Z + public abstract fun isHovered ()Z + public abstract fun isPressed ()Z } -public final class org/jetbrains/jewel/IntelliJContextMenuRepresentation : androidx/compose/foundation/ContextMenuRepresentation { - public static final field $stable I - public static final field INSTANCE Lorg/jetbrains/jewel/IntelliJContextMenuRepresentation; - public fun Representation (Landroidx/compose/foundation/ContextMenuState;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V +public abstract interface annotation class org/jetbrains/jewel/InternalJewelApi : java/lang/annotation/Annotation { } -public abstract interface class org/jetbrains/jewel/IntelliJTheme { - public static final field Companion Lorg/jetbrains/jewel/IntelliJTheme$Companion; +public abstract interface class org/jetbrains/jewel/JewelTheme { + public static final field Companion Lorg/jetbrains/jewel/JewelTheme$Companion; } -public final class org/jetbrains/jewel/IntelliJTheme$Companion { +public final class org/jetbrains/jewel/JewelTheme$Companion { public final fun getCheckboxStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/CheckboxStyle; public final fun getChipStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/ChipStyle; public final fun getCircularProgressStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/CircularProgressStyle; - public final fun getColorPalette (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/IntelliJThemeColorPalette; + public final fun getColorPalette (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ThemeColorPalette; public final fun getContentColor (Landroidx/compose/runtime/Composer;I)J public final fun getDefaultButtonStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/ButtonStyle; public final fun getDefaultTabStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/TabStyle; @@ -365,7 +385,7 @@ public final class org/jetbrains/jewel/IntelliJTheme$Companion { public final fun getGroupHeaderStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/GroupHeaderStyle; public final fun getHorizontalProgressBarStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/HorizontalProgressBarStyle; public final fun getIconButtonStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/IconButtonStyle; - public final fun getIconData (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/IntelliJThemeIconData; + public final fun getIconData (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ThemeIconData; public final fun getLabelledTextFieldStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/LabelledTextFieldStyle; public final fun getLinkStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/LinkStyle; public final fun getMenuStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/MenuStyle; @@ -381,69 +401,14 @@ public final class org/jetbrains/jewel/IntelliJTheme$Companion { public final fun isSwingCompatMode (Landroidx/compose/runtime/Composer;I)Z } -public abstract interface class org/jetbrains/jewel/IntelliJThemeColorPalette { - public abstract fun getRawMap ()Ljava/util/Map; - public abstract fun lookup-ijrfgN4 (Ljava/lang/String;)Landroidx/compose/ui/graphics/Color; -} - -public final class org/jetbrains/jewel/IntelliJThemeColorPalette$DefaultImpls { - public static fun lookup-ijrfgN4 (Lorg/jetbrains/jewel/IntelliJThemeColorPalette;Ljava/lang/String;)Landroidx/compose/ui/graphics/Color; -} - -public abstract interface class org/jetbrains/jewel/IntelliJThemeDefinition { - public abstract fun getColorPalette ()Lorg/jetbrains/jewel/IntelliJThemeColorPalette; - public abstract fun getContentColor-0d7_KjU ()J - public abstract fun getDefaultTextStyle ()Landroidx/compose/ui/text/TextStyle; - public abstract fun getGlobalColors ()Lorg/jetbrains/jewel/GlobalColors; - public abstract fun getGlobalMetrics ()Lorg/jetbrains/jewel/GlobalMetrics; - public abstract fun getIconData ()Lorg/jetbrains/jewel/IntelliJThemeIconData; - public abstract fun isDark ()Z -} - -public abstract interface class org/jetbrains/jewel/IntelliJThemeDescriptor { - public abstract fun getColors ()Lorg/jetbrains/jewel/IntelliJThemeColorPalette; - public abstract fun getIcons ()Lorg/jetbrains/jewel/IntelliJThemeIconData; - public abstract fun getName ()Ljava/lang/String; - public abstract fun isDark ()Z -} - -public abstract interface class org/jetbrains/jewel/IntelliJThemeIconData { - public abstract fun getColorPalette ()Ljava/util/Map; - public abstract fun getIconOverrides ()Ljava/util/Map; - public abstract fun getSelectionColorPalette ()Ljava/util/Map; - public abstract fun selectionColorMapping ()Ljava/util/Map; -} - -public final class org/jetbrains/jewel/IntelliJThemeIconData$DefaultImpls { - public static fun selectionColorMapping (Lorg/jetbrains/jewel/IntelliJThemeIconData;)Ljava/util/Map; -} - -public final class org/jetbrains/jewel/IntelliJThemeKt { - public static final fun IntelliJTheme (Lorg/jetbrains/jewel/IntelliJThemeDefinition;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;I)V - public static final fun IntelliJTheme (Lorg/jetbrains/jewel/IntelliJThemeDefinition;ZLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;I)V +public final class org/jetbrains/jewel/JewelThemeKt { + public static final fun JewelTheme (Lorg/jetbrains/jewel/ThemeDefinition;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;I)V + public static final fun JewelTheme (Lorg/jetbrains/jewel/ThemeDefinition;ZLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;I)V public static final fun OverrideDarkMode (ZLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;I)V public static final fun getLocalColorPalette ()Landroidx/compose/runtime/ProvidableCompositionLocal; public static final fun getLocalIconData ()Landroidx/compose/runtime/ProvidableCompositionLocal; } -public final class org/jetbrains/jewel/IntellijTooltipPlacement : androidx/compose/foundation/TooltipPlacement { - 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; -} - -public abstract interface class org/jetbrains/jewel/InteractiveComponentState { - public abstract fun isActive ()Z - public abstract fun isEnabled ()Z - public abstract fun isHovered ()Z - public abstract fun isPressed ()Z -} - -public abstract interface annotation class org/jetbrains/jewel/InternalJewelApi : java/lang/annotation/Annotation { -} - public final class org/jetbrains/jewel/LabelledTextFieldKt { public static final fun LabelledTextField (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/Modifier;ZZLorg/jetbrains/jewel/Outline;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;ZLandroidx/compose/ui/text/input/VisualTransformation;Landroidx/compose/foundation/text/KeyboardOptions;Landroidx/compose/foundation/text/KeyboardActions;Lkotlin/jvm/functions/Function1;Lorg/jetbrains/jewel/styling/LabelledTextFieldStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/foundation/interaction/MutableInteractionSource;Landroidx/compose/runtime/Composer;III)V public static final fun LabelledTextField (Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/text/input/TextFieldValue;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/Modifier;ZZLorg/jetbrains/jewel/Outline;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;ZLandroidx/compose/ui/text/input/VisualTransformation;Landroidx/compose/foundation/text/KeyboardOptions;Landroidx/compose/foundation/text/KeyboardActions;Lkotlin/jvm/functions/Function1;Lorg/jetbrains/jewel/styling/LabelledTextFieldStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/foundation/interaction/MutableInteractionSource;Landroidx/compose/runtime/Composer;III)V @@ -599,12 +564,21 @@ public final class org/jetbrains/jewel/Outline$Companion { public final fun of (ZZ)Lorg/jetbrains/jewel/Outline; } -public abstract interface class org/jetbrains/jewel/OutlineColors { - public abstract fun getError-0d7_KjU ()J - public abstract fun getFocused-0d7_KjU ()J - public abstract fun getFocusedError-0d7_KjU ()J - public abstract fun getFocusedWarning-0d7_KjU ()J - public abstract fun getWarning-0d7_KjU ()J +public final class org/jetbrains/jewel/OutlineColors { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/OutlineColors$Companion; + public synthetic fun (JJJJJLkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getError-0d7_KjU ()J + public final fun getFocused-0d7_KjU ()J + public final fun getFocusedError-0d7_KjU ()J + public final fun getFocusedWarning-0d7_KjU ()J + public final fun getWarning-0d7_KjU ()J + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/OutlineColors$Companion { } public final class org/jetbrains/jewel/OutlineKt { @@ -819,6 +793,81 @@ public final class org/jetbrains/jewel/TextKt { public static final fun getLocalTextStyle ()Landroidx/compose/runtime/ProvidableCompositionLocal; } +public final class org/jetbrains/jewel/ThemeColorPalette { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/ThemeColorPalette$Companion; + public fun (Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/Map;)V + public final fun blue-vNxB06k (I)J + public final fun blueOrNull-ijrfgN4 (I)Landroidx/compose/ui/graphics/Color; + public fun equals (Ljava/lang/Object;)Z + public final fun getBlue ()Ljava/util/List; + public final fun getGreen ()Ljava/util/List; + public final fun getGrey ()Ljava/util/List; + public final fun getOrange ()Ljava/util/List; + public final fun getPurple ()Ljava/util/List; + public final fun getRawMap ()Ljava/util/Map; + public final fun getRed ()Ljava/util/List; + public final fun getTeal ()Ljava/util/List; + public final fun getYellow ()Ljava/util/List; + public final fun green-vNxB06k (I)J + public final fun greenOrNull-ijrfgN4 (I)Landroidx/compose/ui/graphics/Color; + public final fun grey-vNxB06k (I)J + public final fun greyOrNull-ijrfgN4 (I)Landroidx/compose/ui/graphics/Color; + public fun hashCode ()I + public final fun lookup-ijrfgN4 (Ljava/lang/String;)Landroidx/compose/ui/graphics/Color; + public final fun orange-vNxB06k (I)J + public final fun orangeOrNull-ijrfgN4 (I)Landroidx/compose/ui/graphics/Color; + public final fun purple-vNxB06k (I)J + public final fun purpleOrNull-ijrfgN4 (I)Landroidx/compose/ui/graphics/Color; + public final fun red-vNxB06k (I)J + public final fun redOrNull-ijrfgN4 (I)Landroidx/compose/ui/graphics/Color; + public final fun teal-vNxB06k (I)J + public final fun tealOrNull-ijrfgN4 (I)Landroidx/compose/ui/graphics/Color; + public fun toString ()Ljava/lang/String; + public final fun yellow-vNxB06k (I)J + public final fun yellowOrNull-ijrfgN4 (I)Landroidx/compose/ui/graphics/Color; +} + +public final class org/jetbrains/jewel/ThemeColorPalette$Companion { + public final fun getEmpty ()Lorg/jetbrains/jewel/ThemeColorPalette; +} + +public final class org/jetbrains/jewel/ThemeDefinition { + public static final field $stable I + public synthetic fun (ZLorg/jetbrains/jewel/GlobalColors;Lorg/jetbrains/jewel/GlobalMetrics;Landroidx/compose/ui/text/TextStyle;JLorg/jetbrains/jewel/ThemeColorPalette;Lorg/jetbrains/jewel/ThemeIconData;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getColorPalette ()Lorg/jetbrains/jewel/ThemeColorPalette; + public final fun getContentColor-0d7_KjU ()J + public final fun getDefaultTextStyle ()Landroidx/compose/ui/text/TextStyle; + public final fun getGlobalColors ()Lorg/jetbrains/jewel/GlobalColors; + public final fun getGlobalMetrics ()Lorg/jetbrains/jewel/GlobalMetrics; + public final fun getIconData ()Lorg/jetbrains/jewel/ThemeIconData; + public fun hashCode ()I + public final fun isDark ()Z + public fun toString ()Ljava/lang/String; +} + +public abstract interface class org/jetbrains/jewel/ThemeDescriptor { + public abstract fun getColors ()Lorg/jetbrains/jewel/ThemeColorPalette; + public abstract fun getIconData ()Lorg/jetbrains/jewel/ThemeIconData; + public abstract fun getName ()Ljava/lang/String; + public abstract fun isDark ()Z +} + +public final class org/jetbrains/jewel/ThemeIconData { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/ThemeIconData$Companion; + public fun (Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;)V + public final fun getColorPalette ()Ljava/util/Map; + public final fun getIconOverrides ()Ljava/util/Map; + public final fun getSelectionColorPalette ()Ljava/util/Map; + public final fun selectionColorMapping ()Ljava/util/Map; +} + +public final class org/jetbrains/jewel/ThemeIconData$Companion { + public final fun getEmpty ()Lorg/jetbrains/jewel/ThemeIconData; +} + public abstract interface class org/jetbrains/jewel/ToggleableComponentState : org/jetbrains/jewel/SelectableComponentState { public static final field Companion Lorg/jetbrains/jewel/ToggleableComponentState$Companion; public abstract fun getToggleableState ()Landroidx/compose/ui/state/ToggleableState; @@ -836,6 +885,14 @@ public final class org/jetbrains/jewel/TooltipKt { public static final fun Tooltip (Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/Modifier;Lorg/jetbrains/jewel/styling/TooltipStyle;Landroidx/compose/foundation/TooltipPlacement;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V } +public final class org/jetbrains/jewel/TooltipPlacement : androidx/compose/foundation/TooltipPlacement { + 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; +} + public final class org/jetbrains/jewel/foundation/BorderKt { public static final fun border (Landroidx/compose/ui/Modifier;Lorg/jetbrains/jewel/foundation/Stroke;Landroidx/compose/ui/graphics/Shape;)Landroidx/compose/ui/Modifier; public static final fun border-AkepmR4 (Landroidx/compose/ui/Modifier;Lorg/jetbrains/jewel/foundation/Stroke$Alignment;FLandroidx/compose/ui/graphics/Brush;Landroidx/compose/ui/graphics/Shape;F)Landroidx/compose/ui/Modifier; @@ -1465,15 +1522,6 @@ public final class org/jetbrains/jewel/foundation/tree/TreeViewOnKeyEvent$Defaul public static fun onSelectPreviousItem (Lorg/jetbrains/jewel/foundation/tree/TreeViewOnKeyEvent;Ljava/util/List;Lorg/jetbrains/jewel/foundation/lazy/SelectableLazyListState;)V } -public final class org/jetbrains/jewel/foundation/utils/LoggerKt { - public static final fun main ()V - public static synthetic fun main ([Ljava/lang/String;)V -} - -public final class org/jetbrains/jewel/foundation/utils/ModifierExtensionsKt { - public static final fun thenIf (Landroidx/compose/ui/Modifier;ZLkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier; -} - public abstract interface class org/jetbrains/jewel/painter/BitmapPainterHint : org/jetbrains/jewel/painter/PainterHint { public abstract fun canApplyTo (Ljava/lang/String;)Z } @@ -2990,6 +3038,7 @@ public final class org/jetbrains/jewel/util/DebugKt { public final class org/jetbrains/jewel/util/ModifierExtensionsKt { public static final fun appendIf (Landroidx/compose/ui/Modifier;ZLkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier; + public static final fun thenIf (Landroidx/compose/ui/Modifier;ZLkotlin/jvm/functions/Function1;)Landroidx/compose/ui/Modifier; } public final class org/jetbrains/jewel/util/SpinnerProgressIconGenerator { diff --git a/core/src/main/kotlin/org/jetbrains/jewel/Button.kt b/core/src/main/kotlin/org/jetbrains/jewel/Button.kt index 7521dda44..279546d88 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/Button.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/Button.kt @@ -42,8 +42,8 @@ fun DefaultButton( modifier: Modifier = Modifier, enabled: Boolean = true, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - style: ButtonStyle = IntelliJTheme.defaultButtonStyle, - textStyle: TextStyle = IntelliJTheme.textStyle, + style: ButtonStyle = JewelTheme.defaultButtonStyle, + textStyle: TextStyle = JewelTheme.textStyle, content: @Composable RowScope.() -> Unit, ) { ButtonImpl( @@ -63,8 +63,8 @@ fun OutlinedButton( modifier: Modifier = Modifier, enabled: Boolean = true, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - style: ButtonStyle = IntelliJTheme.outlinedButtonStyle, - textStyle: TextStyle = IntelliJTheme.textStyle, + style: ButtonStyle = JewelTheme.outlinedButtonStyle, + textStyle: TextStyle = JewelTheme.textStyle, content: @Composable RowScope.() -> Unit, ) { ButtonImpl( diff --git a/core/src/main/kotlin/org/jetbrains/jewel/Checkbox.kt b/core/src/main/kotlin/org/jetbrains/jewel/Checkbox.kt index 2f42e4d09..5b6cbd117 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/Checkbox.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/Checkbox.kt @@ -56,9 +56,9 @@ fun Checkbox( enabled: Boolean = true, outline: Outline = Outline.None, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - colors: CheckboxColors = IntelliJTheme.checkboxStyle.colors, - metrics: CheckboxMetrics = IntelliJTheme.checkboxStyle.metrics, - icons: CheckboxIcons = IntelliJTheme.checkboxStyle.icons, + colors: CheckboxColors = JewelTheme.checkboxStyle.colors, + metrics: CheckboxMetrics = JewelTheme.checkboxStyle.metrics, + icons: CheckboxIcons = JewelTheme.checkboxStyle.icons, textStyle: TextStyle = LocalTextStyle.current, ) { val state by remember { mutableStateOf(ToggleableState(checked)) } diff --git a/core/src/main/kotlin/org/jetbrains/jewel/Chip.kt b/core/src/main/kotlin/org/jetbrains/jewel/Chip.kt index 82871deef..dd99e726e 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/Chip.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/Chip.kt @@ -41,7 +41,7 @@ fun Chip( interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, enabled: Boolean = true, selected: Boolean = false, - style: ChipStyle = IntelliJTheme.chipStyle, + style: ChipStyle = JewelTheme.chipStyle, onClick: () -> Unit = {}, content: @Composable () -> Unit, ) { @@ -68,7 +68,7 @@ fun ToggleableChip( modifier: Modifier = Modifier, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, enabled: Boolean = true, - style: ChipStyle = IntelliJTheme.chipStyle, + style: ChipStyle = JewelTheme.chipStyle, content: @Composable () -> Unit, ) { ChipImpl( @@ -95,7 +95,7 @@ fun RadioButtonChip( modifier: Modifier = Modifier, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, enabled: Boolean = true, - style: ChipStyle = IntelliJTheme.chipStyle, + style: ChipStyle = JewelTheme.chipStyle, content: @Composable () -> Unit, ) { ChipImpl( diff --git a/core/src/main/kotlin/org/jetbrains/jewel/CircularProgressIndicator.kt b/core/src/main/kotlin/org/jetbrains/jewel/CircularProgressIndicator.kt index b10b5dedd..197edfdf9 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/CircularProgressIndicator.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/CircularProgressIndicator.kt @@ -23,7 +23,7 @@ import org.jetbrains.jewel.util.toRgbaHexString @Composable fun CircularProgressIndicator( modifier: Modifier = Modifier, - style: CircularProgressStyle = IntelliJTheme.circularProgressStyle, + style: CircularProgressStyle = JewelTheme.circularProgressStyle, ) { CircularProgressIndicatorImpl( modifier = modifier, @@ -36,7 +36,7 @@ fun CircularProgressIndicator( @Composable fun CircularProgressIndicatorBig( modifier: Modifier = Modifier, - style: CircularProgressStyle = IntelliJTheme.circularProgressStyle, + style: CircularProgressStyle = JewelTheme.circularProgressStyle, ) { CircularProgressIndicatorImpl( modifier = modifier, @@ -53,7 +53,7 @@ private fun CircularProgressIndicatorImpl( style: CircularProgressStyle, frameRetriever: (Color) -> List, ) { - val defaultColor = if (IntelliJTheme.isDark) Color(0xFF6F737A) else Color(0xFFA8ADBD) + val defaultColor = if (JewelTheme.isDark) Color(0xFF6F737A) else Color(0xFFA8ADBD) var isFrameReady by remember { mutableStateOf(false) } var currentFrame: Painter? by remember { mutableStateOf(null) } val currentPainter = currentFrame diff --git a/core/src/main/kotlin/org/jetbrains/jewel/IntelliJComponentStyling.kt b/core/src/main/kotlin/org/jetbrains/jewel/ComponentStyling.kt similarity index 97% rename from core/src/main/kotlin/org/jetbrains/jewel/IntelliJComponentStyling.kt rename to core/src/main/kotlin/org/jetbrains/jewel/ComponentStyling.kt index ecd26e04f..0307e9e0a 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/IntelliJComponentStyling.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/ComponentStyling.kt @@ -48,7 +48,7 @@ import org.jetbrains.jewel.styling.TooltipStyle @Stable @GenerateDataFunctions -class IntelliJComponentStyling( +class ComponentStyling( val checkboxStyle: CheckboxStyle, val chipStyle: ChipStyle, val circularProgressStyle: CircularProgressStyle, @@ -78,7 +78,7 @@ class IntelliJComponentStyling( LocalCheckboxStyle provides checkboxStyle, LocalChipStyle provides chipStyle, LocalCircularProgressStyle provides circularProgressStyle, - LocalContextMenuRepresentation provides IntelliJContextMenuRepresentation, + LocalContextMenuRepresentation provides ContextMenuRepresentation, LocalDefaultButtonStyle provides defaultButtonStyle, LocalDefaultDropdownStyle provides defaultDropdownStyle, LocalDefaultTabStyle provides defaultTabStyle, diff --git a/core/src/main/kotlin/org/jetbrains/jewel/ContextMenu.kt b/core/src/main/kotlin/org/jetbrains/jewel/ContextMenu.kt index 30c6d3ed6..46d6b9d6e 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/ContextMenu.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/ContextMenu.kt @@ -20,7 +20,7 @@ import androidx.compose.ui.window.PopupProperties import androidx.compose.ui.window.rememberCursorPositionProvider import org.jetbrains.jewel.styling.MenuStyle -object IntelliJContextMenuRepresentation : ContextMenuRepresentation { +object ContextMenuRepresentation : ContextMenuRepresentation { @Composable override fun Representation(state: ContextMenuState, items: () -> List) { @@ -32,7 +32,7 @@ object IntelliJContextMenuRepresentation : ContextMenuRepresentation { state.status = ContextMenuState.Status.Closed true }, - style = IntelliJTheme.menuStyle, + style = JewelTheme.menuStyle, ) { contextItems(items) } @@ -45,7 +45,7 @@ internal fun ContextMenu( onDismissRequest: (InputMode) -> Boolean, modifier: Modifier = Modifier, focusable: Boolean = true, - style: MenuStyle = IntelliJTheme.menuStyle, + style: MenuStyle = JewelTheme.menuStyle, content: MenuScope.() -> Unit, ) { var focusManager: FocusManager? by mutableStateOf(null) diff --git a/core/src/main/kotlin/org/jetbrains/jewel/Divider.kt b/core/src/main/kotlin/org/jetbrains/jewel/Divider.kt index 6450ae92f..7f0c2b7ec 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/Divider.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/Divider.kt @@ -22,7 +22,7 @@ fun Divider( color: Color = Color.Unspecified, thickness: Dp = Dp.Unspecified, startIndent: Dp = Dp.Unspecified, - style: DividerStyle = IntelliJTheme.dividerStyle, + style: DividerStyle = JewelTheme.dividerStyle, ) { val indentMod = if (startIndent.value != 0f) { Modifier.padding(start = startIndent.takeOrElse { style.metrics.startIndent }) diff --git a/core/src/main/kotlin/org/jetbrains/jewel/Dropdown.kt b/core/src/main/kotlin/org/jetbrains/jewel/Dropdown.kt index e33960ae8..9596c7687 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/Dropdown.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/Dropdown.kt @@ -47,7 +47,7 @@ import org.jetbrains.jewel.painter.hints.Stateful import org.jetbrains.jewel.styling.DropdownStyle import org.jetbrains.jewel.styling.LocalMenuStyle import org.jetbrains.jewel.styling.MenuStyle -import org.jetbrains.jewel.util.appendIf +import org.jetbrains.jewel.util.thenIf @Composable fun Dropdown( @@ -56,7 +56,7 @@ fun Dropdown( menuModifier: Modifier = Modifier, outline: Outline = Outline.None, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - style: DropdownStyle = IntelliJTheme.dropdownStyle, + style: DropdownStyle = JewelTheme.dropdownStyle, menuContent: MenuScope.() -> Unit, content: @Composable BoxScope.() -> Unit, ) { @@ -110,8 +110,8 @@ fun Dropdown( indication = null, ) .background(colors.backgroundFor(dropdownState).value, shape) - .appendIf(hasNoOutline) { border(Stroke.Alignment.Center, style.metrics.borderWidth, borderColor, shape) } - .appendIf(outline == Outline.None) { focusOutline(dropdownState, shape) } + .thenIf(hasNoOutline) { border(Stroke.Alignment.Center, style.metrics.borderWidth, borderColor, shape) } + .thenIf(outline == Outline.None) { focusOutline(dropdownState, shape) } .outline(dropdownState, outline, shape) .width(IntrinsicSize.Max) .defaultMinSize(minSize.width, minSize.height.coerceAtLeast(arrowMinSize.height)), diff --git a/core/src/main/kotlin/org/jetbrains/jewel/FocusableComponentState.kt b/core/src/main/kotlin/org/jetbrains/jewel/FocusableComponentState.kt index 60af20634..7b08a2622 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/FocusableComponentState.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/FocusableComponentState.kt @@ -19,8 +19,8 @@ interface FocusableComponentState : InteractiveComponentState { ): T = when { !isEnabled -> disabled - isPressed && !IntelliJTheme.isSwingCompatMode -> pressed - isHovered && !IntelliJTheme.isSwingCompatMode -> hovered + isPressed && !JewelTheme.isSwingCompatMode -> pressed + isHovered && !JewelTheme.isSwingCompatMode -> hovered isFocused -> focused isActive -> active else -> normal diff --git a/core/src/main/kotlin/org/jetbrains/jewel/GlobalColors.kt b/core/src/main/kotlin/org/jetbrains/jewel/GlobalColors.kt index ea346e27c..5dd42e1d5 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/GlobalColors.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/GlobalColors.kt @@ -5,39 +5,39 @@ import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.graphics.Color @Immutable -interface GlobalColors { - - val borders: BorderColors - - val outlines: OutlineColors - - val infoContent: Color - - val paneBackground: Color +@GenerateDataFunctions +class GlobalColors( + val borders: BorderColors, + val outlines: OutlineColors, + val infoContent: Color, + val paneBackground: Color, +) { + + companion object } @Immutable -interface BorderColors { - - val normal: Color - - val focused: Color - - val disabled: Color +@GenerateDataFunctions +class BorderColors( + val normal: Color, + val focused: Color, + val disabled: Color, +) { + + companion object } @Immutable -interface OutlineColors { - - val focused: Color - - val focusedWarning: Color - - val focusedError: Color - - val warning: Color - - val error: Color +@GenerateDataFunctions +class OutlineColors( + val focused: Color, + val focusedWarning: Color, + val focusedError: Color, + val warning: Color, + val error: Color, +) { + + companion object } val LocalGlobalColors = staticCompositionLocalOf { diff --git a/core/src/main/kotlin/org/jetbrains/jewel/GlobalMetrics.kt b/core/src/main/kotlin/org/jetbrains/jewel/GlobalMetrics.kt index a0e11afab..4be813ce0 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/GlobalMetrics.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/GlobalMetrics.kt @@ -5,10 +5,13 @@ import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.unit.Dp @Immutable -interface GlobalMetrics { +@GenerateDataFunctions +class GlobalMetrics( + val outlineWidth: Dp, + val rowHeight: Dp, +) { - val outlineWidth: Dp - val rowHeight: Dp + companion object } val LocalGlobalMetrics = staticCompositionLocalOf { diff --git a/core/src/main/kotlin/org/jetbrains/jewel/IconButton.kt b/core/src/main/kotlin/org/jetbrains/jewel/IconButton.kt index 61b4e4a2f..2e33a1783 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/IconButton.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/IconButton.kt @@ -28,7 +28,7 @@ fun IconButton( onClick: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, - style: IconButtonStyle = IntelliJTheme.iconButtonStyle, + style: IconButtonStyle = JewelTheme.iconButtonStyle, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, content: @Composable (BoxScope.(ButtonState) -> Unit), ) { diff --git a/core/src/main/kotlin/org/jetbrains/jewel/InputField.kt b/core/src/main/kotlin/org/jetbrains/jewel/InputField.kt index c98196a94..f93a6a94c 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/InputField.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/InputField.kt @@ -30,7 +30,7 @@ import org.jetbrains.jewel.CommonStateBitMask.Pressed import org.jetbrains.jewel.foundation.Stroke import org.jetbrains.jewel.foundation.border import org.jetbrains.jewel.styling.InputFieldStyle -import org.jetbrains.jewel.util.appendIf +import org.jetbrains.jewel.util.thenIf @Composable internal fun InputField( @@ -71,13 +71,13 @@ internal fun InputField( val backgroundColor by colors.backgroundFor(inputState) val shape = RoundedCornerShape(style.metrics.cornerSize) - val backgroundModifier = Modifier.appendIf(!undecorated && backgroundColor.isSpecified) { + val backgroundModifier = Modifier.thenIf(!undecorated && backgroundColor.isSpecified) { background(backgroundColor, shape) } val borderColor by style.colors.borderFor(inputState) val hasNoOutline = outline == Outline.None - val borderModifier = Modifier.appendIf(!undecorated && borderColor.isSpecified && hasNoOutline) { + val borderModifier = Modifier.thenIf(!undecorated && borderColor.isSpecified && hasNoOutline) { Modifier.border( alignment = Stroke.Alignment.Center, width = style.metrics.borderWidth, @@ -94,7 +94,7 @@ internal fun InputField( value = value, modifier = modifier.then(backgroundModifier) .then(borderModifier) - .appendIf(!undecorated && hasNoOutline) { focusOutline(inputState, shape) } + .thenIf(!undecorated && hasNoOutline) { focusOutline(inputState, shape) } .outline(inputState, outline, shape, Stroke.Alignment.Center), onValueChange = onValueChange, enabled = enabled, diff --git a/core/src/main/kotlin/org/jetbrains/jewel/IntelliJThemeColorPalette.kt b/core/src/main/kotlin/org/jetbrains/jewel/IntelliJThemeColorPalette.kt deleted file mode 100644 index 0ab35707d..000000000 --- a/core/src/main/kotlin/org/jetbrains/jewel/IntelliJThemeColorPalette.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.jetbrains.jewel - -import androidx.compose.runtime.Immutable -import androidx.compose.runtime.Stable -import androidx.compose.ui.graphics.Color - -@Stable -interface IntelliJThemeColorPalette { - - fun lookup(colorKey: String): Color? = rawMap[colorKey] - - val rawMap: Map -} - -@Immutable -object EmptyThemeColorPalette : IntelliJThemeColorPalette { - - override val rawMap: Map = emptyMap() -} diff --git a/core/src/main/kotlin/org/jetbrains/jewel/IntelliJThemeDefinition.kt b/core/src/main/kotlin/org/jetbrains/jewel/IntelliJThemeDefinition.kt deleted file mode 100644 index 31ba5d9f4..000000000 --- a/core/src/main/kotlin/org/jetbrains/jewel/IntelliJThemeDefinition.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.jetbrains.jewel - -import androidx.compose.runtime.Immutable -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.text.TextStyle - -@Immutable -interface IntelliJThemeDefinition { - - val isDark: Boolean - val globalColors: GlobalColors - val globalMetrics: GlobalMetrics - val defaultTextStyle: TextStyle - val contentColor: Color - - val colorPalette: IntelliJThemeColorPalette - val iconData: IntelliJThemeIconData -} diff --git a/core/src/main/kotlin/org/jetbrains/jewel/IntelliJThemeDescriptor.kt b/core/src/main/kotlin/org/jetbrains/jewel/IntelliJThemeDescriptor.kt deleted file mode 100644 index ef1e13442..000000000 --- a/core/src/main/kotlin/org/jetbrains/jewel/IntelliJThemeDescriptor.kt +++ /dev/null @@ -1,9 +0,0 @@ -package org.jetbrains.jewel - -interface IntelliJThemeDescriptor { - - val name: String - val isDark: Boolean - val colors: IntelliJThemeColorPalette - val icons: IntelliJThemeIconData -} diff --git a/core/src/main/kotlin/org/jetbrains/jewel/IntelliJTheme.kt b/core/src/main/kotlin/org/jetbrains/jewel/JewelTheme.kt similarity index 92% rename from core/src/main/kotlin/org/jetbrains/jewel/IntelliJTheme.kt rename to core/src/main/kotlin/org/jetbrains/jewel/JewelTheme.kt index 0eb10a832..b3daa1a0e 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/IntelliJTheme.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/JewelTheme.kt @@ -47,7 +47,7 @@ import org.jetbrains.jewel.styling.TextAreaStyle import org.jetbrains.jewel.styling.TextFieldStyle import org.jetbrains.jewel.styling.TooltipStyle -interface IntelliJTheme { +interface JewelTheme { companion object { @@ -85,12 +85,12 @@ interface IntelliJTheme { @ReadOnlyComposable get() = LocalSwingCompatMode.current - val colorPalette: IntelliJThemeColorPalette + val colorPalette: ThemeColorPalette @Composable @ReadOnlyComposable get() = LocalColorPalette.current - val iconData: IntelliJThemeIconData + val iconData: ThemeIconData @Composable @ReadOnlyComposable get() = LocalIconData.current @@ -198,6 +198,7 @@ interface IntelliJTheme { @Composable @ReadOnlyComposable get() = LocalTooltipStyle.current + val iconButtonStyle: IconButtonStyle @Composable @ReadOnlyComposable @@ -206,18 +207,18 @@ interface IntelliJTheme { } @Composable -fun IntelliJTheme( - theme: IntelliJThemeDefinition, +fun JewelTheme( + theme: ThemeDefinition, swingCompatMode: Boolean, content: @Composable () -> Unit, ) { CompositionLocalProvider(LocalSwingCompatMode provides swingCompatMode) { - IntelliJTheme(theme, content) + JewelTheme(theme, content) } } @Composable -fun IntelliJTheme(theme: IntelliJThemeDefinition, content: @Composable () -> Unit) { +fun JewelTheme(theme: ThemeDefinition, content: @Composable () -> Unit) { CompositionLocalProvider( LocalIsDarkTheme provides theme.isDark, LocalContentColor provides theme.contentColor, @@ -229,7 +230,7 @@ fun IntelliJTheme(theme: IntelliJThemeDefinition, content: @Composable () -> Uni } internal val LocalIsDarkTheme = staticCompositionLocalOf { - error("No InDarkTheme provided") + error("No IsDarkTheme provided") } internal val LocalSwingCompatMode = staticCompositionLocalOf { @@ -237,17 +238,15 @@ internal val LocalSwingCompatMode = staticCompositionLocalOf { false } -val LocalColorPalette = staticCompositionLocalOf { - EmptyThemeColorPalette +val LocalColorPalette = staticCompositionLocalOf { + ThemeColorPalette.Empty } -val LocalIconData = staticCompositionLocalOf { - EmptyThemeIconData +val LocalIconData = staticCompositionLocalOf { + ThemeIconData.Empty } -/** - * Overrides the dark mode of the current area. - */ +/** Overrides the dark mode for the current composition scope. */ @Composable fun OverrideDarkMode(isDark: Boolean, content: @Composable () -> Unit) { CompositionLocalProvider(LocalIsDarkTheme provides isDark, content = content) diff --git a/core/src/main/kotlin/org/jetbrains/jewel/LabelledTextField.kt b/core/src/main/kotlin/org/jetbrains/jewel/LabelledTextField.kt index db2f36d55..6147fcdcf 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/LabelledTextField.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/LabelledTextField.kt @@ -47,8 +47,8 @@ fun LabelledTextField( keyboardOptions: KeyboardOptions = KeyboardOptions.Default, keyboardActions: KeyboardActions = KeyboardActions(), onTextLayout: (TextLayoutResult) -> Unit = {}, - style: LabelledTextFieldStyle = IntelliJTheme.labelledTextFieldStyle, - textStyle: TextStyle = IntelliJTheme.textStyle, + style: LabelledTextFieldStyle = JewelTheme.labelledTextFieldStyle, + textStyle: TextStyle = JewelTheme.textStyle, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, ) { var textFieldValueState by remember { mutableStateOf(TextFieldValue(text = value)) } @@ -111,8 +111,8 @@ fun LabelledTextField( keyboardOptions: KeyboardOptions = KeyboardOptions.Default, keyboardActions: KeyboardActions = KeyboardActions(), onTextLayout: (TextLayoutResult) -> Unit = {}, - style: LabelledTextFieldStyle = IntelliJTheme.labelledTextFieldStyle, - textStyle: TextStyle = IntelliJTheme.textStyle, + style: LabelledTextFieldStyle = JewelTheme.labelledTextFieldStyle, + textStyle: TextStyle = JewelTheme.textStyle, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, ) { LabelledTextFieldLayout( diff --git a/core/src/main/kotlin/org/jetbrains/jewel/LazyTree.kt b/core/src/main/kotlin/org/jetbrains/jewel/LazyTree.kt index bc2da6877..ad80f5b98 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/LazyTree.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/LazyTree.kt @@ -25,7 +25,7 @@ fun LazyTree( onElementDoubleClick: (Tree.Element) -> Unit = {}, onSelectionChange: (List>) -> Unit = {}, keyActions: KeyBindingActions = DefaultTreeViewKeyActions(treeState), - style: LazyTreeStyle = IntelliJTheme.treeStyle, + style: LazyTreeStyle = JewelTheme.treeStyle, nodeContent: @Composable (SelectableLazyItemScope.(Tree.Element) -> Unit), ) { val colors = style.colors diff --git a/core/src/main/kotlin/org/jetbrains/jewel/LinearProgressBar.kt b/core/src/main/kotlin/org/jetbrains/jewel/LinearProgressBar.kt index 2774f68a4..ae2585e09 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/LinearProgressBar.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/LinearProgressBar.kt @@ -30,7 +30,7 @@ import org.jetbrains.jewel.styling.HorizontalProgressBarStyle fun HorizontalProgressBar( progress: Float, // from 0 to 1 modifier: Modifier = Modifier, - style: HorizontalProgressBarStyle = IntelliJTheme.horizontalProgressBarStyle, + style: HorizontalProgressBarStyle = JewelTheme.horizontalProgressBarStyle, ) { val colors = style.colors val shape = RoundedCornerShape(style.metrics.cornerSize) @@ -59,7 +59,7 @@ fun HorizontalProgressBar( @Composable fun IndeterminateHorizontalProgressBar( modifier: Modifier = Modifier, - style: HorizontalProgressBarStyle = IntelliJTheme.horizontalProgressBarStyle, + style: HorizontalProgressBarStyle = JewelTheme.horizontalProgressBarStyle, ) { val infiniteTransition = rememberInfiniteTransition() diff --git a/core/src/main/kotlin/org/jetbrains/jewel/Link.kt b/core/src/main/kotlin/org/jetbrains/jewel/Link.kt index cef6271f8..98172d5e4 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/Link.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/Link.kt @@ -39,7 +39,7 @@ import org.jetbrains.jewel.CommonStateBitMask.Enabled import org.jetbrains.jewel.CommonStateBitMask.Focused import org.jetbrains.jewel.CommonStateBitMask.Hovered import org.jetbrains.jewel.CommonStateBitMask.Pressed -import org.jetbrains.jewel.IntelliJTheme.Companion.isSwingCompatMode +import org.jetbrains.jewel.JewelTheme.Companion.isSwingCompatMode import org.jetbrains.jewel.foundation.onHover import org.jetbrains.jewel.painter.PainterProvider import org.jetbrains.jewel.painter.hints.Stateful @@ -47,7 +47,7 @@ import org.jetbrains.jewel.styling.LinkStyle import org.jetbrains.jewel.styling.LocalLinkStyle import org.jetbrains.jewel.styling.LocalMenuStyle import org.jetbrains.jewel.styling.MenuStyle -import org.jetbrains.jewel.util.appendIf +import org.jetbrains.jewel.util.thenIf import java.awt.Cursor @Composable @@ -252,7 +252,7 @@ private fun LinkImpl( Row( modifier = modifier - .appendIf(linkState.isEnabled) { pointerChangeModifier } + .thenIf(linkState.isEnabled) { pointerChangeModifier } .clickable( onClick = { linkState = linkState.copy(visited = true) diff --git a/core/src/main/kotlin/org/jetbrains/jewel/Menu.kt b/core/src/main/kotlin/org/jetbrains/jewel/Menu.kt index 7569834d5..a9be6f775 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/Menu.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/Menu.kt @@ -80,7 +80,7 @@ fun PopupMenu( onDismissRequest: (InputMode) -> Boolean, horizontalAlignment: Alignment.Horizontal, modifier: Modifier = Modifier, - style: MenuStyle = IntelliJTheme.menuStyle, + style: MenuStyle = JewelTheme.menuStyle, content: MenuScope.() -> Unit, ) { val density = LocalDensity.current @@ -127,7 +127,7 @@ fun PopupMenu( @Composable internal fun MenuContent( modifier: Modifier = Modifier, - style: MenuStyle = IntelliJTheme.menuStyle, + style: MenuStyle = JewelTheme.menuStyle, content: MenuScope.() -> Unit, ) { val items by remember(content) { @@ -288,8 +288,8 @@ private data class SubmenuItem( @Composable fun MenuSeparator( modifier: Modifier = Modifier, - metrics: MenuItemMetrics = IntelliJTheme.menuStyle.metrics.itemMetrics, - colors: MenuItemColors = IntelliJTheme.menuStyle.colors.itemColors, + metrics: MenuItemMetrics = JewelTheme.menuStyle.metrics.itemMetrics, + colors: MenuItemColors = JewelTheme.menuStyle.colors.itemColors, ) { Divider( orientation = Orientation.Horizontal, @@ -306,7 +306,7 @@ fun MenuItem( modifier: Modifier = Modifier, enabled: Boolean = true, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - style: MenuStyle = IntelliJTheme.menuStyle, + style: MenuStyle = JewelTheme.menuStyle, content: @Composable () -> Unit, ) { var itemState by remember(interactionSource) { @@ -388,7 +388,7 @@ fun MenuSubmenuItem( modifier: Modifier = Modifier, enabled: Boolean = true, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - style: MenuStyle = IntelliJTheme.menuStyle, + style: MenuStyle = JewelTheme.menuStyle, submenu: MenuScope.() -> Unit, content: @Composable () -> Unit, ) { @@ -517,7 +517,7 @@ private fun Size.subtract(paddingValues: PaddingValues, density: Density, layout internal fun Submenu( onDismissRequest: (InputMode) -> Boolean, modifier: Modifier = Modifier, - style: MenuStyle = IntelliJTheme.menuStyle, + style: MenuStyle = JewelTheme.menuStyle, content: MenuScope.() -> Unit, ) { val density = LocalDensity.current diff --git a/core/src/main/kotlin/org/jetbrains/jewel/Outline.kt b/core/src/main/kotlin/org/jetbrains/jewel/Outline.kt index d2ef4fb49..96abd47a9 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/Outline.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/Outline.kt @@ -6,7 +6,7 @@ import androidx.compose.ui.graphics.Shape import androidx.compose.ui.unit.Dp import org.jetbrains.jewel.foundation.Stroke import org.jetbrains.jewel.foundation.border -import org.jetbrains.jewel.foundation.utils.thenIf +import org.jetbrains.jewel.util.thenIf enum class Outline { None, @@ -30,9 +30,9 @@ fun Modifier.focusOutline( state: FocusableComponentState, outlineShape: Shape, alignment: Stroke.Alignment = Stroke.Alignment.Outside, - outlineWidth: Dp = IntelliJTheme.globalMetrics.outlineWidth, + outlineWidth: Dp = JewelTheme.globalMetrics.outlineWidth, ): Modifier { - val outlineColors = IntelliJTheme.globalColors.outlines + val outlineColors = JewelTheme.globalColors.outlines return thenIf(state.isFocused) { val outlineColor = outlineColors.focused @@ -46,9 +46,9 @@ fun Modifier.outline( outline: Outline, outlineShape: Shape, alignment: Stroke.Alignment = Stroke.Alignment.Outside, - outlineWidth: Dp = IntelliJTheme.globalMetrics.outlineWidth, + outlineWidth: Dp = JewelTheme.globalMetrics.outlineWidth, ): Modifier { - val outlineColors = IntelliJTheme.globalColors.outlines + val outlineColors = JewelTheme.globalColors.outlines return thenIf(outline != Outline.None) { val outlineColor = when { diff --git a/core/src/main/kotlin/org/jetbrains/jewel/RadioButton.kt b/core/src/main/kotlin/org/jetbrains/jewel/RadioButton.kt index 5b3bdb34a..221212d16 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/RadioButton.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/RadioButton.kt @@ -46,8 +46,8 @@ fun RadioButton( enabled: Boolean = true, outline: Outline = Outline.None, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - style: RadioButtonStyle = IntelliJTheme.radioButtonStyle, - textStyle: TextStyle = IntelliJTheme.textStyle, + style: RadioButtonStyle = JewelTheme.radioButtonStyle, + textStyle: TextStyle = JewelTheme.textStyle, ) { RadioButtonImpl( selected = selected, @@ -71,8 +71,8 @@ fun RadioButtonRow( enabled: Boolean = true, outline: Outline = Outline.None, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - style: RadioButtonStyle = IntelliJTheme.radioButtonStyle, - textStyle: TextStyle = IntelliJTheme.textStyle, + style: RadioButtonStyle = JewelTheme.radioButtonStyle, + textStyle: TextStyle = JewelTheme.textStyle, ) { RadioButtonImpl( selected = selected, @@ -96,8 +96,8 @@ fun RadioButtonRow( enabled: Boolean = true, outline: Outline = Outline.None, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - style: RadioButtonStyle = IntelliJTheme.radioButtonStyle, - textStyle: TextStyle = IntelliJTheme.textStyle, + style: RadioButtonStyle = JewelTheme.radioButtonStyle, + textStyle: TextStyle = JewelTheme.textStyle, content: @Composable RowScope.() -> Unit, ) { RadioButtonImpl( diff --git a/core/src/main/kotlin/org/jetbrains/jewel/Scrollbars.kt b/core/src/main/kotlin/org/jetbrains/jewel/Scrollbars.kt index efab635a8..8432ed78a 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/Scrollbars.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/Scrollbars.kt @@ -24,7 +24,7 @@ fun VerticalScrollbar( modifier: Modifier = Modifier, reverseLayout: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - style: ScrollbarStyle = IntelliJTheme.scrollbarStyle, + style: ScrollbarStyle = JewelTheme.scrollbarStyle, ) { val shape by remember { mutableStateOf(RoundedCornerShape(style.metrics.thumbCornerSize)) } val hoverDurationMillis by remember { mutableStateOf(style.hoverDuration.inWholeMilliseconds) } @@ -55,7 +55,7 @@ fun HorizontalScrollbar( modifier: Modifier = Modifier, reverseLayout: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - style: ScrollbarStyle = IntelliJTheme.scrollbarStyle, + style: ScrollbarStyle = JewelTheme.scrollbarStyle, ) { val shape by remember { mutableStateOf(RoundedCornerShape(style.metrics.thumbCornerSize)) } val hoverDurationMillis by remember { mutableStateOf(style.hoverDuration.toInt(DurationUnit.MILLISECONDS)) } @@ -86,7 +86,7 @@ fun TabStripHorizontalScrollbar( modifier: Modifier = Modifier, reverseLayout: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - style: ScrollbarStyle = IntelliJTheme.scrollbarStyle, + style: ScrollbarStyle = JewelTheme.scrollbarStyle, ) { val shape by remember { mutableStateOf(RoundedCornerShape(style.metrics.thumbCornerSize)) } val hoverDurationMillis by remember { mutableStateOf(style.hoverDuration.inWholeMilliseconds.toInt()) } diff --git a/core/src/main/kotlin/org/jetbrains/jewel/SplitLayout.kt b/core/src/main/kotlin/org/jetbrains/jewel/SplitLayout.kt index f85c57677..7a81d118f 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/SplitLayout.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/SplitLayout.kt @@ -32,7 +32,7 @@ fun HorizontalSplitLayout( first: @Composable (Modifier) -> Unit, second: @Composable (Modifier) -> Unit, modifier: Modifier = Modifier, - dividerColor: Color = IntelliJTheme.globalColors.borders.normal, + dividerColor: Color = JewelTheme.globalColors.borders.normal, dividerThickness: Dp = 1.dp, dividerIndent: Dp = 0.dp, draggableWidth: Dp = 8.dp, @@ -117,7 +117,7 @@ fun VerticalSplitLayout( first: @Composable (Modifier) -> Unit, second: @Composable (Modifier) -> Unit, modifier: Modifier = Modifier, - dividerColor: Color = IntelliJTheme.globalColors.borders.normal, + dividerColor: Color = JewelTheme.globalColors.borders.normal, dividerThickness: Dp = 1.dp, dividerIndent: Dp = 0.dp, draggableWidth: Dp = 8.dp, diff --git a/core/src/main/kotlin/org/jetbrains/jewel/Tabs.kt b/core/src/main/kotlin/org/jetbrains/jewel/Tabs.kt index baeb74cf6..1292a439d 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/Tabs.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/Tabs.kt @@ -52,8 +52,8 @@ internal fun TabImpl( interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, ) { val tabStyle = when (tabData) { - is TabData.Default -> IntelliJTheme.defaultTabStyle - is TabData.Editor -> IntelliJTheme.editorTabStyle + is TabData.Default -> JewelTheme.defaultTabStyle + is TabData.Editor -> JewelTheme.editorTabStyle } var tabState by remember { mutableStateOf(TabState.of(selected = tabData.selected, active = isActive)) } diff --git a/core/src/main/kotlin/org/jetbrains/jewel/Text.kt b/core/src/main/kotlin/org/jetbrains/jewel/Text.kt index 10e0c9427..e55355353 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/Text.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/Text.kt @@ -35,7 +35,7 @@ fun Text( softWrap: Boolean = true, maxLines: Int = Int.MAX_VALUE, onTextLayout: (TextLayoutResult) -> Unit = {}, - style: TextStyle = IntelliJTheme.textStyle, + style: TextStyle = JewelTheme.textStyle, ) { Text( AnnotatedString(text), @@ -76,7 +76,7 @@ fun Text( maxLines: Int = Int.MAX_VALUE, inlineContent: Map = emptyMap(), onTextLayout: (TextLayoutResult) -> Unit = {}, - style: TextStyle = IntelliJTheme.textStyle, + style: TextStyle = JewelTheme.textStyle, ) { val textColor = color.takeOrElse { LocalContentColor.current.takeOrElse { diff --git a/core/src/main/kotlin/org/jetbrains/jewel/TextArea.kt b/core/src/main/kotlin/org/jetbrains/jewel/TextArea.kt index 8929a96ee..f1dd64d6d 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/TextArea.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/TextArea.kt @@ -45,8 +45,8 @@ fun TextArea( keyboardActions: KeyboardActions = KeyboardActions(), maxLines: Int = Int.MAX_VALUE, onTextLayout: (TextLayoutResult) -> Unit = {}, - style: TextAreaStyle = IntelliJTheme.textAreaStyle, - textStyle: TextStyle = IntelliJTheme.textStyle, + style: TextAreaStyle = JewelTheme.textAreaStyle, + textStyle: TextStyle = JewelTheme.textStyle, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, ) { var textFieldValueState by remember { mutableStateOf(TextFieldValue(text = value)) } @@ -101,8 +101,8 @@ fun TextArea( keyboardActions: KeyboardActions = KeyboardActions(), maxLines: Int = Int.MAX_VALUE, onTextLayout: (TextLayoutResult) -> Unit = {}, - style: TextAreaStyle = IntelliJTheme.textAreaStyle, - textStyle: TextStyle = IntelliJTheme.textStyle, + style: TextAreaStyle = JewelTheme.textAreaStyle, + textStyle: TextStyle = JewelTheme.textStyle, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, ) { val minSize = style.metrics.minSize diff --git a/core/src/main/kotlin/org/jetbrains/jewel/TextField.kt b/core/src/main/kotlin/org/jetbrains/jewel/TextField.kt index 199967e90..2c0e7f3aa 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/TextField.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/TextField.kt @@ -47,7 +47,7 @@ fun TextField( keyboardOptions: KeyboardOptions = KeyboardOptions.Default, keyboardActions: KeyboardActions = KeyboardActions(), onTextLayout: (TextLayoutResult) -> Unit = {}, - style: TextFieldStyle = IntelliJTheme.textFieldStyle, + style: TextFieldStyle = JewelTheme.textFieldStyle, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, ) { var textFieldValueState by remember { mutableStateOf(TextFieldValue(text = value)) } @@ -103,8 +103,8 @@ fun TextField( keyboardOptions: KeyboardOptions = KeyboardOptions.Default, keyboardActions: KeyboardActions = KeyboardActions(), onTextLayout: (TextLayoutResult) -> Unit = {}, - style: TextFieldStyle = IntelliJTheme.textFieldStyle, - textStyle: TextStyle = IntelliJTheme.textStyle, + style: TextFieldStyle = JewelTheme.textFieldStyle, + textStyle: TextStyle = JewelTheme.textStyle, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, ) { InputField( diff --git a/core/src/main/kotlin/org/jetbrains/jewel/ThemeColorPalette.kt b/core/src/main/kotlin/org/jetbrains/jewel/ThemeColorPalette.kt new file mode 100644 index 000000000..1c256ca67 --- /dev/null +++ b/core/src/main/kotlin/org/jetbrains/jewel/ThemeColorPalette.kt @@ -0,0 +1,90 @@ +package org.jetbrains.jewel + +import androidx.compose.runtime.Immutable +import androidx.compose.ui.graphics.Color + +private val colorKeyRegex: Regex + get() = "([a-z]+)(\\d+)".toRegex(RegexOption.IGNORE_CASE) + +@Immutable +@GenerateDataFunctions +class ThemeColorPalette( + val grey: List, + val blue: List, + val green: List, + val red: List, + val yellow: List, + val orange: List, + val purple: List, + val teal: List, + val rawMap: Map, +) { + + fun grey(index: Int): Color = grey[index - 1] + + fun greyOrNull(index: Int): Color? = grey.getOrNull(index - 1) + + fun blue(index: Int): Color = blue[index - 1] + + fun blueOrNull(index: Int): Color? = blue.getOrNull(index - 1) + + fun green(index: Int): Color = green[index - 1] + + fun greenOrNull(index: Int): Color? = green.getOrNull(index - 1) + + fun red(index: Int): Color = red[index - 1] + + fun redOrNull(index: Int): Color? = red.getOrNull(index - 1) + + fun yellow(index: Int): Color = yellow[index - 1] + + fun yellowOrNull(index: Int): Color? = yellow.getOrNull(index - 1) + + fun orange(index: Int): Color = orange[index - 1] + fun orangeOrNull(index: Int): Color? = orange.getOrNull(index - 1) + + fun purple(index: Int): Color = purple[index - 1] + + fun purpleOrNull(index: Int): Color? = purple.getOrNull(index - 1) + + fun teal(index: Int): Color = teal[index - 1] + + fun tealOrNull(index: Int): Color? = teal.getOrNull(index - 1) + + fun lookup(colorKey: String): Color? { + val result = colorKeyRegex.matchEntire(colorKey.trim()) + val colorGroup = result?.groupValues?.get(1)?.lowercase() + val colorIndex = result?.groupValues?.get(2)?.toIntOrNull() + + if (colorGroup == null || colorIndex == null) { + return rawMap[colorKey] + } + + return when (colorGroup) { + "grey" -> grey(colorIndex) + "blue" -> blue(colorIndex) + "green" -> green(colorIndex) + "red" -> red(colorIndex) + "yellow" -> yellow(colorIndex) + "orange" -> orange(colorIndex) + "purple" -> purple(colorIndex) + "teal" -> teal(colorIndex) + else -> null + } + } + + companion object { + + val Empty = ThemeColorPalette( + grey = emptyList(), + blue = emptyList(), + green = emptyList(), + red = emptyList(), + yellow = emptyList(), + orange = emptyList(), + purple = emptyList(), + teal = emptyList(), + rawMap = emptyMap(), + ) + } +} diff --git a/core/src/main/kotlin/org/jetbrains/jewel/ThemeDefinition.kt b/core/src/main/kotlin/org/jetbrains/jewel/ThemeDefinition.kt new file mode 100644 index 000000000..81f9c5587 --- /dev/null +++ b/core/src/main/kotlin/org/jetbrains/jewel/ThemeDefinition.kt @@ -0,0 +1,17 @@ +package org.jetbrains.jewel + +import androidx.compose.runtime.Immutable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.TextStyle + +@Immutable +@GenerateDataFunctions +class ThemeDefinition( + val isDark: Boolean, + val globalColors: GlobalColors, + val globalMetrics: GlobalMetrics, + val defaultTextStyle: TextStyle, + val contentColor: Color, + val colorPalette: ThemeColorPalette, + val iconData: ThemeIconData, +) diff --git a/core/src/main/kotlin/org/jetbrains/jewel/ThemeDescriptor.kt b/core/src/main/kotlin/org/jetbrains/jewel/ThemeDescriptor.kt new file mode 100644 index 000000000..982e4336c --- /dev/null +++ b/core/src/main/kotlin/org/jetbrains/jewel/ThemeDescriptor.kt @@ -0,0 +1,12 @@ +package org.jetbrains.jewel + +import androidx.compose.runtime.Immutable + +@Immutable +interface ThemeDescriptor { + + val name: String + val isDark: Boolean + val colors: ThemeColorPalette + val iconData: ThemeIconData +} diff --git a/core/src/main/kotlin/org/jetbrains/jewel/IntelliJThemeIconData.kt b/core/src/main/kotlin/org/jetbrains/jewel/ThemeIconData.kt similarity index 61% rename from core/src/main/kotlin/org/jetbrains/jewel/IntelliJThemeIconData.kt rename to core/src/main/kotlin/org/jetbrains/jewel/ThemeIconData.kt index 18a42d88b..dfad02bc8 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/IntelliJThemeIconData.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/ThemeIconData.kt @@ -4,11 +4,11 @@ import androidx.compose.runtime.Immutable import androidx.compose.ui.graphics.Color @Immutable -interface IntelliJThemeIconData { - - val iconOverrides: Map - val colorPalette: Map - val selectionColorPalette: Map +class ThemeIconData( + val iconOverrides: Map, + val colorPalette: Map, + val selectionColorPalette: Map, +) { fun selectionColorMapping() = selectionColorPalette.mapNotNull { (key, value) -> @@ -16,6 +16,15 @@ interface IntelliJThemeIconData { val valueColor = Color(value) keyColor to valueColor }.toMap() + + companion object { + + val Empty = ThemeIconData( + iconOverrides = emptyMap(), + colorPalette = emptyMap(), + selectionColorPalette = emptyMap(), + ) + } } internal fun String.toColorOrNull() = @@ -33,16 +42,3 @@ internal fun String.toColorOrNull() = } ?.toLongOrNull(radix = 16) ?.let { Color(it) } - -@Immutable -object EmptyThemeIconData : IntelliJThemeIconData { - - override val iconOverrides: Map = emptyMap() - - override val colorPalette: Map = emptyMap() - - override val selectionColorPalette: Map = emptyMap() - - override fun toString() = - "EmptyThemeIconData(iconOverrides=[], colorPalette=[], selectionColorPalette=[])" -} diff --git a/core/src/main/kotlin/org/jetbrains/jewel/Tooltip.kt b/core/src/main/kotlin/org/jetbrains/jewel/Tooltip.kt index 90565aa4f..beb669729 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/Tooltip.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/Tooltip.kt @@ -32,8 +32,8 @@ import org.jetbrains.jewel.util.isDark fun Tooltip( tooltip: @Composable () -> Unit, modifier: Modifier = Modifier, - style: TooltipStyle = IntelliJTheme.tooltipStyle, - tooltipPlacement: TooltipPlacement = IntellijTooltipPlacement( + style: TooltipStyle = JewelTheme.tooltipStyle, + tooltipPlacement: TooltipPlacement = TooltipPlacement( contentOffset = style.metrics.tooltipOffset, alignment = style.metrics.tooltipAlignment, density = LocalDensity.current, @@ -77,7 +77,7 @@ fun Tooltip( ) } -class IntellijTooltipPlacement( +class TooltipPlacement( private val contentOffset: DpOffset, private val alignment: Alignment.Horizontal, private val density: Density, @@ -91,19 +91,18 @@ class IntellijTooltipPlacement( } @Composable - override fun positionProvider(cursorPosition: Offset): PopupPositionProvider { - return rememberIntellijTooltipPositionProvider( + override fun positionProvider(cursorPosition: Offset): PopupPositionProvider = + rememberTooltipPositionProvider( cursorPosition = cursorPosition, contentOffset = contentOffset, alignment = alignment, density = density, windowMargin = windowMargin, ) - } } @Composable -private fun rememberIntellijTooltipPositionProvider( +private fun rememberTooltipPositionProvider( cursorPosition: Offset, contentOffset: DpOffset, alignment: Alignment.Horizontal, @@ -115,7 +114,7 @@ private fun rememberIntellijTooltipPositionProvider( density, windowMargin, ) { - IntellijTooltipPositionProvider( + TooltipPositionProvider( cursorPosition = cursorPosition, contentOffset = contentOffset, alignment = alignment, @@ -124,7 +123,7 @@ private fun rememberIntellijTooltipPositionProvider( ) } -private class IntellijTooltipPositionProvider( +private class TooltipPositionProvider( private val cursorPosition: Offset, private val contentOffset: DpOffset, private val alignment: Alignment.Horizontal, diff --git a/core/src/main/kotlin/org/jetbrains/jewel/foundation/utils/Logger.kt b/core/src/main/kotlin/org/jetbrains/jewel/foundation/utils/Logger.kt index 90dd42884..651dfbe35 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/foundation/utils/Logger.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/foundation/utils/Logger.kt @@ -37,6 +37,7 @@ internal interface Logger { } } +// TODO remove and replace with real logger internal object Log : Logger { override var currentLogLevel: LogLevel = LogLevel.Off @@ -44,13 +45,3 @@ internal object Log : Logger { if (currentLogLevel.ordinal <= level.ordinal) println(msg) } } - -fun main() { - Log.currentLogLevel = LogLevel.Trace - Log.e(Log.currentLogLevel.name) - Log.t("this is a trace message") - Log.d("this is a debug message") - Log.i("this is an info message") - Log.w("this is a warning message") - Log.e("this is a severe message") -} diff --git a/core/src/main/kotlin/org/jetbrains/jewel/foundation/utils/ModifierExtensions.kt b/core/src/main/kotlin/org/jetbrains/jewel/foundation/utils/ModifierExtensions.kt deleted file mode 100644 index f0dce3ea7..000000000 --- a/core/src/main/kotlin/org/jetbrains/jewel/foundation/utils/ModifierExtensions.kt +++ /dev/null @@ -1,10 +0,0 @@ -package org.jetbrains.jewel.foundation.utils - -import androidx.compose.ui.Modifier - -/** - * Concatenate the result of [action] if [condition] is `true`, - * otherwise return the receiver [Modifier] untouched. - */ -fun Modifier.thenIf(condition: Boolean, action: Modifier.() -> Modifier): Modifier = - if (condition) action(this) else this diff --git a/core/src/main/kotlin/org/jetbrains/jewel/painter/PainterHintsProvider.kt b/core/src/main/kotlin/org/jetbrains/jewel/painter/PainterHintsProvider.kt index fb6b363ee..e29720f5a 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/painter/PainterHintsProvider.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/painter/PainterHintsProvider.kt @@ -4,7 +4,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.Immutable import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.platform.LocalDensity -import org.jetbrains.jewel.IntelliJTheme +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.painter.hints.Dark import org.jetbrains.jewel.painter.hints.HiDpi @@ -40,7 +40,7 @@ object CommonPainterHintsProvider : PainterHintsProvider { @Composable override fun hints(path: String): List = listOf( HiDpi(LocalDensity.current), - Dark(IntelliJTheme.isDark), + Dark(JewelTheme.isDark), ) } diff --git a/core/src/main/kotlin/org/jetbrains/jewel/styling/ChipStyling.kt b/core/src/main/kotlin/org/jetbrains/jewel/styling/ChipStyling.kt index 5706cf8f1..1de7df973 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/styling/ChipStyling.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/styling/ChipStyling.kt @@ -12,7 +12,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import org.jetbrains.jewel.ChipState import org.jetbrains.jewel.GenerateDataFunctions -import org.jetbrains.jewel.IntelliJTheme +import org.jetbrains.jewel.JewelTheme @Stable @GenerateDataFunctions @@ -106,17 +106,17 @@ class ChipColors( if (state.isSelected) { when { !state.isEnabled -> borderSelectedDisabled - state.isPressed && !IntelliJTheme.isSwingCompatMode -> borderSelectedPressed + state.isPressed && !JewelTheme.isSwingCompatMode -> borderSelectedPressed state.isFocused -> borderSelectedFocused - state.isHovered && !IntelliJTheme.isSwingCompatMode -> borderSelectedHovered + state.isHovered && !JewelTheme.isSwingCompatMode -> borderSelectedHovered else -> borderSelected } } else { when { !state.isEnabled -> borderDisabled - state.isPressed && !IntelliJTheme.isSwingCompatMode -> borderPressed + state.isPressed && !JewelTheme.isSwingCompatMode -> borderPressed state.isFocused -> borderFocused - state.isHovered && !IntelliJTheme.isSwingCompatMode -> borderHovered + state.isHovered && !JewelTheme.isSwingCompatMode -> borderHovered else -> border } }, diff --git a/core/src/main/kotlin/org/jetbrains/jewel/util/ModifierExtensions.kt b/core/src/main/kotlin/org/jetbrains/jewel/util/ModifierExtensions.kt index 0f4979796..4af44445e 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/util/ModifierExtensions.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/util/ModifierExtensions.kt @@ -2,5 +2,12 @@ package org.jetbrains.jewel.util import androidx.compose.ui.Modifier +@Deprecated( + "Use thenIf instead", + ReplaceWith("thenIf(precondition, action)"), +) inline fun Modifier.appendIf(precondition: Boolean, action: Modifier.() -> Modifier) = + thenIf(precondition, action) + +inline fun Modifier.thenIf(precondition: Boolean, action: Modifier.() -> Modifier) = if (precondition) action() else this diff --git a/decorated-window/api/decorated-window.api b/decorated-window/api/decorated-window.api index 5b77a7da3..b981ed88c 100644 --- a/decorated-window/api/decorated-window.api +++ b/decorated-window/api/decorated-window.api @@ -90,8 +90,8 @@ public final class org/jetbrains/jewel/window/DecoratedWindowState$Companion { } public final class org/jetbrains/jewel/window/ThemeKt { - public static final fun getDefaultDecoratedWindowStyle (Lorg/jetbrains/jewel/IntelliJTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/window/styling/DecoratedWindowStyle; - public static final fun getDefaultTitleBarStyle (Lorg/jetbrains/jewel/IntelliJTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/window/styling/TitleBarStyle; + public static final fun getDefaultDecoratedWindowStyle (Lorg/jetbrains/jewel/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/window/styling/DecoratedWindowStyle; + public static final fun getDefaultTitleBarStyle (Lorg/jetbrains/jewel/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/window/styling/TitleBarStyle; } public final class org/jetbrains/jewel/window/TitleBarKt { @@ -109,72 +109,127 @@ public final class org/jetbrains/jewel/window/TitleBar_MacOSKt { public static synthetic fun newFullscreenControls$default (Landroidx/compose/ui/Modifier;ZILjava/lang/Object;)Landroidx/compose/ui/Modifier; } -public abstract interface class org/jetbrains/jewel/window/styling/DecoratedWindowColors { - public abstract fun borderFor-3hEOMOc (JLandroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; - public abstract fun getBorder-0d7_KjU ()J - public abstract fun getBorderInactive-0d7_KjU ()J +public final class org/jetbrains/jewel/window/styling/DecoratedWindowColors { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors$Companion; + public synthetic fun (JJLkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun borderFor-3hEOMOc (JLandroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; + public fun equals (Ljava/lang/Object;)Z + public final fun getBorder-0d7_KjU ()J + public final fun getBorderInactive-0d7_KjU ()J + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/window/styling/DecoratedWindowColors$Companion { +} + +public final class org/jetbrains/jewel/window/styling/DecoratedWindowMetrics { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/window/styling/DecoratedWindowMetrics$Companion; + public synthetic fun (FLkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getBorderWidth-D9Ej5fM ()F + public fun hashCode ()I + public fun toString ()Ljava/lang/String; } -public final class org/jetbrains/jewel/window/styling/DecoratedWindowColors$DefaultImpls { - public static fun borderFor-3hEOMOc (Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors;JLandroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; +public final class org/jetbrains/jewel/window/styling/DecoratedWindowMetrics$Companion { } -public abstract interface class org/jetbrains/jewel/window/styling/DecoratedWindowMetrics { - public abstract fun getBorderWidth-D9Ej5fM ()F +public final class org/jetbrains/jewel/window/styling/DecoratedWindowStyle { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/window/styling/DecoratedWindowStyle$Companion; + public fun (Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors;Lorg/jetbrains/jewel/window/styling/DecoratedWindowMetrics;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getColors ()Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors; + public final fun getMetrics ()Lorg/jetbrains/jewel/window/styling/DecoratedWindowMetrics; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; } -public abstract interface class org/jetbrains/jewel/window/styling/DecoratedWindowStyle { - public abstract fun getColors ()Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors; - public abstract fun getMetrics ()Lorg/jetbrains/jewel/window/styling/DecoratedWindowMetrics; +public final class org/jetbrains/jewel/window/styling/DecoratedWindowStyle$Companion { } public final class org/jetbrains/jewel/window/styling/DecoratedWindowStylingKt { public static final fun getLocalDecoratedWindowStyle ()Landroidx/compose/runtime/ProvidableCompositionLocal; } -public abstract interface class org/jetbrains/jewel/window/styling/TitleBarColors { - public abstract fun backgroundFor-3hEOMOc (JLandroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; - public abstract fun getBackground-0d7_KjU ()J - public abstract fun getBorder-0d7_KjU ()J - public abstract fun getContent-0d7_KjU ()J - public abstract fun getDropdownHoveredBackground-0d7_KjU ()J - public abstract fun getDropdownPressedBackground-0d7_KjU ()J - public abstract fun getFullscreenControlButtonsBackground-0d7_KjU ()J - public abstract fun getIconButtonHoveredBackground-0d7_KjU ()J - public abstract fun getIconButtonPressedBackground-0d7_KjU ()J - public abstract fun getInactiveBackground-0d7_KjU ()J - public abstract fun getTitlePaneButtonHoveredBackground-0d7_KjU ()J - public abstract fun getTitlePaneButtonPressedBackground-0d7_KjU ()J - public abstract fun getTitlePaneCloseButtonHoveredBackground-0d7_KjU ()J - public abstract fun getTitlePaneCloseButtonPressedBackground-0d7_KjU ()J -} - -public final class org/jetbrains/jewel/window/styling/TitleBarColors$DefaultImpls { - public static fun backgroundFor-3hEOMOc (Lorg/jetbrains/jewel/window/styling/TitleBarColors;JLandroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; -} - -public abstract interface class org/jetbrains/jewel/window/styling/TitleBarIcons { - public abstract fun getCloseButton ()Lorg/jetbrains/jewel/painter/PainterProvider; - public abstract fun getMaximizeButton ()Lorg/jetbrains/jewel/painter/PainterProvider; - public abstract fun getMinimizeButton ()Lorg/jetbrains/jewel/painter/PainterProvider; - public abstract fun getRestoreButton ()Lorg/jetbrains/jewel/painter/PainterProvider; -} - -public abstract interface class org/jetbrains/jewel/window/styling/TitleBarMetrics { - public abstract fun getGradientEndX-D9Ej5fM ()F - public abstract fun getGradientStartX-D9Ej5fM ()F - public abstract fun getHeight-D9Ej5fM ()F - public abstract fun getTitlePaneButtonSize-MYxV2XQ ()J -} - -public abstract interface class org/jetbrains/jewel/window/styling/TitleBarStyle { - public abstract fun getColors ()Lorg/jetbrains/jewel/window/styling/TitleBarColors; - public abstract fun getDropdownStyle ()Lorg/jetbrains/jewel/styling/DropdownStyle; - public abstract fun getIconButtonStyle ()Lorg/jetbrains/jewel/styling/IconButtonStyle; - public abstract fun getIcons ()Lorg/jetbrains/jewel/window/styling/TitleBarIcons; - public abstract fun getMetrics ()Lorg/jetbrains/jewel/window/styling/TitleBarMetrics; - public abstract fun getPaneButtonStyle ()Lorg/jetbrains/jewel/styling/IconButtonStyle; - public abstract fun getPaneCloseButtonStyle ()Lorg/jetbrains/jewel/styling/IconButtonStyle; +public final class org/jetbrains/jewel/window/styling/TitleBarColors { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/window/styling/TitleBarColors$Companion; + public synthetic fun (JJJJJJJJJJJJJLkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun backgroundFor-3hEOMOc (JLandroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; + public fun equals (Ljava/lang/Object;)Z + public final fun getBackground-0d7_KjU ()J + public final fun getBorder-0d7_KjU ()J + public final fun getContent-0d7_KjU ()J + public final fun getDropdownHoveredBackground-0d7_KjU ()J + public final fun getDropdownPressedBackground-0d7_KjU ()J + public final fun getFullscreenControlButtonsBackground-0d7_KjU ()J + public final fun getIconButtonHoveredBackground-0d7_KjU ()J + public final fun getIconButtonPressedBackground-0d7_KjU ()J + public final fun getInactiveBackground-0d7_KjU ()J + public final fun getTitlePaneButtonHoveredBackground-0d7_KjU ()J + public final fun getTitlePaneButtonPressedBackground-0d7_KjU ()J + public final fun getTitlePaneCloseButtonHoveredBackground-0d7_KjU ()J + public final fun getTitlePaneCloseButtonPressedBackground-0d7_KjU ()J + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/window/styling/TitleBarColors$Companion { +} + +public final class org/jetbrains/jewel/window/styling/TitleBarIcons { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/window/styling/TitleBarIcons$Companion; + public fun (Lorg/jetbrains/jewel/painter/PainterProvider;Lorg/jetbrains/jewel/painter/PainterProvider;Lorg/jetbrains/jewel/painter/PainterProvider;Lorg/jetbrains/jewel/painter/PainterProvider;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getCloseButton ()Lorg/jetbrains/jewel/painter/PainterProvider; + public final fun getMaximizeButton ()Lorg/jetbrains/jewel/painter/PainterProvider; + public final fun getMinimizeButton ()Lorg/jetbrains/jewel/painter/PainterProvider; + public final fun getRestoreButton ()Lorg/jetbrains/jewel/painter/PainterProvider; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/window/styling/TitleBarIcons$Companion { +} + +public final class org/jetbrains/jewel/window/styling/TitleBarMetrics { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/window/styling/TitleBarMetrics$Companion; + public synthetic fun (FFFJLkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getGradientEndX-D9Ej5fM ()F + public final fun getGradientStartX-D9Ej5fM ()F + public final fun getHeight-D9Ej5fM ()F + public final fun getTitlePaneButtonSize-MYxV2XQ ()J + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/window/styling/TitleBarMetrics$Companion { +} + +public final class org/jetbrains/jewel/window/styling/TitleBarStyle { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/window/styling/TitleBarStyle$Companion; + public fun (Lorg/jetbrains/jewel/window/styling/TitleBarColors;Lorg/jetbrains/jewel/window/styling/TitleBarMetrics;Lorg/jetbrains/jewel/window/styling/TitleBarIcons;Lorg/jetbrains/jewel/styling/DropdownStyle;Lorg/jetbrains/jewel/styling/IconButtonStyle;Lorg/jetbrains/jewel/styling/IconButtonStyle;Lorg/jetbrains/jewel/styling/IconButtonStyle;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getColors ()Lorg/jetbrains/jewel/window/styling/TitleBarColors; + public final fun getDropdownStyle ()Lorg/jetbrains/jewel/styling/DropdownStyle; + public final fun getIconButtonStyle ()Lorg/jetbrains/jewel/styling/IconButtonStyle; + public final fun getIcons ()Lorg/jetbrains/jewel/window/styling/TitleBarIcons; + public final fun getMetrics ()Lorg/jetbrains/jewel/window/styling/TitleBarMetrics; + public final fun getPaneButtonStyle ()Lorg/jetbrains/jewel/styling/IconButtonStyle; + public final fun getPaneCloseButtonStyle ()Lorg/jetbrains/jewel/styling/IconButtonStyle; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/window/styling/TitleBarStyle$Companion { } public final class org/jetbrains/jewel/window/styling/TitleBarStylingKt { diff --git a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/DecoratedWindow.kt b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/DecoratedWindow.kt index 4238a6170..c2e4f13c0 100644 --- a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/DecoratedWindow.kt +++ b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/DecoratedWindow.kt @@ -31,7 +31,7 @@ import androidx.compose.ui.window.WindowPlacement import androidx.compose.ui.window.WindowState import androidx.compose.ui.window.rememberWindowState import com.jetbrains.JBR -import org.jetbrains.jewel.IntelliJTheme +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.foundation.Stroke import org.jetbrains.jewel.foundation.border import org.jetbrains.jewel.window.styling.DecoratedWindowStyle @@ -53,7 +53,7 @@ import java.awt.event.WindowEvent alwaysOnTop: Boolean = false, onPreviewKeyEvent: (KeyEvent) -> Boolean = { false }, onKeyEvent: (KeyEvent) -> Boolean = { false }, - style: DecoratedWindowStyle = IntelliJTheme.defaultDecoratedWindowStyle, + style: DecoratedWindowStyle = JewelTheme.defaultDecoratedWindowStyle, content: @Composable DecoratedWindowScope.() -> Unit, ) { remember { diff --git a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/Theme.kt b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/Theme.kt index 690b7d151..26696ee02 100644 --- a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/Theme.kt +++ b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/Theme.kt @@ -2,18 +2,18 @@ package org.jetbrains.jewel.window import androidx.compose.runtime.Composable import androidx.compose.runtime.ReadOnlyComposable -import org.jetbrains.jewel.IntelliJTheme +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.window.styling.DecoratedWindowStyle import org.jetbrains.jewel.window.styling.LocalDecoratedWindowStyle import org.jetbrains.jewel.window.styling.LocalTitleBarStyle import org.jetbrains.jewel.window.styling.TitleBarStyle -val IntelliJTheme.Companion.defaultTitleBarStyle: TitleBarStyle +val JewelTheme.Companion.defaultTitleBarStyle: TitleBarStyle @Composable @ReadOnlyComposable get() = LocalTitleBarStyle.current -val IntelliJTheme.Companion.defaultDecoratedWindowStyle: DecoratedWindowStyle +val JewelTheme.Companion.defaultDecoratedWindowStyle: DecoratedWindowStyle @Composable @ReadOnlyComposable get() = LocalDecoratedWindowStyle.current diff --git a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.Linux.kt b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.Linux.kt index 1a4235bba..8056163b3 100644 --- a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.Linux.kt +++ b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.Linux.kt @@ -16,7 +16,7 @@ import androidx.compose.ui.unit.dp import com.jetbrains.JBR import org.jetbrains.jewel.Icon import org.jetbrains.jewel.IconButton -import org.jetbrains.jewel.IntelliJTheme +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.painter.PainterHint import org.jetbrains.jewel.painter.PainterProvider import org.jetbrains.jewel.painter.PainterSuffixHint @@ -29,7 +29,7 @@ import java.awt.event.WindowEvent @Composable internal fun DecoratedWindowScope.TitleBarOnLinux( modifier: Modifier = Modifier, gradientStartColor: Color = Color.Unspecified, - style: TitleBarStyle = IntelliJTheme.defaultTitleBarStyle, + style: TitleBarStyle = JewelTheme.defaultTitleBarStyle, content: @Composable TitleBarScope.(DecoratedWindowState) -> Unit, ) { var lastPress = 0L @@ -75,7 +75,7 @@ import java.awt.event.WindowEvent @Composable private fun TitleBarScope.CloseButton( onClick: () -> Unit, state: DecoratedWindowState, - style: TitleBarStyle = IntelliJTheme.defaultTitleBarStyle, + style: TitleBarStyle = JewelTheme.defaultTitleBarStyle, ) { ControlButton(onClick, state, style.icons.closeButton, "Close", style, style.paneCloseButtonStyle) } @@ -85,7 +85,7 @@ import java.awt.event.WindowEvent state: DecoratedWindowState, painterProvider: PainterProvider, description: String, - style: TitleBarStyle = IntelliJTheme.defaultTitleBarStyle, + style: TitleBarStyle = JewelTheme.defaultTitleBarStyle, iconButtonStyle: IconButtonStyle = style.paneButtonStyle, ) { IconButton( diff --git a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.MacOS.kt b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.MacOS.kt index 8699defac..06711db6e 100644 --- a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.MacOS.kt +++ b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.MacOS.kt @@ -11,7 +11,7 @@ import androidx.compose.ui.platform.InspectorInfo import androidx.compose.ui.platform.debugInspectorInfo import androidx.compose.ui.unit.dp import com.jetbrains.JBR -import org.jetbrains.jewel.IntelliJTheme +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.window.styling.TitleBarStyle import org.jetbrains.jewel.window.utils.macos.MacUtil @@ -58,7 +58,7 @@ private class NewFullscreenControlsNode( @Composable internal fun DecoratedWindowScope.TitleBarOnMacOs( modifier: Modifier = Modifier, gradientStartColor: Color = Color.Unspecified, - style: TitleBarStyle = IntelliJTheme.defaultTitleBarStyle, + style: TitleBarStyle = JewelTheme.defaultTitleBarStyle, content: @Composable TitleBarScope.(DecoratedWindowState) -> Unit, ) { val newFullscreenControls = modifier.foldOut(false) { e, r -> diff --git a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.Windows.kt b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.Windows.kt index 9f94771c9..66ffbaa9e 100644 --- a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.Windows.kt +++ b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.Windows.kt @@ -13,14 +13,14 @@ import com.jetbrains.JBR import com.jetbrains.WindowDecorations.CustomTitleBar import kotlinx.coroutines.currentCoroutineContext import kotlinx.coroutines.isActive -import org.jetbrains.jewel.IntelliJTheme +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.util.isDark import org.jetbrains.jewel.window.styling.TitleBarStyle @Composable internal fun DecoratedWindowScope.TitleBarOnWindows( modifier: Modifier = Modifier, gradientStartColor: Color = Color.Unspecified, - style: TitleBarStyle = IntelliJTheme.defaultTitleBarStyle, + style: TitleBarStyle = JewelTheme.defaultTitleBarStyle, content: @Composable TitleBarScope.(DecoratedWindowState) -> Unit, ) { val titleBar = remember { JBR.getWindowDecorations().createCustomTitleBar() } diff --git a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.kt b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.kt index 104ee03a7..4f628f586 100644 --- a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.kt +++ b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/TitleBar.kt @@ -38,7 +38,7 @@ import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.offset -import org.jetbrains.jewel.IntelliJTheme +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.LocalContentColor import org.jetbrains.jewel.OverrideDarkMode import org.jetbrains.jewel.styling.LocalDefaultDropdownStyle @@ -59,7 +59,7 @@ internal const val TITLE_BAR_BORDER_LAYOUT_ID = "__TITLE_BAR_BORDER__" @Composable fun DecoratedWindowScope.TitleBar( modifier: Modifier = Modifier, gradientStartColor: Color = Color.Unspecified, - style: TitleBarStyle = IntelliJTheme.defaultTitleBarStyle, + style: TitleBarStyle = JewelTheme.defaultTitleBarStyle, content: @Composable TitleBarScope.(DecoratedWindowState) -> Unit, ) { when (DesktopPlatform.Current) { @@ -73,7 +73,7 @@ internal const val TITLE_BAR_BORDER_LAYOUT_ID = "__TITLE_BAR_BORDER__" @Composable internal fun DecoratedWindowScope.TitleBarImpl( modifier: Modifier = Modifier, gradientStartColor: Color = Color.Unspecified, - style: TitleBarStyle = IntelliJTheme.defaultTitleBarStyle, + style: TitleBarStyle = JewelTheme.defaultTitleBarStyle, applyTitleBar: (Dp, DecoratedWindowState) -> PaddingValues, content: @Composable TitleBarScope.(DecoratedWindowState) -> Unit, ) { diff --git a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/styling/DecoratedWindowStyling.kt b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/styling/DecoratedWindowStyling.kt index 3506a630b..9bdcf0a86 100644 --- a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/styling/DecoratedWindowStyling.kt +++ b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/styling/DecoratedWindowStyling.kt @@ -1,24 +1,30 @@ package org.jetbrains.jewel.window.styling import androidx.compose.runtime.Composable -import androidx.compose.runtime.Stable +import androidx.compose.runtime.Immutable import androidx.compose.runtime.rememberUpdatedState import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp +import org.jetbrains.jewel.GenerateDataFunctions import org.jetbrains.jewel.window.DecoratedWindowState -interface DecoratedWindowStyle { +@Immutable +@GenerateDataFunctions +class DecoratedWindowStyle( + val colors: DecoratedWindowColors, + val metrics: DecoratedWindowMetrics, +) { - val colors: DecoratedWindowColors - val metrics: DecoratedWindowMetrics + companion object } -@Stable -interface DecoratedWindowColors { - - val border: Color - val borderInactive: Color +@Immutable +@GenerateDataFunctions +class DecoratedWindowColors( + val border: Color, + val borderInactive: Color, +) { @Composable fun borderFor(state: DecoratedWindowState) = rememberUpdatedState( @@ -27,12 +33,15 @@ interface DecoratedWindowColors { else -> border }, ) + + companion object } -@Stable -interface DecoratedWindowMetrics { +@Immutable +@GenerateDataFunctions +class DecoratedWindowMetrics(val borderWidth: Dp) { - val borderWidth: Dp + companion object } val LocalDecoratedWindowStyle = staticCompositionLocalOf { diff --git a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/styling/TitleBarStyling.kt b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/styling/TitleBarStyling.kt index 3fd5550cf..d53022fce 100644 --- a/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/styling/TitleBarStyling.kt +++ b/decorated-window/src/main/kotlin/org/jetbrains/jewel/window/styling/TitleBarStyling.kt @@ -8,50 +8,54 @@ import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.DpSize +import org.jetbrains.jewel.GenerateDataFunctions import org.jetbrains.jewel.painter.PainterProvider import org.jetbrains.jewel.styling.DropdownStyle import org.jetbrains.jewel.styling.IconButtonStyle import org.jetbrains.jewel.window.DecoratedWindowState @Stable -interface TitleBarStyle { - - val colors: TitleBarColors - val metrics: TitleBarMetrics - val icons: TitleBarIcons - - val dropdownStyle: DropdownStyle - val iconButtonStyle: IconButtonStyle - val paneButtonStyle: IconButtonStyle - val paneCloseButtonStyle: IconButtonStyle +@GenerateDataFunctions +class TitleBarStyle( + val colors: TitleBarColors, + val metrics: TitleBarMetrics, + val icons: TitleBarIcons, + val dropdownStyle: DropdownStyle, + val iconButtonStyle: IconButtonStyle, + val paneButtonStyle: IconButtonStyle, + val paneCloseButtonStyle: IconButtonStyle, +) { + + companion object } -@Stable -interface TitleBarColors { - - val background: Color - val inactiveBackground: Color - val content: Color - val border: Color +@Immutable +@GenerateDataFunctions +class TitleBarColors( + val background: Color, + val inactiveBackground: Color, + val content: Color, + val border: Color, // The background color for newControlButtons(three circles in left top corner) in MacOS fullscreen mode - val fullscreenControlButtonsBackground: Color + val fullscreenControlButtonsBackground: Color, // The hover and press background color for window control buttons(minimize, maximize) in Linux - val titlePaneButtonHoveredBackground: Color - val titlePaneButtonPressedBackground: Color + val titlePaneButtonHoveredBackground: Color, + val titlePaneButtonPressedBackground: Color, // The hover and press background color for window close button in Linux - val titlePaneCloseButtonHoveredBackground: Color - val titlePaneCloseButtonPressedBackground: Color + val titlePaneCloseButtonHoveredBackground: Color, + val titlePaneCloseButtonPressedBackground: Color, // The hover and press background color for IconButtons in title bar content - val iconButtonHoveredBackground: Color - val iconButtonPressedBackground: Color + val iconButtonHoveredBackground: Color, + val iconButtonPressedBackground: Color, // The hover and press background color for Dropdown in title bar content - val dropdownPressedBackground: Color - val dropdownHoveredBackground: Color + val dropdownPressedBackground: Color, + val dropdownHoveredBackground: Color, +) { @Composable fun backgroundFor(state: DecoratedWindowState) = rememberUpdatedState( @@ -60,30 +64,32 @@ interface TitleBarColors { else -> background }, ) -} - -@Stable -interface TitleBarMetrics { - val height: Dp - - val gradientStartX: Dp - - val gradientEndX: Dp - - val titlePaneButtonSize: DpSize + companion object } @Immutable -interface TitleBarIcons { - - val minimizeButton: PainterProvider - - val maximizeButton: PainterProvider - - val restoreButton: PainterProvider +@GenerateDataFunctions +class TitleBarMetrics( + val height: Dp, + val gradientStartX: Dp, + val gradientEndX: Dp, + val titlePaneButtonSize: DpSize, +) { + + companion object +} - val closeButton: PainterProvider +@Immutable +@GenerateDataFunctions +class TitleBarIcons( + val minimizeButton: PainterProvider, + val maximizeButton: PainterProvider, + val restoreButton: PainterProvider, + val closeButton: PainterProvider, +) { + + companion object } val LocalTitleBarStyle = staticCompositionLocalOf { diff --git a/ide-laf-bridge/api/ide-laf-bridge.api b/ide-laf-bridge/api/ide-laf-bridge.api index 2edf40322..ce8d752e5 100644 --- a/ide-laf-bridge/api/ide-laf-bridge.api +++ b/ide-laf-bridge/api/ide-laf-bridge.api @@ -1,33 +1,20 @@ -public final class org/jetbrains/jewel/bridge/BridgeResourceResolverKt { - public static final fun bridgePainterProvider (Ljava/lang/String;)Lorg/jetbrains/jewel/painter/ResourcePainterProvider; +public final class org/jetbrains/jewel/bridge/BridgeGlobalColorsKt { + public static final fun readFromLaF (Lorg/jetbrains/jewel/BorderColors$Companion;)Lorg/jetbrains/jewel/BorderColors; + public static final fun readFromLaF (Lorg/jetbrains/jewel/GlobalColors$Companion;)Lorg/jetbrains/jewel/GlobalColors; + public static final fun readFromLaF (Lorg/jetbrains/jewel/OutlineColors$Companion;)Lorg/jetbrains/jewel/OutlineColors; } -public final class org/jetbrains/jewel/bridge/BridgeThemeColorPalette : org/jetbrains/jewel/intui/core/IntUiThemeColorPalette { - public static final field $stable I - public static final field Companion Lorg/jetbrains/jewel/bridge/BridgeThemeColorPalette$Companion; - public synthetic fun (Ljava/util/Map;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;Ljava/util/List;JLkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun blue ()Ljava/util/List; - public fun blue-vNxB06k (I)J - public fun getRawMap ()Ljava/util/Map; - public fun green ()Ljava/util/List; - public fun green-vNxB06k (I)J - public fun grey ()Ljava/util/List; - public fun grey-vNxB06k (I)J - public fun lookup-ijrfgN4 (Ljava/lang/String;)Landroidx/compose/ui/graphics/Color; - public fun orange ()Ljava/util/List; - public fun orange-vNxB06k (I)J - public fun purple ()Ljava/util/List; - public fun purple-vNxB06k (I)J - public fun red ()Ljava/util/List; - public fun red-vNxB06k (I)J - public fun teal ()Ljava/util/List; - public fun teal-vNxB06k (I)J - public fun yellow ()Ljava/util/List; - public fun yellow-vNxB06k (I)J +public final class org/jetbrains/jewel/bridge/BridgeGlobalMetricsKt { + public static final fun readFromLaF (Lorg/jetbrains/jewel/GlobalMetrics$Companion;)Lorg/jetbrains/jewel/GlobalMetrics; +} + +public final class org/jetbrains/jewel/bridge/BridgeResourceResolverKt { + public static final fun bridgePainterProvider (Ljava/lang/String;)Lorg/jetbrains/jewel/painter/ResourcePainterProvider; } -public final class org/jetbrains/jewel/bridge/BridgeThemeColorPalette$Companion { - public final fun readFromLaF ()Lorg/jetbrains/jewel/bridge/BridgeThemeColorPalette; +public final class org/jetbrains/jewel/bridge/BridgeThemeColorPaletteKt { + public static final fun getWindowsPopupBorder (Lorg/jetbrains/jewel/ThemeColorPalette;)Landroidx/compose/ui/graphics/Color; + public static final fun readFromLaF (Lorg/jetbrains/jewel/ThemeColorPalette$Companion;)Lorg/jetbrains/jewel/ThemeColorPalette; } public final class org/jetbrains/jewel/bridge/BridgeUtilsKt { diff --git a/ide-laf-bridge/build.gradle.kts b/ide-laf-bridge/build.gradle.kts index c504420fb..35df42911 100644 --- a/ide-laf-bridge/build.gradle.kts +++ b/ide-laf-bridge/build.gradle.kts @@ -1,4 +1,5 @@ -import SupportedIJVersion.* +import SupportedIJVersion.IJ_232 +import SupportedIJVersion.IJ_233 plugins { jewel @@ -8,7 +9,7 @@ plugins { } dependencies { - api(projects.intUi.intUiStandalone) { + api(projects.intUi.intUiCore) { exclude(group = "org.jetbrains.kotlinx") } when (supportedIJVersion()) { diff --git a/ide-laf-bridge/ide-laf-bridge-232/api/ide-laf-bridge-232.api b/ide-laf-bridge/ide-laf-bridge-232/api/ide-laf-bridge-232.api index 514854488..190647519 100644 --- a/ide-laf-bridge/ide-laf-bridge-232/api/ide-laf-bridge-232.api +++ b/ide-laf-bridge/ide-laf-bridge-232/api/ide-laf-bridge-232.api @@ -1,5 +1,5 @@ -public final class org/jetbrains/jewel/bridge/BridgeIconData$Companion { - public final fun readFromLaF ()Lorg/jetbrains/jewel/bridge/BridgeIconData; +public final class org/jetbrains/jewel/bridge/BridgeIconDataKt { + public static final fun readFromLaF (Lorg/jetbrains/jewel/ThemeIconData$Companion;)Lorg/jetbrains/jewel/ThemeIconData; } public final class org/jetbrains/jewel/bridge/BridgePainterHintsProvider$Companion { diff --git a/ide-laf-bridge/ide-laf-bridge-232/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeIconData.kt b/ide-laf-bridge/ide-laf-bridge-232/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeIconData.kt index ea6ff34ee..4af24bf3b 100644 --- a/ide-laf-bridge/ide-laf-bridge-232/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeIconData.kt +++ b/ide-laf-bridge/ide-laf-bridge-232/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeIconData.kt @@ -1,55 +1,18 @@ package org.jetbrains.jewel.bridge -import androidx.compose.runtime.Immutable import com.intellij.ide.ui.UITheme import com.intellij.ui.ColorUtil -import org.jetbrains.jewel.IntelliJThemeIconData import org.jetbrains.jewel.InternalJewelApi - -@Immutable -@InternalJewelApi -class BridgeIconData( - override val iconOverrides: Map, - override val colorPalette: Map, - override val selectionColorPalette: Map, -) : IntelliJThemeIconData { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as BridgeIconData - - if (iconOverrides != other.iconOverrides) return false - if (colorPalette != other.colorPalette) return false - if (selectionColorPalette != other.selectionColorPalette) return false - - return true +import org.jetbrains.jewel.ThemeIconData + +@OptIn(InternalJewelApi::class) +fun ThemeIconData.Companion.readFromLaF(): ThemeIconData { + val uiTheme = currentUiThemeOrNull() + val iconMap = uiTheme?.icons.orEmpty() + val selectedIconColorPalette = uiTheme?.selectedIconColorPalette.orEmpty().mapValues { + ColorUtil.fromHex(it.value).rgb } - override fun hashCode(): Int { - var result = iconOverrides.hashCode() - result = 31 * result + colorPalette.hashCode() - result = 31 * result + selectionColorPalette.hashCode() - return result - } - - override fun toString(): String = - "BridgeIconData(iconOverrides=$iconOverrides, colorPalette=$colorPalette, " + - "selectionColorPalette=$selectionColorPalette)" - - companion object { - - @OptIn(InternalJewelApi::class) - fun readFromLaF(): BridgeIconData { - val uiTheme = currentUiThemeOrNull() - val iconMap = uiTheme?.icons.orEmpty() - val selectedIconColorPalette = uiTheme?.selectedIconColorPalette.orEmpty().mapValues { - ColorUtil.fromHex(it.value).rgb - } - - val colorPalette = UITheme.getColorPalette() - return BridgeIconData(iconMap, colorPalette, selectedIconColorPalette) - } - } + val colorPalette = UITheme.getColorPalette() + return ThemeIconData(iconMap, colorPalette, selectedIconColorPalette) } diff --git a/ide-laf-bridge/ide-laf-bridge-232/src/main/kotlin/org/jetbrains/jewel/bridge/BridgePainterHintsProvider.kt b/ide-laf-bridge/ide-laf-bridge-232/src/main/kotlin/org/jetbrains/jewel/bridge/BridgePainterHintsProvider.kt index a14b2be9e..b6591184f 100644 --- a/ide-laf-bridge/ide-laf-bridge-232/src/main/kotlin/org/jetbrains/jewel/bridge/BridgePainterHintsProvider.kt +++ b/ide-laf-bridge/ide-laf-bridge-232/src/main/kotlin/org/jetbrains/jewel/bridge/BridgePainterHintsProvider.kt @@ -5,8 +5,8 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalDensity import com.intellij.ide.ui.UITheme import com.intellij.openapi.diagnostic.thisLogger -import org.jetbrains.jewel.IntelliJTheme import org.jetbrains.jewel.InternalJewelApi +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.intui.core.IntUiPainterHintsProvider import org.jetbrains.jewel.painter.PainterHint import org.jetbrains.jewel.painter.hints.Dark @@ -31,7 +31,7 @@ class BridgePainterHintsProvider private constructor( add(getPaletteHint(path)) add(BridgeOverride) add(HiDpi(LocalDensity.current)) - add(Dark(IntelliJTheme.isDark)) + add(Dark(JewelTheme.isDark)) } companion object { diff --git a/ide-laf-bridge/ide-laf-bridge-233/api/ide-laf-bridge-233.api b/ide-laf-bridge/ide-laf-bridge-233/api/ide-laf-bridge-233.api index 5a977b11b..6856e0c63 100644 --- a/ide-laf-bridge/ide-laf-bridge-233/api/ide-laf-bridge-233.api +++ b/ide-laf-bridge/ide-laf-bridge-233/api/ide-laf-bridge-233.api @@ -1,5 +1,5 @@ -public final class org/jetbrains/jewel/bridge/BridgeIconData$Companion { - public final fun readFromLaF ()Lorg/jetbrains/jewel/bridge/BridgeIconData; +public final class org/jetbrains/jewel/bridge/BridgeIconDataKt { + public static final fun readFromLaF (Lorg/jetbrains/jewel/ThemeIconData$Companion;)Lorg/jetbrains/jewel/ThemeIconData; } public final class org/jetbrains/jewel/bridge/BridgePainterHintsProvider$Companion { diff --git a/ide-laf-bridge/ide-laf-bridge-233/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeIconData.kt b/ide-laf-bridge/ide-laf-bridge-233/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeIconData.kt index 0078240f5..0ca830cc3 100644 --- a/ide-laf-bridge/ide-laf-bridge-233/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeIconData.kt +++ b/ide-laf-bridge/ide-laf-bridge-233/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeIconData.kt @@ -1,53 +1,15 @@ package org.jetbrains.jewel.bridge -import androidx.compose.runtime.Immutable import com.intellij.ide.ui.UITheme -import org.jetbrains.jewel.IntelliJThemeIconData -import org.jetbrains.jewel.InternalJewelApi +import org.jetbrains.jewel.ThemeIconData -@Immutable -@InternalJewelApi -class BridgeIconData( - override val iconOverrides: Map, - override val colorPalette: Map, - override val selectionColorPalette: Map, -) : IntelliJThemeIconData { +@Suppress("UnstableApiUsage") +fun ThemeIconData.Companion.readFromLaF(): ThemeIconData { + val uiTheme = currentUiThemeOrNull() + val bean = uiTheme?.describe() + val iconMap = bean?.icons.orEmpty() + val selectedIconColorPalette = bean?.iconColorsOnSelection.orEmpty() - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as BridgeIconData - - if (iconOverrides != other.iconOverrides) return false - if (colorPalette != other.colorPalette) return false - if (selectionColorPalette != other.selectionColorPalette) return false - - return true - } - - override fun hashCode(): Int { - var result = iconOverrides.hashCode() - result = 31 * result + colorPalette.hashCode() - result = 31 * result + selectionColorPalette.hashCode() - return result - } - - override fun toString(): String = - "BridgeIconData(iconOverrides=$iconOverrides, colorPalette=$colorPalette, " + - "selectionColorPalette=$selectionColorPalette)" - - companion object { - - @Suppress("UnstableApiUsage") - fun readFromLaF(): BridgeIconData { - val uiTheme = currentUiThemeOrNull() - val bean = uiTheme?.describe() - val iconMap = bean?.icons.orEmpty() - val selectedIconColorPalette = bean?.iconColorsOnSelection.orEmpty() - - val colorPalette = UITheme.getColorPalette() - return BridgeIconData(iconMap, colorPalette, selectedIconColorPalette) - } - } + val colorPalette = UITheme.getColorPalette() + return ThemeIconData(iconMap, colorPalette, selectedIconColorPalette) } diff --git a/ide-laf-bridge/ide-laf-bridge-233/src/main/kotlin/org/jetbrains/jewel/bridge/BridgePainterHintsProvider.kt b/ide-laf-bridge/ide-laf-bridge-233/src/main/kotlin/org/jetbrains/jewel/bridge/BridgePainterHintsProvider.kt index 327fe34d4..832adf0b0 100644 --- a/ide-laf-bridge/ide-laf-bridge-233/src/main/kotlin/org/jetbrains/jewel/bridge/BridgePainterHintsProvider.kt +++ b/ide-laf-bridge/ide-laf-bridge-233/src/main/kotlin/org/jetbrains/jewel/bridge/BridgePainterHintsProvider.kt @@ -5,8 +5,8 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalDensity import com.intellij.ide.ui.UITheme import com.intellij.openapi.diagnostic.thisLogger -import org.jetbrains.jewel.IntelliJTheme import org.jetbrains.jewel.InternalJewelApi +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.intui.core.IntUiPainterHintsProvider import org.jetbrains.jewel.painter.PainterHint import org.jetbrains.jewel.painter.hints.Dark @@ -30,7 +30,7 @@ class BridgePainterHintsProvider private constructor( add(getPaletteHint(path)) add(BridgeOverride) add(HiDpi(LocalDensity.current)) - add(Dark(IntelliJTheme.isDark)) + add(Dark(JewelTheme.isDark)) } companion object { diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeGlobalColors.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeGlobalColors.kt index 0f9d77908..ad8c224f9 100644 --- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeGlobalColors.kt +++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeGlobalColors.kt @@ -1,140 +1,29 @@ package org.jetbrains.jewel.bridge -import androidx.compose.runtime.Immutable -import androidx.compose.ui.graphics.Color import org.jetbrains.jewel.BorderColors import org.jetbrains.jewel.GlobalColors import org.jetbrains.jewel.OutlineColors -@Immutable -internal class BridgeGlobalColors( - override val borders: BorderColors, - override val outlines: OutlineColors, - @SwingLafKey("*.infoForeground") override val infoContent: Color, - @SwingLafKey("Panel.background") override val paneBackground: Color, -) : GlobalColors { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as BridgeGlobalColors - - if (borders != other.borders) return false - if (outlines != other.outlines) return false - if (infoContent != other.infoContent) return false - if (paneBackground != other.paneBackground) return false - - return true - } - - override fun hashCode(): Int { - var result = borders.hashCode() - result = 31 * result + outlines.hashCode() - result = 31 * result + infoContent.hashCode() - result = 31 * result + paneBackground.hashCode() - return result - } - - override fun toString(): String = - "BridgeGlobalColors(borders=$borders, outlines=$outlines, infoContent=$infoContent, paneBackground=$paneBackground)" - - companion object { - - fun readFromLaF() = BridgeGlobalColors( - borders = BridgeBorderColors.readFromLaF(), - outlines = BridgeOutlineColors.readFromLaF(), - infoContent = retrieveColorOrUnspecified("*.infoForeground"), - paneBackground = retrieveColorOrUnspecified("Panel.background"), - ) - } -} - -@Immutable -internal class BridgeBorderColors( - @SwingLafKey("Component.borderColor") override val normal: Color, - @SwingLafKey("Component.focusedBorderColor") override val focused: Color, - @SwingLafKey("*.disabledBorderColor") override val disabled: Color, -) : BorderColors { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as BridgeBorderColors - - if (normal != other.normal) return false - if (focused != other.focused) return false - if (disabled != other.disabled) return false - - return true - } - - override fun hashCode(): Int { - var result = normal.hashCode() - result = 31 * result + focused.hashCode() - result = 31 * result + disabled.hashCode() - return result - } - - override fun toString(): String = - "BridgeBorderColors(normal=$normal, focused=$focused, disabled=$disabled)" - - companion object { - - fun readFromLaF() = BridgeBorderColors( - normal = retrieveColorOrUnspecified("Component.borderColor"), - focused = retrieveColorOrUnspecified("Component.focusedBorderColor"), - disabled = retrieveColorOrUnspecified("*.disabledBorderColor"), - ) - } -} - -@Immutable -internal class BridgeOutlineColors( - @SwingLafKey("*.focusColor") override val focused: Color, - @SwingLafKey("Component.warningFocusColor") override val focusedWarning: Color, - @SwingLafKey("Component.errorFocusColor") override val focusedError: Color, - @SwingLafKey("Component.inactiveWarningFocusColor") override val warning: Color, - @SwingLafKey("Component.inactiveErrorFocusColor") override val error: Color, -) : OutlineColors { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as BridgeOutlineColors - - if (focused != other.focused) return false - if (focusedWarning != other.focusedWarning) return false - if (focusedError != other.focusedError) return false - if (warning != other.warning) return false - if (error != other.error) return false - - return true - } - - override fun hashCode(): Int { - var result = focused.hashCode() - result = 31 * result + focusedWarning.hashCode() - result = 31 * result + focusedError.hashCode() - result = 31 * result + warning.hashCode() - result = 31 * result + error.hashCode() - return result - } - - override fun toString(): String = - "BridgeOutlineColors(focused=$focused, focusedWarning=$focusedWarning, focusedError=$focusedError, " + - "warning=$warning, error=$error)" - - companion object { - - fun readFromLaF() = BridgeOutlineColors( - focused = retrieveColorOrUnspecified("*.focusColor"), - focusedWarning = retrieveColorOrUnspecified("Component.warningFocusColor"), - focusedError = retrieveColorOrUnspecified("Component.errorFocusColor"), - warning = retrieveColorOrUnspecified("Component.inactiveWarningFocusColor"), - error = retrieveColorOrUnspecified("Component.inactiveErrorFocusColor"), - ) - } -} +fun GlobalColors.Companion.readFromLaF() = + GlobalColors( + borders = BorderColors.readFromLaF(), + outlines = OutlineColors.readFromLaF(), + infoContent = retrieveColorOrUnspecified("*.infoForeground"), + paneBackground = retrieveColorOrUnspecified("Panel.background"), + ) + +fun BorderColors.Companion.readFromLaF() = + BorderColors( + normal = retrieveColorOrUnspecified("Component.borderColor"), + focused = retrieveColorOrUnspecified("Component.focusedBorderColor"), + disabled = retrieveColorOrUnspecified("*.disabledBorderColor"), + ) + +fun OutlineColors.Companion.readFromLaF() = + OutlineColors( + focused = retrieveColorOrUnspecified("*.focusColor"), + focusedWarning = retrieveColorOrUnspecified("Component.warningFocusColor"), + focusedError = retrieveColorOrUnspecified("Component.errorFocusColor"), + warning = retrieveColorOrUnspecified("Component.inactiveWarningFocusColor"), + error = retrieveColorOrUnspecified("Component.inactiveErrorFocusColor"), + ) diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeGlobalMetrics.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeGlobalMetrics.kt index 52ce20ce5..2ba571f9f 100644 --- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeGlobalMetrics.kt +++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeGlobalMetrics.kt @@ -1,7 +1,5 @@ package org.jetbrains.jewel.bridge -import androidx.compose.runtime.Immutable -import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.intellij.ide.ui.laf.darcula.DarculaUIUtil import com.intellij.ui.scale.JBUIScale @@ -9,46 +7,15 @@ import com.intellij.util.ui.JBUI import com.intellij.util.ui.UIUtil import org.jetbrains.jewel.GlobalMetrics -@Immutable -internal class BridgeGlobalMetrics( - override val outlineWidth: Dp, - override val rowHeight: Dp, -) : GlobalMetrics { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as BridgeGlobalMetrics - - if (outlineWidth != other.outlineWidth) return false - if (rowHeight != other.rowHeight) return false - - return true - } - - override fun hashCode(): Int { - var result = outlineWidth.hashCode() - result = 31 * result + rowHeight.hashCode() - return result - } - - override fun toString() = - "BridgeGlobalMetrics(outlineWidth=$outlineWidth, rowHeight=$rowHeight)" - - companion object { - - fun readFromLaF(): BridgeGlobalMetrics { - // Copied from DarculaUIUtil.doPaint(java.awt.Graphics2D, int, int, float, float, boolean) - // except that scaling is all moved into the .dp operation below - val f = if (UIUtil.isRetina()) 0.5f else 1.0f - val lw = if (UIUtil.isUnderDefaultMacTheme()) f else DarculaUIUtil.LW.unscaled - - return BridgeGlobalMetrics( - outlineWidth = (DarculaUIUtil.BW.unscaled + lw).dp, - // The rowHeight() function returns a scaled value, but we need the base value - rowHeight = (JBUI.CurrentTheme.List.rowHeight() / JBUIScale.scale(1f)).dp, - ) - } - } +fun GlobalMetrics.Companion.readFromLaF(): GlobalMetrics { + // Copied from DarculaUIUtil.doPaint(java.awt.Graphics2D, int, int, float, float, boolean) + // except that scaling is all moved into the .dp operation below + val f = if (UIUtil.isRetina()) 0.5f else 1.0f + val lw = if (UIUtil.isUnderDefaultMacTheme()) f else DarculaUIUtil.LW.unscaled + + return GlobalMetrics( + outlineWidth = (DarculaUIUtil.BW.unscaled + lw).dp, + // The rowHeight() function returns a scaled value, but we need the base value + rowHeight = (JBUI.CurrentTheme.List.rowHeight() / JBUIScale.scale(1f)).dp, + ) } diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeThemeColorPalette.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeThemeColorPalette.kt index afd7bad0b..b631929b6 100644 --- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeThemeColorPalette.kt +++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/BridgeThemeColorPalette.kt @@ -1,133 +1,84 @@ package org.jetbrains.jewel.bridge -import androidx.compose.runtime.Immutable import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.isSpecified import com.intellij.openapi.diagnostic.Logger -import org.jetbrains.jewel.intui.core.IntUiThemeColorPalette +import org.jetbrains.jewel.ThemeColorPalette import java.util.TreeMap private val logger = Logger.getInstance("BridgeThemeColorPalette") -@Immutable -class BridgeThemeColorPalette private constructor( - override val rawMap: Map, - private val grey: List, - private val blue: List, - private val green: List, - private val red: List, - private val yellow: List, - private val orange: List, - private val purple: List, - private val teal: List, - private val windowsPopupBorder: Color, -) : IntUiThemeColorPalette { - - override fun grey(): List = grey - - override fun grey(index: Int): Color = grey[index - 1] - - override fun blue(): List = blue - - override fun blue(index: Int): Color = blue[index - 1] - - override fun green(): List = green - - override fun green(index: Int): Color = green[index - 1] - - override fun red(): List = red - - override fun red(index: Int): Color = red[index - 1] - - override fun yellow(): List = yellow - - override fun yellow(index: Int): Color = yellow[index - 1] - - override fun orange(): List = orange - - override fun orange(index: Int): Color = orange[index - 1] - - override fun purple(): List = purple - - override fun purple(index: Int): Color = purple[index - 1] - - override fun teal(): List = teal - - override fun teal(index: Int): Color = teal[index - 1] - - companion object { - - fun readFromLaF(): BridgeThemeColorPalette { - val grey = readPaletteColors("Grey") - val blue = readPaletteColors("Blue") - val green = readPaletteColors("Green") - val red = readPaletteColors("Red") - val yellow = readPaletteColors("Yellow") - val orange = readPaletteColors("Orange") - val purple = readPaletteColors("Purple") - val teal = readPaletteColors("Teal") - val windowsPopupBorder = readPaletteColor("windowsPopupBorder") +val ThemeColorPalette.windowsPopupBorder + get() = lookup("windowsPopupBorder") + +fun ThemeColorPalette.Companion.readFromLaF(): ThemeColorPalette { + val grey = readPaletteColors("Grey") + val blue = readPaletteColors("Blue") + val green = readPaletteColors("Green") + val red = readPaletteColors("Red") + val yellow = readPaletteColors("Yellow") + val orange = readPaletteColors("Orange") + val purple = readPaletteColors("Purple") + val teal = readPaletteColors("Teal") + val windowsPopupBorder = readPaletteColor("windowsPopupBorder") + + val rawMap = buildMap { + putAll(grey) + putAll(blue) + putAll(green) + putAll(red) + putAll(yellow) + putAll(orange) + putAll(purple) + putAll(teal) + if (windowsPopupBorder.isSpecified) put("windowsPopupBorder", windowsPopupBorder) + } - val rawMap = buildMap { - putAll(grey) - putAll(blue) - putAll(green) - putAll(red) - putAll(yellow) - putAll(orange) - putAll(purple) - putAll(teal) - if (windowsPopupBorder.isSpecified) put("windowsPopupBorder", windowsPopupBorder) - } + return ThemeColorPalette( + grey = grey.values.toList(), + blue = blue.values.toList(), + green = green.values.toList(), + red = red.values.toList(), + yellow = yellow.values.toList(), + orange = orange.values.toList(), + purple = purple.values.toList(), + teal = teal.values.toList(), + rawMap = rawMap, + ) +} - return BridgeThemeColorPalette( - grey = grey.values.toList(), - blue = blue.values.toList(), - green = green.values.toList(), - red = red.values.toList(), - yellow = yellow.values.toList(), - orange = orange.values.toList(), - purple = purple.values.toList(), - teal = teal.values.toList(), - windowsPopupBorder = windowsPopupBorder, - rawMap = rawMap, - ) +private fun readPaletteColors(colorName: String): Map { + val defaults = uiDefaults + val allKeys = defaults.keys + val colorNameKeyPrefix = "ColorPalette.$colorName" + val colorNameKeyPrefixLength = colorNameKeyPrefix.length + + val lastColorIndex = allKeys.asSequence() + .filterIsInstance(String::class.java) + .filter { it.startsWith(colorNameKeyPrefix) } + .mapNotNull { + val afterName = it.substring(colorNameKeyPrefixLength) + afterName.toIntOrNull() } - - private fun readPaletteColors(colorName: String): Map { - val defaults = uiDefaults - val allKeys = defaults.keys - val colorNameKeyPrefix = "ColorPalette.$colorName" - val colorNameKeyPrefixLength = colorNameKeyPrefix.length - - val lastColorIndex = allKeys.asSequence() - .filterIsInstance(String::class.java) - .filter { it.startsWith(colorNameKeyPrefix) } - .mapNotNull { - val afterName = it.substring(colorNameKeyPrefixLength) - afterName.toIntOrNull() - } - .maxOrNull() ?: return TreeMap() - - return buildMap { - for (i in 1..lastColorIndex) { - val key = "$colorNameKeyPrefix$i" - val value = defaults[key] as? java.awt.Color - if (value == null) { - logger.error("Unable to find color value for palette key '$colorNameKeyPrefix$i'") - continue - } - - put(key, value.toComposeColor()) - } + .maxOrNull() ?: return TreeMap() + + return buildMap { + for (i in 1..lastColorIndex) { + val key = "$colorNameKeyPrefix$i" + val value = defaults[key] as? java.awt.Color + if (value == null) { + logger.error("Unable to find color value for palette key '$colorNameKeyPrefix$i'") + continue } - } - private fun readPaletteColor(colorName: String): Color { - val defaults = uiDefaults - val colorNameKey = "ColorPalette.$colorName" - return (defaults[colorNameKey] as? java.awt.Color) - ?.toComposeColor() ?: Color.Unspecified + put(key, value.toComposeColor()) } } } + +private fun readPaletteColor(colorName: String): Color { + val defaults = uiDefaults + val colorNameKey = "ColorPalette.$colorName" + return (defaults[colorNameKey] as? java.awt.Color) + ?.toComposeColor() ?: Color.Unspecified +} diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/IntUiBridge.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/IntUiBridge.kt index 3c633bd66..586293d68 100644 --- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/IntUiBridge.kt +++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/IntUiBridge.kt @@ -21,8 +21,12 @@ import com.intellij.util.ui.DirProvider import com.intellij.util.ui.JBUI import com.intellij.util.ui.NamedColorUtil import com.intellij.util.ui.StatusText -import org.jetbrains.jewel.IntelliJComponentStyling -import org.jetbrains.jewel.intui.core.IntUiThemeDefinition +import org.jetbrains.jewel.ComponentStyling +import org.jetbrains.jewel.GlobalColors +import org.jetbrains.jewel.GlobalMetrics +import org.jetbrains.jewel.ThemeColorPalette +import org.jetbrains.jewel.ThemeDefinition +import org.jetbrains.jewel.ThemeIconData import org.jetbrains.jewel.intui.core.styling.defaults import org.jetbrains.jewel.styling.ButtonColors import org.jetbrains.jewel.styling.ButtonMetrics @@ -105,31 +109,31 @@ private val iconsBasePath get() = DirProvider().dir() @OptIn(DependsOnJBR::class) -internal suspend fun createBridgeIntUiDefinition(): IntUiThemeDefinition { +internal suspend fun createBridgeThemeDefinition(): ThemeDefinition { val textStyle = retrieveTextStyle("Label.font", "Label.foreground") - return createBridgeIntUiDefinition(textStyle) + return createBridgeThemeDefinition(textStyle) } -internal fun createBridgeIntUiDefinition(textStyle: TextStyle): IntUiThemeDefinition { +internal fun createBridgeThemeDefinition(textStyle: TextStyle): ThemeDefinition { val isDark = !JBColor.isBright() - logger.debug("Obtaining Int UI theme definition from Swing...") + logger.debug("Obtaining theme definition from Swing...") - return IntUiThemeDefinition( + return ThemeDefinition( isDark = isDark, - globalColors = BridgeGlobalColors.readFromLaF(), - colorPalette = BridgeThemeColorPalette.readFromLaF(), - iconData = BridgeIconData.readFromLaF(), - globalMetrics = BridgeGlobalMetrics.readFromLaF(), + globalColors = GlobalColors.readFromLaF(), + colorPalette = ThemeColorPalette.readFromLaF(), + iconData = ThemeIconData.readFromLaF(), + globalMetrics = GlobalMetrics.readFromLaF(), defaultTextStyle = textStyle, contentColor = JBColor.foreground().toComposeColor(), ) } @OptIn(DependsOnJBR::class) -internal suspend fun createSwingIntUiComponentStyling( - theme: IntUiThemeDefinition, -): IntelliJComponentStyling = createSwingIntUiComponentStyling( +internal suspend fun createBridgeComponentStyling( + theme: ThemeDefinition, +): ComponentStyling = createBridgeComponentStyling( theme = theme, textAreaTextStyle = retrieveTextStyle("TextArea.font", "TextArea.foreground"), textFieldTextStyle = retrieveTextStyle("TextField.font", "TextField.foreground"), @@ -138,20 +142,20 @@ internal suspend fun createSwingIntUiComponentStyling( linkTextStyle = retrieveTextStyle("Label.font"), ) -internal fun createSwingIntUiComponentStyling( - theme: IntUiThemeDefinition, +internal fun createBridgeComponentStyling( + theme: ThemeDefinition, textFieldTextStyle: TextStyle, textAreaTextStyle: TextStyle, dropdownTextStyle: TextStyle, labelTextStyle: TextStyle, linkTextStyle: TextStyle, -): IntelliJComponentStyling { +): ComponentStyling { logger.debug("Obtaining Int UI component styling from Swing...") val textFieldStyle = readTextFieldStyle(textFieldTextStyle) val menuStyle = readMenuStyle() - return IntelliJComponentStyling( + return ComponentStyling( checkboxStyle = readCheckboxStyle(), chipStyle = readChipStyle(), circularProgressStyle = readCircularProgressStyle(theme.isDark), diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/SwingBridgeService.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/SwingBridgeService.kt index d564ea912..4d9572af2 100644 --- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/SwingBridgeService.kt +++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/SwingBridgeService.kt @@ -15,8 +15,8 @@ import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.mapLatest import kotlinx.coroutines.flow.stateIn -import org.jetbrains.jewel.IntelliJComponentStyling -import org.jetbrains.jewel.intui.core.IntUiThemeDefinition +import org.jetbrains.jewel.ComponentStyling +import org.jetbrains.jewel.ThemeDefinition import kotlin.time.Duration.Companion.milliseconds @Service(Level.APP) @@ -28,7 +28,6 @@ internal class SwingBridgeService : Disposable { private val coroutineScope: CoroutineScope = CoroutineScope(SupervisorJob() + CoroutineName("JewelSwingBridge")) - // TODO we shouldn't assume it's Int UI, but we only have that for now internal val currentBridgeThemeData: StateFlow = IntelliJApplication.lookAndFeelChangedFlow(coroutineScope) .mapLatest { tryGettingThemeData() } @@ -52,10 +51,10 @@ internal class SwingBridgeService : Disposable { logger.warn("Darcula LaFs (aka \"old UI\") are not supported yet, falling back to Int UI") } - val themeDefinition = createBridgeIntUiDefinition() + val themeDefinition = createBridgeThemeDefinition() return BridgeThemeData( - themeDefinition = createBridgeIntUiDefinition(), - componentStyling = createSwingIntUiComponentStyling(themeDefinition), + themeDefinition = createBridgeThemeDefinition(), + componentStyling = createBridgeComponentStyling(themeDefinition), ) } @@ -64,17 +63,17 @@ internal class SwingBridgeService : Disposable { } internal data class BridgeThemeData( - val themeDefinition: IntUiThemeDefinition, - val componentStyling: IntelliJComponentStyling, + val themeDefinition: ThemeDefinition, + val componentStyling: ComponentStyling, ) { companion object { val DEFAULT = run { - val themeDefinition = createBridgeIntUiDefinition(TextStyle.Default) + val themeDefinition = createBridgeThemeDefinition(TextStyle.Default) BridgeThemeData( - themeDefinition = createBridgeIntUiDefinition(TextStyle.Default), - componentStyling = createSwingIntUiComponentStyling( + themeDefinition = createBridgeThemeDefinition(TextStyle.Default), + componentStyling = createBridgeComponentStyling( theme = themeDefinition, textAreaTextStyle = TextStyle.Default, textFieldTextStyle = TextStyle.Default, diff --git a/int-ui/int-ui-core/api/int-ui-core.api b/int-ui/int-ui-core/api/int-ui-core.api index 745aa713a..70f683730 100644 --- a/int-ui/int-ui-core/api/int-ui-core.api +++ b/int-ui/int-ui-core/api/int-ui-core.api @@ -1,66 +1,6 @@ -public abstract interface class org/jetbrains/jewel/intui/core/BaseIntUiTheme : org/jetbrains/jewel/IntelliJTheme { - public abstract fun getCheckboxStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/CheckboxStyle; - public abstract fun getChipStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/ChipStyle; - public abstract fun getCircularProgressStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/CircularProgressStyle; - public abstract fun getColorPalette (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/intui/core/IntUiThemeColorPalette; - public abstract fun getContentColor (Landroidx/compose/runtime/Composer;I)J - public abstract fun getDefaultButtonStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/ButtonStyle; - public abstract fun getDefaultTabStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/TabStyle; - public abstract fun getDividerStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/DividerStyle; - public abstract fun getDropdownStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/DropdownStyle; - public abstract fun getEditorTabStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/TabStyle; - public abstract fun getGlobalColors (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/GlobalColors; - public abstract fun getGlobalMetrics (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/GlobalMetrics; - public abstract fun getGroupHeaderStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/GroupHeaderStyle; - public abstract fun getHorizontalProgressBarStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/HorizontalProgressBarStyle; - public abstract fun getIconData (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/IntelliJThemeIconData; - public abstract fun getLabelledTextFieldStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/LabelledTextFieldStyle; - public abstract fun getLinkStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/LinkStyle; - public abstract fun getMenuStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/MenuStyle; - public abstract fun getOutlinedButtonStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/ButtonStyle; - public abstract fun getRadioButtonStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/RadioButtonStyle; - public abstract fun getScrollbarStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/ScrollbarStyle; - public abstract fun getTextAreaStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/TextAreaStyle; - public abstract fun getTextFieldStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/TextFieldStyle; - public abstract fun getTextStyle (Landroidx/compose/runtime/Composer;I)Landroidx/compose/ui/text/TextStyle; - public abstract fun getTreeStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/LazyTreeStyle; - public abstract fun isDark (Landroidx/compose/runtime/Composer;I)Z - public abstract fun isSwingCompatMode (Landroidx/compose/runtime/Composer;I)Z -} - -public final class org/jetbrains/jewel/intui/core/BaseIntUiTheme$DefaultImpls { - public static fun getCheckboxStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/CheckboxStyle; - public static fun getChipStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/ChipStyle; - public static fun getCircularProgressStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/CircularProgressStyle; - public static fun getColorPalette (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/intui/core/IntUiThemeColorPalette; - public static fun getContentColor (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)J - public static fun getDefaultButtonStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/ButtonStyle; - public static fun getDefaultTabStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/TabStyle; - public static fun getDividerStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/DividerStyle; - public static fun getDropdownStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/DropdownStyle; - public static fun getEditorTabStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/TabStyle; - public static fun getGlobalColors (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/GlobalColors; - public static fun getGlobalMetrics (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/GlobalMetrics; - public static fun getGroupHeaderStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/GroupHeaderStyle; - public static fun getHorizontalProgressBarStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/HorizontalProgressBarStyle; - public static fun getIconData (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/IntelliJThemeIconData; - public static fun getLabelledTextFieldStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/LabelledTextFieldStyle; - public static fun getLinkStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/LinkStyle; - public static fun getMenuStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/MenuStyle; - public static fun getOutlinedButtonStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/ButtonStyle; - public static fun getRadioButtonStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/RadioButtonStyle; - public static fun getScrollbarStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/ScrollbarStyle; - public static fun getTextAreaStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/TextAreaStyle; - public static fun getTextFieldStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/TextFieldStyle; - public static fun getTextStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Landroidx/compose/ui/text/TextStyle; - public static fun getTreeStyle (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/LazyTreeStyle; - public static fun isDark (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Z - public static fun isSwingCompatMode (Lorg/jetbrains/jewel/intui/core/BaseIntUiTheme;Landroidx/compose/runtime/Composer;I)Z -} - public final class org/jetbrains/jewel/intui/core/BaseIntUiThemeKt { - public static final fun BaseIntUiTheme (Lorg/jetbrains/jewel/intui/core/IntUiThemeDefinition;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;I)V - public static final fun BaseIntUiTheme (Lorg/jetbrains/jewel/intui/core/IntUiThemeDefinition;Lkotlin/jvm/functions/Function2;ZLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V + public static final fun BaseIntUiTheme (Lorg/jetbrains/jewel/ThemeDefinition;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;I)V + public static final fun BaseIntUiTheme (Lorg/jetbrains/jewel/ThemeDefinition;Lkotlin/jvm/functions/Function2;ZLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V } public abstract class org/jetbrains/jewel/intui/core/IntUiPainterHintsProvider : org/jetbrains/jewel/painter/PainterHintsProvider { @@ -70,46 +10,6 @@ public abstract class org/jetbrains/jewel/intui/core/IntUiPainterHintsProvider : public fun priorityHints (Ljava/lang/String;Landroidx/compose/runtime/Composer;I)Ljava/util/List; } -public abstract interface class org/jetbrains/jewel/intui/core/IntUiThemeColorPalette : org/jetbrains/jewel/IntelliJThemeColorPalette { - public abstract fun blue ()Ljava/util/List; - public abstract fun blue-vNxB06k (I)J - public abstract fun green ()Ljava/util/List; - public abstract fun green-vNxB06k (I)J - public abstract fun grey ()Ljava/util/List; - public abstract fun grey-vNxB06k (I)J - public abstract fun lookup-ijrfgN4 (Ljava/lang/String;)Landroidx/compose/ui/graphics/Color; - public abstract fun orange ()Ljava/util/List; - public abstract fun orange-vNxB06k (I)J - public abstract fun purple ()Ljava/util/List; - public abstract fun purple-vNxB06k (I)J - public abstract fun red ()Ljava/util/List; - public abstract fun red-vNxB06k (I)J - public abstract fun teal ()Ljava/util/List; - public abstract fun teal-vNxB06k (I)J - public abstract fun yellow ()Ljava/util/List; - public abstract fun yellow-vNxB06k (I)J -} - -public final class org/jetbrains/jewel/intui/core/IntUiThemeColorPalette$DefaultImpls { - public static fun lookup-ijrfgN4 (Lorg/jetbrains/jewel/intui/core/IntUiThemeColorPalette;Ljava/lang/String;)Landroidx/compose/ui/graphics/Color; -} - -public final class org/jetbrains/jewel/intui/core/IntUiThemeDefinition : org/jetbrains/jewel/IntelliJThemeDefinition { - public static final field $stable I - public synthetic fun (ZLorg/jetbrains/jewel/GlobalColors;Lorg/jetbrains/jewel/intui/core/IntUiThemeColorPalette;Lorg/jetbrains/jewel/IntelliJThemeIconData;Lorg/jetbrains/jewel/GlobalMetrics;Landroidx/compose/ui/text/TextStyle;JLkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun equals (Ljava/lang/Object;)Z - public synthetic fun getColorPalette ()Lorg/jetbrains/jewel/IntelliJThemeColorPalette; - public fun getColorPalette ()Lorg/jetbrains/jewel/intui/core/IntUiThemeColorPalette; - public fun getContentColor-0d7_KjU ()J - public fun getDefaultTextStyle ()Landroidx/compose/ui/text/TextStyle; - public fun getGlobalColors ()Lorg/jetbrains/jewel/GlobalColors; - public fun getGlobalMetrics ()Lorg/jetbrains/jewel/GlobalMetrics; - public fun getIconData ()Lorg/jetbrains/jewel/IntelliJThemeIconData; - public fun hashCode ()I - public fun isDark ()Z - public fun toString ()Ljava/lang/String; -} - public final class org/jetbrains/jewel/intui/core/styling/CommonMetricsKt { public static final fun defaults-VpY3zN4 (Lorg/jetbrains/jewel/styling/DividerMetrics$Companion;FF)Lorg/jetbrains/jewel/styling/DividerMetrics; public static synthetic fun defaults-VpY3zN4$default (Lorg/jetbrains/jewel/styling/DividerMetrics$Companion;FFILjava/lang/Object;)Lorg/jetbrains/jewel/styling/DividerMetrics; @@ -117,265 +17,21 @@ public final class org/jetbrains/jewel/intui/core/styling/CommonMetricsKt { public static synthetic fun defaults-_3NXNO4$default (Lorg/jetbrains/jewel/styling/TooltipMetrics$Companion;Landroidx/compose/foundation/layout/PaddingValues;JLandroidx/compose/foundation/shape/CornerSize;FFJLandroidx/compose/ui/Alignment$Horizontal;ILjava/lang/Object;)Lorg/jetbrains/jewel/styling/TooltipMetrics; } -public final class org/jetbrains/jewel/intui/core/theme/IntUiDarkTheme : org/jetbrains/jewel/IntelliJThemeDescriptor { +public final class org/jetbrains/jewel/intui/core/theme/IntUiDarkTheme : org/jetbrains/jewel/ThemeDescriptor { public static final field $stable I public static final field INSTANCE Lorg/jetbrains/jewel/intui/core/theme/IntUiDarkTheme; - public synthetic fun getColors ()Lorg/jetbrains/jewel/IntelliJThemeColorPalette; - public fun getColors ()Lorg/jetbrains/jewel/intui/core/IntUiThemeColorPalette; - public fun getIcons ()Lorg/jetbrains/jewel/IntelliJThemeIconData; + public fun getColors ()Lorg/jetbrains/jewel/ThemeColorPalette; + public fun getIconData ()Lorg/jetbrains/jewel/ThemeIconData; public fun getName ()Ljava/lang/String; public fun isDark ()Z } -public final class org/jetbrains/jewel/intui/core/theme/IntUiDarkTheme$Colors : org/jetbrains/jewel/intui/core/IntUiThemeColorPalette { - public static final field $stable I - public static final field INSTANCE Lorg/jetbrains/jewel/intui/core/theme/IntUiDarkTheme$Colors; - public fun blue ()Ljava/util/List; - public fun blue-vNxB06k (I)J - public final fun getBlue1-0d7_KjU ()J - public final fun getBlue10-0d7_KjU ()J - public final fun getBlue11-0d7_KjU ()J - public final fun getBlue2-0d7_KjU ()J - public final fun getBlue3-0d7_KjU ()J - public final fun getBlue4-0d7_KjU ()J - public final fun getBlue5-0d7_KjU ()J - public final fun getBlue6-0d7_KjU ()J - public final fun getBlue7-0d7_KjU ()J - public final fun getBlue8-0d7_KjU ()J - public final fun getBlue9-0d7_KjU ()J - public final fun getGreen1-0d7_KjU ()J - public final fun getGreen10-0d7_KjU ()J - public final fun getGreen11-0d7_KjU ()J - public final fun getGreen2-0d7_KjU ()J - public final fun getGreen3-0d7_KjU ()J - public final fun getGreen4-0d7_KjU ()J - public final fun getGreen5-0d7_KjU ()J - public final fun getGreen6-0d7_KjU ()J - public final fun getGreen7-0d7_KjU ()J - public final fun getGreen8-0d7_KjU ()J - public final fun getGreen9-0d7_KjU ()J - public final fun getGrey1-0d7_KjU ()J - public final fun getGrey10-0d7_KjU ()J - public final fun getGrey11-0d7_KjU ()J - public final fun getGrey12-0d7_KjU ()J - public final fun getGrey13-0d7_KjU ()J - public final fun getGrey14-0d7_KjU ()J - public final fun getGrey2-0d7_KjU ()J - public final fun getGrey3-0d7_KjU ()J - public final fun getGrey4-0d7_KjU ()J - public final fun getGrey5-0d7_KjU ()J - public final fun getGrey6-0d7_KjU ()J - public final fun getGrey7-0d7_KjU ()J - public final fun getGrey8-0d7_KjU ()J - public final fun getGrey9-0d7_KjU ()J - public final fun getOrange1-0d7_KjU ()J - public final fun getOrange10-0d7_KjU ()J - public final fun getOrange11-0d7_KjU ()J - public final fun getOrange2-0d7_KjU ()J - public final fun getOrange3-0d7_KjU ()J - public final fun getOrange4-0d7_KjU ()J - public final fun getOrange5-0d7_KjU ()J - public final fun getOrange6-0d7_KjU ()J - public final fun getOrange7-0d7_KjU ()J - public final fun getOrange8-0d7_KjU ()J - public final fun getOrange9-0d7_KjU ()J - public final fun getPurple1-0d7_KjU ()J - public final fun getPurple10-0d7_KjU ()J - public final fun getPurple11-0d7_KjU ()J - public final fun getPurple2-0d7_KjU ()J - public final fun getPurple3-0d7_KjU ()J - public final fun getPurple4-0d7_KjU ()J - public final fun getPurple5-0d7_KjU ()J - public final fun getPurple6-0d7_KjU ()J - public final fun getPurple7-0d7_KjU ()J - public final fun getPurple8-0d7_KjU ()J - public final fun getPurple9-0d7_KjU ()J - public fun getRawMap ()Ljava/util/Map; - public final fun getRed1-0d7_KjU ()J - public final fun getRed10-0d7_KjU ()J - public final fun getRed11-0d7_KjU ()J - public final fun getRed2-0d7_KjU ()J - public final fun getRed3-0d7_KjU ()J - public final fun getRed4-0d7_KjU ()J - public final fun getRed5-0d7_KjU ()J - public final fun getRed6-0d7_KjU ()J - public final fun getRed7-0d7_KjU ()J - public final fun getRed8-0d7_KjU ()J - public final fun getRed9-0d7_KjU ()J - public final fun getTeal1-0d7_KjU ()J - public final fun getTeal10-0d7_KjU ()J - public final fun getTeal11-0d7_KjU ()J - public final fun getTeal2-0d7_KjU ()J - public final fun getTeal3-0d7_KjU ()J - public final fun getTeal4-0d7_KjU ()J - public final fun getTeal5-0d7_KjU ()J - public final fun getTeal6-0d7_KjU ()J - public final fun getTeal7-0d7_KjU ()J - public final fun getTeal8-0d7_KjU ()J - public final fun getTeal9-0d7_KjU ()J - public final fun getYellow1-0d7_KjU ()J - public final fun getYellow10-0d7_KjU ()J - public final fun getYellow11-0d7_KjU ()J - public final fun getYellow2-0d7_KjU ()J - public final fun getYellow3-0d7_KjU ()J - public final fun getYellow4-0d7_KjU ()J - public final fun getYellow5-0d7_KjU ()J - public final fun getYellow6-0d7_KjU ()J - public final fun getYellow7-0d7_KjU ()J - public final fun getYellow8-0d7_KjU ()J - public final fun getYellow9-0d7_KjU ()J - public fun green ()Ljava/util/List; - public fun green-vNxB06k (I)J - public fun grey ()Ljava/util/List; - public fun grey-vNxB06k (I)J - public fun lookup-ijrfgN4 (Ljava/lang/String;)Landroidx/compose/ui/graphics/Color; - public fun orange ()Ljava/util/List; - public fun orange-vNxB06k (I)J - public fun purple ()Ljava/util/List; - public fun purple-vNxB06k (I)J - public fun red ()Ljava/util/List; - public fun red-vNxB06k (I)J - public fun teal ()Ljava/util/List; - public fun teal-vNxB06k (I)J - public fun yellow ()Ljava/util/List; - public fun yellow-vNxB06k (I)J -} - -public final class org/jetbrains/jewel/intui/core/theme/IntUiDarkTheme$Icons : org/jetbrains/jewel/IntelliJThemeIconData { - public static final field $stable I - public static final field INSTANCE Lorg/jetbrains/jewel/intui/core/theme/IntUiDarkTheme$Icons; - public fun getColorPalette ()Ljava/util/Map; - public fun getIconOverrides ()Ljava/util/Map; - public fun getSelectionColorPalette ()Ljava/util/Map; - public fun selectionColorMapping ()Ljava/util/Map; -} - -public final class org/jetbrains/jewel/intui/core/theme/IntUiLightTheme : org/jetbrains/jewel/IntelliJThemeDescriptor { +public final class org/jetbrains/jewel/intui/core/theme/IntUiLightTheme : org/jetbrains/jewel/ThemeDescriptor { public static final field $stable I public static final field INSTANCE Lorg/jetbrains/jewel/intui/core/theme/IntUiLightTheme; - public synthetic fun getColors ()Lorg/jetbrains/jewel/IntelliJThemeColorPalette; - public fun getColors ()Lorg/jetbrains/jewel/intui/core/IntUiThemeColorPalette; - public fun getIcons ()Lorg/jetbrains/jewel/IntelliJThemeIconData; + public fun getColors ()Lorg/jetbrains/jewel/ThemeColorPalette; + public fun getIconData ()Lorg/jetbrains/jewel/ThemeIconData; public fun getName ()Ljava/lang/String; public fun isDark ()Z } -public final class org/jetbrains/jewel/intui/core/theme/IntUiLightTheme$Colors : org/jetbrains/jewel/intui/core/IntUiThemeColorPalette { - public static final field $stable I - public static final field INSTANCE Lorg/jetbrains/jewel/intui/core/theme/IntUiLightTheme$Colors; - public fun blue ()Ljava/util/List; - public fun blue-vNxB06k (I)J - public final fun getBlue1-0d7_KjU ()J - public final fun getBlue10-0d7_KjU ()J - public final fun getBlue11-0d7_KjU ()J - public final fun getBlue12-0d7_KjU ()J - public final fun getBlue13-0d7_KjU ()J - public final fun getBlue2-0d7_KjU ()J - public final fun getBlue3-0d7_KjU ()J - public final fun getBlue4-0d7_KjU ()J - public final fun getBlue5-0d7_KjU ()J - public final fun getBlue6-0d7_KjU ()J - public final fun getBlue7-0d7_KjU ()J - public final fun getBlue8-0d7_KjU ()J - public final fun getBlue9-0d7_KjU ()J - public final fun getGreen1-0d7_KjU ()J - public final fun getGreen10-0d7_KjU ()J - public final fun getGreen11-0d7_KjU ()J - public final fun getGreen2-0d7_KjU ()J - public final fun getGreen3-0d7_KjU ()J - public final fun getGreen4-0d7_KjU ()J - public final fun getGreen5-0d7_KjU ()J - public final fun getGreen6-0d7_KjU ()J - public final fun getGreen7-0d7_KjU ()J - public final fun getGreen8-0d7_KjU ()J - public final fun getGreen9-0d7_KjU ()J - public final fun getGrey1-0d7_KjU ()J - public final fun getGrey10-0d7_KjU ()J - public final fun getGrey11-0d7_KjU ()J - public final fun getGrey12-0d7_KjU ()J - public final fun getGrey13-0d7_KjU ()J - public final fun getGrey14-0d7_KjU ()J - public final fun getGrey2-0d7_KjU ()J - public final fun getGrey3-0d7_KjU ()J - public final fun getGrey4-0d7_KjU ()J - public final fun getGrey5-0d7_KjU ()J - public final fun getGrey6-0d7_KjU ()J - public final fun getGrey7-0d7_KjU ()J - public final fun getGrey8-0d7_KjU ()J - public final fun getGrey9-0d7_KjU ()J - public final fun getOrange1-0d7_KjU ()J - public final fun getOrange2-0d7_KjU ()J - public final fun getOrange3-0d7_KjU ()J - public final fun getOrange4-0d7_KjU ()J - public final fun getOrange5-0d7_KjU ()J - public final fun getOrange6-0d7_KjU ()J - public final fun getOrange7-0d7_KjU ()J - public final fun getOrange8-0d7_KjU ()J - public final fun getOrange9-0d7_KjU ()J - public final fun getPurple1-0d7_KjU ()J - public final fun getPurple2-0d7_KjU ()J - public final fun getPurple3-0d7_KjU ()J - public final fun getPurple4-0d7_KjU ()J - public final fun getPurple5-0d7_KjU ()J - public final fun getPurple6-0d7_KjU ()J - public final fun getPurple7-0d7_KjU ()J - public final fun getPurple8-0d7_KjU ()J - public final fun getPurple9-0d7_KjU ()J - public fun getRawMap ()Ljava/util/Map; - public final fun getRed1-0d7_KjU ()J - public final fun getRed10-0d7_KjU ()J - public final fun getRed11-0d7_KjU ()J - public final fun getRed2-0d7_KjU ()J - public final fun getRed3-0d7_KjU ()J - public final fun getRed4-0d7_KjU ()J - public final fun getRed5-0d7_KjU ()J - public final fun getRed6-0d7_KjU ()J - public final fun getRed7-0d7_KjU ()J - public final fun getRed8-0d7_KjU ()J - public final fun getRed9-0d7_KjU ()J - public final fun getTeal1-0d7_KjU ()J - public final fun getTeal2-0d7_KjU ()J - public final fun getTeal3-0d7_KjU ()J - public final fun getTeal4-0d7_KjU ()J - public final fun getTeal5-0d7_KjU ()J - public final fun getTeal6-0d7_KjU ()J - public final fun getTeal7-0d7_KjU ()J - public final fun getTeal8-0d7_KjU ()J - public final fun getTeal9-0d7_KjU ()J - public final fun getWindowsPopupBorder-0d7_KjU ()J - public final fun getYellow1-0d7_KjU ()J - public final fun getYellow10-0d7_KjU ()J - public final fun getYellow2-0d7_KjU ()J - public final fun getYellow3-0d7_KjU ()J - public final fun getYellow4-0d7_KjU ()J - public final fun getYellow5-0d7_KjU ()J - public final fun getYellow6-0d7_KjU ()J - public final fun getYellow7-0d7_KjU ()J - public final fun getYellow8-0d7_KjU ()J - public final fun getYellow9-0d7_KjU ()J - public fun green ()Ljava/util/List; - public fun green-vNxB06k (I)J - public fun grey ()Ljava/util/List; - public fun grey-vNxB06k (I)J - public fun lookup-ijrfgN4 (Ljava/lang/String;)Landroidx/compose/ui/graphics/Color; - public fun orange ()Ljava/util/List; - public fun orange-vNxB06k (I)J - public fun purple ()Ljava/util/List; - public fun purple-vNxB06k (I)J - public fun red ()Ljava/util/List; - public fun red-vNxB06k (I)J - public fun teal ()Ljava/util/List; - public fun teal-vNxB06k (I)J - public fun yellow ()Ljava/util/List; - public fun yellow-vNxB06k (I)J -} - -public final class org/jetbrains/jewel/intui/core/theme/IntUiLightTheme$Icons : org/jetbrains/jewel/IntelliJThemeIconData { - public static final field $stable I - public static final field INSTANCE Lorg/jetbrains/jewel/intui/core/theme/IntUiLightTheme$Icons; - public fun getColorPalette ()Ljava/util/Map; - public fun getIconOverrides ()Ljava/util/Map; - public fun getSelectionColorPalette ()Ljava/util/Map; - public fun selectionColorMapping ()Ljava/util/Map; -} - diff --git a/int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/BaseIntUiTheme.kt b/int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/BaseIntUiTheme.kt index b93ff499d..98b60edb0 100644 --- a/int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/BaseIntUiTheme.kt +++ b/int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/BaseIntUiTheme.kt @@ -4,175 +4,15 @@ import androidx.compose.foundation.LocalIndication import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.ProvidedValue -import androidx.compose.runtime.ReadOnlyComposable -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.text.TextStyle -import org.jetbrains.jewel.GlobalColors -import org.jetbrains.jewel.GlobalMetrics -import org.jetbrains.jewel.IntelliJTheme -import org.jetbrains.jewel.IntelliJThemeIconData +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.LocalColorPalette import org.jetbrains.jewel.LocalIconData import org.jetbrains.jewel.NoIndication -import org.jetbrains.jewel.styling.ButtonStyle -import org.jetbrains.jewel.styling.CheckboxStyle -import org.jetbrains.jewel.styling.ChipStyle -import org.jetbrains.jewel.styling.CircularProgressStyle -import org.jetbrains.jewel.styling.DividerStyle -import org.jetbrains.jewel.styling.DropdownStyle -import org.jetbrains.jewel.styling.GroupHeaderStyle -import org.jetbrains.jewel.styling.HorizontalProgressBarStyle -import org.jetbrains.jewel.styling.LabelledTextFieldStyle -import org.jetbrains.jewel.styling.LazyTreeStyle -import org.jetbrains.jewel.styling.LinkStyle -import org.jetbrains.jewel.styling.MenuStyle -import org.jetbrains.jewel.styling.RadioButtonStyle -import org.jetbrains.jewel.styling.ScrollbarStyle -import org.jetbrains.jewel.styling.TabStyle -import org.jetbrains.jewel.styling.TextAreaStyle -import org.jetbrains.jewel.styling.TextFieldStyle - -interface BaseIntUiTheme : IntelliJTheme { - - val globalColors: GlobalColors - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.globalColors - - val globalMetrics: GlobalMetrics - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.globalMetrics - - val textStyle: TextStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.textStyle - - val contentColor: Color - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.contentColor - - val isDark: Boolean - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.isDark - - val isSwingCompatMode: Boolean - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.isSwingCompatMode - - val iconData: IntelliJThemeIconData - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.iconData - - val colorPalette: IntUiThemeColorPalette - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.colorPalette as? IntUiThemeColorPalette ?: EmptyIntUiThemeColorPalette - - val defaultButtonStyle: ButtonStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.defaultButtonStyle - - val outlinedButtonStyle: ButtonStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.outlinedButtonStyle - - val checkboxStyle: CheckboxStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.checkboxStyle - - val chipStyle: ChipStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.chipStyle - - val dividerStyle: DividerStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.dividerStyle - - val dropdownStyle: DropdownStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.dropdownStyle - - val groupHeaderStyle: GroupHeaderStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.groupHeaderStyle - - val labelledTextFieldStyle: LabelledTextFieldStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.labelledTextFieldStyle - - val linkStyle: LinkStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.linkStyle - - val menuStyle: MenuStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.menuStyle - - val horizontalProgressBarStyle: HorizontalProgressBarStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.horizontalProgressBarStyle - - val radioButtonStyle: RadioButtonStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.radioButtonStyle - - val scrollbarStyle: ScrollbarStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.scrollbarStyle - - val textAreaStyle: TextAreaStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.textAreaStyle - - val textFieldStyle: TextFieldStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.textFieldStyle - - val treeStyle: LazyTreeStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.treeStyle - - val defaultTabStyle: TabStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.defaultTabStyle - - val editorTabStyle: TabStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.editorTabStyle - - val circularProgressStyle: CircularProgressStyle - @Composable - @ReadOnlyComposable - get() = IntelliJTheme.circularProgressStyle -} +import org.jetbrains.jewel.ThemeDefinition @Composable fun BaseIntUiTheme( - theme: IntUiThemeDefinition, + theme: ThemeDefinition, componentStyling: @Composable () -> Array>, content: @Composable () -> Unit, ) { @@ -181,12 +21,12 @@ fun BaseIntUiTheme( @Composable fun BaseIntUiTheme( - theme: IntUiThemeDefinition, + theme: ThemeDefinition, componentStyling: @Composable () -> Array>, swingCompatMode: Boolean = false, content: @Composable () -> Unit, ) { - IntelliJTheme(theme, swingCompatMode) { + JewelTheme(theme, swingCompatMode) { CompositionLocalProvider( LocalColorPalette provides theme.colorPalette, LocalIconData provides theme.iconData, diff --git a/int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/IntUiThemeColorPalette.kt b/int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/IntUiThemeColorPalette.kt deleted file mode 100644 index 5cd4b6888..000000000 --- a/int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/IntUiThemeColorPalette.kt +++ /dev/null @@ -1,99 +0,0 @@ -package org.jetbrains.jewel.intui.core - -import androidx.compose.runtime.Immutable -import androidx.compose.ui.graphics.Color -import org.jetbrains.jewel.IntelliJThemeColorPalette - -@Immutable -interface IntUiThemeColorPalette : IntelliJThemeColorPalette { - - fun grey(): List - - fun grey(index: Int): Color - - fun blue(): List - - fun blue(index: Int): Color - - fun green(): List - - fun green(index: Int): Color - - fun red(): List - - fun red(index: Int): Color - - fun yellow(): List - - fun yellow(index: Int): Color - - fun orange(): List - - fun orange(index: Int): Color - - fun purple(): List - - fun purple(index: Int): Color - - fun teal(): List - - fun teal(index: Int): Color - - override fun lookup(colorKey: String): Color? { - val result = colorKeyRegex.matchEntire(colorKey.trim()) ?: return null - val colorGroup = result.groupValues[1].lowercase() - val colorIndex = result.groupValues[2].toIntOrNull() ?: return null - - return when (colorGroup) { - "grey" -> grey(colorIndex) - "blue" -> blue(colorIndex) - "green" -> green(colorIndex) - "red" -> red(colorIndex) - "yellow" -> yellow(colorIndex) - "orange" -> orange(colorIndex) - "purple" -> purple(colorIndex) - "teal" -> teal(colorIndex) - else -> null - } - } -} - -internal object EmptyIntUiThemeColorPalette : IntUiThemeColorPalette { - - override fun grey(): List = emptyList() - - override fun grey(index: Int): Color = Color.Unspecified - - override fun blue(): List = emptyList() - - override fun blue(index: Int): Color = Color.Unspecified - - override fun green(): List = emptyList() - - override fun green(index: Int): Color = Color.Unspecified - - override fun red(): List = emptyList() - - override fun red(index: Int): Color = Color.Unspecified - - override fun yellow(): List = emptyList() - - override fun yellow(index: Int): Color = Color.Unspecified - - override fun orange(): List = emptyList() - - override fun orange(index: Int): Color = Color.Unspecified - - override fun purple(): List = emptyList() - - override fun purple(index: Int): Color = Color.Unspecified - - override fun teal(): List = emptyList() - - override fun teal(index: Int): Color = Color.Unspecified - - override val rawMap: Map = emptyMap() -} - -private val colorKeyRegex: Regex - get() = "([a-z]+)(\\d+)".toRegex(RegexOption.IGNORE_CASE) diff --git a/int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/IntUiThemeDefinition.kt b/int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/IntUiThemeDefinition.kt deleted file mode 100644 index ac4e3df15..000000000 --- a/int-ui/int-ui-core/src/main/kotlin/org/jetbrains/jewel/intui/core/IntUiThemeDefinition.kt +++ /dev/null @@ -1,22 +0,0 @@ -package org.jetbrains.jewel.intui.core - -import androidx.compose.runtime.Immutable -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.text.TextStyle -import org.jetbrains.jewel.GenerateDataFunctions -import org.jetbrains.jewel.GlobalColors -import org.jetbrains.jewel.GlobalMetrics -import org.jetbrains.jewel.IntelliJThemeDefinition -import org.jetbrains.jewel.IntelliJThemeIconData - -@Immutable -@GenerateDataFunctions -class IntUiThemeDefinition( - override val isDark: Boolean, - override val globalColors: GlobalColors, - override val colorPalette: IntUiThemeColorPalette, - override val iconData: IntelliJThemeIconData, - override val globalMetrics: GlobalMetrics, - override val defaultTextStyle: TextStyle, - override val contentColor: Color, -) : IntelliJThemeDefinition diff --git a/int-ui/int-ui-decorated-window/api/int-ui-decorated-window.api b/int-ui/int-ui-decorated-window/api/int-ui-decorated-window.api index 6b828a169..63fd2fcd8 100644 --- a/int-ui/int-ui-decorated-window/api/int-ui-decorated-window.api +++ b/int-ui/int-ui-decorated-window/api/int-ui-decorated-window.api @@ -3,141 +3,32 @@ public final class org/jetbrains/jewel/intui/window/IntUiDecoratedWindowResource } public final class org/jetbrains/jewel/intui/window/IntUiThemeKt { - public static final fun decoratedWindowComponentStyling (Lorg/jetbrains/jewel/intui/core/IntUiThemeDefinition;Lorg/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowStyle;Lorg/jetbrains/jewel/window/styling/TitleBarStyle;Landroidx/compose/runtime/Composer;II)[Landroidx/compose/runtime/ProvidedValue; + public static final fun decoratedWindowComponentStyling (Lorg/jetbrains/jewel/ThemeDefinition;Lorg/jetbrains/jewel/window/styling/DecoratedWindowStyle;Lorg/jetbrains/jewel/window/styling/TitleBarStyle;Landroidx/compose/runtime/Composer;II)[Landroidx/compose/runtime/ProvidedValue; } -public final class org/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowColors : org/jetbrains/jewel/window/styling/DecoratedWindowColors { - public static final field $stable I - public static final field Companion Lorg/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowColors$Companion; - public synthetic fun (JJLkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun borderFor-3hEOMOc (JLandroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; - public fun equals (Ljava/lang/Object;)Z - public fun getBorder-0d7_KjU ()J - public fun getBorderInactive-0d7_KjU ()J - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class org/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowColors$Companion { - public final fun dark-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowColors; - public final fun light-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowColors; -} - -public final class org/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowMetrics : org/jetbrains/jewel/window/styling/DecoratedWindowMetrics { - public static final field $stable I - public synthetic fun (FILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (FLkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun equals (Ljava/lang/Object;)Z - public fun getBorderWidth-D9Ej5fM ()F - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class org/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowStyle : org/jetbrains/jewel/window/styling/DecoratedWindowStyle { - public static final field $stable I - public static final field Companion Lorg/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowStyle$Companion; - public fun (Lorg/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowColors;Lorg/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowMetrics;)V - public fun equals (Ljava/lang/Object;)Z - public fun getColors ()Lorg/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowColors; - public synthetic fun getColors ()Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors; - public fun getMetrics ()Lorg/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowMetrics; - public synthetic fun getMetrics ()Lorg/jetbrains/jewel/window/styling/DecoratedWindowMetrics; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class org/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowStyle$Companion { - public final fun dark (Lorg/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowColors;Lorg/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowStyle; - public final fun light (Lorg/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowColors;Lorg/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowStyle; -} - -public final class org/jetbrains/jewel/intui/window/styling/IntUiTitleBarColors : org/jetbrains/jewel/window/styling/TitleBarColors { - public static final field $stable I - public static final field Companion Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarColors$Companion; - public synthetic fun (JJJJJJJJJJJJJLkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun backgroundFor-3hEOMOc (JLandroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; - public fun equals (Ljava/lang/Object;)Z - public fun getBackground-0d7_KjU ()J - public fun getBorder-0d7_KjU ()J - public fun getContent-0d7_KjU ()J - public fun getDropdownHoveredBackground-0d7_KjU ()J - public fun getDropdownPressedBackground-0d7_KjU ()J - public fun getFullscreenControlButtonsBackground-0d7_KjU ()J - public fun getIconButtonHoveredBackground-0d7_KjU ()J - public fun getIconButtonPressedBackground-0d7_KjU ()J - public fun getInactiveBackground-0d7_KjU ()J - public fun getTitlePaneButtonHoveredBackground-0d7_KjU ()J - public fun getTitlePaneButtonPressedBackground-0d7_KjU ()J - public fun getTitlePaneCloseButtonHoveredBackground-0d7_KjU ()J - public fun getTitlePaneCloseButtonPressedBackground-0d7_KjU ()J - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class org/jetbrains/jewel/intui/window/styling/IntUiTitleBarColors$Companion { - public final fun dark-kwJvTHA (JJJJJJJJJJJJJLandroidx/compose/runtime/Composer;III)Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarColors; - public final fun light-kwJvTHA (JJJJJJJJJJJJJLandroidx/compose/runtime/Composer;III)Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarColors; - public final fun lightWithLightHeader-kwJvTHA (JJJJJJJJJJJJJLandroidx/compose/runtime/Composer;III)Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarColors; -} - -public final class org/jetbrains/jewel/intui/window/styling/IntUiTitleBarIcons : org/jetbrains/jewel/window/styling/TitleBarIcons { - public static final field $stable I - public static final field Companion Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarIcons$Companion; - public fun (Lorg/jetbrains/jewel/painter/PainterProvider;Lorg/jetbrains/jewel/painter/PainterProvider;Lorg/jetbrains/jewel/painter/PainterProvider;Lorg/jetbrains/jewel/painter/PainterProvider;)V - public fun equals (Ljava/lang/Object;)Z - public fun getCloseButton ()Lorg/jetbrains/jewel/painter/PainterProvider; - public fun getMaximizeButton ()Lorg/jetbrains/jewel/painter/PainterProvider; - public fun getMinimizeButton ()Lorg/jetbrains/jewel/painter/PainterProvider; - public fun getRestoreButton ()Lorg/jetbrains/jewel/painter/PainterProvider; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class org/jetbrains/jewel/intui/window/styling/IntUiTitleBarIcons$Companion { - public final fun close (Ljava/lang/String;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/painter/PainterProvider; - public final fun maximize (Ljava/lang/String;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/painter/PainterProvider; - public final fun minimize (Ljava/lang/String;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/painter/PainterProvider; - public final fun restore (Ljava/lang/String;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/painter/PainterProvider; -} - -public final class org/jetbrains/jewel/intui/window/styling/IntUiTitleBarMetrics : org/jetbrains/jewel/window/styling/TitleBarMetrics { - public static final field $stable I - public synthetic fun (FFFJILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (FFFJLkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun equals (Ljava/lang/Object;)Z - public fun getGradientEndX-D9Ej5fM ()F - public fun getGradientStartX-D9Ej5fM ()F - public fun getHeight-D9Ej5fM ()F - public fun getTitlePaneButtonSize-MYxV2XQ ()J - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class org/jetbrains/jewel/intui/window/styling/IntUiTitleBarStyle : org/jetbrains/jewel/window/styling/TitleBarStyle { - public static final field $stable I - public static final field Companion Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarStyle$Companion; - public fun (Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarColors;Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarMetrics;Lorg/jetbrains/jewel/window/styling/TitleBarIcons;Lorg/jetbrains/jewel/styling/DropdownStyle;Lorg/jetbrains/jewel/styling/IconButtonStyle;Lorg/jetbrains/jewel/styling/IconButtonStyle;Lorg/jetbrains/jewel/styling/IconButtonStyle;)V - public fun equals (Ljava/lang/Object;)Z - public fun getColors ()Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarColors; - public synthetic fun getColors ()Lorg/jetbrains/jewel/window/styling/TitleBarColors; - public fun getDropdownStyle ()Lorg/jetbrains/jewel/styling/DropdownStyle; - public fun getIconButtonStyle ()Lorg/jetbrains/jewel/styling/IconButtonStyle; - public fun getIcons ()Lorg/jetbrains/jewel/window/styling/TitleBarIcons; - public fun getMetrics ()Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarMetrics; - public synthetic fun getMetrics ()Lorg/jetbrains/jewel/window/styling/TitleBarMetrics; - public fun getPaneButtonStyle ()Lorg/jetbrains/jewel/styling/IconButtonStyle; - public fun getPaneCloseButtonStyle ()Lorg/jetbrains/jewel/styling/IconButtonStyle; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class org/jetbrains/jewel/intui/window/styling/IntUiTitleBarStyle$Companion { - public final fun dark (Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarColors;Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarMetrics;Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarIcons;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarStyle; - public final fun light (Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarColors;Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarMetrics;Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarIcons;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarStyle; - public final fun lightWithLightHeader (Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarColors;Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarMetrics;Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarIcons;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarStyle; +public final class org/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowStylingKt { + public static final fun dark (Lorg/jetbrains/jewel/window/styling/DecoratedWindowStyle$Companion;Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors;Lorg/jetbrains/jewel/window/styling/DecoratedWindowMetrics;)Lorg/jetbrains/jewel/window/styling/DecoratedWindowStyle; + public static synthetic fun dark$default (Lorg/jetbrains/jewel/window/styling/DecoratedWindowStyle$Companion;Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors;Lorg/jetbrains/jewel/window/styling/DecoratedWindowMetrics;ILjava/lang/Object;)Lorg/jetbrains/jewel/window/styling/DecoratedWindowStyle; + public static final fun dark-WkMS-hQ (Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors$Companion;JJ)Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors; + public static synthetic fun dark-WkMS-hQ$default (Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors$Companion;JJILjava/lang/Object;)Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors; + public static final fun defaults-3ABfNKs (Lorg/jetbrains/jewel/window/styling/DecoratedWindowMetrics$Companion;F)Lorg/jetbrains/jewel/window/styling/DecoratedWindowMetrics; + public static synthetic fun defaults-3ABfNKs$default (Lorg/jetbrains/jewel/window/styling/DecoratedWindowMetrics$Companion;FILjava/lang/Object;)Lorg/jetbrains/jewel/window/styling/DecoratedWindowMetrics; + public static final fun light (Lorg/jetbrains/jewel/window/styling/DecoratedWindowStyle$Companion;Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors;Lorg/jetbrains/jewel/window/styling/DecoratedWindowMetrics;)Lorg/jetbrains/jewel/window/styling/DecoratedWindowStyle; + public static synthetic fun light$default (Lorg/jetbrains/jewel/window/styling/DecoratedWindowStyle$Companion;Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors;Lorg/jetbrains/jewel/window/styling/DecoratedWindowMetrics;ILjava/lang/Object;)Lorg/jetbrains/jewel/window/styling/DecoratedWindowStyle; + public static final fun light-WkMS-hQ (Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors$Companion;JJ)Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors; + public static synthetic fun light-WkMS-hQ$default (Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors$Companion;JJILjava/lang/Object;)Lorg/jetbrains/jewel/window/styling/DecoratedWindowColors; } public final class org/jetbrains/jewel/intui/window/styling/IntUiTitleBarStylingKt { - public static final fun intUiTitleBarIcons (Lorg/jetbrains/jewel/painter/PainterProvider;Lorg/jetbrains/jewel/painter/PainterProvider;Lorg/jetbrains/jewel/painter/PainterProvider;Lorg/jetbrains/jewel/painter/PainterProvider;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/window/styling/IntUiTitleBarIcons; + public static final fun dark (Lorg/jetbrains/jewel/window/styling/TitleBarStyle$Companion;Lorg/jetbrains/jewel/window/styling/TitleBarColors;Lorg/jetbrains/jewel/window/styling/TitleBarMetrics;Lorg/jetbrains/jewel/window/styling/TitleBarIcons;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/window/styling/TitleBarStyle; + public static final fun dark-a6iJyiw (Lorg/jetbrains/jewel/window/styling/TitleBarColors$Companion;JJJJJJJJJJJJJLandroidx/compose/runtime/Composer;III)Lorg/jetbrains/jewel/window/styling/TitleBarColors; + public static final fun defaults (Lorg/jetbrains/jewel/window/styling/TitleBarIcons$Companion;Lorg/jetbrains/jewel/painter/PainterProvider;Lorg/jetbrains/jewel/painter/PainterProvider;Lorg/jetbrains/jewel/painter/PainterProvider;Lorg/jetbrains/jewel/painter/PainterProvider;)Lorg/jetbrains/jewel/window/styling/TitleBarIcons; + public static synthetic fun defaults$default (Lorg/jetbrains/jewel/window/styling/TitleBarIcons$Companion;Lorg/jetbrains/jewel/painter/PainterProvider;Lorg/jetbrains/jewel/painter/PainterProvider;Lorg/jetbrains/jewel/painter/PainterProvider;Lorg/jetbrains/jewel/painter/PainterProvider;ILjava/lang/Object;)Lorg/jetbrains/jewel/window/styling/TitleBarIcons; + public static final fun defaults-LgNEgRQ (Lorg/jetbrains/jewel/window/styling/TitleBarMetrics$Companion;FFFJ)Lorg/jetbrains/jewel/window/styling/TitleBarMetrics; + public static synthetic fun defaults-LgNEgRQ$default (Lorg/jetbrains/jewel/window/styling/TitleBarMetrics$Companion;FFFJILjava/lang/Object;)Lorg/jetbrains/jewel/window/styling/TitleBarMetrics; + public static final fun light (Lorg/jetbrains/jewel/window/styling/TitleBarStyle$Companion;Lorg/jetbrains/jewel/window/styling/TitleBarColors;Lorg/jetbrains/jewel/window/styling/TitleBarMetrics;Lorg/jetbrains/jewel/window/styling/TitleBarIcons;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/window/styling/TitleBarStyle; + public static final fun light-a6iJyiw (Lorg/jetbrains/jewel/window/styling/TitleBarColors$Companion;JJJJJJJJJJJJJLandroidx/compose/runtime/Composer;III)Lorg/jetbrains/jewel/window/styling/TitleBarColors; + public static final fun lightWithLightHeader (Lorg/jetbrains/jewel/window/styling/TitleBarStyle$Companion;Lorg/jetbrains/jewel/window/styling/TitleBarColors;Lorg/jetbrains/jewel/window/styling/TitleBarMetrics;Lorg/jetbrains/jewel/window/styling/TitleBarIcons;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/window/styling/TitleBarStyle; + public static final fun lightWithLightHeader-a6iJyiw (Lorg/jetbrains/jewel/window/styling/TitleBarColors$Companion;JJJJJJJJJJJJJLandroidx/compose/runtime/Composer;III)Lorg/jetbrains/jewel/window/styling/TitleBarColors; } diff --git a/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/IntUiDecoratedWindowResourceResolver.kt b/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/IntUiDecoratedWindowResourceResolver.kt index 53fcdeb22..3e08a5789 100644 --- a/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/IntUiDecoratedWindowResourceResolver.kt +++ b/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/IntUiDecoratedWindowResourceResolver.kt @@ -1,11 +1,11 @@ package org.jetbrains.jewel.intui.window -import org.jetbrains.jewel.intui.standalone.IntUiTheme -import org.jetbrains.jewel.intui.window.styling.IntUiDecoratedWindowStyle +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.painter.ResourcePainterProvider +import org.jetbrains.jewel.window.styling.DecoratedWindowStyle /** * Create [PainterProvider][org.jetbrains.jewel.painter.PainterProvider] for decorated window module resource. */ fun decoratedWindowPainterProvider(path: String) = - ResourcePainterProvider(path, IntUiDecoratedWindowStyle::class.java.classLoader, IntUiTheme::class.java.classLoader) + ResourcePainterProvider(path, DecoratedWindowStyle::class.java.classLoader, JewelTheme::class.java.classLoader) diff --git a/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/IntUiTheme.kt b/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/IntUiTheme.kt index 169e470cc..bf96550f8 100644 --- a/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/IntUiTheme.kt +++ b/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/IntUiTheme.kt @@ -2,24 +2,25 @@ package org.jetbrains.jewel.intui.window import androidx.compose.runtime.Composable import androidx.compose.runtime.ProvidedValue -import org.jetbrains.jewel.intui.core.IntUiThemeDefinition -import org.jetbrains.jewel.intui.window.styling.IntUiDecoratedWindowStyle -import org.jetbrains.jewel.intui.window.styling.IntUiTitleBarStyle +import org.jetbrains.jewel.ThemeDefinition +import org.jetbrains.jewel.intui.window.styling.dark +import org.jetbrains.jewel.intui.window.styling.light +import org.jetbrains.jewel.window.styling.DecoratedWindowStyle import org.jetbrains.jewel.window.styling.LocalDecoratedWindowStyle import org.jetbrains.jewel.window.styling.LocalTitleBarStyle import org.jetbrains.jewel.window.styling.TitleBarStyle @Composable -fun IntUiThemeDefinition.decoratedWindowComponentStyling( - windowStyle: IntUiDecoratedWindowStyle = if (isDark) { - IntUiDecoratedWindowStyle.dark() +fun ThemeDefinition.decoratedWindowComponentStyling( + windowStyle: DecoratedWindowStyle = if (isDark) { + DecoratedWindowStyle.dark() } else { - IntUiDecoratedWindowStyle.light() + DecoratedWindowStyle.light() }, titleBarStyle: TitleBarStyle = if (isDark) { - IntUiTitleBarStyle.dark() + TitleBarStyle.dark() } else { - IntUiTitleBarStyle.light() + TitleBarStyle.light() }, ): Array> = arrayOf( LocalDecoratedWindowStyle provides windowStyle, diff --git a/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowStyling.kt b/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowStyling.kt index f14e20df8..b470c3f2e 100644 --- a/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowStyling.kt +++ b/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/styling/IntUiDecoratedWindowStyling.kt @@ -1,8 +1,5 @@ package org.jetbrains.jewel.intui.window.styling -import androidx.compose.runtime.Composable -import androidx.compose.runtime.Immutable -import androidx.compose.runtime.Stable import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp @@ -10,109 +7,28 @@ import org.jetbrains.jewel.window.styling.DecoratedWindowColors import org.jetbrains.jewel.window.styling.DecoratedWindowMetrics import org.jetbrains.jewel.window.styling.DecoratedWindowStyle -@Stable -@Immutable -class IntUiDecoratedWindowStyle( - override val colors: IntUiDecoratedWindowColors, - override val metrics: IntUiDecoratedWindowMetrics, -) : DecoratedWindowStyle { - - override fun hashCode(): Int { - var result = colors.hashCode() - result = 31 * result + metrics.hashCode() - return result - } - - override fun toString(): String = "IntUiDecoratedWindowStyle(colors=$colors, metrics=$metrics)" - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is IntUiDecoratedWindowStyle) return false - - if (colors != other.colors) return false - if (metrics != other.metrics) return false - - return true - } - - companion object { - - @Composable fun light( - colors: IntUiDecoratedWindowColors = IntUiDecoratedWindowColors.light(), - metrics: IntUiDecoratedWindowMetrics = IntUiDecoratedWindowMetrics(), - ): IntUiDecoratedWindowStyle = IntUiDecoratedWindowStyle(colors, metrics) - - @Composable fun dark( - colors: IntUiDecoratedWindowColors = IntUiDecoratedWindowColors.dark(), - metrics: IntUiDecoratedWindowMetrics = IntUiDecoratedWindowMetrics(), - ): IntUiDecoratedWindowStyle = IntUiDecoratedWindowStyle(colors, metrics) - } -} - -@Stable -@Immutable -class IntUiDecoratedWindowColors( - override val border: Color, - override val borderInactive: Color, -) : DecoratedWindowColors { - - override fun hashCode(): Int { - var result = border.hashCode() - result = 31 * result + borderInactive.hashCode() - return result - } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is IntUiDecoratedWindowColors) return false - - if (border != other.border) return false - if (borderInactive != other.borderInactive) return false - - return true - } - - override fun toString(): String = "IntUiDecoratedWindowColors(border=$border, borderInactive=$borderInactive)" - - companion object { - - @Composable - fun light( - // from Window.undecorated.border - borderColor: Color = Color(0xFF5A5D6B), - inactiveBorderColor: Color = borderColor, - ) = IntUiDecoratedWindowColors( - borderColor, - inactiveBorderColor, - ) - - @Composable - fun dark( - // from Window.undecorated.border - borderColor: Color = Color(0xFF5A5D63), - inactiveBorderColor: Color = borderColor, - ) = IntUiDecoratedWindowColors( - borderColor, - inactiveBorderColor, - ) - } -} - -@Stable -class IntUiDecoratedWindowMetrics( - override val borderWidth: Dp = 1.dp, -) : DecoratedWindowMetrics { - - override fun toString(): String = "IntUiDecoratedWindowMetrics(borderWidth=$borderWidth)" - - override fun hashCode(): Int = borderWidth.hashCode() - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other !is IntUiDecoratedWindowMetrics) return false - - if (borderWidth != other.borderWidth) return false - - return true - } -} +fun DecoratedWindowStyle.Companion.light( + colors: DecoratedWindowColors = DecoratedWindowColors.light(), + metrics: DecoratedWindowMetrics = DecoratedWindowMetrics.defaults(), +) = DecoratedWindowStyle(colors, metrics) + +fun DecoratedWindowStyle.Companion.dark( + colors: DecoratedWindowColors = DecoratedWindowColors.dark(), + metrics: DecoratedWindowMetrics = DecoratedWindowMetrics.defaults(), +) = DecoratedWindowStyle(colors, metrics) + +fun DecoratedWindowColors.Companion.light( + // from Window.undecorated.border + borderColor: Color = Color(0xFF5A5D6B), + inactiveBorderColor: Color = borderColor, +) = DecoratedWindowColors(borderColor, inactiveBorderColor) + +fun DecoratedWindowColors.Companion.dark( + // from Window.undecorated.border + borderColor: Color = Color(0xFF5A5D63), + inactiveBorderColor: Color = borderColor, +) = DecoratedWindowColors(borderColor, inactiveBorderColor) + +fun DecoratedWindowMetrics.Companion.defaults( + borderWidth: Dp = 1.dp, +) = DecoratedWindowMetrics(borderWidth) diff --git a/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/styling/IntUiTitleBarStyling.kt b/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/styling/IntUiTitleBarStyling.kt index dbba9c97c..597bfd1ab 100644 --- a/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/styling/IntUiTitleBarStyling.kt +++ b/int-ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/styling/IntUiTitleBarStyling.kt @@ -2,12 +2,10 @@ package org.jetbrains.jewel.intui.window.styling import androidx.compose.foundation.shape.CornerSize import androidx.compose.runtime.Composable -import androidx.compose.runtime.Immutable import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp -import org.jetbrains.jewel.GenerateDataFunctions import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme import org.jetbrains.jewel.intui.standalone.styling.Undecorated @@ -27,332 +25,262 @@ import org.jetbrains.jewel.window.styling.TitleBarIcons import org.jetbrains.jewel.window.styling.TitleBarMetrics import org.jetbrains.jewel.window.styling.TitleBarStyle -@Immutable -@GenerateDataFunctions -class IntUiTitleBarStyle( - override val colors: IntUiTitleBarColors, - override val metrics: IntUiTitleBarMetrics, - override val icons: TitleBarIcons, - override val dropdownStyle: DropdownStyle, - override val iconButtonStyle: IconButtonStyle, - override val paneButtonStyle: IconButtonStyle, - override val paneCloseButtonStyle: IconButtonStyle, -) : TitleBarStyle { - - companion object { - - @Composable - private fun titleBarIconButtonStyle( - hoveredBackground: Color, - pressedBackground: Color, - metrics: IconButtonMetrics, - ) = IconButtonStyle( - IconButtonColors( - background = Color.Transparent, - backgroundDisabled = Color.Transparent, - backgroundFocused = Color.Transparent, - backgroundPressed = hoveredBackground, - backgroundHovered = pressedBackground, - border = Color.Transparent, - borderDisabled = Color.Transparent, - borderFocused = Color.Transparent, - borderPressed = Color.Transparent, - borderHovered = Color.Transparent, - ), - metrics, - ) - - @Composable - fun light( - colors: IntUiTitleBarColors = IntUiTitleBarColors.light(), - metrics: IntUiTitleBarMetrics = IntUiTitleBarMetrics(), - icons: IntUiTitleBarIcons = intUiTitleBarIcons(), - ): IntUiTitleBarStyle = IntUiTitleBarStyle( - colors = colors, - metrics = metrics, - icons = icons, - dropdownStyle = DropdownStyle.Undecorated.light( - colors = DropdownColors.Undecorated.light( - content = colors.content, - contentFocused = colors.content, - contentHovered = colors.content, - contentPressed = colors.content, - contentDisabled = colors.content, - backgroundHovered = colors.dropdownHoveredBackground, - backgroundPressed = colors.dropdownPressedBackground, - ), - menuStyle = MenuStyle.light(), - ), - iconButtonStyle = titleBarIconButtonStyle( - colors.iconButtonHoveredBackground, - colors.iconButtonPressedBackground, - IconButtonMetrics.defaults(borderWidth = 0.dp), - ), - paneButtonStyle = titleBarIconButtonStyle( - colors.titlePaneButtonHoveredBackground, - colors.titlePaneButtonPressedBackground, - IconButtonMetrics.defaults(cornerSize = CornerSize(0.dp), borderWidth = 0.dp), - ), - paneCloseButtonStyle = titleBarIconButtonStyle( - colors.titlePaneCloseButtonHoveredBackground, - colors.titlePaneCloseButtonPressedBackground, - IconButtonMetrics.defaults(cornerSize = CornerSize(0.dp), borderWidth = 0.dp), +@Composable +fun TitleBarStyle.Companion.light( + colors: TitleBarColors = TitleBarColors.light(), + metrics: TitleBarMetrics = TitleBarMetrics.defaults(), + icons: TitleBarIcons = TitleBarIcons.defaults(), +) = + TitleBarStyle( + colors = colors, + metrics = metrics, + icons = icons, + dropdownStyle = DropdownStyle.Undecorated.light( + colors = DropdownColors.Undecorated.light( + content = colors.content, + contentFocused = colors.content, + contentHovered = colors.content, + contentPressed = colors.content, + contentDisabled = colors.content, + backgroundHovered = colors.dropdownHoveredBackground, + backgroundPressed = colors.dropdownPressedBackground, ), - ) + menuStyle = MenuStyle.light(), + ), + iconButtonStyle = titleBarIconButtonStyle( + colors.iconButtonHoveredBackground, + colors.iconButtonPressedBackground, + IconButtonMetrics.defaults(borderWidth = 0.dp), + ), + paneButtonStyle = titleBarIconButtonStyle( + colors.titlePaneButtonHoveredBackground, + colors.titlePaneButtonPressedBackground, + IconButtonMetrics.defaults(cornerSize = CornerSize(0.dp), borderWidth = 0.dp), + ), + paneCloseButtonStyle = titleBarIconButtonStyle( + colors.titlePaneCloseButtonHoveredBackground, + colors.titlePaneCloseButtonPressedBackground, + IconButtonMetrics.defaults(cornerSize = CornerSize(0.dp), borderWidth = 0.dp), + ), + ) - @Composable - fun lightWithLightHeader( - colors: IntUiTitleBarColors = IntUiTitleBarColors.lightWithLightHeader(), - metrics: IntUiTitleBarMetrics = IntUiTitleBarMetrics(), - icons: IntUiTitleBarIcons = intUiTitleBarIcons(), - ): IntUiTitleBarStyle = IntUiTitleBarStyle( - colors = colors, - metrics = metrics, - icons = icons, - dropdownStyle = DropdownStyle.Undecorated.light( - colors = DropdownColors.Undecorated.light( - content = colors.content, - contentFocused = colors.content, - contentHovered = colors.content, - contentPressed = colors.content, - contentDisabled = colors.content, - backgroundHovered = colors.dropdownHoveredBackground, - backgroundPressed = colors.dropdownPressedBackground, - ), - menuStyle = MenuStyle.light(), - ), - iconButtonStyle = titleBarIconButtonStyle( - colors.iconButtonHoveredBackground, - colors.iconButtonPressedBackground, - IconButtonMetrics.defaults(borderWidth = 0.dp), - ), - paneButtonStyle = titleBarIconButtonStyle( - colors.titlePaneButtonHoveredBackground, - colors.titlePaneButtonPressedBackground, - IconButtonMetrics.defaults(cornerSize = CornerSize(0.dp), borderWidth = 0.dp), - ), - paneCloseButtonStyle = titleBarIconButtonStyle( - colors.titlePaneCloseButtonHoveredBackground, - colors.titlePaneCloseButtonPressedBackground, - IconButtonMetrics.defaults(cornerSize = CornerSize(0.dp), borderWidth = 0.dp), +@Composable +fun TitleBarStyle.Companion.lightWithLightHeader( + colors: TitleBarColors = TitleBarColors.lightWithLightHeader(), + metrics: TitleBarMetrics = TitleBarMetrics.defaults(), + icons: TitleBarIcons = TitleBarIcons.defaults(), +) = + TitleBarStyle( + colors = colors, + metrics = metrics, + icons = icons, + dropdownStyle = DropdownStyle.Undecorated.light( + colors = DropdownColors.Undecorated.light( + content = colors.content, + contentFocused = colors.content, + contentHovered = colors.content, + contentPressed = colors.content, + contentDisabled = colors.content, + backgroundHovered = colors.dropdownHoveredBackground, + backgroundPressed = colors.dropdownPressedBackground, ), - ) + menuStyle = MenuStyle.light(), + ), + iconButtonStyle = titleBarIconButtonStyle( + colors.iconButtonHoveredBackground, + colors.iconButtonPressedBackground, + IconButtonMetrics.defaults(borderWidth = 0.dp), + ), + paneButtonStyle = titleBarIconButtonStyle( + colors.titlePaneButtonHoveredBackground, + colors.titlePaneButtonPressedBackground, + IconButtonMetrics.defaults(cornerSize = CornerSize(0.dp), borderWidth = 0.dp), + ), + paneCloseButtonStyle = titleBarIconButtonStyle( + colors.titlePaneCloseButtonHoveredBackground, + colors.titlePaneCloseButtonPressedBackground, + IconButtonMetrics.defaults(cornerSize = CornerSize(0.dp), borderWidth = 0.dp), + ), + ) - @Composable - fun dark( - colors: IntUiTitleBarColors = IntUiTitleBarColors.dark(), - metrics: IntUiTitleBarMetrics = IntUiTitleBarMetrics(), - icons: IntUiTitleBarIcons = intUiTitleBarIcons(), - ): IntUiTitleBarStyle = IntUiTitleBarStyle( - colors = colors, - metrics = metrics, - icons = icons, - dropdownStyle = DropdownStyle.Undecorated.dark( - colors = DropdownColors.Undecorated.dark( - content = colors.content, - contentFocused = colors.content, - contentHovered = colors.content, - contentPressed = colors.content, - contentDisabled = colors.content, - backgroundHovered = colors.dropdownHoveredBackground, - backgroundPressed = colors.dropdownPressedBackground, - ), - menuStyle = MenuStyle.dark(), - ), - iconButtonStyle = titleBarIconButtonStyle( - colors.iconButtonHoveredBackground, - colors.iconButtonPressedBackground, - IconButtonMetrics.defaults(borderWidth = 0.dp), - ), - paneButtonStyle = titleBarIconButtonStyle( - colors.titlePaneButtonHoveredBackground, - colors.titlePaneButtonPressedBackground, - IconButtonMetrics.defaults(cornerSize = CornerSize(0.dp), borderWidth = 0.dp), - ), - paneCloseButtonStyle = titleBarIconButtonStyle( - colors.titlePaneCloseButtonHoveredBackground, - colors.titlePaneCloseButtonPressedBackground, - IconButtonMetrics.defaults(cornerSize = CornerSize(0.dp), borderWidth = 0.dp), +@Composable +fun TitleBarStyle.Companion.dark( + colors: TitleBarColors = TitleBarColors.dark(), + metrics: TitleBarMetrics = TitleBarMetrics.defaults(), + icons: TitleBarIcons = TitleBarIcons.defaults(), +) = + TitleBarStyle( + colors = colors, + metrics = metrics, + icons = icons, + dropdownStyle = DropdownStyle.Undecorated.dark( + colors = DropdownColors.Undecorated.dark( + content = colors.content, + contentFocused = colors.content, + contentHovered = colors.content, + contentPressed = colors.content, + contentDisabled = colors.content, + backgroundHovered = colors.dropdownHoveredBackground, + backgroundPressed = colors.dropdownPressedBackground, ), - ) - } -} - -@Immutable -@GenerateDataFunctions -class IntUiTitleBarColors( - override val background: Color, - override val inactiveBackground: Color, - override val content: Color, - override val border: Color, - override val fullscreenControlButtonsBackground: Color, - override val titlePaneButtonHoveredBackground: Color, - override val titlePaneButtonPressedBackground: Color, - override val titlePaneCloseButtonHoveredBackground: Color, - override val titlePaneCloseButtonPressedBackground: Color, - override val iconButtonHoveredBackground: Color, - override val iconButtonPressedBackground: Color, - override val dropdownHoveredBackground: Color, - override val dropdownPressedBackground: Color, -) : TitleBarColors { - - companion object { - - @Composable - fun light( - backgroundColor: Color = IntUiLightTheme.colors.grey(2), - inactiveBackground: Color = IntUiLightTheme.colors.grey(3), - contentColor: Color = IntUiLightTheme.colors.grey(12), - borderColor: Color = IntUiLightTheme.colors.grey(4), - fullscreenControlButtonsBackground: Color = Color(0xFF7A7B80), - // Color hex from - // com.intellij.util.ui.JBUI.CurrentTheme.CustomFrameDecorations.titlePaneButtonHoveredBackground - titlePaneButtonHoveredBackground: Color = Color(0x1AFFFFFF), - // Same as - // com.intellij.util.ui.JBUI.CurrentTheme.CustomFrameDecorations.titlePaneButtonPressedBackground - titlePaneButtonPressedBackground: Color = titlePaneButtonHoveredBackground, - // Color hex from - // com.intellij.openapi.wm.impl.customFrameDecorations.CustomFrameTitleButtons.closeStyleBuilder - titlePaneCloseButtonHoveredBackground: Color = Color(0xFFE81123), - titlePaneCloseButtonPressedBackground: Color = Color(0xFFF1707A), - - iconButtonHoveredBackground: Color = IntUiLightTheme.colors.grey(3), - iconButtonPressedBackground: Color = IntUiLightTheme.colors.grey(3), - - // There are two fields in theme.json: transparentHoveredBackground and hoveredBackground, - // but in com.intellij.ide.ui.laf.darcula.ui.ToolbarComboWidgetUI#paintBackground, - // transparentHoveredBackground is used first, which is guessed to be due to the gradient background - // caused by the project color of the titlebar, which makes the pure color background look strange - // in the area. In order to simplify the use in Jewel, here directly use transparentHoveredBackground - // as hoveredBackground. - dropdownHoveredBackground: Color = Color(0x1AFFFFFF), - dropdownPressedBackground: Color = dropdownHoveredBackground, - ) = IntUiTitleBarColors( - background = backgroundColor, - inactiveBackground = inactiveBackground, - content = contentColor, - border = borderColor, - fullscreenControlButtonsBackground = fullscreenControlButtonsBackground, - titlePaneButtonHoveredBackground = titlePaneButtonHoveredBackground, - titlePaneButtonPressedBackground = titlePaneButtonPressedBackground, - titlePaneCloseButtonHoveredBackground = titlePaneCloseButtonHoveredBackground, - titlePaneCloseButtonPressedBackground = titlePaneCloseButtonPressedBackground, - iconButtonHoveredBackground = iconButtonHoveredBackground, - iconButtonPressedBackground = iconButtonPressedBackground, - dropdownHoveredBackground = dropdownHoveredBackground, - dropdownPressedBackground = dropdownPressedBackground, - ) + menuStyle = MenuStyle.dark(), + ), + iconButtonStyle = titleBarIconButtonStyle( + colors.iconButtonHoveredBackground, + colors.iconButtonPressedBackground, + IconButtonMetrics.defaults(borderWidth = 0.dp), + ), + paneButtonStyle = titleBarIconButtonStyle( + colors.titlePaneButtonHoveredBackground, + colors.titlePaneButtonPressedBackground, + IconButtonMetrics.defaults(cornerSize = CornerSize(0.dp), borderWidth = 0.dp), + ), + paneCloseButtonStyle = titleBarIconButtonStyle( + colors.titlePaneCloseButtonHoveredBackground, + colors.titlePaneCloseButtonPressedBackground, + IconButtonMetrics.defaults(cornerSize = CornerSize(0.dp), borderWidth = 0.dp), + ), + ) - @Composable - fun lightWithLightHeader( - backgroundColor: Color = IntUiLightTheme.colors.grey(13), - inactiveBackground: Color = IntUiLightTheme.colors.grey(12), - fullscreenControlButtonsBackground: Color = Color(0xFF7A7B80), - contentColor: Color = IntUiLightTheme.colors.grey(1), - borderColor: Color = IntUiLightTheme.colors.grey(11), - titlePaneButtonHoveredBackground: Color = Color(0x1A000000), - titlePaneButtonPressedBackground: Color = titlePaneButtonHoveredBackground, - titlePaneCloseButtonHoveredBackground: Color = Color(0xFFE81123), - titlePaneCloseButtonPressedBackground: Color = Color(0xFFF1707A), - iconButtonHoveredBackground: Color = IntUiLightTheme.colors.grey(12), - iconButtonPressedBackground: Color = IntUiLightTheme.colors.grey(11), - dropdownHoveredBackground: Color = Color(0x0D000000), - dropdownPressedBackground: Color = dropdownHoveredBackground, - ) = IntUiTitleBarColors( - background = backgroundColor, - inactiveBackground = inactiveBackground, - content = contentColor, - border = borderColor, - fullscreenControlButtonsBackground = fullscreenControlButtonsBackground, - titlePaneButtonHoveredBackground = titlePaneButtonHoveredBackground, - titlePaneButtonPressedBackground = titlePaneButtonPressedBackground, - titlePaneCloseButtonHoveredBackground = titlePaneCloseButtonHoveredBackground, - titlePaneCloseButtonPressedBackground = titlePaneCloseButtonPressedBackground, - iconButtonHoveredBackground = iconButtonHoveredBackground, - iconButtonPressedBackground = iconButtonPressedBackground, - dropdownHoveredBackground = dropdownHoveredBackground, - dropdownPressedBackground = dropdownPressedBackground, - ) +private fun titleBarIconButtonStyle( + hoveredBackground: Color, + pressedBackground: Color, + metrics: IconButtonMetrics, +) = IconButtonStyle( + IconButtonColors( + background = Color.Transparent, + backgroundDisabled = Color.Transparent, + backgroundFocused = Color.Transparent, + backgroundPressed = hoveredBackground, + backgroundHovered = pressedBackground, + border = Color.Transparent, + borderDisabled = Color.Transparent, + borderFocused = Color.Transparent, + borderPressed = Color.Transparent, + borderHovered = Color.Transparent, + ), + metrics, +) - @Composable - fun dark( - backgroundColor: Color = IntUiDarkTheme.colors.grey(2), - inactiveBackground: Color = IntUiDarkTheme.colors.grey(3), - fullscreenControlButtonsBackground: Color = Color(0xFF575A5C), - contentColor: Color = IntUiDarkTheme.colors.grey(12), - borderColor: Color = IntUiDarkTheme.colors.grey(4), - titlePaneButtonHoveredBackground: Color = Color(0x1AFFFFFF), - titlePaneButtonPressedBackground: Color = titlePaneButtonHoveredBackground, - titlePaneCloseButtonHoveredBackground: Color = Color(0xFFE81123), - titlePaneCloseButtonPressedBackground: Color = Color(0xFFF1707A), - iconButtonHoveredBackground: Color = IntUiLightTheme.colors.grey(3), - iconButtonPressedBackground: Color = IntUiLightTheme.colors.grey(3), - dropdownHoveredBackground: Color = Color(0x1AFFFFFF), - dropdownPressedBackground: Color = dropdownHoveredBackground, - ) = IntUiTitleBarColors( - background = backgroundColor, - inactiveBackground = inactiveBackground, - content = contentColor, - border = borderColor, - fullscreenControlButtonsBackground = fullscreenControlButtonsBackground, - titlePaneButtonHoveredBackground = titlePaneButtonHoveredBackground, - titlePaneButtonPressedBackground = titlePaneButtonPressedBackground, - titlePaneCloseButtonHoveredBackground = titlePaneCloseButtonHoveredBackground, - titlePaneCloseButtonPressedBackground = titlePaneCloseButtonPressedBackground, - iconButtonHoveredBackground = iconButtonHoveredBackground, - iconButtonPressedBackground = iconButtonPressedBackground, - dropdownHoveredBackground = dropdownHoveredBackground, - dropdownPressedBackground = dropdownPressedBackground, - ) - } -} - -@Immutable -@GenerateDataFunctions -class IntUiTitleBarMetrics( - override val height: Dp = 40.dp, - override val gradientStartX: Dp = (-100).dp, - override val gradientEndX: Dp = 400.dp, - override val titlePaneButtonSize: DpSize = DpSize(40.dp, 40.dp), -) : TitleBarMetrics - -@Immutable -@GenerateDataFunctions -class IntUiTitleBarIcons( - override val minimizeButton: PainterProvider, - override val maximizeButton: PainterProvider, - override val restoreButton: PainterProvider, - override val closeButton: PainterProvider, -) : TitleBarIcons { +@Composable +fun TitleBarColors.Companion.light( + backgroundColor: Color = IntUiLightTheme.colors.grey(2), + inactiveBackground: Color = IntUiLightTheme.colors.grey(3), + contentColor: Color = IntUiLightTheme.colors.grey(12), + borderColor: Color = IntUiLightTheme.colors.grey(4), + fullscreenControlButtonsBackground: Color = Color(0xFF7A7B80), + // Color hex from + // com.intellij.util.ui.JBUI.CurrentTheme.CustomFrameDecorations.titlePaneButtonHoveredBackground + titlePaneButtonHoveredBackground: Color = Color(0x1AFFFFFF), + // Same as + // com.intellij.util.ui.JBUI.CurrentTheme.CustomFrameDecorations.titlePaneButtonPressedBackground + titlePaneButtonPressedBackground: Color = titlePaneButtonHoveredBackground, + // Color hex from + // com.intellij.openapi.wm.impl.customFrameDecorations.CustomFrameTitleButtons.closeStyleBuilder + titlePaneCloseButtonHoveredBackground: Color = Color(0xFFE81123), + titlePaneCloseButtonPressedBackground: Color = Color(0xFFF1707A), - companion object { + iconButtonHoveredBackground: Color = IntUiLightTheme.colors.grey(3), + iconButtonPressedBackground: Color = IntUiLightTheme.colors.grey(3), - @Composable - fun minimize( - basePath: String = "icons/intui/window/minimize.svg", - ): PainterProvider = decoratedWindowPainterProvider(basePath) + // There are two fields in theme.json: transparentHoveredBackground and hoveredBackground, + // but in com.intellij.ide.ui.laf.darcula.ui.ToolbarComboWidgetUI#paintBackground, + // transparentHoveredBackground is used first, which is guessed to be due to the gradient background + // caused by the project color of the titlebar, which makes the pure color background look strange + // in the area. In order to simplify the use in Jewel, here directly use transparentHoveredBackground + // as hoveredBackground. + dropdownHoveredBackground: Color = Color(0x1AFFFFFF), + dropdownPressedBackground: Color = dropdownHoveredBackground, +) = + TitleBarColors( + background = backgroundColor, + inactiveBackground = inactiveBackground, + content = contentColor, + border = borderColor, + fullscreenControlButtonsBackground = fullscreenControlButtonsBackground, + titlePaneButtonHoveredBackground = titlePaneButtonHoveredBackground, + titlePaneButtonPressedBackground = titlePaneButtonPressedBackground, + titlePaneCloseButtonHoveredBackground = titlePaneCloseButtonHoveredBackground, + titlePaneCloseButtonPressedBackground = titlePaneCloseButtonPressedBackground, + iconButtonHoveredBackground = iconButtonHoveredBackground, + iconButtonPressedBackground = iconButtonPressedBackground, + dropdownHoveredBackground = dropdownHoveredBackground, + dropdownPressedBackground = dropdownPressedBackground, + ) - @Composable - fun maximize( - basePath: String = "icons/intui/window/maximize.svg", - ): PainterProvider = decoratedWindowPainterProvider(basePath) +@Composable +fun TitleBarColors.Companion.lightWithLightHeader( + backgroundColor: Color = IntUiLightTheme.colors.grey(13), + inactiveBackground: Color = IntUiLightTheme.colors.grey(12), + fullscreenControlButtonsBackground: Color = Color(0xFF7A7B80), + contentColor: Color = IntUiLightTheme.colors.grey(1), + borderColor: Color = IntUiLightTheme.colors.grey(11), + titlePaneButtonHoveredBackground: Color = Color(0x1A000000), + titlePaneButtonPressedBackground: Color = titlePaneButtonHoveredBackground, + titlePaneCloseButtonHoveredBackground: Color = Color(0xFFE81123), + titlePaneCloseButtonPressedBackground: Color = Color(0xFFF1707A), + iconButtonHoveredBackground: Color = IntUiLightTheme.colors.grey(12), + iconButtonPressedBackground: Color = IntUiLightTheme.colors.grey(11), + dropdownHoveredBackground: Color = Color(0x0D000000), + dropdownPressedBackground: Color = dropdownHoveredBackground, +) = + TitleBarColors( + background = backgroundColor, + inactiveBackground = inactiveBackground, + content = contentColor, + border = borderColor, + fullscreenControlButtonsBackground = fullscreenControlButtonsBackground, + titlePaneButtonHoveredBackground = titlePaneButtonHoveredBackground, + titlePaneButtonPressedBackground = titlePaneButtonPressedBackground, + titlePaneCloseButtonHoveredBackground = titlePaneCloseButtonHoveredBackground, + titlePaneCloseButtonPressedBackground = titlePaneCloseButtonPressedBackground, + iconButtonHoveredBackground = iconButtonHoveredBackground, + iconButtonPressedBackground = iconButtonPressedBackground, + dropdownHoveredBackground = dropdownHoveredBackground, + dropdownPressedBackground = dropdownPressedBackground, + ) - @Composable - fun restore( - basePath: String = "icons/intui/window/restore.svg", - ): PainterProvider = decoratedWindowPainterProvider(basePath) +@Composable +fun TitleBarColors.Companion.dark( + backgroundColor: Color = IntUiDarkTheme.colors.grey(2), + inactiveBackground: Color = IntUiDarkTheme.colors.grey(3), + fullscreenControlButtonsBackground: Color = Color(0xFF575A5C), + contentColor: Color = IntUiDarkTheme.colors.grey(12), + borderColor: Color = IntUiDarkTheme.colors.grey(4), + titlePaneButtonHoveredBackground: Color = Color(0x1AFFFFFF), + titlePaneButtonPressedBackground: Color = titlePaneButtonHoveredBackground, + titlePaneCloseButtonHoveredBackground: Color = Color(0xFFE81123), + titlePaneCloseButtonPressedBackground: Color = Color(0xFFF1707A), + iconButtonHoveredBackground: Color = IntUiLightTheme.colors.grey(3), + iconButtonPressedBackground: Color = IntUiLightTheme.colors.grey(3), + dropdownHoveredBackground: Color = Color(0x1AFFFFFF), + dropdownPressedBackground: Color = dropdownHoveredBackground, +) = TitleBarColors( + background = backgroundColor, + inactiveBackground = inactiveBackground, + content = contentColor, + border = borderColor, + fullscreenControlButtonsBackground = fullscreenControlButtonsBackground, + titlePaneButtonHoveredBackground = titlePaneButtonHoveredBackground, + titlePaneButtonPressedBackground = titlePaneButtonPressedBackground, + titlePaneCloseButtonHoveredBackground = titlePaneCloseButtonHoveredBackground, + titlePaneCloseButtonPressedBackground = titlePaneCloseButtonPressedBackground, + iconButtonHoveredBackground = iconButtonHoveredBackground, + iconButtonPressedBackground = iconButtonPressedBackground, + dropdownHoveredBackground = dropdownHoveredBackground, + dropdownPressedBackground = dropdownPressedBackground, +) - @Composable - fun close( - basePath: String = "icons/intui/window/close.svg", - ): PainterProvider = decoratedWindowPainterProvider(basePath) - } -} +fun TitleBarMetrics.Companion.defaults( + height: Dp = 40.dp, + gradientStartX: Dp = (-100).dp, + gradientEndX: Dp = 400.dp, + titlePaneButtonSize: DpSize = DpSize(40.dp, 40.dp), +) = TitleBarMetrics(height, gradientStartX, gradientEndX, titlePaneButtonSize) -@Composable -fun intUiTitleBarIcons( - minimize: PainterProvider = IntUiTitleBarIcons.minimize(), - maximize: PainterProvider = IntUiTitleBarIcons.maximize(), - restore: PainterProvider = IntUiTitleBarIcons.restore(), - close: PainterProvider = IntUiTitleBarIcons.close(), -) = IntUiTitleBarIcons(minimize, maximize, restore, close) +fun TitleBarIcons.Companion.defaults( + minimizeButton: PainterProvider = decoratedWindowPainterProvider("icons/intui/window/minimize.svg"), + maximizeButton: PainterProvider = decoratedWindowPainterProvider("icons/intui/window/maximize.svg"), + restoreButton: PainterProvider = decoratedWindowPainterProvider("icons/intui/window/restore.svg"), + closeButton: PainterProvider = decoratedWindowPainterProvider("icons/intui/window/close.svg"), +) = TitleBarIcons(minimizeButton, maximizeButton, restoreButton, closeButton) 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 65ed058ba..43a2809a8 100644 --- a/int-ui/int-ui-standalone/api/int-ui-standalone.api +++ b/int-ui/int-ui-standalone/api/int-ui-standalone.api @@ -1,108 +1,25 @@ -public final class org/jetbrains/jewel/intui/standalone/IntUiBorderColors : org/jetbrains/jewel/BorderColors { - public static final field $stable I - public static final field Companion Lorg/jetbrains/jewel/intui/standalone/IntUiBorderColors$Companion; - public synthetic fun (JJJLkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun equals (Ljava/lang/Object;)Z - public fun getDisabled-0d7_KjU ()J - public fun getFocused-0d7_KjU ()J - public fun getNormal-0d7_KjU ()J - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class org/jetbrains/jewel/intui/standalone/IntUiBorderColors$Companion { - public final fun dark-RGew2ao (JJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/standalone/IntUiBorderColors; - public final fun light-RGew2ao (JJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/standalone/IntUiBorderColors; +public final class org/jetbrains/jewel/intui/standalone/IntUiGlobalColorsKt { + public static final fun dark-GyCwops (Lorg/jetbrains/jewel/BorderColors$Companion;JJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/BorderColors; + public static final fun dark-Hformbs (Lorg/jetbrains/jewel/OutlineColors$Companion;JJJJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/OutlineColors; + public static final fun dark-jA1GFJw (Lorg/jetbrains/jewel/GlobalColors$Companion;Lorg/jetbrains/jewel/BorderColors;Lorg/jetbrains/jewel/OutlineColors;JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/GlobalColors; + public static final fun light-GyCwops (Lorg/jetbrains/jewel/BorderColors$Companion;JJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/BorderColors; + public static final fun light-Hformbs (Lorg/jetbrains/jewel/OutlineColors$Companion;JJJJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/OutlineColors; + public static final fun light-jA1GFJw (Lorg/jetbrains/jewel/GlobalColors$Companion;Lorg/jetbrains/jewel/BorderColors;Lorg/jetbrains/jewel/OutlineColors;JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/GlobalColors; } -public final class org/jetbrains/jewel/intui/standalone/IntUiGlobalColors : org/jetbrains/jewel/GlobalColors { - public static final field $stable I - public static final field Companion Lorg/jetbrains/jewel/intui/standalone/IntUiGlobalColors$Companion; - public synthetic fun (Lorg/jetbrains/jewel/BorderColors;Lorg/jetbrains/jewel/OutlineColors;JJLkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun equals (Ljava/lang/Object;)Z - public fun getBorders ()Lorg/jetbrains/jewel/BorderColors; - public fun getInfoContent-0d7_KjU ()J - public fun getOutlines ()Lorg/jetbrains/jewel/OutlineColors; - public fun getPaneBackground-0d7_KjU ()J - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class org/jetbrains/jewel/intui/standalone/IntUiGlobalColors$Companion { - public final fun dark-eaDK9VM (Lorg/jetbrains/jewel/BorderColors;Lorg/jetbrains/jewel/OutlineColors;JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/standalone/IntUiGlobalColors; - public final fun light-eaDK9VM (Lorg/jetbrains/jewel/BorderColors;Lorg/jetbrains/jewel/OutlineColors;JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/standalone/IntUiGlobalColors; -} - -public final class org/jetbrains/jewel/intui/standalone/IntUiGlobalMetrics : org/jetbrains/jewel/GlobalMetrics { - public static final field $stable I - public synthetic fun (FFILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (FFLkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun equals (Ljava/lang/Object;)Z - public fun getOutlineWidth-D9Ej5fM ()F - public fun getRowHeight-D9Ej5fM ()F - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class org/jetbrains/jewel/intui/standalone/IntUiOutlineColors : org/jetbrains/jewel/OutlineColors { - public static final field $stable I - public static final field Companion Lorg/jetbrains/jewel/intui/standalone/IntUiOutlineColors$Companion; - public synthetic fun (JJJJJLkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun equals (Ljava/lang/Object;)Z - public fun getError-0d7_KjU ()J - public fun getFocused-0d7_KjU ()J - public fun getFocusedError-0d7_KjU ()J - public fun getFocusedWarning-0d7_KjU ()J - public fun getWarning-0d7_KjU ()J - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class org/jetbrains/jewel/intui/standalone/IntUiOutlineColors$Companion { - public final fun dark-zjMxDiM (JJJJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/standalone/IntUiOutlineColors; - public final fun light-zjMxDiM (JJJJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/standalone/IntUiOutlineColors; -} - -public final class org/jetbrains/jewel/intui/standalone/IntUiTheme : org/jetbrains/jewel/intui/core/BaseIntUiTheme { - public static final field $stable I - public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/IntUiTheme; - public final fun darkComponentStyling (Lorg/jetbrains/jewel/styling/CheckboxStyle;Lorg/jetbrains/jewel/styling/ChipStyle;Lorg/jetbrains/jewel/styling/CircularProgressStyle;Lorg/jetbrains/jewel/styling/ButtonStyle;Lorg/jetbrains/jewel/styling/TabStyle;Lorg/jetbrains/jewel/styling/DividerStyle;Lorg/jetbrains/jewel/styling/DropdownStyle;Lorg/jetbrains/jewel/styling/TabStyle;Lorg/jetbrains/jewel/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/styling/IconButtonStyle;Lorg/jetbrains/jewel/styling/LabelledTextFieldStyle;Lorg/jetbrains/jewel/styling/LazyTreeStyle;Lorg/jetbrains/jewel/styling/LinkStyle;Lorg/jetbrains/jewel/styling/MenuStyle;Lorg/jetbrains/jewel/styling/ButtonStyle;Lorg/jetbrains/jewel/styling/RadioButtonStyle;Lorg/jetbrains/jewel/styling/ScrollbarStyle;Lorg/jetbrains/jewel/styling/TextAreaStyle;Lorg/jetbrains/jewel/styling/TextFieldStyle;Lorg/jetbrains/jewel/styling/TooltipStyle;Lorg/jetbrains/jewel/styling/DropdownStyle;Landroidx/compose/runtime/Composer;IIII)Lorg/jetbrains/jewel/IntelliJComponentStyling; - public final fun darkThemeDefinition-V-9fs2A (Lorg/jetbrains/jewel/GlobalColors;Lorg/jetbrains/jewel/GlobalMetrics;Lorg/jetbrains/jewel/intui/core/IntUiThemeColorPalette;Lorg/jetbrains/jewel/IntelliJThemeIconData;Landroidx/compose/ui/text/TextStyle;JLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/core/IntUiThemeDefinition; - public final fun defaultComponentStyling (Lorg/jetbrains/jewel/intui/core/IntUiThemeDefinition;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/IntelliJComponentStyling; - public fun getCheckboxStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/CheckboxStyle; - public fun getChipStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/ChipStyle; - public fun getCircularProgressStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/CircularProgressStyle; - public fun getColorPalette (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/intui/core/IntUiThemeColorPalette; - public fun getContentColor (Landroidx/compose/runtime/Composer;I)J - public fun getDefaultButtonStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/ButtonStyle; - public fun getDefaultTabStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/TabStyle; - public final fun getDefaultTextStyle ()Landroidx/compose/ui/text/TextStyle; - public fun getDividerStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/DividerStyle; - public fun getDropdownStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/DropdownStyle; - public fun getEditorTabStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/TabStyle; - public fun getGlobalColors (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/GlobalColors; - public fun getGlobalMetrics (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/GlobalMetrics; - public fun getGroupHeaderStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/GroupHeaderStyle; - public fun getHorizontalProgressBarStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/HorizontalProgressBarStyle; - public fun getIconData (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/IntelliJThemeIconData; - public fun getLabelledTextFieldStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/LabelledTextFieldStyle; - public fun getLinkStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/LinkStyle; - public fun getMenuStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/MenuStyle; - public fun getOutlinedButtonStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/ButtonStyle; - public fun getRadioButtonStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/RadioButtonStyle; - public fun getScrollbarStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/ScrollbarStyle; - public fun getTextAreaStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/TextAreaStyle; - public fun getTextFieldStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/TextFieldStyle; - public fun getTextStyle (Landroidx/compose/runtime/Composer;I)Landroidx/compose/ui/text/TextStyle; - public fun getTreeStyle (Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/styling/LazyTreeStyle; - public fun isDark (Landroidx/compose/runtime/Composer;I)Z - public fun isSwingCompatMode (Landroidx/compose/runtime/Composer;I)Z - public final fun lightComponentStyling (Lorg/jetbrains/jewel/styling/CheckboxStyle;Lorg/jetbrains/jewel/styling/ChipStyle;Lorg/jetbrains/jewel/styling/CircularProgressStyle;Lorg/jetbrains/jewel/styling/ButtonStyle;Lorg/jetbrains/jewel/styling/TabStyle;Lorg/jetbrains/jewel/styling/DividerStyle;Lorg/jetbrains/jewel/styling/DropdownStyle;Lorg/jetbrains/jewel/styling/TabStyle;Lorg/jetbrains/jewel/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/styling/IconButtonStyle;Lorg/jetbrains/jewel/styling/LabelledTextFieldStyle;Lorg/jetbrains/jewel/styling/LazyTreeStyle;Lorg/jetbrains/jewel/styling/LinkStyle;Lorg/jetbrains/jewel/styling/MenuStyle;Lorg/jetbrains/jewel/styling/ButtonStyle;Lorg/jetbrains/jewel/styling/RadioButtonStyle;Lorg/jetbrains/jewel/styling/ScrollbarStyle;Lorg/jetbrains/jewel/styling/TextAreaStyle;Lorg/jetbrains/jewel/styling/TextFieldStyle;Lorg/jetbrains/jewel/styling/TooltipStyle;Lorg/jetbrains/jewel/styling/DropdownStyle;Landroidx/compose/runtime/Composer;IIII)Lorg/jetbrains/jewel/IntelliJComponentStyling; - public final fun lightThemeDefinition-V-9fs2A (Lorg/jetbrains/jewel/GlobalColors;Lorg/jetbrains/jewel/GlobalMetrics;Lorg/jetbrains/jewel/intui/core/IntUiThemeColorPalette;Lorg/jetbrains/jewel/IntelliJThemeIconData;Landroidx/compose/ui/text/TextStyle;JLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/intui/core/IntUiThemeDefinition; +public final class org/jetbrains/jewel/intui/standalone/IntUiGlobalMetricsKt { + public static final fun defaults-VpY3zN4 (Lorg/jetbrains/jewel/GlobalMetrics$Companion;FF)Lorg/jetbrains/jewel/GlobalMetrics; + public static synthetic fun defaults-VpY3zN4$default (Lorg/jetbrains/jewel/GlobalMetrics$Companion;FFILjava/lang/Object;)Lorg/jetbrains/jewel/GlobalMetrics; } public final class org/jetbrains/jewel/intui/standalone/IntUiThemeKt { - public static final fun IntUiTheme (Lorg/jetbrains/jewel/intui/core/IntUiThemeDefinition;Lkotlin/jvm/functions/Function2;ZLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V + public static final fun IntUiTheme (Lorg/jetbrains/jewel/ThemeDefinition;Lkotlin/jvm/functions/Function2;ZLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V + public static final fun darkComponentStyling (Lorg/jetbrains/jewel/JewelTheme$Companion;Lorg/jetbrains/jewel/styling/CheckboxStyle;Lorg/jetbrains/jewel/styling/ChipStyle;Lorg/jetbrains/jewel/styling/CircularProgressStyle;Lorg/jetbrains/jewel/styling/ButtonStyle;Lorg/jetbrains/jewel/styling/TabStyle;Lorg/jetbrains/jewel/styling/DividerStyle;Lorg/jetbrains/jewel/styling/DropdownStyle;Lorg/jetbrains/jewel/styling/TabStyle;Lorg/jetbrains/jewel/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/styling/IconButtonStyle;Lorg/jetbrains/jewel/styling/LabelledTextFieldStyle;Lorg/jetbrains/jewel/styling/LazyTreeStyle;Lorg/jetbrains/jewel/styling/LinkStyle;Lorg/jetbrains/jewel/styling/MenuStyle;Lorg/jetbrains/jewel/styling/ButtonStyle;Lorg/jetbrains/jewel/styling/RadioButtonStyle;Lorg/jetbrains/jewel/styling/ScrollbarStyle;Lorg/jetbrains/jewel/styling/TextAreaStyle;Lorg/jetbrains/jewel/styling/TextFieldStyle;Lorg/jetbrains/jewel/styling/TooltipStyle;Lorg/jetbrains/jewel/styling/DropdownStyle;Landroidx/compose/runtime/Composer;IIII)Lorg/jetbrains/jewel/ComponentStyling; + public static final fun darkThemeDefinition-RFMEUTM (Lorg/jetbrains/jewel/JewelTheme$Companion;Lorg/jetbrains/jewel/GlobalColors;Lorg/jetbrains/jewel/GlobalMetrics;Lorg/jetbrains/jewel/ThemeColorPalette;Lorg/jetbrains/jewel/ThemeIconData;Landroidx/compose/ui/text/TextStyle;JLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ThemeDefinition; + public static final fun defaultComponentStyling (Lorg/jetbrains/jewel/JewelTheme$Companion;Lorg/jetbrains/jewel/ThemeDefinition;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ComponentStyling; + public static final fun getDefaultTextStyle (Lorg/jetbrains/jewel/JewelTheme$Companion;)Landroidx/compose/ui/text/TextStyle; + public static final fun lightComponentStyling (Lorg/jetbrains/jewel/JewelTheme$Companion;Lorg/jetbrains/jewel/styling/CheckboxStyle;Lorg/jetbrains/jewel/styling/ChipStyle;Lorg/jetbrains/jewel/styling/CircularProgressStyle;Lorg/jetbrains/jewel/styling/ButtonStyle;Lorg/jetbrains/jewel/styling/TabStyle;Lorg/jetbrains/jewel/styling/DividerStyle;Lorg/jetbrains/jewel/styling/DropdownStyle;Lorg/jetbrains/jewel/styling/TabStyle;Lorg/jetbrains/jewel/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/styling/IconButtonStyle;Lorg/jetbrains/jewel/styling/LabelledTextFieldStyle;Lorg/jetbrains/jewel/styling/LazyTreeStyle;Lorg/jetbrains/jewel/styling/LinkStyle;Lorg/jetbrains/jewel/styling/MenuStyle;Lorg/jetbrains/jewel/styling/ButtonStyle;Lorg/jetbrains/jewel/styling/RadioButtonStyle;Lorg/jetbrains/jewel/styling/ScrollbarStyle;Lorg/jetbrains/jewel/styling/TextAreaStyle;Lorg/jetbrains/jewel/styling/TextFieldStyle;Lorg/jetbrains/jewel/styling/TooltipStyle;Lorg/jetbrains/jewel/styling/DropdownStyle;Landroidx/compose/runtime/Composer;IIII)Lorg/jetbrains/jewel/ComponentStyling; + public static final fun lightThemeDefinition-RFMEUTM (Lorg/jetbrains/jewel/JewelTheme$Companion;Lorg/jetbrains/jewel/GlobalColors;Lorg/jetbrains/jewel/GlobalMetrics;Lorg/jetbrains/jewel/ThemeColorPalette;Lorg/jetbrains/jewel/ThemeIconData;Landroidx/compose/ui/text/TextStyle;JLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ThemeDefinition; } public final class org/jetbrains/jewel/intui/standalone/InterFontKt { @@ -116,7 +33,7 @@ public final class org/jetbrains/jewel/intui/standalone/PainterProviderKt { public final class org/jetbrains/jewel/intui/standalone/StandalonePainterHintsProvider : org/jetbrains/jewel/intui/core/IntUiPainterHintsProvider { public static final field $stable I public static final field Companion Lorg/jetbrains/jewel/intui/standalone/StandalonePainterHintsProvider$Companion; - public fun (Lorg/jetbrains/jewel/intui/core/IntUiThemeDefinition;)V + public fun (Lorg/jetbrains/jewel/ThemeDefinition;)V public fun hints (Ljava/lang/String;Landroidx/compose/runtime/Composer;I)Ljava/util/List; } diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/IntUiGlobalColors.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/IntUiGlobalColors.kt index 5dc1a01d4..d3683f4b5 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/IntUiGlobalColors.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/IntUiGlobalColors.kt @@ -1,7 +1,6 @@ package org.jetbrains.jewel.intui.standalone import androidx.compose.runtime.Composable -import androidx.compose.runtime.Immutable import androidx.compose.ui.graphics.Color import org.jetbrains.jewel.BorderColors import org.jetbrains.jewel.GlobalColors @@ -9,172 +8,60 @@ import org.jetbrains.jewel.OutlineColors import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme -@Immutable -class IntUiGlobalColors( - override val borders: BorderColors, - override val outlines: OutlineColors, - override val infoContent: Color, - override val paneBackground: Color, -) : GlobalColors { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as IntUiGlobalColors - - if (borders != other.borders) return false - if (outlines != other.outlines) return false - if (infoContent != other.infoContent) return false - if (paneBackground != other.paneBackground) return false - - return true - } - - override fun hashCode(): Int { - var result = borders.hashCode() - result = 31 * result + outlines.hashCode() - result = 31 * result + infoContent.hashCode() - result = 31 * result + paneBackground.hashCode() - return result - } - - override fun toString(): String = - "IntUiGlobalColors(borders=$borders, outlines=$outlines, infoContent=$infoContent, paneBackground=$paneBackground)" - - companion object { - - @Composable - fun light( - borders: BorderColors = IntUiBorderColors.light(), - outlines: OutlineColors = IntUiOutlineColors.light(), - infoContent: Color = IntUiLightTheme.colors.grey(7), - paneBackground: Color = IntUiLightTheme.colors.grey(13), - ) = IntUiGlobalColors( - borders = borders, - outlines = outlines, - infoContent = infoContent, - paneBackground = paneBackground, - ) - - @Composable - fun dark( - borders: BorderColors = IntUiBorderColors.dark(), - outlines: OutlineColors = IntUiOutlineColors.dark(), - infoContent: Color = IntUiDarkTheme.colors.grey(7), - paneBackground: Color = IntUiDarkTheme.colors.grey(2), - ) = IntUiGlobalColors( - borders = borders, - outlines = outlines, - infoContent = infoContent, - paneBackground = paneBackground, - ) - } -} - -@Immutable -class IntUiBorderColors( - override val normal: Color, - override val focused: Color, - override val disabled: Color, -) : BorderColors { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as IntUiBorderColors - - if (normal != other.normal) return false - if (focused != other.focused) return false - if (disabled != other.disabled) return false - - return true - } - - override fun hashCode(): Int { - var result = normal.hashCode() - result = 31 * result + focused.hashCode() - result = 31 * result + disabled.hashCode() - return result - } - - override fun toString(): String = - "IntUiBorderColors(normal=$normal, focused=$focused, disabled=$disabled)" - - companion object { - - @Composable - fun light( - normal: Color = IntUiLightTheme.colors.grey(9), - focused: Color = IntUiLightTheme.colors.grey(14), - disabled: Color = IntUiLightTheme.colors.grey(11), - ) = IntUiBorderColors(normal, focused, disabled) - - @Composable - fun dark( - normal: Color = IntUiDarkTheme.colors.grey(5), - focused: Color = IntUiDarkTheme.colors.grey(2), - disabled: Color = IntUiDarkTheme.colors.grey(4), - ) = IntUiBorderColors(normal, focused, disabled) - } -} - -@Immutable -class IntUiOutlineColors( - override val focused: Color, - override val focusedWarning: Color, - override val focusedError: Color, - override val warning: Color, - override val error: Color, -) : OutlineColors { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as IntUiOutlineColors - - if (focused != other.focused) return false - if (focusedWarning != other.focusedWarning) return false - if (focusedError != other.focusedError) return false - if (warning != other.warning) return false - if (error != other.error) return false - - return true - } - - override fun hashCode(): Int { - var result = focused.hashCode() - result = 31 * result + focusedWarning.hashCode() - result = 31 * result + focusedError.hashCode() - result = 31 * result + warning.hashCode() - result = 31 * result + error.hashCode() - return result - } - - override fun toString(): String = - "IntUiOutlineColors(focused=$focused, focusedWarning=$focusedWarning, focusedError=$focusedError, " + - "warning=$warning, error=$error)" - - companion object { - - @Composable - fun light( - focused: Color = IntUiLightTheme.colors.blue(4), - focusedWarning: Color = IntUiLightTheme.colors.yellow(4), - focusedError: Color = IntUiLightTheme.colors.red(4), - warning: Color = IntUiLightTheme.colors.yellow(7), - error: Color = IntUiLightTheme.colors.red(9), - ) = IntUiOutlineColors(focused, focusedWarning, focusedError, warning, error) - - @Composable - fun dark( - focused: Color = IntUiDarkTheme.colors.blue(6), - focusedWarning: Color = IntUiDarkTheme.colors.yellow(4), - focusedError: Color = IntUiDarkTheme.colors.red(4), - warning: Color = IntUiDarkTheme.colors.yellow(2), - error: Color = IntUiDarkTheme.colors.red(2), - ) = IntUiOutlineColors(focused, focusedWarning, focusedError, warning, error) - } -} +@Composable +fun GlobalColors.Companion.light( + borders: BorderColors = BorderColors.light(), + outlines: OutlineColors = OutlineColors.light(), + infoContent: Color = IntUiLightTheme.colors.grey(7), + paneBackground: Color = IntUiLightTheme.colors.grey(13), +) = GlobalColors( + borders = borders, + outlines = outlines, + infoContent = infoContent, + paneBackground = paneBackground, +) + +@Composable +fun GlobalColors.Companion.dark( + borders: BorderColors = BorderColors.dark(), + outlines: OutlineColors = OutlineColors.dark(), + infoContent: Color = IntUiDarkTheme.colors.grey(7), + paneBackground: Color = IntUiDarkTheme.colors.grey(2), +) = GlobalColors( + borders = borders, + outlines = outlines, + infoContent = infoContent, + paneBackground = paneBackground, +) + +@Composable +fun BorderColors.Companion.light( + normal: Color = IntUiLightTheme.colors.grey(9), + focused: Color = IntUiLightTheme.colors.grey(14), + disabled: Color = IntUiLightTheme.colors.grey(11), +) = BorderColors(normal, focused, disabled) + +@Composable +fun BorderColors.Companion.dark( + normal: Color = IntUiDarkTheme.colors.grey(5), + focused: Color = IntUiDarkTheme.colors.grey(2), + disabled: Color = IntUiDarkTheme.colors.grey(4), +) = BorderColors(normal, focused, disabled) + +@Composable +fun OutlineColors.Companion.light( + focused: Color = IntUiLightTheme.colors.blue(4), + focusedWarning: Color = IntUiLightTheme.colors.yellow(4), + focusedError: Color = IntUiLightTheme.colors.red(4), + warning: Color = IntUiLightTheme.colors.yellow(7), + error: Color = IntUiLightTheme.colors.red(9), +) = OutlineColors(focused, focusedWarning, focusedError, warning, error) + +@Composable +fun OutlineColors.Companion.dark( + focused: Color = IntUiDarkTheme.colors.blue(6), + focusedWarning: Color = IntUiDarkTheme.colors.yellow(4), + focusedError: Color = IntUiDarkTheme.colors.red(4), + warning: Color = IntUiDarkTheme.colors.yellow(2), + error: Color = IntUiDarkTheme.colors.red(2), +) = OutlineColors(focused, focusedWarning, focusedError, warning, error) diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/IntUiGlobalMetrics.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/IntUiGlobalMetrics.kt index 5f2b75678..e337db42a 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/IntUiGlobalMetrics.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/IntUiGlobalMetrics.kt @@ -1,34 +1,10 @@ package org.jetbrains.jewel.intui.standalone -import androidx.compose.runtime.Immutable import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import org.jetbrains.jewel.GlobalMetrics -@Immutable -class IntUiGlobalMetrics( - override val outlineWidth: Dp = 2.dp, - override val rowHeight: Dp = 24.dp, -) : GlobalMetrics { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as IntUiGlobalMetrics - - if (outlineWidth != other.outlineWidth) return false - if (rowHeight != other.rowHeight) return false - - return true - } - - override fun hashCode(): Int { - var result = outlineWidth.hashCode() - result = 31 * result + rowHeight.hashCode() - return result - } - - override fun toString() = - "IntUiGlobalMetrics(outlineWidth=$outlineWidth, rowHeight=$rowHeight)" -} +fun GlobalMetrics.Companion.defaults( + outlineWidth: Dp = 2.dp, + rowHeight: Dp = 24.dp, +) = GlobalMetrics(outlineWidth, rowHeight) diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/IntUiTheme.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/IntUiTheme.kt index 423214ea3..c770db641 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/IntUiTheme.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/IntUiTheme.kt @@ -9,16 +9,16 @@ import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.sp +import org.jetbrains.jewel.ComponentStyling import org.jetbrains.jewel.GlobalColors import org.jetbrains.jewel.GlobalMetrics -import org.jetbrains.jewel.IntelliJComponentStyling -import org.jetbrains.jewel.IntelliJThemeIconData +import org.jetbrains.jewel.JewelTheme +import org.jetbrains.jewel.ThemeColorPalette +import org.jetbrains.jewel.ThemeDefinition +import org.jetbrains.jewel.ThemeIconData import org.jetbrains.jewel.intui.core.BaseIntUiTheme -import org.jetbrains.jewel.intui.core.IntUiThemeColorPalette -import org.jetbrains.jewel.intui.core.IntUiThemeDefinition import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme -import org.jetbrains.jewel.intui.standalone.IntUiTheme.defaultComponentStyling import org.jetbrains.jewel.intui.standalone.styling.Default import org.jetbrains.jewel.intui.standalone.styling.Editor import org.jetbrains.jewel.intui.standalone.styling.Outlined @@ -46,148 +46,146 @@ import org.jetbrains.jewel.styling.TextAreaStyle import org.jetbrains.jewel.styling.TextFieldStyle import org.jetbrains.jewel.styling.TooltipStyle -object IntUiTheme : BaseIntUiTheme { - - val defaultTextStyle = TextStyle.Default.copy( +val JewelTheme.Companion.defaultTextStyle + get() = TextStyle.Default.copy( fontFamily = FontFamily.Inter, fontSize = 13.sp, fontWeight = FontWeight.Normal, fontStyle = FontStyle.Normal, ) - @Composable - fun lightThemeDefinition( - colors: GlobalColors = IntUiGlobalColors.light(), - metrics: GlobalMetrics = IntUiGlobalMetrics(), - palette: IntUiThemeColorPalette = IntUiLightTheme.colors, - icons: IntelliJThemeIconData = IntUiLightTheme.icons, - defaultTextStyle: TextStyle = this.defaultTextStyle, - contentColor: Color = IntUiLightTheme.colors.grey(1), - ) = IntUiThemeDefinition(isDark = false, colors, palette, icons, metrics, defaultTextStyle, contentColor) +@Composable +fun JewelTheme.Companion.lightThemeDefinition( + colors: GlobalColors = GlobalColors.light(), + metrics: GlobalMetrics = GlobalMetrics.defaults(), + palette: ThemeColorPalette = IntUiLightTheme.colors, + iconData: ThemeIconData = IntUiLightTheme.iconData, + defaultTextStyle: TextStyle = JewelTheme.defaultTextStyle, + contentColor: Color = IntUiLightTheme.colors.grey(1), +) = ThemeDefinition(isDark = false, colors, metrics, defaultTextStyle, contentColor, palette, iconData) - @Composable - fun darkThemeDefinition( - colors: GlobalColors = IntUiGlobalColors.dark(), - metrics: GlobalMetrics = IntUiGlobalMetrics(), - palette: IntUiThemeColorPalette = IntUiDarkTheme.colors, - icons: IntelliJThemeIconData = IntUiDarkTheme.icons, - defaultTextStyle: TextStyle = this.defaultTextStyle, - contentColor: Color = IntUiDarkTheme.colors.grey(12), - ) = IntUiThemeDefinition(isDark = true, colors, palette, icons, metrics, defaultTextStyle, contentColor) +@Composable +fun JewelTheme.Companion.darkThemeDefinition( + colors: GlobalColors = GlobalColors.dark(), + metrics: GlobalMetrics = GlobalMetrics.defaults(), + palette: ThemeColorPalette = IntUiDarkTheme.colors, + iconData: ThemeIconData = IntUiDarkTheme.iconData, + defaultTextStyle: TextStyle = JewelTheme.defaultTextStyle, + contentColor: Color = IntUiDarkTheme.colors.grey(12), +) = ThemeDefinition(isDark = true, colors, metrics, defaultTextStyle, contentColor, palette, iconData) - @Composable - fun defaultComponentStyling(theme: IntUiThemeDefinition): IntelliJComponentStyling = - if (theme.isDark) darkComponentStyling() else lightComponentStyling() +@Composable +fun JewelTheme.Companion.defaultComponentStyling(theme: ThemeDefinition): ComponentStyling = + if (theme.isDark) darkComponentStyling() else lightComponentStyling() - @Composable - fun darkComponentStyling( - checkboxStyle: CheckboxStyle = CheckboxStyle.dark(), - chipStyle: ChipStyle = ChipStyle.dark(), - circularProgressStyle: CircularProgressStyle = CircularProgressStyle.dark(), - defaultButtonStyle: ButtonStyle = ButtonStyle.Default.dark(), - defaultTabStyle: TabStyle = TabStyle.Default.dark(), - dividerStyle: DividerStyle = DividerStyle.dark(), - dropdownStyle: DropdownStyle = DropdownStyle.Default.dark(), - editorTabStyle: TabStyle = TabStyle.Editor.dark(), - groupHeaderStyle: GroupHeaderStyle = GroupHeaderStyle.dark(), - horizontalProgressBarStyle: HorizontalProgressBarStyle = HorizontalProgressBarStyle.dark(), - iconButtonStyle: IconButtonStyle = IconButtonStyle.dark(), - labelledTextFieldStyle: LabelledTextFieldStyle = LabelledTextFieldStyle.dark(), - lazyTreeStyle: LazyTreeStyle = LazyTreeStyle.dark(), - linkStyle: LinkStyle = LinkStyle.dark(), - menuStyle: MenuStyle = MenuStyle.dark(), - outlinedButtonStyle: ButtonStyle = ButtonStyle.Outlined.dark(), - radioButtonStyle: RadioButtonStyle = RadioButtonStyle.dark(), - scrollbarStyle: ScrollbarStyle = ScrollbarStyle.dark(), - textAreaStyle: TextAreaStyle = TextAreaStyle.dark(), - textFieldStyle: TextFieldStyle = TextFieldStyle.dark(), - tooltipStyle: TooltipStyle = TooltipStyle.dark(), - undecoratedDropdownStyle: DropdownStyle = DropdownStyle.Undecorated.dark(), - ) = IntelliJComponentStyling( - checkboxStyle = checkboxStyle, - chipStyle = chipStyle, - circularProgressStyle = circularProgressStyle, - defaultButtonStyle = defaultButtonStyle, - defaultDropdownStyle = dropdownStyle, - defaultTabStyle = defaultTabStyle, - dividerStyle = dividerStyle, - editorTabStyle = editorTabStyle, - groupHeaderStyle = groupHeaderStyle, - horizontalProgressBarStyle = horizontalProgressBarStyle, - iconButtonStyle = iconButtonStyle, - labelledTextFieldStyle = labelledTextFieldStyle, - lazyTreeStyle = lazyTreeStyle, - linkStyle = linkStyle, - menuStyle = menuStyle, - outlinedButtonStyle = outlinedButtonStyle, - radioButtonStyle = radioButtonStyle, - scrollbarStyle = scrollbarStyle, - textAreaStyle = textAreaStyle, - textFieldStyle = textFieldStyle, - tooltipStyle = tooltipStyle, - undecoratedDropdownStyle = undecoratedDropdownStyle, - ) +@Composable +fun JewelTheme.Companion.darkComponentStyling( + checkboxStyle: CheckboxStyle = CheckboxStyle.dark(), + chipStyle: ChipStyle = ChipStyle.dark(), + circularProgressStyle: CircularProgressStyle = CircularProgressStyle.dark(), + defaultButtonStyle: ButtonStyle = ButtonStyle.Default.dark(), + defaultTabStyle: TabStyle = TabStyle.Default.dark(), + dividerStyle: DividerStyle = DividerStyle.dark(), + dropdownStyle: DropdownStyle = DropdownStyle.Default.dark(), + editorTabStyle: TabStyle = TabStyle.Editor.dark(), + groupHeaderStyle: GroupHeaderStyle = GroupHeaderStyle.dark(), + horizontalProgressBarStyle: HorizontalProgressBarStyle = HorizontalProgressBarStyle.dark(), + iconButtonStyle: IconButtonStyle = IconButtonStyle.dark(), + labelledTextFieldStyle: LabelledTextFieldStyle = LabelledTextFieldStyle.dark(), + lazyTreeStyle: LazyTreeStyle = LazyTreeStyle.dark(), + linkStyle: LinkStyle = LinkStyle.dark(), + menuStyle: MenuStyle = MenuStyle.dark(), + outlinedButtonStyle: ButtonStyle = ButtonStyle.Outlined.dark(), + radioButtonStyle: RadioButtonStyle = RadioButtonStyle.dark(), + scrollbarStyle: ScrollbarStyle = ScrollbarStyle.dark(), + textAreaStyle: TextAreaStyle = TextAreaStyle.dark(), + textFieldStyle: TextFieldStyle = TextFieldStyle.dark(), + tooltipStyle: TooltipStyle = TooltipStyle.dark(), + undecoratedDropdownStyle: DropdownStyle = DropdownStyle.Undecorated.dark(), +) = ComponentStyling( + checkboxStyle = checkboxStyle, + chipStyle = chipStyle, + circularProgressStyle = circularProgressStyle, + defaultButtonStyle = defaultButtonStyle, + defaultDropdownStyle = dropdownStyle, + defaultTabStyle = defaultTabStyle, + dividerStyle = dividerStyle, + editorTabStyle = editorTabStyle, + groupHeaderStyle = groupHeaderStyle, + horizontalProgressBarStyle = horizontalProgressBarStyle, + iconButtonStyle = iconButtonStyle, + labelledTextFieldStyle = labelledTextFieldStyle, + lazyTreeStyle = lazyTreeStyle, + linkStyle = linkStyle, + menuStyle = menuStyle, + outlinedButtonStyle = outlinedButtonStyle, + radioButtonStyle = radioButtonStyle, + scrollbarStyle = scrollbarStyle, + textAreaStyle = textAreaStyle, + textFieldStyle = textFieldStyle, + tooltipStyle = tooltipStyle, + undecoratedDropdownStyle = undecoratedDropdownStyle, +) - @Composable - fun lightComponentStyling( - checkboxStyle: CheckboxStyle = CheckboxStyle.light(), - chipStyle: ChipStyle = ChipStyle.light(), - circularProgressStyle: CircularProgressStyle = CircularProgressStyle.light(), - defaultButtonStyle: ButtonStyle = ButtonStyle.Default.light(), - defaultTabStyle: TabStyle = TabStyle.Default.light(), - dividerStyle: DividerStyle = DividerStyle.light(), - dropdownStyle: DropdownStyle = DropdownStyle.Default.light(), - editorTabStyle: TabStyle = TabStyle.Editor.light(), - groupHeaderStyle: GroupHeaderStyle = GroupHeaderStyle.light(), - horizontalProgressBarStyle: HorizontalProgressBarStyle = HorizontalProgressBarStyle.light(), - iconButtonStyle: IconButtonStyle = IconButtonStyle.light(), - labelledTextFieldStyle: LabelledTextFieldStyle = LabelledTextFieldStyle.light(), - lazyTreeStyle: LazyTreeStyle = LazyTreeStyle.light(), - linkStyle: LinkStyle = LinkStyle.light(), - menuStyle: MenuStyle = MenuStyle.light(), - outlinedButtonStyle: ButtonStyle = ButtonStyle.Outlined.light(), - radioButtonStyle: RadioButtonStyle = RadioButtonStyle.light(), - scrollbarStyle: ScrollbarStyle = ScrollbarStyle.light(), - textAreaStyle: TextAreaStyle = TextAreaStyle.light(), - textFieldStyle: TextFieldStyle = TextFieldStyle.light(), - tooltipStyle: TooltipStyle = TooltipStyle.light(), - undecoratedDropdownStyle: DropdownStyle = DropdownStyle.Undecorated.light(), - ) = IntelliJComponentStyling( - checkboxStyle = checkboxStyle, - chipStyle = chipStyle, - circularProgressStyle = circularProgressStyle, - defaultButtonStyle = defaultButtonStyle, - defaultDropdownStyle = dropdownStyle, - defaultTabStyle = defaultTabStyle, - dividerStyle = dividerStyle, - editorTabStyle = editorTabStyle, - groupHeaderStyle = groupHeaderStyle, - horizontalProgressBarStyle = horizontalProgressBarStyle, - iconButtonStyle = iconButtonStyle, - labelledTextFieldStyle = labelledTextFieldStyle, - lazyTreeStyle = lazyTreeStyle, - linkStyle = linkStyle, - menuStyle = menuStyle, - outlinedButtonStyle = outlinedButtonStyle, - radioButtonStyle = radioButtonStyle, - scrollbarStyle = scrollbarStyle, - textAreaStyle = textAreaStyle, - textFieldStyle = textFieldStyle, - tooltipStyle = tooltipStyle, - undecoratedDropdownStyle = undecoratedDropdownStyle, - ) -} +@Composable +fun JewelTheme.Companion.lightComponentStyling( + checkboxStyle: CheckboxStyle = CheckboxStyle.light(), + chipStyle: ChipStyle = ChipStyle.light(), + circularProgressStyle: CircularProgressStyle = CircularProgressStyle.light(), + defaultButtonStyle: ButtonStyle = ButtonStyle.Default.light(), + defaultTabStyle: TabStyle = TabStyle.Default.light(), + dividerStyle: DividerStyle = DividerStyle.light(), + dropdownStyle: DropdownStyle = DropdownStyle.Default.light(), + editorTabStyle: TabStyle = TabStyle.Editor.light(), + groupHeaderStyle: GroupHeaderStyle = GroupHeaderStyle.light(), + horizontalProgressBarStyle: HorizontalProgressBarStyle = HorizontalProgressBarStyle.light(), + iconButtonStyle: IconButtonStyle = IconButtonStyle.light(), + labelledTextFieldStyle: LabelledTextFieldStyle = LabelledTextFieldStyle.light(), + lazyTreeStyle: LazyTreeStyle = LazyTreeStyle.light(), + linkStyle: LinkStyle = LinkStyle.light(), + menuStyle: MenuStyle = MenuStyle.light(), + outlinedButtonStyle: ButtonStyle = ButtonStyle.Outlined.light(), + radioButtonStyle: RadioButtonStyle = RadioButtonStyle.light(), + scrollbarStyle: ScrollbarStyle = ScrollbarStyle.light(), + textAreaStyle: TextAreaStyle = TextAreaStyle.light(), + textFieldStyle: TextFieldStyle = TextFieldStyle.light(), + tooltipStyle: TooltipStyle = TooltipStyle.light(), + undecoratedDropdownStyle: DropdownStyle = DropdownStyle.Undecorated.light(), +) = ComponentStyling( + checkboxStyle = checkboxStyle, + chipStyle = chipStyle, + circularProgressStyle = circularProgressStyle, + defaultButtonStyle = defaultButtonStyle, + defaultDropdownStyle = dropdownStyle, + defaultTabStyle = defaultTabStyle, + dividerStyle = dividerStyle, + editorTabStyle = editorTabStyle, + groupHeaderStyle = groupHeaderStyle, + horizontalProgressBarStyle = horizontalProgressBarStyle, + iconButtonStyle = iconButtonStyle, + labelledTextFieldStyle = labelledTextFieldStyle, + lazyTreeStyle = lazyTreeStyle, + linkStyle = linkStyle, + menuStyle = menuStyle, + outlinedButtonStyle = outlinedButtonStyle, + radioButtonStyle = radioButtonStyle, + scrollbarStyle = scrollbarStyle, + textAreaStyle = textAreaStyle, + textFieldStyle = textFieldStyle, + tooltipStyle = tooltipStyle, + undecoratedDropdownStyle = undecoratedDropdownStyle, +) @Composable fun IntUiTheme( - theme: IntUiThemeDefinition, + theme: ThemeDefinition, componentStyling: @Composable () -> Array>, swingCompatMode: Boolean = false, content: @Composable () -> Unit, ) { BaseIntUiTheme( theme, - componentStyling = { defaultComponentStyling(theme).providedStyles() + componentStyling() }, + componentStyling = { JewelTheme.defaultComponentStyling(theme).providedStyles() + componentStyling() }, swingCompatMode, ) { CompositionLocalProvider( diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/PainterProvider.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/PainterProvider.kt index 779161d58..460310ad6 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/PainterProvider.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/PainterProvider.kt @@ -1,5 +1,6 @@ package org.jetbrains.jewel.intui.standalone +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.painter.ResourcePainterProvider /** @@ -7,4 +8,4 @@ import org.jetbrains.jewel.painter.ResourcePainterProvider * resource from the classpath. */ fun standalonePainterProvider(path: String) = - ResourcePainterProvider(path, IntUiTheme::class.java.classLoader) + ResourcePainterProvider(path, JewelTheme::class.java.classLoader) diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/StandalonePainterHintsProvider.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/StandalonePainterHintsProvider.kt index 0793126ce..3484e0578 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/StandalonePainterHintsProvider.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/StandalonePainterHintsProvider.kt @@ -2,16 +2,16 @@ package org.jetbrains.jewel.intui.standalone import androidx.compose.runtime.Composable import androidx.compose.ui.platform.LocalDensity -import org.jetbrains.jewel.IntelliJTheme +import org.jetbrains.jewel.JewelTheme +import org.jetbrains.jewel.ThemeDefinition import org.jetbrains.jewel.intui.core.IntUiPainterHintsProvider -import org.jetbrains.jewel.intui.core.IntUiThemeDefinition import org.jetbrains.jewel.painter.PainterHint import org.jetbrains.jewel.painter.hints.Dark import org.jetbrains.jewel.painter.hints.HiDpi import org.jetbrains.jewel.painter.hints.Override class StandalonePainterHintsProvider( - theme: IntUiThemeDefinition, + theme: ThemeDefinition, ) : IntUiPainterHintsProvider( theme.isDark, intellijColorPalette, @@ -19,22 +19,18 @@ class StandalonePainterHintsProvider( theme.colorPalette.rawMap, ) { - private val overrideHint: PainterHint - - init { - overrideHint = Override( - theme.iconData.iconOverrides.entries.associate { (k, v) -> - k.removePrefix("/") to v.removePrefix("/") - }, - ) - } + private val overrideHint: PainterHint = Override( + theme.iconData.iconOverrides.entries.associate { (k, v) -> + k.removePrefix("/") to v.removePrefix("/") + }, + ) @Composable override fun hints(path: String): List = buildList { add(getPaletteHint(path)) add(overrideHint) add(HiDpi(LocalDensity.current)) - add(Dark(IntelliJTheme.isDark)) + add(Dark(JewelTheme.isDark)) } companion object { 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 ca136bae7..403da1b70 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 @@ -8,9 +8,10 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme -import org.jetbrains.jewel.intui.standalone.IntUiTheme +import org.jetbrains.jewel.intui.standalone.defaultTextStyle import org.jetbrains.jewel.intui.standalone.standalonePainterProvider import org.jetbrains.jewel.painter.PainterProvider import org.jetbrains.jewel.styling.DropdownColors @@ -29,7 +30,7 @@ object IntUiDefaultDropdownStyleFactory { colors: DropdownColors = DropdownColors.Default.light(), metrics: DropdownMetrics = DropdownMetrics.default(), icons: DropdownIcons = DropdownIcons.defaults(), - textStyle: TextStyle = IntUiTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, menuStyle: MenuStyle = MenuStyle.light(), ) = DropdownStyle(colors, metrics, icons, textStyle, menuStyle) @@ -38,7 +39,7 @@ object IntUiDefaultDropdownStyleFactory { colors: DropdownColors = DropdownColors.Default.dark(), metrics: DropdownMetrics = DropdownMetrics.default(), icons: DropdownIcons = DropdownIcons.defaults(), - textStyle: TextStyle = IntUiTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, menuStyle: MenuStyle = MenuStyle.dark(), ) = DropdownStyle(colors, metrics, icons, textStyle, menuStyle) } @@ -53,7 +54,7 @@ object IntUiUndecoratedDropdownStyleFactory { colors: DropdownColors = DropdownColors.Undecorated.light(), metrics: DropdownMetrics = DropdownMetrics.undecorated(), icons: DropdownIcons = DropdownIcons.defaults(), - textStyle: TextStyle = IntUiTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, menuStyle: MenuStyle = MenuStyle.light(), ) = DropdownStyle(colors, metrics, icons, textStyle, menuStyle) @@ -62,7 +63,7 @@ object IntUiUndecoratedDropdownStyleFactory { colors: DropdownColors = DropdownColors.Undecorated.dark(), metrics: DropdownMetrics = DropdownMetrics.undecorated(), icons: DropdownIcons = DropdownIcons.defaults(), - textStyle: TextStyle = IntUiTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, menuStyle: MenuStyle = MenuStyle.dark(), ) = DropdownStyle(colors, metrics, icons, textStyle, menuStyle) } diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLabelledTextFieldStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLabelledTextFieldStyling.kt index 537665a9b..73086422b 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLabelledTextFieldStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLabelledTextFieldStyling.kt @@ -9,9 +9,10 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme -import org.jetbrains.jewel.intui.standalone.IntUiTheme +import org.jetbrains.jewel.intui.standalone.defaultTextStyle import org.jetbrains.jewel.styling.LabelledTextFieldColors import org.jetbrains.jewel.styling.LabelledTextFieldMetrics import org.jetbrains.jewel.styling.LabelledTextFieldStyle @@ -21,7 +22,7 @@ import org.jetbrains.jewel.styling.LabelledTextFieldTextStyles fun LabelledTextFieldStyle.Companion.light( colors: LabelledTextFieldColors = LabelledTextFieldColors.light(), metrics: LabelledTextFieldMetrics = LabelledTextFieldMetrics.defaults(), - textStyle: TextStyle = IntUiTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, textStyles: LabelledTextFieldTextStyles = LabelledTextFieldTextStyles.light(), ) = LabelledTextFieldStyle(colors, metrics, textStyle, textStyles) @@ -29,7 +30,7 @@ fun LabelledTextFieldStyle.Companion.light( fun LabelledTextFieldStyle.Companion.dark( colors: LabelledTextFieldColors = LabelledTextFieldColors.dark(), metrics: LabelledTextFieldMetrics = LabelledTextFieldMetrics.defaults(), - textStyle: TextStyle = IntUiTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, textStyles: LabelledTextFieldTextStyles = LabelledTextFieldTextStyles.dark(), ) = LabelledTextFieldStyle(colors, metrics, textStyle, textStyles) @@ -145,16 +146,16 @@ fun LabelledTextFieldMetrics.Companion.defaults( ) = LabelledTextFieldMetrics(borderWidth, contentPadding, cornerSize, minSize, labelSpacing, hintSpacing) fun LabelledTextFieldTextStyles.Companion.light( - label: TextStyle = IntUiTheme.defaultTextStyle, - hint: TextStyle = IntUiTheme.defaultTextStyle.copy( + label: TextStyle = JewelTheme.defaultTextStyle, + hint: TextStyle = JewelTheme.defaultTextStyle.copy( fontSize = 12.sp, lineHeight = 16.sp, ), ) = LabelledTextFieldTextStyles(label, hint) fun LabelledTextFieldTextStyles.Companion.dark( - label: TextStyle = IntUiTheme.defaultTextStyle, - hint: TextStyle = IntUiTheme.defaultTextStyle.copy( + label: TextStyle = JewelTheme.defaultTextStyle, + hint: TextStyle = JewelTheme.defaultTextStyle.copy( fontSize = 12.sp, lineHeight = 16.sp, ), 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 0bd878cab..f0774a1f6 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 @@ -8,9 +8,10 @@ import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme -import org.jetbrains.jewel.intui.standalone.IntUiTheme +import org.jetbrains.jewel.intui.standalone.defaultTextStyle import org.jetbrains.jewel.intui.standalone.standalonePainterProvider import org.jetbrains.jewel.painter.PainterProvider import org.jetbrains.jewel.styling.LinkColors @@ -82,8 +83,8 @@ fun LinkIcons.Companion.defaults( @Composable fun LinkTextStyles.Companion.light( - normal: TextStyle = IntUiTheme.defaultTextStyle.copy(textDecoration = TextDecoration.Underline), - disabled: TextStyle = IntUiTheme.defaultTextStyle, + normal: TextStyle = JewelTheme.defaultTextStyle.copy(textDecoration = TextDecoration.Underline), + disabled: TextStyle = JewelTheme.defaultTextStyle, focused: TextStyle = normal, pressed: TextStyle = normal, hovered: TextStyle = normal, @@ -92,8 +93,8 @@ fun LinkTextStyles.Companion.light( @Composable fun LinkTextStyles.Companion.dark( - normal: TextStyle = IntUiTheme.defaultTextStyle.copy(textDecoration = TextDecoration.Underline), - disabled: TextStyle = IntUiTheme.defaultTextStyle, + normal: TextStyle = JewelTheme.defaultTextStyle.copy(textDecoration = TextDecoration.Underline), + disabled: TextStyle = JewelTheme.defaultTextStyle, focused: TextStyle = normal, pressed: TextStyle = normal, hovered: TextStyle = normal, diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextAreaStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextAreaStyling.kt index df4441624..9231b43a7 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextAreaStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextAreaStyling.kt @@ -8,9 +8,10 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme -import org.jetbrains.jewel.intui.standalone.IntUiTheme +import org.jetbrains.jewel.intui.standalone.defaultTextStyle import org.jetbrains.jewel.styling.TextAreaColors import org.jetbrains.jewel.styling.TextAreaMetrics import org.jetbrains.jewel.styling.TextAreaStyle @@ -19,14 +20,14 @@ import org.jetbrains.jewel.styling.TextAreaStyle fun TextAreaStyle.Companion.light( colors: TextAreaColors = TextAreaColors.light(), metrics: TextAreaMetrics = TextAreaMetrics.defaults(), - textStyle: TextStyle = IntUiTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, ) = TextAreaStyle(colors, metrics, textStyle) @Composable fun TextAreaStyle.Companion.dark( colors: TextAreaColors = TextAreaColors.dark(), metrics: TextAreaMetrics = TextAreaMetrics.defaults(), - textStyle: TextStyle = IntUiTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, ) = TextAreaStyle(colors, metrics, textStyle) @Composable diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextFieldStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextFieldStyling.kt index 1c4fe15e5..72817ce07 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextFieldStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTextFieldStyling.kt @@ -8,9 +8,10 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme -import org.jetbrains.jewel.intui.standalone.IntUiTheme +import org.jetbrains.jewel.intui.standalone.defaultTextStyle import org.jetbrains.jewel.styling.TextFieldColors import org.jetbrains.jewel.styling.TextFieldMetrics import org.jetbrains.jewel.styling.TextFieldStyle @@ -19,14 +20,14 @@ import org.jetbrains.jewel.styling.TextFieldStyle fun TextFieldStyle.Companion.light( colors: TextFieldColors = TextFieldColors.light(), metrics: TextFieldMetrics = TextFieldMetrics.defaults(), - textStyle: TextStyle = IntUiTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, ) = TextFieldStyle(colors, metrics, textStyle) @Composable fun TextFieldStyle.Companion.dark( colors: TextFieldColors = TextFieldColors.dark(), metrics: TextFieldMetrics = TextFieldMetrics.defaults(), - textStyle: TextStyle = IntUiTheme.defaultTextStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, ) = TextFieldStyle(colors, metrics, textStyle) @Composable diff --git a/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/ComponentShowcaseTab.kt b/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/ComponentShowcaseTab.kt index 77c04cfac..bd3fe6b7d 100644 --- a/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/ComponentShowcaseTab.kt +++ b/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/ComponentShowcaseTab.kt @@ -32,6 +32,7 @@ import org.jetbrains.jewel.CircularProgressIndicatorBig import org.jetbrains.jewel.DefaultButton import org.jetbrains.jewel.Icon import org.jetbrains.jewel.IconButton +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.LazyTree import org.jetbrains.jewel.OutlinedButton import org.jetbrains.jewel.RadioButtonRow @@ -41,11 +42,10 @@ import org.jetbrains.jewel.Tooltip import org.jetbrains.jewel.bridge.SwingBridgeTheme import org.jetbrains.jewel.bridge.toComposeColor import org.jetbrains.jewel.foundation.tree.buildTree -import org.jetbrains.jewel.intui.standalone.IntUiTheme @Composable internal fun ComponentShowcaseTab() { SwingBridgeTheme { - val bgColor by remember(IntUiTheme.isDark) { mutableStateOf(JBColor.PanelBackground.toComposeColor()) } + val bgColor by remember(JewelTheme.isDark) { mutableStateOf(JBColor.PanelBackground.toComposeColor()) } val scrollState = rememberScrollState() Row( @@ -159,7 +159,7 @@ import org.jetbrains.jewel.intui.standalone.IntUiTheme } }) { Text( - modifier = Modifier.border(1.dp, IntUiTheme.globalColors.borders.normal).padding(12.dp, 8.dp), + modifier = Modifier.border(1.dp, JewelTheme.globalColors.borders.normal).padding(12.dp, 8.dp), text = "Hover Me!", ) } diff --git a/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/releasessample/ReleasesSampleCompose.kt b/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/releasessample/ReleasesSampleCompose.kt index 473d12f2e..43c25947a 100644 --- a/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/releasessample/ReleasesSampleCompose.kt +++ b/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/releasessample/ReleasesSampleCompose.kt @@ -75,6 +75,7 @@ import kotlinx.coroutines.runBlocking import kotlinx.datetime.toJavaLocalDate import org.jetbrains.jewel.HorizontalSplitLayout import org.jetbrains.jewel.Icon +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.PopupMenu import org.jetbrains.jewel.Text import org.jetbrains.jewel.TextField @@ -89,10 +90,9 @@ import org.jetbrains.jewel.foundation.lazy.SelectionMode import org.jetbrains.jewel.foundation.lazy.items import org.jetbrains.jewel.foundation.lazy.rememberSelectableLazyListState import org.jetbrains.jewel.foundation.onHover -import org.jetbrains.jewel.foundation.utils.thenIf -import org.jetbrains.jewel.intui.standalone.IntUiTheme import org.jetbrains.jewel.items import org.jetbrains.jewel.painter.rememberResourcePainterProvider +import org.jetbrains.jewel.util.thenIf import org.jetbrains.skiko.DependsOnJBR import java.awt.Font import java.time.format.DateTimeFormatter @@ -208,7 +208,7 @@ private fun ContentItemRow( else -> Transparent } Row( - modifier = Modifier.height(IntUiTheme.globalMetrics.rowHeight) + modifier = Modifier.height(JewelTheme.globalMetrics.rowHeight) .background(color) .padding(start = 4.dp, end = 12.dp), verticalAlignment = Alignment.CenterVertically, @@ -398,7 +398,7 @@ private fun OverflowMenu( onItemClick = onContentSourceChange, ) { Row( - modifier = Modifier.height(IntUiTheme.globalMetrics.rowHeight), + modifier = Modifier.height(JewelTheme.globalMetrics.rowHeight), horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.Start), verticalAlignment = Alignment.CenterVertically, ) { diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/Main.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/Main.kt index e9dadce9e..e28cf47d5 100644 --- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/Main.kt +++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/Main.kt @@ -36,13 +36,18 @@ import org.jetbrains.jewel.Divider import org.jetbrains.jewel.Dropdown import org.jetbrains.jewel.Icon import org.jetbrains.jewel.IconButton +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.Orientation import org.jetbrains.jewel.Text import org.jetbrains.jewel.Tooltip import org.jetbrains.jewel.VerticalScrollbar import org.jetbrains.jewel.intui.standalone.IntUiTheme +import org.jetbrains.jewel.intui.standalone.darkThemeDefinition +import org.jetbrains.jewel.intui.standalone.lightThemeDefinition import org.jetbrains.jewel.intui.window.decoratedWindowComponentStyling -import org.jetbrains.jewel.intui.window.styling.IntUiTitleBarStyle +import org.jetbrains.jewel.intui.window.styling.dark +import org.jetbrains.jewel.intui.window.styling.light +import org.jetbrains.jewel.intui.window.styling.lightWithLightHeader import org.jetbrains.jewel.samples.standalone.components.Borders import org.jetbrains.jewel.samples.standalone.components.Buttons import org.jetbrains.jewel.samples.standalone.components.Checkboxes @@ -60,6 +65,7 @@ import org.jetbrains.jewel.separator import org.jetbrains.jewel.window.DecoratedWindow import org.jetbrains.jewel.window.TitleBar import org.jetbrains.jewel.window.newFullscreenControls +import org.jetbrains.jewel.window.styling.TitleBarStyle import java.awt.Desktop import java.io.InputStream import java.net.URI @@ -67,12 +73,18 @@ import java.net.URI fun main() { val icon = svgResource("icons/jewel-logo.svg") application { - var intUiTheme by remember { mutableStateOf(IntUiThemes.Light) } + var theme by remember { mutableStateOf(IntUiThemes.Light) } var swingCompat by remember { mutableStateOf(false) } - val theme = if (intUiTheme.isDark()) IntUiTheme.darkThemeDefinition() else IntUiTheme.lightThemeDefinition() + val themeDefinition = + if (theme.isDark()) { + JewelTheme.darkThemeDefinition() + } else { + JewelTheme.lightThemeDefinition() + } + val projectColor by rememberUpdatedState( - if (intUiTheme.isLightHeader()) { + if (theme.isLightHeader()) { Color(0xFFF5D4C1) } else { Color(0xFF654B40) @@ -80,13 +92,13 @@ fun main() { ) IntUiTheme( - theme, - { - theme.decoratedWindowComponentStyling( - titleBarStyle = when (intUiTheme) { - IntUiThemes.Light -> IntUiTitleBarStyle.light() - IntUiThemes.LightWithLightHeader -> IntUiTitleBarStyle.lightWithLightHeader() - IntUiThemes.Dark -> IntUiTitleBarStyle.dark() + themeDefinition, + componentStyling = { + themeDefinition.decoratedWindowComponentStyling( + titleBarStyle = when (theme) { + IntUiThemes.Light -> TitleBarStyle.light() + IntUiThemes.LightWithLightHeader -> TitleBarStyle.lightWithLightHeader() + IntUiThemes.Dark -> TitleBarStyle.dark() }, ) }, @@ -97,10 +109,10 @@ fun main() { title = "Jewel component catalog", icon = icon, ) { - val windowBackground = if (intUiTheme.isDark()) { - IntUiTheme.colorPalette.grey(1) + val windowBackground = if (theme.isDark()) { + JewelTheme.colorPalette.grey(1) } else { - IntUiTheme.colorPalette.grey(14) + JewelTheme.colorPalette.grey(14) } TitleBar(Modifier.newFullscreenControls(), gradientStartColor = projectColor) { Row(Modifier.align(Alignment.Start)) { @@ -144,20 +156,20 @@ fun main() { } Tooltip({ - when (intUiTheme) { + when (theme) { IntUiThemes.Light -> Text("Switch to light theme with light header") IntUiThemes.LightWithLightHeader -> Text("Switch to dark theme") IntUiThemes.Dark -> Text("Switch to light theme") } }) { IconButton({ - intUiTheme = when (intUiTheme) { + theme = when (theme) { IntUiThemes.Light -> IntUiThemes.LightWithLightHeader IntUiThemes.LightWithLightHeader -> IntUiThemes.Dark IntUiThemes.Dark -> IntUiThemes.Light } }, Modifier.size(40.dp).padding(5.dp)) { - if (intUiTheme.isDark()) { + if (theme.isDark()) { Icon("icons/darkTheme@20x20.svg", "Themes", StandaloneSampleIcons::class.java) } else { Icon("icons/lightTheme@20x20.svg", "Themes", StandaloneSampleIcons::class.java) diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/Borders.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/Borders.kt index 5d465a9d1..1452d108e 100644 --- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/Borders.kt +++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/Borders.kt @@ -16,12 +16,12 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.unit.dp import org.jetbrains.jewel.GroupHeader +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.OutlinedButton import org.jetbrains.jewel.RadioButtonRow import org.jetbrains.jewel.Text import org.jetbrains.jewel.foundation.Stroke import org.jetbrains.jewel.foundation.border -import org.jetbrains.jewel.intui.standalone.IntUiTheme @Composable internal fun Borders() { @@ -84,7 +84,7 @@ internal fun Borders() { .border( borderAlignment, width, - IntUiTheme.colorPalette.blue(4), + JewelTheme.colorPalette.blue(4), CircleShape, expand, ), @@ -94,7 +94,7 @@ internal fun Borders() { .border( borderAlignment, width, - IntUiTheme.colorPalette.blue(4), + JewelTheme.colorPalette.blue(4), RectangleShape, expand, ), @@ -104,7 +104,7 @@ internal fun Borders() { .border( borderAlignment, width, - IntUiTheme.colorPalette.blue(4), + JewelTheme.colorPalette.blue(4), RoundedCornerShape(4.dp), expand, ), @@ -114,7 +114,7 @@ internal fun Borders() { .border( borderAlignment, width, - IntUiTheme.colorPalette.blue(4), + JewelTheme.colorPalette.blue(4), RoundedCornerShape(4.dp, 0.dp, 4.dp, 0.dp), expand, ), diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/ChipsAndTree.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/ChipsAndTree.kt index 7782975f4..93d785ede 100644 --- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/ChipsAndTree.kt +++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/ChipsAndTree.kt @@ -24,13 +24,13 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import org.jetbrains.jewel.Chip import org.jetbrains.jewel.GroupHeader +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.LazyTree import org.jetbrains.jewel.RadioButtonChip import org.jetbrains.jewel.Text import org.jetbrains.jewel.ToggleableChip import org.jetbrains.jewel.foundation.lazy.SelectableLazyColumn import org.jetbrains.jewel.foundation.tree.buildTree -import org.jetbrains.jewel.intui.standalone.IntUiTheme @Composable fun ChipsAndTree() { @@ -171,10 +171,10 @@ fun TreeSample(modifier: Modifier = Modifier) { } val borderColor = - if (IntUiTheme.isDark) { - IntUiTheme.colorPalette.grey(3) + if (JewelTheme.isDark) { + JewelTheme.colorPalette.grey(3) } else { - IntUiTheme.colorPalette.grey(12) + JewelTheme.colorPalette.grey(12) } Box(modifier.border(1.dp, borderColor, RoundedCornerShape(2.dp))) { diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/Tabs.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/Tabs.kt index e8825e622..d95c7d021 100644 --- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/Tabs.kt +++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/Tabs.kt @@ -26,12 +26,11 @@ import androidx.compose.ui.semantics.Role import androidx.compose.ui.unit.dp import org.jetbrains.jewel.GroupHeader import org.jetbrains.jewel.Icon -import org.jetbrains.jewel.IntelliJTheme +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.NoIndication import org.jetbrains.jewel.TabData import org.jetbrains.jewel.TabStrip import org.jetbrains.jewel.Text -import org.jetbrains.jewel.intui.standalone.IntUiTheme import org.jetbrains.jewel.samples.standalone.StandaloneSampleIcons import kotlin.math.max @@ -140,13 +139,13 @@ private fun TabStripWithAddButton( // TODO create an IconButton instead of this hack val backgroundColor = if (isHovered) { - IntUiTheme.defaultTabStyle.colors.backgroundHovered + JewelTheme.defaultTabStyle.colors.backgroundHovered } else { - IntUiTheme.defaultTabStyle.colors.background + JewelTheme.defaultTabStyle.colors.background } Box( - modifier = Modifier.size(IntelliJTheme.defaultTabStyle.metrics.tabHeight) + modifier = Modifier.size(JewelTheme.defaultTabStyle.metrics.tabHeight) .clickable( onClick = onAddClick, onClickLabel = "Add a tab", @@ -157,7 +156,11 @@ private fun TabStripWithAddButton( .background(backgroundColor), contentAlignment = Alignment.Center, ) { - Icon(resource = "expui/general/add.svg", contentDescription = "Add a tab", StandaloneSampleIcons::class.java) + Icon( + resource = "expui/general/add.svg", + contentDescription = "Add a tab", + StandaloneSampleIcons::class.java, + ) } } } diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/Tooltips.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/Tooltips.kt index 0b3c38e06..119471962 100644 --- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/Tooltips.kt +++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/Tooltips.kt @@ -6,9 +6,9 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import org.jetbrains.jewel.GroupHeader +import org.jetbrains.jewel.JewelTheme import org.jetbrains.jewel.Text import org.jetbrains.jewel.Tooltip -import org.jetbrains.jewel.intui.standalone.IntUiTheme @Composable fun Tooltips() { @@ -16,6 +16,6 @@ fun Tooltips() { Tooltip(tooltip = { Text("This is a tooltip") }) { - Text(modifier = Modifier.border(1.dp, IntUiTheme.globalColors.borders.normal).padding(4.dp), text = "Hover Me!") + Text(modifier = Modifier.border(1.dp, JewelTheme.globalColors.borders.normal).padding(4.dp), text = "Hover Me!") } }