Display optional indicator on subgraphNode inputs

This commit is contained in:
Austin Mroz
2026-02-09 18:42:06 -08:00
parent a3cf6fcde0
commit 96666ab146
3 changed files with 9 additions and 2 deletions

View File

@@ -8,8 +8,8 @@ import type { LGraphEventMap } from './LGraphEventMap'
export interface SubgraphInputEventMap extends LGraphEventMap {
'input-connected': {
input: INodeInputSlot
widget: IBaseWidget
node: LGraphNode
widget?: IBaseWidget
node?: LGraphNode
}
'input-disconnected': {

View File

@@ -95,6 +95,8 @@ export class SubgraphInput extends SubgraphSlot {
widget: inputWidget,
node
})
} else {
this.events.dispatch('input-connected', { input: slot })
}
const link = new LLink(

View File

@@ -764,6 +764,8 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
'input-connected',
(e) => {
this._invalidatePromotedViewsCache()
input.shape = e.detail.input.shape
if (!e.detail.widget || !e.detail.node) return
// `SubgraphInput.connect()` dispatches before appending to `linkIds`,
// so resolve by current links would miss this new connection.
@@ -900,6 +902,9 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
name: slot.name,
localized_name: slot.localized_name,
label: slot.label,
shape: this.subgraph.links[slot.linkIds[0]]?.resolve(
this.subgraph
)?.input?.shape,
type: slot.type,
link: null
},