@microsoft/live-share-react 1.0.0-preview.12 → 1.0.0-preview.13
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/README.md +3 -3
- package/bin/index.d.ts +6 -6
- package/bin/index.js +6 -6
- package/bin/interfaces/LiveInterfaceExtensions.d.ts +8 -8
- package/bin/interfaces/LiveInterfaceExtensions.js +5 -5
- package/bin/interfaces/index.d.ts +1 -1
- package/bin/interfaces/index.js +1 -1
- package/bin/internal-hooks/index.d.ts +1 -1
- package/bin/internal-hooks/index.js +1 -1
- package/bin/internal-hooks/useSharedStateRegistry.d.ts +30 -30
- package/bin/internal-hooks/useSharedStateRegistry.d.ts.map +1 -1
- package/bin/internal-hooks/useSharedStateRegistry.js +101 -99
- package/bin/internal-hooks/useSharedStateRegistry.js.map +1 -1
- package/bin/live-hooks/index.d.ts +6 -6
- package/bin/live-hooks/index.js +6 -6
- package/bin/live-hooks/useLiveCanvas.d.ts +27 -27
- package/bin/live-hooks/useLiveCanvas.js +158 -158
- package/bin/live-hooks/useLiveEvent.d.ts +21 -21
- package/bin/live-hooks/useLiveEvent.d.ts.map +1 -1
- package/bin/live-hooks/useLiveEvent.js +92 -85
- package/bin/live-hooks/useLiveEvent.js.map +1 -1
- package/bin/live-hooks/useLivePresence.d.ts +25 -25
- package/bin/live-hooks/useLivePresence.d.ts.map +1 -1
- package/bin/live-hooks/useLivePresence.js +101 -92
- package/bin/live-hooks/useLivePresence.js.map +1 -1
- package/bin/live-hooks/useLiveState.d.ts +19 -18
- package/bin/live-hooks/useLiveState.d.ts.map +1 -1
- package/bin/live-hooks/useLiveState.js +72 -60
- package/bin/live-hooks/useLiveState.js.map +1 -1
- package/bin/live-hooks/useLiveTimer.d.ts +7 -7
- package/bin/live-hooks/useLiveTimer.d.ts.map +1 -1
- package/bin/live-hooks/useLiveTimer.js +144 -131
- package/bin/live-hooks/useLiveTimer.js.map +1 -1
- package/bin/live-hooks/useMediaSynchronizer.d.ts +22 -22
- package/bin/live-hooks/useMediaSynchronizer.d.ts.map +1 -1
- package/bin/live-hooks/useMediaSynchronizer.js +184 -161
- package/bin/live-hooks/useMediaSynchronizer.js.map +1 -1
- package/bin/providers/AzureProvider.d.ts +33 -33
- package/bin/providers/AzureProvider.d.ts.map +1 -1
- package/bin/providers/AzureProvider.js +101 -101
- package/bin/providers/AzureProvider.js.map +1 -1
- package/bin/providers/LiveShareProvider.d.ts +62 -41
- package/bin/providers/LiveShareProvider.d.ts.map +1 -1
- package/bin/providers/LiveShareProvider.js +68 -65
- package/bin/providers/LiveShareProvider.js.map +1 -1
- package/bin/providers/index.d.ts +2 -2
- package/bin/providers/index.js +2 -2
- package/bin/shared-hooks/index.d.ts +3 -3
- package/bin/shared-hooks/index.js +3 -3
- package/bin/shared-hooks/useDynamicDDS.d.ts +18 -18
- package/bin/shared-hooks/useDynamicDDS.d.ts.map +1 -1
- package/bin/shared-hooks/useDynamicDDS.js +67 -67
- package/bin/shared-hooks/useDynamicDDS.js.map +1 -1
- package/bin/shared-hooks/useSharedMap.d.ts +21 -21
- package/bin/shared-hooks/useSharedMap.d.ts.map +1 -1
- package/bin/shared-hooks/useSharedMap.js +105 -105
- package/bin/shared-hooks/useSharedMap.js.map +1 -1
- package/bin/shared-hooks/useSharedState.d.ts +20 -20
- package/bin/shared-hooks/useSharedState.d.ts.map +1 -1
- package/bin/shared-hooks/useSharedState.js +66 -62
- package/bin/shared-hooks/useSharedState.js.map +1 -1
- package/bin/types/ActionTypes.d.ts +105 -29
- package/bin/types/ActionTypes.d.ts.map +1 -1
- package/bin/types/ActionTypes.js +5 -5
- package/bin/types/PropTypes.d.ts +7 -7
- package/bin/types/PropTypes.d.ts.map +1 -1
- package/bin/types/PropTypes.js +5 -5
- package/bin/types/ResultTypes.d.ts +174 -162
- package/bin/types/ResultTypes.d.ts.map +1 -1
- package/bin/types/ResultTypes.js +5 -5
- package/bin/types/index.d.ts +3 -3
- package/bin/types/index.js +3 -3
- package/bin/utils/index.d.ts +1 -1
- package/bin/utils/index.js +1 -1
- package/bin/utils/type-check.d.ts +14 -14
- package/bin/utils/type-check.js +53 -53
- package/package.json +13 -13
- package/src/internal-hooks/useSharedStateRegistry.ts +6 -5
- package/src/live-hooks/useLiveEvent.ts +14 -18
- package/src/live-hooks/useLivePresence.ts +13 -7
- package/src/live-hooks/useLiveState.ts +8 -6
- package/src/live-hooks/useLiveTimer.ts +21 -18
- package/src/live-hooks/useMediaSynchronizer.ts +37 -27
- package/src/providers/AzureProvider.tsx +2 -7
- package/src/providers/LiveShareProvider.tsx +45 -15
- package/src/shared-hooks/useDynamicDDS.ts +15 -8
- package/src/shared-hooks/useSharedMap.ts +17 -10
- package/src/shared-hooks/useSharedState.ts +5 -1
- package/src/types/ActionTypes.ts +89 -11
- package/src/types/ResultTypes.ts +22 -8
|
@@ -1,102 +1,102 @@
|
|
|
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 "../internal-hooks";
|
|
13
|
-
import { AzureTurboClient, } from "@microsoft/live-share-turbo";
|
|
14
|
-
export const FluidContext = React.createContext({});
|
|
15
|
-
export const useFluidObjectsContext = () => {
|
|
16
|
-
const context = React.useContext(FluidContext);
|
|
17
|
-
return context;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* React Context provider component for using Fluid data objects & joining/creating a Fluid document `AzureClient`.
|
|
21
|
-
*/
|
|
22
|
-
export const AzureProvider = (props) => {
|
|
23
|
-
var _a;
|
|
24
|
-
const startedRef = React.useRef(false);
|
|
25
|
-
const clientRef = React.useRef(new AzureTurboClient(props.clientOptions));
|
|
26
|
-
const [results, setResults] = React.useState();
|
|
27
|
-
const [joinError, setJoinError] = React.useState();
|
|
28
|
-
const stateRegistryCallbacks = useSharedStateRegistry(results);
|
|
29
|
-
/**
|
|
30
|
-
* Get the container for a given containerId using AzureClient
|
|
31
|
-
*/
|
|
32
|
-
const getContainer = React.useCallback((containerId, initialObjects) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
-
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
-
try {
|
|
35
|
-
const results = yield clientRef.current.getContainer(containerId, initialObjects);
|
|
36
|
-
setResults(results);
|
|
37
|
-
resolve(results);
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
if (error instanceof Error) {
|
|
41
|
-
setJoinError(error);
|
|
42
|
-
}
|
|
43
|
-
reject(error);
|
|
44
|
-
}
|
|
45
|
-
}));
|
|
46
|
-
}), [props.containerId, setResults]);
|
|
47
|
-
/**
|
|
48
|
-
* Create container callback to create a new container using AzureClient
|
|
49
|
-
*/
|
|
50
|
-
const createContainer = React.useCallback((initialObjects, onInitializeContainer) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
-
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
-
try {
|
|
53
|
-
const results = yield clientRef.current.createContainer(initialObjects);
|
|
54
|
-
if (onInitializeContainer) {
|
|
55
|
-
onInitializeContainer(results.container);
|
|
56
|
-
}
|
|
57
|
-
const containerId = yield results.container.attach();
|
|
58
|
-
window.location.hash = containerId;
|
|
59
|
-
setResults(results);
|
|
60
|
-
resolve(results);
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
if (error instanceof Error) {
|
|
64
|
-
setJoinError(error);
|
|
65
|
-
}
|
|
66
|
-
reject(error);
|
|
67
|
-
}
|
|
68
|
-
}));
|
|
69
|
-
}), [props.containerId, setResults]);
|
|
70
|
-
/**
|
|
71
|
-
* Joins a container if `props.joinOnLoad` is true and `props.containerId` is known. Creates a new container if `props.createOnLoad` is true
|
|
72
|
-
* and `props.containerId` is not known.
|
|
73
|
-
*/
|
|
74
|
-
React.useEffect(() => {
|
|
75
|
-
var _a;
|
|
76
|
-
// This hook should only be called once, so we use a ref to track if it has been called.
|
|
77
|
-
// This is a workaround for the fact that useEffect is called twice on initial render in React V18.
|
|
78
|
-
// We are not doing this here for backwards compatibility. View the README for more information.
|
|
79
|
-
if (((_a = results === null || results === void 0 ? void 0 : results.container) === null || _a === void 0 ? void 0 : _a.connectionState) !== undefined ||
|
|
80
|
-
startedRef.current)
|
|
81
|
-
return;
|
|
82
|
-
startedRef.current = true;
|
|
83
|
-
if (props.containerId && props.joinOnLoad) {
|
|
84
|
-
getContainer(props.containerId, props.initialObjects);
|
|
85
|
-
}
|
|
86
|
-
else if (!props.containerId && props.createOnLoad) {
|
|
87
|
-
createContainer(props.initialObjects);
|
|
88
|
-
}
|
|
89
|
-
}, [
|
|
90
|
-
(_a = results === null || results === void 0 ? void 0 : results.container) === null || _a === void 0 ? void 0 : _a.connectionState,
|
|
91
|
-
props.containerId,
|
|
92
|
-
props.createOnLoad,
|
|
93
|
-
props.joinOnLoad,
|
|
94
|
-
props.initialObjects,
|
|
95
|
-
getContainer,
|
|
96
|
-
createContainer,
|
|
97
|
-
]);
|
|
98
|
-
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,
|
|
99
|
-
createContainer,
|
|
100
|
-
getContainer }, stateRegistryCallbacks) }, { children: props.children })));
|
|
101
|
-
};
|
|
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 "../internal-hooks";
|
|
13
|
+
import { AzureTurboClient, } from "@microsoft/live-share-turbo";
|
|
14
|
+
export const FluidContext = React.createContext({});
|
|
15
|
+
export const useFluidObjectsContext = () => {
|
|
16
|
+
const context = React.useContext(FluidContext);
|
|
17
|
+
return context;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* React Context provider component for using Fluid data objects & joining/creating a Fluid document `AzureClient`.
|
|
21
|
+
*/
|
|
22
|
+
export const AzureProvider = (props) => {
|
|
23
|
+
var _a;
|
|
24
|
+
const startedRef = React.useRef(false);
|
|
25
|
+
const clientRef = React.useRef(new AzureTurboClient(props.clientOptions));
|
|
26
|
+
const [results, setResults] = React.useState();
|
|
27
|
+
const [joinError, setJoinError] = React.useState();
|
|
28
|
+
const stateRegistryCallbacks = useSharedStateRegistry(results);
|
|
29
|
+
/**
|
|
30
|
+
* Get the container for a given containerId using AzureClient
|
|
31
|
+
*/
|
|
32
|
+
const getContainer = React.useCallback((containerId, initialObjects) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
+
try {
|
|
35
|
+
const results = yield clientRef.current.getContainer(containerId, initialObjects);
|
|
36
|
+
setResults(results);
|
|
37
|
+
resolve(results);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error instanceof Error) {
|
|
41
|
+
setJoinError(error);
|
|
42
|
+
}
|
|
43
|
+
reject(error);
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
46
|
+
}), [props.containerId, setResults]);
|
|
47
|
+
/**
|
|
48
|
+
* Create container callback to create a new container using AzureClient
|
|
49
|
+
*/
|
|
50
|
+
const createContainer = React.useCallback((initialObjects, onInitializeContainer) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
try {
|
|
53
|
+
const results = yield clientRef.current.createContainer(initialObjects);
|
|
54
|
+
if (onInitializeContainer) {
|
|
55
|
+
onInitializeContainer(results.container);
|
|
56
|
+
}
|
|
57
|
+
const containerId = yield results.container.attach();
|
|
58
|
+
window.location.hash = containerId;
|
|
59
|
+
setResults(results);
|
|
60
|
+
resolve(results);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (error instanceof Error) {
|
|
64
|
+
setJoinError(error);
|
|
65
|
+
}
|
|
66
|
+
reject(error);
|
|
67
|
+
}
|
|
68
|
+
}));
|
|
69
|
+
}), [props.containerId, setResults]);
|
|
70
|
+
/**
|
|
71
|
+
* Joins a container if `props.joinOnLoad` is true and `props.containerId` is known. Creates a new container if `props.createOnLoad` is true
|
|
72
|
+
* and `props.containerId` is not known.
|
|
73
|
+
*/
|
|
74
|
+
React.useEffect(() => {
|
|
75
|
+
var _a;
|
|
76
|
+
// This hook should only be called once, so we use a ref to track if it has been called.
|
|
77
|
+
// This is a workaround for the fact that useEffect is called twice on initial render in React V18.
|
|
78
|
+
// We are not doing this here for backwards compatibility. View the README for more information.
|
|
79
|
+
if (((_a = results === null || results === void 0 ? void 0 : results.container) === null || _a === void 0 ? void 0 : _a.connectionState) !== undefined ||
|
|
80
|
+
startedRef.current)
|
|
81
|
+
return;
|
|
82
|
+
startedRef.current = true;
|
|
83
|
+
if (props.containerId && props.joinOnLoad) {
|
|
84
|
+
getContainer(props.containerId, props.initialObjects);
|
|
85
|
+
}
|
|
86
|
+
else if (!props.containerId && props.createOnLoad) {
|
|
87
|
+
createContainer(props.initialObjects);
|
|
88
|
+
}
|
|
89
|
+
}, [
|
|
90
|
+
(_a = results === null || results === void 0 ? void 0 : results.container) === null || _a === void 0 ? void 0 : _a.connectionState,
|
|
91
|
+
props.containerId,
|
|
92
|
+
props.createOnLoad,
|
|
93
|
+
props.joinOnLoad,
|
|
94
|
+
props.initialObjects,
|
|
95
|
+
getContainer,
|
|
96
|
+
createContainer,
|
|
97
|
+
]);
|
|
98
|
+
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,
|
|
99
|
+
createContainer,
|
|
100
|
+
getContainer }, stateRegistryCallbacks) }, { children: props.children })));
|
|
101
|
+
};
|
|
102
102
|
//# sourceMappingURL=AzureProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureProvider.js","sourceRoot":"","sources":["../../src/providers/AzureProvider.tsx"],"names":[],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"AzureProvider.js","sourceRoot":"","sources":["../../src/providers/AzureProvider.tsx"],"names":[],"mappings":";;;;;;;;;;AAMA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAEH,sBAAsB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,gBAAgB,GAEnB,MAAM,6BAA6B,CAAC;AAiBrC,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,aAAa,CAC3C,EAAmB,CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAkB,EAAE;IACtD,MAAM,OAAO,GAAG,KAAK,CAAC,UA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CAAC,CAAC;SACzC;IACL,CAAC,EAAE;QACC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,0CAAE,eAAe;QACnC,KAAK,CAAC,WAAW;QACjB,KAAK,CAAC,YAAY;QAClB,KAAK,CAAC,UAAU;QAChB,KAAK,CAAC,cAAc;QACpB,YAAY;QACZ,eAAe;KAClB,CAAC,CAAC;IAEH,OAAO,CACH,KAAC,YAAY,CAAC,QAAQ,kBAClB,KAAK,kBACD,SAAS,EACT,SAAS,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAC7B,QAAQ,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,EAC3B,SAAS;YACT,eAAe;YACf,YAAY,IACT,sBAAsB,iBAG5B,KAAK,CAAC,QAAQ,IACK,CAC3B,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,42 +1,63 @@
|
|
|
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 {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
* Optional.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
+
export interface ILiveShareContext {
|
|
9
|
+
/**
|
|
10
|
+
* True if the local user created the Fluid container
|
|
11
|
+
*/
|
|
12
|
+
created: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* True if connected to the Live Share container
|
|
15
|
+
*/
|
|
16
|
+
joined: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* An error that will be defined if there was a problem joining the container, or undefined if not.
|
|
19
|
+
*/
|
|
20
|
+
joinError: Error | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Live Share timestamp provider. Can be used to `.getTimestamp()` for a global clock value.
|
|
23
|
+
* This reference timestamp value should be fairly consistent for all users in the session.
|
|
24
|
+
*/
|
|
25
|
+
timestampProvider: ITimestampProvider | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Join callback method
|
|
28
|
+
* @param initialObjects Optional. The initial objects for the Fluid container schema.
|
|
29
|
+
* @param onInitializeContainer Optional. Callback for when the container is first created.
|
|
30
|
+
* @returns `ILiveShareJoinResults`, which includes the Fluid container
|
|
31
|
+
*/
|
|
32
|
+
join: (initialObjects?: LoadableObjectClassRecord, onInitializeContainer?: (container: IFluidContainer) => void) => Promise<ILiveShareJoinResults>;
|
|
33
|
+
}
|
|
34
|
+
export declare const LiveShareContext: React.Context<ILiveShareContext>;
|
|
35
|
+
export declare const useLiveShareContext: () => ILiveShareContext;
|
|
36
|
+
interface ILiveShareProviderProps {
|
|
37
|
+
/**
|
|
38
|
+
* Optional. React children node for the React Context Provider
|
|
39
|
+
*/
|
|
40
|
+
children?: React.ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Optional. Options to pass into LiveShareClient initializer
|
|
43
|
+
*/
|
|
44
|
+
clientOptions?: ILiveShareClientOptions;
|
|
45
|
+
/**
|
|
46
|
+
* Host to initialize LiveShareClient with
|
|
47
|
+
*/
|
|
48
|
+
host: ILiveShareHost;
|
|
49
|
+
/**
|
|
50
|
+
* Optional. Initial Fluid objects to load when the container is first created
|
|
51
|
+
*/
|
|
52
|
+
initialObjects?: LoadableObjectClassRecord;
|
|
53
|
+
/**
|
|
54
|
+
* Optional. Flag to determine whether to join Fluid container on load
|
|
55
|
+
*/
|
|
56
|
+
joinOnLoad?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* React Context provider component for using Live Share data objects & joining a Live Share session using `LiveShareClient`.
|
|
60
|
+
*/
|
|
61
|
+
export declare const LiveShareProvider: React.FC<ILiveShareProviderProps>;
|
|
62
|
+
export {};
|
|
42
63
|
//# sourceMappingURL=LiveShareProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAI/B,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;;;;;OAKG;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,eAAO,MAAM,gBAAgB,kCAE5B,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAO,iBAGtC,CAAC;AAEF,UAAU,uBAAuB;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC;;OAEG;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,CAuF/D,CAAC"}
|
|
@@ -1,66 +1,69 @@
|
|
|
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 "../internal-hooks";
|
|
13
|
-
import { FluidContext } from "./AzureProvider";
|
|
14
|
-
import { LiveShareTurboClient } from "@microsoft/live-share-turbo";
|
|
15
|
-
export const LiveShareContext = React.createContext({});
|
|
16
|
-
export const useLiveShareContext = () => {
|
|
17
|
-
const context = React.useContext(LiveShareContext);
|
|
18
|
-
return context;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* React Context provider component for using Live Share data objects & joining a Live Share session using `LiveShareClient`.
|
|
22
|
-
*/
|
|
23
|
-
export const LiveShareProvider = (props) => {
|
|
24
|
-
const startedRef = React.useRef(false);
|
|
25
|
-
const clientRef = React.useRef(new LiveShareTurboClient(props.host, props.clientOptions));
|
|
26
|
-
const [results, setResults] = React.useState();
|
|
27
|
-
const [joinError, setJoinError] = React.useState();
|
|
28
|
-
const stateRegistryCallbacks = useSharedStateRegistry(results);
|
|
29
|
-
/**
|
|
30
|
-
* Join container callback for joining the Live Share session
|
|
31
|
-
*/
|
|
32
|
-
const join = React.useCallback((initialObjects, onInitializeContainer) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
-
startedRef.current = true;
|
|
34
|
-
const results = yield clientRef.current.join(initialObjects, onInitializeContainer);
|
|
35
|
-
setResults(results);
|
|
36
|
-
return results;
|
|
37
|
-
}), []);
|
|
38
|
-
/**
|
|
39
|
-
* Joins the container on load if `props.joinOnLoad` is true
|
|
40
|
-
*/
|
|
41
|
-
React.useEffect(() => {
|
|
42
|
-
// This hook should only be called once, so we use a ref to track if it has been called.
|
|
43
|
-
// This is a workaround for the fact that useEffect is called twice on initial render in React V18.
|
|
44
|
-
// We are not doing this here for backwards compatibility. View the README for more information.
|
|
45
|
-
if (results !== undefined || startedRef.current || !props.joinOnLoad)
|
|
46
|
-
return;
|
|
47
|
-
join(props.initialObjects).catch((error) => {
|
|
48
|
-
console.
|
|
49
|
-
if (error instanceof Error) {
|
|
50
|
-
setJoinError(error);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
setJoinError(new Error("LiveShareProvider: An unknown error occurred while joining container."));
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}, [results, props.joinOnLoad, props.initialObjects, join]);
|
|
57
|
-
return (_jsx(LiveShareContext.Provider, Object.assign({ value: {
|
|
58
|
-
created: results === null || results === void 0 ? void 0 : results.created,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
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 "../internal-hooks";
|
|
13
|
+
import { FluidContext } from "./AzureProvider";
|
|
14
|
+
import { LiveShareTurboClient } from "@microsoft/live-share-turbo";
|
|
15
|
+
export const LiveShareContext = React.createContext({});
|
|
16
|
+
export const useLiveShareContext = () => {
|
|
17
|
+
const context = React.useContext(LiveShareContext);
|
|
18
|
+
return context;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* React Context provider component for using Live Share data objects & joining a Live Share session using `LiveShareClient`.
|
|
22
|
+
*/
|
|
23
|
+
export const LiveShareProvider = (props) => {
|
|
24
|
+
const startedRef = React.useRef(false);
|
|
25
|
+
const clientRef = React.useRef(new LiveShareTurboClient(props.host, props.clientOptions));
|
|
26
|
+
const [results, setResults] = React.useState();
|
|
27
|
+
const [joinError, setJoinError] = React.useState();
|
|
28
|
+
const stateRegistryCallbacks = useSharedStateRegistry(results);
|
|
29
|
+
/**
|
|
30
|
+
* Join container callback for joining the Live Share session
|
|
31
|
+
*/
|
|
32
|
+
const join = React.useCallback((initialObjects, onInitializeContainer) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
startedRef.current = true;
|
|
34
|
+
const results = yield clientRef.current.join(initialObjects, onInitializeContainer);
|
|
35
|
+
setResults(results);
|
|
36
|
+
return results;
|
|
37
|
+
}), []);
|
|
38
|
+
/**
|
|
39
|
+
* Joins the container on load if `props.joinOnLoad` is true
|
|
40
|
+
*/
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
// This hook should only be called once, so we use a ref to track if it has been called.
|
|
43
|
+
// This is a workaround for the fact that useEffect is called twice on initial render in React V18.
|
|
44
|
+
// We are not doing this here for backwards compatibility. View the README for more information.
|
|
45
|
+
if (results !== undefined || startedRef.current || !props.joinOnLoad)
|
|
46
|
+
return;
|
|
47
|
+
join(props.initialObjects).catch((error) => {
|
|
48
|
+
console.error(error);
|
|
49
|
+
if (error instanceof Error) {
|
|
50
|
+
setJoinError(error);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
setJoinError(new Error("LiveShareProvider: An unknown error occurred while joining container."));
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}, [results, props.joinOnLoad, props.initialObjects, join]);
|
|
57
|
+
return (_jsx(LiveShareContext.Provider, Object.assign({ value: {
|
|
58
|
+
created: !!(results === null || results === void 0 ? void 0 : results.created),
|
|
59
|
+
timestampProvider: results === null || results === void 0 ? void 0 : results.timestampProvider,
|
|
60
|
+
joined: !!(results === null || results === void 0 ? void 0 : results.container),
|
|
61
|
+
joinError,
|
|
62
|
+
join,
|
|
63
|
+
} }, { 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* () {
|
|
64
|
+
throw new Error("Cannot join new container through getContainer in LiveShareProvider");
|
|
65
|
+
}), createContainer: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
throw new Error("Cannot create new container through createContainer in LiveShareProvider");
|
|
67
|
+
}) }, stateRegistryCallbacks) }, { children: props.children })) })));
|
|
68
|
+
};
|
|
66
69
|
//# sourceMappingURL=LiveShareProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveShareProvider.js","sourceRoot":"","sources":["../../src/providers/LiveShareProvider.tsx"],"names":[],"mappings":";;;;;;;;;;AAMA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
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,mBAAmB,CAAC;AAO3D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAgCnE,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAC/C,EAAuB,CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAsB,EAAE;IACvD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;IACnD,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAyBF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAsC,CAAC,KAAK,EAAE,EAAE;IAC1E,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,SAAS,GAAG,KAAK,CAAC,MA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,EAAE,IAAI,CAAC,CAAC,CAAC;IAE5D,OAAO,CACH,KAAC,gBAAgB,CAAC,QAAQ,kBACtB,KAAK,EAAE;YACH,OAAO,EAAE,CAAC,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAA;YAC3B,iBAAiB,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,iBAAiB;YAC7C,MAAM,EAAE,CAAC,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAA;YAC5B,SAAS;YACT,IAAI;SACP,gBAED,KAAC,YAAY,CAAC,QAAQ,kBAClB,KAAK,kBACD,SAAS,EACT,SAAS,EAAE,OAAO,aAAP,OAAO,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"}
|
package/bin/providers/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./AzureProvider";
|
|
2
|
-
export * from "./LiveShareProvider";
|
|
1
|
+
export * from "./AzureProvider";
|
|
2
|
+
export * from "./LiveShareProvider";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/bin/providers/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./AzureProvider";
|
|
2
|
-
export * from "./LiveShareProvider";
|
|
1
|
+
export * from "./AzureProvider";
|
|
2
|
+
export * from "./LiveShareProvider";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./useSharedState";
|
|
2
|
-
export * from "./useSharedMap";
|
|
3
|
-
export * from "./useDynamicDDS";
|
|
1
|
+
export * from "./useSharedState";
|
|
2
|
+
export * from "./useSharedMap";
|
|
3
|
+
export * from "./useDynamicDDS";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./useSharedState";
|
|
2
|
-
export * from "./useSharedMap";
|
|
3
|
-
export * from "./useDynamicDDS";
|
|
1
|
+
export * from "./useSharedState";
|
|
2
|
+
export * from "./useSharedMap";
|
|
3
|
+
export * from "./useDynamicDDS";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
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
|
-
* @template T Type of Fluid LoadableObjectClass type to load. Must conform to IFluidLoadable interface.
|
|
10
|
-
* @param uniqueKey uniqueKey value for the data object
|
|
11
|
-
* @param loadableObjectClass Fluid LoadableObjectClass<T> to create/load.
|
|
12
|
-
* @param onFirstInitialize Optional. Callback function for when the DDS is first loaded
|
|
13
|
-
* @returns the DDS object, which is of type T when loaded and undefined while loading
|
|
14
|
-
*/
|
|
15
|
-
export declare function useDynamicDDS<T extends IFluidLoadable = FluidObject<any> & IFluidLoadable>(uniqueKey: string, loadableObjectClass: LoadableObjectClass<T>, onFirstInitialize?: (dds: T) => void): {
|
|
16
|
-
dds: T | undefined;
|
|
17
|
-
error: Error | undefined;
|
|
18
|
-
};
|
|
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
|
+
* @template T Type of Fluid LoadableObjectClass type to load. Must conform to IFluidLoadable interface.
|
|
10
|
+
* @param uniqueKey uniqueKey value for the data object
|
|
11
|
+
* @param loadableObjectClass Fluid LoadableObjectClass<T> to create/load.
|
|
12
|
+
* @param onFirstInitialize Optional. Callback function for when the DDS is first loaded
|
|
13
|
+
* @returns the DDS object, which is of type T when loaded and undefined while loading
|
|
14
|
+
*/
|
|
15
|
+
export declare function useDynamicDDS<T extends IFluidLoadable = FluidObject<any> & IFluidLoadable>(uniqueKey: string, loadableObjectClass: LoadableObjectClass<T>, onFirstInitialize?: (dds: T) => void): {
|
|
16
|
+
dds: T | undefined;
|
|
17
|
+
error: Error | undefined;
|
|
18
|
+
};
|
|
19
19
|
//# sourceMappingURL=useDynamicDDS.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;;;;;;;GAOG;AACH,wBAAgB,aAAa,
|
|
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;;;;;;;GAOG;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"}
|