siyuan 0.1.0 → 0.3.12
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/README.md +1 -1
- package/package.json +1 -1
- package/siyuan.d.ts +269 -12
package/README.md
CHANGED
package/package.json
CHANGED
package/siyuan.d.ts
CHANGED
|
@@ -1,12 +1,269 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
// Generated by dts-bundle v0.7.3
|
|
2
|
+
|
|
3
|
+
declare module 'siyuan' {
|
|
4
|
+
import * as serverApi from 'siyuan/api/server-api';
|
|
5
|
+
import * as clientApi from 'siyuan/api/client-api';
|
|
6
|
+
import { Menu } from 'siyuan/internal/classes/menu';
|
|
7
|
+
import { Dialog } from 'siyuan/internal/classes/dialog';
|
|
8
|
+
import { Plugin } from 'siyuan/api/plugin';
|
|
9
|
+
export { clientApi, serverApi, Menu, Dialog, Plugin };
|
|
10
|
+
const _default: {
|
|
11
|
+
clientApi: typeof clientApi;
|
|
12
|
+
serverApi: typeof serverApi;
|
|
13
|
+
Plugin: typeof Plugin;
|
|
14
|
+
Menu: typeof Menu;
|
|
15
|
+
Dialog: typeof Dialog;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare module 'siyuan/api/server-api' {
|
|
21
|
+
export function request(url: any, data: any): Promise<any>;
|
|
22
|
+
export function parseBody(response: any): Promise<any>;
|
|
23
|
+
export function transactions(protyle: any, transactions?: any[]): Promise<any>;
|
|
24
|
+
export function sql(sql: any): Promise<any>;
|
|
25
|
+
export function lsNotebooks(sql: any): Promise<any>;
|
|
26
|
+
export function getAnchor(anchorText: any, name: any): Promise<string>;
|
|
27
|
+
export function openNotebook(notebookId: any): Promise<any>;
|
|
28
|
+
export function closeNotebook(notebookId: any): Promise<any>;
|
|
29
|
+
export function renameNotebook(notebookId: any, notebookNewName: any): Promise<any>;
|
|
30
|
+
export function createNotebook(notebookName: any): Promise<any>;
|
|
31
|
+
export function removeNotebook(notebookId: any): Promise<any>;
|
|
32
|
+
export function getNotebookConf(notebookId: any): Promise<any>;
|
|
33
|
+
export function setNotebookConf(notebookId: any): Promise<any>;
|
|
34
|
+
export function renameDoc(notebookId: any, path: any, title: any): Promise<any>;
|
|
35
|
+
export function removeDoc(notebookId: any, path: any): Promise<any>;
|
|
36
|
+
export function moveDoc(srcNotebookId: any, srcPath: any, targetNotebookId: any, targetPath: any): Promise<any>;
|
|
37
|
+
export function getHPathByPath(notebookId: any, path: any): Promise<any>;
|
|
38
|
+
export function getHPathByID(ID: any): Promise<any>;
|
|
39
|
+
export function getBlockAttrs(blockId: any): Promise<any>;
|
|
40
|
+
export function getBlockByID(blockId: any): Promise<any>;
|
|
41
|
+
export function getBlockKramdown(blockId: any): Promise<any>;
|
|
42
|
+
export function getBlockBreadcrumb(ID: any): Promise<any>;
|
|
43
|
+
export function setBlockAttrs(blockId: any, attrs: any): Promise<any>;
|
|
44
|
+
export function exportMdContent(docId: any): Promise<any>;
|
|
45
|
+
export function getDocOutline(docId: any): Promise<any>;
|
|
46
|
+
export function listDocsByPath(path: any): Promise<any>;
|
|
47
|
+
export function getBacklink(id: any): Promise<any>;
|
|
48
|
+
export function searchEmbedBlock(excludeIds: any, sql: any): Promise<any>;
|
|
49
|
+
export function getDoc(id: any): Promise<any>;
|
|
50
|
+
export function getFocusedDoc(id: any): Promise<any>;
|
|
51
|
+
export function getTag(): Promise<any>;
|
|
52
|
+
export function getLocalGraph(k: any, id: any, conf: any, reqId: any): Promise<any>;
|
|
53
|
+
export function getGraph(k: any, conf: any, reqId: any): Promise<any>;
|
|
54
|
+
export function searchDocs(k: any): Promise<any>;
|
|
55
|
+
export function searchBlock(query: any): Promise<any>;
|
|
56
|
+
export function searchTemplate(k: any): Promise<any>;
|
|
57
|
+
export function createDocWithMd(notebook: any, path: any, markdown: any): Promise<any>;
|
|
58
|
+
export function docSaveAsTemplate(id: any, overwrite?: boolean): Promise<any>;
|
|
59
|
+
export function render(data: any): Promise<any>;
|
|
60
|
+
export function insertBlock(previousID: any, dataType: any, data: any): Promise<any>;
|
|
61
|
+
export function prependBlock(parentID: any, dataType: any, data: any): Promise<any>;
|
|
62
|
+
export function appendBlock(parentID: any, dataType: any, data: any): Promise<any>;
|
|
63
|
+
export function updateBlock(id: any, dataType: any, data: any): Promise<any>;
|
|
64
|
+
export function deleteBlock(id: any): Promise<any>;
|
|
65
|
+
export function getSysFonts(): Promise<any>;
|
|
66
|
+
export function getFile(path: any): Promise<Response>;
|
|
67
|
+
export function putFile(path: any, filedata: any, isDir?: boolean, modTime?: number): Promise<any>;
|
|
68
|
+
export function pushMsg(message?: any, text?: any, timeout?: number): Promise<any>;
|
|
69
|
+
export function pushErrMsg(message?: any, text?: any, timeout?: number): Promise<any>;
|
|
70
|
+
export function setStorageVal(key: string, val: any): Promise<any>;
|
|
71
|
+
export function getLocalStorage(): Promise<any>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare module 'siyuan/api/client-api' {
|
|
75
|
+
import { ISettingTab } from "siyuan/types";
|
|
76
|
+
export function addToolbarLeft(el: Element): void;
|
|
77
|
+
export function addToolbarRight(el: Element): void;
|
|
78
|
+
export function addSettingTab(settingTab: ISettingTab): void;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare module 'siyuan/internal/classes/menu' {
|
|
82
|
+
export interface IMenuItemOption {
|
|
83
|
+
label?: string;
|
|
84
|
+
click?: (element: HTMLElement) => void;
|
|
85
|
+
type?: "separator" | "submenu" | "readonly";
|
|
86
|
+
accelerator?: string;
|
|
87
|
+
action?: string;
|
|
88
|
+
id?: string;
|
|
89
|
+
submenu?: IMenuItemOption[];
|
|
90
|
+
disabled?: boolean;
|
|
91
|
+
icon?: string;
|
|
92
|
+
iconHTML?: string;
|
|
93
|
+
current?: boolean;
|
|
94
|
+
bind?: (element: HTMLElement) => void;
|
|
95
|
+
}
|
|
96
|
+
export class Menu {
|
|
97
|
+
constructor(id: string);
|
|
98
|
+
addItem(item: MenuItem): this;
|
|
99
|
+
addSeparator(): this;
|
|
100
|
+
showAtMouseEvent(event: MouseEvent): this;
|
|
101
|
+
showAtPosition(position: {
|
|
102
|
+
x: number;
|
|
103
|
+
y: number;
|
|
104
|
+
}): this;
|
|
105
|
+
close(): void;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Copy from siyuan source code
|
|
109
|
+
*/
|
|
110
|
+
export class MenuItem {
|
|
111
|
+
element: HTMLElement;
|
|
112
|
+
constructor(options: IMenuItemOption);
|
|
113
|
+
}
|
|
114
|
+
export class MenuSeparator {
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare module 'siyuan/internal/classes/dialog' {
|
|
119
|
+
export class Dialog {
|
|
120
|
+
element: HTMLElement;
|
|
121
|
+
constructor(options: {
|
|
122
|
+
title?: string;
|
|
123
|
+
transparent?: boolean;
|
|
124
|
+
content: string;
|
|
125
|
+
width?: string;
|
|
126
|
+
height?: string;
|
|
127
|
+
destroyCallback?: () => void;
|
|
128
|
+
disableClose?: boolean;
|
|
129
|
+
disableAnimation?: boolean;
|
|
130
|
+
});
|
|
131
|
+
destroy(): void;
|
|
132
|
+
bindInput(inputElement: HTMLInputElement | HTMLTextAreaElement, enterEvent?: () => void): void;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare module 'siyuan/api/plugin' {
|
|
137
|
+
import { IPlugin, IPluginCommand } from "siyuan/types";
|
|
138
|
+
export class Plugin implements IPlugin {
|
|
139
|
+
_id: string;
|
|
140
|
+
onload(): void;
|
|
141
|
+
onunload(): void;
|
|
142
|
+
registerCommand(command: IPluginCommand): void;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
declare module 'siyuan/types' {
|
|
147
|
+
export interface IPlugin {
|
|
148
|
+
onload(): void;
|
|
149
|
+
onunload(): void;
|
|
150
|
+
}
|
|
151
|
+
export interface PluginConstructor {
|
|
152
|
+
new (): IPlugin;
|
|
153
|
+
}
|
|
154
|
+
export interface PluginManifest {
|
|
155
|
+
key: string;
|
|
156
|
+
name: string;
|
|
157
|
+
script?: string;
|
|
158
|
+
enabled?: boolean;
|
|
159
|
+
hidden?: boolean;
|
|
160
|
+
description?: string;
|
|
161
|
+
plugin?: new (...args: any) => IPlugin;
|
|
162
|
+
}
|
|
163
|
+
export interface IStorageManager {
|
|
164
|
+
get(key: string): any;
|
|
165
|
+
set(key: string, val: any): Promise<void>;
|
|
166
|
+
initStorage(): Promise<IStorageManager>;
|
|
167
|
+
getPlugins(): PluginManifest[];
|
|
168
|
+
getInternalPlugins(): PluginManifest[];
|
|
169
|
+
getThirdPartyPlugins(): PluginManifest[];
|
|
170
|
+
getPluginByKey(key: string): PluginManifest | undefined;
|
|
171
|
+
setPluginEnabled(key: string, enabled: boolean): Promise<void>;
|
|
172
|
+
savePluginsEnabled(): Promise<void>;
|
|
173
|
+
setSafeModeEnabled(enabled: boolean): Promise<void>;
|
|
174
|
+
}
|
|
175
|
+
export interface ISystemManager {
|
|
176
|
+
saveToLocal(p: string, content: string): Promise<void>;
|
|
177
|
+
createFile(p: string): Promise<string>;
|
|
178
|
+
localCacheInit(): Promise<void>;
|
|
179
|
+
delayAutoUpgrade(): void;
|
|
180
|
+
tryUpgrade(): Promise<void>;
|
|
181
|
+
getOnlineVersion(): Promise<string>;
|
|
182
|
+
upgrade(): Promise<void>;
|
|
183
|
+
}
|
|
184
|
+
export interface IPluginSystem {
|
|
185
|
+
init(): Promise<IPluginSystem>;
|
|
186
|
+
loadPlugin(key: string): Promise<void>;
|
|
187
|
+
unloadPlugin(key: string): Promise<void>;
|
|
188
|
+
turnOffSafeMode(): Promise<void>;
|
|
189
|
+
turnOnSafeMode(): Promise<void>;
|
|
190
|
+
}
|
|
191
|
+
export interface IPluginLoader {
|
|
192
|
+
loadEnabledPlugins(plugins: PluginManifest[]): Promise<void>;
|
|
193
|
+
loadAllInternalPlugins(): Promise<void>;
|
|
194
|
+
loadAllLocalPlugins(): Promise<void>;
|
|
195
|
+
loadPlugin(plugin: PluginManifest): Promise<void>;
|
|
196
|
+
unloadPlugin(key: string): Promise<void>;
|
|
197
|
+
generateRequiredModules(): void;
|
|
198
|
+
unloadThirdPartyPlugins(plugins: PluginManifest[]): Promise<void>;
|
|
199
|
+
loadThirdPartyEnabledPlugins(plugins: PluginManifest[]): Promise<void>;
|
|
200
|
+
}
|
|
201
|
+
export interface IPluginFileManager {
|
|
202
|
+
scanPlugins(pluginFolder: string): Promise<string[]>;
|
|
203
|
+
getFileContent(f: string): Promise<string>;
|
|
204
|
+
getManifest(f: string): Promise<any>;
|
|
205
|
+
getScript(f: string): Promise<string>;
|
|
206
|
+
getAllPlugins(): Promise<PluginManifest[]>;
|
|
207
|
+
}
|
|
208
|
+
export interface ISettingTab {
|
|
209
|
+
key: string;
|
|
210
|
+
name: string;
|
|
211
|
+
settings: ISetting[];
|
|
212
|
+
}
|
|
213
|
+
export interface ISetting<T extends ISettingType = any> {
|
|
214
|
+
key: string;
|
|
215
|
+
name: string;
|
|
216
|
+
type: T;
|
|
217
|
+
value: T extends 'boolean' ? boolean : T extends 'string' ? string : T extends 'array' ? Array<any> : T extends 'number' ? number : any;
|
|
218
|
+
}
|
|
219
|
+
export enum ISettingType {
|
|
220
|
+
BOOLEAN = "boolean",
|
|
221
|
+
STRING = "string",
|
|
222
|
+
ARRAY = "array",
|
|
223
|
+
NUMBER = "number"
|
|
224
|
+
}
|
|
225
|
+
export interface PluginEnableConfig {
|
|
226
|
+
key: string;
|
|
227
|
+
enabled: boolean;
|
|
228
|
+
}
|
|
229
|
+
export interface PluginConfig {
|
|
230
|
+
PLUGIN_SYSTEM_SAFE_MODE_ENABLED: boolean;
|
|
231
|
+
PLUGIN_SYSTEM_AUTO_UPDATE: boolean;
|
|
232
|
+
PLUGIN_SYSTEM_PLUGIN: Array<PluginEnableConfig>;
|
|
233
|
+
PLUGIN_SYSTEM_THIRD_PARTY_PLUGIN: Array<PluginEnableConfig>;
|
|
234
|
+
}
|
|
235
|
+
export type Listener = (...args: any) => void;
|
|
236
|
+
export interface IEventBus {
|
|
237
|
+
on(eventName: string, callback: Listener): () => void;
|
|
238
|
+
off(eventName: string, callback?: Listener): void;
|
|
239
|
+
emit(eventName: string, ...args: any): void;
|
|
240
|
+
destroy(): void;
|
|
241
|
+
}
|
|
242
|
+
export interface Command {
|
|
243
|
+
plugin: string;
|
|
244
|
+
pluginName: string;
|
|
245
|
+
command: string;
|
|
246
|
+
shortcut?: string;
|
|
247
|
+
description?: string;
|
|
248
|
+
callback: (...args: any[]) => any;
|
|
249
|
+
}
|
|
250
|
+
export interface IPluginCommand {
|
|
251
|
+
command: string;
|
|
252
|
+
shortcut?: string;
|
|
253
|
+
description?: string;
|
|
254
|
+
callback: (...args: any[]) => any;
|
|
255
|
+
}
|
|
256
|
+
export interface ICommandManager {
|
|
257
|
+
registerCommand(command: Command): any;
|
|
258
|
+
unregisterCommand(command: Command): any;
|
|
259
|
+
unregisterCommandByPlugin(plugin: string): any;
|
|
260
|
+
getCommands(): Command[];
|
|
261
|
+
}
|
|
262
|
+
export interface IShortcut {
|
|
263
|
+
registerKeyboardEvent(shortcut: string, callback: (e: KeyboardEvent) => void): any;
|
|
264
|
+
unregisterKeyboardEvent(shortcut: string): any;
|
|
265
|
+
registerKeyboardEventFromPlugin(command: Command): any;
|
|
266
|
+
unregisterKeyboardEventFromPlugin(command: Command): any;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|