Sidebar tab API for extensions (#215)

* Add extensionManager to manage tabs

* Fix null bug

* nit
This commit is contained in:
Chenlei Hu
2024-07-24 21:31:59 -04:00
committed by GitHub
parent ebdd7b8e40
commit 19c70d95d3
9 changed files with 181 additions and 61 deletions

View 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[];
}