@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,13 +1,8 @@
1
- import {
2
- AbstractStruct,
3
- addStruct,
4
- addToIdSet,
5
- UpdateEncoderV1, UpdateEncoderV2, StructStore, Transaction, // eslint-disable-line
6
- createID
7
- } from '../internals.js'
8
-
9
1
  import * as encoding from 'lib0/encoding'
10
2
 
3
+ import { AbstractStruct } from './AbstractStruct.js'
4
+ import { createID } from '../utils/ID.js'
5
+
11
6
  export const structSkipRefNumber = 10
12
7
 
13
8
  /**
@@ -41,8 +36,9 @@ export class Skip extends AbstractStruct {
41
36
  this.id.clock += offset
42
37
  this.length -= offset
43
38
  }
44
- addToIdSet(transaction.doc.store.skips, this.id.client, this.id.clock, this.length)
45
- addStruct(transaction.doc.store, this)
39
+ const store = transaction.doc.store
40
+ store.skips.add(this.id.client, this.id.clock, this.length)
41
+ store.add(this)
46
42
  }
47
43
 
48
44
  /**
@@ -55,15 +51,6 @@ export class Skip extends AbstractStruct {
55
51
  encoding.writeVarUint(encoder.restEncoder, this.length - offset)
56
52
  }
57
53
 
58
- /**
59
- * @param {Transaction} _transaction
60
- * @param {StructStore} _store
61
- * @return {null | number}
62
- */
63
- getMissing (_transaction, _store) {
64
- return null
65
- }
66
-
67
54
  /**
68
55
  * @param {number} diff
69
56
  */
@@ -73,3 +60,13 @@ export class Skip extends AbstractStruct {
73
60
  return other
74
61
  }
75
62
  }
63
+
64
+ /**
65
+ * @type {10}
66
+ */
67
+ Skip.prototype.ref = structSkipRefNumber
68
+
69
+ /**
70
+ * @type {false}
71
+ */
72
+ Skip.prototype.isItem = false
@@ -1,15 +1,3 @@
1
- import {
2
- createID,
3
- readItemContent,
4
- findIndexCleanStart,
5
- Skip,
6
- createIdSet,
7
- sliceStruct,
8
- IdRange,
9
- GC, Item, ID,
10
- writeStructs
11
- } from '../internals.js'
12
-
13
1
  import * as decoding from 'lib0/decoding'
14
2
  import * as binary from 'lib0/binary'
15
3
  import * as map from 'lib0/map'
@@ -18,6 +6,16 @@ import * as math from 'lib0/math'
18
6
  import * as encoding from 'lib0/encoding'
19
7
  import * as number from 'lib0/number'
20
8
 
9
+ import { createID, ID } from './ID.js'
10
+ import { Item } from '../structs/Item.js'
11
+ import { readItemContent } from '../ytype.js'
12
+ import { findIndexCleanStart } from './transaction-helpers.js'
13
+ import { Skip } from '../structs/Skip.js'
14
+ import { createIdSet, IdRange } from './ids.js'
15
+ import { sliceStruct } from './updates.js'
16
+ import { GC } from '../structs/GC.js'
17
+ import { writeStructs } from './encoding-helpers.js'
18
+
21
19
  /**
22
20
  * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder The decoder object to read data from.
23
21
  * @return {BlockSet}
@@ -31,7 +29,7 @@ export const readBlockSet = (decoder) => {
31
29
  for (let i = 0; i < numOfStateUpdates; i++) {
32
30
  const numberOfBlocks = decoding.readVarUint(decoder.restDecoder)
33
31
  /**
34
- * @type {Array<GC|Item>}
32
+ * @type {Array<GC|Item|Skip>}
35
33
  */
36
34
  const refs = new Array(numberOfBlocks)
37
35
  const client = decoder.readClient()
@@ -99,12 +97,12 @@ export const writeBlockSet = (encoder, blocks) => {
99
97
 
100
98
  class BlockRange {
101
99
  /**
102
- * @param {Array<Item|GC>} refs
100
+ * @param {Array<Item|GC|Skip>} refs
103
101
  */
104
102
  constructor (refs) {
105
103
  this.i = 0
106
104
  /**
107
- * @type {Array<Item | GC>}
105
+ * @type {Array<Item | GC | Skip>}
108
106
  */
109
107
  this.refs = refs
110
108
  }
@@ -196,17 +194,19 @@ export class BlockSet {
196
194
  if (gapSize > 0) {
197
195
  leftRanges.push(new Skip(new ID(clientid, lastBlockLeft.id.clock + lastBlockLeft.length), gapSize))
198
196
  }
199
- leftRanges.push(...rightRanges)
197
+ for (let i = 0; i < rightRanges.length; i++) {
198
+ leftRanges.push(rightRanges[i])
199
+ }
200
200
  ranges.refs = leftRanges
201
201
  } else {
202
202
  // requires more computation because we need to filter duplicates
203
203
  /**
204
- * @type {Array<GC|Item>}
204
+ * @type {Array<GC|Item|Skip>}
205
205
  */
206
206
  const result = []
207
207
  let nextExpectedClock = leftRanges[0].id.clock
208
208
  /**
209
- * @param {Item|GC} block
209
+ * @param {Item|GC|Skip} block
210
210
  */
211
211
  const addToResult = block => {
212
212
  result.push(block)
@@ -215,11 +215,11 @@ export class BlockSet {
215
215
  let li = 0
216
216
  let ri = 0
217
217
  /**
218
- * @type {Item|GC|undefined}
218
+ * @type {Item|GC|Skip|undefined}
219
219
  */
220
220
  let lblock = leftRanges[li]
221
221
  /**
222
- * @type {Item|GC|undefined}
222
+ * @type {Item|GC|Skip|undefined}
223
223
  */
224
224
  let rblock = rightRanges[ri]
225
225
  const applyLeft = () => {
package/src/utils/Doc.js CHANGED
@@ -2,22 +2,16 @@
2
2
  * @module Y
3
3
  */
4
4
 
5
- import {
6
- StructStore,
7
- transact,
8
- applyUpdate,
9
- ContentDoc, Item, Transaction, // eslint-disable-line
10
- encodeStateAsUpdate
11
- } from '../internals.js'
12
-
13
- import { YType } from '../ytype.js'
14
5
  import { ObservableV2 } from 'lib0/observable'
15
6
  import * as random from 'lib0/random'
16
7
  import * as map from 'lib0/map'
17
8
  import * as array from 'lib0/array'
18
9
  import * as promise from 'lib0/promise'
19
10
 
20
- export const generateNewClientId = random.uint32
11
+ import { StructStore } from './StructStore.js'
12
+ import { transact, generateNewClientId } from './Transaction.js'
13
+ import { YType } from '../ytype.js'
14
+ import { $ydoc } from './schemas.js'
21
15
 
22
16
  /**
23
17
  * @typedef {Object} DocOpts
@@ -179,12 +173,11 @@ export class Doc extends ObservableV2 {
179
173
  * @template T
180
174
  * @param {function(Transaction):T} f The function that should be executed as a transaction
181
175
  * @param {any} [origin] Origin of who started the transaction. Will be stored on transaction.origin
176
+ * @param {boolean} [local]
182
177
  * @return T
183
- *
184
- * @public
185
178
  */
186
- transact (f, origin = null) {
187
- return transact(this, f, origin)
179
+ transact (f, origin = null, local = true) {
180
+ return transact(this, f, origin, local)
188
181
  }
189
182
 
190
183
  /**
@@ -238,29 +231,22 @@ export class Doc extends ObservableV2 {
238
231
  if (item !== null) {
239
232
  this._item = null
240
233
  const content = /** @type {ContentDoc} */ (item.content)
241
- content.doc = new Doc({ guid: this.guid, ...content.opts, shouldLoad: false })
242
- content.doc._item = item
234
+ /**
235
+ * new content doc which replaces the new one
236
+ */
237
+ const contentDoc = new Doc({ guid: this.guid, ...content.opts, shouldLoad: false })
238
+ content.doc = contentDoc
239
+ contentDoc._item = item
243
240
  transact(/** @type {any} */ (item).parent.doc, transaction => {
244
- const doc = content.doc
245
241
  if (!item.deleted) {
246
- transaction.subdocsAdded.add(doc)
242
+ transaction.subdocsAdded.add(contentDoc)
247
243
  }
248
244
  transaction.subdocsRemoved.add(this)
249
245
  }, null, true)
250
246
  }
251
- // @ts-ignore
252
- this.emit('destroyed', [true]) // DEPRECATED!
253
247
  this.emit('destroy', [this])
254
248
  super.destroy()
255
249
  }
256
250
  }
257
251
 
258
- /**
259
- * @param {Doc} ydoc
260
- * @param {DocOpts} [opts]
261
- */
262
- export const cloneDoc = (ydoc, opts) => {
263
- const clone = new Doc(opts)
264
- applyUpdate(clone, encodeStateAsUpdate(ydoc))
265
- return clone
266
- }
252
+ Doc.prototype.$type = $ydoc
package/src/utils/ID.js CHANGED
@@ -1,5 +1,3 @@
1
- import { YType } from '../internals.js' // eslint-disable-line
2
-
3
1
  import * as decoding from 'lib0/decoding'
4
2
  import * as encoding from 'lib0/encoding'
5
3
  import * as error from 'lib0/error'
@@ -1,21 +1,11 @@
1
- import {
2
- writeID,
3
- readID,
4
- compareIDs,
5
- getState,
6
- findRootTypeKey,
7
- Item,
8
- createID,
9
- ContentType,
10
- followRedone,
11
- getItem,
12
- StructStore, ID, Doc, YType, noAttributionsManager, // eslint-disable-line
13
- } from '../internals.js'
14
-
15
1
  import * as encoding from 'lib0/encoding'
16
2
  import * as decoding from 'lib0/decoding'
17
3
  import * as error from 'lib0/error'
18
4
 
5
+ import { Item, followRedone, ContentType } from '../structs/Item.js'
6
+ import { writeID, readID, compareIDs, findRootTypeKey, createID } from './ID.js'
7
+ import { baseRenderer } from './renderer-helpers.js'
8
+
19
9
  /**
20
10
  * A relative position is based on the Yjs model and is not affected by document changes.
21
11
  * E.g. If you place a relative position before a certain character, it will always point to this character.
@@ -156,12 +146,12 @@ export const createRelativePosition = (type, item, assoc) => {
156
146
  * @param {YType} type The base type (e.g. YText or YArray).
157
147
  * @param {number} index The absolute position.
158
148
  * @param {number} [assoc]
159
- * @param {import('../utils/AttributionManager.js').AbstractAttributionManager} attributionManager
149
+ * @param {import('../utils/Renderer.js').AbstractRenderer} renderer
160
150
  * @return {RelativePosition}
161
151
  *
162
152
  * @function
163
153
  */
164
- export const createRelativePositionFromTypeIndex = (type, index, assoc = 0, attributionManager = noAttributionsManager) => {
154
+ export const createRelativePositionFromTypeIndex = (type, index, assoc = 0, renderer = baseRenderer) => {
165
155
  let t = type._start
166
156
  if (assoc < 0) {
167
157
  // associated to the left character or the beginning of a type, increment index if possible.
@@ -171,7 +161,7 @@ export const createRelativePositionFromTypeIndex = (type, index, assoc = 0, attr
171
161
  index--
172
162
  }
173
163
  while (t !== null) {
174
- const len = attributionManager.contentLength(t)
164
+ const len = renderer.contentLength(t)
175
165
  if (len > index) {
176
166
  // case 1: found position somewhere in the linked list
177
167
  return createRelativePosition(type, createID(t.id.client, t.id.clock + index), assoc)
@@ -261,7 +251,7 @@ export const decodeRelativePosition = uint8Array => readRelativePosition(decodin
261
251
  * @param {ID} id
262
252
  */
263
253
  const getItemWithOffset = (store, id) => {
264
- const item = getItem(store, id)
254
+ const item = store.getItem(id)
265
255
  const diff = id.clock - item.id.clock
266
256
  return {
267
257
  item, diff
@@ -282,12 +272,12 @@ const getItemWithOffset = (store, id) => {
282
272
  * @param {RelativePosition} rpos
283
273
  * @param {Doc} doc
284
274
  * @param {boolean} followUndoneDeletions - whether to follow undone deletions - see https://github.com/yjs/yjs/issues/638
285
- * @param {import('../utils/AttributionManager.js').AbstractAttributionManager} attributionManager
275
+ * @param {import('../utils/Renderer.js').AbstractRenderer} renderer
286
276
  * @return {AbsolutePosition|null}
287
277
  *
288
278
  * @function
289
279
  */
290
- export const createAbsolutePositionFromRelativePosition = (rpos, doc, followUndoneDeletions = true, attributionManager = noAttributionsManager) => {
280
+ export const createAbsolutePositionFromRelativePosition = (rpos, doc, followUndoneDeletions = true, renderer = baseRenderer) => {
291
281
  const store = doc.store
292
282
  const rightID = rpos.item
293
283
  const typeID = rpos.type
@@ -296,7 +286,7 @@ export const createAbsolutePositionFromRelativePosition = (rpos, doc, followUndo
296
286
  let type = null
297
287
  let index = 0
298
288
  if (rightID !== null) {
299
- if (getState(store, rightID.client) <= rightID.clock) {
289
+ if (store.getClock(rightID.client) <= rightID.clock) {
300
290
  return null
301
291
  }
302
292
  const res = followUndoneDeletions ? followRedone(store, rightID) : getItemWithOffset(store, rightID)
@@ -306,10 +296,10 @@ export const createAbsolutePositionFromRelativePosition = (rpos, doc, followUndo
306
296
  }
307
297
  type = /** @type {YType<any>} */ (right.parent)
308
298
  if (type._item === null || !type._item.deleted) {
309
- index = attributionManager.contentLength(right) === 0 ? 0 : (res.diff + (assoc >= 0 ? 0 : 1)) // adjust position based on left association if necessary
299
+ index = renderer.contentLength(right) === 0 ? 0 : (res.diff + (assoc >= 0 ? 0 : 1)) // adjust position based on left association if necessary
310
300
  let n = right.left
311
301
  while (n !== null) {
312
- index += attributionManager.contentLength(n)
302
+ index += renderer.contentLength(n)
313
303
  n = n.left
314
304
  }
315
305
  }
@@ -317,11 +307,11 @@ export const createAbsolutePositionFromRelativePosition = (rpos, doc, followUndo
317
307
  if (tname !== null) {
318
308
  type = doc.get(tname)
319
309
  } else if (typeID !== null) {
320
- if (getState(store, typeID.client) <= typeID.clock) {
310
+ if (store.getClock(typeID.client) <= typeID.clock) {
321
311
  // type does not exist yet
322
312
  return null
323
313
  }
324
- const { item } = followUndoneDeletions ? followRedone(store, typeID) : { item: getItem(store, typeID) }
314
+ const { item } = followUndoneDeletions ? followRedone(store, typeID) : { item: store.getItem(typeID) }
325
315
  if (item instanceof Item && item.content instanceof ContentType) {
326
316
  type = item.content.type
327
317
  } else {