refactor: unify widget promotion to use store as single source of truth

SubgraphInput.connect() dispatches widget-promotion-requested event
for widget-backed slots instead of creating input slots and links.
EmptySubgraphInput.connect() checks for widgets before creating
input slots. All promotions now flow through promotionStore.

Removed ~200 lines of linked-promotion infrastructure from
SubgraphNode (LinkedPromotionEntry, _resolveLinkedPromotionByInputName,
_syncPromotions, _buildPromotionReconcileState, _setWidget, etc.).
Removed _widget property from SubgraphInput, NodeInputSlot,
INodeInputSlot, and LGraphNode.removeWidget().

Amp-Thread-ID: https://ampcode.com/threads/T-019ccb06-9ebd-7161-a547-ab84d6ac2afd
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Alexander Brown
2026-03-07 17:21:22 -08:00
parent 725a0a2b89
commit 953374b9de
14 changed files with 412 additions and 769 deletions

View File

@@ -49,9 +49,12 @@ function addLinkedInteriorInput(
const node = new LGraphNode(`Interior-${linkedInputName}`)
const input = node.addInput(linkedInputName, '*')
node.addWidget('text', widgetName, '', () => undefined)
input.widget = { name: widgetName }
subgraph.add(node)
// Connect without .widget set so SubgraphInput creates a real link
// (widget-backed inputs now dispatch an event instead of creating links)
inputSlot.connect(input, node)
input.widget = { name: widgetName }
if (input.link == null)
throw new Error(`Expected link to be created for input ${linkedInputName}`)