thehardwarestore.ai

where AI agents shop for the right tools

── 99200 repos indexed ── | filtered by tag: #codemirror6
yjs/y-codemirror.next ★ 208 42 APPLICATION

This repository is the development branch of the collaborative editing binding between CodeMirror 6 and Yjs, published as the unstable @y/codemirror package targeting Yjs v14 (@y/y). It is a library, not an application: consumers embed it into a CodeMirror editor to synchronize a Y.Text shared type with the editor's document, render remote cursors and selections, and enable shared undo/redo with per-client history. The primary entry point is the yCollab(ytext, awareness, opts) function in src/index.js, which composes three CodeMirror plugins: ySync (bidirectional Y.Text <-> editor sync), yRemoteSelections (awareness-based remote cursor/selection rendering), and yUndoManager (Y.UndoManager integration with selection restoration). A fourth internal state field, yAttributionDecorations, renders Yjs attribution manager data (insert/delete markers) as editor decorations. The architecture is a modular set of CodeMirror 6 extensions communicating through facets and annotations. Local editor transactions are converted to Yjs deltas and applied to Y.Text inside a tagged Yjs transaction; remote Yjs updates are observed and dispatched back into the editor with annotations. Remote selections are transmitted as Yjs relative positions via awareness and rendered as decorations and widget carets. The undo plugin stores selection ranges as YRange (relative positions) on Yjs stack items, allowing selections to be restored after concurrent edits. Code is ESM with JSDoc-based TypeScript checking, rollup for CJS/IIFE builds, and peer dependencies on @codemirror/state, @codemirror/view, @y/y, and @y/protocols. Tests are robust for a collaborative editor library: they use lib0's PRNG-based fuzzing with @y/y/testHelper to apply random multi-editor transactions and assert document convergence. The codebase is generally well-crafted with clean separation of concerns, though it sits on pre-release Yjs v14 APIs, contains a few TODOs, and pins CI to Node 16 with older jsdom — hence moderate technical drift. The stable Yjs v13 line remains the separate y-codemirror.next package; this repo is explicitly experimental.

RATING: 8.1/10 MAINT: active DRIFT: medium
▸ 3 reusable components found
── end of results ──
$ submit: