Build comfyui-frontend-types library (#1725)

* Install vite-plugin-dts

* Explicitly type workflowStore

* Working rollup

* Hide diff type

* Inline primevue toast mesage types

* Add prepare-types script to generate package.json for type package

* Add global declaration

* Add publish types Github action

* Update litegraph

* Add @comfyorg to package name
This commit is contained in:
Chenlei Hu
2024-11-28 08:21:19 -08:00
committed by GitHub
parent 5191e11650
commit 05fab91bda
11 changed files with 733 additions and 10 deletions

View File

@@ -1,4 +1,3 @@
import type { ToastMessageOptions } from 'primevue/toast'
import { Component } from 'vue'
export interface BaseSidebarTabExtension {
@@ -41,6 +40,53 @@ export type BottomPanelExtension =
| VueBottomPanelExtension
| CustomBottomPanelExtension
/**
* Defines message options in Toast component.
*/
export interface ToastMessageOptions {
/**
* Severity level of the message.
* @defaultValue info
*/
severity?:
| 'success'
| 'info'
| 'warn'
| 'error'
| 'secondary'
| 'contrast'
| undefined
/**
* Summary content of the message.
*/
summary?: string | undefined
/**
* Detail content of the message.
*/
detail?: any | undefined
/**
* Whether the message can be closed manually using the close icon.
* @defaultValue true
*/
closable?: boolean | undefined
/**
* Delay in milliseconds to close the message automatically.
*/
life?: number | undefined
/**
* Key of the Toast to display the message.
*/
group?: string | undefined
/**
* Style class of the message.
*/
styleClass?: any
/**
* Style class of the content.
*/
contentStyleClass?: any
}
export type ToastManager = {
add(message: ToastMessageOptions): void
remove(message: ToastMessageOptions): void

9
src/types/index.ts Normal file
View File

@@ -0,0 +1,9 @@
import { ComfyApp } from '@/scripts/app'
export type { ComfyExtension } from './comfy'
export type { ComfyApi } from '@/scripts/api'
export type { ComfyApp } from '@/scripts/app'
declare global {
const app: ComfyApp
}