mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
## Summary Implement 11 Figma design discrepancies for the Node Library sidebar and V2 Node Search dialog, aligning the UI with the [Toolbox Figma design](https://www.figma.com/design/xMFxCziXJe6Denz4dpDGTq/Toolbox?node-id=2074-21394&m=dev). ## Changes - **What**: Sidebar: reorder tabs (All/Essentials/Blueprints), rename Custom→Blueprints, uppercase section headers, chevron-left of folder icon, bookmark-on-hover for node rows, filter dropdown with checkbox items, sort labels (Categorized/A-Z) with label-left/check-right layout, hide section headers in A-Z mode. Search dialog: expand filter chips from 3→6, add Recents and source categories to sidebar, remove "Filter by" label. Pull foundation V2 components from merged PR #8548. - **Dependencies**: Depends on #8987 (V2 Node Search) and #8548 (NodeLibrarySidebarTabV2) ## Review Focus - Filter dropdown (`filterOptions`) is UI-scaffolded but not yet wired to filtering logic (pending V2 integration) - "Recents" category currently returns frequency-based results as placeholder until a usage-tracking store is implemented - Pre-existing type errors from V2 PR dependencies not in the base commit (SearchBoxV2, usePerTabState, TextTicker, getProviderIcon, getLinkTypeColor, SidebarContainerKey) are expected and will resolve when rebased onto main after parent PRs land ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9085-feat-Node-Library-sidebar-and-V2-Search-dialog-Figma-design-improvements-30f6d73d36508175bf72d716f5904476) by [Unito](https://www.unito.io) --------- Co-authored-by: Yourz <crazilou@vip.qq.com> Co-authored-by: github-actions <github-actions@github.com>
136 lines
4.0 KiB
Vue
136 lines
4.0 KiB
Vue
<template>
|
|
<TabsContent
|
|
ref="panelEl"
|
|
value="essentials"
|
|
class="flex-1 overflow-y-auto px-3 h-full"
|
|
>
|
|
<div class="flex flex-col gap-2 pb-6">
|
|
<!-- Flat sorted grid when alphabetical -->
|
|
<div
|
|
v-if="flatNodes.length > 0"
|
|
class="grid grid-cols-[repeat(auto-fill,minmax(5rem,1fr))] gap-3 pt-3"
|
|
>
|
|
<EssentialNodeCard
|
|
v-for="node in flatNodes"
|
|
:key="node.key"
|
|
:node="node"
|
|
@click="emit('nodeClick', $event)"
|
|
/>
|
|
</div>
|
|
|
|
<!-- Grouped collapsible folders when original -->
|
|
<template v-else>
|
|
<CollapsibleRoot
|
|
v-for="folder in folders"
|
|
:key="folder.key"
|
|
class="rounded-lg"
|
|
:open="expandedKeys.includes(folder.key)"
|
|
@update:open="toggleFolder(folder.key, $event)"
|
|
>
|
|
<CollapsibleTrigger
|
|
class="group flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-3 px-1 text-xs font-medium tracking-wide text-muted-foreground h-8 box-content"
|
|
>
|
|
<span class="uppercase">{{ folder.label }}</span>
|
|
<i
|
|
:class="
|
|
cn(
|
|
'icon-[lucide--chevron-up] size-4 transition-transform duration-200',
|
|
!expandedKeys.includes(folder.key) && '-rotate-180'
|
|
)
|
|
"
|
|
/>
|
|
</CollapsibleTrigger>
|
|
<CollapsibleContent
|
|
class="overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down"
|
|
>
|
|
<div
|
|
class="grid grid-cols-[repeat(auto-fill,minmax(5rem,1fr))] gap-3"
|
|
>
|
|
<EssentialNodeCard
|
|
v-for="node in folder.children"
|
|
:key="node.key"
|
|
:node="node"
|
|
@click="emit('nodeClick', $event)"
|
|
/>
|
|
</div>
|
|
</CollapsibleContent>
|
|
</CollapsibleRoot>
|
|
</template>
|
|
</div>
|
|
</TabsContent>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import {
|
|
CollapsibleContent,
|
|
CollapsibleRoot,
|
|
CollapsibleTrigger,
|
|
TabsContent
|
|
} from 'reka-ui'
|
|
import type { ComponentPublicInstance } from 'vue'
|
|
import { computed, provide, ref, watch } from 'vue'
|
|
|
|
import type { ComfyNodeDefImpl } from '@/stores/nodeDefStore'
|
|
import type { RenderedTreeExplorerNode } from '@/types/treeExplorerTypes'
|
|
import { cn } from '@/utils/tailwindUtil'
|
|
|
|
const panelEl = ref<ComponentPublicInstance | null>(null)
|
|
const panelRef = computed(() => panelEl.value?.$el as HTMLElement | null)
|
|
provide('essentialsPanelRef', panelRef)
|
|
|
|
import EssentialNodeCard from './EssentialNodeCard.vue'
|
|
|
|
const { root, flatNodes = [] } = defineProps<{
|
|
root: RenderedTreeExplorerNode<ComfyNodeDefImpl>
|
|
flatNodes?: RenderedTreeExplorerNode<ComfyNodeDefImpl>[]
|
|
}>()
|
|
|
|
const expandedKeys = defineModel<string[]>('expandedKeys', { required: true })
|
|
|
|
const emit = defineEmits<{
|
|
nodeClick: [node: RenderedTreeExplorerNode<ComfyNodeDefImpl>]
|
|
}>()
|
|
|
|
function flattenLeaves(
|
|
node: RenderedTreeExplorerNode<ComfyNodeDefImpl>
|
|
): RenderedTreeExplorerNode<ComfyNodeDefImpl>[] {
|
|
if (node.type === 'node') return [node]
|
|
return node.children?.flatMap(flattenLeaves) ?? []
|
|
}
|
|
|
|
const folders = computed(() => {
|
|
const topFolders =
|
|
(root.children?.filter(
|
|
(child) => child.type === 'folder'
|
|
) as RenderedTreeExplorerNode<ComfyNodeDefImpl>[]) ?? []
|
|
|
|
return topFolders.map((folder) => ({
|
|
...folder,
|
|
children: flattenLeaves(folder)
|
|
}))
|
|
})
|
|
|
|
function toggleFolder(key: string, open: boolean) {
|
|
if (open) {
|
|
expandedKeys.value = [...expandedKeys.value, key]
|
|
} else {
|
|
expandedKeys.value = expandedKeys.value.filter((k) => k !== key)
|
|
}
|
|
}
|
|
|
|
const hasAutoExpanded = ref(false)
|
|
|
|
watch(
|
|
folders,
|
|
(value) => {
|
|
if (!hasAutoExpanded.value && value.length > 0) {
|
|
hasAutoExpanded.value = true
|
|
if (expandedKeys.value.length === 0) {
|
|
expandedKeys.value = value.map((folder) => folder.key)
|
|
}
|
|
}
|
|
},
|
|
{ immediate: true }
|
|
)
|
|
</script>
|