Skip to content

feat(canvas): Add lane-based canvas with persistent card positions - #7

Merged
nfebe merged 1 commit into
mainfrom
feat/canvas
Nov 21, 2026
Merged

nfebe merged 1 commit into
mainfrom
feat/canvas

Conversation

@nfebe

@nfebe nfebe commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Provide a reusable canvas for exploring related cards while preserving spatial context across visits. The memory type terminology change retains a deprecated compatibility alias so existing consumers can migrate without changing their current usage.

Show related cards in named lanes with zoom, fit and reset controls.
Keep layouts deterministic and optionally retain dragged positions so
readers can return to a familiar arrangement.

Rename memory kind terminology to memory types while preserving the
deprecated composable name and its return shape for existing consumers.
@sourceant

sourceant Bot commented Oct 31, 2026

Copy link
Copy Markdown

Code Review Summary

Adds a lane-based Canvas built on @vue-flow/core, with CanvasCard and CanvasControls, a deterministic lane layout module, localStorage-backed card positions, and an edge registry that merges and deduplicates independent edge sources. Renames useContextKinds to useMemoryTypes with type-named fields while keeping a deprecated alias under the old kind names. CodeGraph and CodeGraph's ink lookup now use the new composable; canvas color tokens are added for both themes.

🚀 Key Improvements

  • Deterministic lane layout with saved drag positions keeps the same picture across visits
  • Edge registry isolates failing sources and deduplicates shared edges
  • Deprecated useContextKinds alias preserves existing consumers during migration

📉 Regressions

  • @vue-flow/core is a peer dependency, so existing consumers of unrelated components must install it

💡 Minor Suggestions

  • The module was renamed, so @sourceant/design/composables/useContextKinds no longer resolves even though the function is kept and the CHANGELOG promises 0.3.0 keeps working unchanged. The "./*": "./src/*" export makes path imports part of the shipped surface. Add a src/composables/useContextKinds.ts shim re-exporting ./useMemoryTypes for this release.
  • CanvasEdgeSource.load may be synchronous, so a source that throws synchronously throws inside map before allSettled sees anything, rejecting the whole load and dropping every other source's edges. Wrapping each call in an async arrow converts a sync throw into a rejected promise that allSettled absorbs, matching the documented 'one source failing costs its own lines' contract.
  • Review coverage is incomplete. Inspect the execution details before approving.

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

return { tone, fill, ink, legend, types: Object.keys(TONE), typeOptions: OPTIONS, typeDescriptions: DESCRIBED }
}

/** @deprecated Use `useMemoryTypes`. Kept, under its old field names, for one release. */

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module was renamed, so @sourceant/design/composables/useContextKinds no longer resolves even though the function is kept and the CHANGELOG promises 0.3.0 keeps working unchanged. The "./*": "./src/*" export makes path imports part of the shipped surface. Add a src/composables/useContextKinds.ts shim re-exporting ./useMemoryTypes for this release.

Comment thread src/canvas/edges.ts
async load(subject, only) {
const wanted = only ? new Set(only) : null
const chosen = [...registered.values()].filter(s => !wanted || wanted.has(s.type))
const results = await Promise.allSettled(chosen.map(s => s.load(subject)))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CanvasEdgeSource.load may be synchronous, so a source that throws synchronously throws inside map before allSettled sees anything, rejecting the whole load and dropping every other source's edges. Wrapping each call in an async arrow converts a sync throw into a rejected promise that allSettled absorbs, matching the documented 'one source failing costs its own lines' contract.

Suggested change
const results = await Promise.allSettled(chosen.map(s => s.load(subject)))
const results = await Promise.allSettled(chosen.map(async s => s.load(subject)))

@nfebe
nfebe merged commit b733b8d into main Nov 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant