@xiongtao.xt/tau-plugins 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PluginPages } from "./pages";
|
|
2
2
|
import type { PluginEditor } from "./editor";
|
|
3
3
|
import type { PluginSettings } from "./settings";
|
|
4
|
+
import type { PluginSidebar } from "./sidebar";
|
|
4
5
|
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
5
6
|
[key: string]: JsonValue;
|
|
6
7
|
};
|
|
@@ -29,6 +30,7 @@ export interface PluginContext {
|
|
|
29
30
|
readonly pages: PluginPages;
|
|
30
31
|
readonly editor: PluginEditor;
|
|
31
32
|
readonly settings: PluginSettings;
|
|
33
|
+
readonly sidebar: PluginSidebar;
|
|
32
34
|
readonly fetch: typeof globalThis.fetch;
|
|
33
35
|
/** 将订阅等资源交给宿主,在停用或激活失败时逆序回收。 */
|
|
34
36
|
register(resource: Disposable): Disposable;
|
|
@@ -2,5 +2,6 @@ import type { PluginDefinition } from "./contract";
|
|
|
2
2
|
export type { JsonValue, Disposable, PluginStorage, PluginCommand, PluginContext, PluginInstance, PluginDefinition, } from "./contract";
|
|
3
3
|
export type { PluginSettings, PluginSettingsDefinition, PluginSettingsProps, PluginSettingsHandle, } from "./settings";
|
|
4
4
|
export * from "./editor";
|
|
5
|
+
export * from "./sidebar";
|
|
5
6
|
export type { PluginPageDefinition, PluginPageHandle, PluginPageParams, PluginPageProps, PluginPages, } from "./pages";
|
|
6
7
|
export declare function definePlugin(definition: Omit<PluginDefinition, "apiVersion">): PluginDefinition;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Disposable } from "./contract";
|
|
2
|
+
import type { PluginPageHandle, PluginPageParams } from "./pages";
|
|
3
|
+
export declare const SIDEBAR_GROUPS: Readonly<{
|
|
4
|
+
readonly daily: "daily";
|
|
5
|
+
readonly knowledge: "knowledge";
|
|
6
|
+
readonly learning: "learning";
|
|
7
|
+
readonly ai: "ai";
|
|
8
|
+
readonly sharing: "sharing";
|
|
9
|
+
readonly plugins: "plugins";
|
|
10
|
+
}>;
|
|
11
|
+
export interface PluginSidebarGroupDefinition {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PluginSidebarGroupHandle extends Disposable {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
}
|
|
18
|
+
export interface PluginSidebarItemDefinition {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
/** 缺省或分组不存在时归入默认插件分组。 */
|
|
22
|
+
group?: string;
|
|
23
|
+
page: PluginPageHandle;
|
|
24
|
+
params?: PluginPageParams;
|
|
25
|
+
}
|
|
26
|
+
export interface PluginSidebar {
|
|
27
|
+
registerGroup(definition: PluginSidebarGroupDefinition): PluginSidebarGroupHandle;
|
|
28
|
+
registerItem(definition: PluginSidebarItemDefinition): Disposable;
|
|
29
|
+
}
|