Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"dependencies": {
"@atlaskit/pragmatic-drag-and-drop": "^1.3.1",
"@comfyorg/comfyui-electron-types": "^0.4.11",
"@comfyorg/litegraph": "^0.8.60",
"@comfyorg/litegraph": "^0.8.61",
"@primevue/themes": "^4.0.5",
"@sentry/vue": "^8.48.0",
"@tiptap/core": "^2.10.4",
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/domWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>)
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/services/litegraphService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 14 additions & 0 deletions src/types/litegraph-augmentation.d.ts
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
Loading