mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-05 23:50:08 +00:00
fix: add LiteGraph types to Window interface and remove @ts-expect-error suppressions
This commit is contained in:
@@ -6,30 +6,21 @@ import {
|
||||
LGraphCanvas,
|
||||
LGraphGroup,
|
||||
LGraphNode,
|
||||
LLink,
|
||||
LiteGraph
|
||||
LiteGraph,
|
||||
LLink
|
||||
} from '@/lib/litegraph/src/litegraph'
|
||||
|
||||
/**
|
||||
* Assign all properties of LiteGraph to window to make it backward compatible.
|
||||
*/
|
||||
export const useGlobalLitegraph = () => {
|
||||
// @ts-expect-error fixme ts strict error
|
||||
window['LiteGraph'] = LiteGraph
|
||||
// @ts-expect-error fixme ts strict error
|
||||
window['LGraph'] = LGraph
|
||||
// @ts-expect-error fixme ts strict error
|
||||
window['LLink'] = LLink
|
||||
// @ts-expect-error fixme ts strict error
|
||||
window['LGraphNode'] = LGraphNode
|
||||
// @ts-expect-error fixme ts strict error
|
||||
window['LGraphGroup'] = LGraphGroup
|
||||
// @ts-expect-error fixme ts strict error
|
||||
window['DragAndScale'] = DragAndScale
|
||||
// @ts-expect-error fixme ts strict error
|
||||
window['LGraphCanvas'] = LGraphCanvas
|
||||
// @ts-expect-error fixme ts strict error
|
||||
window['ContextMenu'] = ContextMenu
|
||||
// @ts-expect-error fixme ts strict error
|
||||
window['LGraphBadge'] = LGraphBadge
|
||||
export function useGlobalLitegraph() {
|
||||
window.LiteGraph = LiteGraph
|
||||
window.LGraph = LGraph
|
||||
window.LLink = LLink
|
||||
window.LGraphNode = LGraphNode
|
||||
window.LGraphGroup = LGraphGroup
|
||||
window.DragAndScale = DragAndScale
|
||||
window.LGraphCanvas = LGraphCanvas
|
||||
window.ContextMenu = ContextMenu
|
||||
window.LGraphBadge = LGraphBadge
|
||||
}
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
import type {
|
||||
ContextMenu,
|
||||
DragAndScale,
|
||||
LGraph,
|
||||
LGraphBadge,
|
||||
LGraphCanvas,
|
||||
LGraphGroup,
|
||||
LGraphNode,
|
||||
LiteGraphGlobal,
|
||||
LLink
|
||||
} from '@/lib/litegraph/src/litegraph'
|
||||
import type {
|
||||
DeviceStats,
|
||||
EmbeddingsResponse,
|
||||
@@ -71,5 +82,16 @@ declare global {
|
||||
|
||||
/** For use by extensions and in the browser console. Where possible, import `app` and access via `app.graph` instead. */
|
||||
graph?: unknown
|
||||
|
||||
/** LiteGraph global namespace - for extension compatibility */
|
||||
LiteGraph?: LiteGraphGlobal
|
||||
LGraph?: typeof LGraph
|
||||
LLink?: typeof LLink
|
||||
LGraphNode?: typeof LGraphNode
|
||||
LGraphGroup?: typeof LGraphGroup
|
||||
DragAndScale?: typeof DragAndScale
|
||||
LGraphCanvas?: typeof LGraphCanvas
|
||||
ContextMenu?: typeof ContextMenu
|
||||
LGraphBadge?: typeof LGraphBadge
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user