yjs

npm

Bidirectional Angular Signal bindings for Yjs CRDT real-time collaborative state.

TypeScriptmain.ts
import { yjsSignal, YjsDocService } from '@angular-helpers/yjs';
  
  const yjs = inject(YjsDocService);
  const yMap = yjs.doc.getMap('doc');
  const title = yjsSignal(yMap, { key: 'title' });

πŸ”„
Signals & State

yjsSignal

Creates a bidirectional Angular WritableSignal synchronized with Yjs CRDT types (Y.Map, Y.Array, Y.Text). Features non-destructive delta reconciliation, recursive nested CRDT structure preservation, key-level mapping, and configurable batching. Fully interoperable as a model driver for Angular Signal Forms (@angular/forms/signals).

Explore API→

injectYjsUndoManager

Creates a reactive Angular adapter for Yjs UndoManager. Exposes canUndo and canRedo read-only Signals to easily bind undo/redo UI buttons in collaborative editors. Automatically tracks local signal and directive edits by default.

Explore API→

injectYjsAwareness

Connects an Angular component or service to a Yjs Awareness protocol instance. Exposes reactive signals for local presence, active remote collaborators, and cursor/state updates with automatic tab visibility resync and phantom cleanup.

Explore API→

injectYjsWebsocket

Connects a Y.Doc to a y-websocket server. Exposes status() and isSynced() read-only Signals to track real-time WebSocket connection state.

Explore API→

injectYjsIndexeddb

Persists a Y.Doc to local IndexedDB storage using y-indexeddb. Exposes reactive isHydrated, isHydrating, and synced Signals to easily guard SSR hydration and @defer blocks.

Explore API→

YjsTextDirective

Angular directive that binds a Y.Text CRDT instance to an or element. Automatically synchronizes collaborative edits bidirectionally and retains cursor and selection position across concurrent remote changes.

Explore API→

YjsDocService

Injectable Angular service providing a managed singleton Y.Doc instance with lifecycle management and cleanup helpers.

Explore API→
LCP N/A
CLS N/A
INP N/A