@liveblocks/yjs 1.1.1-yjs2 → 1.1.1-yjs3
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/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +22 -2
- package/dist/index.mjs +22 -2
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -27,16 +27,21 @@ declare class Awareness extends Observable<unknown> {
|
|
|
27
27
|
setLocalStateField(field: string, value: JsonObject | null): void;
|
|
28
28
|
getStates(): Map<number, unknown>;
|
|
29
29
|
}
|
|
30
|
-
declare class LiveblocksProvider<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json> {
|
|
30
|
+
declare class LiveblocksProvider<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json> extends Observable<unknown> {
|
|
31
31
|
private room;
|
|
32
32
|
private httpEndpoint?;
|
|
33
33
|
private doc;
|
|
34
34
|
private unsubscribers;
|
|
35
35
|
awareness: Awareness;
|
|
36
|
+
private _synced;
|
|
36
37
|
constructor(room: Room<P, S, U, E>, doc: Y.Doc);
|
|
37
38
|
private syncDoc;
|
|
39
|
+
get synced(): boolean;
|
|
40
|
+
set synced(state: boolean);
|
|
38
41
|
private updateHandler;
|
|
39
42
|
destroy(): void;
|
|
43
|
+
disconnect(): void;
|
|
44
|
+
connect(): void;
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
export { Awareness, LiveblocksProvider as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,16 +27,21 @@ declare class Awareness extends Observable<unknown> {
|
|
|
27
27
|
setLocalStateField(field: string, value: JsonObject | null): void;
|
|
28
28
|
getStates(): Map<number, unknown>;
|
|
29
29
|
}
|
|
30
|
-
declare class LiveblocksProvider<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json> {
|
|
30
|
+
declare class LiveblocksProvider<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json> extends Observable<unknown> {
|
|
31
31
|
private room;
|
|
32
32
|
private httpEndpoint?;
|
|
33
33
|
private doc;
|
|
34
34
|
private unsubscribers;
|
|
35
35
|
awareness: Awareness;
|
|
36
|
+
private _synced;
|
|
36
37
|
constructor(room: Room<P, S, U, E>, doc: Y.Doc);
|
|
37
38
|
private syncDoc;
|
|
39
|
+
get synced(): boolean;
|
|
40
|
+
set synced(state: boolean);
|
|
38
41
|
private updateHandler;
|
|
39
42
|
destroy(): void;
|
|
43
|
+
disconnect(): void;
|
|
44
|
+
connect(): void;
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
export { Awareness, LiveblocksProvider as default };
|
package/dist/index.js
CHANGED
|
@@ -188,11 +188,15 @@ var Awareness = class extends Observable {
|
|
|
188
188
|
return states;
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
|
-
var LiveblocksProvider = class {
|
|
191
|
+
var LiveblocksProvider = class extends Observable {
|
|
192
192
|
constructor(room, doc) {
|
|
193
|
+
var _a;
|
|
194
|
+
super();
|
|
193
195
|
this.unsubscribers = [];
|
|
196
|
+
this._synced = false;
|
|
194
197
|
this.syncDoc = () => {
|
|
195
198
|
var _a;
|
|
199
|
+
this.synced = false;
|
|
196
200
|
this.doc.clientID = ((_a = this.room.getSelf()) == null ? void 0 : _a.connectionId) || this.doc.clientID;
|
|
197
201
|
this.awareness.clientID = this.doc.clientID;
|
|
198
202
|
const encodedVector = _jsbase64.Base64.fromUint8Array(Y.encodeStateVector(this.doc));
|
|
@@ -210,7 +214,6 @@ var LiveblocksProvider = class {
|
|
|
210
214
|
}
|
|
211
215
|
}
|
|
212
216
|
});
|
|
213
|
-
var _a;
|
|
214
217
|
this.doc = doc;
|
|
215
218
|
this.room = room;
|
|
216
219
|
const connectionId = (_a = this.room.getSelf()) == null ? void 0 : _a.connectionId;
|
|
@@ -229,15 +232,32 @@ var LiveblocksProvider = class {
|
|
|
229
232
|
this.unsubscribers.push(
|
|
230
233
|
this.room.events.ydoc.subscribe((update) => {
|
|
231
234
|
Y.applyUpdate(this.doc, _jsbase64.Base64.toUint8Array(update), "backend");
|
|
235
|
+
this.synced = true;
|
|
232
236
|
})
|
|
233
237
|
);
|
|
234
238
|
this.syncDoc();
|
|
235
239
|
}
|
|
240
|
+
// The sync'd property is required by some provider implementations
|
|
241
|
+
get synced() {
|
|
242
|
+
return this._synced;
|
|
243
|
+
}
|
|
244
|
+
set synced(state) {
|
|
245
|
+
if (this._synced !== state) {
|
|
246
|
+
this._synced = state;
|
|
247
|
+
this.emit("synced", [state]);
|
|
248
|
+
this.emit("sync", [state]);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
236
251
|
destroy() {
|
|
237
252
|
this.doc.off("update", this.updateHandler);
|
|
238
253
|
this.unsubscribers.forEach((unsub) => unsub());
|
|
239
254
|
this.awareness.destroy();
|
|
240
255
|
}
|
|
256
|
+
// Some provider implementations expect to be able to call connect/disconnect, implement as noop
|
|
257
|
+
disconnect() {
|
|
258
|
+
}
|
|
259
|
+
connect() {
|
|
260
|
+
}
|
|
241
261
|
};
|
|
242
262
|
|
|
243
263
|
|
package/dist/index.mjs
CHANGED
|
@@ -188,11 +188,15 @@ var Awareness = class extends Observable {
|
|
|
188
188
|
return states;
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
|
-
var LiveblocksProvider = class {
|
|
191
|
+
var LiveblocksProvider = class extends Observable {
|
|
192
192
|
constructor(room, doc) {
|
|
193
|
+
var _a;
|
|
194
|
+
super();
|
|
193
195
|
this.unsubscribers = [];
|
|
196
|
+
this._synced = false;
|
|
194
197
|
this.syncDoc = () => {
|
|
195
198
|
var _a;
|
|
199
|
+
this.synced = false;
|
|
196
200
|
this.doc.clientID = ((_a = this.room.getSelf()) == null ? void 0 : _a.connectionId) || this.doc.clientID;
|
|
197
201
|
this.awareness.clientID = this.doc.clientID;
|
|
198
202
|
const encodedVector = Base64.fromUint8Array(Y.encodeStateVector(this.doc));
|
|
@@ -210,7 +214,6 @@ var LiveblocksProvider = class {
|
|
|
210
214
|
}
|
|
211
215
|
}
|
|
212
216
|
});
|
|
213
|
-
var _a;
|
|
214
217
|
this.doc = doc;
|
|
215
218
|
this.room = room;
|
|
216
219
|
const connectionId = (_a = this.room.getSelf()) == null ? void 0 : _a.connectionId;
|
|
@@ -229,15 +232,32 @@ var LiveblocksProvider = class {
|
|
|
229
232
|
this.unsubscribers.push(
|
|
230
233
|
this.room.events.ydoc.subscribe((update) => {
|
|
231
234
|
Y.applyUpdate(this.doc, Base64.toUint8Array(update), "backend");
|
|
235
|
+
this.synced = true;
|
|
232
236
|
})
|
|
233
237
|
);
|
|
234
238
|
this.syncDoc();
|
|
235
239
|
}
|
|
240
|
+
// The sync'd property is required by some provider implementations
|
|
241
|
+
get synced() {
|
|
242
|
+
return this._synced;
|
|
243
|
+
}
|
|
244
|
+
set synced(state) {
|
|
245
|
+
if (this._synced !== state) {
|
|
246
|
+
this._synced = state;
|
|
247
|
+
this.emit("synced", [state]);
|
|
248
|
+
this.emit("sync", [state]);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
236
251
|
destroy() {
|
|
237
252
|
this.doc.off("update", this.updateHandler);
|
|
238
253
|
this.unsubscribers.forEach((unsub) => unsub());
|
|
239
254
|
this.awareness.destroy();
|
|
240
255
|
}
|
|
256
|
+
// Some provider implementations expect to be able to call connect/disconnect, implement as noop
|
|
257
|
+
disconnect() {
|
|
258
|
+
}
|
|
259
|
+
connect() {
|
|
260
|
+
}
|
|
241
261
|
};
|
|
242
262
|
export {
|
|
243
263
|
Awareness,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liveblocks/yjs",
|
|
3
|
-
"version": "1.1.1-
|
|
3
|
+
"version": "1.1.1-yjs3",
|
|
4
4
|
"description": "An integration with . Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@liveblocks/client": "1.1.1-
|
|
36
|
-
"@liveblocks/core": "1.1.1-
|
|
35
|
+
"@liveblocks/client": "1.1.1-yjs3",
|
|
36
|
+
"@liveblocks/core": "1.1.1-yjs3",
|
|
37
37
|
"js-base64": "^3.7.5"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|