@fluidframework/tree 2.20.0 → 2.22.0

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 (357) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +1 -0
  3. package/api-report/tree.alpha.api.md +29 -4
  4. package/api-report/tree.beta.api.md +29 -4
  5. package/api-report/tree.legacy.alpha.api.md +35 -4
  6. package/api-report/tree.legacy.public.api.md +29 -4
  7. package/api-report/tree.public.api.md +29 -4
  8. package/dist/alpha.d.ts +1 -0
  9. package/dist/beta.d.ts +1 -0
  10. package/dist/core/forest/editableForest.js +1 -1
  11. package/dist/core/forest/editableForest.js.map +1 -1
  12. package/dist/core/index.d.ts +1 -1
  13. package/dist/core/index.d.ts.map +1 -1
  14. package/dist/core/index.js.map +1 -1
  15. package/dist/core/tree/anchorSet.d.ts +2 -5
  16. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  17. package/dist/core/tree/anchorSet.js +1 -151
  18. package/dist/core/tree/anchorSet.js.map +1 -1
  19. package/dist/core/tree/index.d.ts +1 -2
  20. package/dist/core/tree/index.d.ts.map +1 -1
  21. package/dist/core/tree/index.js.map +1 -1
  22. package/dist/core/tree/pathTree.d.ts +0 -11
  23. package/dist/core/tree/pathTree.d.ts.map +1 -1
  24. package/dist/core/tree/pathTree.js.map +1 -1
  25. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  26. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  27. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  28. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  29. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
  30. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  31. package/dist/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
  32. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  33. package/dist/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
  34. package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  35. package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  36. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
  37. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  38. package/dist/feature-libraries/forest-summary/forestSummarizer.js +0 -9
  39. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  40. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
  41. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  42. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  43. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -4
  44. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  45. package/dist/feature-libraries/modular-schema/genericFieldKind.js +4 -19
  46. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  47. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  48. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +11 -12
  49. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  50. package/dist/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  51. package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  52. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  53. package/dist/feature-libraries/optional-field/optionalField.js +7 -3
  54. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  55. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
  56. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  57. package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -11
  58. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  59. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
  60. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  61. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
  62. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  63. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  64. package/dist/feature-libraries/treeCursorUtils.js +1 -1
  65. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  66. package/dist/index.d.ts +3 -3
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +4 -2
  69. package/dist/index.js.map +1 -1
  70. package/dist/legacy.d.ts +4 -1
  71. package/dist/packageVersion.d.ts +1 -1
  72. package/dist/packageVersion.js +1 -1
  73. package/dist/packageVersion.js.map +1 -1
  74. package/dist/public.d.ts +1 -0
  75. package/dist/shared-tree/index.d.ts +1 -2
  76. package/dist/shared-tree/index.d.ts.map +1 -1
  77. package/dist/shared-tree/index.js +1 -4
  78. package/dist/shared-tree/index.js.map +1 -1
  79. package/dist/shared-tree/schematizingTreeView.d.ts +4 -5
  80. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  81. package/dist/shared-tree/schematizingTreeView.js +9 -10
  82. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  83. package/dist/shared-tree/sharedTree.d.ts +39 -39
  84. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  85. package/dist/shared-tree/sharedTree.js +81 -55
  86. package/dist/shared-tree/sharedTree.js.map +1 -1
  87. package/dist/shared-tree/treeApi.d.ts +2 -2
  88. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  89. package/dist/shared-tree/treeApi.js +9 -3
  90. package/dist/shared-tree/treeApi.js.map +1 -1
  91. package/dist/shared-tree/treeCheckout.d.ts +3 -3
  92. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  93. package/dist/shared-tree/treeCheckout.js +3 -2
  94. package/dist/shared-tree/treeCheckout.js.map +1 -1
  95. package/dist/shared-tree-core/editManager.js +1 -1
  96. package/dist/shared-tree-core/editManager.js.map +1 -1
  97. package/dist/shared-tree-core/editManagerSummarizer.d.ts +1 -2
  98. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  99. package/dist/shared-tree-core/editManagerSummarizer.js +0 -9
  100. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  101. package/dist/shared-tree-core/sequenceIdUtils.d.ts +12 -1
  102. package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  103. package/dist/shared-tree-core/sequenceIdUtils.js +25 -7
  104. package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
  105. package/dist/shared-tree-core/sharedTreeCore.d.ts +25 -30
  106. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  107. package/dist/shared-tree-core/sharedTreeCore.js +20 -49
  108. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  109. package/dist/simple-tree/api/index.d.ts +3 -2
  110. package/dist/simple-tree/api/index.d.ts.map +1 -1
  111. package/dist/simple-tree/api/index.js +3 -1
  112. package/dist/simple-tree/api/index.js.map +1 -1
  113. package/dist/simple-tree/api/schemaFactory.d.ts +158 -63
  114. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  115. package/dist/simple-tree/api/schemaFactory.js +181 -86
  116. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  117. package/dist/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
  118. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -0
  119. package/dist/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
  120. package/dist/simple-tree/api/tree.d.ts +27 -2
  121. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  122. package/dist/simple-tree/api/tree.js.map +1 -1
  123. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  124. package/dist/simple-tree/core/getOrCreateNode.js +1 -1
  125. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  126. package/dist/simple-tree/core/index.d.ts +1 -1
  127. package/dist/simple-tree/core/index.d.ts.map +1 -1
  128. package/dist/simple-tree/core/index.js +2 -2
  129. package/dist/simple-tree/core/index.js.map +1 -1
  130. package/dist/simple-tree/core/treeNodeKernel.d.ts +2 -6
  131. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  132. package/dist/simple-tree/core/treeNodeKernel.js +10 -13
  133. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  134. package/dist/simple-tree/index.d.ts +1 -1
  135. package/dist/simple-tree/index.d.ts.map +1 -1
  136. package/dist/simple-tree/index.js +3 -2
  137. package/dist/simple-tree/index.js.map +1 -1
  138. package/dist/simple-tree/proxies.js +1 -1
  139. package/dist/simple-tree/proxies.js.map +1 -1
  140. package/dist/simple-tree/schemaTypes.d.ts +2 -2
  141. package/dist/simple-tree/schemaTypes.js +1 -1
  142. package/dist/simple-tree/schemaTypes.js.map +1 -1
  143. package/dist/simple-tree/treeNodeValid.js +1 -2
  144. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  145. package/dist/treeFactory.d.ts +16 -5
  146. package/dist/treeFactory.d.ts.map +1 -1
  147. package/dist/treeFactory.js +21 -12
  148. package/dist/treeFactory.js.map +1 -1
  149. package/dist/util/breakable.d.ts +1 -1
  150. package/dist/util/breakable.d.ts.map +1 -1
  151. package/dist/util/breakable.js.map +1 -1
  152. package/dist/util/rangeMap.d.ts +11 -2
  153. package/dist/util/rangeMap.d.ts.map +1 -1
  154. package/dist/util/rangeMap.js +36 -8
  155. package/dist/util/rangeMap.js.map +1 -1
  156. package/lib/alpha.d.ts +1 -0
  157. package/lib/beta.d.ts +1 -0
  158. package/lib/core/forest/editableForest.js +1 -1
  159. package/lib/core/forest/editableForest.js.map +1 -1
  160. package/lib/core/index.d.ts +1 -1
  161. package/lib/core/index.d.ts.map +1 -1
  162. package/lib/core/index.js.map +1 -1
  163. package/lib/core/tree/anchorSet.d.ts +2 -5
  164. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  165. package/lib/core/tree/anchorSet.js +1 -151
  166. package/lib/core/tree/anchorSet.js.map +1 -1
  167. package/lib/core/tree/index.d.ts +1 -2
  168. package/lib/core/tree/index.d.ts.map +1 -1
  169. package/lib/core/tree/index.js.map +1 -1
  170. package/lib/core/tree/pathTree.d.ts +0 -11
  171. package/lib/core/tree/pathTree.d.ts.map +1 -1
  172. package/lib/core/tree/pathTree.js.map +1 -1
  173. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
  174. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  175. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  176. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  177. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
  178. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  179. package/lib/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
  180. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  181. package/lib/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
  182. package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  183. package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  184. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
  185. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  186. package/lib/feature-libraries/forest-summary/forestSummarizer.js +0 -9
  187. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  188. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
  189. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  190. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  191. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -4
  192. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  193. package/lib/feature-libraries/modular-schema/genericFieldKind.js +4 -19
  194. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  195. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  196. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +11 -12
  197. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  198. package/lib/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  199. package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  200. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  201. package/lib/feature-libraries/optional-field/optionalField.js +7 -3
  202. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  203. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
  204. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  205. package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -11
  206. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  207. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
  208. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  209. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
  210. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  211. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  212. package/lib/feature-libraries/treeCursorUtils.js +2 -2
  213. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  214. package/lib/index.d.ts +3 -3
  215. package/lib/index.d.ts.map +1 -1
  216. package/lib/index.js +3 -3
  217. package/lib/index.js.map +1 -1
  218. package/lib/legacy.d.ts +4 -1
  219. package/lib/packageVersion.d.ts +1 -1
  220. package/lib/packageVersion.js +1 -1
  221. package/lib/packageVersion.js.map +1 -1
  222. package/lib/public.d.ts +1 -0
  223. package/lib/shared-tree/index.d.ts +1 -2
  224. package/lib/shared-tree/index.d.ts.map +1 -1
  225. package/lib/shared-tree/index.js +1 -2
  226. package/lib/shared-tree/index.js.map +1 -1
  227. package/lib/shared-tree/schematizingTreeView.d.ts +4 -5
  228. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  229. package/lib/shared-tree/schematizingTreeView.js +4 -5
  230. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  231. package/lib/shared-tree/sharedTree.d.ts +39 -39
  232. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  233. package/lib/shared-tree/sharedTree.js +79 -53
  234. package/lib/shared-tree/sharedTree.js.map +1 -1
  235. package/lib/shared-tree/treeApi.d.ts +2 -2
  236. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  237. package/lib/shared-tree/treeApi.js +8 -2
  238. package/lib/shared-tree/treeApi.js.map +1 -1
  239. package/lib/shared-tree/treeCheckout.d.ts +3 -3
  240. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  241. package/lib/shared-tree/treeCheckout.js +4 -3
  242. package/lib/shared-tree/treeCheckout.js.map +1 -1
  243. package/lib/shared-tree-core/editManager.js +2 -2
  244. package/lib/shared-tree-core/editManager.js.map +1 -1
  245. package/lib/shared-tree-core/editManagerSummarizer.d.ts +1 -2
  246. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  247. package/lib/shared-tree-core/editManagerSummarizer.js +0 -9
  248. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  249. package/lib/shared-tree-core/sequenceIdUtils.d.ts +12 -1
  250. package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
  251. package/lib/shared-tree-core/sequenceIdUtils.js +23 -5
  252. package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
  253. package/lib/shared-tree-core/sharedTreeCore.d.ts +25 -30
  254. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  255. package/lib/shared-tree-core/sharedTreeCore.js +19 -48
  256. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  257. package/lib/simple-tree/api/index.d.ts +3 -2
  258. package/lib/simple-tree/api/index.d.ts.map +1 -1
  259. package/lib/simple-tree/api/index.js +1 -0
  260. package/lib/simple-tree/api/index.js.map +1 -1
  261. package/lib/simple-tree/api/schemaFactory.d.ts +158 -63
  262. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  263. package/lib/simple-tree/api/schemaFactory.js +180 -85
  264. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  265. package/lib/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
  266. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -0
  267. package/lib/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
  268. package/lib/simple-tree/api/tree.d.ts +27 -2
  269. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  270. package/lib/simple-tree/api/tree.js.map +1 -1
  271. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  272. package/lib/simple-tree/core/getOrCreateNode.js +2 -2
  273. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  274. package/lib/simple-tree/core/index.d.ts +1 -1
  275. package/lib/simple-tree/core/index.d.ts.map +1 -1
  276. package/lib/simple-tree/core/index.js +1 -1
  277. package/lib/simple-tree/core/index.js.map +1 -1
  278. package/lib/simple-tree/core/treeNodeKernel.d.ts +2 -6
  279. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  280. package/lib/simple-tree/core/treeNodeKernel.js +9 -11
  281. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  282. package/lib/simple-tree/index.d.ts +1 -1
  283. package/lib/simple-tree/index.d.ts.map +1 -1
  284. package/lib/simple-tree/index.js +1 -1
  285. package/lib/simple-tree/index.js.map +1 -1
  286. package/lib/simple-tree/proxies.js +2 -2
  287. package/lib/simple-tree/proxies.js.map +1 -1
  288. package/lib/simple-tree/schemaTypes.d.ts +2 -2
  289. package/lib/simple-tree/schemaTypes.js +1 -1
  290. package/lib/simple-tree/schemaTypes.js.map +1 -1
  291. package/lib/simple-tree/treeNodeValid.js +1 -2
  292. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  293. package/lib/treeFactory.d.ts +16 -5
  294. package/lib/treeFactory.d.ts.map +1 -1
  295. package/lib/treeFactory.js +20 -11
  296. package/lib/treeFactory.js.map +1 -1
  297. package/lib/util/breakable.d.ts +1 -1
  298. package/lib/util/breakable.d.ts.map +1 -1
  299. package/lib/util/breakable.js.map +1 -1
  300. package/lib/util/rangeMap.d.ts +11 -2
  301. package/lib/util/rangeMap.d.ts.map +1 -1
  302. package/lib/util/rangeMap.js +36 -8
  303. package/lib/util/rangeMap.js.map +1 -1
  304. package/package.json +23 -23
  305. package/src/core/forest/editableForest.ts +1 -1
  306. package/src/core/index.ts +0 -3
  307. package/src/core/tree/anchorSet.ts +4 -197
  308. package/src/core/tree/index.ts +0 -3
  309. package/src/core/tree/pathTree.ts +0 -13
  310. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
  311. package/src/feature-libraries/detachedFieldIndexSummarizer.ts +0 -11
  312. package/src/feature-libraries/flex-tree/treeEvents.ts +2 -4
  313. package/src/feature-libraries/forest-summary/forestSummarizer.ts +0 -11
  314. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +6 -2
  315. package/src/feature-libraries/modular-schema/genericFieldKind.ts +3 -35
  316. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +9 -42
  317. package/src/feature-libraries/optional-field/optionalField.ts +10 -3
  318. package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -16
  319. package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +13 -2
  320. package/src/feature-libraries/treeCursorUtils.ts +4 -2
  321. package/src/index.ts +15 -10
  322. package/src/packageVersion.ts +1 -1
  323. package/src/shared-tree/index.ts +3 -14
  324. package/src/shared-tree/schematizingTreeView.ts +18 -16
  325. package/src/shared-tree/sharedTree.ts +203 -103
  326. package/src/shared-tree/treeApi.ts +10 -1
  327. package/src/shared-tree/treeCheckout.ts +11 -8
  328. package/src/shared-tree-core/editManager.ts +2 -2
  329. package/src/shared-tree-core/editManagerSummarizer.ts +0 -11
  330. package/src/shared-tree-core/sequenceIdUtils.ts +26 -5
  331. package/src/shared-tree-core/sharedTreeCore.ts +30 -87
  332. package/src/simple-tree/api/index.ts +15 -0
  333. package/src/simple-tree/api/schemaFactory.ts +205 -89
  334. package/src/{shared-tree → simple-tree/api}/transactionTypes.ts +1 -1
  335. package/src/simple-tree/api/tree.ts +35 -6
  336. package/src/simple-tree/core/getOrCreateNode.ts +6 -2
  337. package/src/simple-tree/core/index.ts +1 -1
  338. package/src/simple-tree/core/treeNodeKernel.ts +16 -14
  339. package/src/simple-tree/index.ts +12 -0
  340. package/src/simple-tree/proxies.ts +2 -2
  341. package/src/simple-tree/schemaTypes.ts +2 -2
  342. package/src/treeFactory.ts +29 -11
  343. package/src/util/breakable.ts +1 -1
  344. package/src/util/rangeMap.ts +36 -7
  345. package/dist/core/tree/visitPath.d.ts +0 -101
  346. package/dist/core/tree/visitPath.d.ts.map +0 -1
  347. package/dist/core/tree/visitPath.js +0 -7
  348. package/dist/core/tree/visitPath.js.map +0 -1
  349. package/dist/shared-tree/transactionTypes.d.ts.map +0 -1
  350. package/lib/core/tree/visitPath.d.ts +0 -101
  351. package/lib/core/tree/visitPath.d.ts.map +0 -1
  352. package/lib/core/tree/visitPath.js +0 -6
  353. package/lib/core/tree/visitPath.js.map +0 -1
  354. package/lib/shared-tree/transactionTypes.d.ts.map +0 -1
  355. package/src/core/tree/visitPath.ts +0 -124
  356. /package/dist/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
  357. /package/lib/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
@@ -24,10 +24,19 @@ export class RangeMap<K, V> {
24
24
  * Offsetting `b` by this difference should return `a`.
25
25
  * The difference can be infinite if `a` cannot be reached from `b` by offsetting,
26
26
  * but the difference should still be positive if `a` is larger than `b` and negative if smaller.
27
+ *
28
+ * @param offsetValue - Function used to associate a range of values with a range of keys.
29
+ * When writing to a range of keys starting with `start`, the value of the nth key is interpreted to be
30
+ * `offsetValue(firstValue, n - 1)`.
31
+ * The same logic should be used when interpreting the values for keys after the first in a
32
+ * `RangeQueryResult` or `RangeQueryEntry`.
33
+ *
34
+ * If `offsetValue` is left unspecified, all keys in a block will be given the same value.
27
35
  */
28
36
  public constructor(
29
37
  private readonly offsetKey: (key: K, offset: number) => K,
30
38
  private readonly subtractKeys: (a: K, b: K) => number,
39
+ public readonly offsetValue: (value: V, offset: number) => V = defaultValueOffsetFn,
31
40
  ) {
32
41
  this.tree = new BTree(undefined, subtractKeys);
33
42
  }
@@ -52,7 +61,7 @@ export class RangeMap<K, V> {
52
61
  * Retrieves the values for all keys in the query range.
53
62
  *
54
63
  * @param start - The first key in the range being queried
55
- * @param length - The length of the query range
64
+ * @param length - The length of the query range
56
65
  * @returns A list of entries, each describing the value for some subrange of the query.
57
66
  * The entries are in the same order as the keys, and there is an entry for every key with a non `undefined` value.
58
67
  */
@@ -65,7 +74,11 @@ export class RangeMap<K, V> {
65
74
  const firstEntry = entries[0] ?? oob();
66
75
  const lengthBefore = this.subtractKeys(start, firstEntry.start);
67
76
  if (lengthBefore > 0) {
68
- entries[0] = { ...firstEntry, start, length: firstEntry.length - lengthBefore };
77
+ entries[0] = {
78
+ start,
79
+ length: firstEntry.length - lengthBefore,
80
+ value: this.offsetValue(firstEntry.value, lengthBefore),
81
+ };
69
82
  }
70
83
 
71
84
  const lastEntry = entries[entries.length - 1] ?? oob();
@@ -96,9 +109,14 @@ export class RangeMap<K, V> {
96
109
  const { value, length: entryLength } = entry[1];
97
110
 
98
111
  const entryLastKey = this.offsetKey(entryKey, entryLength - 1);
112
+ const lengthBeforeQuery = this.subtractKeys(start, entryKey);
99
113
  const overlappingLength = Math.min(this.subtractKeys(entryLastKey, start) + 1, length);
100
114
  if (overlappingLength > 0) {
101
- return { value, start, length: overlappingLength };
115
+ return {
116
+ value: this.offsetValue(value, lengthBeforeQuery),
117
+ start,
118
+ length: overlappingLength,
119
+ };
102
120
  }
103
121
  }
104
122
  }
@@ -171,13 +189,18 @@ export class RangeMap<K, V> {
171
189
  const lengthAfter = this.subtractKeys(lastEntryKey, lastDeleteKey);
172
190
  if (lengthAfter > 0) {
173
191
  // A portion of this entry comes after the deletion range, so we reinsert that portion.
174
- this.tree.set(this.offsetKey(lastDeleteKey, 1), { length: lengthAfter, value });
192
+ const newKey = this.offsetKey(lastDeleteKey, 1);
193
+ const difference = this.subtractKeys(newKey, key);
194
+ this.tree.set(newKey, {
195
+ length: lengthAfter,
196
+ value: this.offsetValue(value, difference),
197
+ });
175
198
  }
176
199
  }
177
200
  }
178
201
 
179
202
  public clone(): RangeMap<K, V> {
180
- const cloned = new RangeMap<K, V>(this.offsetKey, this.subtractKeys);
203
+ const cloned = new RangeMap<K, V>(this.offsetKey, this.subtractKeys, this.offsetValue);
181
204
  cloned.tree = this.tree.clone();
182
205
  return cloned;
183
206
  }
@@ -187,11 +210,13 @@ export class RangeMap<K, V> {
187
210
  */
188
211
  public static union<K, V>(a: RangeMap<K, V>, b: RangeMap<K, V>): RangeMap<K, V> {
189
212
  assert(
190
- a.offsetKey === b.offsetKey && a.subtractKeys === b.subtractKeys,
213
+ a.offsetKey === b.offsetKey &&
214
+ a.subtractKeys === b.subtractKeys &&
215
+ a.offsetValue === b.offsetValue,
191
216
  0xaae /* Maps should have the same behavior */,
192
217
  );
193
218
 
194
- const merged = new RangeMap<K, V>(a.offsetKey, a.subtractKeys);
219
+ const merged = new RangeMap<K, V>(a.offsetKey, a.subtractKeys, a.offsetValue);
195
220
 
196
221
  // TODO: Is there a good pattern that lets us make `tree` readonly?
197
222
  merged.tree = a.tree.clone();
@@ -307,3 +332,7 @@ function offsetInteger(key: number, offset: number): number {
307
332
  function subtractIntegers(a: number, b: number): number {
308
333
  return a - b;
309
334
  }
335
+
336
+ function defaultValueOffsetFn<T>(value: T, offset: number): T {
337
+ return value;
338
+ }
@@ -1,101 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import type { ProtoNodes } from "./delta.js";
6
- import type { DetachedPlaceUpPath, DetachedRangeUpPath, PlaceUpPath, RangeUpPath, UpPath } from "./pathTree.js";
7
- /**
8
- * Delta visitor for the path tree.
9
- *
10
- * For any of these events, the paths are guaranteed to be valid at the time of the event,
11
- * and it is valid to read from the Forest at that path.
12
- */
13
- export interface PathVisitor {
14
- /**
15
- * Invoked after the creation of a range of nodes.
16
- * @param content - The content that was created.
17
- */
18
- afterCreate(content: DetachedRangeUpPath): void;
19
- /**
20
- * Invoked before the attaching of a range of nodes.
21
- * Not invoked for replacements.
22
- * @param source - The content that will be attached.
23
- * @param destination - The location where the content will be attached.
24
- * @param kind - The kind of replacement that will occur.
25
- */
26
- beforeAttach(source: DetachedRangeUpPath, destination: PlaceUpPath): void;
27
- /**
28
- * Invoked after the attaching of a range of nodes.
29
- * Not invoked for replacements.
30
- * @param source - The location where the content originated.
31
- * @param destination - The content that was attached.
32
- * @param kind - The kind of replacement that will occur.
33
- */
34
- afterAttach(source: DetachedPlaceUpPath, destination: RangeUpPath): void;
35
- /**
36
- * Invoked before the detaching of a range of nodes.
37
- * Not invoked for replacements.
38
- * @param source - The content that will be detached.
39
- * @param destination - The location where the content will be sent to.
40
- * @param kind - The kind of replacement that will occur.
41
- */
42
- beforeDetach(source: RangeUpPath, destination: DetachedPlaceUpPath): void;
43
- /**
44
- * Invoked after the detaching of a range of nodes.
45
- * Not invoked for replacements.
46
- * @param source - The content that was detached.
47
- * @param destination - The location where the content will be attached.
48
- * @param kind - The kind of replacement that will occur.
49
- */
50
- afterDetach(source: PlaceUpPath, destination: DetachedRangeUpPath): void;
51
- /**
52
- * Invoked before the replacement of a range of nodes.
53
- *
54
- * Note that the `newContent` range length will always match the `oldContent` range length.
55
- * A replace might actually be separate detaches and attaches which have been coalesced.
56
- *
57
- * @param newContent - The content that will be attached in place of the old.
58
- * @param oldContent - The old that will be replaced.
59
- * @param oldContentDestination - The destination of the old content.
60
- * @param kind - The kind of replacement that will occur.
61
- */
62
- beforeReplace(newContent: DetachedRangeUpPath, oldContent: RangeUpPath, oldContentDestination: DetachedPlaceUpPath): void;
63
- /**
64
- * Invoked after the replacement of a range of nodes.
65
- *
66
- * Note that the `newContent` range length will always match the `oldContent` range length.
67
- * A replace might actually be separate detaches and attaches which have been coalesced.
68
- *
69
- * @param newContentSource - The place that the new content came from.
70
- * @param newContent - The new content.
71
- * @param oldContent - The content that was replaced.
72
- */
73
- afterReplace(newContentSource: DetachedPlaceUpPath, newContent: RangeUpPath, oldContent: DetachedRangeUpPath): void;
74
- /**
75
- * Invoked before content is destroyed.
76
- * @param content - The content that will be destroyed
77
- */
78
- beforeDestroy(content: DetachedRangeUpPath): void;
79
- /**
80
- * A sequence of nodes of length `count` is being removed starting with `path`.
81
- * Called when these nodes are no longer parented under their previous parent, and do not have a new parent.
82
- * It is possible they may be restored in the future (for example by a conflicted merge or undo).
83
- *
84
- * Not called for children of removed nodes.
85
- *
86
- * @param path - first node in the removed range.
87
- * @param count - length of removed range.
88
- *
89
- * @deprecated Migrate to using the other events.
90
- */
91
- onRemove(path: UpPath, count: number): void;
92
- /**
93
- * @param path - location which first node of inserted range will have after insert.
94
- * Any nodes at this index (or after it) will be moved to the right (have their indexes increased by `content.length`).
95
- * @param content - content which is being inserted.
96
- *
97
- * @deprecated Migrate to using the other events.
98
- */
99
- onInsert(path: UpPath, content: ProtoNodes): void;
100
- }
101
- //# sourceMappingURL=visitPath.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"visitPath.d.ts","sourceRoot":"","sources":["../../../src/core/tree/visitPath.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACX,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,MAAM,EACN,MAAM,eAAe,CAAC;AAEvB;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC3B;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAEhD;;;;;;OAMG;IACH,YAAY,CAAC,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAE1E;;;;;;OAMG;IACH,WAAW,CAAC,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAEzE;;;;;;OAMG;IACH,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAE1E;;;;;;OAMG;IACH,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAEzE;;;;;;;;;;OAUG;IACH,aAAa,CACZ,UAAU,EAAE,mBAAmB,EAC/B,UAAU,EAAE,WAAW,EACvB,qBAAqB,EAAE,mBAAmB,GACxC,IAAI,CAAC;IAER;;;;;;;;;OASG;IACH,YAAY,CACX,gBAAgB,EAAE,mBAAmB,EACrC,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,mBAAmB,GAC7B,IAAI,CAAC;IAER;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAElD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;CAClD"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=visitPath.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"visitPath.js","sourceRoot":"","sources":["../../../src/core/tree/visitPath.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ProtoNodes } from \"./delta.js\";\nimport type {\n\tDetachedPlaceUpPath,\n\tDetachedRangeUpPath,\n\tPlaceUpPath,\n\tRangeUpPath,\n\tUpPath,\n} from \"./pathTree.js\";\n\n/**\n * Delta visitor for the path tree.\n *\n * For any of these events, the paths are guaranteed to be valid at the time of the event,\n * and it is valid to read from the Forest at that path.\n */\nexport interface PathVisitor {\n\t/**\n\t * Invoked after the creation of a range of nodes.\n\t * @param content - The content that was created.\n\t */\n\tafterCreate(content: DetachedRangeUpPath): void;\n\n\t/**\n\t * Invoked before the attaching of a range of nodes.\n\t * Not invoked for replacements.\n\t * @param source - The content that will be attached.\n\t * @param destination - The location where the content will be attached.\n\t * @param kind - The kind of replacement that will occur.\n\t */\n\tbeforeAttach(source: DetachedRangeUpPath, destination: PlaceUpPath): void;\n\n\t/**\n\t * Invoked after the attaching of a range of nodes.\n\t * Not invoked for replacements.\n\t * @param source - The location where the content originated.\n\t * @param destination - The content that was attached.\n\t * @param kind - The kind of replacement that will occur.\n\t */\n\tafterAttach(source: DetachedPlaceUpPath, destination: RangeUpPath): void;\n\n\t/**\n\t * Invoked before the detaching of a range of nodes.\n\t * Not invoked for replacements.\n\t * @param source - The content that will be detached.\n\t * @param destination - The location where the content will be sent to.\n\t * @param kind - The kind of replacement that will occur.\n\t */\n\tbeforeDetach(source: RangeUpPath, destination: DetachedPlaceUpPath): void;\n\n\t/**\n\t * Invoked after the detaching of a range of nodes.\n\t * Not invoked for replacements.\n\t * @param source - The content that was detached.\n\t * @param destination - The location where the content will be attached.\n\t * @param kind - The kind of replacement that will occur.\n\t */\n\tafterDetach(source: PlaceUpPath, destination: DetachedRangeUpPath): void;\n\n\t/**\n\t * Invoked before the replacement of a range of nodes.\n\t *\n\t * Note that the `newContent` range length will always match the `oldContent` range length.\n\t * A replace might actually be separate detaches and attaches which have been coalesced.\n\t *\n\t * @param newContent - The content that will be attached in place of the old.\n\t * @param oldContent - The old that will be replaced.\n\t * @param oldContentDestination - The destination of the old content.\n\t * @param kind - The kind of replacement that will occur.\n\t */\n\tbeforeReplace(\n\t\tnewContent: DetachedRangeUpPath,\n\t\toldContent: RangeUpPath,\n\t\toldContentDestination: DetachedPlaceUpPath,\n\t): void;\n\n\t/**\n\t * Invoked after the replacement of a range of nodes.\n\t *\n\t * Note that the `newContent` range length will always match the `oldContent` range length.\n\t * A replace might actually be separate detaches and attaches which have been coalesced.\n\t *\n\t * @param newContentSource - The place that the new content came from.\n\t * @param newContent - The new content.\n\t * @param oldContent - The content that was replaced.\n\t */\n\tafterReplace(\n\t\tnewContentSource: DetachedPlaceUpPath,\n\t\tnewContent: RangeUpPath,\n\t\toldContent: DetachedRangeUpPath,\n\t): void;\n\n\t/**\n\t * Invoked before content is destroyed.\n\t * @param content - The content that will be destroyed\n\t */\n\tbeforeDestroy(content: DetachedRangeUpPath): void;\n\n\t/**\n\t * A sequence of nodes of length `count` is being removed starting with `path`.\n\t * Called when these nodes are no longer parented under their previous parent, and do not have a new parent.\n\t * It is possible they may be restored in the future (for example by a conflicted merge or undo).\n\t *\n\t * Not called for children of removed nodes.\n\t *\n\t * @param path - first node in the removed range.\n\t * @param count - length of removed range.\n\t *\n\t * @deprecated Migrate to using the other events.\n\t */\n\tonRemove(path: UpPath, count: number): void;\n\t/**\n\t * @param path - location which first node of inserted range will have after insert.\n\t * Any nodes at this index (or after it) will be moved to the right (have their indexes increased by `content.length`).\n\t * @param content - content which is being inserted.\n\t *\n\t * @deprecated Migrate to using the other events.\n\t */\n\tonInsert(path: UpPath, content: ProtoNodes): void;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"transactionTypes.d.ts","sourceRoot":"","sources":["../../src/shared-tree/transactionTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,QAAQ,eAA4C,CAAC;AAElE;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM,yBAAyB,CAAC,aAAa,EAAE,aAAa,IAAI,CACnE;IACA,gEAAgE;IAChE,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,oEAAoE;IACpE,KAAK,EAAE,aAAa,CAAC;CACpB,GACD;IACA,gGAAgG;IAChG,QAAQ,EAAE,IAAI,CAAC;IACf,0DAA0D;IAC1D,KAAK,EAAE,aAAa,CAAC;CACpB,CACH,GAAG;IACH;;;;;;OAMG;IACH,qBAAqB,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACzD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAC/C,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,EAC3C,OAAO,CACP,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,wBAAwB,CAAC,aAAa;IACtD,qDAAqD;IACrD,OAAO,EAAE,IAAI,CAAC;IACd,kEAAkE;IAClE,KAAK,EAAE,aAAa,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB,CAAC,aAAa;IACrD,6CAA6C;IAC7C,OAAO,EAAE,KAAK,CAAC;IACf,0DAA0D;IAC1D,KAAK,EAAE,aAAa,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAAC,aAAa,EAAE,aAAa,IAC1D,wBAAwB,CAAC,aAAa,CAAC,GACvC,uBAAuB,CAAC,aAAa,CAAC,CAAC;AAE1C;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAC1B,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAChD,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;CAC1D"}
@@ -1,101 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import type { ProtoNodes } from "./delta.js";
6
- import type { DetachedPlaceUpPath, DetachedRangeUpPath, PlaceUpPath, RangeUpPath, UpPath } from "./pathTree.js";
7
- /**
8
- * Delta visitor for the path tree.
9
- *
10
- * For any of these events, the paths are guaranteed to be valid at the time of the event,
11
- * and it is valid to read from the Forest at that path.
12
- */
13
- export interface PathVisitor {
14
- /**
15
- * Invoked after the creation of a range of nodes.
16
- * @param content - The content that was created.
17
- */
18
- afterCreate(content: DetachedRangeUpPath): void;
19
- /**
20
- * Invoked before the attaching of a range of nodes.
21
- * Not invoked for replacements.
22
- * @param source - The content that will be attached.
23
- * @param destination - The location where the content will be attached.
24
- * @param kind - The kind of replacement that will occur.
25
- */
26
- beforeAttach(source: DetachedRangeUpPath, destination: PlaceUpPath): void;
27
- /**
28
- * Invoked after the attaching of a range of nodes.
29
- * Not invoked for replacements.
30
- * @param source - The location where the content originated.
31
- * @param destination - The content that was attached.
32
- * @param kind - The kind of replacement that will occur.
33
- */
34
- afterAttach(source: DetachedPlaceUpPath, destination: RangeUpPath): void;
35
- /**
36
- * Invoked before the detaching of a range of nodes.
37
- * Not invoked for replacements.
38
- * @param source - The content that will be detached.
39
- * @param destination - The location where the content will be sent to.
40
- * @param kind - The kind of replacement that will occur.
41
- */
42
- beforeDetach(source: RangeUpPath, destination: DetachedPlaceUpPath): void;
43
- /**
44
- * Invoked after the detaching of a range of nodes.
45
- * Not invoked for replacements.
46
- * @param source - The content that was detached.
47
- * @param destination - The location where the content will be attached.
48
- * @param kind - The kind of replacement that will occur.
49
- */
50
- afterDetach(source: PlaceUpPath, destination: DetachedRangeUpPath): void;
51
- /**
52
- * Invoked before the replacement of a range of nodes.
53
- *
54
- * Note that the `newContent` range length will always match the `oldContent` range length.
55
- * A replace might actually be separate detaches and attaches which have been coalesced.
56
- *
57
- * @param newContent - The content that will be attached in place of the old.
58
- * @param oldContent - The old that will be replaced.
59
- * @param oldContentDestination - The destination of the old content.
60
- * @param kind - The kind of replacement that will occur.
61
- */
62
- beforeReplace(newContent: DetachedRangeUpPath, oldContent: RangeUpPath, oldContentDestination: DetachedPlaceUpPath): void;
63
- /**
64
- * Invoked after the replacement of a range of nodes.
65
- *
66
- * Note that the `newContent` range length will always match the `oldContent` range length.
67
- * A replace might actually be separate detaches and attaches which have been coalesced.
68
- *
69
- * @param newContentSource - The place that the new content came from.
70
- * @param newContent - The new content.
71
- * @param oldContent - The content that was replaced.
72
- */
73
- afterReplace(newContentSource: DetachedPlaceUpPath, newContent: RangeUpPath, oldContent: DetachedRangeUpPath): void;
74
- /**
75
- * Invoked before content is destroyed.
76
- * @param content - The content that will be destroyed
77
- */
78
- beforeDestroy(content: DetachedRangeUpPath): void;
79
- /**
80
- * A sequence of nodes of length `count` is being removed starting with `path`.
81
- * Called when these nodes are no longer parented under their previous parent, and do not have a new parent.
82
- * It is possible they may be restored in the future (for example by a conflicted merge or undo).
83
- *
84
- * Not called for children of removed nodes.
85
- *
86
- * @param path - first node in the removed range.
87
- * @param count - length of removed range.
88
- *
89
- * @deprecated Migrate to using the other events.
90
- */
91
- onRemove(path: UpPath, count: number): void;
92
- /**
93
- * @param path - location which first node of inserted range will have after insert.
94
- * Any nodes at this index (or after it) will be moved to the right (have their indexes increased by `content.length`).
95
- * @param content - content which is being inserted.
96
- *
97
- * @deprecated Migrate to using the other events.
98
- */
99
- onInsert(path: UpPath, content: ProtoNodes): void;
100
- }
101
- //# sourceMappingURL=visitPath.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"visitPath.d.ts","sourceRoot":"","sources":["../../../src/core/tree/visitPath.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACX,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,MAAM,EACN,MAAM,eAAe,CAAC;AAEvB;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC3B;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAEhD;;;;;;OAMG;IACH,YAAY,CAAC,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAE1E;;;;;;OAMG;IACH,WAAW,CAAC,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAEzE;;;;;;OAMG;IACH,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAE1E;;;;;;OAMG;IACH,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAEzE;;;;;;;;;;OAUG;IACH,aAAa,CACZ,UAAU,EAAE,mBAAmB,EAC/B,UAAU,EAAE,WAAW,EACvB,qBAAqB,EAAE,mBAAmB,GACxC,IAAI,CAAC;IAER;;;;;;;;;OASG;IACH,YAAY,CACX,gBAAgB,EAAE,mBAAmB,EACrC,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,mBAAmB,GAC7B,IAAI,CAAC;IAER;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAElD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;CAClD"}
@@ -1,6 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- export {};
6
- //# sourceMappingURL=visitPath.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"visitPath.js","sourceRoot":"","sources":["../../../src/core/tree/visitPath.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ProtoNodes } from \"./delta.js\";\nimport type {\n\tDetachedPlaceUpPath,\n\tDetachedRangeUpPath,\n\tPlaceUpPath,\n\tRangeUpPath,\n\tUpPath,\n} from \"./pathTree.js\";\n\n/**\n * Delta visitor for the path tree.\n *\n * For any of these events, the paths are guaranteed to be valid at the time of the event,\n * and it is valid to read from the Forest at that path.\n */\nexport interface PathVisitor {\n\t/**\n\t * Invoked after the creation of a range of nodes.\n\t * @param content - The content that was created.\n\t */\n\tafterCreate(content: DetachedRangeUpPath): void;\n\n\t/**\n\t * Invoked before the attaching of a range of nodes.\n\t * Not invoked for replacements.\n\t * @param source - The content that will be attached.\n\t * @param destination - The location where the content will be attached.\n\t * @param kind - The kind of replacement that will occur.\n\t */\n\tbeforeAttach(source: DetachedRangeUpPath, destination: PlaceUpPath): void;\n\n\t/**\n\t * Invoked after the attaching of a range of nodes.\n\t * Not invoked for replacements.\n\t * @param source - The location where the content originated.\n\t * @param destination - The content that was attached.\n\t * @param kind - The kind of replacement that will occur.\n\t */\n\tafterAttach(source: DetachedPlaceUpPath, destination: RangeUpPath): void;\n\n\t/**\n\t * Invoked before the detaching of a range of nodes.\n\t * Not invoked for replacements.\n\t * @param source - The content that will be detached.\n\t * @param destination - The location where the content will be sent to.\n\t * @param kind - The kind of replacement that will occur.\n\t */\n\tbeforeDetach(source: RangeUpPath, destination: DetachedPlaceUpPath): void;\n\n\t/**\n\t * Invoked after the detaching of a range of nodes.\n\t * Not invoked for replacements.\n\t * @param source - The content that was detached.\n\t * @param destination - The location where the content will be attached.\n\t * @param kind - The kind of replacement that will occur.\n\t */\n\tafterDetach(source: PlaceUpPath, destination: DetachedRangeUpPath): void;\n\n\t/**\n\t * Invoked before the replacement of a range of nodes.\n\t *\n\t * Note that the `newContent` range length will always match the `oldContent` range length.\n\t * A replace might actually be separate detaches and attaches which have been coalesced.\n\t *\n\t * @param newContent - The content that will be attached in place of the old.\n\t * @param oldContent - The old that will be replaced.\n\t * @param oldContentDestination - The destination of the old content.\n\t * @param kind - The kind of replacement that will occur.\n\t */\n\tbeforeReplace(\n\t\tnewContent: DetachedRangeUpPath,\n\t\toldContent: RangeUpPath,\n\t\toldContentDestination: DetachedPlaceUpPath,\n\t): void;\n\n\t/**\n\t * Invoked after the replacement of a range of nodes.\n\t *\n\t * Note that the `newContent` range length will always match the `oldContent` range length.\n\t * A replace might actually be separate detaches and attaches which have been coalesced.\n\t *\n\t * @param newContentSource - The place that the new content came from.\n\t * @param newContent - The new content.\n\t * @param oldContent - The content that was replaced.\n\t */\n\tafterReplace(\n\t\tnewContentSource: DetachedPlaceUpPath,\n\t\tnewContent: RangeUpPath,\n\t\toldContent: DetachedRangeUpPath,\n\t): void;\n\n\t/**\n\t * Invoked before content is destroyed.\n\t * @param content - The content that will be destroyed\n\t */\n\tbeforeDestroy(content: DetachedRangeUpPath): void;\n\n\t/**\n\t * A sequence of nodes of length `count` is being removed starting with `path`.\n\t * Called when these nodes are no longer parented under their previous parent, and do not have a new parent.\n\t * It is possible they may be restored in the future (for example by a conflicted merge or undo).\n\t *\n\t * Not called for children of removed nodes.\n\t *\n\t * @param path - first node in the removed range.\n\t * @param count - length of removed range.\n\t *\n\t * @deprecated Migrate to using the other events.\n\t */\n\tonRemove(path: UpPath, count: number): void;\n\t/**\n\t * @param path - location which first node of inserted range will have after insert.\n\t * Any nodes at this index (or after it) will be moved to the right (have their indexes increased by `content.length`).\n\t * @param content - content which is being inserted.\n\t *\n\t * @deprecated Migrate to using the other events.\n\t */\n\tonInsert(path: UpPath, content: ProtoNodes): void;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"transactionTypes.d.ts","sourceRoot":"","sources":["../../src/shared-tree/transactionTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,QAAQ,eAA4C,CAAC;AAElE;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM,yBAAyB,CAAC,aAAa,EAAE,aAAa,IAAI,CACnE;IACA,gEAAgE;IAChE,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,oEAAoE;IACpE,KAAK,EAAE,aAAa,CAAC;CACpB,GACD;IACA,gGAAgG;IAChG,QAAQ,EAAE,IAAI,CAAC;IACf,0DAA0D;IAC1D,KAAK,EAAE,aAAa,CAAC;CACpB,CACH,GAAG;IACH;;;;;;OAMG;IACH,qBAAqB,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACzD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAC/C,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,EAC3C,OAAO,CACP,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,wBAAwB,CAAC,aAAa;IACtD,qDAAqD;IACrD,OAAO,EAAE,IAAI,CAAC;IACd,kEAAkE;IAClE,KAAK,EAAE,aAAa,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB,CAAC,aAAa;IACrD,6CAA6C;IAC7C,OAAO,EAAE,KAAK,CAAC;IACf,0DAA0D;IAC1D,KAAK,EAAE,aAAa,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAAC,aAAa,EAAE,aAAa,IAC1D,wBAAwB,CAAC,aAAa,CAAC,GACvC,uBAAuB,CAAC,aAAa,CAAC,CAAC;AAE1C;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAC1B,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAChD,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;CAC1D"}
@@ -1,124 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- import type { ProtoNodes } from "./delta.js";
7
- import type {
8
- DetachedPlaceUpPath,
9
- DetachedRangeUpPath,
10
- PlaceUpPath,
11
- RangeUpPath,
12
- UpPath,
13
- } from "./pathTree.js";
14
-
15
- /**
16
- * Delta visitor for the path tree.
17
- *
18
- * For any of these events, the paths are guaranteed to be valid at the time of the event,
19
- * and it is valid to read from the Forest at that path.
20
- */
21
- export interface PathVisitor {
22
- /**
23
- * Invoked after the creation of a range of nodes.
24
- * @param content - The content that was created.
25
- */
26
- afterCreate(content: DetachedRangeUpPath): void;
27
-
28
- /**
29
- * Invoked before the attaching of a range of nodes.
30
- * Not invoked for replacements.
31
- * @param source - The content that will be attached.
32
- * @param destination - The location where the content will be attached.
33
- * @param kind - The kind of replacement that will occur.
34
- */
35
- beforeAttach(source: DetachedRangeUpPath, destination: PlaceUpPath): void;
36
-
37
- /**
38
- * Invoked after the attaching of a range of nodes.
39
- * Not invoked for replacements.
40
- * @param source - The location where the content originated.
41
- * @param destination - The content that was attached.
42
- * @param kind - The kind of replacement that will occur.
43
- */
44
- afterAttach(source: DetachedPlaceUpPath, destination: RangeUpPath): void;
45
-
46
- /**
47
- * Invoked before the detaching of a range of nodes.
48
- * Not invoked for replacements.
49
- * @param source - The content that will be detached.
50
- * @param destination - The location where the content will be sent to.
51
- * @param kind - The kind of replacement that will occur.
52
- */
53
- beforeDetach(source: RangeUpPath, destination: DetachedPlaceUpPath): void;
54
-
55
- /**
56
- * Invoked after the detaching of a range of nodes.
57
- * Not invoked for replacements.
58
- * @param source - The content that was detached.
59
- * @param destination - The location where the content will be attached.
60
- * @param kind - The kind of replacement that will occur.
61
- */
62
- afterDetach(source: PlaceUpPath, destination: DetachedRangeUpPath): void;
63
-
64
- /**
65
- * Invoked before the replacement of a range of nodes.
66
- *
67
- * Note that the `newContent` range length will always match the `oldContent` range length.
68
- * A replace might actually be separate detaches and attaches which have been coalesced.
69
- *
70
- * @param newContent - The content that will be attached in place of the old.
71
- * @param oldContent - The old that will be replaced.
72
- * @param oldContentDestination - The destination of the old content.
73
- * @param kind - The kind of replacement that will occur.
74
- */
75
- beforeReplace(
76
- newContent: DetachedRangeUpPath,
77
- oldContent: RangeUpPath,
78
- oldContentDestination: DetachedPlaceUpPath,
79
- ): void;
80
-
81
- /**
82
- * Invoked after the replacement of a range of nodes.
83
- *
84
- * Note that the `newContent` range length will always match the `oldContent` range length.
85
- * A replace might actually be separate detaches and attaches which have been coalesced.
86
- *
87
- * @param newContentSource - The place that the new content came from.
88
- * @param newContent - The new content.
89
- * @param oldContent - The content that was replaced.
90
- */
91
- afterReplace(
92
- newContentSource: DetachedPlaceUpPath,
93
- newContent: RangeUpPath,
94
- oldContent: DetachedRangeUpPath,
95
- ): void;
96
-
97
- /**
98
- * Invoked before content is destroyed.
99
- * @param content - The content that will be destroyed
100
- */
101
- beforeDestroy(content: DetachedRangeUpPath): void;
102
-
103
- /**
104
- * A sequence of nodes of length `count` is being removed starting with `path`.
105
- * Called when these nodes are no longer parented under their previous parent, and do not have a new parent.
106
- * It is possible they may be restored in the future (for example by a conflicted merge or undo).
107
- *
108
- * Not called for children of removed nodes.
109
- *
110
- * @param path - first node in the removed range.
111
- * @param count - length of removed range.
112
- *
113
- * @deprecated Migrate to using the other events.
114
- */
115
- onRemove(path: UpPath, count: number): void;
116
- /**
117
- * @param path - location which first node of inserted range will have after insert.
118
- * Any nodes at this index (or after it) will be moved to the right (have their indexes increased by `content.length`).
119
- * @param content - content which is being inserted.
120
- *
121
- * @deprecated Migrate to using the other events.
122
- */
123
- onInsert(path: UpPath, content: ProtoNodes): void;
124
- }