mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-28 02:02:08 +00:00
Type INodeOutputSlot widget hack on PrimitiveNode (#2728)
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
// @ts-strict-ignore
|
// @ts-strict-ignore
|
||||||
import { LGraphNode, LiteGraph } from '@comfyorg/litegraph'
|
import { LGraphNode, LiteGraph } from '@comfyorg/litegraph'
|
||||||
import type {
|
import type {
|
||||||
|
IFoundSlot,
|
||||||
INodeInputSlot,
|
INodeInputSlot,
|
||||||
|
INodeOutputSlot,
|
||||||
IWidget,
|
IWidget,
|
||||||
LiteGraphCanvasEvent
|
LiteGraphCanvasEvent
|
||||||
} from '@comfyorg/litegraph'
|
} from '@comfyorg/litegraph'
|
||||||
import type { IFoundSlot } from '@comfyorg/litegraph'
|
|
||||||
import { INodeSlot } from '@comfyorg/litegraph'
|
|
||||||
|
|
||||||
import { useNodeDefStore } from '@/stores/nodeDefStore'
|
import { useNodeDefStore } from '@/stores/nodeDefStore'
|
||||||
import { useSettingStore } from '@/stores/settingStore'
|
import { useSettingStore } from '@/stores/settingStore'
|
||||||
@@ -422,7 +422,7 @@ export class PrimitiveNode extends LGraphNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getWidgetConfig(slot: INodeSlot) {
|
export function getWidgetConfig(slot: INodeInputSlot | INodeOutputSlot) {
|
||||||
return slot.widget[CONFIG] ?? slot.widget[GET_CONFIG]?.() ?? ['*', {}]
|
return slot.widget[CONFIG] ?? slot.widget[GET_CONFIG]?.() ?? ['*', {}]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
8
src/types/litegraph-augmentation.d.ts
vendored
8
src/types/litegraph-augmentation.d.ts
vendored
@@ -148,6 +148,14 @@ declare module '@comfyorg/litegraph' {
|
|||||||
/** Callback for pasting multiple files into the node */
|
/** Callback for pasting multiple files into the node */
|
||||||
pasteFiles?(files: File[]): void
|
pasteFiles?(files: File[]): void
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Only used by the Primitive node. Primitive node is using the widget property
|
||||||
|
* to store/access the widget config.
|
||||||
|
* We should remove this hacky solution once we have a proper solution.
|
||||||
|
*/
|
||||||
|
interface INodeOutputSlot {
|
||||||
|
widget?: IWidget
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user