@y/y 14.0.0-rc.2 → 14.0.0-rc.20

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.
Files changed (166) hide show
  1. package/README.md +36 -12
  2. package/dist/src/index.d.ts +24 -1
  3. package/dist/src/index.d.ts.map +1 -1
  4. package/dist/src/structs/AbstractStruct.d.ts +14 -17
  5. package/dist/src/structs/AbstractStruct.d.ts.map +1 -1
  6. package/dist/src/structs/GC.d.ts +9 -14
  7. package/dist/src/structs/GC.d.ts.map +1 -1
  8. package/dist/src/structs/Item.d.ts +569 -31
  9. package/dist/src/structs/Item.d.ts.map +1 -1
  10. package/dist/src/structs/Skip.d.ts +9 -11
  11. package/dist/src/structs/Skip.d.ts.map +1 -1
  12. package/dist/src/utils/BlockSet.d.ts +8 -7
  13. package/dist/src/utils/BlockSet.d.ts.map +1 -1
  14. package/dist/src/utils/Doc.d.ts +4 -9
  15. package/dist/src/utils/Doc.d.ts.map +1 -1
  16. package/dist/src/utils/ID.d.ts +0 -1
  17. package/dist/src/utils/ID.d.ts.map +1 -1
  18. package/dist/src/utils/RelativePosition.d.ts +2 -5
  19. package/dist/src/utils/RelativePosition.d.ts.map +1 -1
  20. package/dist/src/utils/Renderer.d.ts +144 -0
  21. package/dist/src/utils/Renderer.d.ts.map +1 -0
  22. package/dist/src/utils/Snapshot.d.ts +7 -11
  23. package/dist/src/utils/Snapshot.d.ts.map +1 -1
  24. package/dist/src/utils/StructStore.d.ts +45 -23
  25. package/dist/src/utils/StructStore.d.ts.map +1 -1
  26. package/dist/src/utils/Transaction.d.ts +11 -21
  27. package/dist/src/utils/Transaction.d.ts.map +1 -1
  28. package/dist/src/utils/UndoManager.d.ts +13 -14
  29. package/dist/src/utils/UndoManager.d.ts.map +1 -1
  30. package/dist/src/utils/UpdateDecoder.d.ts +1 -1
  31. package/dist/src/utils/UpdateDecoder.d.ts.map +1 -1
  32. package/dist/src/utils/UpdateEncoder.d.ts +0 -1
  33. package/dist/src/utils/UpdateEncoder.d.ts.map +1 -1
  34. package/dist/src/utils/YEvent.d.ts +22 -26
  35. package/dist/src/utils/YEvent.d.ts.map +1 -1
  36. package/dist/src/utils/content-helper.d.ts +2 -0
  37. package/dist/src/utils/content-helper.d.ts.map +1 -0
  38. package/dist/src/utils/delta-helpers.d.ts +2 -3
  39. package/dist/src/utils/delta-helpers.d.ts.map +1 -1
  40. package/dist/src/utils/encoding-helpers.d.ts +6 -0
  41. package/dist/src/utils/encoding-helpers.d.ts.map +1 -0
  42. package/dist/src/utils/encoding.d.ts +16 -18
  43. package/dist/src/utils/encoding.d.ts.map +1 -1
  44. package/dist/src/utils/ids.d.ts +331 -0
  45. package/dist/src/utils/ids.d.ts.map +1 -0
  46. package/dist/src/utils/isParentOf.d.ts +1 -2
  47. package/dist/src/utils/isParentOf.d.ts.map +1 -1
  48. package/dist/src/utils/logging.d.ts +0 -1
  49. package/dist/src/utils/logging.d.ts.map +1 -1
  50. package/dist/src/utils/meta.d.ts +15 -64
  51. package/dist/src/utils/meta.d.ts.map +1 -1
  52. package/dist/src/utils/renderer-helpers.d.ts +99 -0
  53. package/dist/src/utils/renderer-helpers.d.ts.map +1 -0
  54. package/dist/src/utils/schemas.d.ts +3 -0
  55. package/dist/src/utils/schemas.d.ts.map +1 -0
  56. package/dist/src/utils/transaction-helpers.d.ts +18 -0
  57. package/dist/src/utils/transaction-helpers.d.ts.map +1 -0
  58. package/dist/src/utils/updates.d.ts +19 -25
  59. package/dist/src/utils/updates.d.ts.map +1 -1
  60. package/dist/src/ytype.d.ts +55 -24
  61. package/dist/src/ytype.d.ts.map +1 -1
  62. package/global.d.ts +53 -0
  63. package/package.json +12 -16
  64. package/src/index.js +32 -124
  65. package/src/structs/AbstractStruct.js +21 -16
  66. package/src/structs/GC.js +15 -20
  67. package/src/structs/Item.js +992 -318
  68. package/src/structs/Skip.js +16 -19
  69. package/src/utils/BlockSet.js +20 -20
  70. package/src/utils/Doc.js +15 -29
  71. package/src/utils/ID.js +0 -2
  72. package/src/utils/RelativePosition.js +15 -25
  73. package/src/utils/{AttributionManager.js → Renderer.js} +42 -197
  74. package/src/utils/Snapshot.js +15 -37
  75. package/src/utils/StructStore.js +89 -227
  76. package/src/utils/Transaction.js +63 -307
  77. package/src/utils/UndoManager.js +157 -19
  78. package/src/utils/UpdateDecoder.js +2 -3
  79. package/src/utils/UpdateEncoder.js +0 -4
  80. package/src/utils/YEvent.js +20 -26
  81. package/src/utils/content-helper.js +0 -0
  82. package/src/utils/delta-helpers.js +21 -42
  83. package/src/utils/encoding-helpers.js +110 -0
  84. package/src/utils/encoding.js +197 -122
  85. package/src/utils/ids.js +1527 -0
  86. package/src/utils/isParentOf.js +2 -4
  87. package/src/utils/logging.js +0 -4
  88. package/src/utils/meta.js +57 -46
  89. package/src/utils/renderer-helpers.js +110 -0
  90. package/src/utils/schemas.js +3 -0
  91. package/src/utils/transaction-helpers.js +413 -0
  92. package/src/utils/updates.js +24 -146
  93. package/src/ytype.js +325 -117
  94. package/tests/testHelper.js +10 -12
  95. package/dist/src/internals.d.ts +0 -36
  96. package/dist/src/internals.d.ts.map +0 -1
  97. package/dist/src/structs/ContentAny.d.ts +0 -67
  98. package/dist/src/structs/ContentAny.d.ts.map +0 -1
  99. package/dist/src/structs/ContentBinary.d.ts +0 -64
  100. package/dist/src/structs/ContentBinary.d.ts.map +0 -1
  101. package/dist/src/structs/ContentDeleted.d.ts +0 -64
  102. package/dist/src/structs/ContentDeleted.d.ts.map +0 -1
  103. package/dist/src/structs/ContentDoc.d.ts +0 -72
  104. package/dist/src/structs/ContentDoc.d.ts.map +0 -1
  105. package/dist/src/structs/ContentEmbed.d.ts +0 -67
  106. package/dist/src/structs/ContentEmbed.d.ts.map +0 -1
  107. package/dist/src/structs/ContentFormat.d.ts +0 -69
  108. package/dist/src/structs/ContentFormat.d.ts.map +0 -1
  109. package/dist/src/structs/ContentJSON.d.ts +0 -70
  110. package/dist/src/structs/ContentJSON.d.ts.map +0 -1
  111. package/dist/src/structs/ContentString.d.ts +0 -70
  112. package/dist/src/structs/ContentString.d.ts.map +0 -1
  113. package/dist/src/structs/ContentType.d.ts +0 -77
  114. package/dist/src/structs/ContentType.d.ts.map +0 -1
  115. package/dist/src/utils/AttributionManager.d.ts +0 -238
  116. package/dist/src/utils/AttributionManager.d.ts.map +0 -1
  117. package/dist/src/utils/IdMap.d.ts +0 -164
  118. package/dist/src/utils/IdMap.d.ts.map +0 -1
  119. package/dist/src/utils/IdSet.d.ts +0 -163
  120. package/dist/src/utils/IdSet.d.ts.map +0 -1
  121. package/dist/tests/IdMap.tests.d.ts +0 -9
  122. package/dist/tests/IdMap.tests.d.ts.map +0 -1
  123. package/dist/tests/IdSet.tests.d.ts +0 -9
  124. package/dist/tests/IdSet.tests.d.ts.map +0 -1
  125. package/dist/tests/attribution.tests.d.ts +0 -9
  126. package/dist/tests/attribution.tests.d.ts.map +0 -1
  127. package/dist/tests/compatibility.tests.d.ts +0 -5
  128. package/dist/tests/compatibility.tests.d.ts.map +0 -1
  129. package/dist/tests/delta.tests.d.ts +0 -7
  130. package/dist/tests/delta.tests.d.ts.map +0 -1
  131. package/dist/tests/doc.tests.d.ts +0 -13
  132. package/dist/tests/doc.tests.d.ts.map +0 -1
  133. package/dist/tests/encoding.tests.d.ts +0 -5
  134. package/dist/tests/encoding.tests.d.ts.map +0 -1
  135. package/dist/tests/index.d.ts +0 -2
  136. package/dist/tests/index.d.ts.map +0 -1
  137. package/dist/tests/relativePositions.tests.d.ts +0 -11
  138. package/dist/tests/relativePositions.tests.d.ts.map +0 -1
  139. package/dist/tests/snapshot.tests.d.ts +0 -14
  140. package/dist/tests/snapshot.tests.d.ts.map +0 -1
  141. package/dist/tests/testHelper.d.ts +0 -171
  142. package/dist/tests/testHelper.d.ts.map +0 -1
  143. package/dist/tests/undo-redo.tests.d.ts +0 -27
  144. package/dist/tests/undo-redo.tests.d.ts.map +0 -1
  145. package/dist/tests/updates.tests.d.ts +0 -26
  146. package/dist/tests/updates.tests.d.ts.map +0 -1
  147. package/dist/tests/y-array.tests.d.ts +0 -43
  148. package/dist/tests/y-array.tests.d.ts.map +0 -1
  149. package/dist/tests/y-map.tests.d.ts +0 -42
  150. package/dist/tests/y-map.tests.d.ts.map +0 -1
  151. package/dist/tests/y-text.tests.d.ts +0 -49
  152. package/dist/tests/y-text.tests.d.ts.map +0 -1
  153. package/dist/tests/y-xml.tests.d.ts +0 -14
  154. package/dist/tests/y-xml.tests.d.ts.map +0 -1
  155. package/src/internals.js +0 -35
  156. package/src/structs/ContentAny.js +0 -115
  157. package/src/structs/ContentBinary.js +0 -93
  158. package/src/structs/ContentDeleted.js +0 -101
  159. package/src/structs/ContentDoc.js +0 -141
  160. package/src/structs/ContentEmbed.js +0 -98
  161. package/src/structs/ContentFormat.js +0 -105
  162. package/src/structs/ContentJSON.js +0 -119
  163. package/src/structs/ContentString.js +0 -113
  164. package/src/structs/ContentType.js +0 -152
  165. package/src/utils/IdMap.js +0 -673
  166. package/src/utils/IdSet.js +0 -825
@@ -1,19 +1,19 @@
1
1
  /**
2
- * @template {delta.DeltaConf} DConf
2
+ * @template {DeltaConf} DConf
3
3
  * YEvent describes the changes on a YType.
4
4
  */
5
- export class YEvent<DConf extends delta.DeltaConf> {
5
+ export class YEvent<DConf extends DeltaConf> {
6
6
  /**
7
7
  * @param {YType<DConf>} target The changed type.
8
- * @param {Transaction} transaction
8
+ * @param {import('./Transaction.js').Transaction} transaction
9
9
  * @param {Set<any>?} subs The keys that changed
10
10
  */
11
- constructor(target: YType<DConf>, transaction: Transaction, subs: Set<any> | null);
11
+ constructor(target: YType<DConf>, transaction: import("./Transaction.js").Transaction, subs: Set<any> | null);
12
12
  /**
13
13
  * The type on which this event was created on.
14
- * @type {YType<DConf>}
14
+ * @type {import('../ytype.js').YType<DConf>}
15
15
  */
16
- target: YType<DConf>;
16
+ target: import("../ytype.js").YType<DConf>;
17
17
  /**
18
18
  * The current target on which the observe callback is called.
19
19
  * @type {YType<any>}
@@ -21,17 +21,17 @@ export class YEvent<DConf extends delta.DeltaConf> {
21
21
  currentTarget: YType<any>;
22
22
  /**
23
23
  * The transaction that triggered this event.
24
- * @type {Transaction}
24
+ * @type {import('./Transaction.js').Transaction}
25
25
  */
26
- transaction: Transaction;
26
+ transaction: import("./Transaction.js").Transaction;
27
27
  /**
28
- * @type {delta.Delta<import('../ytype.js').DeltaConfDeltaToYType<DConf>>|null}
28
+ * @type {Delta<import('../ytype.js').DeltaConfDeltaToYType<DConf>>|null}
29
29
  */
30
- _delta: delta.Delta<import("../ytype.js").DeltaConfDeltaToYType<DConf>> | null;
30
+ _delta: Delta<import("../ytype.js").DeltaConfDeltaToYType<DConf>> | null;
31
31
  /**
32
- * @type {delta.Delta<DConf>|null}
32
+ * @type {Delta<DConf>|null}
33
33
  */
34
- _deltaDeep: delta.Delta<DConf> | null;
34
+ _deltaDeep: Delta<DConf> | null;
35
35
  /**
36
36
  * Whether the children changed.
37
37
  * @type {Boolean}
@@ -63,37 +63,33 @@ export class YEvent<DConf extends delta.DeltaConf> {
63
63
  adds(struct: AbstractStruct): boolean;
64
64
  /**
65
65
  * @template {boolean} [Deep=false]
66
- * @param {AbstractAttributionManager} am
67
66
  * @param {object} [opts]
67
+ * @param {AbstractRenderer} [opts.renderer] - renders the content (with attributions); defaults to `baseRenderer`
68
68
  * @param {Deep} [opts.deep]
69
- * @return {Deep extends true ? delta.Delta<DConf> : delta.Delta<import('../internals.js').DeltaConfDeltaToYType<DConf>>} The Delta representation of this type.
69
+ * @return {Deep extends true ? Delta<DConf> : Delta<import('../ytype.js').DeltaConfDeltaToYType<DConf>>} The Delta representation of this type.
70
70
  *
71
71
  * @public
72
72
  */
73
- public getDelta<Deep extends boolean = false>(am?: AbstractAttributionManager, { deep }?: {
73
+ public getDelta<Deep extends boolean = false>({ renderer, deep }?: {
74
+ renderer?: import("./renderer-helpers.js").AbstractRenderer | undefined;
74
75
  deep?: Deep | undefined;
75
- }): Deep extends true ? delta.Delta<DConf> : delta.Delta<import("../internals.js").DeltaConfDeltaToYType<DConf>>;
76
+ }): Deep extends true ? Delta<DConf> : Delta<import("../ytype.js").DeltaConfDeltaToYType<DConf>>;
76
77
  /**
77
78
  * Compute the changes in the delta format.
78
79
  * A {@link https://quilljs.com/docs/delta/|Quill Delta}) that represents the changes on the document.
79
80
  *
80
- * @type {delta.Delta<import('../internals.js').DeltaConfDeltaToYType<DConf>>} The Delta representation of this type.
81
+ * @type {Delta<import('../ytype.js').DeltaConfDeltaToYType<DConf>>} The Delta representation of this type.
81
82
  * @public
82
83
  */
83
- public get delta(): delta.Delta<import("../internals.js").DeltaConfDeltaToYType<DConf>>;
84
+ public get delta(): Delta<import("../ytype.js").DeltaConfDeltaToYType<DConf>>;
84
85
  /**
85
86
  * Compute the changes in the delta format.
86
87
  * A {@link https://quilljs.com/docs/delta/|Quill Delta}) that represents the changes on the document.
87
88
  *
88
- * @type {delta.Delta<DConf>} The Delta representation of this type.
89
+ * @type {Delta<DConf>} The Delta representation of this type.
89
90
  * @public
90
91
  */
91
- public get deltaDeep(): delta.Delta<DConf>;
92
+ public get deltaDeep(): Delta<DConf>;
92
93
  }
93
- export function getPathTo(parent: YType, child: YType, am?: AbstractAttributionManager): Array<string | number>;
94
- import * as delta from 'lib0/delta';
95
- import { YType } from '../internals.js';
96
- import { Transaction } from '../internals.js';
97
- import { AbstractStruct } from '../internals.js';
98
- import { AbstractAttributionManager } from '../internals.js';
94
+ export function getPathTo(parent: YType, child: YType, renderer?: AbstractRenderer): Array<string | number>;
99
95
  //# sourceMappingURL=YEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"YEvent.d.ts","sourceRoot":"","sources":["../../../src/utils/YEvent.js"],"names":[],"mappings":"AAaA;;;GAGG;AACH,oBAH+B,KAAK,SAAtB,KAAK,CAAC,SAAU;IAI5B;;;;OAIG;IACH,oBAJW,KAAK,CAAC,KAAK,CAAC,eACZ,WAAW,QACX,GAAG,CAAC,GAAG,CAAC,OAAC,EA4CnB;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
1
+ export {};
2
+ //# sourceMappingURL=content-helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-helper.d.ts","sourceRoot":"","sources":["../../../src/utils/content-helper.js"],"names":[],"mappings":""}
@@ -1,6 +1,5 @@
1
- export function diffDocsToDelta(v1: Doc, v2: Doc, { am }?: {
2
- am?: import("./AttributionManager.js").DiffAttributionManager | undefined;
1
+ export function diffDocsToDelta(v1: Doc, v2: Doc, { renderer }?: {
2
+ renderer?: import("./Renderer.js").DiffRenderer | undefined;
3
3
  }): delta.DeltaBuilderAny;
4
- import { Doc } from '../internals.js';
5
4
  import * as delta from 'lib0/delta';
6
5
  //# sourceMappingURL=delta-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"delta-helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/delta-helpers.js"],"names":[],"mappings":"AAmBO,oCAJI,GAAG,MACH,GAAG;;IACF,KAAK,CAAC,eAAe,CAoChC;oBA5CM,iBAAiB;uBACD,YAAY"}
1
+ {"version":3,"file":"delta-helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/delta-helpers.js"],"names":[],"mappings":"AAUO,oCAJI,GAAG,MACH,GAAG;;IACF,KAAK,CAAC,eAAe,CAwBhC;uBAhCsB,YAAY"}
@@ -0,0 +1,6 @@
1
+ export function writeStructs(encoder: UpdateEncoderV1 | UpdateEncoderV2, structs: Array<GC | Item | Skip>, client: number, idranges: Array<IdRange>): void;
2
+ export function writeStructsFromIdSet(encoder: UpdateEncoderV1 | UpdateEncoderV2, store: StructStore, idset: IdSet): void;
3
+ export function writeStructsFromTransaction(encoder: UpdateEncoderV1 | UpdateEncoderV2, transaction: Transaction): void;
4
+ export function writeUpdateMessageFromTransaction(encoder: UpdateEncoderV1 | UpdateEncoderV2, transaction: Transaction): boolean;
5
+ import { Skip } from '../structs/Skip.js';
6
+ //# sourceMappingURL=encoding-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoding-helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/encoding-helpers.js"],"names":[],"mappings":"AAiBO,sCAPI,eAAe,GAAG,eAAe,WACjC,KAAK,CAAC,EAAE,GAAC,IAAI,GAAC,IAAI,CAAC,UACnB,MAAM,YACN,KAAK,CAAC,OAAO,CAAC,QAmDxB;AAYM,+CATI,eAAe,GAAG,eAAe,SACjC,WAAW,SACX,KAAK,QAiBf;AASM,qDANI,eAAe,GAAG,eAAe,eACjC,WAAW,QAK2H;AAO1I,2DAJI,eAAe,GAAG,eAAe,eACjC,WAAW,GACV,OAAO,CASlB;qBAxGoB,oBAAoB"}
@@ -1,7 +1,4 @@
1
- export function writeStructs(encoder: UpdateEncoderV1 | UpdateEncoderV2, structs: Array<GC | Item>, client: number, idranges: Array<IdRange>): void;
2
1
  export function writeClientsStructs(encoder: UpdateEncoderV1 | UpdateEncoderV2, store: StructStore, _sm: Map<number, number>): void;
3
- export function writeStructsFromIdSet(encoder: UpdateEncoderV1 | UpdateEncoderV2, store: StructStore, idset: IdSet): void;
4
- export function writeStructsFromTransaction(encoder: UpdateEncoderV1 | UpdateEncoderV2, transaction: Transaction): void;
5
2
  export function readUpdateV2(decoder: decoding.Decoder, ydoc: Doc, transactionOrigin?: any, structDecoder?: UpdateDecoderV1 | UpdateDecoderV2): void;
6
3
  export function readUpdate(decoder: decoding.Decoder, ydoc: Doc, transactionOrigin?: any): void;
7
4
  export function applyUpdateV2(ydoc: Doc, update: Uint8Array, transactionOrigin?: any, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2): void;
@@ -10,25 +7,26 @@ export function writeStateAsUpdate(encoder: UpdateEncoderV1 | UpdateEncoderV2, d
10
7
  export function encodeStateAsUpdateV2(doc: Doc, encodedTargetStateVector?: Uint8Array, encoder?: UpdateEncoderV1 | UpdateEncoderV2): Uint8Array<ArrayBuffer>;
11
8
  export function encodeStateAsUpdate(doc: Doc, encodedTargetStateVector?: Uint8Array): Uint8Array<ArrayBuffer>;
12
9
  export function readStateVector(decoder: IdSetDecoderV1 | IdSetDecoderV2): Map<number, number>;
10
+ export function mergeUpdatesV2(updates: Array<Uint8Array<ArrayBuffer>>, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2, YEncoder?: typeof UpdateEncoderV1 | typeof UpdateEncoderV2): Uint8Array<ArrayBuffer>;
11
+ export function mergeUpdates(updates: Array<Uint8Array<ArrayBuffer>>): Uint8Array<ArrayBuffer>;
12
+ export function diffUpdateV2(update: Uint8Array, sv: Uint8Array, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2, YEncoder?: typeof UpdateEncoderV1 | typeof UpdateEncoderV2): Uint8Array<ArrayBuffer>;
13
+ export function diffUpdate(update: Uint8Array<ArrayBuffer>, sv: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>;
13
14
  export function decodeStateVector(decodedState: Uint8Array): Map<number, number>;
14
15
  export function writeStateVector(encoder: IdSetEncoderV1 | IdSetEncoderV2, sv: Map<number, number>): IdSetEncoderV1 | IdSetEncoderV2;
15
16
  export function writeDocumentStateVector(encoder: IdSetEncoderV1 | IdSetEncoderV2, doc: Doc): IdSetEncoderV1 | IdSetEncoderV2;
16
17
  export function encodeStateVectorV2(doc: Doc | Map<number, number>, encoder?: IdSetEncoderV1 | IdSetEncoderV2): Uint8Array<ArrayBuffer>;
17
18
  export function encodeStateVector(doc: Doc | Map<number, number>): Uint8Array<ArrayBuffer>;
18
- import { UpdateEncoderV1 } from '../internals.js';
19
- import { UpdateEncoderV2 } from '../internals.js';
20
- import { GC } from '../internals.js';
21
- import { Item } from '../internals.js';
22
- import { IdRange } from '../internals.js';
23
- import { StructStore } from '../internals.js';
24
- import { IdSet } from '../internals.js';
25
- import { Transaction } from '../internals.js';
19
+ export function createDocFromUpdate(update: Uint8Array, opts?: import("./Doc.js").DocOpts): Doc;
20
+ export function createDocFromUpdateV2(update: Uint8Array, opts?: import("./Doc.js").DocOpts): Doc;
21
+ export function cloneDoc(ydoc: Doc, opts?: import("./Doc.js").DocOpts): Doc;
22
+ import { UpdateEncoderV1 } from './UpdateEncoder.js';
23
+ import { UpdateEncoderV2 } from './UpdateEncoder.js';
24
+ import { StructStore } from './StructStore.js';
26
25
  import * as decoding from 'lib0/decoding';
27
- import { Doc } from '../internals.js';
28
- import { UpdateDecoderV1 } from '../internals.js';
29
- import { UpdateDecoderV2 } from '../internals.js';
30
- import { IdSetDecoderV1 } from '../internals.js';
31
- import { IdSetDecoderV2 } from '../internals.js';
32
- import { IdSetEncoderV1 } from '../internals.js';
33
- import { IdSetEncoderV2 } from '../internals.js';
26
+ import { Doc } from './Doc.js';
27
+ import { UpdateDecoderV1 } from './UpdateDecoder.js';
28
+ import { UpdateDecoderV2 } from './UpdateDecoder.js';
29
+ import { IdSetDecoderV1 } from './UpdateDecoder.js';
30
+ import { IdSetEncoderV1 } from './UpdateEncoder.js';
31
+ import { IdSetEncoderV2 } from './UpdateEncoder.js';
34
32
  //# sourceMappingURL=encoding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../../src/utils/encoding.js"],"names":[],"mappings":"AAwDO,sCAPI,eAAe,GAAG,eAAe,WACjC,KAAK,CAAC,EAAE,GAAC,IAAI,CAAC,UACd,MAAM,YACN,KAAK,CAAC,OAAO,CAAC,QAmDxB;AAUM,6CAPI,eAAe,GAAG,eAAe,SACjC,WAAW,OACX,GAAG,CAAC,MAAM,EAAC,MAAM,CAAC,QA4B5B;AAYM,+CATI,eAAe,GAAG,eAAe,SACjC,WAAW,SACX,KAAK,QAiBf;AA6KM,qDANI,eAAe,GAAG,eAAe,eACjC,WAAW,QAK2H;AAc1I,sCAPI,QAAQ,CAAC,OAAO,QAChB,GAAG,sBACH,GAAG,kBACH,eAAe,GAAG,eAAe,QAqFd;AAavB,oCANI,QAAQ,CAAC,OAAO,QAChB,GAAG,sBACH,GAAG,QAI8H;AAcrI,oCAPI,GAAG,UACH,UAAU,sBACV,GAAG,aACH,OAAO,eAAe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AC,MAAM,CAAC,mCAU5B;AAQM,kDALI,cAAc,GAAG,cAAc,OAC/B,GAAG,mCAIgG;AAWvG,yCANI,GAAG,GAAC,GAAG,CAAC,MAAM,EAAC,MAAM,CAAC,YACtB,cAAc,GAAG,cAAc,GAC9B,UAAU,CAAC,WAAW,CAAC,CAWlC;AAUM,uCALI,GAAG,GAAC,GAAG,CAAC,MAAM,EAAC,MAAM,CAAC,GACrB,UAAU,CAAC,WAAW,CAAC,CAImD;AA+D/E,4CAHI,UAAU,SACV,OAAO,UAAU,EAAE,OAAO,OAMpC;AAMM,8CAHI,UAAU,SACV,OAAO,UAAU,EAAE,OAAO,OAMpC;AAMM,+BAHI,GAAG,SACH,OAAO,UAAU,EAAE,OAAO,OAMpC;gCA7pBgF,oBAAoB;gCAApB,oBAAoB;4BALzD,kBAAkB;0BALpC,eAAe;oBAgBrB,UAAU;gCAPmC,oBAAoB;gCAApB,oBAAoB;+BAApB,oBAAoB;+BACJ,oBAAoB;+BAApB,oBAAoB"}
@@ -0,0 +1,331 @@
1
+ /**
2
+ * @typedef {{ inserts: IdSet, deletes: IdSet }} ContentIds
3
+ */
4
+ /**
5
+ * @typedef {{ inserts: IdMap<any>, deletes: IdMap<any> }} ContentMap
6
+ */
7
+ export class IdRange {
8
+ /**
9
+ * @param {number} clock
10
+ * @param {number} len
11
+ */
12
+ constructor(clock: number, len: number);
13
+ /**
14
+ * @type {number}
15
+ */
16
+ clock: number;
17
+ /**
18
+ * @type {number}
19
+ */
20
+ len: number;
21
+ /**
22
+ * @param {number} clock
23
+ * @param {number} len
24
+ */
25
+ copyWith(clock: number, len: number): IdRange;
26
+ /**
27
+ * Helper method making this compatible with IdMap.
28
+ *
29
+ * @return {Array<ContentAttribute<any>>}
30
+ */
31
+ get attrs(): Array<ContentAttribute<any>>;
32
+ }
33
+ export class MaybeIdRange {
34
+ /**
35
+ * @param {number} clock
36
+ * @param {number} len
37
+ * @param {boolean} exists
38
+ */
39
+ constructor(clock: number, len: number, exists: boolean);
40
+ /**
41
+ * @type {number}
42
+ */
43
+ clock: number;
44
+ /**
45
+ * @type {number}
46
+ */
47
+ len: number;
48
+ /**
49
+ * @type {boolean}
50
+ */
51
+ exists: boolean;
52
+ }
53
+ export function createMaybeIdRange(clock: number, len: number, exists: boolean): MaybeIdRange;
54
+ export class IdRanges {
55
+ /**
56
+ * @param {Array<IdRange>} ids
57
+ */
58
+ constructor(ids: Array<IdRange>);
59
+ sorted: boolean;
60
+ /**
61
+ * A typical use-case for IdSet is to append data. We heavily optimize this case by allowing the
62
+ * last item to be mutated if it isn't used currently.
63
+ * This flag is true if the last item was exposed to the outside.
64
+ */
65
+ _lastIsUsed: boolean;
66
+ /**
67
+ * @private
68
+ */
69
+ private _ids;
70
+ copy(): IdRanges;
71
+ /**
72
+ * @param {number} clock
73
+ * @param {number} length
74
+ */
75
+ add(clock: number, length: number): void;
76
+ /**
77
+ * Return the list of immutable id ranges, sorted and merged.
78
+ */
79
+ getIds(): IdRange[];
80
+ }
81
+ /**
82
+ * @implements {traits.EqualityTrait}
83
+ */
84
+ export class IdSet implements traits.EqualityTrait {
85
+ /**
86
+ * @type {Map<number,IdRanges>}
87
+ */
88
+ clients: Map<number, IdRanges>;
89
+ isEmpty(): boolean;
90
+ /**
91
+ * @param {(idrange:IdRange, client:number) => void} f
92
+ */
93
+ forEach(f: (idrange: IdRange, client: number) => void): void;
94
+ /**
95
+ * @param {ID} id
96
+ * @return {boolean}
97
+ */
98
+ hasId(id: ID): boolean;
99
+ /**
100
+ * @param {number} client
101
+ * @param {number} clock
102
+ */
103
+ has(client: number, clock: number): boolean;
104
+ /**
105
+ * Return slices of ids that exist in this idset.
106
+ *
107
+ * @param {number} client
108
+ * @param {number} clock
109
+ * @param {number} len
110
+ * @return {Array<MaybeIdRange>}
111
+ */
112
+ slice(client: number, clock: number, len: number): Array<MaybeIdRange>;
113
+ /**
114
+ * @param {number} client
115
+ * @param {number} clock
116
+ * @param {number} len
117
+ */
118
+ add(client: number, clock: number, len: number): void;
119
+ /**
120
+ * @param {number} client
121
+ * @param {number} clock
122
+ * @param {number} len
123
+ */
124
+ delete(client: number, clock: number, len: number): void;
125
+ /**
126
+ * @param {any} other
127
+ */
128
+ [traits.EqualityTraitSymbol](other: any): boolean;
129
+ }
130
+ export function equalIdSets(ds1: IdSet, ds2: IdSet): boolean;
131
+ export function _deleteRangeFromIdSet(set: IdSet | IdMap<any>, client: number, clock: number, len: number): void;
132
+ export function iterateStructsByIdSet(transaction: Transaction, ds: IdSet, f: (arg0: GC | Item) => void): void;
133
+ export function gcIdSet(doc: Doc, ids: IdSet, gcFilter?: (arg0: Item) => boolean): void;
134
+ export function iterateStructsByIdSetWithoutSplits(store: StructStore, ds: IdSet, f: (struct: GC | Item | Skip, offset: number, len: number) => void): void;
135
+ export function findIndexInIdRanges(dis: Array<IdRange>, clock: number): number | null;
136
+ export function findRangeStartInIdRanges(dis: Array<IdRange>, clock: number): number | null;
137
+ export function mergeIdSets(idSets: Array<IdSet>): IdSet;
138
+ /**
139
+ * @template {IdSet | IdMap<any>} S
140
+ * @param {S} dest
141
+ * @param {S} src
142
+ */
143
+ export function insertIntoIdSet<S extends IdSet | IdMap<any>>(dest: S, src: S): void;
144
+ /**
145
+ * @template {IdSet | IdMap<any>} S
146
+ * @param {S} dest
147
+ * @param {S} src
148
+ */
149
+ export function insertIntoIdMap<S extends IdSet | IdMap<any>>(dest: S, src: S): void;
150
+ export function _diffSet<Set extends IdSet | IdMap<any>>(set: Set, exclude: IdSet | IdMap<any>): Set;
151
+ /**
152
+ * Remove all ranges from `exclude` from `idSet`. The result is a fresh IdSet containing all ranges from `idSet` that are not
153
+ * in `exclude`.
154
+ *
155
+ * @type {(idSet: IdSet, exclude: IdSet|IdMap<any>) => IdSet}
156
+ */
157
+ export const diffIdSet: (idSet: IdSet, exclude: IdSet | IdMap<any>) => IdSet;
158
+ export function _intersectSets<SetA extends IdSet | IdMap<any>, SetB extends IdSet | IdMap<any>>(setA: SetA, setB: SetB): SetA extends IdMap<infer A> ? (SetB extends IdMap<infer B> ? IdMap<A | B> : IdMap<A>) : IdSet;
159
+ export function intersectSets<SetA extends IdSet | IdMap<any>, SetB extends IdSet | IdMap<any>>(setA: SetA, setB: SetB): SetA extends IdMap<infer A> ? (SetB extends IdMap<infer B> ? IdMap<A | B> : IdMap<A>) : IdSet;
160
+ export function createIdSet(): IdSet;
161
+ export function createDeleteSetFromStructStore(ss: StructStore): IdSet;
162
+ export function _createInsertSliceFromStructs(structs: Array<GC | Item | Skip>, filterDeleted: boolean): IdRange[];
163
+ export function createInsertSetFromStructStore(ss: StructStore, filterDeleted: boolean): IdSet;
164
+ export function writeIdSet(encoder: IdSetEncoderV1 | IdSetEncoderV2, idSet: IdSet): void;
165
+ export function readIdSet(decoder: IdSetDecoderV1 | IdSetDecoderV2): IdSet;
166
+ export function encodeIdSet(idSet: IdSet): Uint8Array<ArrayBuffer>;
167
+ export function decodeIdSet(data: Uint8Array): IdSet;
168
+ export function readAndApplyDeleteSet(decoder: IdSetDecoderV1 | IdSetDecoderV2, transaction: Transaction, store: StructStore): Uint8Array<ArrayBuffer> | null;
169
+ /**
170
+ * @template Attrs
171
+ */
172
+ export class AttrRange<Attrs> {
173
+ /**
174
+ * @param {number} clock
175
+ * @param {number} len
176
+ * @param {Array<ContentAttribute<Attrs>>} attrs
177
+ */
178
+ constructor(clock: number, len: number, attrs: Array<ContentAttribute<Attrs>>);
179
+ /**
180
+ * @readonly
181
+ */
182
+ readonly clock: number;
183
+ /**
184
+ * @readonly
185
+ */
186
+ readonly len: number;
187
+ /**
188
+ * @readonly
189
+ */
190
+ readonly attrs: ContentAttribute<Attrs>[];
191
+ /**
192
+ * @param {number} clock
193
+ * @param {number} len
194
+ */
195
+ copyWith(clock: number, len: number): AttrRange<Attrs>;
196
+ }
197
+ /**
198
+ * @todo rename this to `Attribute`
199
+ * @template V
200
+ */
201
+ export class ContentAttribute<V> {
202
+ /**
203
+ * @param {string} name
204
+ * @param {V} val
205
+ */
206
+ constructor(name: string, val: V);
207
+ name: string;
208
+ val: V;
209
+ hash(): string;
210
+ }
211
+ export function createContentAttribute<V>(name: string, val: V): ContentAttribute<V>;
212
+ export function createMaybeAttrRange<Attrs>(clock: number, len: number, attrs: Array<ContentAttribute<Attrs>> | null): MaybeAttrRange<Attrs>;
213
+ /**
214
+ * Whenever this is instantiated, it must receive a fresh array of ops, not something copied.
215
+ *
216
+ * @template Attrs
217
+ */
218
+ export class AttrRanges<Attrs> {
219
+ /**
220
+ * @param {Array<AttrRange<Attrs>>} ids
221
+ */
222
+ constructor(ids: Array<AttrRange<Attrs>>);
223
+ sorted: boolean;
224
+ /**
225
+ * @private
226
+ */
227
+ private _ids;
228
+ copy(): AttrRanges<Attrs>;
229
+ /**
230
+ * @param {number} clock
231
+ * @param {number} length
232
+ * @param {Array<ContentAttribute<Attrs>>} attrs
233
+ */
234
+ add(clock: number, length: number, attrs: Array<ContentAttribute<Attrs>>): void;
235
+ /**
236
+ * Return the list of id ranges, sorted and merged.
237
+ */
238
+ getIds(): AttrRange<Attrs>[];
239
+ }
240
+ /**
241
+ * @template Attrs
242
+ */
243
+ export class IdMap<Attrs> {
244
+ /**
245
+ * @type {Map<number,AttrRanges<Attrs>>}
246
+ */
247
+ clients: Map<number, AttrRanges<Attrs>>;
248
+ /**
249
+ * @type {Map<string, ContentAttribute<Attrs>>}
250
+ */
251
+ attrsH: Map<string, ContentAttribute<Attrs>>;
252
+ /**
253
+ * @type {Set<ContentAttribute<Attrs>>}
254
+ */
255
+ attrs: Set<ContentAttribute<Attrs>>;
256
+ /**
257
+ * @param {(attrRange:AttrRange<Attrs>, client:number) => void} f
258
+ */
259
+ forEach(f: (attrRange: AttrRange<Attrs>, client: number) => void): void;
260
+ isEmpty(): boolean;
261
+ /**
262
+ * @param {ID} id
263
+ * @return {boolean}
264
+ */
265
+ hasId(id: ID): boolean;
266
+ /**
267
+ * @param {number} client
268
+ * @param {number} clock
269
+ * @return {boolean}
270
+ */
271
+ has(client: number, clock: number): boolean;
272
+ /**
273
+ * Return attributions for a slice of ids.
274
+ *
275
+ * @param {ID} id
276
+ * @param {number} len
277
+ * @return {Array<MaybeAttrRange<Attrs>>}
278
+ */
279
+ sliceId(id: ID, len: number): Array<MaybeAttrRange<Attrs>>;
280
+ /**
281
+ * Return attributions for a slice of ids.
282
+ *
283
+ * @param {number} client
284
+ * @param {number} clock
285
+ * @param {number} len
286
+ * @return {Array<MaybeAttrRange<Attrs>>}
287
+ */
288
+ slice(client: number, clock: number, len: number): Array<MaybeAttrRange<Attrs>>;
289
+ /**
290
+ * @param {number} client
291
+ * @param {number} clock
292
+ * @param {number} len
293
+ * @param {Array<ContentAttribute<Attrs>>} attrs
294
+ */
295
+ add(client: number, clock: number, len: number, attrs: Array<ContentAttribute<Attrs>>): void;
296
+ /**
297
+ * @param {number} client
298
+ * @param {number} clock
299
+ * @param {number} len
300
+ */
301
+ delete(client: number, clock: number, len: number): void;
302
+ }
303
+ export function idmapAttrsEqual<T>(a: Array<T>, b: Array<T>): boolean;
304
+ export function mergeIdMaps<T>(ams: Array<IdMap<T>>): IdMap<T>;
305
+ export function createIdMapFromIdSet(idset: IdSet, attrs: Array<ContentAttribute<any>>): IdMap<any>;
306
+ export function createIdSetFromIdMap(idmap: IdMap<any>): IdSet;
307
+ export function writeIdMap<Attr>(encoder: IdSetEncoderV1 | IdSetEncoderV2, idmap: IdMap<Attr>): void;
308
+ export function encodeIdMap(idmap: IdMap<any>): Uint8Array<ArrayBuffer>;
309
+ export function readIdMap(decoder: IdSetDecoderV1 | IdSetDecoderV2): IdMap<any>;
310
+ export function decodeIdMap(data: Uint8Array): IdMap<any>;
311
+ export function createIdMap(): IdMap<any>;
312
+ export function diffIdMap<ISet extends IdMap<any>>(set: ISet, exclude: IdSet | IdMap<any>): ISet;
313
+ export function intersectMaps<SetA extends IdSet | IdMap<any>, SetB extends IdSet | IdMap<any>>(setA: SetA, setB: SetB): SetA extends IdMap<infer A> ? (SetB extends IdMap<infer B> ? IdMap<A | B> : IdMap<A>) : IdSet;
314
+ export function filterIdMap<Attrs>(idmap: IdMap<Attrs>, predicate: (attr: Array<ContentAttribute<Attrs>>) => boolean): IdMap<Attrs>;
315
+ export type ContentIds = {
316
+ inserts: IdSet;
317
+ deletes: IdSet;
318
+ };
319
+ export type ContentMap = {
320
+ inserts: IdMap<any>;
321
+ deletes: IdMap<any>;
322
+ };
323
+ export type MaybeAttrRange<Attrs> = {
324
+ clock: number;
325
+ len: number;
326
+ attrs: Array<ContentAttribute<Attrs>> | null;
327
+ };
328
+ import * as traits from 'lib0/traits';
329
+ import { IdSetEncoderV2 } from './UpdateEncoder.js';
330
+ import { IdSetDecoderV2 } from './UpdateDecoder.js';
331
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../src/utils/ids.js"],"names":[],"mappings":"AAaA;;GAEG;AAEH;;GAEG;AAEH;IACE;;;OAGG;IACH,mBAHW,MAAM,OACN,MAAM,EAWhB;IARC;;OAEG;IACH,OAFU,MAAM,CAEE;IAClB;;OAEG;IACH,KAFU,MAAM,CAEF;IAGhB;;;OAGG;IACH,gBAHW,MAAM,OACN,MAAM,WAIhB;IAED;;;;OAIG;IACH,aAFY,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAIvC;CACF;AAED;IACE;;;;OAIG;IACH,mBAJW,MAAM,OACN,MAAM,UACN,OAAO,EAejB;IAZC;;OAEG;IACH,OAFU,MAAM,CAEE;IAClB;;OAEG;IACH,KAFU,MAAM,CAEF;IACd;;OAEG;IACH,QAFU,OAAO,CAEG;CAEvB;AAQM,0CALI,MAAM,OACN,MAAM,UACN,OAAO,GACN,YAAY,CAEsE;AAE9F;IACE;;OAEG;IACH,iBAFW,KAAK,CAAC,OAAO,CAAC,EAcxB;IAXC,gBAAmB;IACnB;;;;OAIG;IACH,qBAAwB;IACxB;;OAEG;IACH,aAAe;IAGjB,iBAKC;IAED;;;O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EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,OAAC,CAAA;CAAE;wBA56B3D,aAAa;+BASW,oBAAoB;+BACrC,oBAAoB"}
@@ -1,3 +1,2 @@
1
- export function isParentOf(parent: import("../ytype.js").YType, child: Item | null): boolean;
2
- import { Item } from '../internals.js';
1
+ export function isParentOf(parent: YType, child: Item | null): boolean;
3
2
  //# sourceMappingURL=isParentOf.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isParentOf.d.ts","sourceRoot":"","sources":["../../../src/utils/isParentOf.js"],"names":[],"mappings":"AAYO,mCAPI,OAAO,aAAa,EAAE,KAAK,SAC3B,IAAI,GAAC,IAAI,WAcnB;qBApBoB,iBAAiB"}
1
+ {"version":3,"file":"isParentOf.d.ts","sourceRoot":"","sources":["../../../src/utils/isParentOf.js"],"names":[],"mappings":"AAUO,mCAPI,KAAK,SACL,IAAI,GAAC,IAAI,WAcnB"}
@@ -1,3 +1,2 @@
1
1
  export function logType(type: YType<any>): void;
2
- import { YType } from '../internals.js';
3
2
  //# sourceMappingURL=logging.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../src/utils/logging.js"],"names":[],"mappings":"AAWO,8BAFI,KAAK,CAAC,GAAG,CAAC,QAWpB;sBAlBM,iBAAiB"}
1
+ {"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../src/utils/logging.js"],"names":[],"mappings":"AAOO,8BAFI,KAAK,CAAC,GAAG,CAAC,QAWpB"}