@fluidframework/tree 2.3.1 → 2.4.0-297027

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 (674) hide show
  1. package/api-report/tree.alpha.api.md +77 -38
  2. package/api-report/tree.beta.api.md +50 -30
  3. package/api-report/tree.legacy.alpha.api.md +50 -30
  4. package/api-report/tree.legacy.public.api.md +50 -30
  5. package/api-report/tree.public.api.md +50 -30
  6. package/dist/alpha.d.ts +7 -0
  7. package/dist/beta.d.ts +4 -0
  8. package/dist/core/index.d.ts +1 -1
  9. package/dist/core/index.d.ts.map +1 -1
  10. package/dist/core/index.js +2 -1
  11. package/dist/core/index.js.map +1 -1
  12. package/dist/core/rebase/index.d.ts +1 -1
  13. package/dist/core/rebase/index.d.ts.map +1 -1
  14. package/dist/core/rebase/index.js +2 -1
  15. package/dist/core/rebase/index.js.map +1 -1
  16. package/dist/core/rebase/types.d.ts +1 -0
  17. package/dist/core/rebase/types.d.ts.map +1 -1
  18. package/dist/core/rebase/types.js +8 -1
  19. package/dist/core/rebase/types.js.map +1 -1
  20. package/dist/core/schema-stored/schema.d.ts +7 -0
  21. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  22. package/dist/core/schema-stored/schema.js +9 -0
  23. package/dist/core/schema-stored/schema.js.map +1 -1
  24. package/dist/core/tree/anchorSet.d.ts +1 -2
  25. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  26. package/dist/core/tree/anchorSet.js +2 -2
  27. package/dist/core/tree/anchorSet.js.map +1 -1
  28. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  29. package/dist/core/tree/detachedFieldIndex.js +13 -2
  30. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  31. package/dist/core/tree/detachedFieldIndexTypes.d.ts +1 -1
  32. package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
  33. package/dist/feature-libraries/editableTreeBinder.d.ts +3 -230
  34. package/dist/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  35. package/dist/feature-libraries/editableTreeBinder.js +1 -539
  36. package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
  37. package/dist/feature-libraries/flex-tree/context.d.ts +7 -14
  38. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  39. package/dist/feature-libraries/flex-tree/context.js +3 -3
  40. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  41. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -16
  42. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  43. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  44. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +2 -3
  45. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  46. package/dist/feature-libraries/flex-tree/lazyEntity.js +1 -2
  47. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  48. package/dist/feature-libraries/flex-tree/lazyField.d.ts +10 -15
  49. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  50. package/dist/feature-libraries/flex-tree/lazyField.js +18 -20
  51. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  52. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +4 -5
  53. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  54. package/dist/feature-libraries/flex-tree/lazyNode.js +13 -23
  55. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  56. package/dist/feature-libraries/flex-tree/utilities.js +1 -1
  57. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  58. package/dist/feature-libraries/index.d.ts +4 -7
  59. package/dist/feature-libraries/index.d.ts.map +1 -1
  60. package/dist/feature-libraries/index.js +5 -31
  61. package/dist/feature-libraries/index.js.map +1 -1
  62. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +7 -0
  63. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  64. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +61 -17
  65. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  66. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  67. package/dist/feature-libraries/sequence-field/compose.js +3 -0
  68. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  69. package/dist/feature-libraries/sequence-field/formatV1.d.ts +18 -18
  70. package/dist/feature-libraries/sequence-field/formatV2.d.ts +18 -18
  71. package/dist/feature-libraries/sequence-field/formatV3.d.ts +27 -27
  72. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  73. package/dist/feature-libraries/sequence-field/utils.js +1 -4
  74. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  75. package/dist/feature-libraries/typed-schema/flexList.d.ts +1 -46
  76. package/dist/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  77. package/dist/feature-libraries/typed-schema/flexList.js +1 -13
  78. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  79. package/dist/feature-libraries/typed-schema/index.d.ts +2 -4
  80. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  81. package/dist/feature-libraries/typed-schema/index.js +1 -19
  82. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  83. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -212
  84. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  85. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +0 -266
  86. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  87. package/dist/index.d.ts +3 -3
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.js +2 -1
  90. package/dist/index.js.map +1 -1
  91. package/dist/internalTypes.d.ts +1 -1
  92. package/dist/internalTypes.d.ts.map +1 -1
  93. package/dist/internalTypes.js.map +1 -1
  94. package/dist/legacy.d.ts +4 -0
  95. package/dist/packageVersion.d.ts +1 -1
  96. package/dist/packageVersion.d.ts.map +1 -1
  97. package/dist/packageVersion.js +1 -1
  98. package/dist/packageVersion.js.map +1 -1
  99. package/dist/public.d.ts +4 -0
  100. package/dist/shared-tree/checkoutFlexTreeView.d.ts +3 -3
  101. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  102. package/dist/shared-tree/checkoutFlexTreeView.js +1 -1
  103. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  104. package/dist/shared-tree/index.d.ts +3 -3
  105. package/dist/shared-tree/index.d.ts.map +1 -1
  106. package/dist/shared-tree/index.js +2 -3
  107. package/dist/shared-tree/index.js.map +1 -1
  108. package/dist/shared-tree/schematizeTree.d.ts +1 -40
  109. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  110. package/dist/shared-tree/schematizeTree.js +2 -11
  111. package/dist/shared-tree/schematizeTree.js.map +1 -1
  112. package/dist/shared-tree/schematizingTreeView.d.ts +9 -7
  113. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  114. package/dist/shared-tree/schematizingTreeView.js +19 -8
  115. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  116. package/dist/shared-tree/sharedTree.d.ts +19 -2
  117. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  118. package/dist/shared-tree/sharedTree.js +10 -2
  119. package/dist/shared-tree/sharedTree.js.map +1 -1
  120. package/dist/shared-tree/treeCheckout.d.ts +71 -41
  121. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  122. package/dist/shared-tree/treeCheckout.js +116 -84
  123. package/dist/shared-tree/treeCheckout.js.map +1 -1
  124. package/dist/shared-tree-core/branch.d.ts +8 -11
  125. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  126. package/dist/shared-tree-core/branch.js +12 -15
  127. package/dist/shared-tree-core/branch.js.map +1 -1
  128. package/dist/simple-tree/api/create.d.ts +1 -1
  129. package/dist/simple-tree/api/create.d.ts.map +1 -1
  130. package/dist/simple-tree/api/create.js +11 -13
  131. package/dist/simple-tree/api/create.js.map +1 -1
  132. package/dist/simple-tree/api/getJsonSchema.d.ts +3 -3
  133. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  134. package/dist/simple-tree/api/getJsonSchema.js +1 -1
  135. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  136. package/dist/simple-tree/api/getSimpleSchema.d.ts +2 -2
  137. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  138. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  139. package/dist/simple-tree/api/index.d.ts +2 -1
  140. package/dist/simple-tree/api/index.d.ts.map +1 -1
  141. package/dist/simple-tree/api/index.js +3 -1
  142. package/dist/simple-tree/api/index.js.map +1 -1
  143. package/dist/simple-tree/api/jsonSchema.d.ts +13 -14
  144. package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -1
  145. package/dist/simple-tree/api/jsonSchema.js.map +1 -1
  146. package/dist/simple-tree/api/schemaFactory.d.ts +14 -8
  147. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  148. package/dist/simple-tree/api/schemaFactory.js +21 -2
  149. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  150. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +3 -3
  151. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  152. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  153. package/dist/simple-tree/api/simpleSchema.d.ts +18 -10
  154. package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
  155. package/dist/simple-tree/api/simpleSchema.js.map +1 -1
  156. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  157. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +30 -17
  158. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  159. package/dist/simple-tree/api/tree.d.ts +16 -6
  160. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  161. package/dist/simple-tree/api/tree.js +4 -4
  162. package/dist/simple-tree/api/tree.js.map +1 -1
  163. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  164. package/dist/simple-tree/api/treeNodeApi.js +8 -6
  165. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  166. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  167. package/dist/simple-tree/api/verboseTree.js +6 -10
  168. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  169. package/{lib/feature-libraries/typed-schema → dist/simple-tree/api}/view.d.ts +4 -11
  170. package/dist/simple-tree/api/view.d.ts.map +1 -0
  171. package/dist/{feature-libraries/typed-schema → simple-tree/api}/view.js +9 -9
  172. package/dist/simple-tree/api/view.js.map +1 -0
  173. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -2
  174. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  175. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +11 -1
  176. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  177. package/dist/simple-tree/arrayNode.d.ts +147 -14
  178. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  179. package/dist/simple-tree/arrayNode.js +32 -20
  180. package/dist/simple-tree/arrayNode.js.map +1 -1
  181. package/dist/simple-tree/core/context.d.ts +55 -0
  182. package/dist/simple-tree/core/context.d.ts.map +1 -0
  183. package/dist/simple-tree/core/context.js +60 -0
  184. package/dist/simple-tree/core/context.js.map +1 -0
  185. package/dist/simple-tree/core/getOrCreateNode.d.ts +15 -0
  186. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -0
  187. package/dist/simple-tree/core/getOrCreateNode.js +36 -0
  188. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -0
  189. package/dist/simple-tree/core/index.d.ts +7 -3
  190. package/dist/simple-tree/core/index.d.ts.map +1 -1
  191. package/dist/simple-tree/core/index.js +16 -7
  192. package/dist/simple-tree/core/index.js.map +1 -1
  193. package/dist/simple-tree/core/schemaCaching.d.ts +5 -13
  194. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -1
  195. package/dist/simple-tree/core/schemaCaching.js +16 -45
  196. package/dist/simple-tree/core/schemaCaching.js.map +1 -1
  197. package/dist/simple-tree/core/treeNodeKernel.d.ts +29 -7
  198. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  199. package/dist/simple-tree/core/treeNodeKernel.js +94 -58
  200. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  201. package/dist/simple-tree/core/treeNodeSchema.d.ts +24 -0
  202. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  203. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  204. package/dist/simple-tree/core/types.d.ts +0 -5
  205. package/dist/simple-tree/core/types.d.ts.map +1 -1
  206. package/dist/simple-tree/core/types.js.map +1 -1
  207. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +139 -0
  208. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -0
  209. package/dist/{feature-libraries/flex-map-tree/mapTreeNode.js → simple-tree/core/unhydratedFlexTree.js} +112 -132
  210. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -0
  211. package/dist/simple-tree/{walkSchema.d.ts → core/walkSchema.d.ts} +8 -4
  212. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -0
  213. package/dist/simple-tree/core/walkSchema.js +34 -0
  214. package/dist/simple-tree/core/walkSchema.js.map +1 -0
  215. package/dist/simple-tree/createContext.d.ts +11 -0
  216. package/dist/simple-tree/createContext.d.ts.map +1 -0
  217. package/dist/simple-tree/createContext.js +25 -0
  218. package/dist/simple-tree/createContext.js.map +1 -0
  219. package/dist/simple-tree/index.d.ts +4 -5
  220. package/dist/simple-tree/index.d.ts.map +1 -1
  221. package/dist/simple-tree/index.js +7 -7
  222. package/dist/simple-tree/index.js.map +1 -1
  223. package/dist/simple-tree/leafNodeSchema.d.ts +1 -0
  224. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  225. package/dist/simple-tree/leafNodeSchema.js +1 -2
  226. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  227. package/dist/simple-tree/mapNode.d.ts +4 -4
  228. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  229. package/dist/simple-tree/mapNode.js +9 -5
  230. package/dist/simple-tree/mapNode.js.map +1 -1
  231. package/dist/simple-tree/objectNode.d.ts +8 -8
  232. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  233. package/dist/simple-tree/objectNode.js +33 -14
  234. package/dist/simple-tree/objectNode.js.map +1 -1
  235. package/dist/simple-tree/objectNodeTypes.d.ts +7 -3
  236. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
  237. package/dist/simple-tree/objectNodeTypes.js.map +1 -1
  238. package/dist/simple-tree/proxies.d.ts +1 -2
  239. package/dist/simple-tree/proxies.d.ts.map +1 -1
  240. package/dist/simple-tree/proxies.js +6 -22
  241. package/dist/simple-tree/proxies.js.map +1 -1
  242. package/dist/simple-tree/schemaTypes.d.ts +44 -4
  243. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  244. package/dist/simple-tree/schemaTypes.js +10 -0
  245. package/dist/simple-tree/schemaTypes.js.map +1 -1
  246. package/dist/simple-tree/toFlexSchema.d.ts +6 -36
  247. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  248. package/dist/simple-tree/toFlexSchema.js +58 -142
  249. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  250. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  251. package/dist/simple-tree/toMapTree.js +2 -2
  252. package/dist/simple-tree/toMapTree.js.map +1 -1
  253. package/dist/simple-tree/treeNodeValid.d.ts +13 -5
  254. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  255. package/dist/simple-tree/treeNodeValid.js +19 -10
  256. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  257. package/dist/simple-tree/typesUnsafe.d.ts +4 -4
  258. package/dist/simple-tree/typesUnsafe.d.ts.map +1 -1
  259. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  260. package/dist/simple-tree/walkFieldSchema.d.ts +11 -0
  261. package/dist/simple-tree/walkFieldSchema.d.ts.map +1 -0
  262. package/dist/simple-tree/walkFieldSchema.js +17 -0
  263. package/dist/simple-tree/walkFieldSchema.js.map +1 -0
  264. package/dist/util/index.d.ts +1 -1
  265. package/dist/util/index.d.ts.map +1 -1
  266. package/dist/util/index.js.map +1 -1
  267. package/dist/util/typeUtils.d.ts +14 -45
  268. package/dist/util/typeUtils.d.ts.map +1 -1
  269. package/dist/util/typeUtils.js.map +1 -1
  270. package/lib/alpha.d.ts +7 -0
  271. package/lib/beta.d.ts +4 -0
  272. package/lib/core/index.d.ts +1 -1
  273. package/lib/core/index.d.ts.map +1 -1
  274. package/lib/core/index.js +1 -1
  275. package/lib/core/index.js.map +1 -1
  276. package/lib/core/rebase/index.d.ts +1 -1
  277. package/lib/core/rebase/index.d.ts.map +1 -1
  278. package/lib/core/rebase/index.js +1 -1
  279. package/lib/core/rebase/index.js.map +1 -1
  280. package/lib/core/rebase/types.d.ts +1 -0
  281. package/lib/core/rebase/types.d.ts.map +1 -1
  282. package/lib/core/rebase/types.js +6 -0
  283. package/lib/core/rebase/types.js.map +1 -1
  284. package/lib/core/schema-stored/schema.d.ts +7 -0
  285. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  286. package/lib/core/schema-stored/schema.js +9 -0
  287. package/lib/core/schema-stored/schema.js.map +1 -1
  288. package/lib/core/tree/anchorSet.d.ts +1 -2
  289. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  290. package/lib/core/tree/anchorSet.js +2 -2
  291. package/lib/core/tree/anchorSet.js.map +1 -1
  292. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  293. package/lib/core/tree/detachedFieldIndex.js +13 -2
  294. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  295. package/lib/core/tree/detachedFieldIndexTypes.d.ts +1 -1
  296. package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
  297. package/lib/feature-libraries/editableTreeBinder.d.ts +3 -230
  298. package/lib/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  299. package/lib/feature-libraries/editableTreeBinder.js +1 -532
  300. package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
  301. package/lib/feature-libraries/flex-tree/context.d.ts +7 -14
  302. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  303. package/lib/feature-libraries/flex-tree/context.js +3 -3
  304. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  305. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -16
  306. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  307. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  308. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +2 -3
  309. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  310. package/lib/feature-libraries/flex-tree/lazyEntity.js +1 -2
  311. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  312. package/lib/feature-libraries/flex-tree/lazyField.d.ts +10 -15
  313. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  314. package/lib/feature-libraries/flex-tree/lazyField.js +18 -20
  315. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  316. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +4 -5
  317. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  318. package/lib/feature-libraries/flex-tree/lazyNode.js +13 -23
  319. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  320. package/lib/feature-libraries/flex-tree/utilities.js +1 -1
  321. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  322. package/lib/feature-libraries/index.d.ts +4 -7
  323. package/lib/feature-libraries/index.d.ts.map +1 -1
  324. package/lib/feature-libraries/index.js +4 -6
  325. package/lib/feature-libraries/index.js.map +1 -1
  326. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +7 -0
  327. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  328. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +62 -18
  329. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  330. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  331. package/lib/feature-libraries/sequence-field/compose.js +3 -0
  332. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  333. package/lib/feature-libraries/sequence-field/formatV1.d.ts +18 -18
  334. package/lib/feature-libraries/sequence-field/formatV2.d.ts +18 -18
  335. package/lib/feature-libraries/sequence-field/formatV3.d.ts +27 -27
  336. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  337. package/lib/feature-libraries/sequence-field/utils.js +2 -5
  338. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  339. package/lib/feature-libraries/typed-schema/flexList.d.ts +1 -46
  340. package/lib/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  341. package/lib/feature-libraries/typed-schema/flexList.js +0 -11
  342. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  343. package/lib/feature-libraries/typed-schema/index.d.ts +2 -4
  344. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  345. package/lib/feature-libraries/typed-schema/index.js +0 -3
  346. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  347. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -212
  348. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  349. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +1 -253
  350. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  351. package/lib/index.d.ts +3 -3
  352. package/lib/index.d.ts.map +1 -1
  353. package/lib/index.js +1 -1
  354. package/lib/index.js.map +1 -1
  355. package/lib/internalTypes.d.ts +1 -1
  356. package/lib/internalTypes.d.ts.map +1 -1
  357. package/lib/internalTypes.js.map +1 -1
  358. package/lib/legacy.d.ts +4 -0
  359. package/lib/packageVersion.d.ts +1 -1
  360. package/lib/packageVersion.d.ts.map +1 -1
  361. package/lib/packageVersion.js +1 -1
  362. package/lib/packageVersion.js.map +1 -1
  363. package/lib/public.d.ts +4 -0
  364. package/lib/shared-tree/checkoutFlexTreeView.d.ts +3 -3
  365. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  366. package/lib/shared-tree/checkoutFlexTreeView.js +1 -1
  367. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  368. package/lib/shared-tree/index.d.ts +3 -3
  369. package/lib/shared-tree/index.d.ts.map +1 -1
  370. package/lib/shared-tree/index.js +1 -2
  371. package/lib/shared-tree/index.js.map +1 -1
  372. package/lib/shared-tree/schematizeTree.d.ts +1 -40
  373. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  374. package/lib/shared-tree/schematizeTree.js +1 -9
  375. package/lib/shared-tree/schematizeTree.js.map +1 -1
  376. package/lib/shared-tree/schematizingTreeView.d.ts +9 -7
  377. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  378. package/lib/shared-tree/schematizingTreeView.js +22 -11
  379. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  380. package/lib/shared-tree/sharedTree.d.ts +19 -2
  381. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  382. package/lib/shared-tree/sharedTree.js +10 -3
  383. package/lib/shared-tree/sharedTree.js.map +1 -1
  384. package/lib/shared-tree/treeCheckout.d.ts +71 -41
  385. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  386. package/lib/shared-tree/treeCheckout.js +118 -86
  387. package/lib/shared-tree/treeCheckout.js.map +1 -1
  388. package/lib/shared-tree-core/branch.d.ts +8 -11
  389. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  390. package/lib/shared-tree-core/branch.js +12 -15
  391. package/lib/shared-tree-core/branch.js.map +1 -1
  392. package/lib/simple-tree/api/create.d.ts +1 -1
  393. package/lib/simple-tree/api/create.d.ts.map +1 -1
  394. package/lib/simple-tree/api/create.js +14 -16
  395. package/lib/simple-tree/api/create.js.map +1 -1
  396. package/lib/simple-tree/api/getJsonSchema.d.ts +3 -3
  397. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  398. package/lib/simple-tree/api/getJsonSchema.js +1 -1
  399. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  400. package/lib/simple-tree/api/getSimpleSchema.d.ts +2 -2
  401. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  402. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  403. package/lib/simple-tree/api/index.d.ts +2 -1
  404. package/lib/simple-tree/api/index.d.ts.map +1 -1
  405. package/lib/simple-tree/api/index.js +1 -0
  406. package/lib/simple-tree/api/index.js.map +1 -1
  407. package/lib/simple-tree/api/jsonSchema.d.ts +13 -14
  408. package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -1
  409. package/lib/simple-tree/api/jsonSchema.js.map +1 -1
  410. package/lib/simple-tree/api/schemaFactory.d.ts +14 -8
  411. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  412. package/lib/simple-tree/api/schemaFactory.js +21 -2
  413. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  414. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +3 -3
  415. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  416. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  417. package/lib/simple-tree/api/simpleSchema.d.ts +18 -10
  418. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
  419. package/lib/simple-tree/api/simpleSchema.js.map +1 -1
  420. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  421. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +31 -18
  422. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  423. package/lib/simple-tree/api/tree.d.ts +16 -6
  424. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  425. package/lib/simple-tree/api/tree.js +4 -4
  426. package/lib/simple-tree/api/tree.js.map +1 -1
  427. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  428. package/lib/simple-tree/api/treeNodeApi.js +10 -8
  429. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  430. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  431. package/lib/simple-tree/api/verboseTree.js +6 -10
  432. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  433. package/{dist/feature-libraries/typed-schema → lib/simple-tree/api}/view.d.ts +4 -11
  434. package/lib/simple-tree/api/view.d.ts.map +1 -0
  435. package/lib/{feature-libraries/typed-schema → simple-tree/api}/view.js +9 -9
  436. package/lib/simple-tree/api/view.js.map +1 -0
  437. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -2
  438. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  439. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +11 -1
  440. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  441. package/lib/simple-tree/arrayNode.d.ts +147 -14
  442. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  443. package/lib/simple-tree/arrayNode.js +37 -25
  444. package/lib/simple-tree/arrayNode.js.map +1 -1
  445. package/lib/simple-tree/core/context.d.ts +55 -0
  446. package/lib/simple-tree/core/context.d.ts.map +1 -0
  447. package/lib/simple-tree/core/context.js +55 -0
  448. package/lib/simple-tree/core/context.js.map +1 -0
  449. package/lib/simple-tree/core/getOrCreateNode.d.ts +15 -0
  450. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -0
  451. package/lib/simple-tree/core/getOrCreateNode.js +32 -0
  452. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -0
  453. package/lib/simple-tree/core/index.d.ts +7 -3
  454. package/lib/simple-tree/core/index.d.ts.map +1 -1
  455. package/lib/simple-tree/core/index.js +6 -2
  456. package/lib/simple-tree/core/index.js.map +1 -1
  457. package/lib/simple-tree/core/schemaCaching.d.ts +5 -13
  458. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -1
  459. package/lib/simple-tree/core/schemaCaching.js +13 -39
  460. package/lib/simple-tree/core/schemaCaching.js.map +1 -1
  461. package/lib/simple-tree/core/treeNodeKernel.d.ts +29 -7
  462. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  463. package/lib/simple-tree/core/treeNodeKernel.js +89 -54
  464. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  465. package/lib/simple-tree/core/treeNodeSchema.d.ts +24 -0
  466. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  467. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  468. package/lib/simple-tree/core/types.d.ts +0 -5
  469. package/lib/simple-tree/core/types.d.ts.map +1 -1
  470. package/lib/simple-tree/core/types.js.map +1 -1
  471. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +139 -0
  472. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -0
  473. package/lib/{feature-libraries/flex-map-tree/mapTreeNode.js → simple-tree/core/unhydratedFlexTree.js} +110 -128
  474. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -0
  475. package/lib/simple-tree/{walkSchema.d.ts → core/walkSchema.d.ts} +8 -4
  476. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -0
  477. package/lib/simple-tree/core/walkSchema.js +29 -0
  478. package/lib/simple-tree/core/walkSchema.js.map +1 -0
  479. package/lib/simple-tree/createContext.d.ts +11 -0
  480. package/lib/simple-tree/createContext.d.ts.map +1 -0
  481. package/lib/simple-tree/createContext.js +21 -0
  482. package/lib/simple-tree/createContext.js.map +1 -0
  483. package/lib/simple-tree/index.d.ts +4 -5
  484. package/lib/simple-tree/index.d.ts.map +1 -1
  485. package/lib/simple-tree/index.js +3 -4
  486. package/lib/simple-tree/index.js.map +1 -1
  487. package/lib/simple-tree/leafNodeSchema.d.ts +1 -0
  488. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  489. package/lib/simple-tree/leafNodeSchema.js +3 -4
  490. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  491. package/lib/simple-tree/mapNode.d.ts +4 -4
  492. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  493. package/lib/simple-tree/mapNode.js +12 -8
  494. package/lib/simple-tree/mapNode.js.map +1 -1
  495. package/lib/simple-tree/objectNode.d.ts +8 -8
  496. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  497. package/lib/simple-tree/objectNode.js +36 -17
  498. package/lib/simple-tree/objectNode.js.map +1 -1
  499. package/lib/simple-tree/objectNodeTypes.d.ts +7 -3
  500. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
  501. package/lib/simple-tree/objectNodeTypes.js.map +1 -1
  502. package/lib/simple-tree/proxies.d.ts +1 -2
  503. package/lib/simple-tree/proxies.d.ts.map +1 -1
  504. package/lib/simple-tree/proxies.js +7 -22
  505. package/lib/simple-tree/proxies.js.map +1 -1
  506. package/lib/simple-tree/schemaTypes.d.ts +44 -4
  507. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  508. package/lib/simple-tree/schemaTypes.js +10 -0
  509. package/lib/simple-tree/schemaTypes.js.map +1 -1
  510. package/lib/simple-tree/toFlexSchema.d.ts +6 -36
  511. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  512. package/lib/simple-tree/toFlexSchema.js +61 -142
  513. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  514. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  515. package/lib/simple-tree/toMapTree.js +4 -4
  516. package/lib/simple-tree/toMapTree.js.map +1 -1
  517. package/lib/simple-tree/treeNodeValid.d.ts +13 -5
  518. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  519. package/lib/simple-tree/treeNodeValid.js +21 -12
  520. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  521. package/lib/simple-tree/typesUnsafe.d.ts +4 -4
  522. package/lib/simple-tree/typesUnsafe.d.ts.map +1 -1
  523. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  524. package/lib/simple-tree/walkFieldSchema.d.ts +11 -0
  525. package/lib/simple-tree/walkFieldSchema.d.ts.map +1 -0
  526. package/lib/simple-tree/walkFieldSchema.js +13 -0
  527. package/lib/simple-tree/walkFieldSchema.js.map +1 -0
  528. package/lib/util/index.d.ts +1 -1
  529. package/lib/util/index.d.ts.map +1 -1
  530. package/lib/util/index.js.map +1 -1
  531. package/lib/util/typeUtils.d.ts +14 -45
  532. package/lib/util/typeUtils.d.ts.map +1 -1
  533. package/lib/util/typeUtils.js.map +1 -1
  534. package/package.json +41 -22
  535. package/src/core/index.ts +1 -0
  536. package/src/core/rebase/index.ts +1 -0
  537. package/src/core/rebase/types.ts +11 -0
  538. package/src/core/schema-stored/schema.ts +18 -0
  539. package/src/core/tree/anchorSet.ts +3 -4
  540. package/src/core/tree/detachedFieldIndex.ts +14 -3
  541. package/src/core/tree/detachedFieldIndexTypes.ts +1 -1
  542. package/src/feature-libraries/editableTreeBinder.ts +2 -915
  543. package/src/feature-libraries/flex-tree/context.ts +7 -20
  544. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +2 -18
  545. package/src/feature-libraries/flex-tree/lazyEntity.ts +1 -4
  546. package/src/feature-libraries/flex-tree/lazyField.ts +22 -78
  547. package/src/feature-libraries/flex-tree/lazyNode.ts +24 -39
  548. package/src/feature-libraries/flex-tree/utilities.ts +1 -1
  549. package/src/feature-libraries/index.ts +3 -71
  550. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +97 -10
  551. package/src/feature-libraries/sequence-field/compose.ts +3 -0
  552. package/src/feature-libraries/sequence-field/utils.ts +2 -4
  553. package/src/feature-libraries/typed-schema/flexList.ts +3 -84
  554. package/src/feature-libraries/typed-schema/index.ts +1 -33
  555. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +0 -458
  556. package/src/index.ts +7 -0
  557. package/src/internalTypes.ts +0 -1
  558. package/src/packageVersion.ts +1 -1
  559. package/src/shared-tree/checkoutFlexTreeView.ts +3 -3
  560. package/src/shared-tree/index.ts +4 -8
  561. package/src/shared-tree/schematizeTree.ts +2 -56
  562. package/src/shared-tree/schematizingTreeView.ts +38 -15
  563. package/src/shared-tree/sharedTree.ts +36 -8
  564. package/src/shared-tree/treeCheckout.ts +225 -128
  565. package/src/shared-tree-core/branch.ts +15 -26
  566. package/src/simple-tree/api/create.ts +18 -20
  567. package/src/simple-tree/api/getJsonSchema.ts +3 -3
  568. package/src/simple-tree/api/getSimpleSchema.ts +2 -2
  569. package/src/simple-tree/api/index.ts +2 -0
  570. package/src/simple-tree/api/jsonSchema.ts +19 -17
  571. package/src/simple-tree/api/schemaFactory.ts +53 -18
  572. package/src/simple-tree/api/schemaFactoryRecursive.ts +3 -6
  573. package/src/simple-tree/api/simpleSchema.ts +20 -10
  574. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +40 -19
  575. package/src/simple-tree/api/tree.ts +20 -9
  576. package/src/simple-tree/api/treeNodeApi.ts +12 -10
  577. package/src/simple-tree/api/verboseTree.ts +6 -12
  578. package/src/{feature-libraries/typed-schema → simple-tree/api}/view.ts +9 -22
  579. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +18 -4
  580. package/src/simple-tree/arrayNode.ts +202 -53
  581. package/src/simple-tree/core/context.ts +78 -0
  582. package/src/simple-tree/core/getOrCreateNode.ts +38 -0
  583. package/src/simple-tree/core/index.ts +11 -7
  584. package/src/simple-tree/core/schemaCaching.ts +13 -50
  585. package/src/simple-tree/core/treeNodeKernel.ts +117 -78
  586. package/src/simple-tree/core/treeNodeSchema.ts +35 -1
  587. package/src/simple-tree/core/types.ts +0 -5
  588. package/src/{feature-libraries/flex-map-tree/mapTreeNode.ts → simple-tree/core/unhydratedFlexTree.ts} +167 -210
  589. package/src/simple-tree/{walkSchema.ts → core/walkSchema.ts} +12 -34
  590. package/src/simple-tree/createContext.ts +24 -0
  591. package/src/simple-tree/index.ts +6 -2
  592. package/src/simple-tree/leafNodeSchema.ts +3 -9
  593. package/src/simple-tree/mapNode.ts +20 -17
  594. package/src/simple-tree/objectNode.ts +63 -38
  595. package/src/simple-tree/objectNodeTypes.ts +8 -5
  596. package/src/simple-tree/proxies.ts +8 -26
  597. package/src/simple-tree/schemaTypes.ts +55 -5
  598. package/src/simple-tree/toFlexSchema.ts +71 -204
  599. package/src/simple-tree/toMapTree.ts +5 -5
  600. package/src/simple-tree/treeNodeValid.ts +28 -22
  601. package/src/simple-tree/typesUnsafe.ts +4 -4
  602. package/src/simple-tree/walkFieldSchema.ts +19 -0
  603. package/src/util/index.ts +1 -5
  604. package/src/util/typeUtils.ts +14 -56
  605. package/dist/feature-libraries/fieldGenerator.d.ts +0 -43
  606. package/dist/feature-libraries/fieldGenerator.d.ts.map +0 -1
  607. package/dist/feature-libraries/fieldGenerator.js +0 -13
  608. package/dist/feature-libraries/fieldGenerator.js.map +0 -1
  609. package/dist/feature-libraries/flex-map-tree/index.d.ts +0 -6
  610. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +0 -1
  611. package/dist/feature-libraries/flex-map-tree/index.js +0 -14
  612. package/dist/feature-libraries/flex-map-tree/index.js.map +0 -1
  613. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +0 -157
  614. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +0 -1
  615. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +0 -1
  616. package/dist/feature-libraries/storedToViewSchema.d.ts +0 -17
  617. package/dist/feature-libraries/storedToViewSchema.d.ts.map +0 -1
  618. package/dist/feature-libraries/storedToViewSchema.js +0 -67
  619. package/dist/feature-libraries/storedToViewSchema.js.map +0 -1
  620. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts +0 -58
  621. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +0 -1
  622. package/dist/feature-libraries/typed-schema/schemaCollection.js +0 -160
  623. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +0 -1
  624. package/dist/feature-libraries/typed-schema/typeUtils.d.ts +0 -15
  625. package/dist/feature-libraries/typed-schema/typeUtils.d.ts.map +0 -1
  626. package/dist/feature-libraries/typed-schema/typeUtils.js +0 -14
  627. package/dist/feature-libraries/typed-schema/typeUtils.js.map +0 -1
  628. package/dist/feature-libraries/typed-schema/view.d.ts.map +0 -1
  629. package/dist/feature-libraries/typed-schema/view.js.map +0 -1
  630. package/dist/simple-tree/getSimpleFieldSchema.d.ts +0 -14
  631. package/dist/simple-tree/getSimpleFieldSchema.d.ts.map +0 -1
  632. package/dist/simple-tree/getSimpleFieldSchema.js +0 -29
  633. package/dist/simple-tree/getSimpleFieldSchema.js.map +0 -1
  634. package/dist/simple-tree/walkSchema.d.ts.map +0 -1
  635. package/dist/simple-tree/walkSchema.js +0 -49
  636. package/dist/simple-tree/walkSchema.js.map +0 -1
  637. package/lib/feature-libraries/fieldGenerator.d.ts +0 -43
  638. package/lib/feature-libraries/fieldGenerator.d.ts.map +0 -1
  639. package/lib/feature-libraries/fieldGenerator.js +0 -12
  640. package/lib/feature-libraries/fieldGenerator.js.map +0 -1
  641. package/lib/feature-libraries/flex-map-tree/index.d.ts +0 -6
  642. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +0 -1
  643. package/lib/feature-libraries/flex-map-tree/index.js +0 -6
  644. package/lib/feature-libraries/flex-map-tree/index.js.map +0 -1
  645. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +0 -157
  646. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +0 -1
  647. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +0 -1
  648. package/lib/feature-libraries/storedToViewSchema.d.ts +0 -17
  649. package/lib/feature-libraries/storedToViewSchema.d.ts.map +0 -1
  650. package/lib/feature-libraries/storedToViewSchema.js +0 -62
  651. package/lib/feature-libraries/storedToViewSchema.js.map +0 -1
  652. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts +0 -58
  653. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +0 -1
  654. package/lib/feature-libraries/typed-schema/schemaCollection.js +0 -153
  655. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +0 -1
  656. package/lib/feature-libraries/typed-schema/typeUtils.d.ts +0 -15
  657. package/lib/feature-libraries/typed-schema/typeUtils.d.ts.map +0 -1
  658. package/lib/feature-libraries/typed-schema/typeUtils.js +0 -10
  659. package/lib/feature-libraries/typed-schema/typeUtils.js.map +0 -1
  660. package/lib/feature-libraries/typed-schema/view.d.ts.map +0 -1
  661. package/lib/feature-libraries/typed-schema/view.js.map +0 -1
  662. package/lib/simple-tree/getSimpleFieldSchema.d.ts +0 -14
  663. package/lib/simple-tree/getSimpleFieldSchema.d.ts.map +0 -1
  664. package/lib/simple-tree/getSimpleFieldSchema.js +0 -25
  665. package/lib/simple-tree/getSimpleFieldSchema.js.map +0 -1
  666. package/lib/simple-tree/walkSchema.d.ts.map +0 -1
  667. package/lib/simple-tree/walkSchema.js +0 -43
  668. package/lib/simple-tree/walkSchema.js.map +0 -1
  669. package/src/feature-libraries/fieldGenerator.ts +0 -47
  670. package/src/feature-libraries/flex-map-tree/index.ts +0 -14
  671. package/src/feature-libraries/storedToViewSchema.ts +0 -100
  672. package/src/feature-libraries/typed-schema/schemaCollection.ts +0 -254
  673. package/src/feature-libraries/typed-schema/typeUtils.ts +0 -29
  674. package/src/simple-tree/getSimpleFieldSchema.ts +0 -36
@@ -4,439 +4,8 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.compileSyntaxTree = exports.comparePipeline = exports.createFlushableBinderOptions = exports.createBinderOptions = exports.createDataBinderInvalidating = exports.createDataBinderDirect = exports.createDataBinderBuffering = exports.toDownPath = exports.BindingType = exports.indexSymbol = void 0;
8
- const internal_1 = require("@fluidframework/core-utils/internal");
7
+ exports.toDownPath = void 0;
9
8
  const index_js_1 = require("../core/index.js");
10
- const index_js_2 = require("../util/index.js");
11
- /**
12
- * Index symbol for syntax tree
13
- */
14
- exports.indexSymbol = Symbol("flex-tree-binder:index");
15
- /**
16
- * Enumeration of binding categories
17
- */
18
- exports.BindingType = {
19
- Remove: "remove",
20
- Insert: "insert",
21
- Invalidation: "invalidation",
22
- Batch: "batch",
23
- };
24
- /**
25
- * A generic implementation of a {@link PathVisitor} enabling the registration of listeners
26
- * categorized by {@link BindingContextType} and {@link BindPolicy}.
27
- */
28
- class AbstractPathVisitor {
29
- constructor(options) {
30
- this.options = options;
31
- this.registeredListeners = new Map();
32
- }
33
- // TODO: make these methods abstract and make AbstractPathVisitor implementations implement them
34
- afterCreate(content) { }
35
- beforeDestroy(content) { }
36
- beforeAttach(source, destination) { }
37
- afterAttach(source, destination) {
38
- this.onInsert({
39
- parent: destination.parent,
40
- parentField: destination.field,
41
- parentIndex: destination.start,
42
- }, this.getContent(destination));
43
- }
44
- beforeDetach(source, destination) { }
45
- afterDetach(source, destination) {
46
- this.onRemove({
47
- parent: source.parent,
48
- parentField: source.field,
49
- parentIndex: source.index,
50
- }, destination.end - destination.start);
51
- }
52
- beforeReplace(newContent, oldContent, oldContentDestination) { }
53
- afterReplace(newContentSource, newContent, oldContent) {
54
- this.onRemove({
55
- parent: newContent.parent,
56
- parentField: newContent.field,
57
- parentIndex: newContent.start,
58
- }, oldContent.end - oldContent.start);
59
- this.onInsert({
60
- parent: newContent.parent,
61
- parentField: newContent.field,
62
- parentIndex: newContent.start,
63
- }, this.getContent(newContent));
64
- }
65
- getContent(range) {
66
- // TODO: either lookup the content in the forest or stop providing the content in the events
67
- return [];
68
- }
69
- registerListener(contextType, policies, listener) {
70
- const contextRoots = (0, index_js_2.getOrCreate)(this.registeredListeners, contextType, () => new Map());
71
- policies.forEach((policy) => {
72
- const tree = policy.bindTree;
73
- const currentRoot = this.findRoot(contextType, tree.field);
74
- if (currentRoot === undefined) {
75
- const newRoot = {
76
- field: tree.field,
77
- index: tree.index,
78
- listeners: new Set(),
79
- children: new Map(),
80
- matchPolicy: policy.matchPolicy,
81
- };
82
- (0, internal_1.assert)(contextRoots !== undefined, 0x6da /* expected contextRoots to be defined */);
83
- contextRoots.set(tree.field, newRoot);
84
- this.bindTree(contextType, tree, listener, newRoot);
85
- }
86
- else {
87
- this.bindTree(contextType, tree, listener, currentRoot);
88
- }
89
- });
90
- return () => {
91
- policies.forEach((policy) => this.unregisterListener(contextType, policy.bindTree, listener));
92
- };
93
- }
94
- bindTree(contextType, tree, listener, callTree) {
95
- if (tree.children.size === 0) {
96
- callTree.listeners.add(listener);
97
- }
98
- else {
99
- tree.children.forEach((childTree, fieldKey) => {
100
- const childCallTree = (0, index_js_2.getOrCreate)(callTree.children, fieldKey, () => {
101
- const newChildCallTree = {
102
- field: fieldKey,
103
- index: childTree.index,
104
- listeners: new Set(),
105
- children: new Map(),
106
- };
107
- callTree.children.set(fieldKey, newChildCallTree);
108
- return newChildCallTree;
109
- });
110
- this.bindTree(contextType, childTree, listener, childCallTree);
111
- });
112
- }
113
- }
114
- findRoot(contextType, field) {
115
- return this.registeredListeners.get(contextType)?.get(field);
116
- }
117
- unregisterListener(contextType, tree, listener, callTree) {
118
- const foundTree = callTree ?? this.findRoot(contextType, tree.field);
119
- if (foundTree !== undefined) {
120
- if (tree.children.size === 0) {
121
- foundTree.listeners.delete(listener);
122
- }
123
- else {
124
- tree.children.forEach((childTree, fieldKey) => {
125
- (0, internal_1.assert)(foundTree !== undefined, 0x6db /* expected foundTree to be defined */);
126
- const childCallTree = foundTree.children.get(fieldKey);
127
- if (childCallTree !== undefined) {
128
- this.unregisterListener(contextType, childTree, listener, childCallTree);
129
- }
130
- });
131
- }
132
- }
133
- }
134
- getListeners(contextType, downPath) {
135
- const firstDownPath = downPath[0] ?? (0, internal_1.oob)();
136
- const foundRoot = this.findRoot(contextType, firstDownPath.field);
137
- if (foundRoot === undefined) {
138
- return undefined;
139
- }
140
- else {
141
- const subtreeMatch = (subtreePolicy, depth) => {
142
- if (subtreePolicy?.maxDepth !== undefined && depth > subtreePolicy.maxDepth) {
143
- return false;
144
- }
145
- return true;
146
- };
147
- const accumulateMatching = (treeNode, index, onMatch) => {
148
- const step = downPath[index];
149
- if (step === undefined ||
150
- treeNode.field !== step.field ||
151
- (treeNode.index !== undefined && step.index !== treeNode.index)) {
152
- return undefined;
153
- }
154
- for (const child of treeNode.children.values()) {
155
- accumulateMatching(child, index + 1, onMatch);
156
- }
157
- onMatch(index, treeNode);
158
- };
159
- const matchedNodes = new Set();
160
- if (foundRoot.matchPolicy === "path") {
161
- accumulateMatching(foundRoot, 0, (index, treeNode) => {
162
- if (index === downPath.length - 1) {
163
- treeNode.listeners.forEach((listener) => matchedNodes.add(listener));
164
- }
165
- });
166
- }
167
- else if (foundRoot.matchPolicy === "subtree") {
168
- accumulateMatching(foundRoot, 0, (index, treeNode) => {
169
- treeNode.listeners.forEach((listener) => matchedNodes.add(listener));
170
- });
171
- }
172
- else {
173
- const matchPolicy = foundRoot.matchPolicy;
174
- accumulateMatching(foundRoot, 0, (index, treeNode) => {
175
- if (subtreeMatch(matchPolicy, downPath.length - 1)) {
176
- treeNode.listeners.forEach((listener) => matchedNodes.add(listener));
177
- }
178
- });
179
- }
180
- return matchedNodes.size > 0 ? matchedNodes : undefined;
181
- }
182
- }
183
- hasRegisteredContextType(contextType) {
184
- return this.registeredListeners.has(contextType);
185
- }
186
- dispose() {
187
- this.registeredListeners.clear();
188
- }
189
- }
190
- /**
191
- * A visitor that invokes listeners immediately when a path is traversed.
192
- */
193
- class DirectPathVisitor extends AbstractPathVisitor {
194
- processListeners(path, listeners, otherArgs) {
195
- for (const listener of listeners) {
196
- listener({
197
- path,
198
- ...otherArgs,
199
- });
200
- }
201
- }
202
- processRegisteredPaths(path, type, otherArgs) {
203
- const current = toDownPath(path);
204
- const listeners = this.getListeners(type, current);
205
- if (listeners !== undefined) {
206
- this.processListeners(path, listeners, otherArgs);
207
- }
208
- }
209
- onRemove(path, count) {
210
- this.processRegisteredPaths(path, exports.BindingType.Remove, {
211
- count,
212
- type: exports.BindingType.Remove,
213
- });
214
- }
215
- onInsert(path, content) {
216
- this.processRegisteredPaths(path, exports.BindingType.Insert, {
217
- content,
218
- type: exports.BindingType.Insert,
219
- });
220
- }
221
- }
222
- /**
223
- * A visitor that invokes listeners only once when flushed if any modifications detected on the registered paths.
224
- */
225
- class InvalidatingPathVisitor extends AbstractPathVisitor {
226
- constructor() {
227
- super(...arguments);
228
- this.listeners = new Set();
229
- }
230
- processRegisteredPaths(path) {
231
- const current = toDownPath(path);
232
- const listeners = this.getListeners(exports.BindingType.Invalidation, current);
233
- if (listeners !== undefined) {
234
- for (const listener of listeners) {
235
- this.listeners.add(listener);
236
- }
237
- }
238
- }
239
- onRemove(path, count) {
240
- this.processRegisteredPaths(path);
241
- }
242
- onInsert(path, content) {
243
- this.processRegisteredPaths(path);
244
- }
245
- flush() {
246
- for (const listener of this.listeners) {
247
- listener({
248
- type: exports.BindingType.Invalidation,
249
- });
250
- }
251
- this.listeners.clear();
252
- return this;
253
- }
254
- dispose() {
255
- this.flush();
256
- super.dispose();
257
- }
258
- }
259
- /**
260
- * A visitor that buffers all events which match the registered event categories and corresponding paths.
261
- * Listeners are invoked when flushed. Flushing has also the ability to sort and batch the events.
262
- */
263
- class BufferingPathVisitor extends AbstractPathVisitor {
264
- constructor() {
265
- super(...arguments);
266
- this.eventQueue = [];
267
- }
268
- onRemove(path, count) {
269
- const current = toDownPath(path);
270
- const listeners = this.getListeners(exports.BindingType.Remove, current);
271
- if (listeners !== undefined) {
272
- this.eventQueue.push({
273
- path,
274
- count,
275
- type: exports.BindingType.Remove,
276
- listeners,
277
- });
278
- }
279
- }
280
- onInsert(path, content) {
281
- const current = toDownPath(path);
282
- const listeners = this.getListeners(exports.BindingType.Insert, current);
283
- if (listeners !== undefined) {
284
- this.eventQueue.push({
285
- path,
286
- content,
287
- type: exports.BindingType.Insert,
288
- listeners,
289
- });
290
- }
291
- }
292
- flush() {
293
- const sortedQueue = nativeSort(this.eventQueue, this.options.sortFn ?? (() => 0));
294
- const batchEventIndices = new Set();
295
- const batchEvents = [];
296
- const collected = new Set();
297
- if (this.hasRegisteredContextType(exports.BindingType.Batch)) {
298
- for (const [i, event] of sortedQueue.entries()) {
299
- const current = toDownPath(event.path);
300
- const listeners = this.getListeners(exports.BindingType.Batch, current);
301
- if (listeners !== undefined && listeners.size > 0) {
302
- for (const listener of listeners) {
303
- collected.add(listener);
304
- }
305
- batchEvents.push(event);
306
- batchEventIndices.add(i);
307
- }
308
- }
309
- }
310
- for (const listener of collected) {
311
- listener({
312
- type: exports.BindingType.Batch,
313
- events: batchEvents,
314
- });
315
- }
316
- for (const [i, { listeners, ...context }] of sortedQueue.entries()) {
317
- if (batchEventIndices.has(i)) {
318
- continue;
319
- }
320
- for (const listener of listeners) {
321
- listener({ ...context });
322
- }
323
- }
324
- this.eventQueue.length = 0;
325
- return this;
326
- }
327
- dispose() {
328
- this.flush();
329
- super.dispose();
330
- }
331
- }
332
- class AbstractDataBinder {
333
- constructor(options, visitorFactory) {
334
- this.options = options;
335
- this.visitorFactory = visitorFactory;
336
- this.visitors = new Map();
337
- this.visitorLocations = new Map();
338
- this.unregisterHandles = new Set();
339
- }
340
- register(anchor, eventType, eventTrees, listener) {
341
- // TODO: validate BindPath semantics against the schema
342
- const visitor = (0, index_js_2.getOrCreate)(this.visitors, anchor, () => {
343
- const newVisitor = this.visitorFactory(anchor);
344
- this.unregisterHandles.add(anchor.anchorNode.on("subtreeChanging", (upPath) => {
345
- (0, internal_1.assert)(newVisitor !== undefined, 0x6dc /* visitor expected to be defined */);
346
- if (!this.visitorLocations.has(newVisitor)) {
347
- this.visitorLocations.set(newVisitor, upPath);
348
- }
349
- return newVisitor;
350
- }));
351
- return newVisitor;
352
- });
353
- const contextType = eventType;
354
- this.unregisterHandles.add(visitor.registerListener(contextType, eventTrees, listener));
355
- }
356
- unregisterAll() {
357
- this.unregisterHandles.forEach((h) => h());
358
- this.unregisterHandles.clear();
359
- this.visitors.forEach((v) => v.dispose());
360
- this.visitors.clear();
361
- }
362
- extractBindPaths(root) {
363
- const result = [];
364
- const depthFirst = (node, path = [root]) => {
365
- if (node.children.size === 0) {
366
- result.push(path);
367
- return;
368
- }
369
- for (const [field, childNode] of node.children.entries()) {
370
- depthFirst(childNode, [...path, { field, index: childNode.index }]);
371
- }
372
- };
373
- depthFirst(root);
374
- return result;
375
- }
376
- }
377
- class BufferingDataBinder extends AbstractDataBinder {
378
- constructor(view, options) {
379
- super(options, (anchor) => new BufferingPathVisitor(options));
380
- this.view = view;
381
- this.autoFlushPolicy = options.autoFlushPolicy;
382
- if (options.autoFlush) {
383
- this.enableAutoFlush();
384
- }
385
- }
386
- flush() {
387
- const unsortedVisitors = Array.from(this.visitorLocations.keys());
388
- const sortFn = this.options.sortAnchorsFn ?? (() => 0);
389
- const compareFn = (a, b) => {
390
- const pathA = this.visitorLocations.get(a);
391
- const pathB = this.visitorLocations.get(b);
392
- (0, internal_1.assert)(pathA !== undefined, 0x6dd /* pathA expected to be defined */);
393
- (0, internal_1.assert)(pathB !== undefined, 0x6de /* pathB expected to be defined */);
394
- return sortFn(pathA, pathB);
395
- };
396
- const sortedVisitors = nativeSort(unsortedVisitors, compareFn);
397
- for (const visitor of sortedVisitors) {
398
- visitor.flush();
399
- }
400
- return this;
401
- }
402
- enableAutoFlush() {
403
- const callbackFn = (() => {
404
- this.flush();
405
- });
406
- const unregisterFlushing = this.view.on(this.autoFlushPolicy, callbackFn);
407
- this.unregisterHandles.add(unregisterFlushing);
408
- return this;
409
- }
410
- }
411
- class DirectDataBinder extends AbstractDataBinder {
412
- constructor(view, options) {
413
- super(options, (anchor) => new DirectPathVisitor(options));
414
- }
415
- }
416
- class InvalidateDataBinder extends AbstractDataBinder {
417
- constructor(view, options) {
418
- super(options, (anchor) => new InvalidatingPathVisitor(options));
419
- this.view = view;
420
- this.autoFlushPolicy = options.autoFlushPolicy;
421
- if (options.autoFlush) {
422
- this.enableAutoFlush();
423
- }
424
- }
425
- flush() {
426
- for (const visitor of this.visitors.values()) {
427
- visitor.flush();
428
- }
429
- return this;
430
- }
431
- enableAutoFlush() {
432
- const callbackFn = (() => {
433
- this.flush();
434
- });
435
- const unregisterFlushing = this.view.on(this.autoFlushPolicy, callbackFn);
436
- this.unregisterHandles.add(unregisterFlushing);
437
- return this;
438
- }
439
- }
440
9
  /**
441
10
  * Compute a top-town {@link DownPath} from an {@link UpPath}.
442
11
  */
@@ -449,111 +18,4 @@ function toDownPath(upPath) {
449
18
  return stepDownPath;
450
19
  }
451
20
  exports.toDownPath = toDownPath;
452
- /**
453
- * Create a buffering data binder.
454
- */
455
- function createDataBinderBuffering(view, options) {
456
- return new BufferingDataBinder(view, options);
457
- }
458
- exports.createDataBinderBuffering = createDataBinderBuffering;
459
- /**
460
- * Create a direct data binder.
461
- */
462
- function createDataBinderDirect(view, options) {
463
- return new DirectDataBinder(view, options);
464
- }
465
- exports.createDataBinderDirect = createDataBinderDirect;
466
- /**
467
- * Create an invalidating data binder.
468
- */
469
- function createDataBinderInvalidating(view, options) {
470
- return new InvalidateDataBinder(view, options);
471
- }
472
- exports.createDataBinderInvalidating = createDataBinderInvalidating;
473
- /**
474
- * Create binder options. If not specified, the default values are:
475
- * - sortFn: no sorting
476
- */
477
- function createBinderOptions({ sortFn, }) {
478
- return { sortFn };
479
- }
480
- exports.createBinderOptions = createBinderOptions;
481
- /**
482
- * Create flushable binder options. If not specified, the default values are:
483
- * - sortFn: no sorting
484
- * - sortAnchorsFn: no sorting
485
- * - autoFlush: true
486
- */
487
- function createFlushableBinderOptions({ sortFn, sortAnchorsFn, autoFlush = true, autoFlushPolicy, }) {
488
- return {
489
- sortFn,
490
- sortAnchorsFn,
491
- autoFlush,
492
- autoFlushPolicy,
493
- };
494
- }
495
- exports.createFlushableBinderOptions = createFlushableBinderOptions;
496
- /**
497
- * Utility to create a compare function from a list of compare functions.
498
- *
499
- * @param fns - a list of compare functions
500
- * @returns a compare function that can be used for sorting
501
- */
502
- function comparePipeline(...fns) {
503
- return (a, b) => {
504
- for (const fn of fns) {
505
- const result = fn(a, b);
506
- if (result !== 0) {
507
- return result;
508
- }
509
- }
510
- return 0;
511
- };
512
- }
513
- exports.comparePipeline = comparePipeline;
514
- /**
515
- * Native sorting algorithm.
516
- *
517
- * @param arr - the array to sort
518
- * @param compareFn - the compare function
519
- * @returns the sorted array
520
- */
521
- function nativeSort(arr, compareFn) {
522
- return [...arr].sort(compareFn);
523
- }
524
- /**
525
- * Compiles a (user friendly) syntax tree into the internal binding structure.
526
- * The syntax tree is a compact representation of related {@link BindPath}s.
527
- * The match policy can be specified. If not specified, the default value is "path".
528
- * @returns a {@link BindPolicy} object
529
- */
530
- function compileSyntaxTree(syntaxTree, matchPolicy) {
531
- const entries = Object.entries(syntaxTree);
532
- if (entries.length === 1) {
533
- const [fieldName, childNode] = entries[0] ?? (0, internal_1.oob)();
534
- const fieldKey = (0, index_js_2.brand)(fieldName);
535
- const bindTree = compileSyntaxTreeNode(childNode, fieldKey);
536
- return { matchPolicy: matchPolicy ?? "path", bindTree };
537
- }
538
- else
539
- throw new Error("Invalid BindSyntaxTree structure");
540
- }
541
- exports.compileSyntaxTree = compileSyntaxTree;
542
- function compileSyntaxTreeNode(node, parentField) {
543
- if (node === true)
544
- return { field: parentField, children: new Map() };
545
- const pathStep = {
546
- field: parentField,
547
- index: node[exports.indexSymbol],
548
- };
549
- const children = new Map();
550
- for (const [key, value] of Object.entries(node)) {
551
- const fieldKey = (0, index_js_2.brand)(key);
552
- children.set(fieldKey, compileSyntaxTreeNode(value, fieldKey));
553
- }
554
- return {
555
- ...pathStep,
556
- children,
557
- };
558
- }
559
21
  //# sourceMappingURL=editableTreeBinder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"editableTreeBinder.js","sourceRoot":"","sources":["../../src/feature-libraries/editableTreeBinder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAkE;AAElE,+CAU0B;AAE1B,+CAAsD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AA,cAAG,GAAE,CAAC;QACnD,MAAM,QAAQ,GAAa,IAAA,gBAAK,EAAC,SAAS,CAAC,CAAC;QAC5C,MAAM,QAAQ,GAAG,qBAAqB,CAAC,SAA2B,EAAE,QAAQ,CAAC,CAAC;QAC9E,OAAO,EAAE,WAAW,EAAE,WAAW,IAAI,MAAM,EAAE,QAAQ,EAAE,CAAC;IACzD,CAAC;;QAAM,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;AAC5D,CAAC;AAXD,8CAWC;AAED,SAAS,qBAAqB,CAAC,IAA2B,EAAE,WAAqB;IAChF,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;IACtE,MAAM,QAAQ,GAAa;QAC1B,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,IAAI,CAAC,mBAAW,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,IAAA,gBAAK,EAAC,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"]}
1
+ {"version":3,"file":"editableTreeBinder.js","sourceRoot":"","sources":["../../src/feature-libraries/editableTreeBinder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAA2E;AAyB3E;;GAEG;AACH,SAAgB,UAAU,CAAC,MAAc;IACxC,MAAM,QAAQ,GAAa,IAAA,sBAAW,EAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,YAAY,GAAe,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACnD,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACvD,CAAC,CAAC,CAAC;IACH,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,oCAAoC;IAC1D,OAAO,YAAY,CAAC;AACrB,CAAC;AAPD,gCAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type FieldKey, type UpPath, topDownPath } from \"../core/index.js\";\n\n/**\n * A step in a bind path\n */\ninterface 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 * 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 * 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"]}