[feat] DOM widget promotion for subgraph inputs (#4491)

This commit is contained in:
Christian Byrne
2025-07-21 11:52:54 -07:00
committed by GitHub
parent 995f482593
commit a39f6e6763
8 changed files with 537 additions and 28 deletions

View File

@@ -158,6 +158,18 @@ abstract class BaseDOMWidgetImpl<V extends object | string>
override onRemove(): void {
useDomWidgetStore().unregisterWidget(this.id)
}
override createCopyForNode(node: LGraphNode): this {
// @ts-expect-error
const cloned: this = new (this.constructor as typeof this)({
node: node,
name: this.name,
type: this.type,
options: this.options
})
cloned.value = this.value
return cloned
}
}
export class DOMWidgetImpl<T extends HTMLElement, V extends object | string>
@@ -177,6 +189,19 @@ export class DOMWidgetImpl<T extends HTMLElement, V extends object | string>
this.element = obj.element
}
override createCopyForNode(node: LGraphNode): this {
// @ts-expect-error
const cloned: this = new (this.constructor as typeof this)({
node: node,
name: this.name,
type: this.type,
element: this.element, // Include the element!
options: this.options
})
cloned.value = this.value
return cloned
}
/** Extract DOM widget size info */
override computeLayoutSize(node: LGraphNode) {
if (this.type === 'hidden') {