forked from jcollingj/caret
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
94 lines (87 loc) · 2.18 KB
/
types.ts
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
import { MarkdownView } from "obsidian";
export interface ViewportNode {
alwaysKeepLoaded: boolean;
app: any; // This should be more specific based on the actual type of 'app'
aspectRatio: number;
bbox: {
minX: number;
minY: number;
maxX: number;
maxY: number;
};
canvas: any; // This should be more specific based on the actual type of 'canvas'
child: any; // This should be more specific based on the actual type of 'child'
color: string;
containerEl: HTMLElement;
contentBlockerEl: HTMLElement;
contentEl: HTMLElement;
destroyed: boolean;
height: number;
id: string;
initialized: boolean;
isContentMounted: boolean;
isEditing: boolean;
nodeEl: HTMLElement;
placeholderEl: HTMLElement;
renderedZIndex: number;
resizeDirty: boolean;
text: string;
unknownData: {
id: string;
type: string;
text: string;
};
width: number;
x: number;
y: number;
zIndex: number;
}
export interface Node {
id: string;
type: string;
text: string;
x: number;
y: number;
width: number;
height: number;
color: string;
render(): void;
file?: string;
}
// TODO - improve types for everyting
export interface Canvas {
readonly: boolean;
view: MarkdownView;
x: number;
y: number;
nodes: Map<string, any>;
edges: Map<string, any>;
selection: Set<any>;
menu: CanvasMenu;
nodeIndex: any; // Gotta figure out the typing for this.
requestSave(save?: boolean, triggerBySelf?: boolean): void;
getData(): any;
getViewportNodes(): any[];
requestSave(save?: boolean, triggerBySelf?: boolean): void;
zoomToSelection(): void;
selectOnly(node: Node): void;
importData({}): void;
requestFrame(): void;
}
export interface CanvasMenu {
containerEl: HTMLElement;
menuEl: HTMLElement;
canvas: Canvas;
render(): void;
updateZIndex(): void;
}
export type Message = {
content: string;
role: string;
};
export type Edge = {
fromNode: string;
toNode: string;
fromSide: "left" | "right" | "top" | "bottom";
toSide: "left" | "right" | "top" | "bottom";
};