Enhance canvas components with improved error handling and aspect ratio normalization

- Added error name tracking in NodeErrorBoundary for better debugging.
- Introduced aspect ratio normalization in PromptNode to ensure valid values are used.
- Updated debounced state management in CanvasInner for improved performance.
- Enhanced SelectContent component to support optional portal rendering.
This commit is contained in:
Matthias
2026-04-02 08:26:06 +02:00
parent 2142249ed5
commit 624beac6dc
10 changed files with 552 additions and 100 deletions

View File

@@ -2,76 +2,23 @@
import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";
import {
nodeTypeValidator,
phase1NodeTypeValidator,
} from "./node-type-validator";
// ============================================================================
// Node Types
// ============================================================================
// Phase 1 Node Types
const phase1NodeTypes = v.union(
// Quelle
v.literal("image"),
v.literal("text"),
v.literal("prompt"),
// KI-Ausgabe
v.literal("ai-image"),
// Canvas & Layout
v.literal("group"),
v.literal("frame"),
v.literal("note"),
v.literal("compare")
);
const phase1NodeTypes = phase1NodeTypeValidator;
// Alle Node Types (Phase 1 + spätere Phasen)
// Phase 2+3 Typen sind hier schon definiert, damit das Schema nicht bei
// jedem Phasenübergang migriert werden muss. Die UI zeigt nur die Typen
// der jeweiligen Phase an.
const nodeType = v.union(
// Quelle (Phase 1)
v.literal("image"),
v.literal("text"),
v.literal("prompt"),
// Quelle (Phase 2)
v.literal("color"),
v.literal("video"),
v.literal("asset"),
// KI-Ausgabe (Phase 1)
v.literal("ai-image"),
// KI-Ausgabe (Phase 2)
v.literal("ai-text"),
v.literal("ai-video"),
// KI-Ausgabe (Phase 3)
v.literal("agent-output"),
// Transformation (Phase 2)
v.literal("crop"),
v.literal("bg-remove"),
v.literal("upscale"),
// Transformation (Phase 3)
v.literal("style-transfer"),
v.literal("face-restore"),
// Bildbearbeitung (Phase 2)
v.literal("curves"),
v.literal("color-adjust"),
v.literal("light-adjust"),
v.literal("detail-adjust"),
v.literal("render"),
// Steuerung (Phase 2)
v.literal("splitter"),
v.literal("loop"),
v.literal("agent"),
// Steuerung (Phase 3)
v.literal("mixer"),
v.literal("switch"),
// Canvas & Layout (Phase 1)
v.literal("group"),
v.literal("frame"),
v.literal("note"),
v.literal("compare"),
// Canvas & Layout (Phase 2)
v.literal("text-overlay"),
// Canvas & Layout (Phase 3)
v.literal("comment"),
v.literal("presentation")
);
const nodeType = nodeTypeValidator;
// Node Status — direkt am Node sichtbar (UX-Strategie aus dem PRD)
const nodeStatus = v.union(