Manage widget definitions with Pinia store (#1510)

* Fix compile

* nit

* Remove extensions.test

* nit
This commit is contained in:
Chenlei Hu
2024-11-11 17:23:52 -05:00
committed by GitHub
parent 64ef0f18b1
commit 1ff6e27d9c
12 changed files with 111 additions and 269 deletions

19
src/types/comfy.d.ts vendored
View File

@@ -1,20 +1,13 @@
import { LGraphNode, IWidget } from './litegraph'
import { ComfyApp } from '../scripts/app'
import type { LGraphNode } from './litegraph'
import type { ComfyApp } from '../scripts/app'
import type { ComfyNodeDef } from '@/types/apiTypes'
import type { Keybinding } from '@/types/keyBindingTypes'
import type { ComfyCommand } from '@/stores/commandStore'
import { SettingParams } from './settingTypes'
import type { SettingParams } from './settingTypes'
import type { BottomPanelExtension } from './extensionTypes'
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
export type Widgets = Record<
string,
(
node,
inputName,
inputData,
app?: ComfyApp
) => { widget?: IWidget; minWidth?: number; minHeight?: number }
>
export type Widgets = Record<string, ComfyWidgetConstructor>
export interface AboutPageBadge {
label: string
@@ -94,6 +87,8 @@ export interface ComfyExtension {
defs: Record<string, ComfyNodeDef>,
app: ComfyApp
): Promise<void> | void
// TODO(huchenlei): We should deprecate the async return value of
// getCustomWidgets.
/**
* Allows the extension to add custom widgets
* @param app The ComfyUI app instance

View File

@@ -22,6 +22,8 @@ declare module '@comfyorg/litegraph' {
* Callback fired on each node after the graph is configured
*/
onAfterGraphConfigured?(): void
onGraphConfigured?(): void
onExecuted?(output: any): void
onNodeCreated?(this: LGraphNode): void
setInnerNodes?(nodes: LGraphNode[]): void
applyToGraph?(extraLinks?: LLink[]): void
@@ -38,7 +40,7 @@ declare module '@comfyorg/litegraph' {
name: string,
type: string,
element: HTMLElement,
options: Record<string, any>
options?: Record<string, any>
): DOMWidget
}