Skip to content

Commit 57e0088

Browse files
committed
add @types
1 parent 9b46057 commit 57e0088

File tree

3 files changed

+66
-74
lines changed

3 files changed

+66
-74
lines changed

src/api.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
* API 文档见 [API_zh_CN.md](https://github.com/siyuan-note/siyuan/blob/master/API_zh_CN.md)
77
*/
88

9-
import {
10-
Block, Notebook, NotebookConf, NotebookId, DocumentId, BlockId,
11-
doOperation, PreviousID, ParentID, BlockType, BlockSubType
12-
} from "sy-dtype";
139
import { fetchSyncPost, IWebSocketData } from "siyuan";
1410

1511

src/sy-dtype.d.ts

Lines changed: 0 additions & 70 deletions
This file was deleted.

src/types/index.d.ts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* Copyright (c) 2023 frostime. All rights reserved.
3+
*/
4+
5+
/**
6+
* Frequently used data structures in SiYuan
7+
*/
8+
type DocumentId = string;
9+
type BlockId = string;
10+
type NotebookId = string;
11+
type PreviousID = BlockId;
12+
type ParentID = BlockId | DocumentId;
13+
14+
type Notebook = {
15+
id: NotebookId;
16+
name: string;
17+
icon: string;
18+
sort: number;
19+
closed: boolean;
20+
}
21+
22+
type NotebookConf = {
23+
name: string;
24+
closed: boolean;
25+
refCreateSavePath: string;
26+
createDocNameTemplate: string;
27+
dailyNoteSavePath: string;
28+
dailyNoteTemplatePath: string;
29+
}
30+
31+
type BlockType = "d" | "s" | "h" | "t" | "i" | "p" | "f" | "audio" | "video" | "other";
32+
33+
type BlockSubType = "d1" | "d2" | "s1" | "s2" | "s3" | "t1" | "t2" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "table" | "task" | "toggle" | "latex" | "quote" | "html" | "code" | "footnote" | "cite" | "collection" | "bookmark" | "attachment" | "comment" | "mindmap" | "spreadsheet" | "calendar" | "image" | "audio" | "video" | "other";
34+
35+
type Block = {
36+
id: BlockId;
37+
parent_id?: BlockId;
38+
root_id: DocumentId;
39+
hash: string;
40+
box: string;
41+
path: string;
42+
hpath: string;
43+
name: string;
44+
alias: string;
45+
memo: string;
46+
tag: string;
47+
content: string;
48+
fcontent?: string;
49+
markdown: string;
50+
length: number;
51+
type: BlockType;
52+
subtype: BlockSubType;
53+
ial?: { [key: string]: string };
54+
sort: number;
55+
created: string;
56+
updated: string;
57+
}
58+
59+
type doOperation = {
60+
action: string;
61+
data: string;
62+
id: BlockId;
63+
parentID: BlockId | DocumentId;
64+
previousID: BlockId;
65+
retData: null;
66+
}

0 commit comments

Comments
 (0)