-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Expand file tree
/
Copy pathindex.d.ts
More file actions
1343 lines (1235 loc) · 35.7 KB
/
Copy pathindex.d.ts
File metadata and controls
1343 lines (1235 loc) · 35.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
type TPluginDockPosition = "LeftTop" | "LeftBottom" | "RightTop" | "RightBottom" | "BottomLeft" | "BottomRight"
type TDockPosition = "Left" | "Right" | "Bottom"
type TWS = "main" | "filetree" | "protyle" | "backlink" | "bookmark" | "graph" | "outline" | "tag" | "agentChat"
type TDock = "file" | "outline" | "inbox" | "bookmark" | "tag" | "graph" | "globalGraph" | "backlink" | "agentChat"
type TTab = "Outline" | "Graph" | "Backlink" | "Asset" | "Editor" | "Search" | "siyuan-card"
type TOperation =
"insert"
| "update"
| "delete"
| "move"
| "foldHeading"
| "unfoldHeading"
| "setAttrs"
| "updateAttrs"
| "append"
| "insertAttrViewBlock"
| "removeAttrViewBlock"
| "addAttrViewCol"
| "removeAttrViewCol"
| "addFlashcards"
| "removeFlashcards"
| "updateAttrViewCell"
| "updateAttrViewCol"
| "updateAttrViewColTemplate"
| "sortAttrViewRow"
| "sortAttrViewCol"
| "sortAttrViewKey"
| "setAttrViewColPin"
| "setAttrViewColHidden"
| "setAttrViewColWrap"
| "setAttrViewColWidth"
| "updateAttrViewColOptions"
| "removeAttrViewColOption"
| "updateAttrViewColOption"
| "setAttrViewName"
| "doUpdateUpdated"
| "duplicateAttrViewKey"
| "setAttrViewColIcon"
| "setAttrViewFilters"
| "setAttrViewSorts"
| "setAttrViewColCalc"
| "updateAttrViewColNumberFormat"
| "replaceAttrViewBlock"
| "addAttrViewView"
| "setAttrViewViewName"
| "removeAttrViewView"
| "setAttrViewViewIcon"
| "duplicateAttrViewView"
| "duplicateAttrViewRow"
| "sortAttrViewView"
| "setAttrViewPageSize"
| "updateAttrViewColRelation"
| "moveOutlineHeading"
| "updateAttrViewColRollup"
| "hideAttrViewName"
| "setAttrViewCardSize"
| "setAttrViewCardAspectRatio"
| "setAttrViewCoverFrom"
| "setAttrViewCoverFromAssetKeyID"
| "setAttrViewFitImage"
| "setAttrViewShowIcon"
| "setAttrViewWrapField"
| "setAttrViewColDateFillCreated"
| "setAttrViewColDateFillSpecificTime"
| "setAttrViewViewDesc"
| "setAttrViewColDesc"
| "setAttrViewBlockView"
| "setAttrViewGroup"
| "removeAttrViewGroup"
| "hideAttrViewAllGroups"
| "syncAttrViewTableColWidth"
| "hideAttrViewGroup"
| "sortAttrViewGroup"
| "foldAttrViewGroup"
| "setAttrViewDisplayFieldName"
| "setAttrViewFillColBackgroundColor"
| "setAttrViewUpdatedIncludeTime"
| "setAttrViewCreatedIncludeTime"
type TBazaarType = "templates" | "icons" | "widgets" | "themes" | "plugins"
type TCardType = "doc" | "notebook" | "all"
type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" |
"click-blockicon" | "click-editorcontent" | "click-pdf" | "click-editortitleicon" | "click-flashcard-action" |
"open-noneditableblock" |
"open-menu-blockref" | "open-menu-fileannotationref" | "open-menu-tag" | "open-menu-link" | "open-menu-image" |
"open-menu-av" | "open-menu-content" | "open-menu-breadcrumbmore" | "open-menu-doctree" | "open-menu-inbox" |
"open-siyuan-url-plugin" | "open-siyuan-url-block" | "opened-notebook" |
"closed-notebook" |
"paste" |
"input-search" |
"loaded-protyle-dynamic" | "loaded-protyle-static" |
"switch-protyle" | "switch-protyle-mode" |
"destroy-protyle" |
"lock-screen" |
"mobile-keyboard-show" | "mobile-keyboard-hide" |
"code-language-update" | "code-language-change" |
"kernel-plugin-state-change"
type TAVView = "table" | "gallery" | "kanban"
type TAVCol =
"text"
| "date"
| "number"
| "relation"
| "rollup"
| "select"
| "block"
| "mSelect"
| "url"
| "email"
| "phone"
| "mAsset"
| "template"
| "created"
| "updated"
| "checkbox"
| "lineNumber"
type TAVFilterOperator =
"="
| "!="
| ">"
| ">="
| "<"
| "<="
| "Contains"
| "Does not contains"
| "Is empty"
| "Is not empty"
| "Starts with"
| "Ends with"
| "Is between"
| "Is relative to today"
| "Is true"
| "Is false"
type TRecentDocsSort = "viewedAt" | "closedAt" | "openAt" | "updated"
type TPublishAccessLevel = "public" | "protected" | "hidden" | "private" | "forbidden";
/**
* 内核插件状态
* - `-1`: inactive 内核插件未安装或不可用
* - `0`: ready 内核插件已安装但未启动
* - `1`: loading 内核插件正在启动
* - `2`: running 内核插件正在运行, 可正常使用
* - `3`: stopping 内核插件正在停止
* - `4`: stopped 内核插件已停止
* - `5`: error 内核插件出现不可恢复的错误
*/
type TKernelPluginState = -1 | 0 | 1 | 2 | 3 | 4 | 5
type TJsonRpcId = string | number;
type TJsonRpcMethod = string;
type TJsonRpcPositionalParams = any[];
type TJsonRpcNamedParams = Record<string, any>;
type TJsonRpcParams = TJsonRpcPositionalParams | TJsonRpcNamedParams | undefined;
type TJsonRpcMethodParams = TJsonRpcPositionalParams | [TJsonRpcNamedParams] | [];
type TJsonRpcHandler<T = any> = (...args: TJsonRpcMethodParams) => Promise<T> | T;
declare module "blueimp-md5"
declare class Highlight {
constructor(...range: Range[]);
add(range: Range): void
clear(): void
forEach(callbackfn: (value: Range, key: number) => void): void;
}
declare namespace CSS {
const highlights: Map<string, Highlight>;
}
interface CSSStyleDeclarationElectron extends CSSStyleDeclaration {
WebkitAppRegion: string;
}
interface Window {
DOMPurify: {
sanitize(dirty: string, options?: any): string;
};
echarts: {
init(element: Element, theme?: string, options?: {
width: number
}): {
setOption(option: any): void;
getZr(): any;
on(name: string, event: (e: any) => void): any;
containPixel(name: string, position: number[]): any;
resize(): void;
};
dispose(element: Element): void;
getInstanceById(id: string): {
resize: () => void
clear: () => void
getOption: () => { series: { type: string }[] }
};
};
ABCJS: {
renderAbc(element: Element, text: string, options: {
responsive: string
}): void;
};
MathJax: {
svg: {
fontCache: string
}
startup?: {
promise: Promise<void>
}
tex2svg?(math: string, options: { display: boolean }): HTMLElement
};
hljs: {
listLanguages(): string[];
highlight(text: string, options: {
language?: string,
ignoreIllegals: boolean
}): {
value: string
};
getLanguage(text: string): {
name: string
};
};
katex: {
renderToString(math: string, option: {
displayMode: boolean;
output: string;
macros: IObject;
trust: boolean;
strict: (errorCode: string) => "ignore" | "warn";
}): string;
};
zenuml: object,
mermaid: {
initialize(options: any): void,
render(id: string, text: string): { svg: string },
registerExternalDiagrams(ex: object[]): void,
registerIconPacks(options: {
name: string,
loader(): Promise<Response>
}[]): void
};
plantumlEncoder: {
encode(options: string): string,
};
pdfjsLib: any;
webkit: {
nativeCallbacks: { [key: string]: (id: number) => void },
messageHandlers: {
saveExportFile: { postMessage: (url: string) => void }
openLink: { postMessage: (url: string) => void }
startKernelFast: { postMessage: (url: string) => void }
changeStatusBar: { postMessage: (url: string) => void }
setClipboard: { postMessage: (url: string) => void }
purchase: { postMessage: (url: string) => void }
print: { postMessage: (html: string) => void }
exit: { postMessage: (text: string) => void }
sendNotification: {
postMessage: (options: {
title: string,
body: string,
delay: number,
callback: string
}) => number
}
cancelNotification: { postMessage: (id: number) => void }
}
};
htmlToImage: {
toCanvas: (element: Element, options?: Partial<IObject>) => Promise<HTMLCanvasElement>
toBlob: (element: Element, options?: Partial<IObject>) => Promise<Blob>
};
modernScreenshot: {
domToBlob: (element: Element, options?: Partial<IObject>) => Promise<Blob>
};
siyuan: ISiyuan;
JSAndroid: {
returnDesktop(): void
openExternal(url: string): void
exportByDefault(url: string): void
saveExportFile(url: string): void
changeStatusBarColor(color: string, mode: number): void
writeClipboard(text: string): void
writeHTMLClipboard(text: string, html: string): void
writeSiYuanHTMLClipboard(text: string, html: string, siyuanHTML: string): void
writeImageClipboard(uri: string): void
readClipboard(): string
readHTMLClipboard(): string
readSiYuanHTMLClipboard(): string
getBlockURL(): string
hideKeyboard(): void
showKeyboard(): void
print(title: string, html: string): void
getScreenWidthPx(): number
exit(): void
setWebViewFocusable(enable: boolean): void
sendNotification(channel: string, title: string, body: string, delayInSeconds: number): number
cancelNotification(id: number): void
};
JSHarmony: {
showKeyboard(): void
hideKeyboard(): void
openExternal(url: string): void
exportByDefault(url: string): void
saveExportFile(url: string): void
changeStatusBarColor(color: string, mode: number): void
writeClipboard(text: string): void
writeHTMLClipboard(text: string, html: string): void
writeSiYuanHTMLClipboard(text: string, html: string, siyuanHTML: string): void
readClipboard(): string
readHTMLClipboard(): string
readSiYuanHTMLClipboard(): string
returnDesktop(): void
print(title: string, html: string): void
getScreenWidthPx(): number
exit(): void
setWebViewFocusable(enable: boolean): void
sendNotification(channel: string, title: string, body: string, delayInSeconds: number): number
cancelNotification(id: number): void
};
Protyle: import("../protyle/method").default;
lockscreenByMode(): void;
goBack(): void;
showMessage(message: string, timeout: number, type: string, messageId?: string): void;
reconnectWebSocket(): void;
showKeyboardToolbar(): void;
processIOSPurchaseResponse(code: number): void;
hideKeyboardToolbar(): void;
openFileByURL(URL: string): boolean;
destroyTheme(): Promise<void>;
}
interface ILocalFiles {
path: string,
size: number
}
interface IClipboardData {
textHTML?: string,
textPlain?: string,
siyuanHTML?: string,
files?: File[],
localFiles?: ILocalFiles[],
}
interface IRefDefs {
refID: string,
defIDs?: string[]
}
interface IFilesPath {
notebookId: string,
openPaths: string[]
}
interface IPosition {
x: number,
y: number,
w?: number,
h?: number,
isLeft?: boolean
}
interface ISaveLayout {
name: string,
layout: IObject
time: number
filesPaths: IFilesPath[]
}
interface IWorkspace {
path: string;
closed: boolean;
}
interface ICardPackage {
id: string;
updated: string;
name: string;
size: number;
}
interface ICard {
deckID: string;
cardID: string;
blockID: string;
nextDues: IObject;
lapses: number; // 遗忘次数
lastReview: number; // 最后复习时间
reps: number; // 复习次数
state: number; // 卡片状态 0:新卡
}
interface ICardData {
cards: ICard[],
unreviewedCount: number
unreviewedNewCardCount: number
unreviewedOldCardCount: number
}
interface IPluginSettingOption {
title: string;
description?: string;
actionElement?: HTMLElement;
direction?: "column" | "row";
createActionElement?(): HTMLElement;
}
interface ISearchAssetOption {
keys: string[],
col: string,
row: string,
layout: number,
method: number,
types: {
".txt": boolean,
".md": boolean,
".docx": boolean,
".xlsx": boolean,
".pptx": boolean,
},
sort: number,
k: string,
}
interface ITextOption {
color?: string,
type: string
}
interface ISnippet {
id?: string;
name: string;
type: string;
enabled: boolean;
content: string;
disabledInPublish: boolean;
}
interface IInbox {
oId: string;
shorthandContent: string;
shorthandMd: string;
shorthandDesc: string;
shorthandFrom: number;
shorthandTitle: string;
shorthandURL: string;
hCreated: string;
}
interface IPdfAnno {
pages?: {
index: number
positions: number[]
}[]
index?: number,
color: string,
type: string, // border, text
content: string, // rect, text
mode: string,
id?: string,
coords?: number[]
ids?: string[]
}
interface IBackStack {
id: string,
// 仅移动端
data?: {
startId: string,
endId: string
path: string
notebookId: string
},
scrollTop?: number,
callback?: TProtyleAction[],
position?: {
start: number,
end: number
}
// 仅桌面端
protyle?: IProtyle,
zoomId?: string
}
interface IEmojiItem {
unicode: string,
description: string,
description_zh_cn: string,
description_ja_jp: string,
keywords: string
}
interface IEmoji {
id: string,
title: string,
title_zh_cn: string,
title_ja_jp: string,
items: IEmojiItem[]
}
interface INotebook {
name: string;
id: string;
closed: boolean;
icon: string;
sort: number;
dueFlashcardCount?: string;
newFlashcardCount?: string;
flashcardCount?: string;
sortMode: number;
}
interface ISiyuan {
zIndex: number
storage?: {
[key: string]: any
},
closedTabs?: ILayoutJSON[]
reqIds: {
[key: string]: number
},
editorIsFullscreen?: boolean,
hideBreadcrumb?: boolean,
notebooks?: INotebook[],
emojis?: IEmoji[],
backStack?: IBackStack[],
mobile?: {
touchRange?: Range
size: {
isLandscape?: boolean,
landscape?: {
height1: number,
height2: number, // 键盘弹起时的高度
}, // 横屏
portrait?: {
height1: number,
height2: number,
}
}
editor?: import("../protyle").Protyle
popEditor?: import("../protyle").Protyle
docks?: {
outline: import("../mobile/dock/MobileOutline").MobileOutline | null,
file: import("../mobile/dock/MobileFiles").MobileFiles | null,
bookmark: import("../mobile/dock/MobileBookmarks").MobileBookmarks | null,
tag: import("../mobile/dock/MobileTags").MobileTags | null,
backlink: import("../mobile/dock/MobileBacklinks").MobileBacklinks | null,
inbox: import("../layout/dock/Inbox").Inbox | null,
} & { [key: string]: import("../layout/Model").Model | any };
},
user?: {
userId: string
userName: string
userAvatarURL: string
userHomeBImgURL: string
userIntro: string
userNickname: string
/**
* 功能特性付费状态
* 0 未付费,1 已付费
*/
userSiYuanOneTimePayStatus: number
/**
* 会员过期时间
* -1 终身会员;0 未订阅或订阅已过期;>0 订阅到期时间(时间戳,毫秒)
*/
userSiYuanProExpireTime: number
/**
* 订阅计划类型
* 0 年付订阅/终生;1 教育优惠;2 订阅试用
*/
userSiYuanSubscriptionPlan: number
/**
* 订阅类型
* 0 年付;1 终生;2 月付
*/
userSiYuanSubscriptionType: number
/**
* 订阅状态
* -1 未订阅,0 订阅可用,1 订阅封禁,2 订阅过期(包括付费订阅过期和试用订阅过期)
*/
userSiYuanSubscriptionStatus: number
userToken: string
userTitles: {
name: string,
icon: string,
desc: string
}[]
},
dragElement?: HTMLElement,
dragTitle?: string,
currentDragOverTabHeadersElement?: HTMLElement
touchDragActive?: boolean,
touchDragGhost?: HTMLElement | null,
layout?: {
layout?: import("../layout").Layout,
centerLayout?: import("../layout").Layout,
leftDock?: import("../layout/dock").Dock,
rightDock?: import("../layout/dock").Dock,
bottomDock?: import("../layout/dock").Dock,
}
config?: Config.IConf;
ws: import("../layout/Model").Model,
ctrlIsPressed?: boolean,
altIsPressed?: boolean,
shiftIsPressed?: boolean,
coordinates?: {
pageX: number,
pageY: number,
clientX: number,
clientY: number,
screenX: number,
screenY: number,
},
menus?: import("../menus").Menus
languages?: {
[key: string]: any;
}
bookmarkLabel?: string[]
blockPanels: import("../block/Panel").BlockPanel[],
dialogs: import("../dialog").Dialog[],
viewer?: Viewer,
/**
* 是否在发布服务下访问
*/
isPublish?: boolean;
}
interface IOperation {
action: TOperation, // move, delete 不需要传 data
id?: string,
context?: IObject, // focusId, message, ignoreProcess, setRange
blockID?: string,
isTwoWay?: boolean, // 是否双向关联
backRelationKeyID?: string, // 双向关联的目标关联列 ID
avID?: string, // av
format?: string // updateAttrViewColNumberFormat 专享
keyID?: string // updateAttrViewCell 专享
rowID?: string // updateAttrViewCell 专享
data?: any, // updateAttr 时为 { old: IObject, new: IObject }, updateAttrViewCell 时为 {TAVCol: {content: string}}
parentID?: string
previousID?: string
retData?: any
nextID?: string // insert 专享
isDetached?: boolean // insertAttrViewBlock 专享
srcIDs?: string[] // removeAttrViewBlock 专享
srcs?: IOperationSrcs[] // insertAttrViewBlock 专享
ignoreDefaultFill?: boolean // insertAttrViewBlock 专享
viewID?: string // 多个属性视图操作使用,用于推送时不影响其他视图
name?: string // addAttrViewCol 专享
type?: TAVCol // addAttrViewCol 专享
deckID?: string // add/removeFlashcards 专享
blockIDs?: string[] // add/removeFlashcards 专享
removeDest?: boolean // removeAttrViewCol 专享
layout?: string // addAttrViewView 专享
groupID?: string // insertAttrViewBlock, sortAttrViewRow 专享
targetGroupID?: string // sortAttrViewRow 专享
}
interface IOperationSrcs {
itemID: string,
id: string,
content?: string,
isDetached: boolean
}
interface IObject {
[key: string]: string;
}
interface ILayoutJSON extends ILayoutOptions {
scrollAttr?: IScrollAttr,
instance?: string,
width?: string,
height?: string,
title?: string,
lang?: string
docIcon?: string
page?: string
path?: string
blockId?: string
mode?: TEditorMode
action?: TProtyleAction
icon?: string
rootId?: string
active?: boolean
pin?: boolean
isPreview?: boolean
customModelData?: any
customModelType?: string
config?: Config.IUILayoutTabSearchConfig
children?: ILayoutJSON[] | ILayoutJSON
}
interface ICommand {
langKey: string, // 用于区分不同快捷键的 key, 同时作为 i18n 的字段名
langText?: string, // 显示的文本, 指定后不再使用 langKey 对应的 i18n 文本
hotkey?: string, // 快捷键,默认为空字符串
customHotkey?: string,
callback?: () => void // 其余回调存在时将不会触发
globalCallback?: () => void // 焦点不在应用内时执行的回调
fileTreeCallback?: (file: import("../layout/dock/Files").Files) => void // 焦点在文档树上时执行的回调
editorCallback?: (protyle: IProtyle) => void // 焦点在编辑器上时执行的回调
dockCallback?: (element: HTMLElement) => void // 焦点在 dock 上时执行的回调
}
interface IPluginData {
displayName: string,
name: string,
js: string,
css: string,
i18n: IObject
}
interface IPluginDockTab {
position: TPluginDockPosition,
size: Config.IUILayoutDockPanelSize,
icon: string,
hotkey?: string,
title: string,
index?: number
show?: boolean
}
interface IExportOptions {
type: string,
id: string,
}
interface IOpenFileOptions {
app: import("../index").App,
searchData?: Config.IUILayoutTabSearchConfig, // 搜索必填
// card 和自定义页签 必填
custom?: {
title: string,
icon: string,
data?: any
id: string,
fn?: (options: {
tab: import("../layout/Tab").Tab,
data: any,
}) => import("../layout/Model").Model, // plugin 0.8.3 历史兼容
}
scrollPosition?: ScrollLogicalPosition,
assetPath?: string, // asset 必填
fileName?: string, // file 必填
rootTitleEmpty?: boolean,
rootIcon?: string, // 文档图标
id?: string, // file 必填
rootID?: string, // file 必填
position?: string, // file 或者 asset,打开位置
page?: number | string, // asset
mode?: TEditorMode // file
action?: TProtyleAction[]
keepCursor?: boolean // file,是否跳转到新 tab 上
zoomIn?: boolean // 是否缩放
removeCurrentTab?: boolean // 在当前页签打开时需移除原有页签
openNewTab?: boolean // 使用新页签打开
afterOpen?: (model?: import("../layout/Model").Model) => void // 打开后回调
}
interface ILayoutOptions {
direction?: Config.TUILayoutDirection;
size?: string;
resize?: Config.TUILayoutDirection;
type?: Config.TUILayoutType;
element?: HTMLElement;
}
interface ITab {
icon?: string;
docIcon?: string;
title?: string;
panel?: string;
callback?: (tab: import("../layout/Tab").Tab) => void;
}
interface IWebSocketData {
cmd?: string;
callback?: string;
data?: any;
msg: string;
code: number;
sid?: string;
context?: any;
}
interface IGraphCommon {
d3: {
centerStrength: number
collideRadius: number
collideStrength: number
lineOpacity: number
linkDistance: number
linkWidth: number
nodeSize: number
arrow: boolean
};
type: {
blockquote: boolean
callout: boolean
code: boolean
heading: boolean
list: boolean
listItem: boolean
math: boolean
paragraph: boolean
super: boolean
table: boolean
tag: boolean
};
}
interface IKeymapItem {
default: string,
custom: string
}
interface IFile {
icon: string;
name1: string;
alias: string;
memo: string;
bookmark: string;
path: string;
name: string;
titleEmpty?: boolean;
hMtime: string;
hCtime: string;
hSize: string;
dueFlashcardCount?: string;
newFlashcardCount?: string;
flashcardCount?: string;
id: string;
count: number;
subFileCount: number;
}
interface IBlockTree {
box: string,
nodeType: string,
hPath: string,
subType: string,
name: string,
type: string,
depth: number,
url?: string,
label?: string,
id?: string,
blocks?: IBlock[],
count: number,
children?: IBlockTree[]
}
interface IBlock {
riffCard?: IRiffCard,
depth?: number,
box?: string;
path?: string;
hPath?: string;
id?: string;
rootID?: string;
type?: string;
content?: string;
def?: IBlock;
defID?: string
defPath?: string
refText?: string;
name?: string;
memo?: string;
alias?: string;
tag?: string;
refs?: IBlock[];
children?: IBlock[]
length?: number
ial: IObject
refCount?: number
}
interface IRiffCard {
due?: string;
reps?: number; // 闪卡复习次数
}
interface IModels {
editor: import("../editor").Editor[],
graph: import("../layout/dock/Graph").Graph[],
outline: import("../layout/dock/Outline").Outline[]
backlink: import("../layout/dock/Backlink").Backlink[]
inbox: import("../layout/dock/Inbox").Inbox[]
files: import("../layout/dock/Files").Files[]
bookmark: import("../layout/dock/Bookmark").Bookmark[]
tag: import("../layout/dock/Tag").Tag[]
asset: import("../asset").Asset[]
search: import("../search").Search[]
custom: import("../layout/dock/Custom").Custom[]
}
interface IMenu {
checked?: boolean,
iconClass?: string,
label?: string,
click?: (element: HTMLElement, event: MouseEvent) => boolean | void | Promise<boolean | void>
type?: "separator" | "submenu" | "readonly" | "empty",
accelerator?: string,
action?: string,
id?: string,
submenu?: IMenu[]
disabled?: boolean
icon?: string
iconHTML?: string
current?: boolean
bind?: (element: HTMLElement) => void
index?: number
element?: HTMLElement
ignore?: boolean
warning?: boolean
}
interface IBazaarItem {
preferredName: string;
minAppVersion: string;
preferredDesc: string;
preferredReadme: string;
iconURL: string;
stars: string;
author: string;
updated: string;
downloads: string;
disallowInstall: boolean;
current: false;
installed: false;
outdated: false;
name: string;
previewURL: string;
repoHash: string;
repoURL: string;
url: string;
openIssues: number;
version: string;
hSize: string;
hInstallSize: string;
hInstallDate: string;
hUpdated: string;
preferredFunding: string;
disallowUpdate: boolean;
updateRequiredMinAppVer?: string;
installedIncompatible?: boolean; // 仅 plugin
bazaarIncompatible?: boolean; // 仅 plugin
enabled?: boolean; // 仅 plugin
modes?: string[]; // 仅 theme
}
interface IAV {
id: string;
name: string;
view: IAVTable | IAVGallery;
viewID: string;
viewType: TAVView;
views: IAVView[];
isMirror?: boolean;
}
interface IAVView {
name: string;
desc: string;
id: string;
type: TAVView;
icon: string;
hideAttrViewName: boolean;
pageSize: number;
showIcon: boolean;
wrapField: boolean;
groupHidden?: number, // 0:显示,1:空白隐藏,2:手动隐藏
groupFolded?: boolean,
filters: IAVFilter[],
sorts: IAVSort[],
groups: IAVView[]
group: IAVGroup
groupKey: IAVColumn
groupValue: IAVCellValue
}
interface IAVTable extends IAVView {
columns: IAVColumn[],
rows: IAVRow[],
rowCount: number,
}