@liveblocks/client 0.12.0-beta.13 → 0.12.0-beta.14
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/lib/cjs/doc.d.ts +179 -10
- package/lib/cjs/doc.js +466 -187
- package/lib/cjs/live.d.ts +1 -1
- package/lib/cjs/room.d.ts +2 -0
- package/lib/cjs/room.js +10 -0
- package/lib/cjs/storage.d.ts +2 -0
- package/lib/cjs/storage.js +9 -3
- package/lib/cjs/types.d.ts +2 -0
- package/lib/esm/doc.d.ts +179 -10
- package/lib/esm/doc.js +466 -187
- package/lib/esm/live.d.ts +1 -1
- package/lib/esm/room.d.ts +2 -0
- package/lib/esm/room.js +10 -0
- package/lib/esm/storage.d.ts +2 -0
- package/lib/esm/storage.js +9 -3
- package/lib/esm/types.d.ts +2 -0
- package/package.json +1 -1
package/lib/esm/live.d.ts
CHANGED
|
@@ -114,7 +114,7 @@ export declare enum OpType {
|
|
|
114
114
|
}
|
|
115
115
|
export declare type Op = CreateObjectOp | UpdateObjectOp | DeleteCrdtOp | CreateListOp | SetParentKeyOp | DeleteObjectKeyOp | CreateMapOp | CreateRegisterOp;
|
|
116
116
|
export declare type UpdateObjectOp = {
|
|
117
|
-
opId
|
|
117
|
+
opId?: string;
|
|
118
118
|
id: string;
|
|
119
119
|
type: OpType.UpdateObject;
|
|
120
120
|
data: {
|
package/lib/esm/room.d.ts
CHANGED
|
@@ -81,6 +81,8 @@ export declare function makeStateMachine(state: State, context: Context, mockedE
|
|
|
81
81
|
};
|
|
82
82
|
updatePresence: <T_4 extends Presence>(overrides: Partial<T_4>) => void;
|
|
83
83
|
broadcastEvent: (event: any) => void;
|
|
84
|
+
undo: () => void;
|
|
85
|
+
redo: () => void;
|
|
84
86
|
getStorage: <TRoot>() => Promise<{
|
|
85
87
|
root: import("./doc").LiveObject<TRoot>;
|
|
86
88
|
}>;
|
package/lib/esm/room.js
CHANGED
|
@@ -475,6 +475,12 @@ export function makeStateMachine(state, context, mockedEffects) {
|
|
|
475
475
|
};
|
|
476
476
|
});
|
|
477
477
|
}
|
|
478
|
+
function undo() {
|
|
479
|
+
storage.undo();
|
|
480
|
+
}
|
|
481
|
+
function redo() {
|
|
482
|
+
storage.redo();
|
|
483
|
+
}
|
|
478
484
|
return {
|
|
479
485
|
// Internal
|
|
480
486
|
onOpen,
|
|
@@ -493,6 +499,8 @@ export function makeStateMachine(state, context, mockedEffects) {
|
|
|
493
499
|
// Presence
|
|
494
500
|
updatePresence,
|
|
495
501
|
broadcastEvent,
|
|
502
|
+
undo,
|
|
503
|
+
redo,
|
|
496
504
|
getStorage,
|
|
497
505
|
selectors: {
|
|
498
506
|
// Core
|
|
@@ -573,6 +581,8 @@ export function createRoom(name, options) {
|
|
|
573
581
|
getOthers: machine.selectors.getOthers,
|
|
574
582
|
broadcastEvent: machine.broadcastEvent,
|
|
575
583
|
getStorage: machine.getStorage,
|
|
584
|
+
undo: machine.undo,
|
|
585
|
+
redo: machine.redo,
|
|
576
586
|
};
|
|
577
587
|
return {
|
|
578
588
|
connect: machine.connect,
|
package/lib/esm/storage.d.ts
CHANGED
package/lib/esm/storage.js
CHANGED
|
@@ -48,12 +48,18 @@ export default class Storage {
|
|
|
48
48
|
break;
|
|
49
49
|
}
|
|
50
50
|
case ServerMessageType.UpdateStorage: {
|
|
51
|
-
|
|
52
|
-
(_b = this._doc) === null || _b === void 0 ? void 0 : _b.apply(op);
|
|
53
|
-
}
|
|
51
|
+
(_b = this._doc) === null || _b === void 0 ? void 0 : _b.apply(message.ops);
|
|
54
52
|
break;
|
|
55
53
|
}
|
|
56
54
|
}
|
|
57
55
|
});
|
|
58
56
|
}
|
|
57
|
+
undo() {
|
|
58
|
+
var _a;
|
|
59
|
+
(_a = this._doc) === null || _a === void 0 ? void 0 : _a.undo();
|
|
60
|
+
}
|
|
61
|
+
redo() {
|
|
62
|
+
var _a;
|
|
63
|
+
(_a = this._doc) === null || _a === void 0 ? void 0 : _a.redo();
|
|
64
|
+
}
|
|
59
65
|
}
|
package/lib/esm/types.d.ts
CHANGED