@liveblocks/core 3.21.0-exp1 → 3.21.0-exp10

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.cts CHANGED
@@ -435,7 +435,7 @@ type TextAttributes = JsonObject;
435
435
  * ["Hello world"]
436
436
  * ["Hello ", { bold: true }]
437
437
  */
438
- type LiveTextSegment = readonly [text: string] | readonly [text: string, attributes: TextAttributes];
438
+ type LiveTextSegment = [text: string] | [text: string, attributes: TextAttributes];
439
439
  /**
440
440
  * Serialized form of a {@link LiveText} document: an ordered list of text
441
441
  * segments with optional inline attributes.
@@ -444,7 +444,7 @@ type LiveTextSegment = readonly [text: string] | readonly [text: string, attribu
444
444
  * [["Hello world"]]
445
445
  * [["Hello ", { bold: true }], ["world"]]
446
446
  */
447
- type LiveTextData = readonly LiveTextSegment[];
447
+ type LiveTextData = LiveTextSegment[];
448
448
  type TextOperation = {
449
449
  type: "insert";
450
450
  index: number;
package/dist/index.d.ts CHANGED
@@ -435,7 +435,7 @@ type TextAttributes = JsonObject;
435
435
  * ["Hello world"]
436
436
  * ["Hello ", { bold: true }]
437
437
  */
438
- type LiveTextSegment = readonly [text: string] | readonly [text: string, attributes: TextAttributes];
438
+ type LiveTextSegment = [text: string] | [text: string, attributes: TextAttributes];
439
439
  /**
440
440
  * Serialized form of a {@link LiveText} document: an ordered list of text
441
441
  * segments with optional inline attributes.
@@ -444,7 +444,7 @@ type LiveTextSegment = readonly [text: string] | readonly [text: string, attribu
444
444
  * [["Hello world"]]
445
445
  * [["Hello ", { bold: true }], ["world"]]
446
446
  */
447
- type LiveTextData = readonly LiveTextSegment[];
447
+ type LiveTextData = LiveTextSegment[];
448
448
  type TextOperation = {
449
449
  type: "insert";
450
450
  index: number;
package/dist/index.js 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 = "3.21.0-exp1";
9
+ var PKG_VERSION = "3.21.0-exp10";
10
10
  var PKG_FORMAT = "esm";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -9814,19 +9814,31 @@ var LiveText = class _LiveText extends AbstractCrdt {
9814
9814
  return segmentsToData(this.#segments);
9815
9815
  }
9816
9816
  /** @internal */
9817
+ toTreeNode(key) {
9818
+ return super.toTreeNode(key);
9819
+ }
9820
+ /** @internal */
9817
9821
  _toTreeNode(key) {
9822
+ const nodeId = this._id ?? nanoid();
9823
+ const payload = this.toJSON().map(
9824
+ (segment, index) => ({
9825
+ type: "Json",
9826
+ id: `${nodeId}:${index}`,
9827
+ key: String(index),
9828
+ payload: segment
9829
+ })
9830
+ );
9831
+ payload.push({
9832
+ type: "Json",
9833
+ id: `${nodeId}:version`,
9834
+ key: "version",
9835
+ payload: this.version
9836
+ });
9818
9837
  return {
9819
9838
  type: "LiveText",
9820
- id: this._id ?? nanoid(),
9839
+ id: nodeId,
9821
9840
  key,
9822
- payload: [
9823
- {
9824
- type: "Json",
9825
- id: `${this._id ?? nanoid()}:text`,
9826
- key: "text",
9827
- payload: this.toString()
9828
- }
9829
- ]
9841
+ payload
9830
9842
  };
9831
9843
  }
9832
9844
  clone() {