@figliolia/galena 3.0.1 → 3.0.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/README.md +43 -43
- package/dist/Galena.cjs +49 -18
- package/dist/Galena.d.cts +46 -19
- package/dist/Galena.d.cts.map +1 -1
- package/dist/Galena.d.mts +46 -19
- package/dist/Galena.d.mts.map +1 -1
- package/dist/Galena.mjs +49 -18
- package/dist/Galena.mjs.map +1 -1
- package/dist/State.cjs +13 -18
- package/dist/State.d.cts +13 -18
- package/dist/State.d.cts.map +1 -1
- package/dist/State.d.mts +13 -18
- package/dist/State.d.mts.map +1 -1
- package/dist/State.mjs +13 -18
- package/dist/State.mjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/types.d.cts +3 -2
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +3 -2
- package/dist/types.d.mts.map +1 -1
- package/package.json +9 -3
- package/src/Galena.ts +64 -19
- package/src/State.ts +13 -18
- package/src/types.ts +3 -1
package/dist/Galena.mjs
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { EventEmitter } from "@figliolia/event-emitter";
|
|
2
2
|
//#region src/Galena.ts
|
|
3
3
|
/**
|
|
4
|
-
* Galena
|
|
4
|
+
* ### Galena
|
|
5
5
|
*
|
|
6
|
-
* Galena
|
|
6
|
+
* Galena instances are designed to house one or more units of `State`
|
|
7
7
|
* and exist as a pseudo global application state.
|
|
8
8
|
*
|
|
9
9
|
* By design, each of its `State` units have isolated reactivity
|
|
10
10
|
* that prevents entire state trees from updating when a single
|
|
11
11
|
* unit changes.
|
|
12
12
|
*
|
|
13
|
-
* This is dissimilar to redux-like models where downstream reconciliations
|
|
14
|
-
* will propagate everwhere a given store is read from. In galena, downstream
|
|
15
|
-
* reconciliations occur only for consumers of the slice of state that
|
|
16
|
-
* changed - making it safer to use with more frequent state changes.
|
|
17
|
-
*
|
|
18
13
|
* ```typescript
|
|
19
14
|
* import { Galena } from "@figliolia/galena";
|
|
20
15
|
*
|
|
21
16
|
* const AppState = new Galena({
|
|
17
|
+
* user: new State("<user-stuff>"),
|
|
18
|
+
* business: new State("<business-logic-stuff>")
|
|
22
19
|
* // your reactive instances
|
|
23
20
|
* }, ...middleware);
|
|
24
21
|
*
|
|
@@ -26,8 +23,9 @@ import { EventEmitter } from "@figliolia/event-emitter";
|
|
|
26
23
|
* const myUnit = AppState.get("<key>"); // Returns State<T>
|
|
27
24
|
*
|
|
28
25
|
* // to run a callback anytime a unit of state changes
|
|
29
|
-
* const
|
|
26
|
+
* const listener = AppState.subscribe(({ state, updated }) => {
|
|
30
27
|
* // do something with the `State` instance that updated
|
|
28
|
+
* // the entirety of your state
|
|
31
29
|
* });
|
|
32
30
|
* ```
|
|
33
31
|
*/
|
|
@@ -37,9 +35,38 @@ var Galena = class {
|
|
|
37
35
|
this.state = state;
|
|
38
36
|
this.registerMiddleware(...middleware);
|
|
39
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Get
|
|
40
|
+
*
|
|
41
|
+
* Returns a connected State instance by key
|
|
42
|
+
*/
|
|
40
43
|
get(key) {
|
|
41
44
|
return this.state[key];
|
|
42
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Set
|
|
48
|
+
*
|
|
49
|
+
* Sets a connected State instance's state by key
|
|
50
|
+
*/
|
|
51
|
+
set(key, value) {
|
|
52
|
+
return this.get(key).set(value);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Update
|
|
56
|
+
*
|
|
57
|
+
* Invokes a connected State instance's update method key
|
|
58
|
+
*/
|
|
59
|
+
update(key, updater) {
|
|
60
|
+
return this.get(key).update(updater);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Subscribe
|
|
64
|
+
*
|
|
65
|
+
* Listen for changes on your Galena instnace. Your provided
|
|
66
|
+
* callback will be invoked each time an attached state instance
|
|
67
|
+
* changes. To your callback will be provided the `updated` state
|
|
68
|
+
* instance, along with the entire `state` tree
|
|
69
|
+
*/
|
|
43
70
|
subscribe = (subscriber) => {
|
|
44
71
|
const ID = this.Emitter.on("change", subscriber);
|
|
45
72
|
const unsubscribers = [];
|
|
@@ -56,6 +83,12 @@ var Galena = class {
|
|
|
56
83
|
while (unsubscribers.length) unsubscribers.pop?.()?.();
|
|
57
84
|
};
|
|
58
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* Register Middleware
|
|
88
|
+
*
|
|
89
|
+
* Adds middleware instances to each of the connected
|
|
90
|
+
* `State` instances
|
|
91
|
+
*/
|
|
59
92
|
registerMiddleware(...middlewares) {
|
|
60
93
|
for (const key in this.state) this.state[key]?.registerMiddleware?.(...middlewares);
|
|
61
94
|
}
|
|
@@ -64,24 +97,21 @@ var Galena = class {
|
|
|
64
97
|
}
|
|
65
98
|
};
|
|
66
99
|
/**
|
|
67
|
-
*
|
|
100
|
+
* ### createGalena
|
|
68
101
|
*
|
|
69
|
-
* Galena
|
|
102
|
+
* Galena instances are designed to house one or more units of `State`
|
|
70
103
|
* and exist as a pseudo global application state.
|
|
71
104
|
*
|
|
72
105
|
* By design, each of its `State` units have isolated reactivity
|
|
73
106
|
* that prevents entire state trees from updating when a single
|
|
74
107
|
* unit changes.
|
|
75
108
|
*
|
|
76
|
-
* This is dissimilar to redux-like models where downstream reconciliations
|
|
77
|
-
* will propagate everwhere a given store is read from. In galena, downstream
|
|
78
|
-
* reconciliations occur only for consumers of the slice of state that
|
|
79
|
-
* changed - making it safer to use with more frequent state changes.
|
|
80
|
-
*
|
|
81
109
|
* ```typescript
|
|
82
|
-
* import {
|
|
110
|
+
* import { Galena } from "@figliolia/galena";
|
|
83
111
|
*
|
|
84
|
-
* const AppState =
|
|
112
|
+
* const AppState = new Galena({
|
|
113
|
+
* user: new State("<user-stuff>"),
|
|
114
|
+
* business: new State("<business-logic-stuff>")
|
|
85
115
|
* // your reactive instances
|
|
86
116
|
* }, ...middleware);
|
|
87
117
|
*
|
|
@@ -89,8 +119,9 @@ var Galena = class {
|
|
|
89
119
|
* const myUnit = AppState.get("<key>"); // Returns State<T>
|
|
90
120
|
*
|
|
91
121
|
* // to run a callback anytime a unit of state changes
|
|
92
|
-
* const
|
|
122
|
+
* const listener = AppState.subscribe(({ state, updated }) => {
|
|
93
123
|
* // do something with the `State` instance that updated
|
|
124
|
+
* // the entirety of your state
|
|
94
125
|
* });
|
|
95
126
|
* ```
|
|
96
127
|
*/
|
package/dist/Galena.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Galena.mjs","names":[],"sources":["../src/Galena.ts"],"sourcesContent":["import { EventEmitter } from \"@figliolia/event-emitter\";\nimport type { Middleware } from \"./Middleware\";\nimport type { State } from \"./State\";\nimport type {
|
|
1
|
+
{"version":3,"file":"Galena.mjs","names":[],"sources":["../src/Galena.ts"],"sourcesContent":["import { EventEmitter } from \"@figliolia/event-emitter\";\nimport type { Middleware } from \"./Middleware\";\nimport type { State } from \"./State\";\nimport type {\n AppSubscriber,\n GalenaSnapshot,\n Setter,\n StateType,\n StateTypes,\n} from \"./types\";\n\n/**\n * ### Galena\n *\n * Galena instances are designed to house one or more units of `State`\n * and exist as a pseudo global application state.\n *\n * By design, each of its `State` units have isolated reactivity\n * that prevents entire state trees from updating when a single\n * unit changes.\n *\n * ```typescript\n * import { Galena } from \"@figliolia/galena\";\n *\n * const AppState = new Galena({\n * user: new State(\"<user-stuff>\"),\n * business: new State(\"<business-logic-stuff>\")\n * // your reactive instances\n * }, ...middleware);\n *\n * // to retreive and work with an individual unit\n * const myUnit = AppState.get(\"<key>\"); // Returns State<T>\n *\n * // to run a callback anytime a unit of state changes\n * const listener = AppState.subscribe(({ state, updated }) => {\n * // do something with the `State` instance that updated\n * // the entirety of your state\n * });\n * ```\n */\nexport class Galena<T extends Record<string, State<any>>> {\n private Emitter = new EventEmitter<{ change: GalenaSnapshot<T> }>();\n constructor(\n public readonly state: T,\n ...middleware: Middleware<StateTypes<T>>[]\n ) {\n this.registerMiddleware(...middleware);\n }\n\n /**\n * Get\n *\n * Returns a connected State instance by key\n */\n public get<K extends Extract<keyof T, string>>(key: K) {\n return this.state[key];\n }\n\n /**\n * Set\n *\n * Sets a connected State instance's state by key\n */\n public set<K extends Extract<keyof T, string>>(\n key: K,\n value: StateType<T[K]>,\n ) {\n return this.get(key).set(value);\n }\n\n /**\n * Update\n *\n * Invokes a connected State instance's update method key\n */\n public update<K extends Extract<keyof T, string>>(\n key: K,\n updater: Setter<StateType<T[K]>>,\n ) {\n return this.get(key).update(updater);\n }\n\n /**\n * Subscribe\n *\n * Listen for changes on your Galena instnace. Your provided\n * callback will be invoked each time an attached state instance\n * changes. To your callback will be provided the `updated` state\n * instance, along with the entire `state` tree\n */\n public subscribe = (subscriber: AppSubscriber<T>) => {\n const ID = this.Emitter.on(\"change\", subscriber);\n const unsubscribers: (() => void)[] = [];\n for (const key in this.state) {\n const instance = this.state[key];\n if (!instance) {\n continue;\n }\n unsubscribers.push(\n instance.subscribe(() =>\n this.emit({ state: this.state, updated: instance }),\n ),\n );\n }\n return () => {\n this.Emitter.off(\"change\", ID);\n while (unsubscribers.length) {\n unsubscribers.pop?.()?.();\n }\n };\n };\n\n /**\n * Register Middleware\n *\n * Adds middleware instances to each of the connected\n * `State` instances\n */\n public registerMiddleware(...middlewares: Middleware<StateTypes<T>>[]) {\n for (const key in this.state) {\n this.state[key]?.registerMiddleware?.(...middlewares);\n }\n }\n\n private emit<K extends Extract<keyof T, string>>(\n event: GalenaSnapshot<T, K>,\n ) {\n this.Emitter.emit(\"change\", event);\n }\n}\n\n/**\n * ### createGalena\n *\n * Galena instances are designed to house one or more units of `State`\n * and exist as a pseudo global application state.\n *\n * By design, each of its `State` units have isolated reactivity\n * that prevents entire state trees from updating when a single\n * unit changes.\n *\n * ```typescript\n * import { Galena } from \"@figliolia/galena\";\n *\n * const AppState = new Galena({\n * user: new State(\"<user-stuff>\"),\n * business: new State(\"<business-logic-stuff>\")\n * // your reactive instances\n * }, ...middleware);\n *\n * // to retreive and work with an individual unit\n * const myUnit = AppState.get(\"<key>\"); // Returns State<T>\n *\n * // to run a callback anytime a unit of state changes\n * const listener = AppState.subscribe(({ state, updated }) => {\n * // do something with the `State` instance that updated\n * // the entirety of your state\n * });\n * ```\n */\nexport const createGalena = <T extends Record<string, State<any>>>(\n ...args: ConstructorParameters<typeof Galena<T>>\n) => {\n return new Galena(...args);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAa,SAAb,MAA0D;CACxD,UAAkB,IAAI,cAA6C;CACnE,YACE,OACA,GAAG,YACH;AAFgB,OAAA,QAAA;AAGhB,OAAK,mBAAmB,GAAG,WAAW;;;;;;;CAQxC,IAA+C,KAAQ;AACrD,SAAO,KAAK,MAAM;;;;;;;CAQpB,IACE,KACA,OACA;AACA,SAAO,KAAK,IAAI,IAAI,CAAC,IAAI,MAAM;;;;;;;CAQjC,OACE,KACA,SACA;AACA,SAAO,KAAK,IAAI,IAAI,CAAC,OAAO,QAAQ;;;;;;;;;;CAWtC,aAAoB,eAAiC;EACnD,MAAM,KAAK,KAAK,QAAQ,GAAG,UAAU,WAAW;EAChD,MAAM,gBAAgC,EAAE;AACxC,OAAK,MAAM,OAAO,KAAK,OAAO;GAC5B,MAAM,WAAW,KAAK,MAAM;AAC5B,OAAI,CAAC,SACH;AAEF,iBAAc,KACZ,SAAS,gBACP,KAAK,KAAK;IAAE,OAAO,KAAK;IAAO,SAAS;IAAU,CAAC,CACpD,CACF;;AAEH,eAAa;AACX,QAAK,QAAQ,IAAI,UAAU,GAAG;AAC9B,UAAO,cAAc,OACnB,eAAc,OAAO,IAAI;;;;;;;;;CAW/B,mBAA0B,GAAG,aAA0C;AACrE,OAAK,MAAM,OAAO,KAAK,MACrB,MAAK,MAAM,MAAM,qBAAqB,GAAG,YAAY;;CAIzD,KACE,OACA;AACA,OAAK,QAAQ,KAAK,UAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCtC,MAAa,gBACX,GAAG,SACA;AACH,QAAO,IAAI,OAAO,GAAG,KAAK"}
|
package/dist/State.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
let _figliolia_event_emitter = require("@figliolia/event-emitter");
|
|
2
2
|
//#region src/State.ts
|
|
3
3
|
/**
|
|
4
|
-
* State
|
|
4
|
+
* ### State
|
|
5
5
|
*
|
|
6
6
|
* The unit of reactivity for Galena. `State`'s can act
|
|
7
7
|
* as isolated instances or be part of your global app
|
|
@@ -10,7 +10,7 @@ let _figliolia_event_emitter = require("@figliolia/event-emitter");
|
|
|
10
10
|
* There are three ways to create state instances
|
|
11
11
|
*
|
|
12
12
|
* ```typescript
|
|
13
|
-
* import { State, createState,
|
|
13
|
+
* import { State, createState, Profiler } from "@figliolia/galena";
|
|
14
14
|
* // for island states that can be shared between react components
|
|
15
15
|
* const myState = new State("<any value>", ...middleware);
|
|
16
16
|
* // or
|
|
@@ -20,17 +20,7 @@ let _figliolia_event_emitter = require("@figliolia/event-emitter");
|
|
|
20
20
|
* myState.update(previousValue => "<new-value>");
|
|
21
21
|
* myState.subscribe(nextValue => {});
|
|
22
22
|
* myState.registerMiddleware(new Profiler());
|
|
23
|
-
*
|
|
24
|
-
* // Similarly if you wish to use your state inside a react component
|
|
25
|
-
* const MyComponent = () => {
|
|
26
|
-
* const [state, setState] = useState(myState);
|
|
27
|
-
* // or
|
|
28
|
-
* const [state, setState] = useMyState("<any-value>", ...middlware);
|
|
29
|
-
*
|
|
30
|
-
* return (
|
|
31
|
-
* // your jsx
|
|
32
|
-
* );
|
|
33
|
-
* }
|
|
23
|
+
* myState.reset(); // reset back to it's original value
|
|
34
24
|
* ```
|
|
35
25
|
*/
|
|
36
26
|
var State = class {
|
|
@@ -122,21 +112,26 @@ var State = class {
|
|
|
122
112
|
}
|
|
123
113
|
};
|
|
124
114
|
/**
|
|
125
|
-
*
|
|
115
|
+
* ### createState
|
|
126
116
|
*
|
|
127
|
-
*
|
|
117
|
+
* The unit of reactivity for Galena. `State`'s can act
|
|
128
118
|
* as isolated instances or be part of your global app
|
|
129
|
-
* state (via `Galena` instances)
|
|
119
|
+
* state (via `Galena` instances).
|
|
130
120
|
*
|
|
131
|
-
*
|
|
132
|
-
* import { createState, Profiler } from "@figliolia/galena";
|
|
121
|
+
* There are three ways to create state instances
|
|
133
122
|
*
|
|
123
|
+
* ```typescript
|
|
124
|
+
* import { State, createState, Profiler } from "@figliolia/galena";
|
|
125
|
+
* // for island states that can be shared between react components
|
|
126
|
+
* const myState = new State("<any value>", ...middleware);
|
|
127
|
+
* // or
|
|
134
128
|
* const myState = createState("<any value>", ...middleware);
|
|
135
129
|
*
|
|
136
130
|
* myState.set("<new-value>");
|
|
137
131
|
* myState.update(previousValue => "<new-value>");
|
|
138
132
|
* myState.subscribe(nextValue => {});
|
|
139
133
|
* myState.registerMiddleware(new Profiler());
|
|
134
|
+
* myState.reset(); // reset back to it's original value
|
|
140
135
|
* ```
|
|
141
136
|
*/
|
|
142
137
|
function createState(...args) {
|
package/dist/State.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { Middleware } from "./Middleware.cjs";
|
|
|
3
3
|
|
|
4
4
|
//#region src/State.d.ts
|
|
5
5
|
/**
|
|
6
|
-
* State
|
|
6
|
+
* ### State
|
|
7
7
|
*
|
|
8
8
|
* The unit of reactivity for Galena. `State`'s can act
|
|
9
9
|
* as isolated instances or be part of your global app
|
|
@@ -12,7 +12,7 @@ import { Middleware } from "./Middleware.cjs";
|
|
|
12
12
|
* There are three ways to create state instances
|
|
13
13
|
*
|
|
14
14
|
* ```typescript
|
|
15
|
-
* import { State, createState,
|
|
15
|
+
* import { State, createState, Profiler } from "@figliolia/galena";
|
|
16
16
|
* // for island states that can be shared between react components
|
|
17
17
|
* const myState = new State("<any value>", ...middleware);
|
|
18
18
|
* // or
|
|
@@ -22,17 +22,7 @@ import { Middleware } from "./Middleware.cjs";
|
|
|
22
22
|
* myState.update(previousValue => "<new-value>");
|
|
23
23
|
* myState.subscribe(nextValue => {});
|
|
24
24
|
* myState.registerMiddleware(new Profiler());
|
|
25
|
-
*
|
|
26
|
-
* // Similarly if you wish to use your state inside a react component
|
|
27
|
-
* const MyComponent = () => {
|
|
28
|
-
* const [state, setState] = useState(myState);
|
|
29
|
-
* // or
|
|
30
|
-
* const [state, setState] = useMyState("<any-value>", ...middlware);
|
|
31
|
-
*
|
|
32
|
-
* return (
|
|
33
|
-
* // your jsx
|
|
34
|
-
* );
|
|
35
|
-
* }
|
|
25
|
+
* myState.reset(); // reset back to it's original value
|
|
36
26
|
* ```
|
|
37
27
|
*/
|
|
38
28
|
declare class State<T> {
|
|
@@ -91,21 +81,26 @@ declare class State<T> {
|
|
|
91
81
|
private invokeMiddleware;
|
|
92
82
|
}
|
|
93
83
|
/**
|
|
94
|
-
*
|
|
84
|
+
* ### createState
|
|
95
85
|
*
|
|
96
|
-
*
|
|
86
|
+
* The unit of reactivity for Galena. `State`'s can act
|
|
97
87
|
* as isolated instances or be part of your global app
|
|
98
|
-
* state (via `Galena` instances)
|
|
88
|
+
* state (via `Galena` instances).
|
|
99
89
|
*
|
|
100
|
-
*
|
|
101
|
-
* import { createState, Profiler } from "@figliolia/galena";
|
|
90
|
+
* There are three ways to create state instances
|
|
102
91
|
*
|
|
92
|
+
* ```typescript
|
|
93
|
+
* import { State, createState, Profiler } from "@figliolia/galena";
|
|
94
|
+
* // for island states that can be shared between react components
|
|
95
|
+
* const myState = new State("<any value>", ...middleware);
|
|
96
|
+
* // or
|
|
103
97
|
* const myState = createState("<any value>", ...middleware);
|
|
104
98
|
*
|
|
105
99
|
* myState.set("<new-value>");
|
|
106
100
|
* myState.update(previousValue => "<new-value>");
|
|
107
101
|
* myState.subscribe(nextValue => {});
|
|
108
102
|
* myState.registerMiddleware(new Profiler());
|
|
103
|
+
* myState.reset(); // reset back to it's original value
|
|
109
104
|
* ```
|
|
110
105
|
*/
|
|
111
106
|
declare function createState<T>(...args: ConstructorParameters<typeof State<T>>): State<T>;
|
package/dist/State.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"State.d.cts","names":[],"sources":["../src/State.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"State.d.cts","names":[],"sources":["../src/State.ts"],"mappings":";;;;;;AA2BA;;;;;;;;;;;;;;;;;;;;;cAAa,KAAA;EAAA,SAKO,YAAA,EAAc,WAAA,CAAY,CAAA;EAAA,QAJpC,KAAA;EAAA,SACQ,UAAA,EAAY,UAAA,CAAW,CAAA;EAAA,iBACtB,OAAA;cAEC,YAAA,EAAc,WAAA,CAAY,CAAA,MACvC,UAAA,EAAY,UAAA,CAAW,CAAA;EANX;;;;;;EAAA,SAkBD,GAAA,GAAG,KAAA,EAAA,WAAA,CAAA,CAAA;EAhBoB;;;;;;;EAAA,SAyBvB,MAAA,GAAM,MAAA,EAAA,MAAA,CAAA,CAAA;EArBM;;;;;;EAAA,SAkCZ,KAAA;EAbM;;;;;;EAAA,SAqBN,WAAA,QAAW,WAAA,CAAA,CAAA;EAUM;;;;;;EAAA,SAAjB,SAAA,GAAa,EAAA,EAAI,UAAA,CAAW,CAAA;EAkBpC;;;;;;;EAJD,kBAAA,CAAA,GAAsB,UAAA,EAAY,UAAA,CAAW,CAAA;EAAA,QAI5C,YAAA;EAAA,QAaA,IAAA;EAAA,UAOE,UAAA,CAAW,MAAA,EAAQ,MAAA,CAAO,CAAA,IAAK,MAAA,IAAU,WAAA,CAAY,CAAA;EAAA,QAIvD,gBAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;iBA8BM,WAAA,GAAA,CAAA,GACX,IAAA,EAAM,qBAAA,QAA6B,KAAA,CAAM,CAAA,KAAG,KAAA,CAAA,CAAA"}
|
package/dist/State.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { Middleware } from "./Middleware.mjs";
|
|
|
3
3
|
|
|
4
4
|
//#region src/State.d.ts
|
|
5
5
|
/**
|
|
6
|
-
* State
|
|
6
|
+
* ### State
|
|
7
7
|
*
|
|
8
8
|
* The unit of reactivity for Galena. `State`'s can act
|
|
9
9
|
* as isolated instances or be part of your global app
|
|
@@ -12,7 +12,7 @@ import { Middleware } from "./Middleware.mjs";
|
|
|
12
12
|
* There are three ways to create state instances
|
|
13
13
|
*
|
|
14
14
|
* ```typescript
|
|
15
|
-
* import { State, createState,
|
|
15
|
+
* import { State, createState, Profiler } from "@figliolia/galena";
|
|
16
16
|
* // for island states that can be shared between react components
|
|
17
17
|
* const myState = new State("<any value>", ...middleware);
|
|
18
18
|
* // or
|
|
@@ -22,17 +22,7 @@ import { Middleware } from "./Middleware.mjs";
|
|
|
22
22
|
* myState.update(previousValue => "<new-value>");
|
|
23
23
|
* myState.subscribe(nextValue => {});
|
|
24
24
|
* myState.registerMiddleware(new Profiler());
|
|
25
|
-
*
|
|
26
|
-
* // Similarly if you wish to use your state inside a react component
|
|
27
|
-
* const MyComponent = () => {
|
|
28
|
-
* const [state, setState] = useState(myState);
|
|
29
|
-
* // or
|
|
30
|
-
* const [state, setState] = useMyState("<any-value>", ...middlware);
|
|
31
|
-
*
|
|
32
|
-
* return (
|
|
33
|
-
* // your jsx
|
|
34
|
-
* );
|
|
35
|
-
* }
|
|
25
|
+
* myState.reset(); // reset back to it's original value
|
|
36
26
|
* ```
|
|
37
27
|
*/
|
|
38
28
|
declare class State<T> {
|
|
@@ -91,21 +81,26 @@ declare class State<T> {
|
|
|
91
81
|
private invokeMiddleware;
|
|
92
82
|
}
|
|
93
83
|
/**
|
|
94
|
-
*
|
|
84
|
+
* ### createState
|
|
95
85
|
*
|
|
96
|
-
*
|
|
86
|
+
* The unit of reactivity for Galena. `State`'s can act
|
|
97
87
|
* as isolated instances or be part of your global app
|
|
98
|
-
* state (via `Galena` instances)
|
|
88
|
+
* state (via `Galena` instances).
|
|
99
89
|
*
|
|
100
|
-
*
|
|
101
|
-
* import { createState, Profiler } from "@figliolia/galena";
|
|
90
|
+
* There are three ways to create state instances
|
|
102
91
|
*
|
|
92
|
+
* ```typescript
|
|
93
|
+
* import { State, createState, Profiler } from "@figliolia/galena";
|
|
94
|
+
* // for island states that can be shared between react components
|
|
95
|
+
* const myState = new State("<any value>", ...middleware);
|
|
96
|
+
* // or
|
|
103
97
|
* const myState = createState("<any value>", ...middleware);
|
|
104
98
|
*
|
|
105
99
|
* myState.set("<new-value>");
|
|
106
100
|
* myState.update(previousValue => "<new-value>");
|
|
107
101
|
* myState.subscribe(nextValue => {});
|
|
108
102
|
* myState.registerMiddleware(new Profiler());
|
|
103
|
+
* myState.reset(); // reset back to it's original value
|
|
109
104
|
* ```
|
|
110
105
|
*/
|
|
111
106
|
declare function createState<T>(...args: ConstructorParameters<typeof State<T>>): State<T>;
|
package/dist/State.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"State.d.mts","names":[],"sources":["../src/State.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"State.d.mts","names":[],"sources":["../src/State.ts"],"mappings":";;;;;;AA2BA;;;;;;;;;;;;;;;;;;;;;cAAa,KAAA;EAAA,SAKO,YAAA,EAAc,WAAA,CAAY,CAAA;EAAA,QAJpC,KAAA;EAAA,SACQ,UAAA,EAAY,UAAA,CAAW,CAAA;EAAA,iBACtB,OAAA;cAEC,YAAA,EAAc,WAAA,CAAY,CAAA,MACvC,UAAA,EAAY,UAAA,CAAW,CAAA;EANX;;;;;;EAAA,SAkBD,GAAA,GAAG,KAAA,EAAA,WAAA,CAAA,CAAA;EAhBoB;;;;;;;EAAA,SAyBvB,MAAA,GAAM,MAAA,EAAA,MAAA,CAAA,CAAA;EArBM;;;;;;EAAA,SAkCZ,KAAA;EAbM;;;;;;EAAA,SAqBN,WAAA,QAAW,WAAA,CAAA,CAAA;EAUM;;;;;;EAAA,SAAjB,SAAA,GAAa,EAAA,EAAI,UAAA,CAAW,CAAA;EAkBpC;;;;;;;EAJD,kBAAA,CAAA,GAAsB,UAAA,EAAY,UAAA,CAAW,CAAA;EAAA,QAI5C,YAAA;EAAA,QAaA,IAAA;EAAA,UAOE,UAAA,CAAW,MAAA,EAAQ,MAAA,CAAO,CAAA,IAAK,MAAA,IAAU,WAAA,CAAY,CAAA;EAAA,QAIvD,gBAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;iBA8BM,WAAA,GAAA,CAAA,GACX,IAAA,EAAM,qBAAA,QAA6B,KAAA,CAAM,CAAA,KAAG,KAAA,CAAA,CAAA"}
|
package/dist/State.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from "@figliolia/event-emitter";
|
|
2
2
|
//#region src/State.ts
|
|
3
3
|
/**
|
|
4
|
-
* State
|
|
4
|
+
* ### State
|
|
5
5
|
*
|
|
6
6
|
* The unit of reactivity for Galena. `State`'s can act
|
|
7
7
|
* as isolated instances or be part of your global app
|
|
@@ -10,7 +10,7 @@ import { EventEmitter } from "@figliolia/event-emitter";
|
|
|
10
10
|
* There are three ways to create state instances
|
|
11
11
|
*
|
|
12
12
|
* ```typescript
|
|
13
|
-
* import { State, createState,
|
|
13
|
+
* import { State, createState, Profiler } from "@figliolia/galena";
|
|
14
14
|
* // for island states that can be shared between react components
|
|
15
15
|
* const myState = new State("<any value>", ...middleware);
|
|
16
16
|
* // or
|
|
@@ -20,17 +20,7 @@ import { EventEmitter } from "@figliolia/event-emitter";
|
|
|
20
20
|
* myState.update(previousValue => "<new-value>");
|
|
21
21
|
* myState.subscribe(nextValue => {});
|
|
22
22
|
* myState.registerMiddleware(new Profiler());
|
|
23
|
-
*
|
|
24
|
-
* // Similarly if you wish to use your state inside a react component
|
|
25
|
-
* const MyComponent = () => {
|
|
26
|
-
* const [state, setState] = useState(myState);
|
|
27
|
-
* // or
|
|
28
|
-
* const [state, setState] = useMyState("<any-value>", ...middlware);
|
|
29
|
-
*
|
|
30
|
-
* return (
|
|
31
|
-
* // your jsx
|
|
32
|
-
* );
|
|
33
|
-
* }
|
|
23
|
+
* myState.reset(); // reset back to it's original value
|
|
34
24
|
* ```
|
|
35
25
|
*/
|
|
36
26
|
var State = class {
|
|
@@ -122,21 +112,26 @@ var State = class {
|
|
|
122
112
|
}
|
|
123
113
|
};
|
|
124
114
|
/**
|
|
125
|
-
*
|
|
115
|
+
* ### createState
|
|
126
116
|
*
|
|
127
|
-
*
|
|
117
|
+
* The unit of reactivity for Galena. `State`'s can act
|
|
128
118
|
* as isolated instances or be part of your global app
|
|
129
|
-
* state (via `Galena` instances)
|
|
119
|
+
* state (via `Galena` instances).
|
|
130
120
|
*
|
|
131
|
-
*
|
|
132
|
-
* import { createState, Profiler } from "@figliolia/galena";
|
|
121
|
+
* There are three ways to create state instances
|
|
133
122
|
*
|
|
123
|
+
* ```typescript
|
|
124
|
+
* import { State, createState, Profiler } from "@figliolia/galena";
|
|
125
|
+
* // for island states that can be shared between react components
|
|
126
|
+
* const myState = new State("<any value>", ...middleware);
|
|
127
|
+
* // or
|
|
134
128
|
* const myState = createState("<any value>", ...middleware);
|
|
135
129
|
*
|
|
136
130
|
* myState.set("<new-value>");
|
|
137
131
|
* myState.update(previousValue => "<new-value>");
|
|
138
132
|
* myState.subscribe(nextValue => {});
|
|
139
133
|
* myState.registerMiddleware(new Profiler());
|
|
134
|
+
* myState.reset(); // reset back to it's original value
|
|
140
135
|
* ```
|
|
141
136
|
*/
|
|
142
137
|
function createState(...args) {
|
package/dist/State.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"State.mjs","names":[],"sources":["../src/State.ts"],"sourcesContent":["import { EventEmitter } from \"@figliolia/event-emitter\";\nimport type { Middleware } from \"./Middleware\";\nimport type { NonFunction, Setter, Subscriber } from \"./types\";\n\n/**\n * State\n *\n * The unit of reactivity for Galena. `State`'s can act\n * as isolated instances or be part of your global app\n * state (via `Galena` instances).\n *\n * There are three ways to create state instances\n *\n * ```typescript\n * import { State, createState,
|
|
1
|
+
{"version":3,"file":"State.mjs","names":[],"sources":["../src/State.ts"],"sourcesContent":["import { EventEmitter } from \"@figliolia/event-emitter\";\nimport type { Middleware } from \"./Middleware\";\nimport type { NonFunction, Setter, Subscriber } from \"./types\";\n\n/**\n * ### State\n *\n * The unit of reactivity for Galena. `State`'s can act\n * as isolated instances or be part of your global app\n * state (via `Galena` instances).\n *\n * There are three ways to create state instances\n *\n * ```typescript\n * import { State, createState, Profiler } from \"@figliolia/galena\";\n * // for island states that can be shared between react components\n * const myState = new State(\"<any value>\", ...middleware);\n * // or\n * const myState = createState(\"<any value>\", ...middleware);\n *\n * myState.set(\"<new-value>\");\n * myState.update(previousValue => \"<new-value>\");\n * myState.subscribe(nextValue => {});\n * myState.registerMiddleware(new Profiler());\n * myState.reset(); // reset back to it's original value\n * ```\n */\nexport class State<T> {\n private state: NonFunction<T>;\n public readonly middleware: Middleware<T>[] = [];\n private readonly Emitter = new EventEmitter<{ change: NonFunction<T> }>();\n constructor(\n public readonly initialState: NonFunction<T>,\n ...middleware: Middleware<T>[]\n ) {\n this.state = initialState;\n this.registerMiddleware(...middleware);\n }\n\n /**\n * Set\n *\n * Updates the current value of state notifying\n * all interested parties\n */\n public readonly set = this.withEmission((state: NonFunction<T>) => state);\n\n /**\n * Update\n *\n * Updates the current value of state using a setter function\n * receiving the previous state as a parameter. Notifies all\n * interested parties\n */\n public readonly update = this.withEmission((setter: Setter<T>) => {\n if (this.diffSetter(setter)) {\n return setter;\n }\n return setter(this.state);\n });\n\n /**\n * Reset\n *\n * Resets the current state back to the state which the instance\n * was initialized with. Notifies all interested parties\n */\n public readonly reset = this.withEmission(() => this.initialState);\n\n /**\n * Get Snapshot\n *\n * Returns the current state. Designed for compatibility with\n * `useSyncExternalStore`\n */\n public readonly getSnapshot = () => {\n return this.state;\n };\n\n /**\n * Subscribe\n *\n * Registers a callback to be executed each time state\n * changes. Returns an `unsubscribe` function\n */\n public readonly subscribe = (fn: Subscriber<T>) => {\n const ID = this.Emitter.on(\"change\", fn);\n return () => {\n this.Emitter.off(\"change\", ID);\n };\n };\n\n /**\n * Register Middleware\n *\n * Registers any number of `Middleware` instances on the\n * current instance of `State`. Your middleware will begin\n * executing at the next state transition\n */\n public registerMiddleware(...middleware: Middleware<T>[]) {\n this.middleware.push(...middleware);\n }\n\n private withEmission<\n F extends (...args: any[]) => NonFunction<T> | Promise<NonFunction<T>>,\n >(fn: F) {\n return (...args: Parameters<F>) => {\n const result = fn(...args);\n if (result instanceof Promise) {\n void result.then(resolved => this.emit(resolved));\n return;\n }\n return this.emit(result);\n };\n }\n\n private emit(nextState: NonFunction<T>) {\n this.invokeMiddleware(\"onBeforeUpdate\");\n this.state = nextState;\n this.Emitter.emit(\"change\", this.state);\n this.invokeMiddleware(\"onUpdate\");\n }\n\n protected diffSetter(setter: Setter<T>): setter is NonFunction<T> {\n return typeof setter !== \"function\";\n }\n\n private invokeMiddleware<K extends keyof Middleware<T>>(fn: K) {\n for (const middleware of this.middleware) {\n middleware[fn](this);\n }\n }\n}\n\n/**\n * ### createState\n *\n * The unit of reactivity for Galena. `State`'s can act\n * as isolated instances or be part of your global app\n * state (via `Galena` instances).\n *\n * There are three ways to create state instances\n *\n * ```typescript\n * import { State, createState, Profiler } from \"@figliolia/galena\";\n * // for island states that can be shared between react components\n * const myState = new State(\"<any value>\", ...middleware);\n * // or\n * const myState = createState(\"<any value>\", ...middleware);\n *\n * myState.set(\"<new-value>\");\n * myState.update(previousValue => \"<new-value>\");\n * myState.subscribe(nextValue => {});\n * myState.registerMiddleware(new Profiler());\n * myState.reset(); // reset back to it's original value\n * ```\n */\nexport function createState<T>(\n ...args: ConstructorParameters<typeof State<T>>\n) {\n return new State<T>(...args);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAa,QAAb,MAAsB;CACpB;CACA,aAA8C,EAAE;CAChD,UAA2B,IAAI,cAA0C;CACzE,YACE,cACA,GAAG,YACH;AAFgB,OAAA,eAAA;AAGhB,OAAK,QAAQ;AACb,OAAK,mBAAmB,GAAG,WAAW;;;;;;;;CASxC,MAAsB,KAAK,cAAc,UAA0B,MAAM;;;;;;;;CASzE,SAAyB,KAAK,cAAc,WAAsB;AAChE,MAAI,KAAK,WAAW,OAAO,CACzB,QAAO;AAET,SAAO,OAAO,KAAK,MAAM;GACzB;;;;;;;CAQF,QAAwB,KAAK,mBAAmB,KAAK,aAAa;;;;;;;CAQlE,oBAAoC;AAClC,SAAO,KAAK;;;;;;;;CASd,aAA6B,OAAsB;EACjD,MAAM,KAAK,KAAK,QAAQ,GAAG,UAAU,GAAG;AACxC,eAAa;AACX,QAAK,QAAQ,IAAI,UAAU,GAAG;;;;;;;;;;CAWlC,mBAA0B,GAAG,YAA6B;AACxD,OAAK,WAAW,KAAK,GAAG,WAAW;;CAGrC,aAEE,IAAO;AACP,UAAQ,GAAG,SAAwB;GACjC,MAAM,SAAS,GAAG,GAAG,KAAK;AAC1B,OAAI,kBAAkB,SAAS;AACxB,WAAO,MAAK,aAAY,KAAK,KAAK,SAAS,CAAC;AACjD;;AAEF,UAAO,KAAK,KAAK,OAAO;;;CAI5B,KAAa,WAA2B;AACtC,OAAK,iBAAiB,iBAAiB;AACvC,OAAK,QAAQ;AACb,OAAK,QAAQ,KAAK,UAAU,KAAK,MAAM;AACvC,OAAK,iBAAiB,WAAW;;CAGnC,WAAqB,QAA6C;AAChE,SAAO,OAAO,WAAW;;CAG3B,iBAAwD,IAAO;AAC7D,OAAK,MAAM,cAAc,KAAK,WAC5B,YAAW,IAAI,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;AA4B1B,SAAgB,YACd,GAAG,MACH;AACA,QAAO,IAAI,MAAS,GAAG,KAAK"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AppSubscriber, GalenaSnapshot, NonFunction, PartialSupport, Setter, StateTypes, Subscriber } from "./types.cjs";
|
|
1
|
+
import { AppSubscriber, GalenaSnapshot, NonFunction, PartialSupport, Setter, StateType, StateTypes, Subscriber } from "./types.cjs";
|
|
2
2
|
import { State, createState } from "./State.cjs";
|
|
3
3
|
import { Middleware } from "./Middleware.cjs";
|
|
4
4
|
import { Galena, createGalena } from "./Galena.cjs";
|
|
5
5
|
import { Logger } from "./Logger.cjs";
|
|
6
6
|
import { Profiler } from "./Profiler.cjs";
|
|
7
|
-
export { AppSubscriber, Galena, GalenaSnapshot, Logger, Middleware, NonFunction, PartialSupport, Profiler, Setter, State, StateTypes, Subscriber, createGalena, createState };
|
|
7
|
+
export { AppSubscriber, Galena, GalenaSnapshot, Logger, Middleware, NonFunction, PartialSupport, Profiler, Setter, State, StateType, StateTypes, Subscriber, createGalena, createState };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AppSubscriber, GalenaSnapshot, NonFunction, PartialSupport, Setter, StateTypes, Subscriber } from "./types.mjs";
|
|
1
|
+
import { AppSubscriber, GalenaSnapshot, NonFunction, PartialSupport, Setter, StateType, StateTypes, Subscriber } from "./types.mjs";
|
|
2
2
|
import { State, createState } from "./State.mjs";
|
|
3
3
|
import { Middleware } from "./Middleware.mjs";
|
|
4
4
|
import { Galena, createGalena } from "./Galena.mjs";
|
|
5
5
|
import { Logger } from "./Logger.mjs";
|
|
6
6
|
import { Profiler } from "./Profiler.mjs";
|
|
7
|
-
export { AppSubscriber, Galena, GalenaSnapshot, Logger, Middleware, NonFunction, PartialSupport, Profiler, Setter, State, StateTypes, Subscriber, createGalena, createState };
|
|
7
|
+
export { AppSubscriber, Galena, GalenaSnapshot, Logger, Middleware, NonFunction, PartialSupport, Profiler, Setter, State, StateType, StateTypes, Subscriber, createGalena, createState };
|
package/dist/types.d.cts
CHANGED
|
@@ -10,7 +10,8 @@ interface GalenaSnapshot<T extends Record<string, State<any>>, K extends Extract
|
|
|
10
10
|
state: T;
|
|
11
11
|
}
|
|
12
12
|
type AppSubscriber<T extends Record<string, State<any>>, K extends Extract<keyof T, string> = Extract<keyof T, string>> = ((payload: GalenaSnapshot<T, K>) => void) | (() => void);
|
|
13
|
-
type StateTypes<T extends Record<string, State<any>>> = ReturnType<T[keyof T]
|
|
13
|
+
type StateTypes<T extends Record<string, State<any>>> = ReturnType<StateType<T[keyof T]>>;
|
|
14
|
+
type StateType<T extends State<any>> = ReturnType<T["getSnapshot"]>;
|
|
14
15
|
//#endregion
|
|
15
|
-
export { AppSubscriber, GalenaSnapshot, NonFunction, PartialSupport, Setter, StateTypes, Subscriber };
|
|
16
|
+
export { AppSubscriber, GalenaSnapshot, NonFunction, PartialSupport, Setter, StateType, StateTypes, Subscriber };
|
|
16
17
|
//# sourceMappingURL=types.d.cts.map
|
package/dist/types.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;KAEY,WAAA,MAAiB,CAAA,cAAc,IAAA,2BAA8B,CAAA;AAAA,KAE7D,cAAA,MAAoB,CAAA,SAAU,MAAA,gBAAsB,OAAA,CAAQ,CAAA,IAAK,CAAA;AAAA,KAEjE,MAAA,MACR,WAAA,CAAY,CAAA,MACV,SAAA,EAAW,WAAA,CAAY,CAAA,MAAO,WAAA,CAAY,CAAA,IAAK,OAAA,CAAQ,WAAA,CAAY,CAAA;AAAA,KAE7D,UAAA,QAAkB,KAAA,EAAO,WAAA,CAAY,CAAA;AAAA,UAEhC,cAAA,WACL,MAAA,SAAe,KAAA,kBACf,OAAA,OAAc,CAAA,YAAa,OAAA,OAAc,CAAA;EAEnD,OAAA,EAAS,CAAA,CAAE,CAAA;EACX,KAAA,EAAO,CAAA;AAAA;AAAA,KAGG,aAAA,WACA,MAAA,SAAe,KAAA,kBACf,OAAA,OAAc,CAAA,YAAa,OAAA,OAAc,CAAA,eAC/C,OAAA,EAAS,cAAA,CAAe,CAAA,EAAG,CAAA;AAAA,KAErB,UAAA,WAAqB,MAAA,SAAe,KAAA,UAAe,UAAA,CAC7D,CAAA,OAAQ,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;KAEY,WAAA,MAAiB,CAAA,cAAc,IAAA,2BAA8B,CAAA;AAAA,KAE7D,cAAA,MAAoB,CAAA,SAAU,MAAA,gBAAsB,OAAA,CAAQ,CAAA,IAAK,CAAA;AAAA,KAEjE,MAAA,MACR,WAAA,CAAY,CAAA,MACV,SAAA,EAAW,WAAA,CAAY,CAAA,MAAO,WAAA,CAAY,CAAA,IAAK,OAAA,CAAQ,WAAA,CAAY,CAAA;AAAA,KAE7D,UAAA,QAAkB,KAAA,EAAO,WAAA,CAAY,CAAA;AAAA,UAEhC,cAAA,WACL,MAAA,SAAe,KAAA,kBACf,OAAA,OAAc,CAAA,YAAa,OAAA,OAAc,CAAA;EAEnD,OAAA,EAAS,CAAA,CAAE,CAAA;EACX,KAAA,EAAO,CAAA;AAAA;AAAA,KAGG,aAAA,WACA,MAAA,SAAe,KAAA,kBACf,OAAA,OAAc,CAAA,YAAa,OAAA,OAAc,CAAA,eAC/C,OAAA,EAAS,cAAA,CAAe,CAAA,EAAG,CAAA;AAAA,KAErB,UAAA,WAAqB,MAAA,SAAe,KAAA,UAAe,UAAA,CAC7D,SAAA,CAAU,CAAA,OAAQ,CAAA;AAAA,KAGR,SAAA,WAAoB,KAAA,SAAc,UAAA,CAAW,CAAA"}
|
package/dist/types.d.mts
CHANGED
|
@@ -10,7 +10,8 @@ interface GalenaSnapshot<T extends Record<string, State<any>>, K extends Extract
|
|
|
10
10
|
state: T;
|
|
11
11
|
}
|
|
12
12
|
type AppSubscriber<T extends Record<string, State<any>>, K extends Extract<keyof T, string> = Extract<keyof T, string>> = ((payload: GalenaSnapshot<T, K>) => void) | (() => void);
|
|
13
|
-
type StateTypes<T extends Record<string, State<any>>> = ReturnType<T[keyof T]
|
|
13
|
+
type StateTypes<T extends Record<string, State<any>>> = ReturnType<StateType<T[keyof T]>>;
|
|
14
|
+
type StateType<T extends State<any>> = ReturnType<T["getSnapshot"]>;
|
|
14
15
|
//#endregion
|
|
15
|
-
export { AppSubscriber, GalenaSnapshot, NonFunction, PartialSupport, Setter, StateTypes, Subscriber };
|
|
16
|
+
export { AppSubscriber, GalenaSnapshot, NonFunction, PartialSupport, Setter, StateType, StateTypes, Subscriber };
|
|
16
17
|
//# sourceMappingURL=types.d.mts.map
|
package/dist/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;KAEY,WAAA,MAAiB,CAAA,cAAc,IAAA,2BAA8B,CAAA;AAAA,KAE7D,cAAA,MAAoB,CAAA,SAAU,MAAA,gBAAsB,OAAA,CAAQ,CAAA,IAAK,CAAA;AAAA,KAEjE,MAAA,MACR,WAAA,CAAY,CAAA,MACV,SAAA,EAAW,WAAA,CAAY,CAAA,MAAO,WAAA,CAAY,CAAA,IAAK,OAAA,CAAQ,WAAA,CAAY,CAAA;AAAA,KAE7D,UAAA,QAAkB,KAAA,EAAO,WAAA,CAAY,CAAA;AAAA,UAEhC,cAAA,WACL,MAAA,SAAe,KAAA,kBACf,OAAA,OAAc,CAAA,YAAa,OAAA,OAAc,CAAA;EAEnD,OAAA,EAAS,CAAA,CAAE,CAAA;EACX,KAAA,EAAO,CAAA;AAAA;AAAA,KAGG,aAAA,WACA,MAAA,SAAe,KAAA,kBACf,OAAA,OAAc,CAAA,YAAa,OAAA,OAAc,CAAA,eAC/C,OAAA,EAAS,cAAA,CAAe,CAAA,EAAG,CAAA;AAAA,KAErB,UAAA,WAAqB,MAAA,SAAe,KAAA,UAAe,UAAA,CAC7D,CAAA,OAAQ,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;KAEY,WAAA,MAAiB,CAAA,cAAc,IAAA,2BAA8B,CAAA;AAAA,KAE7D,cAAA,MAAoB,CAAA,SAAU,MAAA,gBAAsB,OAAA,CAAQ,CAAA,IAAK,CAAA;AAAA,KAEjE,MAAA,MACR,WAAA,CAAY,CAAA,MACV,SAAA,EAAW,WAAA,CAAY,CAAA,MAAO,WAAA,CAAY,CAAA,IAAK,OAAA,CAAQ,WAAA,CAAY,CAAA;AAAA,KAE7D,UAAA,QAAkB,KAAA,EAAO,WAAA,CAAY,CAAA;AAAA,UAEhC,cAAA,WACL,MAAA,SAAe,KAAA,kBACf,OAAA,OAAc,CAAA,YAAa,OAAA,OAAc,CAAA;EAEnD,OAAA,EAAS,CAAA,CAAE,CAAA;EACX,KAAA,EAAO,CAAA;AAAA;AAAA,KAGG,aAAA,WACA,MAAA,SAAe,KAAA,kBACf,OAAA,OAAc,CAAA,YAAa,OAAA,OAAc,CAAA,eAC/C,OAAA,EAAS,cAAA,CAAe,CAAA,EAAG,CAAA;AAAA,KAErB,UAAA,WAAqB,MAAA,SAAe,KAAA,UAAe,UAAA,CAC7D,SAAA,CAAU,CAAA,OAAQ,CAAA;AAAA,KAGR,SAAA,WAAoB,KAAA,SAAc,UAAA,CAAW,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@figliolia/galena",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "A performant state management library supporting middleware and a rich developer API",
|
|
5
5
|
"homepage": "https://github.com/alexfigliolia/galena#readme",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,9 +44,15 @@
|
|
|
44
44
|
"oxlint": "^1.36.0",
|
|
45
45
|
"oxlint-tsgolint": "^0.17.0",
|
|
46
46
|
"tsdown": "^0.21.1",
|
|
47
|
-
"typescript": "^
|
|
47
|
+
"typescript": "^6.0.2"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@figliolia/event-emitter": ">=1.2.0"
|
|
51
|
-
}
|
|
51
|
+
},
|
|
52
|
+
"keywords": [
|
|
53
|
+
"state",
|
|
54
|
+
"state management",
|
|
55
|
+
"flux",
|
|
56
|
+
"react"
|
|
57
|
+
]
|
|
52
58
|
}
|