@webkrafters/react-observable-context 4.1.4 → 4.1.5
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/main/index.d.ts +8 -7
- package/package.json +1 -1
package/dist/main/index.d.ts
CHANGED
|
@@ -8,12 +8,13 @@ export function createContext<T extends import("../types").State>(): ObservableC
|
|
|
8
8
|
/**
|
|
9
9
|
* Actively monitors the store and triggers component re-render if any of the watched keys in the state objects changes
|
|
10
10
|
*
|
|
11
|
-
* @param {ObservableContext<
|
|
12
|
-
* @param {
|
|
13
|
-
* @returns {Store<
|
|
14
|
-
* @template {State}
|
|
15
|
-
* @
|
|
16
|
-
* @
|
|
11
|
+
* @param {ObservableContext<STATE>} context Refers to the PublicObservableContext<T> type of the ObservableContext<T>
|
|
12
|
+
* @param {SELECTOR_MAP} [selectorMap = {}] Key:value pairs where `key` => arbitrary key given to a Store.data property holding a state slice and `value` => property path to a state slice used by this component: see examples below. May add a mapping for a certain arbitrary key='state' and value='@@STATE' to indicate a desire to obtain the entire state object and assign to a `state` property of Store.data. A change in any of the referenced properties results in this component render. When using '@@STATE', note that any change within the state object will result in this component render.
|
|
13
|
+
* @returns {Store<STATE>}
|
|
14
|
+
* @template {State} STATE
|
|
15
|
+
* @template {SelectorMap<STATE>} [SELECTOR_MAP=SelectorMap<STATE>]
|
|
16
|
+
* @see {ObservableContext<STATE>}
|
|
17
|
+
* @exampleS
|
|
17
18
|
* a valid property path follows the `lodash` object property path convention.
|
|
18
19
|
* for a state = { a: 1, b: 2, c: 3, d: { e: 5, f: [6, { x: 7, y: 8, z: 9 } ] } }
|
|
19
20
|
* Any of the following is an applicable selector map.
|
|
@@ -30,7 +31,7 @@ export function createContext<T extends import("../types").State>(): ObservableC
|
|
|
30
31
|
* {myX: 'd.e.f[1].x'} or {myX: 'd.e.f.1.x'} => {myX: 7} // same applies to {myY: 'd.e.f[1].y'} = {myY: 8}; {myZ: 'd.e.f[1].z'} = {myZ: 9}
|
|
31
32
|
* {myData: '@@STATE'} => {myData: state}
|
|
32
33
|
*/
|
|
33
|
-
export function useContext<
|
|
34
|
+
export function useContext<STATE extends import("../types").State, SELECTOR_MAP extends BaseSelectorMap<STATE> = BaseSelectorMap<STATE>>(context: ObservableContext<STATE>, selectorMap?: SELECTOR_MAP): Store<STATE>;
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
* Provides an HOC function for connecting its WrappedComponent argument to the context store.
|
package/package.json
CHANGED