siyuan 0.3.17 → 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 +3 -2
- package/siyuan.d.ts +53 -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,27 +66,30 @@ 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
|
|
85
|
+
export const createLogger: (name: string) => import("zhi-log").DefaultLogger;
|
|
79
86
|
}
|
|
80
87
|
|
|
81
88
|
declare module 'siyuan/internal/classes/menu' {
|
|
82
89
|
export interface IMenuItemOption {
|
|
83
90
|
label?: string;
|
|
84
91
|
click?: (element: HTMLElement) => void;
|
|
85
|
-
type?:
|
|
92
|
+
type?: 'separator' | 'submenu' | 'readonly';
|
|
86
93
|
accelerator?: string;
|
|
87
94
|
action?: string;
|
|
88
95
|
id?: string;
|
|
@@ -128,18 +135,28 @@ declare module 'siyuan/internal/classes/dialog' {
|
|
|
128
135
|
disableClose?: boolean;
|
|
129
136
|
disableAnimation?: boolean;
|
|
130
137
|
});
|
|
138
|
+
static destroyAll(): void;
|
|
131
139
|
destroy(): void;
|
|
132
140
|
bindInput(inputElement: HTMLInputElement | HTMLTextAreaElement, enterEvent?: () => void): void;
|
|
133
141
|
}
|
|
134
142
|
}
|
|
135
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
|
+
|
|
136
152
|
declare module 'siyuan/api/plugin' {
|
|
137
|
-
import { IPlugin, IPluginCommand } from
|
|
153
|
+
import { IPlugin, IPluginCommand, SettingRender } from 'siyuan/types';
|
|
138
154
|
export class Plugin implements IPlugin {
|
|
139
155
|
_id: string;
|
|
140
156
|
onload(): void;
|
|
141
157
|
onunload(): void;
|
|
142
158
|
registerCommand(command: IPluginCommand): void;
|
|
159
|
+
registerSettingRender(settingRender: SettingRender): void;
|
|
143
160
|
loadStorage(filename: string): Promise<any>;
|
|
144
161
|
writeStorage(filename: string, content: any): Promise<void>;
|
|
145
162
|
}
|
|
@@ -150,6 +167,7 @@ declare module 'siyuan/types' {
|
|
|
150
167
|
onload(): void;
|
|
151
168
|
onunload(): void;
|
|
152
169
|
registerCommand(command: IPluginCommand): any;
|
|
170
|
+
registerSettingRender(settingRender: SettingRender): any;
|
|
153
171
|
loadStorage(filename: string): Promise<Response>;
|
|
154
172
|
writeStorage(filename: string, content: any): Promise<void>;
|
|
155
173
|
}
|
|
@@ -162,6 +180,7 @@ declare module 'siyuan/types' {
|
|
|
162
180
|
description: string;
|
|
163
181
|
author: string;
|
|
164
182
|
version: string;
|
|
183
|
+
url: string;
|
|
165
184
|
}
|
|
166
185
|
export interface StorePluginStatus extends StorePluginManifest {
|
|
167
186
|
isExist: boolean;
|
|
@@ -175,6 +194,8 @@ declare module 'siyuan/types' {
|
|
|
175
194
|
enabled?: boolean;
|
|
176
195
|
hidden?: boolean;
|
|
177
196
|
description?: string;
|
|
197
|
+
url?: string;
|
|
198
|
+
author?: string;
|
|
178
199
|
plugin?: new (...args: any) => IPlugin;
|
|
179
200
|
}
|
|
180
201
|
export interface IStorageManager {
|
|
@@ -190,10 +211,10 @@ declare module 'siyuan/types' {
|
|
|
190
211
|
setSafeModeEnabled(enabled: boolean): Promise<void>;
|
|
191
212
|
setPluginStorage(pluginKey: string, filename: string, content: any): Promise<void>;
|
|
192
213
|
getPluginStorage(pluginKey: string, filename: string): Promise<Response>;
|
|
214
|
+
uninstallPlugin(key: string): Promise<void>;
|
|
193
215
|
}
|
|
194
216
|
export interface ISystemManager {
|
|
195
217
|
saveToLocal(p: string, content: string): Promise<void>;
|
|
196
|
-
createFile(p: string): Promise<string>;
|
|
197
218
|
localCacheInit(): Promise<void>;
|
|
198
219
|
delayAutoUpgrade(): void;
|
|
199
220
|
tryUpgrade(): Promise<void>;
|
|
@@ -293,5 +314,29 @@ declare module 'siyuan/types' {
|
|
|
293
314
|
message: string;
|
|
294
315
|
timeout?: number;
|
|
295
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
|
+
}
|
|
296
341
|
}
|
|
297
342
|
|