@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/README.md CHANGED
@@ -1,300 +1,149 @@
1
1
  # @fluidframework/react
2
2
 
3
- The Fluid Framework's React package enables React developers to quickly start building large, scalable React apps with synced views powered by Fluid data. It does this by providing a `SyncedDataObject`, Fluid React hooks and a base view class for building React views that use synced states provided by Fluid.
4
-
5
- Examples on how to use all of the different tools in this package can be found in the [clicker-react](../../../examples/data-objects/clicker-react) and [`likes-and-comments`](../../../examples/data-objects/likes-and-comments) folders under `./examples/data-object/` from the Fluid Framework repo root.
6
-
7
- A good general order of operations to follow when writing a `SyncedDataObject` implementation is the following:
8
- 1. Define the DDSes needed in the `SyncedDataObject`constructor. This can be done using the `set*Config` functions.
9
- 2. Fill in the `render(element: HTMLElement)` function with a call to `ReactDOM.render` and pass in a React view.
10
- 3. Build out the React view either using the `FluidReactView` class or as a functional view using the various hooks that are available.
11
-
12
- ## SyncedDataObject
13
-
14
- The ['SyncedDataObject'](./src/syncedDataObject.ts) is an extension of the Fluid `DataObject` class provided by the `@fluidframework/aqueduct` package. This will be the base class that users developing Fluid objects with React views will want to extend.
15
-
16
- The `SyncedDataObject` essentially acts as the data store for the React app that is rendered within it. It provides a configuration where we can set up the schema for our data store, and also guarantees that all the values defined in the configuration will be automatically initialized prior to the view rendering. It also ensures that all updates that were made in the data store for that session will be automatically restored when the app is loaded fresh again by another client for that session. Finally, and most importantly, it guarantees that all updates that are made in the data store are synced live with all other clients that are currently viewing this React app in the current session, without requiring event listeners or component lifecycle methods.
17
-
18
- `SyncedDataObject` uses the same factory as `DataObject`. However, in addition, it also provides the following functionality:
19
-
20
- - A `syncedStateConfig` where users can define the different types of values that they would like to see prepared for their view to consume. Values defined here are guaranteed to be initialized and available prior to `render` being called. Here, users can assign the DDSes that their React views will need by using the pre-built helper functions available to them from the `syncedObjects` folder, i.e. `setSyncedStringConfig`, `setSyncedArrayConfig`, etc. or they can manually define their own unique configuration with `this.setConfig`. Each value set on the config will have its own `syncedStateId` which we will use to refer to the prepared value from the view.
21
-
22
- - An implementation of `IFluidHTMLView` where users fill in the `render` function and the `IFluidHTMLView` interface is already fulfilled without any further code. The React view used in the `render` function should pass in the synced data object for the view to use.
23
-
24
- - A `fluidObjectMap` that guarantees that all Fluid DDSes/objects used by this `SyncedDataObject` will be automatically created and loaded without the need for component lifecycle methods such as `initializeStateFirstTime` and `initializeStateFromExisting`
25
-
26
- #### SyncedDataObject Example
27
-
28
- ```jsx
29
- export class LikesAndComments extends SyncedDataObject {
30
- constructor(props) {
31
- super(props);
32
- // Adds a synced counter to config under ID 'likes'
33
- setSyncedCounterConfig(
34
- this,
35
- "likes",
36
- );
37
- // Adds a synced array to config under ID 'comments'
38
- setSyncedArrayConfig<IComment>(
39
- this,
40
- "comments",
41
- );
42
- // Adds a synced string to config under ID 'imgUrl'
43
- setSyncedStringConfig(
44
- this,
45
- "imgUrl",
46
- defaultImgUrl,
47
- );
48
- }
49
-
50
- // Renders the React view
51
- public render(div: HTMLElement) {
52
- ReactDOM.render(
53
- <div>
54
- <LikesAndCommentsView
55
- syncedDataObject={this}
56
- />
57
- </div>,
58
- div,
59
- );
60
- return div;
61
- }
62
- }
63
- ```
3
+ Utilities for integrating content powered by the Fluid Framework into [React](https://react.dev/) applications.
64
4
 
65
- ## syncedObject Hooks
66
-
67
- The [synced Objects folder](./src/syncedObjects) contains a collection of setSynced\*Config helper function and useSynced\* hook pairings. These functions allow you to easily start using the DDSes that were prepared in the `syncedDataObject`. Since these are all wrappers around the `React.useState` hook, with added syncing functionality, simply calling these functions using regular React hook rules will automatically convert the function into a React functional view.
68
-
69
- Each of these helper & hook pairings take a Fluid DDS and binds them to the `syncedDataObject` under the unique `syncedStateId`. This ensures that any changes that happen on these DDSes see synced updates show up live on all connected React views.
70
-
71
- A single `syncedDataObject` can hold multiple different types of DDSes and other `DataObjects` under different `syncedStateIds`. However, each unique ID is exclusive to the type of value that is set there when using the helper & hook pairs.
72
-
73
- The current roster of available helper & hook pairs for different DDSes are:
74
- - For just setting type T objects on a `SharedMap` -> `useSyncedObject<T>` & `setSyncedObjectConfig<T>`
75
- - `SharedCounter` -> `useSyncedCounter` & `setSyncedCounterConfig`
76
- - `SharedObjectSequence` -> `useSyncedArray<T>` & `setSyncedArrayConfig`
77
- - `SharedString` -> `useSyncedString` & `setSyncedStringConfig`
78
-
79
- NOTE: IT IS IMPORTANT TO PICK THE RIGHT DDS.
80
-
81
- While it may be tempting to use `useSyncedObject` for any type T object, a SharedMap has different syncing logic from a SharedString, SharedObjectSequence, etc. Therefore, passing a string to be set on a SharedMap is not the same as using a SharedString. The latter contains additional logic that allows people to, for example, type on the same word together without overwriting one another's characters. Please use `useSyncedString` for these scenarios. The SharedMap, on the other hand, is useful for having a distributed dictionary of items that are always in sync based on the values being set on the map.
82
-
83
- ### syncedObject Hooks Example
84
-
85
- This example provides the view for the `syncedDataObject` in the example above.
86
-
87
- ```jsx
88
- function LikesAndCommentsView(
89
- props: ILikesAndCommentsViewProps,
90
- ) {
91
- // Use the synced states that were prepared on our syncedDataObject above using the setSynced*Config helper functions. Note that the useSynced* function and the ID passed in correspond to the how the config was set above. These values are guaranteed to be available in the view
92
- const [likes, likesReducer] = useSyncedCounter(props.syncedDataObject, "likes");
93
- const [comments, commentReducer] = useSyncedArray<IComment>(props.syncedDataObject, "comments");
94
- const [imgUrl, setImgUrl] = useSyncedString(props.syncedDataObject,"imgUrl");
95
-
96
- // Use local state for the comment as we don't want it to be synced until it is submitted
97
- const [currentComment, setCurrentComment] = React.useState("");
98
-
99
- // The remaining code is for rendering the React view elements themselves
100
-
101
- // Convert data to JSX for comments state
102
- const commentListItems = comments.map((item, key) => (
103
- <li key={key}>
104
- {`${item.author}: ${item.message}`}
105
- </li>
106
- ));
107
-
108
- // Render
109
- return (
110
- <div>
111
- <div>
112
- <img width='100%' src={imgUrl?.getText()}/>
113
- {imgUrl !== undefined
114
- ? <CollaborativeInput
115
- style={{ width: "90%" }}
116
- sharedString={imgUrl}
117
- onInput={(value: SharedString) => setImgUrl({ value })}
118
- />
119
- : undefined}
120
- </div>
121
- <span>
122
- {`Likes: ${likes}`}
123
- </span>
124
- <button onClick={() => likesReducer.increment(1)}>
125
- {"+"}
126
- </button>
127
- <div>
128
- <div>
129
- <input
130
- type="text"
131
- value={currentComment}
132
- onChange={(e) => setCurrentComment(e.target.value)}
133
- placeholder="Add Comment"
134
- />
135
- <button
136
- onClick={() => {
137
- commentReducer.add({
138
- message: currentComment,
139
- author: getAuthorName(props.syncedDataObject),
140
- });
141
- setCurrentComment("");
142
- }}
143
- >{"Submit"}</button>
144
- </div>
145
- <ul>{commentListItems}</ul>
146
- </div>
147
- </div>
148
- );
149
- }
150
- ```
5
+ This package currently has some experimental APIs focused on integrating SharedTree content into React.
151
6
 
152
- Please note that for every different type of DDS that is used, the initial factory for the data object needs to be updated to include those dependencies. Each DDS only needs to be added to the factory dependency list once, regardless of how many different ways it is used.
153
-
154
- I.e. for the example above,
155
- ```jsx
156
- // ----- FACTORY SETUP -----
157
- export const LikesAndCommentsInstantiationFactory = new DataObjectFactory(
158
- "likes-and-comments",
159
- LikesAndComments,
160
- [
161
- SharedCounter.getFactory(),
162
- SharedObjectSequence.getFactory(),
163
- SharedString.getFactory(),
164
- ],
165
- {},
166
- );
167
- export const fluidExport = LikesAndCommentsInstantiationFactory;
168
- ```
7
+ ## Known Issues and Limitations
169
8
 
170
- These hooks should allow for general functionality to start users off building synced React views using Fluid DDSes. However, if users would like to set up their own custom relationships and configurations, we do also offer the `FluidReactView` base class that extends `React.Component` for classical views, and the `useStateFluid` and `useReducerFluid` hooks for functional views.
171
-
172
- ## FluidReactView
173
-
174
- This is the base level `FluidReactView` that offers a synced view state and a mapping between the view and synced state stored in the root. It allows users to set up their own unique relationships between the Fluid state, which is the data state that is being synced, and the view state, which extracts the synced data from the Fluid state in a format that is ready for consumption in the view. In many cases, these the Fluid and view state can be identical but, in more complex scenarios, it may be beneficial to have a cleaner view state that picks out the relevant values needed for the view from the Fluid state.
175
-
176
- To see an example of this, please take a look at the `@fluid-example/clicker-react` example. If we take a look at this example in parts, we can see how the `SyncedDataObject` that houses the view aligns with the `FluidReactView` that is rendered.
177
-
178
- Looking at the constructor, we see that a configuration is created under ID `clicker` containing a SharedCounter:
179
- ```jsx
180
- constructor(props) {
181
- super(props);
182
- // Mark the counter value in the state as a SharedCounter type and pass in its create function
183
- // so that it will be created on the first run and be available on our React state
184
- // We also mark the "incremented" event as we want to update the React state when the counter
185
- // is incremented to display the new value
186
- this.setConfig<ICounterState>(
187
- "clicker",
188
- {
189
- syncedStateId: "clicker",
190
- fluidToView: new Map([
191
- [
192
- "counter", {
193
- type: SharedCounter.name,
194
- viewKey: "counter",
195
- sharedObjectCreate: SharedCounter.create,
196
- listenedEvents: ["incremented"],
197
- },
198
- ],
199
- ]),
200
- defaultViewState: {},
201
- },
202
- );
203
- }
204
- ```
9
+ These are a mix of issues that were encountered when authoring this package, as well as limitations of this package.
205
10
 
206
- Each `FluidReactView` is bound to its unique state ID and will automatically re-render when any values within the synced state change, without needing any additional event listeners or component lifecycle methods. However, since we are defining our own custom relationships now, we are not limited to only one DDS/Fluid object per `syncedStateId` like we were with the helper & hook pairs above. We can define multiple different DDS/Fluid objects per `syncedStateId` by adding keys to the `fluidToView` map. If we wanted a second counter, the configuration would look like this:
207
-
208
- ```jsx
209
- this.setConfig<ICounterState>(
210
- "clicker",
211
- {
212
- syncedStateId: "clicker",
213
- fluidToView: new Map([
214
- [
215
- "counter", {
216
- type: SharedCounter.name,
217
- viewKey: "counter",
218
- sharedObjectCreate: SharedCounter.create,
219
- listenedEvents: ["incremented"],
220
- },
221
- "counter2", {
222
- type: SharedCounter.name,
223
- viewKey: "counter2",
224
- sharedObjectCreate: SharedCounter.create,
225
- listenedEvents: ["incremented"],
226
- },
227
- ],
228
- ]),
229
- defaultViewState: {},
230
- },
231
- );
232
- ```
11
+ Some of this logic would be useful for non-react applications: to avoid creating even more septate packages, that logic is not split into its own package.
12
+ If there is clear demand for this to be done, it might be done in the future.
233
13
 
234
- This is then passed to the `FluidReactView` in the render function with the `clicker` ID:
235
- ```jsx
236
- public render(element: HTMLElement) {
237
- ReactDOM.render(
238
- <CounterReactView
239
- syncedStateId={"clicker"}
240
- syncedDataObject={this}
241
- />,
242
- element,
243
- );
244
- return element;
245
- }
246
- ```
14
+ There is no service implementation agnostic client abstraction that can be referred to here (ex: shared by TinyliciousClient, AzureClient and OdspClient).
15
+ This makes documenting compatibility with that implicit common API difficult.
16
+ It also makes writing service agnostic code at that abstraction level harder.
17
+
18
+ There does not appear to be a local service implementation of the above mentioned abstraction, which makes testing the code in the package harder.
19
+
20
+ The commonly used boilerplate for setting up a ContainerSchema based application configures the dev-tools,
21
+ but currently can't be included in this package due to dependency layering issues.
22
+
23
+ <!-- AUTO-GENERATED-CONTENT:START (LIBRARY_README_HEADER) -->
247
24
 
248
- And now if we look at the view itself, we will see that the state is now pre-loaded with the SharedCounter under the key `counter`, as we defined in the synced state configuration.
249
-
250
- ```jsx
251
- class CounterReactView extends FluidReactView<CounterViewState, CounterFluidState> {
252
- constructor(props) {
253
- super(props);
254
- this.state = {};
255
- }
256
-
257
- render() {
258
- return (
259
- <div>
260
- <span className="value">
261
- {this.state.counter?.value}
262
- </span>
263
- <button onClick={() => { this.state.counter?.increment(1); }}>+</button>
264
- </div>
265
- );
266
- }
267
- }
25
+ <!-- prettier-ignore-start -->
26
+ <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
27
+
28
+ ## Using Fluid Framework libraries
29
+
30
+ When taking a dependency on a Fluid Framework library's public APIs, we recommend using a `^` (caret) version range, such as `^1.3.4`.
31
+ While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
32
+ library consumers should always prefer `^`.
33
+
34
+ If using any of Fluid Framework's unstable APIs (for example, its `beta` APIs), we recommend using a more constrained version range, such as `~`.
35
+
36
+ ## Installation
37
+
38
+ To get started, install the package by running the following command:
39
+
40
+ ```bash
41
+ npm i @fluidframework/react
268
42
  ```
269
43
 
270
- This state will automatically update for all clients when `counter?.increment(1)` is called, and trigger a re-render for everyone. No additional event listeners are required.
44
+ ## Importing from this package
45
+
46
+ This package leverages [package.json exports](https://nodejs.org/api/packages.html#exports) to separate its APIs by support level.
47
+ For more information on the related support guarantees, see [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels).
48
+
49
+ To access the `public` ([SemVer](https://semver.org/)) APIs, import via `@fluidframework/react` like normal.
50
+
51
+ To access the `beta` APIs, import via `@fluidframework/react/beta`.
52
+
53
+ To access the `alpha` APIs, import via `@fluidframework/react/alpha`.
54
+
55
+ ## API Documentation
56
+
57
+ API documentation for **@fluidframework/react** is available at <https://fluidframework.com/docs/apis/react>.
58
+
59
+ <!-- prettier-ignore-end -->
60
+
61
+ <!-- AUTO-GENERATED-CONTENT:END -->
62
+
63
+ <!-- AUTO-GENERATED-CONTENT:START (README_FOOTER) -->
64
+
65
+ <!-- prettier-ignore-start -->
66
+ <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
67
+
68
+ ## Minimum Client Requirements
69
+
70
+ These are the platform requirements for the current version of Fluid Framework Client Packages.
71
+ These requirements err on the side of being too strict since within a major version they can be relaxed over time, but not made stricter.
72
+ For Long Term Support (LTS) versions this can require supporting these platforms for several years.
73
+
74
+ It is likely that other configurations will work, but they are not supported: if they stop working, we do not consider that a bug.
75
+ If you would benefit from support for something not listed here, file an issue and the product team will evaluate your request.
76
+ When making such a request please include if the configuration already works (and thus the request is just that it becomes officially supported), or if changes are required to get it working.
77
+
78
+ ### Supported Runtimes
79
+
80
+ - NodeJs ^20.10.0 except that we will drop support for it [when NodeJs 20 loses its upstream support on 2026-04-30](https://github.com/nodejs/release#release-schedule), and will support a newer LTS version of NodeJS (22) at least 1 year before 20 is end-of-life. This same policy applies to NodeJS 22 when it is end of life (2027-04-30).
81
+ - Running Fluid in a Node.js environment with the `--no-experimental-fetch` flag is not supported.
82
+ - Modern browsers supporting the es2022 standard library: in response to asks we can add explicit support for using babel to polyfill to target specific standards or runtimes (meaning we can avoid/remove use of things that don't polyfill robustly, but otherwise target modern standards).
83
+
84
+ ### Supported Tools
85
+
86
+ - TypeScript 5.4:
87
+ - All [`strict`](https://www.typescriptlang.org/tsconfig) options are supported.
88
+ - [`strictNullChecks`](https://www.typescriptlang.org/tsconfig) is required.
89
+ - [Configuration options deprecated in 5.0](https://github.com/microsoft/TypeScript/issues/51909) are not supported.
90
+ - `exactOptionalPropertyTypes` is currently not fully supported.
91
+ If used, narrowing members of Fluid Framework types types using `in`, `Reflect.has`, `Object.hasOwn` or `Object.prototype.hasOwnProperty` should be avoided as they may incorrectly exclude `undefined` from the possible values in some cases.
92
+ - [webpack](https://webpack.js.org/) 5
93
+ - We are not intending to be prescriptive about what bundler to use.
94
+ Other bundlers which can handle ES Modules should work, but webpack is the only one we actively test.
95
+
96
+ ### Module Resolution
97
+
98
+ [`Node16`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution) resolution should be used with TypeScript compilerOptions to follow the [Node.js v12+ ESM Resolution and Loading algorithm](https://nodejs.github.io/nodejs.dev/en/api/v20/esm/#resolution-and-loading-algorithm).
99
+ Node10 resolution is not supported as it does not support Fluid Framework's API structuring pattern that is used to distinguish stable APIs from those that are in development.
100
+
101
+ ### Module Formats
102
+
103
+ - ES Modules:
104
+ ES Modules are the preferred way to consume our client packages (including in NodeJs) and consuming our client packages from ES Modules is fully supported.
105
+ - CommonJs:
106
+ Consuming our client packages as CommonJs is supported only in NodeJS and only for the cases listed below.
107
+ This is done to accommodate some workflows without good ES Module support.
108
+ If you have a workflow you would like included in this list, file an issue.
109
+ Once this list of workflows motivating CommonJS support is empty, we may drop support for CommonJS one year after notice of the change is posted here.
271
110
 
272
- If we wanted to access our second counter, we can simply do `this.state.counter2?.value`.
111
+ - Testing with Jest (which lacks [stable ESM support](https://jestjs.io/docs/ecmascript-modules) due to [unstable APIs in NodeJs](https://github.com/nodejs/node/issues/37648))
273
112
 
274
- ## useStateFluid
113
+ ## Contribution Guidelines
275
114
 
276
- This is analogous to the React view but as a functional hook. Users can similarly use the returned setState callback to perform synced updates to both their local and synced states.
115
+ There are many ways to [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid.
277
116
 
278
- Some of the `useSynced*` hooks that we discussed above use this underlying call to power their DDS-specifc behavior. It can also be used directly.
117
+ - Participate in Q&A in our [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
118
+ - [Submit bugs](https://github.com/microsoft/FluidFramework/issues) and help us verify fixes as they are checked in.
119
+ - Review the [source code changes](https://github.com/microsoft/FluidFramework/pulls).
120
+ - [Contribute bug fixes](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md).
279
121
 
280
- ## useReducerFluid
122
+ Detailed instructions for working in the repo can be found in the [Wiki](https://github.com/microsoft/FluidFramework/wiki).
281
123
 
282
- This is the hook of choice for larger-scale applications that require more complex mutations, need to work with multiple Fluid objects, and need to have a division between data and view models. Here, instead of having only the view state to manipulate, users have both the view state and the Fluid state, with the former containing primitives used for rendering and the latter containing Fluid views to manipulate data in a synced manner. This hook also introduces the concept of a local FluidObjectMap that stores and listens to changes on already fetched Fluid objects.
124
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
125
+ For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
283
126
 
127
+ This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
128
+ Use of these trademarks or logos must follow Microsoft’s [Trademark & Brand Guidelines](https://www.microsoft.com/trademarks).
129
+ Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
284
130
 
285
- Reducers offer ways of mutating the state whereas selectors offer ways of fetching data from other Fluid objects. When either involves the addition of new Fluid objects locally, these are added to the FluidObjectMap so that they can be accessed by the view synchronously.
131
+ ## Help
286
132
 
133
+ Not finding what you're looking for in this README? Check out [fluidframework.com](https://fluidframework.com/docs/).
287
134
 
288
- Any updates to the root state are converted to updates in the view using the provided fluidConverters in the fluidToView map, and vice versa. This allows changes locally to reflect on the root, and root changes to also be translated back to local state updates.
135
+ Still not finding what you're looking for? Please [file an issue](https://github.com/microsoft/FluidFramework/wiki/Submitting-Bugs-and-Feature-Requests).
289
136
 
290
- This is currently used to power the `useSyncedCounter` and `useSyncedArray` hook, and an example showcasing how to use it is coming soon.
137
+ Thank you!
291
138
 
292
- ## createContextFluid
139
+ ## Trademark
293
140
 
294
- This hook is for users who want to be able to easily create a context with provider and consumer that pass the root and initial state through their app.
141
+ This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
295
142
 
143
+ Use of these trademarks or logos must follow Microsoft's [Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
296
144
 
297
- This hook calls useStateFluid and returns the state and setState values back to be used as part of the initial values passed down by the provider and used by a consumer
145
+ Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
298
146
 
147
+ <!-- prettier-ignore-end -->
299
148
 
300
- Essentially, this allows that portion of the root state to be manipulated through different levels of a React app, giving apps the ability to have multiple different views manipulate the same data not only throughout the app but through all renders of the app on different clients
149
+ <!-- AUTO-GENERATED-CONTENT:END -->
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/dist/alpha.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/lib/alpha.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/dist/beta.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/lib/beta.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/lib/index.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/dist/public.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
4
+ "mainEntryPointFilePath": "<projectFolder>/lib/public.d.ts"
5
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "../../../common/build/build-common/api-extractor-lint.esm.primary.json"
4
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "@fluidframework/build-common/api-extractor-common.json"
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "../../../common/build/build-common/api-extractor-base.esm.no-legacy.json"
4
4
  }
@@ -0,0 +1,114 @@
1
+ ## Alpha API Report File for "@fluidframework/react"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ // @alpha @sealed
8
+ export interface IReactTreeDataObject<TSchema extends ImplicitFieldSchema> {
9
+ readonly config: TreeViewConfiguration<TSchema>;
10
+ readonly treeView: TreeView<TSchema>;
11
+ readonly TreeViewComponent: (props: TreeViewProps<TSchema>) => React_2.JSX.Element;
12
+ }
13
+
14
+ // @alpha @system
15
+ export type IsMappableObjectType<T, True = true, False = false, Mapped = {
16
+ [P in keyof T]: T[P];
17
+ }> = [Mapped] extends [T] ? ([T] extends [Mapped] ? True : False) : False;
18
+
19
+ // @alpha
20
+ export type NodeRecord = Record<string, TreeNode | TreeLeafValue>;
21
+
22
+ // @alpha
23
+ export function objectIdNumber(object: object): number;
24
+
25
+ // @alpha @input
26
+ export interface ObservationOptions {
27
+ onInvalidation?: () => void;
28
+ }
29
+
30
+ // @alpha
31
+ export interface PropTreeNode<T extends TreeNode> extends ErasedType<[T, "PropTreeNode"]> {
32
+ }
33
+
34
+ // @alpha
35
+ export type PropTreeNodeRecord = Record<string, TreeLeafValue | PropTreeNode<TreeNode> | undefined>;
36
+
37
+ // @alpha
38
+ export type PropTreeValue<T extends TreeNode | TreeLeafValue | undefined> = T extends TreeNode ? PropTreeNode<T> : T;
39
+
40
+ // @alpha
41
+ export interface SchemaIncompatibleProps {
42
+ readonly compatibility: SchemaCompatibilityStatus;
43
+ readonly upgradeSchema: () => void;
44
+ }
45
+
46
+ // @alpha
47
+ export function toPropTreeNode<T extends TreeNode | TreeLeafValue>(node: T): PropTreeValue<T>;
48
+
49
+ // @alpha
50
+ export function toPropTreeRecord<T extends NodeRecord>(node: T): WrapPropTreeNodeRecord<T>;
51
+
52
+ // @alpha
53
+ export function treeDataObject<TSchema extends ImplicitFieldSchema>(treeConfiguration: TreeViewConfiguration<TSchema>, createInitialTree: () => InsertableTreeFieldFromImplicitField<TSchema>): SharedObjectKind<IReactTreeDataObject<TSchema> & IFluidLoadable>;
54
+
55
+ // @alpha
56
+ export function TreeViewComponent<TSchema extends ImplicitFieldSchema>({ tree, viewComponent: ViewComponent, errorComponent, }: TreeViewProps<TSchema> & {
57
+ tree: Pick<IReactTreeDataObject<TSchema>, "treeView">;
58
+ }): React_2.JSX.Element;
59
+
60
+ // @alpha @input
61
+ export interface TreeViewProps<TSchema extends ImplicitFieldSchema> {
62
+ readonly errorComponent?: React_2.FC<SchemaIncompatibleProps>;
63
+ readonly viewComponent: React_2.FC<{
64
+ root: PropTreeValue<TreeFieldFromImplicitField<TSchema>>;
65
+ }>;
66
+ }
67
+
68
+ // @alpha
69
+ export type UnwrapPropTreeNode<T extends TreeLeafValue | PropTreeNode<TreeNode> | undefined> = T extends PropTreeNode<infer Node> ? Node : T;
70
+
71
+ // @alpha
72
+ export function unwrapPropTreeNode<T extends TreeNode | TreeLeafValue>(propNode: PropTreeValue<T> | T): T;
73
+
74
+ // @alpha
75
+ export type UnwrapPropTreeNodeRecord<T extends PropTreeNodeRecord> = {
76
+ readonly [P in keyof T]: UnwrapPropTreeNode<T[P]>;
77
+ };
78
+
79
+ // @alpha
80
+ export function unwrapPropTreeRecord<T extends PropTreeNodeRecord>(props: T): UnwrapPropTreeNodeRecord<T>;
81
+
82
+ // @alpha
83
+ export function usePropTreeNode<T extends TreeNode | TreeLeafValue, TResult>(propNode: PropTreeValue<T> | T, trackDuring: (node: T) => TResult): WrapNodes<TResult>;
84
+
85
+ // @alpha
86
+ export function usePropTreeRecord<const T extends PropTreeNodeRecord, TResult>(props: T, f: (node: UnwrapPropTreeNodeRecord<T>) => TResult): WrapNodes<TResult>;
87
+
88
+ // @alpha
89
+ export function useTree(subtreeRoot: TreeNode): number;
90
+
91
+ // @alpha
92
+ export function useTreeObservations<TResult>(trackDuring: () => TResult, options?: ObservationOptions): TResult;
93
+
94
+ // @alpha
95
+ export function withMemoizedTreeObservations<TIn>(component: React_2.FC<TIn>, options?: ObservationOptions & {
96
+ readonly propsAreEqual?: Parameters<typeof React_2.memo>[1];
97
+ }): React_2.MemoExoticComponent<ReturnType<typeof withTreeObservations<TIn>>>;
98
+
99
+ // @alpha
100
+ export function withTreeObservations<TIn>(component: React_2.FC<TIn>, options?: ObservationOptions): React_2.FC<TIn> & React_2.FC<WrapNodes<TIn>> & React_2.FC<TIn | WrapNodes<TIn>>;
101
+
102
+ // @alpha
103
+ export type WrapNodes<T> = T extends TreeNode ? PropTreeNode<T> : T extends readonly (infer U)[] ? readonly WrapNodes<U>[] : T extends infer U ? IsMappableObjectType<U, {
104
+ [P in keyof U]: WrapNodes<U[P]>;
105
+ } extends U ? U : {
106
+ [P in keyof U]: WrapNodes<U[P]>;
107
+ }, T> : T;
108
+
109
+ // @alpha
110
+ export type WrapPropTreeNodeRecord<T extends NodeRecord> = {
111
+ readonly [P in keyof T]: PropTreeValue<T[P]>;
112
+ };
113
+
114
+ ```
@@ -0,0 +1,7 @@
1
+ ## Beta API Report File for "@fluidframework/react"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ ```
@@ -0,0 +1,7 @@
1
+ ## Public API Report File for "@fluidframework/react"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ ```
package/biome.jsonc ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3
+ "extends": ["../../../biome.jsonc"]
4
+ }