supermemory/apps/web/components/memory-graph/index.ts
Vorflux AI 1c5ef7e5ed Rewrite @supermemory/memory-graph with perf optimizations and consolidate consumers
Package changes (packages/memory-graph):
- Spatial grid nearest-neighbor: O(n^2) -> O(n*k) for doc-doc edge rendering
- Zoom-based edge culling: skip low-similarity edges at low zoom levels
- Modular canvas engine from mono repo (renderer, simulation, viewport, hit-test)
- Remove vanilla-extract CSS, use inline styles only
- Add motion/react for slide-in animations
- Export mock data generator for stress testing
- Add performance and integration tests (15/15 pass)

Web app changes (apps/web):
- Remove local graph implementation (~4400 lines deleted)
- Add thin wrapper (memory-graph-wrapper.tsx) using useGraphApi hook
- Keep app-specific graph-card.tsx and use-graph-api.ts

Playground changes (apps/memory-graph-playground):
- Add stress test buttons (50/100/200/500 docs)
- Add mock data generation via package
- Convert DocumentWithMemories to GraphApiDocument format
- Show FPS counter during stress tests

All TypeScript compiles clean. Performance tests: 15/15 pass.
2026-03-26 17:58:28 +00:00

19 lines
591 B
TypeScript

// Re-export the wrapper as MemoryGraph (same name, drop-in replacement)
export { MemoryGraph } from "./memory-graph-wrapper"
export type { MemoryGraphWrapperProps as MemoryGraphProps } from "./memory-graph-wrapper"
// Keep GraphCard (app-specific)
export { GraphCard } from "./graph-card"
export type { GraphCardProps } from "./graph-card"
// Re-export useful types from the package
export type {
GraphNode,
GraphEdge,
GraphApiDocument,
GraphApiMemory,
GraphApiEdge,
} from "@supermemory/memory-graph"
// Keep the API hook export
export { useGraphApi } from "./hooks/use-graph-api"