@microsoft/live-share-react 1.3.0-preview.0 → 1.3.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.
Files changed (38) hide show
  1. package/.nycrc.json +9 -9
  2. package/LICENSE +86 -86
  3. package/README.md +608 -608
  4. package/package.json +50 -50
  5. package/src/index.ts +6 -6
  6. package/src/interfaces/LiveInterfaceExtensions.ts +26 -26
  7. package/src/interfaces/index.ts +1 -1
  8. package/src/internal/errors.ts +57 -57
  9. package/src/internal/index.ts +2 -2
  10. package/src/internal/type-guards.ts +9 -9
  11. package/src/live-hooks/index.ts +7 -7
  12. package/src/live-hooks/useLiveCanvas.ts +191 -191
  13. package/src/live-hooks/useLiveEvent.ts +140 -140
  14. package/src/live-hooks/useLiveFollowMode.ts +316 -316
  15. package/src/live-hooks/useLivePresence.ts +147 -147
  16. package/src/live-hooks/useLiveState.ts +110 -110
  17. package/src/live-hooks/useLiveTimer.ts +213 -213
  18. package/src/live-hooks/useMediaSynchronizer.ts +295 -295
  19. package/src/providers/AzureProvider.tsx +261 -261
  20. package/src/providers/LiveShareProvider.tsx +210 -210
  21. package/src/providers/index.ts +2 -2
  22. package/src/shared-hooks/index.ts +4 -4
  23. package/src/shared-hooks/useDynamicDDS.ts +82 -82
  24. package/src/shared-hooks/useSharedMap.ts +159 -159
  25. package/src/shared-hooks/useSharedState.ts +96 -96
  26. package/src/shared-hooks/useSharedStateRegistry.ts +170 -170
  27. package/src/types/ActionTypes.ts +161 -161
  28. package/src/types/PropTypes.ts +10 -10
  29. package/src/types/ResultTypes.ts +332 -332
  30. package/src/types/index.ts +3 -3
  31. package/src/utils/index.ts +1 -1
  32. package/src/utils/type-check.ts +69 -69
  33. package/tsconfig.build.json +5 -5
  34. package/tsconfig.json +72 -72
  35. package/bin/internal/useSharedStateRegistry.d.ts +0 -31
  36. package/bin/internal/useSharedStateRegistry.d.ts.map +0 -1
  37. package/bin/internal/useSharedStateRegistry.js +0 -102
  38. package/bin/internal/useSharedStateRegistry.js.map +0 -1
@@ -1 +1 @@
1
- export * from "./type-check";
1
+ export * from "./type-check";
@@ -1,69 +1,69 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
-
6
- import {
7
- ExtendedMediaMetadata,
8
- IMediaPlayer,
9
- } from "@microsoft/live-share-media";
10
- import React from "react";
11
-
12
- export function isRefObject<T>(value: any): value is React.RefObject<T> {
13
- return value.current === null || !!value.current;
14
- }
15
-
16
- export function isMediaElement(value: any): value is IMediaPlayer {
17
- if (value) {
18
- return (
19
- value.currentSrc !== undefined &&
20
- value.currentTime !== undefined &&
21
- value.duration !== undefined &&
22
- value.ended !== undefined &&
23
- value.muted !== undefined &&
24
- value.paused !== undefined &&
25
- value.playbackRate !== undefined &&
26
- value.src !== undefined &&
27
- value.volume !== undefined &&
28
- value.load !== undefined &&
29
- value.pause !== undefined &&
30
- value.play !== undefined &&
31
- value.addEventListener !== undefined &&
32
- value.removeEventListener !== undefined
33
- );
34
- }
35
- return false;
36
- }
37
-
38
- export function isExtendedMediaMetadata(
39
- value: any
40
- ): value is ExtendedMediaMetadata {
41
- return value === null || !!value?.trackIdentifier;
42
- }
43
-
44
- export function isMap(value: any): value is Map<string, any> {
45
- return value instanceof Map;
46
- }
47
-
48
- export function isEntries(
49
- value: any
50
- ): value is readonly (readonly [string, any])[] {
51
- try {
52
- const tryValue = value as readonly (readonly [any, any])[];
53
- if (typeof tryValue[0][0] === "string") {
54
- return true;
55
- }
56
- return false;
57
- } catch (error) {
58
- return false;
59
- }
60
- }
61
-
62
- export function isJSON(value: any): value is { [key: string]: any } {
63
- try {
64
- const tryValue = value as { [key: string]: any };
65
- return Object.keys(tryValue).length > 0;
66
- } catch (error) {
67
- return false;
68
- }
69
- }
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the Microsoft Live Share SDK License.
4
+ */
5
+
6
+ import {
7
+ ExtendedMediaMetadata,
8
+ IMediaPlayer,
9
+ } from "@microsoft/live-share-media";
10
+ import React from "react";
11
+
12
+ export function isRefObject<T>(value: any): value is React.RefObject<T> {
13
+ return value.current === null || !!value.current;
14
+ }
15
+
16
+ export function isMediaElement(value: any): value is IMediaPlayer {
17
+ if (value) {
18
+ return (
19
+ value.currentSrc !== undefined &&
20
+ value.currentTime !== undefined &&
21
+ value.duration !== undefined &&
22
+ value.ended !== undefined &&
23
+ value.muted !== undefined &&
24
+ value.paused !== undefined &&
25
+ value.playbackRate !== undefined &&
26
+ value.src !== undefined &&
27
+ value.volume !== undefined &&
28
+ value.load !== undefined &&
29
+ value.pause !== undefined &&
30
+ value.play !== undefined &&
31
+ value.addEventListener !== undefined &&
32
+ value.removeEventListener !== undefined
33
+ );
34
+ }
35
+ return false;
36
+ }
37
+
38
+ export function isExtendedMediaMetadata(
39
+ value: any
40
+ ): value is ExtendedMediaMetadata {
41
+ return value === null || !!value?.trackIdentifier;
42
+ }
43
+
44
+ export function isMap(value: any): value is Map<string, any> {
45
+ return value instanceof Map;
46
+ }
47
+
48
+ export function isEntries(
49
+ value: any
50
+ ): value is readonly (readonly [string, any])[] {
51
+ try {
52
+ const tryValue = value as readonly (readonly [any, any])[];
53
+ if (typeof tryValue[0][0] === "string") {
54
+ return true;
55
+ }
56
+ return false;
57
+ } catch (error) {
58
+ return false;
59
+ }
60
+ }
61
+
62
+ export function isJSON(value: any): value is { [key: string]: any } {
63
+ try {
64
+ const tryValue = value as { [key: string]: any };
65
+ return Object.keys(tryValue).length > 0;
66
+ } catch (error) {
67
+ return false;
68
+ }
69
+ }
@@ -1,6 +1,6 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
5
- }
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
5
+ }
6
6
  }
package/tsconfig.json CHANGED
@@ -1,72 +1,72 @@
1
- {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
-
5
- /* Basic Options */
6
- // "incremental": true, /* Enable incremental compilation */
7
- "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8
- "module": "ES2020", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
9
- "lib": ["es2020","DOM", "DOM.Iterable"], /* Specify library files to be included in the compilation. */
10
- "allowJs": false, /* Allow javascript files to be compiled. */
11
- // "checkJs": true, /* Report errors in .js files. */
12
- "jsx": "react-jsx", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
13
- "declaration": true, /* Generates corresponding '.d.ts' file. */
14
- "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15
- "sourceMap": true, /* Generates corresponding '.map' file. */
16
- // "outFile": "./", /* Concatenate and emit output to single file. */
17
- "outDir": "./bin", /* Redirect output structure to the directory. */
18
- // "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
19
- // "composite": true, /* Enable project compilation */
20
- // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
21
- // "removeComments": true, /* Do not emit comments to output. */
22
- // "noEmit": true, /* Do not emit outputs. */
23
- // "importHelpers": true, /* Import emit helpers from 'tslib'. */
24
- // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
25
- // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
26
-
27
- /* Strict Type-Checking Options */
28
- "strict": true, /* Enable all strict type-checking options. */
29
- // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
30
- // "strictNullChecks": true, /* Enable strict null checks. */
31
- // "strictFunctionTypes": true, /* Enable strict checking of function types. */
32
- // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
33
- // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
34
- // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
35
- // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
36
-
37
- /* Additional Checks */
38
- // "noUnusedLocals": true, /* Report errors on unused locals. */
39
- // "noUnusedParameters": true, /* Report errors on unused parameters. */
40
- // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
41
- // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
42
-
43
- /* Module Resolution Options */
44
- "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
45
- // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
46
- // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
47
- // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
48
- // "typeRoots": [], /* List of folders to include type definitions from. */
49
- // "types": [], /* Type declaration files to be included in compilation. */
50
- // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
51
- "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
52
- // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
53
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
54
-
55
- /* Source Map Options */
56
- // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
57
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
58
- // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
59
- // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
60
-
61
- /* Experimental Options */
62
- // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
63
- // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
64
-
65
- /* Advanced Options */
66
- "skipLibCheck": true, /* Skip type checking of declaration files. */
67
- "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
68
- },
69
- "files": [
70
- "src/index.ts"
71
- ]
72
- }
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
+
5
+ /* Basic Options */
6
+ // "incremental": true, /* Enable incremental compilation */
7
+ "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8
+ "module": "ES2020", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
9
+ "lib": ["es2020","DOM", "DOM.Iterable"], /* Specify library files to be included in the compilation. */
10
+ "allowJs": false, /* Allow javascript files to be compiled. */
11
+ // "checkJs": true, /* Report errors in .js files. */
12
+ "jsx": "react-jsx", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
13
+ "declaration": true, /* Generates corresponding '.d.ts' file. */
14
+ "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15
+ "sourceMap": true, /* Generates corresponding '.map' file. */
16
+ // "outFile": "./", /* Concatenate and emit output to single file. */
17
+ "outDir": "./bin", /* Redirect output structure to the directory. */
18
+ // "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
19
+ // "composite": true, /* Enable project compilation */
20
+ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
21
+ // "removeComments": true, /* Do not emit comments to output. */
22
+ // "noEmit": true, /* Do not emit outputs. */
23
+ // "importHelpers": true, /* Import emit helpers from 'tslib'. */
24
+ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
25
+ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
26
+
27
+ /* Strict Type-Checking Options */
28
+ "strict": true, /* Enable all strict type-checking options. */
29
+ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
30
+ // "strictNullChecks": true, /* Enable strict null checks. */
31
+ // "strictFunctionTypes": true, /* Enable strict checking of function types. */
32
+ // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
33
+ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
34
+ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
35
+ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
36
+
37
+ /* Additional Checks */
38
+ // "noUnusedLocals": true, /* Report errors on unused locals. */
39
+ // "noUnusedParameters": true, /* Report errors on unused parameters. */
40
+ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
41
+ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
42
+
43
+ /* Module Resolution Options */
44
+ "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
45
+ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
46
+ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
47
+ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
48
+ // "typeRoots": [], /* List of folders to include type definitions from. */
49
+ // "types": [], /* Type declaration files to be included in compilation. */
50
+ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
51
+ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
52
+ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
53
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
54
+
55
+ /* Source Map Options */
56
+ // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
57
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
58
+ // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
59
+ // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
60
+
61
+ /* Experimental Options */
62
+ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
63
+ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
64
+
65
+ /* Advanced Options */
66
+ "skipLibCheck": true, /* Skip type checking of declaration files. */
67
+ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
68
+ },
69
+ "files": [
70
+ "src/index.ts"
71
+ ]
72
+ }
@@ -1,31 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- import { DeleteSharedStateAction, IAzureContainerResults, RegisterSharedSetStateAction, UnregisterSharedSetStateAction, UpdateSharedStateAction } from "../types";
6
- export interface ISharedStateRegistryResponse {
7
- /**
8
- * Register a set state action callback
9
- */
10
- registerSharedSetStateAction: RegisterSharedSetStateAction;
11
- /**
12
- * Unregister a set state action callback
13
- */
14
- unregisterSharedSetStateAction: UnregisterSharedSetStateAction;
15
- /**
16
- * Setter callback to update the shared state
17
- */
18
- updateSharedState: UpdateSharedStateAction;
19
- /**
20
- * Delete a shared state value
21
- */
22
- deleteSharedState: DeleteSharedStateAction;
23
- }
24
- /**
25
- * Hook used internally to keep track of the SharedSetStateActionMap for each unique key. It sets state values for provided keys and updates components listening to the values.
26
- *
27
- * @param results IAzureContainerResults response or undefined
28
- * @returns ISharedStateRegistryResponse object
29
- */
30
- export declare const useSharedStateRegistry: (results: IAzureContainerResults | undefined) => ISharedStateRegistryResponse;
31
- //# sourceMappingURL=useSharedStateRegistry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSharedStateRegistry.d.ts","sourceRoot":"","sources":["../../src/internal/useSharedStateRegistry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACH,uBAAuB,EACvB,sBAAsB,EACtB,4BAA4B,EAE5B,8BAA8B,EAC9B,uBAAuB,EAC1B,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,4BAA4B;IACzC;;OAEG;IACH,4BAA4B,EAAE,4BAA4B,CAAC;IAC3D;;OAEG;IACH,8BAA8B,EAAE,8BAA8B,CAAC;IAC/D;;OAEG;IACH,iBAAiB,EAAE,uBAAuB,CAAC;IAC3C;;OAEG;IACH,iBAAiB,EAAE,uBAAuB,CAAC;CAC9C;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,YACtB,sBAAsB,GAAG,SAAS,KAC5C,4BAwHF,CAAC"}
@@ -1,102 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the Microsoft Live Share SDK License.
4
- */
5
- import React from "react";
6
- /**
7
- * Hook used internally to keep track of the SharedSetStateActionMap for each unique key. It sets state values for provided keys and updates components listening to the values.
8
- *
9
- * @param results IAzureContainerResults response or undefined
10
- * @returns ISharedStateRegistryResponse object
11
- */
12
- export const useSharedStateRegistry = (results) => {
13
- const registeredSharedSetStateActionMapRef = React.useRef(new Map());
14
- /**
15
- * @see ISharedStateRegistryResponse.registerSharedSetStateAction
16
- */
17
- const registerSharedSetStateAction = React.useCallback((uniqueKey, componentId, setLocalStateAction) => {
18
- let actionsMap = registeredSharedSetStateActionMapRef.current.get(uniqueKey);
19
- if (actionsMap) {
20
- if (!actionsMap.has(componentId)) {
21
- actionsMap.set(componentId, setLocalStateAction);
22
- }
23
- }
24
- else {
25
- actionsMap = new Map();
26
- actionsMap.set(componentId, setLocalStateAction);
27
- registeredSharedSetStateActionMapRef.current.set(uniqueKey, actionsMap);
28
- }
29
- // Set initial values, if known
30
- const stateMap = results === null || results === void 0 ? void 0 : results.container.initialObjects.TURBO_STATE_MAP;
31
- const initialValue = stateMap === null || stateMap === void 0 ? void 0 : stateMap.get(uniqueKey);
32
- if (initialValue) {
33
- setLocalStateAction(initialValue);
34
- }
35
- }, [results]);
36
- /**
37
- * @see ISharedStateRegistryResponse.unregisterSharedSetStateAction
38
- */
39
- const unregisterSharedSetStateAction = React.useCallback((uniqueKey, componentId) => {
40
- let actionsMap = registeredSharedSetStateActionMapRef.current.get(uniqueKey);
41
- if (actionsMap === null || actionsMap === void 0 ? void 0 : actionsMap.has(componentId)) {
42
- actionsMap.delete(componentId);
43
- }
44
- }, []);
45
- /**
46
- * @see ISharedStateRegistryResponse.updateSharedState
47
- */
48
- const updateSharedState = React.useCallback((uniqueKey, value) => {
49
- if (!results)
50
- return;
51
- const { container } = results;
52
- const stateMap = container.initialObjects
53
- .TURBO_STATE_MAP;
54
- stateMap.set(uniqueKey, value);
55
- }, [results]);
56
- /**
57
- * @see ISharedStateRegistryResponse.deleteSharedState
58
- */
59
- const deleteSharedState = React.useCallback((uniqueKey) => {
60
- if (!results)
61
- return;
62
- const { container } = results;
63
- let actionsMap = registeredSharedSetStateActionMapRef.current.get(uniqueKey);
64
- actionsMap === null || actionsMap === void 0 ? void 0 : actionsMap.clear();
65
- const stateMap = container.initialObjects
66
- .TURBO_STATE_MAP;
67
- stateMap.delete(uniqueKey);
68
- }, [results]);
69
- React.useEffect(() => {
70
- if (!results)
71
- return;
72
- const { container } = results;
73
- const stateMap = container.initialObjects.TURBO_STATE_MAP;
74
- const valueChangedListener = (changed) => {
75
- if (registeredSharedSetStateActionMapRef.current.has(changed.key)) {
76
- const value = stateMap.get(changed.key);
77
- const actionMap = registeredSharedSetStateActionMapRef.current.get(changed.key);
78
- actionMap === null || actionMap === void 0 ? void 0 : actionMap.forEach((setLocalStateHandler) => {
79
- setLocalStateHandler(value);
80
- });
81
- }
82
- };
83
- stateMap.on("valueChanged", valueChangedListener);
84
- // Set initial values
85
- stateMap.forEach((value, key) => {
86
- const actionMap = registeredSharedSetStateActionMapRef.current.get(key);
87
- actionMap === null || actionMap === void 0 ? void 0 : actionMap.forEach((setLocalStateHandler) => {
88
- setLocalStateHandler(value);
89
- });
90
- });
91
- return () => {
92
- stateMap.off("valueChanged", valueChangedListener);
93
- };
94
- }, [results]);
95
- return {
96
- registerSharedSetStateAction,
97
- unregisterSharedSetStateAction,
98
- updateSharedState,
99
- deleteSharedState,
100
- };
101
- };
102
- //# sourceMappingURL=useSharedStateRegistry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSharedStateRegistry.js","sourceRoot":"","sources":["../../src/internal/useSharedStateRegistry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AA6B1B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAClC,OAA2C,EACf,EAAE;IAC9B,MAAM,oCAAoC,GAAG,KAAK,CAAC,MAAM,CAEvD,IAAI,GAAG,EAAE,CAAC,CAAC;IAEb;;OAEG;IACH,MAAM,4BAA4B,GAAG,KAAK,CAAC,WAAW,CAClD,CACI,SAAiB,EACjB,WAAmB,EACnB,mBAAwC,EAC1C,EAAE;QACA,IAAI,UAAU,GACV,oCAAoC,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAChE,IAAI,UAAU,EAAE;YACZ,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;gBAC9B,UAAU,CAAC,GAAG,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;aACpD;SACJ;aAAM;YACH,UAAU,GAAG,IAAI,GAAG,EAA+B,CAAC;YACpD,UAAU,CAAC,GAAG,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;YACjD,oCAAoC,CAAC,OAAO,CAAC,GAAG,CAC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