siyuan 0.9.1 → 0.9.3

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,7 +1,19 @@
1
1
  # Changelog
2
2
 
3
- ## 0.9.2 2024-01
3
+ ## 0.9.4 2024-02
4
4
 
5
+ ## 0.9.3 2024-01-30
6
+
7
+ * [Improve Global.Lute type](https://github.com/siyuan-note/petal/issues/23)
8
+
9
+ ## 0.9.2 2024-01-09
10
+
11
+ * [Add plugin `protyleOptions`](https://github.com/siyuan-note/siyuan/issues/10090)
12
+ * [Add plugin api `uninstall`](https://github.com/siyuan-note/siyuan/issues/10063)
13
+ * [Add plugin method `updateCards`](https://github.com/siyuan-note/siyuan/issues/10065)
14
+ * [Add plugin function `lockScreen`](https://github.com/siyuan-note/siyuan/issues/10063)
15
+ * [Add plugin event bus `lock-screen`](https://github.com/siyuan-note/siyuan/pull/9967)
16
+ * [Add plugin event bus `open-menu-inbox`](https://github.com/siyuan-note/siyuan/pull/9967)
5
17
 
6
18
  ## 0.9.1 2023-12-26
7
19
 
@@ -10,7 +22,7 @@
10
22
 
11
23
  ## 0.9.0 2023-12-05
12
24
 
13
- * [Add plugin eventbus `sync-start`, `sync-end`, and `sync-fail`](https://github.com/siyuan-note/siyuan/issues/9798)
25
+ * [Add plugin event bus `sync-start`, `sync-end`, and `sync-fail`](https://github.com/siyuan-note/siyuan/issues/9798)
14
26
  * [Add plugin event bus `mobile-keyboard-show` and `mobile-keyboard-hide`](https://github.com/siyuan-note/siyuan/issues/9773)
15
27
  * [Add some `Protyle` methods to the plugin API](https://github.com/siyuan-note/petal/issues/21)
16
28
 
package/package.json CHANGED
@@ -12,6 +12,6 @@
12
12
  "README.md",
13
13
  "siyuan.d.ts"
14
14
  ],
15
- "version": "0.9.1",
15
+ "version": "0.9.3",
16
16
  "repository": "https://github.com/siyuan-note/petal"
17
17
  }
package/siyuan.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from "./types";
2
2
 
3
- import {IProtyle, Lute, Protyle, Toolbar} from "./types/protyle";
3
+ import {IProtyle, Lute, Protyle, Toolbar, IProtyleOption, TProtyleAction} from "./types/protyle";
4
4
  import {IMenuBaseDetail} from "./types/events";
5
5
  import {IGetDocInfo, IGetTreeStat} from "./types/response";
6
6
 
@@ -19,21 +19,6 @@ export type TTurnInto = "Blocks2Ps" | "Blocks2Hs"
19
19
 
20
20
  export type TCardType = "doc" | "notebook" | "all"
21
21
 
22
- export type TProtyleAction = "cb-get-append" | // 向下滚动加载
23
- "cb-get-before" | // 向上滚动加载
24
- "cb-get-unchangeid" | // 上下滚动,定位时不修改 blockid
25
- "cb-get-hl" | // 高亮
26
- "cb-get-focus" | // 光标定位
27
- "cb-get-focusfirst" | // 动态定位到第一个块
28
- "cb-get-setid" | // 重置 blockid
29
- "cb-get-all" | // 获取所有块
30
- "cb-get-backlink" | // 悬浮窗为传递型需展示上下文
31
- "cb-get-unundo" | // 不需要记录历史
32
- "cb-get-scroll" | // 滚动到指定位置
33
- "cb-get-context" | // 包含上下文
34
- "cb-get-html" | // 直接渲染,不需要再 /api/block/getDocInfo,否则搜索表格无法定位
35
- "cb-get-history" // 历史渲染
36
-
37
22
  export type TOperation =
38
23
  "insert"
39
24
  | "update"
@@ -80,7 +65,7 @@ export type TAVCol =
80
65
  | "phone"
81
66
 
82
67
  export interface Global {
83
- Lute: Lute;
68
+ Lute: typeof Lute;
84
69
  }
85
70
 
86
71
  interface IKeymapItem {
@@ -169,6 +154,11 @@ export interface IEventBusMap {
169
154
  elements: NodeListOf<HTMLElement>,
170
155
  type: "doc" | "docs" | "notebook",
171
156
  };
157
+ "open-menu-inbox": {
158
+ menu: EventMenu,
159
+ element: HTMLElement,
160
+ ids: string[],
161
+ };
172
162
  "open-noneditableblock": {
173
163
  protyle: IProtyle,
174
164
  toolbar: Toolbar,
@@ -194,6 +184,7 @@ export interface IEventBusMap {
194
184
  "sync-start": IWebSocketData;
195
185
  "sync-end": IWebSocketData;
196
186
  "sync-fail": IWebSocketData;
187
+ "lock-screen": void;
197
188
  "mobile-keyboard-show": void;
198
189
  "mobile-keyboard-hide": void;
199
190
  }
@@ -362,38 +353,11 @@ export interface ICommandOption {
362
353
  dockCallback?: (element: HTMLElement) => void // 焦点在 dock 上时执行的回调
363
354
  }
364
355
 
365
- export interface IProtyleOption {
366
- action?: TProtyleAction[];
367
- mode?: "preview" | "wysiwyg";
368
- blockId: string;
369
- key?: string;
370
- scrollAttr?: {
371
- rootId: string,
372
- startId: string,
373
- endId: string,
374
- scrollTop: number,
375
- focusId?: string,
376
- focusStart?: number,
377
- focusEnd?: number,
378
- zoomInId?: string,
379
- };
380
- defId?: string;
381
- render?: {
382
- background?: boolean,
383
- title?: boolean,
384
- gutter?: boolean,
385
- scroll?: boolean,
386
- breadcrumb?: boolean,
387
- breadcrumbDocName?: boolean,
388
- };
389
- typewriterMode?: boolean;
390
-
391
- after?(protyle: Protyle): void;
392
- }
393
-
394
356
  export interface IOperation {
395
357
  action: TOperation; // move, delete 不需要传 data
396
358
  id?: string;
359
+ isTwoWay?: boolean; // 是否双向关联
360
+ backRelationKeyID?: string; // 双向关联的目标关联列 ID
397
361
  avID?: string; // av
398
362
  format?: string; // updateAttrViewColNumberFormat 专享
399
363
  keyID?: string; // updateAttrViewCell 专享
@@ -403,6 +367,7 @@ export interface IOperation {
403
367
  previousID?: string;
404
368
  retData?: any;
405
369
  nextID?: string; // insert 专享
370
+ isDetached?: boolean; // insertAttrViewBlock 专享
406
371
  srcIDs?: string[]; // insertAttrViewBlock 专享
407
372
  name?: string; // addAttrViewCol 专享
408
373
  type?: TAVCol; // addAttrViewCol 专享
@@ -410,6 +375,20 @@ export interface IOperation {
410
375
  blockIDs?: string[]; // add/removeFlashcards 专享
411
376
  }
412
377
 
378
+ export interface ICard {
379
+ deckID: string
380
+ cardID: string
381
+ blockID: string
382
+ nextDues: IObject
383
+ }
384
+
385
+ export interface ICardData {
386
+ cards: ICard[],
387
+ unreviewedCount: number
388
+ unreviewedNewCardCount: number
389
+ unreviewedOldCardCount: number
390
+ }
391
+
413
392
  export function fetchPost(url: string, data?: any, callback?: (response: IWebSocketData) => void, headers?: IObject): void;
414
393
 
415
394
  export function fetchSyncPost(url: string, data?: any): Promise<IWebSocketData>;
@@ -435,7 +414,7 @@ export function openTab(options: {
435
414
  app: App,
436
415
  doc?: {
437
416
  id: string, // 块 id
438
- action?: string[], // cb-get-all:获取所有内容;cb-get-focus:打开后光标定位在 id 所在的块;cb-get-hl: 打开后 id 块高亮
417
+ action?: TProtyleAction[],
439
418
  zoomIn?: boolean, // 是否缩放
440
419
  };
441
420
  pdf?: {
@@ -466,6 +445,8 @@ export function openTab(options: {
466
445
 
467
446
  export function getFrontend(): "desktop" | "desktop-window" | "mobile" | "browser-desktop" | "browser-mobile";
468
447
 
448
+ export function lockScreen(app: App): void
449
+
469
450
  export function getBackend(): "windows" | "linux" | "darwin" | "docker" | "android" | "ios";
470
451
 
471
452
  export function adaptHotkey(hotkey: string): string;
@@ -498,6 +479,7 @@ export abstract class Plugin {
498
479
  id: string,
499
480
  callback(protyle: Protyle): void,
500
481
  }[];
482
+ protyleOptions: IProtyleOption;
501
483
 
502
484
  constructor(options: {
503
485
  app: App,
@@ -509,6 +491,8 @@ export abstract class Plugin {
509
491
 
510
492
  onunload(): void;
511
493
 
494
+ uninstall(): void;
495
+
512
496
  onLayoutReady(): void;
513
497
 
514
498
  /**
@@ -578,6 +562,8 @@ export abstract class Plugin {
578
562
  y?: number,
579
563
  targetElement?: HTMLElement
580
564
  }): void;
565
+
566
+ updateCards(options: ICardData): Promise<ICardData> | ICardData;
581
567
  }
582
568
 
583
569
  export class Setting {
@@ -4,11 +4,70 @@ import {
4
4
  IObject,
5
5
  IOperation,
6
6
  IPosition,
7
- IProtyleOption, TTurnInto,
7
+ TTurnInto,
8
8
  TTurnIntoOne,
9
9
  TTurnIntoOneSub
10
10
  } from "./../siyuan";
11
11
 
12
+ type TProtyleAction = "cb-get-append" | // 向下滚动加载
13
+ "cb-get-before" | // 向上滚动加载
14
+ "cb-get-unchangeid" | // 上下滚动,定位时不修改 blockid
15
+ "cb-get-hl" | // 高亮
16
+ "cb-get-focus" | // 光标定位
17
+ "cb-get-focusfirst" | // 动态定位到第一个块
18
+ "cb-get-setid" | // 重置 blockid
19
+ "cb-get-all" | // 获取所有块
20
+ "cb-get-backlink" | // 悬浮窗为传递型需展示上下文
21
+ "cb-get-unundo" | // 不需要记录历史
22
+ "cb-get-scroll" | // 滚动到指定位置
23
+ "cb-get-context" | // 包含上下文
24
+ "cb-get-html" | // 直接渲染,不需要再 /api/block/getDocInfo,否则搜索表格无法定位
25
+ "cb-get-history" // 历史渲染
26
+
27
+ interface IToolbarItem {
28
+ /** 唯一标示 */
29
+ name: string;
30
+ /** 提示 */
31
+ tip?: string;
32
+ /** svg 图标 */
33
+ icon: string;
34
+ /** 快捷键 */
35
+ hotkey?: string;
36
+ /** 提示位置 */
37
+ tipPosition: string;
38
+ click?(protyle: Protyle): void;
39
+ }
40
+
41
+ export interface IProtyleOption {
42
+ action?: TProtyleAction[];
43
+ mode?: "preview" | "wysiwyg";
44
+ toolbar?: Array<string | IToolbarItem>;
45
+ blockId?: string;
46
+ key?: string;
47
+ scrollAttr?: {
48
+ rootId: string,
49
+ startId: string,
50
+ endId: string,
51
+ scrollTop: number,
52
+ focusId?: string,
53
+ focusStart?: number,
54
+ focusEnd?: number,
55
+ zoomInId?: string,
56
+ };
57
+ defId?: string;
58
+ render?: {
59
+ background?: boolean,
60
+ title?: boolean,
61
+ gutter?: boolean,
62
+ scroll?: boolean,
63
+ breadcrumb?: boolean,
64
+ breadcrumbDocName?: boolean,
65
+ };
66
+ typewriterMode?: boolean;
67
+
68
+ after?(protyle: Protyle): void;
69
+ }
70
+
12
71
  // REF: https://github.com/siyuan-note/siyuan/blob/dev/app/src/types/protyle.d.ts
13
72
  export interface IProtyle {
14
73
  app: App;
@@ -54,7 +113,7 @@ export interface IProtyle {
54
113
  contentElement?: HTMLElement;
55
114
  options: any;
56
115
  lute?: Lute;
57
- toolbar?: any;
116
+ toolbar?: Toolbar;
58
117
  preview?: any;
59
118
  hint?: any;
60
119
  upload?: any;