@fluidframework/tree 2.4.0-294316 → 2.4.0-297385

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 (755) hide show
  1. package/api-report/tree.alpha.api.md +58 -28
  2. package/api-report/tree.beta.api.md +38 -27
  3. package/api-report/tree.legacy.alpha.api.md +38 -27
  4. package/api-report/tree.legacy.public.api.md +38 -27
  5. package/api-report/tree.public.api.md +38 -27
  6. package/dist/alpha.d.ts +6 -0
  7. package/dist/beta.d.ts +3 -0
  8. package/dist/core/change-family/changeFamily.d.ts +2 -2
  9. package/dist/core/change-family/changeFamily.d.ts.map +1 -1
  10. package/dist/core/change-family/changeFamily.js.map +1 -1
  11. package/dist/core/change-family/editBuilder.d.ts +3 -2
  12. package/dist/core/change-family/editBuilder.d.ts.map +1 -1
  13. package/dist/core/change-family/editBuilder.js.map +1 -1
  14. package/dist/core/rebase/changeRebaser.d.ts +2 -1
  15. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  16. package/dist/core/rebase/changeRebaser.js.map +1 -1
  17. package/dist/core/rebase/utils.js +1 -1
  18. package/dist/core/rebase/utils.js.map +1 -1
  19. package/dist/core/schema-stored/schema.d.ts +7 -0
  20. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  21. package/dist/core/schema-stored/schema.js +9 -0
  22. package/dist/core/schema-stored/schema.js.map +1 -1
  23. package/dist/core/tree/anchorSet.d.ts +1 -2
  24. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  25. package/dist/core/tree/anchorSet.js +2 -2
  26. package/dist/core/tree/anchorSet.js.map +1 -1
  27. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  28. package/dist/core/tree/detachedFieldIndex.js +13 -2
  29. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  30. package/dist/core/tree/detachedFieldIndexTypes.d.ts +1 -1
  31. package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
  32. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +4 -3
  33. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  34. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +41 -30
  35. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  36. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +4 -6
  37. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  38. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  39. package/dist/feature-libraries/editableTreeBinder.d.ts +3 -230
  40. package/dist/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  41. package/dist/feature-libraries/editableTreeBinder.js +1 -539
  42. package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
  43. package/dist/feature-libraries/flex-tree/context.d.ts +7 -14
  44. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  45. package/dist/feature-libraries/flex-tree/context.js +3 -3
  46. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  47. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -16
  48. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  49. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  50. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +2 -3
  51. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  52. package/dist/feature-libraries/flex-tree/lazyEntity.js +1 -2
  53. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  54. package/dist/feature-libraries/flex-tree/lazyField.d.ts +10 -15
  55. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  56. package/dist/feature-libraries/flex-tree/lazyField.js +18 -20
  57. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  58. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +4 -5
  59. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  60. package/dist/feature-libraries/flex-tree/lazyNode.js +13 -23
  61. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  62. package/dist/feature-libraries/flex-tree/utilities.js +1 -1
  63. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  64. package/dist/feature-libraries/index.d.ts +4 -7
  65. package/dist/feature-libraries/index.d.ts.map +1 -1
  66. package/dist/feature-libraries/index.js +5 -31
  67. package/dist/feature-libraries/index.js.map +1 -1
  68. package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  69. package/dist/feature-libraries/mitigatedChangeFamily.js +4 -4
  70. package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  71. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +1 -1
  72. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  73. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  74. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +12 -8
  75. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  76. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +179 -60
  77. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  78. package/dist/feature-libraries/optional-field/optionalField.d.ts +10 -9
  79. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  80. package/dist/feature-libraries/optional-field/optionalField.js +9 -7
  81. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  82. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -10
  83. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  84. package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -8
  85. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  86. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  87. package/dist/feature-libraries/sequence-field/compose.js +32 -20
  88. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  89. package/dist/feature-libraries/sequence-field/formatV1.d.ts +18 -18
  90. package/dist/feature-libraries/sequence-field/formatV2.d.ts +18 -18
  91. package/dist/feature-libraries/sequence-field/formatV3.d.ts +27 -27
  92. package/dist/feature-libraries/sequence-field/invert.d.ts +6 -1
  93. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  94. package/dist/feature-libraries/sequence-field/invert.js +25 -9
  95. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  96. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +17 -16
  97. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  98. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +19 -11
  99. package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  100. package/dist/feature-libraries/typed-schema/flexList.d.ts +1 -46
  101. package/dist/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  102. package/dist/feature-libraries/typed-schema/flexList.js +1 -13
  103. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  104. package/dist/feature-libraries/typed-schema/index.d.ts +2 -4
  105. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  106. package/dist/feature-libraries/typed-schema/index.js +1 -19
  107. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  108. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -212
  109. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  110. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +0 -266
  111. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  112. package/dist/index.d.ts +3 -3
  113. package/dist/index.d.ts.map +1 -1
  114. package/dist/index.js +2 -1
  115. package/dist/index.js.map +1 -1
  116. package/dist/internalTypes.d.ts +1 -1
  117. package/dist/internalTypes.d.ts.map +1 -1
  118. package/dist/internalTypes.js.map +1 -1
  119. package/dist/legacy.d.ts +3 -0
  120. package/dist/packageVersion.d.ts +1 -1
  121. package/dist/packageVersion.js +1 -1
  122. package/dist/packageVersion.js.map +1 -1
  123. package/dist/public.d.ts +3 -0
  124. package/dist/shared-tree/checkoutFlexTreeView.d.ts +3 -3
  125. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  126. package/dist/shared-tree/checkoutFlexTreeView.js +1 -1
  127. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  128. package/dist/shared-tree/index.d.ts +3 -3
  129. package/dist/shared-tree/index.d.ts.map +1 -1
  130. package/dist/shared-tree/index.js +2 -3
  131. package/dist/shared-tree/index.js.map +1 -1
  132. package/dist/shared-tree/schematizeTree.d.ts +1 -40
  133. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  134. package/dist/shared-tree/schematizeTree.js +2 -11
  135. package/dist/shared-tree/schematizeTree.js.map +1 -1
  136. package/dist/shared-tree/schematizingTreeView.d.ts +8 -7
  137. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  138. package/dist/shared-tree/schematizingTreeView.js +16 -8
  139. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  140. package/dist/shared-tree/sharedTree.d.ts +19 -2
  141. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  142. package/dist/shared-tree/sharedTree.js +11 -3
  143. package/dist/shared-tree/sharedTree.js.map +1 -1
  144. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  145. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  146. package/dist/shared-tree/sharedTreeChangeFamily.js +4 -4
  147. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  148. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +2 -2
  149. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  150. package/dist/shared-tree/sharedTreeEditBuilder.js +15 -11
  151. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  152. package/dist/shared-tree/treeCheckout.d.ts +71 -41
  153. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  154. package/dist/shared-tree/treeCheckout.js +119 -86
  155. package/dist/shared-tree/treeCheckout.js.map +1 -1
  156. package/dist/shared-tree-core/branch.d.ts +9 -13
  157. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  158. package/dist/shared-tree-core/branch.js +21 -25
  159. package/dist/shared-tree-core/branch.js.map +1 -1
  160. package/dist/shared-tree-core/defaultResubmitMachine.d.ts +5 -5
  161. package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  162. package/dist/shared-tree-core/defaultResubmitMachine.js +4 -4
  163. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  164. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  165. package/dist/shared-tree-core/editManager.js +1 -1
  166. package/dist/shared-tree-core/editManager.js.map +1 -1
  167. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  168. package/dist/shared-tree-core/sharedTreeCore.js +2 -2
  169. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  170. package/dist/simple-tree/api/create.d.ts +1 -1
  171. package/dist/simple-tree/api/create.d.ts.map +1 -1
  172. package/dist/simple-tree/api/create.js +11 -13
  173. package/dist/simple-tree/api/create.js.map +1 -1
  174. package/dist/simple-tree/api/getJsonSchema.d.ts +3 -3
  175. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  176. package/dist/simple-tree/api/getJsonSchema.js +1 -1
  177. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  178. package/dist/simple-tree/api/getSimpleSchema.d.ts +2 -2
  179. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  180. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  181. package/dist/simple-tree/api/index.d.ts +2 -1
  182. package/dist/simple-tree/api/index.d.ts.map +1 -1
  183. package/dist/simple-tree/api/index.js +3 -1
  184. package/dist/simple-tree/api/index.js.map +1 -1
  185. package/dist/simple-tree/api/schemaFactory.d.ts +6 -6
  186. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  187. package/dist/simple-tree/api/schemaFactory.js +15 -2
  188. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  189. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +3 -3
  190. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  191. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  192. package/dist/simple-tree/api/simpleSchema.d.ts +14 -10
  193. package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
  194. package/dist/simple-tree/api/simpleSchema.js.map +1 -1
  195. package/dist/simple-tree/api/tree.d.ts +12 -6
  196. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  197. package/dist/simple-tree/api/tree.js +4 -4
  198. package/dist/simple-tree/api/tree.js.map +1 -1
  199. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  200. package/dist/simple-tree/api/treeNodeApi.js +8 -6
  201. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  202. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  203. package/dist/simple-tree/api/verboseTree.js +6 -10
  204. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  205. package/{lib/feature-libraries/typed-schema → dist/simple-tree/api}/view.d.ts +4 -11
  206. package/dist/simple-tree/api/view.d.ts.map +1 -0
  207. package/dist/{feature-libraries/typed-schema → simple-tree/api}/view.js +9 -9
  208. package/dist/simple-tree/api/view.js.map +1 -0
  209. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -2
  210. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  211. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +7 -1
  212. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  213. package/dist/simple-tree/arrayNode.d.ts +147 -14
  214. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  215. package/dist/simple-tree/arrayNode.js +32 -20
  216. package/dist/simple-tree/arrayNode.js.map +1 -1
  217. package/dist/simple-tree/core/context.d.ts +55 -0
  218. package/dist/simple-tree/core/context.d.ts.map +1 -0
  219. package/dist/simple-tree/core/context.js +60 -0
  220. package/dist/simple-tree/core/context.js.map +1 -0
  221. package/dist/simple-tree/core/getOrCreateNode.d.ts +15 -0
  222. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -0
  223. package/dist/simple-tree/core/getOrCreateNode.js +36 -0
  224. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -0
  225. package/dist/simple-tree/core/index.d.ts +7 -3
  226. package/dist/simple-tree/core/index.d.ts.map +1 -1
  227. package/dist/simple-tree/core/index.js +16 -7
  228. package/dist/simple-tree/core/index.js.map +1 -1
  229. package/dist/simple-tree/core/schemaCaching.d.ts +5 -13
  230. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -1
  231. package/dist/simple-tree/core/schemaCaching.js +16 -45
  232. package/dist/simple-tree/core/schemaCaching.js.map +1 -1
  233. package/dist/simple-tree/core/treeNodeKernel.d.ts +29 -7
  234. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  235. package/dist/simple-tree/core/treeNodeKernel.js +94 -58
  236. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  237. package/dist/simple-tree/core/treeNodeSchema.d.ts +24 -0
  238. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  239. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  240. package/dist/simple-tree/core/types.d.ts +0 -5
  241. package/dist/simple-tree/core/types.d.ts.map +1 -1
  242. package/dist/simple-tree/core/types.js.map +1 -1
  243. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +139 -0
  244. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -0
  245. package/dist/{feature-libraries/flex-map-tree/mapTreeNode.js → simple-tree/core/unhydratedFlexTree.js} +112 -132
  246. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -0
  247. package/dist/simple-tree/{walkSchema.d.ts → core/walkSchema.d.ts} +8 -4
  248. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -0
  249. package/dist/simple-tree/core/walkSchema.js +34 -0
  250. package/dist/simple-tree/core/walkSchema.js.map +1 -0
  251. package/dist/simple-tree/createContext.d.ts +11 -0
  252. package/dist/simple-tree/createContext.d.ts.map +1 -0
  253. package/dist/simple-tree/createContext.js +25 -0
  254. package/dist/simple-tree/createContext.js.map +1 -0
  255. package/dist/simple-tree/index.d.ts +3 -4
  256. package/dist/simple-tree/index.d.ts.map +1 -1
  257. package/dist/simple-tree/index.js +7 -7
  258. package/dist/simple-tree/index.js.map +1 -1
  259. package/dist/simple-tree/leafNodeSchema.d.ts +1 -0
  260. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  261. package/dist/simple-tree/leafNodeSchema.js +1 -2
  262. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  263. package/dist/simple-tree/mapNode.d.ts +4 -4
  264. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  265. package/dist/simple-tree/mapNode.js +9 -5
  266. package/dist/simple-tree/mapNode.js.map +1 -1
  267. package/dist/simple-tree/objectNode.d.ts +8 -8
  268. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  269. package/dist/simple-tree/objectNode.js +33 -14
  270. package/dist/simple-tree/objectNode.js.map +1 -1
  271. package/dist/simple-tree/objectNodeTypes.d.ts +7 -3
  272. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
  273. package/dist/simple-tree/objectNodeTypes.js.map +1 -1
  274. package/dist/simple-tree/proxies.d.ts +1 -2
  275. package/dist/simple-tree/proxies.d.ts.map +1 -1
  276. package/dist/simple-tree/proxies.js +6 -22
  277. package/dist/simple-tree/proxies.js.map +1 -1
  278. package/dist/simple-tree/schemaTypes.d.ts +2 -2
  279. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  280. package/dist/simple-tree/schemaTypes.js.map +1 -1
  281. package/dist/simple-tree/toFlexSchema.d.ts +6 -36
  282. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  283. package/dist/simple-tree/toFlexSchema.js +58 -142
  284. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  285. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  286. package/dist/simple-tree/toMapTree.js +2 -2
  287. package/dist/simple-tree/toMapTree.js.map +1 -1
  288. package/dist/simple-tree/treeNodeValid.d.ts +13 -5
  289. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  290. package/dist/simple-tree/treeNodeValid.js +19 -10
  291. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  292. package/dist/simple-tree/typesUnsafe.d.ts +4 -4
  293. package/dist/simple-tree/typesUnsafe.d.ts.map +1 -1
  294. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  295. package/dist/simple-tree/walkFieldSchema.d.ts +11 -0
  296. package/dist/simple-tree/walkFieldSchema.d.ts.map +1 -0
  297. package/dist/simple-tree/walkFieldSchema.js +17 -0
  298. package/dist/simple-tree/walkFieldSchema.js.map +1 -0
  299. package/dist/util/index.d.ts +1 -1
  300. package/dist/util/index.d.ts.map +1 -1
  301. package/dist/util/index.js.map +1 -1
  302. package/dist/util/typeUtils.d.ts +14 -45
  303. package/dist/util/typeUtils.d.ts.map +1 -1
  304. package/dist/util/typeUtils.js.map +1 -1
  305. package/lib/alpha.d.ts +6 -0
  306. package/lib/beta.d.ts +3 -0
  307. package/lib/core/change-family/changeFamily.d.ts +2 -2
  308. package/lib/core/change-family/changeFamily.d.ts.map +1 -1
  309. package/lib/core/change-family/changeFamily.js.map +1 -1
  310. package/lib/core/change-family/editBuilder.d.ts +3 -2
  311. package/lib/core/change-family/editBuilder.d.ts.map +1 -1
  312. package/lib/core/change-family/editBuilder.js.map +1 -1
  313. package/lib/core/rebase/changeRebaser.d.ts +2 -1
  314. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  315. package/lib/core/rebase/changeRebaser.js.map +1 -1
  316. package/lib/core/rebase/utils.js +1 -1
  317. package/lib/core/rebase/utils.js.map +1 -1
  318. package/lib/core/schema-stored/schema.d.ts +7 -0
  319. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  320. package/lib/core/schema-stored/schema.js +9 -0
  321. package/lib/core/schema-stored/schema.js.map +1 -1
  322. package/lib/core/tree/anchorSet.d.ts +1 -2
  323. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  324. package/lib/core/tree/anchorSet.js +2 -2
  325. package/lib/core/tree/anchorSet.js.map +1 -1
  326. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  327. package/lib/core/tree/detachedFieldIndex.js +13 -2
  328. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  329. package/lib/core/tree/detachedFieldIndexTypes.d.ts +1 -1
  330. package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
  331. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +4 -3
  332. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  333. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +41 -30
  334. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  335. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +4 -6
  336. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  337. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  338. package/lib/feature-libraries/editableTreeBinder.d.ts +3 -230
  339. package/lib/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  340. package/lib/feature-libraries/editableTreeBinder.js +1 -532
  341. package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
  342. package/lib/feature-libraries/flex-tree/context.d.ts +7 -14
  343. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  344. package/lib/feature-libraries/flex-tree/context.js +3 -3
  345. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  346. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -16
  347. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  348. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  349. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +2 -3
  350. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  351. package/lib/feature-libraries/flex-tree/lazyEntity.js +1 -2
  352. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  353. package/lib/feature-libraries/flex-tree/lazyField.d.ts +10 -15
  354. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  355. package/lib/feature-libraries/flex-tree/lazyField.js +18 -20
  356. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  357. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +4 -5
  358. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  359. package/lib/feature-libraries/flex-tree/lazyNode.js +13 -23
  360. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  361. package/lib/feature-libraries/flex-tree/utilities.js +1 -1
  362. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  363. package/lib/feature-libraries/index.d.ts +4 -7
  364. package/lib/feature-libraries/index.d.ts.map +1 -1
  365. package/lib/feature-libraries/index.js +4 -6
  366. package/lib/feature-libraries/index.js.map +1 -1
  367. package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
  368. package/lib/feature-libraries/mitigatedChangeFamily.js +4 -4
  369. package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
  370. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +1 -1
  371. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  372. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  373. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +12 -8
  374. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  375. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +180 -61
  376. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  377. package/lib/feature-libraries/optional-field/optionalField.d.ts +10 -9
  378. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  379. package/lib/feature-libraries/optional-field/optionalField.js +9 -7
  380. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  381. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -10
  382. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  383. package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -8
  384. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  385. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  386. package/lib/feature-libraries/sequence-field/compose.js +32 -20
  387. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  388. package/lib/feature-libraries/sequence-field/formatV1.d.ts +18 -18
  389. package/lib/feature-libraries/sequence-field/formatV2.d.ts +18 -18
  390. package/lib/feature-libraries/sequence-field/formatV3.d.ts +27 -27
  391. package/lib/feature-libraries/sequence-field/invert.d.ts +6 -1
  392. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  393. package/lib/feature-libraries/sequence-field/invert.js +25 -9
  394. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  395. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +17 -16
  396. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
  397. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +19 -11
  398. package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
  399. package/lib/feature-libraries/typed-schema/flexList.d.ts +1 -46
  400. package/lib/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  401. package/lib/feature-libraries/typed-schema/flexList.js +0 -11
  402. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  403. package/lib/feature-libraries/typed-schema/index.d.ts +2 -4
  404. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  405. package/lib/feature-libraries/typed-schema/index.js +0 -3
  406. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  407. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -212
  408. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  409. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +1 -253
  410. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  411. package/lib/index.d.ts +3 -3
  412. package/lib/index.d.ts.map +1 -1
  413. package/lib/index.js +1 -1
  414. package/lib/index.js.map +1 -1
  415. package/lib/internalTypes.d.ts +1 -1
  416. package/lib/internalTypes.d.ts.map +1 -1
  417. package/lib/internalTypes.js.map +1 -1
  418. package/lib/legacy.d.ts +3 -0
  419. package/lib/packageVersion.d.ts +1 -1
  420. package/lib/packageVersion.js +1 -1
  421. package/lib/packageVersion.js.map +1 -1
  422. package/lib/public.d.ts +3 -0
  423. package/lib/shared-tree/checkoutFlexTreeView.d.ts +3 -3
  424. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  425. package/lib/shared-tree/checkoutFlexTreeView.js +1 -1
  426. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  427. package/lib/shared-tree/index.d.ts +3 -3
  428. package/lib/shared-tree/index.d.ts.map +1 -1
  429. package/lib/shared-tree/index.js +1 -2
  430. package/lib/shared-tree/index.js.map +1 -1
  431. package/lib/shared-tree/schematizeTree.d.ts +1 -40
  432. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  433. package/lib/shared-tree/schematizeTree.js +1 -9
  434. package/lib/shared-tree/schematizeTree.js.map +1 -1
  435. package/lib/shared-tree/schematizingTreeView.d.ts +8 -7
  436. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  437. package/lib/shared-tree/schematizingTreeView.js +19 -11
  438. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  439. package/lib/shared-tree/sharedTree.d.ts +19 -2
  440. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  441. package/lib/shared-tree/sharedTree.js +11 -4
  442. package/lib/shared-tree/sharedTree.js.map +1 -1
  443. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  444. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  445. package/lib/shared-tree/sharedTreeChangeFamily.js +4 -4
  446. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  447. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +2 -2
  448. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  449. package/lib/shared-tree/sharedTreeEditBuilder.js +15 -11
  450. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  451. package/lib/shared-tree/treeCheckout.d.ts +71 -41
  452. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  453. package/lib/shared-tree/treeCheckout.js +122 -89
  454. package/lib/shared-tree/treeCheckout.js.map +1 -1
  455. package/lib/shared-tree-core/branch.d.ts +9 -13
  456. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  457. package/lib/shared-tree-core/branch.js +22 -26
  458. package/lib/shared-tree-core/branch.js.map +1 -1
  459. package/lib/shared-tree-core/defaultResubmitMachine.d.ts +5 -5
  460. package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  461. package/lib/shared-tree-core/defaultResubmitMachine.js +4 -4
  462. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  463. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  464. package/lib/shared-tree-core/editManager.js +2 -2
  465. package/lib/shared-tree-core/editManager.js.map +1 -1
  466. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  467. package/lib/shared-tree-core/sharedTreeCore.js +2 -2
  468. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  469. package/lib/simple-tree/api/create.d.ts +1 -1
  470. package/lib/simple-tree/api/create.d.ts.map +1 -1
  471. package/lib/simple-tree/api/create.js +14 -16
  472. package/lib/simple-tree/api/create.js.map +1 -1
  473. package/lib/simple-tree/api/getJsonSchema.d.ts +3 -3
  474. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  475. package/lib/simple-tree/api/getJsonSchema.js +1 -1
  476. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  477. package/lib/simple-tree/api/getSimpleSchema.d.ts +2 -2
  478. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  479. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  480. package/lib/simple-tree/api/index.d.ts +2 -1
  481. package/lib/simple-tree/api/index.d.ts.map +1 -1
  482. package/lib/simple-tree/api/index.js +1 -0
  483. package/lib/simple-tree/api/index.js.map +1 -1
  484. package/lib/simple-tree/api/schemaFactory.d.ts +6 -6
  485. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  486. package/lib/simple-tree/api/schemaFactory.js +15 -2
  487. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  488. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +3 -3
  489. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  490. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  491. package/lib/simple-tree/api/simpleSchema.d.ts +14 -10
  492. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
  493. package/lib/simple-tree/api/simpleSchema.js.map +1 -1
  494. package/lib/simple-tree/api/tree.d.ts +12 -6
  495. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  496. package/lib/simple-tree/api/tree.js +4 -4
  497. package/lib/simple-tree/api/tree.js.map +1 -1
  498. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  499. package/lib/simple-tree/api/treeNodeApi.js +10 -8
  500. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  501. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  502. package/lib/simple-tree/api/verboseTree.js +6 -10
  503. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  504. package/{dist/feature-libraries/typed-schema → lib/simple-tree/api}/view.d.ts +4 -11
  505. package/lib/simple-tree/api/view.d.ts.map +1 -0
  506. package/lib/{feature-libraries/typed-schema → simple-tree/api}/view.js +9 -9
  507. package/lib/simple-tree/api/view.js.map +1 -0
  508. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -2
  509. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  510. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +7 -1
  511. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  512. package/lib/simple-tree/arrayNode.d.ts +147 -14
  513. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  514. package/lib/simple-tree/arrayNode.js +37 -25
  515. package/lib/simple-tree/arrayNode.js.map +1 -1
  516. package/lib/simple-tree/core/context.d.ts +55 -0
  517. package/lib/simple-tree/core/context.d.ts.map +1 -0
  518. package/lib/simple-tree/core/context.js +55 -0
  519. package/lib/simple-tree/core/context.js.map +1 -0
  520. package/lib/simple-tree/core/getOrCreateNode.d.ts +15 -0
  521. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -0
  522. package/lib/simple-tree/core/getOrCreateNode.js +32 -0
  523. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -0
  524. package/lib/simple-tree/core/index.d.ts +7 -3
  525. package/lib/simple-tree/core/index.d.ts.map +1 -1
  526. package/lib/simple-tree/core/index.js +6 -2
  527. package/lib/simple-tree/core/index.js.map +1 -1
  528. package/lib/simple-tree/core/schemaCaching.d.ts +5 -13
  529. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -1
  530. package/lib/simple-tree/core/schemaCaching.js +13 -39
  531. package/lib/simple-tree/core/schemaCaching.js.map +1 -1
  532. package/lib/simple-tree/core/treeNodeKernel.d.ts +29 -7
  533. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  534. package/lib/simple-tree/core/treeNodeKernel.js +89 -54
  535. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  536. package/lib/simple-tree/core/treeNodeSchema.d.ts +24 -0
  537. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  538. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  539. package/lib/simple-tree/core/types.d.ts +0 -5
  540. package/lib/simple-tree/core/types.d.ts.map +1 -1
  541. package/lib/simple-tree/core/types.js.map +1 -1
  542. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +139 -0
  543. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -0
  544. package/lib/{feature-libraries/flex-map-tree/mapTreeNode.js → simple-tree/core/unhydratedFlexTree.js} +110 -128
  545. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -0
  546. package/lib/simple-tree/{walkSchema.d.ts → core/walkSchema.d.ts} +8 -4
  547. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -0
  548. package/lib/simple-tree/core/walkSchema.js +29 -0
  549. package/lib/simple-tree/core/walkSchema.js.map +1 -0
  550. package/lib/simple-tree/createContext.d.ts +11 -0
  551. package/lib/simple-tree/createContext.d.ts.map +1 -0
  552. package/lib/simple-tree/createContext.js +21 -0
  553. package/lib/simple-tree/createContext.js.map +1 -0
  554. package/lib/simple-tree/index.d.ts +3 -4
  555. package/lib/simple-tree/index.d.ts.map +1 -1
  556. package/lib/simple-tree/index.js +3 -4
  557. package/lib/simple-tree/index.js.map +1 -1
  558. package/lib/simple-tree/leafNodeSchema.d.ts +1 -0
  559. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  560. package/lib/simple-tree/leafNodeSchema.js +3 -4
  561. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  562. package/lib/simple-tree/mapNode.d.ts +4 -4
  563. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  564. package/lib/simple-tree/mapNode.js +12 -8
  565. package/lib/simple-tree/mapNode.js.map +1 -1
  566. package/lib/simple-tree/objectNode.d.ts +8 -8
  567. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  568. package/lib/simple-tree/objectNode.js +36 -17
  569. package/lib/simple-tree/objectNode.js.map +1 -1
  570. package/lib/simple-tree/objectNodeTypes.d.ts +7 -3
  571. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
  572. package/lib/simple-tree/objectNodeTypes.js.map +1 -1
  573. package/lib/simple-tree/proxies.d.ts +1 -2
  574. package/lib/simple-tree/proxies.d.ts.map +1 -1
  575. package/lib/simple-tree/proxies.js +7 -22
  576. package/lib/simple-tree/proxies.js.map +1 -1
  577. package/lib/simple-tree/schemaTypes.d.ts +2 -2
  578. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  579. package/lib/simple-tree/schemaTypes.js.map +1 -1
  580. package/lib/simple-tree/toFlexSchema.d.ts +6 -36
  581. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  582. package/lib/simple-tree/toFlexSchema.js +61 -142
  583. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  584. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  585. package/lib/simple-tree/toMapTree.js +4 -4
  586. package/lib/simple-tree/toMapTree.js.map +1 -1
  587. package/lib/simple-tree/treeNodeValid.d.ts +13 -5
  588. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  589. package/lib/simple-tree/treeNodeValid.js +21 -12
  590. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  591. package/lib/simple-tree/typesUnsafe.d.ts +4 -4
  592. package/lib/simple-tree/typesUnsafe.d.ts.map +1 -1
  593. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  594. package/lib/simple-tree/walkFieldSchema.d.ts +11 -0
  595. package/lib/simple-tree/walkFieldSchema.d.ts.map +1 -0
  596. package/lib/simple-tree/walkFieldSchema.js +13 -0
  597. package/lib/simple-tree/walkFieldSchema.js.map +1 -0
  598. package/lib/util/index.d.ts +1 -1
  599. package/lib/util/index.d.ts.map +1 -1
  600. package/lib/util/index.js.map +1 -1
  601. package/lib/util/typeUtils.d.ts +14 -45
  602. package/lib/util/typeUtils.d.ts.map +1 -1
  603. package/lib/util/typeUtils.js.map +1 -1
  604. package/package.json +32 -23
  605. package/src/core/change-family/changeFamily.ts +5 -2
  606. package/src/core/change-family/editBuilder.ts +3 -2
  607. package/src/core/rebase/changeRebaser.ts +6 -1
  608. package/src/core/rebase/utils.ts +1 -1
  609. package/src/core/schema-stored/schema.ts +17 -0
  610. package/src/core/tree/anchorSet.ts +3 -4
  611. package/src/core/tree/detachedFieldIndex.ts +14 -3
  612. package/src/core/tree/detachedFieldIndexTypes.ts +1 -1
  613. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +92 -47
  614. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +7 -7
  615. package/src/feature-libraries/editableTreeBinder.ts +2 -915
  616. package/src/feature-libraries/flex-tree/context.ts +7 -20
  617. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +2 -18
  618. package/src/feature-libraries/flex-tree/lazyEntity.ts +1 -4
  619. package/src/feature-libraries/flex-tree/lazyField.ts +22 -78
  620. package/src/feature-libraries/flex-tree/lazyNode.ts +24 -39
  621. package/src/feature-libraries/flex-tree/utilities.ts +1 -1
  622. package/src/feature-libraries/index.ts +3 -71
  623. package/src/feature-libraries/mitigatedChangeFamily.ts +11 -4
  624. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +1 -0
  625. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +218 -175
  626. package/src/feature-libraries/optional-field/optionalField.ts +21 -17
  627. package/src/feature-libraries/schema-index/schemaSummarizer.ts +2 -10
  628. package/src/feature-libraries/sequence-field/compose.ts +67 -58
  629. package/src/feature-libraries/sequence-field/invert.ts +30 -6
  630. package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +65 -19
  631. package/src/feature-libraries/typed-schema/flexList.ts +3 -84
  632. package/src/feature-libraries/typed-schema/index.ts +1 -33
  633. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +0 -458
  634. package/src/index.ts +6 -0
  635. package/src/internalTypes.ts +0 -1
  636. package/src/packageVersion.ts +1 -1
  637. package/src/shared-tree/checkoutFlexTreeView.ts +3 -3
  638. package/src/shared-tree/index.ts +4 -8
  639. package/src/shared-tree/schematizeTree.ts +2 -56
  640. package/src/shared-tree/schematizingTreeView.ts +34 -15
  641. package/src/shared-tree/sharedTree.ts +39 -9
  642. package/src/shared-tree/sharedTreeChangeFamily.ts +5 -1
  643. package/src/shared-tree/sharedTreeEditBuilder.ts +23 -12
  644. package/src/shared-tree/treeCheckout.ts +232 -134
  645. package/src/shared-tree-core/branch.ts +26 -40
  646. package/src/shared-tree-core/defaultResubmitMachine.ts +4 -4
  647. package/src/shared-tree-core/editManager.ts +2 -1
  648. package/src/shared-tree-core/sharedTreeCore.ts +4 -2
  649. package/src/simple-tree/api/create.ts +18 -20
  650. package/src/simple-tree/api/getJsonSchema.ts +3 -3
  651. package/src/simple-tree/api/getSimpleSchema.ts +2 -2
  652. package/src/simple-tree/api/index.ts +2 -0
  653. package/src/simple-tree/api/schemaFactory.ts +41 -12
  654. package/src/simple-tree/api/schemaFactoryRecursive.ts +3 -6
  655. package/src/simple-tree/api/simpleSchema.ts +15 -10
  656. package/src/simple-tree/api/tree.ts +15 -9
  657. package/src/simple-tree/api/treeNodeApi.ts +12 -10
  658. package/src/simple-tree/api/verboseTree.ts +6 -12
  659. package/src/{feature-libraries/typed-schema → simple-tree/api}/view.ts +9 -22
  660. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +11 -2
  661. package/src/simple-tree/arrayNode.ts +202 -53
  662. package/src/simple-tree/core/context.ts +78 -0
  663. package/src/simple-tree/core/getOrCreateNode.ts +38 -0
  664. package/src/simple-tree/core/index.ts +11 -7
  665. package/src/simple-tree/core/schemaCaching.ts +13 -50
  666. package/src/simple-tree/core/treeNodeKernel.ts +117 -78
  667. package/src/simple-tree/core/treeNodeSchema.ts +35 -1
  668. package/src/simple-tree/core/types.ts +0 -5
  669. package/src/{feature-libraries/flex-map-tree/mapTreeNode.ts → simple-tree/core/unhydratedFlexTree.ts} +167 -210
  670. package/src/simple-tree/{walkSchema.ts → core/walkSchema.ts} +12 -34
  671. package/src/simple-tree/createContext.ts +24 -0
  672. package/src/simple-tree/index.ts +5 -2
  673. package/src/simple-tree/leafNodeSchema.ts +3 -9
  674. package/src/simple-tree/mapNode.ts +20 -17
  675. package/src/simple-tree/objectNode.ts +63 -38
  676. package/src/simple-tree/objectNodeTypes.ts +8 -5
  677. package/src/simple-tree/proxies.ts +8 -26
  678. package/src/simple-tree/schemaTypes.ts +2 -2
  679. package/src/simple-tree/toFlexSchema.ts +71 -204
  680. package/src/simple-tree/toMapTree.ts +5 -5
  681. package/src/simple-tree/treeNodeValid.ts +28 -22
  682. package/src/simple-tree/typesUnsafe.ts +4 -4
  683. package/src/simple-tree/walkFieldSchema.ts +19 -0
  684. package/src/util/index.ts +1 -5
  685. package/src/util/typeUtils.ts +14 -56
  686. package/dist/feature-libraries/fieldGenerator.d.ts +0 -43
  687. package/dist/feature-libraries/fieldGenerator.d.ts.map +0 -1
  688. package/dist/feature-libraries/fieldGenerator.js +0 -13
  689. package/dist/feature-libraries/fieldGenerator.js.map +0 -1
  690. package/dist/feature-libraries/flex-map-tree/index.d.ts +0 -6
  691. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +0 -1
  692. package/dist/feature-libraries/flex-map-tree/index.js +0 -14
  693. package/dist/feature-libraries/flex-map-tree/index.js.map +0 -1
  694. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +0 -157
  695. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +0 -1
  696. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +0 -1
  697. package/dist/feature-libraries/storedToViewSchema.d.ts +0 -17
  698. package/dist/feature-libraries/storedToViewSchema.d.ts.map +0 -1
  699. package/dist/feature-libraries/storedToViewSchema.js +0 -67
  700. package/dist/feature-libraries/storedToViewSchema.js.map +0 -1
  701. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts +0 -58
  702. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +0 -1
  703. package/dist/feature-libraries/typed-schema/schemaCollection.js +0 -160
  704. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +0 -1
  705. package/dist/feature-libraries/typed-schema/typeUtils.d.ts +0 -15
  706. package/dist/feature-libraries/typed-schema/typeUtils.d.ts.map +0 -1
  707. package/dist/feature-libraries/typed-schema/typeUtils.js +0 -14
  708. package/dist/feature-libraries/typed-schema/typeUtils.js.map +0 -1
  709. package/dist/feature-libraries/typed-schema/view.d.ts.map +0 -1
  710. package/dist/feature-libraries/typed-schema/view.js.map +0 -1
  711. package/dist/simple-tree/getSimpleFieldSchema.d.ts +0 -14
  712. package/dist/simple-tree/getSimpleFieldSchema.d.ts.map +0 -1
  713. package/dist/simple-tree/getSimpleFieldSchema.js +0 -29
  714. package/dist/simple-tree/getSimpleFieldSchema.js.map +0 -1
  715. package/dist/simple-tree/walkSchema.d.ts.map +0 -1
  716. package/dist/simple-tree/walkSchema.js +0 -49
  717. package/dist/simple-tree/walkSchema.js.map +0 -1
  718. package/lib/feature-libraries/fieldGenerator.d.ts +0 -43
  719. package/lib/feature-libraries/fieldGenerator.d.ts.map +0 -1
  720. package/lib/feature-libraries/fieldGenerator.js +0 -12
  721. package/lib/feature-libraries/fieldGenerator.js.map +0 -1
  722. package/lib/feature-libraries/flex-map-tree/index.d.ts +0 -6
  723. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +0 -1
  724. package/lib/feature-libraries/flex-map-tree/index.js +0 -6
  725. package/lib/feature-libraries/flex-map-tree/index.js.map +0 -1
  726. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +0 -157
  727. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +0 -1
  728. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +0 -1
  729. package/lib/feature-libraries/storedToViewSchema.d.ts +0 -17
  730. package/lib/feature-libraries/storedToViewSchema.d.ts.map +0 -1
  731. package/lib/feature-libraries/storedToViewSchema.js +0 -62
  732. package/lib/feature-libraries/storedToViewSchema.js.map +0 -1
  733. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts +0 -58
  734. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +0 -1
  735. package/lib/feature-libraries/typed-schema/schemaCollection.js +0 -153
  736. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +0 -1
  737. package/lib/feature-libraries/typed-schema/typeUtils.d.ts +0 -15
  738. package/lib/feature-libraries/typed-schema/typeUtils.d.ts.map +0 -1
  739. package/lib/feature-libraries/typed-schema/typeUtils.js +0 -10
  740. package/lib/feature-libraries/typed-schema/typeUtils.js.map +0 -1
  741. package/lib/feature-libraries/typed-schema/view.d.ts.map +0 -1
  742. package/lib/feature-libraries/typed-schema/view.js.map +0 -1
  743. package/lib/simple-tree/getSimpleFieldSchema.d.ts +0 -14
  744. package/lib/simple-tree/getSimpleFieldSchema.d.ts.map +0 -1
  745. package/lib/simple-tree/getSimpleFieldSchema.js +0 -25
  746. package/lib/simple-tree/getSimpleFieldSchema.js.map +0 -1
  747. package/lib/simple-tree/walkSchema.d.ts.map +0 -1
  748. package/lib/simple-tree/walkSchema.js +0 -43
  749. package/lib/simple-tree/walkSchema.js.map +0 -1
  750. package/src/feature-libraries/fieldGenerator.ts +0 -47
  751. package/src/feature-libraries/flex-map-tree/index.ts +0 -14
  752. package/src/feature-libraries/storedToViewSchema.ts +0 -100
  753. package/src/feature-libraries/typed-schema/schemaCollection.ts +0 -254
  754. package/src/feature-libraries/typed-schema/typeUtils.ts +0 -29
  755. package/src/simple-tree/getSimpleFieldSchema.ts +0 -36
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.js","sourceRoot":"","sources":["../../../src/simple-tree/api/view.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kDAQ6B;AAC7B,kDAA2C;AAC3C,+DAI0C;AAE1C;;GAEG;AACH,MAAa,UA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QAAQ,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC;gBACrD,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;oBAClC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;oBAChC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBAC/B,CAAC;YACF,CAAC;YAED,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;QACvC,CAAC;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC;IAEO,SAAS,CAAC,QAA8B;QAC/C,sDAAsD;QACtD,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD;AA1HD,gCA0HC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tAdaptedViewSchema,\n\ttype Adapters,\n\tCompatibility,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n\ttype TreeStoredSchema,\n} from \"../../core/index.js\";\nimport { fail } from \"../../util/index.js\";\nimport {\n\ttype FullSchemaPolicy,\n\tallowsRepoSuperset,\n\tisNeverTree,\n} from \"../../feature-libraries/index.js\";\n\n/**\n * A collection of View information for schema, including policy.\n */\nexport class ViewSchema {\n\t/**\n\t * @param schema - Cached conversion of view schema in the stored schema format.\n\t */\n\tpublic constructor(\n\t\tpublic readonly policy: FullSchemaPolicy,\n\t\tpublic readonly adapters: Adapters,\n\t\tpublic readonly schema: TreeStoredSchema,\n\t) {}\n\n\t/**\n\t * Determines the compatibility of a stored document\n\t * (based on its stored schema) with a viewer (based on its view schema).\n\t *\n\t * Adapters can be provided to handle differences between the two schema.\n\t * Adapters should only use to types in the `view` SchemaRepository.\n\t *\n\t * TODO: this API violates the parse don't validate design philosophy.\n\t * It should be wrapped with (or replaced by) a parse style API.\n\t */\n\tpublic checkCompatibility(stored: TreeStoredSchema): {\n\t\tread: Compatibility;\n\t\twrite: Compatibility;\n\t\twriteAllowingStoredSchemaUpdates: Compatibility;\n\t} {\n\t\t// TODO: support adapters\n\t\t// const adapted = this.adaptRepo(stored);\n\n\t\tconst read = allowsRepoSuperset(this.policy, stored, this.schema)\n\t\t\t? Compatibility.Compatible\n\t\t\t: // TODO: support adapters\n\t\t\t\t// : allowsRepoSuperset(this.policy, adapted.adaptedForViewSchema, this.storedSchema)\n\t\t\t\t// ? Compatibility.RequiresAdapters\n\t\t\t\tCompatibility.Incompatible;\n\t\t// TODO: Extract subset of adapters that are valid to use on stored\n\t\t// TODO: separate adapters from schema updates\n\t\tconst write = allowsRepoSuperset(this.policy, this.schema, stored)\n\t\t\t? Compatibility.Compatible\n\t\t\t: // TODO: support adapters\n\t\t\t\t// : allowsRepoSuperset(this.policy, this.storedSchema, adapted.adaptedForViewSchema)\n\t\t\t\t// TODO: IThis assumes adapters are bidirectional.\n\t\t\t\t// Compatibility.RequiresAdapters\n\t\t\t\tCompatibility.Incompatible;\n\n\t\t// TODO: compute this properly (and maybe include the set of schema changes needed for it?).\n\t\t// Maybe updates would happen lazily when needed to store data?\n\t\t// When willingness to updates can avoid need for some adapters,\n\t\t// how should it be decided if the adapter should be used to avoid the update?\n\t\t// TODO: is this case actually bi-variant, making this correct if we did it for each schema independently?\n\t\tlet writeAllowingStoredSchemaUpdates =\n\t\t\t// TODO: This should consider just the updates needed\n\t\t\t// (ex: when view covers a subset of stored after stored has a update to that subset).\n\t\t\tallowsRepoSuperset(this.policy, stored, this.schema)\n\t\t\t\t? Compatibility.Compatible\n\t\t\t\t: // TODO: this assumes adapters can translate in both directions. In general this will not be true.\n\t\t\t\t\t// TODO: this also assumes that schema updates to the adapted repo would translate to\n\t\t\t\t\t// updates on the stored schema, which is also likely untrue.\n\t\t\t\t\t// // TODO: support adapters\n\t\t\t\t\t// allowsRepoSuperset(this.policy, adapted.adaptedForViewSchema, this.storedSchema)\n\t\t\t\t\t// ? Compatibility.RequiresAdapters // Requires schema updates. TODO: consider adapters that can update writes.\n\t\t\t\t\tCompatibility.Incompatible;\n\n\t\t// Since the above does not consider partial updates,\n\t\t// we can improve the tolerance a bit by considering the op-op update:\n\t\twriteAllowingStoredSchemaUpdates = Math.max(writeAllowingStoredSchemaUpdates, write);\n\n\t\treturn { read, write, writeAllowingStoredSchemaUpdates };\n\t}\n\n\t/**\n\t * Compute a schema that `original` could be viewed as using adapters as needed.\n\t *\n\t * TODO: have a way for callers to get invalidated on schema updates.\n\t */\n\tpublic adaptRepo(stored: TreeStoredSchema): AdaptedViewSchema {\n\t\t// Sanity check on adapters:\n\t\t// it's probably a bug if they use the never types,\n\t\t// since there never is a reason to have a never type as an adapter input,\n\t\t// and its impossible for an adapter to be correctly implemented if its output type is never\n\t\t// (unless its input is also never).\n\t\tfor (const adapter of this.adapters?.tree ?? []) {\n\t\t\tif (isNeverTree(this.policy, this.schema, this.schema.nodeSchema.get(adapter.output))) {\n\t\t\t\tfail(\"tree adapter for stored adapter.output should not be never\");\n\t\t\t}\n\t\t}\n\n\t\tconst adapted = {\n\t\t\trootFieldSchema: this.adaptField(stored.rootFieldSchema),\n\t\t\tnodeSchema: new Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>(),\n\t\t};\n\n\t\tfor (const [key, schema] of stored.nodeSchema) {\n\t\t\tconst adapatedTree = this.adaptTree(schema);\n\t\t\tadapted.nodeSchema.set(key, adapatedTree);\n\t\t}\n\n\t\t// TODO: subset these adapters to the ones that were needed/used.\n\t\treturn new AdaptedViewSchema(this.adapters, adapted);\n\t}\n\n\t/**\n\t * Adapt original such that it allows member types which can be adapted to its specified types.\n\t */\n\tprivate adaptField(original: TreeFieldStoredSchema): TreeFieldStoredSchema {\n\t\tif (original.types !== undefined) {\n\t\t\tconst types: Set<TreeNodeSchemaIdentifier> = new Set(original.types);\n\t\t\tfor (const treeAdapter of this.adapters?.tree ?? []) {\n\t\t\t\tif (types.has(treeAdapter.input)) {\n\t\t\t\t\ttypes.delete(treeAdapter.input);\n\t\t\t\t\ttypes.add(treeAdapter.output);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { kind: original.kind, types };\n\t\t}\n\t\treturn original;\n\t}\n\n\tprivate adaptTree(original: TreeNodeStoredSchema): TreeNodeStoredSchema {\n\t\t// TODO: support adapters like missing field adapters.\n\t\treturn original;\n\t}\n}\n"]}
@@ -2,10 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { type ImplicitAllowedTypes } from "../schemaTypes.js";
5
+ import { type ImplicitFieldSchema } from "../schemaTypes.js";
6
6
  import type { SimpleTreeSchema } from "./simpleSchema.js";
7
7
  /**
8
8
  * Converts a "view" schema to a "simple" schema representation.
9
9
  */
10
- export declare function toSimpleTreeSchema(schema: ImplicitAllowedTypes): SimpleTreeSchema;
10
+ export declare function toSimpleTreeSchema(schema: ImplicitFieldSchema): SimpleTreeSchema;
11
11
  //# sourceMappingURL=viewSchemaToSimpleSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"viewSchemaToSimpleSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/viewSchemaToSimpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAGN,KAAK,oBAAoB,EACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAOX,gBAAgB,EAChB,MAAM,mBAAmB,CAAC;AAM3B;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,oBAAoB,GAAG,gBAAgB,CAYjF"}
1
+ {"version":3,"file":"viewSchemaToSimpleSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/viewSchemaToSimpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAIN,KAAK,mBAAmB,EACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAOX,gBAAgB,EAChB,MAAM,mBAAmB,CAAC;AAM3B;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,GAAG,gBAAgB,CAoBhF"}
@@ -18,10 +18,16 @@ function toSimpleTreeSchema(schema) {
18
18
  const allowedTypes = allowedTypesFromFieldSchema(normalizedSchema);
19
19
  const definitions = new Map();
20
20
  populateSchemaDefinitionsForField(normalizedSchema, definitions);
21
- return {
21
+ const output = {
22
+ kind: normalizedSchema.kind,
22
23
  allowedTypes,
23
24
  definitions,
24
25
  };
26
+ // Include the "description" property only if it's present on the input.
27
+ if (normalizedSchema.metadata?.description !== undefined) {
28
+ output.description = normalizedSchema.metadata.description;
29
+ }
30
+ return output;
25
31
  }
26
32
  exports.toSimpleTreeSchema = toSimpleTreeSchema;
27
33
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"viewSchemaToSimpleSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/viewSchemaToSimpleSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA8E;AAC9E,sDAI2B;AAW3B,kDAAgE;AAChE,8DAAkF;AAClF,+CAAiE;AAEjE;;GAEG;AACH,SAAgB,kBAAkB,CAAC,MAA4B;IAC9D,MAAM,gBAAgB,GAAG,IAAA,qCAAoB,EAAC,MAAM,CAAC,CAAC;IAEtD,MAAM,YAAY,GAAG,2BAA2B,CAAC,gBAAgB,CAAC,CAAC;IAEnE,MAAM,WAAW,GAAG,IAAI,GAAG,EAA4B,CAAC;IACxD,iCAAiC,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;IAEjE,OAAO;QACN,YAAY;QACZ,WAAW;KACX,CAAC;AACH,CAAC;AAZD,gDAYC;AAED;;GAEG;AACH,MAAM,qBAAqB,GAAG,IAAI,OAAO,EAAoC,CAAC;AAE9E;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,MAAsB;IACjD,OAAO,IAAA,sBAAW,EAAC,qBAAqB,EAAE,MAAM,EAAE,GA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CAAC,CAAC;YAC9E,iCAAiC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YAC5D,MAAM;QACP,CAAC;QACD,KAAK,mBAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YACtB,IAAA,iBAAM,EAAC,IAAA,uCAAkB,EAAC,MAAM,CAAC,EAAE,KAAK,CAAC,4BAA4B,CAAC,CAAC;YACvE,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBACvC,iCAAiC,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;YACvD,CAAC;YACD,MAAM;QACP,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACT,IAAA,0BAAe,EAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\tnormalizeFieldSchema,\n\ttype FieldSchema,\n\ttype ImplicitAllowedTypes,\n} from \"../schemaTypes.js\";\nimport type {\n\tSimpleArrayNodeSchema,\n\tSimpleFieldSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleNodeSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleTreeSchema,\n} from \"./simpleSchema.js\";\nimport type { ValueSchema } from \"../../core/index.js\";\nimport { getOrCreate, type Mutable } from \"../../util/index.js\";\nimport { isObjectNodeSchema, type ObjectNodeSchema } from \"../objectNodeTypes.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\n\n/**\n * Converts a \"view\" schema to a \"simple\" schema representation.\n */\nexport function toSimpleTreeSchema(schema: ImplicitAllowedTypes): SimpleTreeSchema {\n\tconst normalizedSchema = normalizeFieldSchema(schema);\n\n\tconst allowedTypes = allowedTypesFromFieldSchema(normalizedSchema);\n\n\tconst definitions = new Map<string, SimpleNodeSchema>();\n\tpopulateSchemaDefinitionsForField(normalizedSchema, definitions);\n\n\treturn {\n\t\tallowedTypes,\n\t\tdefinitions,\n\t};\n}\n\n/**\n * Cache in which the results of {@link toSimpleNodeSchema} are saved.\n */\nconst simpleNodeSchemaCache = new WeakMap<TreeNodeSchema, SimpleNodeSchema>();\n\n/**\n * Creates a {@link SimpleNodeSchema} from a {@link TreeNodeSchema}.\n *\n * @remarks Caches the result on the input schema for future calls.\n */\nfunction toSimpleNodeSchema(schema: TreeNodeSchema): SimpleNodeSchema {\n\treturn getOrCreate(simpleNodeSchemaCache, schema, () => {\n\t\tconst kind = schema.kind;\n\t\tswitch (kind) {\n\t\t\tcase NodeKind.Leaf: {\n\t\t\t\treturn leafSchemaToSimpleSchema(schema);\n\t\t\t}\n\t\t\tcase NodeKind.Map: {\n\t\t\t\treturn mapSchemaToSimpleSchema(schema);\n\t\t\t}\n\t\t\tcase NodeKind.Array: {\n\t\t\t\treturn arraySchemaToSimpleSchema(schema);\n\t\t\t}\n\t\t\tcase NodeKind.Object: {\n\t\t\t\tassert(isObjectNodeSchema(schema), 0xa06 /* Expected object schema */);\n\t\t\t\treturn objectSchemaToSimpleSchema(schema);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(kind);\n\t\t\t}\n\t\t}\n\t});\n}\n\n// TODO: Use a stronger type for leaf schemas once one is available (see object schema handler for an example).\nfunction leafSchemaToSimpleSchema(schema: TreeNodeSchema): SimpleLeafNodeSchema {\n\treturn {\n\t\tkind: NodeKind.Leaf,\n\t\tleafKind: schema.info as ValueSchema,\n\t};\n}\n\n// TODO: Use a stronger type for array schemas once one is available (see object schema handler for an example).\nfunction arraySchemaToSimpleSchema(schema: TreeNodeSchema): SimpleArrayNodeSchema {\n\tconst fieldSchema = normalizeFieldSchema(schema.info as ImplicitAllowedTypes);\n\tconst allowedTypes = allowedTypesFromFieldSchema(fieldSchema);\n\treturn {\n\t\tkind: NodeKind.Array,\n\t\tallowedTypes,\n\t};\n}\n\n// TODO: Use a stronger type for map schemas once one is available (see object schema handler for an example).\nfunction mapSchemaToSimpleSchema(schema: TreeNodeSchema): SimpleMapNodeSchema {\n\tconst fieldSchema = normalizeFieldSchema(schema.info as ImplicitAllowedTypes);\n\tconst allowedTypes = allowedTypesFromFieldSchema(fieldSchema);\n\treturn {\n\t\tkind: NodeKind.Map,\n\t\tallowedTypes,\n\t};\n}\n\nfunction objectSchemaToSimpleSchema(schema: ObjectNodeSchema): SimpleObjectNodeSchema {\n\tconst fields: Record<string, SimpleFieldSchema> = {};\n\tfor (const [key, field] of schema.fields) {\n\t\tfields[key] = fieldSchemaToSimpleSchema(field);\n\t}\n\treturn {\n\t\tkind: NodeKind.Object,\n\t\tfields,\n\t};\n}\n\n/**\n * Private symbol under which the results of {@link toSimpleNodeSchema} are cached on an input {@link TreeNodeSchema}.\n */\nconst simpleFieldSchemaCacheSymbol = Symbol(\"simpleFieldSchemaCache\");\n\nfunction fieldSchemaToSimpleSchema(schema: FieldSchema): SimpleFieldSchema {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tif ((schema as any)[simpleFieldSchemaCacheSymbol] !== undefined) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\treturn (schema as any)[simpleFieldSchemaCacheSymbol] as SimpleFieldSchema;\n\t}\n\n\tconst allowedTypes = allowedTypesFromFieldSchema(schema);\n\tconst result: Mutable<SimpleFieldSchema> = {\n\t\tkind: schema.kind,\n\t\tallowedTypes,\n\t};\n\n\t// Don't include \"description\" property at all if it's not present.\n\tif (schema.metadata?.description !== undefined) {\n\t\tresult.description = schema.metadata.description;\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t(schema as any)[simpleFieldSchemaCacheSymbol] = result;\n\n\treturn result;\n}\n\nfunction allowedTypesFromFieldSchema(schema: FieldSchema): Set<string> {\n\tconst allowedTypes = new Set<string>();\n\tfor (const type of schema.allowedTypeSet) {\n\t\tallowedTypes.add(type.identifier);\n\t}\n\treturn allowedTypes;\n}\n\n/**\n * Recursively populates `definitions` by walking the input field schema tree.\n */\nfunction populateSchemaDefinitionsForField(\n\tschema: FieldSchema,\n\tdefinitions: Map<string, SimpleNodeSchema>,\n): void {\n\tfor (const child of schema.allowedTypeSet) {\n\t\tpopulateSchemaDefinitionsForNode(child, definitions);\n\t}\n}\n\n/**\n * Recursively populates `definitions` by walking the input node schema tree.\n */\nfunction populateSchemaDefinitionsForNode(\n\tschema: TreeNodeSchema,\n\tdefinitions: Map<string, SimpleNodeSchema>,\n): void {\n\tif (definitions.has(schema.identifier)) {\n\t\t// If the definition has already been populated, no need to recurse.\n\t\treturn;\n\t}\n\n\t// Populate definition for this schema\n\tdefinitions.set(schema.identifier, toSimpleNodeSchema(schema));\n\n\t// Recurse into children to populate definitions for them\n\tconst kind = schema.kind;\n\tswitch (kind) {\n\t\tcase NodeKind.Leaf: {\n\t\t\t// Leaf node, so no need to recurse\n\t\t\tbreak;\n\t\t}\n\t\tcase NodeKind.Map: {\n\t\t\t// TODO: Utilize a map schema type-guard once one exists (see object case for an example).\n\n\t\t\t// Recursively populate definitions for allowed map children\n\t\t\tconst fieldSchema = normalizeFieldSchema(schema.info as ImplicitAllowedTypes);\n\t\t\tpopulateSchemaDefinitionsForField(fieldSchema, definitions);\n\t\t\tbreak;\n\t\t}\n\t\tcase NodeKind.Array: {\n\t\t\t// TODO: Utilize an array schema type-guard once one exists (see object case for an example).\n\n\t\t\t// Recursively populate definitions for allowed map children\n\t\t\tconst fieldSchema = normalizeFieldSchema(schema.info as ImplicitAllowedTypes);\n\t\t\tpopulateSchemaDefinitionsForField(fieldSchema, definitions);\n\t\t\tbreak;\n\t\t}\n\t\tcase NodeKind.Object: {\n\t\t\tassert(isObjectNodeSchema(schema), 0xa07 /* Expected object schema */);\n\t\t\tfor (const [, field] of schema.fields) {\n\t\t\t\tpopulateSchemaDefinitionsForField(field, definitions);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(kind);\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"viewSchemaToSimpleSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/viewSchemaToSimpleSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA8E;AAC9E,sDAK2B;AAW3B,kDAAgE;AAChE,8DAAkF;AAClF,+CAAiE;AAEjE;;GAEG;AACH,SAAgB,kBAAkB,CAAC,MAA2B;IAC7D,MAAM,gBAAgB,GAAG,IAAA,qCAAoB,EAAC,MAAM,CAAC,CAAC;IAEtD,MAAM,YAAY,GAAG,2BAA2B,CAAC,gBAAgB,CAAC,CAAC;IAEnE,MAAM,WAAW,GAAG,IAAI,GAAG,EAA4B,CAAC;IACxD,iCAAiC,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;IAEjE,MAAM,MAAM,GAA8B;QACzC,IAAI,EAAE,gBAAgB,CAAC,IAAI;QAC3B,YAAY;QACZ,WAAW;KACX,CAAC;IAEF,wEAAwE;IACxE,IAAI,gBAAgB,CAAC,QAAQ,EAAE,WAAW,KAAK,SAAS,EAAE,CAAC;QAC1D,MAAM,CAAC,WAAW,GAAG,gBAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC;IAC5D,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AApBD,gDAoBC;AAED;;GAEG;AACH,MAAM,qBAAqB,GAAG,IAAI,OAAO,EAAoC,CAAC;AAE9E;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,MAAsB;IACjD,OAAO,IAAA,sBAAW,EAAC,qBAAqB,EAAE,MAAM,EAAE,GAAG,EAAE;QACtD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACzB,QAAQ,IAAI,EAAE,CAAC;YACd,KAAK,mBAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;gBACpB,OAAO,wBAAwB,CAAC,MAAM,CAAC,CAAC;YACzC,CAAC;YACD,KAAK,mBAAQ,CAAC,G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AAC,CAAC;YACvE,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBACvC,iCAAiC,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;YACvD,CAAC;YACD,MAAM;QACP,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACT,IAAA,0BAAe,EAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\tnormalizeFieldSchema,\n\ttype FieldSchema,\n\ttype ImplicitAllowedTypes,\n\ttype ImplicitFieldSchema,\n} from \"../schemaTypes.js\";\nimport type {\n\tSimpleArrayNodeSchema,\n\tSimpleFieldSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleNodeSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleTreeSchema,\n} from \"./simpleSchema.js\";\nimport type { ValueSchema } from \"../../core/index.js\";\nimport { getOrCreate, type Mutable } from \"../../util/index.js\";\nimport { isObjectNodeSchema, type ObjectNodeSchema } from \"../objectNodeTypes.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\n\n/**\n * Converts a \"view\" schema to a \"simple\" schema representation.\n */\nexport function toSimpleTreeSchema(schema: ImplicitFieldSchema): SimpleTreeSchema {\n\tconst normalizedSchema = normalizeFieldSchema(schema);\n\n\tconst allowedTypes = allowedTypesFromFieldSchema(normalizedSchema);\n\n\tconst definitions = new Map<string, SimpleNodeSchema>();\n\tpopulateSchemaDefinitionsForField(normalizedSchema, definitions);\n\n\tconst output: Mutable<SimpleTreeSchema> = {\n\t\tkind: normalizedSchema.kind,\n\t\tallowedTypes,\n\t\tdefinitions,\n\t};\n\n\t// Include the \"description\" property only if it's present on the input.\n\tif (normalizedSchema.metadata?.description !== undefined) {\n\t\toutput.description = normalizedSchema.metadata.description;\n\t}\n\n\treturn output;\n}\n\n/**\n * Cache in which the results of {@link toSimpleNodeSchema} are saved.\n */\nconst simpleNodeSchemaCache = new WeakMap<TreeNodeSchema, SimpleNodeSchema>();\n\n/**\n * Creates a {@link SimpleNodeSchema} from a {@link TreeNodeSchema}.\n *\n * @remarks Caches the result on the input schema for future calls.\n */\nfunction toSimpleNodeSchema(schema: TreeNodeSchema): SimpleNodeSchema {\n\treturn getOrCreate(simpleNodeSchemaCache, schema, () => {\n\t\tconst kind = schema.kind;\n\t\tswitch (kind) {\n\t\t\tcase NodeKind.Leaf: {\n\t\t\t\treturn leafSchemaToSimpleSchema(schema);\n\t\t\t}\n\t\t\tcase NodeKind.Map: {\n\t\t\t\treturn mapSchemaToSimpleSchema(schema);\n\t\t\t}\n\t\t\tcase NodeKind.Array: {\n\t\t\t\treturn arraySchemaToSimpleSchema(schema);\n\t\t\t}\n\t\t\tcase NodeKind.Object: {\n\t\t\t\tassert(isObjectNodeSchema(schema), 0xa06 /* Expected object schema */);\n\t\t\t\treturn objectSchemaToSimpleSchema(schema);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(kind);\n\t\t\t}\n\t\t}\n\t});\n}\n\n// TODO: Use a stronger type for leaf schemas once one is available (see object schema handler for an example).\nfunction leafSchemaToSimpleSchema(schema: TreeNodeSchema): SimpleLeafNodeSchema {\n\treturn {\n\t\tkind: NodeKind.Leaf,\n\t\tleafKind: schema.info as ValueSchema,\n\t};\n}\n\n// TODO: Use a stronger type for array schemas once one is available (see object schema handler for an example).\nfunction arraySchemaToSimpleSchema(schema: TreeNodeSchema): SimpleArrayNodeSchema {\n\tconst fieldSchema = normalizeFieldSchema(schema.info as ImplicitAllowedTypes);\n\tconst allowedTypes = allowedTypesFromFieldSchema(fieldSchema);\n\treturn {\n\t\tkind: NodeKind.Array,\n\t\tallowedTypes,\n\t};\n}\n\n// TODO: Use a stronger type for map schemas once one is available (see object schema handler for an example).\nfunction mapSchemaToSimpleSchema(schema: TreeNodeSchema): SimpleMapNodeSchema {\n\tconst fieldSchema = normalizeFieldSchema(schema.info as ImplicitAllowedTypes);\n\tconst allowedTypes = allowedTypesFromFieldSchema(fieldSchema);\n\treturn {\n\t\tkind: NodeKind.Map,\n\t\tallowedTypes,\n\t};\n}\n\nfunction objectSchemaToSimpleSchema(schema: ObjectNodeSchema): SimpleObjectNodeSchema {\n\tconst fields: Record<string, SimpleFieldSchema> = {};\n\tfor (const [key, field] of schema.fields) {\n\t\tfields[key] = fieldSchemaToSimpleSchema(field);\n\t}\n\treturn {\n\t\tkind: NodeKind.Object,\n\t\tfields,\n\t};\n}\n\n/**\n * Private symbol under which the results of {@link toSimpleNodeSchema} are cached on an input {@link TreeNodeSchema}.\n */\nconst simpleFieldSchemaCacheSymbol = Symbol(\"simpleFieldSchemaCache\");\n\nfunction fieldSchemaToSimpleSchema(schema: FieldSchema): SimpleFieldSchema {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tif ((schema as any)[simpleFieldSchemaCacheSymbol] !== undefined) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\treturn (schema as any)[simpleFieldSchemaCacheSymbol] as SimpleFieldSchema;\n\t}\n\n\tconst allowedTypes = allowedTypesFromFieldSchema(schema);\n\tconst result: Mutable<SimpleFieldSchema> = {\n\t\tkind: schema.kind,\n\t\tallowedTypes,\n\t};\n\n\t// Don't include \"description\" property at all if it's not present.\n\tif (schema.metadata?.description !== undefined) {\n\t\tresult.description = schema.metadata.description;\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t(schema as any)[simpleFieldSchemaCacheSymbol] = result;\n\n\treturn result;\n}\n\nfunction allowedTypesFromFieldSchema(schema: FieldSchema): Set<string> {\n\tconst allowedTypes = new Set<string>();\n\tfor (const type of schema.allowedTypeSet) {\n\t\tallowedTypes.add(type.identifier);\n\t}\n\treturn allowedTypes;\n}\n\n/**\n * Recursively populates `definitions` by walking the input field schema tree.\n */\nfunction populateSchemaDefinitionsForField(\n\tschema: FieldSchema,\n\tdefinitions: Map<string, SimpleNodeSchema>,\n): void {\n\tfor (const child of schema.allowedTypeSet) {\n\t\tpopulateSchemaDefinitionsForNode(child, definitions);\n\t}\n}\n\n/**\n * Recursively populates `definitions` by walking the input node schema tree.\n */\nfunction populateSchemaDefinitionsForNode(\n\tschema: TreeNodeSchema,\n\tdefinitions: Map<string, SimpleNodeSchema>,\n): void {\n\tif (definitions.has(schema.identifier)) {\n\t\t// If the definition has already been populated, no need to recurse.\n\t\treturn;\n\t}\n\n\t// Populate definition for this schema\n\tdefinitions.set(schema.identifier, toSimpleNodeSchema(schema));\n\n\t// Recurse into children to populate definitions for them\n\tconst kind = schema.kind;\n\tswitch (kind) {\n\t\tcase NodeKind.Leaf: {\n\t\t\t// Leaf node, so no need to recurse\n\t\t\tbreak;\n\t\t}\n\t\tcase NodeKind.Map: {\n\t\t\t// TODO: Utilize a map schema type-guard once one exists (see object case for an example).\n\n\t\t\t// Recursively populate definitions for allowed map children\n\t\t\tconst fieldSchema = normalizeFieldSchema(schema.info as ImplicitAllowedTypes);\n\t\t\tpopulateSchemaDefinitionsForField(fieldSchema, definitions);\n\t\t\tbreak;\n\t\t}\n\t\tcase NodeKind.Array: {\n\t\t\t// TODO: Utilize an array schema type-guard once one exists (see object case for an example).\n\n\t\t\t// Recursively populate definitions for allowed map children\n\t\t\tconst fieldSchema = normalizeFieldSchema(schema.info as ImplicitAllowedTypes);\n\t\t\tpopulateSchemaDefinitionsForField(fieldSchema, definitions);\n\t\t\tbreak;\n\t\t}\n\t\tcase NodeKind.Object: {\n\t\t\tassert(isObjectNodeSchema(schema), 0xa07 /* Expected object schema */);\n\t\t\tfor (const [, field] of schema.fields) {\n\t\t\t\tpopulateSchemaDefinitionsForField(field, definitions);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(kind);\n\t\t}\n\t}\n}\n"]}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { ImplicitAllowedTypes, InsertableTreeNodeFromImplicitAllowedTypes, TreeNodeFromImplicitAllowedTypes } from "./schemaTypes.js";
6
- import { type WithType, NodeKind, type TreeNode, type TreeNodeSchemaClass } from "./core/index.js";
5
+ import { type ImplicitAllowedTypes, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeNodeFromImplicitAllowedTypes } from "./schemaTypes.js";
6
+ import { type WithType, NodeKind, type TreeNode, type TreeNodeSchemaBoth } from "./core/index.js";
7
7
  /**
8
8
  * A generic array type, used to defined types like {@link (TreeArrayNode:interface)}.
9
9
  *
@@ -79,22 +79,88 @@ export interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends Readonl
79
79
  moveToEnd(sourceIndex: number, source: TMoveFrom): void;
80
80
  /**
81
81
  * Moves the specified item to the desired location in the array.
82
- * @param index - The index to move the item to.
83
- * This is based on the state of the array before moving the source item.
82
+ *
83
+ * WARNING - This API is easily misused.
84
+ * Please read the documentation for the `destinationGap` parameter carefully.
85
+ *
86
+ * @param destinationGap - The location *between* existing items that the moved item should be moved to.
87
+ *
88
+ * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.
89
+ *
90
+ * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:
91
+ *
92
+ * - `0` (between the start of the array and `A`'s original position)
93
+ * - `1` (between `A`'s original position and `B`'s original position)
94
+ * - `2` (between `B`'s original position and `C`'s original position)
95
+ * - `3` (between `C`'s original position and the end of the array)
96
+ *
97
+ * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.
98
+ *
99
+ * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,
100
+ * or relative to the start or end of the array:
101
+ *
102
+ * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)
103
+ * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`
104
+ * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)
105
+ * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)
106
+ *
107
+ * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:
108
+ *
109
+ * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`
110
+ * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`
111
+ *
112
+ * Notice the asymmetry between `-1` and `+2` in the above examples.
113
+ * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:
114
+ * If items A and B are adjacent, such that A precedes B,
115
+ * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.
116
+ *
84
117
  * @param sourceIndex - The index of the item to move.
85
118
  * @throws Throws if any of the input indices are not in the range [0, `array.length`).
86
119
  */
87
- moveToIndex(index: number, sourceIndex: number): void;
120
+ moveToIndex(destinationGap: number, sourceIndex: number): void;
88
121
  /**
89
122
  * Moves the specified item to the desired location in the array.
90
- * @param index - The index to move the item to in the range [0, `array.length`].
91
- * This is based on the state of the array before moving the source item.
123
+ *
124
+ * WARNING - This API is easily misused.
125
+ * Please read the documentation for the `destinationGap` parameter carefully.
126
+ *
127
+ * @param destinationGap - The location *between* existing items that the moved item should be moved to.
128
+ *
129
+ * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.
130
+ *
131
+ * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:
132
+ *
133
+ * - `0` (between the start of the array and `A`'s original position)
134
+ * - `1` (between `A`'s original position and `B`'s original position)
135
+ * - `2` (between `B`'s original position and `C`'s original position)
136
+ * - `3` (between `C`'s original position and the end of the array)
137
+ *
138
+ * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.
139
+ *
140
+ * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,
141
+ * or relative to the start or end of the array:
142
+ *
143
+ * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)
144
+ * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`
145
+ * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)
146
+ * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)
147
+ *
148
+ * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:
149
+ *
150
+ * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`
151
+ * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`
152
+ *
153
+ * Notice the asymmetry between `-1` and `+2` in the above examples.
154
+ * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:
155
+ * If items A and B are adjacent, such that A precedes B,
156
+ * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.
157
+ *
92
158
  * @param sourceIndex - The index of the item to move.
93
159
  * @param source - The source array to move the item out of.
94
160
  * @throws Throws if any of the source index is not in the range [0, `array.length`),
95
161
  * or if the index is not in the range [0, `array.length`].
96
162
  */
97
- moveToIndex(index: number, sourceIndex: number, source: TMoveFrom): void;
163
+ moveToIndex(destinationGap: number, sourceIndex: number, source: TMoveFrom): void;
98
164
  /**
99
165
  * Moves the specified items to the start of the array.
100
166
  * @param sourceStart - The starting index of the range to move (inclusive).
@@ -133,24 +199,91 @@ export interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends Readonl
133
199
  moveRangeToEnd(sourceStart: number, sourceEnd: number, source: TMoveFrom): void;
134
200
  /**
135
201
  * Moves the specified items to the desired location within the array.
136
- * @param index - The index to move the items to.
137
- * This is based on the state of the array before moving the source items.
202
+ *
203
+ * WARNING - This API is easily misused.
204
+ * Please read the documentation for the `destinationGap` parameter carefully.
205
+ *
206
+ * @param destinationGap - The location *between* existing items that the moved item should be moved to.
207
+ *
208
+ * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.
209
+ *
210
+ * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:
211
+ *
212
+ * - `0` (between the start of the array and `A`'s original position)
213
+ * - `1` (between `A`'s original position and `B`'s original position)
214
+ * - `2` (between `B`'s original position and `C`'s original position)
215
+ * - `3` (between `C`'s original position and the end of the array)
216
+ *
217
+ * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.
218
+ *
219
+ * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,
220
+ * or relative to the start or end of the array:
221
+ *
222
+ * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)
223
+ * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`
224
+ * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)
225
+ * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)
226
+ *
227
+ * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:
228
+ *
229
+ * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`
230
+ * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`
231
+ *
232
+ * Notice the asymmetry between `-1` and `+2` in the above examples.
233
+ * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:
234
+ * If items A and B are adjacent, such that A precedes B,
235
+ * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.
236
+ *
138
237
  * @param sourceStart - The starting index of the range to move (inclusive).
139
238
  * @param sourceEnd - The ending index of the range to move (exclusive)
140
239
  * @throws Throws if any of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.
141
240
  * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.
142
241
  */
143
- moveRangeToIndex(index: number, sourceStart: number, sourceEnd: number): void;
242
+ moveRangeToIndex(destinationGap: number, sourceStart: number, sourceEnd: number): void;
144
243
  /**
145
244
  * Moves the specified items to the desired location within the array.
146
- * @param index - The index to move the items to.
245
+ *
246
+ * WARNING - This API is easily misused.
247
+ * Please read the documentation for the `destinationGap` parameter carefully.
248
+ *
249
+ * @param destinationGap - The location *between* existing items that the moved item should be moved to.
250
+ *
251
+ * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.
252
+ *
253
+ * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:
254
+ *
255
+ * - `0` (between the start of the array and `A`'s original position)
256
+ * - `1` (between `A`'s original position and `B`'s original position)
257
+ * - `2` (between `B`'s original position and `C`'s original position)
258
+ * - `3` (between `C`'s original position and the end of the array)
259
+ *
260
+ * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.
261
+ *
262
+ * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,
263
+ * or relative to the start or end of the array:
264
+ *
265
+ * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)
266
+ * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`
267
+ * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)
268
+ * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)
269
+ *
270
+ * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:
271
+ *
272
+ * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`
273
+ * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`
274
+ *
275
+ * Notice the asymmetry between `-1` and `+2` in the above examples.
276
+ * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:
277
+ * If items A and B are adjacent, such that A precedes B,
278
+ * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.
279
+ *
147
280
  * @param sourceStart - The starting index of the range to move (inclusive).
148
281
  * @param sourceEnd - The ending index of the range to move (exclusive)
149
282
  * @param source - The source array to move items out of.
150
283
  * @throws Throws if the types of any of the items being moved are not allowed in the destination array,
151
284
  * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.
152
285
  */
153
- moveRangeToIndex(index: number, sourceStart: number, sourceEnd: number, source: TMoveFrom): void;
286
+ moveRangeToIndex(destinationGap: number, sourceStart: number, sourceEnd: number, source: TMoveFrom): void;
154
287
  /**
155
288
  * Returns a custom IterableIterator which throws usage errors if concurrent editing and iteration occurs.
156
289
  */
@@ -208,5 +341,5 @@ export declare function asIndex(key: string | symbol, exclusiveMax: number): num
208
341
  *
209
342
  * @param name - Unique identifier for this schema including the factory's scope.
210
343
  */
211
- export declare function arraySchema<TName extends string, const T extends ImplicitAllowedTypes, const ImplicitlyConstructable extends boolean>(identifier: TName, info: T, implicitlyConstructable: ImplicitlyConstructable, customizable: boolean): TreeNodeSchemaClass<TName, NodeKind.Array, TreeArrayNode<T> & WithType<TName, NodeKind.Array, unknown>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable, T>;
344
+ export declare function arraySchema<TName extends string, const T extends ImplicitAllowedTypes, const ImplicitlyConstructable extends boolean>(identifier: TName, info: T, implicitlyConstructable: ImplicitlyConstructable, customizable: boolean): TreeNodeSchemaBoth<TName, NodeKind.Array, TreeArrayNode<T> & WithType<TName, NodeKind.Array, unknown>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable, T>;
212
345
  //# sourceMappingURL=arrayNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"arrayNode.d.ts","sourceRoot":"","sources":["../../src/simple-tree/arrayNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuBH,OAAO,KAAK,EACX,oBAAoB,EACpB,0CAA0C,EAC1C,gCAAgC,EAChC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,KAAK,QAAQ,EAGb,QAAQ,EACR,KAAK,QAAQ,EAEb,KAAK,mBAAmB,EAGxB,MAAM,iBAAiB,CAAC;AAOzB;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAC9D,SAAQ,aAAa,CAAC,CAAC,CAAC,EACvB,QAAQ;IACT;;;;;OAKG;IACH,QAAQ,CAAC,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AAU,EAAE,KAAK,EACjB,IAAI,EAAE,CAAC,EACP,uBAAuB,EAAE,uBAAuB,EAChD,YAAY,EAAE,OAAO,+LA6GrB"}
@@ -17,12 +17,13 @@ const index_js_1 = require("../core/index.js");
17
17
  const index_js_2 = require("../feature-libraries/index.js");
18
18
  const proxies_js_1 = require("./proxies.js");
19
19
  const proxyBinding_js_1 = require("./proxyBinding.js");
20
+ const schemaTypes_js_1 = require("./schemaTypes.js");
20
21
  const index_js_3 = require("./core/index.js");
21
22
  const toMapTree_js_1 = require("./toMapTree.js");
22
23
  const index_js_4 = require("../util/index.js");
23
- const toFlexSchema_js_1 = require("./toFlexSchema.js");
24
24
  const index_js_5 = require("./core/index.js");
25
25
  const treeNodeValid_js_1 = require("./treeNodeValid.js");
26
+ const createContext_js_1 = require("./createContext.js");
26
27
  /**
27
28
  * A {@link TreeNode} which implements 'readonly T[]' and the array mutation APIs.
28
29
  * @public
@@ -185,7 +186,7 @@ function createArrayNodeProxy(allowAdditionalProperties, proxyTarget, dispatchTa
185
186
  }
186
187
  const maybeContent = field.at(maybeIndex);
187
188
  return (0, index_js_2.isFlexTreeNode)(maybeContent)
188
- ? (0, proxies_js_1.getOrCreateNodeFromFlexTreeNode)(maybeContent)
189
+ ? (0, index_js_3.getOrCreateNodeFromInnerNode)(maybeContent)
189
190
  : maybeContent;
190
191
  },
191
192
  set: (target, key, newValue, receiver) => {
@@ -237,7 +238,7 @@ function createArrayNodeProxy(allowAdditionalProperties, proxyTarget, dispatchTa
237
238
  // To satisfy 'deepEquals' level scrutiny, the property descriptor for indexed properties must
238
239
  // be a simple value property (as opposed to using getter) and declared writable/enumerable/configurable.
239
240
  return {
240
- value: (0, index_js_2.isFlexTreeNode)(val) ? (0, proxies_js_1.getOrCreateNodeFromFlexTreeNode)(val) : val,
241
+ value: (0, index_js_2.isFlexTreeNode)(val) ? (0, index_js_3.getOrCreateNodeFromInnerNode)(val) : val,
241
242
  writable: true, // For MVP, setting indexed properties is reported as allowed here (for deep equals compatibility noted above), but not actually supported.
242
243
  enumerable: true,
243
244
  configurable: true,
@@ -308,7 +309,7 @@ class CustomArrayNodeBase extends TreeNodeWithArrayFeatures {
308
309
  if (val === undefined) {
309
310
  return val;
310
311
  }
311
- return (0, proxies_js_1.getOrCreateNodeFromFlexTreeNode)(val);
312
+ return (0, index_js_3.getOrCreateNodeFromInnerNode)(val);
312
313
  }
313
314
  insertAt(index, ...value) {
314
315
  const field = getSequenceField(this);
@@ -352,13 +353,13 @@ class CustomArrayNodeBase extends TreeNodeWithArrayFeatures {
352
353
  validateIndex(sourceIndex, sourceField, "moveToEnd");
353
354
  this.moveRangeToIndex(this.length, sourceIndex, sourceIndex + 1, source);
354
355
  }
355
- moveToIndex(destinationIndex, sourceIndex, source) {
356
+ moveToIndex(destinationGap, sourceIndex, source) {
356
357
  const sourceArray = source ?? this;
357
358
  const sourceField = getSequenceField(sourceArray);
358
359
  const destinationField = getSequenceField(this);
359
- validateIndex(destinationIndex, destinationField, "moveToIndex", true);
360
+ validateIndex(destinationGap, destinationField, "moveToIndex", true);
360
361
  validateIndex(sourceIndex, sourceField, "moveToIndex");
361
- this.moveRangeToIndex(destinationIndex, sourceIndex, sourceIndex + 1, source);
362
+ this.moveRangeToIndex(destinationGap, sourceIndex, sourceIndex + 1, source);
362
363
  }
363
364
  moveRangeToStart(sourceStart, sourceEnd, source) {
364
365
  validateIndexRange(sourceStart, sourceEnd, source ?? getSequenceField(this), "moveRangeToStart");
@@ -368,30 +369,35 @@ class CustomArrayNodeBase extends TreeNodeWithArrayFeatures {
368
369
  validateIndexRange(sourceStart, sourceEnd, source ?? getSequenceField(this), "moveRangeToEnd");
369
370
  this.moveRangeToIndex(this.length, sourceStart, sourceEnd, source);
370
371
  }
371
- moveRangeToIndex(destinationIndex, sourceStart, sourceEnd, source) {
372
+ moveRangeToIndex(destinationGap, sourceStart, sourceEnd, source) {
372
373
  const destinationField = getSequenceField(this);
374
+ const destinationSchema = this.allowedTypes;
373
375
  const sourceField = source !== undefined ? getSequenceField(source) : destinationField;
374
- validateIndex(destinationIndex, destinationField, "moveRangeToIndex", true);
376
+ validateIndex(destinationGap, destinationField, "moveRangeToIndex", true);
375
377
  validateIndexRange(sourceStart, sourceEnd, source ?? destinationField, "moveRangeToIndex");
376
378
  // TODO: determine support for move across different sequence types
377
379
  if (sourceField !== destinationField) {
378
380
  for (let i = sourceStart; i < sourceEnd; i++) {
379
381
  const sourceNode = sourceField.boxedAt(i) ?? (0, internal_1.oob)();
380
- if (!destinationField.schema.types.has(sourceNode.schema)) {
382
+ const sourceSchema = (0, index_js_3.getSimpleNodeSchemaFromInnerNode)(sourceNode);
383
+ if (!destinationSchema.has(sourceSchema)) {
381
384
  throw new internal_2.UsageError("Type in source sequence is not allowed in destination.");
382
385
  }
383
386
  }
384
387
  }
385
388
  const movedCount = sourceEnd - sourceStart;
386
389
  if (!destinationField.context.isHydrated()) {
387
- if (!(0, index_js_2.isMapTreeSequenceField)(sourceField)) {
390
+ if (!(sourceField instanceof index_js_5.UnhydratedTreeSequenceField)) {
388
391
  throw new internal_2.UsageError("Cannot move elements from an unhydrated array to a hydrated array.");
389
392
  }
390
- if (sourceField !== destinationField || destinationIndex < sourceStart) {
391
- destinationField.editor.insert(destinationIndex, sourceField.editor.remove(sourceStart, movedCount));
393
+ if (sourceField.context.isHydrated()) {
394
+ throw new internal_2.UsageError("Cannot move elements from an unhydrated array to a hydrated array.");
395
+ }
396
+ if (sourceField !== destinationField || destinationGap < sourceStart) {
397
+ destinationField.editor.insert(destinationGap, sourceField.editor.remove(sourceStart, movedCount));
392
398
  }
393
- else if (destinationIndex > sourceStart + movedCount) {
394
- destinationField.editor.insert(destinationIndex - movedCount, sourceField.editor.remove(sourceStart, movedCount));
399
+ else if (destinationGap > sourceStart + movedCount) {
400
+ destinationField.editor.insert(destinationGap - movedCount, sourceField.editor.remove(sourceStart, movedCount));
395
401
  }
396
402
  }
397
403
  else {
@@ -401,7 +407,7 @@ class CustomArrayNodeBase extends TreeNodeWithArrayFeatures {
401
407
  if (sourceField.context !== destinationField.context) {
402
408
  throw new internal_2.UsageError("Cannot move elements between two different TreeViews.");
403
409
  }
404
- destinationField.context.checkout.editor.move(sourceField.getFieldPath(), sourceStart, movedCount, destinationField.getFieldPath(), destinationIndex);
410
+ destinationField.context.checkout.editor.move(sourceField.getFieldPath(), sourceStart, movedCount, destinationField.getFieldPath(), destinationGap);
405
411
  }
406
412
  }
407
413
  values() {
@@ -428,7 +434,7 @@ CustomArrayNodeBase.kind = index_js_3.NodeKind.Array;
428
434
  */
429
435
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
430
436
  function arraySchema(identifier, info, implicitlyConstructable, customizable) {
431
- let flexSchema;
437
+ const lazyChildTypes = new internal_1.Lazy(() => (0, schemaTypes_js_1.normalizeAllowedTypes)(info));
432
438
  let unhydratedContext;
433
439
  // This class returns a proxy from its constructor to handle numeric indexing.
434
440
  // Alternatively it could extend a normal class which gets tons of numeric properties added.
@@ -448,12 +454,11 @@ function arraySchema(identifier, info, implicitlyConstructable, customizable) {
448
454
  return createArrayNodeProxy(customizable, proxyTarget, instance);
449
455
  }
450
456
  static buildRawNode(instance, input) {
451
- return (0, index_js_2.getOrCreateMapTreeNode)(unhydratedContext, flexSchema, (0, toMapTree_js_1.mapTreeFromNodeData)(input, this));
457
+ return index_js_5.UnhydratedFlexTreeNode.getOrCreate(unhydratedContext, (0, toMapTree_js_1.mapTreeFromNodeData)(input, this));
452
458
  }
453
459
  static oneTimeSetup() {
454
460
  const schema = this;
455
- flexSchema = (0, toFlexSchema_js_1.getFlexSchema)(schema);
456
- unhydratedContext = new index_js_2.UnhydratedContext((0, toFlexSchema_js_1.toFlexSchema)(schema));
461
+ unhydratedContext = (0, createContext_js_1.getUnhydratedContext)(schema);
457
462
  // First run, do extra validation.
458
463
  // TODO: provide a way for TreeConfiguration to trigger this same validation to ensure it gets run early.
459
464
  // Scan for shadowing inherited members which won't work, but stop scan early to allow shadowing built in (which seems to work ok).
@@ -475,6 +480,10 @@ function arraySchema(identifier, info, implicitlyConstructable, customizable) {
475
480
  prototype = Reflect.getPrototypeOf(prototype);
476
481
  }
477
482
  }
483
+ return unhydratedContext;
484
+ }
485
+ static get childTypes() {
486
+ return lazyChildTypes.value;
478
487
  }
479
488
  // eslint-disable-next-line import/no-deprecated
480
489
  get [index_js_3.typeNameSymbol]() {
@@ -486,6 +495,9 @@ function arraySchema(identifier, info, implicitlyConstructable, customizable) {
486
495
  get simpleSchema() {
487
496
  return info;
488
497
  }
498
+ get allowedTypes() {
499
+ return lazyChildTypes.value;
500
+ }
489
501
  }
490
502
  Schema.constructorCached = undefined;
491
503
  Schema.identifier = identifier;