mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-28 18:54:09 +00:00
[Type] Mark app as required arg for ComfyWidgetConstructor (#2518)
This commit is contained in:
@@ -2,12 +2,13 @@ import type { LGraphNode } from '@comfyorg/litegraph'
|
||||
import type { IStringWidget } from '@comfyorg/litegraph/dist/types/widgets'
|
||||
|
||||
import { api } from '@/scripts/api'
|
||||
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
|
||||
import { useToastStore } from '@/stores/toastStore'
|
||||
import type { ComfyApp } from '@/types'
|
||||
import type { InputSpec } from '@/types/apiTypes'
|
||||
|
||||
export const useImageUploadWidget = () => {
|
||||
const widgetConstructor = (
|
||||
const widgetConstructor: ComfyWidgetConstructor = (
|
||||
node: LGraphNode,
|
||||
inputName: string,
|
||||
inputData: InputSpec,
|
||||
|
||||
@@ -15,7 +15,7 @@ export const useIntWidget = () => {
|
||||
node: LGraphNode,
|
||||
inputName: string,
|
||||
inputData: InputSpec,
|
||||
app?: ComfyApp,
|
||||
app: ComfyApp,
|
||||
widgetName?: string
|
||||
) => {
|
||||
const settingStore = useSettingStore()
|
||||
|
||||
@@ -8,6 +8,7 @@ import TiptapTableRow from '@tiptap/extension-table-row'
|
||||
import TiptapStarterKit from '@tiptap/starter-kit'
|
||||
import { Markdown as TiptapMarkdown } from 'tiptap-markdown'
|
||||
|
||||
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
|
||||
import type { ComfyApp } from '@/types'
|
||||
import type { InputSpec } from '@/types/apiTypes'
|
||||
|
||||
@@ -101,13 +102,13 @@ function addMarkdownWidget(
|
||||
}
|
||||
|
||||
export const useMarkdownWidget = () => {
|
||||
const widgetConstructor = (
|
||||
const widgetConstructor: ComfyWidgetConstructor = (
|
||||
node: LGraphNode,
|
||||
inputName: string,
|
||||
inputData: InputSpec,
|
||||
app: ComfyApp
|
||||
) => {
|
||||
const defaultVal = inputData[1].default || ''
|
||||
const defaultVal = inputData[1]?.default || ''
|
||||
return addMarkdownWidget(
|
||||
node,
|
||||
inputName,
|
||||
|
||||
@@ -13,7 +13,7 @@ export const useSeedWidget = () => {
|
||||
node: LGraphNode,
|
||||
inputName: string,
|
||||
inputData: InputSpec,
|
||||
app?: ComfyApp,
|
||||
app: ComfyApp,
|
||||
widgetName?: string
|
||||
) => {
|
||||
inputData[1] = {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { IWidget, LGraphNode } from '@comfyorg/litegraph'
|
||||
|
||||
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
|
||||
import { useSettingStore } from '@/stores/settingStore'
|
||||
import type { ComfyApp } from '@/types'
|
||||
import type { InputSpec } from '@/types/apiTypes'
|
||||
@@ -57,14 +58,14 @@ function addMultilineWidget(
|
||||
}
|
||||
|
||||
export const useStringWidget = () => {
|
||||
const widgetConstructor = (
|
||||
const widgetConstructor: ComfyWidgetConstructor = (
|
||||
node: LGraphNode,
|
||||
inputName: string,
|
||||
inputData: InputSpec,
|
||||
app: ComfyApp
|
||||
) => {
|
||||
const defaultVal = inputData[1].default || ''
|
||||
const multiline = !!inputData[1].multiline
|
||||
const defaultVal = inputData[1]?.default || ''
|
||||
const multiline = !!inputData[1]?.multiline
|
||||
|
||||
let res: { widget: IWidget }
|
||||
if (multiline) {
|
||||
|
||||
@@ -20,7 +20,7 @@ export type ComfyWidgetConstructor = (
|
||||
node: LGraphNode,
|
||||
inputName: string,
|
||||
inputData: InputSpec,
|
||||
app?: ComfyApp,
|
||||
app: ComfyApp,
|
||||
widgetName?: string
|
||||
) => { widget: IWidget; minWidth?: number; minHeight?: number }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user