siyuan 0.3.18 → 0.6.1
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 +2 -2
- package/siyuan.d.ts +52 -8
package/package.json
CHANGED
package/siyuan.d.ts
CHANGED
|
@@ -3,15 +3,19 @@
|
|
|
3
3
|
declare module 'siyuan' {
|
|
4
4
|
import * as serverApi from 'siyuan/api/server-api';
|
|
5
5
|
import * as clientApi from 'siyuan/api/client-api';
|
|
6
|
-
import { Menu } from 'siyuan/internal/classes/menu';
|
|
6
|
+
import { Menu, MenuItem, MenuSeparator } from 'siyuan/internal/classes/menu';
|
|
7
7
|
import { Dialog } from 'siyuan/internal/classes/dialog';
|
|
8
|
+
import { Notification } from 'siyuan/internal/classes/notification';
|
|
8
9
|
import { Plugin } from 'siyuan/api/plugin';
|
|
9
|
-
export { clientApi, serverApi, Menu, Dialog, Plugin };
|
|
10
|
+
export { clientApi, serverApi, Menu, MenuItem, MenuSeparator, Notification, Dialog, Plugin };
|
|
10
11
|
const _default: {
|
|
11
12
|
clientApi: typeof clientApi;
|
|
12
13
|
serverApi: typeof serverApi;
|
|
13
14
|
Plugin: typeof Plugin;
|
|
14
15
|
Menu: typeof Menu;
|
|
16
|
+
MenuItem: typeof MenuItem;
|
|
17
|
+
MenuSeparator: typeof MenuSeparator;
|
|
18
|
+
Notification: typeof Notification;
|
|
15
19
|
Dialog: typeof Dialog;
|
|
16
20
|
};
|
|
17
21
|
export default _default;
|
|
@@ -62,20 +66,22 @@ declare module 'siyuan/api/server-api' {
|
|
|
62
66
|
export function appendBlock(parentID: any, dataType: any, data: any): Promise<any>;
|
|
63
67
|
export function updateBlock(id: any, dataType: any, data: any): Promise<any>;
|
|
64
68
|
export function deleteBlock(id: any): Promise<any>;
|
|
69
|
+
export function moveBlock(id: string, previousID: string, parentID: string): Promise<any>;
|
|
65
70
|
export function getSysFonts(): Promise<any>;
|
|
66
|
-
export function getFile(path:
|
|
71
|
+
export function getFile(path: string, type?: 'json' | 'text'): Promise<any>;
|
|
67
72
|
export function putFile(path: any, filedata: any, isDir?: boolean, modTime?: number): Promise<any>;
|
|
73
|
+
export function readDir(path: string): Promise<any>;
|
|
74
|
+
export function removeFile(path: any): Promise<any>;
|
|
68
75
|
export function pushMsg(message?: any, text?: any, timeout?: number): Promise<any>;
|
|
69
76
|
export function pushErrMsg(message?: any, text?: any, timeout?: number): Promise<any>;
|
|
70
77
|
export function setStorageVal(key: string, val: any): Promise<any>;
|
|
71
78
|
export function getLocalStorage(): Promise<any>;
|
|
79
|
+
export function renderSprig(template: string): Promise<any>;
|
|
72
80
|
}
|
|
73
81
|
|
|
74
82
|
declare module 'siyuan/api/client-api' {
|
|
75
|
-
import { ISettingTab } from "siyuan/types";
|
|
76
83
|
export function addToolbarLeft(el: Element): void;
|
|
77
84
|
export function addToolbarRight(el: Element): void;
|
|
78
|
-
export function addSettingTab(settingTab: ISettingTab): void;
|
|
79
85
|
export const createLogger: (name: string) => import("zhi-log").DefaultLogger;
|
|
80
86
|
}
|
|
81
87
|
|
|
@@ -83,7 +89,7 @@ declare module 'siyuan/internal/classes/menu' {
|
|
|
83
89
|
export interface IMenuItemOption {
|
|
84
90
|
label?: string;
|
|
85
91
|
click?: (element: HTMLElement) => void;
|
|
86
|
-
type?:
|
|
92
|
+
type?: 'separator' | 'submenu' | 'readonly';
|
|
87
93
|
accelerator?: string;
|
|
88
94
|
action?: string;
|
|
89
95
|
id?: string;
|
|
@@ -129,18 +135,28 @@ declare module 'siyuan/internal/classes/dialog' {
|
|
|
129
135
|
disableClose?: boolean;
|
|
130
136
|
disableAnimation?: boolean;
|
|
131
137
|
});
|
|
138
|
+
static destroyAll(): void;
|
|
132
139
|
destroy(): void;
|
|
133
140
|
bindInput(inputElement: HTMLInputElement | HTMLTextAreaElement, enterEvent?: () => void): void;
|
|
134
141
|
}
|
|
135
142
|
}
|
|
136
143
|
|
|
144
|
+
declare module 'siyuan/internal/classes/notification' {
|
|
145
|
+
import { INoticationOption, INotification } from 'siyuan/types';
|
|
146
|
+
export class Notification implements INotification {
|
|
147
|
+
constructor(option: INoticationOption);
|
|
148
|
+
show(): void;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
137
152
|
declare module 'siyuan/api/plugin' {
|
|
138
|
-
import { IPlugin, IPluginCommand } from
|
|
153
|
+
import { IPlugin, IPluginCommand, SettingRender } from 'siyuan/types';
|
|
139
154
|
export class Plugin implements IPlugin {
|
|
140
155
|
_id: string;
|
|
141
156
|
onload(): void;
|
|
142
157
|
onunload(): void;
|
|
143
158
|
registerCommand(command: IPluginCommand): void;
|
|
159
|
+
registerSettingRender(settingRender: SettingRender): void;
|
|
144
160
|
loadStorage(filename: string): Promise<any>;
|
|
145
161
|
writeStorage(filename: string, content: any): Promise<void>;
|
|
146
162
|
}
|
|
@@ -151,6 +167,7 @@ declare module 'siyuan/types' {
|
|
|
151
167
|
onload(): void;
|
|
152
168
|
onunload(): void;
|
|
153
169
|
registerCommand(command: IPluginCommand): any;
|
|
170
|
+
registerSettingRender(settingRender: SettingRender): any;
|
|
154
171
|
loadStorage(filename: string): Promise<Response>;
|
|
155
172
|
writeStorage(filename: string, content: any): Promise<void>;
|
|
156
173
|
}
|
|
@@ -163,6 +180,7 @@ declare module 'siyuan/types' {
|
|
|
163
180
|
description: string;
|
|
164
181
|
author: string;
|
|
165
182
|
version: string;
|
|
183
|
+
url: string;
|
|
166
184
|
}
|
|
167
185
|
export interface StorePluginStatus extends StorePluginManifest {
|
|
168
186
|
isExist: boolean;
|
|
@@ -176,6 +194,8 @@ declare module 'siyuan/types' {
|
|
|
176
194
|
enabled?: boolean;
|
|
177
195
|
hidden?: boolean;
|
|
178
196
|
description?: string;
|
|
197
|
+
url?: string;
|
|
198
|
+
author?: string;
|
|
179
199
|
plugin?: new (...args: any) => IPlugin;
|
|
180
200
|
}
|
|
181
201
|
export interface IStorageManager {
|
|
@@ -191,10 +211,10 @@ declare module 'siyuan/types' {
|
|
|
191
211
|
setSafeModeEnabled(enabled: boolean): Promise<void>;
|
|
192
212
|
setPluginStorage(pluginKey: string, filename: string, content: any): Promise<void>;
|
|
193
213
|
getPluginStorage(pluginKey: string, filename: string): Promise<Response>;
|
|
214
|
+
uninstallPlugin(key: string): Promise<void>;
|
|
194
215
|
}
|
|
195
216
|
export interface ISystemManager {
|
|
196
217
|
saveToLocal(p: string, content: string): Promise<void>;
|
|
197
|
-
createFile(p: string): Promise<string>;
|
|
198
218
|
localCacheInit(): Promise<void>;
|
|
199
219
|
delayAutoUpgrade(): void;
|
|
200
220
|
tryUpgrade(): Promise<void>;
|
|
@@ -294,5 +314,29 @@ declare module 'siyuan/types' {
|
|
|
294
314
|
message: string;
|
|
295
315
|
timeout?: number;
|
|
296
316
|
}
|
|
317
|
+
export interface IStore {
|
|
318
|
+
init(): Promise<void>;
|
|
319
|
+
getStoreUrl(): string;
|
|
320
|
+
getPlugins(): StorePluginManifest[];
|
|
321
|
+
loadPlugins(): Promise<StorePluginManifest[]>;
|
|
322
|
+
getPluginsWithStatus(): StorePluginManifest[];
|
|
323
|
+
loadPluginsFromUrl(): Promise<void>;
|
|
324
|
+
getPluginByUrl(url: string): Promise<{
|
|
325
|
+
manifest: string;
|
|
326
|
+
mainJs: string;
|
|
327
|
+
}>;
|
|
328
|
+
getPluginManifest(url: string): Promise<PluginManifest>;
|
|
329
|
+
getPluginReadme(url: string): Promise<string>;
|
|
330
|
+
downloadPlugin(key: string): Promise<any>;
|
|
331
|
+
}
|
|
332
|
+
export type SettingRender = (element: HTMLElement) => void;
|
|
333
|
+
export interface ISettingManager {
|
|
334
|
+
registerSetting(key: string, settingRender: SettingRender): void;
|
|
335
|
+
unregisterSetting(key: string): void;
|
|
336
|
+
getSettingRenders(): Array<{
|
|
337
|
+
key: string;
|
|
338
|
+
value: SettingRender;
|
|
339
|
+
}>;
|
|
340
|
+
}
|
|
297
341
|
}
|
|
298
342
|
|