@fluidframework/tree 2.31.1 → 2.33.0-333010

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 (280) hide show
  1. package/.vscode/settings.json +1 -1
  2. package/CHANGELOG.md +44 -0
  3. package/api-extractor/api-extractor.current.json +5 -1
  4. package/api-report/tree.alpha.api.md +44 -20
  5. package/dist/alpha.d.ts +6 -2
  6. package/dist/feature-libraries/flex-tree/context.d.ts +6 -1
  7. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  8. package/dist/feature-libraries/flex-tree/context.js +5 -2
  9. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  10. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +8 -0
  11. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  12. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +8 -0
  13. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  14. package/dist/feature-libraries/flex-tree/index.d.ts +1 -1
  15. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  16. package/dist/feature-libraries/flex-tree/index.js +1 -2
  17. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  18. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +6 -15
  19. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  20. package/dist/feature-libraries/flex-tree/lazyEntity.js +9 -18
  21. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  22. package/dist/feature-libraries/flex-tree/lazyField.d.ts +3 -3
  23. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  24. package/dist/feature-libraries/flex-tree/lazyField.js +14 -14
  25. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  26. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +4 -4
  27. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  28. package/dist/feature-libraries/flex-tree/lazyNode.js +12 -12
  29. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  30. package/dist/feature-libraries/index.d.ts +1 -1
  31. package/dist/feature-libraries/index.d.ts.map +1 -1
  32. package/dist/feature-libraries/index.js +1 -2
  33. package/dist/feature-libraries/index.js.map +1 -1
  34. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -1
  35. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js +29 -25
  36. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
  37. package/dist/index.d.ts +2 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +5 -2
  40. package/dist/index.js.map +1 -1
  41. package/dist/packageVersion.d.ts +1 -1
  42. package/dist/packageVersion.d.ts.map +1 -1
  43. package/dist/packageVersion.js +1 -1
  44. package/dist/packageVersion.js.map +1 -1
  45. package/dist/shared-tree/checkoutFlexTreeView.d.ts +1 -0
  46. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  47. package/dist/shared-tree/checkoutFlexTreeView.js +4 -0
  48. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  49. package/dist/shared-tree/sharedTree.js +2 -2
  50. package/dist/shared-tree/sharedTree.js.map +1 -1
  51. package/dist/shared-tree/treeApiAlpha.d.ts +6 -6
  52. package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
  53. package/dist/shared-tree/treeApiAlpha.js.map +1 -1
  54. package/dist/shared-tree-core/sharedTreeCore.d.ts +0 -6
  55. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  56. package/dist/shared-tree-core/sharedTreeCore.js +0 -17
  57. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  58. package/dist/simple-tree/api/conciseTree.d.ts +2 -2
  59. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  60. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  61. package/dist/simple-tree/api/customTree.d.ts +14 -12
  62. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  63. package/dist/simple-tree/api/customTree.js.map +1 -1
  64. package/dist/simple-tree/api/getJsonSchema.d.ts +21 -7
  65. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  66. package/dist/simple-tree/api/getJsonSchema.js +8 -16
  67. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  68. package/dist/simple-tree/api/getSimpleSchema.d.ts +3 -10
  69. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  70. package/dist/simple-tree/api/getSimpleSchema.js +4 -16
  71. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  72. package/dist/simple-tree/api/index.d.ts +4 -3
  73. package/dist/simple-tree/api/index.d.ts.map +1 -1
  74. package/dist/simple-tree/api/index.js +2 -1
  75. package/dist/simple-tree/api/index.js.map +1 -1
  76. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +17 -1
  77. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  78. package/dist/simple-tree/api/schemaFactoryAlpha.js +4 -0
  79. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  80. package/dist/simple-tree/api/schemaFromSimple.d.ts +5 -2
  81. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  82. package/dist/simple-tree/api/schemaFromSimple.js +24 -8
  83. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  84. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +11 -3
  85. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  86. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +40 -28
  87. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  88. package/dist/simple-tree/api/tree.d.ts +32 -5
  89. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  90. package/dist/simple-tree/api/tree.js +17 -1
  91. package/dist/simple-tree/api/tree.js.map +1 -1
  92. package/dist/simple-tree/api/verboseTree.d.ts +4 -28
  93. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  94. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  95. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  96. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +7 -3
  97. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  98. package/dist/simple-tree/core/treeNodeKernel.d.ts +9 -2
  99. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  100. package/dist/simple-tree/core/treeNodeKernel.js +46 -30
  101. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  102. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +2 -1
  103. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  104. package/dist/simple-tree/core/unhydratedFlexTree.js +15 -1
  105. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  106. package/dist/simple-tree/index.d.ts +1 -1
  107. package/dist/simple-tree/index.d.ts.map +1 -1
  108. package/dist/simple-tree/index.js +3 -2
  109. package/dist/simple-tree/index.js.map +1 -1
  110. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  111. package/dist/simple-tree/objectNode.js +3 -0
  112. package/dist/simple-tree/objectNode.js.map +1 -1
  113. package/dist/simple-tree/simpleSchema.d.ts +4 -11
  114. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  115. package/dist/simple-tree/simpleSchema.js.map +1 -1
  116. package/dist/tableSchema.d.ts +241 -0
  117. package/dist/tableSchema.d.ts.map +1 -0
  118. package/dist/tableSchema.js +238 -0
  119. package/dist/tableSchema.js.map +1 -0
  120. package/dist/treeFactory.d.ts +4 -4
  121. package/dist/treeFactory.d.ts.map +1 -1
  122. package/dist/treeFactory.js.map +1 -1
  123. package/dist/util/breakable.d.ts.map +1 -1
  124. package/dist/util/breakable.js +9 -7
  125. package/dist/util/breakable.js.map +1 -1
  126. package/lib/alpha.d.ts +6 -2
  127. package/lib/feature-libraries/flex-tree/context.d.ts +6 -1
  128. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  129. package/lib/feature-libraries/flex-tree/context.js +6 -3
  130. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  131. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +8 -0
  132. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  133. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +8 -0
  134. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  135. package/lib/feature-libraries/flex-tree/index.d.ts +1 -1
  136. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  137. package/lib/feature-libraries/flex-tree/index.js +1 -1
  138. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  139. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +6 -15
  140. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  141. package/lib/feature-libraries/flex-tree/lazyEntity.js +8 -17
  142. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  143. package/lib/feature-libraries/flex-tree/lazyField.d.ts +3 -3
  144. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  145. package/lib/feature-libraries/flex-tree/lazyField.js +15 -15
  146. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  147. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +4 -4
  148. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  149. package/lib/feature-libraries/flex-tree/lazyNode.js +13 -13
  150. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  151. package/lib/feature-libraries/index.d.ts +1 -1
  152. package/lib/feature-libraries/index.d.ts.map +1 -1
  153. package/lib/feature-libraries/index.js +1 -1
  154. package/lib/feature-libraries/index.js.map +1 -1
  155. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -1
  156. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js +28 -24
  157. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -1
  158. package/lib/index.d.ts +2 -1
  159. package/lib/index.d.ts.map +1 -1
  160. package/lib/index.js +2 -1
  161. package/lib/index.js.map +1 -1
  162. package/lib/packageVersion.d.ts +1 -1
  163. package/lib/packageVersion.d.ts.map +1 -1
  164. package/lib/packageVersion.js +1 -1
  165. package/lib/packageVersion.js.map +1 -1
  166. package/lib/shared-tree/checkoutFlexTreeView.d.ts +1 -0
  167. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  168. package/lib/shared-tree/checkoutFlexTreeView.js +4 -0
  169. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  170. package/lib/shared-tree/sharedTree.js +2 -2
  171. package/lib/shared-tree/sharedTree.js.map +1 -1
  172. package/lib/shared-tree/treeApiAlpha.d.ts +6 -6
  173. package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
  174. package/lib/shared-tree/treeApiAlpha.js.map +1 -1
  175. package/lib/shared-tree-core/sharedTreeCore.d.ts +0 -6
  176. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  177. package/lib/shared-tree-core/sharedTreeCore.js +0 -17
  178. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  179. package/lib/simple-tree/api/conciseTree.d.ts +2 -2
  180. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  181. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  182. package/lib/simple-tree/api/customTree.d.ts +14 -12
  183. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  184. package/lib/simple-tree/api/customTree.js.map +1 -1
  185. package/lib/simple-tree/api/getJsonSchema.d.ts +21 -7
  186. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  187. package/lib/simple-tree/api/getJsonSchema.js +8 -16
  188. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  189. package/lib/simple-tree/api/getSimpleSchema.d.ts +3 -10
  190. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  191. package/lib/simple-tree/api/getSimpleSchema.js +4 -16
  192. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  193. package/lib/simple-tree/api/index.d.ts +4 -3
  194. package/lib/simple-tree/api/index.d.ts.map +1 -1
  195. package/lib/simple-tree/api/index.js +1 -1
  196. package/lib/simple-tree/api/index.js.map +1 -1
  197. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +17 -1
  198. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  199. package/lib/simple-tree/api/schemaFactoryAlpha.js +4 -0
  200. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  201. package/lib/simple-tree/api/schemaFromSimple.d.ts +5 -2
  202. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  203. package/lib/simple-tree/api/schemaFromSimple.js +24 -8
  204. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  205. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +11 -3
  206. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  207. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +41 -29
  208. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  209. package/lib/simple-tree/api/tree.d.ts +32 -5
  210. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  211. package/lib/simple-tree/api/tree.js +16 -1
  212. package/lib/simple-tree/api/tree.js.map +1 -1
  213. package/lib/simple-tree/api/verboseTree.d.ts +4 -28
  214. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  215. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  216. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  217. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +7 -3
  218. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  219. package/lib/simple-tree/core/treeNodeKernel.d.ts +9 -2
  220. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  221. package/lib/simple-tree/core/treeNodeKernel.js +48 -32
  222. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  223. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +2 -1
  224. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  225. package/lib/simple-tree/core/unhydratedFlexTree.js +15 -1
  226. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  227. package/lib/simple-tree/index.d.ts +1 -1
  228. package/lib/simple-tree/index.d.ts.map +1 -1
  229. package/lib/simple-tree/index.js +1 -1
  230. package/lib/simple-tree/index.js.map +1 -1
  231. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  232. package/lib/simple-tree/objectNode.js +4 -1
  233. package/lib/simple-tree/objectNode.js.map +1 -1
  234. package/lib/simple-tree/simpleSchema.d.ts +4 -11
  235. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  236. package/lib/simple-tree/simpleSchema.js.map +1 -1
  237. package/lib/tableSchema.d.ts +241 -0
  238. package/lib/tableSchema.d.ts.map +1 -0
  239. package/lib/tableSchema.js +235 -0
  240. package/lib/tableSchema.js.map +1 -0
  241. package/lib/treeFactory.d.ts +4 -4
  242. package/lib/treeFactory.d.ts.map +1 -1
  243. package/lib/treeFactory.js.map +1 -1
  244. package/lib/util/breakable.d.ts.map +1 -1
  245. package/lib/util/breakable.js +9 -7
  246. package/lib/util/breakable.js.map +1 -1
  247. package/package.json +23 -22
  248. package/src/feature-libraries/flex-tree/context.ts +13 -3
  249. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +8 -0
  250. package/src/feature-libraries/flex-tree/index.ts +0 -1
  251. package/src/feature-libraries/flex-tree/lazyEntity.ts +11 -21
  252. package/src/feature-libraries/flex-tree/lazyField.ts +17 -26
  253. package/src/feature-libraries/flex-tree/lazyNode.ts +13 -19
  254. package/src/feature-libraries/index.ts +0 -1
  255. package/src/feature-libraries/node-identifier/nodeIdentifierManager.ts +39 -38
  256. package/src/index.ts +6 -2
  257. package/src/packageVersion.ts +1 -1
  258. package/src/shared-tree/checkoutFlexTreeView.ts +6 -0
  259. package/src/shared-tree/sharedTree.ts +2 -2
  260. package/src/shared-tree/treeApiAlpha.ts +17 -15
  261. package/src/shared-tree-core/sharedTreeCore.ts +0 -23
  262. package/src/simple-tree/api/conciseTree.ts +4 -4
  263. package/src/simple-tree/api/customTree.ts +16 -14
  264. package/src/simple-tree/api/getJsonSchema.ts +25 -16
  265. package/src/simple-tree/api/getSimpleSchema.ts +4 -18
  266. package/src/simple-tree/api/index.ts +4 -2
  267. package/src/simple-tree/api/schemaFactoryAlpha.ts +18 -1
  268. package/src/simple-tree/api/schemaFromSimple.ts +45 -16
  269. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +53 -34
  270. package/src/simple-tree/api/tree.ts +51 -4
  271. package/src/simple-tree/api/verboseTree.ts +7 -32
  272. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +8 -3
  273. package/src/simple-tree/core/treeNodeKernel.ts +57 -35
  274. package/src/simple-tree/core/unhydratedFlexTree.ts +22 -5
  275. package/src/simple-tree/index.ts +4 -2
  276. package/src/simple-tree/objectNode.ts +4 -2
  277. package/src/simple-tree/simpleSchema.ts +4 -12
  278. package/src/tableSchema.ts +668 -0
  279. package/src/treeFactory.ts +4 -3
  280. package/src/util/breakable.ts +9 -6
@@ -7,7 +7,7 @@
7
7
  // "pruneFiles" is disabled because it causesd "source-map-support/register" to give `Unknown file extension ".ts"` errors.
8
8
  // "mochaExplorer.pruneFiles": true,
9
9
  "mochaExplorer.require": [
10
- "node_modules/@fluid-internal/mocha-test-setup",
10
+ "node_modules/@fluid-internal/mocha-test-setup/dist/index.js",
11
11
  "source-map-support/register",
12
12
  ],
13
13
  "mochaExplorer.configFile": ".mocharc.cjs",
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # @fluidframework/tree
2
2
 
3
+ ## 2.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Cleanup of several tree and schema alpha APIs for content import and export ([#24350](https://github.com/microsoft/FluidFramework/pull/24350)) [fe924a173b](https://github.com/microsoft/FluidFramework/commit/fe924a173b71abd96ba76da787eec3b4c077d32b)
8
+
9
+ A new `TreeSchema` type has been introduced which extends `SimpleTreeSchema` but contains `TreeNodeSchema` instead of `SimpleNodeSchema`.
10
+
11
+ `TreeViewConfigurationAlpha` is added which is just `TreeViewConfiguration` but implementing `TreeSchema`.
12
+
13
+ `SimpleTreeSchema` was modified to have a `root` property instead of implementing `SimpleFieldSchema` directly:
14
+ this makes it possible for `TreeViewConfigurationAlpha` to implement `TreeSchema` which extends `SimpleTreeSchema`.
15
+
16
+ `generateSchemaFromSimpleSchema` now returns the new `TreeSchema` type.
17
+
18
+ `EncodeOptions` and `ParseOptions` have been unified as `TreeEncodingOptions` which covers both the encoding and parsing cases.
19
+
20
+ `getJsonSchema` now takes in `ImplicitAllowedTypes` instead of `ImplicitFieldSchema` since it can't handle optional roots.
21
+ `getJsonSchema` also takes in the new `TreeSchemaEncodingOptions` to provide options for how to handle stored keys vs property keys, and fields with defaults.
22
+
23
+ Now that `getJsonSchema` takes in configuration options, its results are no longer cached.
24
+
25
+ - Provide alpha APIs for accessing tree content and stored schema without requiring a compatible view schema ([#24350](https://github.com/microsoft/FluidFramework/pull/24350)) [fe924a173b](https://github.com/microsoft/FluidFramework/commit/fe924a173b71abd96ba76da787eec3b4c077d32b)
26
+
27
+ Adds an `ITreeAlpha` interface (which `ITree` can be down-casted to) that provides access to both the tree content and the schema.
28
+ This allows inspecting the content saved in a SharedTree in a generic way that can work on any SharedTree.
29
+
30
+ This can be combined with the existing `generateSchemaFromSimpleSchema` to generate a schema that can be used with [`IIree.viewWith`](https://fluidframework.com/docs/api/fluid-framework/viewabletree-interface#viewwith-methodsignature) to allow constructing a [`TreeView`](https://fluidframework.com/docs/api/fluid-framework/treeview-interface) for any SharedTree, regardless of its schema.
31
+
32
+ Note that the resulting TypeScript typing for such a view will not be friendly: the `TreeView` APIs are designed for statically known schema. Using them is possible with care and a lot of type casts but not recommended if it can be avoided: see disclaimer on `generateSchemaFromSimpleSchema`.
33
+ Example using `ITreeAlpha` and `generateSchemaFromSimpleSchema`:
34
+
35
+ ```typescript
36
+ const viewAlpha = tree as ITreeAlpha;
37
+ const treeSchema = generateSchemaFromSimpleSchema(
38
+ viewAlpha.exportSimpleSchema(),
39
+ );
40
+ const config = new TreeViewConfiguration({ schema: treeSchema.root });
41
+ const view = viewAlpha.viewWith(config);
42
+ ```
43
+
44
+ `getSimpleSchema` is also added as an `@alpha` API to provide a way to clone schema into the simple schema formats.
45
+ Note that when using (or copying) a view schema as a simple schema, more metadata will be preserved than when deriving one from the stored schema using `ITreeAlpha`.
46
+
3
47
  ## 2.31.0
4
48
 
5
49
  ### Minor Changes
@@ -1,5 +1,9 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
3
  "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-report.esm.current.json",
4
- "mainEntryPointFilePath": "<projectFolder>/lib/alpha.d.ts"
4
+ "mainEntryPointFilePath": "<projectFolder>/lib/alpha.d.ts",
5
+ "apiReport": {
6
+ // The base config omits alpha. Explicitly opt into alpha reports (in addition to public/beta) for this package.
7
+ "reportVariants": ["public", "beta", "alpha"]
8
+ }
5
9
  }
@@ -112,11 +112,6 @@ export function createSimpleTreeIndex<TFieldSchema extends ImplicitFieldSchema,
112
112
  interface DefaultProvider extends ErasedType<"@fluidframework/tree.FieldProvider"> {
113
113
  }
114
114
 
115
- // @alpha
116
- export interface EncodeOptions {
117
- readonly useStoredKeys?: boolean;
118
- }
119
-
120
115
  // @alpha
121
116
  export function enumFromStrings<TScope extends string, const Members extends readonly string[]>(factory: SchemaFactory<TScope>, members: Members): (<TValue extends Members[number]>(value: TValue) => TValue extends unknown ? TreeNode & {
122
117
  readonly value: TValue;
@@ -246,7 +241,7 @@ export const ForestTypeOptimized: ForestType;
246
241
  export const ForestTypeReference: ForestType;
247
242
 
248
243
  // @alpha
249
- export function generateSchemaFromSimpleSchema(simple: SimpleTreeSchema): FieldSchemaAlpha;
244
+ export function generateSchemaFromSimpleSchema(simple: SimpleTreeSchema): TreeSchema;
250
245
 
251
246
  // @alpha @deprecated
252
247
  export function getBranch(tree: ITree): BranchableTree;
@@ -255,7 +250,10 @@ export function getBranch(tree: ITree): BranchableTree;
255
250
  export function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(view: TreeViewAlpha<T>): BranchableTree;
256
251
 
257
252
  // @alpha
258
- export function getJsonSchema(schema: ImplicitFieldSchema): JsonTreeSchema;
253
+ export function getJsonSchema(schema: ImplicitAllowedTypes, options: Required<TreeSchemaEncodingOptions>): JsonTreeSchema;
254
+
255
+ // @alpha
256
+ export function getSimpleSchema(schema: ImplicitFieldSchema): SimpleTreeSchema;
259
257
 
260
258
  // @alpha
261
259
  export type HandleConverter<TCustom> = (data: IFluidHandle) => TCustom;
@@ -410,6 +408,12 @@ export class IterableTreeArrayContent<T> implements Iterable<T> {
410
408
  export interface ITree extends ViewableTree, IFluidLoadable {
411
409
  }
412
410
 
411
+ // @alpha @sealed
412
+ export interface ITreeAlpha extends ITree {
413
+ exportSimpleSchema(): SimpleTreeSchema;
414
+ exportVerbose(): VerboseTree | undefined;
415
+ }
416
+
413
417
  // @public
414
418
  export interface ITreeConfigurationOptions {
415
419
  enableSchemaValidation?: boolean;
@@ -639,11 +643,6 @@ export const ObjectNodeSchema: {
639
643
  // @public @deprecated
640
644
  export type Off = Off_2;
641
645
 
642
- // @alpha
643
- export interface ParseOptions {
644
- readonly useStoredKeys?: boolean;
645
- }
646
-
647
646
  // @alpha
648
647
  export type PopUnion<Union, AsOverloadedFunction = UnionToIntersection<Union extends unknown ? (f: Union) => void : never>> = AsOverloadedFunction extends (a: infer First) => void ? First : never;
649
648
 
@@ -804,9 +803,12 @@ export class SchemaFactoryAlpha<out TScope extends string | undefined = string |
804
803
  arrayAlpha<const Name extends TName, const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
805
804
  arrayRecursive<const Name extends TName, const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): ArrayNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
806
805
  static readonly identifier: <const TCustomMetadata = unknown>(props?: Omit<FieldProps_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlpha_2<FieldKind_2.Identifier, LeafSchema_2<"string", string> & SimpleLeafNodeSchema_2, TCustomMetadata>;
806
+ static readonly leaves: readonly [LeafSchema_2<"string", string> & SimpleLeafNodeSchema_2, LeafSchema_2<"number", number> & SimpleLeafNodeSchema_2, LeafSchema_2<"boolean", boolean> & SimpleLeafNodeSchema_2, LeafSchema_2<"null", null> & SimpleLeafNodeSchema_2, LeafSchema_2<"handle", IFluidHandle<unknown>> & SimpleLeafNodeSchema_2];
807
807
  mapAlpha<Name extends TName, const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): MapNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
808
808
  mapRecursive<Name extends TName, const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): MapNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
809
- object<const Name extends TName, const T extends RestrictiveStringRecord<ImplicitFieldSchema>, const TCustomMetadata = unknown>(name: Name, fields: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): ObjectNodeSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
809
+ object<const Name extends TName, const T extends RestrictiveStringRecord<ImplicitFieldSchema>, const TCustomMetadata = unknown>(name: Name, fields: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): ObjectNodeSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> & {
810
+ readonly createFromInsertable: unknown;
811
+ };
810
812
  objectRecursive<const Name extends TName, const T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>, const TCustomMetadata = unknown>(name: Name, t: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecordUnsafe<T>, false, T, never, TCustomMetadata> & SimpleObjectNodeSchema<TCustomMetadata> & Pick<ObjectNodeSchema, "fields">;
811
813
  static readonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlpha_2<FieldKind_2.Optional, T, TCustomMetadata>;
812
814
  static readonly optionalRecursive: <const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2<FieldKind_2.Optional, T, TCustomMetadata>;
@@ -911,10 +913,9 @@ export interface SimpleObjectNodeSchema<out TCustomMetadata = unknown> extends S
911
913
  export type SimpleTreeIndex<TKey extends TreeIndexKey, TValue> = TreeIndex<TKey, TValue>;
912
914
 
913
915
  // @alpha @sealed
914
- export interface SimpleTreeSchema extends SimpleFieldSchema {
915
- readonly allowedTypesIdentifiers: ReadonlySet<string>;
916
+ export interface SimpleTreeSchema {
916
917
  readonly definitions: ReadonlyMap<string, SimpleNodeSchema>;
917
- readonly kind: FieldKind;
918
+ readonly root: SimpleFieldSchema;
918
919
  }
919
920
 
920
921
  // @alpha
@@ -962,10 +963,10 @@ export const TreeAlpha: {
962
963
  branch(node: TreeNode): TreeBranch | undefined;
963
964
  create<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(schema: UnsafeUnknownSchema extends TSchema ? ImplicitFieldSchema : TSchema & ImplicitFieldSchema, data: InsertableField<TSchema>): Unhydrated<TSchema extends ImplicitFieldSchema ? TreeFieldFromImplicitField<TSchema> : TreeNode | TreeLeafValue | undefined>;
964
965
  importConcise<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(schema: UnsafeUnknownSchema extends TSchema ? ImplicitFieldSchema : TSchema & ImplicitFieldSchema, data: ConciseTree | undefined): Unhydrated<TSchema extends ImplicitFieldSchema ? TreeFieldFromImplicitField<TSchema> : TreeNode | TreeLeafValue | undefined>;
965
- importVerbose<const TSchema extends ImplicitFieldSchema>(schema: TSchema, data: VerboseTree | undefined, options?: Partial<ParseOptions>): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
966
- exportConcise(node: TreeNode | TreeLeafValue, options?: EncodeOptions): ConciseTree;
967
- exportConcise(node: TreeNode | TreeLeafValue | undefined, options?: EncodeOptions): ConciseTree | undefined;
968
- exportVerbose(node: TreeNode | TreeLeafValue, options?: EncodeOptions): VerboseTree;
966
+ importVerbose<const TSchema extends ImplicitFieldSchema>(schema: TSchema, data: VerboseTree | undefined, options?: Partial<TreeEncodingOptions>): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
967
+ exportConcise(node: TreeNode | TreeLeafValue, options?: TreeEncodingOptions): ConciseTree;
968
+ exportConcise(node: TreeNode | TreeLeafValue | undefined, options?: TreeEncodingOptions): ConciseTree | undefined;
969
+ exportVerbose(node: TreeNode | TreeLeafValue, options?: TreeEncodingOptions): VerboseTree;
969
970
  exportCompressed(tree: TreeNode | TreeLeafValue, options: {
970
971
  oldestCompatibleClient: FluidClientVersion;
971
972
  idCompressor?: IIdCompressor;
@@ -1056,6 +1057,11 @@ export enum TreeCompressionStrategy {
1056
1057
  Uncompressed = 1
1057
1058
  }
1058
1059
 
1060
+ // @alpha
1061
+ export interface TreeEncodingOptions {
1062
+ readonly useStoredKeys?: boolean;
1063
+ }
1064
+
1059
1065
  // @public
1060
1066
  export type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypes<Types>, Kind> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypes<TSchema> : TreeNode | TreeLeafValue | undefined;
1061
1067
 
@@ -1167,6 +1173,17 @@ export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema
1167
1173
  // @public
1168
1174
  export type TreeObjectNodeUnsafe<T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecordUnsafe<T> & WithType<TypeName, NodeKind.Object, T>;
1169
1175
 
1176
+ // @alpha @sealed (undocumented)
1177
+ export interface TreeSchema extends SimpleTreeSchema {
1178
+ readonly definitions: ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;
1179
+ readonly root: FieldSchemaAlpha;
1180
+ }
1181
+
1182
+ // @alpha
1183
+ export interface TreeSchemaEncodingOptions extends TreeEncodingOptions {
1184
+ readonly requireFieldsWithDefaults?: boolean;
1185
+ }
1186
+
1170
1187
  // @public
1171
1188
  export enum TreeStatus {
1172
1189
  Deleted = 2,
@@ -1211,6 +1228,13 @@ export class TreeViewConfiguration<const TSchema extends ImplicitFieldSchema = I
1211
1228
  protected _typeCheck: MakeNominal;
1212
1229
  }
1213
1230
 
1231
+ // @alpha @sealed
1232
+ export class TreeViewConfigurationAlpha<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> extends TreeViewConfiguration<TSchema> implements TreeSchema {
1233
+ constructor(props: ITreeViewConfiguration<TSchema>);
1234
+ readonly definitions: ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;
1235
+ readonly root: FieldSchemaAlpha;
1236
+ }
1237
+
1214
1238
  // @public @sealed
1215
1239
  export interface TreeViewEvents {
1216
1240
  commitApplied(data: CommitMetadata, getRevertible?: RevertibleFactory): void;
package/dist/alpha.d.ts CHANGED
@@ -107,7 +107,6 @@ export {
107
107
  ArrayNodeSchema,
108
108
  BranchableTree,
109
109
  ConciseTree,
110
- EncodeOptions,
111
110
  FactoryContent,
112
111
  FactoryContentObject,
113
112
  FieldSchemaAlpha,
@@ -121,6 +120,7 @@ export {
121
120
  ForestTypeReference,
122
121
  HandleConverter,
123
122
  ICodecOptions,
123
+ ITreeAlpha,
124
124
  IdentifierIndex,
125
125
  Insertable,
126
126
  InsertableContent,
@@ -148,7 +148,6 @@ export {
148
148
  MapNodePojoEmulationSchema,
149
149
  MapNodeSchema,
150
150
  ObjectNodeSchema,
151
- ParseOptions,
152
151
  PopUnion,
153
152
  ReadSchema,
154
153
  ReadableField,
@@ -180,10 +179,14 @@ export {
180
179
  TreeBranchEvents,
181
180
  TreeBranchFork,
182
181
  TreeCompressionStrategy,
182
+ TreeEncodingOptions,
183
183
  TreeIndex,
184
184
  TreeIndexKey,
185
185
  TreeIndexNodes,
186
+ TreeSchema,
187
+ TreeSchemaEncodingOptions,
186
188
  TreeViewAlpha,
189
+ TreeViewConfigurationAlpha,
187
190
  UnionToTuple,
188
191
  UnsafeUnknownSchema,
189
192
  ValueSchema,
@@ -203,6 +206,7 @@ export {
203
206
  generateSchemaFromSimpleSchema,
204
207
  getBranch,
205
208
  getJsonSchema,
209
+ getSimpleSchema,
206
210
  independentInitializedView,
207
211
  independentView,
208
212
  noopValidator,
@@ -7,7 +7,7 @@ import type { Listenable } from "@fluidframework/core-interfaces";
7
7
  import { type IDisposable, disposeSymbol } from "../../util/index.js";
8
8
  import type { NodeIdentifierManager } from "../node-identifier/index.js";
9
9
  import type { FlexTreeField } from "./flexTreeTypes.js";
10
- import { type LazyEntity } from "./lazyEntity.js";
10
+ import type { LazyEntity } from "./lazyEntity.js";
11
11
  import type { ITreeCheckout } from "../../shared-tree/index.js";
12
12
  /**
13
13
  * Context for FlexTrees.
@@ -29,6 +29,10 @@ export interface FlexTreeContext {
29
29
  * If false, this context was created for use in a unhydrated tree, and the full document schema is unknown.
30
30
  */
31
31
  isHydrated(): this is FlexTreeHydratedContext;
32
+ /**
33
+ * If true, none of the nodes in this context can be used.
34
+ */
35
+ isDisposed(): boolean;
32
36
  }
33
37
  /**
34
38
  * A common context of a "forest" of FlexTrees.
@@ -71,6 +75,7 @@ export declare class Context implements FlexTreeHydratedContext, IDisposable {
71
75
  */
72
76
  constructor(schemaPolicy: SchemaPolicy, checkout: ITreeCheckout, nodeKeyManager: NodeIdentifierManager);
73
77
  isHydrated(): this is FlexTreeHydratedContext;
78
+ isDisposed(): boolean;
74
79
  get schema(): TreeStoredSchema;
75
80
  /**
76
81
  * Called before editing.
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EAGrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,KAAK,UAAU,EAAwB,MAAM,iBAAiB,CAAC;AAExE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,YAAY,E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,YAAY,EAAE,YAAY;aAC1B,QAAQ,EAAE,aAAa;aACvB,cAAc,EAAE,qBAAqB;IAdtD,SAAgB,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,CAAa;IACzD,SAAgB,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,CAAa;IAEzD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IACjD,OAAO,CAAC,QAAQ,CAAS;IAEzB;;;;OAIG;gBAEc,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,aAAa,EACvB,cAAc,EAAE,qBAAqB;IAe/C,UAAU,IAAI,IAAI,IAAI,uBAAuB;IAK7C,UAAU,IAAI,OAAO;IAI5B,IAAW,MAAM,IAAI,gBAAgB,CAEpC;IAED;;;OAGG;IACH,OAAO,CAAC,cAAc;IAQf,CAAC,aAAa,CAAC,IAAI,IAAI;IAa9B;;;;;OAKG;IACI,KAAK,IAAI,IAAI;IAQpB,IAAW,IAAI,IAAI,aAAa,CAO/B;IAED,IAAW,MAAM,IAAI,UAAU,CAAC,YAAY,CAAC,CAE5C;CACD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC7B,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,aAAa,EACvB,cAAc,EAAE,qBAAqB,GACnC,OAAO,CAET"}
@@ -8,7 +8,6 @@ exports.getTreeContext = exports.Context = exports.ContextSlot = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const index_js_1 = require("../../core/index.js");
10
10
  const index_js_2 = require("../../util/index.js");
11
- const lazyEntity_js_1 = require("./lazyEntity.js");
12
11
  const lazyField_js_1 = require("./lazyField.js");
13
12
  /**
14
13
  * Creating multiple flex tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.
@@ -42,8 +41,12 @@ class Context {
42
41
  this.checkout.forest.anchors.slots.set(exports.ContextSlot, this);
43
42
  }
44
43
  isHydrated() {
44
+ (0, internal_1.debugAssert)(() => !this.disposed || "Disposed");
45
45
  return true;
46
46
  }
47
+ isDisposed() {
48
+ return this.disposed;
49
+ }
47
50
  get schema() {
48
51
  return this.checkout.storedSchema;
49
52
  }
@@ -54,7 +57,7 @@ class Context {
54
57
  prepareForEdit() {
55
58
  (0, internal_1.assert)(this.disposed === false, 0x802 /* use after dispose */);
56
59
  for (const target of this.withCursors) {
57
- target[lazyEntity_js_1.prepareForEditSymbol]();
60
+ target.prepareForEdit();
58
61
  }
59
62
  (0, internal_1.assert)(this.withCursors.size === 0, 0x773 /* prepareForEdit should remove all cursors */);
60
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,kDAM6B;AAE7B,kDAAsE;AAItE,mDAAwE;AACxE,iDAA2C;AA8C3C;;;GAGG;AACU,QAAA,WAAW,GAAG,IAAA,qBAAU,GAAW,CAAC;AAEjD;;;;GAIG;AACH,MAAa,OAAO;IAOnB;;;;OAIG;IACH,YACiB,YAA0B,EAC1B,QAAuB,EACvB,cAAqC;QAFrC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,aAAQ,GAAR,QAAQ,CAAe;QACvB,mBAAc,GAAd,cAAc,CAAuB;QAdtC,gBAAW,GAAoB,IAAI,GAAG,EAAE,CAAC;QACzC,gBAAW,GAAoB,IAAI,GAAG,EAAE,CAAC;QAGjD,aAAQ,GAAG,KAAK,CAAC;QAYxB,IAAI,CAAC,eAAe,GAAG;YACtB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;gBACnD,IAAI,CAAC,cAAc,EAAE,CAAC;YACvB,CAAC,CAAC;SACF,CAAC;QAEF,IAAA,iBAAM,EACL,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,mBAAW,CAAC,EACpD,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,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACvC,MAAM,CAAC,wBAAa,CAAC,EAAE,CAAC;QACzB,CAAC;QACD,IAAA,iBAAM,EAAC,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAChF,IAAA,iBAAM,EAAC,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACjF,CAAC;IAED,IAAW,IAAI;QACd,IAAA,iBAAM,EAAC,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC3D,IAAA,8BAAmB,EAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAClD,MAAM,KAAK,GAAG,IAAA,wBAAS,EAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACxE,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,CAAC;CACD;AAzFD,0BAyFC;AAED;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAC7B,MAAoB,EACpB,QAAuB,EACvB,cAAqC;IAErC,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AACtD,CAAC;AAND,wCAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype ForestEvents,\n\ttype SchemaPolicy,\n\ttype TreeStoredSchema,\n\tanchorSlot,\n\tmoveToDetachedField,\n} from \"../../core/index.js\";\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport { type IDisposable, disposeSymbol } from \"../../util/index.js\";\nimport type { NodeIdentifierManager } from \"../node-identifier/index.js\";\n\nimport type { FlexTreeField } from \"./flexTreeTypes.js\";\nimport { type LazyEntity, prepareForEditSymbol } from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\nimport type { ITreeCheckout } from \"../../shared-tree/index.js\";\n\n/**\n * Context for FlexTrees.\n */\nexport interface FlexTreeContext {\n\t/**\n\t * Schema used within this context.\n\t * All data must conform to these schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\n\t/**\n\t * SchemaPolicy used within this context.\n\t */\n\treadonly schemaPolicy: SchemaPolicy;\n\n\t/**\n\t * If true, this context is the canonical context instance for a given view,\n\t * and its schema include all schema from the document.\n\t *\n\t * If false, this context was created for use in a unhydrated tree, and the full document schema is unknown.\n\t */\n\tisHydrated(): this is FlexTreeHydratedContext;\n}\n\n/**\n * A common context of a \"forest\" of FlexTrees.\n * It handles group operations like transforming cursors into anchors for edits.\n */\nexport interface FlexTreeHydratedContext extends FlexTreeContext {\n\treadonly events: Listenable<ForestEvents>;\n\t/**\n\t * Gets the root field of the tree.\n\t */\n\tget root(): FlexTreeField;\n\n\treadonly nodeKeyManager: NodeIdentifierManager;\n\n\t/**\n\t * The checkout object associated with this context.\n\t */\n\treadonly checkout: ITreeCheckout;\n}\n\n/**\n * Creating multiple flex tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.\n * This slot is used to detect if one already exists and error if creating a second.\n */\nexport const ContextSlot = anchorSlot<Context>();\n\n/**\n * Implementation of `FlexTreeContext`.\n *\n * @remarks An editor is required to edit the FlexTree.\n */\nexport class Context implements FlexTreeHydratedContext, IDisposable {\n\tpublic readonly withCursors: Set<LazyEntity> = new Set();\n\tpublic readonly withAnchors: Set<LazyEntity> = new Set();\n\n\tprivate readonly eventUnregister: (() => void)[];\n\tprivate disposed = false;\n\n\t/**\n\t * @param flexSchema - Schema to use when working with the tree.\n\t * @param checkout - The checkout.\n\t * @param nodeKeyManager - An object which handles node key generation and conversion\n\t */\n\tpublic constructor(\n\t\tpublic readonly schemaPolicy: SchemaPolicy,\n\t\tpublic readonly checkout: ITreeCheckout,\n\t\tpublic readonly nodeKeyManager: NodeIdentifierManager,\n\t) {\n\t\tthis.eventUnregister = [\n\t\t\tthis.checkout.forest.events.on(\"beforeChange\", () => {\n\t\t\t\tthis.prepareForEdit();\n\t\t\t}),\n\t\t];\n\n\t\tassert(\n\t\t\t!this.checkout.forest.anchors.slots.has(ContextSlot),\n\t\t\t0x92b /* Cannot create second flex-tree from checkout */,\n\t\t);\n\t\tthis.checkout.forest.anchors.slots.set(ContextSlot, this);\n\t}\n\n\tpublic isHydrated(): this is FlexTreeHydratedContext {\n\t\treturn true;\n\t}\n\n\tpublic get schema(): TreeStoredSchema {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\t/**\n\t * Called before editing.\n\t * Clears all cursors so editing can proceed.\n\t */\n\tprivate prepareForEdit(): void {\n\t\tassert(this.disposed === false, 0x802 /* use after dispose */);\n\t\tfor (const target of this.withCursors) {\n\t\t\ttarget[prepareForEditSymbol]();\n\t\t}\n\t\tassert(this.withCursors.size === 0, 0x773 /* prepareForEdit should remove all cursors */);\n\t}\n\n\tpublic [disposeSymbol](): void {\n\t\tassert(this.disposed === false, 0x803 /* double dispose */);\n\t\tthis.disposed = true;\n\t\tthis.clear();\n\t\tfor (const unregister of this.eventUnregister) {\n\t\t\tunregister();\n\t\t}\n\t\tthis.eventUnregister.length = 0;\n\n\t\tconst deleted = this.checkout.forest.anchors.slots.delete(ContextSlot);\n\t\tassert(deleted, 0x8c4 /* unexpected dispose */);\n\t}\n\n\t/**\n\t * Release any cursors and anchors held by tree entities created in this context.\n\t * Ensures the cashed references to those entities on the Anchors are also cleared.\n\t * The tree entities are invalid to use after this, but the context may still be used\n\t * to create new trees starting from the root.\n\t */\n\tpublic clear(): void {\n\t\tfor (const target of this.withAnchors) {\n\t\t\ttarget[disposeSymbol]();\n\t\t}\n\t\tassert(this.withCursors.size === 0, 0x774 /* free should remove all cursors */);\n\t\tassert(this.withAnchors.size === 0, 0x775 /* free should remove all anchors */);\n\t}\n\n\tpublic get root(): FlexTreeField {\n\t\tassert(this.disposed === false, 0x804 /* use after dispose */);\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"root\");\n\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\tconst field = makeField(this, this.schema.rootFieldSchema.kind, cursor);\n\t\tcursor.free();\n\t\treturn field;\n\t}\n\n\tpublic get events(): Listenable<ForestEvents> {\n\t\treturn this.checkout.forest.events;\n\t}\n}\n\n/**\n * A simple API for a Forest to interact with the tree.\n *\n * @param forest - the Forest\n * @param editor - an editor that makes changes to the forest.\n * @param nodeKeyManager - an object which handles node key generation and conversion.\n * @returns {@link FlexTreeContext} which is used to manage the cursors and anchors within the FlexTrees:\n * This is necessary for supporting using this tree across edits to the forest, and not leaking memory.\n */\nexport function getTreeContext(\n\tschema: SchemaPolicy,\n\tcheckout: ITreeCheckout,\n\tnodeKeyManager: NodeIdentifierManager,\n): Context {\n\treturn new Context(schema, checkout, nodeKeyManager);\n}\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/context.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA0E;AAE1E,kDAM6B;AAE7B,kDAAsE;AAKtE,iDAA2C;AAmD3C;;;GAGG;AACU,QAAA,WAAW,GAAG,IAAA,qBAAU,GAAW,CAAC;AAEjD;;;;GAIG;AACH,MAAa,OAAO;IAOnB;;;;OAIG;IACH,YACiB,YAA0B,EAC1B,QAAuB,EACvB,cAAqC;QAFrC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,aAAQ,GAAR,QAAQ,CAAe;QACvB,mBAAc,GAAd,cAAc,CAAuB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EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACxE,MAAM,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACd,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,CAAC;CACD;AA9FD,0BA8FC;AAED;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAC7B,MAAoB,EACpB,QAAuB,EACvB,cAAqC;IAErC,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AACtD,CAAC;AAND,wCAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, debugAssert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype ForestEvents,\n\ttype SchemaPolicy,\n\ttype TreeStoredSchema,\n\tanchorSlot,\n\tmoveToDetachedField,\n} from \"../../core/index.js\";\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport { type IDisposable, disposeSymbol } from \"../../util/index.js\";\nimport type { NodeIdentifierManager } from \"../node-identifier/index.js\";\n\nimport type { FlexTreeField } from \"./flexTreeTypes.js\";\nimport type { LazyEntity } from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\nimport type { ITreeCheckout } from \"../../shared-tree/index.js\";\n\n/**\n * Context for FlexTrees.\n */\nexport interface FlexTreeContext {\n\t/**\n\t * Schema used within this context.\n\t * All data must conform to these schema.\n\t */\n\treadonly schema: TreeStoredSchema;\n\n\t/**\n\t * SchemaPolicy used within this context.\n\t */\n\treadonly schemaPolicy: SchemaPolicy;\n\n\t/**\n\t * If true, this context is the canonical context instance for a given view,\n\t * and its schema include all schema from the document.\n\t *\n\t * If false, this context was created for use in a unhydrated tree, and the full document schema is unknown.\n\t */\n\tisHydrated(): this is FlexTreeHydratedContext;\n\n\t/**\n\t * If true, none of the nodes in this context can be used.\n\t */\n\tisDisposed(): boolean;\n}\n\n/**\n * A common context of a \"forest\" of FlexTrees.\n * It handles group operations like transforming cursors into anchors for edits.\n */\nexport interface FlexTreeHydratedContext extends FlexTreeContext {\n\treadonly events: Listenable<ForestEvents>;\n\t/**\n\t * Gets the root field of the tree.\n\t */\n\tget root(): FlexTreeField;\n\n\treadonly nodeKeyManager: NodeIdentifierManager;\n\n\t/**\n\t * The checkout object associated with this context.\n\t */\n\treadonly checkout: ITreeCheckout;\n}\n\n/**\n * Creating multiple flex tree contexts for the same branch, and thus with the same underlying AnchorSet does not work due to how TreeNode caching works.\n * This slot is used to detect if one already exists and error if creating a second.\n */\nexport const ContextSlot = anchorSlot<Context>();\n\n/**\n * Implementation of `FlexTreeContext`.\n *\n * @remarks An editor is required to edit the FlexTree.\n */\nexport class Context implements FlexTreeHydratedContext, IDisposable {\n\tpublic readonly withCursors: Set<LazyEntity> = new Set();\n\tpublic readonly withAnchors: Set<LazyEntity> = new Set();\n\n\tprivate readonly eventUnregister: (() => void)[];\n\tprivate disposed = false;\n\n\t/**\n\t * @param flexSchema - Schema to use when working with the tree.\n\t * @param checkout - The checkout.\n\t * @param nodeKeyManager - An object which handles node key generation and conversion\n\t */\n\tpublic constructor(\n\t\tpublic readonly schemaPolicy: SchemaPolicy,\n\t\tpublic readonly checkout: ITreeCheckout,\n\t\tpublic readonly nodeKeyManager: NodeIdentifierManager,\n\t) {\n\t\tthis.eventUnregister = [\n\t\t\tthis.checkout.forest.events.on(\"beforeChange\", () => {\n\t\t\t\tthis.prepareForEdit();\n\t\t\t}),\n\t\t];\n\n\t\tassert(\n\t\t\t!this.checkout.forest.anchors.slots.has(ContextSlot),\n\t\t\t0x92b /* Cannot create second flex-tree from checkout */,\n\t\t);\n\t\tthis.checkout.forest.anchors.slots.set(ContextSlot, this);\n\t}\n\n\tpublic isHydrated(): this is FlexTreeHydratedContext {\n\t\tdebugAssert(() => !this.disposed || \"Disposed\");\n\t\treturn true;\n\t}\n\n\tpublic isDisposed(): boolean {\n\t\treturn this.disposed;\n\t}\n\n\tpublic get schema(): TreeStoredSchema {\n\t\treturn this.checkout.storedSchema;\n\t}\n\n\t/**\n\t * Called before editing.\n\t * Clears all cursors so editing can proceed.\n\t */\n\tprivate prepareForEdit(): void {\n\t\tassert(this.disposed === false, 0x802 /* use after dispose */);\n\t\tfor (const target of this.withCursors) {\n\t\t\ttarget.prepareForEdit();\n\t\t}\n\t\tassert(this.withCursors.size === 0, 0x773 /* prepareForEdit should remove all cursors */);\n\t}\n\n\tpublic [disposeSymbol](): void {\n\t\tassert(this.disposed === false, 0x803 /* double dispose */);\n\t\tthis.disposed = true;\n\t\tthis.clear();\n\t\tfor (const unregister of this.eventUnregister) {\n\t\t\tunregister();\n\t\t}\n\t\tthis.eventUnregister.length = 0;\n\n\t\tconst deleted = this.checkout.forest.anchors.slots.delete(ContextSlot);\n\t\tassert(deleted, 0x8c4 /* unexpected dispose */);\n\t}\n\n\t/**\n\t * Release any cursors and anchors held by tree entities created in this context.\n\t * Ensures the cashed references to those entities on the Anchors are also cleared.\n\t * The tree entities are invalid to use after this, but the context may still be used\n\t * to create new trees starting from the root.\n\t */\n\tpublic clear(): void {\n\t\tfor (const target of this.withAnchors) {\n\t\t\ttarget[disposeSymbol]();\n\t\t}\n\t\tassert(this.withCursors.size === 0, 0x774 /* free should remove all cursors */);\n\t\tassert(this.withAnchors.size === 0, 0x775 /* free should remove all anchors */);\n\t}\n\n\tpublic get root(): FlexTreeField {\n\t\tassert(this.disposed === false, 0x804 /* use after dispose */);\n\t\tconst cursor = this.checkout.forest.allocateCursor(\"root\");\n\t\tmoveToDetachedField(this.checkout.forest, cursor);\n\t\tconst field = makeField(this, this.schema.rootFieldSchema.kind, cursor);\n\t\tcursor.free();\n\t\treturn field;\n\t}\n\n\tpublic get events(): Listenable<ForestEvents> {\n\t\treturn this.checkout.forest.events;\n\t}\n}\n\n/**\n * A simple API for a Forest to interact with the tree.\n *\n * @param forest - the Forest\n * @param editor - an editor that makes changes to the forest.\n * @param nodeKeyManager - an object which handles node key generation and conversion.\n * @returns {@link FlexTreeContext} which is used to manage the cursors and anchors within the FlexTrees:\n * This is necessary for supporting using this tree across edits to the forest, and not leaking memory.\n */\nexport function getTreeContext(\n\tschema: SchemaPolicy,\n\tcheckout: ITreeCheckout,\n\tnodeKeyManager: NodeIdentifierManager,\n): Context {\n\treturn new Context(schema, checkout, nodeKeyManager);\n}\n"]}
@@ -62,6 +62,14 @@ export declare enum TreeStatus {
62
62
  Removed = 1,
63
63
  /**
64
64
  * Is removed and cannot be added back to the original document tree.
65
+ * @remarks
66
+ * Nodes can enter this state for multiple reasons:
67
+ * - The node was removed and nothing (e.g. undo/redo history) kept it from being cleaned up.
68
+ * - The {@link TreeView} was disposed or had a schema change which made the tree incompatible.
69
+ * @privateRemarks
70
+ * There was planned work (AB#17948) to make the first reason a node could become "Deleted" impossible,
71
+ * at least as an opt in feature,
72
+ * by lifetime extending all nodes which are still possible to reach automatically.
65
73
  */
66
74
  Deleted = 2,
67
75
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"flexTreeTypes.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/flexTreeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EAEd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACX,UAAU,EACV,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,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] = "Removed";
46
46
  /**
47
47
  * Is removed and cannot be added back to the original document tree.
48
+ * @remarks
49
+ * Nodes can enter this state for multiple reasons:
50
+ * - The node was removed and nothing (e.g. undo/redo history) kept it from being cleaned up.
51
+ * - The {@link TreeView} was disposed or had a schema change which made the tree incompatible.
52
+ * @privateRemarks
53
+ * There was planned work (AB#17948) to make the first reason a node could become "Deleted" impossible,
54
+ * at least as an opt in feature,
55
+ * by lifetime extending all nodes which are still possible to reach automatically.
48
56
  */
49
57
  TreeStatus[TreeStatus["Deleted"] = 2] = "Deleted";
50
58
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"flexTreeTypes.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/flexTreeTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kDAU6B;AAW7B;;;GAGG;AACU,QAAA,YAAY,GAAG,IAAA,qBAAU,GAAgB,CAAC;AAEvD;;GAEG;AACU,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAEvD,SAAS,gBAAgB,CAAC,CAAU;IACnC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,sBAAc,IAAI,CAAC,CAAC;AACnE,CAAC;AAED,SAAgB,cAAc,CAAC,CAAU;IACxC,OAAO,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,sBAAc,CAAC,KAAK,kBAAkB,CAAC,IAAI,CAAC;AAC7E,CAAC;AAFD,wCAEC;AAED;GACG;AACH,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC7B,2DAAI,CAAA;IACJ,6DAAK,CAAA;AACN,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AA6BD;;;GAGG;AACH,IAAY,UAkCX;AAlCD,WAAY,UAAU;IACrB;;OAEG;IACH,uDAAc,CAAA;IAEd;;OAEG;IACH,iDAAW,CAAA;IAEX;;OAEG;IACH,iDAAW,CAAA;IAEX;;;;;;;;;;;;;;;;OAgBG;IACH,yCAAO,CAAA;AACR,CAAC,EAlCW,UAAU,0BAAV,UAAU,QAkCrB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype AnchorNode,\n\ttype ExclusiveMapTree,\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype ITreeCursorSynchronous,\n\ttype NormalizedFieldUpPath,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeValue,\n\tanchorSlot,\n} from \"../../core/index.js\";\nimport type {\n\tFieldKinds,\n\tSequenceFieldEditBuilder,\n\tValueFieldEditBuilder,\n\tOptionalFieldEditBuilder,\n} from \"../default-schema/index.js\";\nimport type { FlexFieldKind } from \"../modular-schema/index.js\";\n\nimport type { FlexTreeContext } from \"./context.js\";\n\n/**\n * An anchor slot which records the {@link FlexTreeNode} associated with that anchor, if there is one.\n * @remarks This always points to a \"real\" {@link FlexTreeNode} (i.e. a `LazyTreeNode`), never to a \"raw\" node.\n */\nexport const flexTreeSlot = anchorSlot<FlexTreeNode>();\n\n/**\n * Indicates that an object is a flex tree.\n */\nexport const flexTreeMarker = Symbol(\"flexTreeMarker\");\n\nfunction isFlexTreeEntity(t: unknown): t is FlexTreeEntity {\n\treturn typeof t === \"object\" && t !== null && flexTreeMarker in t;\n}\n\nexport function isFlexTreeNode(t: unknown): t is FlexTreeNode {\n\treturn isFlexTreeEntity(t) && t[flexTreeMarker] === FlexTreeEntityKind.Node;\n}\n\n/**\n */\nexport enum FlexTreeEntityKind {\n\tNode,\n\tField,\n}\n\n/**\n * Part of a tree.\n * Iterates over children.\n *\n * @privateRemarks\n * This exists mainly as a place to share common members between nodes and fields.\n * It is not expected to be useful or common to write code which handles this type directly.\n * If this assumption turns out to be false, and generically processing `UntypedEntity`s is useful,\n * then this interface should probably be extended with some down casting functionality (like `is`).\n *\n * TODO:\n * Design and document iterator invalidation rules and ordering rules.\n * Providing a custom iterator type with place anchor semantics would be a good approach.\n */\nexport interface FlexTreeEntity {\n\t/**\n\t * Indicates that an object is a specific kind of flex tree FlexTreeEntity.\n\t * This makes it possible to both down cast FlexTreeEntities safely as well as validate if an object is or is not a FlexTreeEntity.\n\t */\n\treadonly [flexTreeMarker]: FlexTreeEntityKind;\n\n\t/**\n\t * A common context of FlexTrees.\n\t */\n\treadonly context: FlexTreeContext;\n}\n\n/**\n * Status of the tree that a particular node belongs to.\n * @public\n */\nexport enum TreeStatus {\n\t/**\n\t * Is parented under the root field.\n\t */\n\tInDocument = 0,\n\n\t/**\n\t * Is not parented under the root field, but can be added back to the original document tree.\n\t */\n\tRemoved = 1,\n\n\t/**\n\t * Is removed and cannot be added back to the original document tree.\n\t */\n\tDeleted = 2,\n\n\t/**\n\t * Is created but has not yet been inserted into the tree.\n\t * @remarks\n\t * See also {@link Unhydrated}.\n\t *\n\t * Nodes in the new state have some limitations:\n\t *\n\t * - Events are not currently triggered for changes. Fixes for this are planned.\n\t *\n\t * - Reading identifiers from nodes which were left unspecified (defaulted) when creating the tree will error.\n\t * This is because allocating unique identifiers in a compressible manner requires knowing which tree the nodes will be inserted into.\n\t *\n\t * - Transactions do not work: transactions apply to a single {@link TreeView}, and `New` nodes are not part of one.\n\t *\n\t * - `Tree.shortId` (when the identifier was explicitly specified and thus works at all) will just return the full identifier as a string,\n\t * but might return a compressed form as a number once hydrated.\n\t */\n\tNew = 3,\n}\n\n/**\n * Generic tree node API.\n *\n * Nodes are (shallowly) immutable and have a logical identity, a type and either a value or fields under string keys.\n *\n * This \"logical identity\" is exposed as the object identity: if a node is moved within a document,\n * the same {@link FlexTreeNode} instance will be used in the new location.\n * Similarly, edits applied to a node's sub-tree concurrently with the move of the node will still be applied to its subtree in its new location.\n *\n * @remarks\n * All editing is actually done via {@link FlexTreeField}s: the nodes are immutable other than that they contain mutable fields.\n */\nexport interface FlexTreeNode extends FlexTreeEntity {\n\treadonly [flexTreeMarker]: FlexTreeEntityKind.Node;\n\n\t/**\n\t * Value stored on this node.\n\t */\n\treadonly value?: TreeValue;\n\n\t/**\n\t * Gets a field of this node, if it is not empty.\n\t */\n\ttryGetField(key: FieldKey): undefined | FlexTreeField;\n\n\t/**\n\t * Get the field for `key`.\n\t * @param key - which entry to look up.\n\t *\n\t * @remarks\n\t * All fields implicitly exist, so `getBoxed` can be called with any key and will always return a field.\n\t * Even if the field is empty, it will still be returned, and can be edited to insert content if allowed by the field kind.\n\t * See {@link FlexTreeNode.tryGetField} for a variant that does not allocate afield in the empty case.\n\t */\n\tgetBoxed(key: FieldKey): FlexTreeField;\n\n\t/**\n\t * The field this tree is in, and the index within that field.\n\t */\n\treadonly parentField: { readonly parent: FlexTreeField; readonly index: number };\n\n\tboxedIterator(): IterableIterator<FlexTreeField>;\n\n\t/**\n\t * The anchor node associated with this node\n\t *\n\t * @remarks\n\t * The ref count keeping this alive is owned by the FlexTreeNode:\n\t * if holding onto this anchor for longer than the FlexTreeNode might be alive,\n\t * a separate Anchor (and thus ref count) must be allocated to keep it alive.\n\t */\n\treadonly anchorNode: AnchorNode;\n\n\t/**\n\t * Returns an iterable of keys for non-empty fields.\n\t *\n\t * @remarks\n\t * All fields under a map implicitly exist, but `keys` will yield only the keys of fields which contain one or more nodes.\n\t *\n\t * No guarantees are made regarding the order of the keys returned.\n\t */\n\tkeys(): IterableIterator<FieldKey>;\n\n\t/**\n\t * Schema for this entity.\n\t * If well-formed, it must follow this schema.\n\t */\n\treadonly schema: TreeNodeSchemaIdentifier;\n\n\t/**\n\t * Get a cursor for the underlying data.\n\t * @remarks\n\t * This cursor might be one the node uses in its implementation, and thus must be returned to its original location before using any other APIs to interact with the tree.\n\t * Must not be held onto across edits or any other tree API use.\n\t */\n\tborrowCursor(): ITreeCursorSynchronous;\n}\n\n/**\n * A collaboratively editable collection of nodes within a {@link FlexTreeEntity}.\n *\n * Fields are inherently part of their parent, and thus cannot be moved.\n * Instead their content can be moved, deleted or created.\n *\n * Editing operations are only valid on trees with the {@link TreeStatus#InDocument} `TreeStatus`.\n *\n * @remarks\n * Fields are used wherever an editable collection of nodes is required.\n * This is required in two places:\n * 1. To hold the children of non-leaf {@link FlexTreeNode}s.\n * 2. As the root of a {@link FlexTreeEntity}.\n *\n * Down-casting (via {@link FlexTreeField.is}) is required to access Schema-Aware APIs, including editing.\n * All content in the tree is accessible without down-casting, but if the schema is known,\n * the schema aware API may be more ergonomic.\n */\nexport interface FlexTreeField extends FlexTreeEntity {\n\treadonly [flexTreeMarker]: FlexTreeEntityKind.Field;\n\n\t/**\n\t * The number of nodes in this field\n\t */\n\treadonly length: number;\n\n\t/**\n\t * The `FieldKey` this field is under.\n\t * Defines what part of its parent this field makes up.\n\t */\n\treadonly key: FieldKey;\n\n\t/**\n\t * The node which has this field on it under `fieldKey`.\n\t * `undefined` iff this field is a detached field.\n\t */\n\treadonly parent?: FlexTreeNode;\n\n\t/**\n\t * Type guard for narrowing / down-casting to a specific schema.\n\t */\n\tis<TKind extends FlexFieldKind>(kind: TKind): this is FlexTreeTypedField<TKind>;\n\n\tboxedIterator(): IterableIterator<FlexTreeNode>;\n\n\t/**\n\t * Gets a node of this field by its index without unboxing.\n\t * @param index - Zero-based index of the item to retrieve. Negative values are interpreted from the end of the sequence.\n\t *\n\t * @returns The element in the sequence matching the given index. Always returns undefined if index \\< -sequence.length\n\t * or index \\>= sequence.length.\n\t *\n\t * @remarks\n\t * Semantics match {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at}.\n\t */\n\tboxedAt(index: number): FlexTreeNode | undefined;\n\n\t/**\n\t * Gets the FieldUpPath of a field.\n\t */\n\tgetFieldPath(): NormalizedFieldUpPath;\n\n\t/**\n\t * Schema for this entity.\n\t * If well-formed, it must follow this schema.\n\t */\n\treadonly schema: FieldKindIdentifier;\n}\n\n// #region Field Kinds\n\n/**\n * Typed tree for inserting as the content of a field.\n */\nexport type FlexibleFieldContent = ExclusiveMapTree[];\n\n/**\n * Tree for inserting as a node.\n */\nexport type FlexibleNodeContent = ExclusiveMapTree;\n\n/**\n * {@link FlexTreeField} that stores a sequence of children.\n *\n * Sequence fields can contain an ordered sequence any number of {@link FlexTreeNode}s which must be of the {@link FlexAllowedTypes} from the {@link FlexFieldSchema}).\n *\n * @remarks\n * Allows for concurrent editing based on index, adjusting the locations of indexes as needed so they apply to the same logical place in the sequence when rebased and merged.\n *\n * Edits to sequence fields are anchored relative to their surroundings, so concurrent edits can result in the indexes of nodes and edits getting shifted.\n * To hold onto locations in sequence across an edit, use anchors.\n *\n * @privateRemarks\n * TODO:\n * Add anchor API that can actually hold onto locations in a sequence.\n * Currently only nodes can be held onto with anchors, and this does not replicate the behavior implemented for editing.\n */\nexport interface FlexTreeSequenceField extends FlexTreeField {\n\t/**\n\t * Gets a node of this field by its index with unboxing.\n\t * @param index - Zero-based index of the item to retrieve. Negative values are interpreted from the end of the sequence.\n\t *\n\t * @returns The element in the sequence matching the given index. Always returns undefined if index \\< -sequence.length\n\t * or index \\>= array.length.\n\t *\n\t * @remarks\n\t * Semantics match {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at}.\n\t */\n\tat(index: number): FlexTreeUnknownUnboxed | undefined;\n\n\t/**\n\t * {@inheritdoc FlexTreeField.boxedAt}\n\t */\n\tboxedAt(index: number): FlexTreeNode | undefined;\n\n\t/**\n\t * Calls the provided callback function on each child of this sequence, and returns an array that contains the results.\n\t * @param callbackfn - A function that accepts the child and its index.\n\t */\n\tmap<U>(callbackfn: (value: FlexTreeUnknownUnboxed, index: number) => U): U[];\n\n\t/**\n\t * Get an editor for this sequence.\n\t */\n\treadonly editor: SequenceFieldEditBuilder<FlexibleFieldContent>;\n\n\tboxedIterator(): IterableIterator<FlexTreeNode>;\n}\n\n/**\n * Field that stores exactly one child.\n *\n * @remarks\n * Unboxes its content, so in schema aware APIs which do unboxing, the RequiredField itself will be skipped over and its content will be returned directly.\n */\nexport interface FlexTreeRequiredField extends FlexTreeField {\n\tget content(): FlexTreeUnknownUnboxed;\n\n\treadonly editor: ValueFieldEditBuilder<FlexibleNodeContent>;\n}\n\n/**\n * Field that stores zero or one child.\n *\n * @remarks\n * Unboxes its content, so in schema aware APIs which do unboxing, the OptionalField itself will be skipped over and its content will be returned directly.\n *\n * @privateRemarks\n * TODO: Document merge semitics\n * TODO: Allow Optional fields to be used with last write wins OR first write wins merge resolution.\n * TODO:\n * Better centralize the documentation about what kinds of merge semantics are available for field kinds.\n * Maybe link editor?\n */\nexport interface FlexTreeOptionalField extends FlexTreeField {\n\tget content(): FlexTreeUnknownUnboxed | undefined;\n\n\treadonly editor: OptionalFieldEditBuilder<FlexibleNodeContent>;\n}\n\n// #endregion\n\n// #region Typed\n\n/**\n * Schema aware specialization of {@link FlexTreeField}.\n */\nexport type FlexTreeTypedField<Kind extends FlexFieldKind> =\n\tKind extends typeof FieldKinds.sequence\n\t\t? FlexTreeSequenceField\n\t\t: Kind extends typeof FieldKinds.required\n\t\t\t? FlexTreeRequiredField\n\t\t\t: Kind extends typeof FieldKinds.optional\n\t\t\t\t? FlexTreeOptionalField\n\t\t\t\t: FlexTreeField;\n\n// #endregion\n\n/**\n * Unboxed tree type for unknown schema cases.\n */\nexport type FlexTreeUnknownUnboxed = TreeValue | FlexTreeNode;\n"]}
1
+ {"version":3,"file":"flexTreeTypes.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/flexTreeTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kDAU6B;AAW7B;;;GAGG;AACU,QAAA,YAAY,GAAG,IAAA,qBAAU,GAAgB,CAAC;AAEvD;;GAEG;AACU,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAEvD,SAAS,gBAAgB,CAAC,CAAU;IACnC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,sBAAc,IAAI,CAAC,CAAC;AACnE,CAAC;AAED,SAAgB,cAAc,CAAC,CAAU;IACxC,OAAO,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,sBAAc,CAAC,KAAK,kBAAkB,CAAC,IAAI,CAAC;AAC7E,CAAC;AAFD,wCAEC;AAED;GACG;AACH,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC7B,2DAAI,CAAA;IACJ,6DAAK,CAAA;AACN,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AA6BD;;;GAGG;AACH,IAAY,UA0CX;AA1CD,WAAY,UAAU;IACrB;;OAEG;IACH,uDAAc,CAAA;IAEd;;OAEG;IACH,iDAAW,CAAA;IAEX;;;;;;;;;;OAUG;IACH,iDAAW,CAAA;IAEX;;;;;;;;;;;;;;;;OAgBG;IACH,yCAAO,CAAA;AACR,CAAC,EA1CW,UAAU,0BAAV,UAAU,QA0CrB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype AnchorNode,\n\ttype ExclusiveMapTree,\n\ttype FieldKey,\n\ttype FieldKindIdentifier,\n\ttype ITreeCursorSynchronous,\n\ttype NormalizedFieldUpPath,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeValue,\n\tanchorSlot,\n} from \"../../core/index.js\";\nimport type {\n\tFieldKinds,\n\tSequenceFieldEditBuilder,\n\tValueFieldEditBuilder,\n\tOptionalFieldEditBuilder,\n} from \"../default-schema/index.js\";\nimport type { FlexFieldKind } from \"../modular-schema/index.js\";\n\nimport type { FlexTreeContext } from \"./context.js\";\n\n/**\n * An anchor slot which records the {@link FlexTreeNode} associated with that anchor, if there is one.\n * @remarks This always points to a \"real\" {@link FlexTreeNode} (i.e. a `LazyTreeNode`), never to a \"raw\" node.\n */\nexport const flexTreeSlot = anchorSlot<FlexTreeNode>();\n\n/**\n * Indicates that an object is a flex tree.\n */\nexport const flexTreeMarker = Symbol(\"flexTreeMarker\");\n\nfunction isFlexTreeEntity(t: unknown): t is FlexTreeEntity {\n\treturn typeof t === \"object\" && t !== null && flexTreeMarker in t;\n}\n\nexport function isFlexTreeNode(t: unknown): t is FlexTreeNode {\n\treturn isFlexTreeEntity(t) && t[flexTreeMarker] === FlexTreeEntityKind.Node;\n}\n\n/**\n */\nexport enum FlexTreeEntityKind {\n\tNode,\n\tField,\n}\n\n/**\n * Part of a tree.\n * Iterates over children.\n *\n * @privateRemarks\n * This exists mainly as a place to share common members between nodes and fields.\n * It is not expected to be useful or common to write code which handles this type directly.\n * If this assumption turns out to be false, and generically processing `UntypedEntity`s is useful,\n * then this interface should probably be extended with some down casting functionality (like `is`).\n *\n * TODO:\n * Design and document iterator invalidation rules and ordering rules.\n * Providing a custom iterator type with place anchor semantics would be a good approach.\n */\nexport interface FlexTreeEntity {\n\t/**\n\t * Indicates that an object is a specific kind of flex tree FlexTreeEntity.\n\t * This makes it possible to both down cast FlexTreeEntities safely as well as validate if an object is or is not a FlexTreeEntity.\n\t */\n\treadonly [flexTreeMarker]: FlexTreeEntityKind;\n\n\t/**\n\t * A common context of FlexTrees.\n\t */\n\treadonly context: FlexTreeContext;\n}\n\n/**\n * Status of the tree that a particular node belongs to.\n * @public\n */\nexport enum TreeStatus {\n\t/**\n\t * Is parented under the root field.\n\t */\n\tInDocument = 0,\n\n\t/**\n\t * Is not parented under the root field, but can be added back to the original document tree.\n\t */\n\tRemoved = 1,\n\n\t/**\n\t * Is removed and cannot be added back to the original document tree.\n\t * @remarks\n\t * Nodes can enter this state for multiple reasons:\n\t * - The node was removed and nothing (e.g. undo/redo history) kept it from being cleaned up.\n\t * - The {@link TreeView} was disposed or had a schema change which made the tree incompatible.\n\t * @privateRemarks\n\t * There was planned work (AB#17948) to make the first reason a node could become \"Deleted\" impossible,\n\t * at least as an opt in feature,\n\t * by lifetime extending all nodes which are still possible to reach automatically.\n\t */\n\tDeleted = 2,\n\n\t/**\n\t * Is created but has not yet been inserted into the tree.\n\t * @remarks\n\t * See also {@link Unhydrated}.\n\t *\n\t * Nodes in the new state have some limitations:\n\t *\n\t * - Events are not currently triggered for changes. Fixes for this are planned.\n\t *\n\t * - Reading identifiers from nodes which were left unspecified (defaulted) when creating the tree will error.\n\t * This is because allocating unique identifiers in a compressible manner requires knowing which tree the nodes will be inserted into.\n\t *\n\t * - Transactions do not work: transactions apply to a single {@link TreeView}, and `New` nodes are not part of one.\n\t *\n\t * - `Tree.shortId` (when the identifier was explicitly specified and thus works at all) will just return the full identifier as a string,\n\t * but might return a compressed form as a number once hydrated.\n\t */\n\tNew = 3,\n}\n\n/**\n * Generic tree node API.\n *\n * Nodes are (shallowly) immutable and have a logical identity, a type and either a value or fields under string keys.\n *\n * This \"logical identity\" is exposed as the object identity: if a node is moved within a document,\n * the same {@link FlexTreeNode} instance will be used in the new location.\n * Similarly, edits applied to a node's sub-tree concurrently with the move of the node will still be applied to its subtree in its new location.\n *\n * @remarks\n * All editing is actually done via {@link FlexTreeField}s: the nodes are immutable other than that they contain mutable fields.\n */\nexport interface FlexTreeNode extends FlexTreeEntity {\n\treadonly [flexTreeMarker]: FlexTreeEntityKind.Node;\n\n\t/**\n\t * Value stored on this node.\n\t */\n\treadonly value?: TreeValue;\n\n\t/**\n\t * Gets a field of this node, if it is not empty.\n\t */\n\ttryGetField(key: FieldKey): undefined | FlexTreeField;\n\n\t/**\n\t * Get the field for `key`.\n\t * @param key - which entry to look up.\n\t *\n\t * @remarks\n\t * All fields implicitly exist, so `getBoxed` can be called with any key and will always return a field.\n\t * Even if the field is empty, it will still be returned, and can be edited to insert content if allowed by the field kind.\n\t * See {@link FlexTreeNode.tryGetField} for a variant that does not allocate afield in the empty case.\n\t */\n\tgetBoxed(key: FieldKey): FlexTreeField;\n\n\t/**\n\t * The field this tree is in, and the index within that field.\n\t */\n\treadonly parentField: { readonly parent: FlexTreeField; readonly index: number };\n\n\tboxedIterator(): IterableIterator<FlexTreeField>;\n\n\t/**\n\t * The anchor node associated with this node\n\t *\n\t * @remarks\n\t * The ref count keeping this alive is owned by the FlexTreeNode:\n\t * if holding onto this anchor for longer than the FlexTreeNode might be alive,\n\t * a separate Anchor (and thus ref count) must be allocated to keep it alive.\n\t */\n\treadonly anchorNode: AnchorNode;\n\n\t/**\n\t * Returns an iterable of keys for non-empty fields.\n\t *\n\t * @remarks\n\t * All fields under a map implicitly exist, but `keys` will yield only the keys of fields which contain one or more nodes.\n\t *\n\t * No guarantees are made regarding the order of the keys returned.\n\t */\n\tkeys(): IterableIterator<FieldKey>;\n\n\t/**\n\t * Schema for this entity.\n\t * If well-formed, it must follow this schema.\n\t */\n\treadonly schema: TreeNodeSchemaIdentifier;\n\n\t/**\n\t * Get a cursor for the underlying data.\n\t * @remarks\n\t * This cursor might be one the node uses in its implementation, and thus must be returned to its original location before using any other APIs to interact with the tree.\n\t * Must not be held onto across edits or any other tree API use.\n\t */\n\tborrowCursor(): ITreeCursorSynchronous;\n}\n\n/**\n * A collaboratively editable collection of nodes within a {@link FlexTreeEntity}.\n *\n * Fields are inherently part of their parent, and thus cannot be moved.\n * Instead their content can be moved, deleted or created.\n *\n * Editing operations are only valid on trees with the {@link TreeStatus#InDocument} `TreeStatus`.\n *\n * @remarks\n * Fields are used wherever an editable collection of nodes is required.\n * This is required in two places:\n * 1. To hold the children of non-leaf {@link FlexTreeNode}s.\n * 2. As the root of a {@link FlexTreeEntity}.\n *\n * Down-casting (via {@link FlexTreeField.is}) is required to access Schema-Aware APIs, including editing.\n * All content in the tree is accessible without down-casting, but if the schema is known,\n * the schema aware API may be more ergonomic.\n */\nexport interface FlexTreeField extends FlexTreeEntity {\n\treadonly [flexTreeMarker]: FlexTreeEntityKind.Field;\n\n\t/**\n\t * The number of nodes in this field\n\t */\n\treadonly length: number;\n\n\t/**\n\t * The `FieldKey` this field is under.\n\t * Defines what part of its parent this field makes up.\n\t */\n\treadonly key: FieldKey;\n\n\t/**\n\t * The node which has this field on it under `fieldKey`.\n\t * `undefined` iff this field is a detached field.\n\t */\n\treadonly parent?: FlexTreeNode;\n\n\t/**\n\t * Type guard for narrowing / down-casting to a specific schema.\n\t */\n\tis<TKind extends FlexFieldKind>(kind: TKind): this is FlexTreeTypedField<TKind>;\n\n\tboxedIterator(): IterableIterator<FlexTreeNode>;\n\n\t/**\n\t * Gets a node of this field by its index without unboxing.\n\t * @param index - Zero-based index of the item to retrieve. Negative values are interpreted from the end of the sequence.\n\t *\n\t * @returns The element in the sequence matching the given index. Always returns undefined if index \\< -sequence.length\n\t * or index \\>= sequence.length.\n\t *\n\t * @remarks\n\t * Semantics match {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at}.\n\t */\n\tboxedAt(index: number): FlexTreeNode | undefined;\n\n\t/**\n\t * Gets the FieldUpPath of a field.\n\t */\n\tgetFieldPath(): NormalizedFieldUpPath;\n\n\t/**\n\t * Schema for this entity.\n\t * If well-formed, it must follow this schema.\n\t */\n\treadonly schema: FieldKindIdentifier;\n}\n\n// #region Field Kinds\n\n/**\n * Typed tree for inserting as the content of a field.\n */\nexport type FlexibleFieldContent = ExclusiveMapTree[];\n\n/**\n * Tree for inserting as a node.\n */\nexport type FlexibleNodeContent = ExclusiveMapTree;\n\n/**\n * {@link FlexTreeField} that stores a sequence of children.\n *\n * Sequence fields can contain an ordered sequence any number of {@link FlexTreeNode}s which must be of the {@link FlexAllowedTypes} from the {@link FlexFieldSchema}).\n *\n * @remarks\n * Allows for concurrent editing based on index, adjusting the locations of indexes as needed so they apply to the same logical place in the sequence when rebased and merged.\n *\n * Edits to sequence fields are anchored relative to their surroundings, so concurrent edits can result in the indexes of nodes and edits getting shifted.\n * To hold onto locations in sequence across an edit, use anchors.\n *\n * @privateRemarks\n * TODO:\n * Add anchor API that can actually hold onto locations in a sequence.\n * Currently only nodes can be held onto with anchors, and this does not replicate the behavior implemented for editing.\n */\nexport interface FlexTreeSequenceField extends FlexTreeField {\n\t/**\n\t * Gets a node of this field by its index with unboxing.\n\t * @param index - Zero-based index of the item to retrieve. Negative values are interpreted from the end of the sequence.\n\t *\n\t * @returns The element in the sequence matching the given index. Always returns undefined if index \\< -sequence.length\n\t * or index \\>= array.length.\n\t *\n\t * @remarks\n\t * Semantics match {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at | Array.at}.\n\t */\n\tat(index: number): FlexTreeUnknownUnboxed | undefined;\n\n\t/**\n\t * {@inheritdoc FlexTreeField.boxedAt}\n\t */\n\tboxedAt(index: number): FlexTreeNode | undefined;\n\n\t/**\n\t * Calls the provided callback function on each child of this sequence, and returns an array that contains the results.\n\t * @param callbackfn - A function that accepts the child and its index.\n\t */\n\tmap<U>(callbackfn: (value: FlexTreeUnknownUnboxed, index: number) => U): U[];\n\n\t/**\n\t * Get an editor for this sequence.\n\t */\n\treadonly editor: SequenceFieldEditBuilder<FlexibleFieldContent>;\n\n\tboxedIterator(): IterableIterator<FlexTreeNode>;\n}\n\n/**\n * Field that stores exactly one child.\n *\n * @remarks\n * Unboxes its content, so in schema aware APIs which do unboxing, the RequiredField itself will be skipped over and its content will be returned directly.\n */\nexport interface FlexTreeRequiredField extends FlexTreeField {\n\tget content(): FlexTreeUnknownUnboxed;\n\n\treadonly editor: ValueFieldEditBuilder<FlexibleNodeContent>;\n}\n\n/**\n * Field that stores zero or one child.\n *\n * @remarks\n * Unboxes its content, so in schema aware APIs which do unboxing, the OptionalField itself will be skipped over and its content will be returned directly.\n *\n * @privateRemarks\n * TODO: Document merge semitics\n * TODO: Allow Optional fields to be used with last write wins OR first write wins merge resolution.\n * TODO:\n * Better centralize the documentation about what kinds of merge semantics are available for field kinds.\n * Maybe link editor?\n */\nexport interface FlexTreeOptionalField extends FlexTreeField {\n\tget content(): FlexTreeUnknownUnboxed | undefined;\n\n\treadonly editor: OptionalFieldEditBuilder<FlexibleNodeContent>;\n}\n\n// #endregion\n\n// #region Typed\n\n/**\n * Schema aware specialization of {@link FlexTreeField}.\n */\nexport type FlexTreeTypedField<Kind extends FlexFieldKind> =\n\tKind extends typeof FieldKinds.sequence\n\t\t? FlexTreeSequenceField\n\t\t: Kind extends typeof FieldKinds.required\n\t\t\t? FlexTreeRequiredField\n\t\t\t: Kind extends typeof FieldKinds.optional\n\t\t\t\t? FlexTreeOptionalField\n\t\t\t\t: FlexTreeField;\n\n// #endregion\n\n/**\n * Unboxed tree type for unknown schema cases.\n */\nexport type FlexTreeUnknownUnboxed = TreeValue | FlexTreeNode;\n"]}
@@ -6,7 +6,7 @@ export { type FlexTreeField, type FlexTreeNode, type FlexTreeEntity, type FlexTr
6
6
  export { visitBipartiteIterableTree, Skip, visitBipartiteIterableTreeWithState, visitIterableTree, visitIterableTreeWithState, } from "./navigation.js";
7
7
  export { getTreeContext, type FlexTreeContext, type FlexTreeHydratedContext, Context, ContextSlot, } from "./context.js";
8
8
  export { type FlexTreeNodeEvents } from "./treeEvents.js";
9
- export { assertFlexTreeEntityNotFreed, isFreedSymbol, LazyEntity, } from "./lazyEntity.js";
9
+ export { assertFlexTreeEntityNotFreed, LazyEntity, } from "./lazyEntity.js";
10
10
  export { getSchemaAndPolicy, indexForAt } from "./utilities.js";
11
11
  export { treeStatusFromAnchorCache } from "./utilities.js";
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,UAAU,EACV,KAAK,sBAAsB,EAC3B,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,YAAY,GACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACN,0BAA0B,EAC1B,IAAI,EACJ,mCAAmC,EACnC,iBAAiB,EACjB,0BAA0B,GAC1B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,OAAO,EACP,WAAW,GACX,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EACN,4BAA4B,EAC5B,aAAa,EACb,UAAU,GACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,UAAU,EACV,KAAK,sBAAsB,EAC3B,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,YAAY,GACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACN,0BAA0B,EAC1B,IAAI,EACJ,mCAAmC,EACnC,iBAAiB,EACjB,0BAA0B,GAC1B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,OAAO,EACP,WAAW,GACX,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EACN,4BAA4B,EAC5B,UAAU,GACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.treeStatusFromAnchorCache = exports.indexForAt = exports.getSchemaAndPolicy = exports.LazyEntity = exports.isFreedSymbol = exports.assertFlexTreeEntityNotFreed = exports.ContextSlot = exports.Context = exports.getTreeContext = exports.visitIterableTreeWithState = exports.visitIterableTree = exports.visitBipartiteIterableTreeWithState = exports.Skip = exports.visitBipartiteIterableTree = exports.flexTreeSlot = exports.isFlexTreeNode = exports.FlexTreeEntityKind = exports.flexTreeMarker = exports.TreeStatus = void 0;
7
+ exports.treeStatusFromAnchorCache = exports.indexForAt = exports.getSchemaAndPolicy = exports.LazyEntity = exports.assertFlexTreeEntityNotFreed = exports.ContextSlot = exports.Context = exports.getTreeContext = exports.visitIterableTreeWithState = exports.visitIterableTree = exports.visitBipartiteIterableTreeWithState = exports.Skip = exports.visitBipartiteIterableTree = exports.flexTreeSlot = exports.isFlexTreeNode = exports.FlexTreeEntityKind = exports.flexTreeMarker = exports.TreeStatus = void 0;
8
8
  var flexTreeTypes_js_1 = require("./flexTreeTypes.js");
9
9
  Object.defineProperty(exports, "TreeStatus", { enumerable: true, get: function () { return flexTreeTypes_js_1.TreeStatus; } });
10
10
  Object.defineProperty(exports, "flexTreeMarker", { enumerable: true, get: function () { return flexTreeTypes_js_1.flexTreeMarker; } });
@@ -23,7 +23,6 @@ Object.defineProperty(exports, "Context", { enumerable: true, get: function () {
23
23
  Object.defineProperty(exports, "ContextSlot", { enumerable: true, get: function () { return context_js_1.ContextSlot; } });
24
24
  var lazyEntity_js_1 = require("./lazyEntity.js");
25
25
  Object.defineProperty(exports, "assertFlexTreeEntityNotFreed", { enumerable: true, get: function () { return lazyEntity_js_1.assertFlexTreeEntityNotFreed; } });
26
- Object.defineProperty(exports, "isFreedSymbol", { enumerable: true, get: function () { return lazyEntity_js_1.isFreedSymbol; } });
27
26
  Object.defineProperty(exports, "LazyEntity", { enumerable: true, get: function () { return lazyEntity_js_1.LazyEntity; } });
28
27
  var utilities_js_1 = require("./utilities.js");
29
28
  Object.defineProperty(exports, "getSchemaAndPolicy", { enumerable: true, get: function () { return utilities_js_1.getSchemaAndPolicy; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAc4B;AAN3B,8GAAA,UAAU,OAAA;AAEV,kHAAA,cAAc,OAAA;AACd,sHAAA,kBAAkB,OAAA;AAClB,kHAAA,cAAc,OAAA;AACd,gHAAA,YAAY,OAAA;AAGb,iDAMyB;AALxB,2HAAA,0BAA0B,OAAA;AAC1B,qGAAA,IAAI,OAAA;AACJ,oIAAA,mCAAmC,OAAA;AACnC,kHAAA,iBAAiB,OAAA;AACjB,2HAAA,0BAA0B,OAAA;AAG3B,2CAMsB;AALrB,4GAAA,cAAc,OAAA;AAGd,qGAAA,OAAO,OAAA;AACP,yGAAA,WAAW,OAAA;AAKZ,iDAIyB;AAHxB,6HAAA,4BAA4B,OAAA;AAC5B,8GAAA,aAAa,OAAA;AACb,2GAAA,UAAU,OAAA;AAGX,+CAAgE;AAAvD,kHAAA,kBAAkB,OAAA;AAAE,0GAAA,UAAU,OAAA;AAEvC,+CAA2D;AAAlD,yHAAA,yBAAyB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\ttype FlexTreeEntity,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\tTreeStatus,\n\ttype FlexTreeUnknownUnboxed,\n\tflexTreeMarker,\n\tFlexTreeEntityKind,\n\tisFlexTreeNode,\n\tflexTreeSlot,\n} from \"./flexTreeTypes.js\";\n\nexport {\n\tvisitBipartiteIterableTree,\n\tSkip,\n\tvisitBipartiteIterableTreeWithState,\n\tvisitIterableTree,\n\tvisitIterableTreeWithState,\n} from \"./navigation.js\";\n\nexport {\n\tgetTreeContext,\n\ttype FlexTreeContext,\n\ttype FlexTreeHydratedContext,\n\tContext,\n\tContextSlot,\n} from \"./context.js\";\n\nexport { type FlexTreeNodeEvents } from \"./treeEvents.js\";\n\nexport {\n\tassertFlexTreeEntityNotFreed,\n\tisFreedSymbol,\n\tLazyEntity,\n} from \"./lazyEntity.js\";\n\nexport { getSchemaAndPolicy, indexForAt } from \"./utilities.js\";\n\nexport { treeStatusFromAnchorCache } from \"./utilities.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAc4B;AAN3B,8GAAA,UAAU,OAAA;AAEV,kHAAA,cAAc,OAAA;AACd,sHAAA,kBAAkB,OAAA;AAClB,kHAAA,cAAc,OAAA;AACd,gHAAA,YAAY,OAAA;AAGb,iDAMyB;AALxB,2HAAA,0BAA0B,OAAA;AAC1B,qGAAA,IAAI,OAAA;AACJ,oIAAA,mCAAmC,OAAA;AACnC,kHAAA,iBAAiB,OAAA;AACjB,2HAAA,0BAA0B,OAAA;AAG3B,2CAMsB;AALrB,4GAAA,cAAc,OAAA;AAGd,qGAAA,OAAO,OAAA;AACP,yGAAA,WAAW,OAAA;AAKZ,iDAGyB;AAFxB,6HAAA,4BAA4B,OAAA;AAC5B,2GAAA,UAAU,OAAA;AAGX,+CAAgE;AAAvD,kHAAA,kBAAkB,OAAA;AAAE,0GAAA,UAAU,OAAA;AAEvC,+CAA2D;AAAlD,yHAAA,yBAAyB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\ttype FlexTreeEntity,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\tTreeStatus,\n\ttype FlexTreeUnknownUnboxed,\n\tflexTreeMarker,\n\tFlexTreeEntityKind,\n\tisFlexTreeNode,\n\tflexTreeSlot,\n} from \"./flexTreeTypes.js\";\n\nexport {\n\tvisitBipartiteIterableTree,\n\tSkip,\n\tvisitBipartiteIterableTreeWithState,\n\tvisitIterableTree,\n\tvisitIterableTreeWithState,\n} from \"./navigation.js\";\n\nexport {\n\tgetTreeContext,\n\ttype FlexTreeContext,\n\ttype FlexTreeHydratedContext,\n\tContext,\n\tContextSlot,\n} from \"./context.js\";\n\nexport { type FlexTreeNodeEvents } from \"./treeEvents.js\";\n\nexport {\n\tassertFlexTreeEntityNotFreed,\n\tLazyEntity,\n} from \"./lazyEntity.js\";\n\nexport { getSchemaAndPolicy, indexForAt } from \"./utilities.js\";\n\nexport { treeStatusFromAnchorCache } from \"./utilities.js\";\n"]}
@@ -6,15 +6,6 @@ import { type ITreeSubscriptionCursor, TreeNavigationResult } from "../../core/i
6
6
  import { type IDisposable, disposeSymbol } from "../../util/index.js";
7
7
  import type { Context } from "./context.js";
8
8
  import { type FlexTreeEntity, type FlexTreeEntityKind, flexTreeMarker } from "./flexTreeTypes.js";
9
- export declare const prepareForEditSymbol: unique symbol;
10
- export declare const isFreedSymbol: unique symbol;
11
- export declare const tryMoveCursorToAnchorSymbol: unique symbol;
12
- export declare const forgetAnchorSymbol: unique symbol;
13
- export declare const cursorSymbol: unique symbol;
14
- /**
15
- * Symbol used to access the (generic) anchor of a {@link LazyEntity}.
16
- */
17
- export declare const anchorSymbol: unique symbol;
18
9
  /**
19
10
  * Assert `entity` is not deleted.
20
11
  * @privateRemarks
@@ -28,18 +19,18 @@ export declare function assertFlexTreeEntityNotFreed(entity: FlexTreeEntity): vo
28
19
  export declare abstract class LazyEntity<TAnchor = unknown> implements FlexTreeEntity, IDisposable {
29
20
  #private;
30
21
  readonly context: Context;
31
- readonly [anchorSymbol]: TAnchor;
22
+ readonly anchor: TAnchor;
32
23
  protected constructor(context: Context, cursor: ITreeSubscriptionCursor, anchor: TAnchor);
33
24
  abstract boxedIterator(): IterableIterator<FlexTreeEntity>;
34
25
  abstract get [flexTreeMarker](): FlexTreeEntityKind;
35
26
  [disposeSymbol](): void;
36
- [prepareForEditSymbol](): void;
37
- [isFreedSymbol](): boolean;
38
- get [cursorSymbol](): ITreeSubscriptionCursor;
39
- protected abstract [tryMoveCursorToAnchorSymbol](cursor: ITreeSubscriptionCursor): TreeNavigationResult;
27
+ prepareForEdit(): void;
28
+ isFreed(): boolean;
29
+ get cursor(): ITreeSubscriptionCursor;
30
+ protected abstract tryMoveCursorToAnchor(cursor: ITreeSubscriptionCursor): TreeNavigationResult;
40
31
  /**
41
32
  * Called when disposing of this target, iff it has an anchor.
42
33
  */
43
- protected abstract [forgetAnchorSymbol](): void;
34
+ protected abstract forgetAnchor(): void;
44
35
  }
45
36
  //# sourceMappingURL=lazyEntity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lazyEntity.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyEntity.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,uBAAuB,EAE5B,oBAAoB,EACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,cAAc,EACd,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,oBAAoB,eAA2B,CAAC;AAC7D,eAAO,MAAM,aAAa,eAAoB,CAAC;AAC/C,eAAO,MAAM,2BAA2B,eAAkC,CAAC;AAC3E,eAAO,MAAM,kBAAkB,eAAyB,CAAC;AACzD,eAAO,MAAM,YAAY,eAAmB,CAAC;AAC7C;;GAEG;AACH,eAAO,MAAM,YAAY,eAAmB,CAAC;AAE7C;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAA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