Migrate from a custom canvas
Checklist for replacing in-app graph components with @restormel/ui-graph-svelte and @restormel/graph-core—imports, Vite, CSS, deduplication, and verification.
This guide assumes you are replacing local graph code, not greenfield. Follow the canonical SvelteKit integration page first, then use the checklist below.
Checklist
- Add npm dependencies and
ssr.noExternalentries (see integration guide). - Swap imports: local canvas / detail / semantic style helpers →
@restormel/ui-graph-svelte. - Swap types and layout/trace/workspace →
@restormel/graph-coresubpaths or barrel. - Ensure global CSS satisfies the variable contract; add
styles.cssfrom the UI package if needed. - Remove duplicate components and stale
viewModelcopies from the repo—single source of truth is npm. - Run
pnpm run check, targeted tests, and a manual smoke route if you have one.
Decision hints
- Compare / lineage / projection / evaluation? Prefer the published
@restormel/graph-reasoning-extensionspackage (plus@restormel/contracts) and map results intoGraphData— do not fork Contract v0 DTOs. Add internal packages only for org-specific logic on top. - Monorepo pattern: npm canvas + contracts-backed extensions + one adapter that
converts snapshots into
GraphData. See Performance & scale if you need to cap graph size. - Already deleted legacy graph code? Focus on adapter correctness and CSS parity; run the verification commands from the integration page.
Performance
Large graphs: pre-filter or cluster in your adapter before calling computeLayout / GraphCanvas.
Details: Performance & scale.
Risk callouts
- Duplicate package names: a monorepo workspace package named
@restormel/graph-corevs npm can confuse resolution—prefer a single source (npm or explicit tarball overrides). - Lockfile pins: ensure
ui-graph-svelteandgraph-coreresolve the same version. - Registry lag: immediately after
graph-v*publishes,npm viewcan be stale briefly.
Maintainer detail: restormel-graph-sophia-consumer.md.