Skip to content

Commit 17b0a00

Browse files
committed
🚚 Moved types of parsed objects to userscript/*.ts
1 parent 385e601 commit 17b0a00

File tree

4 files changed

+60
-60
lines changed

4 files changed

+60
-60
lines changed

scrapbox.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Omit } from "./utils.ts";
2-
export * from "./line.ts";
2+
export * from "./userscript/blocks.ts";
3+
export * from "./userscript/nodes.ts";
34

45
/** scrapboxの行のメタデータ */
56
export interface Line {
@@ -196,5 +197,3 @@ export type ProjectBackupWithMetadata = {
196197
lines: { text: string; updated: number; created: number }[];
197198
};
198199
};
199-
200-

userscript.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ParsedLine } from "./line.ts";
1+
import { ParsedLine } from "./userscript/blocks.ts";
22

33
export type Layout =
44
| "list"

userscript/blocks.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { Node, NodeWithoutIndent } from "./nodes.ts";
2+
3+
export type ParsedLine =
4+
& {
5+
text: string;
6+
id: string;
7+
userId: string;
8+
updated: number;
9+
created: number;
10+
section: {
11+
number: number;
12+
start: boolean;
13+
end: boolean;
14+
};
15+
}
16+
& ({
17+
title?: boolean;
18+
} | {
19+
codeBlock: CodeBlock;
20+
} | {
21+
tableBlock: TableBlock;
22+
} | {
23+
helpfeel: Helpfeel;
24+
} | {
25+
cli: Cli;
26+
} | {
27+
formulaLine?: true;
28+
nodes: NodeWithoutIndent[];
29+
} | {
30+
numberList?: { digit: number };
31+
formulaLine?: true;
32+
nodes: Node[];
33+
});
34+
35+
export type CodeBlock = {
36+
lang: string;
37+
filename?: string;
38+
indent: number;
39+
start: boolean;
40+
end: boolean;
41+
};
42+
export type TableBlock = {
43+
title: string;
44+
cells: string[];
45+
indent: number;
46+
start: boolean;
47+
end: boolean;
48+
};
49+
export type Helpfeel = {
50+
prefix: "?";
51+
entry: string;
52+
};
53+
export type Cli = {
54+
prefix: "$" | "%";
55+
command: string;
56+
};

line.ts renamed to userscript/nodes.ts

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,3 @@
1-
export type ParsedLine =
2-
& {
3-
text: string;
4-
id: string;
5-
userId: string;
6-
updated: number;
7-
created: number;
8-
section: {
9-
number: number;
10-
start: boolean;
11-
end: boolean;
12-
};
13-
}
14-
& ({
15-
title?: boolean;
16-
} | {
17-
codeBlock: CodeBlock;
18-
} | {
19-
tableBlock: TableBlock;
20-
} | {
21-
helpfeel: Helpfeel;
22-
} | {
23-
cli: Cli;
24-
} | {
25-
formulaLine?: true;
26-
nodes: NodeWithoutIndent[];
27-
} | {
28-
numberList?: { digit: number };
29-
formulaLine?: true;
30-
nodes: Node[];
31-
});
32-
33-
export type CodeBlock = {
34-
lang: string;
35-
filename?: string;
36-
indent: number;
37-
start: boolean;
38-
end: boolean;
39-
};
40-
export type TableBlock = {
41-
title: string;
42-
cells: string[];
43-
indent: number;
44-
start: boolean;
45-
end: boolean;
46-
};
47-
export type Helpfeel = {
48-
prefix: "?";
49-
entry: string;
50-
};
51-
export type Cli = {
52-
prefix: "$" | "%";
53-
command: string;
54-
};
55-
561
type NodeBase =
572
| PlainText
583
| Blank
@@ -79,7 +24,7 @@ type NodeBase =
7924
| UrlLink
8025
| Youtube
8126
| GoogleMap;
82-
type NodeWithoutIndent = NodeBase | Formula;
27+
export type NodeWithoutIndent = NodeBase | Formula;
8328
export type Node = NodeWithoutIndent | Indent;
8429
type UnitBase = {
8530
content: string;

0 commit comments

Comments
 (0)