@fluidframework/tree 2.1.0 → 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 (1457) hide show
  1. package/.mocharc.customBenchmarks.cjs +33 -0
  2. package/CHANGELOG.md +297 -0
  3. package/README.md +34 -4
  4. package/api-extractor.json +17 -0
  5. package/api-report/tree.alpha.api.md +119 -25
  6. package/api-report/tree.beta.api.md +51 -25
  7. package/api-report/tree.public.api.md +51 -25
  8. package/dist/beta.d.ts +3 -1
  9. package/dist/codec/discriminatedUnions.d.ts +11 -5
  10. package/dist/codec/discriminatedUnions.d.ts.map +1 -1
  11. package/dist/codec/discriminatedUnions.js.map +1 -1
  12. package/dist/codec/index.d.ts +1 -1
  13. package/dist/codec/index.d.ts.map +1 -1
  14. package/dist/codec/index.js.map +1 -1
  15. package/dist/core/forest/editableForest.d.ts +1 -5
  16. package/dist/core/forest/editableForest.d.ts.map +1 -1
  17. package/dist/core/forest/editableForest.js.map +1 -1
  18. package/dist/core/forest/forest.d.ts +0 -6
  19. package/dist/core/forest/forest.d.ts.map +1 -1
  20. package/dist/core/forest/forest.js +0 -2
  21. package/dist/core/forest/forest.js.map +1 -1
  22. package/dist/core/index.d.ts +2 -2
  23. package/dist/core/index.d.ts.map +1 -1
  24. package/dist/core/index.js +3 -4
  25. package/dist/core/index.js.map +1 -1
  26. package/dist/core/rebase/changeRebaser.d.ts +0 -4
  27. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  28. package/dist/core/rebase/changeRebaser.js.map +1 -1
  29. package/dist/core/rebase/index.d.ts +1 -1
  30. package/dist/core/rebase/index.d.ts.map +1 -1
  31. package/dist/core/rebase/index.js +1 -3
  32. package/dist/core/rebase/index.js.map +1 -1
  33. package/dist/core/rebase/types.d.ts +1 -8
  34. package/dist/core/rebase/types.d.ts.map +1 -1
  35. package/dist/core/rebase/types.js +1 -9
  36. package/dist/core/rebase/types.js.map +1 -1
  37. package/dist/core/rebase/utils.d.ts +0 -1
  38. package/dist/core/rebase/utils.d.ts.map +1 -1
  39. package/dist/core/rebase/utils.js +12 -7
  40. package/dist/core/rebase/utils.js.map +1 -1
  41. package/dist/core/schema-stored/multiplicity.d.ts +0 -1
  42. package/dist/core/schema-stored/multiplicity.d.ts.map +1 -1
  43. package/dist/core/schema-stored/multiplicity.js +0 -1
  44. package/dist/core/schema-stored/multiplicity.js.map +1 -1
  45. package/dist/core/schema-stored/schema.d.ts +0 -7
  46. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  47. package/dist/core/schema-stored/schema.js +0 -4
  48. package/dist/core/schema-stored/schema.js.map +1 -1
  49. package/dist/core/schema-stored/storedSchemaRepository.d.ts +0 -3
  50. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  51. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  52. package/dist/core/schema-view/view.d.ts +0 -3
  53. package/dist/core/schema-view/view.d.ts.map +1 -1
  54. package/dist/core/schema-view/view.js +0 -1
  55. package/dist/core/schema-view/view.js.map +1 -1
  56. package/dist/core/tree/anchorSet.d.ts +0 -10
  57. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  58. package/dist/core/tree/anchorSet.js +1 -4
  59. package/dist/core/tree/anchorSet.js.map +1 -1
  60. package/dist/core/tree/cursor.d.ts +1 -6
  61. package/dist/core/tree/cursor.d.ts.map +1 -1
  62. package/dist/core/tree/cursor.js +0 -2
  63. package/dist/core/tree/cursor.js.map +1 -1
  64. package/dist/core/tree/delta.d.ts +0 -11
  65. package/dist/core/tree/delta.d.ts.map +1 -1
  66. package/dist/core/tree/delta.js.map +1 -1
  67. package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  68. package/dist/core/tree/detachedFieldIndexCodec.js +3 -2
  69. package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
  70. package/dist/core/tree/detachedFieldIndexTypes.d.ts +0 -1
  71. package/dist/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  72. package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
  73. package/dist/core/tree/index.d.ts +1 -1
  74. package/dist/core/tree/index.d.ts.map +1 -1
  75. package/dist/core/tree/index.js +3 -1
  76. package/dist/core/tree/index.js.map +1 -1
  77. package/dist/core/tree/mapTree.d.ts +20 -4
  78. package/dist/core/tree/mapTree.d.ts.map +1 -1
  79. package/dist/core/tree/mapTree.js +29 -0
  80. package/dist/core/tree/mapTree.js.map +1 -1
  81. package/dist/core/tree/pathTree.d.ts +0 -11
  82. package/dist/core/tree/pathTree.d.ts.map +1 -1
  83. package/dist/core/tree/pathTree.js.map +1 -1
  84. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  85. package/dist/core/tree/treeTextFormat.js +3 -2
  86. package/dist/core/tree/treeTextFormat.js.map +1 -1
  87. package/dist/core/tree/types.d.ts +0 -11
  88. package/dist/core/tree/types.d.ts.map +1 -1
  89. package/dist/core/tree/types.js +0 -4
  90. package/dist/core/tree/types.js.map +1 -1
  91. package/dist/core/tree/visitDelta.d.ts +0 -1
  92. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  93. package/dist/core/tree/visitDelta.js +2 -2
  94. package/dist/core/tree/visitDelta.js.map +1 -1
  95. package/dist/core/tree/visitPath.d.ts +0 -2
  96. package/dist/core/tree/visitPath.d.ts.map +1 -1
  97. package/dist/core/tree/visitPath.js.map +1 -1
  98. package/dist/core/tree/visitorUtils.d.ts +0 -1
  99. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  100. package/dist/core/tree/visitorUtils.js.map +1 -1
  101. package/dist/domains/index.d.ts +1 -1
  102. package/dist/domains/index.d.ts.map +1 -1
  103. package/dist/domains/index.js +2 -1
  104. package/dist/domains/index.js.map +1 -1
  105. package/dist/domains/json/index.d.ts +1 -1
  106. package/dist/domains/json/index.d.ts.map +1 -1
  107. package/dist/domains/json/index.js +2 -1
  108. package/dist/domains/json/index.js.map +1 -1
  109. package/dist/domains/json/jsonCursor.d.ts +36 -2
  110. package/dist/domains/json/jsonCursor.d.ts.map +1 -1
  111. package/dist/domains/json/jsonCursor.js +76 -5
  112. package/dist/domains/json/jsonCursor.js.map +1 -1
  113. package/dist/domains/json/jsonDomainSchema.d.ts +13 -3
  114. package/dist/domains/json/jsonDomainSchema.d.ts.map +1 -1
  115. package/dist/domains/json/jsonDomainSchema.js +12 -4
  116. package/dist/domains/json/jsonDomainSchema.js.map +1 -1
  117. package/dist/domains/leafDomain.d.ts +0 -1
  118. package/dist/domains/leafDomain.d.ts.map +1 -1
  119. package/dist/domains/leafDomain.js +0 -1
  120. package/dist/domains/leafDomain.js.map +1 -1
  121. package/dist/domains/schemaBuilder.d.ts +1 -7
  122. package/dist/domains/schemaBuilder.d.ts.map +1 -1
  123. package/dist/domains/schemaBuilder.js +0 -10
  124. package/dist/domains/schemaBuilder.js.map +1 -1
  125. package/dist/events/events.d.ts +0 -4
  126. package/dist/events/events.d.ts.map +1 -1
  127. package/dist/events/events.js +0 -1
  128. package/dist/events/events.js.map +1 -1
  129. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  130. package/dist/feature-libraries/chunked-forest/basicChunk.js +8 -3
  131. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  132. package/dist/feature-libraries/chunked-forest/chunk.d.ts +1 -1
  133. package/dist/feature-libraries/chunked-forest/chunk.d.ts.map +1 -1
  134. package/dist/feature-libraries/chunked-forest/chunk.js.map +1 -1
  135. package/dist/feature-libraries/chunked-forest/chunkTree.js +3 -3
  136. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  137. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  138. package/dist/feature-libraries/chunked-forest/chunkedForest.js +7 -5
  139. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  140. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +1 -1
  141. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  142. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  143. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +8 -5
  144. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  145. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  146. package/dist/feature-libraries/chunked-forest/uniformChunk.js +5 -3
  147. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  148. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -24
  149. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  150. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +9 -19
  151. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  152. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -6
  153. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  154. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
  155. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  156. package/dist/feature-libraries/default-schema/defaultSchema.d.ts +0 -1
  157. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  158. package/dist/feature-libraries/default-schema/defaultSchema.js +0 -1
  159. package/dist/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  160. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  161. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  162. package/dist/feature-libraries/default-schema/index.js +2 -1
  163. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  164. package/dist/feature-libraries/default-schema/schemaChecker.d.ts +6 -0
  165. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  166. package/dist/feature-libraries/default-schema/schemaChecker.js +6 -0
  167. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  168. package/dist/feature-libraries/editableTreeBinder.d.ts +0 -67
  169. package/dist/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  170. package/dist/feature-libraries/editableTreeBinder.js +5 -24
  171. package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
  172. package/dist/feature-libraries/fieldGenerator.d.ts +0 -3
  173. package/dist/feature-libraries/fieldGenerator.d.ts.map +1 -1
  174. package/dist/feature-libraries/fieldGenerator.js +0 -1
  175. package/dist/feature-libraries/fieldGenerator.js.map +1 -1
  176. package/dist/feature-libraries/flex-map-tree/index.d.ts +1 -1
  177. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  178. package/dist/feature-libraries/flex-map-tree/index.js +2 -2
  179. package/dist/feature-libraries/flex-map-tree/index.js.map +1 -1
  180. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +57 -49
  181. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  182. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +171 -168
  183. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  184. package/dist/feature-libraries/flex-tree/context.d.ts +0 -1
  185. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  186. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  187. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +17 -282
  188. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  189. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +0 -4
  190. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  191. package/dist/feature-libraries/flex-tree/index.d.ts +1 -1
  192. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  193. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  194. package/dist/feature-libraries/flex-tree/lazyField.d.ts +9 -26
  195. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  196. package/dist/feature-libraries/flex-tree/lazyField.js +26 -99
  197. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  198. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +2 -10
  199. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  200. package/dist/feature-libraries/flex-tree/lazyNode.js +3 -42
  201. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  202. package/dist/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
  203. package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  204. package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  205. package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -1
  206. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  207. package/dist/feature-libraries/flex-tree/utilities.js +4 -0
  208. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  209. package/dist/feature-libraries/forest-summary/codec.js +2 -2
  210. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  211. package/dist/feature-libraries/index.d.ts +6 -8
  212. package/dist/feature-libraries/index.d.ts.map +1 -1
  213. package/dist/feature-libraries/index.js +7 -18
  214. package/dist/feature-libraries/index.js.map +1 -1
  215. package/dist/feature-libraries/mapTreeCursor.d.ts +6 -2
  216. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  217. package/dist/feature-libraries/mapTreeCursor.js +9 -1
  218. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  219. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
  220. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
  221. package/dist/feature-libraries/memoizedIdRangeAllocator.js +0 -1
  222. package/dist/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
  223. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
  224. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  225. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
  226. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  227. package/dist/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
  228. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  229. package/dist/feature-libraries/modular-schema/discrepancies.js +105 -2
  230. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  231. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
  232. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  233. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
  234. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  235. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
  236. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  237. package/dist/feature-libraries/modular-schema/fieldKind.js +1 -2
  238. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  239. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
  240. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  241. package/dist/feature-libraries/modular-schema/genericFieldKind.js +57 -85
  242. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  243. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
  244. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  245. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +5 -8
  246. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  247. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
  248. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  249. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js +6 -0
  250. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  251. package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
  252. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  253. package/dist/feature-libraries/modular-schema/index.js +2 -1
  254. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  255. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  256. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +39 -22
  257. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  258. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
  259. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  260. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +192 -228
  261. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  262. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
  263. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  264. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  265. package/dist/feature-libraries/node-key/nodeKey.d.ts +0 -4
  266. package/dist/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
  267. package/dist/feature-libraries/node-key/nodeKey.js +0 -2
  268. package/dist/feature-libraries/node-key/nodeKey.js.map +1 -1
  269. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
  270. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
  271. package/dist/feature-libraries/node-key/nodeKeyManager.js.map +1 -1
  272. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  273. package/dist/feature-libraries/object-forest/objectForest.js +1 -10
  274. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  275. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  276. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  277. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  278. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  279. package/dist/feature-libraries/schemaBuilderBase.d.ts +2 -28
  280. package/dist/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
  281. package/dist/feature-libraries/schemaBuilderBase.js +1 -27
  282. package/dist/feature-libraries/schemaBuilderBase.js.map +1 -1
  283. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  284. package/dist/feature-libraries/sequence-field/compose.js +24 -21
  285. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  286. package/dist/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  287. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  288. package/dist/feature-libraries/sequence-field/formatV2.js +7 -6
  289. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  290. package/dist/feature-libraries/sequence-field/formatV3.d.ts +195 -0
  291. package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
  292. package/dist/feature-libraries/sequence-field/formatV3.js +23 -0
  293. package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -0
  294. package/dist/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
  295. package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  296. package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  297. package/dist/feature-libraries/sequence-field/index.d.ts +1 -1
  298. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  299. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  300. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  301. package/dist/feature-libraries/sequence-field/invert.js +21 -13
  302. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  303. package/dist/feature-libraries/sequence-field/markQueue.js +1 -1
  304. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  305. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
  306. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  307. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  308. package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  309. package/dist/feature-libraries/sequence-field/rebase.js +24 -6
  310. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  311. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  312. package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -3
  313. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  314. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  315. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +38 -4
  316. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  317. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
  318. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  319. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +54 -9
  320. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  321. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
  322. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
  323. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +85 -0
  324. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
  325. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  326. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
  327. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  328. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  329. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +4 -1
  330. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  331. package/dist/feature-libraries/sequence-field/types.d.ts +23 -4
  332. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  333. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  334. package/dist/feature-libraries/sequence-field/utils.d.ts +5 -4
  335. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  336. package/dist/feature-libraries/sequence-field/utils.js +70 -42
  337. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  338. package/dist/feature-libraries/storedToViewSchema.d.ts +0 -1
  339. package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  340. package/dist/feature-libraries/storedToViewSchema.js +0 -1
  341. package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
  342. package/dist/feature-libraries/treeCursorUtils.d.ts +0 -6
  343. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  344. package/dist/feature-libraries/treeCursorUtils.js +8 -6
  345. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  346. package/dist/feature-libraries/treeTextCursor.d.ts +0 -2
  347. package/dist/feature-libraries/treeTextCursor.d.ts.map +1 -1
  348. package/dist/feature-libraries/treeTextCursor.js +0 -2
  349. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  350. package/dist/feature-libraries/typed-schema/flexList.d.ts +0 -3
  351. package/dist/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  352. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  353. package/dist/feature-libraries/typed-schema/index.d.ts +1 -1
  354. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  355. package/dist/feature-libraries/typed-schema/index.js +1 -3
  356. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  357. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  358. package/dist/feature-libraries/typed-schema/schemaCollection.js +0 -4
  359. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  360. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
  361. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  362. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +1 -40
  363. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  364. package/dist/feature-libraries/typed-schema/view.d.ts +0 -1
  365. package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
  366. package/dist/feature-libraries/typed-schema/view.js.map +1 -1
  367. package/dist/index.d.ts +8 -9
  368. package/dist/index.d.ts.map +1 -1
  369. package/dist/index.js +31 -90
  370. package/dist/index.js.map +1 -1
  371. package/dist/internalTypes.d.ts +1 -1
  372. package/dist/internalTypes.d.ts.map +1 -1
  373. package/dist/internalTypes.js.map +1 -1
  374. package/dist/packageVersion.d.ts +1 -1
  375. package/dist/packageVersion.js +1 -1
  376. package/dist/packageVersion.js.map +1 -1
  377. package/dist/public.d.ts +3 -1
  378. package/dist/shared-tree/schematizeTree.d.ts +2 -11
  379. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  380. package/dist/shared-tree/schematizeTree.js +13 -2
  381. package/dist/shared-tree/schematizeTree.js.map +1 -1
  382. package/dist/shared-tree/schematizingTreeView.d.ts +4 -4
  383. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  384. package/dist/shared-tree/schematizingTreeView.js +2 -2
  385. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  386. package/dist/shared-tree/sharedTree.d.ts +4 -17
  387. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  388. package/dist/shared-tree/sharedTree.js +4 -8
  389. package/dist/shared-tree/sharedTree.js.map +1 -1
  390. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  391. package/dist/shared-tree/sharedTreeChangeCodecs.js +4 -0
  392. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  393. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  394. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  395. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
  396. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  397. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  398. package/dist/shared-tree/treeApi.js +2 -2
  399. package/dist/shared-tree/treeApi.js.map +1 -1
  400. package/dist/shared-tree/treeCheckout.d.ts +0 -5
  401. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  402. package/dist/shared-tree/treeCheckout.js +5 -3
  403. package/dist/shared-tree/treeCheckout.js.map +1 -1
  404. package/dist/shared-tree/treeView.d.ts +3 -6
  405. package/dist/shared-tree/treeView.d.ts.map +1 -1
  406. package/dist/shared-tree/treeView.js.map +1 -1
  407. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  408. package/dist/shared-tree-core/branch.js +11 -6
  409. package/dist/shared-tree-core/branch.js.map +1 -1
  410. package/dist/shared-tree-core/defaultResubmitMachine.js +3 -3
  411. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  412. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  413. package/dist/shared-tree-core/editManagerCodecs.js +1 -0
  414. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  415. package/dist/shared-tree-core/editManagerFormat.d.ts +2 -2
  416. package/dist/shared-tree-core/editManagerFormat.d.ts.map +1 -1
  417. package/dist/shared-tree-core/editManagerFormat.js +6 -1
  418. package/dist/shared-tree-core/editManagerFormat.js.map +1 -1
  419. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  420. package/dist/shared-tree-core/messageCodecs.js +1 -0
  421. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  422. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  423. package/dist/shared-tree-core/sharedTreeCore.js +3 -1
  424. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  425. package/dist/simple-tree/api/create.d.ts +54 -0
  426. package/dist/simple-tree/api/create.d.ts.map +1 -0
  427. package/dist/simple-tree/api/create.js +99 -0
  428. package/dist/simple-tree/api/create.js.map +1 -0
  429. package/dist/simple-tree/api/index.d.ts +12 -0
  430. package/dist/simple-tree/api/index.d.ts.map +1 -0
  431. package/dist/simple-tree/api/index.js +28 -0
  432. package/dist/simple-tree/api/index.js.map +1 -0
  433. package/{lib/simple-tree → dist/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
  434. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
  435. package/dist/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
  436. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -0
  437. package/dist/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
  438. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -0
  439. package/dist/simple-tree/{schemaFactory.js → api/schemaFactory.js} +10 -9
  440. package/dist/simple-tree/api/schemaFactory.js.map +1 -0
  441. package/{lib/simple-tree → dist/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
  442. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
  443. package/dist/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
  444. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
  445. package/dist/simple-tree/api/testRecursiveDomain.d.ts +62 -0
  446. package/dist/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
  447. package/dist/simple-tree/api/testRecursiveDomain.js.map +1 -0
  448. package/{lib/simple-tree → dist/simple-tree/api}/tree.d.ts +111 -20
  449. package/dist/simple-tree/api/tree.d.ts.map +1 -0
  450. package/dist/simple-tree/api/tree.js +173 -0
  451. package/dist/simple-tree/api/tree.js.map +1 -0
  452. package/dist/simple-tree/{treeNodeApi.d.ts → api/treeNodeApi.d.ts} +6 -5
  453. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -0
  454. package/dist/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +28 -20
  455. package/dist/simple-tree/api/treeNodeApi.js.map +1 -0
  456. package/dist/simple-tree/api/verboseTree.d.ts +136 -0
  457. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -0
  458. package/dist/simple-tree/api/verboseTree.js +220 -0
  459. package/dist/simple-tree/api/verboseTree.js.map +1 -0
  460. package/dist/simple-tree/arrayNode.d.ts +3 -3
  461. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  462. package/dist/simple-tree/arrayNode.js +70 -69
  463. package/dist/simple-tree/arrayNode.js.map +1 -1
  464. package/dist/simple-tree/core/index.d.ts +10 -0
  465. package/dist/simple-tree/core/index.d.ts.map +1 -0
  466. package/dist/simple-tree/core/index.js +27 -0
  467. package/dist/simple-tree/core/index.js.map +1 -0
  468. package/{lib/simple-tree → dist/simple-tree/core}/schemaCaching.d.ts +2 -9
  469. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -0
  470. package/dist/simple-tree/{schemaCaching.js → core/schemaCaching.js} +2 -23
  471. package/dist/simple-tree/core/schemaCaching.js.map +1 -0
  472. package/dist/simple-tree/core/treeNodeKernel.d.ts +57 -0
  473. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
  474. package/dist/simple-tree/{treeNodeKernel.js → core/treeNodeKernel.js} +49 -4
  475. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -0
  476. package/dist/simple-tree/core/treeNodeSchema.d.ts +149 -0
  477. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
  478. package/dist/simple-tree/core/treeNodeSchema.js +35 -0
  479. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -0
  480. package/dist/simple-tree/{types.d.ts → core/types.d.ts} +23 -70
  481. package/dist/simple-tree/core/types.d.ts.map +1 -0
  482. package/dist/simple-tree/core/types.js +117 -0
  483. package/dist/simple-tree/core/types.js.map +1 -0
  484. package/dist/simple-tree/core/withType.d.ts +82 -0
  485. package/dist/simple-tree/core/withType.d.ts.map +1 -0
  486. package/dist/simple-tree/core/withType.js +39 -0
  487. package/dist/simple-tree/core/withType.js.map +1 -0
  488. package/dist/simple-tree/getJsonSchema.d.ts +55 -0
  489. package/dist/simple-tree/getJsonSchema.d.ts.map +1 -0
  490. package/dist/simple-tree/getJsonSchema.js +69 -0
  491. package/dist/simple-tree/getJsonSchema.js.map +1 -0
  492. package/dist/simple-tree/getSimpleFieldSchema.d.ts +14 -0
  493. package/dist/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
  494. package/dist/simple-tree/getSimpleFieldSchema.js +29 -0
  495. package/dist/simple-tree/getSimpleFieldSchema.js.map +1 -0
  496. package/dist/simple-tree/getSimpleSchema.d.ts +58 -0
  497. package/dist/simple-tree/getSimpleSchema.d.ts.map +1 -0
  498. package/dist/simple-tree/getSimpleSchema.js +68 -0
  499. package/dist/simple-tree/getSimpleSchema.js.map +1 -0
  500. package/dist/simple-tree/index.d.ts +12 -13
  501. package/dist/simple-tree/index.d.ts.map +1 -1
  502. package/dist/simple-tree/index.js +26 -23
  503. package/dist/simple-tree/index.js.map +1 -1
  504. package/dist/simple-tree/jsonSchema.d.ts +206 -0
  505. package/dist/simple-tree/jsonSchema.d.ts.map +1 -0
  506. package/dist/{feature-libraries/schema-aware/index.js → simple-tree/jsonSchema.js} +1 -1
  507. package/dist/simple-tree/jsonSchema.js.map +1 -0
  508. package/dist/simple-tree/leafNodeSchema.d.ts +1 -1
  509. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  510. package/dist/simple-tree/leafNodeSchema.js +3 -4
  511. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  512. package/dist/simple-tree/mapNode.d.ts +9 -3
  513. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  514. package/dist/simple-tree/mapNode.js +33 -35
  515. package/dist/simple-tree/mapNode.js.map +1 -1
  516. package/dist/simple-tree/objectNode.d.ts +18 -16
  517. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  518. package/dist/simple-tree/objectNode.js +43 -44
  519. package/dist/simple-tree/objectNode.js.map +1 -1
  520. package/dist/simple-tree/objectNodeTypes.d.ts +38 -0
  521. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -0
  522. package/dist/simple-tree/objectNodeTypes.js +19 -0
  523. package/dist/simple-tree/objectNodeTypes.js.map +1 -0
  524. package/dist/simple-tree/proxies.d.ts +6 -25
  525. package/dist/simple-tree/proxies.d.ts.map +1 -1
  526. package/dist/simple-tree/proxies.js +50 -63
  527. package/dist/simple-tree/proxies.js.map +1 -1
  528. package/dist/simple-tree/proxyBinding.d.ts +45 -22
  529. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  530. package/dist/simple-tree/proxyBinding.js +94 -59
  531. package/dist/simple-tree/proxyBinding.js.map +1 -1
  532. package/dist/simple-tree/schemaTypes.d.ts +10 -159
  533. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  534. package/dist/simple-tree/schemaTypes.js +11 -42
  535. package/dist/simple-tree/schemaTypes.js.map +1 -1
  536. package/dist/simple-tree/simpleSchema.d.ts +124 -0
  537. package/dist/simple-tree/simpleSchema.d.ts.map +1 -0
  538. package/dist/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
  539. package/dist/simple-tree/simpleSchema.js.map +1 -0
  540. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
  541. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
  542. package/dist/simple-tree/simpleSchemaToJsonSchema.js +146 -0
  543. package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
  544. package/dist/simple-tree/toFlexSchema.d.ts +4 -12
  545. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  546. package/dist/simple-tree/toFlexSchema.js +42 -52
  547. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  548. package/dist/simple-tree/toMapTree.d.ts +39 -39
  549. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  550. package/dist/simple-tree/toMapTree.js +227 -171
  551. package/dist/simple-tree/toMapTree.js.map +1 -1
  552. package/dist/simple-tree/treeNodeValid.d.ts +74 -0
  553. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -0
  554. package/dist/simple-tree/{types.js → treeNodeValid.js} +18 -111
  555. package/dist/simple-tree/treeNodeValid.js.map +1 -0
  556. package/dist/simple-tree/typesUnsafe.d.ts +35 -4
  557. package/dist/simple-tree/typesUnsafe.d.ts.map +1 -1
  558. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  559. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
  560. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
  561. package/dist/simple-tree/viewSchemaToSimpleSchema.js +171 -0
  562. package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
  563. package/dist/util/brand.d.ts +0 -3
  564. package/dist/util/brand.d.ts.map +1 -1
  565. package/dist/util/brand.js +1 -2
  566. package/dist/util/brand.js.map +1 -1
  567. package/dist/util/brandedMap.d.ts +0 -5
  568. package/dist/util/brandedMap.d.ts.map +1 -1
  569. package/dist/util/brandedMap.js +0 -1
  570. package/dist/util/brandedMap.js.map +1 -1
  571. package/dist/util/idAllocator.d.ts +0 -2
  572. package/dist/util/idAllocator.d.ts.map +1 -1
  573. package/dist/util/idAllocator.js +0 -1
  574. package/dist/util/idAllocator.js.map +1 -1
  575. package/dist/util/index.d.ts +2 -2
  576. package/dist/util/index.d.ts.map +1 -1
  577. package/dist/util/index.js +4 -2
  578. package/dist/util/index.js.map +1 -1
  579. package/dist/util/nestedMap.d.ts +5 -19
  580. package/dist/util/nestedMap.d.ts.map +1 -1
  581. package/dist/util/nestedMap.js +17 -17
  582. package/dist/util/nestedMap.js.map +1 -1
  583. package/dist/util/opaque.d.ts +0 -4
  584. package/dist/util/opaque.d.ts.map +1 -1
  585. package/dist/util/opaque.js +0 -2
  586. package/dist/util/opaque.js.map +1 -1
  587. package/dist/util/rangeMap.d.ts +0 -2
  588. package/dist/util/rangeMap.d.ts.map +1 -1
  589. package/dist/util/rangeMap.js +4 -3
  590. package/dist/util/rangeMap.js.map +1 -1
  591. package/dist/util/transactionResult.d.ts +0 -1
  592. package/dist/util/transactionResult.d.ts.map +1 -1
  593. package/dist/util/transactionResult.js +0 -1
  594. package/dist/util/transactionResult.js.map +1 -1
  595. package/dist/util/typeCheck.d.ts +2 -20
  596. package/dist/util/typeCheck.d.ts.map +1 -1
  597. package/dist/util/typeCheck.js.map +1 -1
  598. package/dist/util/typeCheckTests.d.ts +4 -4
  599. package/dist/util/typeCheckTests.d.ts.map +1 -1
  600. package/dist/util/typeCheckTests.js.map +1 -1
  601. package/dist/util/typeUtils.d.ts +0 -7
  602. package/dist/util/typeUtils.d.ts.map +1 -1
  603. package/dist/util/typeUtils.js.map +1 -1
  604. package/dist/util/utils.d.ts +6 -8
  605. package/dist/util/utils.d.ts.map +1 -1
  606. package/dist/util/utils.js +14 -5
  607. package/dist/util/utils.js.map +1 -1
  608. package/lib/beta.d.ts +3 -1
  609. package/lib/codec/discriminatedUnions.d.ts +11 -5
  610. package/lib/codec/discriminatedUnions.d.ts.map +1 -1
  611. package/lib/codec/discriminatedUnions.js.map +1 -1
  612. package/lib/codec/index.d.ts +1 -1
  613. package/lib/codec/index.d.ts.map +1 -1
  614. package/lib/codec/index.js +1 -1
  615. package/lib/codec/index.js.map +1 -1
  616. package/lib/core/forest/editableForest.d.ts +1 -5
  617. package/lib/core/forest/editableForest.d.ts.map +1 -1
  618. package/lib/core/forest/editableForest.js.map +1 -1
  619. package/lib/core/forest/forest.d.ts +0 -6
  620. package/lib/core/forest/forest.d.ts.map +1 -1
  621. package/lib/core/forest/forest.js +0 -2
  622. package/lib/core/forest/forest.js.map +1 -1
  623. package/lib/core/index.d.ts +2 -2
  624. package/lib/core/index.d.ts.map +1 -1
  625. package/lib/core/index.js +2 -2
  626. package/lib/core/index.js.map +1 -1
  627. package/lib/core/rebase/changeRebaser.d.ts +0 -4
  628. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  629. package/lib/core/rebase/changeRebaser.js.map +1 -1
  630. package/lib/core/rebase/index.d.ts +1 -1
  631. package/lib/core/rebase/index.d.ts.map +1 -1
  632. package/lib/core/rebase/index.js +1 -1
  633. package/lib/core/rebase/index.js.map +1 -1
  634. package/lib/core/rebase/types.d.ts +1 -8
  635. package/lib/core/rebase/types.d.ts.map +1 -1
  636. package/lib/core/rebase/types.js +1 -7
  637. package/lib/core/rebase/types.js.map +1 -1
  638. package/lib/core/rebase/utils.d.ts +0 -1
  639. package/lib/core/rebase/utils.d.ts.map +1 -1
  640. package/lib/core/rebase/utils.js +13 -8
  641. package/lib/core/rebase/utils.js.map +1 -1
  642. package/lib/core/schema-stored/multiplicity.d.ts +0 -1
  643. package/lib/core/schema-stored/multiplicity.d.ts.map +1 -1
  644. package/lib/core/schema-stored/multiplicity.js +0 -1
  645. package/lib/core/schema-stored/multiplicity.js.map +1 -1
  646. package/lib/core/schema-stored/schema.d.ts +0 -7
  647. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  648. package/lib/core/schema-stored/schema.js +0 -4
  649. package/lib/core/schema-stored/schema.js.map +1 -1
  650. package/lib/core/schema-stored/storedSchemaRepository.d.ts +0 -3
  651. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  652. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  653. package/lib/core/schema-view/view.d.ts +0 -3
  654. package/lib/core/schema-view/view.d.ts.map +1 -1
  655. package/lib/core/schema-view/view.js +0 -1
  656. package/lib/core/schema-view/view.js.map +1 -1
  657. package/lib/core/tree/anchorSet.d.ts +0 -10
  658. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  659. package/lib/core/tree/anchorSet.js +1 -4
  660. package/lib/core/tree/anchorSet.js.map +1 -1
  661. package/lib/core/tree/cursor.d.ts +1 -6
  662. package/lib/core/tree/cursor.d.ts.map +1 -1
  663. package/lib/core/tree/cursor.js +0 -2
  664. package/lib/core/tree/cursor.js.map +1 -1
  665. package/lib/core/tree/delta.d.ts +0 -11
  666. package/lib/core/tree/delta.d.ts.map +1 -1
  667. package/lib/core/tree/delta.js.map +1 -1
  668. package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  669. package/lib/core/tree/detachedFieldIndexCodec.js +4 -3
  670. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  671. package/lib/core/tree/detachedFieldIndexTypes.d.ts +0 -1
  672. package/lib/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  673. package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
  674. package/lib/core/tree/index.d.ts +1 -1
  675. package/lib/core/tree/index.d.ts.map +1 -1
  676. package/lib/core/tree/index.js +1 -0
  677. package/lib/core/tree/index.js.map +1 -1
  678. package/lib/core/tree/mapTree.d.ts +20 -4
  679. package/lib/core/tree/mapTree.d.ts.map +1 -1
  680. package/lib/core/tree/mapTree.js +27 -1
  681. package/lib/core/tree/mapTree.js.map +1 -1
  682. package/lib/core/tree/pathTree.d.ts +0 -11
  683. package/lib/core/tree/pathTree.d.ts.map +1 -1
  684. package/lib/core/tree/pathTree.js.map +1 -1
  685. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  686. package/lib/core/tree/treeTextFormat.js +3 -2
  687. package/lib/core/tree/treeTextFormat.js.map +1 -1
  688. package/lib/core/tree/types.d.ts +0 -11
  689. package/lib/core/tree/types.d.ts.map +1 -1
  690. package/lib/core/tree/types.js +0 -4
  691. package/lib/core/tree/types.js.map +1 -1
  692. package/lib/core/tree/visitDelta.d.ts +0 -1
  693. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  694. package/lib/core/tree/visitDelta.js +2 -2
  695. package/lib/core/tree/visitDelta.js.map +1 -1
  696. package/lib/core/tree/visitPath.d.ts +0 -2
  697. package/lib/core/tree/visitPath.d.ts.map +1 -1
  698. package/lib/core/tree/visitPath.js.map +1 -1
  699. package/lib/core/tree/visitorUtils.d.ts +0 -1
  700. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  701. package/lib/core/tree/visitorUtils.js.map +1 -1
  702. package/lib/domains/index.d.ts +1 -1
  703. package/lib/domains/index.d.ts.map +1 -1
  704. package/lib/domains/index.js +1 -1
  705. package/lib/domains/index.js.map +1 -1
  706. package/lib/domains/json/index.d.ts +1 -1
  707. package/lib/domains/json/index.d.ts.map +1 -1
  708. package/lib/domains/json/index.js +1 -1
  709. package/lib/domains/json/index.js.map +1 -1
  710. package/lib/domains/json/jsonCursor.d.ts +36 -2
  711. package/lib/domains/json/jsonCursor.d.ts.map +1 -1
  712. package/lib/domains/json/jsonCursor.js +76 -5
  713. package/lib/domains/json/jsonCursor.js.map +1 -1
  714. package/lib/domains/json/jsonDomainSchema.d.ts +13 -3
  715. package/lib/domains/json/jsonDomainSchema.d.ts.map +1 -1
  716. package/lib/domains/json/jsonDomainSchema.js +9 -1
  717. package/lib/domains/json/jsonDomainSchema.js.map +1 -1
  718. package/lib/domains/leafDomain.d.ts +0 -1
  719. package/lib/domains/leafDomain.d.ts.map +1 -1
  720. package/lib/domains/leafDomain.js +0 -1
  721. package/lib/domains/leafDomain.js.map +1 -1
  722. package/lib/domains/schemaBuilder.d.ts +1 -7
  723. package/lib/domains/schemaBuilder.d.ts.map +1 -1
  724. package/lib/domains/schemaBuilder.js +1 -11
  725. package/lib/domains/schemaBuilder.js.map +1 -1
  726. package/lib/events/events.d.ts +0 -4
  727. package/lib/events/events.d.ts.map +1 -1
  728. package/lib/events/events.js +0 -1
  729. package/lib/events/events.js.map +1 -1
  730. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  731. package/lib/feature-libraries/chunked-forest/basicChunk.js +9 -4
  732. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  733. package/lib/feature-libraries/chunked-forest/chunk.d.ts +1 -1
  734. package/lib/feature-libraries/chunked-forest/chunk.d.ts.map +1 -1
  735. package/lib/feature-libraries/chunked-forest/chunk.js.map +1 -1
  736. package/lib/feature-libraries/chunked-forest/chunkTree.js +4 -4
  737. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  738. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  739. package/lib/feature-libraries/chunked-forest/chunkedForest.js +8 -6
  740. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  741. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +2 -2
  742. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  743. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  744. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +9 -6
  745. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  746. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  747. package/lib/feature-libraries/chunked-forest/uniformChunk.js +6 -4
  748. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  749. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -24
  750. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  751. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +6 -16
  752. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  753. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -6
  754. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  755. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
  756. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  757. package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -1
  758. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  759. package/lib/feature-libraries/default-schema/defaultSchema.js +0 -1
  760. package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  761. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  762. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  763. package/lib/feature-libraries/default-schema/index.js +1 -1
  764. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  765. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +6 -0
  766. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  767. package/lib/feature-libraries/default-schema/schemaChecker.js +6 -0
  768. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  769. package/lib/feature-libraries/editableTreeBinder.d.ts +0 -67
  770. package/lib/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  771. package/lib/feature-libraries/editableTreeBinder.js +6 -25
  772. package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
  773. package/lib/feature-libraries/fieldGenerator.d.ts +0 -3
  774. package/lib/feature-libraries/fieldGenerator.d.ts.map +1 -1
  775. package/lib/feature-libraries/fieldGenerator.js +0 -1
  776. package/lib/feature-libraries/fieldGenerator.js.map +1 -1
  777. package/lib/feature-libraries/flex-map-tree/index.d.ts +1 -1
  778. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  779. package/lib/feature-libraries/flex-map-tree/index.js +1 -1
  780. package/lib/feature-libraries/flex-map-tree/index.js.map +1 -1
  781. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +57 -49
  782. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  783. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +172 -168
  784. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  785. package/lib/feature-libraries/flex-tree/context.d.ts +0 -1
  786. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  787. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  788. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +17 -282
  789. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  790. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +0 -4
  791. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  792. package/lib/feature-libraries/flex-tree/index.d.ts +1 -1
  793. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  794. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  795. package/lib/feature-libraries/flex-tree/lazyField.d.ts +9 -26
  796. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  797. package/lib/feature-libraries/flex-tree/lazyField.js +28 -101
  798. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  799. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +2 -10
  800. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  801. package/lib/feature-libraries/flex-tree/lazyNode.js +4 -42
  802. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  803. package/lib/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
  804. package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  805. package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  806. package/lib/feature-libraries/flex-tree/utilities.d.ts +2 -1
  807. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  808. package/lib/feature-libraries/flex-tree/utilities.js +4 -0
  809. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  810. package/lib/feature-libraries/forest-summary/codec.js +3 -3
  811. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  812. package/lib/feature-libraries/index.d.ts +6 -8
  813. package/lib/feature-libraries/index.d.ts.map +1 -1
  814. package/lib/feature-libraries/index.js +5 -6
  815. package/lib/feature-libraries/index.js.map +1 -1
  816. package/lib/feature-libraries/mapTreeCursor.d.ts +6 -2
  817. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  818. package/lib/feature-libraries/mapTreeCursor.js +7 -0
  819. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  820. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
  821. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
  822. package/lib/feature-libraries/memoizedIdRangeAllocator.js +0 -1
  823. package/lib/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
  824. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
  825. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  826. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
  827. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  828. package/lib/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
  829. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  830. package/lib/feature-libraries/modular-schema/discrepancies.js +103 -1
  831. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  832. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
  833. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  834. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
  835. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  836. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
  837. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  838. package/lib/feature-libraries/modular-schema/fieldKind.js +1 -2
  839. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  840. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
  841. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  842. package/lib/feature-libraries/modular-schema/genericFieldKind.js +56 -83
  843. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  844. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
  845. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  846. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js +6 -9
  847. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  848. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
  849. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  850. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js +4 -1
  851. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  852. package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
  853. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  854. package/lib/feature-libraries/modular-schema/index.js +1 -1
  855. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  856. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  857. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +42 -25
  858. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  859. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
  860. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  861. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +169 -206
  862. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  863. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
  864. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  865. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  866. package/lib/feature-libraries/node-key/nodeKey.d.ts +0 -4
  867. package/lib/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
  868. package/lib/feature-libraries/node-key/nodeKey.js +0 -2
  869. package/lib/feature-libraries/node-key/nodeKey.js.map +1 -1
  870. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
  871. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
  872. package/lib/feature-libraries/node-key/nodeKeyManager.js.map +1 -1
  873. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  874. package/lib/feature-libraries/object-forest/objectForest.js +2 -11
  875. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  876. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  877. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  878. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  879. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  880. package/lib/feature-libraries/schemaBuilderBase.d.ts +2 -28
  881. package/lib/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
  882. package/lib/feature-libraries/schemaBuilderBase.js +2 -28
  883. package/lib/feature-libraries/schemaBuilderBase.js.map +1 -1
  884. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  885. package/lib/feature-libraries/sequence-field/compose.js +25 -22
  886. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  887. package/lib/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  888. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  889. package/lib/feature-libraries/sequence-field/formatV2.js +3 -3
  890. package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
  891. package/lib/feature-libraries/sequence-field/formatV3.d.ts +195 -0
  892. package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
  893. package/lib/feature-libraries/sequence-field/formatV3.js +19 -0
  894. package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -0
  895. package/lib/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
  896. package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  897. package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  898. package/lib/feature-libraries/sequence-field/index.d.ts +1 -1
  899. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  900. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  901. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  902. package/lib/feature-libraries/sequence-field/invert.js +22 -14
  903. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  904. package/lib/feature-libraries/sequence-field/markQueue.js +2 -2
  905. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  906. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
  907. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  908. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  909. package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  910. package/lib/feature-libraries/sequence-field/rebase.js +25 -7
  911. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  912. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  913. package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -3
  914. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  915. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  916. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +40 -6
  917. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  918. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
  919. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  920. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +55 -11
  921. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  922. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
  923. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
  924. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +81 -0
  925. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
  926. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  927. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
  928. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  929. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  930. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +5 -2
  931. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  932. package/lib/feature-libraries/sequence-field/types.d.ts +23 -4
  933. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  934. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  935. package/lib/feature-libraries/sequence-field/utils.d.ts +5 -4
  936. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  937. package/lib/feature-libraries/sequence-field/utils.js +67 -41
  938. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  939. package/lib/feature-libraries/storedToViewSchema.d.ts +0 -1
  940. package/lib/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  941. package/lib/feature-libraries/storedToViewSchema.js +0 -1
  942. package/lib/feature-libraries/storedToViewSchema.js.map +1 -1
  943. package/lib/feature-libraries/treeCursorUtils.d.ts +0 -6
  944. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  945. package/lib/feature-libraries/treeCursorUtils.js +9 -7
  946. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  947. package/lib/feature-libraries/treeTextCursor.d.ts +0 -2
  948. package/lib/feature-libraries/treeTextCursor.d.ts.map +1 -1
  949. package/lib/feature-libraries/treeTextCursor.js +0 -2
  950. package/lib/feature-libraries/treeTextCursor.js.map +1 -1
  951. package/lib/feature-libraries/typed-schema/flexList.d.ts +0 -3
  952. package/lib/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  953. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  954. package/lib/feature-libraries/typed-schema/index.d.ts +1 -1
  955. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  956. package/lib/feature-libraries/typed-schema/index.js +1 -1
  957. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  958. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  959. package/lib/feature-libraries/typed-schema/schemaCollection.js +1 -5
  960. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  961. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
  962. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  963. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +1 -38
  964. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  965. package/lib/feature-libraries/typed-schema/view.d.ts +0 -1
  966. package/lib/feature-libraries/typed-schema/view.d.ts.map +1 -1
  967. package/lib/feature-libraries/typed-schema/view.js.map +1 -1
  968. package/lib/index.d.ts +8 -9
  969. package/lib/index.d.ts.map +1 -1
  970. package/lib/index.js +4 -9
  971. package/lib/index.js.map +1 -1
  972. package/lib/internalTypes.d.ts +1 -1
  973. package/lib/internalTypes.d.ts.map +1 -1
  974. package/lib/internalTypes.js.map +1 -1
  975. package/lib/packageVersion.d.ts +1 -1
  976. package/lib/packageVersion.js +1 -1
  977. package/lib/packageVersion.js.map +1 -1
  978. package/lib/public.d.ts +3 -1
  979. package/lib/shared-tree/schematizeTree.d.ts +2 -11
  980. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  981. package/lib/shared-tree/schematizeTree.js +15 -4
  982. package/lib/shared-tree/schematizeTree.js.map +1 -1
  983. package/lib/shared-tree/schematizingTreeView.d.ts +4 -4
  984. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  985. package/lib/shared-tree/schematizingTreeView.js +3 -3
  986. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  987. package/lib/shared-tree/sharedTree.d.ts +4 -17
  988. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  989. package/lib/shared-tree/sharedTree.js +6 -10
  990. package/lib/shared-tree/sharedTree.js.map +1 -1
  991. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  992. package/lib/shared-tree/sharedTreeChangeCodecs.js +4 -0
  993. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  994. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
  995. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  996. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
  997. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  998. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  999. package/lib/shared-tree/treeApi.js +3 -3
  1000. package/lib/shared-tree/treeApi.js.map +1 -1
  1001. package/lib/shared-tree/treeCheckout.d.ts +0 -5
  1002. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  1003. package/lib/shared-tree/treeCheckout.js +6 -4
  1004. package/lib/shared-tree/treeCheckout.js.map +1 -1
  1005. package/lib/shared-tree/treeView.d.ts +3 -6
  1006. package/lib/shared-tree/treeView.d.ts.map +1 -1
  1007. package/lib/shared-tree/treeView.js.map +1 -1
  1008. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  1009. package/lib/shared-tree-core/branch.js +12 -7
  1010. package/lib/shared-tree-core/branch.js.map +1 -1
  1011. package/lib/shared-tree-core/defaultResubmitMachine.js +4 -4
  1012. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  1013. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  1014. package/lib/shared-tree-core/editManagerCodecs.js +1 -0
  1015. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  1016. package/lib/shared-tree-core/editManagerFormat.d.ts +2 -2
  1017. package/lib/shared-tree-core/editManagerFormat.d.ts.map +1 -1
  1018. package/lib/shared-tree-core/editManagerFormat.js +6 -1
  1019. package/lib/shared-tree-core/editManagerFormat.js.map +1 -1
  1020. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  1021. package/lib/shared-tree-core/messageCodecs.js +1 -0
  1022. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  1023. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  1024. package/lib/shared-tree-core/sharedTreeCore.js +4 -2
  1025. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  1026. package/lib/simple-tree/api/create.d.ts +54 -0
  1027. package/lib/simple-tree/api/create.d.ts.map +1 -0
  1028. package/lib/simple-tree/api/create.js +92 -0
  1029. package/lib/simple-tree/api/create.js.map +1 -0
  1030. package/lib/simple-tree/api/index.d.ts +12 -0
  1031. package/lib/simple-tree/api/index.d.ts.map +1 -0
  1032. package/lib/simple-tree/api/index.js +13 -0
  1033. package/lib/simple-tree/api/index.js.map +1 -0
  1034. package/{dist/simple-tree → lib/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
  1035. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
  1036. package/lib/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
  1037. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -0
  1038. package/lib/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
  1039. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -0
  1040. package/lib/simple-tree/{schemaFactory.js → api/schemaFactory.js} +9 -8
  1041. package/lib/simple-tree/api/schemaFactory.js.map +1 -0
  1042. package/{dist/simple-tree → lib/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
  1043. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
  1044. package/lib/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
  1045. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
  1046. package/lib/simple-tree/api/testRecursiveDomain.d.ts +62 -0
  1047. package/lib/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
  1048. package/lib/simple-tree/api/testRecursiveDomain.js.map +1 -0
  1049. package/{dist/simple-tree → lib/simple-tree/api}/tree.d.ts +111 -20
  1050. package/lib/simple-tree/api/tree.d.ts.map +1 -0
  1051. package/lib/simple-tree/api/tree.js +165 -0
  1052. package/lib/simple-tree/api/tree.js.map +1 -0
  1053. package/lib/simple-tree/{treeNodeApi.d.ts → api/treeNodeApi.d.ts} +6 -5
  1054. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -0
  1055. package/lib/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +25 -17
  1056. package/lib/simple-tree/api/treeNodeApi.js.map +1 -0
  1057. package/lib/simple-tree/api/verboseTree.d.ts +136 -0
  1058. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -0
  1059. package/lib/simple-tree/api/verboseTree.js +213 -0
  1060. package/lib/simple-tree/api/verboseTree.js.map +1 -0
  1061. package/lib/simple-tree/arrayNode.d.ts +3 -3
  1062. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  1063. package/lib/simple-tree/arrayNode.js +56 -53
  1064. package/lib/simple-tree/arrayNode.js.map +1 -1
  1065. package/lib/simple-tree/core/index.d.ts +10 -0
  1066. package/lib/simple-tree/core/index.d.ts.map +1 -0
  1067. package/lib/simple-tree/core/index.js +10 -0
  1068. package/lib/simple-tree/core/index.js.map +1 -0
  1069. package/{dist/simple-tree → lib/simple-tree/core}/schemaCaching.d.ts +2 -9
  1070. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -0
  1071. package/lib/simple-tree/{schemaCaching.js → core/schemaCaching.js} +1 -21
  1072. package/lib/simple-tree/core/schemaCaching.js.map +1 -0
  1073. package/lib/simple-tree/core/treeNodeKernel.d.ts +57 -0
  1074. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
  1075. package/lib/simple-tree/{treeNodeKernel.js → core/treeNodeKernel.js} +45 -3
  1076. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -0
  1077. package/lib/simple-tree/core/treeNodeSchema.d.ts +149 -0
  1078. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
  1079. package/lib/simple-tree/core/treeNodeSchema.js +32 -0
  1080. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -0
  1081. package/lib/simple-tree/{types.d.ts → core/types.d.ts} +23 -70
  1082. package/lib/simple-tree/core/types.d.ts.map +1 -0
  1083. package/lib/simple-tree/core/types.js +111 -0
  1084. package/lib/simple-tree/core/types.js.map +1 -0
  1085. package/lib/simple-tree/core/withType.d.ts +82 -0
  1086. package/lib/simple-tree/core/withType.d.ts.map +1 -0
  1087. package/lib/simple-tree/core/withType.js +36 -0
  1088. package/lib/simple-tree/core/withType.js.map +1 -0
  1089. package/lib/simple-tree/getJsonSchema.d.ts +55 -0
  1090. package/lib/simple-tree/getJsonSchema.d.ts.map +1 -0
  1091. package/lib/simple-tree/getJsonSchema.js +65 -0
  1092. package/lib/simple-tree/getJsonSchema.js.map +1 -0
  1093. package/lib/simple-tree/getSimpleFieldSchema.d.ts +14 -0
  1094. package/lib/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
  1095. package/lib/simple-tree/getSimpleFieldSchema.js +25 -0
  1096. package/lib/simple-tree/getSimpleFieldSchema.js.map +1 -0
  1097. package/lib/simple-tree/getSimpleSchema.d.ts +58 -0
  1098. package/lib/simple-tree/getSimpleSchema.d.ts.map +1 -0
  1099. package/lib/simple-tree/getSimpleSchema.js +64 -0
  1100. package/lib/simple-tree/getSimpleSchema.js.map +1 -0
  1101. package/lib/simple-tree/index.d.ts +12 -13
  1102. package/lib/simple-tree/index.d.ts.map +1 -1
  1103. package/lib/simple-tree/index.js +8 -11
  1104. package/lib/simple-tree/index.js.map +1 -1
  1105. package/lib/simple-tree/jsonSchema.d.ts +206 -0
  1106. package/lib/simple-tree/jsonSchema.d.ts.map +1 -0
  1107. package/lib/simple-tree/{nodeKeys.js → jsonSchema.js} +1 -1
  1108. package/lib/simple-tree/jsonSchema.js.map +1 -0
  1109. package/lib/simple-tree/leafNodeSchema.d.ts +1 -1
  1110. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  1111. package/lib/simple-tree/leafNodeSchema.js +1 -2
  1112. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  1113. package/lib/simple-tree/mapNode.d.ts +9 -3
  1114. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  1115. package/lib/simple-tree/mapNode.js +36 -36
  1116. package/lib/simple-tree/mapNode.js.map +1 -1
  1117. package/lib/simple-tree/objectNode.d.ts +18 -16
  1118. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  1119. package/lib/simple-tree/objectNode.js +36 -34
  1120. package/lib/simple-tree/objectNode.js.map +1 -1
  1121. package/lib/simple-tree/objectNodeTypes.d.ts +38 -0
  1122. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -0
  1123. package/lib/simple-tree/objectNodeTypes.js +15 -0
  1124. package/lib/simple-tree/objectNodeTypes.js.map +1 -0
  1125. package/lib/simple-tree/proxies.d.ts +6 -25
  1126. package/lib/simple-tree/proxies.d.ts.map +1 -1
  1127. package/lib/simple-tree/proxies.js +46 -57
  1128. package/lib/simple-tree/proxies.js.map +1 -1
  1129. package/lib/simple-tree/proxyBinding.d.ts +45 -22
  1130. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  1131. package/lib/simple-tree/proxyBinding.js +89 -52
  1132. package/lib/simple-tree/proxyBinding.js.map +1 -1
  1133. package/lib/simple-tree/schemaTypes.d.ts +10 -159
  1134. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  1135. package/lib/simple-tree/schemaTypes.js +9 -41
  1136. package/lib/simple-tree/schemaTypes.js.map +1 -1
  1137. package/lib/simple-tree/simpleSchema.d.ts +124 -0
  1138. package/lib/simple-tree/simpleSchema.d.ts.map +1 -0
  1139. package/lib/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
  1140. package/lib/simple-tree/simpleSchema.js.map +1 -0
  1141. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
  1142. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
  1143. package/lib/simple-tree/simpleSchemaToJsonSchema.js +142 -0
  1144. package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
  1145. package/lib/simple-tree/toFlexSchema.d.ts +4 -12
  1146. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  1147. package/lib/simple-tree/toFlexSchema.js +9 -18
  1148. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  1149. package/lib/simple-tree/toMapTree.d.ts +39 -39
  1150. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  1151. package/lib/simple-tree/toMapTree.js +214 -158
  1152. package/lib/simple-tree/toMapTree.js.map +1 -1
  1153. package/lib/simple-tree/treeNodeValid.d.ts +74 -0
  1154. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -0
  1155. package/lib/simple-tree/{types.js → treeNodeValid.js} +8 -98
  1156. package/lib/simple-tree/treeNodeValid.js.map +1 -0
  1157. package/lib/simple-tree/typesUnsafe.d.ts +35 -4
  1158. package/lib/simple-tree/typesUnsafe.d.ts.map +1 -1
  1159. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  1160. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
  1161. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
  1162. package/lib/simple-tree/viewSchemaToSimpleSchema.js +167 -0
  1163. package/lib/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
  1164. package/lib/util/brand.d.ts +0 -3
  1165. package/lib/util/brand.d.ts.map +1 -1
  1166. package/lib/util/brand.js +1 -2
  1167. package/lib/util/brand.js.map +1 -1
  1168. package/lib/util/brandedMap.d.ts +0 -5
  1169. package/lib/util/brandedMap.d.ts.map +1 -1
  1170. package/lib/util/brandedMap.js +0 -1
  1171. package/lib/util/brandedMap.js.map +1 -1
  1172. package/lib/util/idAllocator.d.ts +0 -2
  1173. package/lib/util/idAllocator.d.ts.map +1 -1
  1174. package/lib/util/idAllocator.js +0 -1
  1175. package/lib/util/idAllocator.js.map +1 -1
  1176. package/lib/util/index.d.ts +2 -2
  1177. package/lib/util/index.d.ts.map +1 -1
  1178. package/lib/util/index.js +2 -2
  1179. package/lib/util/index.js.map +1 -1
  1180. package/lib/util/nestedMap.d.ts +5 -19
  1181. package/lib/util/nestedMap.d.ts.map +1 -1
  1182. package/lib/util/nestedMap.js +15 -16
  1183. package/lib/util/nestedMap.js.map +1 -1
  1184. package/lib/util/opaque.d.ts +0 -4
  1185. package/lib/util/opaque.d.ts.map +1 -1
  1186. package/lib/util/opaque.js +0 -2
  1187. package/lib/util/opaque.js.map +1 -1
  1188. package/lib/util/rangeMap.d.ts +0 -2
  1189. package/lib/util/rangeMap.d.ts.map +1 -1
  1190. package/lib/util/rangeMap.js +4 -3
  1191. package/lib/util/rangeMap.js.map +1 -1
  1192. package/lib/util/transactionResult.d.ts +0 -1
  1193. package/lib/util/transactionResult.d.ts.map +1 -1
  1194. package/lib/util/transactionResult.js +0 -1
  1195. package/lib/util/transactionResult.js.map +1 -1
  1196. package/lib/util/typeCheck.d.ts +2 -20
  1197. package/lib/util/typeCheck.d.ts.map +1 -1
  1198. package/lib/util/typeCheck.js.map +1 -1
  1199. package/lib/util/typeCheckTests.d.ts +4 -4
  1200. package/lib/util/typeCheckTests.d.ts.map +1 -1
  1201. package/lib/util/typeCheckTests.js.map +1 -1
  1202. package/lib/util/typeUtils.d.ts +0 -7
  1203. package/lib/util/typeUtils.d.ts.map +1 -1
  1204. package/lib/util/typeUtils.js.map +1 -1
  1205. package/lib/util/utils.d.ts +6 -8
  1206. package/lib/util/utils.d.ts.map +1 -1
  1207. package/lib/util/utils.js +12 -4
  1208. package/lib/util/utils.js.map +1 -1
  1209. package/package.json +36 -25
  1210. package/src/codec/discriminatedUnions.ts +20 -10
  1211. package/src/codec/index.ts +5 -1
  1212. package/src/core/forest/README.md +4 -2
  1213. package/src/core/forest/editableForest.ts +1 -6
  1214. package/src/core/forest/forest.ts +0 -6
  1215. package/src/core/index.ts +2 -2
  1216. package/src/core/rebase/changeRebaser.ts +0 -4
  1217. package/src/core/rebase/index.ts +0 -2
  1218. package/src/core/rebase/types.ts +1 -23
  1219. package/src/core/rebase/utils.ts +13 -11
  1220. package/src/core/schema-stored/multiplicity.ts +0 -1
  1221. package/src/core/schema-stored/schema.ts +0 -7
  1222. package/src/core/schema-stored/storedSchemaRepository.ts +0 -3
  1223. package/src/core/schema-view/view.ts +0 -3
  1224. package/src/core/tree/anchorSet.ts +7 -17
  1225. package/src/core/tree/cursor.ts +1 -6
  1226. package/src/core/tree/delta.ts +0 -11
  1227. package/src/core/tree/detachedFieldIndexCodec.ts +4 -3
  1228. package/src/core/tree/detachedFieldIndexTypes.ts +0 -1
  1229. package/src/core/tree/index.ts +1 -1
  1230. package/src/core/tree/mapTree.ts +45 -4
  1231. package/src/core/tree/pathTree.ts +0 -11
  1232. package/src/core/tree/treeTextFormat.ts +3 -2
  1233. package/src/core/tree/types.ts +0 -11
  1234. package/src/core/tree/visitDelta.ts +2 -3
  1235. package/src/core/tree/visitPath.ts +0 -2
  1236. package/src/core/tree/visitorUtils.ts +0 -1
  1237. package/src/domains/index.ts +3 -0
  1238. package/src/domains/json/index.ts +7 -1
  1239. package/src/domains/json/jsonCursor.ts +113 -6
  1240. package/src/domains/json/jsonDomainSchema.ts +4 -5
  1241. package/src/domains/leafDomain.ts +0 -1
  1242. package/src/domains/schemaBuilder.ts +0 -22
  1243. package/src/events/events.ts +0 -4
  1244. package/src/feature-libraries/chunked-forest/README.md +9 -1
  1245. package/src/feature-libraries/chunked-forest/basicChunk.ts +14 -9
  1246. package/src/feature-libraries/chunked-forest/chunk.ts +1 -1
  1247. package/src/feature-libraries/chunked-forest/chunkTree.ts +4 -4
  1248. package/src/feature-libraries/chunked-forest/chunkedForest.ts +8 -6
  1249. package/src/feature-libraries/chunked-forest/codec/chunkCodecUtilities.ts +2 -2
  1250. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +9 -6
  1251. package/src/feature-libraries/chunked-forest/uniformChunk.ts +6 -4
  1252. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +18 -46
  1253. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +11 -6
  1254. package/src/feature-libraries/default-schema/defaultSchema.ts +0 -1
  1255. package/src/feature-libraries/default-schema/index.ts +1 -1
  1256. package/src/feature-libraries/default-schema/schemaChecker.ts +6 -0
  1257. package/src/feature-libraries/editableTreeBinder.ts +6 -78
  1258. package/src/feature-libraries/fieldGenerator.ts +0 -3
  1259. package/src/feature-libraries/flex-map-tree/index.ts +2 -1
  1260. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +238 -267
  1261. package/src/feature-libraries/flex-tree/context.ts +0 -1
  1262. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +27 -357
  1263. package/src/feature-libraries/flex-tree/index.ts +0 -1
  1264. package/src/feature-libraries/flex-tree/lazyField.ts +38 -208
  1265. package/src/feature-libraries/flex-tree/lazyNode.ts +5 -66
  1266. package/src/feature-libraries/flex-tree/treeEvents.ts +0 -2
  1267. package/src/feature-libraries/flex-tree/utilities.ts +6 -1
  1268. package/src/feature-libraries/forest-summary/codec.ts +3 -3
  1269. package/src/feature-libraries/index.ts +5 -35
  1270. package/src/feature-libraries/mapTreeCursor.ts +13 -4
  1271. package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -4
  1272. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +0 -2
  1273. package/src/feature-libraries/modular-schema/discrepancies.ts +117 -1
  1274. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +0 -8
  1275. package/src/feature-libraries/modular-schema/fieldKind.ts +1 -3
  1276. package/src/feature-libraries/modular-schema/genericFieldKind.ts +69 -92
  1277. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +7 -14
  1278. package/src/feature-libraries/modular-schema/genericFieldKindTypes.ts +6 -15
  1279. package/src/feature-libraries/modular-schema/index.ts +2 -2
  1280. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +68 -34
  1281. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +330 -336
  1282. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +7 -14
  1283. package/src/feature-libraries/node-key/nodeKey.ts +0 -4
  1284. package/src/feature-libraries/node-key/nodeKeyManager.ts +0 -1
  1285. package/src/feature-libraries/object-forest/objectForest.ts +1 -13
  1286. package/src/feature-libraries/schemaBuilderBase.ts +1 -49
  1287. package/src/feature-libraries/sequence-field/compose.ts +41 -20
  1288. package/src/feature-libraries/sequence-field/formatV2.ts +3 -3
  1289. package/src/feature-libraries/sequence-field/formatV3.ts +65 -0
  1290. package/src/feature-libraries/sequence-field/helperTypes.ts +33 -0
  1291. package/src/feature-libraries/sequence-field/index.ts +1 -0
  1292. package/src/feature-libraries/sequence-field/invert.ts +28 -18
  1293. package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
  1294. package/src/feature-libraries/sequence-field/moveEffectTable.ts +2 -2
  1295. package/src/feature-libraries/sequence-field/rebase.ts +30 -13
  1296. package/src/feature-libraries/sequence-field/replaceRevisions.ts +27 -3
  1297. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +52 -7
  1298. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +92 -19
  1299. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +134 -0
  1300. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +2 -0
  1301. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +8 -2
  1302. package/src/feature-libraries/sequence-field/types.ts +24 -4
  1303. package/src/feature-libraries/sequence-field/utils.ts +78 -50
  1304. package/src/feature-libraries/storedToViewSchema.ts +0 -1
  1305. package/src/feature-libraries/treeCursorUtils.ts +11 -11
  1306. package/src/feature-libraries/treeTextCursor.ts +0 -2
  1307. package/src/feature-libraries/typed-schema/flexList.ts +0 -3
  1308. package/src/feature-libraries/typed-schema/index.ts +0 -2
  1309. package/src/feature-libraries/typed-schema/schemaCollection.ts +0 -5
  1310. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +2 -68
  1311. package/src/feature-libraries/typed-schema/view.ts +0 -1
  1312. package/src/index.ts +27 -245
  1313. package/src/internalTypes.ts +1 -0
  1314. package/src/packageVersion.ts +1 -1
  1315. package/src/shared-tree/schematizeTree.ts +25 -21
  1316. package/src/shared-tree/schematizingTreeView.ts +6 -6
  1317. package/src/shared-tree/sharedTree.ts +8 -39
  1318. package/src/shared-tree/sharedTreeChangeCodecs.ts +8 -0
  1319. package/src/shared-tree/sharedTreeChangeFamily.ts +3 -3
  1320. package/src/shared-tree/sharedTreeEditBuilder.ts +0 -2
  1321. package/src/shared-tree/treeApi.ts +3 -3
  1322. package/src/shared-tree/treeCheckout.ts +6 -8
  1323. package/src/shared-tree/treeView.ts +3 -6
  1324. package/src/shared-tree-core/branch.ts +20 -8
  1325. package/src/shared-tree-core/defaultResubmitMachine.ts +4 -4
  1326. package/src/shared-tree-core/editManagerCodecs.ts +1 -0
  1327. package/src/shared-tree-core/editManagerFormat.ts +7 -2
  1328. package/src/shared-tree-core/messageCodecs.ts +2 -1
  1329. package/src/shared-tree-core/sharedTreeCore.ts +5 -3
  1330. package/src/simple-tree/ProxyBinding.md +2 -0
  1331. package/src/simple-tree/api/README.md +7 -0
  1332. package/src/simple-tree/api/create.ts +179 -0
  1333. package/src/simple-tree/api/index.ts +36 -0
  1334. package/src/simple-tree/{schemaCreationUtilities.ts → api/schemaCreationUtilities.ts} +13 -5
  1335. package/src/simple-tree/{schemaFactory.ts → api/schemaFactory.ts} +36 -34
  1336. package/src/simple-tree/{schemaFactoryRecursive.ts → api/schemaFactoryRecursive.ts} +47 -10
  1337. package/src/simple-tree/{testRecursiveDomain.ts → api/testRecursiveDomain.ts} +3 -1
  1338. package/src/simple-tree/{tree.ts → api/tree.ts} +246 -34
  1339. package/src/simple-tree/{treeNodeApi.ts → api/treeNodeApi.ts} +47 -36
  1340. package/src/simple-tree/api/verboseTree.ts +415 -0
  1341. package/src/simple-tree/arrayNode.ts +100 -98
  1342. package/src/simple-tree/core/README.md +11 -0
  1343. package/src/simple-tree/core/index.ts +33 -0
  1344. package/src/simple-tree/{schemaCaching.ts → core/schemaCaching.ts} +3 -37
  1345. package/src/simple-tree/{treeNodeKernel.ts → core/treeNodeKernel.ts} +55 -5
  1346. package/src/simple-tree/core/treeNodeSchema.ts +184 -0
  1347. package/src/simple-tree/core/types.ts +255 -0
  1348. package/src/simple-tree/core/withType.ts +89 -0
  1349. package/src/simple-tree/getJsonSchema.ts +70 -0
  1350. package/src/simple-tree/getSimpleFieldSchema.ts +36 -0
  1351. package/src/simple-tree/getSimpleSchema.ts +69 -0
  1352. package/src/simple-tree/index.ts +58 -33
  1353. package/src/simple-tree/jsonSchema.ts +230 -0
  1354. package/src/simple-tree/leafNodeSchema.ts +6 -3
  1355. package/src/simple-tree/mapNode.ts +56 -55
  1356. package/src/simple-tree/objectNode.ts +66 -90
  1357. package/src/simple-tree/objectNodeTypes.ts +68 -0
  1358. package/src/simple-tree/proxies.ts +52 -68
  1359. package/src/simple-tree/proxyBinding.ts +127 -72
  1360. package/src/simple-tree/schemaTypes.ts +29 -194
  1361. package/src/simple-tree/simpleSchema.ts +138 -0
  1362. package/src/simple-tree/simpleSchemaToJsonSchema.ts +178 -0
  1363. package/src/simple-tree/toFlexSchema.ts +9 -42
  1364. package/src/simple-tree/toMapTree.ts +270 -296
  1365. package/src/simple-tree/{types.ts → treeNodeValid.ts} +16 -232
  1366. package/src/simple-tree/typesUnsafe.ts +51 -5
  1367. package/src/simple-tree/viewSchemaToSimpleSchema.ts +209 -0
  1368. package/src/util/brand.ts +1 -4
  1369. package/src/util/brandedMap.ts +0 -5
  1370. package/src/util/idAllocator.ts +0 -2
  1371. package/src/util/index.ts +2 -0
  1372. package/src/util/nestedMap.ts +23 -20
  1373. package/src/util/opaque.ts +0 -4
  1374. package/src/util/rangeMap.ts +5 -5
  1375. package/src/util/transactionResult.ts +0 -1
  1376. package/src/util/typeCheck.ts +2 -20
  1377. package/src/util/typeCheckTests.ts +4 -4
  1378. package/src/util/typeUtils.ts +0 -7
  1379. package/src/util/utils.ts +13 -8
  1380. package/tsconfig.json +0 -1
  1381. package/dist/feature-libraries/contextuallyTyped.d.ts +0 -209
  1382. package/dist/feature-libraries/contextuallyTyped.d.ts.map +0 -1
  1383. package/dist/feature-libraries/contextuallyTyped.js +0 -328
  1384. package/dist/feature-libraries/contextuallyTyped.js.map +0 -1
  1385. package/dist/feature-libraries/schema-aware/index.d.ts +0 -6
  1386. package/dist/feature-libraries/schema-aware/index.d.ts.map +0 -1
  1387. package/dist/feature-libraries/schema-aware/index.js.map +0 -1
  1388. package/dist/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
  1389. package/dist/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
  1390. package/dist/feature-libraries/schema-aware/schemaAware.js.map +0 -1
  1391. package/dist/simple-tree/nodeKeys.d.ts +0 -41
  1392. package/dist/simple-tree/nodeKeys.d.ts.map +0 -1
  1393. package/dist/simple-tree/nodeKeys.js +0 -7
  1394. package/dist/simple-tree/nodeKeys.js.map +0 -1
  1395. package/dist/simple-tree/schemaCaching.d.ts.map +0 -1
  1396. package/dist/simple-tree/schemaCaching.js.map +0 -1
  1397. package/dist/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
  1398. package/dist/simple-tree/schemaCreationUtilities.js.map +0 -1
  1399. package/dist/simple-tree/schemaFactory.d.ts.map +0 -1
  1400. package/dist/simple-tree/schemaFactory.js.map +0 -1
  1401. package/dist/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
  1402. package/dist/simple-tree/schemaFactoryRecursive.js.map +0 -1
  1403. package/dist/simple-tree/testRecursiveDomain.d.ts +0 -61
  1404. package/dist/simple-tree/testRecursiveDomain.d.ts.map +0 -1
  1405. package/dist/simple-tree/testRecursiveDomain.js.map +0 -1
  1406. package/dist/simple-tree/tree.d.ts.map +0 -1
  1407. package/dist/simple-tree/tree.js +0 -73
  1408. package/dist/simple-tree/tree.js.map +0 -1
  1409. package/dist/simple-tree/treeNodeApi.d.ts.map +0 -1
  1410. package/dist/simple-tree/treeNodeApi.js.map +0 -1
  1411. package/dist/simple-tree/treeNodeKernel.d.ts +0 -26
  1412. package/dist/simple-tree/treeNodeKernel.d.ts.map +0 -1
  1413. package/dist/simple-tree/treeNodeKernel.js.map +0 -1
  1414. package/dist/simple-tree/types.d.ts.map +0 -1
  1415. package/dist/simple-tree/types.js.map +0 -1
  1416. package/lib/feature-libraries/contextuallyTyped.d.ts +0 -209
  1417. package/lib/feature-libraries/contextuallyTyped.d.ts.map +0 -1
  1418. package/lib/feature-libraries/contextuallyTyped.js +0 -311
  1419. package/lib/feature-libraries/contextuallyTyped.js.map +0 -1
  1420. package/lib/feature-libraries/schema-aware/index.d.ts +0 -6
  1421. package/lib/feature-libraries/schema-aware/index.d.ts.map +0 -1
  1422. package/lib/feature-libraries/schema-aware/index.js +0 -6
  1423. package/lib/feature-libraries/schema-aware/index.js.map +0 -1
  1424. package/lib/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
  1425. package/lib/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
  1426. package/lib/feature-libraries/schema-aware/schemaAware.js.map +0 -1
  1427. package/lib/simple-tree/nodeKeys.d.ts +0 -41
  1428. package/lib/simple-tree/nodeKeys.d.ts.map +0 -1
  1429. package/lib/simple-tree/nodeKeys.js.map +0 -1
  1430. package/lib/simple-tree/schemaCaching.d.ts.map +0 -1
  1431. package/lib/simple-tree/schemaCaching.js.map +0 -1
  1432. package/lib/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
  1433. package/lib/simple-tree/schemaCreationUtilities.js.map +0 -1
  1434. package/lib/simple-tree/schemaFactory.d.ts.map +0 -1
  1435. package/lib/simple-tree/schemaFactory.js.map +0 -1
  1436. package/lib/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
  1437. package/lib/simple-tree/schemaFactoryRecursive.js.map +0 -1
  1438. package/lib/simple-tree/testRecursiveDomain.d.ts +0 -61
  1439. package/lib/simple-tree/testRecursiveDomain.d.ts.map +0 -1
  1440. package/lib/simple-tree/testRecursiveDomain.js.map +0 -1
  1441. package/lib/simple-tree/tree.d.ts.map +0 -1
  1442. package/lib/simple-tree/tree.js +0 -66
  1443. package/lib/simple-tree/tree.js.map +0 -1
  1444. package/lib/simple-tree/treeNodeApi.d.ts.map +0 -1
  1445. package/lib/simple-tree/treeNodeApi.js.map +0 -1
  1446. package/lib/simple-tree/treeNodeKernel.d.ts +0 -26
  1447. package/lib/simple-tree/treeNodeKernel.d.ts.map +0 -1
  1448. package/lib/simple-tree/treeNodeKernel.js.map +0 -1
  1449. package/lib/simple-tree/types.d.ts.map +0 -1
  1450. package/lib/simple-tree/types.js.map +0 -1
  1451. package/src/feature-libraries/contextuallyTyped.ts +0 -582
  1452. package/src/feature-libraries/schema-aware/README.md +0 -19
  1453. package/src/feature-libraries/schema-aware/index.ts +0 -16
  1454. package/src/feature-libraries/schema-aware/schemaAware.ts +0 -135
  1455. package/src/simple-tree/nodeKeys.ts +0 -42
  1456. /package/dist/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
  1457. /package/lib/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
@@ -7,7 +7,6 @@ import type { Listeners, Listenable } from "../events/index.js";
7
7
  import type { FlexTreeNode } from "./flex-tree/index.js";
8
8
  /**
9
9
  * Binder events reflecting atomic data operations
10
- * @internal
11
10
  */
12
11
  export interface OperationBinderEvents {
13
12
  remove(context: RemoveBindingContext): void;
@@ -16,27 +15,20 @@ export interface OperationBinderEvents {
16
15
  }
17
16
  /**
18
17
  * Binder events signaling state invalidation
19
- * @internal
20
18
  */
21
19
  export interface InvalidationBinderEvents {
22
20
  invalidation(context: InvalidationBindingContext): void;
23
21
  }
24
22
  /**
25
23
  * Compare function, generic.
26
- *
27
- * @internal
28
24
  */
29
25
  export type CompareFunction<T> = (a: T, b: T) => number;
30
26
  /**
31
27
  * Compare function for binder events.
32
- *
33
- * @internal
34
28
  */
35
29
  export type BinderEventsCompare = CompareFunction<VisitorBindingContext>;
36
30
  /**
37
31
  * Compare function for anchors.
38
- *
39
- * @internal
40
32
  */
41
33
  export type AnchorsCompare = CompareFunction<UpPath>;
42
34
  /**
@@ -45,15 +37,12 @@ export type AnchorsCompare = CompareFunction<UpPath>;
45
37
  * TODO: add more options:
46
38
  * `filterFn?: (context: BindingContext) => boolean;`
47
39
  * `pathPolicy?: "relative" | "absolute";`
48
- * @internal
49
40
  */
50
41
  export interface BinderOptions {
51
42
  sortFn?: BinderEventsCompare;
52
43
  }
53
44
  /**
54
45
  * Specialized binder options for flushable binders.
55
- *
56
- * @internal
57
46
  */
58
47
  export interface FlushableBinderOptions<E extends Listeners<E>> extends BinderOptions {
59
48
  autoFlush: boolean;
@@ -70,22 +59,16 @@ export interface FlushableBinderOptions<E extends Listeners<E>> extends BinderOp
70
59
  * - `path` match policy means that path filtering would return events matching the _exact_ path only. In this case
71
60
  * _exact_ semantics include interpreting an `undefined` _index_ field in the {@link PathStep} as a wildcard.
72
61
  *
73
- *
74
- * @internal
75
62
  */
76
63
  export type MatchPolicy = SubtreePolicy | "subtree" | "path";
77
64
  /**
78
65
  * Subtree match policy where max depth can be specified.
79
- *
80
- * @internal
81
66
  */
82
67
  export interface SubtreePolicy {
83
68
  maxDepth: number;
84
69
  }
85
70
  /**
86
71
  * The data binder interface
87
- *
88
- * @internal
89
72
  */
90
73
  export interface DataBinder<B extends OperationBinderEvents | InvalidationBinderEvents> {
91
74
  /**
@@ -104,23 +87,17 @@ export interface DataBinder<B extends OperationBinderEvents | InvalidationBinder
104
87
  }
105
88
  /**
106
89
  * An interface describing the ability to flush.
107
- *
108
- * @internal
109
90
  */
110
91
  export interface Flushable<T> {
111
92
  flush(): T;
112
93
  }
113
94
  /**
114
95
  * An interface describing a flushable data binder.
115
- *
116
- * @internal
117
96
  */
118
97
  export interface FlushableDataBinder<B extends OperationBinderEvents | InvalidationBinderEvents> extends DataBinder<B>, Flushable<FlushableDataBinder<B>> {
119
98
  }
120
99
  /**
121
100
  * A step in a bind path
122
- *
123
- * @internal
124
101
  */
125
102
  export interface PathStep {
126
103
  /**
@@ -134,22 +111,16 @@ export interface PathStep {
134
111
  }
135
112
  /**
136
113
  * The default type for a bind tree
137
- *
138
- * @internal
139
114
  */
140
115
  export type BindTreeDefault = BindTree;
141
116
  /**
142
117
  * A bind tree is a compact representation of related {@link BindPath}s.
143
- *
144
- * @internal
145
118
  */
146
119
  export interface BindTree<T = BindTreeDefault> extends PathStep {
147
120
  readonly children: Map<FieldKey, T>;
148
121
  }
149
122
  /**
150
123
  * A bind policy is a combination of a {@link BindTree} and a {@link MatchPolicy}.
151
- *
152
- * @internal
153
124
  */
154
125
  export interface BindPolicy {
155
126
  readonly bindTree: BindTree;
@@ -157,8 +128,6 @@ export interface BindPolicy {
157
128
  }
158
129
  /**
159
130
  * Index symbol for syntax tree
160
- *
161
- * @internal
162
131
  */
163
132
  export declare const indexSymbol: unique symbol;
164
133
  /**
@@ -169,8 +138,6 @@ export declare const indexSymbol: unique symbol;
169
138
  *
170
139
  * see {@link BindTree}
171
140
  * see {@link compileSyntaxTree}
172
- *
173
- * @internal
174
141
  */
175
142
  export interface BindSyntaxTree {
176
143
  readonly [indexSymbol]?: number;
@@ -181,26 +148,18 @@ export interface BindSyntaxTree {
181
148
  *
182
149
  * see {@link BindTree}
183
150
  * see {@link UpPath}
184
- *
185
- * @internal
186
151
  */
187
152
  export type DownPath = PathStep[];
188
153
  /**
189
154
  * A bind path is a top down path in a bind tree
190
- *
191
- * @internal
192
155
  */
193
156
  export type BindPath = DownPath;
194
157
  /**
195
158
  * A binding context specialized for {@link PathVisitor} triggered binding events.
196
- *
197
- * @internal
198
159
  */
199
160
  export type VisitorBindingContext = RemoveBindingContext | InsertBindingContext;
200
161
  /**
201
162
  * Enumeration of binding categories
202
- *
203
- * @internal
204
163
  */
205
164
  export declare const BindingType: {
206
165
  readonly Remove: "remove";
@@ -210,22 +169,16 @@ export declare const BindingType: {
210
169
  };
211
170
  /**
212
171
  * The type of a binding context
213
- *
214
- * @internal
215
172
  */
216
173
  export type BindingContextType = (typeof BindingType)[keyof typeof BindingType];
217
174
  /**
218
175
  * The binding context attribution common to all binding events
219
- *
220
- * @internal
221
176
  */
222
177
  export interface BindingContext {
223
178
  readonly type: BindingContextType;
224
179
  }
225
180
  /**
226
181
  * The binding context for a remove event
227
- *
228
- * @internal
229
182
  */
230
183
  export interface RemoveBindingContext extends BindingContext {
231
184
  readonly type: typeof BindingType.Remove;
@@ -234,8 +187,6 @@ export interface RemoveBindingContext extends BindingContext {
234
187
  }
235
188
  /**
236
189
  * The binding context for an insert event
237
- *
238
- * @internal
239
190
  */
240
191
  export interface InsertBindingContext extends BindingContext {
241
192
  readonly type: typeof BindingType.Insert;
@@ -244,16 +195,12 @@ export interface InsertBindingContext extends BindingContext {
244
195
  }
245
196
  /**
246
197
  * The binding context for an invalidation event
247
- *
248
- * @internal
249
198
  */
250
199
  export interface InvalidationBindingContext extends BindingContext {
251
200
  readonly type: typeof BindingType.Invalidation;
252
201
  }
253
202
  /**
254
203
  * The binding context for a batch event
255
- *
256
- * @internal
257
204
  */
258
205
  export interface BatchBindingContext extends BindingContext {
259
206
  readonly type: typeof BindingType.Batch;
@@ -261,33 +208,23 @@ export interface BatchBindingContext extends BindingContext {
261
208
  }
262
209
  /**
263
210
  * Compute a top-town {@link DownPath} from an {@link UpPath}.
264
- *
265
- * @internal
266
211
  */
267
212
  export declare function toDownPath(upPath: UpPath): DownPath;
268
213
  /**
269
214
  * Create a buffering data binder.
270
- *
271
- * @internal
272
215
  */
273
216
  export declare function createDataBinderBuffering<E extends Listeners<E>>(view: Listenable<E>, options: FlushableBinderOptions<E>): FlushableDataBinder<OperationBinderEvents>;
274
217
  /**
275
218
  * Create a direct data binder.
276
- *
277
- * @internal
278
219
  */
279
220
  export declare function createDataBinderDirect<E extends Listeners<E>>(view: Listenable<E>, options: BinderOptions): DataBinder<OperationBinderEvents>;
280
221
  /**
281
222
  * Create an invalidating data binder.
282
- *
283
- * @internal
284
223
  */
285
224
  export declare function createDataBinderInvalidating<E extends Listeners<E>>(view: Listenable<E>, options: FlushableBinderOptions<E>): FlushableDataBinder<InvalidationBinderEvents>;
286
225
  /**
287
226
  * Create binder options. If not specified, the default values are:
288
227
  * - sortFn: no sorting
289
- *
290
- * @internal
291
228
  */
292
229
  export declare function createBinderOptions({ sortFn, }: {
293
230
  sortFn?: BinderEventsCompare;
@@ -297,8 +234,6 @@ export declare function createBinderOptions({ sortFn, }: {
297
234
  * - sortFn: no sorting
298
235
  * - sortAnchorsFn: no sorting
299
236
  * - autoFlush: true
300
- *
301
- * @internal
302
237
  */
303
238
  export declare function createFlushableBinderOptions<E extends Listeners<E>>({ sortFn, sortAnchorsFn, autoFlush, autoFlushPolicy, }: {
304
239
  sortFn?: BinderEventsCompare;
@@ -311,7 +246,6 @@ export declare function createFlushableBinderOptions<E extends Listeners<E>>({ s
311
246
  *
312
247
  * @param fns - a list of compare functions
313
248
  * @returns a compare function that can be used for sorting
314
- * @internal
315
249
  */
316
250
  export declare function comparePipeline<T>(...fns: CompareFunction<T>[]): CompareFunction<T>;
317
251
  /**
@@ -319,7 +253,6 @@ export declare function comparePipeline<T>(...fns: CompareFunction<T>[]): Compar
319
253
  * The syntax tree is a compact representation of related {@link BindPath}s.
320
254
  * The match policy can be specified. If not specified, the default value is "path".
321
255
  * @returns a {@link BindPolicy} object
322
- * @internal
323
256
  */
324
257
  export declare function compileSyntaxTree(syntaxTree: BindSyntaxTree, matchPolicy?: MatchPolicy): BindPolicy;
325
258
  //# sourceMappingURL=editableTreeBinder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editableTreeBinder.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/editableTreeBinder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAGN,KAAK,QAAQ,EAGb,KAAK,UAAU,EAEf,KAAK,MAAM,EAEX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAMzD;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACrC,MAAM,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC5C,MAAM,CAAC,OAAO,EAAE,o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AC;IACpB,eAAe,EAAE,MAAM,SAAS,CAAC,CAAC,CAAC,CAAC;CACpC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAO5B;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC,CAUnF;AAaD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAChC,UAAU,EAAE,cAAc,EAC1B,WAAW,CAAC,EAAE,WAAW,GACvB,UAAU,CAQZ"}
@@ -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
  }
@@ -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;AACH,MAAe,mBAAmB;IAGjC,YAAsC,OAAsB;QAAtB,YAAO,GAAP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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.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 *\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,aAAa,CAAC,OAA4B,IAAS,CAAC;IACpD,YAAY,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;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"]}