[Refactor] Move type extensions out of LG (SoC) (#2303)

Co-authored-by: huchenlei <huchenlei@proton.me>
This commit is contained in:
filtered
2025-01-21 06:22:56 +11:00
committed by GitHub
parent f9be20fa78
commit 9c53bbd53d
5 changed files with 20 additions and 7 deletions

View File

@@ -272,7 +272,7 @@ LGraphCanvas.prototype.computeVisibleNodes = function (): LGraphNode[] {
w.element.hidden = actualHidden
w.element.style.display = actualHidden ? 'none' : null
if (actualHidden && !wasHidden) {
w.options.onHide?.(w)
w.options.onHide?.(w as DOMWidget<HTMLElement, object>)
}
}
}

View File

@@ -367,7 +367,6 @@ export const useLitegraphService = () => {
const w = node.widgets[node.widgets.length - 1]
shiftY = w.last_y
if (w.computeSize) {
// @ts-expect-error requires 1 param
shiftY += w.computeSize()[1] + 4
// @ts-expect-error computedHeight only exists for DOMWidget
} else if (w.computedHeight) {

View File

@@ -1,10 +1,24 @@
import '@comfyorg/litegraph'
import type { LLink } from '@comfyorg/litegraph'
import type { DOMWidget } from '@/scripts/domWidget'
import type { ComfyNodeDef } from '@/types/apiTypes'
import type { NodeId } from './comfyWorkflow'
/** ComfyUI extensions of litegraph */
declare module '@comfyorg/litegraph/dist/types/widgets' {
interface IWidgetOptions {
/** Currently used by DOM widgets only. Declaring here reduces complexity. */
onHide?: (widget: DOMWidget) => void
}
interface IBaseWidget {
onRemove?: () => void
beforeQueued?: () => unknown
}
}
/**
* ComfyUI extensions of litegraph
*/