@microsoft/live-share-react 2.0.0-internal.1 → 2.0.0-internal.11
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/LICENSE +64 -61
- package/README.md +169 -164
- 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/live-hooks/useLiveCanvas.js +1 -1
- package/bin/live-hooks/useLiveCanvas.js.map +1 -1
- package/bin/live-hooks/useLiveState.d.ts.map +1 -1
- package/bin/live-hooks/useLiveState.js +6 -2
- package/bin/live-hooks/useLiveState.js.map +1 -1
- package/bin/live-hooks/useMediaSynchronizer.js +1 -1
- package/bin/live-hooks/useMediaSynchronizer.js.map +1 -1
- package/bin/providers/AzureProvider.js +2 -2
- package/bin/providers/AzureProvider.js.map +1 -1
- package/bin/providers/LiveShareProvider.js +3 -3
- package/bin/providers/LiveShareProvider.js.map +1 -1
- package/package.json +61 -47
- package/src/index.ts +6 -6
- package/src/interfaces/index.ts +1 -1
- package/src/internal/index.ts +2 -2
- package/src/internal/type-guards.ts +1 -1
- package/src/live-hooks/index.ts +7 -7
- package/src/live-hooks/useLiveCanvas.ts +154 -82
- package/src/live-hooks/useLiveEvent.ts +43 -7
- package/src/live-hooks/useLiveFollowMode.ts +149 -6
- package/src/live-hooks/useLivePresence.ts +80 -17
- package/src/live-hooks/useLiveState.ts +54 -6
- package/src/live-hooks/useLiveTimer.ts +59 -4
- package/src/live-hooks/useMediaSynchronizer.ts +71 -6
- package/src/providers/AzureProvider.tsx +21 -21
- package/src/providers/LiveShareProvider.tsx +115 -13
- package/src/providers/index.ts +2 -2
- package/src/shared-hooks/index.ts +6 -4
- package/src/shared-hooks/internals/tree-node-constants.ts +2 -0
- package/src/shared-hooks/internals/tree-node-types.ts +26 -0
- package/src/shared-hooks/internals/tree-node-utils.ts +269 -0
- package/src/shared-hooks/useDynamicDDS.ts +28 -17
- package/src/shared-hooks/useSharedMap.ts +42 -17
- package/src/shared-hooks/useSharedState.ts +6 -3
- package/src/shared-hooks/useSharedStateRegistry.ts +44 -22
- package/src/shared-hooks/useSharedTree.ts +144 -0
- package/src/shared-hooks/useTreeNode.ts +147 -0
- package/src/types/ActionTypes.ts +13 -9
- package/src/types/PropTypes.ts +57 -0
- package/src/types/ResultTypes.ts +71 -17
- package/src/types/index.ts +3 -3
- package/src/utils/index.ts +1 -1
- package/tsconfig.cjs.json +14 -0
- package/tsconfig.json +65 -70
- package/.nycrc.json +0 -10
- package/tsconfig.build.json +0 -6
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { TreeChangeEvents, TreeNode } from "fluid-framework";
|
|
2
|
+
import { IUseTreeNodeResults } from "../types/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Makes a provided Fluid `TreeNode` stateful in React.
|
|
5
|
+
*
|
|
6
|
+
* @param node the Fluid `SharedTree` `TreeNode` instance to make stateful.
|
|
7
|
+
* @param stateChangeType listener type to apply changes for. Default value is "nodeChanged", which has the most optimal performance.
|
|
8
|
+
* Provide "treeChanged" to make all children nodes stateful as well when those child nodes change.
|
|
9
|
+
* When using the default, you must pass all child `TreeNode` values into `useTreeNode` for them to be stateful as well.
|
|
10
|
+
* @returns a stateful version `node`
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* Example using default `"nodeChanged"` `stateChangeType`
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { SchemaFactory, TreeViewConfiguration } from "fluid-framework";
|
|
16
|
+
* import { useSharedTree, useTreeNode } from "@microsoft/live-share-react";
|
|
17
|
+
* // Declare a schema factory with your unique uuid
|
|
18
|
+
* const sf = new SchemaFactory("fc1db2e8-0000-11ee-be57-0242ac120002");
|
|
19
|
+
* class YourObject extends sf.object("YourObject", {
|
|
20
|
+
* listChangedCount: sf.number,
|
|
21
|
+
* list: sf.array(sf.string),
|
|
22
|
+
* }) {
|
|
23
|
+
* // You can add your own utility functions
|
|
24
|
+
* insert() {
|
|
25
|
+
* this.list.insertAtEnd("some text");
|
|
26
|
+
* this.listChangedCount += 1;
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* const config = new TreeViewConfiguration({ schema: YourObject });
|
|
30
|
+
* const initialData = new YourObject({
|
|
31
|
+
* number: 0,
|
|
32
|
+
* list: [],
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // Must be child component of <LiveShareProvider> or <AzureProvider>
|
|
36
|
+
* export const YourComponent = () => {
|
|
37
|
+
* // Get the root node of the `SharedTree` mapped to "some-unique-key"
|
|
38
|
+
* const { root } = useSharedTree("some-unique-key", config, initialData);
|
|
39
|
+
* // Makes root stateful / automatically update when the node changes (e.g., node.count)
|
|
40
|
+
* const { node } = useTreeNode(root);
|
|
41
|
+
* // node.list is its own TreeNode, so we make it stateful as well
|
|
42
|
+
* const { node: list } = useTreeNode(node?.list);
|
|
43
|
+
* if (!node || !list) return (<>"Loading"</>);
|
|
44
|
+
* return (
|
|
45
|
+
* <div>
|
|
46
|
+
* <div>Changed: {node.listChangedCount}</div>
|
|
47
|
+
* <button onClick={() => node.insert()}>Insert</button>
|
|
48
|
+
* { list.map((item) => <div key={item}>{item}</div>) }
|
|
49
|
+
* </div>
|
|
50
|
+
* );
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* Example using `"treeChanged"` `stateChangeType`
|
|
56
|
+
* ```tsx
|
|
57
|
+
* import { SchemaFactory, TreeViewConfiguration } from "fluid-framework";
|
|
58
|
+
* import { useSharedTree, useTreeNode } from "@microsoft/live-share-react";
|
|
59
|
+
* // Declare a schema factory with your unique uuid
|
|
60
|
+
* const sf = new SchemaFactory("fc1db2e8-0000-11ee-be57-0242ac120002");
|
|
61
|
+
*
|
|
62
|
+
* class ChildObject extends sf.object("ChildObject", {
|
|
63
|
+
* count: sf.number,
|
|
64
|
+
* }) {
|
|
65
|
+
* increment() {
|
|
66
|
+
* this.count += 1;
|
|
67
|
+
* }
|
|
68
|
+
* }
|
|
69
|
+
*
|
|
70
|
+
* class YourObject extends sf.object("YourObject", {
|
|
71
|
+
* child: ChildObject,
|
|
72
|
+
* }) {}
|
|
73
|
+
* const config = new TreeViewConfiguration({ schema: YourObject });
|
|
74
|
+
* const initialData = new YourObject({
|
|
75
|
+
* child: new ChildObject({ count: 0 }),
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* // Must be child component of <LiveShareProvider> or <AzureProvider>
|
|
79
|
+
* export const YourComponent = () => {
|
|
80
|
+
* // Get the root node of the `SharedTree` mapped to "some-unique-key"
|
|
81
|
+
* const { root } = useSharedTree("some-unique-key", config, initialData);
|
|
82
|
+
* // Using "treeChanged" prop makes all children nodes stateful as well.
|
|
83
|
+
* // Use with caution / measure render performance with React dev tools.
|
|
84
|
+
* const { node } = useTreeNode(root, "treeChanged");
|
|
85
|
+
* if (!node) return (<>"Loading"</>);
|
|
86
|
+
* return (
|
|
87
|
+
* <div>
|
|
88
|
+
* <div>Changed: {node.child.count}</div>
|
|
89
|
+
* <button onClick={() => node.increment()}>Insert</button>
|
|
90
|
+
* </div>
|
|
91
|
+
* );
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare function useTreeNode<TNode extends TreeNode | undefined = TreeNode>(node: TNode, stateChangeType?: keyof TreeChangeEvents): IUseTreeNodeResults<TNode>;
|
|
96
|
+
//# sourceMappingURL=useTreeNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTreeNode.d.ts","sourceRoot":"","sources":["../../../src/shared-hooks/useTreeNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,gBAAgB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAQxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AACH,wBAAgB,WAAW,CAAC,KAAK,SAAS,QAAQ,GAAG,SAAS,GAAG,QAAQ,EACrE,IAAI,EAAE,KAAK,EACX,eAAe,GAAE,MAAM,gBAAgC,GACxD,mBAAmB,CAAC,KAAK,CAAC,CA0C5B"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTreeNode = useTreeNode;
|
|
4
|
+
const fluid_framework_1 = require("fluid-framework");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const tree_node_utils_js_1 = require("./internals/tree-node-utils.js");
|
|
7
|
+
/**
|
|
8
|
+
* Makes a provided Fluid `TreeNode` stateful in React.
|
|
9
|
+
*
|
|
10
|
+
* @param node the Fluid `SharedTree` `TreeNode` instance to make stateful.
|
|
11
|
+
* @param stateChangeType listener type to apply changes for. Default value is "nodeChanged", which has the most optimal performance.
|
|
12
|
+
* Provide "treeChanged" to make all children nodes stateful as well when those child nodes change.
|
|
13
|
+
* When using the default, you must pass all child `TreeNode` values into `useTreeNode` for them to be stateful as well.
|
|
14
|
+
* @returns a stateful version `node`
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* Example using default `"nodeChanged"` `stateChangeType`
|
|
18
|
+
* ```tsx
|
|
19
|
+
* import { SchemaFactory, TreeViewConfiguration } from "fluid-framework";
|
|
20
|
+
* import { useSharedTree, useTreeNode } from "@microsoft/live-share-react";
|
|
21
|
+
* // Declare a schema factory with your unique uuid
|
|
22
|
+
* const sf = new SchemaFactory("fc1db2e8-0000-11ee-be57-0242ac120002");
|
|
23
|
+
* class YourObject extends sf.object("YourObject", {
|
|
24
|
+
* listChangedCount: sf.number,
|
|
25
|
+
* list: sf.array(sf.string),
|
|
26
|
+
* }) {
|
|
27
|
+
* // You can add your own utility functions
|
|
28
|
+
* insert() {
|
|
29
|
+
* this.list.insertAtEnd("some text");
|
|
30
|
+
* this.listChangedCount += 1;
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* const config = new TreeViewConfiguration({ schema: YourObject });
|
|
34
|
+
* const initialData = new YourObject({
|
|
35
|
+
* number: 0,
|
|
36
|
+
* list: [],
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* // Must be child component of <LiveShareProvider> or <AzureProvider>
|
|
40
|
+
* export const YourComponent = () => {
|
|
41
|
+
* // Get the root node of the `SharedTree` mapped to "some-unique-key"
|
|
42
|
+
* const { root } = useSharedTree("some-unique-key", config, initialData);
|
|
43
|
+
* // Makes root stateful / automatically update when the node changes (e.g., node.count)
|
|
44
|
+
* const { node } = useTreeNode(root);
|
|
45
|
+
* // node.list is its own TreeNode, so we make it stateful as well
|
|
46
|
+
* const { node: list } = useTreeNode(node?.list);
|
|
47
|
+
* if (!node || !list) return (<>"Loading"</>);
|
|
48
|
+
* return (
|
|
49
|
+
* <div>
|
|
50
|
+
* <div>Changed: {node.listChangedCount}</div>
|
|
51
|
+
* <button onClick={() => node.insert()}>Insert</button>
|
|
52
|
+
* { list.map((item) => <div key={item}>{item}</div>) }
|
|
53
|
+
* </div>
|
|
54
|
+
* );
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* Example using `"treeChanged"` `stateChangeType`
|
|
60
|
+
* ```tsx
|
|
61
|
+
* import { SchemaFactory, TreeViewConfiguration } from "fluid-framework";
|
|
62
|
+
* import { useSharedTree, useTreeNode } from "@microsoft/live-share-react";
|
|
63
|
+
* // Declare a schema factory with your unique uuid
|
|
64
|
+
* const sf = new SchemaFactory("fc1db2e8-0000-11ee-be57-0242ac120002");
|
|
65
|
+
*
|
|
66
|
+
* class ChildObject extends sf.object("ChildObject", {
|
|
67
|
+
* count: sf.number,
|
|
68
|
+
* }) {
|
|
69
|
+
* increment() {
|
|
70
|
+
* this.count += 1;
|
|
71
|
+
* }
|
|
72
|
+
* }
|
|
73
|
+
*
|
|
74
|
+
* class YourObject extends sf.object("YourObject", {
|
|
75
|
+
* child: ChildObject,
|
|
76
|
+
* }) {}
|
|
77
|
+
* const config = new TreeViewConfiguration({ schema: YourObject });
|
|
78
|
+
* const initialData = new YourObject({
|
|
79
|
+
* child: new ChildObject({ count: 0 }),
|
|
80
|
+
* });
|
|
81
|
+
*
|
|
82
|
+
* // Must be child component of <LiveShareProvider> or <AzureProvider>
|
|
83
|
+
* export const YourComponent = () => {
|
|
84
|
+
* // Get the root node of the `SharedTree` mapped to "some-unique-key"
|
|
85
|
+
* const { root } = useSharedTree("some-unique-key", config, initialData);
|
|
86
|
+
* // Using "treeChanged" prop makes all children nodes stateful as well.
|
|
87
|
+
* // Use with caution / measure render performance with React dev tools.
|
|
88
|
+
* const { node } = useTreeNode(root, "treeChanged");
|
|
89
|
+
* if (!node) return (<>"Loading"</>);
|
|
90
|
+
* return (
|
|
91
|
+
* <div>
|
|
92
|
+
* <div>Changed: {node.child.count}</div>
|
|
93
|
+
* <button onClick={() => node.increment()}>Insert</button>
|
|
94
|
+
* </div>
|
|
95
|
+
* );
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
function useTreeNode(node, stateChangeType = "nodeChanged") {
|
|
100
|
+
// When we return a proxied node to a developer, it's possible they will pass it back to us in this hook.
|
|
101
|
+
// We can't listen using Tree.on using a proxy node though...
|
|
102
|
+
// Thus, if we are already listening to a node from another instance of this hook, we look for the unproxied node.
|
|
103
|
+
const rawNode = (0, tree_node_utils_js_1.getRawNode)(node);
|
|
104
|
+
const [proxyNode, setProxyNode] = (0, react_1.useState)(rawNode);
|
|
105
|
+
const treeProxyMapRef = (0, react_1.useRef)(new WeakMap());
|
|
106
|
+
(0, react_1.useEffect)(() => {
|
|
107
|
+
if (!rawNode)
|
|
108
|
+
return;
|
|
109
|
+
// Set default value
|
|
110
|
+
setProxyNode(rawNode);
|
|
111
|
+
function onNodeChanged() {
|
|
112
|
+
if (!rawNode)
|
|
113
|
+
return;
|
|
114
|
+
const proxyNode = (0, tree_node_utils_js_1.buildProxy)(rawNode, treeProxyMapRef.current);
|
|
115
|
+
setProxyNode(proxyNode);
|
|
116
|
+
}
|
|
117
|
+
// Listen to Fluid's base node from their TreeView so Fluid flex nodes continue to work
|
|
118
|
+
const unsubscribeListeners = [
|
|
119
|
+
fluid_framework_1.Tree.on(rawNode, "nodeChanged", onNodeChanged),
|
|
120
|
+
];
|
|
121
|
+
if (stateChangeType === "treeChanged") {
|
|
122
|
+
// Recursively for all child nodes of this node in the tree
|
|
123
|
+
(0, tree_node_utils_js_1.setUpListenersForNodeChildren)(rawNode, rawNode, treeProxyMapRef.current, unsubscribeListeners,
|
|
124
|
+
// TODO: fix typing so casting isn't necessary
|
|
125
|
+
setProxyNode);
|
|
126
|
+
}
|
|
127
|
+
return () => {
|
|
128
|
+
unsubscribeListeners.forEach((unsubscribe) => unsubscribe());
|
|
129
|
+
};
|
|
130
|
+
}, [rawNode, stateChangeType]);
|
|
131
|
+
return {
|
|
132
|
+
node: proxyNode,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=useTreeNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTreeNode.js","sourceRoot":"","sources":["../../../src/shared-hooks/useTreeNode.ts"],"names":[],"mappings":";;AAqGA,kCA6CC;AAlJD,qDAAmE;AAEnE,iCAAoD;AACpD,uEAIwC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AACH,SAAgB,WAAW,CACvB,IAAW,EACX,kBAA0C,aAAa;IAEvD,yGAAyG;IACzG,6DAA6D;IAC7D,kHAAkH;IAClH,MAAM,OAAO,GAAG,IAAA,+BAAU,EAAC,IAAI,CAAC,CAAC;IACjC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAQ,OAAO,CAAC,CAAC;IAC3D,MAAM,eAAe,GAAG,IAAA,cAAM,EAA8B,IAAI,OAAO,EAAE,CAAC,CAAC;IAE3E,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,IAAI,CAAC,OAAO;YAAE,OAAO;QAErB,oBAAoB;QACpB,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,SAAS,aAAa;YAClB,IAAI,CAAC,OAAO;gBAAE,OAAO;YAErB,MAAM,SAAS,GAAG,IAAA,+BAAU,EAAC,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;YAC/D,YAAY,CAAC,SAAS,CAAC,CAAC;QAC5B,CAAC;QACD,uFAAuF;QACvF,MAAM,oBAAoB,GAAmB;YACzC,sBAAI,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,aAAa,CAAC;SACjD,CAAC;QACF,IAAI,eAAe,KAAK,aAAa,EAAE,CAAC;YACpC,2DAA2D;YAC3D,IAAA,kDAA6B,EACzB,OAAO,EACP,OAAO,EACP,eAAe,CAAC,OAAO,EACvB,oBAAoB;YACpB,8CAA8C;YAC9C,YAAmB,CACtB,CAAC;QACN,CAAC;QACD,OAAO,GAAG,EAAE;YACR,oBAAoB,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;QACjE,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC;IAE/B,OAAO;QACH,IAAI,EAAE,SAAS;KAClB,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
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 { IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
7
|
+
import { ITimerConfig, ILiveEvent, LivePresenceData } from "@microsoft/live-share";
|
|
8
|
+
import { SharedObjectKind } from "fluid-framework";
|
|
9
|
+
/**
|
|
10
|
+
* Callback to set shared state
|
|
11
|
+
*/
|
|
12
|
+
export type SetSharedStateAction<TState> = (state: TState | ((prevState: TState) => TState)) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Callback to set local state
|
|
15
|
+
*/
|
|
16
|
+
export type SetLocalStateAction = React.Dispatch<React.SetStateAction<any>>;
|
|
17
|
+
/**
|
|
18
|
+
* Callback for UnregisterDDSSetStateAction.
|
|
19
|
+
* <T extends IFluidLoadable>(uniqueKey: string, componentId: string, objectClass: SharedObjectKind<T>, setLocalStateAction: SetLocalStateAction, onDidFirstInitialize?: (dds: T) => void) => void
|
|
20
|
+
*/
|
|
21
|
+
export type RegisterDDSSetStateAction = <T extends IFluidLoadable>(uniqueKey: string, componentId: string, objectClass: SharedObjectKind<T>, setLocalStateAction: SetLocalStateAction, onDidFirstInitialize?: (dds: T) => void) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Callback for UnregisterDDSSetStateAction.
|
|
24
|
+
* (uniqueKey: string, componentId: string) => void
|
|
25
|
+
*/
|
|
26
|
+
export type UnregisterDDSSetStateAction = (uniqueKey: string, componentId: string) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Callback for RegisterSharedSetStateAction.
|
|
29
|
+
* (uniqueKey: string, componentId: string, setLocalStateAction: SetLocalStateAction) => void
|
|
30
|
+
*/
|
|
31
|
+
export type RegisterSharedSetStateAction = (uniqueKey: string, componentId: string, setLocalStateAction: SetLocalStateAction) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Callback for UnregisterSharedSetStateAction.
|
|
34
|
+
* (uniqueKey: string, componentId: string) => void
|
|
35
|
+
*/
|
|
36
|
+
export type UnregisterSharedSetStateAction = (uniqueKey: string, componentId: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Callback for UpdateSharedStateAction.
|
|
39
|
+
* (uniqueKey: string, value: any) => void
|
|
40
|
+
*/
|
|
41
|
+
export type UpdateSharedStateAction = (uniqueKey: string, value: any) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Callback for DeleteSharedStateAction.
|
|
44
|
+
* (uniqueKey: string) => void
|
|
45
|
+
*/
|
|
46
|
+
export type DeleteSharedStateAction = (uniqueKey: string) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Callback for DisposeSharedStateAction.
|
|
49
|
+
* () => void
|
|
50
|
+
*/
|
|
51
|
+
export type DisposeSharedStateAction = () => void;
|
|
52
|
+
/**
|
|
53
|
+
* Callback for SetLiveStateAction<TState = undefined>.
|
|
54
|
+
* (state: TState) => Promise<void>
|
|
55
|
+
*/
|
|
56
|
+
export type SetLiveStateAction<TState = undefined> = (state: TState | ((prevState: TState) => TState)) => Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Callback for SendLiveEventAction<TEvent>.
|
|
59
|
+
* (event: TEvent, targetClientId?: string) => Promise<void>
|
|
60
|
+
*/
|
|
61
|
+
export type SendLiveEventAction<TEvent> = (event: TEvent, targetClientId?: string) => Promise<ILiveEvent<TEvent>>;
|
|
62
|
+
/**
|
|
63
|
+
* Callback for OnReceivedLiveEventAction<TEvent>.
|
|
64
|
+
* (event: TEvent, local: boolean) => void
|
|
65
|
+
*/
|
|
66
|
+
export type OnReceivedLiveEventAction<TEvent> = (event: TEvent, local: boolean) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Callback for OnUpdateLivePresenceAction<TData extends object = object>.
|
|
69
|
+
* (data?: TData | undefined, state?: PresenceState | undefined) => Promise<void>
|
|
70
|
+
*/
|
|
71
|
+
export type OnUpdateLivePresenceAction<TData extends LivePresenceData = any> = (data: TData) => Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Callback for OnStartTimerAction.
|
|
74
|
+
* (duration: number) => Promise<void>
|
|
75
|
+
*/
|
|
76
|
+
export type OnStartTimerAction = (duration: number) => Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Callback for OnPlayTimerAction.
|
|
79
|
+
* () => Promise<void>
|
|
80
|
+
*/
|
|
81
|
+
export type OnPlayTimerAction = () => Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Callback for OnPauseTimerAction.
|
|
84
|
+
* () => Promise<void>
|
|
85
|
+
*/
|
|
86
|
+
export type OnPauseTimerAction = () => Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Callback for OnTimerTickAction.
|
|
89
|
+
* (milliRemaining: number) => void
|
|
90
|
+
*/
|
|
91
|
+
export type OnTimerTickAction = (milliRemaining: number) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Callback for OnTimerDidStartAction.
|
|
94
|
+
* (timerConfig: ITimerConfig) => void
|
|
95
|
+
*/
|
|
96
|
+
export type OnTimerDidStartAction = (timerConfig: ITimerConfig) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Callback for OnTimerDidPauseAction.
|
|
99
|
+
* (timerConfig: ITimerConfig) => void
|
|
100
|
+
*/
|
|
101
|
+
export type OnTimerDidPauseAction = (timerConfig: ITimerConfig) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Callback for OnTimerDidPlayAction.
|
|
104
|
+
* (timerConfig: ITimerConfig) => void
|
|
105
|
+
*/
|
|
106
|
+
export type OnTimerDidPlayAction = (timerConfig: ITimerConfig) => void;
|
|
107
|
+
/**
|
|
108
|
+
* Callback for OnTimerDidFinishAction.
|
|
109
|
+
* (timerConfig: ITimerConfig) => void
|
|
110
|
+
*/
|
|
111
|
+
export type OnTimerDidFinishAction = (timerConfig: ITimerConfig) => void;
|
|
112
|
+
//# sourceMappingURL=ActionTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionTypes.d.ts","sourceRoot":"","sources":["../../../src/types/ActionTypes.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionTypes.js","sourceRoot":"","sources":["../../../src/types/ActionTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
+
*/
|
|
5
|
+
import { UserMeetingRole } from "@microsoft/live-share";
|
|
6
|
+
import { CanvasReferencePoint, IBrush, IPoint, InkingTool, LiveCanvasTreeNode } from "@microsoft/live-share-canvas";
|
|
7
|
+
export type SharedMapInitialData<T> = Map<string, T> | readonly (readonly [string, T])[] | {
|
|
8
|
+
[key: string]: T;
|
|
9
|
+
} | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Optional props for {@link useLiveCanvas}
|
|
12
|
+
*/
|
|
13
|
+
export interface IUseLiveCanvasOptionalProps {
|
|
14
|
+
/**
|
|
15
|
+
* Optional. Stateful boolean that will activate/de-activate `InkingManager` accordingly.
|
|
16
|
+
*/
|
|
17
|
+
active?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Optional. Stateful enum for what tool to use in the `InkingManager`.
|
|
20
|
+
*/
|
|
21
|
+
tool?: InkingTool;
|
|
22
|
+
/**
|
|
23
|
+
* Optional. Stateful lineBrush object for the selected lineBrush options to use in `InkingManager`.
|
|
24
|
+
*/
|
|
25
|
+
lineBrush?: IBrush;
|
|
26
|
+
/**
|
|
27
|
+
* Optional. Stateful offset point to use in the `InkingManager`. Gets the viewport offset. Defaults to 0,0.
|
|
28
|
+
*/
|
|
29
|
+
offset?: IPoint;
|
|
30
|
+
/**
|
|
31
|
+
* Optional. Stateful scale number to use in the `InkingManager`. Defaults to 1 and must be greater than 0.
|
|
32
|
+
*/
|
|
33
|
+
scale?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Optional. Stateful reference point enum to use in the `InkingManger`. Defaults to "center".
|
|
36
|
+
*/
|
|
37
|
+
referencePoint?: CanvasReferencePoint;
|
|
38
|
+
/**
|
|
39
|
+
* Optional. Stateful boolean flag for whether cursor should be shared in `LiveCanvas`. Defaults to false.
|
|
40
|
+
*/
|
|
41
|
+
isCursorShared?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Optional. url string for the local user to display alongside their cursor. Defaults to undefined.
|
|
44
|
+
*/
|
|
45
|
+
localUserPictureUrl?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Optional. A Fluid `LiveCanvasTree` `TreeNode` instance to swap out the underlying storage solution for strokes.
|
|
48
|
+
* To learn more, look at Fluid's [SharedTree](https://fluidframework.com/docs/data-structures/tree/) documentation.
|
|
49
|
+
*/
|
|
50
|
+
node?: LiveCanvasTreeNode;
|
|
51
|
+
/**
|
|
52
|
+
* Optional. The user roles that are allowed to start/stop/pause the timer.
|
|
53
|
+
*/
|
|
54
|
+
allowedRoles?: UserMeetingRole[];
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=PropTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropTypes.d.ts","sourceRoot":"","sources":["../../../src/types/PropTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACH,oBAAoB,EACpB,MAAM,EACN,MAAM,EACN,UAAU,EACV,kBAAkB,EACrB,MAAM,8BAA8B,CAAC;AAGtC,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAC5B,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,GACd,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,GACjC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAA;CAAE,GACpB,SAAS,CAAC;AAEhB;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B;;OAEG;IACH,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropTypes.js","sourceRoot":"","sources":["../../../src/types/PropTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|