@webkrafters/react-observable-context 4.1.2 → 4.1.3
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 +14 -10
- package/package.json +1 -1
package/dist/main/index.d.ts
CHANGED
|
@@ -33,18 +33,20 @@ export function createContext<T extends import("../types").State>(): ObservableC
|
|
|
33
33
|
export function useContext<T extends import("../types").State>(context: ObservableContext<T>, selectorMap?: SelectorMap<T>): Store<T>;
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @
|
|
41
|
-
* @
|
|
42
|
-
* @
|
|
36
|
+
* Provides an HOC function for connecting its WrappedComponent argument to the context store.
|
|
37
|
+
*
|
|
38
|
+
* The HOC function automatically memoizes any un-memoized WrappedComponent argument.
|
|
39
|
+
*
|
|
40
|
+
* @param {ObservableContext<STATE>} context - Refers to the PublicObservableContext<T> type of the ObservableContext<T>
|
|
41
|
+
* @param {SelectorMap<STATE>} [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.
|
|
42
|
+
* @returns {(WrappedComponent: C) => ConnectedComponent<OWNPROPS, Store<STATE>>} - Connector HOC function
|
|
43
|
+
* @template {State} STATE
|
|
44
|
+
* @template {State} [OWNPROPS = {}]
|
|
45
|
+
* @template {ComponentType<ConnectedComponentProps<OWNPROPS, PartialStore<STATE>>|ExoticComponent<ConnectedComponentProps<OWNPROPS, PartialStore<STATE>>} [C = ComponentType<ConnectedComponentProps<OWNPROPS, PartialStore<STATE>>]
|
|
46
|
+
* @see {ObservableContext<STATE>}
|
|
43
47
|
* @see {useContext} for selectorMap sample
|
|
44
48
|
*/
|
|
45
|
-
export function connect<
|
|
46
|
-
[x: string]: any;
|
|
47
|
-
} = PartialStore<T>, C extends ComponentType<P> | import("react").ExoticComponent<ComponentType<P>>>(context: ObservableContext<T>, selectorMap?: SelectorMap<T>): (WrappedComponent: C) => MemoExoticComponent<P>;
|
|
49
|
+
export function connect<STATE extends import("../types").State, OWNPROPS extends import("../types").State = {}, C extends ComponentType<ConnectedComponentProps<OWNPROPS, PartialStore<STATE>> | import("react").ExoticComponent<ComponentType<ConnectedComponentProps<OWNPROPS, PartialStore<STATE>>>>> = ComponentType<ConnectedComponentProps<OWNPROPS, PartialStore<STATE>>>>(context: ObservableContext<STATE>, selectorMap?: SelectorMap<STATE>): (WrappedComponent: C) => ConnectedComponent<OWNPROPS, Store<STATE>>;
|
|
48
50
|
export type CLEAR_TAG = typeof CLEAR_TAG;
|
|
49
51
|
|
|
50
52
|
/** @example changes = { property: CLEAR_TAG } */
|
|
@@ -143,6 +145,8 @@ export type PartialStore<T extends import("../types").State> = {
|
|
|
143
145
|
export type Store<T extends import("../types").State> = import("../types").Store<T>;
|
|
144
146
|
export type IStore = import("../types").IStore;
|
|
145
147
|
export type IStorage<T extends import("../types").State> = import("../types").IStorage<T>;
|
|
148
|
+
export type ConnectedComponent<OWNPROPS extends import("../types").State = {}, STORE extends Store<import("../types").State> = Store<import("../types").State>> = MemoExoticComponent<ConnectedComponentProps<OWNPROPS, STORE>>;
|
|
149
|
+
export type ConnectedComponentProps<OWNPROPS extends import("../types").State = {}, STORE extends Store<import("../types").State> = Store<import("../types").State>> = STORE & OWNPROPS;
|
|
146
150
|
export type NonReactUsageReport = import("../types").NonReactUsageReport;
|
|
147
151
|
export type Data = import("../types").Data;
|
|
148
152
|
export type ReactNode = import("react").ReactNode;
|
package/package.json
CHANGED