@liveblocks/core 1.4.0-test1 → 1.4.1-test1
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 +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +34 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
8
|
var PKG_NAME = "@liveblocks/core";
|
|
9
|
-
var PKG_VERSION = "1.4.
|
|
9
|
+
var PKG_VERSION = "1.4.1-test1";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -1544,7 +1544,11 @@ function startSyncStream(room) {
|
|
|
1544
1544
|
room.events.self.subscribe(() => partialSyncMe(room)),
|
|
1545
1545
|
room.events.others.subscribe(() => partialSyncOthers(room)),
|
|
1546
1546
|
// Any time ydoc is updated, forward the update
|
|
1547
|
-
room.events.ydoc.subscribe((update) => syncYdocUpdate(room, update))
|
|
1547
|
+
room.events.ydoc.subscribe((update) => syncYdocUpdate(room, update)),
|
|
1548
|
+
// Any time a custom room event is received, forward it
|
|
1549
|
+
room.events.customEvent.subscribe(
|
|
1550
|
+
(eventData) => forwardEvent(room, eventData)
|
|
1551
|
+
)
|
|
1548
1552
|
]);
|
|
1549
1553
|
}
|
|
1550
1554
|
function syncYdocUpdate(room, update) {
|
|
@@ -1554,6 +1558,24 @@ function syncYdocUpdate(room, update) {
|
|
|
1554
1558
|
update
|
|
1555
1559
|
});
|
|
1556
1560
|
}
|
|
1561
|
+
var loadedAt = Date.now();
|
|
1562
|
+
var eventCounter = 0;
|
|
1563
|
+
function nextEventId() {
|
|
1564
|
+
return `event-${loadedAt}-${eventCounter++}`;
|
|
1565
|
+
}
|
|
1566
|
+
function forwardEvent(room, eventData) {
|
|
1567
|
+
sendToPanel({
|
|
1568
|
+
msg: "room::events::custom-event",
|
|
1569
|
+
roomId: room.id,
|
|
1570
|
+
event: {
|
|
1571
|
+
type: "CustomEvent",
|
|
1572
|
+
id: nextEventId(),
|
|
1573
|
+
key: "Event",
|
|
1574
|
+
connectionId: eventData.connectionId,
|
|
1575
|
+
payload: eventData.event
|
|
1576
|
+
}
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1557
1579
|
function partialSyncConnection(room) {
|
|
1558
1580
|
sendToPanel({
|
|
1559
1581
|
msg: "room::sync::partial",
|
|
@@ -2334,7 +2356,16 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2334
2356
|
};
|
|
2335
2357
|
ops.push(op);
|
|
2336
2358
|
for (const item of this._items) {
|
|
2337
|
-
|
|
2359
|
+
const parentKey2 = item._getParentKeyOrThrow();
|
|
2360
|
+
const childOps = HACK_addIntentAndDeletedIdToOperation(
|
|
2361
|
+
item._toOps(this._id, parentKey2, pool),
|
|
2362
|
+
void 0
|
|
2363
|
+
);
|
|
2364
|
+
const childOpId = childOps[0].opId;
|
|
2365
|
+
if (childOpId !== void 0) {
|
|
2366
|
+
this._unacknowledgedSets.set(parentKey2, childOpId);
|
|
2367
|
+
}
|
|
2368
|
+
ops.push(...childOps);
|
|
2338
2369
|
}
|
|
2339
2370
|
return ops;
|
|
2340
2371
|
}
|