siyuan 0.8.7 → 0.8.8

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/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Changelog
2
2
 
3
- ## 0.8.8 2023-10
3
+ ## 0.8.9 2023-11
4
+
5
+
6
+ ## 0.8.8 2023-10-31
7
+
8
+ * [Export `Constants` to plugin](https://github.com/siyuan-note/siyuan/issues/9555)
9
+ * [Add plugin `app.appId`](https://github.com/siyuan-note/siyuan/issues/9538)
10
+ * [Add plugin event bus `switch-protyle`](https://github.com/siyuan-note/siyuan/issues/9454)
4
11
 
5
12
  ## 0.8.7 2023-10-24
6
13
 
package/package.json CHANGED
@@ -12,6 +12,6 @@
12
12
  "README.md",
13
13
  "siyuan.d.ts"
14
14
  ],
15
- "version": "0.8.7",
15
+ "version": "0.8.8",
16
16
  "repository": "https://github.com/siyuan-note/petal"
17
17
  }
package/siyuan.d.ts CHANGED
@@ -77,6 +77,39 @@ export interface Global {
77
77
  Lute: Lute;
78
78
  }
79
79
 
80
+ interface IKeymapItem {
81
+ default: string,
82
+ custom: string
83
+ }
84
+
85
+ export interface IKeymap {
86
+ plugin: {
87
+ [key: string]: {
88
+ [key: string]: IKeymapItem
89
+ }
90
+ }
91
+ general: {
92
+ [key: string]: IKeymapItem
93
+ }
94
+ editor: {
95
+ general: {
96
+ [key: string]: IKeymapItem
97
+ }
98
+ insert: {
99
+ [key: string]: IKeymapItem
100
+ }
101
+ heading: {
102
+ [key: string]: IKeymapItem
103
+ }
104
+ list: {
105
+ [key: string]: IKeymapItem
106
+ }
107
+ table: {
108
+ [key: string]: IKeymapItem
109
+ }
110
+ }
111
+ }
112
+
80
113
  export interface IEventBusMap {
81
114
  "click-blockicon": {
82
115
  menu: EventMenu,
@@ -110,6 +143,9 @@ export interface IEventBusMap {
110
143
  "loaded-protyle-static": {
111
144
  protyle: IProtyle,
112
145
  };
146
+ "switch-protyle": {
147
+ protyle: IProtyle,
148
+ };
113
149
  "open-menu-av": IMenuBaseDetail & { selectRowElements: HTMLElement[] };
114
150
  "open-menu-blockref": IMenuBaseDetail;
115
151
  "open-menu-breadcrumbmore": {
@@ -431,6 +467,7 @@ export function showMessage(text: string, timeout?: number, type?: "info" | "err
431
467
 
432
468
  export class App {
433
469
  plugins: Plugin[];
470
+ appId: string
434
471
  }
435
472
 
436
473
  export abstract class Plugin {
@@ -0,0 +1,571 @@
1
+ import {IObject, IKeymap} from "../siyuan";
2
+
3
+ export abstract class Constants {
4
+ public static readonly SIYUAN_VERSION: string;
5
+ public static readonly NODE_ENV: string;
6
+ public static readonly SIYUAN_APPID: string = Math.random().toString(36).substring(8);
7
+
8
+ // 服务器地址
9
+ public static readonly ASSETS_ADDRESS: string = "https://assets.b3logfile.com/siyuan/";
10
+ public static readonly PROTYLE_CDN: string = "/stage/protyle";
11
+ public static readonly UPLOAD_ADDRESS: string = "/upload";
12
+ public static readonly SERVICE_WORKER_PATH: string = "/service-worker.js";
13
+
14
+ // drop 事件
15
+ public static readonly SIYUAN_DROP_FILE: string = "application/siyuan-file";
16
+ public static readonly SIYUAN_DROP_GUTTER: string = "application/siyuan-gutter";
17
+ public static readonly SIYUAN_DROP_TAB: string = "application/siyuan-tab";
18
+ public static readonly SIYUAN_DROP_EDITOR: string = "application/siyuan-editor";
19
+
20
+ // 渲染进程调主进程
21
+ public static readonly SIYUAN_CMD: string = "siyuan-cmd";
22
+ public static readonly SIYUAN_GET: string = "siyuan-get";
23
+ public static readonly SIYUAN_EVENT: string = "siyuan-event";
24
+
25
+ public static readonly SIYUAN_CONFIG_TRAY: string = "siyuan-config-tray";
26
+ public static readonly SIYUAN_QUIT: string = "siyuan-quit";
27
+ public static readonly SIYUAN_HOTKEY: string = "siyuan-hotkey";
28
+ public static readonly SIYUAN_INIT: string = "siyuan-init";
29
+ public static readonly SIYUAN_SEND_WINDOWS: string = "siyuan-send-windows"; // 主窗口和各新窗口之间的通信,{cmd: "closetab"|"lockscreen"|"lockscreenByMode", data: {}})
30
+ public static readonly SIYUAN_SAVE_CLOSE: string = "siyuan-save-close";
31
+ public static readonly SIYUAN_AUTO_LAUNCH: string = "siyuan-auto-launch";
32
+
33
+ public static readonly SIYUAN_OPEN_WORKSPACE: string = "siyuan-open-workspace";
34
+ public static readonly SIYUAN_OPEN_URL: string = "siyuan-open-url";
35
+ public static readonly SIYUAN_OPEN_WINDOW: string = "siyuan-open-window";
36
+ public static readonly SIYUAN_OPEN_FOLDER: string = "siyuan-open-folder";
37
+ public static readonly SIYUAN_OPEN_FILE: string = "siyuan-open-file";
38
+
39
+ public static readonly SIYUAN_EXPORT_PDF: string = "siyuan-export-pdf";
40
+ public static readonly SIYUAN_EXPORT_NEWWINDOW: string = "siyuan-export-newwindow";
41
+
42
+ // custom
43
+ public static readonly CUSTOM_SY_READONLY: string = "custom-sy-readonly";
44
+ public static readonly CUSTOM_SY_FULLWIDTH: string = "custom-sy-fullwidth";
45
+ public static readonly CUSTOM_REMINDER_WECHAT: string = "custom-reminder-wechat";
46
+ public static readonly CUSTOM_RIFF_DECKS: string = "custom-riff-decks";
47
+
48
+ // size
49
+ public static readonly SIZE_LINK_TEXT_MAX: number = 24;
50
+ public static readonly SIZE_TOOLBAR_HEIGHT: number;
51
+ public static readonly SIZE_GET_MAX = 102400;
52
+ public static readonly SIZE_UNDO = 64;
53
+ public static readonly SIZE_TITLE = 512;
54
+ public static readonly SIZE_EDITOR_WIDTH = 760;
55
+ public static readonly SIZE_ZOOM = [0.25, 0.33, 0.5, 0.67, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3];
56
+
57
+ // ws callback
58
+ public static readonly CB_MOVE_NOLIST = "cb-move-nolist";
59
+ public static readonly CB_MOUNT_REMOVE = "cb-mount-remove";
60
+ public static readonly CB_GET_APPEND = "cb-get-append"; // 向下滚动加载
61
+ public static readonly CB_GET_BEFORE = "cb-get-before"; // 向上滚动加载
62
+ public static readonly CB_GET_UNCHANGEID = "cb-get-unchangeid"; // 上下滚动,定位时不修改 blockid
63
+ public static readonly CB_GET_HL = "cb-get-hl"; // 高亮
64
+ public static readonly CB_GET_FOCUS = "cb-get-focus"; // 光标定位
65
+ public static readonly CB_GET_FOCUSFIRST = "cb-get-focusfirst"; // 动态定位到第一个块
66
+ public static readonly CB_GET_SETID = "cb-get-setid"; // 重置 blockid
67
+ public static readonly CB_GET_ALL = "cb-get-all"; // 获取所有块
68
+ public static readonly CB_GET_BACKLINK = "cb-get-backlink"; // 悬浮窗为传递型需展示上下文
69
+ public static readonly CB_GET_UNUNDO = "cb-get-unundo"; // 不需要记录历史
70
+ public static readonly CB_GET_SCROLL = "cb-get-scroll"; // 滚动到指定位置
71
+ public static readonly CB_GET_CONTEXT = "cb-get-context"; // 包含上下文
72
+ public static readonly CB_GET_ROOTSCROLL = "cb-get-rootscroll"; // 如果为 rootID 就滚动到指定位置
73
+ public static readonly CB_GET_HTML = "cb-get-html"; // 直接渲染,不需要再 /api/block/getDocInfo,否则搜索表格无法定位
74
+ public static readonly CB_GET_HISTORY = "cb-get-history"; // 历史渲染
75
+
76
+ // localstorage
77
+ public static readonly LOCAL_ZOOM = "local-zoom";
78
+ public static readonly LOCAL_SEARCHDATA = "local-searchdata";
79
+ public static readonly LOCAL_SEARCHKEYS = "local-searchkeys";
80
+ public static readonly LOCAL_SEARCHASSET = "local-searchasset";
81
+ public static readonly LOCAL_DOCINFO = "local-docinfo"; // only mobile
82
+ public static readonly LOCAL_DAILYNOTEID = "local-dailynoteid"; // string
83
+ public static readonly LOCAL_HISTORYNOTEID = "local-historynoteid"; // string
84
+ public static readonly LOCAL_CODELANG = "local-codelang"; // string
85
+ public static readonly LOCAL_FONTSTYLES = "local-fontstyles";
86
+ public static readonly LOCAL_EXPORTPDF = "local-exportpdf";
87
+ public static readonly LOCAL_EXPORTWORD = "local-exportword";
88
+ public static readonly LOCAL_EXPORTIMG = "local-exportimg";
89
+ public static readonly LOCAL_BAZAAR = "local-bazaar";
90
+ public static readonly LOCAL_PDFTHEME = "local-pdftheme";
91
+ public static readonly LOCAL_LAYOUTS = "local-layouts";
92
+ public static readonly LOCAL_AI = "local-ai";
93
+ public static readonly LOCAL_PLUGINTOPUNPIN = "local-plugintopunpin";
94
+ public static readonly LOCAL_FLASHCARD = "local-flashcard";
95
+
96
+ // timeout
97
+ public static readonly TIMEOUT_DBLCLICK = 190;
98
+ public static readonly TIMEOUT_INPUT = 256;
99
+ public static readonly TIMEOUT_LOAD = 300;
100
+ public static readonly TIMEOUT_TRANSITION = 300;
101
+ public static readonly TIMEOUT_COUNT = 1000;
102
+
103
+ // id
104
+ public static readonly HELP_PATH = {
105
+ zh_CN: "20210808180117-czj9bvb",
106
+ zh_CHT: "20211226090932-5lcq56f",
107
+ en_US: "20210808180117-6v0mkxr",
108
+ fr_FR: "20210808180117-6v0mkxr",
109
+ };
110
+ public static readonly QUICK_DECK_ID = "20230218211946-2kw8jgx";
111
+
112
+ public static readonly KEYCODELIST: { [key: number]: string } = {
113
+ 8: "⌫",
114
+ 9: "⇥",
115
+ 13: "↩",
116
+ 16: "⇧",
117
+ 17: "⌘",
118
+ 18: "⌥",
119
+ 19: "Pause",
120
+ 20: "CapsLock",
121
+ 27: "Escape",
122
+ 32: " ",
123
+ 33: "PageUp",
124
+ 34: "PageDown",
125
+ 35: "End",
126
+ 36: "Home",
127
+ 37: "←",
128
+ 38: "↑",
129
+ 39: "→",
130
+ 40: "↓",
131
+ 44: "PrintScreen",
132
+ 45: "Insert",
133
+ 46: "⌦",
134
+ 48: "0",
135
+ 49: "1",
136
+ 50: "2",
137
+ 51: "3",
138
+ 52: "4",
139
+ 53: "5",
140
+ 54: "6",
141
+ 55: "7",
142
+ 56: "8",
143
+ 57: "9",
144
+ 65: "A",
145
+ 66: "B",
146
+ 67: "C",
147
+ 68: "D",
148
+ 69: "E",
149
+ 70: "F",
150
+ 71: "G",
151
+ 72: "H",
152
+ 73: "I",
153
+ 74: "J",
154
+ 75: "K",
155
+ 76: "L",
156
+ 77: "M",
157
+ 78: "N",
158
+ 79: "O",
159
+ 80: "P",
160
+ 81: "Q",
161
+ 82: "R",
162
+ 83: "S",
163
+ 84: "T",
164
+ 85: "U",
165
+ 86: "V",
166
+ 87: "W",
167
+ 88: "X",
168
+ 89: "Y",
169
+ 90: "Z",
170
+ 91: "⌘",
171
+ 92: "⌘",
172
+ 93: "ContextMenu",
173
+ 96: "0",
174
+ 97: "1",
175
+ 98: "2",
176
+ 99: "3",
177
+ 100: "4",
178
+ 101: "5",
179
+ 102: "6",
180
+ 103: "7",
181
+ 104: "8",
182
+ 105: "9",
183
+ 106: "*",
184
+ 107: "+",
185
+ 109: "-",
186
+ 110: ".",
187
+ 111: "/",
188
+ 112: "F1",
189
+ 113: "F2",
190
+ 114: "F3",
191
+ 115: "F4",
192
+ 116: "F5",
193
+ 117: "F6",
194
+ 118: "F7",
195
+ 119: "F8",
196
+ 120: "F9",
197
+ 121: "F10",
198
+ 122: "F11",
199
+ 123: "F12",
200
+ 144: "NumLock",
201
+ 145: "ScrollLock",
202
+ 182: "MyComputer",
203
+ 183: "MyCalculator",
204
+ 186: ";",
205
+ 187: "=",
206
+ 188: ",",
207
+ 189: "-",
208
+ 190: ".",
209
+ 191: "/",
210
+ 192: "`",
211
+ 219: "[",
212
+ 220: "\\",
213
+ 221: "]",
214
+ 222: "'",
215
+ };
216
+ // 冲突不使用 "⌘S/Q"
217
+ // "⌘", "⇧", "⌥", "⌃"
218
+ // "⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⌃⇧⇥", "⌃⇥", "⌘⇥", "⇧⌘⇥", "⇧⌘→", "⇧⌘←",
219
+ // "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦" 不可自定义
220
+ public static readonly SIYUAN_KEYMAP: IKeymap = {
221
+ general: {
222
+ mainMenu: {default: "⌥\\", custom: "⌥\\"},
223
+ commandPanel: {default: "⌥⇧P", custom: "⌥⇧P"},
224
+ editReadonly: {default: "⇧⌘G", custom: "⇧⌘G"},
225
+ syncNow: {default: "F9", custom: "F9"},
226
+ enterBack: {default: "⌥←", custom: "⌥←"},
227
+ enter: {default: "⌥→", custom: "⌥→"},
228
+ goForward: {default: "⌘]", custom: "⌘]"},
229
+ goBack: {default: "⌘[", custom: "⌘["},
230
+ newFile: {default: "⌘N", custom: "⌘N"},
231
+ search: {default: "⌘F", custom: "⌘F"},
232
+ globalSearch: {default: "⌘P", custom: "⌘P"},
233
+ stickSearch: {default: "⇧⌘F", custom: "⇧⌘F"},
234
+ replace: {default: "⌘R", custom: "⌘R"},
235
+ closeTab: {default: "⌘W", custom: "⌘W"},
236
+ fileTree: {default: "⌥1", custom: "⌥1"},
237
+ outline: {default: "⌥2", custom: "⌥2"},
238
+ bookmark: {default: "⌥3", custom: "⌥3"},
239
+ tag: {default: "⌥4", custom: "⌥4"},
240
+ dailyNote: {default: "⌥5", custom: "⌥5"},
241
+ inbox: {default: "⌥6", custom: "⌥6"},
242
+ backlinks: {default: "⌥7", custom: "⌥7"},
243
+ graphView: {default: "⌥8", custom: "⌥8"},
244
+ globalGraph: {default: "⌥9", custom: "⌥9"},
245
+ riffCard: {default: "⌥0", custom: "⌥0"},
246
+ config: {default: "⌥P", custom: "⌥P"},
247
+ dataHistory: {default: "⌥H", custom: "⌥H"},
248
+ toggleWin: {default: "⌥M", custom: "⌥M"},
249
+ lockScreen: {default: "⌥N", custom: "⌥N"},
250
+ recentDocs: {default: "⌘E", custom: "⌘E"},
251
+ goToTab1: {default: "⌘1", custom: "⌘1"},
252
+ goToTab2: {default: "⌘2", custom: "⌘2"},
253
+ goToTab3: {default: "⌘3", custom: "⌘3"},
254
+ goToTab4: {default: "⌘4", custom: "⌘4"},
255
+ goToTab5: {default: "⌘5", custom: "⌘5"},
256
+ goToTab6: {default: "⌘6", custom: "⌘6"},
257
+ goToTab7: {default: "⌘7", custom: "⌘7"},
258
+ goToTab8: {default: "⌘8", custom: "⌘8"},
259
+ goToTab9: {default: "⌘9", custom: "⌘9"},
260
+ goToTabNext: {default: "⇧⌘]", custom: "⇧⌘]"},
261
+ goToTabPrev: {default: "⇧⌘[", custom: "⇧⌘["},
262
+ move: {default: "", custom: ""},
263
+ selectOpen1: {default: "", custom: ""},
264
+ toggleDock: {default: "", custom: ""},
265
+ splitLR: {default: "", custom: ""},
266
+ splitMoveR: {default: "", custom: ""},
267
+ splitTB: {default: "", custom: ""},
268
+ splitMoveB: {default: "", custom: ""},
269
+ closeOthers: {default: "", custom: ""},
270
+ closeAll: {default: "", custom: ""},
271
+ closeUnmodified: {default: "", custom: ""},
272
+ closeLeft: {default: "", custom: ""},
273
+ closeRight: {default: "", custom: ""},
274
+ },
275
+ editor: {
276
+ general: {
277
+ duplicate: {default: "⌘D", custom: "⌘D"},
278
+ expandDown: {default: "⌥⇧↓", custom: "⌥⇧↓"},
279
+ expandUp: {default: "⌥⇧↑", custom: "⌥⇧↑"},
280
+ copyPlainText: {default: "", custom: ""},
281
+ copyID: {default: "", custom: ""},
282
+ copyProtocolInMd: {default: "", custom: ""},
283
+ netImg2LocalAsset: {default: "", custom: ""},
284
+ optimizeTypography: {default: "", custom: ""},
285
+ hLayout: {default: "", custom: ""},
286
+ vLayout: {default: "", custom: ""},
287
+ refPopover: {default: "", custom: ""},
288
+ copyText: {default: "", custom: ""},
289
+ expand: {default: "⌘↓", custom: "⌘↓"},
290
+ collapse: {default: "⌘↑", custom: "⌘↑"},
291
+ insertBottom: {default: "⌥⌘.", custom: "⌥⌘."},
292
+ refTab: {default: "⇧⌘.", custom: "⇧⌘."},
293
+ openBy: {default: "⌥,", custom: "⌥,"},
294
+ insertRight: {default: "⌥.", custom: "⌥."},
295
+ attr: {default: "⌥⌘A", custom: "⌥⌘A"},
296
+ quickMakeCard: {default: "⌥⌘F", custom: "⌥⌘F"},
297
+ refresh: {default: "F5", custom: "F5"},
298
+ copyBlockRef: {default: "⇧⌘C", custom: "⇧⌘C"},
299
+ copyProtocol: {default: "⇧⌘H", custom: "⇧⌘H"},
300
+ copyBlockEmbed: {default: "⇧⌘E", custom: "⇧⌘E"},
301
+ copyHPath: {default: "⇧⌘P", custom: "⇧⌘P"},
302
+ undo: {default: "⌘Z", custom: "⌘Z"},
303
+ redo: {default: "⌘Y", custom: "⌘Y"},
304
+ rename: {default: "F2", custom: "F2"},
305
+ newNameFile: {default: "F3", custom: "F3"},
306
+ newContentFile: {default: "F4", custom: "F4"},
307
+ newNameSettingFile: {default: "⌘F3", custom: "⌘F3"},
308
+ showInFolder: {default: "⌥A", custom: "⌥A"},
309
+ outline: {default: "⌥O", custom: "⌥O"},
310
+ backlinks: {default: "⌥B", custom: "⌥B"},
311
+ graphView: {default: "⌥G", custom: "⌥G"},
312
+ spaceRepetition: {default: "⌥F", custom: "⌥F"},
313
+ fullscreen: {default: "⌥Y", custom: "⌥Y"},
314
+ alignLeft: {default: "⌥L", custom: "⌥L"},
315
+ alignCenter: {default: "⌥C", custom: "⌥C"},
316
+ alignRight: {default: "⌥R", custom: "⌥R"},
317
+ wysiwyg: {default: "⌥⌘7", custom: "⌥⌘7"},
318
+ preview: {default: "⌥⌘9", custom: "⌥⌘9"},
319
+ insertBefore: {default: "⇧⌘B", custom: "⇧⌘B"},
320
+ insertAfter: {default: "⇧⌘A", custom: "⇧⌘A"},
321
+ jumpToParentNext: {default: "⇧⌘N", custom: "⇧⌘N"},
322
+ moveToUp: {default: "⇧⌘↑", custom: "⇧⌘↑"},
323
+ moveToDown: {default: "⇧⌘↓", custom: "⇧⌘↓"},
324
+ },
325
+ insert: {
326
+ appearance: {default: "⌥⌘X", custom: "⌥⌘X"},
327
+ lastUsed: {default: "⌥X", custom: "⌥X"},
328
+ ref: {default: "⌥[", custom: "⌥["},
329
+ kbd: {default: "⌘'", custom: "⌘'"},
330
+ sup: {default: "⌘H", custom: "⌘H"},
331
+ sub: {default: "⌘J", custom: "⌘J"},
332
+ bold: {default: "⌘B", custom: "⌘B"},
333
+ "inline-math": {default: "⌘M", custom: "⌘M"},
334
+ memo: {default: "⌥⌘M", custom: "⌥⌘M"},
335
+ underline: {default: "⌘U", custom: "⌘U"},
336
+ italic: {default: "⌘I", custom: "⌘I"},
337
+ mark: {default: "⌥D", custom: "⌥D"},
338
+ tag: {default: "⌘T", custom: "⌘T"},
339
+ strike: {default: "⇧⌘S", custom: "⇧⌘S"},
340
+ "inline-code": {default: "⌘G", custom: "⌘G"},
341
+ link: {default: "⌘K", custom: "⌘K"},
342
+ check: {default: "⌘L", custom: "⌘L"},
343
+ table: {default: "⌘O", custom: "⌘O"},
344
+ code: {default: "⇧⌘K", custom: "⇧⌘K"},
345
+ clearInline: {default: "⌘\\", custom: "⌘\\"},
346
+ },
347
+ heading: {
348
+ paragraph: {default: "⌥⌘0", custom: "⌥⌘0"},
349
+ heading1: {default: "⌥⌘1", custom: "⌥⌘1"},
350
+ heading2: {default: "⌥⌘2", custom: "⌥⌘2"},
351
+ heading3: {default: "⌥⌘3", custom: "⌥⌘3"},
352
+ heading4: {default: "⌥⌘4", custom: "⌥⌘4"},
353
+ heading5: {default: "⌥⌘5", custom: "⌥⌘5"},
354
+ heading6: {default: "⌥⌘6", custom: "⌥⌘6"},
355
+ },
356
+ list: {
357
+ indent: {default: "⇥", custom: "⇥"},
358
+ outdent: {default: "⇧⇥", custom: "⇧⇥"},
359
+ checkToggle: {default: "⌘↩", custom: "⌘↩"},
360
+ },
361
+ table: {
362
+ insertRowAbove: {default: "⇧⌘T", custom: "⇧⌘T"},
363
+ insertRowBelow: {default: "⇧⌘D", custom: "⇧⌘D"},
364
+ insertColumnLeft: {default: "⇧⌘L", custom: "⇧⌘L"},
365
+ insertColumnRight: {default: "⇧⌘R", custom: "⇧⌘R"},
366
+ moveToUp: {default: "⌥⌘T", custom: "⌥⌘T"},
367
+ moveToDown: {default: "⌥⌘B", custom: "⌥⌘B"},
368
+ moveToLeft: {default: "⌥⌘L", custom: "⌥⌘L"},
369
+ moveToRight: {default: "⌥⌘R", custom: "⌥⌘R"},
370
+ "delete-row": {default: "⌘-", custom: "⌘-"},
371
+ "delete-column": {default: "⇧⌘-", custom: "⇧⌘-"}
372
+ }
373
+ },
374
+ plugin: {},
375
+ };
376
+
377
+ public static readonly SIYUAN_EMPTY_LAYOUT: Record<string, unknown> = {
378
+ hideDock: false,
379
+ layout: {
380
+ "direction": "tb",
381
+ "size": "0px",
382
+ "type": "normal",
383
+ "instance": "Layout",
384
+ "children": [{
385
+ "direction": "lr",
386
+ "size": "auto",
387
+ "type": "normal",
388
+ "instance": "Layout",
389
+ "children": [{
390
+ "direction": "tb",
391
+ "size": "0px",
392
+ "type": "left",
393
+ "instance": "Layout",
394
+ "children": [{
395
+ "instance": "Wnd",
396
+ "children": []
397
+ }, {
398
+ "instance": "Wnd",
399
+ "resize": "tb",
400
+ "children": []
401
+ }]
402
+ }, {
403
+ "direction": "lr",
404
+ "resize": "lr",
405
+ "size": "auto",
406
+ "type": "center",
407
+ "instance": "Layout",
408
+ "children": [{"instance": "Wnd", "children": [{"instance": "Tab", "children": []}]}]
409
+ }, {
410
+ "direction": "tb",
411
+ "size": "0px",
412
+ "resize": "lr",
413
+ "type": "right",
414
+ "instance": "Layout",
415
+ "children": [{
416
+ "instance": "Wnd",
417
+ "children": []
418
+ }, {
419
+ "instance": "Wnd",
420
+ "resize": "tb",
421
+ "children": []
422
+ }]
423
+ }]
424
+ }, {
425
+ "direction": "lr",
426
+ "size": "0px",
427
+ "resize": "tb",
428
+ "type": "bottom",
429
+ "instance": "Layout",
430
+ "children": [{
431
+ "instance": "Wnd",
432
+ "children": []
433
+ }, {
434
+ "instance": "Wnd",
435
+ "resize": "lr",
436
+ "children": []
437
+ }]
438
+ }]
439
+ },
440
+ bottom: {
441
+ pin: true,
442
+ data: []
443
+ },
444
+ left: {
445
+ pin: true,
446
+ data: [
447
+ [{
448
+ type: "file",
449
+ size: {width: 227, height: 0},
450
+ show: true,
451
+ icon: "iconFiles",
452
+ hotkeyLangId: "fileTree",
453
+ }, {
454
+ type: "outline",
455
+ size: {width: 227, height: 0},
456
+ show: false,
457
+ icon: "iconAlignCenter",
458
+ hotkeyLangId: "outline",
459
+ }, {
460
+ type: "inbox",
461
+ size: {width: 320, height: 0},
462
+ show: false,
463
+ icon: "iconInbox",
464
+ hotkeyLangId: "inbox",
465
+ }], [{
466
+ type: "bookmark",
467
+ size: {width: 227, height: 0},
468
+ show: false,
469
+ icon: "iconBookmark",
470
+ hotkeyLangId: "bookmark",
471
+ }, {
472
+ type: "tag",
473
+ size: {width: 227, height: 0},
474
+ show: false,
475
+ icon: "iconTags",
476
+ hotkeyLangId: "tag",
477
+ }]
478
+ ]
479
+ },
480
+ right: {
481
+ pin: true,
482
+ data: [
483
+ [{
484
+ type: "graph",
485
+ size: {width: 320, height: 0},
486
+ show: false,
487
+ icon: "iconGraph",
488
+ hotkeyLangId: "graphView",
489
+ }, {
490
+ type: "globalGraph",
491
+ size: {width: 320, height: 0},
492
+ show: false,
493
+ icon: "iconGlobalGraph",
494
+ hotkeyLangId: "globalGraph",
495
+ }], [{
496
+ type: "backlink",
497
+ size: {width: 320, height: 0},
498
+ show: false,
499
+ icon: "iconLink",
500
+ hotkeyLangId: "backlinks",
501
+ }]
502
+ ]
503
+ }
504
+ };
505
+
506
+ // image
507
+ public static readonly SIYUAN_IMAGE_VIP: string = `<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
508
+ <path fill="#ffd00f" d="M2.288 12.643l23.487 12.853c0.286 0.153 0.477 0.45 0.477 0.791 0 0.082-0.011 0.161-0.032 0.237l0.001-0.006c-0.119 0.395-0.479 0.678-0.905 0.678-0.004 0-0.009-0-0.013-0h-19.439c-0.958 0-1.766-0.684-1.885-1.595l-1.691-12.956z"></path>
509
+ <path fill="#ffd00f" d="M29.676 12.643l-1.691 12.957c-0.119 0.911-0.927 1.594-1.884 1.594h-19.442c-0.004 0-0.009 0-0.013 0-0.425 0-0.785-0.281-0.903-0.668l-0.002-0.007c-0.019-0.070-0.031-0.15-0.031-0.232 0-0.341 0.191-0.638 0.472-0.788l0.005-0.002 23.487-12.853z"></path>
510
+ <path fill="#ffe668" d="M15.413 8.369l10.394 15.921c0.378 0.579 0.407 1.317 0.076 1.924-0.328 0.591-0.948 0.985-1.66 0.985-0 0-0.001 0-0.001 0h-17.617c-0.694 0-1.331-0.378-1.661-0.985-0.144-0.26-0.229-0.569-0.229-0.899 0-0.382 0.114-0.736 0.31-1.033l-0.004 0.007 10.394-15.921z"></path>
511
+ <path fill="#ffdd4e" d="M15.396 8.403l11.659 15.921c0.401 0.579 0.432 1.317 0.081 1.924-0.361 0.594-1.005 0.985-1.741 0.985-0.008 0-0.017-0-0.025-0h-9.344l-0.63-18.83z"></path>
512
+ <path fill="#ffd00f" d="M13.868 6.478c0 0.946 0.767 1.712 1.712 1.712s1.712-0.767 1.712-1.712v0c0-0.945-0.766-1.712-1.712-1.712s-1.712 0.766-1.712 1.712v0zM28.577 10.818c0 0.945 0.766 1.712 1.712 1.712s1.712-0.766 1.712-1.712v0c0-0.945-0.766-1.712-1.712-1.712s-1.712 0.766-1.712 1.712v0zM0 10.822c0 0.945 0.766 1.712 1.712 1.712s1.712-0.766 1.712-1.712v0c0-0.945-0.766-1.712-1.712-1.712s-1.712 0.766-1.712 1.712v0z"></path>
513
+ </svg>`;
514
+ public static readonly SIYUAN_IMAGE_FILE: string = "1f4c4";
515
+ public static readonly SIYUAN_IMAGE_NOTE: string = "1f5c3";
516
+ public static readonly SIYUAN_IMAGE_FOLDER: string = "1f4d1";
517
+
518
+ // assets
519
+ public static readonly SIYUAN_ASSETS_IMAGE: string[] = [".apng", ".ico", ".cur", ".jpg", ".jpe", ".jpeg", ".jfif", ".pjp", ".pjpeg", ".png", ".gif", ".webp", ".bmp", ".svg", ".avif"];
520
+ public static readonly SIYUAN_ASSETS_AUDIO: string[] = [".mp3", ".wav", ".ogg", ".m4a"];
521
+ public static readonly SIYUAN_ASSETS_VIDEO: string[] = [".mov", ".weba", ".mkv", ".mp4", ".webm"];
522
+ public static readonly SIYUAN_ASSETS_EXTS: string[] = [".pdf"].concat(Constants.SIYUAN_ASSETS_IMAGE).concat(Constants.SIYUAN_ASSETS_AUDIO).concat(Constants.SIYUAN_ASSETS_VIDEO);
523
+ public static readonly SIYUAN_ASSETS_SEARCH: string[] = [".txt", ".md", ".markdown", ".docx", ".xlsx", ".pptx", ".pdf", ".json", ".log", ".sql", ".html", ".xml", ".java", ".h", ".c",
524
+ ".cpp", ".go", ".rs", ".swift", ".kt", ".py", ".php", ".js", ".css", ".ts", ".sh", ".bat", ".cmd", ".ini", ".yaml",
525
+ ".rst", ".adoc", ".textile", ".opml", ".org", ".wiki", ".epub"];
526
+
527
+ // protyle
528
+ public static readonly SIYUAN_CONFIG_APPEARANCE_DARK_CODE: string[] = ["a11y-dark", "agate", "an-old-hope", "androidstudio",
529
+ "arta", "atom-one-dark", "atom-one-dark-reasonable", "base16/3024", "base16/apathy", "base16/apprentice", "base16/ashes", "base16/atelier-cave", "base16/atelier-dune",
530
+ "base16/atelier-estuary", "base16/atelier-forest", "base16/atelier-heath", "base16/atelier-lakeside", "base16/atelier-plateau", "base16/atelier-savanna", "base16/atelier-seaside", "base16/atelier-sulphurpool",
531
+ "base16/atlas", "base16/bespin", "base16/black-metal", "base16/black-metal-bathory", "base16/black-metal-burzum", "base16/black-metal-dark-funeral", "base16/black-metal-gorgoroth", "base16/black-metal-immortal", "base16/black-metal-khold", "base16/black-metal-marduk", "base16/black-metal-mayhem", "base16/black-metal-nile", "base16/black-metal-venom", "base16/brewer", "base16/bright", "base16/brogrammer",
532
+ "base16/brush-trees-dark", "base16/chalk", "base16/circus", "base16/classic-dark", "base16/codeschool", "base16/colors", "base16/danqing", "base16/darcula", "base16/dark-violet",
533
+ "base16/darkmoss", "base16/darktooth", "base16/decaf", "base16/default-dark", "base16/dracula", "base16/edge-dark", "base16/eighties", "base16/embers", "base16/equilibrium-dark",
534
+ "base16/equilibrium-gray-dark", "base16/espresso", "base16/eva", "base16/eva-dim", "base16/flat", "base16/framer", "base16/gigavolt", "base16/google-dark", "base16/grayscale-dark", "base16/green-screen", "base16/gruvbox-dark-hard", "base16/gruvbox-dark-medium",
535
+ "base16/gruvbox-dark-pale", "base16/gruvbox-dark-soft", "base16/hardcore", "base16/harmonic16-dark", "base16/heetch-dark", "base16/helios", "base16/hopscotch", "base16/horizon-dark", "base16/humanoid-dark", "base16/ia-dark", "base16/icy-dark", "base16/ir-black", "base16/isotope",
536
+ "base16/kimber", "base16/london-tube", "base16/macintosh", "base16/marrakesh", "base16/materia", "base16/material", "base16/material-darker", "base16/material-palenight", "base16/material-vivid",
537
+ "base16/mellow-purple", "base16/mocha", "base16/monokai", "base16/nebula", "base16/nord", "base16/nova", "base16/ocean", "base16/oceanicnext", "base16/onedark", "base16/outrun-dark",
538
+ "base16/papercolor-dark", "base16/paraiso", "base16/pasque", "base16/phd", "base16/pico", "base16/pop", "base16/porple", "base16/qualia", "base16/railscasts", "base16/rebecca",
539
+ "base16/ros-pine", "base16/ros-pine-moon", "base16/sandcastle", "base16/seti-ui", "base16/silk-dark", "base16/snazzy", "base16/solar-flare", "base16/solarized-dark", "base16/spacemacs", "base16/summercamp", "base16/summerfruit-dark",
540
+ "base16/synth-midnight-terminal-dark", "base16/tango", "base16/tender", "base16/tomorrow-night", "base16/twilight", "base16/unikitty-dark", "base16/vulcan",
541
+ "base16/windows-10", "base16/windows-95", "base16/windows-high-contrast", "base16/windows-nt", "base16/woodland", "base16/xcode-dusk", "base16/zenburn", "codepen-embed", "dark",
542
+ "devibeans", "far", "felipec", "github-dark", "github-dark-dimmed", "gml", "gradient-dark", "hybrid", "ir-black", "isbl-editor-dark", "kimbie-dark", "lioshi",
543
+ "monokai", "monokai-sublime", "night-owl", "nnfx-dark", "nord", "obsidian", "panda-syntax-dark", "paraiso-dark", "pojoaque", "qtcreator-dark", "rainbow", "shades-of-purple", "srcery", "stackoverflow-dark",
544
+ "sunburst", "tomorrow-night-blue", "tomorrow-night-bright", "tokyo-night-dark", "vs2015", "xt256"
545
+ ];
546
+ public static readonly SIYUAN_CONFIG_APPEARANCE_LIGHT_CODE: string[] = ["ant-design",
547
+ "a11y-light", "arduino-light", "ascetic", "atom-one-light", "base16/atelier-cave-light",
548
+ "base16/atelier-dune-light", "base16/atelier-estuary-light", "base16/atelier-forest-light", "base16/atelier-heath-light",
549
+ "base16/atelier-lakeside-light", "base16/atelier-plateau-light", "base16/atelier-savanna-light", "base16/atelier-seaside-light", "base16/atelier-sulphurpool-light", "base16/brush-trees",
550
+ "base16/classic-light", "base16/cupcake", "base16/cupertino", "base16/default-light", "base16/dirtysea", "base16/edge-light", "base16/equilibrium-gray-light", "base16/equilibrium-light",
551
+ "base16/fruit-soda", "base16/github", "base16/google-light", "base16/grayscale-light", "base16/gruvbox-light-hard", "base16/gruvbox-light-medium", "base16/gruvbox-light-soft",
552
+ "base16/harmonic16-light", "base16/heetch-light", "base16/humanoid-light", "base16/horizon-light", "base16/ia-light", "base16/material-lighter", "base16/mexico-light",
553
+ "base16/one-light", "base16/papercolor-light", "base16/ros-pine-dawn", "base16/sagelight", "base16/shapeshifter",
554
+ "base16/silk-light", "base16/solar-flare-light", "base16/solarized-light", "base16/summerfruit-light", "base16/synth-midnight-terminal-light", "base16/tomorrow",
555
+ "base16/unikitty-light", "base16/windows-10-light", "base16/windows-95-light", "base16/windows-high-contrast-light", "brown-paper", "base16/windows-nt-light",
556
+ "color-brewer", "docco", "foundation", "github", "googlecode", "gradient-light", "grayscale", "idea", "intellij-light", "isbl-editor-light", "kimbie-light",
557
+ "lightfair", "magula", "mono-blue", "nnfx-light", "panda-syntax-light", "paraiso-light", "purebasic", "qtcreator-light", "routeros", "school-book",
558
+ "stackoverflow-light", "tokyo-night-light", "vs", "xcode", "default"];
559
+ public static readonly ZWSP: string = "\u200b";
560
+ public static readonly INLINE_TYPE: string[] = ["block-ref", "kbd", "text", "file-annotation-ref", "a", "strong", "em", "u", "s", "mark", "sup", "sub", "tag", "code", "inline-math", "inline-memo"];
561
+ public static readonly BLOCK_HINT_KEYS: string[] = ["((", "[[", "((", "【【"];
562
+ public static readonly BLOCK_HINT_CLOSE_KEYS: IObject;
563
+ // common: "bash", "c", "csharp", "cpp", "css", "diff", "go", "xml", "json", "java", "javascript", "kotlin", "less", "lua", "makefile", "markdown", "objectivec", "php", "php-template", "perl", "plaintext", "python", "python-repl", "r", "ruby", "rust", "scss", "sql", "shell", "swift", "ini", "typescript", "vbnet", "yaml", "properties", "1c", "armasm", "avrasm", "actionscript", "ada", "angelscript", "accesslog", "apache", "applescript", "arcade", "arduino", "asciidoc", "aspectj", "abnf", "autohotkey", "autoit", "awk", "basic", "bnf", "dos", "brainfuck", "cal", "cmake", "csp", "cos", "capnproto", "ceylon", "clean", "clojure", "clojure-repl", "coffeescript", "coq", "crystal", "d", "dns", "dart", "delphi", "dts", "django", "dockerfile", "dust", "erb", "elixir", "elm", "erlang", "erlang-repl", "excel", "ebnf", "fsharp", "fix", "flix", "fortran", "gcode", "gams", "gauss", "glsl", "gml", "gherkin", "golo", "gradle", "groovy", "haml", "hsp", "http", "handlebars", "haskell", "haxe", "hy", "irpf90", "isbl", "inform7", "x86asm", "jboss-cli", "julia", "julia-repl", "ldif", "llvm", "lsl", "latex", "lasso", "leaf", "lisp", "livecodeserver", "livescript", "mel", "mipsasm", "matlab", "maxima", "mercury", "axapta", "routeros", "mizar", "mojolicious", "monkey", "moonscript", "n1ql", "nsis", "nestedtext", "nginx", "nim", "nix", "node-repl", "ocaml", "openscad", "ruleslanguage", "oxygene", "pf", "parser3", "pony", "pgsql", "powershell", "processing", "prolog", "protobuf", "puppet", "purebasic", "profile", "q", "qml", "reasonml", "rib", "rsl", "roboconf", "sas", "sml", "sqf", "step21", "scala", "scheme", "scilab", "smali", "smalltalk", "stan", "stata", "stylus", "subunit", "tp", "taggerscript", "tcl", "tap", "thrift", "twig", "vbscript", "vbscript-html", "vhdl", "vala", "verilog", "vim", "wasm", "mathematica", "wren", "xl", "xquery", "zephir", "crmsh", "dsconfig", "graphql",
564
+ // third: "yul", "solidity", "abap", "hlsl"
565
+ public static readonly ALIAS_CODE_LANGUAGES: string[] = [
566
+ "js", "ts", "html", "toml", "c#", "bat",
567
+ ];
568
+
569
+ // Google Analytics 事件
570
+ public static readonly ANALYTICS_EVT_ON_GET_CONFIG: string = "siyuan.onGetConfig";
571
+ }
package/types/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./events";
2
2
  export * from "./protyle";
3
3
  export * from "./response";
4
+ export * from "./constants";