Skip to content

Commit

Permalink
Removed Jewel from dependencies and Compose/Jewel shadowing from fatj…
Browse files Browse the repository at this point in the history
…ar (#12)

(cherry picked from commit 85f94dc)
  • Loading branch information
fscarponi committed Jan 10, 2024
1 parent 9d27c69 commit 31398a6
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ fun Project.configureGradleIntellijPlugin(packageSearchExtension: PackageSearchE
relocate("io.ktor", "shadow.io.ktor")
relocate("kotlinx.serialization", "shadow.kotlinx.serialization")
relocate("kotlinx.datetime", "shadow.kotlinx.datetime")
relocate("androidx", "shadow.androidx")
relocate("org.jetbrains.jewel", "shadow.org.jetbrains.jewel")
relocate("org.jetbrains.compose", "shadow.org.jetbrains.compose")
exclude {
it.name.containsAny(packageSearchExtension.librariesToDelete.get())
&& !it.name.containsAny(packageSearchExtension.librariesToKeep.get())
Expand All @@ -43,4 +40,4 @@ fun Project.configureGradleIntellijPlugin(packageSearchExtension: PackageSearchE
}
}
}
}
}
6 changes: 0 additions & 6 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,7 @@ val tooling: Configuration by configurations.creating {
}

dependencies {
implementation(compose.desktop.linux_arm64)
implementation(compose.desktop.linux_x64)
implementation(compose.desktop.macos_arm64)
implementation(compose.desktop.macos_x64)
implementation(compose.desktop.windows_x64)
implementation(packageSearchCatalog.kotlinx.serialization.core)
implementation(packageSearchCatalog.jewel.bridge.ij233)
implementation(packageSearchCatalog.ktor.client.logging)
implementation(packageSearchCatalog.packagesearch.api.models)
implementation(projects.plugin.gradle.base)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.onClick
import androidx.compose.material.Divider
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand Down Expand Up @@ -52,7 +51,9 @@ import org.jetbrains.jewel.foundation.lazy.SelectableLazyItemScope
import org.jetbrains.jewel.foundation.lazy.SelectableLazyListState
import org.jetbrains.jewel.foundation.lazy.SelectionMode
import org.jetbrains.jewel.foundation.theme.JewelTheme
import org.jetbrains.jewel.ui.Orientation
import org.jetbrains.jewel.ui.component.CircularProgressIndicator
import org.jetbrains.jewel.ui.component.Divider
import org.jetbrains.jewel.ui.component.Icon
import org.jetbrains.jewel.ui.component.Link
import org.jetbrains.jewel.ui.component.Text
Expand Down Expand Up @@ -319,7 +320,7 @@ internal fun RemotePackageWithVariantsActionPopup(
}
if (!isInstalledInPrimaryVariant) {
passiveItem {
Divider(modifier = Modifier.padding(vertical = 4.dp))
Divider(Orientation.Horizontal,modifier = Modifier.padding(vertical = 4.dp))
}
selectableItem(
selected = false,
Expand All @@ -331,7 +332,7 @@ internal fun RemotePackageWithVariantsActionPopup(

if (additionalVariants.isNotEmpty()) {
passiveItem {
Divider(modifier = Modifier.padding(vertical = 4.dp))
Divider(Orientation.Horizontal,modifier = Modifier.padding(vertical = 4.dp))
}
additionalVariants.forEach {
selectableItem(
Expand Down Expand Up @@ -375,7 +376,7 @@ internal fun DeclaredPackageActionPopup(
}
}
passiveItem {
Divider(modifier = Modifier.padding(vertical = 4.dp))
Divider(Orientation.Horizontal,modifier = Modifier.padding(vertical = 4.dp))
}
selectableItem(
selected = false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.jetbrains.packagesearch.plugin.ui.panels.tree

import androidx.compose.animation.Crossfade
import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -34,6 +33,7 @@ import org.jetbrains.jewel.foundation.lazy.tree.Tree
import org.jetbrains.jewel.foundation.lazy.tree.buildTree
import org.jetbrains.jewel.foundation.lazy.tree.rememberTreeState
import org.jetbrains.jewel.foundation.theme.JewelTheme
import org.jetbrains.jewel.foundation.theme.ThemeDefinition
import org.jetbrains.jewel.ui.Orientation
import org.jetbrains.jewel.ui.component.Divider
import org.jetbrains.jewel.ui.component.Icon
Expand All @@ -58,7 +58,7 @@ fun PackageSearchModulesTree(
onExpandAll = viewModel::expandAll,
onCollapseAll = {
val rootIds = tree.roots.map { it.id }.toSet()
viewModel.treeState.selectedKeys = viewModel.treeState.selectedKeys intersect rootIds
viewModel.treeState.selectedKeys = (viewModel.treeState.selectedKeys intersect rootIds).toList()
viewModel.collapseAll()
},
)
Expand All @@ -77,7 +77,7 @@ fun PackageSearchModulesTree(
viewModel.treeState.selectedKeys = tree.walkBreadthFirst()
.take(1)
.map { it.data.id }
.toSet()
.toList()
}
}
Box {
Expand Down Expand Up @@ -200,52 +200,52 @@ private fun TreeItem(element: Tree.Element<TreeItemModel>) {
}
}
}

@Preview
@Composable
private fun TreeItemPreview() {
val items = listOf(
TreeItemModel(
id = PackageSearchModule.Identity("a", ":"),
text = "JetBrains",
hasUpdates = true,
icon = IconProvider.Icon("icons/npm.svg"),
),
TreeItemModel(
id = PackageSearchModule.Identity("a", ":b"),
text = "Kotlin",
hasUpdates = false,
icon = IconProvider.Icon("icons/maven.svg"),
),
TreeItemModel(
id = PackageSearchModule.Identity("a", ":c"),
text = "Ktor",
hasUpdates = false,
icon = IconProvider.Icon("icons/cocoapods.svg.svg"),
),
TreeItemModel(
id = PackageSearchModule.Identity("a", ":c:d"),
text = "Compose",
hasUpdates = true,
icon = IconProvider.Icon("icons/npm.svg"),
),
)
val tree = buildTree {
addLeaf(items[0], items[0].id)
addNode(items[1], items[1].id) {
addLeaf(items[2], items[2].id)
}
addLeaf(items[3], items[3].id)
}
LazyTree(
modifier = Modifier.padding(top = 4.dp),
tree = tree,
treeState = rememberTreeState(),
onSelectionChange = {},
) { item ->
TreeItem(item)
}
}



//
//@Preview
//@Composable
//private fun TreeItemPreview() {
// val items = listOf(
// TreeItemModel(
// id = PackageSearchModule.Identity("a", ":"),
// text = "JetBrains",
// hasUpdates = true,
// icon = IconProvider.Icon("icons/npm.svg"),
// ),
// TreeItemModel(
// id = PackageSearchModule.Identity("a", ":b"),
// text = "Kotlin",
// hasUpdates = false,
// icon = IconProvider.Icon("icons/maven.svg"),
// ),
// TreeItemModel(
// id = PackageSearchModule.Identity("a", ":c"),
// text = "Ktor",
// hasUpdates = false,
// icon = IconProvider.Icon("icons/cocoapods.svg.svg"),
// ),
// TreeItemModel(
// id = PackageSearchModule.Identity("a", ":c:d"),
// text = "Compose",
// hasUpdates = true,
// icon = IconProvider.Icon("icons/npm.svg"),
// ),
// )
// val tree = buildTree {
// addLeaf(items[0], items[0].id)
// addNode(items[1], items[1].id) {
// addLeaf(items[2], items[2].id)
// }
// addLeaf(items[3], items[3].id)
// }
// LazyTree(
// modifier = Modifier.padding(top = 4.dp),
// tree = tree,
// treeState = rememberTreeState(),
// onSelectionChange = {},
// ) { item ->
// TreeItem(item)
// }
//}
//
//
//

0 comments on commit 31398a6

Please sign in to comment.