@microsoft/live-share-react 1.3.1-preview.0 → 1.4.1-preview.0
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.
- package/bin/cjs/index.d.ts +7 -0
- package/bin/cjs/index.d.ts.map +1 -0
- package/bin/cjs/index.js +23 -0
- package/bin/cjs/index.js.map +1 -0
- package/bin/cjs/interfaces/LiveInterfaceExtensions.d.ts +26 -0
- package/bin/cjs/interfaces/LiveInterfaceExtensions.d.ts.map +1 -0
- package/bin/cjs/interfaces/LiveInterfaceExtensions.js +7 -0
- package/bin/cjs/interfaces/LiveInterfaceExtensions.js.map +1 -0
- package/bin/cjs/interfaces/index.d.ts +2 -0
- package/bin/cjs/interfaces/index.d.ts.map +1 -0
- package/bin/cjs/interfaces/index.js +18 -0
- package/bin/cjs/interfaces/index.js.map +1 -0
- package/bin/cjs/internal/errors.d.ts +41 -0
- package/bin/cjs/internal/errors.d.ts.map +1 -0
- package/bin/cjs/internal/errors.js +48 -0
- package/bin/cjs/internal/errors.js.map +1 -0
- package/bin/cjs/internal/index.d.ts +3 -0
- package/bin/cjs/internal/index.d.ts.map +1 -0
- package/bin/cjs/internal/index.js +19 -0
- package/bin/cjs/internal/index.js.map +1 -0
- package/bin/cjs/internal/type-guards.d.ts +11 -0
- package/bin/cjs/internal/type-guards.d.ts.map +1 -0
- package/bin/cjs/internal/type-guards.js +24 -0
- package/bin/cjs/internal/type-guards.js.map +1 -0
- package/bin/cjs/live-hooks/index.d.ts +8 -0
- package/bin/cjs/live-hooks/index.d.ts.map +1 -0
- package/bin/cjs/live-hooks/index.js +24 -0
- package/bin/cjs/live-hooks/index.js.map +1 -0
- package/bin/cjs/live-hooks/useLiveCanvas.d.ts +80 -0
- package/bin/cjs/live-hooks/useLiveCanvas.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLiveCanvas.js +244 -0
- package/bin/cjs/live-hooks/useLiveCanvas.js.map +1 -0
- package/bin/cjs/live-hooks/useLiveEvent.d.ts +59 -0
- package/bin/cjs/live-hooks/useLiveEvent.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLiveEvent.js +150 -0
- package/bin/cjs/live-hooks/useLiveEvent.js.map +1 -0
- package/bin/cjs/live-hooks/useLiveFollowMode.d.ts +163 -0
- package/bin/cjs/live-hooks/useLiveFollowMode.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLiveFollowMode.js +360 -0
- package/bin/cjs/live-hooks/useLiveFollowMode.js.map +1 -0
- package/bin/cjs/live-hooks/useLivePresence.d.ts +76 -0
- package/bin/cjs/live-hooks/useLivePresence.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLivePresence.js +170 -0
- package/bin/cjs/live-hooks/useLivePresence.js.map +1 -0
- package/bin/cjs/live-hooks/useLiveState.d.ts +66 -0
- package/bin/cjs/live-hooks/useLiveState.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLiveState.js +134 -0
- package/bin/cjs/live-hooks/useLiveState.js.map +1 -0
- package/bin/cjs/live-hooks/useLiveTimer.d.ts +80 -0
- package/bin/cjs/live-hooks/useLiveTimer.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useLiveTimer.js +233 -0
- package/bin/cjs/live-hooks/useLiveTimer.js.map +1 -0
- package/bin/cjs/live-hooks/useMediaSynchronizer.d.ts +86 -0
- package/bin/cjs/live-hooks/useMediaSynchronizer.d.ts.map +1 -0
- package/bin/cjs/live-hooks/useMediaSynchronizer.js +301 -0
- package/bin/cjs/live-hooks/useMediaSynchronizer.js.map +1 -0
- package/bin/cjs/package.json +1 -0
- package/bin/cjs/providers/AzureProvider.d.ts +113 -0
- package/bin/cjs/providers/AzureProvider.d.ts.map +1 -0
- package/bin/cjs/providers/AzureProvider.js +127 -0
- package/bin/cjs/providers/AzureProvider.js.map +1 -0
- package/bin/cjs/providers/LiveShareProvider.d.ts +193 -0
- package/bin/cjs/providers/LiveShareProvider.d.ts.map +1 -0
- package/bin/cjs/providers/LiveShareProvider.js +205 -0
- package/bin/cjs/providers/LiveShareProvider.js.map +1 -0
- package/bin/cjs/providers/index.d.ts +3 -0
- package/bin/cjs/providers/index.d.ts.map +1 -0
- package/bin/cjs/providers/index.js +19 -0
- package/bin/cjs/providers/index.js.map +1 -0
- package/bin/cjs/shared-hooks/index.d.ts +7 -0
- package/bin/cjs/shared-hooks/index.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/index.js +23 -0
- package/bin/cjs/shared-hooks/index.js.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-constants.d.ts +3 -0
- package/bin/cjs/shared-hooks/internals/tree-node-constants.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-constants.js +6 -0
- package/bin/cjs/shared-hooks/internals/tree-node-constants.js.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-types.d.ts +10 -0
- package/bin/cjs/shared-hooks/internals/tree-node-types.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-types.js +23 -0
- package/bin/cjs/shared-hooks/internals/tree-node-types.js.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-utils.d.ts +33 -0
- package/bin/cjs/shared-hooks/internals/tree-node-utils.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/internals/tree-node-utils.js +193 -0
- package/bin/cjs/shared-hooks/internals/tree-node-utils.js.map +1 -0
- package/bin/cjs/shared-hooks/useDynamicDDS.d.ts +23 -0
- package/bin/cjs/shared-hooks/useDynamicDDS.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useDynamicDDS.js +87 -0
- package/bin/cjs/shared-hooks/useDynamicDDS.js.map +1 -0
- package/bin/cjs/shared-hooks/useSharedMap.d.ts +25 -0
- package/bin/cjs/shared-hooks/useSharedMap.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useSharedMap.js +134 -0
- package/bin/cjs/shared-hooks/useSharedMap.js.map +1 -0
- package/bin/cjs/shared-hooks/useSharedState.d.ts +22 -0
- package/bin/cjs/shared-hooks/useSharedState.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useSharedState.js +80 -0
- package/bin/cjs/shared-hooks/useSharedState.js.map +1 -0
- package/bin/cjs/shared-hooks/useSharedStateRegistry.d.ts +37 -0
- package/bin/cjs/shared-hooks/useSharedStateRegistry.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useSharedStateRegistry.js +120 -0
- package/bin/cjs/shared-hooks/useSharedStateRegistry.js.map +1 -0
- package/bin/cjs/shared-hooks/useSharedTree.d.ts +57 -0
- package/bin/cjs/shared-hooks/useSharedTree.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useSharedTree.js +123 -0
- package/bin/cjs/shared-hooks/useSharedTree.js.map +1 -0
- package/bin/cjs/shared-hooks/useTreeNode.d.ts +96 -0
- package/bin/cjs/shared-hooks/useTreeNode.d.ts.map +1 -0
- package/bin/cjs/shared-hooks/useTreeNode.js +135 -0
- package/bin/cjs/shared-hooks/useTreeNode.js.map +1 -0
- package/bin/cjs/types/ActionTypes.d.ts +112 -0
- package/bin/cjs/types/ActionTypes.d.ts.map +1 -0
- package/bin/cjs/types/ActionTypes.js +7 -0
- package/bin/cjs/types/ActionTypes.js.map +1 -0
- package/bin/cjs/types/PropTypes.d.ts +56 -0
- package/bin/cjs/types/PropTypes.d.ts.map +1 -0
- package/bin/cjs/types/PropTypes.js +7 -0
- package/bin/cjs/types/PropTypes.js.map +1 -0
- package/bin/cjs/types/ResultTypes.d.ts +334 -0
- package/bin/cjs/types/ResultTypes.d.ts.map +1 -0
- package/bin/cjs/types/ResultTypes.js +7 -0
- package/bin/cjs/types/ResultTypes.js.map +1 -0
- package/bin/cjs/types/index.d.ts +4 -0
- package/bin/cjs/types/index.d.ts.map +1 -0
- package/bin/cjs/types/index.js +20 -0
- package/bin/cjs/types/index.js.map +1 -0
- package/bin/cjs/utils/index.d.ts +2 -0
- package/bin/cjs/utils/index.d.ts.map +1 -0
- package/bin/cjs/utils/index.js +18 -0
- package/bin/cjs/utils/index.js.map +1 -0
- package/bin/cjs/utils/type-check.d.ts +15 -0
- package/bin/cjs/utils/type-check.d.ts.map +1 -0
- package/bin/cjs/utils/type-check.js +62 -0
- package/bin/cjs/utils/type-check.js.map +1 -0
- package/bin/esm/index.d.ts +7 -0
- package/bin/esm/index.d.ts.map +1 -0
- package/bin/esm/index.js +7 -0
- package/bin/esm/index.js.map +1 -0
- package/bin/esm/interfaces/LiveInterfaceExtensions.d.ts +26 -0
- package/bin/esm/interfaces/LiveInterfaceExtensions.d.ts.map +1 -0
- package/bin/esm/interfaces/LiveInterfaceExtensions.js +6 -0
- package/bin/esm/interfaces/LiveInterfaceExtensions.js.map +1 -0
- package/bin/esm/interfaces/index.d.ts +2 -0
- package/bin/esm/interfaces/index.d.ts.map +1 -0
- package/bin/esm/interfaces/index.js +2 -0
- package/bin/esm/interfaces/index.js.map +1 -0
- package/bin/esm/internal/errors.d.ts +41 -0
- package/bin/esm/internal/errors.d.ts.map +1 -0
- package/bin/esm/internal/errors.js +42 -0
- package/bin/esm/internal/errors.js.map +1 -0
- package/bin/esm/internal/index.d.ts +3 -0
- package/bin/esm/internal/index.d.ts.map +1 -0
- package/bin/esm/internal/index.js +3 -0
- package/bin/esm/internal/index.js.map +1 -0
- package/bin/esm/internal/type-guards.d.ts +11 -0
- package/bin/esm/internal/type-guards.d.ts.map +1 -0
- package/bin/esm/internal/type-guards.js +20 -0
- package/bin/esm/internal/type-guards.js.map +1 -0
- package/bin/esm/live-hooks/index.d.ts +8 -0
- package/bin/esm/live-hooks/index.d.ts.map +1 -0
- package/bin/esm/live-hooks/index.js +8 -0
- package/bin/esm/live-hooks/index.js.map +1 -0
- package/bin/esm/live-hooks/useLiveCanvas.d.ts +80 -0
- package/bin/esm/live-hooks/useLiveCanvas.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLiveCanvas.js +238 -0
- package/bin/esm/live-hooks/useLiveCanvas.js.map +1 -0
- package/bin/esm/live-hooks/useLiveEvent.d.ts +59 -0
- package/bin/esm/live-hooks/useLiveEvent.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLiveEvent.js +144 -0
- package/bin/esm/live-hooks/useLiveEvent.js.map +1 -0
- package/bin/esm/live-hooks/useLiveFollowMode.d.ts +163 -0
- package/bin/esm/live-hooks/useLiveFollowMode.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLiveFollowMode.js +354 -0
- package/bin/esm/live-hooks/useLiveFollowMode.js.map +1 -0
- package/bin/esm/live-hooks/useLivePresence.d.ts +76 -0
- package/bin/esm/live-hooks/useLivePresence.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLivePresence.js +164 -0
- package/bin/esm/live-hooks/useLivePresence.js.map +1 -0
- package/bin/esm/live-hooks/useLiveState.d.ts +66 -0
- package/bin/esm/live-hooks/useLiveState.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLiveState.js +128 -0
- package/bin/esm/live-hooks/useLiveState.js.map +1 -0
- package/bin/esm/live-hooks/useLiveTimer.d.ts +80 -0
- package/bin/esm/live-hooks/useLiveTimer.d.ts.map +1 -0
- package/bin/esm/live-hooks/useLiveTimer.js +227 -0
- package/bin/esm/live-hooks/useLiveTimer.js.map +1 -0
- package/bin/esm/live-hooks/useMediaSynchronizer.d.ts +86 -0
- package/bin/esm/live-hooks/useMediaSynchronizer.d.ts.map +1 -0
- package/bin/esm/live-hooks/useMediaSynchronizer.js +295 -0
- package/bin/esm/live-hooks/useMediaSynchronizer.js.map +1 -0
- package/bin/esm/providers/AzureProvider.d.ts +113 -0
- package/bin/esm/providers/AzureProvider.d.ts.map +1 -0
- package/bin/esm/providers/AzureProvider.js +119 -0
- package/bin/esm/providers/AzureProvider.js.map +1 -0
- package/bin/esm/providers/LiveShareProvider.d.ts +193 -0
- package/bin/esm/providers/LiveShareProvider.d.ts.map +1 -0
- package/bin/esm/providers/LiveShareProvider.js +197 -0
- package/bin/esm/providers/LiveShareProvider.js.map +1 -0
- package/bin/esm/providers/index.d.ts +3 -0
- package/bin/esm/providers/index.d.ts.map +1 -0
- package/bin/esm/providers/index.js +3 -0
- package/bin/esm/providers/index.js.map +1 -0
- package/bin/esm/shared-hooks/index.d.ts +7 -0
- package/bin/esm/shared-hooks/index.d.ts.map +1 -0
- package/bin/esm/shared-hooks/index.js +7 -0
- package/bin/esm/shared-hooks/index.js.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-constants.d.ts +3 -0
- package/bin/esm/shared-hooks/internals/tree-node-constants.d.ts.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-constants.js +3 -0
- package/bin/esm/shared-hooks/internals/tree-node-constants.js.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-types.d.ts +10 -0
- package/bin/esm/shared-hooks/internals/tree-node-types.d.ts.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-types.js +18 -0
- package/bin/esm/shared-hooks/internals/tree-node-types.js.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-utils.d.ts +33 -0
- package/bin/esm/shared-hooks/internals/tree-node-utils.d.ts.map +1 -0
- package/bin/esm/shared-hooks/internals/tree-node-utils.js +188 -0
- package/bin/esm/shared-hooks/internals/tree-node-utils.js.map +1 -0
- package/bin/esm/shared-hooks/useDynamicDDS.d.ts +23 -0
- package/bin/esm/shared-hooks/useDynamicDDS.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useDynamicDDS.js +81 -0
- package/bin/esm/shared-hooks/useDynamicDDS.js.map +1 -0
- package/bin/esm/shared-hooks/useSharedMap.d.ts +25 -0
- package/bin/esm/shared-hooks/useSharedMap.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useSharedMap.js +128 -0
- package/bin/esm/shared-hooks/useSharedMap.js.map +1 -0
- package/bin/esm/shared-hooks/useSharedState.d.ts +22 -0
- package/bin/esm/shared-hooks/useSharedState.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useSharedState.js +74 -0
- package/bin/esm/shared-hooks/useSharedState.js.map +1 -0
- package/bin/esm/shared-hooks/useSharedStateRegistry.d.ts +37 -0
- package/bin/esm/shared-hooks/useSharedStateRegistry.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useSharedStateRegistry.js +113 -0
- package/bin/esm/shared-hooks/useSharedStateRegistry.js.map +1 -0
- package/bin/esm/shared-hooks/useSharedTree.d.ts +57 -0
- package/bin/esm/shared-hooks/useSharedTree.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useSharedTree.js +117 -0
- package/bin/esm/shared-hooks/useSharedTree.js.map +1 -0
- package/bin/esm/shared-hooks/useTreeNode.d.ts +96 -0
- package/bin/esm/shared-hooks/useTreeNode.d.ts.map +1 -0
- package/bin/esm/shared-hooks/useTreeNode.js +132 -0
- package/bin/esm/shared-hooks/useTreeNode.js.map +1 -0
- package/bin/esm/types/ActionTypes.d.ts +112 -0
- package/bin/esm/types/ActionTypes.d.ts.map +1 -0
- package/bin/esm/types/ActionTypes.js +6 -0
- package/bin/esm/types/ActionTypes.js.map +1 -0
- package/bin/esm/types/PropTypes.d.ts +56 -0
- package/bin/esm/types/PropTypes.d.ts.map +1 -0
- package/bin/esm/types/PropTypes.js +6 -0
- package/bin/esm/types/PropTypes.js.map +1 -0
- package/bin/esm/types/ResultTypes.d.ts +334 -0
- package/bin/esm/types/ResultTypes.d.ts.map +1 -0
- package/bin/esm/types/ResultTypes.js +6 -0
- package/bin/esm/types/ResultTypes.js.map +1 -0
- package/bin/esm/types/index.d.ts +4 -0
- package/bin/esm/types/index.d.ts.map +1 -0
- package/bin/esm/types/index.js +4 -0
- package/bin/esm/types/index.js.map +1 -0
- package/bin/esm/utils/index.d.ts +2 -0
- package/bin/esm/utils/index.d.ts.map +1 -0
- package/bin/esm/utils/index.js +2 -0
- package/bin/esm/utils/index.js.map +1 -0
- package/bin/esm/utils/type-check.d.ts +15 -0
- package/bin/esm/utils/type-check.d.ts.map +1 -0
- package/bin/esm/utils/type-check.js +54 -0
- package/bin/esm/utils/type-check.js.map +1 -0
- package/bin/internal/errors.d.ts +15 -0
- package/bin/internal/errors.d.ts.map +1 -1
- package/bin/internal/errors.js.map +1 -1
- package/bin/internal/type-guards.d.ts +5 -0
- package/bin/internal/type-guards.d.ts.map +1 -1
- package/bin/internal/type-guards.js +12 -0
- package/bin/internal/type-guards.js.map +1 -1
- package/bin/live-hooks/useLiveEvent.d.ts.map +1 -1
- package/bin/live-hooks/useLiveEvent.js +6 -0
- package/bin/live-hooks/useLiveEvent.js.map +1 -1
- package/bin/live-hooks/useLiveFollowMode.d.ts.map +1 -1
- package/bin/live-hooks/useLiveFollowMode.js +2 -4
- package/bin/live-hooks/useLiveFollowMode.js.map +1 -1
- package/bin/live-hooks/useLivePresence.d.ts.map +1 -1
- package/bin/live-hooks/useLivePresence.js +1 -3
- package/bin/live-hooks/useLivePresence.js.map +1 -1
- package/bin/live-hooks/useLiveState.d.ts.map +1 -1
- package/bin/live-hooks/useLiveState.js +4 -2
- package/bin/live-hooks/useLiveState.js.map +1 -1
- package/bin/live-hooks/useLiveTimer.d.ts.map +1 -1
- package/bin/live-hooks/useLiveTimer.js +4 -0
- package/bin/live-hooks/useLiveTimer.js.map +1 -1
- package/bin/providers/LiveShareProvider.d.ts.map +1 -1
- package/bin/providers/LiveShareProvider.js +8 -0
- package/bin/providers/LiveShareProvider.js.map +1 -1
- package/package.json +8 -8
- package/src/internal/errors.ts +16 -0
- package/src/internal/type-guards.ts +12 -0
- package/src/live-hooks/useLiveEvent.ts +6 -0
- package/src/live-hooks/useLiveFollowMode.ts +2 -3
- package/src/live-hooks/useLivePresence.ts +1 -2
- package/src/live-hooks/useLiveState.ts +4 -3
- package/src/live-hooks/useLiveTimer.ts +4 -0
- package/src/providers/LiveShareProvider.tsx +12 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
+
*/
|
|
5
|
+
import { ContainerSchema, IFluidContainer } 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: (fluidContainerSchema?: ContainerSchema, 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
|
+
* @example
|
|
59
|
+
```jsx
|
|
60
|
+
// LiveShareApp.jsx
|
|
61
|
+
import { LiveShareProvider } from "@microsoft/live-share-react";
|
|
62
|
+
import { LiveShareHost } from "@microsoft/teams-js";
|
|
63
|
+
|
|
64
|
+
const host = LiveShareHost.create();
|
|
65
|
+
|
|
66
|
+
export function LiveShareApp() {
|
|
67
|
+
// Call app.initialize() from teams-js before rendering LiveShareProvider
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<LiveShareProvider
|
|
71
|
+
joinOnLoad={true}
|
|
72
|
+
host={host}
|
|
73
|
+
>
|
|
74
|
+
<LiveShareLoader>
|
|
75
|
+
<LiveCheckbox />
|
|
76
|
+
</LiveShareLoader>
|
|
77
|
+
</LiveShareProvider>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// LiveShareLoader.jsx
|
|
82
|
+
import { useLiveShareContext } from "@microsoft/live-share-react";
|
|
83
|
+
|
|
84
|
+
export function LiveShareLoader({ children }) {
|
|
85
|
+
const { joined, joinError } = useLiveShareContext();
|
|
86
|
+
|
|
87
|
+
if (joinError) return <>{joinError.message}</>;
|
|
88
|
+
if (!joined) return <>Joining Live Share session...</>;
|
|
89
|
+
return <>{children}</>
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// LiveCheckbox.jsx
|
|
93
|
+
import { useLiveState } from "@microsoft/live-share-react";
|
|
94
|
+
|
|
95
|
+
export function LiveCheckbox() {
|
|
96
|
+
const [checked, setChecked] = useLiveState("MY-UNIQUE-ID", false);
|
|
97
|
+
return (
|
|
98
|
+
<input
|
|
99
|
+
type="checkbox"
|
|
100
|
+
checked={checked}
|
|
101
|
+
onChange={() => {
|
|
102
|
+
setChecked(!checked);
|
|
103
|
+
}}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
*/
|
|
109
|
+
export declare const useLiveShareContext: () => ILiveShareContext;
|
|
110
|
+
/**
|
|
111
|
+
* Prop types for {@link LiveShareProvider} component.
|
|
112
|
+
*/
|
|
113
|
+
export interface ILiveShareProviderProps {
|
|
114
|
+
/**
|
|
115
|
+
* Optional. React children node for the React Context Provider
|
|
116
|
+
*/
|
|
117
|
+
children?: React.ReactNode;
|
|
118
|
+
/**
|
|
119
|
+
* Optional. Options for initializing `LiveShareClient`.
|
|
120
|
+
*/
|
|
121
|
+
clientOptions?: ILiveShareClientOptions;
|
|
122
|
+
/**
|
|
123
|
+
* Host to initialize `LiveShareClient` with.
|
|
124
|
+
*
|
|
125
|
+
* @remarks
|
|
126
|
+
* If using the `LiveShareClient` class from `@microsoft/teams-js`, you must ensure that you have first called `teamsJs.app.initialize()` before calling `LiveShareClient.create()`.
|
|
127
|
+
*/
|
|
128
|
+
host: ILiveShareHost;
|
|
129
|
+
/**
|
|
130
|
+
* The schema to use when {@link joinOnLoad} is true.
|
|
131
|
+
*/
|
|
132
|
+
fluidContainerSchema?: ContainerSchema;
|
|
133
|
+
/**
|
|
134
|
+
* Optional. Flag to determine whether to join Fluid container on load.
|
|
135
|
+
*/
|
|
136
|
+
joinOnLoad?: boolean;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* React Context provider component for using Live Share data objects & joining a Live Share session using `LiveShareClient`.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
```jsx
|
|
143
|
+
// LiveShareApp.jsx
|
|
144
|
+
import { LiveShareProvider } from "@microsoft/live-share-react";
|
|
145
|
+
import { LiveShareHost } from "@microsoft/teams-js";
|
|
146
|
+
|
|
147
|
+
const host = LiveShareHost.create();
|
|
148
|
+
|
|
149
|
+
export function LiveShareApp() {
|
|
150
|
+
// Call app.initialize() from teams-js before rendering LiveShareProvider
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<LiveShareProvider
|
|
154
|
+
joinOnLoad={true}
|
|
155
|
+
host={host}
|
|
156
|
+
>
|
|
157
|
+
<LiveShareLoader>
|
|
158
|
+
<LiveCheckbox />
|
|
159
|
+
</LiveShareLoader>
|
|
160
|
+
</LiveShareProvider>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// LiveShareLoader.jsx
|
|
165
|
+
import { useLiveShareContext } from "@microsoft/live-share-react";
|
|
166
|
+
|
|
167
|
+
export function LiveShareLoader({ children }) {
|
|
168
|
+
const { joined, joinError } = useLiveShareContext();
|
|
169
|
+
|
|
170
|
+
if (joinError) return <>{joinError.message}</>;
|
|
171
|
+
if (!joined) return <>Joining Live Share session...</>;
|
|
172
|
+
return <>{children}</>
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// LiveCheckbox.jsx
|
|
176
|
+
import { useLiveState } from "@microsoft/live-share-react";
|
|
177
|
+
|
|
178
|
+
export function LiveCheckbox() {
|
|
179
|
+
const [checked, setChecked] = useLiveState("MY-UNIQUE-ID", false);
|
|
180
|
+
return (
|
|
181
|
+
<input
|
|
182
|
+
type="checkbox"
|
|
183
|
+
checked={checked}
|
|
184
|
+
onChange={() => {
|
|
185
|
+
setChecked(!checked);
|
|
186
|
+
}}
|
|
187
|
+
/>
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
*/
|
|
192
|
+
export declare const LiveShareProvider: React.FC<ILiveShareProviderProps>;
|
|
193
|
+
//# sourceMappingURL=LiveShareProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveShareProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/LiveShareProvider.tsx"],"names":[],"mappings":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AE,CAAC,uBAAuB,CAkG/D,CAAC"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.LiveShareProvider = exports.useLiveShareContext = exports.LiveShareContext = void 0;
|
|
16
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const index_js_1 = require("../shared-hooks/index.js");
|
|
19
|
+
const live_share_1 = require("@microsoft/live-share");
|
|
20
|
+
const AzureProvider_js_1 = require("./AzureProvider.js");
|
|
21
|
+
const index_js_2 = require("../internal/index.js");
|
|
22
|
+
/**
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
exports.LiveShareContext = react_1.default.createContext({});
|
|
26
|
+
/**
|
|
27
|
+
* Hook to get the latest React context state for `LiveShareContext`.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* This hook can only be used in a child component of `<LiveShareProvider>`.
|
|
31
|
+
* See `useFluidObjectsContext` for other information related to the Live Share session, such as the `container`.
|
|
32
|
+
*
|
|
33
|
+
* @returns current state of `LiveShareContext`
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
```jsx
|
|
37
|
+
// LiveShareApp.jsx
|
|
38
|
+
import { LiveShareProvider } from "@microsoft/live-share-react";
|
|
39
|
+
import { LiveShareHost } from "@microsoft/teams-js";
|
|
40
|
+
|
|
41
|
+
const host = LiveShareHost.create();
|
|
42
|
+
|
|
43
|
+
export function LiveShareApp() {
|
|
44
|
+
// Call app.initialize() from teams-js before rendering LiveShareProvider
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<LiveShareProvider
|
|
48
|
+
joinOnLoad={true}
|
|
49
|
+
host={host}
|
|
50
|
+
>
|
|
51
|
+
<LiveShareLoader>
|
|
52
|
+
<LiveCheckbox />
|
|
53
|
+
</LiveShareLoader>
|
|
54
|
+
</LiveShareProvider>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// LiveShareLoader.jsx
|
|
59
|
+
import { useLiveShareContext } from "@microsoft/live-share-react";
|
|
60
|
+
|
|
61
|
+
export function LiveShareLoader({ children }) {
|
|
62
|
+
const { joined, joinError } = useLiveShareContext();
|
|
63
|
+
|
|
64
|
+
if (joinError) return <>{joinError.message}</>;
|
|
65
|
+
if (!joined) return <>Joining Live Share session...</>;
|
|
66
|
+
return <>{children}</>
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// LiveCheckbox.jsx
|
|
70
|
+
import { useLiveState } from "@microsoft/live-share-react";
|
|
71
|
+
|
|
72
|
+
export function LiveCheckbox() {
|
|
73
|
+
const [checked, setChecked] = useLiveState("MY-UNIQUE-ID", false);
|
|
74
|
+
return (
|
|
75
|
+
<input
|
|
76
|
+
type="checkbox"
|
|
77
|
+
checked={checked}
|
|
78
|
+
onChange={() => {
|
|
79
|
+
setChecked(!checked);
|
|
80
|
+
}}
|
|
81
|
+
/>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
*/
|
|
86
|
+
const useLiveShareContext = () => {
|
|
87
|
+
const context = react_1.default.useContext(exports.LiveShareContext);
|
|
88
|
+
if (!isLiveShareContext(context)) {
|
|
89
|
+
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>`.");
|
|
90
|
+
}
|
|
91
|
+
return context;
|
|
92
|
+
};
|
|
93
|
+
exports.useLiveShareContext = useLiveShareContext;
|
|
94
|
+
/**
|
|
95
|
+
* React Context provider component for using Live Share data objects & joining a Live Share session using `LiveShareClient`.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
```jsx
|
|
99
|
+
// LiveShareApp.jsx
|
|
100
|
+
import { LiveShareProvider } from "@microsoft/live-share-react";
|
|
101
|
+
import { LiveShareHost } from "@microsoft/teams-js";
|
|
102
|
+
|
|
103
|
+
const host = LiveShareHost.create();
|
|
104
|
+
|
|
105
|
+
export function LiveShareApp() {
|
|
106
|
+
// Call app.initialize() from teams-js before rendering LiveShareProvider
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<LiveShareProvider
|
|
110
|
+
joinOnLoad={true}
|
|
111
|
+
host={host}
|
|
112
|
+
>
|
|
113
|
+
<LiveShareLoader>
|
|
114
|
+
<LiveCheckbox />
|
|
115
|
+
</LiveShareLoader>
|
|
116
|
+
</LiveShareProvider>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// LiveShareLoader.jsx
|
|
121
|
+
import { useLiveShareContext } from "@microsoft/live-share-react";
|
|
122
|
+
|
|
123
|
+
export function LiveShareLoader({ children }) {
|
|
124
|
+
const { joined, joinError } = useLiveShareContext();
|
|
125
|
+
|
|
126
|
+
if (joinError) return <>{joinError.message}</>;
|
|
127
|
+
if (!joined) return <>Joining Live Share session...</>;
|
|
128
|
+
return <>{children}</>
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// LiveCheckbox.jsx
|
|
132
|
+
import { useLiveState } from "@microsoft/live-share-react";
|
|
133
|
+
|
|
134
|
+
export function LiveCheckbox() {
|
|
135
|
+
const [checked, setChecked] = useLiveState("MY-UNIQUE-ID", false);
|
|
136
|
+
return (
|
|
137
|
+
<input
|
|
138
|
+
type="checkbox"
|
|
139
|
+
checked={checked}
|
|
140
|
+
onChange={() => {
|
|
141
|
+
setChecked(!checked);
|
|
142
|
+
}}
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
*/
|
|
148
|
+
const LiveShareProvider = (props) => {
|
|
149
|
+
const startedRef = react_1.default.useRef(false);
|
|
150
|
+
const clientRef = react_1.default.useRef(new live_share_1.LiveShareClient(props.host, props.clientOptions));
|
|
151
|
+
const [results, setResults] = react_1.default.useState();
|
|
152
|
+
const [joinError, setJoinError] = react_1.default.useState();
|
|
153
|
+
const stateRegistryCallbacks = (0, index_js_1.useSharedStateRegistry)(results);
|
|
154
|
+
/**
|
|
155
|
+
* Join container callback for joining the Live Share session
|
|
156
|
+
*/
|
|
157
|
+
const join = react_1.default.useCallback((fluidContainerSchema, onInitializeContainer) => __awaiter(void 0, void 0, void 0, function* () {
|
|
158
|
+
startedRef.current = true;
|
|
159
|
+
const results = yield clientRef.current.join(fluidContainerSchema, onInitializeContainer);
|
|
160
|
+
setResults(results);
|
|
161
|
+
return results;
|
|
162
|
+
}), []);
|
|
163
|
+
/**
|
|
164
|
+
* Joins the container on load if `props.joinOnLoad` is true
|
|
165
|
+
*/
|
|
166
|
+
react_1.default.useEffect(() => {
|
|
167
|
+
// This hook should only be called once, so we use a ref to track if it has been called.
|
|
168
|
+
// This is a workaround for the fact that useEffect is called twice on initial render in React V18.
|
|
169
|
+
// We are not doing this here for backwards compatibility. View the README for more information.
|
|
170
|
+
if (results !== undefined || startedRef.current || !props.joinOnLoad)
|
|
171
|
+
return;
|
|
172
|
+
join(props.fluidContainerSchema).catch((error) => {
|
|
173
|
+
var _a;
|
|
174
|
+
console.error(error);
|
|
175
|
+
if (error instanceof Error) {
|
|
176
|
+
setJoinError(error);
|
|
177
|
+
}
|
|
178
|
+
else if ((0, index_js_2.isITeamsJsSdkError)(error)) {
|
|
179
|
+
setJoinError(new Error(`[${error.errorCode}] ${(_a = error.message) !== null && _a !== void 0 ? _a : "An unknown error occurred while joining container."}`));
|
|
180
|
+
}
|
|
181
|
+
else if (typeof error == "string") {
|
|
182
|
+
setJoinError(new Error(error));
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
setJoinError(new Error("LiveShareProvider: An unknown error occurred while joining container."));
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}, [results, props.joinOnLoad, props.fluidContainerSchema, join]);
|
|
189
|
+
return ((0, jsx_runtime_1.jsx)(exports.LiveShareContext.Provider, { value: {
|
|
190
|
+
created: !!(results === null || results === void 0 ? void 0 : results.created),
|
|
191
|
+
timestampProvider: results === null || results === void 0 ? void 0 : results.timestampProvider,
|
|
192
|
+
joined: !!(results === null || results === void 0 ? void 0 : results.container),
|
|
193
|
+
joinError,
|
|
194
|
+
join,
|
|
195
|
+
}, children: (0, jsx_runtime_1.jsx)(AzureProvider_js_1.FluidContext.Provider, { 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* () {
|
|
196
|
+
throw new Error("Cannot join new container through getContainer in LiveShareProvider");
|
|
197
|
+
}), createContainer: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
198
|
+
throw new Error("Cannot create new container through createContainer in LiveShareProvider");
|
|
199
|
+
}) }, stateRegistryCallbacks), children: props.children }) }));
|
|
200
|
+
};
|
|
201
|
+
exports.LiveShareProvider = LiveShareProvider;
|
|
202
|
+
function isLiveShareContext(value) {
|
|
203
|
+
return (typeof (value === null || value === void 0 ? void 0 : value.created) === "boolean" && typeof (value === null || value === void 0 ? void 0 : value.join) === "function");
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=LiveShareProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveShareProvider.js","sourceRoot":"","sources":["../../../src/providers/LiveShareProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAMA,kDAA0B;AAC1B,uDAAkE;AAClE,sDAM+B;AAC/B,yDAA0E;AAC1E,mDAA0D;AA2C1D;;GAEG;AACU,QAAA,gBAAgB,GAAG,eAAK,CAAC,aAAa,CAC/C,EAAuB,CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACI,MAAM,mBAAmB,GAAG,GAAsB,EAAE;IACvD,MAAM,OAAO,GAAG,eAAK,CAAC,UAAU,CAAC,wBAAgB,CAAC,CAAC;IACnD,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACX,mRAAmR,CACtR,CAAC;IACN,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AARW,QAAA,mBAAmB,uBAQ9B;AA+BF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACI,MAAM,iBAAiB,GAAsC,CAAC,KAAK,EAAE,EAAE;IAC1E,MAAM,UAAU,GAAG,eAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,SAAS,GAAG,eAAK,CAAC,MAAM,CAC1B,IAAI,4BAAe,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,CACvD,CAAC;IACF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,eAAK,CAAC,QAAQ,EAEzC,CAAC;IACJ,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,eAAK,CAAC,QAAQ,EAAqB,CAAC;IAEtE,MAAM,sBAA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.ts","sourceRoot":"","sources":["../../../src/providers/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AzureProvider.js"), exports);
|
|
18
|
+
__exportStar(require("./LiveShareProvider.js"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/providers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,yDAAuC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./useSharedState.js";
|
|
2
|
+
export * from "./useSharedMap.js";
|
|
3
|
+
export * from "./useDynamicDDS.js";
|
|
4
|
+
export * from "./useSharedStateRegistry.js";
|
|
5
|
+
export * from "./useSharedTree.js";
|
|
6
|
+
export * from "./useTreeNode.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared-hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useSharedState.js"), exports);
|
|
18
|
+
__exportStar(require("./useSharedMap.js"), exports);
|
|
19
|
+
__exportStar(require("./useDynamicDDS.js"), exports);
|
|
20
|
+
__exportStar(require("./useSharedStateRegistry.js"), exports);
|
|
21
|
+
__exportStar(require("./useSharedTree.js"), exports);
|
|
22
|
+
__exportStar(require("./useTreeNode.js"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared-hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,oDAAkC;AAClC,qDAAmC;AACnC,8DAA4C;AAC5C,qDAAmC;AACnC,mDAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-node-constants.d.ts","sourceRoot":"","sources":["../../../../src/shared-hooks/internals/tree-node-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAC/C,eAAO,MAAM,kBAAkB,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.proxiedChildrenKey = exports.rawTNodeKey = void 0;
|
|
4
|
+
exports.rawTNodeKey = "[[FluidTreeNode]]";
|
|
5
|
+
exports.proxiedChildrenKey = "[[FluidChildNodes]]";
|
|
6
|
+
//# sourceMappingURL=tree-node-constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-node-constants.js","sourceRoot":"","sources":["../../../../src/shared-hooks/internals/tree-node-constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,mBAAmB,CAAC;AAClC,QAAA,kBAAkB,GAAG,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TreeNode } from "fluid-framework";
|
|
2
|
+
import { proxiedChildrenKey, rawTNodeKey } from "./tree-node-constants.js";
|
|
3
|
+
export interface ICustomProxyHandler<TNode extends TreeNode = TreeNode> {
|
|
4
|
+
[rawTNodeKey]: TNode;
|
|
5
|
+
[proxiedChildrenKey]: Record<string, TreeNode>;
|
|
6
|
+
}
|
|
7
|
+
export declare function isProxy(value: any): value is typeof Proxy;
|
|
8
|
+
export declare function isCustomProxyHandler<TNode extends TreeNode = TreeNode>(value: any): value is ICustomProxyHandler<TNode>;
|
|
9
|
+
export declare function isTreeNode(value: any): value is TreeNode;
|
|
10
|
+
//# sourceMappingURL=tree-node-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-node-types.d.ts","sourceRoot":"","sources":["../../../../src/shared-hooks/internals/tree-node-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAQ,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE3E,MAAM,WAAW,mBAAmB,CAAC,KAAK,SAAS,QAAQ,GAAG,QAAQ;IAClE,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;IACrB,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CAClD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,OAAO,KAAK,CAEzD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,SAAS,QAAQ,GAAG,QAAQ,EAClE,KAAK,EAAE,GAAG,GACX,KAAK,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAErC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,QAAQ,CAOxD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isProxy = isProxy;
|
|
4
|
+
exports.isCustomProxyHandler = isCustomProxyHandler;
|
|
5
|
+
exports.isTreeNode = isTreeNode;
|
|
6
|
+
const fluid_framework_1 = require("fluid-framework");
|
|
7
|
+
const tree_node_constants_js_1 = require("./tree-node-constants.js");
|
|
8
|
+
function isProxy(value) {
|
|
9
|
+
return value && value["[[Handler]]"];
|
|
10
|
+
}
|
|
11
|
+
function isCustomProxyHandler(value) {
|
|
12
|
+
return (value === null || value === void 0 ? void 0 : value[tree_node_constants_js_1.rawTNodeKey]) !== undefined;
|
|
13
|
+
}
|
|
14
|
+
function isTreeNode(value) {
|
|
15
|
+
try {
|
|
16
|
+
fluid_framework_1.Tree.schema(value);
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
catch (_) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=tree-node-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-node-types.js","sourceRoot":"","sources":["../../../../src/shared-hooks/internals/tree-node-types.ts"],"names":[],"mappings":";;AAQA,0BAEC;AAED,oDAIC;AAED,gCAOC;AAzBD,qDAAiD;AACjD,qEAA2E;AAO3E,SAAgB,OAAO,CAAC,KAAU;IAC9B,OAAO,KAAK,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;AACzC,CAAC;AAED,SAAgB,oBAAoB,CAChC,KAAU;IAEV,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,oCAAW,CAAC,MAAK,SAAS,CAAC;AAC9C,CAAC;AAED,SAAgB,UAAU,CAAC,KAAU;IACjC,IAAI,CAAC;QACD,sBAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TreeNode } from "fluid-framework";
|
|
2
|
+
import { Dispatch, SetStateAction } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
* Build a proxied version of a node and set its value to the treeMap provided
|
|
6
|
+
*
|
|
7
|
+
* @param rawNode the raw proxy node exposed by Fluid
|
|
8
|
+
* @param treeMap a map where Fluid's proxy node is mapped to our proxied node
|
|
9
|
+
* @returns TNode instance
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildProxy<TNode extends TreeNode = TreeNode>(rawNode: TNode, treeMap: WeakMap<TreeNode, TreeNode>): TNode;
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
* Set up listeners for a given TreeNode.
|
|
15
|
+
* Will recursively call this function for all children nodes of each children until there are no more child nodes.
|
|
16
|
+
*
|
|
17
|
+
* @param parentRawNode raw parent node
|
|
18
|
+
* @param rootNodeForListener root node being listened to in useTreeNode
|
|
19
|
+
* @param treeMap a map where Fluid's proxy node is mapped to our proxied node
|
|
20
|
+
* @param unsubscribeListeners list of unsubscribe listeners, where we set the unsubscribe callbacks
|
|
21
|
+
* @param setProxyNode setter to set the root proxy node listened to in useTreeNode
|
|
22
|
+
*/
|
|
23
|
+
export declare function setUpListenersForNodeChildren<TNode extends TreeNode = TreeNode>(parentRawNode: TreeNode, rootNodeForListener: TreeNode, treeMap: WeakMap<TreeNode, TreeNode>, unsubscribeListeners: (() => void)[], setProxyNode: Dispatch<SetStateAction<TNode>>): void;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
* Fluid only knows how to work with their proxied version of a TreeNode.
|
|
27
|
+
* We store a reference to that node in our proxied instances so we can easily use it when working with Fluid APIs.
|
|
28
|
+
*
|
|
29
|
+
* @param node get the raw node from the proxy
|
|
30
|
+
* @returns the raw proxied node that Fluid expects
|
|
31
|
+
*/
|
|
32
|
+
export declare function getRawNode<TNode extends TreeNode | undefined = TreeNode>(node: TNode): TNode;
|
|
33
|
+
//# sourceMappingURL=tree-node-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-node-utils.d.ts","sourceRoot":"","sources":["../../../../src/shared-hooks/internals/tree-node-utils.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAQ,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAIjD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,SAAS,QAAQ,GAAG,QAAQ,EACxD,OAAO,EAAE,KAAK,EACd,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,GACrC,KAAK,CAwCP;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CACzC,KAAK,SAAS,QAAQ,GAAG,QAAQ,EAEjC,aAAa,EAAE,QAAQ,EACvB,mBAAmB,EAAE,QAAQ,EAC7B,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACpC,oBAAoB,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,EACpC,YAAY,EAAE,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,QAmChD;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,SAAS,QAAQ,GAAG,SAAS,GAAG,QAAQ,EACpE,IAAI,EAAE,KAAK,GACZ,KAAK,CAKP"}
|