@liveblocks/yjs 1.1.0-yjs2 → 1.1.0-yjs4

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.js CHANGED
@@ -158,13 +158,21 @@ var Awareness = class extends Observable {
158
158
  return presence["__yjs"];
159
159
  }
160
160
  setLocalState(state) {
161
- this.room.updatePresence({ __yjs: __spreadValues({}, state || {}) });
161
+ var _a;
162
+ const presence = (_a = this.room.getSelf()) == null ? void 0 : _a.presence["__yjs"];
163
+ this.room.updatePresence({
164
+ __yjs: __spreadValues(__spreadValues({}, presence || {}), state || {})
165
+ });
162
166
  }
163
167
  setLocalStateField(field, value) {
168
+ var _a;
169
+ const presence = (_a = this.room.getSelf()) == null ? void 0 : _a.presence["__yjs"];
164
170
  const update = { [field]: value };
165
- this.room.updatePresence({ __yjs: update });
171
+ this.room.updatePresence({
172
+ __yjs: __spreadValues(__spreadValues({}, presence || {}), update)
173
+ });
166
174
  }
167
- // Translate
175
+ // Translate liveblocks presence to yjs awareness
168
176
  getStates() {
169
177
  const others = this.room.getOthers();
170
178
  const states = others.reduce((acc, currentValue) => {
@@ -176,7 +184,6 @@ var Awareness = class extends Observable {
176
184
  }
177
185
  return acc;
178
186
  }, /* @__PURE__ */ new Map());
179
- console.log(states);
180
187
  return states;
181
188
  }
182
189
  };
package/dist/index.mjs CHANGED
@@ -158,13 +158,21 @@ var Awareness = class extends Observable {
158
158
  return presence["__yjs"];
159
159
  }
160
160
  setLocalState(state) {
161
- this.room.updatePresence({ __yjs: __spreadValues({}, state || {}) });
161
+ var _a;
162
+ const presence = (_a = this.room.getSelf()) == null ? void 0 : _a.presence["__yjs"];
163
+ this.room.updatePresence({
164
+ __yjs: __spreadValues(__spreadValues({}, presence || {}), state || {})
165
+ });
162
166
  }
163
167
  setLocalStateField(field, value) {
168
+ var _a;
169
+ const presence = (_a = this.room.getSelf()) == null ? void 0 : _a.presence["__yjs"];
164
170
  const update = { [field]: value };
165
- this.room.updatePresence({ __yjs: update });
171
+ this.room.updatePresence({
172
+ __yjs: __spreadValues(__spreadValues({}, presence || {}), update)
173
+ });
166
174
  }
167
- // Translate
175
+ // Translate liveblocks presence to yjs awareness
168
176
  getStates() {
169
177
  const others = this.room.getOthers();
170
178
  const states = others.reduce((acc, currentValue) => {
@@ -176,7 +184,6 @@ var Awareness = class extends Observable {
176
184
  }
177
185
  return acc;
178
186
  }, /* @__PURE__ */ new Map());
179
- console.log(states);
180
187
  return states;
181
188
  }
182
189
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/yjs",
3
- "version": "1.1.0-yjs2",
3
+ "version": "1.1.0-yjs4",
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",
@@ -26,8 +26,8 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@liveblocks/client": "1.1.0-yjs2",
30
- "@liveblocks/core": "1.1.0-yjs2",
29
+ "@liveblocks/client": "1.1.0-yjs4",
30
+ "@liveblocks/core": "1.1.0-yjs4",
31
31
  "js-base64": "^3.7.5"
32
32
  },
33
33
  "peerDependencies": {