Support associated socket for widgets (#3326)

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Chenlei Hu
2025-04-06 11:50:21 -04:00
committed by GitHub
parent 6eb2b76621
commit ac53296b2e
41 changed files with 212 additions and 534 deletions

View File

@@ -66,7 +66,7 @@ import {
import { $el, ComfyUI } from './ui'
import { ComfyAppMenu } from './ui/menu/index'
import { clone } from './utils'
import { type ComfyWidgetConstructor, ComfyWidgets } from './widgets'
import { type ComfyWidgetConstructor } from './widgets'
export const ANIM_PREVIEW_WIDGET = '$$comfy_animation_preview'
@@ -180,10 +180,7 @@ export class ComfyApp {
* @deprecated Use useWidgetStore().widgets instead
*/
get widgets(): Record<string, ComfyWidgetConstructor> {
if (this.vueAppReady) {
return useWidgetStore().widgets
}
return ComfyWidgets
return Object.fromEntries(useWidgetStore().widgets.entries())
}
/**

View File

@@ -132,12 +132,7 @@ abstract class BaseDOMWidgetImpl<V extends object | string>
}
isVisible(): boolean {
return (
!_.isNil(this.computedHeight) &&
this.computedHeight > 0 &&
!['converted-widget', 'hidden'].includes(this.type) &&
!this.node.collapsed
)
return !['hidden'].includes(this.type) && this.node.isWidgetVisible(this)
}
draw(