@fluidframework/tree 2.1.0-281041 → 2.2.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 (1510) hide show
  1. package/.mocharc.customBenchmarks.cjs +33 -0
  2. package/.vscode/Tree.code-workspace +2 -1
  3. package/CHANGELOG.md +335 -0
  4. package/README.md +40 -10
  5. package/api-extractor.json +17 -0
  6. package/api-report/tree.alpha.api.md +120 -26
  7. package/api-report/tree.beta.api.md +52 -26
  8. package/api-report/tree.public.api.md +52 -26
  9. package/dist/beta.d.ts +3 -1
  10. package/dist/codec/discriminatedUnions.d.ts +11 -5
  11. package/dist/codec/discriminatedUnions.d.ts.map +1 -1
  12. package/dist/codec/discriminatedUnions.js.map +1 -1
  13. package/dist/codec/index.d.ts +1 -1
  14. package/dist/codec/index.d.ts.map +1 -1
  15. package/dist/codec/index.js.map +1 -1
  16. package/dist/core/forest/editableForest.d.ts +1 -5
  17. package/dist/core/forest/editableForest.d.ts.map +1 -1
  18. package/dist/core/forest/editableForest.js +4 -2
  19. package/dist/core/forest/editableForest.js.map +1 -1
  20. package/dist/core/forest/forest.d.ts +0 -6
  21. package/dist/core/forest/forest.d.ts.map +1 -1
  22. package/dist/core/forest/forest.js +0 -2
  23. package/dist/core/forest/forest.js.map +1 -1
  24. package/dist/core/index.d.ts +2 -2
  25. package/dist/core/index.d.ts.map +1 -1
  26. package/dist/core/index.js +3 -4
  27. package/dist/core/index.js.map +1 -1
  28. package/dist/core/rebase/changeRebaser.d.ts +0 -4
  29. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  30. package/dist/core/rebase/changeRebaser.js.map +1 -1
  31. package/dist/core/rebase/index.d.ts +1 -1
  32. package/dist/core/rebase/index.d.ts.map +1 -1
  33. package/dist/core/rebase/index.js +1 -3
  34. package/dist/core/rebase/index.js.map +1 -1
  35. package/dist/core/rebase/types.d.ts +1 -8
  36. package/dist/core/rebase/types.d.ts.map +1 -1
  37. package/dist/core/rebase/types.js +1 -9
  38. package/dist/core/rebase/types.js.map +1 -1
  39. package/dist/core/rebase/utils.d.ts +0 -1
  40. package/dist/core/rebase/utils.d.ts.map +1 -1
  41. package/dist/core/rebase/utils.js +12 -7
  42. package/dist/core/rebase/utils.js.map +1 -1
  43. package/dist/core/schema-stored/multiplicity.d.ts +0 -1
  44. package/dist/core/schema-stored/multiplicity.d.ts.map +1 -1
  45. package/dist/core/schema-stored/multiplicity.js +0 -1
  46. package/dist/core/schema-stored/multiplicity.js.map +1 -1
  47. package/dist/core/schema-stored/schema.d.ts +0 -7
  48. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  49. package/dist/core/schema-stored/schema.js +0 -4
  50. package/dist/core/schema-stored/schema.js.map +1 -1
  51. package/dist/core/schema-stored/storedSchemaRepository.d.ts +0 -3
  52. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  53. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  54. package/dist/core/schema-view/view.d.ts +0 -3
  55. package/dist/core/schema-view/view.d.ts.map +1 -1
  56. package/dist/core/schema-view/view.js +0 -1
  57. package/dist/core/schema-view/view.js.map +1 -1
  58. package/dist/core/tree/anchorSet.d.ts +1 -10
  59. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  60. package/dist/core/tree/anchorSet.js +14 -4
  61. package/dist/core/tree/anchorSet.js.map +1 -1
  62. package/dist/core/tree/cursor.d.ts +1 -6
  63. package/dist/core/tree/cursor.d.ts.map +1 -1
  64. package/dist/core/tree/cursor.js +0 -2
  65. package/dist/core/tree/cursor.js.map +1 -1
  66. package/dist/core/tree/delta.d.ts +0 -11
  67. package/dist/core/tree/delta.d.ts.map +1 -1
  68. package/dist/core/tree/delta.js.map +1 -1
  69. package/dist/core/tree/detachedFieldIndex.d.ts +48 -11
  70. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  71. package/dist/core/tree/detachedFieldIndex.js +144 -20
  72. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  73. package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  74. package/dist/core/tree/detachedFieldIndexCodec.js +16 -6
  75. package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
  76. package/dist/core/tree/detachedFieldIndexFormat.d.ts +1 -1
  77. package/dist/core/tree/detachedFieldIndexFormat.d.ts.map +1 -1
  78. package/dist/core/tree/detachedFieldIndexFormat.js.map +1 -1
  79. package/dist/core/tree/detachedFieldIndexTypes.d.ts +38 -4
  80. package/dist/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  81. package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
  82. package/dist/core/tree/index.d.ts +3 -2
  83. package/dist/core/tree/index.d.ts.map +1 -1
  84. package/dist/core/tree/index.js +3 -1
  85. package/dist/core/tree/index.js.map +1 -1
  86. package/dist/core/tree/mapTree.d.ts +20 -4
  87. package/dist/core/tree/mapTree.d.ts.map +1 -1
  88. package/dist/core/tree/mapTree.js +29 -0
  89. package/dist/core/tree/mapTree.js.map +1 -1
  90. package/dist/core/tree/pathTree.d.ts +0 -11
  91. package/dist/core/tree/pathTree.d.ts.map +1 -1
  92. package/dist/core/tree/pathTree.js.map +1 -1
  93. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  94. package/dist/core/tree/treeTextFormat.js +3 -2
  95. package/dist/core/tree/treeTextFormat.js.map +1 -1
  96. package/dist/core/tree/types.d.ts +0 -11
  97. package/dist/core/tree/types.d.ts.map +1 -1
  98. package/dist/core/tree/types.js +0 -4
  99. package/dist/core/tree/types.js.map +1 -1
  100. package/dist/core/tree/visitDelta.d.ts +3 -2
  101. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  102. package/dist/core/tree/visitDelta.js +33 -17
  103. package/dist/core/tree/visitDelta.js.map +1 -1
  104. package/dist/core/tree/visitPath.d.ts +0 -2
  105. package/dist/core/tree/visitPath.d.ts.map +1 -1
  106. package/dist/core/tree/visitPath.js.map +1 -1
  107. package/dist/core/tree/visitorUtils.d.ts +3 -4
  108. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  109. package/dist/core/tree/visitorUtils.js +4 -4
  110. package/dist/core/tree/visitorUtils.js.map +1 -1
  111. package/dist/domains/index.d.ts +1 -1
  112. package/dist/domains/index.d.ts.map +1 -1
  113. package/dist/domains/index.js +2 -1
  114. package/dist/domains/index.js.map +1 -1
  115. package/dist/domains/json/index.d.ts +1 -1
  116. package/dist/domains/json/index.d.ts.map +1 -1
  117. package/dist/domains/json/index.js +2 -1
  118. package/dist/domains/json/index.js.map +1 -1
  119. package/dist/domains/json/jsonCursor.d.ts +36 -2
  120. package/dist/domains/json/jsonCursor.d.ts.map +1 -1
  121. package/dist/domains/json/jsonCursor.js +76 -5
  122. package/dist/domains/json/jsonCursor.js.map +1 -1
  123. package/dist/domains/json/jsonDomainSchema.d.ts +13 -3
  124. package/dist/domains/json/jsonDomainSchema.d.ts.map +1 -1
  125. package/dist/domains/json/jsonDomainSchema.js +12 -4
  126. package/dist/domains/json/jsonDomainSchema.js.map +1 -1
  127. package/dist/domains/leafDomain.d.ts +0 -1
  128. package/dist/domains/leafDomain.d.ts.map +1 -1
  129. package/dist/domains/leafDomain.js +0 -1
  130. package/dist/domains/leafDomain.js.map +1 -1
  131. package/dist/domains/schemaBuilder.d.ts +1 -7
  132. package/dist/domains/schemaBuilder.d.ts.map +1 -1
  133. package/dist/domains/schemaBuilder.js +0 -10
  134. package/dist/domains/schemaBuilder.js.map +1 -1
  135. package/dist/events/events.d.ts +0 -4
  136. package/dist/events/events.d.ts.map +1 -1
  137. package/dist/events/events.js +0 -1
  138. package/dist/events/events.js.map +1 -1
  139. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  140. package/dist/feature-libraries/chunked-forest/basicChunk.js +8 -3
  141. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  142. package/dist/feature-libraries/chunked-forest/chunk.d.ts +1 -1
  143. package/dist/feature-libraries/chunked-forest/chunk.d.ts.map +1 -1
  144. package/dist/feature-libraries/chunked-forest/chunk.js.map +1 -1
  145. package/dist/feature-libraries/chunked-forest/chunkTree.js +3 -3
  146. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  147. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  148. package/dist/feature-libraries/chunked-forest/chunkedForest.js +7 -5
  149. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  150. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +1 -1
  151. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  152. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  153. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +8 -5
  154. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  155. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  156. package/dist/feature-libraries/chunked-forest/uniformChunk.js +5 -3
  157. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  158. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -24
  159. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  160. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +9 -19
  161. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  162. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -6
  163. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  164. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
  165. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  166. package/dist/feature-libraries/default-schema/defaultSchema.d.ts +0 -1
  167. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  168. package/dist/feature-libraries/default-schema/defaultSchema.js +0 -1
  169. package/dist/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  170. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  171. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  172. package/dist/feature-libraries/default-schema/index.js +2 -1
  173. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  174. package/dist/feature-libraries/default-schema/schemaChecker.d.ts +6 -0
  175. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  176. package/dist/feature-libraries/default-schema/schemaChecker.js +6 -0
  177. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  178. package/dist/feature-libraries/editableTreeBinder.d.ts +0 -67
  179. package/dist/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  180. package/dist/feature-libraries/editableTreeBinder.js +6 -25
  181. package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
  182. package/dist/feature-libraries/fieldGenerator.d.ts +0 -3
  183. package/dist/feature-libraries/fieldGenerator.d.ts.map +1 -1
  184. package/dist/feature-libraries/fieldGenerator.js +0 -1
  185. package/dist/feature-libraries/fieldGenerator.js.map +1 -1
  186. package/dist/feature-libraries/flex-map-tree/index.d.ts +1 -1
  187. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  188. package/dist/feature-libraries/flex-map-tree/index.js +2 -2
  189. package/dist/feature-libraries/flex-map-tree/index.js.map +1 -1
  190. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +57 -56
  191. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  192. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +168 -217
  193. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  194. package/dist/feature-libraries/flex-tree/context.d.ts +0 -1
  195. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  196. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  197. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +18 -295
  198. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  199. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +0 -6
  200. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  201. package/dist/feature-libraries/flex-tree/index.d.ts +3 -2
  202. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  203. package/dist/feature-libraries/flex-tree/index.js +5 -1
  204. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  205. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +1 -2
  206. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  207. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  208. package/dist/feature-libraries/flex-tree/lazyField.d.ts +9 -27
  209. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  210. package/dist/feature-libraries/flex-tree/lazyField.js +36 -117
  211. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  212. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +2 -13
  213. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  214. package/dist/feature-libraries/flex-tree/lazyNode.js +3 -69
  215. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  216. package/dist/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
  217. package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  218. package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  219. package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -1
  220. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  221. package/dist/feature-libraries/flex-tree/utilities.js +4 -0
  222. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  223. package/dist/feature-libraries/forest-summary/codec.js +2 -2
  224. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  225. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  226. package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  227. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  228. package/dist/feature-libraries/index.d.ts +6 -8
  229. package/dist/feature-libraries/index.d.ts.map +1 -1
  230. package/dist/feature-libraries/index.js +10 -18
  231. package/dist/feature-libraries/index.js.map +1 -1
  232. package/dist/feature-libraries/mapTreeCursor.d.ts +6 -2
  233. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  234. package/dist/feature-libraries/mapTreeCursor.js +9 -1
  235. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  236. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
  237. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
  238. package/dist/feature-libraries/memoizedIdRangeAllocator.js +0 -1
  239. package/dist/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
  240. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
  241. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  242. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
  243. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  244. package/dist/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
  245. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  246. package/dist/feature-libraries/modular-schema/discrepancies.js +108 -5
  247. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  248. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
  249. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  250. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
  251. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  252. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
  253. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  254. package/dist/feature-libraries/modular-schema/fieldKind.js +1 -2
  255. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  256. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
  257. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  258. package/dist/feature-libraries/modular-schema/genericFieldKind.js +57 -85
  259. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  260. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
  261. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  262. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +5 -8
  263. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  264. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
  265. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  266. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js +6 -0
  267. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  268. package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
  269. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  270. package/dist/feature-libraries/modular-schema/index.js +2 -1
  271. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  272. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  273. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +40 -23
  274. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  275. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
  276. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  277. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +205 -244
  278. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  279. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
  280. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  281. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  282. package/dist/feature-libraries/node-key/nodeKey.d.ts +0 -4
  283. package/dist/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
  284. package/dist/feature-libraries/node-key/nodeKey.js +0 -2
  285. package/dist/feature-libraries/node-key/nodeKey.js.map +1 -1
  286. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
  287. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
  288. package/dist/feature-libraries/node-key/nodeKeyManager.js.map +1 -1
  289. package/dist/feature-libraries/object-forest/objectForest.d.ts +3 -2
  290. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  291. package/dist/feature-libraries/object-forest/objectForest.js +6 -14
  292. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  293. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  294. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  295. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  296. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  297. package/dist/feature-libraries/schemaBuilderBase.d.ts +2 -28
  298. package/dist/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
  299. package/dist/feature-libraries/schemaBuilderBase.js +1 -27
  300. package/dist/feature-libraries/schemaBuilderBase.js.map +1 -1
  301. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  302. package/dist/feature-libraries/sequence-field/compose.js +24 -21
  303. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  304. package/dist/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  305. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  306. package/dist/feature-libraries/sequence-field/formatV2.js +7 -6
  307. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  308. package/dist/feature-libraries/sequence-field/formatV3.d.ts +195 -0
  309. package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
  310. package/dist/feature-libraries/sequence-field/formatV3.js +23 -0
  311. package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -0
  312. package/dist/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
  313. package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  314. package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  315. package/dist/feature-libraries/sequence-field/index.d.ts +1 -1
  316. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  317. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  318. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  319. package/dist/feature-libraries/sequence-field/invert.js +21 -13
  320. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  321. package/dist/feature-libraries/sequence-field/markQueue.js +1 -1
  322. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  323. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
  324. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  325. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  326. package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  327. package/dist/feature-libraries/sequence-field/rebase.js +24 -6
  328. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  329. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  330. package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -3
  331. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  332. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  333. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +38 -4
  334. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  335. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
  336. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  337. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +54 -9
  338. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  339. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
  340. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
  341. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +85 -0
  342. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
  343. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  344. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
  345. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  346. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  347. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +4 -1
  348. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  349. package/dist/feature-libraries/sequence-field/types.d.ts +23 -4
  350. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  351. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  352. package/dist/feature-libraries/sequence-field/utils.d.ts +5 -4
  353. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  354. package/dist/feature-libraries/sequence-field/utils.js +70 -42
  355. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  356. package/dist/feature-libraries/storedToViewSchema.d.ts +0 -1
  357. package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  358. package/dist/feature-libraries/storedToViewSchema.js +0 -1
  359. package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
  360. package/dist/feature-libraries/treeCursorUtils.d.ts +0 -6
  361. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  362. package/dist/feature-libraries/treeCursorUtils.js +8 -6
  363. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  364. package/dist/feature-libraries/treeTextCursor.d.ts +0 -2
  365. package/dist/feature-libraries/treeTextCursor.d.ts.map +1 -1
  366. package/dist/feature-libraries/treeTextCursor.js +0 -2
  367. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  368. package/dist/feature-libraries/typed-schema/flexList.d.ts +0 -3
  369. package/dist/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  370. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  371. package/dist/feature-libraries/typed-schema/index.d.ts +1 -1
  372. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  373. package/dist/feature-libraries/typed-schema/index.js +1 -3
  374. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  375. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  376. package/dist/feature-libraries/typed-schema/schemaCollection.js +0 -4
  377. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  378. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
  379. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  380. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +1 -40
  381. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  382. package/dist/feature-libraries/typed-schema/view.d.ts +0 -1
  383. package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
  384. package/dist/feature-libraries/typed-schema/view.js.map +1 -1
  385. package/dist/index.d.ts +8 -9
  386. package/dist/index.d.ts.map +1 -1
  387. package/dist/index.js +31 -90
  388. package/dist/index.js.map +1 -1
  389. package/dist/internalTypes.d.ts +1 -1
  390. package/dist/internalTypes.d.ts.map +1 -1
  391. package/dist/internalTypes.js.map +1 -1
  392. package/dist/packageVersion.d.ts +1 -1
  393. package/dist/packageVersion.d.ts.map +1 -1
  394. package/dist/packageVersion.js +1 -1
  395. package/dist/packageVersion.js.map +1 -1
  396. package/dist/public.d.ts +3 -1
  397. package/dist/shared-tree/schematizeTree.d.ts +2 -11
  398. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  399. package/dist/shared-tree/schematizeTree.js +13 -2
  400. package/dist/shared-tree/schematizeTree.js.map +1 -1
  401. package/dist/shared-tree/schematizingTreeView.d.ts +4 -4
  402. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  403. package/dist/shared-tree/schematizingTreeView.js +2 -2
  404. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  405. package/dist/shared-tree/sharedTree.d.ts +9 -18
  406. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  407. package/dist/shared-tree/sharedTree.js +12 -9
  408. package/dist/shared-tree/sharedTree.js.map +1 -1
  409. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  410. package/dist/shared-tree/sharedTreeChangeCodecs.js +4 -0
  411. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  412. package/dist/shared-tree/sharedTreeChangeEnricher.js +1 -1
  413. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  414. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  415. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  416. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
  417. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  418. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  419. package/dist/shared-tree/treeApi.js +3 -3
  420. package/dist/shared-tree/treeApi.js.map +1 -1
  421. package/dist/shared-tree/treeCheckout.d.ts +10 -6
  422. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  423. package/dist/shared-tree/treeCheckout.js +51 -6
  424. package/dist/shared-tree/treeCheckout.js.map +1 -1
  425. package/dist/shared-tree/treeView.d.ts +3 -6
  426. package/dist/shared-tree/treeView.d.ts.map +1 -1
  427. package/dist/shared-tree/treeView.js +7 -3
  428. package/dist/shared-tree/treeView.js.map +1 -1
  429. package/dist/shared-tree-core/branch.d.ts +6 -0
  430. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  431. package/dist/shared-tree-core/branch.js +13 -6
  432. package/dist/shared-tree-core/branch.js.map +1 -1
  433. package/dist/shared-tree-core/defaultResubmitMachine.js +3 -3
  434. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  435. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  436. package/dist/shared-tree-core/editManagerCodecs.js +1 -0
  437. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  438. package/dist/shared-tree-core/editManagerFormat.d.ts +2 -2
  439. package/dist/shared-tree-core/editManagerFormat.d.ts.map +1 -1
  440. package/dist/shared-tree-core/editManagerFormat.js +6 -1
  441. package/dist/shared-tree-core/editManagerFormat.js.map +1 -1
  442. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  443. package/dist/shared-tree-core/messageCodecs.js +1 -0
  444. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  445. package/dist/shared-tree-core/sharedTreeCore.d.ts +4 -0
  446. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  447. package/dist/shared-tree-core/sharedTreeCore.js +9 -1
  448. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  449. package/dist/simple-tree/api/create.d.ts +54 -0
  450. package/dist/simple-tree/api/create.d.ts.map +1 -0
  451. package/dist/simple-tree/api/create.js +99 -0
  452. package/dist/simple-tree/api/create.js.map +1 -0
  453. package/dist/simple-tree/api/index.d.ts +12 -0
  454. package/dist/simple-tree/api/index.d.ts.map +1 -0
  455. package/dist/simple-tree/api/index.js +28 -0
  456. package/dist/simple-tree/api/index.js.map +1 -0
  457. package/{lib/simple-tree → dist/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
  458. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
  459. package/dist/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
  460. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -0
  461. package/dist/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
  462. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -0
  463. package/dist/simple-tree/{schemaFactory.js → api/schemaFactory.js} +10 -9
  464. package/dist/simple-tree/api/schemaFactory.js.map +1 -0
  465. package/{lib/simple-tree → dist/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
  466. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
  467. package/dist/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
  468. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
  469. package/dist/simple-tree/api/testRecursiveDomain.d.ts +62 -0
  470. package/dist/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
  471. package/dist/simple-tree/api/testRecursiveDomain.js.map +1 -0
  472. package/{lib/simple-tree → dist/simple-tree/api}/tree.d.ts +111 -20
  473. package/dist/simple-tree/api/tree.d.ts.map +1 -0
  474. package/dist/simple-tree/api/tree.js +173 -0
  475. package/dist/simple-tree/api/tree.js.map +1 -0
  476. package/dist/simple-tree/api/treeNodeApi.d.ts +87 -0
  477. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -0
  478. package/dist/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +33 -33
  479. package/dist/simple-tree/api/treeNodeApi.js.map +1 -0
  480. package/dist/simple-tree/api/verboseTree.d.ts +136 -0
  481. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -0
  482. package/dist/simple-tree/api/verboseTree.js +220 -0
  483. package/dist/simple-tree/api/verboseTree.js.map +1 -0
  484. package/dist/simple-tree/arrayNode.d.ts +3 -3
  485. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  486. package/dist/simple-tree/arrayNode.js +70 -69
  487. package/dist/simple-tree/arrayNode.js.map +1 -1
  488. package/dist/simple-tree/core/index.d.ts +10 -0
  489. package/dist/simple-tree/core/index.d.ts.map +1 -0
  490. package/dist/simple-tree/core/index.js +27 -0
  491. package/dist/simple-tree/core/index.js.map +1 -0
  492. package/{lib/simple-tree → dist/simple-tree/core}/schemaCaching.d.ts +2 -9
  493. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -0
  494. package/dist/simple-tree/{schemaCaching.js → core/schemaCaching.js} +2 -23
  495. package/dist/simple-tree/core/schemaCaching.js.map +1 -0
  496. package/dist/simple-tree/core/treeNodeKernel.d.ts +57 -0
  497. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
  498. package/dist/simple-tree/core/treeNodeKernel.js +128 -0
  499. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -0
  500. package/dist/simple-tree/core/treeNodeSchema.d.ts +149 -0
  501. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
  502. package/dist/simple-tree/core/treeNodeSchema.js +35 -0
  503. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -0
  504. package/dist/simple-tree/core/types.d.ts +178 -0
  505. package/dist/simple-tree/core/types.d.ts.map +1 -0
  506. package/dist/simple-tree/core/types.js +117 -0
  507. package/dist/simple-tree/core/types.js.map +1 -0
  508. package/dist/simple-tree/core/withType.d.ts +82 -0
  509. package/dist/simple-tree/core/withType.d.ts.map +1 -0
  510. package/dist/simple-tree/core/withType.js +39 -0
  511. package/dist/simple-tree/core/withType.js.map +1 -0
  512. package/dist/simple-tree/getJsonSchema.d.ts +55 -0
  513. package/dist/simple-tree/getJsonSchema.d.ts.map +1 -0
  514. package/dist/simple-tree/getJsonSchema.js +69 -0
  515. package/dist/simple-tree/getJsonSchema.js.map +1 -0
  516. package/dist/simple-tree/getSimpleFieldSchema.d.ts +14 -0
  517. package/dist/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
  518. package/dist/simple-tree/getSimpleFieldSchema.js +29 -0
  519. package/dist/simple-tree/getSimpleFieldSchema.js.map +1 -0
  520. package/dist/simple-tree/getSimpleSchema.d.ts +58 -0
  521. package/dist/simple-tree/getSimpleSchema.d.ts.map +1 -0
  522. package/dist/simple-tree/getSimpleSchema.js +68 -0
  523. package/dist/simple-tree/getSimpleSchema.js.map +1 -0
  524. package/dist/simple-tree/index.d.ts +12 -13
  525. package/dist/simple-tree/index.d.ts.map +1 -1
  526. package/dist/simple-tree/index.js +27 -23
  527. package/dist/simple-tree/index.js.map +1 -1
  528. package/dist/simple-tree/jsonSchema.d.ts +206 -0
  529. package/dist/simple-tree/jsonSchema.d.ts.map +1 -0
  530. package/dist/{feature-libraries/schema-aware/index.js → simple-tree/jsonSchema.js} +1 -1
  531. package/dist/simple-tree/jsonSchema.js.map +1 -0
  532. package/dist/simple-tree/leafNodeSchema.d.ts +1 -1
  533. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  534. package/dist/simple-tree/leafNodeSchema.js +3 -4
  535. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  536. package/dist/simple-tree/mapNode.d.ts +9 -3
  537. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  538. package/dist/simple-tree/mapNode.js +33 -35
  539. package/dist/simple-tree/mapNode.js.map +1 -1
  540. package/dist/simple-tree/objectNode.d.ts +18 -16
  541. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  542. package/dist/simple-tree/objectNode.js +43 -44
  543. package/dist/simple-tree/objectNode.js.map +1 -1
  544. package/dist/simple-tree/objectNodeTypes.d.ts +38 -0
  545. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -0
  546. package/dist/simple-tree/objectNodeTypes.js +19 -0
  547. package/dist/simple-tree/objectNodeTypes.js.map +1 -0
  548. package/dist/simple-tree/proxies.d.ts +6 -25
  549. package/dist/simple-tree/proxies.d.ts.map +1 -1
  550. package/dist/simple-tree/proxies.js +54 -81
  551. package/dist/simple-tree/proxies.js.map +1 -1
  552. package/dist/simple-tree/proxyBinding.d.ts +46 -19
  553. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  554. package/dist/simple-tree/proxyBinding.js +101 -44
  555. package/dist/simple-tree/proxyBinding.js.map +1 -1
  556. package/dist/simple-tree/schemaTypes.d.ts +10 -159
  557. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  558. package/dist/simple-tree/schemaTypes.js +11 -42
  559. package/dist/simple-tree/schemaTypes.js.map +1 -1
  560. package/dist/simple-tree/simpleSchema.d.ts +124 -0
  561. package/dist/simple-tree/simpleSchema.d.ts.map +1 -0
  562. package/dist/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
  563. package/dist/simple-tree/simpleSchema.js.map +1 -0
  564. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
  565. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
  566. package/dist/simple-tree/simpleSchemaToJsonSchema.js +146 -0
  567. package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
  568. package/dist/simple-tree/toFlexSchema.d.ts +4 -12
  569. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  570. package/dist/simple-tree/toFlexSchema.js +42 -52
  571. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  572. package/dist/simple-tree/toMapTree.d.ts +39 -39
  573. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  574. package/dist/simple-tree/toMapTree.js +227 -171
  575. package/dist/simple-tree/toMapTree.js.map +1 -1
  576. package/dist/simple-tree/{types.d.ts → treeNodeValid.d.ts} +2 -80
  577. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -0
  578. package/dist/simple-tree/{types.js → treeNodeValid.js} +102 -107
  579. package/dist/simple-tree/treeNodeValid.js.map +1 -0
  580. package/dist/simple-tree/typesUnsafe.d.ts +35 -4
  581. package/dist/simple-tree/typesUnsafe.d.ts.map +1 -1
  582. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  583. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
  584. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
  585. package/dist/simple-tree/viewSchemaToSimpleSchema.js +171 -0
  586. package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
  587. package/dist/util/brand.d.ts +0 -3
  588. package/dist/util/brand.d.ts.map +1 -1
  589. package/dist/util/brand.js +1 -2
  590. package/dist/util/brand.js.map +1 -1
  591. package/dist/util/brandedMap.d.ts +0 -5
  592. package/dist/util/brandedMap.d.ts.map +1 -1
  593. package/dist/util/brandedMap.js +0 -1
  594. package/dist/util/brandedMap.js.map +1 -1
  595. package/dist/util/breakable.js +1 -1
  596. package/dist/util/breakable.js.map +1 -1
  597. package/dist/util/idAllocator.d.ts +0 -2
  598. package/dist/util/idAllocator.d.ts.map +1 -1
  599. package/dist/util/idAllocator.js +0 -1
  600. package/dist/util/idAllocator.js.map +1 -1
  601. package/dist/util/index.d.ts +2 -2
  602. package/dist/util/index.d.ts.map +1 -1
  603. package/dist/util/index.js +4 -2
  604. package/dist/util/index.js.map +1 -1
  605. package/dist/util/nestedMap.d.ts +5 -19
  606. package/dist/util/nestedMap.d.ts.map +1 -1
  607. package/dist/util/nestedMap.js +17 -17
  608. package/dist/util/nestedMap.js.map +1 -1
  609. package/dist/util/opaque.d.ts +0 -4
  610. package/dist/util/opaque.d.ts.map +1 -1
  611. package/dist/util/opaque.js +0 -2
  612. package/dist/util/opaque.js.map +1 -1
  613. package/dist/util/rangeMap.d.ts +0 -2
  614. package/dist/util/rangeMap.d.ts.map +1 -1
  615. package/dist/util/rangeMap.js +4 -3
  616. package/dist/util/rangeMap.js.map +1 -1
  617. package/dist/util/transactionResult.d.ts +0 -1
  618. package/dist/util/transactionResult.d.ts.map +1 -1
  619. package/dist/util/transactionResult.js +0 -1
  620. package/dist/util/transactionResult.js.map +1 -1
  621. package/dist/util/typeCheck.d.ts +2 -20
  622. package/dist/util/typeCheck.d.ts.map +1 -1
  623. package/dist/util/typeCheck.js.map +1 -1
  624. package/dist/util/typeCheckTests.d.ts +4 -4
  625. package/dist/util/typeCheckTests.d.ts.map +1 -1
  626. package/dist/util/typeCheckTests.js.map +1 -1
  627. package/dist/util/typeUtils.d.ts +0 -7
  628. package/dist/util/typeUtils.d.ts.map +1 -1
  629. package/dist/util/typeUtils.js.map +1 -1
  630. package/dist/util/utils.d.ts +6 -8
  631. package/dist/util/utils.d.ts.map +1 -1
  632. package/dist/util/utils.js +14 -5
  633. package/dist/util/utils.js.map +1 -1
  634. package/lib/beta.d.ts +3 -1
  635. package/lib/codec/discriminatedUnions.d.ts +11 -5
  636. package/lib/codec/discriminatedUnions.d.ts.map +1 -1
  637. package/lib/codec/discriminatedUnions.js.map +1 -1
  638. package/lib/codec/index.d.ts +1 -1
  639. package/lib/codec/index.d.ts.map +1 -1
  640. package/lib/codec/index.js +1 -1
  641. package/lib/codec/index.js.map +1 -1
  642. package/lib/core/forest/editableForest.d.ts +1 -5
  643. package/lib/core/forest/editableForest.d.ts.map +1 -1
  644. package/lib/core/forest/editableForest.js +4 -2
  645. package/lib/core/forest/editableForest.js.map +1 -1
  646. package/lib/core/forest/forest.d.ts +0 -6
  647. package/lib/core/forest/forest.d.ts.map +1 -1
  648. package/lib/core/forest/forest.js +0 -2
  649. package/lib/core/forest/forest.js.map +1 -1
  650. package/lib/core/index.d.ts +2 -2
  651. package/lib/core/index.d.ts.map +1 -1
  652. package/lib/core/index.js +2 -2
  653. package/lib/core/index.js.map +1 -1
  654. package/lib/core/rebase/changeRebaser.d.ts +0 -4
  655. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  656. package/lib/core/rebase/changeRebaser.js.map +1 -1
  657. package/lib/core/rebase/index.d.ts +1 -1
  658. package/lib/core/rebase/index.d.ts.map +1 -1
  659. package/lib/core/rebase/index.js +1 -1
  660. package/lib/core/rebase/index.js.map +1 -1
  661. package/lib/core/rebase/types.d.ts +1 -8
  662. package/lib/core/rebase/types.d.ts.map +1 -1
  663. package/lib/core/rebase/types.js +1 -7
  664. package/lib/core/rebase/types.js.map +1 -1
  665. package/lib/core/rebase/utils.d.ts +0 -1
  666. package/lib/core/rebase/utils.d.ts.map +1 -1
  667. package/lib/core/rebase/utils.js +13 -8
  668. package/lib/core/rebase/utils.js.map +1 -1
  669. package/lib/core/schema-stored/multiplicity.d.ts +0 -1
  670. package/lib/core/schema-stored/multiplicity.d.ts.map +1 -1
  671. package/lib/core/schema-stored/multiplicity.js +0 -1
  672. package/lib/core/schema-stored/multiplicity.js.map +1 -1
  673. package/lib/core/schema-stored/schema.d.ts +0 -7
  674. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  675. package/lib/core/schema-stored/schema.js +0 -4
  676. package/lib/core/schema-stored/schema.js.map +1 -1
  677. package/lib/core/schema-stored/storedSchemaRepository.d.ts +0 -3
  678. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  679. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  680. package/lib/core/schema-view/view.d.ts +0 -3
  681. package/lib/core/schema-view/view.d.ts.map +1 -1
  682. package/lib/core/schema-view/view.js +0 -1
  683. package/lib/core/schema-view/view.js.map +1 -1
  684. package/lib/core/tree/anchorSet.d.ts +1 -10
  685. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  686. package/lib/core/tree/anchorSet.js +14 -4
  687. package/lib/core/tree/anchorSet.js.map +1 -1
  688. package/lib/core/tree/cursor.d.ts +1 -6
  689. package/lib/core/tree/cursor.d.ts.map +1 -1
  690. package/lib/core/tree/cursor.js +0 -2
  691. package/lib/core/tree/cursor.js.map +1 -1
  692. package/lib/core/tree/delta.d.ts +0 -11
  693. package/lib/core/tree/delta.d.ts.map +1 -1
  694. package/lib/core/tree/delta.js.map +1 -1
  695. package/lib/core/tree/detachedFieldIndex.d.ts +48 -11
  696. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  697. package/lib/core/tree/detachedFieldIndex.js +145 -21
  698. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  699. package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  700. package/lib/core/tree/detachedFieldIndexCodec.js +17 -7
  701. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  702. package/lib/core/tree/detachedFieldIndexFormat.d.ts +1 -1
  703. package/lib/core/tree/detachedFieldIndexFormat.d.ts.map +1 -1
  704. package/lib/core/tree/detachedFieldIndexFormat.js.map +1 -1
  705. package/lib/core/tree/detachedFieldIndexTypes.d.ts +38 -4
  706. package/lib/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  707. package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
  708. package/lib/core/tree/index.d.ts +3 -2
  709. package/lib/core/tree/index.d.ts.map +1 -1
  710. package/lib/core/tree/index.js +1 -0
  711. package/lib/core/tree/index.js.map +1 -1
  712. package/lib/core/tree/mapTree.d.ts +20 -4
  713. package/lib/core/tree/mapTree.d.ts.map +1 -1
  714. package/lib/core/tree/mapTree.js +27 -1
  715. package/lib/core/tree/mapTree.js.map +1 -1
  716. package/lib/core/tree/pathTree.d.ts +0 -11
  717. package/lib/core/tree/pathTree.d.ts.map +1 -1
  718. package/lib/core/tree/pathTree.js.map +1 -1
  719. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  720. package/lib/core/tree/treeTextFormat.js +3 -2
  721. package/lib/core/tree/treeTextFormat.js.map +1 -1
  722. package/lib/core/tree/types.d.ts +0 -11
  723. package/lib/core/tree/types.d.ts.map +1 -1
  724. package/lib/core/tree/types.js +0 -4
  725. package/lib/core/tree/types.js.map +1 -1
  726. package/lib/core/tree/visitDelta.d.ts +3 -2
  727. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  728. package/lib/core/tree/visitDelta.js +33 -17
  729. package/lib/core/tree/visitDelta.js.map +1 -1
  730. package/lib/core/tree/visitPath.d.ts +0 -2
  731. package/lib/core/tree/visitPath.d.ts.map +1 -1
  732. package/lib/core/tree/visitPath.js.map +1 -1
  733. package/lib/core/tree/visitorUtils.d.ts +3 -4
  734. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  735. package/lib/core/tree/visitorUtils.js +4 -4
  736. package/lib/core/tree/visitorUtils.js.map +1 -1
  737. package/lib/domains/index.d.ts +1 -1
  738. package/lib/domains/index.d.ts.map +1 -1
  739. package/lib/domains/index.js +1 -1
  740. package/lib/domains/index.js.map +1 -1
  741. package/lib/domains/json/index.d.ts +1 -1
  742. package/lib/domains/json/index.d.ts.map +1 -1
  743. package/lib/domains/json/index.js +1 -1
  744. package/lib/domains/json/index.js.map +1 -1
  745. package/lib/domains/json/jsonCursor.d.ts +36 -2
  746. package/lib/domains/json/jsonCursor.d.ts.map +1 -1
  747. package/lib/domains/json/jsonCursor.js +76 -5
  748. package/lib/domains/json/jsonCursor.js.map +1 -1
  749. package/lib/domains/json/jsonDomainSchema.d.ts +13 -3
  750. package/lib/domains/json/jsonDomainSchema.d.ts.map +1 -1
  751. package/lib/domains/json/jsonDomainSchema.js +9 -1
  752. package/lib/domains/json/jsonDomainSchema.js.map +1 -1
  753. package/lib/domains/leafDomain.d.ts +0 -1
  754. package/lib/domains/leafDomain.d.ts.map +1 -1
  755. package/lib/domains/leafDomain.js +0 -1
  756. package/lib/domains/leafDomain.js.map +1 -1
  757. package/lib/domains/schemaBuilder.d.ts +1 -7
  758. package/lib/domains/schemaBuilder.d.ts.map +1 -1
  759. package/lib/domains/schemaBuilder.js +1 -11
  760. package/lib/domains/schemaBuilder.js.map +1 -1
  761. package/lib/events/events.d.ts +0 -4
  762. package/lib/events/events.d.ts.map +1 -1
  763. package/lib/events/events.js +0 -1
  764. package/lib/events/events.js.map +1 -1
  765. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  766. package/lib/feature-libraries/chunked-forest/basicChunk.js +9 -4
  767. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  768. package/lib/feature-libraries/chunked-forest/chunk.d.ts +1 -1
  769. package/lib/feature-libraries/chunked-forest/chunk.d.ts.map +1 -1
  770. package/lib/feature-libraries/chunked-forest/chunk.js.map +1 -1
  771. package/lib/feature-libraries/chunked-forest/chunkTree.js +4 -4
  772. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  773. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  774. package/lib/feature-libraries/chunked-forest/chunkedForest.js +8 -6
  775. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  776. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +2 -2
  777. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  778. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  779. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +9 -6
  780. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  781. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  782. package/lib/feature-libraries/chunked-forest/uniformChunk.js +6 -4
  783. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  784. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -24
  785. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  786. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +6 -16
  787. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  788. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -6
  789. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  790. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
  791. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  792. package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -1
  793. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  794. package/lib/feature-libraries/default-schema/defaultSchema.js +0 -1
  795. package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  796. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  797. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  798. package/lib/feature-libraries/default-schema/index.js +1 -1
  799. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  800. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +6 -0
  801. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  802. package/lib/feature-libraries/default-schema/schemaChecker.js +6 -0
  803. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  804. package/lib/feature-libraries/editableTreeBinder.d.ts +0 -67
  805. package/lib/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  806. package/lib/feature-libraries/editableTreeBinder.js +7 -26
  807. package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
  808. package/lib/feature-libraries/fieldGenerator.d.ts +0 -3
  809. package/lib/feature-libraries/fieldGenerator.d.ts.map +1 -1
  810. package/lib/feature-libraries/fieldGenerator.js +0 -1
  811. package/lib/feature-libraries/fieldGenerator.js.map +1 -1
  812. package/lib/feature-libraries/flex-map-tree/index.d.ts +1 -1
  813. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  814. package/lib/feature-libraries/flex-map-tree/index.js +1 -1
  815. package/lib/feature-libraries/flex-map-tree/index.js.map +1 -1
  816. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +57 -56
  817. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  818. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +169 -217
  819. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  820. package/lib/feature-libraries/flex-tree/context.d.ts +0 -1
  821. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  822. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  823. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +18 -295
  824. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  825. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +0 -6
  826. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  827. package/lib/feature-libraries/flex-tree/index.d.ts +3 -2
  828. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  829. package/lib/feature-libraries/flex-tree/index.js +2 -1
  830. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  831. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +1 -2
  832. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  833. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  834. package/lib/feature-libraries/flex-tree/lazyField.d.ts +9 -27
  835. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  836. package/lib/feature-libraries/flex-tree/lazyField.js +39 -120
  837. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  838. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +2 -13
  839. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  840. package/lib/feature-libraries/flex-tree/lazyNode.js +7 -72
  841. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  842. package/lib/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
  843. package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  844. package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  845. package/lib/feature-libraries/flex-tree/utilities.d.ts +2 -1
  846. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  847. package/lib/feature-libraries/flex-tree/utilities.js +4 -0
  848. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  849. package/lib/feature-libraries/forest-summary/codec.js +3 -3
  850. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  851. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  852. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  853. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  854. package/lib/feature-libraries/index.d.ts +6 -8
  855. package/lib/feature-libraries/index.d.ts.map +1 -1
  856. package/lib/feature-libraries/index.js +6 -7
  857. package/lib/feature-libraries/index.js.map +1 -1
  858. package/lib/feature-libraries/mapTreeCursor.d.ts +6 -2
  859. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  860. package/lib/feature-libraries/mapTreeCursor.js +7 -0
  861. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  862. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
  863. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
  864. package/lib/feature-libraries/memoizedIdRangeAllocator.js +0 -1
  865. package/lib/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
  866. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
  867. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  868. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
  869. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  870. package/lib/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
  871. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  872. package/lib/feature-libraries/modular-schema/discrepancies.js +106 -4
  873. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  874. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
  875. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  876. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
  877. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  878. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
  879. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  880. package/lib/feature-libraries/modular-schema/fieldKind.js +1 -2
  881. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  882. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
  883. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  884. package/lib/feature-libraries/modular-schema/genericFieldKind.js +56 -83
  885. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  886. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
  887. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  888. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js +6 -9
  889. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  890. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
  891. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  892. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js +4 -1
  893. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  894. package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
  895. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  896. package/lib/feature-libraries/modular-schema/index.js +1 -1
  897. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  898. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  899. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +43 -26
  900. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  901. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
  902. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  903. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +182 -222
  904. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  905. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
  906. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  907. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  908. package/lib/feature-libraries/node-key/nodeKey.d.ts +0 -4
  909. package/lib/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
  910. package/lib/feature-libraries/node-key/nodeKey.js +0 -2
  911. package/lib/feature-libraries/node-key/nodeKey.js.map +1 -1
  912. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
  913. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
  914. package/lib/feature-libraries/node-key/nodeKeyManager.js.map +1 -1
  915. package/lib/feature-libraries/object-forest/objectForest.d.ts +3 -2
  916. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  917. package/lib/feature-libraries/object-forest/objectForest.js +7 -15
  918. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  919. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  920. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  921. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  922. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  923. package/lib/feature-libraries/schemaBuilderBase.d.ts +2 -28
  924. package/lib/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
  925. package/lib/feature-libraries/schemaBuilderBase.js +2 -28
  926. package/lib/feature-libraries/schemaBuilderBase.js.map +1 -1
  927. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  928. package/lib/feature-libraries/sequence-field/compose.js +25 -22
  929. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  930. package/lib/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  931. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  932. package/lib/feature-libraries/sequence-field/formatV2.js +3 -3
  933. package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
  934. package/lib/feature-libraries/sequence-field/formatV3.d.ts +195 -0
  935. package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
  936. package/lib/feature-libraries/sequence-field/formatV3.js +19 -0
  937. package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -0
  938. package/lib/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
  939. package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  940. package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  941. package/lib/feature-libraries/sequence-field/index.d.ts +1 -1
  942. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  943. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  944. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  945. package/lib/feature-libraries/sequence-field/invert.js +22 -14
  946. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  947. package/lib/feature-libraries/sequence-field/markQueue.js +2 -2
  948. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  949. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
  950. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  951. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  952. package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  953. package/lib/feature-libraries/sequence-field/rebase.js +25 -7
  954. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  955. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  956. package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -3
  957. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  958. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  959. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +40 -6
  960. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  961. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
  962. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  963. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +55 -11
  964. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  965. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
  966. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
  967. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +81 -0
  968. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
  969. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  970. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
  971. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  972. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  973. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +5 -2
  974. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  975. package/lib/feature-libraries/sequence-field/types.d.ts +23 -4
  976. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  977. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  978. package/lib/feature-libraries/sequence-field/utils.d.ts +5 -4
  979. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  980. package/lib/feature-libraries/sequence-field/utils.js +67 -41
  981. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  982. package/lib/feature-libraries/storedToViewSchema.d.ts +0 -1
  983. package/lib/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  984. package/lib/feature-libraries/storedToViewSchema.js +0 -1
  985. package/lib/feature-libraries/storedToViewSchema.js.map +1 -1
  986. package/lib/feature-libraries/treeCursorUtils.d.ts +0 -6
  987. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  988. package/lib/feature-libraries/treeCursorUtils.js +9 -7
  989. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  990. package/lib/feature-libraries/treeTextCursor.d.ts +0 -2
  991. package/lib/feature-libraries/treeTextCursor.d.ts.map +1 -1
  992. package/lib/feature-libraries/treeTextCursor.js +0 -2
  993. package/lib/feature-libraries/treeTextCursor.js.map +1 -1
  994. package/lib/feature-libraries/typed-schema/flexList.d.ts +0 -3
  995. package/lib/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  996. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  997. package/lib/feature-libraries/typed-schema/index.d.ts +1 -1
  998. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  999. package/lib/feature-libraries/typed-schema/index.js +1 -1
  1000. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  1001. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  1002. package/lib/feature-libraries/typed-schema/schemaCollection.js +1 -5
  1003. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  1004. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
  1005. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  1006. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +1 -38
  1007. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  1008. package/lib/feature-libraries/typed-schema/view.d.ts +0 -1
  1009. package/lib/feature-libraries/typed-schema/view.d.ts.map +1 -1
  1010. package/lib/feature-libraries/typed-schema/view.js.map +1 -1
  1011. package/lib/index.d.ts +8 -9
  1012. package/lib/index.d.ts.map +1 -1
  1013. package/lib/index.js +4 -9
  1014. package/lib/index.js.map +1 -1
  1015. package/lib/internalTypes.d.ts +1 -1
  1016. package/lib/internalTypes.d.ts.map +1 -1
  1017. package/lib/internalTypes.js.map +1 -1
  1018. package/lib/packageVersion.d.ts +1 -1
  1019. package/lib/packageVersion.d.ts.map +1 -1
  1020. package/lib/packageVersion.js +1 -1
  1021. package/lib/packageVersion.js.map +1 -1
  1022. package/lib/public.d.ts +3 -1
  1023. package/lib/shared-tree/schematizeTree.d.ts +2 -11
  1024. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  1025. package/lib/shared-tree/schematizeTree.js +15 -4
  1026. package/lib/shared-tree/schematizeTree.js.map +1 -1
  1027. package/lib/shared-tree/schematizingTreeView.d.ts +4 -4
  1028. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  1029. package/lib/shared-tree/schematizingTreeView.js +3 -3
  1030. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  1031. package/lib/shared-tree/sharedTree.d.ts +9 -18
  1032. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  1033. package/lib/shared-tree/sharedTree.js +14 -11
  1034. package/lib/shared-tree/sharedTree.js.map +1 -1
  1035. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  1036. package/lib/shared-tree/sharedTreeChangeCodecs.js +4 -0
  1037. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  1038. package/lib/shared-tree/sharedTreeChangeEnricher.js +1 -1
  1039. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  1040. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
  1041. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  1042. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
  1043. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  1044. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  1045. package/lib/shared-tree/treeApi.js +4 -4
  1046. package/lib/shared-tree/treeApi.js.map +1 -1
  1047. package/lib/shared-tree/treeCheckout.d.ts +10 -6
  1048. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  1049. package/lib/shared-tree/treeCheckout.js +52 -7
  1050. package/lib/shared-tree/treeCheckout.js.map +1 -1
  1051. package/lib/shared-tree/treeView.d.ts +3 -6
  1052. package/lib/shared-tree/treeView.d.ts.map +1 -1
  1053. package/lib/shared-tree/treeView.js +4 -0
  1054. package/lib/shared-tree/treeView.js.map +1 -1
  1055. package/lib/shared-tree-core/branch.d.ts +6 -0
  1056. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  1057. package/lib/shared-tree-core/branch.js +14 -7
  1058. package/lib/shared-tree-core/branch.js.map +1 -1
  1059. package/lib/shared-tree-core/defaultResubmitMachine.js +4 -4
  1060. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  1061. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  1062. package/lib/shared-tree-core/editManagerCodecs.js +1 -0
  1063. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  1064. package/lib/shared-tree-core/editManagerFormat.d.ts +2 -2
  1065. package/lib/shared-tree-core/editManagerFormat.d.ts.map +1 -1
  1066. package/lib/shared-tree-core/editManagerFormat.js +6 -1
  1067. package/lib/shared-tree-core/editManagerFormat.js.map +1 -1
  1068. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  1069. package/lib/shared-tree-core/messageCodecs.js +1 -0
  1070. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  1071. package/lib/shared-tree-core/sharedTreeCore.d.ts +4 -0
  1072. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  1073. package/lib/shared-tree-core/sharedTreeCore.js +10 -2
  1074. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  1075. package/lib/simple-tree/api/create.d.ts +54 -0
  1076. package/lib/simple-tree/api/create.d.ts.map +1 -0
  1077. package/lib/simple-tree/api/create.js +92 -0
  1078. package/lib/simple-tree/api/create.js.map +1 -0
  1079. package/lib/simple-tree/api/index.d.ts +12 -0
  1080. package/lib/simple-tree/api/index.d.ts.map +1 -0
  1081. package/lib/simple-tree/api/index.js +13 -0
  1082. package/lib/simple-tree/api/index.js.map +1 -0
  1083. package/{dist/simple-tree → lib/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
  1084. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
  1085. package/lib/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
  1086. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -0
  1087. package/lib/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
  1088. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -0
  1089. package/lib/simple-tree/{schemaFactory.js → api/schemaFactory.js} +9 -8
  1090. package/lib/simple-tree/api/schemaFactory.js.map +1 -0
  1091. package/{dist/simple-tree → lib/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
  1092. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
  1093. package/lib/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
  1094. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
  1095. package/lib/simple-tree/api/testRecursiveDomain.d.ts +62 -0
  1096. package/lib/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
  1097. package/lib/simple-tree/api/testRecursiveDomain.js.map +1 -0
  1098. package/{dist/simple-tree → lib/simple-tree/api}/tree.d.ts +111 -20
  1099. package/lib/simple-tree/api/tree.d.ts.map +1 -0
  1100. package/lib/simple-tree/api/tree.js +165 -0
  1101. package/lib/simple-tree/api/tree.js.map +1 -0
  1102. package/lib/simple-tree/api/treeNodeApi.d.ts +87 -0
  1103. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -0
  1104. package/lib/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +32 -32
  1105. package/lib/simple-tree/api/treeNodeApi.js.map +1 -0
  1106. package/lib/simple-tree/api/verboseTree.d.ts +136 -0
  1107. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -0
  1108. package/lib/simple-tree/api/verboseTree.js +213 -0
  1109. package/lib/simple-tree/api/verboseTree.js.map +1 -0
  1110. package/lib/simple-tree/arrayNode.d.ts +3 -3
  1111. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  1112. package/lib/simple-tree/arrayNode.js +57 -54
  1113. package/lib/simple-tree/arrayNode.js.map +1 -1
  1114. package/lib/simple-tree/core/index.d.ts +10 -0
  1115. package/lib/simple-tree/core/index.d.ts.map +1 -0
  1116. package/lib/simple-tree/core/index.js +10 -0
  1117. package/lib/simple-tree/core/index.js.map +1 -0
  1118. package/{dist/simple-tree → lib/simple-tree/core}/schemaCaching.d.ts +2 -9
  1119. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -0
  1120. package/lib/simple-tree/{schemaCaching.js → core/schemaCaching.js} +1 -21
  1121. package/lib/simple-tree/core/schemaCaching.js.map +1 -0
  1122. package/lib/simple-tree/core/treeNodeKernel.d.ts +57 -0
  1123. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
  1124. package/lib/simple-tree/core/treeNodeKernel.js +121 -0
  1125. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -0
  1126. package/lib/simple-tree/core/treeNodeSchema.d.ts +149 -0
  1127. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
  1128. package/lib/simple-tree/core/treeNodeSchema.js +32 -0
  1129. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -0
  1130. package/lib/simple-tree/core/types.d.ts +178 -0
  1131. package/lib/simple-tree/core/types.d.ts.map +1 -0
  1132. package/lib/simple-tree/core/types.js +111 -0
  1133. package/lib/simple-tree/core/types.js.map +1 -0
  1134. package/lib/simple-tree/core/withType.d.ts +82 -0
  1135. package/lib/simple-tree/core/withType.d.ts.map +1 -0
  1136. package/lib/simple-tree/core/withType.js +36 -0
  1137. package/lib/simple-tree/core/withType.js.map +1 -0
  1138. package/lib/simple-tree/getJsonSchema.d.ts +55 -0
  1139. package/lib/simple-tree/getJsonSchema.d.ts.map +1 -0
  1140. package/lib/simple-tree/getJsonSchema.js +65 -0
  1141. package/lib/simple-tree/getJsonSchema.js.map +1 -0
  1142. package/lib/simple-tree/getSimpleFieldSchema.d.ts +14 -0
  1143. package/lib/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
  1144. package/lib/simple-tree/getSimpleFieldSchema.js +25 -0
  1145. package/lib/simple-tree/getSimpleFieldSchema.js.map +1 -0
  1146. package/lib/simple-tree/getSimpleSchema.d.ts +58 -0
  1147. package/lib/simple-tree/getSimpleSchema.d.ts.map +1 -0
  1148. package/lib/simple-tree/getSimpleSchema.js +64 -0
  1149. package/lib/simple-tree/getSimpleSchema.js.map +1 -0
  1150. package/lib/simple-tree/index.d.ts +12 -13
  1151. package/lib/simple-tree/index.d.ts.map +1 -1
  1152. package/lib/simple-tree/index.js +8 -11
  1153. package/lib/simple-tree/index.js.map +1 -1
  1154. package/lib/simple-tree/jsonSchema.d.ts +206 -0
  1155. package/lib/simple-tree/jsonSchema.d.ts.map +1 -0
  1156. package/lib/simple-tree/{nodeKeys.js → jsonSchema.js} +1 -1
  1157. package/lib/simple-tree/jsonSchema.js.map +1 -0
  1158. package/lib/simple-tree/leafNodeSchema.d.ts +1 -1
  1159. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  1160. package/lib/simple-tree/leafNodeSchema.js +1 -2
  1161. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  1162. package/lib/simple-tree/mapNode.d.ts +9 -3
  1163. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  1164. package/lib/simple-tree/mapNode.js +36 -36
  1165. package/lib/simple-tree/mapNode.js.map +1 -1
  1166. package/lib/simple-tree/objectNode.d.ts +18 -16
  1167. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  1168. package/lib/simple-tree/objectNode.js +36 -34
  1169. package/lib/simple-tree/objectNode.js.map +1 -1
  1170. package/lib/simple-tree/objectNodeTypes.d.ts +38 -0
  1171. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -0
  1172. package/lib/simple-tree/objectNodeTypes.js +15 -0
  1173. package/lib/simple-tree/objectNodeTypes.js.map +1 -0
  1174. package/lib/simple-tree/proxies.d.ts +6 -25
  1175. package/lib/simple-tree/proxies.d.ts.map +1 -1
  1176. package/lib/simple-tree/proxies.js +50 -75
  1177. package/lib/simple-tree/proxies.js.map +1 -1
  1178. package/lib/simple-tree/proxyBinding.d.ts +46 -19
  1179. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  1180. package/lib/simple-tree/proxyBinding.js +95 -39
  1181. package/lib/simple-tree/proxyBinding.js.map +1 -1
  1182. package/lib/simple-tree/schemaTypes.d.ts +10 -159
  1183. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  1184. package/lib/simple-tree/schemaTypes.js +9 -41
  1185. package/lib/simple-tree/schemaTypes.js.map +1 -1
  1186. package/lib/simple-tree/simpleSchema.d.ts +124 -0
  1187. package/lib/simple-tree/simpleSchema.d.ts.map +1 -0
  1188. package/lib/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
  1189. package/lib/simple-tree/simpleSchema.js.map +1 -0
  1190. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
  1191. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
  1192. package/lib/simple-tree/simpleSchemaToJsonSchema.js +142 -0
  1193. package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
  1194. package/lib/simple-tree/toFlexSchema.d.ts +4 -12
  1195. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  1196. package/lib/simple-tree/toFlexSchema.js +9 -18
  1197. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  1198. package/lib/simple-tree/toMapTree.d.ts +39 -39
  1199. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  1200. package/lib/simple-tree/toMapTree.js +214 -158
  1201. package/lib/simple-tree/toMapTree.js.map +1 -1
  1202. package/lib/simple-tree/{types.d.ts → treeNodeValid.d.ts} +2 -80
  1203. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -0
  1204. package/lib/simple-tree/{types.js → treeNodeValid.js} +94 -96
  1205. package/lib/simple-tree/treeNodeValid.js.map +1 -0
  1206. package/lib/simple-tree/typesUnsafe.d.ts +35 -4
  1207. package/lib/simple-tree/typesUnsafe.d.ts.map +1 -1
  1208. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  1209. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
  1210. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
  1211. package/lib/simple-tree/viewSchemaToSimpleSchema.js +167 -0
  1212. package/lib/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
  1213. package/lib/util/brand.d.ts +0 -3
  1214. package/lib/util/brand.d.ts.map +1 -1
  1215. package/lib/util/brand.js +1 -2
  1216. package/lib/util/brand.js.map +1 -1
  1217. package/lib/util/brandedMap.d.ts +0 -5
  1218. package/lib/util/brandedMap.d.ts.map +1 -1
  1219. package/lib/util/brandedMap.js +0 -1
  1220. package/lib/util/brandedMap.js.map +1 -1
  1221. package/lib/util/breakable.js +1 -1
  1222. package/lib/util/breakable.js.map +1 -1
  1223. package/lib/util/idAllocator.d.ts +0 -2
  1224. package/lib/util/idAllocator.d.ts.map +1 -1
  1225. package/lib/util/idAllocator.js +0 -1
  1226. package/lib/util/idAllocator.js.map +1 -1
  1227. package/lib/util/index.d.ts +2 -2
  1228. package/lib/util/index.d.ts.map +1 -1
  1229. package/lib/util/index.js +2 -2
  1230. package/lib/util/index.js.map +1 -1
  1231. package/lib/util/nestedMap.d.ts +5 -19
  1232. package/lib/util/nestedMap.d.ts.map +1 -1
  1233. package/lib/util/nestedMap.js +15 -16
  1234. package/lib/util/nestedMap.js.map +1 -1
  1235. package/lib/util/opaque.d.ts +0 -4
  1236. package/lib/util/opaque.d.ts.map +1 -1
  1237. package/lib/util/opaque.js +0 -2
  1238. package/lib/util/opaque.js.map +1 -1
  1239. package/lib/util/rangeMap.d.ts +0 -2
  1240. package/lib/util/rangeMap.d.ts.map +1 -1
  1241. package/lib/util/rangeMap.js +4 -3
  1242. package/lib/util/rangeMap.js.map +1 -1
  1243. package/lib/util/transactionResult.d.ts +0 -1
  1244. package/lib/util/transactionResult.d.ts.map +1 -1
  1245. package/lib/util/transactionResult.js +0 -1
  1246. package/lib/util/transactionResult.js.map +1 -1
  1247. package/lib/util/typeCheck.d.ts +2 -20
  1248. package/lib/util/typeCheck.d.ts.map +1 -1
  1249. package/lib/util/typeCheck.js.map +1 -1
  1250. package/lib/util/typeCheckTests.d.ts +4 -4
  1251. package/lib/util/typeCheckTests.d.ts.map +1 -1
  1252. package/lib/util/typeCheckTests.js.map +1 -1
  1253. package/lib/util/typeUtils.d.ts +0 -7
  1254. package/lib/util/typeUtils.d.ts.map +1 -1
  1255. package/lib/util/typeUtils.js.map +1 -1
  1256. package/lib/util/utils.d.ts +6 -8
  1257. package/lib/util/utils.d.ts.map +1 -1
  1258. package/lib/util/utils.js +12 -4
  1259. package/lib/util/utils.js.map +1 -1
  1260. package/package.json +36 -25
  1261. package/src/codec/discriminatedUnions.ts +20 -10
  1262. package/src/codec/index.ts +5 -1
  1263. package/src/core/forest/README.md +4 -2
  1264. package/src/core/forest/editableForest.ts +10 -7
  1265. package/src/core/forest/forest.ts +0 -6
  1266. package/src/core/index.ts +2 -2
  1267. package/src/core/rebase/changeRebaser.ts +0 -4
  1268. package/src/core/rebase/index.ts +0 -2
  1269. package/src/core/rebase/types.ts +1 -23
  1270. package/src/core/rebase/utils.ts +13 -11
  1271. package/src/core/schema-stored/multiplicity.ts +0 -1
  1272. package/src/core/schema-stored/schema.ts +0 -7
  1273. package/src/core/schema-stored/storedSchemaRepository.ts +0 -3
  1274. package/src/core/schema-view/view.ts +0 -3
  1275. package/src/core/tree/anchorSet.ts +21 -17
  1276. package/src/core/tree/cursor.ts +1 -6
  1277. package/src/core/tree/delta.ts +0 -11
  1278. package/src/core/tree/detachedFieldIndex.ts +217 -35
  1279. package/src/core/tree/detachedFieldIndexCodec.ts +21 -11
  1280. package/src/core/tree/detachedFieldIndexFormat.ts +1 -1
  1281. package/src/core/tree/detachedFieldIndexTypes.ts +40 -5
  1282. package/src/core/tree/index.ts +3 -2
  1283. package/src/core/tree/mapTree.ts +45 -4
  1284. package/src/core/tree/pathTree.ts +0 -11
  1285. package/src/core/tree/treeTextFormat.ts +3 -2
  1286. package/src/core/tree/types.ts +0 -11
  1287. package/src/core/tree/visitDelta.ts +59 -19
  1288. package/src/core/tree/visitPath.ts +0 -2
  1289. package/src/core/tree/visitorUtils.ts +7 -5
  1290. package/src/domains/index.ts +3 -0
  1291. package/src/domains/json/index.ts +7 -1
  1292. package/src/domains/json/jsonCursor.ts +113 -6
  1293. package/src/domains/json/jsonDomainSchema.ts +4 -5
  1294. package/src/domains/leafDomain.ts +0 -1
  1295. package/src/domains/schemaBuilder.ts +0 -22
  1296. package/src/events/events.ts +0 -4
  1297. package/src/feature-libraries/chunked-forest/README.md +9 -1
  1298. package/src/feature-libraries/chunked-forest/basicChunk.ts +14 -9
  1299. package/src/feature-libraries/chunked-forest/chunk.ts +1 -1
  1300. package/src/feature-libraries/chunked-forest/chunkTree.ts +4 -4
  1301. package/src/feature-libraries/chunked-forest/chunkedForest.ts +8 -6
  1302. package/src/feature-libraries/chunked-forest/codec/chunkCodecUtilities.ts +2 -2
  1303. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +9 -6
  1304. package/src/feature-libraries/chunked-forest/uniformChunk.ts +6 -4
  1305. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +18 -46
  1306. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +11 -6
  1307. package/src/feature-libraries/default-schema/defaultSchema.ts +0 -1
  1308. package/src/feature-libraries/default-schema/index.ts +1 -1
  1309. package/src/feature-libraries/default-schema/schemaChecker.ts +6 -0
  1310. package/src/feature-libraries/editableTreeBinder.ts +7 -79
  1311. package/src/feature-libraries/fieldGenerator.ts +0 -3
  1312. package/src/feature-libraries/flex-map-tree/index.ts +2 -1
  1313. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +235 -328
  1314. package/src/feature-libraries/flex-tree/context.ts +0 -1
  1315. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +27 -376
  1316. package/src/feature-libraries/flex-tree/index.ts +7 -2
  1317. package/src/feature-libraries/flex-tree/lazyEntity.ts +0 -3
  1318. package/src/feature-libraries/flex-tree/lazyField.ts +52 -234
  1319. package/src/feature-libraries/flex-tree/lazyNode.ts +6 -108
  1320. package/src/feature-libraries/flex-tree/treeEvents.ts +0 -2
  1321. package/src/feature-libraries/flex-tree/utilities.ts +6 -1
  1322. package/src/feature-libraries/forest-summary/codec.ts +3 -3
  1323. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -0
  1324. package/src/feature-libraries/index.ts +8 -35
  1325. package/src/feature-libraries/mapTreeCursor.ts +13 -4
  1326. package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -4
  1327. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +0 -2
  1328. package/src/feature-libraries/modular-schema/discrepancies.ts +120 -4
  1329. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +0 -8
  1330. package/src/feature-libraries/modular-schema/fieldKind.ts +1 -3
  1331. package/src/feature-libraries/modular-schema/genericFieldKind.ts +69 -92
  1332. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +7 -14
  1333. package/src/feature-libraries/modular-schema/genericFieldKindTypes.ts +6 -15
  1334. package/src/feature-libraries/modular-schema/index.ts +2 -2
  1335. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +69 -35
  1336. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +350 -354
  1337. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +7 -14
  1338. package/src/feature-libraries/node-key/nodeKey.ts +0 -4
  1339. package/src/feature-libraries/node-key/nodeKeyManager.ts +0 -1
  1340. package/src/feature-libraries/object-forest/objectForest.ts +8 -16
  1341. package/src/feature-libraries/schemaBuilderBase.ts +1 -49
  1342. package/src/feature-libraries/sequence-field/compose.ts +41 -20
  1343. package/src/feature-libraries/sequence-field/formatV2.ts +3 -3
  1344. package/src/feature-libraries/sequence-field/formatV3.ts +65 -0
  1345. package/src/feature-libraries/sequence-field/helperTypes.ts +33 -0
  1346. package/src/feature-libraries/sequence-field/index.ts +1 -0
  1347. package/src/feature-libraries/sequence-field/invert.ts +28 -18
  1348. package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
  1349. package/src/feature-libraries/sequence-field/moveEffectTable.ts +2 -2
  1350. package/src/feature-libraries/sequence-field/rebase.ts +30 -13
  1351. package/src/feature-libraries/sequence-field/replaceRevisions.ts +27 -3
  1352. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +52 -7
  1353. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +92 -19
  1354. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +134 -0
  1355. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +2 -0
  1356. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +8 -2
  1357. package/src/feature-libraries/sequence-field/types.ts +24 -4
  1358. package/src/feature-libraries/sequence-field/utils.ts +78 -50
  1359. package/src/feature-libraries/storedToViewSchema.ts +0 -1
  1360. package/src/feature-libraries/treeCursorUtils.ts +11 -11
  1361. package/src/feature-libraries/treeTextCursor.ts +0 -2
  1362. package/src/feature-libraries/typed-schema/flexList.ts +0 -3
  1363. package/src/feature-libraries/typed-schema/index.ts +0 -2
  1364. package/src/feature-libraries/typed-schema/schemaCollection.ts +0 -5
  1365. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +2 -68
  1366. package/src/feature-libraries/typed-schema/view.ts +0 -1
  1367. package/src/index.ts +27 -245
  1368. package/src/internalTypes.ts +1 -0
  1369. package/src/packageVersion.ts +1 -1
  1370. package/src/shared-tree/schematizeTree.ts +25 -21
  1371. package/src/shared-tree/schematizingTreeView.ts +6 -6
  1372. package/src/shared-tree/sharedTree.ts +16 -40
  1373. package/src/shared-tree/sharedTreeChangeCodecs.ts +8 -0
  1374. package/src/shared-tree/sharedTreeChangeEnricher.ts +1 -1
  1375. package/src/shared-tree/sharedTreeChangeFamily.ts +3 -3
  1376. package/src/shared-tree/sharedTreeEditBuilder.ts +0 -2
  1377. package/src/shared-tree/treeApi.ts +4 -4
  1378. package/src/shared-tree/treeCheckout.ts +61 -12
  1379. package/src/shared-tree/treeView.ts +8 -6
  1380. package/src/shared-tree-core/branch.ts +29 -8
  1381. package/src/shared-tree-core/defaultResubmitMachine.ts +4 -4
  1382. package/src/shared-tree-core/editManagerCodecs.ts +1 -0
  1383. package/src/shared-tree-core/editManagerFormat.ts +7 -2
  1384. package/src/shared-tree-core/messageCodecs.ts +2 -1
  1385. package/src/shared-tree-core/sharedTreeCore.ts +12 -3
  1386. package/src/simple-tree/ProxyBinding.md +2 -0
  1387. package/src/simple-tree/api/README.md +7 -0
  1388. package/src/simple-tree/api/create.ts +179 -0
  1389. package/src/simple-tree/api/index.ts +36 -0
  1390. package/src/simple-tree/{schemaCreationUtilities.ts → api/schemaCreationUtilities.ts} +13 -5
  1391. package/src/simple-tree/{schemaFactory.ts → api/schemaFactory.ts} +36 -34
  1392. package/src/simple-tree/{schemaFactoryRecursive.ts → api/schemaFactoryRecursive.ts} +47 -10
  1393. package/src/simple-tree/{testRecursiveDomain.ts → api/testRecursiveDomain.ts} +3 -1
  1394. package/src/simple-tree/{tree.ts → api/tree.ts} +250 -35
  1395. package/src/simple-tree/{treeNodeApi.ts → api/treeNodeApi.ts} +57 -128
  1396. package/src/simple-tree/api/verboseTree.ts +415 -0
  1397. package/src/simple-tree/arrayNode.ts +101 -99
  1398. package/src/simple-tree/core/README.md +11 -0
  1399. package/src/simple-tree/core/index.ts +33 -0
  1400. package/src/simple-tree/{schemaCaching.ts → core/schemaCaching.ts} +3 -37
  1401. package/src/simple-tree/core/treeNodeKernel.ts +141 -0
  1402. package/src/simple-tree/core/treeNodeSchema.ts +184 -0
  1403. package/src/simple-tree/core/types.ts +255 -0
  1404. package/src/simple-tree/core/withType.ts +89 -0
  1405. package/src/simple-tree/getJsonSchema.ts +70 -0
  1406. package/src/simple-tree/getSimpleFieldSchema.ts +36 -0
  1407. package/src/simple-tree/getSimpleSchema.ts +69 -0
  1408. package/src/simple-tree/index.ts +58 -33
  1409. package/src/simple-tree/jsonSchema.ts +230 -0
  1410. package/src/simple-tree/leafNodeSchema.ts +6 -3
  1411. package/src/simple-tree/mapNode.ts +56 -55
  1412. package/src/simple-tree/objectNode.ts +66 -90
  1413. package/src/simple-tree/objectNodeTypes.ts +68 -0
  1414. package/src/simple-tree/proxies.ts +56 -93
  1415. package/src/simple-tree/proxyBinding.ts +134 -56
  1416. package/src/simple-tree/schemaTypes.ts +29 -194
  1417. package/src/simple-tree/simpleSchema.ts +138 -0
  1418. package/src/simple-tree/simpleSchemaToJsonSchema.ts +178 -0
  1419. package/src/simple-tree/toFlexSchema.ts +9 -42
  1420. package/src/simple-tree/toMapTree.ts +270 -296
  1421. package/src/simple-tree/{types.ts → treeNodeValid.ts} +166 -151
  1422. package/src/simple-tree/typesUnsafe.ts +51 -5
  1423. package/src/simple-tree/viewSchemaToSimpleSchema.ts +209 -0
  1424. package/src/util/brand.ts +1 -4
  1425. package/src/util/brandedMap.ts +0 -5
  1426. package/src/util/breakable.ts +1 -1
  1427. package/src/util/idAllocator.ts +0 -2
  1428. package/src/util/index.ts +3 -0
  1429. package/src/util/nestedMap.ts +23 -20
  1430. package/src/util/opaque.ts +0 -4
  1431. package/src/util/rangeMap.ts +5 -5
  1432. package/src/util/transactionResult.ts +0 -1
  1433. package/src/util/typeCheck.ts +2 -20
  1434. package/src/util/typeCheckTests.ts +4 -4
  1435. package/src/util/typeUtils.ts +0 -7
  1436. package/src/util/utils.ts +13 -8
  1437. package/tsconfig.json +0 -1
  1438. package/dist/feature-libraries/contextuallyTyped.d.ts +0 -209
  1439. package/dist/feature-libraries/contextuallyTyped.d.ts.map +0 -1
  1440. package/dist/feature-libraries/contextuallyTyped.js +0 -328
  1441. package/dist/feature-libraries/contextuallyTyped.js.map +0 -1
  1442. package/dist/feature-libraries/schema-aware/index.d.ts +0 -6
  1443. package/dist/feature-libraries/schema-aware/index.d.ts.map +0 -1
  1444. package/dist/feature-libraries/schema-aware/index.js.map +0 -1
  1445. package/dist/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
  1446. package/dist/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
  1447. package/dist/feature-libraries/schema-aware/schemaAware.js.map +0 -1
  1448. package/dist/simple-tree/nodeKeys.d.ts +0 -41
  1449. package/dist/simple-tree/nodeKeys.d.ts.map +0 -1
  1450. package/dist/simple-tree/nodeKeys.js +0 -7
  1451. package/dist/simple-tree/nodeKeys.js.map +0 -1
  1452. package/dist/simple-tree/schemaCaching.d.ts.map +0 -1
  1453. package/dist/simple-tree/schemaCaching.js.map +0 -1
  1454. package/dist/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
  1455. package/dist/simple-tree/schemaCreationUtilities.js.map +0 -1
  1456. package/dist/simple-tree/schemaFactory.d.ts.map +0 -1
  1457. package/dist/simple-tree/schemaFactory.js.map +0 -1
  1458. package/dist/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
  1459. package/dist/simple-tree/schemaFactoryRecursive.js.map +0 -1
  1460. package/dist/simple-tree/testRecursiveDomain.d.ts +0 -61
  1461. package/dist/simple-tree/testRecursiveDomain.d.ts.map +0 -1
  1462. package/dist/simple-tree/testRecursiveDomain.js.map +0 -1
  1463. package/dist/simple-tree/tree.d.ts.map +0 -1
  1464. package/dist/simple-tree/tree.js +0 -73
  1465. package/dist/simple-tree/tree.js.map +0 -1
  1466. package/dist/simple-tree/treeNodeApi.d.ts +0 -159
  1467. package/dist/simple-tree/treeNodeApi.d.ts.map +0 -1
  1468. package/dist/simple-tree/treeNodeApi.js.map +0 -1
  1469. package/dist/simple-tree/types.d.ts.map +0 -1
  1470. package/dist/simple-tree/types.js.map +0 -1
  1471. package/lib/feature-libraries/contextuallyTyped.d.ts +0 -209
  1472. package/lib/feature-libraries/contextuallyTyped.d.ts.map +0 -1
  1473. package/lib/feature-libraries/contextuallyTyped.js +0 -311
  1474. package/lib/feature-libraries/contextuallyTyped.js.map +0 -1
  1475. package/lib/feature-libraries/schema-aware/index.d.ts +0 -6
  1476. package/lib/feature-libraries/schema-aware/index.d.ts.map +0 -1
  1477. package/lib/feature-libraries/schema-aware/index.js +0 -6
  1478. package/lib/feature-libraries/schema-aware/index.js.map +0 -1
  1479. package/lib/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
  1480. package/lib/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
  1481. package/lib/feature-libraries/schema-aware/schemaAware.js.map +0 -1
  1482. package/lib/simple-tree/nodeKeys.d.ts +0 -41
  1483. package/lib/simple-tree/nodeKeys.d.ts.map +0 -1
  1484. package/lib/simple-tree/nodeKeys.js.map +0 -1
  1485. package/lib/simple-tree/schemaCaching.d.ts.map +0 -1
  1486. package/lib/simple-tree/schemaCaching.js.map +0 -1
  1487. package/lib/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
  1488. package/lib/simple-tree/schemaCreationUtilities.js.map +0 -1
  1489. package/lib/simple-tree/schemaFactory.d.ts.map +0 -1
  1490. package/lib/simple-tree/schemaFactory.js.map +0 -1
  1491. package/lib/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
  1492. package/lib/simple-tree/schemaFactoryRecursive.js.map +0 -1
  1493. package/lib/simple-tree/testRecursiveDomain.d.ts +0 -61
  1494. package/lib/simple-tree/testRecursiveDomain.d.ts.map +0 -1
  1495. package/lib/simple-tree/testRecursiveDomain.js.map +0 -1
  1496. package/lib/simple-tree/tree.d.ts.map +0 -1
  1497. package/lib/simple-tree/tree.js +0 -66
  1498. package/lib/simple-tree/tree.js.map +0 -1
  1499. package/lib/simple-tree/treeNodeApi.d.ts +0 -159
  1500. package/lib/simple-tree/treeNodeApi.d.ts.map +0 -1
  1501. package/lib/simple-tree/treeNodeApi.js.map +0 -1
  1502. package/lib/simple-tree/types.d.ts.map +0 -1
  1503. package/lib/simple-tree/types.js.map +0 -1
  1504. package/src/feature-libraries/contextuallyTyped.ts +0 -582
  1505. package/src/feature-libraries/schema-aware/README.md +0 -19
  1506. package/src/feature-libraries/schema-aware/index.ts +0 -16
  1507. package/src/feature-libraries/schema-aware/schemaAware.ts +0 -135
  1508. package/src/simple-tree/nodeKeys.ts +0 -42
  1509. /package/dist/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
  1510. /package/lib/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
@@ -2,19 +2,15 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert } from "@fluidframework/core-utils/internal";
5
+ import { assert, oob } from "@fluidframework/core-utils/internal";
6
6
  import { topDownPath, } from "../core/index.js";
7
7
  import { brand, getOrCreate } from "../util/index.js";
8
8
  /**
9
9
  * Index symbol for syntax tree
10
- *
11
- * @internal
12
10
  */
13
11
  export const indexSymbol = Symbol("flex-tree-binder:index");
14
12
  /**
15
13
  * Enumeration of binding categories
16
- *
17
- * @internal
18
14
  */
19
15
  export const BindingType = {
20
16
  Remove: "remove",
@@ -133,7 +129,8 @@ class AbstractPathVisitor {
133
129
  }
134
130
  }
135
131
  getListeners(contextType, downPath) {
136
- const foundRoot = this.findRoot(contextType, downPath[0].field);
132
+ const firstDownPath = downPath[0] ?? oob();
133
+ const foundRoot = this.findRoot(contextType, firstDownPath.field);
137
134
  if (foundRoot === undefined) {
138
135
  return undefined;
139
136
  }
@@ -295,8 +292,7 @@ class BufferingPathVisitor extends AbstractPathVisitor {
295
292
  const batchEvents = [];
296
293
  const collected = new Set();
297
294
  if (this.hasRegisteredContextType(BindingType.Batch)) {
298
- for (let i = 0; i < sortedQueue.length; i++) {
299
- const event = sortedQueue[i];
295
+ for (const [i, event] of sortedQueue.entries()) {
300
296
  const current = toDownPath(event.path);
301
297
  const listeners = this.getListeners(BindingType.Batch, current);
302
298
  if (listeners !== undefined && listeners.size > 0) {
@@ -314,11 +310,10 @@ class BufferingPathVisitor extends AbstractPathVisitor {
314
310
  events: batchEvents,
315
311
  });
316
312
  }
317
- for (let i = 0; i < sortedQueue.length; i++) {
313
+ for (const [i, { listeners, ...context }] of sortedQueue.entries()) {
318
314
  if (batchEventIndices.has(i)) {
319
315
  continue;
320
316
  }
321
- const { listeners, ...context } = sortedQueue[i];
322
317
  for (const listener of listeners) {
323
318
  listener({ ...context });
324
319
  }
@@ -343,7 +338,7 @@ class AbstractDataBinder {
343
338
  // TODO: validate BindPath semantics against the schema
344
339
  const visitor = getOrCreate(this.visitors, anchor, () => {
345
340
  const newVisitor = this.visitorFactory(anchor);
346
- this.unregisterHandles.add(anchor.on("subtreeChanging", (upPath) => {
341
+ this.unregisterHandles.add(anchor.anchorNode.on("subtreeChanging", (upPath) => {
347
342
  assert(newVisitor !== undefined, 0x6dc /* visitor expected to be defined */);
348
343
  if (!this.visitorLocations.has(newVisitor)) {
349
344
  this.visitorLocations.set(newVisitor, upPath);
@@ -441,8 +436,6 @@ class InvalidateDataBinder extends AbstractDataBinder {
441
436
  }
442
437
  /**
443
438
  * Compute a top-town {@link DownPath} from an {@link UpPath}.
444
- *
445
- * @internal
446
439
  */
447
440
  export function toDownPath(upPath) {
448
441
  const downPath = topDownPath(upPath);
@@ -454,24 +447,18 @@ export function toDownPath(upPath) {
454
447
  }
455
448
  /**
456
449
  * Create a buffering data binder.
457
- *
458
- * @internal
459
450
  */
460
451
  export function createDataBinderBuffering(view, options) {
461
452
  return new BufferingDataBinder(view, options);
462
453
  }
463
454
  /**
464
455
  * Create a direct data binder.
465
- *
466
- * @internal
467
456
  */
468
457
  export function createDataBinderDirect(view, options) {
469
458
  return new DirectDataBinder(view, options);
470
459
  }
471
460
  /**
472
461
  * Create an invalidating data binder.
473
- *
474
- * @internal
475
462
  */
476
463
  export function createDataBinderInvalidating(view, options) {
477
464
  return new InvalidateDataBinder(view, options);
@@ -479,8 +466,6 @@ export function createDataBinderInvalidating(view, options) {
479
466
  /**
480
467
  * Create binder options. If not specified, the default values are:
481
468
  * - sortFn: no sorting
482
- *
483
- * @internal
484
469
  */
485
470
  export function createBinderOptions({ sortFn, }) {
486
471
  return { sortFn };
@@ -490,8 +475,6 @@ export function createBinderOptions({ sortFn, }) {
490
475
  * - sortFn: no sorting
491
476
  * - sortAnchorsFn: no sorting
492
477
  * - autoFlush: true
493
- *
494
- * @internal
495
478
  */
496
479
  export function createFlushableBinderOptions({ sortFn, sortAnchorsFn, autoFlush = true, autoFlushPolicy, }) {
497
480
  return {
@@ -506,7 +489,6 @@ export function createFlushableBinderOptions({ sortFn, sortAnchorsFn, autoFlush
506
489
  *
507
490
  * @param fns - a list of compare functions
508
491
  * @returns a compare function that can be used for sorting
509
- * @internal
510
492
  */
511
493
  export function comparePipeline(...fns) {
512
494
  return (a, b) => {
@@ -534,12 +516,11 @@ function nativeSort(arr, compareFn) {
534
516
  * The syntax tree is a compact representation of related {@link BindPath}s.
535
517
  * The match policy can be specified. If not specified, the default value is "path".
536
518
  * @returns a {@link BindPolicy} object
537
- * @internal
538
519
  */
539
520
  export function compileSyntaxTree(syntaxTree, matchPolicy) {
540
521
  const entries = Object.entries(syntaxTree);
541
522
  if (entries.length === 1) {
542
- const [fieldName, childNode] = entries[0];
523
+ const [fieldName, childNode] = entries[0] ?? oob();
543
524
  const fieldKey = brand(fieldName);
544
525
  const bindTree = compileSyntaxTreeNode(childNode, fieldKey);
545
526
  return { matchPolicy: matchPolicy ?? "path", bindTree };
@@ -1 +1 @@
1
- {"version":3,"file":"editableTreeBinder.js","sourceRoot":"","sources":["../../src/feature-libraries/editableTreeBinder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EASN,WAAW,GACX,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAuLtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;AA0C5D;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,YAAY,EAAE,cAAc;IAC5B,KAAK,EAAE,OAAO;CACL,CAAC;AAyEX;;;GAGG;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qBAAqB,CAAC,IAA2B,EAAE,WAAqB;IAChF,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;IACtE,MAAM,QAAQ,GAAa;QAC1B,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC;KACxB,CAAC;IACF,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC/C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACjD,MAAM,QAAQ,GAAa,KAAK,CAAC,GAAG,CAAC,CAAC;QACtC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAChE,CAAC;IACD,OAAO;QACN,GAAG,QAAQ;QACX,QAAQ;KACR,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype DetachedPlaceUpPath,\n\ttype DetachedRangeUpPath,\n\ttype FieldKey,\n\ttype PathVisitor,\n\ttype PlaceUpPath,\n\ttype ProtoNodes,\n\ttype RangeUpPath,\n\ttype UpPath,\n\ttopDownPath,\n} from \"../core/index.js\";\nimport type { Listeners, Listenable } from \"../events/index.js\";\nimport { brand, getOrCreate } from \"../util/index.js\";\n\nimport type { FlexTreeNode } from \"./flex-tree/index.js\";\n\n// TODO:\n// Tests for this file were removed along with the old editable-tree implementation in the commit that includes this note.\n// They were a bit heavily tied to the testing patterns specific to the old editable-tree and will need significant changes to be restored.\n\n/**\n * Binder events reflecting atomic data operations\n * @internal\n */\nexport interface OperationBinderEvents {\n\tremove(context: RemoveBindingContext): void;\n\tinsert(context: InsertBindingContext): void;\n\tbatch(context: BatchBindingContext): void;\n}\n\n/**\n * Binder events signaling state invalidation\n * @internal\n */\nexport interface InvalidationBinderEvents {\n\tinvalidation(context: InvalidationBindingContext): void;\n}\n\n/**\n * Compare function, generic.\n *\n * @internal\n */\nexport type CompareFunction<T> = (a: T, b: T) => number;\n\n/**\n * Compare function for binder events.\n *\n * @internal\n */\nexport type BinderEventsCompare = CompareFunction<VisitorBindingContext>;\n\n/**\n * Compare function for anchors.\n *\n * @internal\n */\nexport type AnchorsCompare = CompareFunction<UpPath>;\n\n/**\n * Options to configure binder behavior.\n *\n * TODO: add more options:\n * `filterFn?: (context: BindingContext) => boolean;`\n * `pathPolicy?: \"relative\" | \"absolute\";`\n * @internal\n */\nexport interface BinderOptions {\n\tsortFn?: BinderEventsCompare;\n}\n\n/**\n * Specialized binder options for flushable binders.\n *\n * @internal\n */\nexport interface FlushableBinderOptions<E extends Listeners<E>> extends BinderOptions {\n\tautoFlush: boolean;\n\tautoFlushPolicy: keyof Listeners<E>;\n\tsortAnchorsFn?: AnchorsCompare;\n}\n\n/**\n * Match policy for binding: subtree or path.\n *\n * - `subtree` match policy means that path filtering would return events matching the exact path and its subpaths,\n * ie. changes to (nested) children would be allowed to bubble up to parent listeners.\n * - {@link SubtreePolicy} match policy is equivalent with `subtree` match policy, while allowing to specify a maximum\n * depth for the subtree.\n * - `path` match policy means that path filtering would return events matching the _exact_ path only. In this case\n * _exact_ semantics include interpreting an `undefined` _index_ field in the {@link PathStep} as a wildcard.\n *\n *\n * @internal\n */\nexport type MatchPolicy = SubtreePolicy | \"subtree\" | \"path\";\n\n/**\n * Subtree match policy where max depth can be specified.\n *\n * @internal\n */\nexport interface SubtreePolicy {\n\tmaxDepth: number;\n}\n\n/**\n * The data binder interface\n *\n * @internal\n */\nexport interface DataBinder<B extends OperationBinderEvents | InvalidationBinderEvents> {\n\t/**\n\t * Register an event listener\n\t *\n\t * @param anchor - The anchor to register the listener on\n\t * @param eventType - The {@link BindingType} to listen for.\n\t * @param eventTrees - The {@link BindPolicy}s to filter on.\n\t * @param listener - The listener to register\n\t */\n\tregister<K extends keyof Listeners<B>>(\n\t\tanchor: FlexTreeNode,\n\t\teventType: K,\n\t\teventTrees: BindPolicy[],\n\t\tlistener?: B[K],\n\t): void;\n\n\t/**\n\t * Unregister all listeners.\n\t */\n\tunregisterAll(): void;\n}\n\n/**\n * An interface describing the ability to flush.\n *\n * @internal\n */\nexport interface Flushable<T> {\n\tflush(): T;\n}\n\n/**\n * An interface describing a flushable data binder.\n *\n * @internal\n */\nexport interface FlushableDataBinder<\n\tB extends OperationBinderEvents | InvalidationBinderEvents,\n> extends DataBinder<B>,\n\t\tFlushable<FlushableDataBinder<B>> {}\n\n/**\n * A step in a bind path\n *\n * @internal\n */\nexport interface PathStep {\n\t/**\n\t * The field being traversed\n\t */\n\treadonly field: FieldKey;\n\n\t/**\n\t * The index of the element being navigated to\n\t */\n\treadonly index?: number;\n}\n\n/**\n * The default type for a bind tree\n *\n * @internal\n */\nexport type BindTreeDefault = BindTree;\n\n/**\n * A bind tree is a compact representation of related {@link BindPath}s.\n *\n * @internal\n */\nexport interface BindTree<T = BindTreeDefault> extends PathStep {\n\treadonly children: Map<FieldKey, T>;\n}\n\n/**\n * A bind policy is a combination of a {@link BindTree} and a {@link MatchPolicy}.\n *\n * @internal\n */\nexport interface BindPolicy {\n\treadonly bindTree: BindTree;\n\treadonly matchPolicy: MatchPolicy;\n}\n\n/**\n * Index symbol for syntax tree\n *\n * @internal\n */\nexport const indexSymbol = Symbol(\"flex-tree-binder:index\");\n\n/**\n * A syntax node for the bind language\n *\n * The bind language is a compact representation of related {@link BindPath}s. It can be used to\n * simplify usage and construction of {@link BindTree}s.\n *\n * see {@link BindTree}\n * see {@link compileSyntaxTree}\n *\n * @internal\n */\nexport interface BindSyntaxTree {\n\treadonly [indexSymbol]?: number;\n\treadonly [key: string]: true | BindSyntaxTree;\n}\n\n/**\n * A top down path in a bind or path tree is a collection of {@link PathStep}s\n *\n * see {@link BindTree}\n * see {@link UpPath}\n *\n * @internal\n */\nexport type DownPath = PathStep[];\n\n/**\n * A bind path is a top down path in a bind tree\n *\n * @internal\n */\nexport type BindPath = DownPath;\n\n/**\n * A binding context specialized for {@link PathVisitor} triggered binding events.\n *\n * @internal\n */\nexport type VisitorBindingContext = RemoveBindingContext | InsertBindingContext;\n\n/**\n * Enumeration of binding categories\n *\n * @internal\n */\nexport const BindingType = {\n\tRemove: \"remove\",\n\tInsert: \"insert\",\n\tInvalidation: \"invalidation\",\n\tBatch: \"batch\",\n} as const;\n\n/**\n * The type of a binding context\n *\n * @internal\n */\nexport type BindingContextType = (typeof BindingType)[keyof typeof BindingType];\n\n/**\n * The binding context attribution common to all binding events\n *\n * @internal\n */\nexport interface BindingContext {\n\treadonly type: BindingContextType;\n}\n\n/**\n * The binding context for a remove event\n *\n * @internal\n */\nexport interface RemoveBindingContext extends BindingContext {\n\treadonly type: typeof BindingType.Remove;\n\treadonly path: UpPath;\n\treadonly count: number;\n}\n\n/**\n * The binding context for an insert event\n *\n * @internal\n */\nexport interface InsertBindingContext extends BindingContext {\n\treadonly type: typeof BindingType.Insert;\n\treadonly path: UpPath;\n\treadonly content: ProtoNodes;\n}\n\n/**\n * The binding context for an invalidation event\n *\n * @internal\n */\nexport interface InvalidationBindingContext extends BindingContext {\n\treadonly type: typeof BindingType.Invalidation;\n}\n\n/**\n * The binding context for a batch event\n *\n * @internal\n */\nexport interface BatchBindingContext extends BindingContext {\n\treadonly type: typeof BindingType.Batch;\n\treadonly events: VisitorBindingContext[];\n}\n\n/**\n * The listener interface. Internal.\n *\n * @internal\n */\ntype Listener = (...args: unknown[]) => void;\n\n/**\n * A call tree is a {@link BindTree} augmented with listeners. Internal.\n *\n * @internal\n */\ntype CallTree = BindTree<CallTree> & { listeners: Set<Listener>; matchPolicy?: MatchPolicy };\n\n/**\n * A generic implementation of a {@link PathVisitor} enabling the registration of listeners\n * categorized by {@link BindingContextType} and {@link BindPolicy}.\n */\nabstract class AbstractPathVisitor implements PathVisitor {\n\tprotected readonly registeredListeners: Map<BindingContextType, Map<FieldKey, CallTree>> =\n\t\tnew Map();\n\tpublic constructor(protected readonly options: BinderOptions) {}\n\n\t// TODO: make these methods abstract and make AbstractPathVisitor implementations implement them\n\tpublic afterCreate(content: DetachedRangeUpPath): void {}\n\tpublic beforeDestroy(content: DetachedRangeUpPath): void {}\n\tpublic beforeAttach(source: DetachedRangeUpPath, destination: PlaceUpPath): void {}\n\tpublic afterAttach(source: DetachedPlaceUpPath, destination: RangeUpPath): void {\n\t\tthis.onInsert(\n\t\t\t{\n\t\t\t\tparent: destination.parent,\n\t\t\t\tparentField: destination.field,\n\t\t\t\tparentIndex: destination.start,\n\t\t\t},\n\t\t\tthis.getContent(destination),\n\t\t);\n\t}\n\tpublic beforeDetach(source: RangeUpPath, destination: DetachedPlaceUpPath): void {}\n\tpublic afterDetach(source: PlaceUpPath, destination: DetachedRangeUpPath): void {\n\t\tthis.onRemove(\n\t\t\t{\n\t\t\t\tparent: source.parent,\n\t\t\t\tparentField: source.field,\n\t\t\t\tparentIndex: source.index,\n\t\t\t},\n\t\t\tdestination.end - destination.start,\n\t\t);\n\t}\n\tpublic beforeReplace(\n\t\tnewContent: DetachedRangeUpPath,\n\t\toldContent: RangeUpPath,\n\t\toldContentDestination: DetachedPlaceUpPath,\n\t): void {}\n\tpublic afterReplace(\n\t\tnewContentSource: DetachedPlaceUpPath,\n\t\tnewContent: RangeUpPath,\n\t\toldContent: DetachedRangeUpPath,\n\t): void {\n\t\tthis.onRemove(\n\t\t\t{\n\t\t\t\tparent: newContent.parent,\n\t\t\t\tparentField: newContent.field,\n\t\t\t\tparentIndex: newContent.start,\n\t\t\t},\n\t\t\toldContent.end - oldContent.start,\n\t\t);\n\t\tthis.onInsert(\n\t\t\t{\n\t\t\t\tparent: newContent.parent,\n\t\t\t\tparentField: newContent.field,\n\t\t\t\tparentIndex: newContent.start,\n\t\t\t},\n\t\t\tthis.getContent(newContent),\n\t\t);\n\t}\n\tprotected getContent(range: RangeUpPath): ProtoNodes {\n\t\t// TODO: either lookup the content in the forest or stop providing the content in the events\n\t\treturn [];\n\t}\n\n\tpublic abstract onRemove(path: UpPath, count: number): void;\n\tpublic abstract onInsert(path: UpPath, content: ProtoNodes): void;\n\tpublic registerListener(\n\t\tcontextType: BindingContextType,\n\t\tpolicies: BindPolicy[],\n\t\tlistener: Listener,\n\t): () => void {\n\t\tconst contextRoots = getOrCreate(this.registeredListeners, contextType, () => new Map());\n\t\tpolicies.forEach((policy) => {\n\t\t\tconst tree = policy.bindTree;\n\t\t\tconst currentRoot = this.findRoot(contextType, tree.field);\n\t\t\tif (currentRoot === undefined) {\n\t\t\t\tconst newRoot: CallTree = {\n\t\t\t\t\tfield: tree.field,\n\t\t\t\t\tindex: tree.index,\n\t\t\t\t\tlisteners: new Set(),\n\t\t\t\t\tchildren: new Map(),\n\t\t\t\t\tmatchPolicy: policy.matchPolicy,\n\t\t\t\t};\n\t\t\t\tassert(contextRoots !== undefined, 0x6da /* expected contextRoots to be defined */);\n\t\t\t\tcontextRoots.set(tree.field, newRoot);\n\t\t\t\tthis.bindTree(contextType, tree, listener, newRoot);\n\t\t\t} else {\n\t\t\t\tthis.bindTree(contextType, tree, listener, currentRoot);\n\t\t\t}\n\t\t});\n\t\treturn () => {\n\t\t\tpolicies.forEach((policy) =>\n\t\t\t\tthis.unregisterListener(contextType, policy.bindTree, listener),\n\t\t\t);\n\t\t};\n\t}\n\n\tprivate bindTree(\n\t\tcontextType: BindingContextType,\n\t\ttree: BindTree,\n\t\tlistener: Listener,\n\t\tcallTree: CallTree,\n\t): void {\n\t\tif (tree.children.size === 0) {\n\t\t\tcallTree.listeners.add(listener);\n\t\t} else {\n\t\t\ttree.children.forEach((childTree, fieldKey) => {\n\t\t\t\tconst childCallTree = getOrCreate(callTree.children, fieldKey, () => {\n\t\t\t\t\tconst newChildCallTree: CallTree = {\n\t\t\t\t\t\tfield: fieldKey,\n\t\t\t\t\t\tindex: childTree.index,\n\t\t\t\t\t\tlisteners: new Set(),\n\t\t\t\t\t\tchildren: new Map(),\n\t\t\t\t\t};\n\t\t\t\t\tcallTree.children.set(fieldKey, newChildCallTree);\n\t\t\t\t\treturn newChildCallTree;\n\t\t\t\t});\n\t\t\t\tthis.bindTree(contextType, childTree, listener, childCallTree);\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate findRoot(contextType: BindingContextType, field: FieldKey): CallTree | undefined {\n\t\treturn this.registeredListeners.get(contextType)?.get(field);\n\t}\n\n\tprivate unregisterListener(\n\t\tcontextType: BindingContextType,\n\t\ttree: BindTree,\n\t\tlistener: Listener,\n\t\tcallTree?: CallTree,\n\t): void {\n\t\tconst foundTree = callTree ?? this.findRoot(contextType, tree.field);\n\t\tif (foundTree !== undefined) {\n\t\t\tif (tree.children.size === 0) {\n\t\t\t\tfoundTree.listeners.delete(listener);\n\t\t\t} else {\n\t\t\t\ttree.children.forEach((childTree, fieldKey) => {\n\t\t\t\t\tassert(foundTree !== undefined, 0x6db /* expected foundTree to be defined */);\n\t\t\t\t\tconst childCallTree = foundTree.children.get(fieldKey);\n\t\t\t\t\tif (childCallTree !== undefined) {\n\t\t\t\t\t\tthis.unregisterListener(contextType, childTree, listener, childCallTree);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected getListeners(\n\t\tcontextType: BindingContextType,\n\t\tdownPath: DownPath,\n\t): Set<Listener> | undefined {\n\t\tconst foundRoot = this.findRoot(contextType, downPath[0].field);\n\t\tif (foundRoot === undefined) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst subtreeMatch = (\n\t\t\t\tsubtreePolicy: SubtreePolicy | undefined,\n\t\t\t\tdepth: number,\n\t\t\t): boolean => {\n\t\t\t\tif (subtreePolicy?.maxDepth !== undefined && depth > subtreePolicy.maxDepth) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t};\n\t\t\tconst accumulateMatching = (\n\t\t\t\ttreeNode: CallTree,\n\t\t\t\tindex: number,\n\t\t\t\tonMatch: (index: number, treeNode: CallTree) => void,\n\t\t\t): void => {\n\t\t\t\tconst step = downPath[index];\n\t\t\t\tif (\n\t\t\t\t\tstep === undefined ||\n\t\t\t\t\ttreeNode.field !== step.field ||\n\t\t\t\t\t(treeNode.index !== undefined && step.index !== treeNode.index)\n\t\t\t\t) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tfor (const child of treeNode.children.values()) {\n\t\t\t\t\taccumulateMatching(child, index + 1, onMatch);\n\t\t\t\t}\n\t\t\t\tonMatch(index, treeNode);\n\t\t\t};\n\t\t\tconst matchedNodes: Set<Listener> = new Set();\n\t\t\tif (foundRoot.matchPolicy === \"path\") {\n\t\t\t\taccumulateMatching(foundRoot, 0, (index: number, treeNode: CallTree): void => {\n\t\t\t\t\tif (index === downPath.length - 1) {\n\t\t\t\t\t\ttreeNode.listeners.forEach((listener) => matchedNodes.add(listener));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (foundRoot.matchPolicy === \"subtree\") {\n\t\t\t\taccumulateMatching(foundRoot, 0, (index: number, treeNode: CallTree): void => {\n\t\t\t\t\ttreeNode.listeners.forEach((listener) => matchedNodes.add(listener));\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst matchPolicy: SubtreePolicy | undefined = foundRoot.matchPolicy;\n\t\t\t\taccumulateMatching(foundRoot, 0, (index: number, treeNode: CallTree): void => {\n\t\t\t\t\tif (subtreeMatch(matchPolicy, downPath.length - 1)) {\n\t\t\t\t\t\ttreeNode.listeners.forEach((listener) => matchedNodes.add(listener));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn matchedNodes.size > 0 ? matchedNodes : undefined;\n\t\t}\n\t}\n\n\tpublic hasRegisteredContextType(contextType: BindingContextType): boolean {\n\t\treturn this.registeredListeners.has(contextType);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.registeredListeners.clear();\n\t}\n}\n\n/**\n * A visitor that invokes listeners immediately when a path is traversed.\n */\nclass DirectPathVisitor extends AbstractPathVisitor {\n\tprivate processListeners(path: UpPath, listeners: Set<Listener>, otherArgs: object): void {\n\t\tfor (const listener of listeners) {\n\t\t\tlistener({\n\t\t\t\tpath,\n\t\t\t\t...otherArgs,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate processRegisteredPaths(\n\t\tpath: UpPath,\n\t\ttype: BindingContextType,\n\t\totherArgs: object,\n\t): void {\n\t\tconst current = toDownPath(path);\n\t\tconst listeners = this.getListeners(type, current);\n\t\tif (listeners !== undefined) {\n\t\t\tthis.processListeners(path, listeners, otherArgs);\n\t\t}\n\t}\n\n\tpublic onRemove(path: UpPath, count: number): void {\n\t\tthis.processRegisteredPaths(path, BindingType.Remove, {\n\t\t\tcount,\n\t\t\ttype: BindingType.Remove,\n\t\t});\n\t}\n\n\tpublic onInsert(path: UpPath, content: ProtoNodes): void {\n\t\tthis.processRegisteredPaths(path, BindingType.Insert, {\n\t\t\tcontent,\n\t\t\ttype: BindingType.Insert,\n\t\t});\n\t}\n}\n\n/**\n * A visitor that invokes listeners only once when flushed if any modifications detected on the registered paths.\n */\nclass InvalidatingPathVisitor\n\textends AbstractPathVisitor\n\timplements Flushable<InvalidatingPathVisitor>\n{\n\tprivate readonly listeners: Set<Listener> = new Set();\n\n\tprivate processRegisteredPaths(path: UpPath): void {\n\t\tconst current = toDownPath(path);\n\t\tconst listeners = this.getListeners(BindingType.Invalidation, current);\n\t\tif (listeners !== undefined) {\n\t\t\tfor (const listener of listeners) {\n\t\t\t\tthis.listeners.add(listener);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic onRemove(path: UpPath, count: number): void {\n\t\tthis.processRegisteredPaths(path);\n\t}\n\n\tpublic onInsert(path: UpPath, content: ProtoNodes): void {\n\t\tthis.processRegisteredPaths(path);\n\t}\n\n\tpublic flush(): InvalidatingPathVisitor {\n\t\tfor (const listener of this.listeners) {\n\t\t\tlistener({\n\t\t\t\ttype: BindingType.Invalidation,\n\t\t\t});\n\t\t}\n\t\tthis.listeners.clear();\n\t\treturn this;\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis.flush();\n\t\tsuper.dispose();\n\t}\n}\n\ntype CallableBindingContext = VisitorBindingContext & {\n\tlisteners: Set<Listener>;\n};\n\n/**\n * A visitor that buffers all events which match the registered event categories and corresponding paths.\n * Listeners are invoked when flushed. Flushing has also the ability to sort and batch the events.\n */\nclass BufferingPathVisitor\n\textends AbstractPathVisitor\n\timplements Flushable<BufferingPathVisitor>\n{\n\tprivate readonly eventQueue: CallableBindingContext[] = [];\n\n\tpublic onRemove(path: UpPath, count: number): void {\n\t\tconst current = toDownPath(path);\n\t\tconst listeners = this.getListeners(BindingType.Remove, current);\n\t\tif (listeners !== undefined) {\n\t\t\tthis.eventQueue.push({\n\t\t\t\tpath,\n\t\t\t\tcount,\n\t\t\t\ttype: BindingType.Remove,\n\t\t\t\tlisteners,\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic onInsert(path: UpPath, content: ProtoNodes): void {\n\t\tconst current = toDownPath(path);\n\t\tconst listeners = this.getListeners(BindingType.Insert, current);\n\t\tif (listeners !== undefined) {\n\t\t\tthis.eventQueue.push({\n\t\t\t\tpath,\n\t\t\t\tcontent,\n\t\t\t\ttype: BindingType.Insert,\n\t\t\t\tlisteners,\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic flush(): BufferingPathVisitor {\n\t\tconst sortedQueue: CallableBindingContext[] = nativeSort(\n\t\t\tthis.eventQueue,\n\t\t\tthis.options.sortFn ?? (() => 0),\n\t\t);\n\t\tconst batchEventIndices = new Set<number>();\n\t\tconst batchEvents: CallableBindingContext[] = [];\n\t\tconst collected = new Set<Listener>();\n\t\tif (this.hasRegisteredContextType(BindingType.Batch)) {\n\t\t\tfor (let i = 0; i < sortedQueue.length; i++) {\n\t\t\t\tconst event = sortedQueue[i];\n\t\t\t\tconst current = toDownPath(event.path);\n\t\t\t\tconst listeners = this.getListeners(BindingType.Batch, current);\n\t\t\t\tif (listeners !== undefined && listeners.size > 0) {\n\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\tcollected.add(listener);\n\t\t\t\t\t}\n\t\t\t\t\tbatchEvents.push(event);\n\t\t\t\t\tbatchEventIndices.add(i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const listener of collected) {\n\t\t\tlistener({\n\t\t\t\ttype: BindingType.Batch,\n\t\t\t\tevents: batchEvents,\n\t\t\t});\n\t\t}\n\t\tfor (let i = 0; i < sortedQueue.length; i++) {\n\t\t\tif (batchEventIndices.has(i)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst { listeners, ...context } = sortedQueue[i];\n\t\t\tfor (const listener of listeners) {\n\t\t\t\tlistener({ ...context });\n\t\t\t}\n\t\t}\n\t\tthis.eventQueue.length = 0;\n\t\treturn this;\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis.flush();\n\t\tsuper.dispose();\n\t}\n}\n\nclass AbstractDataBinder<\n\tB extends OperationBinderEvents | InvalidationBinderEvents,\n\tV extends AbstractPathVisitor,\n\tO extends BinderOptions,\n> implements DataBinder<B>\n{\n\tprotected readonly visitors = new Map<FlexTreeNode, V>();\n\tprotected readonly visitorLocations = new Map<V, UpPath>();\n\tprotected readonly unregisterHandles = new Set<() => void>();\n\tpublic constructor(\n\t\tprotected readonly options: O,\n\t\tprotected readonly visitorFactory: (anchor: FlexTreeNode) => V,\n\t) {}\n\n\tpublic register<K extends keyof Listeners<B>>(\n\t\tanchor: FlexTreeNode,\n\t\teventType: K,\n\t\teventTrees: BindPolicy[],\n\t\tlistener: B[K],\n\t): void {\n\t\t// TODO: validate BindPath semantics against the schema\n\t\tconst visitor = getOrCreate(this.visitors, anchor, () => {\n\t\t\tconst newVisitor = this.visitorFactory(anchor);\n\t\t\tthis.unregisterHandles.add(\n\t\t\t\tanchor.on(\"subtreeChanging\", (upPath: UpPath) => {\n\t\t\t\t\tassert(newVisitor !== undefined, 0x6dc /* visitor expected to be defined */);\n\t\t\t\t\tif (!this.visitorLocations.has(newVisitor)) {\n\t\t\t\t\t\tthis.visitorLocations.set(newVisitor, upPath);\n\t\t\t\t\t}\n\t\t\t\t\treturn newVisitor;\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn newVisitor;\n\t\t});\n\t\tconst contextType: BindingContextType = eventType as BindingContextType;\n\t\tthis.unregisterHandles.add(\n\t\t\tvisitor.registerListener(contextType, eventTrees, listener as unknown as Listener),\n\t\t);\n\t}\n\tpublic unregisterAll(): void {\n\t\tthis.unregisterHandles.forEach((h) => h());\n\t\tthis.unregisterHandles.clear();\n\t\tthis.visitors.forEach((v) => v.dispose());\n\t\tthis.visitors.clear();\n\t}\n\n\tpublic extractBindPaths(root: BindTree): BindPath[] {\n\t\tconst result: BindPath[] = [];\n\t\tconst depthFirst = (node: BindTree, path: PathStep[] = [root]): void => {\n\t\t\tif (node.children.size === 0) {\n\t\t\t\tresult.push(path);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (const [field, childNode] of node.children.entries()) {\n\t\t\t\tdepthFirst(childNode, [...path, { field, index: childNode.index }]);\n\t\t\t}\n\t\t};\n\t\tdepthFirst(root);\n\t\treturn result;\n\t}\n}\n\nclass BufferingDataBinder<E extends Listeners<E>>\n\textends AbstractDataBinder<\n\t\tOperationBinderEvents,\n\t\tBufferingPathVisitor,\n\t\tFlushableBinderOptions<E>\n\t>\n\timplements FlushableDataBinder<OperationBinderEvents>\n{\n\tprotected readonly view: Listenable<E>;\n\tprotected readonly autoFlushPolicy: keyof Listeners<E>;\n\tpublic constructor(view: Listenable<E>, options: FlushableBinderOptions<E>) {\n\t\tsuper(options, (anchor: FlexTreeNode) => new BufferingPathVisitor(options));\n\t\tthis.view = view;\n\t\tthis.autoFlushPolicy = options.autoFlushPolicy;\n\t\tif (options.autoFlush) {\n\t\t\tthis.enableAutoFlush();\n\t\t}\n\t}\n\n\tpublic flush(): FlushableDataBinder<OperationBinderEvents> {\n\t\tconst unsortedVisitors: BufferingPathVisitor[] = Array.from(this.visitorLocations.keys());\n\t\tconst sortFn = this.options.sortAnchorsFn ?? (() => 0);\n\t\tconst compareFn = (a: BufferingPathVisitor, b: BufferingPathVisitor): number => {\n\t\t\tconst pathA = this.visitorLocations.get(a);\n\t\t\tconst pathB = this.visitorLocations.get(b);\n\t\t\tassert(pathA !== undefined, 0x6dd /* pathA expected to be defined */);\n\t\t\tassert(pathB !== undefined, 0x6de /* pathB expected to be defined */);\n\t\t\treturn sortFn(pathA, pathB);\n\t\t};\n\t\tconst sortedVisitors: BufferingPathVisitor[] = nativeSort(unsortedVisitors, compareFn);\n\t\tfor (const visitor of sortedVisitors) {\n\t\t\tvisitor.flush();\n\t\t}\n\t\treturn this;\n\t}\n\n\tprivate enableAutoFlush(): FlushableDataBinder<OperationBinderEvents> {\n\t\tconst callbackFn = (() => {\n\t\t\tthis.flush();\n\t\t}) as E[keyof Listeners<E>];\n\t\tconst unregisterFlushing = this.view.on(this.autoFlushPolicy, callbackFn);\n\t\tthis.unregisterHandles.add(unregisterFlushing);\n\t\treturn this;\n\t}\n}\n\nclass DirectDataBinder<E extends Listeners<E>> extends AbstractDataBinder<\n\tOperationBinderEvents,\n\tDirectPathVisitor,\n\tBinderOptions\n> {\n\tpublic constructor(view: Listenable<E>, options: BinderOptions) {\n\t\tsuper(options, (anchor: FlexTreeNode) => new DirectPathVisitor(options));\n\t}\n}\n\nclass InvalidateDataBinder<E extends Listeners<E>>\n\textends AbstractDataBinder<\n\t\tInvalidationBinderEvents,\n\t\tInvalidatingPathVisitor,\n\t\tFlushableBinderOptions<E>\n\t>\n\timplements FlushableDataBinder<InvalidationBinderEvents>\n{\n\tprotected readonly view: Listenable<E>;\n\tprotected readonly autoFlushPolicy: keyof Listeners<E>;\n\tpublic constructor(view: Listenable<E>, options: FlushableBinderOptions<E>) {\n\t\tsuper(options, (anchor: FlexTreeNode) => new InvalidatingPathVisitor(options));\n\t\tthis.view = view;\n\t\tthis.autoFlushPolicy = options.autoFlushPolicy;\n\t\tif (options.autoFlush) {\n\t\t\tthis.enableAutoFlush();\n\t\t}\n\t}\n\tpublic flush(): FlushableDataBinder<InvalidationBinderEvents> {\n\t\tfor (const visitor of this.visitors.values()) {\n\t\t\tvisitor.flush();\n\t\t}\n\t\treturn this;\n\t}\n\tprivate enableAutoFlush(): FlushableDataBinder<InvalidationBinderEvents> {\n\t\tconst callbackFn = (() => {\n\t\t\tthis.flush();\n\t\t}) as E[keyof Listeners<E>];\n\t\tconst unregisterFlushing = this.view.on(this.autoFlushPolicy, callbackFn);\n\t\tthis.unregisterHandles.add(unregisterFlushing);\n\t\treturn this;\n\t}\n}\n\n/**\n * Compute a top-town {@link DownPath} from an {@link UpPath}.\n *\n * @internal\n */\nexport function toDownPath(upPath: UpPath): DownPath {\n\tconst downPath: UpPath[] = topDownPath(upPath);\n\tconst stepDownPath: PathStep[] = downPath.map((u) => {\n\t\treturn { field: u.parentField, index: u.parentIndex };\n\t});\n\tstepDownPath.shift(); // remove last step to the root node\n\treturn stepDownPath;\n}\n\n/**\n * Create a buffering data binder.\n *\n * @internal\n */\nexport function createDataBinderBuffering<E extends Listeners<E>>(\n\tview: Listenable<E>,\n\toptions: FlushableBinderOptions<E>,\n): FlushableDataBinder<OperationBinderEvents> {\n\treturn new BufferingDataBinder(view, options);\n}\n\n/**\n * Create a direct data binder.\n *\n * @internal\n */\nexport function createDataBinderDirect<E extends Listeners<E>>(\n\tview: Listenable<E>,\n\toptions: BinderOptions,\n): DataBinder<OperationBinderEvents> {\n\treturn new DirectDataBinder(view, options);\n}\n\n/**\n * Create an invalidating data binder.\n *\n * @internal\n */\nexport function createDataBinderInvalidating<E extends Listeners<E>>(\n\tview: Listenable<E>,\n\toptions: FlushableBinderOptions<E>,\n): FlushableDataBinder<InvalidationBinderEvents> {\n\treturn new InvalidateDataBinder(view, options);\n}\n\n/**\n * Create binder options. If not specified, the default values are:\n * - sortFn: no sorting\n *\n * @internal\n */\nexport function createBinderOptions({\n\tsortFn,\n}: { sortFn?: BinderEventsCompare }): BinderOptions {\n\treturn { sortFn };\n}\n\n/**\n * Create flushable binder options. If not specified, the default values are:\n * - sortFn: no sorting\n * - sortAnchorsFn: no sorting\n * - autoFlush: true\n *\n * @internal\n */\nexport function createFlushableBinderOptions<E extends Listeners<E>>({\n\tsortFn,\n\tsortAnchorsFn,\n\tautoFlush = true,\n\tautoFlushPolicy,\n}: {\n\tsortFn?: BinderEventsCompare;\n\tsortAnchorsFn?: AnchorsCompare;\n\tautoFlush?: boolean;\n\tautoFlushPolicy: keyof Listeners<E>;\n}): FlushableBinderOptions<E> {\n\treturn {\n\t\tsortFn,\n\t\tsortAnchorsFn,\n\t\tautoFlush,\n\t\tautoFlushPolicy,\n\t};\n}\n\n/**\n * Utility to create a compare function from a list of compare functions.\n *\n * @param fns - a list of compare functions\n * @returns a compare function that can be used for sorting\n * @internal\n */\nexport function comparePipeline<T>(...fns: CompareFunction<T>[]): CompareFunction<T> {\n\treturn (a: T, b: T): number => {\n\t\tfor (const fn of fns) {\n\t\t\tconst result = fn(a, b);\n\t\t\tif (result !== 0) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t};\n}\n\n/**\n * Native sorting algorithm.\n *\n * @param arr - the array to sort\n * @param compareFn - the compare function\n * @returns the sorted array\n */\nfunction nativeSort<T>(arr: T[], compareFn: CompareFunction<T>): T[] {\n\treturn [...arr].sort(compareFn);\n}\n\n/**\n * Compiles a (user friendly) syntax tree into the internal binding structure.\n * The syntax tree is a compact representation of related {@link BindPath}s.\n * The match policy can be specified. If not specified, the default value is \"path\".\n * @returns a {@link BindPolicy} object\n * @internal\n */\nexport function compileSyntaxTree(\n\tsyntaxTree: BindSyntaxTree,\n\tmatchPolicy?: MatchPolicy,\n): BindPolicy {\n\tconst entries = Object.entries(syntaxTree);\n\tif (entries.length === 1) {\n\t\tconst [fieldName, childNode] = entries[0];\n\t\tconst fieldKey: FieldKey = brand(fieldName);\n\t\tconst bindTree = compileSyntaxTreeNode(childNode as BindSyntaxTree, fieldKey);\n\t\treturn { matchPolicy: matchPolicy ?? \"path\", bindTree };\n\t} else throw new Error(\"Invalid BindSyntaxTree structure\");\n}\n\nfunction compileSyntaxTreeNode(node: BindSyntaxTree | true, parentField: FieldKey): BindTree {\n\tif (node === true) return { field: parentField, children: new Map() };\n\tconst pathStep: PathStep = {\n\t\tfield: parentField,\n\t\tindex: node[indexSymbol],\n\t};\n\tconst children = new Map<FieldKey, BindTree>();\n\tfor (const [key, value] of Object.entries(node)) {\n\t\tconst fieldKey: FieldKey = brand(key);\n\t\tchildren.set(fieldKey, compileSyntaxTreeNode(value, fieldKey));\n\t}\n\treturn {\n\t\t...pathStep,\n\t\tchildren,\n\t};\n}\n"]}
1
+ {"version":3,"file":"editableTreeBinder.js","sourceRoot":"","sources":["../../src/feature-libraries/editableTreeBinder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EASN,WAAW,GACX,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA0JtD;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAkC5D;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,YAAY,EAAE,cAAc;IAC5B,KAAK,EAAE,OAAO;CACL,CAAC;AAyDX;;;GAGG;AACH,MAAe,mBAAmB;IAGjC,YAAsC,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;QAFzC,wBAAmB,GACrC,IAAI,GAAG,EAAE,CAAC;IACoD,CAAC;IAEhE,gGAAgG;IACzF,WAAW,CAAC,OAA4B,IAAS,CAAC;IAClD,aAA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M,QAAQ,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC/C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACjD,MAAM,QAAQ,GAAa,KAAK,CAAC,GAAG,CAAC,CAAC;QACtC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAChE,CAAC;IACD,OAAO;QACN,GAAG,QAAQ;QACX,QAAQ;KACR,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype DetachedPlaceUpPath,\n\ttype DetachedRangeUpPath,\n\ttype FieldKey,\n\ttype PathVisitor,\n\ttype PlaceUpPath,\n\ttype ProtoNodes,\n\ttype RangeUpPath,\n\ttype UpPath,\n\ttopDownPath,\n} from \"../core/index.js\";\nimport type { Listeners, Listenable } from \"../events/index.js\";\nimport { brand, getOrCreate } from \"../util/index.js\";\n\nimport type { FlexTreeNode } from \"./flex-tree/index.js\";\n\n// TODO:\n// Tests for this file were removed along with the old editable-tree implementation in the commit that includes this note.\n// They were a bit heavily tied to the testing patterns specific to the old editable-tree and will need significant changes to be restored.\n\n/**\n * Binder events reflecting atomic data operations\n */\nexport interface OperationBinderEvents {\n\tremove(context: RemoveBindingContext): void;\n\tinsert(context: InsertBindingContext): void;\n\tbatch(context: BatchBindingContext): void;\n}\n\n/**\n * Binder events signaling state invalidation\n */\nexport interface InvalidationBinderEvents {\n\tinvalidation(context: InvalidationBindingContext): void;\n}\n\n/**\n * Compare function, generic.\n */\nexport type CompareFunction<T> = (a: T, b: T) => number;\n\n/**\n * Compare function for binder events.\n */\nexport type BinderEventsCompare = CompareFunction<VisitorBindingContext>;\n\n/**\n * Compare function for anchors.\n */\nexport type AnchorsCompare = CompareFunction<UpPath>;\n\n/**\n * Options to configure binder behavior.\n *\n * TODO: add more options:\n * `filterFn?: (context: BindingContext) => boolean;`\n * `pathPolicy?: \"relative\" | \"absolute\";`\n */\nexport interface BinderOptions {\n\tsortFn?: BinderEventsCompare;\n}\n\n/**\n * Specialized binder options for flushable binders.\n */\nexport interface FlushableBinderOptions<E extends Listeners<E>> extends BinderOptions {\n\tautoFlush: boolean;\n\tautoFlushPolicy: keyof Listeners<E>;\n\tsortAnchorsFn?: AnchorsCompare;\n}\n\n/**\n * Match policy for binding: subtree or path.\n *\n * - `subtree` match policy means that path filtering would return events matching the exact path and its subpaths,\n * ie. changes to (nested) children would be allowed to bubble up to parent listeners.\n * - {@link SubtreePolicy} match policy is equivalent with `subtree` match policy, while allowing to specify a maximum\n * depth for the subtree.\n * - `path` match policy means that path filtering would return events matching the _exact_ path only. In this case\n * _exact_ semantics include interpreting an `undefined` _index_ field in the {@link PathStep} as a wildcard.\n *\n */\nexport type MatchPolicy = SubtreePolicy | \"subtree\" | \"path\";\n\n/**\n * Subtree match policy where max depth can be specified.\n */\nexport interface SubtreePolicy {\n\tmaxDepth: number;\n}\n\n/**\n * The data binder interface\n */\nexport interface DataBinder<B extends OperationBinderEvents | InvalidationBinderEvents> {\n\t/**\n\t * Register an event listener\n\t *\n\t * @param anchor - The anchor to register the listener on\n\t * @param eventType - The {@link BindingType} to listen for.\n\t * @param eventTrees - The {@link BindPolicy}s to filter on.\n\t * @param listener - The listener to register\n\t */\n\tregister<K extends keyof Listeners<B>>(\n\t\tanchor: FlexTreeNode,\n\t\teventType: K,\n\t\teventTrees: BindPolicy[],\n\t\tlistener?: B[K],\n\t): void;\n\n\t/**\n\t * Unregister all listeners.\n\t */\n\tunregisterAll(): void;\n}\n\n/**\n * An interface describing the ability to flush.\n */\nexport interface Flushable<T> {\n\tflush(): T;\n}\n\n/**\n * An interface describing a flushable data binder.\n */\nexport interface FlushableDataBinder<\n\tB extends OperationBinderEvents | InvalidationBinderEvents,\n> extends DataBinder<B>,\n\t\tFlushable<FlushableDataBinder<B>> {}\n\n/**\n * A step in a bind path\n */\nexport interface PathStep {\n\t/**\n\t * The field being traversed\n\t */\n\treadonly field: FieldKey;\n\n\t/**\n\t * The index of the element being navigated to\n\t */\n\treadonly index?: number;\n}\n\n/**\n * The default type for a bind tree\n */\nexport type BindTreeDefault = BindTree;\n\n/**\n * A bind tree is a compact representation of related {@link BindPath}s.\n */\nexport interface BindTree<T = BindTreeDefault> extends PathStep {\n\treadonly children: Map<FieldKey, T>;\n}\n\n/**\n * A bind policy is a combination of a {@link BindTree} and a {@link MatchPolicy}.\n */\nexport interface BindPolicy {\n\treadonly bindTree: BindTree;\n\treadonly matchPolicy: MatchPolicy;\n}\n\n/**\n * Index symbol for syntax tree\n */\nexport const indexSymbol = Symbol(\"flex-tree-binder:index\");\n\n/**\n * A syntax node for the bind language\n *\n * The bind language is a compact representation of related {@link BindPath}s. It can be used to\n * simplify usage and construction of {@link BindTree}s.\n *\n * see {@link BindTree}\n * see {@link compileSyntaxTree}\n */\nexport interface BindSyntaxTree {\n\treadonly [indexSymbol]?: number;\n\treadonly [key: string]: true | BindSyntaxTree;\n}\n\n/**\n * A top down path in a bind or path tree is a collection of {@link PathStep}s\n *\n * see {@link BindTree}\n * see {@link UpPath}\n */\nexport type DownPath = PathStep[];\n\n/**\n * A bind path is a top down path in a bind tree\n */\nexport type BindPath = DownPath;\n\n/**\n * A binding context specialized for {@link PathVisitor} triggered binding events.\n */\nexport type VisitorBindingContext = RemoveBindingContext | InsertBindingContext;\n\n/**\n * Enumeration of binding categories\n */\nexport const BindingType = {\n\tRemove: \"remove\",\n\tInsert: \"insert\",\n\tInvalidation: \"invalidation\",\n\tBatch: \"batch\",\n} as const;\n\n/**\n * The type of a binding context\n */\nexport type BindingContextType = (typeof BindingType)[keyof typeof BindingType];\n\n/**\n * The binding context attribution common to all binding events\n */\nexport interface BindingContext {\n\treadonly type: BindingContextType;\n}\n\n/**\n * The binding context for a remove event\n */\nexport interface RemoveBindingContext extends BindingContext {\n\treadonly type: typeof BindingType.Remove;\n\treadonly path: UpPath;\n\treadonly count: number;\n}\n\n/**\n * The binding context for an insert event\n */\nexport interface InsertBindingContext extends BindingContext {\n\treadonly type: typeof BindingType.Insert;\n\treadonly path: UpPath;\n\treadonly content: ProtoNodes;\n}\n\n/**\n * The binding context for an invalidation event\n */\nexport interface InvalidationBindingContext extends BindingContext {\n\treadonly type: typeof BindingType.Invalidation;\n}\n\n/**\n * The binding context for a batch event\n */\nexport interface BatchBindingContext extends BindingContext {\n\treadonly type: typeof BindingType.Batch;\n\treadonly events: VisitorBindingContext[];\n}\n\n/**\n * The listener interface. Internal.\n */\ntype Listener = (...args: unknown[]) => void;\n\n/**\n * A call tree is a {@link BindTree} augmented with listeners. Internal.\n */\ntype CallTree = BindTree<CallTree> & { listeners: Set<Listener>; matchPolicy?: MatchPolicy };\n\n/**\n * A generic implementation of a {@link PathVisitor} enabling the registration of listeners\n * categorized by {@link BindingContextType} and {@link BindPolicy}.\n */\nabstract class AbstractPathVisitor implements PathVisitor {\n\tprotected readonly registeredListeners: Map<BindingContextType, Map<FieldKey, CallTree>> =\n\t\tnew Map();\n\tpublic constructor(protected readonly options: BinderOptions) {}\n\n\t// TODO: make these methods abstract and make AbstractPathVisitor implementations implement them\n\tpublic afterCreate(content: DetachedRangeUpPath): void {}\n\tpublic beforeDestroy(content: DetachedRangeUpPath): void {}\n\tpublic beforeAttach(source: DetachedRangeUpPath, destination: PlaceUpPath): void {}\n\tpublic afterAttach(source: DetachedPlaceUpPath, destination: RangeUpPath): void {\n\t\tthis.onInsert(\n\t\t\t{\n\t\t\t\tparent: destination.parent,\n\t\t\t\tparentField: destination.field,\n\t\t\t\tparentIndex: destination.start,\n\t\t\t},\n\t\t\tthis.getContent(destination),\n\t\t);\n\t}\n\tpublic beforeDetach(source: RangeUpPath, destination: DetachedPlaceUpPath): void {}\n\tpublic afterDetach(source: PlaceUpPath, destination: DetachedRangeUpPath): void {\n\t\tthis.onRemove(\n\t\t\t{\n\t\t\t\tparent: source.parent,\n\t\t\t\tparentField: source.field,\n\t\t\t\tparentIndex: source.index,\n\t\t\t},\n\t\t\tdestination.end - destination.start,\n\t\t);\n\t}\n\tpublic beforeReplace(\n\t\tnewContent: DetachedRangeUpPath,\n\t\toldContent: RangeUpPath,\n\t\toldContentDestination: DetachedPlaceUpPath,\n\t): void {}\n\tpublic afterReplace(\n\t\tnewContentSource: DetachedPlaceUpPath,\n\t\tnewContent: RangeUpPath,\n\t\toldContent: DetachedRangeUpPath,\n\t): void {\n\t\tthis.onRemove(\n\t\t\t{\n\t\t\t\tparent: newContent.parent,\n\t\t\t\tparentField: newContent.field,\n\t\t\t\tparentIndex: newContent.start,\n\t\t\t},\n\t\t\toldContent.end - oldContent.start,\n\t\t);\n\t\tthis.onInsert(\n\t\t\t{\n\t\t\t\tparent: newContent.parent,\n\t\t\t\tparentField: newContent.field,\n\t\t\t\tparentIndex: newContent.start,\n\t\t\t},\n\t\t\tthis.getContent(newContent),\n\t\t);\n\t}\n\tprotected getContent(range: RangeUpPath): ProtoNodes {\n\t\t// TODO: either lookup the content in the forest or stop providing the content in the events\n\t\treturn [];\n\t}\n\n\tpublic abstract onRemove(path: UpPath, count: number): void;\n\tpublic abstract onInsert(path: UpPath, content: ProtoNodes): void;\n\tpublic registerListener(\n\t\tcontextType: BindingContextType,\n\t\tpolicies: BindPolicy[],\n\t\tlistener: Listener,\n\t): () => void {\n\t\tconst contextRoots = getOrCreate(this.registeredListeners, contextType, () => new Map());\n\t\tpolicies.forEach((policy) => {\n\t\t\tconst tree = policy.bindTree;\n\t\t\tconst currentRoot = this.findRoot(contextType, tree.field);\n\t\t\tif (currentRoot === undefined) {\n\t\t\t\tconst newRoot: CallTree = {\n\t\t\t\t\tfield: tree.field,\n\t\t\t\t\tindex: tree.index,\n\t\t\t\t\tlisteners: new Set(),\n\t\t\t\t\tchildren: new Map(),\n\t\t\t\t\tmatchPolicy: policy.matchPolicy,\n\t\t\t\t};\n\t\t\t\tassert(contextRoots !== undefined, 0x6da /* expected contextRoots to be defined */);\n\t\t\t\tcontextRoots.set(tree.field, newRoot);\n\t\t\t\tthis.bindTree(contextType, tree, listener, newRoot);\n\t\t\t} else {\n\t\t\t\tthis.bindTree(contextType, tree, listener, currentRoot);\n\t\t\t}\n\t\t});\n\t\treturn () => {\n\t\t\tpolicies.forEach((policy) =>\n\t\t\t\tthis.unregisterListener(contextType, policy.bindTree, listener),\n\t\t\t);\n\t\t};\n\t}\n\n\tprivate bindTree(\n\t\tcontextType: BindingContextType,\n\t\ttree: BindTree,\n\t\tlistener: Listener,\n\t\tcallTree: CallTree,\n\t): void {\n\t\tif (tree.children.size === 0) {\n\t\t\tcallTree.listeners.add(listener);\n\t\t} else {\n\t\t\ttree.children.forEach((childTree, fieldKey) => {\n\t\t\t\tconst childCallTree = getOrCreate(callTree.children, fieldKey, () => {\n\t\t\t\t\tconst newChildCallTree: CallTree = {\n\t\t\t\t\t\tfield: fieldKey,\n\t\t\t\t\t\tindex: childTree.index,\n\t\t\t\t\t\tlisteners: new Set(),\n\t\t\t\t\t\tchildren: new Map(),\n\t\t\t\t\t};\n\t\t\t\t\tcallTree.children.set(fieldKey, newChildCallTree);\n\t\t\t\t\treturn newChildCallTree;\n\t\t\t\t});\n\t\t\t\tthis.bindTree(contextType, childTree, listener, childCallTree);\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate findRoot(contextType: BindingContextType, field: FieldKey): CallTree | undefined {\n\t\treturn this.registeredListeners.get(contextType)?.get(field);\n\t}\n\n\tprivate unregisterListener(\n\t\tcontextType: BindingContextType,\n\t\ttree: BindTree,\n\t\tlistener: Listener,\n\t\tcallTree?: CallTree,\n\t): void {\n\t\tconst foundTree = callTree ?? this.findRoot(contextType, tree.field);\n\t\tif (foundTree !== undefined) {\n\t\t\tif (tree.children.size === 0) {\n\t\t\t\tfoundTree.listeners.delete(listener);\n\t\t\t} else {\n\t\t\t\ttree.children.forEach((childTree, fieldKey) => {\n\t\t\t\t\tassert(foundTree !== undefined, 0x6db /* expected foundTree to be defined */);\n\t\t\t\t\tconst childCallTree = foundTree.children.get(fieldKey);\n\t\t\t\t\tif (childCallTree !== undefined) {\n\t\t\t\t\t\tthis.unregisterListener(contextType, childTree, listener, childCallTree);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected getListeners(\n\t\tcontextType: BindingContextType,\n\t\tdownPath: DownPath,\n\t): Set<Listener> | undefined {\n\t\tconst firstDownPath = downPath[0] ?? oob();\n\t\tconst foundRoot = this.findRoot(contextType, firstDownPath.field);\n\t\tif (foundRoot === undefined) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tconst subtreeMatch = (\n\t\t\t\tsubtreePolicy: SubtreePolicy | undefined,\n\t\t\t\tdepth: number,\n\t\t\t): boolean => {\n\t\t\t\tif (subtreePolicy?.maxDepth !== undefined && depth > subtreePolicy.maxDepth) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t};\n\t\t\tconst accumulateMatching = (\n\t\t\t\ttreeNode: CallTree,\n\t\t\t\tindex: number,\n\t\t\t\tonMatch: (index: number, treeNode: CallTree) => void,\n\t\t\t): void => {\n\t\t\t\tconst step = downPath[index];\n\t\t\t\tif (\n\t\t\t\t\tstep === undefined ||\n\t\t\t\t\ttreeNode.field !== step.field ||\n\t\t\t\t\t(treeNode.index !== undefined && step.index !== treeNode.index)\n\t\t\t\t) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tfor (const child of treeNode.children.values()) {\n\t\t\t\t\taccumulateMatching(child, index + 1, onMatch);\n\t\t\t\t}\n\t\t\t\tonMatch(index, treeNode);\n\t\t\t};\n\t\t\tconst matchedNodes: Set<Listener> = new Set();\n\t\t\tif (foundRoot.matchPolicy === \"path\") {\n\t\t\t\taccumulateMatching(foundRoot, 0, (index: number, treeNode: CallTree): void => {\n\t\t\t\t\tif (index === downPath.length - 1) {\n\t\t\t\t\t\ttreeNode.listeners.forEach((listener) => matchedNodes.add(listener));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (foundRoot.matchPolicy === \"subtree\") {\n\t\t\t\taccumulateMatching(foundRoot, 0, (index: number, treeNode: CallTree): void => {\n\t\t\t\t\ttreeNode.listeners.forEach((listener) => matchedNodes.add(listener));\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst matchPolicy: SubtreePolicy | undefined = foundRoot.matchPolicy;\n\t\t\t\taccumulateMatching(foundRoot, 0, (index: number, treeNode: CallTree): void => {\n\t\t\t\t\tif (subtreeMatch(matchPolicy, downPath.length - 1)) {\n\t\t\t\t\t\ttreeNode.listeners.forEach((listener) => matchedNodes.add(listener));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn matchedNodes.size > 0 ? matchedNodes : undefined;\n\t\t}\n\t}\n\n\tpublic hasRegisteredContextType(contextType: BindingContextType): boolean {\n\t\treturn this.registeredListeners.has(contextType);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.registeredListeners.clear();\n\t}\n}\n\n/**\n * A visitor that invokes listeners immediately when a path is traversed.\n */\nclass DirectPathVisitor extends AbstractPathVisitor {\n\tprivate processListeners(path: UpPath, listeners: Set<Listener>, otherArgs: object): void {\n\t\tfor (const listener of listeners) {\n\t\t\tlistener({\n\t\t\t\tpath,\n\t\t\t\t...otherArgs,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate processRegisteredPaths(\n\t\tpath: UpPath,\n\t\ttype: BindingContextType,\n\t\totherArgs: object,\n\t): void {\n\t\tconst current = toDownPath(path);\n\t\tconst listeners = this.getListeners(type, current);\n\t\tif (listeners !== undefined) {\n\t\t\tthis.processListeners(path, listeners, otherArgs);\n\t\t}\n\t}\n\n\tpublic onRemove(path: UpPath, count: number): void {\n\t\tthis.processRegisteredPaths(path, BindingType.Remove, {\n\t\t\tcount,\n\t\t\ttype: BindingType.Remove,\n\t\t});\n\t}\n\n\tpublic onInsert(path: UpPath, content: ProtoNodes): void {\n\t\tthis.processRegisteredPaths(path, BindingType.Insert, {\n\t\t\tcontent,\n\t\t\ttype: BindingType.Insert,\n\t\t});\n\t}\n}\n\n/**\n * A visitor that invokes listeners only once when flushed if any modifications detected on the registered paths.\n */\nclass InvalidatingPathVisitor\n\textends AbstractPathVisitor\n\timplements Flushable<InvalidatingPathVisitor>\n{\n\tprivate readonly listeners: Set<Listener> = new Set();\n\n\tprivate processRegisteredPaths(path: UpPath): void {\n\t\tconst current = toDownPath(path);\n\t\tconst listeners = this.getListeners(BindingType.Invalidation, current);\n\t\tif (listeners !== undefined) {\n\t\t\tfor (const listener of listeners) {\n\t\t\t\tthis.listeners.add(listener);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic onRemove(path: UpPath, count: number): void {\n\t\tthis.processRegisteredPaths(path);\n\t}\n\n\tpublic onInsert(path: UpPath, content: ProtoNodes): void {\n\t\tthis.processRegisteredPaths(path);\n\t}\n\n\tpublic flush(): InvalidatingPathVisitor {\n\t\tfor (const listener of this.listeners) {\n\t\t\tlistener({\n\t\t\t\ttype: BindingType.Invalidation,\n\t\t\t});\n\t\t}\n\t\tthis.listeners.clear();\n\t\treturn this;\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis.flush();\n\t\tsuper.dispose();\n\t}\n}\n\ntype CallableBindingContext = VisitorBindingContext & {\n\tlisteners: Set<Listener>;\n};\n\n/**\n * A visitor that buffers all events which match the registered event categories and corresponding paths.\n * Listeners are invoked when flushed. Flushing has also the ability to sort and batch the events.\n */\nclass BufferingPathVisitor\n\textends AbstractPathVisitor\n\timplements Flushable<BufferingPathVisitor>\n{\n\tprivate readonly eventQueue: CallableBindingContext[] = [];\n\n\tpublic onRemove(path: UpPath, count: number): void {\n\t\tconst current = toDownPath(path);\n\t\tconst listeners = this.getListeners(BindingType.Remove, current);\n\t\tif (listeners !== undefined) {\n\t\t\tthis.eventQueue.push({\n\t\t\t\tpath,\n\t\t\t\tcount,\n\t\t\t\ttype: BindingType.Remove,\n\t\t\t\tlisteners,\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic onInsert(path: UpPath, content: ProtoNodes): void {\n\t\tconst current = toDownPath(path);\n\t\tconst listeners = this.getListeners(BindingType.Insert, current);\n\t\tif (listeners !== undefined) {\n\t\t\tthis.eventQueue.push({\n\t\t\t\tpath,\n\t\t\t\tcontent,\n\t\t\t\ttype: BindingType.Insert,\n\t\t\t\tlisteners,\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic flush(): BufferingPathVisitor {\n\t\tconst sortedQueue: CallableBindingContext[] = nativeSort(\n\t\t\tthis.eventQueue,\n\t\t\tthis.options.sortFn ?? (() => 0),\n\t\t);\n\t\tconst batchEventIndices = new Set<number>();\n\t\tconst batchEvents: CallableBindingContext[] = [];\n\t\tconst collected = new Set<Listener>();\n\t\tif (this.hasRegisteredContextType(BindingType.Batch)) {\n\t\t\tfor (const [i, event] of sortedQueue.entries()) {\n\t\t\t\tconst current = toDownPath(event.path);\n\t\t\t\tconst listeners = this.getListeners(BindingType.Batch, current);\n\t\t\t\tif (listeners !== undefined && listeners.size > 0) {\n\t\t\t\t\tfor (const listener of listeners) {\n\t\t\t\t\t\tcollected.add(listener);\n\t\t\t\t\t}\n\t\t\t\t\tbatchEvents.push(event);\n\t\t\t\t\tbatchEventIndices.add(i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const listener of collected) {\n\t\t\tlistener({\n\t\t\t\ttype: BindingType.Batch,\n\t\t\t\tevents: batchEvents,\n\t\t\t});\n\t\t}\n\t\tfor (const [i, { listeners, ...context }] of sortedQueue.entries()) {\n\t\t\tif (batchEventIndices.has(i)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (const listener of listeners) {\n\t\t\t\tlistener({ ...context });\n\t\t\t}\n\t\t}\n\t\tthis.eventQueue.length = 0;\n\t\treturn this;\n\t}\n\n\tpublic override dispose(): void {\n\t\tthis.flush();\n\t\tsuper.dispose();\n\t}\n}\n\nclass AbstractDataBinder<\n\tB extends OperationBinderEvents | InvalidationBinderEvents,\n\tV extends AbstractPathVisitor,\n\tO extends BinderOptions,\n> implements DataBinder<B>\n{\n\tprotected readonly visitors = new Map<FlexTreeNode, V>();\n\tprotected readonly visitorLocations = new Map<V, UpPath>();\n\tprotected readonly unregisterHandles = new Set<() => void>();\n\tpublic constructor(\n\t\tprotected readonly options: O,\n\t\tprotected readonly visitorFactory: (anchor: FlexTreeNode) => V,\n\t) {}\n\n\tpublic register<K extends keyof Listeners<B>>(\n\t\tanchor: FlexTreeNode,\n\t\teventType: K,\n\t\teventTrees: BindPolicy[],\n\t\tlistener: B[K],\n\t): void {\n\t\t// TODO: validate BindPath semantics against the schema\n\t\tconst visitor = getOrCreate(this.visitors, anchor, () => {\n\t\t\tconst newVisitor = this.visitorFactory(anchor);\n\t\t\tthis.unregisterHandles.add(\n\t\t\t\tanchor.anchorNode.on(\"subtreeChanging\", (upPath: UpPath) => {\n\t\t\t\t\tassert(newVisitor !== undefined, 0x6dc /* visitor expected to be defined */);\n\t\t\t\t\tif (!this.visitorLocations.has(newVisitor)) {\n\t\t\t\t\t\tthis.visitorLocations.set(newVisitor, upPath);\n\t\t\t\t\t}\n\t\t\t\t\treturn newVisitor;\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn newVisitor;\n\t\t});\n\t\tconst contextType: BindingContextType = eventType as BindingContextType;\n\t\tthis.unregisterHandles.add(\n\t\t\tvisitor.registerListener(contextType, eventTrees, listener as unknown as Listener),\n\t\t);\n\t}\n\tpublic unregisterAll(): void {\n\t\tthis.unregisterHandles.forEach((h) => h());\n\t\tthis.unregisterHandles.clear();\n\t\tthis.visitors.forEach((v) => v.dispose());\n\t\tthis.visitors.clear();\n\t}\n\n\tpublic extractBindPaths(root: BindTree): BindPath[] {\n\t\tconst result: BindPath[] = [];\n\t\tconst depthFirst = (node: BindTree, path: PathStep[] = [root]): void => {\n\t\t\tif (node.children.size === 0) {\n\t\t\t\tresult.push(path);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (const [field, childNode] of node.children.entries()) {\n\t\t\t\tdepthFirst(childNode, [...path, { field, index: childNode.index }]);\n\t\t\t}\n\t\t};\n\t\tdepthFirst(root);\n\t\treturn result;\n\t}\n}\n\nclass BufferingDataBinder<E extends Listeners<E>>\n\textends AbstractDataBinder<\n\t\tOperationBinderEvents,\n\t\tBufferingPathVisitor,\n\t\tFlushableBinderOptions<E>\n\t>\n\timplements FlushableDataBinder<OperationBinderEvents>\n{\n\tprotected readonly view: Listenable<E>;\n\tprotected readonly autoFlushPolicy: keyof Listeners<E>;\n\tpublic constructor(view: Listenable<E>, options: FlushableBinderOptions<E>) {\n\t\tsuper(options, (anchor: FlexTreeNode) => new BufferingPathVisitor(options));\n\t\tthis.view = view;\n\t\tthis.autoFlushPolicy = options.autoFlushPolicy;\n\t\tif (options.autoFlush) {\n\t\t\tthis.enableAutoFlush();\n\t\t}\n\t}\n\n\tpublic flush(): FlushableDataBinder<OperationBinderEvents> {\n\t\tconst unsortedVisitors: BufferingPathVisitor[] = Array.from(this.visitorLocations.keys());\n\t\tconst sortFn = this.options.sortAnchorsFn ?? (() => 0);\n\t\tconst compareFn = (a: BufferingPathVisitor, b: BufferingPathVisitor): number => {\n\t\t\tconst pathA = this.visitorLocations.get(a);\n\t\t\tconst pathB = this.visitorLocations.get(b);\n\t\t\tassert(pathA !== undefined, 0x6dd /* pathA expected to be defined */);\n\t\t\tassert(pathB !== undefined, 0x6de /* pathB expected to be defined */);\n\t\t\treturn sortFn(pathA, pathB);\n\t\t};\n\t\tconst sortedVisitors: BufferingPathVisitor[] = nativeSort(unsortedVisitors, compareFn);\n\t\tfor (const visitor of sortedVisitors) {\n\t\t\tvisitor.flush();\n\t\t}\n\t\treturn this;\n\t}\n\n\tprivate enableAutoFlush(): FlushableDataBinder<OperationBinderEvents> {\n\t\tconst callbackFn = (() => {\n\t\t\tthis.flush();\n\t\t}) as E[keyof Listeners<E>];\n\t\tconst unregisterFlushing = this.view.on(this.autoFlushPolicy, callbackFn);\n\t\tthis.unregisterHandles.add(unregisterFlushing);\n\t\treturn this;\n\t}\n}\n\nclass DirectDataBinder<E extends Listeners<E>> extends AbstractDataBinder<\n\tOperationBinderEvents,\n\tDirectPathVisitor,\n\tBinderOptions\n> {\n\tpublic constructor(view: Listenable<E>, options: BinderOptions) {\n\t\tsuper(options, (anchor: FlexTreeNode) => new DirectPathVisitor(options));\n\t}\n}\n\nclass InvalidateDataBinder<E extends Listeners<E>>\n\textends AbstractDataBinder<\n\t\tInvalidationBinderEvents,\n\t\tInvalidatingPathVisitor,\n\t\tFlushableBinderOptions<E>\n\t>\n\timplements FlushableDataBinder<InvalidationBinderEvents>\n{\n\tprotected readonly view: Listenable<E>;\n\tprotected readonly autoFlushPolicy: keyof Listeners<E>;\n\tpublic constructor(view: Listenable<E>, options: FlushableBinderOptions<E>) {\n\t\tsuper(options, (anchor: FlexTreeNode) => new InvalidatingPathVisitor(options));\n\t\tthis.view = view;\n\t\tthis.autoFlushPolicy = options.autoFlushPolicy;\n\t\tif (options.autoFlush) {\n\t\t\tthis.enableAutoFlush();\n\t\t}\n\t}\n\tpublic flush(): FlushableDataBinder<InvalidationBinderEvents> {\n\t\tfor (const visitor of this.visitors.values()) {\n\t\t\tvisitor.flush();\n\t\t}\n\t\treturn this;\n\t}\n\tprivate enableAutoFlush(): FlushableDataBinder<InvalidationBinderEvents> {\n\t\tconst callbackFn = (() => {\n\t\t\tthis.flush();\n\t\t}) as E[keyof Listeners<E>];\n\t\tconst unregisterFlushing = this.view.on(this.autoFlushPolicy, callbackFn);\n\t\tthis.unregisterHandles.add(unregisterFlushing);\n\t\treturn this;\n\t}\n}\n\n/**\n * Compute a top-town {@link DownPath} from an {@link UpPath}.\n */\nexport function toDownPath(upPath: UpPath): DownPath {\n\tconst downPath: UpPath[] = topDownPath(upPath);\n\tconst stepDownPath: PathStep[] = downPath.map((u) => {\n\t\treturn { field: u.parentField, index: u.parentIndex };\n\t});\n\tstepDownPath.shift(); // remove last step to the root node\n\treturn stepDownPath;\n}\n\n/**\n * Create a buffering data binder.\n */\nexport function createDataBinderBuffering<E extends Listeners<E>>(\n\tview: Listenable<E>,\n\toptions: FlushableBinderOptions<E>,\n): FlushableDataBinder<OperationBinderEvents> {\n\treturn new BufferingDataBinder(view, options);\n}\n\n/**\n * Create a direct data binder.\n */\nexport function createDataBinderDirect<E extends Listeners<E>>(\n\tview: Listenable<E>,\n\toptions: BinderOptions,\n): DataBinder<OperationBinderEvents> {\n\treturn new DirectDataBinder(view, options);\n}\n\n/**\n * Create an invalidating data binder.\n */\nexport function createDataBinderInvalidating<E extends Listeners<E>>(\n\tview: Listenable<E>,\n\toptions: FlushableBinderOptions<E>,\n): FlushableDataBinder<InvalidationBinderEvents> {\n\treturn new InvalidateDataBinder(view, options);\n}\n\n/**\n * Create binder options. If not specified, the default values are:\n * - sortFn: no sorting\n */\nexport function createBinderOptions({\n\tsortFn,\n}: { sortFn?: BinderEventsCompare }): BinderOptions {\n\treturn { sortFn };\n}\n\n/**\n * Create flushable binder options. If not specified, the default values are:\n * - sortFn: no sorting\n * - sortAnchorsFn: no sorting\n * - autoFlush: true\n */\nexport function createFlushableBinderOptions<E extends Listeners<E>>({\n\tsortFn,\n\tsortAnchorsFn,\n\tautoFlush = true,\n\tautoFlushPolicy,\n}: {\n\tsortFn?: BinderEventsCompare;\n\tsortAnchorsFn?: AnchorsCompare;\n\tautoFlush?: boolean;\n\tautoFlushPolicy: keyof Listeners<E>;\n}): FlushableBinderOptions<E> {\n\treturn {\n\t\tsortFn,\n\t\tsortAnchorsFn,\n\t\tautoFlush,\n\t\tautoFlushPolicy,\n\t};\n}\n\n/**\n * Utility to create a compare function from a list of compare functions.\n *\n * @param fns - a list of compare functions\n * @returns a compare function that can be used for sorting\n */\nexport function comparePipeline<T>(...fns: CompareFunction<T>[]): CompareFunction<T> {\n\treturn (a: T, b: T): number => {\n\t\tfor (const fn of fns) {\n\t\t\tconst result = fn(a, b);\n\t\t\tif (result !== 0) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t};\n}\n\n/**\n * Native sorting algorithm.\n *\n * @param arr - the array to sort\n * @param compareFn - the compare function\n * @returns the sorted array\n */\nfunction nativeSort<T>(arr: T[], compareFn: CompareFunction<T>): T[] {\n\treturn [...arr].sort(compareFn);\n}\n\n/**\n * Compiles a (user friendly) syntax tree into the internal binding structure.\n * The syntax tree is a compact representation of related {@link BindPath}s.\n * The match policy can be specified. If not specified, the default value is \"path\".\n * @returns a {@link BindPolicy} object\n */\nexport function compileSyntaxTree(\n\tsyntaxTree: BindSyntaxTree,\n\tmatchPolicy?: MatchPolicy,\n): BindPolicy {\n\tconst entries = Object.entries(syntaxTree);\n\tif (entries.length === 1) {\n\t\tconst [fieldName, childNode] = entries[0] ?? oob();\n\t\tconst fieldKey: FieldKey = brand(fieldName);\n\t\tconst bindTree = compileSyntaxTreeNode(childNode as BindSyntaxTree, fieldKey);\n\t\treturn { matchPolicy: matchPolicy ?? \"path\", bindTree };\n\t} else throw new Error(\"Invalid BindSyntaxTree structure\");\n}\n\nfunction compileSyntaxTreeNode(node: BindSyntaxTree | true, parentField: FieldKey): BindTree {\n\tif (node === true) return { field: parentField, children: new Map() };\n\tconst pathStep: PathStep = {\n\t\tfield: parentField,\n\t\tindex: node[indexSymbol],\n\t};\n\tconst children = new Map<FieldKey, BindTree>();\n\tfor (const [key, value] of Object.entries(node)) {\n\t\tconst fieldKey: FieldKey = brand(key);\n\t\tchildren.set(fieldKey, compileSyntaxTreeNode(value, fieldKey));\n\t}\n\treturn {\n\t\t...pathStep,\n\t\tchildren,\n\t};\n}\n"]}
@@ -9,7 +9,6 @@ import type { FlexTreeSchema } from "./typed-schema/index.js";
9
9
  * TODO:
10
10
  * Currently being exposed at the package level which also requires us to export MapTree at the package level.
11
11
  * Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.
12
- * @internal
13
12
  */
14
13
  export interface TreeDataContext {
15
14
  /**
@@ -33,7 +32,6 @@ export interface TreeDataContext {
33
32
  * TODO:
34
33
  * Currently being exposed at the package level which also requires us to export MapTree at the package level.
35
34
  * Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.
36
- * @internal
37
35
  */
38
36
  export type FieldGenerator = () => MapTree[];
39
37
  /**
@@ -41,6 +39,5 @@ export type FieldGenerator = () => MapTree[];
41
39
  * TODO:
42
40
  * Currently being exposed at the package level which also requires us to export MapTree at the package level.
43
41
  * Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.
44
- * @internal
45
42
  */
46
43
  //# sourceMappingURL=fieldGenerator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fieldGenerator.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/fieldGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAEhC;;;;;;;;;OASG;IACH,WAAW,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,qBAAqB,GAAG,SAAS,GAAG,cAAc,CAAC;CACvF;AAED;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,EAAE,CAAC;AAC7C;;;;;;GAMG"}
1
+ {"version":3,"file":"fieldGenerator.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/fieldGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAEhC;;;;;;;;;OASG;IACH,WAAW,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,qBAAqB,GAAG,SAAS,GAAG,cAAc,CAAC;CACvF;AAED;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,EAAE,CAAC;AAC7C;;;;;GAKG"}
@@ -8,6 +8,5 @@ export {};
8
8
  * TODO:
9
9
  * Currently being exposed at the package level which also requires us to export MapTree at the package level.
10
10
  * Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.
11
- * @internal
12
11
  */
13
12
  //# sourceMappingURL=fieldGenerator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fieldGenerator.js","sourceRoot":"","sources":["../../src/feature-libraries/fieldGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAwCH;;;;;;GAMG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FieldKey, MapTree, TreeFieldStoredSchema } from \"../core/index.js\";\n\nimport type { FlexTreeSchema } from \"./typed-schema/index.js\";\n\n/**\n * Information needed to interpret a subtree described by {@link ContextuallyTypedNodeData} and {@link ContextuallyTypedFieldData}.\n * TODO:\n * Currently being exposed at the package level which also requires us to export MapTree at the package level.\n * Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.\n * @internal\n */\nexport interface TreeDataContext {\n\t/**\n\t * Schema for the document which the tree will be used in.\n\t */\n\treadonly schema: FlexTreeSchema;\n\n\t/**\n\t * Procedural data generator for fields.\n\t * Fields which provide generators here can be omitted in the input contextually typed data.\n\t *\n\t * @remarks\n\t * TODO:\n\t * For implementers of this which are not pure (like identifier generation),\n\t * order of invocation should be made consistent and documented.\n\t * This will be important for identifier elision optimizations in tree encoding for session based identifier generation.\n\t */\n\tfieldSource?(key: FieldKey, schema: TreeFieldStoredSchema): undefined | FieldGenerator;\n}\n\n/**\n * Generates field content for a MapTree on demand.\n * TODO:\n * Currently being exposed at the package level which also requires us to export MapTree at the package level.\n * Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.\n * @internal\n */\nexport type FieldGenerator = () => MapTree[];\n/**\n * Information needed to interpret a subtree described by {@link ContextuallyTypedNodeData} and {@link ContextuallyTypedFieldData}.\n * TODO:\n * Currently being exposed at the package level which also requires us to export MapTree at the package level.\n * Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.\n * @internal\n */\n"]}
1
+ {"version":3,"file":"fieldGenerator.js","sourceRoot":"","sources":["../../src/feature-libraries/fieldGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAsCH;;;;;GAKG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FieldKey, MapTree, TreeFieldStoredSchema } from \"../core/index.js\";\n\nimport type { FlexTreeSchema } from \"./typed-schema/index.js\";\n\n/**\n * Information needed to interpret a subtree described by {@link ContextuallyTypedNodeData} and {@link ContextuallyTypedFieldData}.\n * TODO:\n * Currently being exposed at the package level which also requires us to export MapTree at the package level.\n * Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.\n */\nexport interface TreeDataContext {\n\t/**\n\t * Schema for the document which the tree will be used in.\n\t */\n\treadonly schema: FlexTreeSchema;\n\n\t/**\n\t * Procedural data generator for fields.\n\t * Fields which provide generators here can be omitted in the input contextually typed data.\n\t *\n\t * @remarks\n\t * TODO:\n\t * For implementers of this which are not pure (like identifier generation),\n\t * order of invocation should be made consistent and documented.\n\t * This will be important for identifier elision optimizations in tree encoding for session based identifier generation.\n\t */\n\tfieldSource?(key: FieldKey, schema: TreeFieldStoredSchema): undefined | FieldGenerator;\n}\n\n/**\n * Generates field content for a MapTree on demand.\n * TODO:\n * Currently being exposed at the package level which also requires us to export MapTree at the package level.\n * Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.\n */\nexport type FieldGenerator = () => MapTree[];\n/**\n * Information needed to interpret a subtree described by {@link ContextuallyTypedNodeData} and {@link ContextuallyTypedFieldData}.\n * TODO:\n * Currently being exposed at the package level which also requires us to export MapTree at the package level.\n * Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.\n */\n"]}
@@ -2,5 +2,5 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { type MapTreeNode, isMapTreeNode, getOrCreateNode, getOrCreateMapTreeNode, tryGetMapTreeNode, } from "./mapTreeNode.js";
5
+ export { type MapTreeNode, type MapTreeSequenceField, isMapTreeNode, isMapTreeSequenceField, getOrCreateMapTreeNode, tryGetMapTreeNode, } from "./mapTreeNode.js";
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-map-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,WAAW,EAChB,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,iBAAiB,GACjB,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-map-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,GACjB,MAAM,kBAAkB,CAAC"}
@@ -2,5 +2,5 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { isMapTreeNode, getOrCreateNode, getOrCreateMapTreeNode, tryGetMapTreeNode, } from "./mapTreeNode.js";
5
+ export { isMapTreeNode, isMapTreeSequenceField, getOrCreateMapTreeNode, tryGetMapTreeNode, } from "./mapTreeNode.js";
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-map-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,iBAAiB,GACjB,MAAM,kBAAkB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype MapTreeNode,\n\tisMapTreeNode,\n\tgetOrCreateNode,\n\tgetOrCreateMapTreeNode,\n\ttryGetMapTreeNode,\n} from \"./mapTreeNode.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-map-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGN,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,GACjB,MAAM,kBAAkB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype MapTreeNode,\n\ttype MapTreeSequenceField,\n\tisMapTreeNode,\n\tisMapTreeSequenceField,\n\tgetOrCreateMapTreeNode,\n\ttryGetMapTreeNode,\n} from \"./mapTreeNode.js\";\n"]}