feat(plugin): implement canvas node plugin system with dynamic registration and remote installation

This commit is contained in:
HouYunFei
2026-07-15 11:47:25 +08:00
parent f0db29d8e3
commit eef4d96787
51 changed files with 4933 additions and 72 deletions
+6 -2
View File
@@ -1,5 +1,6 @@
import { CanvasNodeType } from "@/types/canvas";
import type { CanvasNodeMetadata } from "@/types/canvas";
import { getNodeSpec as getRegistryNodeSpec } from "@/lib/canvas/node-registry";
type CanvasNodeSpec = {
width: number;
@@ -44,6 +45,9 @@ export const NODE_SPECS = {
},
} satisfies Record<CanvasNodeType, CanvasNodeSpec>;
export function getNodeSpec(type: CanvasNodeType) {
return NODE_SPECS[type];
// 内置类型返回内置 spec;插件类型从注册表解析
export function getNodeSpec(type: string) {
if ((Object.values(CanvasNodeType) as string[]).includes(type)) return NODE_SPECS[type as CanvasNodeType];
const spec = getRegistryNodeSpec(type);
return { width: spec.width, height: spec.height, title: spec.title, metadata: spec.metadata };
}