@webkrafters/eagleeye 1.0.5 → 1.0.7
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/README.md +3 -1
- package/dist/index.d.ts +11 -14
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,9 @@ Please consult the [Getting Started](https://eagleeye.js.org/getting-started) pa
|
|
|
38
38
|
|
|
39
39
|
There are also framework specific Eagle-Eye installations such as:
|
|
40
40
|
<br />
|
|
41
|
-
[
|
|
41
|
+
[Angular Eagle Eye](https://www.npmjs.com/package/@webkrafters/ng-eagleeye)
|
|
42
|
+
<br />
|
|
43
|
+
[React Eagle Eye](https://www.npmjs.com/package/@webkrafters/react-eagleeye)
|
|
42
44
|
<br />
|
|
43
45
|
[React Observable Context](https://www.npmjs.com/package/@webkrafters/react-observable-context)
|
|
44
46
|
|
package/dist/index.d.ts
CHANGED
|
@@ -19,17 +19,14 @@ export type Text = string | number;
|
|
|
19
19
|
export type FullStateSelector = typeof FULL_STATE_SELECTOR;
|
|
20
20
|
export type ObjectSelector = Record<Text, Text | FullStateSelector>;
|
|
21
21
|
export type ArraySelector = Array<Text | FullStateSelector>;
|
|
22
|
-
export type SelectorMap = ObjectSelector | ArraySelector |
|
|
23
|
-
type
|
|
24
|
-
type
|
|
25
|
-
type
|
|
26
|
-
type
|
|
27
|
-
type
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} : SELECTOR_MAP extends ArraySelector ? {
|
|
31
|
-
[S_NUM: number]: DataPoint<SELECTOR_MAP[number], STATE>;
|
|
32
|
-
} : Array<any>);
|
|
22
|
+
export type SelectorMap = ObjectSelector | ArraySelector | undefined | null;
|
|
23
|
+
type Replace<P extends string, S extends string, R extends string> = P extends `${infer K}${S}${infer PP}` ? `${K}${R}${Replace<PP, S, R>}` : P;
|
|
24
|
+
type DotizedPath<P extends string> = Replace<Replace<Replace<Replace<P, ']', '.'>, '[', '.'>, '..', '.'>, '...', '.'>;
|
|
25
|
+
type DrillType<T extends Record<any, any>, P extends string, W extends State> = P extends `${infer K}.${infer R}` ? T[K] extends {} ? DrillType<T[K], R, W> : any : P extends FullStateSelector ? W : T[P];
|
|
26
|
+
type ExtricateTypeFrom<T extends State, P extends string> = DrillType<T, DotizedPath<P>, T>;
|
|
27
|
+
export type Data<S extends SelectorMap = SelectorMap, T extends State = State> = S extends undefined | null ? {} : S extends ObjectSelector ? {
|
|
28
|
+
[K in keyof S]: S[K] extends string ? ExtricateTypeFrom<T, S[K]> : S[K] extends keyof T ? T[S[K]] : any;
|
|
29
|
+
} : S extends Array<infer U> ? U extends FullStateSelector ? Record<number, T> : Record<number, any> : Record<any, any>;
|
|
33
30
|
export type Changes<T extends State = State> = BaseChanges<T>;
|
|
34
31
|
interface StorageGetter<T extends State = State> {
|
|
35
32
|
(key: null): T;
|
|
@@ -76,7 +73,7 @@ export interface IStore<T extends State = State> {
|
|
|
76
73
|
setState: (changes: Changes<T>) => void;
|
|
77
74
|
}
|
|
78
75
|
export interface Store<T extends State = State, SELECTOR_MAP extends SelectorMap = SelectorMap> extends IStore<T> {
|
|
79
|
-
data: Data<SELECTOR_MAP>;
|
|
76
|
+
data: Data<SELECTOR_MAP, T>;
|
|
80
77
|
}
|
|
81
78
|
export interface StoreRef<T extends State = State> extends IStore<T> {
|
|
82
79
|
getState: (propertyPaths?: Array<string>) => T;
|
|
@@ -90,10 +87,10 @@ export interface StoreInternal<T extends State = State> extends StoreRef<T> {
|
|
|
90
87
|
closed: boolean;
|
|
91
88
|
}
|
|
92
89
|
export interface BaseStream<T extends State = State> {
|
|
93
|
-
<S extends SelectorMap>(selectorMap?: S): Channel<T, S>;
|
|
90
|
+
<const S extends SelectorMap>(selectorMap?: S): Channel<T, S>;
|
|
94
91
|
}
|
|
95
92
|
export interface Stream<T extends State = State> extends BaseStream<T> {
|
|
96
|
-
<S extends SelectorMap>(selectorMap?: S): Store<T, S>;
|
|
93
|
+
<const S extends SelectorMap>(selectorMap?: S): Store<T, S>;
|
|
97
94
|
}
|
|
98
95
|
export { CLEAR_TAG, DELETE_TAG, FULL_STATE_SELECTOR, MOVE_TAG, NULL_SELECTOR, PUSH_TAG, REPLACE_TAG, SET_TAG, SPLICE_TAG, Tag, } from './constants';
|
|
99
96
|
export { Channel, createEagleEye, EagleEyeContext } from './main';
|
package/dist/index.js
CHANGED
package/package.json
CHANGED