feat: add benchmark settings panel
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 1m59s

This commit is contained in:
2024-05-01 23:05:04 +02:00
parent 8bf2958e1d
commit d9afec5bf6
39 changed files with 1253 additions and 741 deletions

View File

@ -1,5 +1,6 @@
export type { NodeInput } from "./inputs";
export type { NodeRegistry, RuntimeExecutor, RuntimeCache } from "./components";
export type { Node, NodeDefinition, Socket, NodeId, Edge, Graph } from "./types";
export { NodeSchema, GraphSchema } from "./types";
export { NodeDefinitionSchema } from "./types";

View File

@ -3,10 +3,18 @@ import { NodeInputSchema } from "./inputs";
export type NodeId = `${string}/${string}/${string}`;
export const NodeSchema = z.object({
id: z.number(),
type: z.string(),
props: z.record(z.union([z.number(), z.array(z.number())])).optional(),
meta: z.object({
title: z.string().optional(),
lastModified: z.string().optional(),
}).optional(),
position: z.tuple([z.number(), z.number()])
});
export type Node = {
id: number;
type: NodeId;
props?: Record<string, number | number[]>,
tmp?: {
depth?: number;
mesh?: any;
@ -22,13 +30,8 @@ export type Node = {
ref?: HTMLElement;
visible?: boolean;
isMoving?: boolean;
},
meta?: {
title?: string;
lastModified?: string;
},
position: [x: number, y: number]
}
}
} & z.infer<typeof NodeSchema>;
export const NodeDefinitionSchema = z.object({
id: z.string(),
@ -50,16 +53,17 @@ export type Socket = {
position: [number, number];
};
export type Edge = [Node, number, Node, string];
export type Graph = {
id: number;
meta?: {
title?: string;
lastModified?: string;
},
settings?: Record<string, any>,
nodes: Node[];
edges: [number, number, number, string][];
}
export const GraphSchema = z.object({
id: z.number().optional(),
meta: z.object({
title: z.string().optional(),
lastModified: z.string().optional(),
}).optional(),
settings: z.record(z.any()).optional(),
nodes: z.array(NodeSchema),
edges: z.array(z.tuple([z.number(), z.number(), z.number(), z.string()])),
});
export type Graph = z.infer<typeof GraphSchema> & { nodes: Node[] };