mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-28 02:02:08 +00:00
Sidebar tab API for extensions (#215)
* Add extensionManager to manage tabs * Fix null bug * nit
This commit is contained in:
30
src/types/extensionTypes.ts
Normal file
30
src/types/extensionTypes.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Component } from "vue";
|
||||
|
||||
export interface BaseSidebarTabExtension {
|
||||
id: string;
|
||||
title: string;
|
||||
icon?: string;
|
||||
order?: number;
|
||||
tooltip?: string;
|
||||
}
|
||||
|
||||
export interface VueSidebarTabExtension extends BaseSidebarTabExtension {
|
||||
type: "vue";
|
||||
component: Component;
|
||||
}
|
||||
|
||||
export interface CustomSidebarTabExtension extends BaseSidebarTabExtension {
|
||||
type: "custom";
|
||||
render: (container: HTMLElement) => void;
|
||||
destroy?: () => void;
|
||||
}
|
||||
|
||||
export type SidebarTabExtension =
|
||||
| VueSidebarTabExtension
|
||||
| CustomSidebarTabExtension;
|
||||
|
||||
export interface ExtensionManager {
|
||||
registerSidebarTab(tab: SidebarTabExtension): void;
|
||||
unregisterSidebarTab(id: string): void;
|
||||
getSidebarTabs(): SidebarTabExtension[];
|
||||
}
|
||||
Reference in New Issue
Block a user