@cocreate/crdt 1.4.3 → 1.5.1

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,38 @@
1
+ ## [1.5.1](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.5.0...v1.5.1) (2021-10-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update dependencies ([780096f](https://github.com/CoCreate-app/CoCreate-crdt/commit/780096f925a8166203e69aeb76bc7bc199fdb066))
7
+ * update dependencies ([5c9edeb](https://github.com/CoCreate-app/CoCreate-crdt/commit/5c9edebcf7c62900a338bf6e286cd689a7504bb0))
8
+
9
+ # [1.5.0](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.4.5...v1.5.0) (2021-10-15)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * dispatchEvent for cursors ([ac84921](https://github.com/CoCreate-app/CoCreate-crdt/commit/ac84921f215ea24d1b0bd3ce80a2a740eb869789))
15
+
16
+
17
+ ### Features
18
+
19
+ * removed @cocreate/cursor and dispatch cursor event instead ([91ae024](https://github.com/CoCreate-app/CoCreate-crdt/commit/91ae024b57ae9c8ec488ddeb61344ae21ad14a20))
20
+
21
+ ## [1.4.5](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.4.4...v1.4.5) (2021-10-15)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * update packages ([a145b9f](https://github.com/CoCreate-app/CoCreate-crdt/commit/a145b9fb1d2803e86c80c65184120828fb524fc0))
27
+
28
+ ## [1.4.4](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.4.3...v1.4.4) (2021-10-15)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * update packages ([72b328f](https://github.com/CoCreate-app/CoCreate-crdt/commit/72b328f9701742a78f1e3d23d8e6a3fe5814f800))
34
+ * updated dependencies ([cd55675](https://github.com/CoCreate-app/CoCreate-crdt/commit/cd556758aff0bf478829f2550939204a044205b8))
35
+
1
36
  ## [1.4.3](https://github.com/CoCreate-app/CoCreate-crdt/compare/v1.4.2...v1.4.3) (2021-10-13)
2
37
 
3
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/crdt",
3
- "version": "1.4.3",
3
+ "version": "1.5.1",
4
4
  "description": "CoCreate crdt",
5
5
  "author": "CoCreate LLC",
6
6
  "license": "SEE LICENSE",
@@ -24,9 +24,8 @@
24
24
  "hosting": "node ./node_modules/@cocreate/hosting/src/index.js"
25
25
  },
26
26
  "dependencies": {
27
- "@cocreate/crud-client": "^1.4.1",
28
- "@cocreate/cursors": "^1.6.11",
29
- "@cocreate/utils": "^1.1.29",
27
+ "@cocreate/crud-client": "^1.4.7",
28
+ "@cocreate/utils": "^1.1.33",
30
29
  "y-indexeddb": "^9.0.6",
31
30
  "y-websocket": "^1.3.16",
32
31
  "yjs": "^13.5.11"
package/src/index.js CHANGED
@@ -3,7 +3,6 @@
3
3
  import * as Y from 'yjs';
4
4
  import { WebsocketProvider } from 'y-websocket';
5
5
  // import { IndexeddbPersistence } from 'y-indexeddb';
6
- import CoCreateCursors from '@cocreate/cursors';
7
6
  import crud from '@cocreate/crud-client';
8
7
 
9
8
 
@@ -164,7 +163,7 @@ class CoCreateCRDTClass {
164
163
  const aw = awareness.getStates().get(clientId);
165
164
 
166
165
  if (aw === undefined) {
167
- CoCreateCursors.removeCursor(clientId);
166
+ this.removeCursor(clientId, aw);
168
167
  return;
169
168
  }
170
169
  const user = aw.user || {};
@@ -176,7 +175,7 @@ class CoCreateCRDTClass {
176
175
  }
177
176
  const cursor = aw.cursor;
178
177
  if (cursor == null || cursor.anchor == null || cursor.head == null) {
179
- CoCreateCursors.removeCursor(clientId);
178
+ this.removeCursor(clientId, aw);
180
179
  return;
181
180
  }
182
181
  // const start = cursor.anchor.item.clock;
@@ -199,11 +198,24 @@ class CoCreateCRDTClass {
199
198
  'name':user.name
200
199
  },
201
200
  };
202
- CoCreateCursors.drawCursors(selection);
201
+ const cursorUpdate = new CustomEvent('updateCursor', {
202
+ detail: {selection},
203
+ });
204
+
205
+ window.dispatchEvent(cursorUpdate);
203
206
  }
204
207
  }
205
208
  }
206
209
 
210
+ removeCursor(clientId, aw){
211
+ const cursorRemove = new CustomEvent('removeCursor', {
212
+ detail: {clientId, aw},
213
+ });
214
+ window.dispatchEvent(cursorRemove);
215
+ return;
216
+
217
+ }
218
+
207
219
  deleteDoc(docName) {
208
220
  if (this.docs[docName]) {
209
221
  delete this.docs[docName];