@fluidframework/react 0.41.4 → 2.63.0-358419

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 (342) hide show
  1. package/.eslintrc.cjs +11 -0
  2. package/.mocharc.cjs +15 -0
  3. package/CHANGELOG.md +282 -0
  4. package/README.md +122 -273
  5. package/api-extractor/api-extractor-lint-alpha.cjs.json +5 -0
  6. package/api-extractor/api-extractor-lint-alpha.esm.json +5 -0
  7. package/api-extractor/api-extractor-lint-beta.cjs.json +5 -0
  8. package/api-extractor/api-extractor-lint-beta.esm.json +5 -0
  9. package/api-extractor/api-extractor-lint-bundle.json +5 -0
  10. package/api-extractor/api-extractor-lint-public.cjs.json +5 -0
  11. package/api-extractor/api-extractor-lint-public.esm.json +5 -0
  12. package/api-extractor-lint.json +4 -0
  13. package/api-extractor.json +2 -2
  14. package/api-report/react.alpha.api.md +114 -0
  15. package/api-report/react.beta.api.md +7 -0
  16. package/api-report/react.public.api.md +7 -0
  17. package/biome.jsonc +4 -0
  18. package/dist/alpha.d.ts +45 -0
  19. package/dist/beta.d.ts +15 -0
  20. package/dist/index.d.ts +11 -7
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +19 -17
  23. package/dist/index.js.map +1 -1
  24. package/dist/package.json +4 -0
  25. package/dist/propNode.d.ts +114 -0
  26. package/dist/propNode.d.ts.map +1 -0
  27. package/dist/propNode.js +43 -0
  28. package/dist/propNode.js.map +1 -0
  29. package/dist/public.d.ts +15 -0
  30. package/dist/reactSharedTreeView.d.ts +119 -0
  31. package/dist/reactSharedTreeView.d.ts.map +1 -0
  32. package/dist/reactSharedTreeView.js +206 -0
  33. package/dist/reactSharedTreeView.js.map +1 -0
  34. package/dist/simpleIdentifier.d.ts +19 -0
  35. package/dist/simpleIdentifier.d.ts.map +1 -0
  36. package/dist/simpleIdentifier.js +33 -0
  37. package/dist/simpleIdentifier.js.map +1 -0
  38. package/dist/useObservation.d.ts +83 -0
  39. package/dist/useObservation.d.ts.map +1 -0
  40. package/dist/useObservation.js +295 -0
  41. package/dist/useObservation.js.map +1 -0
  42. package/dist/useTree.d.ts +80 -0
  43. package/dist/useTree.d.ts.map +1 -0
  44. package/dist/useTree.js +137 -0
  45. package/dist/useTree.js.map +1 -0
  46. package/lib/alpha.d.ts +45 -0
  47. package/lib/beta.d.ts +15 -0
  48. package/lib/index.d.ts +16 -0
  49. package/lib/index.d.ts.map +1 -0
  50. package/lib/index.js +4 -7
  51. package/lib/index.js.map +1 -1
  52. package/lib/package.json +4 -0
  53. package/lib/propNode.d.ts +114 -0
  54. package/lib/propNode.d.ts.map +1 -0
  55. package/lib/propNode.js +36 -0
  56. package/lib/propNode.js.map +1 -0
  57. package/lib/public.d.ts +15 -0
  58. package/lib/reactSharedTreeView.d.ts +119 -0
  59. package/lib/reactSharedTreeView.d.ts.map +1 -0
  60. package/lib/reactSharedTreeView.js +176 -0
  61. package/lib/reactSharedTreeView.js.map +1 -0
  62. package/lib/simpleIdentifier.d.ts +19 -0
  63. package/lib/simpleIdentifier.d.ts.map +1 -0
  64. package/lib/simpleIdentifier.js +29 -0
  65. package/lib/simpleIdentifier.js.map +1 -0
  66. package/lib/test/propNode.spec.js +120 -0
  67. package/lib/test/propNode.spec.js.map +1 -0
  68. package/lib/test/reactSharedTreeView.spec.js +71 -0
  69. package/lib/test/reactSharedTreeView.spec.js.map +1 -0
  70. package/lib/test/simpleIdentifier.spec.js +18 -0
  71. package/lib/test/simpleIdentifier.spec.js.map +1 -0
  72. package/lib/test/useObservation.spec.js +162 -0
  73. package/lib/test/useObservation.spec.js.map +1 -0
  74. package/lib/test/useTree.spec.js +165 -0
  75. package/lib/test/useTree.spec.js.map +1 -0
  76. package/lib/tsdoc-metadata.json +11 -0
  77. package/lib/useObservation.d.ts +83 -0
  78. package/lib/useObservation.d.ts.map +1 -0
  79. package/lib/useObservation.js +266 -0
  80. package/lib/useObservation.js.map +1 -0
  81. package/lib/useTree.d.ts +80 -0
  82. package/lib/useTree.d.ts.map +1 -0
  83. package/lib/useTree.js +105 -0
  84. package/lib/useTree.js.map +1 -0
  85. package/package.json +150 -51
  86. package/react.test-files.tar +0 -0
  87. package/src/index.ts +42 -7
  88. package/src/propNode.ts +164 -0
  89. package/src/reactSharedTreeView.tsx +327 -0
  90. package/src/simpleIdentifier.ts +31 -0
  91. package/src/useObservation.ts +376 -0
  92. package/src/useTree.ts +147 -0
  93. package/tsconfig.cjs.json +7 -0
  94. package/tsconfig.json +12 -15
  95. package/tsdoc.json +4 -0
  96. package/.eslintrc.js +0 -11
  97. package/dist/createContextFluid.d.ts +0 -7
  98. package/dist/createContextFluid.d.ts.map +0 -1
  99. package/dist/createContextFluid.js +0 -46
  100. package/dist/createContextFluid.js.map +0 -1
  101. package/dist/helpers/generateFluidObjectSchema.d.ts +0 -16
  102. package/dist/helpers/generateFluidObjectSchema.d.ts.map +0 -1
  103. package/dist/helpers/generateFluidObjectSchema.js +0 -75
  104. package/dist/helpers/generateFluidObjectSchema.js.map +0 -1
  105. package/dist/helpers/getFluidFromView.d.ts +0 -15
  106. package/dist/helpers/getFluidFromView.d.ts.map +0 -1
  107. package/dist/helpers/getFluidFromView.js +0 -30
  108. package/dist/helpers/getFluidFromView.js.map +0 -1
  109. package/dist/helpers/getFluidState.d.ts +0 -15
  110. package/dist/helpers/getFluidState.d.ts.map +0 -1
  111. package/dist/helpers/getFluidState.js +0 -47
  112. package/dist/helpers/getFluidState.js.map +0 -1
  113. package/dist/helpers/getSchema.d.ts +0 -13
  114. package/dist/helpers/getSchema.d.ts.map +0 -1
  115. package/dist/helpers/getSchema.js +0 -15
  116. package/dist/helpers/getSchema.js.map +0 -1
  117. package/dist/helpers/getViewFromFluid.d.ts +0 -18
  118. package/dist/helpers/getViewFromFluid.d.ts.map +0 -1
  119. package/dist/helpers/getViewFromFluid.js +0 -47
  120. package/dist/helpers/getViewFromFluid.js.map +0 -1
  121. package/dist/helpers/index.d.ts +0 -16
  122. package/dist/helpers/index.d.ts.map +0 -1
  123. package/dist/helpers/index.js +0 -28
  124. package/dist/helpers/index.js.map +0 -1
  125. package/dist/helpers/initializeState.d.ts +0 -22
  126. package/dist/helpers/initializeState.d.ts.map +0 -1
  127. package/dist/helpers/initializeState.js +0 -77
  128. package/dist/helpers/initializeState.js.map +0 -1
  129. package/dist/helpers/internalInterface.d.ts +0 -15
  130. package/dist/helpers/internalInterface.d.ts.map +0 -1
  131. package/dist/helpers/internalInterface.js +0 -7
  132. package/dist/helpers/internalInterface.js.map +0 -1
  133. package/dist/helpers/rootCallbackListener.d.ts +0 -24
  134. package/dist/helpers/rootCallbackListener.d.ts.map +0 -1
  135. package/dist/helpers/rootCallbackListener.js +0 -55
  136. package/dist/helpers/rootCallbackListener.js.map +0 -1
  137. package/dist/helpers/setComponentSchema.d.ts +0 -14
  138. package/dist/helpers/setComponentSchema.d.ts.map +0 -1
  139. package/dist/helpers/setComponentSchema.js +0 -18
  140. package/dist/helpers/setComponentSchema.js.map +0 -1
  141. package/dist/helpers/setFluidState.d.ts +0 -20
  142. package/dist/helpers/setFluidState.d.ts.map +0 -1
  143. package/dist/helpers/setFluidState.js +0 -94
  144. package/dist/helpers/setFluidState.js.map +0 -1
  145. package/dist/helpers/syncState.d.ts +0 -25
  146. package/dist/helpers/syncState.d.ts.map +0 -1
  147. package/dist/helpers/syncState.js +0 -98
  148. package/dist/helpers/syncState.js.map +0 -1
  149. package/dist/helpers/updateStateAndFluidObjectMap.d.ts +0 -29
  150. package/dist/helpers/updateStateAndFluidObjectMap.d.ts.map +0 -1
  151. package/dist/helpers/updateStateAndFluidObjectMap.js +0 -30
  152. package/dist/helpers/updateStateAndFluidObjectMap.js.map +0 -1
  153. package/dist/helpers/utils.d.ts +0 -12
  154. package/dist/helpers/utils.d.ts.map +0 -1
  155. package/dist/helpers/utils.js +0 -74
  156. package/dist/helpers/utils.js.map +0 -1
  157. package/dist/interface.d.ts +0 -444
  158. package/dist/interface.d.ts.map +0 -1
  159. package/dist/interface.js +0 -18
  160. package/dist/interface.js.map +0 -1
  161. package/dist/reactView.d.ts +0 -32
  162. package/dist/reactView.d.ts.map +0 -1
  163. package/dist/reactView.js +0 -79
  164. package/dist/reactView.js.map +0 -1
  165. package/dist/syncedDataObject.d.ts +0 -80
  166. package/dist/syncedDataObject.d.ts.map +0 -1
  167. package/dist/syncedDataObject.js +0 -249
  168. package/dist/syncedDataObject.js.map +0 -1
  169. package/dist/syncedObjects/array/fluidSyncedArray.d.ts +0 -11
  170. package/dist/syncedObjects/array/fluidSyncedArray.d.ts.map +0 -1
  171. package/dist/syncedObjects/array/fluidSyncedArray.js +0 -78
  172. package/dist/syncedObjects/array/fluidSyncedArray.js.map +0 -1
  173. package/dist/syncedObjects/array/index.d.ts +0 -7
  174. package/dist/syncedObjects/array/index.d.ts.map +0 -1
  175. package/dist/syncedObjects/array/index.js +0 -19
  176. package/dist/syncedObjects/array/index.js.map +0 -1
  177. package/dist/syncedObjects/array/interface.d.ts +0 -33
  178. package/dist/syncedObjects/array/interface.d.ts.map +0 -1
  179. package/dist/syncedObjects/array/interface.js +0 -3
  180. package/dist/syncedObjects/array/interface.js.map +0 -1
  181. package/dist/syncedObjects/array/syncedArray.d.ts +0 -30
  182. package/dist/syncedObjects/array/syncedArray.d.ts.map +0 -1
  183. package/dist/syncedObjects/array/syncedArray.js +0 -42
  184. package/dist/syncedObjects/array/syncedArray.js.map +0 -1
  185. package/dist/syncedObjects/counter/fluidSyncedCounter.d.ts +0 -11
  186. package/dist/syncedObjects/counter/fluidSyncedCounter.d.ts.map +0 -1
  187. package/dist/syncedObjects/counter/fluidSyncedCounter.js +0 -79
  188. package/dist/syncedObjects/counter/fluidSyncedCounter.js.map +0 -1
  189. package/dist/syncedObjects/counter/index.d.ts +0 -7
  190. package/dist/syncedObjects/counter/index.d.ts.map +0 -1
  191. package/dist/syncedObjects/counter/index.js +0 -19
  192. package/dist/syncedObjects/counter/index.js.map +0 -1
  193. package/dist/syncedObjects/counter/interface.d.ts +0 -32
  194. package/dist/syncedObjects/counter/interface.d.ts.map +0 -1
  195. package/dist/syncedObjects/counter/interface.js +0 -3
  196. package/dist/syncedObjects/counter/interface.js.map +0 -1
  197. package/dist/syncedObjects/counter/syncedCounter.d.ts +0 -29
  198. package/dist/syncedObjects/counter/syncedCounter.d.ts.map +0 -1
  199. package/dist/syncedObjects/counter/syncedCounter.js +0 -36
  200. package/dist/syncedObjects/counter/syncedCounter.js.map +0 -1
  201. package/dist/syncedObjects/index.d.ts +0 -9
  202. package/dist/syncedObjects/index.d.ts.map +0 -1
  203. package/dist/syncedObjects/index.js +0 -21
  204. package/dist/syncedObjects/index.js.map +0 -1
  205. package/dist/syncedObjects/object/index.d.ts +0 -7
  206. package/dist/syncedObjects/object/index.d.ts.map +0 -1
  207. package/dist/syncedObjects/object/index.js +0 -19
  208. package/dist/syncedObjects/object/index.js.map +0 -1
  209. package/dist/syncedObjects/object/interface.d.ts +0 -13
  210. package/dist/syncedObjects/object/interface.d.ts.map +0 -1
  211. package/dist/syncedObjects/object/interface.js +0 -7
  212. package/dist/syncedObjects/object/interface.js.map +0 -1
  213. package/dist/syncedObjects/object/syncedObject.d.ts +0 -22
  214. package/dist/syncedObjects/object/syncedObject.d.ts.map +0 -1
  215. package/dist/syncedObjects/object/syncedObject.js +0 -46
  216. package/dist/syncedObjects/object/syncedObject.js.map +0 -1
  217. package/dist/syncedObjects/string/index.d.ts +0 -7
  218. package/dist/syncedObjects/string/index.d.ts.map +0 -1
  219. package/dist/syncedObjects/string/index.js +0 -19
  220. package/dist/syncedObjects/string/index.js.map +0 -1
  221. package/dist/syncedObjects/string/interface.d.ts +0 -16
  222. package/dist/syncedObjects/string/interface.d.ts.map +0 -1
  223. package/dist/syncedObjects/string/interface.js +0 -7
  224. package/dist/syncedObjects/string/interface.js.map +0 -1
  225. package/dist/syncedObjects/string/syncedString.d.ts +0 -25
  226. package/dist/syncedObjects/string/syncedString.d.ts.map +0 -1
  227. package/dist/syncedObjects/string/syncedString.js +0 -53
  228. package/dist/syncedObjects/string/syncedString.js.map +0 -1
  229. package/dist/useReducerFluid.d.ts +0 -7
  230. package/dist/useReducerFluid.d.ts.map +0 -1
  231. package/dist/useReducerFluid.js +0 -219
  232. package/dist/useReducerFluid.js.map +0 -1
  233. package/dist/useStateFluid.d.ts +0 -10
  234. package/dist/useStateFluid.d.ts.map +0 -1
  235. package/dist/useStateFluid.js +0 -67
  236. package/dist/useStateFluid.js.map +0 -1
  237. package/lib/createContextFluid.js +0 -23
  238. package/lib/createContextFluid.js.map +0 -1
  239. package/lib/helpers/generateFluidObjectSchema.js +0 -71
  240. package/lib/helpers/generateFluidObjectSchema.js.map +0 -1
  241. package/lib/helpers/getFluidFromView.js +0 -26
  242. package/lib/helpers/getFluidFromView.js.map +0 -1
  243. package/lib/helpers/getFluidState.js +0 -43
  244. package/lib/helpers/getFluidState.js.map +0 -1
  245. package/lib/helpers/getSchema.js +0 -11
  246. package/lib/helpers/getSchema.js.map +0 -1
  247. package/lib/helpers/getViewFromFluid.js +0 -43
  248. package/lib/helpers/getViewFromFluid.js.map +0 -1
  249. package/lib/helpers/index.js +0 -16
  250. package/lib/helpers/index.js.map +0 -1
  251. package/lib/helpers/initializeState.js +0 -73
  252. package/lib/helpers/initializeState.js.map +0 -1
  253. package/lib/helpers/internalInterface.js +0 -6
  254. package/lib/helpers/internalInterface.js.map +0 -1
  255. package/lib/helpers/rootCallbackListener.js +0 -51
  256. package/lib/helpers/rootCallbackListener.js.map +0 -1
  257. package/lib/helpers/setComponentSchema.js +0 -14
  258. package/lib/helpers/setComponentSchema.js.map +0 -1
  259. package/lib/helpers/setFluidState.js +0 -90
  260. package/lib/helpers/setFluidState.js.map +0 -1
  261. package/lib/helpers/syncState.js +0 -94
  262. package/lib/helpers/syncState.js.map +0 -1
  263. package/lib/helpers/updateStateAndFluidObjectMap.js +0 -26
  264. package/lib/helpers/updateStateAndFluidObjectMap.js.map +0 -1
  265. package/lib/helpers/utils.js +0 -67
  266. package/lib/helpers/utils.js.map +0 -1
  267. package/lib/interface.js +0 -8
  268. package/lib/interface.js.map +0 -1
  269. package/lib/reactView.js +0 -56
  270. package/lib/reactView.js.map +0 -1
  271. package/lib/syncedDataObject.js +0 -245
  272. package/lib/syncedDataObject.js.map +0 -1
  273. package/lib/syncedObjects/array/fluidSyncedArray.js +0 -72
  274. package/lib/syncedObjects/array/fluidSyncedArray.js.map +0 -1
  275. package/lib/syncedObjects/array/index.js +0 -7
  276. package/lib/syncedObjects/array/index.js.map +0 -1
  277. package/lib/syncedObjects/array/interface.js +0 -2
  278. package/lib/syncedObjects/array/interface.js.map +0 -1
  279. package/lib/syncedObjects/array/syncedArray.js +0 -37
  280. package/lib/syncedObjects/array/syncedArray.js.map +0 -1
  281. package/lib/syncedObjects/counter/fluidSyncedCounter.js +0 -73
  282. package/lib/syncedObjects/counter/fluidSyncedCounter.js.map +0 -1
  283. package/lib/syncedObjects/counter/index.js +0 -7
  284. package/lib/syncedObjects/counter/index.js.map +0 -1
  285. package/lib/syncedObjects/counter/interface.js +0 -2
  286. package/lib/syncedObjects/counter/interface.js.map +0 -1
  287. package/lib/syncedObjects/counter/syncedCounter.js +0 -31
  288. package/lib/syncedObjects/counter/syncedCounter.js.map +0 -1
  289. package/lib/syncedObjects/index.js +0 -9
  290. package/lib/syncedObjects/index.js.map +0 -1
  291. package/lib/syncedObjects/object/index.js +0 -7
  292. package/lib/syncedObjects/object/index.js.map +0 -1
  293. package/lib/syncedObjects/object/interface.js +0 -6
  294. package/lib/syncedObjects/object/interface.js.map +0 -1
  295. package/lib/syncedObjects/object/syncedObject.js +0 -41
  296. package/lib/syncedObjects/object/syncedObject.js.map +0 -1
  297. package/lib/syncedObjects/string/index.js +0 -7
  298. package/lib/syncedObjects/string/index.js.map +0 -1
  299. package/lib/syncedObjects/string/interface.js +0 -6
  300. package/lib/syncedObjects/string/interface.js.map +0 -1
  301. package/lib/syncedObjects/string/syncedString.js +0 -48
  302. package/lib/syncedObjects/string/syncedString.js.map +0 -1
  303. package/lib/useReducerFluid.js +0 -196
  304. package/lib/useReducerFluid.js.map +0 -1
  305. package/lib/useStateFluid.js +0 -44
  306. package/lib/useStateFluid.js.map +0 -1
  307. package/src/createContextFluid.tsx +0 -33
  308. package/src/helpers/generateFluidObjectSchema.ts +0 -95
  309. package/src/helpers/getFluidFromView.ts +0 -38
  310. package/src/helpers/getFluidState.ts +0 -67
  311. package/src/helpers/getSchema.ts +0 -18
  312. package/src/helpers/getViewFromFluid.ts +0 -68
  313. package/src/helpers/index.tsx +0 -16
  314. package/src/helpers/initializeState.ts +0 -162
  315. package/src/helpers/internalInterface.ts +0 -16
  316. package/src/helpers/rootCallbackListener.ts +0 -104
  317. package/src/helpers/setComponentSchema.ts +0 -21
  318. package/src/helpers/setFluidState.ts +0 -116
  319. package/src/helpers/syncState.ts +0 -159
  320. package/src/helpers/updateStateAndFluidObjectMap.ts +0 -85
  321. package/src/helpers/utils.tsx +0 -109
  322. package/src/interface.ts +0 -617
  323. package/src/reactView.tsx +0 -108
  324. package/src/syncedDataObject.ts +0 -337
  325. package/src/syncedObjects/array/fluidSyncedArray.ts +0 -126
  326. package/src/syncedObjects/array/index.ts +0 -7
  327. package/src/syncedObjects/array/interface.ts +0 -45
  328. package/src/syncedObjects/array/syncedArray.ts +0 -65
  329. package/src/syncedObjects/counter/fluidSyncedCounter.ts +0 -122
  330. package/src/syncedObjects/counter/index.ts +0 -7
  331. package/src/syncedObjects/counter/interface.ts +0 -44
  332. package/src/syncedObjects/counter/syncedCounter.ts +0 -64
  333. package/src/syncedObjects/index.ts +0 -9
  334. package/src/syncedObjects/object/index.ts +0 -7
  335. package/src/syncedObjects/object/interface.ts +0 -14
  336. package/src/syncedObjects/object/syncedObject.ts +0 -55
  337. package/src/syncedObjects/string/index.ts +0 -7
  338. package/src/syncedObjects/string/interface.ts +0 -17
  339. package/src/syncedObjects/string/syncedString.ts +0 -61
  340. package/src/useReducerFluid.tsx +0 -436
  341. package/src/useStateFluid.tsx +0 -84
  342. package/tsconfig.esnext.json +0 -7
package/.eslintrc.cjs ADDED
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ module.exports = {
7
+ extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"],
8
+ parserOptions: {
9
+ project: ["./tsconfig.json", "./src/test/tsconfig.json"],
10
+ },
11
+ };
package/.mocharc.cjs ADDED
@@ -0,0 +1,15 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ "use strict";
7
+
8
+ const getFluidTestMochaConfig = require("@fluid-internal/mocha-test-setup/mocharc-common");
9
+
10
+ const config = getFluidTestMochaConfig(__dirname);
11
+ // TODO: figure out why this package needs the --exit flag, tests might not be cleaning up correctly after themselves.
12
+ // AB#7856
13
+ config.exit = true;
14
+
15
+ module.exports = config;
package/CHANGELOG.md ADDED
@@ -0,0 +1,282 @@
1
+ # @fluidframework/react
2
+
3
+ ## 2.62.0
4
+
5
+ ### Minor Changes
6
+
7
+ - The exports of @fluid-experimental/tree-react-api have been moved to the new @fluidframework/react package and placed under its /alpha exports ([#25542](https://github.com/microsoft/FluidFramework/pull/25542)) [b388c7b7f1](https://github.com/microsoft/FluidFramework/commit/b388c7b7f18ba446f707b7eaea3caaf2c5bbaab5)
8
+
9
+ `@fluid-experimental/tree-react-api` has been adjusted to align with Fluid Framework's [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels).
10
+ It has been renamed to `@fluidframework/react` and all existing APIs are now available under `@fluidframework/react/alpha`.
11
+
12
+ Since this package was under `@fluid-experimental`, previously it implicitly made no guarantees.
13
+ Now all the APIs are `@alpha`, which also amounts to making no guarantees but makes it possible to promote APIs to `@beta` in the future to offer some stability.
14
+
15
+ To accommodate this change, all users of this package will need to adjust:
16
+
17
+ - Package dependencies from `"@fluid-experimental/tree-react-api"` to `"@fluidframework/react"`.
18
+ - Imports from `"@fluid-experimental/tree-react-api"` to `"@fluidframework/react/alpha"`.
19
+
20
+ - Added APIs for tracking observations of SharedTree content for automatic invalidation ([#25459](https://github.com/microsoft/FluidFramework/pull/25459)) [21d45d5948](https://github.com/microsoft/FluidFramework/commit/21d45d5948b961a82c77ed5154fc42e456d85ee4)
21
+
22
+ `TreeAlpha.trackObservations` and `TreeAlpha.trackObservationsOnce` have been added.
23
+ These provide a way to run some operation which reads content from [TreeNodes](https://fluidframework.com/docs/api/tree/treenode-class), then run a call back when anything observed by that operation changes.
24
+
25
+ This functionality has also been exposed in the form of React hooks and React higher order components via the `@fluid-experimental/tree-react-api` package.
26
+ It is now possible to use these utilities to implement React applications which pass TreeNodes in their props and get all necessary invalidation from tree changes handled automatically.
27
+ The recommended pattern for doing this is to use `treeDataObject` or `TreeViewComponent` at the root, then `withTreeObservations` or `withMemoizedTreeObservations` for any sub-components which read from TreeNodes.
28
+ Alternatively more localized changes can be made by using `PropNode` to type erase TreeNodes passed in props, then use one of the `usePropTreeNode` or `usePropTreeRecord` hooks to read from them.
29
+
30
+ These APIs work with both hydrated and [un-hydrated](https://fluidframework.com/docs/api/tree/unhydrated-typealias) TreeNodes.
31
+
32
+ #### React Support
33
+
34
+ Here is a simple example of a React components which has an invalidation bug due to reading a mutable field from a TreeNode that was provided in a prop:
35
+
36
+ ```typescript
37
+ const builder = new SchemaFactory("example");
38
+ class Item extends builder.object("Item", { text: SchemaFactory.string }) {}
39
+ const ItemComponentBug = ({ item }: { item: Item }): JSX.Element => (
40
+ <span>{item.text}</span> // Reading `text`, a mutable value from a React prop, causes an invalidation bug.
41
+ );
42
+ ```
43
+
44
+ This bug can now easily be fixed using `withTreeObservations` or `withMemoizedTreeObservations`:
45
+
46
+ ```typescript
47
+ const ItemComponent = withTreeObservations(
48
+ ({ item }: { item: Item }): JSX.Element => <span>{item.text}</span>,
49
+ );
50
+ ```
51
+
52
+ For components which take in TreeNodes, but merely forward them and do not read their properties, they can use `PropTreeNode` as shown:
53
+
54
+ ```typescript
55
+ const ItemParentComponent = ({ item }: { item: PropTreeNode<Item> }): JSX.Element => (
56
+ <ItemComponent item={item} />
57
+ );
58
+ ```
59
+
60
+ If such a component reads from the TreeNode, it gets a compile error instead of an invalidation bug.
61
+ In this case the invalidation bug would be that if `item.text` is modified, the component would not re-render.
62
+
63
+ ```typescript
64
+ const InvalidItemParentComponent = ({
65
+ item,
66
+ }: { item: PropTreeNode<Item> }): JSX.Element => (
67
+ // @ts-expect-error PropTreeNode turns this invalidation bug into a compile error
68
+ <span>{item.text}</span>
69
+ );
70
+ ```
71
+
72
+ To provide access to TreeNode content in only part of a component the `usePropTreeNode` or `usePropTreeRecord` hooks can be used.
73
+
74
+ #### TreeAlpha.trackObservationsOnce Examples
75
+
76
+ Here is a rather minimal example of how `TreeAlpha.trackObservationsOnce` can be used:
77
+
78
+ ```typescript
79
+ cachedFoo ??= TreeAlpha.trackObservationsOnce(
80
+ () => {
81
+ cachedFoo = undefined;
82
+ },
83
+ () => nodeA.someChild.bar + nodeB.someChild.baz,
84
+ ).result;
85
+ ```
86
+
87
+ That is equivalent to doing the following:
88
+
89
+ ```typescript
90
+ if (cachedFoo === undefined) {
91
+ cachedFoo = nodeA.someChild.bar + nodeB.someChild.baz;
92
+ const invalidate = (): void => {
93
+ cachedFoo = undefined;
94
+ for (const u of unsubscribe) {
95
+ u();
96
+ }
97
+ };
98
+ const unsubscribe: (() => void)[] = [
99
+ TreeBeta.on(nodeA, "nodeChanged", (data) => {
100
+ if (data.changedProperties.has("someChild")) {
101
+ invalidate();
102
+ }
103
+ }),
104
+ TreeBeta.on(nodeB, "nodeChanged", (data) => {
105
+ if (data.changedProperties.has("someChild")) {
106
+ invalidate();
107
+ }
108
+ }),
109
+ TreeBeta.on(nodeA.someChild, "nodeChanged", (data) => {
110
+ if (data.changedProperties.has("bar")) {
111
+ invalidate();
112
+ }
113
+ }),
114
+ TreeBeta.on(nodeB.someChild, "nodeChanged", (data) => {
115
+ if (data.changedProperties.has("baz")) {
116
+ invalidate();
117
+ }
118
+ }),
119
+ ];
120
+ }
121
+ ```
122
+
123
+ Here is more complete example showing how to use `TreeAlpha.trackObservationsOnce` invalidate a property derived from its tree fields.
124
+
125
+ ```typescript
126
+ const factory = new SchemaFactory("com.example");
127
+ class Vector extends factory.object("Vector", {
128
+ x: SchemaFactory.number,
129
+ y: SchemaFactory.number,
130
+ }) {
131
+ #length: number | undefined = undefined;
132
+ public length(): number {
133
+ if (this.#length === undefined) {
134
+ const result = TreeAlpha.trackObservationsOnce(
135
+ () => {
136
+ this.#length = undefined;
137
+ },
138
+ () => Math.hypot(this.x, this.y),
139
+ );
140
+ this.#length = result.result;
141
+ }
142
+ return this.#length;
143
+ }
144
+ }
145
+ const vec = new Vector({ x: 3, y: 4 });
146
+ assert.equal(vec.length(), 5);
147
+ vec.x = 0;
148
+ assert.equal(vec.length(), 4);
149
+ ```
150
+
151
+ ## 2.61.0
152
+
153
+ Dependency updates only.
154
+
155
+ ## 2.60.0
156
+
157
+ Dependency updates only.
158
+
159
+ ## 2.53.0
160
+
161
+ Dependency updates only.
162
+
163
+ ## 2.52.0
164
+
165
+ Dependency updates only.
166
+
167
+ ## 2.51.0
168
+
169
+ Dependency updates only.
170
+
171
+ ## 2.50.0
172
+
173
+ Dependency updates only.
174
+
175
+ ## 2.43.0
176
+
177
+ Dependency updates only.
178
+
179
+ ## 2.42.0
180
+
181
+ Dependency updates only.
182
+
183
+ ## 2.41.0
184
+
185
+ ### Minor Changes
186
+
187
+ - New experimental objectIdNumber API ([#21115](https://github.com/microsoft/FluidFramework/pull/21115)) [df2f139be8](https://github.com/microsoft/FluidFramework/commit/df2f139be8e8145d5eea313814cd6d35018cacee)
188
+
189
+ A new `objectIdNumber` has been added, which is useful when you need an identifier which corresponds to an object identity.
190
+ For example: when specifying a React "key" that corresponds to a `TreeNode`.
191
+
192
+ ## 2.40.0
193
+
194
+ Dependency updates only.
195
+
196
+ ## 2.33.0
197
+
198
+ Dependency updates only.
199
+
200
+ ## 2.32.0
201
+
202
+ Dependency updates only.
203
+
204
+ ## 2.31.0
205
+
206
+ ### Minor Changes
207
+
208
+ - Simplify experimental tree data object implementation ([#23943](https://github.com/microsoft/FluidFramework/pull/23943)) [00a56b79b3](https://github.com/microsoft/FluidFramework/commit/00a56b79b3ba517d56bbde4421fee0cdbfe8af95)
209
+
210
+ The experimental tree data object in `tree-react-api` has been simplified in a way that is incompatible with its previous version, which used `SharedDirectory` at the root.
211
+ The library now leverages a new data object that uses the `SharedTree` directly at the root.
212
+ In addition to breaking compatibility with existing documents, these changes include some related simplifications to the APIs which are also breaking:
213
+
214
+ - Removes the `key` property from the data object configuration.
215
+ This key was used to inform where the SharedTree was parented beneath the root SharedDirectory, so it no longer serves a purpose.
216
+ - Inlined the `ITreeDataObject` interface into `IReactTreeDataObject`.
217
+
218
+ ## 2.30.0
219
+
220
+ Dependency updates only.
221
+
222
+ ## 2.23.0
223
+
224
+ Dependency updates only.
225
+
226
+ ## 2.22.0
227
+
228
+ Dependency updates only.
229
+
230
+ ## 2.21.0
231
+
232
+ Dependency updates only.
233
+
234
+ ## 2.20.0
235
+
236
+ Dependency updates only.
237
+
238
+ ## 2.13.0
239
+
240
+ Dependency updates only.
241
+
242
+ ## 2.12.0
243
+
244
+ Dependency updates only.
245
+
246
+ ## 2.11.0
247
+
248
+ Dependency updates only.
249
+
250
+ ## 2.10.0
251
+
252
+ Dependency updates only.
253
+
254
+ ## 2.5.0
255
+
256
+ Dependency updates only.
257
+
258
+ ## 2.4.0
259
+
260
+ Dependency updates only.
261
+
262
+ ## 2.3.0
263
+
264
+ Dependency updates only.
265
+
266
+ ## 2.2.0
267
+
268
+ Dependency updates only.
269
+
270
+ ## 2.1.0
271
+
272
+ Dependency updates only.
273
+
274
+ ## 2.0.0-rc.5.0.0
275
+
276
+ ### Minor Changes
277
+
278
+ - Update to TypeScript 5.4 ([#21214](https://github.com/microsoft/FluidFramework/pull/21214)) [0e6256c722](https://github.com/microsoft/FluidFramework/commit/0e6256c722d8bf024f4325bf02547daeeb18bfa6)
279
+
280
+ Update package implementations to use TypeScript 5.4.5.
281
+
282
+ ## 2.0.0-rc.4.0.0