@webkrafters/eagleeye 1.0.4 → 1.0.6
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 +7 -2
- package/dist/index.d.ts +11 -14
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
|
|
25
25
|
<p>Framework-agnostic native-javasacript change-stream capable immutable state manager.</p>
|
|
26
26
|
<p>It is not logically bound to any section of an application. A single instance may be deployed anywhere within an application as needed.</p>
|
|
27
|
-
<p>It is
|
|
27
|
+
<p>It is not bound by quantity. As many instances as needed may be created and deployed simultaneously anywhere within an application.</p>
|
|
28
|
+
<p>It supports framework-agnostic state sharing among applications. Simply create an <a href="https://auto-immutable.js.org/intro/">Auto Immutable</a> instance to pass around as the <code>value</code> argument for this or any <a href="https://eagleeye.js.org">Eagle Eye</a> based state manager instances.</p>
|
|
28
29
|
|
|
29
30
|
<br />
|
|
30
31
|
<p><b>Name:</b> Eagle Eye.</p>
|
|
@@ -35,7 +36,11 @@
|
|
|
35
36
|
|
|
36
37
|
Please consult the [Getting Started](https://eagleeye.js.org/getting-started) page for quick information regarding usage.
|
|
37
38
|
|
|
38
|
-
There are also framework specific Eagle-Eye installations such as
|
|
39
|
+
There are also framework specific Eagle-Eye installations such as:
|
|
40
|
+
<br />
|
|
41
|
+
[React Eagle Eye](https://www.npmjs.com/package/@webkrafters/react-eagle)
|
|
42
|
+
<br />
|
|
43
|
+
[React Observable Context](https://www.npmjs.com/package/@webkrafters/react-observable-context)
|
|
39
44
|
|
|
40
45
|
|
|
41
46
|
## Please see more documentation here:
|
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