@y/y 14.0.0-16

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 (193) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +1406 -0
  3. package/dist/Skip-j0kX7pdq.js +12173 -0
  4. package/dist/Skip-j0kX7pdq.js.map +1 -0
  5. package/dist/Skip-wRT7BKFP.js +11877 -0
  6. package/dist/Skip-wRT7BKFP.js.map +1 -0
  7. package/dist/index-DyTeTfmj.js +163 -0
  8. package/dist/index-DyTeTfmj.js.map +1 -0
  9. package/dist/index-R7GxO-36.js +165 -0
  10. package/dist/index-R7GxO-36.js.map +1 -0
  11. package/dist/internals.cjs +286 -0
  12. package/dist/internals.cjs.map +1 -0
  13. package/dist/internals.mjs +25 -0
  14. package/dist/internals.mjs.map +1 -0
  15. package/dist/src/index.d.ts +2 -0
  16. package/dist/src/index.d.ts.map +1 -0
  17. package/dist/src/internals.d.ts +43 -0
  18. package/dist/src/internals.d.ts.map +1 -0
  19. package/dist/src/structs/AbstractStruct.d.ts +42 -0
  20. package/dist/src/structs/AbstractStruct.d.ts.map +1 -0
  21. package/dist/src/structs/ContentAny.d.ts +67 -0
  22. package/dist/src/structs/ContentAny.d.ts.map +1 -0
  23. package/dist/src/structs/ContentBinary.d.ts +64 -0
  24. package/dist/src/structs/ContentBinary.d.ts.map +1 -0
  25. package/dist/src/structs/ContentDeleted.d.ts +64 -0
  26. package/dist/src/structs/ContentDeleted.d.ts.map +1 -0
  27. package/dist/src/structs/ContentDoc.d.ts +72 -0
  28. package/dist/src/structs/ContentDoc.d.ts.map +1 -0
  29. package/dist/src/structs/ContentEmbed.d.ts +67 -0
  30. package/dist/src/structs/ContentEmbed.d.ts.map +1 -0
  31. package/dist/src/structs/ContentFormat.d.ts +69 -0
  32. package/dist/src/structs/ContentFormat.d.ts.map +1 -0
  33. package/dist/src/structs/ContentJSON.d.ts +70 -0
  34. package/dist/src/structs/ContentJSON.d.ts.map +1 -0
  35. package/dist/src/structs/ContentString.d.ts +70 -0
  36. package/dist/src/structs/ContentString.d.ts.map +1 -0
  37. package/dist/src/structs/ContentType.d.ts +83 -0
  38. package/dist/src/structs/ContentType.d.ts.map +1 -0
  39. package/dist/src/structs/GC.d.ts +31 -0
  40. package/dist/src/structs/GC.d.ts.map +1 -0
  41. package/dist/src/structs/Item.d.ts +212 -0
  42. package/dist/src/structs/Item.d.ts.map +1 -0
  43. package/dist/src/structs/Skip.d.ts +33 -0
  44. package/dist/src/structs/Skip.d.ts.map +1 -0
  45. package/dist/src/types/AbstractType.d.ts +239 -0
  46. package/dist/src/types/AbstractType.d.ts.map +1 -0
  47. package/dist/src/types/YArray.d.ts +128 -0
  48. package/dist/src/types/YArray.d.ts.map +1 -0
  49. package/dist/src/types/YMap.d.ts +112 -0
  50. package/dist/src/types/YMap.d.ts.map +1 -0
  51. package/dist/src/types/YText.d.ts +216 -0
  52. package/dist/src/types/YText.d.ts.map +1 -0
  53. package/dist/src/types/YXmlElement.d.ts +106 -0
  54. package/dist/src/types/YXmlElement.d.ts.map +1 -0
  55. package/dist/src/types/YXmlFragment.d.ts +143 -0
  56. package/dist/src/types/YXmlFragment.d.ts.map +1 -0
  57. package/dist/src/types/YXmlHook.d.ts +32 -0
  58. package/dist/src/types/YXmlHook.d.ts.map +1 -0
  59. package/dist/src/types/YXmlText.d.ts +34 -0
  60. package/dist/src/types/YXmlText.d.ts.map +1 -0
  61. package/dist/src/utils/AbstractConnector.d.ts +20 -0
  62. package/dist/src/utils/AbstractConnector.d.ts.map +1 -0
  63. package/dist/src/utils/AttributionManager.d.ts +224 -0
  64. package/dist/src/utils/AttributionManager.d.ts.map +1 -0
  65. package/dist/src/utils/Doc.d.ts +267 -0
  66. package/dist/src/utils/Doc.d.ts.map +1 -0
  67. package/dist/src/utils/EventHandler.d.ts +19 -0
  68. package/dist/src/utils/EventHandler.d.ts.map +1 -0
  69. package/dist/src/utils/ID.d.ts +26 -0
  70. package/dist/src/utils/ID.d.ts.map +1 -0
  71. package/dist/src/utils/IdMap.d.ts +161 -0
  72. package/dist/src/utils/IdMap.d.ts.map +1 -0
  73. package/dist/src/utils/IdSet.d.ts +163 -0
  74. package/dist/src/utils/IdSet.d.ts.map +1 -0
  75. package/dist/src/utils/RelativePosition.d.ts +91 -0
  76. package/dist/src/utils/RelativePosition.d.ts.map +1 -0
  77. package/dist/src/utils/Snapshot.d.ts +40 -0
  78. package/dist/src/utils/Snapshot.d.ts.map +1 -0
  79. package/dist/src/utils/StructSet.d.ts +27 -0
  80. package/dist/src/utils/StructSet.d.ts.map +1 -0
  81. package/dist/src/utils/StructStore.d.ts +41 -0
  82. package/dist/src/utils/StructStore.d.ts.map +1 -0
  83. package/dist/src/utils/Transaction.d.ts +136 -0
  84. package/dist/src/utils/Transaction.d.ts.map +1 -0
  85. package/dist/src/utils/UndoManager.d.ts +188 -0
  86. package/dist/src/utils/UndoManager.d.ts.map +1 -0
  87. package/dist/src/utils/UpdateDecoder.d.ts +167 -0
  88. package/dist/src/utils/UpdateDecoder.d.ts.map +1 -0
  89. package/dist/src/utils/UpdateEncoder.d.ts +164 -0
  90. package/dist/src/utils/UpdateEncoder.d.ts.map +1 -0
  91. package/dist/src/utils/YEvent.d.ts +120 -0
  92. package/dist/src/utils/YEvent.d.ts.map +1 -0
  93. package/dist/src/utils/delta-helpers.d.ts +6 -0
  94. package/dist/src/utils/delta-helpers.d.ts.map +1 -0
  95. package/dist/src/utils/encoding.d.ts +30 -0
  96. package/dist/src/utils/encoding.d.ts.map +1 -0
  97. package/dist/src/utils/isParentOf.d.ts +3 -0
  98. package/dist/src/utils/isParentOf.d.ts.map +1 -0
  99. package/dist/src/utils/logging.d.ts +3 -0
  100. package/dist/src/utils/logging.d.ts.map +1 -0
  101. package/dist/src/utils/types.d.ts +7 -0
  102. package/dist/src/utils/types.d.ts.map +1 -0
  103. package/dist/src/utils/updates.d.ts +89 -0
  104. package/dist/src/utils/updates.d.ts.map +1 -0
  105. package/dist/testHelper.cjs +780 -0
  106. package/dist/testHelper.cjs.map +1 -0
  107. package/dist/testHelper.mjs +617 -0
  108. package/dist/testHelper.mjs.map +1 -0
  109. package/dist/tests/IdMap.tests.d.ts +9 -0
  110. package/dist/tests/IdMap.tests.d.ts.map +1 -0
  111. package/dist/tests/IdSet.tests.d.ts +9 -0
  112. package/dist/tests/IdSet.tests.d.ts.map +1 -0
  113. package/dist/tests/attribution.tests.d.ts +8 -0
  114. package/dist/tests/attribution.tests.d.ts.map +1 -0
  115. package/dist/tests/compatibility.tests.d.ts +5 -0
  116. package/dist/tests/compatibility.tests.d.ts.map +1 -0
  117. package/dist/tests/delta.tests.d.ts +7 -0
  118. package/dist/tests/delta.tests.d.ts.map +1 -0
  119. package/dist/tests/doc.tests.d.ts +13 -0
  120. package/dist/tests/doc.tests.d.ts.map +1 -0
  121. package/dist/tests/encoding.tests.d.ts +5 -0
  122. package/dist/tests/encoding.tests.d.ts.map +1 -0
  123. package/dist/tests/index.d.ts +2 -0
  124. package/dist/tests/index.d.ts.map +1 -0
  125. package/dist/tests/relativePositions.tests.d.ts +11 -0
  126. package/dist/tests/relativePositions.tests.d.ts.map +1 -0
  127. package/dist/tests/snapshot.tests.d.ts +13 -0
  128. package/dist/tests/snapshot.tests.d.ts.map +1 -0
  129. package/dist/tests/testHelper.d.ts +167 -0
  130. package/dist/tests/testHelper.d.ts.map +1 -0
  131. package/dist/tests/undo-redo.tests.d.ts +27 -0
  132. package/dist/tests/undo-redo.tests.d.ts.map +1 -0
  133. package/dist/tests/updates.tests.d.ts +24 -0
  134. package/dist/tests/updates.tests.d.ts.map +1 -0
  135. package/dist/tests/y-array.tests.d.ts +45 -0
  136. package/dist/tests/y-array.tests.d.ts.map +1 -0
  137. package/dist/tests/y-map.tests.d.ts +45 -0
  138. package/dist/tests/y-map.tests.d.ts.map +1 -0
  139. package/dist/tests/y-text.tests.d.ts +49 -0
  140. package/dist/tests/y-text.tests.d.ts.map +1 -0
  141. package/dist/tests/y-xml.tests.d.ts +15 -0
  142. package/dist/tests/y-xml.tests.d.ts.map +1 -0
  143. package/dist/yjs.cjs +151 -0
  144. package/dist/yjs.cjs.map +1 -0
  145. package/dist/yjs.mjs +26 -0
  146. package/dist/yjs.mjs.map +1 -0
  147. package/package.json +101 -0
  148. package/src/index.js +153 -0
  149. package/src/internals.js +44 -0
  150. package/src/structs/AbstractStruct.js +59 -0
  151. package/src/structs/ContentAny.js +115 -0
  152. package/src/structs/ContentBinary.js +93 -0
  153. package/src/structs/ContentDeleted.js +101 -0
  154. package/src/structs/ContentDoc.js +141 -0
  155. package/src/structs/ContentEmbed.js +98 -0
  156. package/src/structs/ContentFormat.js +105 -0
  157. package/src/structs/ContentJSON.js +119 -0
  158. package/src/structs/ContentString.js +113 -0
  159. package/src/structs/ContentType.js +176 -0
  160. package/src/structs/GC.js +80 -0
  161. package/src/structs/Item.js +845 -0
  162. package/src/structs/Skip.js +75 -0
  163. package/src/types/AbstractType.js +1434 -0
  164. package/src/types/YArray.js +270 -0
  165. package/src/types/YMap.js +244 -0
  166. package/src/types/YText.js +934 -0
  167. package/src/types/YXmlElement.js +227 -0
  168. package/src/types/YXmlFragment.js +266 -0
  169. package/src/types/YXmlHook.js +68 -0
  170. package/src/types/YXmlText.js +66 -0
  171. package/src/utils/AbstractConnector.js +25 -0
  172. package/src/utils/AttributionManager.js +619 -0
  173. package/src/utils/Doc.js +372 -0
  174. package/src/utils/EventHandler.js +87 -0
  175. package/src/utils/ID.js +89 -0
  176. package/src/utils/IdMap.js +629 -0
  177. package/src/utils/IdSet.js +823 -0
  178. package/src/utils/RelativePosition.js +352 -0
  179. package/src/utils/Snapshot.js +220 -0
  180. package/src/utils/StructSet.js +137 -0
  181. package/src/utils/StructStore.js +289 -0
  182. package/src/utils/Transaction.js +489 -0
  183. package/src/utils/UndoManager.js +391 -0
  184. package/src/utils/UpdateDecoder.js +281 -0
  185. package/src/utils/UpdateEncoder.js +320 -0
  186. package/src/utils/YEvent.js +216 -0
  187. package/src/utils/delta-helpers.js +54 -0
  188. package/src/utils/encoding.js +623 -0
  189. package/src/utils/isParentOf.js +21 -0
  190. package/src/utils/logging.js +21 -0
  191. package/src/utils/types.js +28 -0
  192. package/src/utils/updates.js +715 -0
  193. package/tests/testHelper.js +600 -0
@@ -0,0 +1,120 @@
1
+ /**
2
+ * @typedef {import('./types.js').YType} _YType
3
+ */
4
+ /**
5
+ * @template {AbstractType<any,any>} Target
6
+ * YEvent describes the changes on a YType.
7
+ */
8
+ export class YEvent<Target extends AbstractType<any, any>> {
9
+ /**
10
+ * @param {Target} target The changed type.
11
+ * @param {Transaction} transaction
12
+ * @param {Set<any>?} subs The keys that changed
13
+ */
14
+ constructor(target: Target, transaction: Transaction, subs: Set<any> | null);
15
+ /**
16
+ * The type on which this event was created on.
17
+ * @type {Target}
18
+ */
19
+ target: Target;
20
+ /**
21
+ * The current target on which the observe callback is called.
22
+ * @type {_YType}
23
+ */
24
+ currentTarget: _YType;
25
+ /**
26
+ * The transaction that triggered this event.
27
+ * @type {Transaction}
28
+ */
29
+ transaction: Transaction;
30
+ /**
31
+ * @type {(Target extends AbstractType<infer D,any> ? D : delta.Delta<any,any,any,any,any>)|null}
32
+ */
33
+ _delta: (Target extends AbstractType<infer D, any> ? D : delta.Delta<any, any, any, any, any>) | null;
34
+ /**
35
+ * @type {(Target extends AbstractType<infer D,any> ? import('../internals.js').ToDeepEventDelta<D> : delta.Delta<any,any,any,any,any>)|null}
36
+ */
37
+ _deltaDeep: (Target extends AbstractType<infer D, any> ? import("../internals.js").ToDeepEventDelta<D> : delta.Delta<any, any, any, any, any>) | null;
38
+ /**
39
+ * @type {Array<string|number>|null}
40
+ */
41
+ _path: Array<string | number> | null;
42
+ /**
43
+ * Whether the children changed.
44
+ * @type {Boolean}
45
+ * @private
46
+ */
47
+ private childListChanged;
48
+ /**
49
+ * Set of all changed attributes.
50
+ * @type {Set<string>}
51
+ */
52
+ keysChanged: Set<string>;
53
+ /**
54
+ * Computes the path from `y` to the changed type.
55
+ *
56
+ * @todo v14 should standardize on path: Array<{parent, index}> because that is easier to work with.
57
+ *
58
+ * The following property holds:
59
+ * @example
60
+ * let type = y
61
+ * event.path.forEach(dir => {
62
+ * type = type.get(dir)
63
+ * })
64
+ * type === event.target // => true
65
+ */
66
+ get path(): (string | number)[];
67
+ /**
68
+ * Check if a struct is deleted by this event.
69
+ *
70
+ * In contrast to change.deleted, this method also returns true if the struct was added and then deleted.
71
+ *
72
+ * @param {AbstractStruct} struct
73
+ * @return {boolean}
74
+ */
75
+ deletes(struct: AbstractStruct): boolean;
76
+ /**
77
+ * Check if a struct is added by this event.
78
+ *
79
+ * In contrast to change.deleted, this method also returns true if the struct was added and then deleted.
80
+ *
81
+ * @param {AbstractStruct} struct
82
+ * @return {boolean}
83
+ */
84
+ adds(struct: AbstractStruct): boolean;
85
+ /**
86
+ * @template {boolean} [Deep=false]
87
+ * @param {AbstractAttributionManager} am
88
+ * @param {object} [opts]
89
+ * @param {Deep} [opts.deep]
90
+ * @return {Target extends AbstractType<infer D,any> ? (Deep extends true ? import('../internals.js').ToDeepEventDelta<D> : D) : delta.Delta<any,any,any,any>} The Delta representation of this type.
91
+ *
92
+ * @public
93
+ */
94
+ public getDelta<Deep extends boolean = false>(am?: AbstractAttributionManager, { deep }?: {
95
+ deep?: Deep | undefined;
96
+ }): Target extends AbstractType<infer D, any> ? (Deep extends true ? import("../internals.js").ToDeepEventDelta<D> : D) : delta.Delta<any, any, any, any>;
97
+ /**
98
+ * Compute the changes in the delta format.
99
+ * A {@link https://quilljs.com/docs/delta/|Quill Delta}) that represents the changes on the document.
100
+ *
101
+ * @type {Target extends AbstractType<infer D,any> ? D : delta.Delta<any,any,any,any,any>} The Delta representation of this type.
102
+ * @public
103
+ */
104
+ public get delta(): Target extends AbstractType<infer D, any> ? D : delta.Delta<any, any, any, any, any>;
105
+ /**
106
+ * Compute the changes in the delta format.
107
+ * A {@link https://quilljs.com/docs/delta/|Quill Delta}) that represents the changes on the document.
108
+ *
109
+ * @type {Target extends AbstractType<infer D,any> ? D : delta.Delta<any,any,any,any,any>} The Delta representation of this type.
110
+ * @public
111
+ */
112
+ public get deltaDeep(): Target extends AbstractType<infer D, any> ? D : delta.Delta<any, any, any, any, any>;
113
+ }
114
+ export type _YType = import("./types.js").YType;
115
+ import { AbstractType } from '../internals.js';
116
+ import { Transaction } from '../internals.js';
117
+ import * as delta from 'lib0/delta';
118
+ import { AbstractStruct } from '../internals.js';
119
+ import { AbstractAttributionManager } from '../internals.js';
120
+ //# sourceMappingURL=YEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YEvent.d.ts","sourceRoot":"","sources":["../../../src/utils/YEvent.js"],"names":[],"mappings":"AAWA;;GAEG;AAEH;;;GAGG;AACH,oBAHqC,MAAM,SAA7B,YAAY,CAAC,GAAG,EAAC,GAAG,CAAE;IAIlC;;;;OAIG;IACH,oBAJW,MAAM,eACN,WAAW,QACX,GAAG,CAAC,GAAG,CAAC,OAAC,EAgDnB;IA7CC;;;OAGG;IACH,QAFU,MAAM,CAEI;IACpB;;;OAGG;IACH,eAFU,MAAM,CAEW;IAC3B;;;OAGG;IACH,aAFU,WAAW,CAES;IAC9B;;OAEG;IACH,QAFU,CAAC,MAAM,SAAS,YAAY,CAAC,MAAM,CAAC,EAAC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,CAAC,CAAC,GAAC,IAAI,CAE9E;IAClB;;OAEG;IACH,YAFU,CAAC,MAAM,SAAS,YAAY,CAAC,MAAM,CAAC,EAAC,GAAG,CAAC,GAAG,OAAO,iBAAiB,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,CAAC,CAAC,GAAC,IAAI,CAEtH;IACtB;;OAEG;IACH,OAFU,KAAK,CAAC,MA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BuilderAny;
4
+ import { Doc } from '../internals.js';
5
+ import * as delta from 'lib0/delta';
6
+ //# sourceMappingURL=delta-helpers.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,30 @@
1
+ export function writeClientsStructs(encoder: UpdateEncoderV1 | UpdateEncoderV2, store: StructStore, _sm: Map<number, number>): 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 readUpdateV2(decoder: decoding.Decoder, ydoc: Doc, transactionOrigin?: any, structDecoder?: UpdateDecoderV1 | UpdateDecoderV2): void;
5
+ export function readUpdate(decoder: decoding.Decoder, ydoc: Doc, transactionOrigin?: any): void;
6
+ export function applyUpdateV2(ydoc: Doc, update: Uint8Array, transactionOrigin?: any, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2): void;
7
+ export function applyUpdate(ydoc: Doc, update: Uint8Array, transactionOrigin?: any): void;
8
+ export function writeStateAsUpdate(encoder: UpdateEncoderV1 | UpdateEncoderV2, doc: Doc, targetStateVector?: Map<number, number>): void;
9
+ export function encodeStateAsUpdateV2(doc: Doc, encodedTargetStateVector?: Uint8Array, encoder?: UpdateEncoderV1 | UpdateEncoderV2): Uint8Array<ArrayBuffer>;
10
+ export function encodeStateAsUpdate(doc: Doc, encodedTargetStateVector?: Uint8Array): Uint8Array<ArrayBuffer>;
11
+ export function readStateVector(decoder: DSDecoderV1 | DSDecoderV2): Map<number, number>;
12
+ export function decodeStateVector(decodedState: Uint8Array): Map<number, number>;
13
+ export function writeStateVector(encoder: IdSetEncoderV1 | IdSetEncoderV2, sv: Map<number, number>): IdSetEncoderV1 | IdSetEncoderV2;
14
+ export function writeDocumentStateVector(encoder: IdSetEncoderV1 | IdSetEncoderV2, doc: Doc): IdSetEncoderV1 | IdSetEncoderV2;
15
+ export function encodeStateVectorV2(doc: Doc | Map<number, number>, encoder?: IdSetEncoderV1 | IdSetEncoderV2): Uint8Array;
16
+ export function encodeStateVector(doc: Doc | Map<number, number>): Uint8Array;
17
+ import { UpdateEncoderV1 } from '../internals.js';
18
+ import { UpdateEncoderV2 } from '../internals.js';
19
+ import { StructStore } from '../internals.js';
20
+ import { IdSet } from '../internals.js';
21
+ import { Transaction } from '../internals.js';
22
+ import * as decoding from 'lib0/decoding';
23
+ import { Doc } from '../internals.js';
24
+ import { UpdateDecoderV1 } from '../internals.js';
25
+ import { UpdateDecoderV2 } from '../internals.js';
26
+ import { DSDecoderV1 } from '../internals.js';
27
+ import { DSDecoderV2 } from '../internals.js';
28
+ import { IdSetEncoderV1 } from '../internals.js';
29
+ import { IdSetEncoderV2 } from '../internals.js';
30
+ //# sourceMappingURL=encoding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../../src/utils/encoding.js"],"names":[],"mappings":"AAkHO,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,GAAG,OAAO,eAAe,QAOzD;AAaM,kCANI,GAAG,UACH,UAAU,sBACV,GAAG,QAIiH;AAYxH,4CANI,eAAe,GAAG,eAAe,OACjC,GAAG,sBACH,GAAG,CAAC,MAAM,EAAC,MAAM,CAAC,QAO5B;AAeM,2CAPI,GAAG,6BACH,UAAU,YACV,eAAe,GAAG,eAAe,GAChC,UAAU,CAAC,WAAW,CAAC,CAuBlC;AAcM,yCANI,GAAG,6BACH,UAAU,GACT,UAAU,CAAC,WAAW,CAAC,CAI8G;AAU1I,yCALI,WAAW,GAAG,WAAW,GACxB,GAAG,CAAC,MAAM,EAAC,MAAM,CAAC,CAa7B;AAoBM,gDALI,UAAU,GACT,GAAG,CAAC,MAAM,EAAC,MAAM,CAAC,CAIyF;AAOhH,0CAJI,cAAc,GAAG,cAAc,MAC/B,GAAG,CAAC,MAAM,EAAC,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,CAWrB;AAUM,uCALI,GAAG,GAAC,GAAG,CAAC,MAAM,EAAC,MAAM,CAAC,GACrB,UAAU,CAIgE;gCArkB/E,iBAAiB;gCAAjB,iBAAiB;4BAAjB,iBAAiB;sBAAjB,iBAAiB;4BAAjB,iBAAiB;0BAGE,eAAe;oBAHlC,iBAAiB;gCAAjB,iBAAiB;gCAAjB,iBAAiB;4BAAjB,iBAAiB;4BAAjB,iBAAiB;+BAAjB,iBAAiB;+BAAjB,iBAAiB"}
@@ -0,0 +1,3 @@
1
+ export function isParentOf(parent: import("../utils/types.js").YType, child: Item | null): boolean;
2
+ import { Item } from '../internals.js';
3
+ //# sourceMappingURL=isParentOf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isParentOf.d.ts","sourceRoot":"","sources":["../../../src/utils/isParentOf.js"],"names":[],"mappings":"AAYO,mCAPI,OAAO,mBAAmB,EAAE,KAAK,SACjC,IAAI,GAAC,IAAI,WAcnB;qBApBkC,iBAAiB"}
@@ -0,0 +1,3 @@
1
+ export function logType(type: AbstractType<any>): void;
2
+ import { AbstractType } from '../internals.js';
3
+ //# sourceMappingURL=logging.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../src/utils/logging.js"],"names":[],"mappings":"AAWO,8BAFI,YAAY,CAAC,GAAG,CAAC,QAW3B;6BAlBM,iBAAiB"}
@@ -0,0 +1,7 @@
1
+ export type YValueType = import("../types/YArray.js").YArray<any> | import("../types/YMap.js").YMap<any> | import("../types/YText.js").YText<any> | import("../types/YXmlFragment.js").YXmlFragment<any, any> | import("../types/YXmlElement.js").YXmlElement<any, any> | import("../types/YXmlHook.js").YXmlHook | import("../types/YXmlText.js").YXmlText;
2
+ export type YValue = {
3
+ [x: string]: any;
4
+ } | Array<any> | number | null | string | Uint8Array | bigint | YValueType;
5
+ export type YType = import("../types/AbstractType.js").AbstractType<any, any>;
6
+ export type YTypeConstructors = typeof import("../types/YArray.js").YArray<any> | typeof import("../types/YMap.js").YMap<any> | typeof import("../types/YText.js").YText<any> | typeof import("../types/YXmlFragment.js").YXmlFragment<any, any> | typeof import("../types/YXmlElement.js").YXmlElement<any, any> | typeof import("../types/YXmlHook.js").YXmlHook | typeof import("../types/YXmlText.js").YXmlText | typeof import("../types/AbstractType.js").AbstractType;
7
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/types.js"],"names":[],"mappings":"yBACa,OAAO,oBAAoB,EAAE,MAAM,CAAC,GAAG,CAAC,GAC9C,OAAO,kBAAkB,EAAE,IAAI,CAAC,GAAG,CAAC,GACpC,OAAO,mBAAmB,EAAE,KAAK,CAAC,GAAG,CAAC,GACtC,OAAO,0BAA0B,EAAE,YAAY,CAAC,GAAG,EAAC,GAAG,CAAC,GACxD,OAAO,yBAAyB,EAAE,WAAW,CAAC,GAAG,EAAC,GAAG,CAAC,GACtD,OAAO,sBAAsB,EAAE,QAAQ,GACvC,OAAO,sBAAsB,EAAE,QAAQ;qBAIjC;QAAO,MAAM,GAAC,GAAG;CAAC,GAAC,KAAK,CAAC,GAAG,CAAC,GAAC,MAAM,GAAC,IAAI,GAAC,MAAM,GAAC,UAAU,YAAQ,UAAU;oBAI7E,OAAO,0BAA0B,EAAE,YAAY,CAAC,GAAG,EAAC,GAAG,CAAC;gCAIxD,cAAc,oBAAoB,EAAE,MAAM,CAAC,GAAG,CAAC,GACrD,cAAc,kBAAkB,EAAE,IAAI,CAAC,GAAG,CAAC,GAC3C,cAAc,mBAAmB,EAAE,KAAK,CAAC,GAAG,CAAC,GAC7C,cAAc,0BAA0B,EAAE,YAAY,CAAC,GAAG,EAAC,GAAG,CAAC,GAC/D,cAAc,yBAAyB,EAAE,WAAW,CAAC,GAAG,EAAC,GAAG,CAAC,GAC7D,cAAc,sBAAsB,EAAE,QAAQ,GAC9C,cAAc,sBAAsB,EAAE,QAAQ,GAC9C,cAAc,0BAA0B,EAAE,YAAY"}
@@ -0,0 +1,89 @@
1
+ export class LazyStructReader {
2
+ /**
3
+ * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder
4
+ * @param {boolean} filterSkips
5
+ */
6
+ constructor(decoder: UpdateDecoderV1 | UpdateDecoderV2, filterSkips: boolean);
7
+ gen: Generator<GC | Item | Skip, void, unknown>;
8
+ /**
9
+ * @type {null | Item | Skip | GC}
10
+ */
11
+ curr: null | Item | Skip | GC;
12
+ done: boolean;
13
+ filterSkips: boolean;
14
+ /**
15
+ * @return {Item | GC | Skip |null}
16
+ */
17
+ next(): Item | GC | Skip | null;
18
+ }
19
+ export function logUpdate(update: Uint8Array): void;
20
+ export function logUpdateV2(update: Uint8Array, YDecoder?: typeof UpdateDecoderV2 | typeof UpdateDecoderV1): void;
21
+ export function decodeUpdate(update: Uint8Array): {
22
+ structs: (GC | Item | Skip)[];
23
+ ds: import("./IdSet.js").IdSet;
24
+ };
25
+ export function decodeUpdateV2(update: Uint8Array, YDecoder?: typeof UpdateDecoderV2 | typeof UpdateDecoderV1): {
26
+ structs: (GC | Item | Skip)[];
27
+ ds: import("./IdSet.js").IdSet;
28
+ };
29
+ export class LazyStructWriter {
30
+ /**
31
+ * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
32
+ */
33
+ constructor(encoder: UpdateEncoderV1 | UpdateEncoderV2);
34
+ currClient: number;
35
+ startClock: number;
36
+ written: number;
37
+ encoder: UpdateEncoderV2 | UpdateEncoderV1;
38
+ /**
39
+ * We want to write operations lazily, but also we need to know beforehand how many operations we want to write for each client.
40
+ *
41
+ * This kind of meta-information (#clients, #structs-per-client-written) is written to the restEncoder.
42
+ *
43
+ * We fragment the restEncoder and store a slice of it per-client until we know how many clients there are.
44
+ * When we flush (toUint8Array) we write the restEncoder using the fragments and the meta-information.
45
+ *
46
+ * @type {Array<{ written: number, restEncoder: Uint8Array }>}
47
+ */
48
+ clientStructs: Array<{
49
+ written: number;
50
+ restEncoder: Uint8Array;
51
+ }>;
52
+ }
53
+ export function mergeUpdates(updates: Array<Uint8Array<ArrayBuffer>>): Uint8Array<ArrayBuffer>;
54
+ export function encodeStateVectorFromUpdateV2(update: Uint8Array, YEncoder?: typeof IdSetEncoderV1 | typeof IdSetEncoderV2, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2): Uint8Array;
55
+ export function encodeStateVectorFromUpdate(update: Uint8Array): Uint8Array;
56
+ export function readUpdateIdRangesV2(update: Uint8Array, YDecoder?: typeof UpdateDecoderV2 | typeof UpdateDecoderV1): {
57
+ inserts: import("./IdSet.js").IdSet;
58
+ deletes: import("./IdSet.js").IdSet;
59
+ };
60
+ export function readUpdateIdRanges(update: Uint8Array): {
61
+ inserts: import("./IdSet.js").IdSet;
62
+ deletes: import("./IdSet.js").IdSet;
63
+ };
64
+ export function mergeUpdatesV2(updates: Array<Uint8Array<ArrayBuffer>>, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2, YEncoder?: typeof UpdateEncoderV1 | typeof UpdateEncoderV2): Uint8Array<ArrayBuffer>;
65
+ export function diffUpdateV2(update: Uint8Array, sv: Uint8Array, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2, YEncoder?: typeof UpdateEncoderV1 | typeof UpdateEncoderV2): Uint8Array<ArrayBuffer>;
66
+ export function diffUpdate(update: Uint8Array, sv: Uint8Array): Uint8Array<ArrayBuffer>;
67
+ export function convertUpdateFormat(update: Uint8Array, blockTransformer: (arg0: Item | GC | Skip) => Item | GC | Skip, YDecoder: typeof UpdateDecoderV2 | typeof UpdateDecoderV1, YEncoder: typeof UpdateEncoderV2 | typeof UpdateEncoderV1): Uint8Array<ArrayBuffer>;
68
+ export function obfuscateUpdate(update: Uint8Array, opts?: ObfuscatorOptions): Uint8Array<ArrayBuffer>;
69
+ export function obfuscateUpdateV2(update: Uint8Array, opts?: ObfuscatorOptions): Uint8Array<ArrayBuffer>;
70
+ export function convertUpdateFormatV1ToV2(update: Uint8Array): Uint8Array<ArrayBuffer>;
71
+ export function convertUpdateFormatV2ToV1(update: Uint8Array): Uint8Array<ArrayBuffer>;
72
+ export type ObfuscatorOptions = {
73
+ formatting?: boolean | undefined;
74
+ subdocs?: boolean | undefined;
75
+ /**
76
+ * Whether to obfuscate nodeName / hookName
77
+ */
78
+ yxml?: boolean | undefined;
79
+ };
80
+ import { GC } from '../internals.js';
81
+ import { Item } from '../internals.js';
82
+ import { Skip } from '../internals.js';
83
+ import { UpdateDecoderV1 } from '../internals.js';
84
+ import { UpdateDecoderV2 } from '../internals.js';
85
+ import { UpdateEncoderV2 } from '../internals.js';
86
+ import { UpdateEncoderV1 } from '../internals.js';
87
+ import { IdSetEncoderV1 } from '../internals.js';
88
+ import { IdSetEncoderV2 } from '../internals.js';
89
+ //# sourceMappingURL=updates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updates.d.ts","sourceRoot":"","sources":["../../../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