mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-05 15:40:10 +00:00
Most of the features in this pull request are completed and can be
reviewed and merged.
## TODO
- [x] no selection panel
- [x] group selected panel
- [x] tabs
- [x] favorites tab
- [x] global settings tab
- [x] nodes tab
- [x] widget actions menu
- [x] [Bug]: style bugs
- [x] button zoom to the node on canvas.
- [x] rename widgets on widget actions
- [ ] [Bug]: the canvas has not been updated after renaming.
- [x] global settings
- [ ] setting item: "show advanced parameters"
- blocked by other things. skip for now.
- [x] setting item: show toolbox on selection
- [x] setting item: nodes 2.0
- [ ] setting item: "background color"
- blocked by other things. skip for now.
- [x] setting item: grid spacing
- [x] setting item: snap nodes to grid
- [x] setting item: link shape
- [x] setting item: show connected links
- [x] form style reuses the form style of node widgets
- [x] group node cases
- [x] group node settings
- [x] show all nodes in group
- [x] show frame name on nodes when multiple selections are made
- [x] group multiple selections
- [x] [Bug]: nodes without widgets cannot display the location and their
group
- [x] [Bug]: labels layout
- [x] favorites
- [x] the indicator on widgets
- [x] favorite and unfavorite buttons on widgets
- [x] [Bug]: show node name in favorite widgets + improve labels layout
- [ ] [Bug]: After canceling the like, the like list will not be updated
immediately.
- [x] [Bug]: The favorite function does not work for the project on
Subgraph.
- [x] subgraph
- [x] add the node name from where this parameter comes from when node
is subgraph
- [x] show and hide directly on Inputs
- [x] some bugs need to be fixed.
- [x] advanced widgets
- [x] button: show advanced inputs
- Clicking button expands the "Advanced Inputs" section on the right
side panel, regardless of whether the panel is open or not
- [x] [Bug]: style bugs
- [x] advanced inputs section when node is subgraph
- [x] inputs tab rearranging
- [x] favorited inputs rearranging
- [x] subgraph inputs rearranging
- [ ] review and reconstruction to improve complexity and architecture
┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7812-feat-right-side-panel-favorites-no-selection-state-and-more-2da6d73d36508134b503d676f9b3d248)
by [Unito](https://www.unito.io)
---------
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: bymyself <cbyrne@comfy.org>
168 lines
4.6 KiB
Vue
168 lines
4.6 KiB
Vue
<script setup lang="ts">
|
|
import { cn } from '@comfyorg/tailwind-utils'
|
|
import { computed } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
import MoreButton from '@/components/button/MoreButton.vue'
|
|
import { isProxyWidget } from '@/core/graph/subgraph/proxyWidget'
|
|
import {
|
|
demoteWidget,
|
|
promoteWidget
|
|
} from '@/core/graph/subgraph/proxyWidgetUtils'
|
|
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
|
|
import type { SubgraphNode } from '@/lib/litegraph/src/subgraph/SubgraphNode'
|
|
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
|
|
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
|
|
import { useDialogService } from '@/services/dialogService'
|
|
import { useFavoritedWidgetsStore } from '@/stores/workspace/favoritedWidgetsStore'
|
|
|
|
const {
|
|
widget,
|
|
node,
|
|
parents = [],
|
|
isShownOnParents = false
|
|
} = defineProps<{
|
|
widget: IBaseWidget
|
|
node: LGraphNode
|
|
parents?: SubgraphNode[]
|
|
isShownOnParents?: boolean
|
|
}>()
|
|
|
|
const label = defineModel<string>('label', { required: true })
|
|
|
|
const canvasStore = useCanvasStore()
|
|
const favoritedWidgetsStore = useFavoritedWidgetsStore()
|
|
const dialogService = useDialogService()
|
|
const { t } = useI18n()
|
|
|
|
const hasParents = computed(() => parents?.length > 0)
|
|
const favoriteNode = computed(() =>
|
|
isShownOnParents && hasParents.value ? parents[0] : node
|
|
)
|
|
const isFavorited = computed(() =>
|
|
favoritedWidgetsStore.isFavorited(favoriteNode.value, widget.name)
|
|
)
|
|
|
|
async function handleRename() {
|
|
const newLabel = await dialogService.prompt({
|
|
title: t('g.rename'),
|
|
message: t('g.enterNewName') + ':',
|
|
defaultValue: widget.label,
|
|
placeholder: widget.name
|
|
})
|
|
|
|
if (newLabel === null) return
|
|
label.value = newLabel
|
|
}
|
|
|
|
function handleHideInput() {
|
|
if (!parents?.length) return
|
|
|
|
// For proxy widgets (already promoted), we need to find the original interior node and widget
|
|
if (isProxyWidget(widget)) {
|
|
const subgraph = parents[0].subgraph
|
|
const interiorNode = subgraph.getNodeById(parseInt(widget._overlay.nodeId))
|
|
|
|
if (!interiorNode) {
|
|
console.error('Could not find interior node for proxy widget')
|
|
return
|
|
}
|
|
|
|
const originalWidget = interiorNode.widgets?.find(
|
|
(w) => w.name === widget._overlay.widgetName
|
|
)
|
|
|
|
if (!originalWidget) {
|
|
console.error('Could not find original widget for proxy widget')
|
|
return
|
|
}
|
|
|
|
demoteWidget(interiorNode, originalWidget, parents)
|
|
} else {
|
|
// For regular widgets (not yet promoted), use them directly
|
|
demoteWidget(node, widget, parents)
|
|
}
|
|
|
|
canvasStore.canvas?.setDirty(true, true)
|
|
}
|
|
|
|
function handleShowInput() {
|
|
if (!parents?.length) return
|
|
|
|
promoteWidget(node, widget, parents)
|
|
canvasStore.canvas?.setDirty(true, true)
|
|
}
|
|
|
|
function handleToggleFavorite() {
|
|
favoritedWidgetsStore.toggleFavorite(favoriteNode.value, widget.name)
|
|
}
|
|
|
|
const buttonClasses = cn([
|
|
'border-none bg-transparent',
|
|
'w-full flex items-center gap-2 rounded px-3 py-2 text-sm',
|
|
'cursor-pointer transition-all hover:bg-secondary-background-hover active:scale-95'
|
|
])
|
|
</script>
|
|
|
|
<template>
|
|
<MoreButton
|
|
is-vertical
|
|
class="text-muted-foreground bg-transparent hover:text-base-foreground hover:bg-secondary-background-hover active:scale-95 transition-all"
|
|
>
|
|
<template #default="{ close }">
|
|
<button
|
|
:class="buttonClasses"
|
|
@click="
|
|
() => {
|
|
handleRename()
|
|
close()
|
|
}
|
|
"
|
|
>
|
|
<i class="icon-[lucide--edit] size-4" />
|
|
<span>{{ t('g.rename') }}</span>
|
|
</button>
|
|
|
|
<button
|
|
v-if="hasParents"
|
|
:class="buttonClasses"
|
|
@click="
|
|
() => {
|
|
if (isShownOnParents) handleHideInput()
|
|
else handleShowInput()
|
|
close()
|
|
}
|
|
"
|
|
>
|
|
<template v-if="isShownOnParents">
|
|
<i class="icon-[lucide--eye-off] size-4" />
|
|
<span>{{ t('rightSidePanel.hideInput') }}</span>
|
|
</template>
|
|
<template v-else>
|
|
<i class="icon-[lucide--eye] size-4" />
|
|
<span>{{ t('rightSidePanel.showInput') }}</span>
|
|
</template>
|
|
</button>
|
|
|
|
<button
|
|
:class="buttonClasses"
|
|
@click="
|
|
() => {
|
|
handleToggleFavorite()
|
|
close()
|
|
}
|
|
"
|
|
>
|
|
<template v-if="isFavorited">
|
|
<i class="icon-[lucide--star]" />
|
|
<span>{{ t('rightSidePanel.removeFavorite') }}</span>
|
|
</template>
|
|
<template v-else>
|
|
<i class="icon-[lucide--star]" />
|
|
<span>{{ t('rightSidePanel.addFavorite') }}</span>
|
|
</template>
|
|
</button>
|
|
</template>
|
|
</MoreButton>
|
|
</template>
|