-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
46 lines (39 loc) · 1.51 KB
/
Copy pathtypes.ts
File metadata and controls
46 lines (39 loc) · 1.51 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
export interface Item {
id: string;
text: string;
children: string[];
isCompleted: boolean;
collapsed: boolean;
fontSize?: 'small' | 'medium' | 'large';
isTask?: boolean;
isShortcut?: boolean;
isBold?: boolean;
isItalic?: boolean;
isUnderlined?: boolean;
}
export interface ItemMap {
[id: string]: Item;
}
export interface WorkflowyState {
items: ItemMap;
rootId: string; // The constant absolute root of the data
}
export type DropPosition = 'before' | 'after' | 'inside';
export type SaveStatus = 'saved' | 'saving' | 'error' | 'saved-local';
export type Action =
| { type: 'ADD_ITEM'; afterId: string | null; parentId: string; newId?: string }
| { type: 'UPDATE_TEXT'; id: string; text: string }
| { type: 'INDENT'; id: string; parentId: string }
| { type: 'OUTDENT'; id: string; parentId: string }
| { type: 'DELETE'; id: string; parentId: string }
| { type: 'MERGE_UP'; id: string; parentId: string; previousItemId: string }
| { type: 'TOGGLE_COLLAPSE'; id: string }
| { type: 'MOVE'; dragId: string; targetId: string; position: DropPosition }
| { type: 'MOVE_ITEMS'; dragIds: string[]; targetId: string; position: DropPosition }
| { type: 'LOAD_STATE'; state: WorkflowyState }
| { type: 'CHANGE_FONT_SIZE'; id: string; size: 'small' | 'medium' | 'large' }
| { type: 'SET_IS_TASK'; id: string; isTask: boolean }
| { type: 'TOGGLE_IS_SHORTCUT'; id: string }
| { type: 'TOGGLE_STYLE'; id: string; style: 'bold' | 'italic' | 'underline' }
| { type: 'UNDO' }
| { type: 'REDO' };