@yorkie-js/react 0.6.22 → 0.6.24
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/dist/yorkie-js-react.d.ts +31 -17
- package/dist/yorkie-js-react.es.js +662 -214
- package/dist/yorkie-js-react.es.js.map +1 -1
- package/dist/yorkie-js-react.js +661 -213
- package/dist/yorkie-js-react.js.map +1 -1
- package/package.json +10 -4
|
@@ -9,8 +9,27 @@ import { Presence } from '@yorkie-js/sdk';
|
|
|
9
9
|
import { PropsWithChildren } from 'react';
|
|
10
10
|
import { StreamConnectionStatus } from '@yorkie-js/sdk';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* `createDocumentSelector` is a factory function that provides a selector-based `useDocument` hook.
|
|
14
|
+
* By currying this function, type T can be inferred from the selector function.
|
|
15
|
+
*/
|
|
16
|
+
export declare const createDocumentSelector: <R, P extends Indexable = Indexable>() => <T = DocumentContextType<R, P>>(selector: (state: DocumentContextType<R, P>) => T, equalityFn?: (a: T, b: T) => boolean) => T;
|
|
17
|
+
|
|
12
18
|
export { Document_2 as Document }
|
|
13
19
|
|
|
20
|
+
declare type DocumentContextType<R, P extends Indexable = Indexable> = {
|
|
21
|
+
doc: Document_2<R, P> | undefined;
|
|
22
|
+
root: R;
|
|
23
|
+
presences: Array<{
|
|
24
|
+
clientID: string;
|
|
25
|
+
presence: P;
|
|
26
|
+
}>;
|
|
27
|
+
connection: StreamConnectionStatus;
|
|
28
|
+
update: (callback: (root: R, presence: Presence<P>) => void) => void;
|
|
29
|
+
loading: boolean;
|
|
30
|
+
error: Error | undefined;
|
|
31
|
+
};
|
|
32
|
+
|
|
14
33
|
/**
|
|
15
34
|
* `DocumentProvider` is a component that provides a document to its children.
|
|
16
35
|
* This component must be under a `YorkieProvider` component to initialize the
|
|
@@ -27,42 +46,37 @@ export { JSONArray }
|
|
|
27
46
|
|
|
28
47
|
export { JSONObject }
|
|
29
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Performs a shallow equality check between two values.
|
|
51
|
+
*/
|
|
52
|
+
export declare function shallowEqual<T>(valueA: T, valueB: T): boolean;
|
|
53
|
+
|
|
30
54
|
/**
|
|
31
55
|
* `useConnection` is a custom hook that returns the connection status of the document.
|
|
32
56
|
*/
|
|
33
57
|
export declare const useConnection: () => StreamConnectionStatus;
|
|
34
58
|
|
|
35
59
|
/**
|
|
36
|
-
* `useDocument` is a custom hook that returns the
|
|
60
|
+
* `useDocument` is a custom hook that returns the complete document context.
|
|
37
61
|
* This hook must be used within a `DocumentProvider`.
|
|
62
|
+
* @returns The complete document context.
|
|
38
63
|
*/
|
|
39
|
-
export declare
|
|
40
|
-
doc: Document_2<R, P>;
|
|
41
|
-
root: R;
|
|
42
|
-
presences: {
|
|
43
|
-
clientID: string;
|
|
44
|
-
presence: P;
|
|
45
|
-
}[];
|
|
46
|
-
connection: StreamConnectionStatus;
|
|
47
|
-
update: (callback: (root: R, presence: Presence<P>) => void) => void;
|
|
48
|
-
loading: boolean;
|
|
49
|
-
error: Error | undefined;
|
|
50
|
-
};
|
|
64
|
+
export declare function useDocument<R, P extends Indexable = Indexable>(): DocumentContextType<R, P>;
|
|
51
65
|
|
|
52
66
|
/**
|
|
53
67
|
* `usePresences` is a custom hook that returns the presences of the document.
|
|
54
68
|
*/
|
|
55
|
-
export declare const usePresences: () => {
|
|
69
|
+
export declare const usePresences: <P extends Indexable = Indexable>() => {
|
|
56
70
|
clientID: string;
|
|
57
|
-
presence:
|
|
71
|
+
presence: P;
|
|
58
72
|
}[];
|
|
59
73
|
|
|
60
74
|
/**
|
|
61
75
|
* `useRoot` is a custom hook that returns the root object of the document.
|
|
62
76
|
* This hook must be used within a `DocumentProvider`.
|
|
63
77
|
*/
|
|
64
|
-
export declare const useRoot: () => {
|
|
65
|
-
root:
|
|
78
|
+
export declare const useRoot: <R>() => {
|
|
79
|
+
root: R;
|
|
66
80
|
};
|
|
67
81
|
|
|
68
82
|
/**
|