@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,161 @@
1
+ /**
2
+ * @todo rename this to `Attribute`
3
+ * @template V
4
+ */
5
+ export class AttributionItem<V> {
6
+ /**
7
+ * @param {string} name
8
+ * @param {V} val
9
+ */
10
+ constructor(name: string, val: V);
11
+ name: string;
12
+ val: V;
13
+ hash(): string;
14
+ }
15
+ export function createAttributionItem<V>(name: string, val: V): AttributionItem<V>;
16
+ export function idmapAttrsEqual<T_1>(a: Array<T_1>, b: Array<T_1>): boolean;
17
+ /**
18
+ * @template Attrs
19
+ */
20
+ export class AttrRange<Attrs> {
21
+ /**
22
+ * @param {number} clock
23
+ * @param {number} len
24
+ * @param {Array<AttributionItem<Attrs>>} attrs
25
+ */
26
+ constructor(clock: number, len: number, attrs: Array<AttributionItem<Attrs>>);
27
+ /**
28
+ * @readonly
29
+ */
30
+ readonly clock: number;
31
+ /**
32
+ * @readonly
33
+ */
34
+ readonly len: number;
35
+ /**
36
+ * @readonly
37
+ */
38
+ readonly attrs: AttributionItem<Attrs>[];
39
+ /**
40
+ * @param {number} clock
41
+ * @param {number} len
42
+ */
43
+ copyWith(clock: number, len: number): AttrRange<Attrs>;
44
+ }
45
+ export function createMaybeAttrRange<Attrs>(clock: number, len: number, attrs: Array<AttributionItem<Attrs>> | null): MaybeAttrRange<Attrs>;
46
+ /**
47
+ * Whenever this is instantiated, it must receive a fresh array of ops, not something copied.
48
+ *
49
+ * @template Attrs
50
+ */
51
+ export class AttrRanges<Attrs> {
52
+ /**
53
+ * @param {Array<AttrRange<Attrs>>} ids
54
+ */
55
+ constructor(ids: Array<AttrRange<Attrs>>);
56
+ sorted: boolean;
57
+ /**
58
+ * @private
59
+ */
60
+ private _ids;
61
+ copy(): AttrRanges<Attrs>;
62
+ /**
63
+ * @param {number} clock
64
+ * @param {number} length
65
+ * @param {Array<AttributionItem<Attrs>>} attrs
66
+ */
67
+ add(clock: number, length: number, attrs: Array<AttributionItem<Attrs>>): void;
68
+ /**
69
+ * Return the list of id ranges, sorted and merged.
70
+ */
71
+ getIds(): AttrRange<Attrs>[];
72
+ }
73
+ export function mergeIdMaps<T_1>(ams: Array<IdMap<T_1>>): IdMap<T_1>;
74
+ export function createIdMapFromIdSet(idset: IdSet, attrs: Array<AttributionItem<any>>): IdMap<any>;
75
+ /**
76
+ * @template Attrs
77
+ */
78
+ export class IdMap<Attrs> {
79
+ /**
80
+ * @type {Map<number,AttrRanges<Attrs>>}
81
+ */
82
+ clients: Map<number, AttrRanges<Attrs>>;
83
+ /**
84
+ * @type {Map<string, AttributionItem<Attrs>>}
85
+ */
86
+ attrsH: Map<string, AttributionItem<Attrs>>;
87
+ /**
88
+ * @type {Set<AttributionItem<Attrs>>}
89
+ */
90
+ attrs: Set<AttributionItem<Attrs>>;
91
+ /**
92
+ * @param {(attrRange:AttrRange<Attrs>, client:number) => void} f
93
+ */
94
+ forEach(f: (attrRange: AttrRange<Attrs>, client: number) => void): void;
95
+ /**
96
+ * @param {ID} id
97
+ * @return {boolean}
98
+ */
99
+ hasId(id: ID): boolean;
100
+ /**
101
+ * @param {number} client
102
+ * @param {number} clock
103
+ * @return {boolean}
104
+ */
105
+ has(client: number, clock: number): boolean;
106
+ /**
107
+ * Return attributions for a slice of ids.
108
+ *
109
+ * @param {ID} id
110
+ * @param {number} len
111
+ * @return {Array<MaybeAttrRange<Attrs>>}
112
+ */
113
+ sliceId(id: ID, len: number): Array<MaybeAttrRange<Attrs>>;
114
+ /**
115
+ * Return attributions for a slice of ids.
116
+ *
117
+ * @param {number} client
118
+ * @param {number} clock
119
+ * @param {number} len
120
+ * @return {Array<MaybeAttrRange<Attrs>>}
121
+ */
122
+ slice(client: number, clock: number, len: number): Array<MaybeAttrRange<Attrs>>;
123
+ /**
124
+ * @param {number} client
125
+ * @param {number} clock
126
+ * @param {number} len
127
+ * @param {Array<AttributionItem<Attrs>>} attrs
128
+ */
129
+ add(client: number, clock: number, len: number, attrs: Array<AttributionItem<Attrs>>): void;
130
+ /**
131
+ * @param {number} client
132
+ * @param {number} clock
133
+ * @param {number} len
134
+ */
135
+ delete(client: number, clock: number, len: number): void;
136
+ }
137
+ export function writeIdMap<Attr>(encoder: IdSetEncoderV1 | IdSetEncoderV2, idmap: IdMap<Attr>): void;
138
+ export function encodeIdMap(idmap: IdMap<any>): Uint8Array<ArrayBuffer>;
139
+ export function readIdMap(decoder: DSDecoderV1 | DSDecoderV2): IdMap<any>;
140
+ export function decodeIdMap(data: Uint8Array): IdMap<any>;
141
+ export function createIdMap(): IdMap<any>;
142
+ /**
143
+ * @template T
144
+ * @param {IdMap<T>} dest
145
+ * @param {IdMap<T>} src
146
+ */
147
+ export const insertIntoIdMap: <S extends IdSet | IdMap<any>>(dest: S, src: S) => void;
148
+ export function diffIdMap<ISet extends IdMap<any>>(set: ISet, exclude: IdSet | IdMap<any>): ISet;
149
+ export const 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;
150
+ export type MaybeAttrRange<Attrs> = {
151
+ clock: number;
152
+ len: number;
153
+ attrs: Array<AttributionItem<Attrs>> | null;
154
+ };
155
+ import { IdSet } from '../internals.js';
156
+ import { ID } from '../internals.js';
157
+ import { IdSetEncoderV1 } from '../internals.js';
158
+ import { IdSetEncoderV2 } from '../internals.js';
159
+ import { DSDecoderV1 } from '../internals.js';
160
+ import { DSDecoderV2 } from '../internals.js';
161
+ //# sourceMappingURL=IdMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IdMap.d.ts","sourceRoot":"","sources":["../../../src/utils/IdMap.js"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,6BAFa,CAAC;I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AG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,OAAC,CAAA;CAAE;sBA3G3E,iBAAiB;mBAAjB,iBAAiB;+BAAjB,iBAAiB;+BAAjB,iBAAiB;4BAAjB,iBAAiB;4BAAjB,iBAAiB"}
@@ -0,0 +1,163 @@
1
+ export class IdRange {
2
+ /**
3
+ * @param {number} clock
4
+ * @param {number} len
5
+ */
6
+ constructor(clock: number, len: number);
7
+ /**
8
+ * @type {number}
9
+ */
10
+ clock: number;
11
+ /**
12
+ * @type {number}
13
+ */
14
+ len: number;
15
+ /**
16
+ * @param {number} clock
17
+ * @param {number} len
18
+ */
19
+ copyWith(clock: number, len: number): IdRange;
20
+ /**
21
+ * Helper method making this compatible with IdMap.
22
+ *
23
+ * @return {Array<import('./IdMap.js').AttributionItem<any>>}
24
+ */
25
+ get attrs(): Array<import("./IdMap.js").AttributionItem<any>>;
26
+ }
27
+ export class MaybeIdRange {
28
+ /**
29
+ * @param {number} clock
30
+ * @param {number} len
31
+ * @param {boolean} exists
32
+ */
33
+ constructor(clock: number, len: number, exists: boolean);
34
+ /**
35
+ * @type {number}
36
+ */
37
+ clock: number;
38
+ /**
39
+ * @type {number}
40
+ */
41
+ len: number;
42
+ /**
43
+ * @type {boolean}
44
+ */
45
+ exists: boolean;
46
+ }
47
+ export function createMaybeIdRange(clock: number, len: number, exists: boolean): MaybeIdRange;
48
+ export class IdRanges {
49
+ /**
50
+ * @param {Array<IdRange>} ids
51
+ */
52
+ constructor(ids: Array<IdRange>);
53
+ sorted: boolean;
54
+ /**
55
+ * A typical use-case for IdSet is to append data. We heavily optimize this case by allowing the
56
+ * last item to be mutated ef it isn't used currently.
57
+ * This flag is true if the last item was exposed to the outside.
58
+ */
59
+ _lastIsUsed: boolean;
60
+ /**
61
+ * @private
62
+ */
63
+ private _ids;
64
+ copy(): IdRanges;
65
+ /**
66
+ * @param {number} clock
67
+ * @param {number} length
68
+ */
69
+ add(clock: number, length: number): void;
70
+ /**
71
+ * Return the list of immutable id ranges, sorted and merged.
72
+ */
73
+ getIds(): IdRange[];
74
+ }
75
+ /**
76
+ * @implements {traits.EqualityTrait}
77
+ */
78
+ export class IdSet implements traits.EqualityTrait {
79
+ /**
80
+ * @type {Map<number,IdRanges>}
81
+ */
82
+ clients: Map<number, IdRanges>;
83
+ isEmpty(): boolean;
84
+ /**
85
+ * @param {(idrange:IdRange, client:number) => void} f
86
+ */
87
+ forEach(f: (idrange: IdRange, client: number) => void): void;
88
+ /**
89
+ * @param {ID} id
90
+ * @return {boolean}
91
+ */
92
+ hasId(id: ID): boolean;
93
+ /**
94
+ * @param {number} client
95
+ * @param {number} clock
96
+ */
97
+ has(client: number, clock: number): boolean;
98
+ /**
99
+ * Return slices of ids that exist in this idset.
100
+ *
101
+ * @param {number} client
102
+ * @param {number} clock
103
+ * @param {number} len
104
+ * @return {Array<MaybeIdRange>}
105
+ */
106
+ slice(client: number, clock: number, len: number): Array<MaybeIdRange>;
107
+ /**
108
+ * @param {number} client
109
+ * @param {number} clock
110
+ * @param {number} len
111
+ */
112
+ add(client: number, clock: number, len: number): void;
113
+ /**
114
+ * @param {number} client
115
+ * @param {number} clock
116
+ * @param {number} len
117
+ */
118
+ delete(client: number, clock: number, len: number): void;
119
+ /**
120
+ * @param {any} other
121
+ */
122
+ [traits.EqualityTraitSymbol](other: any): boolean;
123
+ }
124
+ export function _deleteRangeFromIdSet(set: IdSet | IdMap<any>, client: number, clock: number, len: number): void;
125
+ export function iterateStructsByIdSet(transaction: Transaction, ds: IdSet, f: (arg0: GC | Item) => void): void;
126
+ export function findIndexInIdRanges(dis: Array<IdRange>, clock: number): number | null;
127
+ export function findRangeStartInIdRanges(dis: Array<IdRange>, clock: number): number | null;
128
+ export function mergeIdSets(idSets: Array<IdSet>): IdSet;
129
+ export function _insertIntoIdSet<S extends IdSet | IdMap<any>>(dest: S, src: S): void;
130
+ export function insertIntoIdSet<S extends IdSet | IdMap<any>>(dest: S, src: S): void;
131
+ export function _diffSet<Set extends IdSet | IdMap<any>>(set: Set, exclude: IdSet | IdMap<any>): Set;
132
+ /**
133
+ * Remove all ranges from `exclude` from `idSet`. The result is a fresh IdSet containing all ranges from `idSet` that are not
134
+ * in `exclude`.
135
+ *
136
+ * @type {(idSet: IdSet, exclude: IdSet|IdMap<any>) => IdSet}
137
+ */
138
+ export const diffIdSet: (idSet: IdSet, exclude: IdSet | IdMap<any>) => IdSet;
139
+ 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;
140
+ 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;
141
+ export function addToIdSet(idSet: IdSet, client: number, clock: number, length: number): void;
142
+ export function addStructToIdSet(idSet: IdSet, struct: AbstractStruct): void;
143
+ export function createIdSet(): IdSet;
144
+ export function createDeleteSetFromStructStore(ss: StructStore): IdSet;
145
+ export function _createInsertSliceFromStructs(structs: Array<GC | Item>, filterDeleted: boolean): IdRange[];
146
+ export function createInsertSetFromStructStore(ss: import("../internals.js").StructStore, filterDeleted: boolean): IdSet;
147
+ export function writeIdSet(encoder: IdSetEncoderV1 | IdSetEncoderV2, idSet: IdSet): void;
148
+ export function readIdSet(decoder: DSDecoderV1 | DSDecoderV2): IdSet;
149
+ export function readAndApplyDeleteSet(decoder: DSDecoderV1 | DSDecoderV2, transaction: Transaction, store: StructStore): Uint8Array<ArrayBuffer> | null;
150
+ export function equalIdSets(ds1: IdSet, ds2: IdSet): boolean;
151
+ import * as traits from 'lib0/traits';
152
+ import { ID } from '../internals.js';
153
+ import { IdMap } from '../internals.js';
154
+ import { Transaction } from '../internals.js';
155
+ import { GC } from '../internals.js';
156
+ import { Item } from '../internals.js';
157
+ import { AbstractStruct } from '../internals.js';
158
+ import { StructStore } from '../internals.js';
159
+ import { IdSetEncoderV1 } from '../internals.js';
160
+ import { IdSetEncoderV2 } from '../internals.js';
161
+ import { DSDecoderV1 } from '../internals.js';
162
+ import { DSDecoderV2 } from '../internals.js';
163
+ //# sourceMappingURL=IdSet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IdSet.d.ts","sourceRoot":"","sources":["../../../src/utils/IdSet.js"],"names":[],"mappings":"AAkBA;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,OAAO,YAAY,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,CAI3D;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,iBAEC;IAED;;;OAGG;IACH,WAHW,MAAM,UACN,MAAM,QAehB;IAED;;OAEG;IACH,oBA+BC;CACF;AAED;;GAEG;AACH,8BAFgB,MAAM,CAAC,aAAa;IAIhC;;OAEG;IACH,SAFU,GAAG,CAAC,MAAM,EAAC,QAAQ,CAAC,CAEN;IAG1B,mBAEC;IAED;;OAEG;IACH,WAFW,CAAC,OAAO,EAAC,OAAO,EAA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B;sBAAjB,iBAAiB;4BAAjB,iBAAiB;mBAAjB,iBAAiB;qBAAjB,iBAAiB;+BAAjB,iBAAiB;4BAAjB,iBAAiB;+BAAjB,iBAAiB;+BAAjB,iBAAiB;4BAAjB,iBAAiB;4BAAjB,iBAAiB"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * A relative position is based on the Yjs model and is not affected by document changes.
3
+ * E.g. If you place a relative position before a certain character, it will always point to this character.
4
+ * If you place a relative position at the end of a type, it will always point to the end of the type.
5
+ *
6
+ * A numeric position is often unsuited for user selections, because it does not change when content is inserted
7
+ * before or after.
8
+ *
9
+ * ```Insert(0, 'x')('a|bc') = 'xa|bc'``` Where | is the relative position.
10
+ *
11
+ * One of the properties must be defined.
12
+ *
13
+ * @example
14
+ * // Current cursor position is at position 10
15
+ * const relativePosition = createRelativePositionFromIndex(yText, 10)
16
+ * // modify yText
17
+ * yText.insert(0, 'abc')
18
+ * yText.delete(3, 10)
19
+ * // Compute the cursor position
20
+ * const absolutePosition = createAbsolutePositionFromRelativePosition(y, relativePosition)
21
+ * absolutePosition.type === yText // => true
22
+ * console.log('cursor location is ' + absolutePosition.index) // => cursor location is 3
23
+ *
24
+ */
25
+ export class RelativePosition {
26
+ /**
27
+ * @param {ID|null} type
28
+ * @param {string|null} tname
29
+ * @param {ID|null} item
30
+ * @param {number} assoc
31
+ */
32
+ constructor(type: ID | null, tname: string | null, item: ID | null, assoc?: number);
33
+ /**
34
+ * @type {ID|null}
35
+ */
36
+ type: ID | null;
37
+ /**
38
+ * @type {string|null}
39
+ */
40
+ tname: string | null;
41
+ /**
42
+ * @type {ID | null}
43
+ */
44
+ item: ID | null;
45
+ /**
46
+ * A relative position is associated to a specific character. By default
47
+ * assoc >= 0, the relative position is associated to the character
48
+ * after the meant position.
49
+ * I.e. position 1 in 'ab' is associated to character 'b'.
50
+ *
51
+ * If assoc < 0, then the relative position is associated to the character
52
+ * before the meant position.
53
+ *
54
+ * @type {number}
55
+ */
56
+ assoc: number;
57
+ }
58
+ export function relativePositionToJSON(rpos: RelativePosition): any;
59
+ export function createRelativePositionFromJSON(json: any): RelativePosition;
60
+ export class AbsolutePosition {
61
+ /**
62
+ * @param {AbstractType<any>} type
63
+ * @param {number} index
64
+ * @param {number} [assoc]
65
+ */
66
+ constructor(type: AbstractType<any>, index: number, assoc?: number);
67
+ /**
68
+ * @type {AbstractType<any>}
69
+ */
70
+ type: AbstractType<any>;
71
+ /**
72
+ * @type {number}
73
+ */
74
+ index: number;
75
+ assoc: number;
76
+ }
77
+ export function createAbsolutePosition(type: AbstractType<any>, index: number, assoc?: number): AbsolutePosition;
78
+ export function createRelativePosition(type: AbstractType<any>, item: ID | null, assoc?: number): RelativePosition;
79
+ export function createRelativePositionFromTypeIndex(type: AbstractType, index: number, assoc?: number, attributionManager?: import("../utils/AttributionManager.js").AbstractAttributionManager): RelativePosition;
80
+ export function writeRelativePosition(encoder: encoding.Encoder, rpos: RelativePosition): encoding.Encoder;
81
+ export function encodeRelativePosition(rpos: RelativePosition): Uint8Array;
82
+ export function readRelativePosition(decoder: decoding.Decoder): RelativePosition;
83
+ export function decodeRelativePosition(uint8Array: Uint8Array): RelativePosition;
84
+ export function createAbsolutePositionFromRelativePosition(rpos: RelativePosition, doc: Doc, followUndoneDeletions?: boolean, attributionManager?: import("../utils/AttributionManager.js").AbstractAttributionManager): AbsolutePosition | null;
85
+ export function compareRelativePositions(a: RelativePosition | null, b: RelativePosition | null): boolean;
86
+ import { ID } from '../internals.js';
87
+ import { AbstractType } from '../internals.js';
88
+ import * as encoding from 'lib0/encoding';
89
+ import * as decoding from 'lib0/decoding';
90
+ import { Doc } from '../internals.js';
91
+ //# sourceMappingURL=RelativePosition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RelativePosition.d.ts","sourceRoot":"","sources":["../../../src/utils/RelativePosition.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IACE;;;;;OAKG;IACH,kBALW,EAAE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oBAHlC,iBAAiB"}
@@ -0,0 +1,40 @@
1
+ export class Snapshot {
2
+ /**
3
+ * @param {IdSet} ds
4
+ * @param {Map<number,number>} sv state map
5
+ */
6
+ constructor(ds: IdSet, sv: Map<number, number>);
7
+ /**
8
+ * @type {IdSet}
9
+ */
10
+ ds: IdSet;
11
+ /**
12
+ * State Map
13
+ * @type {Map<number,number>}
14
+ */
15
+ sv: Map<number, number>;
16
+ }
17
+ export function equalSnapshots(snap1: Snapshot, snap2: Snapshot): boolean;
18
+ export function encodeSnapshotV2(snapshot: Snapshot, encoder?: IdSetEncoderV1 | IdSetEncoderV2): Uint8Array;
19
+ export function encodeSnapshot(snapshot: Snapshot): Uint8Array;
20
+ export function decodeSnapshotV2(buf: Uint8Array, decoder?: DSDecoderV1 | DSDecoderV2): Snapshot;
21
+ export function decodeSnapshot(buf: Uint8Array): Snapshot;
22
+ export function createSnapshot(ds: IdSet, sm: Map<number, number>): Snapshot;
23
+ export const emptySnapshot: Snapshot;
24
+ export function snapshot(doc: Doc): Snapshot;
25
+ export function isVisible(item: Item, snapshot: Snapshot | undefined): boolean;
26
+ export function splitSnapshotAffectedStructs(transaction: Transaction, snapshot: Snapshot): void;
27
+ export function createDocFromSnapshot(originDoc: Doc, snapshot: Snapshot, newDoc?: Doc): Doc;
28
+ export function snapshotContainsUpdateV2(snapshot: Snapshot, update: Uint8Array, YDecoder?: typeof UpdateDecoderV2 | typeof UpdateDecoderV1): boolean;
29
+ export function snapshotContainsUpdate(snapshot: Snapshot, update: Uint8Array): boolean;
30
+ import { IdSet } from '../internals.js';
31
+ import { IdSetEncoderV1 } from '../internals.js';
32
+ import { IdSetEncoderV2 } from '../internals.js';
33
+ import { DSDecoderV1 } from '../internals.js';
34
+ import { DSDecoderV2 } from '../internals.js';
35
+ import { Doc } from '../internals.js';
36
+ import { Item } from '../internals.js';
37
+ import { Transaction } from '../internals.js';
38
+ import { UpdateDecoderV2 } from '../internals.js';
39
+ import { UpdateDecoderV1 } from '../internals.js';
40
+ //# sourceMappingURL=Snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Snapshot.d.ts","sourceRoot":"","sources":["../../../src/utils/Snapshot.js"],"names":[],"mappings":"AA0BA;IACE;;;OAGG;IACH,gBAHW,KAAK,MACL,GAAG,CAAC,MAAM,EAAC,MAAM,CAAC,EAY5B;IATC;;OAEG;IACH,IAFU,KAAK,CAEH;IACZ;;;OAGG;IACH,IAFU,GAAG,CAAC,MAAM,EAAC,MAAM,CAAC,CAEhB;CAEf;AAOM,sCAJI,QAAQ,SACR,QAAQ,GACP,OAAO,CAclB;AAOM,2CAJI,QAAQ,YACR,cAAc,GAAG,cAAc,GAC9B,UAAU,CAMrB;AAMM,yCAHI,QAAQ,GACP,UAAU,CAEoE;AAOnF,sCAJI,UAAU,YACV,WAAW,GAAG,WAAW,GACxB,QAAQ,CAInB;AAMM,oCAHI,UAAU,GACT,QAAQ,CAEoF;AAOjG,mCAJI,KAAK,MACL,GAAG,CAAC,MAAM,EAAC,MAAM,CAAC,GACjB,QAAQ,CAE0C;AAE9D,qCAAqE;AAM9D,8BAHI,GAAG,GACF,QAAQ,CAE+F;AAS5G,gCANI,IAAI,YACJ,QAAQ,GAAC,SAAS,WAO+F;AAMrH,0DAHI,WAAW,YACX,QAAQ,QAelB;AAgBM,iDALI,GAAG,YACH,QAAQ,WACR,GAAG,GACF,GAAG,CA0Cd;AAOM,mDAJI,QAAQ,UACR,UAAU,aACV,OAAO,eAAe,GAAG,OAAO,eAAe,WAczD;AAMM,iDAHI,QAAQ,UACR,UAAU,WAEkG;sBAxMhH,iBAAiB;+BAAjB,iBAAiB;+BAAjB,iBAAiB;4BAAjB,iBAAiB;4BAAjB,iBAAiB;oBAAjB,iBAAiB;qBAAjB,iBAAiB;4BAAjB,iBAAiB;gCAAjB,iBAAiB;gCAAjB,iBAAiB"}
@@ -0,0 +1,27 @@
1
+ export function readStructSet(decoder: UpdateDecoderV1 | UpdateDecoderV2, doc: Doc): StructSet;
2
+ export function removeRangesFromStructSet(ss: StructSet, exclude: IdSet): void;
3
+ export class StructSet {
4
+ /**
5
+ * @type {Map<number, StructRange>}
6
+ */
7
+ clients: Map<number, StructRange>;
8
+ }
9
+ import { UpdateDecoderV1 } from '../internals.js';
10
+ import { UpdateDecoderV2 } from '../internals.js';
11
+ import { Doc } from '../internals.js';
12
+ import { IdSet } from '../internals.js';
13
+ declare class StructRange {
14
+ /**
15
+ * @param {Array<Item|GC>} refs
16
+ */
17
+ constructor(refs: Array<Item | GC>);
18
+ i: number;
19
+ /**
20
+ * @type {Array<Item | GC>}
21
+ */
22
+ refs: Array<Item | GC>;
23
+ }
24
+ import { Item } from '../internals.js';
25
+ import { GC } from '../internals.js';
26
+ export {};
27
+ //# sourceMappingURL=StructSet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StructSet.d.ts","sourceRoot":"","sources":["../../../src/utils/StructSet.js"],"names":[],"mappings":"AAoBO,uCAPI,eAAe,GAAG,eAAe,OACjC,GAAG,GACF,SAAS,CA6DpB;AAQM,8CAHI,SAAS,WACT,KAAK,QAgCf;AAeD;IAEI;;OAEG;IACH,SAFU,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAEP;CAE9B;gCAlIM,iBAAiB;gCAAjB,iBAAiB;oBAAjB,iBAAiB;sBAAjB,iBAAiB;AA8GxB;IACE;;OAEG;IACH,kBAFW,KAAK,CAAC,IAAI,GAAC,EAAE,CAAC,EAQxB;IALC,UAAU;IACV;;OAEG;IACH,MAFU,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,CAEV;CAEnB;qBAzHM,iBAAiB;mBAAjB,iBAAiB"}
@@ -0,0 +1,41 @@
1
+ export class StructStore {
2
+ /**
3
+ * @type {Map<number,Array<GC|Item>>}
4
+ */
5
+ clients: Map<number, Array<GC | Item>>;
6
+ /**
7
+ * @type {null | { missing: Map<number, number>, update: Uint8Array<ArrayBuffer> }}
8
+ */
9
+ pendingStructs: null | {
10
+ missing: Map<number, number>;
11
+ update: Uint8Array<ArrayBuffer>;
12
+ };
13
+ /**
14
+ * @type {null | Uint8Array<ArrayBuffer>}
15
+ */
16
+ pendingDs: null | Uint8Array<ArrayBuffer>;
17
+ skips: import("./IdSet.js").IdSet;
18
+ get ds(): import("./IdSet.js").IdSet;
19
+ }
20
+ export function getStateVector(store: StructStore): Map<number, number>;
21
+ export function getState(store: StructStore, client: number): number;
22
+ export function integrityCheck(store: StructStore): void;
23
+ export function addStruct(store: StructStore, struct: GC | Item): void;
24
+ export function findIndexSS(structs: Array<Item | GC>, clock: number): number;
25
+ export function find(store: StructStore, id: ID): GC | Item;
26
+ /**
27
+ * Expects that id is actually in store. This function throws or is an infinite loop otherwise.
28
+ * @private
29
+ * @function
30
+ */
31
+ export const getItem: (arg0: StructStore, arg1: ID) => Item;
32
+ export function findIndexCleanStart(transaction: Transaction | null, structs: Array<Item | GC>, clock: number): number;
33
+ export function getItemCleanStart(transaction: Transaction, id: ID): Item;
34
+ export function getItemCleanEnd(transaction: Transaction, store: StructStore, id: ID): Item;
35
+ export function replaceStruct(tr: Transaction, struct: GC | Item, newStruct: GC | Item): void;
36
+ export function iterateStructs(transaction: Transaction, structs: Array<Item | GC>, clockStart: number, len: number, f: (arg0: GC | Item) => void): void;
37
+ import { GC } from '../internals.js';
38
+ import { Item } from '../internals.js';
39
+ import { ID } from '../internals.js';
40
+ import { Transaction } from '../internals.js';
41
+ //# sourceMappingURL=StructStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StructStore.d.ts","sourceRoot":"","sources":["../../../src/utils/StructStore.js"],"names":[],"mappings":"AAcA;IAEI;;OAEG;IACH,SAFU,GAAG,CAAC,MAAM,EAAC,KAAK,CAAC,EAAE,GAAC,IAAI,CAAC,CAAC,CAEZ;IAExB;;OAEG;IACH,gBAFU,IAAI,GAAG;QAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,MAAM,EAAE,UAAU,CAAC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