Skip to content

Commit

Permalink
WIP - Update scrollbars, styles, and dependencies for Jewel
Browse files Browse the repository at this point in the history
Replaced `rememberScrollbarAdapter` with `ScrollbarAdapter` and revised related imports and styles. Upgraded Jewel and IntelliJ versions in the TOML and gradle files. Removed unused imports for better code clarity.
  • Loading branch information
fscarponi committed Nov 8, 2024
1 parent 3b996a0 commit def6807
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 27 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fun PluginDependenciesSpecScope.id(plugin: Provider<PluginDependency>) =
id(plugin.get().pluginId)

const val PACKAGE_SEARCH_PLUGIN_ID = "com.jetbrains.packagesearch.intellij-plugin"
const val INTELLIJ_VERSION = "243.21565.23"
const val INTELLIJ_VERSION = "243.21565.129"

fun String.containsAny(toDelete: List<String>) =
toDelete.any { it in this }
Expand Down
4 changes: 2 additions & 2 deletions packagesearch.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gradlePublishPlugin = "1.1.0"
ideStarter = "LATEST-EAP-SNAPSHOT"
idea = "2024.3"
ideaGradlePlugin = "1.17.3"
jewel = "0.26"
jewel = "0.26.2"
jewelSnapshot = "1.0.0-SNAPSHOT"
junit = "5.10.2"
junit4 = "4.13.2"
Expand Down Expand Up @@ -50,7 +50,7 @@ ij-platform-ide-impl = { module = "com.jetbrains.intellij.platform:ide-impl", ve
jewel-bridge-ij232 = { module = "org.jetbrains.jewel:jewel-ide-laf-bridge-232", version.ref = "jewel" }
jewel-bridge-ij233 = { module = "org.jetbrains.jewel:jewel-ide-laf-bridge-233", version.ref = "jewel" }
jewel-bridge-ij241 = { module = "org.jetbrains.jewel:jewel-ide-laf-bridge-241", version.ref = "jewel" }
jewel-bridge-ij243 = { module= "org.jetbrains.jewel:jewel-ide-laf-bridge-243", version.ref = "jewelSnapshot"}
jewel-bridge-ij243 = { module= "org.jetbrains.jewel:jewel-ide-laf-bridge-243", version.ref = "jewel"}
jewel-foundation = { module = "org.jetbrains.jewel:jewel-foundation", version.ref = "jewel" }
jewel-standalone = { module = "org.jetbrains.jewel:jewel-int-ui-standalone", version.ref = "jewel" }
jewel-ui = { module = "org.jetbrains.jewel:jewel-ui", version.ref = "jewel" }
Expand Down
12 changes: 6 additions & 6 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ dependencies {
"com.jetbrains.performancePlugin",
)
bundledModule(
"intellij.platform.compose"
"intellij.libraries.compose.desktop"
)
}

implementation(compose.desktop.currentOs) {
exclude(group = "org.jetbrains.compose.material")
exclude(group = "org.jetbrains.kotlinx")
}
implementation(packageSearchCatalog.jewel.bridge.ij243) //compileonly???
// runtimeOnly(compose.desktop.currentOs) {
// exclude(group = "org.jetbrains.compose.material")
// exclude(group = "org.jetbrains.kotlinx")
// }
// compileOnly(packageSearchCatalog.jewel.bridge.ij243)
implementation(packageSearchCatalog.kotlinx.serialization.core)
implementation(packageSearchCatalog.compose.desktop.components.splitpane) {
exclude(group = "org.jetbrains.compose.runtime")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.jetbrains.packagesearch.plugin.ui
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.calculateEndPadding
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import org.jetbrains.jewel.foundation.theme.JewelTheme
Expand All @@ -14,9 +13,7 @@ object PackageSearchMetrics {
val scrollbarWidth: Dp
@Composable
get() {
val metrics = JewelTheme.scrollbarStyle.scrollbarVisibility
return metrics.trackThicknessExpanded +
metrics.trackPadding.calculateEndPadding(LocalLayoutDirection.current)
return JewelTheme.scrollbarStyle.metrics.thumbThickness + JewelTheme.scrollbarStyle.metrics.trackPadding.calculateRightPadding(LocalLayoutDirection.current)
}

object Splitpanes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.intellij.openapi.components.service
import com.intellij.ui.JBColor
import com.jetbrains.packagesearch.plugin.ui.bridge.LabelInfo
import com.jetbrains.packagesearch.plugin.ui.model.PackageSearchToolWindowState
import com.jetbrains.packagesearch.plugin.ui.model.ToolWindowViewModel
import com.jetbrains.packagesearch.plugin.ui.model.packageslist.PackageListViewModel
import org.jetbrains.idea.packagesearch.api.PackageSearchApiClientService
import org.jetbrains.jewel.bridge.toComposeColor
import org.jetbrains.jewel.foundation.theme.JewelTheme
import org.jetbrains.jewel.ui.component.IndeterminateHorizontalProgressBar
import org.jetbrains.packagesearch.api.PackageSearchApiClientObject

@Composable
fun PackageSearchToolwindow() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ internal fun PackageActionPopup(


internal fun SplitPaneScope.packageSearchSplitter(
cursor: PointerIcon = PointerIcon(Cursor(Cursor.E_RESIZE_CURSOR)),
cursor: PointerIcon = androidx.compose.ui.input.pointer.PointerIcon(Cursor(Cursor.E_RESIZE_CURSOR)),
) {
splitter {
visiblePart {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ internal fun PackageSearchTabStyle(): TabStyle {
),
icons = current.icons,
contentAlpha = current.contentAlpha,
scrollbarStyle = LocalScrollbarStyle.current,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.rememberScrollbarAdapter
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -46,7 +45,7 @@ fun PackageSearchCentralPanel(
)
VerticalScrollbar(
modifier = Modifier.fillMaxHeight().align(Alignment.CenterEnd),
scrollState = viewModel.selectableLazyListState.lazyListState,
adapter = viewModel.selectableLazyListState.lazyListState,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ private fun RowScope.PackageTitle(item: PackageListItem.Package) {
) {
val iconPath = if (JewelTheme.isDark) item.icon.darkIconPath else item.icon.lightIconPath
Icon(
key = PathIconKey(iconPath, IconProvider::class.java),
key = PathIconKey(iconPath),
modifier = Modifier.size(16.dp),
contentDescription = null,
hint = PainterHint.None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollbarAdapter
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
Expand All @@ -26,8 +25,6 @@ import org.jetbrains.jewel.ui.component.SimpleTabContent
import org.jetbrains.jewel.ui.component.TabData
import org.jetbrains.jewel.ui.component.TabStrip
import org.jetbrains.jewel.ui.component.VerticalScrollbar
import org.jetbrains.jewel.ui.component.styling.LocalDefaultTabStyle
import org.jetbrains.jewel.ui.component.styling.LocalEditorTabStyle

@Composable
fun PackageSearchInfoPanel(
Expand All @@ -45,7 +42,6 @@ fun PackageSearchInfoPanel(
else -> Column(modifier = Modifier.fillMaxSize()) {
TabStrip(
modifier = Modifier.fillMaxWidth(),
style = LocalDefaultTabStyle.current,
tabs = tabs.map { infoPanelContent ->
TabData.Default(
selected = activeTabTitle == infoPanelContent.tabTitleData.tabTitle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollbarAdapter
import androidx.compose.foundation.v2.ScrollbarAdapter
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
Expand All @@ -32,6 +32,7 @@ import com.jetbrains.packagesearch.plugin.ui.PackageSearchMetrics
import com.jetbrains.packagesearch.plugin.ui.model.tree.TreeItemModel
import com.jetbrains.packagesearch.plugin.ui.model.tree.TreeViewModel
import com.jetbrains.packagesearch.plugin.ui.viewModel
import org.jetbrains.jewel.foundation.ExperimentalJewelApi
import org.jetbrains.jewel.foundation.lazy.tree.Tree
import org.jetbrains.jewel.foundation.theme.JewelTheme
import org.jetbrains.jewel.ui.Orientation
Expand All @@ -43,6 +44,7 @@ import org.jetbrains.jewel.ui.component.Text
import org.jetbrains.jewel.ui.component.Tooltip
import org.jetbrains.jewel.ui.component.VerticalScrollbar

@OptIn(ExperimentalJewelApi::class)
@Composable
fun PackageSearchModulesTree(
modifier: Modifier,
Expand Down Expand Up @@ -96,8 +98,8 @@ fun PackageSearchModulesTree(
TreeItem(item)
}
VerticalScrollbar(
adapter = rememberScrollbarAdapter(scrollState = viewModel.lazyListState),
modifier = Modifier.fillMaxHeight().align(Alignment.CenterEnd),
scrollState = viewModel.lazyListState,
)

}
Expand Down

0 comments on commit def6807

Please sign in to comment.