siyuan 0.3.18 → 0.7.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/siyuan.d.ts +53 -8
package/package.json CHANGED
@@ -2,6 +2,6 @@
2
2
  "name": "siyuan",
3
3
  "author": "zuoez02",
4
4
  "types": "siyuan.d.ts",
5
- "version": "0.3.18",
5
+ "version": "0.7.0",
6
6
  "repository": "https://github.com/zuoez02/siyuan-package"
7
- }
7
+ }
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,23 @@ 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: any): Promise<Response>;
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>;
80
+ export function getBazzarWidget(): Promise<any>;
72
81
  }
73
82
 
74
83
  declare module 'siyuan/api/client-api' {
75
- import { ISettingTab } from "siyuan/types";
76
84
  export function addToolbarLeft(el: Element): void;
77
85
  export function addToolbarRight(el: Element): void;
78
- export function addSettingTab(settingTab: ISettingTab): void;
79
86
  export const createLogger: (name: string) => import("zhi-log").DefaultLogger;
80
87
  }
81
88
 
@@ -83,7 +90,7 @@ declare module 'siyuan/internal/classes/menu' {
83
90
  export interface IMenuItemOption {
84
91
  label?: string;
85
92
  click?: (element: HTMLElement) => void;
86
- type?: "separator" | "submenu" | "readonly";
93
+ type?: 'separator' | 'submenu' | 'readonly';
87
94
  accelerator?: string;
88
95
  action?: string;
89
96
  id?: string;
@@ -129,18 +136,28 @@ declare module 'siyuan/internal/classes/dialog' {
129
136
  disableClose?: boolean;
130
137
  disableAnimation?: boolean;
131
138
  });
139
+ static destroyAll(): void;
132
140
  destroy(): void;
133
141
  bindInput(inputElement: HTMLInputElement | HTMLTextAreaElement, enterEvent?: () => void): void;
134
142
  }
135
143
  }
136
144
 
145
+ declare module 'siyuan/internal/classes/notification' {
146
+ import { INoticationOption, INotification } from 'siyuan/types';
147
+ export class Notification implements INotification {
148
+ constructor(option: INoticationOption);
149
+ show(): void;
150
+ }
151
+ }
152
+
137
153
  declare module 'siyuan/api/plugin' {
138
- import { IPlugin, IPluginCommand } from "siyuan/types";
154
+ import { IPlugin, IPluginCommand, SettingRender } from 'siyuan/types';
139
155
  export class Plugin implements IPlugin {
140
156
  _id: string;
141
157
  onload(): void;
142
158
  onunload(): void;
143
159
  registerCommand(command: IPluginCommand): void;
160
+ registerSettingRender(settingRender: SettingRender): void;
144
161
  loadStorage(filename: string): Promise<any>;
145
162
  writeStorage(filename: string, content: any): Promise<void>;
146
163
  }
@@ -151,6 +168,7 @@ declare module 'siyuan/types' {
151
168
  onload(): void;
152
169
  onunload(): void;
153
170
  registerCommand(command: IPluginCommand): any;
171
+ registerSettingRender(settingRender: SettingRender): any;
154
172
  loadStorage(filename: string): Promise<Response>;
155
173
  writeStorage(filename: string, content: any): Promise<void>;
156
174
  }
@@ -163,6 +181,7 @@ declare module 'siyuan/types' {
163
181
  description: string;
164
182
  author: string;
165
183
  version: string;
184
+ url: string;
166
185
  }
167
186
  export interface StorePluginStatus extends StorePluginManifest {
168
187
  isExist: boolean;
@@ -176,6 +195,8 @@ declare module 'siyuan/types' {
176
195
  enabled?: boolean;
177
196
  hidden?: boolean;
178
197
  description?: string;
198
+ url?: string;
199
+ author?: string;
179
200
  plugin?: new (...args: any) => IPlugin;
180
201
  }
181
202
  export interface IStorageManager {
@@ -191,10 +212,10 @@ declare module 'siyuan/types' {
191
212
  setSafeModeEnabled(enabled: boolean): Promise<void>;
192
213
  setPluginStorage(pluginKey: string, filename: string, content: any): Promise<void>;
193
214
  getPluginStorage(pluginKey: string, filename: string): Promise<Response>;
215
+ uninstallPlugin(key: string): Promise<void>;
194
216
  }
195
217
  export interface ISystemManager {
196
218
  saveToLocal(p: string, content: string): Promise<void>;
197
- createFile(p: string): Promise<string>;
198
219
  localCacheInit(): Promise<void>;
199
220
  delayAutoUpgrade(): void;
200
221
  tryUpgrade(): Promise<void>;
@@ -294,5 +315,29 @@ declare module 'siyuan/types' {
294
315
  message: string;
295
316
  timeout?: number;
296
317
  }
318
+ export interface IStore {
319
+ init(): Promise<void>;
320
+ getStoreUrl(): string;
321
+ getPlugins(): StorePluginManifest[];
322
+ loadPlugins(): Promise<StorePluginManifest[]>;
323
+ getPluginsWithStatus(): StorePluginManifest[];
324
+ loadPluginsFromUrl(): Promise<void>;
325
+ getPluginByUrl(url: string): Promise<{
326
+ manifest: string;
327
+ mainJs: string;
328
+ }>;
329
+ getPluginManifest(url: string): Promise<PluginManifest>;
330
+ getPluginReadme(url: string): Promise<string>;
331
+ downloadPlugin(key: string): Promise<any>;
332
+ }
333
+ export type SettingRender = (element: HTMLElement) => void;
334
+ export interface ISettingManager {
335
+ registerSetting(key: string, settingRender: SettingRender): void;
336
+ unregisterSetting(key: string): void;
337
+ getSettingRenders(): Array<{
338
+ key: string;
339
+ value: SettingRender;
340
+ }>;
341
+ }
297
342
  }
298
343