Created
March 11, 2024 19:02
-
-
Save egeozcan/27db06f6771dcf214f0f92bce8c4fe79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type CanvasColor = string | 1 | 2 | 3 | 4 | 5 | 6; | |
interface Canvas { | |
nodes?: Node[]; | |
edges?: Edge[]; | |
} | |
type Node = TextNode | FileNode | LinkNode | GroupNode; | |
interface BaseNode { | |
id: string; | |
type: string; | |
x: number; | |
y: number; | |
width: number; | |
height: number; | |
color?: CanvasColor; | |
} | |
interface TextNode extends BaseNode { | |
type: "text"; | |
text: string; | |
} | |
interface FileNode extends BaseNode { | |
type: "file"; | |
file: string; | |
subpath?: string; | |
} | |
interface LinkNode extends BaseNode { | |
type: "link"; | |
url: string; | |
} | |
interface GroupNode extends BaseNode { | |
type: "group"; | |
label?: string; | |
background?: string; | |
backgroundStyle?: "cover" | "ratio" | "repeat"; | |
} | |
interface Edge { | |
id: string; | |
fromNode: string; | |
fromSide?: "top" | "right" | "bottom" | "left"; | |
fromEnd?: "none" | "arrow"; | |
toNode: string; | |
toSide?: "top" | "right" | "bottom" | "left"; | |
toEnd?: "none" | "arrow"; | |
color?: CanvasColor; | |
label?: string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment