@oh-just-another/collab 0.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +21 -0
  3. package/README.md +57 -0
  4. package/dist/.tsbuildinfo +1 -0
  5. package/dist/awareness.d.ts +60 -0
  6. package/dist/awareness.d.ts.map +1 -0
  7. package/dist/awareness.js +89 -0
  8. package/dist/awareness.js.map +1 -0
  9. package/dist/bind-awareness.d.ts +33 -0
  10. package/dist/bind-awareness.d.ts.map +1 -0
  11. package/dist/bind-awareness.js +125 -0
  12. package/dist/bind-awareness.js.map +1 -0
  13. package/dist/bind-editor.d.ts +34 -0
  14. package/dist/bind-editor.d.ts.map +1 -0
  15. package/dist/bind-editor.js +87 -0
  16. package/dist/bind-editor.js.map +1 -0
  17. package/dist/branch-doc.d.ts +53 -0
  18. package/dist/branch-doc.d.ts.map +1 -0
  19. package/dist/branch-doc.js +188 -0
  20. package/dist/branch-doc.js.map +1 -0
  21. package/dist/constants.d.ts +26 -0
  22. package/dist/constants.d.ts.map +1 -0
  23. package/dist/constants.js +26 -0
  24. package/dist/constants.js.map +1 -0
  25. package/dist/encryption.d.ts +74 -0
  26. package/dist/encryption.d.ts.map +1 -0
  27. package/dist/encryption.js +124 -0
  28. package/dist/encryption.js.map +1 -0
  29. package/dist/index.d.ts +12 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +13 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/mentions.d.ts +33 -0
  34. package/dist/mentions.d.ts.map +1 -0
  35. package/dist/mentions.js +57 -0
  36. package/dist/mentions.js.map +1 -0
  37. package/dist/merge.d.ts +59 -0
  38. package/dist/merge.d.ts.map +1 -0
  39. package/dist/merge.js +2 -0
  40. package/dist/merge.js.map +1 -0
  41. package/dist/scene-doc.d.ts +41 -0
  42. package/dist/scene-doc.d.ts.map +1 -0
  43. package/dist/scene-doc.js +111 -0
  44. package/dist/scene-doc.js.map +1 -0
  45. package/dist/transport-provider.d.ts +21 -0
  46. package/dist/transport-provider.d.ts.map +1 -0
  47. package/dist/transport-provider.js +105 -0
  48. package/dist/transport-provider.js.map +1 -0
  49. package/dist/yjs-history.d.ts +68 -0
  50. package/dist/yjs-history.d.ts.map +1 -0
  51. package/dist/yjs-history.js +215 -0
  52. package/dist/yjs-history.js.map +1 -0
  53. package/package.json +59 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport-provider.js","sourceRoot":"","sources":["../src/transport-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAkB,MAAM,uBAAuB,CAAC;AAGpG;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,GAAG,CAAC,CAAC;AAClB,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAQ3B,MAAM,OAAO,iBAAiB;IACX,GAAG,CAAQ;IACX,SAAS,CAAY;IACrB,SAAS,CAAmB;IAC5B,MAAM,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACtC,kBAAkB,CAAa;IAEhD,YAAY,OAAiC;QAC3C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC;QAE3C,iEAAiE;QACjE,gCAAgC;QAChC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC1C,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACtD,CAAC;QAED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G,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC5C,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IACb,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACjB,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { invert, type Patch } from "@oh-just-another/scene";
2
+ import type { HistoryProvider, TransactionHandle } from "@oh-just-another/history";
3
+ import type { SceneDoc } from "./scene-doc.js";
4
+ /**
5
+ * CRDT-aware history backend backed by `Y.UndoManager`.
6
+ *
7
+ * In a collaborative session, the linear `History` from
8
+ * `@oh-just-another/history` undoes *any* recent change, including a
9
+ * peer's. `YjsHistory` scopes undo to the local client by tagging
10
+ * every locally-pushed Yjs transaction with a shared origin and
11
+ * tracking only that origin in the underlying `Y.UndoManager`.
12
+ *
13
+ * Wiring (the host's job):
14
+ *
15
+ * const sceneDoc = new SceneDoc();
16
+ * const history = new YjsHistory(sceneDoc);
17
+ * const editor = new Editor({ ..., history });
18
+ * bindEditor(editor, sceneDoc);
19
+ *
20
+ * The provider also keeps a small parallel scene mirror (`getScene`
21
+ * callback the host hands in or — by default — wrapped against
22
+ * `sceneDoc.snapshot()`) so it can compute the inverse of every
23
+ * pushed patch in CRDT-land. That inverse is what gets applied
24
+ * remotely through the same `applyDelta` machinery `bindEditor`
25
+ * already uses, so peers receive a single coalesced patch per
26
+ * undo step.
27
+ */
28
+ export interface YjsHistoryOptions {
29
+ /**
30
+ * Number of undo steps to keep on the stack. Mirrors the linear
31
+ * `History.limit`. Default: governed by `Y.UndoManager` defaults.
32
+ */
33
+ readonly captureLimit?: number;
34
+ /**
35
+ * Y.UndoManager `captureTimeout` — coalesces multiple Yjs
36
+ * transactions in this window into one undo step. Default 0
37
+ * (one editor mutation = one undo step). Set to e.g. 500 to
38
+ * group "typing in a row" type input.
39
+ */
40
+ readonly captureTimeout?: number;
41
+ }
42
+ export declare class YjsHistory implements HistoryProvider {
43
+ private readonly doc;
44
+ private readonly origin;
45
+ private readonly maps;
46
+ private readonly viewportMap;
47
+ private readonly undoManager;
48
+ private readonly snapshot;
49
+ private current;
50
+ constructor(sceneDoc: SceneDoc, options?: YjsHistoryOptions);
51
+ push(p: Patch): void;
52
+ undo(): Patch | null;
53
+ redo(): Patch | null;
54
+ clear(): void;
55
+ transaction(): TransactionHandle;
56
+ get canUndo(): boolean;
57
+ get canRedo(): boolean;
58
+ get size(): number;
59
+ /**
60
+ * Mirror a scene patch into the CRDT. The kernel's `apply(scene,
61
+ * patch)` writes to a fresh Scene; the equivalent on the Y.Map
62
+ * side applies the patch to the local mirror, then replaces the
63
+ * divergent maps with the new values inside the tracked transaction.
64
+ */
65
+ private applyToCrdt;
66
+ }
67
+ export { invert };
68
+ //# sourceMappingURL=yjs-history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yjs-history.d.ts","sourceRoot":"","sources":["../src/yjs-history.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,MAAM,EAEN,KAAK,KAAK,EAEX,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,qBAAa,UAAW,YAAW,eAAe;IAChD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAKnB;IACF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAiB;IAC7C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgB;IAG5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IACvC,OAAO,CAAC,OAAO,CAAQ;gBAEX,QAAQ,EAAE,QAAQ,EAAE,OAAO,GAAE,iBAAsB;IAmC/D,IAAI,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAYpB,IAAI,IAAI,KAAK,GAAG,IAAI;IASpB,IAAI,IAAI,KAAK,GAAG,IAAI;IASpB,KAAK,IAAI,IAAI;IAIb,WAAW,IAAI,iBAAiB;IAwBhC,IAAI,OAAO,IAAI,OAAO,CAErB;IACD,IAAI,OAAO,IAAI,OAAO,CAErB;IACD,IAAI,IAAI,IAAI,MAAM,CAIjB;IAED;;;;;OAKG;IACH,OAAO,CAAC,WAAW;CAYpB;AA8ED,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,215 @@
1
+ import * as Y from "yjs";
2
+ import { apply, batch, invert, isNoop, } from "@oh-just-another/scene";
3
+ export class YjsHistory {
4
+ doc;
5
+ origin;
6
+ maps;
7
+ viewportMap;
8
+ undoManager;
9
+ // Snapshot mirror used to compute patch inverses.
10
+ snapshot;
11
+ current;
12
+ constructor(sceneDoc, options = {}) {
13
+ this.doc = sceneDoc.doc;
14
+ this.origin = Symbol("yjs-history");
15
+ this.maps = [
16
+ sceneDoc.elements,
17
+ sceneDoc.links,
18
+ sceneDoc.layers,
19
+ sceneDoc.annotations,
20
+ ];
21
+ this.viewportMap = sceneDoc.viewport;
22
+ this.snapshot = () => sceneDoc.snapshot();
23
+ this.current = this.snapshot();
24
+ const tracked = [...this.maps, this.viewportMap];
25
+ this.undoManager = new Y.UndoManager(tracked, {
26
+ trackedOrigins: new Set([this.origin]),
27
+ captureTimeout: options.captureTimeout ?? 0,
28
+ });
29
+ if (options.captureLimit !== undefined) {
30
+ // Y.UndoManager doesn't expose `limit` post-construction; the
31
+ // host constructs a fresh provider when they need a new cap.
32
+ // The option is best-effort for parity with `HistoryOptions`.
33
+ void options.captureLimit;
34
+ }
35
+ // Keep the mirror in sync with every doc transaction (local or
36
+ // remote). Without this, a remote-coming change would leave
37
+ // `this.current` stale and the next push() would compute the
38
+ // inverse against a wrong scene.
39
+ this.doc.on("afterTransaction", () => {
40
+ this.current = this.snapshot();
41
+ });
42
+ }
43
+ push(p) {
44
+ if (isNoop(p))
45
+ return;
46
+ // Apply the patch to the doc inside a tracked transaction so
47
+ // the UndoManager records it. The doc itself is the source of
48
+ // truth — the editor calls push() after already mutating its
49
+ // local scene; we need to mirror that mutation into the CRDT.
50
+ this.doc.transact(() => {
51
+ this.applyToCrdt(p);
52
+ }, this.origin);
53
+ this.current = this.snapshot();
54
+ }
55
+ undo() {
56
+ const before = this.current;
57
+ const stackEntry = this.undoManager.undo();
58
+ if (!stackEntry)
59
+ return null;
60
+ const after = this.snapshot();
61
+ this.current = after;
62
+ return diffAsPatch(before, after);
63
+ }
64
+ redo() {
65
+ const before = this.current;
66
+ const stackEntry = this.undoManager.redo();
67
+ if (!stackEntry)
68
+ return null;
69
+ const after = this.snapshot();
70
+ this.current = after;
71
+ return diffAsPatch(before, after);
72
+ }
73
+ clear() {
74
+ this.undoManager.clear();
75
+ }
76
+ transaction() {
77
+ const buffer = [];
78
+ let open = true;
79
+ return {
80
+ add: (p) => {
81
+ if (!open)
82
+ throw new Error("Transaction is no longer open");
83
+ if (!isNoop(p))
84
+ buffer.push(p);
85
+ },
86
+ commit: () => {
87
+ if (!open)
88
+ return;
89
+ open = false;
90
+ if (buffer.length === 0)
91
+ return;
92
+ this.doc.transact(() => {
93
+ for (const p of buffer)
94
+ this.applyToCrdt(p);
95
+ }, this.origin);
96
+ this.current = this.snapshot();
97
+ },
98
+ cancel: () => {
99
+ open = false;
100
+ },
101
+ isOpen: () => open,
102
+ };
103
+ }
104
+ get canUndo() {
105
+ return this.undoManager.canUndo();
106
+ }
107
+ get canRedo() {
108
+ return this.undoManager.canRedo();
109
+ }
110
+ get size() {
111
+ // Yjs's UndoManager exposes `undoStack` length as a stand-in
112
+ // for "how many undo steps available". Useful for counter UIs.
113
+ return this.undoManager.undoStack.length;
114
+ }
115
+ /**
116
+ * Mirror a scene patch into the CRDT. The kernel's `apply(scene,
117
+ * patch)` writes to a fresh Scene; the equivalent on the Y.Map
118
+ * side applies the patch to the local mirror, then replaces the
119
+ * divergent maps with the new values inside the tracked transaction.
120
+ */
121
+ applyToCrdt(p) {
122
+ const before = this.current;
123
+ const after = apply(before, p);
124
+ diffMapInto(before.elements, after.elements, this.maps[0]);
125
+ diffMapInto(before.links, after.links, this.maps[1]);
126
+ diffMapInto(before.layers, after.layers, this.maps[2]);
127
+ diffMapInto(before.annotations, after.annotations, this.maps[3]);
128
+ if (before.viewport !== after.viewport) {
129
+ this.viewportMap.set("current", after.viewport);
130
+ }
131
+ this.current = after;
132
+ }
133
+ }
134
+ /**
135
+ * Produce a minimal patch describing the difference between two
136
+ * scenes. Used after Y.UndoManager rewinds the CRDT so the Editor
137
+ * can apply the corresponding patch to its local scene mirror.
138
+ *
139
+ * Structural: every shape/edge/layer/annotation present-or-absent
140
+ * on each side gets a single add/remove/update op. A rewind that
141
+ * landed on the same state resolves to a `null` return — the caller
142
+ * skips applying.
143
+ */
144
+ const diffAsPatch = (before, after) => {
145
+ const ops = [];
146
+ for (const [id, prev] of before.elements) {
147
+ const next = after.elements.get(id);
148
+ if (next === undefined)
149
+ ops.push({ kind: "element", id, before: prev, after: null });
150
+ else if (next !== prev)
151
+ ops.push({ kind: "element", id, before: prev, after: next });
152
+ }
153
+ for (const [id, next] of after.elements) {
154
+ if (!before.elements.has(id))
155
+ ops.push({ kind: "element", id, before: null, after: next });
156
+ }
157
+ for (const [id, prev] of before.links) {
158
+ const next = after.links.get(id);
159
+ if (next === undefined)
160
+ ops.push({ kind: "link", id, before: prev, after: null });
161
+ else if (next !== prev)
162
+ ops.push({ kind: "link", id, before: prev, after: next });
163
+ }
164
+ for (const [id, next] of after.links) {
165
+ if (!before.links.has(id))
166
+ ops.push({ kind: "link", id, before: null, after: next });
167
+ }
168
+ for (const [id, prev] of before.layers) {
169
+ const next = after.layers.get(id);
170
+ if (next === undefined)
171
+ ops.push({ kind: "layer", id, before: prev, after: null });
172
+ else if (next !== prev)
173
+ ops.push({ kind: "layer", id, before: prev, after: next });
174
+ }
175
+ for (const [id, next] of after.layers) {
176
+ if (!before.layers.has(id))
177
+ ops.push({ kind: "layer", id, before: null, after: next });
178
+ }
179
+ for (const [id, prev] of before.annotations) {
180
+ const next = after.annotations.get(id);
181
+ if (next === undefined)
182
+ ops.push({ kind: "annotation", id, before: prev, after: null });
183
+ else if (next !== prev)
184
+ ops.push({ kind: "annotation", id, before: prev, after: next });
185
+ }
186
+ for (const [id, next] of after.annotations) {
187
+ if (!before.annotations.has(id))
188
+ ops.push({ kind: "annotation", id, before: null, after: next });
189
+ }
190
+ if (before.viewport !== after.viewport) {
191
+ ops.push({ kind: "viewport", before: before.viewport, after: after.viewport });
192
+ }
193
+ if (ops.length === 0)
194
+ return null;
195
+ const first = ops[0];
196
+ if (ops.length === 1 && first !== undefined)
197
+ return first;
198
+ return batch(ops);
199
+ };
200
+ const diffMapInto = (before, after, target) => {
201
+ for (const [id] of before) {
202
+ if (!after.has(id))
203
+ target.delete(id);
204
+ }
205
+ for (const [id, value] of after) {
206
+ const prev = before.get(id);
207
+ if (prev !== value)
208
+ target.set(id, value);
209
+ }
210
+ };
211
+ // `invert` and `Patch` come from `@oh-just-another/scene` — re-export
212
+ // the inverse helper for hosts that want to derive their own
213
+ // inverses externally (debugging tools, e2e harnesses).
214
+ export { invert };
215
+ //# sourceMappingURL=yjs-history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yjs-history.js","sourceRoot":"","sources":["../src/yjs-history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EACL,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,GAGP,MAAM,wBAAwB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AM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5B,IAAI,IAAI,KAAK,KAAK;YAAE,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC,CAAC;AAEF,sEAAsE;AACtE,6DAA6D;AAC7D,wDAAwD;AACxD,OAAO,EAAE,MAAM,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@oh-just-another/collab",
3
+ "version": "0.57.0",
4
+ "description": "Real-time collaboration: Yjs binding for scenes + awareness for presence.",
5
+ "license": "MIT",
6
+ "author": "Rustam Garifulin <rustam@n69.in>",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/oh-just-another/diagram.git",
10
+ "directory": "packages/collab"
11
+ },
12
+ "homepage": "https://github.com/oh-just-another/diagram#readme",
13
+ "bugs": "https://github.com/oh-just-another/diagram/issues",
14
+ "keywords": [
15
+ "diagram",
16
+ "canvas",
17
+ "svg",
18
+ "editor",
19
+ "graph",
20
+ "drawing"
21
+ ],
22
+ "type": "module",
23
+ "main": "./dist/index.js",
24
+ "module": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.js"
30
+ }
31
+ },
32
+ "files": [
33
+ "dist",
34
+ "README.md",
35
+ "CHANGELOG.md"
36
+ ],
37
+ "sideEffects": false,
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "dependencies": {
42
+ "yjs": "^13.6.20",
43
+ "y-protocols": "^1.0.6",
44
+ "@oh-just-another/types": "0.57.0",
45
+ "@oh-just-another/history": "0.57.0",
46
+ "@oh-just-another/scene": "0.57.0",
47
+ "@oh-just-another/state": "0.57.0",
48
+ "@oh-just-another/serialization": "0.57.0",
49
+ "@oh-just-another/network": "0.57.0"
50
+ },
51
+ "scripts": {
52
+ "build": "tsc -b tsconfig.build.json",
53
+ "typecheck": "tsc --noEmit",
54
+ "test": "vitest run",
55
+ "test:watch": "vitest",
56
+ "lint": "eslint src tests",
57
+ "clean": "rm -rf dist *.tsbuildinfo"
58
+ }
59
+ }