mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 21:34:06 -06:00
JSON Canvas type definitions
This commit is contained in:
parent
d52b772e60
commit
497f60b487
1
quartz/components/pages/CanvasContent.tsx
Normal file
1
quartz/components/pages/CanvasContent.tsx
Normal file
@ -0,0 +1 @@
|
|||||||
|
import { QuartzCanvasComponent } from "../types"
|
||||||
@ -27,3 +27,51 @@ export type QuartzComponent = ComponentType<QuartzComponentProps> & {
|
|||||||
export type QuartzComponentConstructor<Options extends object | undefined = undefined> = (
|
export type QuartzComponentConstructor<Options extends object | undefined = undefined> = (
|
||||||
opts: Options,
|
opts: Options,
|
||||||
) => QuartzComponent
|
) => QuartzComponent
|
||||||
|
|
||||||
|
export type QuartzCanvasComponent = {
|
||||||
|
nodes?: CanvasNode[]
|
||||||
|
edges?: CanvasEdge[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export type CanvasNode = {
|
||||||
|
id: string
|
||||||
|
type: "text" | "file" | "link" | "group"
|
||||||
|
x: number
|
||||||
|
y: number
|
||||||
|
width: number
|
||||||
|
height: number
|
||||||
|
color?: CanvasColor
|
||||||
|
}
|
||||||
|
|
||||||
|
export type CanvasTextNode = CanvasNode & {
|
||||||
|
text: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type CanvasFileNode = CanvasNode & {
|
||||||
|
file: string
|
||||||
|
subpath?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type CanvasLinkNode = CanvasNode & {
|
||||||
|
url: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type CanvasGroupNode = CanvasNode & {
|
||||||
|
label?: string
|
||||||
|
background?: string
|
||||||
|
backgroundStyle?: "cover" | "ratio" | "repeat"
|
||||||
|
}
|
||||||
|
|
||||||
|
export type CanvasEdge = {
|
||||||
|
id: string
|
||||||
|
fromNode: string
|
||||||
|
toNode: string
|
||||||
|
fromSide?: "top" | "bottom" | "left" | "right"
|
||||||
|
toSide?: "top" | "bottom" | "left" | "right"
|
||||||
|
fromEnd?: "none" | "arrow"
|
||||||
|
toEnd?: "none" | "arrow"
|
||||||
|
color?: CanvasColor
|
||||||
|
label?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type CanvasColor = "1" | "2" | "3" | "4" | "5" | "6" | "#${string}"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user