@microsoft/live-share-react 2.0.0-internal.18 → 2.0.0-internal.19

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 (289) hide show
  1. package/README.md +6 -0
  2. package/bin/esm/live-hooks/useLiveCanvas.js +29 -30
  3. package/bin/esm/live-hooks/useLiveCanvas.js.map +1 -1
  4. package/bin/esm/live-hooks/useLiveEvent.js +6 -15
  5. package/bin/esm/live-hooks/useLiveEvent.js.map +1 -1
  6. package/bin/esm/live-hooks/useLiveFollowMode.js +25 -34
  7. package/bin/esm/live-hooks/useLiveFollowMode.js.map +1 -1
  8. package/bin/esm/live-hooks/useLivePresence.js +5 -14
  9. package/bin/esm/live-hooks/useLivePresence.js.map +1 -1
  10. package/bin/esm/live-hooks/useLiveState.js +4 -13
  11. package/bin/esm/live-hooks/useLiveState.js.map +1 -1
  12. package/bin/esm/live-hooks/useLiveTimer.js +22 -31
  13. package/bin/esm/live-hooks/useLiveTimer.js.map +1 -1
  14. package/bin/esm/live-hooks/useMediaSynchronizer.js +24 -33
  15. package/bin/esm/live-hooks/useMediaSynchronizer.js.map +1 -1
  16. package/bin/esm/providers/AzureProvider.js +22 -27
  17. package/bin/esm/providers/AzureProvider.js.map +1 -1
  18. package/bin/esm/providers/LiveShareProvider.js +20 -21
  19. package/bin/esm/providers/LiveShareProvider.js.map +1 -1
  20. package/bin/esm/shared-hooks/internals/tree-node-types.js +1 -1
  21. package/bin/esm/shared-hooks/internals/tree-node-types.js.map +1 -1
  22. package/bin/esm/shared-hooks/internals/tree-node-utils.js +2 -4
  23. package/bin/esm/shared-hooks/internals/tree-node-utils.js.map +1 -1
  24. package/bin/esm/shared-hooks/useDynamicDDS.js +3 -12
  25. package/bin/esm/shared-hooks/useDynamicDDS.js.map +1 -1
  26. package/bin/esm/shared-hooks/useSharedMap.js +1 -1
  27. package/bin/esm/shared-hooks/useSharedMap.js.map +1 -1
  28. package/bin/esm/shared-hooks/useSharedStateRegistry.js +13 -10
  29. package/bin/esm/shared-hooks/useSharedStateRegistry.js.map +1 -1
  30. package/bin/esm/shared-hooks/useSharedTree.js +4 -4
  31. package/bin/esm/shared-hooks/useSharedTree.js.map +1 -1
  32. package/bin/esm/types/FluidMap.d.ts +151 -0
  33. package/bin/esm/types/FluidMap.d.ts.map +1 -0
  34. package/bin/esm/types/FluidMap.js +24 -0
  35. package/bin/esm/types/FluidMap.js.map +1 -0
  36. package/bin/esm/types/ResultTypes.d.ts +15 -1
  37. package/bin/esm/types/ResultTypes.d.ts.map +1 -1
  38. package/bin/esm/utils/type-check.js +1 -1
  39. package/bin/esm/utils/type-check.js.map +1 -1
  40. package/package.json +11 -21
  41. package/src/types/FluidMap.ts +169 -0
  42. package/src/types/ResultTypes.ts +18 -1
  43. package/tsconfig.json +3 -4
  44. package/bin/cjs/index.d.ts +0 -7
  45. package/bin/cjs/index.d.ts.map +0 -1
  46. package/bin/cjs/index.js +0 -23
  47. package/bin/cjs/index.js.map +0 -1
  48. package/bin/cjs/interfaces/LiveInterfaceExtensions.d.ts +0 -26
  49. package/bin/cjs/interfaces/LiveInterfaceExtensions.d.ts.map +0 -1
  50. package/bin/cjs/interfaces/LiveInterfaceExtensions.js +0 -7
  51. package/bin/cjs/interfaces/LiveInterfaceExtensions.js.map +0 -1
  52. package/bin/cjs/interfaces/index.d.ts +0 -2
  53. package/bin/cjs/interfaces/index.d.ts.map +0 -1
  54. package/bin/cjs/interfaces/index.js +0 -18
  55. package/bin/cjs/interfaces/index.js.map +0 -1
  56. package/bin/cjs/internal/errors.d.ts +0 -41
  57. package/bin/cjs/internal/errors.d.ts.map +0 -1
  58. package/bin/cjs/internal/errors.js +0 -48
  59. package/bin/cjs/internal/errors.js.map +0 -1
  60. package/bin/cjs/internal/index.d.ts +0 -3
  61. package/bin/cjs/internal/index.d.ts.map +0 -1
  62. package/bin/cjs/internal/index.js +0 -19
  63. package/bin/cjs/internal/index.js.map +0 -1
  64. package/bin/cjs/internal/type-guards.d.ts +0 -11
  65. package/bin/cjs/internal/type-guards.d.ts.map +0 -1
  66. package/bin/cjs/internal/type-guards.js +0 -24
  67. package/bin/cjs/internal/type-guards.js.map +0 -1
  68. package/bin/cjs/live-hooks/index.d.ts +0 -8
  69. package/bin/cjs/live-hooks/index.d.ts.map +0 -1
  70. package/bin/cjs/live-hooks/index.js +0 -24
  71. package/bin/cjs/live-hooks/index.js.map +0 -1
  72. package/bin/cjs/live-hooks/useLiveCanvas.d.ts +0 -80
  73. package/bin/cjs/live-hooks/useLiveCanvas.d.ts.map +0 -1
  74. package/bin/cjs/live-hooks/useLiveCanvas.js +0 -244
  75. package/bin/cjs/live-hooks/useLiveCanvas.js.map +0 -1
  76. package/bin/cjs/live-hooks/useLiveEvent.d.ts +0 -59
  77. package/bin/cjs/live-hooks/useLiveEvent.d.ts.map +0 -1
  78. package/bin/cjs/live-hooks/useLiveEvent.js +0 -150
  79. package/bin/cjs/live-hooks/useLiveEvent.js.map +0 -1
  80. package/bin/cjs/live-hooks/useLiveFollowMode.d.ts +0 -163
  81. package/bin/cjs/live-hooks/useLiveFollowMode.d.ts.map +0 -1
  82. package/bin/cjs/live-hooks/useLiveFollowMode.js +0 -360
  83. package/bin/cjs/live-hooks/useLiveFollowMode.js.map +0 -1
  84. package/bin/cjs/live-hooks/useLivePresence.d.ts +0 -76
  85. package/bin/cjs/live-hooks/useLivePresence.d.ts.map +0 -1
  86. package/bin/cjs/live-hooks/useLivePresence.js +0 -170
  87. package/bin/cjs/live-hooks/useLivePresence.js.map +0 -1
  88. package/bin/cjs/live-hooks/useLiveState.d.ts +0 -66
  89. package/bin/cjs/live-hooks/useLiveState.d.ts.map +0 -1
  90. package/bin/cjs/live-hooks/useLiveState.js +0 -134
  91. package/bin/cjs/live-hooks/useLiveState.js.map +0 -1
  92. package/bin/cjs/live-hooks/useLiveTimer.d.ts +0 -80
  93. package/bin/cjs/live-hooks/useLiveTimer.d.ts.map +0 -1
  94. package/bin/cjs/live-hooks/useLiveTimer.js +0 -233
  95. package/bin/cjs/live-hooks/useLiveTimer.js.map +0 -1
  96. package/bin/cjs/live-hooks/useMediaSynchronizer.d.ts +0 -86
  97. package/bin/cjs/live-hooks/useMediaSynchronizer.d.ts.map +0 -1
  98. package/bin/cjs/live-hooks/useMediaSynchronizer.js +0 -301
  99. package/bin/cjs/live-hooks/useMediaSynchronizer.js.map +0 -1
  100. package/bin/cjs/package.json +0 -1
  101. package/bin/cjs/providers/AzureProvider.d.ts +0 -113
  102. package/bin/cjs/providers/AzureProvider.d.ts.map +0 -1
  103. package/bin/cjs/providers/AzureProvider.js +0 -127
  104. package/bin/cjs/providers/AzureProvider.js.map +0 -1
  105. package/bin/cjs/providers/LiveShareProvider.d.ts +0 -193
  106. package/bin/cjs/providers/LiveShareProvider.d.ts.map +0 -1
  107. package/bin/cjs/providers/LiveShareProvider.js +0 -205
  108. package/bin/cjs/providers/LiveShareProvider.js.map +0 -1
  109. package/bin/cjs/providers/index.d.ts +0 -3
  110. package/bin/cjs/providers/index.d.ts.map +0 -1
  111. package/bin/cjs/providers/index.js +0 -19
  112. package/bin/cjs/providers/index.js.map +0 -1
  113. package/bin/cjs/shared-hooks/index.d.ts +0 -7
  114. package/bin/cjs/shared-hooks/index.d.ts.map +0 -1
  115. package/bin/cjs/shared-hooks/index.js +0 -23
  116. package/bin/cjs/shared-hooks/index.js.map +0 -1
  117. package/bin/cjs/shared-hooks/internals/tree-node-constants.d.ts +0 -3
  118. package/bin/cjs/shared-hooks/internals/tree-node-constants.d.ts.map +0 -1
  119. package/bin/cjs/shared-hooks/internals/tree-node-constants.js +0 -6
  120. package/bin/cjs/shared-hooks/internals/tree-node-constants.js.map +0 -1
  121. package/bin/cjs/shared-hooks/internals/tree-node-types.d.ts +0 -10
  122. package/bin/cjs/shared-hooks/internals/tree-node-types.d.ts.map +0 -1
  123. package/bin/cjs/shared-hooks/internals/tree-node-types.js +0 -23
  124. package/bin/cjs/shared-hooks/internals/tree-node-types.js.map +0 -1
  125. package/bin/cjs/shared-hooks/internals/tree-node-utils.d.ts +0 -33
  126. package/bin/cjs/shared-hooks/internals/tree-node-utils.d.ts.map +0 -1
  127. package/bin/cjs/shared-hooks/internals/tree-node-utils.js +0 -193
  128. package/bin/cjs/shared-hooks/internals/tree-node-utils.js.map +0 -1
  129. package/bin/cjs/shared-hooks/useDynamicDDS.d.ts +0 -23
  130. package/bin/cjs/shared-hooks/useDynamicDDS.d.ts.map +0 -1
  131. package/bin/cjs/shared-hooks/useDynamicDDS.js +0 -87
  132. package/bin/cjs/shared-hooks/useDynamicDDS.js.map +0 -1
  133. package/bin/cjs/shared-hooks/useSharedMap.d.ts +0 -25
  134. package/bin/cjs/shared-hooks/useSharedMap.d.ts.map +0 -1
  135. package/bin/cjs/shared-hooks/useSharedMap.js +0 -134
  136. package/bin/cjs/shared-hooks/useSharedMap.js.map +0 -1
  137. package/bin/cjs/shared-hooks/useSharedState.d.ts +0 -22
  138. package/bin/cjs/shared-hooks/useSharedState.d.ts.map +0 -1
  139. package/bin/cjs/shared-hooks/useSharedState.js +0 -80
  140. package/bin/cjs/shared-hooks/useSharedState.js.map +0 -1
  141. package/bin/cjs/shared-hooks/useSharedStateRegistry.d.ts +0 -37
  142. package/bin/cjs/shared-hooks/useSharedStateRegistry.d.ts.map +0 -1
  143. package/bin/cjs/shared-hooks/useSharedStateRegistry.js +0 -120
  144. package/bin/cjs/shared-hooks/useSharedStateRegistry.js.map +0 -1
  145. package/bin/cjs/shared-hooks/useSharedTree.d.ts +0 -57
  146. package/bin/cjs/shared-hooks/useSharedTree.d.ts.map +0 -1
  147. package/bin/cjs/shared-hooks/useSharedTree.js +0 -123
  148. package/bin/cjs/shared-hooks/useSharedTree.js.map +0 -1
  149. package/bin/cjs/shared-hooks/useTreeNode.d.ts +0 -96
  150. package/bin/cjs/shared-hooks/useTreeNode.d.ts.map +0 -1
  151. package/bin/cjs/shared-hooks/useTreeNode.js +0 -135
  152. package/bin/cjs/shared-hooks/useTreeNode.js.map +0 -1
  153. package/bin/cjs/types/ActionTypes.d.ts +0 -112
  154. package/bin/cjs/types/ActionTypes.d.ts.map +0 -1
  155. package/bin/cjs/types/ActionTypes.js +0 -7
  156. package/bin/cjs/types/ActionTypes.js.map +0 -1
  157. package/bin/cjs/types/PropTypes.d.ts +0 -56
  158. package/bin/cjs/types/PropTypes.d.ts.map +0 -1
  159. package/bin/cjs/types/PropTypes.js +0 -7
  160. package/bin/cjs/types/PropTypes.js.map +0 -1
  161. package/bin/cjs/types/ResultTypes.d.ts +0 -334
  162. package/bin/cjs/types/ResultTypes.d.ts.map +0 -1
  163. package/bin/cjs/types/ResultTypes.js +0 -7
  164. package/bin/cjs/types/ResultTypes.js.map +0 -1
  165. package/bin/cjs/types/index.d.ts +0 -4
  166. package/bin/cjs/types/index.d.ts.map +0 -1
  167. package/bin/cjs/types/index.js +0 -20
  168. package/bin/cjs/types/index.js.map +0 -1
  169. package/bin/cjs/utils/index.d.ts +0 -2
  170. package/bin/cjs/utils/index.d.ts.map +0 -1
  171. package/bin/cjs/utils/index.js +0 -18
  172. package/bin/cjs/utils/index.js.map +0 -1
  173. package/bin/cjs/utils/type-check.d.ts +0 -15
  174. package/bin/cjs/utils/type-check.d.ts.map +0 -1
  175. package/bin/cjs/utils/type-check.js +0 -62
  176. package/bin/cjs/utils/type-check.js.map +0 -1
  177. package/bin/index.d.ts +0 -7
  178. package/bin/index.d.ts.map +0 -1
  179. package/bin/index.js +0 -7
  180. package/bin/index.js.map +0 -1
  181. package/bin/interfaces/LiveInterfaceExtensions.d.ts +0 -26
  182. package/bin/interfaces/LiveInterfaceExtensions.d.ts.map +0 -1
  183. package/bin/interfaces/LiveInterfaceExtensions.js +0 -6
  184. package/bin/interfaces/LiveInterfaceExtensions.js.map +0 -1
  185. package/bin/interfaces/index.d.ts +0 -2
  186. package/bin/interfaces/index.d.ts.map +0 -1
  187. package/bin/interfaces/index.js +0 -2
  188. package/bin/interfaces/index.js.map +0 -1
  189. package/bin/internal/errors.d.ts +0 -41
  190. package/bin/internal/errors.d.ts.map +0 -1
  191. package/bin/internal/errors.js +0 -42
  192. package/bin/internal/errors.js.map +0 -1
  193. package/bin/internal/index.d.ts +0 -3
  194. package/bin/internal/index.d.ts.map +0 -1
  195. package/bin/internal/index.js +0 -3
  196. package/bin/internal/index.js.map +0 -1
  197. package/bin/internal/type-guards.d.ts +0 -11
  198. package/bin/internal/type-guards.d.ts.map +0 -1
  199. package/bin/internal/type-guards.js +0 -20
  200. package/bin/internal/type-guards.js.map +0 -1
  201. package/bin/live-hooks/index.d.ts +0 -8
  202. package/bin/live-hooks/index.d.ts.map +0 -1
  203. package/bin/live-hooks/index.js +0 -8
  204. package/bin/live-hooks/index.js.map +0 -1
  205. package/bin/live-hooks/useLiveCanvas.d.ts +0 -29
  206. package/bin/live-hooks/useLiveCanvas.d.ts.map +0 -1
  207. package/bin/live-hooks/useLiveCanvas.js +0 -160
  208. package/bin/live-hooks/useLiveCanvas.js.map +0 -1
  209. package/bin/live-hooks/useLiveEvent.d.ts +0 -23
  210. package/bin/live-hooks/useLiveEvent.d.ts.map +0 -1
  211. package/bin/live-hooks/useLiveEvent.js +0 -108
  212. package/bin/live-hooks/useLiveEvent.js.map +0 -1
  213. package/bin/live-hooks/useLiveFollowMode.d.ts +0 -24
  214. package/bin/live-hooks/useLiveFollowMode.d.ts.map +0 -1
  215. package/bin/live-hooks/useLiveFollowMode.js +0 -211
  216. package/bin/live-hooks/useLiveFollowMode.js.map +0 -1
  217. package/bin/live-hooks/useLivePresence.d.ts +0 -26
  218. package/bin/live-hooks/useLivePresence.d.ts.map +0 -1
  219. package/bin/live-hooks/useLivePresence.js +0 -106
  220. package/bin/live-hooks/useLivePresence.js.map +0 -1
  221. package/bin/live-hooks/useLiveState.d.ts +0 -21
  222. package/bin/live-hooks/useLiveState.d.ts.map +0 -1
  223. package/bin/live-hooks/useLiveState.js +0 -83
  224. package/bin/live-hooks/useLiveState.js.map +0 -1
  225. package/bin/live-hooks/useLiveTimer.d.ts +0 -25
  226. package/bin/live-hooks/useLiveTimer.d.ts.map +0 -1
  227. package/bin/live-hooks/useLiveTimer.js +0 -172
  228. package/bin/live-hooks/useLiveTimer.js.map +0 -1
  229. package/bin/live-hooks/useMediaSynchronizer.d.ts +0 -25
  230. package/bin/live-hooks/useMediaSynchronizer.d.ts.map +0 -1
  231. package/bin/live-hooks/useMediaSynchronizer.js +0 -234
  232. package/bin/live-hooks/useMediaSynchronizer.js.map +0 -1
  233. package/bin/providers/AzureProvider.d.ts +0 -113
  234. package/bin/providers/AzureProvider.d.ts.map +0 -1
  235. package/bin/providers/AzureProvider.js +0 -119
  236. package/bin/providers/AzureProvider.js.map +0 -1
  237. package/bin/providers/LiveShareProvider.d.ts +0 -91
  238. package/bin/providers/LiveShareProvider.d.ts.map +0 -1
  239. package/bin/providers/LiveShareProvider.js +0 -95
  240. package/bin/providers/LiveShareProvider.js.map +0 -1
  241. package/bin/providers/index.d.ts +0 -3
  242. package/bin/providers/index.d.ts.map +0 -1
  243. package/bin/providers/index.js +0 -3
  244. package/bin/providers/index.js.map +0 -1
  245. package/bin/shared-hooks/index.d.ts +0 -5
  246. package/bin/shared-hooks/index.d.ts.map +0 -1
  247. package/bin/shared-hooks/index.js +0 -5
  248. package/bin/shared-hooks/index.js.map +0 -1
  249. package/bin/shared-hooks/useDynamicDDS.d.ts +0 -23
  250. package/bin/shared-hooks/useDynamicDDS.d.ts.map +0 -1
  251. package/bin/shared-hooks/useDynamicDDS.js +0 -72
  252. package/bin/shared-hooks/useDynamicDDS.js.map +0 -1
  253. package/bin/shared-hooks/useSharedMap.d.ts +0 -23
  254. package/bin/shared-hooks/useSharedMap.d.ts.map +0 -1
  255. package/bin/shared-hooks/useSharedMap.js +0 -114
  256. package/bin/shared-hooks/useSharedMap.js.map +0 -1
  257. package/bin/shared-hooks/useSharedState.d.ts +0 -22
  258. package/bin/shared-hooks/useSharedState.d.ts.map +0 -1
  259. package/bin/shared-hooks/useSharedState.js +0 -74
  260. package/bin/shared-hooks/useSharedState.js.map +0 -1
  261. package/bin/shared-hooks/useSharedStateRegistry.d.ts +0 -37
  262. package/bin/shared-hooks/useSharedStateRegistry.d.ts.map +0 -1
  263. package/bin/shared-hooks/useSharedStateRegistry.js +0 -105
  264. package/bin/shared-hooks/useSharedStateRegistry.js.map +0 -1
  265. package/bin/types/ActionTypes.d.ts +0 -112
  266. package/bin/types/ActionTypes.d.ts.map +0 -1
  267. package/bin/types/ActionTypes.js +0 -6
  268. package/bin/types/ActionTypes.js.map +0 -1
  269. package/bin/types/PropTypes.d.ts +0 -8
  270. package/bin/types/PropTypes.d.ts.map +0 -1
  271. package/bin/types/PropTypes.js +0 -6
  272. package/bin/types/PropTypes.js.map +0 -1
  273. package/bin/types/ResultTypes.d.ts +0 -302
  274. package/bin/types/ResultTypes.d.ts.map +0 -1
  275. package/bin/types/ResultTypes.js +0 -6
  276. package/bin/types/ResultTypes.js.map +0 -1
  277. package/bin/types/index.d.ts +0 -4
  278. package/bin/types/index.d.ts.map +0 -1
  279. package/bin/types/index.js +0 -4
  280. package/bin/types/index.js.map +0 -1
  281. package/bin/utils/index.d.ts +0 -2
  282. package/bin/utils/index.d.ts.map +0 -1
  283. package/bin/utils/index.js +0 -2
  284. package/bin/utils/index.js.map +0 -1
  285. package/bin/utils/type-check.d.ts +0 -15
  286. package/bin/utils/type-check.d.ts.map +0 -1
  287. package/bin/utils/type-check.js +0 -54
  288. package/bin/utils/type-check.js.map +0 -1
  289. package/tsconfig.cjs.json +0 -14
@@ -1,119 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- import React from "react";
12
- import { useSharedStateRegistry, } from "../shared-hooks";
13
- import { AzureTurboClient, } from "@microsoft/live-share-turbo";
14
- /**
15
- * @hidden
16
- */
17
- export const FluidContext = React.createContext({});
18
- /**
19
- * Hook to get the latest React context state for `FluidContext`.
20
- *
21
- * @remarks
22
- * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
23
- *
24
- * @returns current state of `LiveShareContext`
25
- */
26
- export const useFluidObjectsContext = () => {
27
- const context = React.useContext(FluidContext);
28
- if (!isFluidObjectsContext(context)) {
29
- throw new Error("@microsoft/live-share-react: attempting to use `useFluidObjectsContext()` from a component that is not a child of `<LiveShareProvider>` or `<AzureProvider>`.\nTo fix this error, ensure that you are only using Live Share hooks (e.g., `useLiveState`) from a child component of `<LiveShareProvider>` or `<AzureProvider>`.");
30
- }
31
- return context;
32
- };
33
- /**
34
- * React Context provider component for using Fluid data objects & joining/creating a Fluid document `AzureClient`.
35
- */
36
- export const AzureProvider = (props) => {
37
- var _a;
38
- const startedRef = React.useRef(false);
39
- const clientRef = React.useRef(new AzureTurboClient(props.clientOptions));
40
- const [results, setResults] = React.useState();
41
- const [joinError, setJoinError] = React.useState();
42
- const stateRegistryCallbacks = useSharedStateRegistry(results);
43
- /**
44
- * Get the container for a given containerId using AzureClient
45
- */
46
- const getContainer = React.useCallback((containerId, initialObjects) => __awaiter(void 0, void 0, void 0, function* () {
47
- return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
48
- try {
49
- const results = yield clientRef.current.getContainer(containerId, initialObjects);
50
- setResults(results);
51
- resolve(results);
52
- }
53
- catch (error) {
54
- if (error instanceof Error) {
55
- setJoinError(error);
56
- }
57
- reject(error);
58
- }
59
- }));
60
- }), [props.containerId, setResults]);
61
- /**
62
- * Create container callback to create a new container using AzureClient
63
- */
64
- const createContainer = React.useCallback((initialObjects, onInitializeContainer) => __awaiter(void 0, void 0, void 0, function* () {
65
- return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
66
- try {
67
- const results = yield clientRef.current.createContainer(initialObjects);
68
- if (onInitializeContainer) {
69
- onInitializeContainer(results.container);
70
- }
71
- const containerId = yield results.container.attach();
72
- window.location.hash = containerId;
73
- setResults(results);
74
- resolve(results);
75
- }
76
- catch (error) {
77
- if (error instanceof Error) {
78
- setJoinError(error);
79
- }
80
- reject(error);
81
- }
82
- }));
83
- }), [props.containerId, setResults]);
84
- /**
85
- * Joins a container if `props.joinOnLoad` is true and `props.containerId` is known. Creates a new container if `props.createOnLoad` is true
86
- * and `props.containerId` is not known.
87
- */
88
- React.useEffect(() => {
89
- var _a;
90
- // This hook should only be called once, so we use a ref to track if it has been called.
91
- // This is a workaround for the fact that useEffect is called twice on initial render in React V18.
92
- // We are not doing this here for backwards compatibility. View the README for more information.
93
- if (((_a = results === null || results === void 0 ? void 0 : results.container) === null || _a === void 0 ? void 0 : _a.connectionState) !== undefined ||
94
- startedRef.current)
95
- return;
96
- startedRef.current = true;
97
- if (props.containerId && props.joinOnLoad) {
98
- getContainer(props.containerId, props.initialObjects);
99
- }
100
- else if (!props.containerId && props.createOnLoad) {
101
- createContainer(props.initialObjects);
102
- }
103
- }, [
104
- (_a = results === null || results === void 0 ? void 0 : results.container) === null || _a === void 0 ? void 0 : _a.connectionState,
105
- props.containerId,
106
- props.createOnLoad,
107
- props.joinOnLoad,
108
- props.initialObjects,
109
- getContainer,
110
- createContainer,
111
- ]);
112
- return (_jsx(FluidContext.Provider, Object.assign({ value: Object.assign({ clientRef, container: results === null || results === void 0 ? void 0 : results.container, services: results === null || results === void 0 ? void 0 : results.services, joinError,
113
- createContainer,
114
- getContainer }, stateRegistryCallbacks) }, { children: props.children })));
115
- };
116
- function isFluidObjectsContext(value) {
117
- return !!(value === null || value === void 0 ? void 0 : value.clientRef);
118
- }
119
- //# sourceMappingURL=AzureProvider.js.map
@@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@ -1,91 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- import { IFluidContainer, LoadableObjectClassRecord } from "fluid-framework";
6
- import React from "react";
7
- import { ILiveShareClientOptions, ILiveShareHost, ILiveShareJoinResults, ITimestampProvider } from "@microsoft/live-share";
8
- /**
9
- * React Context provider values for `<LiveShareProvider>`.
10
- *
11
- * @remarks
12
- * To get the latest values, use the {@link useLiveShareContext} hook.
13
- * Use the {@link useFluidObjectsContext} hook for other relevant context values.
14
- */
15
- export interface ILiveShareContext {
16
- /**
17
- * True if the local user created the Fluid container
18
- */
19
- created: boolean;
20
- /**
21
- * True if connected to the Live Share container
22
- */
23
- joined: boolean;
24
- /**
25
- * An error that will be defined if there was a problem joining the container, or undefined if not.
26
- */
27
- joinError: Error | undefined;
28
- /**
29
- * Live Share timestamp provider. Can be used to `.getTimestamp()` for a global clock value.
30
- * This reference timestamp value should be fairly consistent for all users in the session.
31
- */
32
- timestampProvider: ITimestampProvider | undefined;
33
- /**
34
- * Join callback method for manually connecting to the Fluid container.
35
- *
36
- * @remarks
37
- * Use this callback if `joinOnLoad` is `false` or `undefined` in {@link ILiveShareProviderProps}.
38
- *
39
- * @param initialObjects Optional. The initial objects for the Fluid container schema.
40
- * @param onInitializeContainer Optional. Callback for when the container is first created.
41
- * @returns Promise with `ILiveShareJoinResults`, which includes the Fluid container
42
- */
43
- join: (initialObjects?: LoadableObjectClassRecord, onInitializeContainer?: (container: IFluidContainer) => void) => Promise<ILiveShareJoinResults>;
44
- }
45
- /**
46
- * @hidden
47
- */
48
- export declare const LiveShareContext: React.Context<ILiveShareContext>;
49
- /**
50
- * Hook to get the latest React context state for `LiveShareContext`.
51
- *
52
- * @remarks
53
- * This hook can only be used in a child component of `<LiveShareProvider>`.
54
- * See `useFluidObjectsContext` for other information related to the Live Share session, such as the `container`.
55
- *
56
- * @returns current state of `LiveShareContext`
57
- */
58
- export declare const useLiveShareContext: () => ILiveShareContext;
59
- /**
60
- * Prop types for {@link LiveShareProvider} component.
61
- */
62
- export interface ILiveShareProviderProps {
63
- /**
64
- * Optional. React children node for the React Context Provider
65
- */
66
- children?: React.ReactNode;
67
- /**
68
- * Optional. Options for initializing `LiveShareClient`.
69
- */
70
- clientOptions?: ILiveShareClientOptions;
71
- /**
72
- * Host to initialize `LiveShareClient` with.
73
- *
74
- * @remarks
75
- * If using the `LiveShareClient` class from `@microsoft/teams-js`, you must ensure that you have first called `teamsJs.app.initialize()` before calling `LiveShareClient.create()`.
76
- */
77
- host: ILiveShareHost;
78
- /**
79
- * The initial object schema to use when {@link joinOnLoad} is true.
80
- */
81
- initialObjects?: LoadableObjectClassRecord;
82
- /**
83
- * Optional. Flag to determine whether to join Fluid container on load.
84
- */
85
- joinOnLoad?: boolean;
86
- }
87
- /**
88
- * React Context provider component for using Live Share data objects & joining a Live Share session using `LiveShareClient`.
89
- */
90
- export declare const LiveShareProvider: React.FC<ILiveShareProviderProps>;
91
- //# sourceMappingURL=LiveShareProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LiveShareProvider.d.ts","sourceRoot":"","sources":["../../src/providers/LiveShareProvider.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACH,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACrB,MAAM,uBAAuB,CAAC;AAK/B;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,KAAK,GAAG,SAAS,CAAC;IAC7B;;;OAGG;IACH,iBAAiB,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAClD;;;;;;;;;OASG;IACH,IAAI,EAAE,CACF,cAAc,CAAC,EAAE,yBAAyB,EAC1C,qBAAqB,CAAC,EAAE,CAAC,SAAS,EAAE,eAAe,KAAK,IAAI,KAC3D,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACvC;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,kCAE5B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,QAAO,iBAQtC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC;;;;;OAKG;IACH,IAAI,EAAE,cAAc,CAAC;IACrB;;OAEG;IACH,cAAc,CAAC,EAAE,yBAAyB,CAAC;IAC3C;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAkG/D,CAAC"}
@@ -1,95 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- import React from "react";
12
- import { useSharedStateRegistry } from "../shared-hooks";
13
- import { FluidContext } from "./AzureProvider";
14
- import { LiveShareTurboClient } from "@microsoft/live-share-turbo";
15
- import { isITeamsJsSdkError } from "../internal";
16
- /**
17
- * @hidden
18
- */
19
- export const LiveShareContext = React.createContext({});
20
- /**
21
- * Hook to get the latest React context state for `LiveShareContext`.
22
- *
23
- * @remarks
24
- * This hook can only be used in a child component of `<LiveShareProvider>`.
25
- * See `useFluidObjectsContext` for other information related to the Live Share session, such as the `container`.
26
- *
27
- * @returns current state of `LiveShareContext`
28
- */
29
- export const useLiveShareContext = () => {
30
- const context = React.useContext(LiveShareContext);
31
- if (!isLiveShareContext(context)) {
32
- throw new Error("@microsoft/live-share-react: attempting to use `useLiveShareContext()` from a component that is not a child of `<LiveShareProvider>`.\nTo fix this error, ensure that you are only using Live Share hooks (e.g., `useLiveState`) from a child component of `<LiveShareProvider>`.");
33
- }
34
- return context;
35
- };
36
- /**
37
- * React Context provider component for using Live Share data objects & joining a Live Share session using `LiveShareClient`.
38
- */
39
- export const LiveShareProvider = (props) => {
40
- const startedRef = React.useRef(false);
41
- const clientRef = React.useRef(new LiveShareTurboClient(props.host, props.clientOptions));
42
- const [results, setResults] = React.useState();
43
- const [joinError, setJoinError] = React.useState();
44
- const stateRegistryCallbacks = useSharedStateRegistry(results);
45
- /**
46
- * Join container callback for joining the Live Share session
47
- */
48
- const join = React.useCallback((initialObjects, onInitializeContainer) => __awaiter(void 0, void 0, void 0, function* () {
49
- startedRef.current = true;
50
- const results = yield clientRef.current.join(initialObjects, onInitializeContainer);
51
- setResults(results);
52
- return results;
53
- }), []);
54
- /**
55
- * Joins the container on load if `props.joinOnLoad` is true
56
- */
57
- React.useEffect(() => {
58
- // This hook should only be called once, so we use a ref to track if it has been called.
59
- // This is a workaround for the fact that useEffect is called twice on initial render in React V18.
60
- // We are not doing this here for backwards compatibility. View the README for more information.
61
- if (results !== undefined || startedRef.current || !props.joinOnLoad)
62
- return;
63
- join(props.initialObjects).catch((error) => {
64
- var _a;
65
- console.error(error);
66
- if (error instanceof Error) {
67
- setJoinError(error);
68
- }
69
- else if (isITeamsJsSdkError(error)) {
70
- setJoinError(new Error(`[${error.errorCode}] ${(_a = error.message) !== null && _a !== void 0 ? _a : "An unknown error occurred while joining container."}`));
71
- }
72
- else if (typeof error == "string") {
73
- setJoinError(new Error(error));
74
- }
75
- else {
76
- setJoinError(new Error("LiveShareProvider: An unknown error occurred while joining container."));
77
- }
78
- });
79
- }, [results, props.joinOnLoad, props.initialObjects, join]);
80
- return (_jsx(LiveShareContext.Provider, Object.assign({ value: {
81
- created: !!(results === null || results === void 0 ? void 0 : results.created),
82
- timestampProvider: results === null || results === void 0 ? void 0 : results.timestampProvider,
83
- joined: !!(results === null || results === void 0 ? void 0 : results.container),
84
- joinError,
85
- join,
86
- } }, { children: _jsx(FluidContext.Provider, Object.assign({ value: Object.assign({ clientRef, container: results === null || results === void 0 ? void 0 : results.container, services: results === null || results === void 0 ? void 0 : results.services, joinError, getContainer: () => __awaiter(void 0, void 0, void 0, function* () {
87
- throw new Error("Cannot join new container through getContainer in LiveShareProvider");
88
- }), createContainer: () => __awaiter(void 0, void 0, void 0, function* () {
89
- throw new Error("Cannot create new container through createContainer in LiveShareProvider");
90
- }) }, stateRegistryCallbacks) }, { children: props.children })) })));
91
- };
92
- function isLiveShareContext(value) {
93
- return (typeof (value === null || value === void 0 ? void 0 : value.created) === "boolean" && typeof (value === null || value === void 0 ? void 0 : value.join) === "function");
94
- }
95
- //# sourceMappingURL=LiveShareProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LiveShareProvider.js","sourceRoot":"","sources":["../../src/providers/LiveShareProvider.tsx"],"names":[],"mappings":";;;;;;;;;;AAMA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAOzD,OAAO,EAAE,YAAY,EAA0B,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AA2CjD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CA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AAO,uBAAP,OAAO,CAAE,SAAS,EAC7B,QAAQ,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,EAC3B,SAAS,EACT,YAAY,EAAE,GAAS,EAAE;oBACrB,MAAM,IAAI,KAAK,CACX,qEAAqE,CACxE,CAAC;gBACN,CAAC,CAAA,EACD,eAAe,EAAE,GAAS,EAAE;oBACxB,MAAM,IAAI,KAAK,CACX,0EAA0E,CAC7E,CAAC;gBACN,CAAC,CAAA,IACE,sBAAsB,iBAG5B,KAAK,CAAC,QAAQ,IACK,IACA,CAC/B,CAAC;AACN,CAAC,CAAC;AAEF,SAAS,kBAAkB,CAAC,KAAU;IAClC,OAAO,CACH,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,CAAA,KAAK,SAAS,IAAI,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAA,KAAK,UAAU,CAC3E,CAAC;AACN,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from "./AzureProvider";
2
- export * from "./LiveShareProvider";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from "./AzureProvider";
2
- export * from "./LiveShareProvider";
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
@@ -1,5 +0,0 @@
1
- export * from "./useSharedState";
2
- export * from "./useSharedMap";
3
- export * from "./useDynamicDDS";
4
- export * from "./useSharedStateRegistry";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared-hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC"}
@@ -1,5 +0,0 @@
1
- export * from "./useSharedState";
2
- export * from "./useSharedMap";
3
- export * from "./useDynamicDDS";
4
- export * from "./useSharedStateRegistry";
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC"}
@@ -1,23 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- import { FluidObject, IFluidLoadable } from "@fluidframework/core-interfaces";
6
- import { LoadableObjectClass } from "fluid-framework";
7
- /**
8
- * Hook to gets or creates a DDS that corresponds to a given uniqueKey string.
9
- *
10
- * @remarks
11
- * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
12
- *
13
- * @template T Type of Fluid LoadableObjectClass type to load. Must conform to IFluidLoadable interface.
14
- * @param uniqueKey uniqueKey value for the data object
15
- * @param loadableObjectClass Fluid LoadableObjectClass<T> to create/load.
16
- * @param onFirstInitialize Optional. Callback function for when the DDS is first loaded
17
- * @returns the DDS object, which is of type T when loaded and undefined while loading
18
- */
19
- export declare function useDynamicDDS<T extends IFluidLoadable = FluidObject<any> & IFluidLoadable>(uniqueKey: string, loadableObjectClass: LoadableObjectClass<T>, onFirstInitialize?: (dds: T) => void): {
20
- dds: T | undefined;
21
- error: Error | undefined;
22
- };
23
- //# sourceMappingURL=useDynamicDDS.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDynamicDDS.d.ts","sourceRoot":"","sources":["../../src/shared-hooks/useDynamicDDS.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAE9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CACzB,CAAC,SAAS,cAAc,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,cAAc,EAE5D,SAAS,EAAE,MAAM,EACjB,mBAAmB,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAC3C,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,GACrC;IACC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC5B,CAkDA"}
@@ -1,72 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
- return new (P || (P = Promise))(function (resolve, reject) {
8
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
- step((generator = generator.apply(thisArg, _arguments || [])).next());
12
- });
13
- };
14
- import React from "react";
15
- import { useFluidObjectsContext } from "../providers";
16
- /**
17
- * Hook to gets or creates a DDS that corresponds to a given uniqueKey string.
18
- *
19
- * @remarks
20
- * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
21
- *
22
- * @template T Type of Fluid LoadableObjectClass type to load. Must conform to IFluidLoadable interface.
23
- * @param uniqueKey uniqueKey value for the data object
24
- * @param loadableObjectClass Fluid LoadableObjectClass<T> to create/load.
25
- * @param onFirstInitialize Optional. Callback function for when the DDS is first loaded
26
- * @returns the DDS object, which is of type T when loaded and undefined while loading
27
- */
28
- export function useDynamicDDS(uniqueKey, loadableObjectClass, onFirstInitialize) {
29
- const [dds, setDDS] = React.useState();
30
- const [error, setError] = React.useState();
31
- /**
32
- * Import container and DDS object register callbacks from AzureProvider.
33
- */
34
- const { container, clientRef } = useFluidObjectsContext();
35
- /**
36
- * Once container is available, this effect will register the setter method so that the DDS loaded
37
- * from `dynamicObjects` that matches `uniqueKey` can be passed back to this hook. If one does not yet exist,
38
- * a new DDS is automatically created. If multiple users try to create a DDS at the same time when this component first
39
- * mounts, `live-share-turbo` ensures it will ultimately self correct using last-writer wins.
40
- */
41
- React.useEffect(() => {
42
- if (container === undefined)
43
- return;
44
- let mounted = true;
45
- // Callback method to set the `initialData` into the map when the DDS is first created.
46
- const onGetDDS = () => __awaiter(this, void 0, void 0, function* () {
47
- try {
48
- const dds = yield clientRef.current.getDDS(uniqueKey, loadableObjectClass, onFirstInitialize);
49
- if (mounted) {
50
- setDDS(dds);
51
- }
52
- }
53
- catch (error) {
54
- if (error instanceof Error) {
55
- setError(error);
56
- }
57
- else {
58
- setError(new Error("useDynamicDDS: an unknown error occurred while getting the DDS"));
59
- }
60
- }
61
- });
62
- onGetDDS();
63
- return () => {
64
- mounted = false;
65
- };
66
- }, [container, uniqueKey, onFirstInitialize]);
67
- return {
68
- dds,
69
- error,
70
- };
71
- }
72
- //# sourceMappingURL=useDynamicDDS.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDynamicDDS.js","sourceRoot":"","sources":["../../src/shared-hooks/useDynamicDDS.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAGtD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAGzB,SAAiB,EACjB,mBAA2C,EAC3C,iBAAoC;IAKpC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAK,CAAC;IAC1C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAS,CAAC;IAClD;;OAEG;IACH,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,sBAAsB,EAAE,CAAC;IAE1D;;;;;OAKG;IACH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO;QACpC,IAAI,OAAO,GAAG,IAAI,CAAC;QACnB,uFAAuF;QACvF,MAAM,QAAQ,GAAG,GAAS,EAAE;YACxB,IAAI;gBACA,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,MAAM,CACtC,SAAS,EACT,mBAAmB,EACnB,iBAAiB,CACpB,CAAC;gBACF,IAAI,OAAO,EAAE;oBACT,MAAM,CAAC,GAAG,CAAC,CAAC;iBACf;aACJ;YAAC,OAAO,KAAc,EAAE;gBACrB,IAAI,KAAK,YAAY,KAAK,EAAE;oBACxB,QAAQ,CAAC,KAAK,CAAC,CAAC;iBACnB;qBAAM;oBACH,QAAQ,CACJ,IAAI,KAAK,CACL,gEAAgE,CACnE,CACJ,CAAC;iBACL;aACJ;QACL,CAAC,CAAA,CAAC;QACF,QAAQ,EAAE,CAAC;QACX,OAAO,GAAG,EAAE;YACR,OAAO,GAAG,KAAK,CAAC;QACpB,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAE9C,OAAO;QACH,GAAG;QACH,KAAK;KACR,CAAC;AACN,CAAC"}
@@ -1,23 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- import { IUseSharedMapResults, SharedMapInitialData } from "../types";
6
- /**
7
- * React hook for using a Fluid `SharedMap`.
8
- *
9
- * @remarks
10
- * The primary benefit of using the `useSharedMap` hook rather than the Fluid `SharedMap`
11
- * directly is that it integrates nicely with React state and automates repetitive tasks.
12
- * If you want to use `SharedMap` this hook creates directly, you can do that as well.
13
- * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
14
- *
15
- * @template TData Optional typing for objects stored in the SharedMap. Default is `any` type.
16
- * @param uniqueKey the unique key for the `SharedMap`. If one does not yet exist, a new `SharedMap`
17
- * will be created, otherwise it will use the existing one.
18
- * @param initialData a JS Map, entries array, or JSON object to insert into the `SharedMap` when creating
19
- * the DDS for the first time.
20
- * @returns stateful `map` entries, `setEntry` callback, `deleteEntry` callback, and the Fluid `sharedMap`.
21
- */
22
- export declare function useSharedMap<TData = any>(uniqueKey: string, initialData?: SharedMapInitialData<TData>): IUseSharedMapResults<TData>;
23
- //# sourceMappingURL=useSharedMap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSharedMap.d.ts","sourceRoot":"","sources":["../../src/shared-hooks/useSharedMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAStE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,KAAK,GAAG,GAAG,EACpC,SAAS,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,oBAAoB,CAAC,KAAK,CAAC,GAC1C,oBAAoB,CAAC,KAAK,CAAC,CAmG7B"}
@@ -1,114 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- import React from "react";
6
- import { isEntries, isJSON, isMap } from "../utils";
7
- import { useDynamicDDS } from "./useDynamicDDS";
8
- import { SharedMap } from "fluid-framework";
9
- import { useFluidObjectsContext } from "../providers";
10
- import { ActionContainerNotJoinedError, ActionLiveDataObjectUndefinedError, } from "../internal";
11
- /**
12
- * React hook for using a Fluid `SharedMap`.
13
- *
14
- * @remarks
15
- * The primary benefit of using the `useSharedMap` hook rather than the Fluid `SharedMap`
16
- * directly is that it integrates nicely with React state and automates repetitive tasks.
17
- * If you want to use `SharedMap` this hook creates directly, you can do that as well.
18
- * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
19
- *
20
- * @template TData Optional typing for objects stored in the SharedMap. Default is `any` type.
21
- * @param uniqueKey the unique key for the `SharedMap`. If one does not yet exist, a new `SharedMap`
22
- * will be created, otherwise it will use the existing one.
23
- * @param initialData a JS Map, entries array, or JSON object to insert into the `SharedMap` when creating
24
- * the DDS for the first time.
25
- * @returns stateful `map` entries, `setEntry` callback, `deleteEntry` callback, and the Fluid `sharedMap`.
26
- */
27
- export function useSharedMap(uniqueKey, initialData) {
28
- /**
29
- * Stateful readonly map (user facing) with most recent values from `SharedMap` and its setter method.
30
- */
31
- const [map, setMap] = React.useState(getInitialData(initialData));
32
- const onFirstInitialize = React.useCallback((newDDS) => {
33
- /**
34
- * Callback method to set the `initialData` into the map when the `SharedMap` is first created.
35
- * Only should be used as a prop to useDynamicDDS.
36
- */
37
- getInitialData(initialData).forEach((value, key) => {
38
- newDDS.set(key, value);
39
- });
40
- }, [initialData]);
41
- /**
42
- * User facing: dynamically load the SharedMap DDS for the given unique key.
43
- */
44
- const { dds: sharedMap } = useDynamicDDS(uniqueKey, SharedMap, onFirstInitialize);
45
- const { container } = useFluidObjectsContext();
46
- /**
47
- * User facing: set a value to the Fluid `SharedMap`.
48
- */
49
- const setEntry = React.useCallback((key, value) => {
50
- if (!container) {
51
- throw new ActionContainerNotJoinedError("sharedMap", "setEntry");
52
- }
53
- if (sharedMap === undefined) {
54
- throw new ActionLiveDataObjectUndefinedError("sharedMap", "setEntry");
55
- }
56
- sharedMap.set(key, value);
57
- }, [container, sharedMap]);
58
- /**
59
- * User facing: delete a value from the Fluid `SharedMap`.
60
- */
61
- const deleteEntry = React.useCallback((key) => {
62
- if (!container) {
63
- throw new ActionContainerNotJoinedError("sharedMap", "deleteEntry");
64
- }
65
- if (sharedMap === undefined) {
66
- throw new ActionLiveDataObjectUndefinedError("sharedMap", "deleteEntry");
67
- }
68
- sharedMap.delete(key);
69
- }, [container, sharedMap]);
70
- // Setup change listeners, initial values, etc.
71
- React.useEffect(() => {
72
- if (!sharedMap)
73
- return;
74
- // Register valueChanged listener for `SharedMap`.
75
- const onValueChanged = () => {
76
- setMap(new Map(sharedMap.entries()));
77
- };
78
- sharedMap.on("valueChanged", onValueChanged);
79
- // Get initial values from `SharedMap`.
80
- onValueChanged();
81
- return () => {
82
- // Cleanup on component unmount.
83
- sharedMap === null || sharedMap === void 0 ? void 0 : sharedMap.off("valueChanged", onValueChanged);
84
- };
85
- }, [sharedMap]);
86
- return {
87
- map,
88
- setEntry,
89
- deleteEntry,
90
- sharedMap,
91
- };
92
- }
93
- /**
94
- * Helper method for converting different initial data props into a Map<string, TData> to insert into the Fluid SharedMap
95
- * @template TData Optional typing for objects stored in the SharedMap. Default is `object` type.
96
- * @param initialData a JS Map, entries array, or JSON object.
97
- * @returns A Map<string, TData> with the entries provided.
98
- */
99
- function getInitialData(initialData) {
100
- if (isMap(initialData)) {
101
- return initialData;
102
- }
103
- else if (isEntries(initialData)) {
104
- return new Map(initialData);
105
- }
106
- else if (isJSON(initialData)) {
107
- const values = Object.keys(initialData).map((key) => {
108
- return [key, initialData[key]];
109
- });
110
- return new Map(values);
111
- }
112
- return new Map();
113
- }
114
- //# sourceMappingURL=useSharedMap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSharedMap.js","sourceRoot":"","sources":["../../src/shared-hooks/useSharedMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAA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AAW,CAAC,CAAC;KAC9C;SAAM,IAAI,MAAM,CAAC,WAAW,CAAC,EAAE;QAC5B,MAAM,MAAM,GAAiC,MAAM,CAAC,IAAI,CACpD,WAAW,CACd,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACV,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,GAAG,CAAgB,MAAM,CAAC,CAAC;KACzC;IACD,OAAO,IAAI,GAAG,EAAiB,CAAC;AACpC,CAAC"}
@@ -1,22 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- import { DisposeSharedStateAction, SetSharedStateAction } from "../types";
6
- /**
7
- * Inspired by React's `useState` hook, `useSharedState` makes it easy to synchronize state in your app.
8
- *
9
- * @remarks
10
- * Values set through this state is automatically attached to a `SharedMap` that the `AzureProvider`
11
- * creates. If you are synchronizing complex data structures that multiple users will be setting simultaneously,
12
- * consider using an optimized hook for your data structure (e.g., `useSharedMap`, `useSharedString`, etc.).
13
- * This hook can only be used in a child component of `<LiveShareProvider>` or `<AzureProvider>`.
14
- *
15
- * @template S Typing for objects stored associated with the `uniqueKey`.
16
- * @param uniqueKey the unique key for a `SharedMap`. If you use the same key for multiple components, those components will reference the same state.
17
- * @param initialState a default state for the `SharedMap`.
18
- *
19
- * @returns a stateful value, the function to update it, and an optional dispose method to delete it from the `SharedMap`.
20
- */
21
- export declare function useSharedState<S = any>(uniqueKey: string, initialState: S): [S, SetSharedStateAction<S>, DisposeSharedStateAction];
22
- //# sourceMappingURL=useSharedState.d.ts.map