use-typed-reducer 4.2.0 → 4.2.1

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 CHANGED
@@ -16,6 +16,10 @@ the [createGlobalReducer](#createglobalreducer) for global state.
16
16
  * [useReducerWithProps](#usereducerwithprops)
17
17
  * [useReducer](#usereducer)
18
18
  * [createGlobalReducer](#createglobalreducer)
19
+ * [Middlewares](#middlewares)
20
+ * [Tips and Tricks](#tips-and-tricks)
21
+ * [Save at LocalStorage](#save-at-localstorage)
22
+ * [State logger](#state-logger)
19
23
 
20
24
  <!-- TOC -->
21
25
 
@@ -50,7 +54,7 @@ dispatch. Dispatch has the same key and functions of given dictionary in `useTyp
50
54
  update state. This void `dispatch({ type: "ACTION" })`
51
55
 
52
56
  ```tsx
53
- import {useTypedReducer, UseReducer} from "./index";
57
+ import { useTypedReducer, UseReducer } from "./index";
54
58
 
55
59
  const initialState = {
56
60
  numbers: 0,
@@ -66,12 +70,12 @@ type Reducers = {
66
70
  };
67
71
 
68
72
  const reducers: Reducers = {
69
- increment: () => (state) => ({...state, numbers: state.numbers + 1}),
73
+ increment: () => (state) => ({ ...state, numbers: state.numbers + 1 }),
70
74
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => {
71
75
  const value = e.target.valueAsNumber
72
- return (state) => ({...state, numbers: value})
76
+ return (state) => ({ ...state, numbers: value })
73
77
  },
74
- reset: () => (state) => ({...state, numbers: 0})
78
+ reset: () => (state) => ({ ...state, numbers: 0 })
75
79
  };
76
80
 
77
81
 
@@ -93,9 +97,9 @@ const Component = () => {
93
97
  The same of useTypedReducer, but receive a `getProps` as second argument in the second function.
94
98
 
95
99
  ```typescript jsx
96
- import {useReducerWithProps, UseReducer} from "./index";
100
+ import { useReducerWithProps, UseReducer } from "./index";
97
101
 
98
- const initialState = {numbers: 0, something: ""};
102
+ const initialState = { numbers: 0, something: "" };
99
103
 
100
104
  type State = typeof initialState;
101
105
 
@@ -110,15 +114,15 @@ type Props = {
110
114
  }
111
115
 
112
116
  const reducers: Reducers = {
113
- increment: () => (state) => ({...state, numbers: state.numbers + 1}),
117
+ increment: () => (state) => ({ ...state, numbers: state.numbers + 1 }),
114
118
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => {
115
119
  const value = e.target.valueAsNumber;
116
120
  return (state, props) => {
117
121
  const find = props.list.find(x => x === value);
118
- return find === undefined ? ({...state, numbers: value}) : ({...state, numbers: find * 2});
122
+ return find === undefined ? ({ ...state, numbers: value }) : ({ ...state, numbers: find * 2 });
119
123
  };
120
124
  },
121
- reset: () => (state) => ({...state, numbers: 0})
125
+ reset: () => (state) => ({ ...state, numbers: 0 })
122
126
  };
123
127
 
124
128
 
@@ -143,9 +147,9 @@ state.
143
147
 
144
148
  ```typescript
145
149
  export const useMath = () => {
146
- return useReducer({count: 0}, (getState) => ({
147
- sum: (n: number) => ({count: n + getState().count}),
148
- diff: (n: number) => ({count: n - getState().count})
150
+ return useReducer({ count: 0 }, (getState) => ({
151
+ sum: (n: number) => ({ count: n + getState().count }),
152
+ diff: (n: number) => ({ count: n - getState().count })
149
153
  }));
150
154
  };
151
155
  ```
@@ -156,9 +160,9 @@ If you need a way to create a global state, you can use this function. This enab
156
160
  a Context provider. The API is the same API of `useReducer`, but returns a hook to use the global context.
157
161
 
158
162
  ```typescript jsx
159
- const useStore = createGlobalReducer({count: 0}, (arg) => ({
160
- increment: () => ({count: arg.state().count + 1}),
161
- decrement: () => ({count: arg.state().count - 1}),
163
+ const useStore = createGlobalReducer({ count: 0 }, (arg) => ({
164
+ increment: () => ({ count: arg.state().count + 1 }),
165
+ decrement: () => ({ count: arg.state().count - 1 }),
162
166
  }));
163
167
 
164
168
  export default function App() {
@@ -177,9 +181,9 @@ You can pass a selector to `useStore` to get only the part of state that you nee
177
181
  render, doing the re-render only when the selector get a different value from the previous state.
178
182
 
179
183
  ```typescript jsx
180
- const useStore = createGlobalReducer({count: 0}, (arg) => ({
181
- increment: () => ({count: arg.state().count + 1}),
182
- decrement: () => ({count: arg.state().count - 1}),
184
+ const useStore = createGlobalReducer({ count: 0 }, (arg) => ({
185
+ increment: () => ({ count: arg.state().count + 1 }),
186
+ decrement: () => ({ count: arg.state().count - 1 }),
183
187
  }));
184
188
 
185
189
  export default function App() {
@@ -194,6 +198,47 @@ export default function App() {
194
198
  }
195
199
  ```
196
200
 
201
+ # Middlewares
202
+
203
+ There are two types of middleware in use-typed-reducer
204
+
205
+ - `interceptors`: that can mutate the state and executes immediately after your function
206
+ - `postMiddleware`: execute after useTypedReducer updates the state, like a `useEffect(fn, [state])`
207
+
208
+ ## Using interceptors
209
+
210
+ ```typescript
211
+ type State = { filter: string; };
212
+ const [state, dispatch] = useReducer({ filter: "" }, () => {
213
+ setFilter: (f: string) => ({ filter: f });
214
+ }, {
215
+ interceptors: [
216
+ (state: State, prev: State) => {
217
+ console.log(prev, state);
218
+ return state;
219
+ },
220
+ ],
221
+ });
222
+ ```
223
+
224
+ ## Why use interceptors?
225
+
226
+ Interceptors are great when you need to execute functions that use previous and current state in the same shoot. You can
227
+ use interceptors to create a history of your state. Saving the previous state plus your current state, making a timeline
228
+ of user actions.
229
+
230
+ ## Using postMiddleware
231
+
232
+ While interceptors are good to execute actions during the state update, postMiddleware are great to update your state
233
+ after the
234
+ dispatch of newer state. This is useful to update other states from your middleware.
235
+
236
+ ## Why interceptors and postMiddleware are necessary?
237
+
238
+ If you try to update external states using `interceptors`, maybe you will have a React warning about update state from
239
+ an useState. Because of this you will need to move your update logic from `interceptors` to `postMiddleware`, that acts
240
+ like useEffect
241
+
197
242
  # Tips and Tricks
198
243
 
199
244
  You need to store your state at LocalStorage? Do you need a logger for each change in state? Okay, let's go
@@ -202,16 +247,16 @@ You need to store your state at LocalStorage? Do you need a logger for each chan
202
247
 
203
248
  ````typescript
204
249
  import * as React from "react";
205
- import {useReducer} from "use-typed-reducer"
250
+ import { useReducer } from "use-typed-reducer"
206
251
 
207
252
  const App = () => {
208
253
  const [state, dispatch] = useReducer(
209
- {name: "", topics: [] as string []},
254
+ { name: "", topics: [] as string [] },
210
255
  (get) => ({
211
256
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => {
212
257
  const value = e.target.value;
213
258
  const name = e.target.name;
214
- return {...get.state(), [name]: value}
259
+ return { ...get.state(), [name]: value }
215
260
  }
216
261
  }),
217
262
  undefined, // no props used,
@@ -232,16 +277,16 @@ Maybe you miss the `redux-logger` behaviour. I you help you to recovery this beh
232
277
 
233
278
  ````typescript
234
279
  import * as React from "react";
235
- import {useReducer} from "use-typed-reducer"
280
+ import { useReducer } from "use-typed-reducer"
236
281
 
237
282
  const App = () => {
238
283
  const [state, dispatch] = useReducer(
239
- {name: "", topics: [] as string []},
284
+ { name: "", topics: [] as string [] },
240
285
  (get) => ({
241
286
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => {
242
287
  const value = e.target.value;
243
288
  const name = e.target.name;
244
- return {...get.state(), [name]: value}
289
+ return { ...get.state(), [name]: value }
245
290
  }
246
291
  }),
247
292
  undefined, // no props used,
package/dist/hooks.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { MutableRefObject } from "react";
1
+ import { MutableRefObject } from 'react';
2
+
2
3
  export declare const useMutable: <T extends {}>(state: T) => MutableRefObject<T>;
3
4
  export declare const usePrevious: <V>(value: V) => V;
4
5
  //# sourceMappingURL=hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,OAAO,CAAC;AAE5D,eAAO,MAAM,UAAU,iDAItB,CAAC;AAEF,eAAO,MAAM,WAAW,oBAMvB,CAAC"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,OAAO,CAAC;AAE5D,eAAO,MAAM,UAAU,wBAAyB,CAAC,KAAG,iBAAiB,CAAC,CAIrE,CAAC;AAEF,eAAO,MAAM,WAAW,aAAc,CAAC,KAAG,CAMzC,CAAC"}
package/dist/index.cjs CHANGED
@@ -30,7 +30,7 @@
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var Q;function ue(){return Q||(Q=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=g,r=X();function t(i,n){return i===n&&(i!==0||1/i===1/n)||i!==i&&n!==n}var o=typeof Object.is=="function"?Object.is:t,l=r.useSyncExternalStore,a=e.useRef,E=e.useEffect,m=e.useMemo,O=e.useDebugValue;function _(i,n,u,c,p){var s=a(null),d;s.current===null?(d={hasValue:!1,value:null},s.current=d):d=s.current;var h=m(function(){var L=!1,v,y,A=function(V){if(!L){L=!0,v=V;var x=c(V);if(p!==void 0&&d.hasValue){var M=d.value;if(p(M,x))return y=M,M}return y=x,x}var ee=v,I=y;if(o(ee,V))return I;var G=c(V);return p!==void 0&&p(I,G)?I:(v=V,y=G,G)},w=u===void 0?null:u,T=function(){return A(n())},C=w===null?void 0:function(){return A(w())};return[T,C]},[n,u,c,p]),R=h[0],S=h[1],f=l(i,R,S);return E(function(){d.hasValue=!0,d.value=f},[f]),O(f),f}K.useSyncExternalStoreWithSelector=_,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),K}process.env.NODE_ENV==="production"?N.exports=ne():N.exports=ue();var oe=N.exports;const ce=e=>e&&typeof e=="object",se=Object.keys,D=e=>Object.entries(e),P=e=>e instanceof Promise,k=e=>{const r=typeof e;return r==="string"||r==="number"||r==="bigint"||r==="boolean"||r==="undefined"||r===null},Z=(e,r)=>{if(e===r||Object.is(e,r))return!0;if(Array.isArray(e)&&Array.isArray(r)&&e.length!==r.length)return!1;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();const t=Object.keys(e);if(length=t.length,length!==Object.keys(r).length)return!1;let o=length;for(;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,t[o]))return!1;o=length;for(let l=length;l--!==0;){const a=t[l];if(!(k(e[a])&&k(r[a])&&r[a]===e[a]))return!1}return!0}return e!==e&&r!==r},ae=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),e),ie=(e,r)=>typeof r=="function"?r(e):r,b=e=>{const r=g.useRef(e??{});return g.useEffect(()=>void(r.current=e),[e]),r},q=e=>{const r=g.useRef();return g.useEffect(()=>{r.current=e},[e]),r.current},le=(e,r,t)=>{const[o,l]=g.useState(e),a=b(t??{}),E=g.useCallback(()=>a.current,[a]),m=g.useMemo(()=>D(r).reduce((O,[_,i])=>({...O,[_]:async(...n)=>{const u=await i(...n);return l(c=>u(c,E()))}}),r),[r,E]);return[o,m]},U=(e,r,t,o)=>r===e?t.reduce((l,a)=>a(l,r,o),e):e.constructor.name===Object.name?t.reduce((l,a)=>a(l,r,o),{...r,...e}):t.reduce((l,a)=>a(l,r,o),e),fe=(e,r,t,o,l,a)=>(...E)=>{const m=performance.now(),O=r(...E),_=(i,n)=>t(u=>U(i,u,a,n));return P(O)?O.then(i=>{l.current={method:e,props:o(),time:performance.now()-m},_(i,l.current)}):(l.current={method:e,props:o(),time:performance.now()-m},void _(O,l.current))},de=(e,r,t,o,l,a)=>(...E)=>{l.current={method:e,time:0,props:o()};const m=r(...E),O=_=>t(i=>U(_,i,a,l.current));return P(m)?m.then(_=>O(_)):O(m)},Se=(e,r,t)=>{const[o,l]=g.useState(()=>e),a=b(o),E=b((t==null?void 0:t.props)??{}),m=b(r),O=b((t==null?void 0:t.postMiddleware)??[]),_=b((t==null?void 0:t.interceptor)??[]),i=g.useRef(e),n=q(o),u=b(n),c=g.useRef(null);g.useEffect(()=>{if(c.current===null)return;const s=c.current;O.current.forEach(d=>{d(o,n,s)})},[o,O,n]);const[p]=g.useState(()=>{const s=()=>E.current,d=m.current({props:s,state:()=>a.current,initialState:i.current,previousState:()=>u.current});return D(d).reduce((h,[R,S])=>({...h,[R]:t!=null&&t.debug?fe(R,S,l,s,c,_.current):de(R,S,l,s,c,_.current)}),{})});return[o,p]},ve=(e,r,t)=>{let o=e;const l=(t==null?void 0:t.interceptor)??[],a=()=>o,E=new Set,m=u=>(E.add(u),()=>E.delete(u)),O=u=>{const c={...o},p=u(o);o=p,E.forEach(s=>s(p,c))},_={initialState:e,props:{},state:a,previousState:a},i=u=>u,n=D(r(_)).reduce((u,[c,p])=>({...u,[c]:(...s)=>{const d=p(...s),h=R=>O(S=>U(R,S,l,{method:c,props:{},selector:i,time:0}));return P(d)?d.then(h):h(d)}}),{});return Object.assign(function(c,p=Z,s){const d=b((s==null?void 0:s.postMiddleware)??[]),h=oe.useSyncExternalStoreWithSelector(m,a,a,c||i,p),R=q(h);return g.useEffect(()=>{Array.isArray(d.current)&&d.current.forEach(S=>{S(h,R,{method:"@globalState@",time:-1,props:{},selector:c})})},[h,R,d]),[h,n]},{dispatchers:n})},$=e=>r=>(t,o)=>(e().set(r,JSON.stringify(t)),t),_e=$(()=>({set:(e,r)=>localStorage.setItem(e,r)})),pe=$(()=>({set:(e,r)=>sessionStorage.setItem(e,r)})),Oe=e=>(r,t,o)=>(console.group(e),console.info(`%cAction %c- "${o.method}" ${o.time}ms
33
+ */var Q;function ue(){return Q||(Q=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=g,r=X();function t(i,n){return i===n&&(i!==0||1/i===1/n)||i!==i&&n!==n}var o=typeof Object.is=="function"?Object.is:t,l=r.useSyncExternalStore,a=e.useRef,E=e.useEffect,m=e.useMemo,O=e.useDebugValue;function _(i,n,u,c,p){var s=a(null),d;s.current===null?(d={hasValue:!1,value:null},s.current=d):d=s.current;var h=m(function(){var L=!1,v,y,A=function(V){if(!L){L=!0,v=V;var x=c(V);if(p!==void 0&&d.hasValue){var M=d.value;if(p(M,x))return y=M,M}return y=x,x}var ee=v,I=y;if(o(ee,V))return I;var G=c(V);return p!==void 0&&p(I,G)?I:(v=V,y=G,G)},w=u===void 0?null:u,T=function(){return A(n())},C=w===null?void 0:function(){return A(w())};return[T,C]},[n,u,c,p]),R=h[0],S=h[1],f=l(i,R,S);return E(function(){d.hasValue=!0,d.value=f},[f]),O(f),f}K.useSyncExternalStoreWithSelector=_,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),K}process.env.NODE_ENV==="production"?N.exports=ne():N.exports=ue();var oe=N.exports;const b=e=>{const r=g.useRef(e??{});return g.useEffect(()=>void(r.current=e),[e]),r},q=e=>{const r=g.useRef();return g.useEffect(()=>{r.current=e},[e]),r.current},ce=e=>e&&typeof e=="object",se=Object.keys,D=e=>Object.entries(e),P=e=>e instanceof Promise,k=e=>{const r=typeof e;return r==="string"||r==="number"||r==="bigint"||r==="boolean"||r==="undefined"||r===null},Z=(e,r)=>{if(e===r||Object.is(e,r))return!0;if(Array.isArray(e)&&Array.isArray(r)&&e.length!==r.length)return!1;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();const t=Object.keys(e);if(length=t.length,length!==Object.keys(r).length)return!1;let o=length;for(;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,t[o]))return!1;o=length;for(let l=length;l--!==0;){const a=t[l];if(!(k(e[a])&&k(r[a])&&r[a]===e[a]))return!1}return!0}return e!==e&&r!==r},ae=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),e),ie=(e,r)=>typeof r=="function"?r(e):r,le=(e,r,t)=>{const[o,l]=g.useState(e),a=b(t??{}),E=g.useCallback(()=>a.current,[a]),m=g.useMemo(()=>D(r).reduce((O,[_,i])=>({...O,[_]:async(...n)=>{const u=await i(...n);return l(c=>u(c,E()))}}),r),[r,E]);return[o,m]},U=(e,r,t,o)=>r===e?t.reduce((l,a)=>a(l,r,o),e):e.constructor.name===Object.name?t.reduce((l,a)=>a(l,r,o),{...r,...e}):t.reduce((l,a)=>a(l,r,o),e),fe=(e,r,t,o,l,a)=>(...E)=>{const m=performance.now(),O=r(...E),_=(i,n)=>t(u=>U(i,u,a,n));return P(O)?O.then(i=>{l.current={method:e,props:o(),time:performance.now()-m},_(i,l.current)}):(l.current={method:e,props:o(),time:performance.now()-m},void _(O,l.current))},de=(e,r,t,o,l,a)=>(...E)=>{l.current={method:e,time:0,props:o()};const m=r(...E),O=_=>t(i=>U(_,i,a,l.current));return P(m)?m.then(_=>O(_)):O(m)},Se=(e,r,t)=>{const[o,l]=g.useState(()=>e),a=b(o),E=b((t==null?void 0:t.props)??{}),m=b(r),O=b((t==null?void 0:t.postMiddleware)??[]),_=b((t==null?void 0:t.interceptor)??[]),i=g.useRef(e),n=q(o),u=b(n),c=g.useRef(null);g.useEffect(()=>{if(c.current===null)return;const s=c.current;O.current.forEach(d=>{d(o,n,s)})},[o,O,n]);const[p]=g.useState(()=>{const s=()=>E.current,d=m.current({props:s,state:()=>a.current,initialState:i.current,previousState:()=>u.current});return D(d).reduce((h,[R,S])=>({...h,[R]:t!=null&&t.debug?fe(R,S,l,s,c,_.current):de(R,S,l,s,c,_.current)}),{})});return[o,p,E.current]},ve=(e,r,t)=>{let o=e;const l=(t==null?void 0:t.interceptor)??[],a=()=>o,E=new Set,m=u=>(E.add(u),()=>E.delete(u)),O=u=>{const c={...o},p=u(o);o=p,E.forEach(s=>s(p,c))},_={initialState:e,props:{},state:a,previousState:a},i=u=>u,n=D(r(_)).reduce((u,[c,p])=>({...u,[c]:(...s)=>{const d=p(...s),h=R=>O(S=>U(R,S,l,{method:c,props:{},selector:i,time:0}));return P(d)?d.then(h):h(d)}}),{});return Object.assign(function(c,p=Z,s){const d=b((s==null?void 0:s.postMiddleware)??[]),h=oe.useSyncExternalStoreWithSelector(m,a,a,c||i,p),R=q(h);return g.useEffect(()=>{Array.isArray(d.current)&&d.current.forEach(S=>{S(h,R,{method:"@globalState@",time:-1,props:{},selector:c})})},[h,R,d]),[h,n,{}]},{dispatchers:n})},$=e=>r=>(t,o)=>(e().set(r,JSON.stringify(t)),t),_e=$(()=>({set:(e,r)=>localStorage.setItem(e,r)})),pe=$(()=>({set:(e,r)=>sessionStorage.setItem(e,r)})),Oe=e=>(r,t,o)=>(console.group(e),console.info(`%cAction %c- "${o.method}" ${o.time}ms
34
34
  `,"color: gold","color: white",t),console.info(`%cPrevious state
35
35
  `,"color: silver",t),console.info(`%cCurrent state
36
36
  `,"color: green",r),console.info(`Props
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js","../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js","../node_modules/use-sync-external-store/shim/index.js","../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js","../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js","../node_modules/use-sync-external-store/shim/with-selector.js","../src/lib.ts","../src/hooks.ts","../src/use-typed-reducer.ts","../src/plugins.ts"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n","/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\n// dispatch for CommonJS interop named imports.\n\nvar useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nvar didWarnOld18Alpha = false;\nvar didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\n\nfunction useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n// React do not expose a way to check if we're hydrating. So users of the shim\n// will need to track that themselves and return the correct value\n// from `getSnapshot`.\ngetServerSnapshot) {\n {\n if (!didWarnOld18Alpha) {\n if (React.startTransition !== undefined) {\n didWarnOld18Alpha = true;\n\n error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');\n }\n }\n } // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n\n\n var value = getSnapshot();\n\n {\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n\n if (!objectIs(value, cachedValue)) {\n error('The result of getSnapshot should be cached to avoid an infinite loop');\n\n didWarnUncachedGetSnapshot = true;\n }\n }\n } // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n\n\n var _useState = useState({\n inst: {\n value: value,\n getSnapshot: getSnapshot\n }\n }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n\n\n useLayoutEffect(function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }, [subscribe, value, getSnapshot]);\n useEffect(function () {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n\n var handleStoreChange = function () {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }; // Subscribe to the store and return a clean-up function.\n\n\n return subscribe(handleStoreChange);\n }, [subscribe]);\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n var prevValue = inst.value;\n\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n\nfunction useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n\nvar canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\n\nvar isServerEnvironment = !canUseDOM;\n\nvar shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;\nvar useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;\n\nexports.useSyncExternalStore = useSyncExternalStore$2;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\nvar shim = require('use-sync-external-store/shim');\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\nvar useSyncExternalStore = shim.useSyncExternalStore;\n\n// for CommonJS interop.\n\nvar useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.\n\nfunction useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {\n // Use this to track the rendered snapshot.\n var instRef = useRef(null);\n var inst;\n\n if (instRef.current === null) {\n inst = {\n hasValue: false,\n value: null\n };\n instRef.current = inst;\n } else {\n inst = instRef.current;\n }\n\n var _useMemo = useMemo(function () {\n // Track the memoized state using closure variables that are local to this\n // memoized instance of a getSnapshot function. Intentionally not using a\n // useRef hook, because that state would be shared across all concurrent\n // copies of the hook/component.\n var hasMemo = false;\n var memoizedSnapshot;\n var memoizedSelection;\n\n var memoizedSelector = function (nextSnapshot) {\n if (!hasMemo) {\n // The first time the hook is called, there is no memoized result.\n hasMemo = true;\n memoizedSnapshot = nextSnapshot;\n\n var _nextSelection = selector(nextSnapshot);\n\n if (isEqual !== undefined) {\n // Even if the selector has changed, the currently rendered selection\n // may be equal to the new selection. We should attempt to reuse the\n // current value if possible, to preserve downstream memoizations.\n if (inst.hasValue) {\n var currentSelection = inst.value;\n\n if (isEqual(currentSelection, _nextSelection)) {\n memoizedSelection = currentSelection;\n return currentSelection;\n }\n }\n }\n\n memoizedSelection = _nextSelection;\n return _nextSelection;\n } // We may be able to reuse the previous invocation's result.\n\n\n // We may be able to reuse the previous invocation's result.\n var prevSnapshot = memoizedSnapshot;\n var prevSelection = memoizedSelection;\n\n if (objectIs(prevSnapshot, nextSnapshot)) {\n // The snapshot is the same as last time. Reuse the previous selection.\n return prevSelection;\n } // The snapshot has changed, so we need to compute a new selection.\n\n\n // The snapshot has changed, so we need to compute a new selection.\n var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n\n // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {\n return prevSelection;\n }\n\n memoizedSnapshot = nextSnapshot;\n memoizedSelection = nextSelection;\n return nextSelection;\n }; // Assigning this to a constant so that Flow knows it can't change.\n\n\n // Assigning this to a constant so that Flow knows it can't change.\n var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;\n\n var getSnapshotWithSelector = function () {\n return memoizedSelector(getSnapshot());\n };\n\n var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n };\n return [getSnapshotWithSelector, getServerSnapshotWithSelector];\n }, [getSnapshot, getServerSnapshot, selector, isEqual]),\n getSelection = _useMemo[0],\n getServerSelection = _useMemo[1];\n\n var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);\n useEffect(function () {\n inst.hasValue = true;\n inst.value = value;\n }, [value]);\n useDebugValue(value);\n return value;\n}\n\nexports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n","import { Callback } from \"./types\";\n\nexport const isObject = <T>(obj: T) => obj && typeof obj === \"object\";\n\nexport const keys = Object.keys as <T>(t: T) => Array<keyof T>;\n\ntype MapArray<T, F> = { [K in keyof T]: [K, F] };\nexport const entries = <T extends {}, F>(t: T): MapArray<T[], F> => Object.entries(t) as any;\n\nexport const isPromise = <T>(promise: any): promise is Promise<T> => promise instanceof Promise;\n\nexport const isPrimitive = (a: any): a is string | number | boolean => {\n const type = typeof a;\n return (\n type === \"string\" ||\n type === \"number\" ||\n type === \"bigint\" ||\n type === \"boolean\" ||\n type === \"undefined\" ||\n type === null\n );\n};\n\nexport const shallowCompare = (left: any, right: any): boolean => {\n if (left === right || Object.is(left, right)) return true;\n if (Array.isArray(left) && Array.isArray(right)) {\n if (left.length !== right.length) return false;\n }\n if (left && right && typeof left === \"object\" && typeof right === \"object\") {\n if (left.constructor !== right.constructor) return false;\n if (left.valueOf !== Object.prototype.valueOf) return left.valueOf() === right.valueOf();\n const keys = Object.keys(left);\n length = keys.length;\n if (length !== Object.keys(right).length) {\n return false;\n }\n let i = length;\n for (; i-- !== 0; ) {\n if (!Object.prototype.hasOwnProperty.call(right, keys[i])) {\n return false;\n }\n }\n i = length;\n for (let i = length; i-- !== 0; ) {\n const key = keys[i];\n if (!(isPrimitive(left[key]) && isPrimitive(right[key]) && right[key] === left[key])) return false;\n }\n return true;\n }\n return left !== left && right !== right;\n};\n\nexport const clone = <O>(instance: O) => Object.assign(Object.create(Object.getPrototypeOf(instance)), instance);\n\nexport const dispatchCallback = <Prev extends any, T extends Callback<Prev>>(prev: Prev, setter: T) =>\n typeof setter === \"function\" ? setter(prev) : setter;\n","import { MutableRefObject, useEffect, useRef } from \"react\";\n\nexport const useMutable = <T extends {}>(state: T): MutableRefObject<T> => {\n const mutable = useRef<T>(state ?? {});\n useEffect(() => void (mutable.current = state), [state]);\n return mutable;\n};\n\nexport const usePrevious = <V>(value: V): V => {\n const ref = useRef<V>();\n useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current!;\n};\n","import React, { SetStateAction, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useSyncExternalStoreWithSelector } from \"use-sync-external-store/shim/with-selector\";\nimport { entries, isPromise, shallowCompare } from \"./lib\";\nimport {\n Dispatch,\n MapReducers,\n Action,\n Listener,\n UseReducer,\n ReducerActions,\n MapReducerReturn,\n ReducerMiddleware,\n Debug\n} from \"./types\";\nimport { useMutable, usePrevious } from \"./hooks\";\n\nexport const useLegacyReducer = <State extends {}, Reducers extends Dispatch<State, Props, Reducers>, Props extends {}>(\n initialState: State,\n reducers: Reducers,\n props?: Props\n): [state: State, dispatch: MapReducers<State, Props, Reducers>] => {\n const [state, setState] = useState(initialState);\n const refProps = useMutable<Props>((props as never) ?? {});\n const getProps = useCallback(() => refProps.current, [refProps]);\n\n const dispatches = useMemo<any>(\n () =>\n entries<Reducers, Action<State, Props>>(reducers).reduce(\n (acc, [name, dispatch]) => ({\n ...acc,\n [name]: async (...params: unknown[]) => {\n const dispatcher = await dispatch(...params);\n return setState((previousState: State) => dispatcher(previousState, getProps()));\n }\n }),\n reducers\n ),\n [reducers, getProps]\n );\n return [state, dispatches];\n};\n\nconst reduce = <State extends {}, Props extends {}>(\n state: State,\n prev: State,\n mutations: Mutators<State, Props>,\n debug: Debug<Props>\n) => {\n if (prev === state) return mutations.reduce((acc, el) => el(acc, prev, debug), state);\n return state.constructor.name === Object.name\n ? mutations.reduce((acc, el) => el(acc, prev, debug), { ...prev, ...state })\n : mutations.reduce((acc, el) => el(acc, prev, debug), state);\n};\n\nconst debugFunc =\n <State extends {}, Props extends object>(\n name: string,\n dispatch: (...args: any[]) => any,\n setState: React.Dispatch<SetStateAction<State>>,\n getProps: () => Props,\n debug: React.MutableRefObject<Debug<Props> | null>,\n mutations: Mutators<State, Props>\n ) =>\n (...params: any[]) => {\n const now = performance.now();\n const result = dispatch(...params);\n const set = (newState: State, debug: Debug<Props>) =>\n setState((prev) => reduce(newState, prev, mutations, debug));\n if (isPromise<State>(result)) {\n return result.then((resolved) => {\n debug.current = {\n method: name,\n props: getProps(),\n time: performance.now() - now\n };\n set(resolved, debug.current);\n });\n }\n debug.current = {\n method: name,\n props: getProps(),\n time: performance.now() - now\n };\n return void set(result, debug.current);\n };\n\ntype Mutators<State extends {}, Props extends {}> = Array<(state: State, prev: State, debug: Debug<Props>) => State>;\n\nconst optimizedFunc =\n <State extends {}, Props extends object>(\n name: string,\n dispatch: (...args: any[]) => any,\n setState: React.Dispatch<SetStateAction<State>>,\n getProps: () => Props,\n debug: React.MutableRefObject<Debug<Props> | null>,\n mutations: Mutators<State, Props>\n ) =>\n (...params: any[]) => {\n debug.current = { method: name, time: 0, props: getProps() };\n const result = dispatch(...params);\n const set = (newState: State) => setState((prev) => reduce(newState, prev, mutations, debug.current!));\n if (isPromise<State>(result)) {\n return result.then((resolved) => set(resolved));\n }\n return set(result);\n };\n\ntype Options<PostMiddleware, Props, Debug, Selector, Interceptor> = Partial<{\n props: Props;\n debug: Debug;\n selector: Selector;\n postMiddleware: PostMiddleware;\n interceptor: Interceptor;\n}>;\n\nexport const useReducer = <\n State extends {},\n Reducers extends ReducerActions<State, Props>,\n Props extends object,\n Middlewares extends ReducerMiddleware<State, Props>,\n Mutations extends Mutators<State, Props>,\n UseDebug extends boolean\n>(\n initialState: State,\n reducer: Reducers,\n options?: Options<Middlewares, Props, UseDebug, undefined, Mutations>\n): UseReducer<State, State, Props, Reducers> => {\n const [state, setState] = useState<State>(() => initialState);\n const mutableState = useMutable(state);\n const mutableProps = useMutable(options?.props ?? ({} as Props));\n const mutableReducer = useMutable(reducer);\n const middleware = useMutable<Middlewares>(options?.postMiddleware ?? ([] as unknown as Middlewares));\n const mutations = useMutable<Mutations>(options?.interceptor ?? ([] as unknown as Mutations));\n const savedInitialState = useRef(initialState);\n const previous = usePrevious(state);\n const previousRef = useMutable(previous);\n const debug = useRef<Debug<Props> | null>(null);\n\n useEffect(() => {\n if (debug.current === null) return;\n const d = debug.current!;\n middleware.current.forEach((middle) => {\n middle(state, previous, d);\n });\n }, [state, middleware, previous]);\n\n const [dispatchers] = useState<MapReducerReturn<State, ReturnType<Reducers>>>(() => {\n const getProps = () => mutableProps.current;\n const reducers = mutableReducer.current({\n props: getProps,\n state: () => mutableState.current,\n initialState: savedInitialState.current,\n previousState: () => previousRef.current\n });\n return entries<string, any>(reducers as any).reduce(\n (acc, [name, dispatch]: any) => ({\n ...acc,\n [name]: options?.debug\n ? debugFunc(name, dispatch, setState, getProps, debug, mutations.current)\n : optimizedFunc(name, dispatch, setState, getProps, debug, mutations.current)\n }),\n {} as MapReducerReturn<State, ReturnType<Reducers>>\n );\n });\n return [state, dispatchers] as const;\n};\n\nexport const createGlobalReducer = <\n State extends {},\n Reducers extends ReducerActions<State, {}>,\n Mutations extends Mutators<State, {}>\n>(\n initialState: State,\n reducer: Reducers,\n rootOptions?: Omit<Options<[], {}, {}, () => State, Mutations>, \"middlewares\">\n): (<Selector extends (state: State) => any, Middlewares extends ReducerMiddleware<ReturnType<Selector>, {}>>(\n selector?: Selector,\n comparator?: (a: any, b: any) => boolean,\n options?: Options<Middlewares, {}, {}, Selector, []>\n) => UseReducer<Selector extends (state: State) => State ? State : ReturnType<Selector>, State, {}, Reducers>) & {\n dispatchers: MapReducerReturn<State, ReturnType<Reducers>>;\n} => {\n let state = initialState;\n const rootMutations = rootOptions?.interceptor ?? [];\n const getSnapshot = () => state;\n const listeners = new Set<Listener<State>>();\n const addListener = (listener: Listener<State>) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const setState = (callback: (arg: State) => State) => {\n const previousState = { ...state };\n const newState = callback(state);\n state = newState;\n listeners.forEach((exec) => exec(newState, previousState));\n };\n\n const debugOptions = { initialState, props: {} as any, state: getSnapshot, previousState: getSnapshot };\n\n const defaultSelector = (state: State) => state;\n\n const dispatchers: MapReducerReturn<State, ReturnType<Reducers>> = entries(reducer(debugOptions)).reduce<any>(\n (acc, [method, fn]: any) => ({\n ...acc,\n [method]: (...args: any[]) => {\n const result = fn(...args);\n const set = (newState: State) =>\n setState((prev) =>\n reduce(newState, prev, rootMutations, {\n method,\n props: {},\n selector: defaultSelector,\n time: 0,\n })\n );\n return isPromise<State>(result) ? result.then(set) : set(result);\n }\n }),\n {}\n );\n\n return Object.assign(\n function useStore<\n Selector extends (state: State) => any,\n O extends Omit<Options<ReducerMiddleware<ReturnType<Selector>, {}>, {}, {}, Selector, []>, \"mutations\">\n >(selector?: Selector, comparator = shallowCompare, options?: O) {\n const middleware = useMutable(options?.postMiddleware ?? []);\n const state = useSyncExternalStoreWithSelector(\n addListener,\n getSnapshot,\n getSnapshot,\n selector || defaultSelector,\n comparator\n );\n const previous = usePrevious(state);\n useEffect(() => {\n if (Array.isArray(middleware.current))\n middleware.current.forEach((middle) => {\n middle(state, previous, { method: \"@globalState@\", time: -1, props: {}, selector });\n });\n }, [state, previous, middleware]);\n return [state, dispatchers] as const;\n },\n { dispatchers }\n );\n};\n","import { Debug } from \"./types\";\n\nexport type StoragePluginManager = {\n set: (key: string, value: any) => void;\n};\n\nexport const createStoragePlugin =\n (storage: () => StoragePluginManager) =>\n (key: string) =>\n <T>(state: T, _: T) => {\n storage().set(key, JSON.stringify(state));\n return state;\n };\n\nexport const createLocalStoragePlugin = createStoragePlugin(() => ({\n set: (k, v) => localStorage.setItem(k, v)\n}));\n\nexport const createSessionStoragePlugin = createStoragePlugin(() => ({\n set: (k, v) => sessionStorage.setItem(k, v)\n}));\n\nexport const createLoggerPlugin =\n (groupName: string) =>\n <State, Props extends object>(state: State, prev: State, debug: Debug<Props>) => {\n console.group(groupName);\n console.info(`%cAction %c- \"${debug.method}\" ${debug.time}ms\\n`, \"color: gold\", \"color: white\", prev);\n console.info(\"%cPrevious state\\n\", \"color: silver\", prev);\n console.info(\"%cCurrent state\\n\", \"color: green\", state);\n console.info(\"Props\\n\", debug.props);\n console.groupEnd();\n return state;\n };\n"],"names":["require$$0","h","a","b","k","l","m","n","p","q","d","f","c","g","r","t","u","useSyncExternalStoreShim_production_min","React","ReactSharedInternals","error","format","_len2","args","_key2","printWarning","level","ReactDebugCurrentFrame","stack","argsWithFormat","item","is","x","y","objectIs","useState","useEffect","useLayoutEffect","useDebugValue","didWarnOld18Alpha","didWarnUncachedGetSnapshot","useSyncExternalStore","subscribe","getSnapshot","getServerSnapshot","value","cachedValue","_useState","inst","forceUpdate","checkIfSnapshotChanged","handleStoreChange","latestGetSnapshot","prevValue","nextValue","useSyncExternalStore$1","canUseDOM","isServerEnvironment","shim","useSyncExternalStore$2","useSyncExternalStoreShim_development","shimModule","require$$1","v","w","withSelector_production_min","e","useRef","useMemo","useSyncExternalStoreWithSelector","selector","isEqual","instRef","_useMemo","hasMemo","memoizedSnapshot","memoizedSelection","memoizedSelector","nextSnapshot","_nextSelection","currentSelection","prevSnapshot","prevSelection","nextSelection","maybeGetServerSnapshot","getSnapshotWithSelector","getServerSnapshotWithSelector","getSelection","getServerSelection","withSelector_development","withSelectorModule","isObject","obj","keys","entries","isPromise","promise","isPrimitive","type","shallowCompare","left","right","i","key","clone","instance","dispatchCallback","prev","setter","useMutable","state","mutable","usePrevious","ref","useLegacyReducer","initialState","reducers","props","setState","refProps","getProps","useCallback","dispatches","acc","name","dispatch","params","dispatcher","previousState","reduce","mutations","debug","el","debugFunc","now","result","set","newState","resolved","optimizedFunc","useReducer","reducer","options","mutableState","mutableProps","mutableReducer","middleware","savedInitialState","previous","previousRef","middle","dispatchers","createGlobalReducer","rootOptions","rootMutations","listeners","addListener","listener","callback","exec","debugOptions","defaultSelector","method","fn","comparator","createStoragePlugin","storage","_","createLocalStoragePlugin","createSessionStoragePlugin","createLoggerPlugin","groupName"],"mappings":";;;;;;;;yCASa,IAAI,EAAEA,EAAiB,SAASC,EAAEC,EAAEC,EAAE,CAAC,OAAOD,IAAIC,IAAQD,IAAJ,GAAO,EAAEA,IAAI,EAAEC,IAAID,IAAIA,GAAGC,IAAIA,CAAC,CAAC,IAAIC,EAAe,OAAO,OAAO,IAA3B,WAA8B,OAAO,GAAGH,EAAEI,EAAE,EAAE,SAASC,EAAE,EAAE,UAAUC,EAAE,EAAE,gBAAgBC,E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C/D,IAAK,CAACjK,EAAG2D,IAAM,aAAa,QAAQ3D,EAAG2D,CAAC,CAC5C,EAAE,EAEW0G,GAA6BJ,EAAoB,KAAO,CACjE,IAAK,CAACjK,EAAG2D,IAAM,eAAe,QAAQ3D,EAAG2D,CAAC,CAC9C,EAAE,EAEW2G,GACRC,GACD,CAA8B7D,EAAcH,EAAawB,KACrD,QAAQ,MAAMwC,CAAS,EACvB,QAAQ,KAAK,iBAAiBxC,EAAM,MAAM,KAAKA,EAAM,IAAI;AAAA,EAAQ,cAAe,eAAgBxB,CAAI,EAC5F,QAAA,KAAK;AAAA,EAAsB,gBAAiBA,CAAI,EAChD,QAAA,KAAK;AAAA,EAAqB,eAAgBG,CAAK,EAC/C,QAAA,KAAK;AAAA,EAAWqB,EAAM,KAAK,EACnC,QAAQ,SAAS,EACVrB","x_google_ignoreList":[0,1,2,3,4,5]}
1
+ {"version":3,"file":"index.cjs","sources":["../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js","../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js","../node_modules/use-sync-external-store/shim/index.js","../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js","../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js","../node_modules/use-sync-external-store/shim/with-selector.js","../src/hooks.ts","../src/lib.ts","../src/use-typed-reducer.ts","../src/plugins.ts"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n","/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\n// dispatch for CommonJS interop named imports.\n\nvar useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nvar didWarnOld18Alpha = false;\nvar didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\n\nfunction useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n// React do not expose a way to check if we're hydrating. So users of the shim\n// will need to track that themselves and return the correct value\n// from `getSnapshot`.\ngetServerSnapshot) {\n {\n if (!didWarnOld18Alpha) {\n if (React.startTransition !== undefined) {\n didWarnOld18Alpha = true;\n\n error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');\n }\n }\n } // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n\n\n var value = getSnapshot();\n\n {\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n\n if (!objectIs(value, cachedValue)) {\n error('The result of getSnapshot should be cached to avoid an infinite loop');\n\n didWarnUncachedGetSnapshot = true;\n }\n }\n } // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n\n\n var _useState = useState({\n inst: {\n value: value,\n getSnapshot: getSnapshot\n }\n }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n\n\n useLayoutEffect(function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }, [subscribe, value, getSnapshot]);\n useEffect(function () {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n\n var handleStoreChange = function () {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }; // Subscribe to the store and return a clean-up function.\n\n\n return subscribe(handleStoreChange);\n }, [subscribe]);\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n var prevValue = inst.value;\n\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n\nfunction useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n\nvar canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\n\nvar isServerEnvironment = !canUseDOM;\n\nvar shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;\nvar useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;\n\nexports.useSyncExternalStore = useSyncExternalStore$2;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\nvar shim = require('use-sync-external-store/shim');\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\nvar useSyncExternalStore = shim.useSyncExternalStore;\n\n// for CommonJS interop.\n\nvar useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.\n\nfunction useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {\n // Use this to track the rendered snapshot.\n var instRef = useRef(null);\n var inst;\n\n if (instRef.current === null) {\n inst = {\n hasValue: false,\n value: null\n };\n instRef.current = inst;\n } else {\n inst = instRef.current;\n }\n\n var _useMemo = useMemo(function () {\n // Track the memoized state using closure variables that are local to this\n // memoized instance of a getSnapshot function. Intentionally not using a\n // useRef hook, because that state would be shared across all concurrent\n // copies of the hook/component.\n var hasMemo = false;\n var memoizedSnapshot;\n var memoizedSelection;\n\n var memoizedSelector = function (nextSnapshot) {\n if (!hasMemo) {\n // The first time the hook is called, there is no memoized result.\n hasMemo = true;\n memoizedSnapshot = nextSnapshot;\n\n var _nextSelection = selector(nextSnapshot);\n\n if (isEqual !== undefined) {\n // Even if the selector has changed, the currently rendered selection\n // may be equal to the new selection. We should attempt to reuse the\n // current value if possible, to preserve downstream memoizations.\n if (inst.hasValue) {\n var currentSelection = inst.value;\n\n if (isEqual(currentSelection, _nextSelection)) {\n memoizedSelection = currentSelection;\n return currentSelection;\n }\n }\n }\n\n memoizedSelection = _nextSelection;\n return _nextSelection;\n } // We may be able to reuse the previous invocation's result.\n\n\n // We may be able to reuse the previous invocation's result.\n var prevSnapshot = memoizedSnapshot;\n var prevSelection = memoizedSelection;\n\n if (objectIs(prevSnapshot, nextSnapshot)) {\n // The snapshot is the same as last time. Reuse the previous selection.\n return prevSelection;\n } // The snapshot has changed, so we need to compute a new selection.\n\n\n // The snapshot has changed, so we need to compute a new selection.\n var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n\n // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {\n return prevSelection;\n }\n\n memoizedSnapshot = nextSnapshot;\n memoizedSelection = nextSelection;\n return nextSelection;\n }; // Assigning this to a constant so that Flow knows it can't change.\n\n\n // Assigning this to a constant so that Flow knows it can't change.\n var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;\n\n var getSnapshotWithSelector = function () {\n return memoizedSelector(getSnapshot());\n };\n\n var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n };\n return [getSnapshotWithSelector, getServerSnapshotWithSelector];\n }, [getSnapshot, getServerSnapshot, selector, isEqual]),\n getSelection = _useMemo[0],\n getServerSelection = _useMemo[1];\n\n var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);\n useEffect(function () {\n inst.hasValue = true;\n inst.value = value;\n }, [value]);\n useDebugValue(value);\n return value;\n}\n\nexports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n","import { MutableRefObject, useEffect, useRef } from \"react\";\n\nexport const useMutable = <T extends {}>(state: T): MutableRefObject<T> => {\n const mutable = useRef<T>(state ?? {});\n useEffect(() => void (mutable.current = state), [state]);\n return mutable;\n};\n\nexport const usePrevious = <V>(value: V): V => {\n const ref = useRef<V>();\n useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current!;\n};\n","import { Callback } from \"./types\";\n\nexport const isObject = <T>(obj: T) => obj && typeof obj === \"object\";\n\nexport const keys = Object.keys as <T>(t: T) => Array<keyof T>;\n\ntype MapArray<T, F> = { [K in keyof T]: [K, F] };\nexport const entries = <T extends {}, F>(t: T): MapArray<T[], F> => Object.entries(t) as any;\n\nexport const isPromise = <T>(promise: any): promise is Promise<T> => promise instanceof Promise;\n\nexport const isPrimitive = (a: any): a is string | number | boolean => {\n const type = typeof a;\n return (\n type === \"string\" ||\n type === \"number\" ||\n type === \"bigint\" ||\n type === \"boolean\" ||\n type === \"undefined\" ||\n type === null\n );\n};\n\nexport const shallowCompare = (left: any, right: any): boolean => {\n if (left === right || Object.is(left, right)) return true;\n if (Array.isArray(left) && Array.isArray(right)) {\n if (left.length !== right.length) return false;\n }\n if (left && right && typeof left === \"object\" && typeof right === \"object\") {\n if (left.constructor !== right.constructor) return false;\n if (left.valueOf !== Object.prototype.valueOf) return left.valueOf() === right.valueOf();\n const keys = Object.keys(left);\n length = keys.length;\n if (length !== Object.keys(right).length) {\n return false;\n }\n let i = length;\n for (; i-- !== 0; ) {\n if (!Object.prototype.hasOwnProperty.call(right, keys[i])) {\n return false;\n }\n }\n i = length;\n for (let i = length; i-- !== 0; ) {\n const key = keys[i];\n if (!(isPrimitive(left[key]) && isPrimitive(right[key]) && right[key] === left[key])) return false;\n }\n return true;\n }\n return left !== left && right !== right;\n};\n\nexport const clone = <O>(instance: O) => Object.assign(Object.create(Object.getPrototypeOf(instance)), instance);\n\nexport const dispatchCallback = <Prev extends any, T extends Callback<Prev>>(prev: Prev, setter: T) =>\n typeof setter === \"function\" ? setter(prev) : setter;\n","import React, { SetStateAction, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useSyncExternalStoreWithSelector } from \"use-sync-external-store/shim/with-selector\";\nimport { useMutable, usePrevious } from \"./hooks\";\nimport { entries, isPromise, shallowCompare } from \"./lib\";\nimport {\n Action,\n Debug,\n Dispatch,\n Listener,\n MapReducerReturn,\n MapReducers,\n ReducerActions,\n ReducerMiddleware,\n UseReducer\n} from \"./types\";\n\nexport const useLegacyReducer = <State extends {}, Reducers extends Dispatch<State, Props, Reducers>, Props extends {}>(\n initialState: State,\n reducers: Reducers,\n props?: Props\n): [state: State, dispatch: MapReducers<State, Props, Reducers>] => {\n const [state, setState] = useState(initialState);\n const refProps = useMutable<Props>((props as never) ?? {});\n const getProps = useCallback(() => refProps.current, [refProps]);\n\n const dispatches = useMemo<any>(\n () =>\n entries<Reducers, Action<State, Props>>(reducers).reduce(\n (acc, [name, dispatch]) => ({\n ...acc,\n [name]: async (...params: unknown[]) => {\n const dispatcher = await dispatch(...params);\n return setState((previousState: State) => dispatcher(previousState, getProps()));\n }\n }),\n reducers\n ),\n [reducers, getProps]\n );\n return [state, dispatches];\n};\n\nconst reduce = <State extends {}, Props extends {}>(\n state: State,\n prev: State,\n mutations: Mutators<State, Props>,\n debug: Debug<Props>\n) => {\n if (prev === state) return mutations.reduce((acc, el) => el(acc, prev, debug), state);\n return state.constructor.name === Object.name\n ? mutations.reduce((acc, el) => el(acc, prev, debug), { ...prev, ...state })\n : mutations.reduce((acc, el) => el(acc, prev, debug), state);\n};\n\nconst debugFunc =\n <State extends {}, Props extends object>(\n name: string,\n dispatch: (...args: any[]) => any,\n setState: React.Dispatch<SetStateAction<State>>,\n getProps: () => Props,\n debug: React.MutableRefObject<Debug<Props> | null>,\n mutations: Mutators<State, Props>\n ) =>\n (...params: any[]) => {\n const now = performance.now();\n const result = dispatch(...params);\n const set = (newState: State, debug: Debug<Props>) =>\n setState((prev) => reduce(newState, prev, mutations, debug));\n if (isPromise<State>(result)) {\n return result.then((resolved) => {\n debug.current = {\n method: name,\n props: getProps(),\n time: performance.now() - now\n };\n set(resolved, debug.current);\n });\n }\n debug.current = {\n method: name,\n props: getProps(),\n time: performance.now() - now\n };\n return void set(result, debug.current);\n };\n\ntype Mutators<State extends {}, Props extends {}> = Array<(state: State, prev: State, debug: Debug<Props>) => State>;\n\nconst optimizedFunc =\n <State extends {}, Props extends object>(\n name: string,\n dispatch: (...args: any[]) => any,\n setState: React.Dispatch<SetStateAction<State>>,\n getProps: () => Props,\n debug: React.MutableRefObject<Debug<Props> | null>,\n mutations: Mutators<State, Props>\n ) =>\n (...params: any[]) => {\n debug.current = { method: name, time: 0, props: getProps() };\n const result = dispatch(...params);\n const set = (newState: State) => setState((prev) => reduce(newState, prev, mutations, debug.current!));\n if (isPromise<State>(result)) {\n return result.then((resolved) => set(resolved));\n }\n return set(result);\n };\n\ntype Options<PostMiddleware, Props, Debug, Selector, Interceptor> = Partial<{\n props: Props;\n debug: Debug;\n selector: Selector;\n interceptor: Interceptor;\n postMiddleware: PostMiddleware;\n}>;\n\nexport const useReducer = <\n State extends {},\n Reducers extends ReducerActions<State, Props>,\n Props extends object,\n Middlewares extends ReducerMiddleware<State, Props>,\n Mutations extends Mutators<State, Props>,\n UseDebug extends boolean\n>(\n initialState: State,\n reducer: Reducers,\n options?: Options<Middlewares, Props, UseDebug, undefined, Mutations>\n): UseReducer<State, State, Props, Reducers> => {\n const [state, setState] = useState<State>(() => initialState);\n const mutableState = useMutable(state);\n const mutableProps = useMutable(options?.props ?? ({} as Props));\n const mutableReducer = useMutable(reducer);\n const middleware = useMutable<Middlewares>(options?.postMiddleware ?? ([] as unknown as Middlewares));\n const mutations = useMutable<Mutations>(options?.interceptor ?? ([] as unknown as Mutations));\n const savedInitialState = useRef(initialState);\n const previous = usePrevious(state);\n const previousRef = useMutable(previous);\n const debug = useRef<Debug<Props> | null>(null);\n\n useEffect(() => {\n if (debug.current === null) return;\n const d = debug.current!;\n middleware.current.forEach((middle) => {\n middle(state, previous, d);\n });\n }, [state, middleware, previous]);\n\n const [dispatchers] = useState<MapReducerReturn<State, ReturnType<Reducers>>>(() => {\n const getProps = () => mutableProps.current;\n const reducers = mutableReducer.current({\n props: getProps,\n state: () => mutableState.current,\n initialState: savedInitialState.current,\n previousState: () => previousRef.current\n });\n return entries<string, any>(reducers as any).reduce(\n (acc, [name, dispatch]: any) => ({\n ...acc,\n [name]: options?.debug\n ? debugFunc(name, dispatch, setState, getProps, debug, mutations.current)\n : optimizedFunc(name, dispatch, setState, getProps, debug, mutations.current)\n }),\n {} as MapReducerReturn<State, ReturnType<Reducers>>\n );\n });\n return [state, dispatchers, mutableProps.current] as const;\n};\n\nexport const createGlobalReducer = <\n State extends {},\n Reducers extends ReducerActions<State, {}>,\n Mutations extends Mutators<State, {}>\n>(\n initialState: State,\n reducer: Reducers,\n rootOptions?: Pick<Options<[], {}, {}, () => State, Mutations>, \"interceptor\">\n): (<Selector extends (state: State) => any, Middlewares extends ReducerMiddleware<ReturnType<Selector>, {}>>(\n selector?: Selector,\n comparator?: (a: any, b: any) => boolean,\n options?: Options<Middlewares, {}, {}, Selector, []>\n) => UseReducer<Selector extends (state: State) => State ? State : ReturnType<Selector>, State, {}, Reducers>) & {\n dispatchers: MapReducerReturn<State, ReturnType<Reducers>>;\n} => {\n let state = initialState;\n const rootMutations = rootOptions?.interceptor ?? [];\n const getSnapshot = () => state;\n const listeners = new Set<Listener<State>>();\n const addListener = (listener: Listener<State>) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const setState = (callback: (arg: State) => State) => {\n const previousState = { ...state };\n const newState = callback(state);\n state = newState;\n listeners.forEach((exec) => exec(newState, previousState));\n };\n\n const debugOptions = { initialState, props: {} as any, state: getSnapshot, previousState: getSnapshot };\n\n const defaultSelector = (state: State) => state;\n\n const dispatchers: MapReducerReturn<State, ReturnType<Reducers>> = entries(reducer(debugOptions)).reduce<any>(\n (acc, [method, fn]: any) => ({\n ...acc,\n [method]: (...args: any[]) => {\n const result = fn(...args);\n const set = (newState: State) =>\n setState((prev) =>\n reduce(newState, prev, rootMutations, {\n method,\n props: {},\n selector: defaultSelector,\n time: 0\n })\n );\n return isPromise<State>(result) ? result.then(set) : set(result);\n }\n }),\n {}\n );\n\n return Object.assign(\n function useStore<\n Selector extends (state: State) => any,\n O extends Omit<Options<ReducerMiddleware<ReturnType<Selector>, {}>, {}, {}, Selector, []>, \"mutations\">\n >(selector?: Selector, comparator = shallowCompare, options?: O) {\n const middleware = useMutable(options?.postMiddleware ?? []);\n const state = useSyncExternalStoreWithSelector(\n addListener,\n getSnapshot,\n getSnapshot,\n selector || defaultSelector,\n comparator\n );\n const previous = usePrevious(state);\n useEffect(() => {\n if (Array.isArray(middleware.current))\n middleware.current.forEach((middle) => {\n middle(state, previous, { method: \"@globalState@\", time: -1, props: {}, selector });\n });\n }, [state, previous, middleware]);\n return [state, dispatchers, {}] as const;\n },\n { dispatchers }\n );\n};\n","import { Debug } from \"./types\";\n\nexport type StoragePluginManager = {\n set: (key: string, value: any) => void;\n};\n\nexport const createStoragePlugin =\n (storage: () => StoragePluginManager) =>\n (key: string) =>\n <T>(state: T, _: T) => {\n storage().set(key, JSON.stringify(state));\n return state;\n };\n\nexport const createLocalStoragePlugin = createStoragePlugin(() => ({\n set: (k, v) => localStorage.setItem(k, v)\n}));\n\nexport const createSessionStoragePlugin = createStoragePlugin(() => ({\n set: (k, v) => sessionStorage.setItem(k, v)\n}));\n\nexport const createLoggerPlugin =\n (groupName: string) =>\n <State, Props extends object>(state: State, prev: State, debug: Debug<Props>) => {\n console.group(groupName);\n console.info(`%cAction %c- \"${debug.method}\" ${debug.time}ms\\n`, \"color: gold\", \"color: white\", prev);\n console.info(\"%cPrevious state\\n\", \"color: silver\", prev);\n console.info(\"%cCurrent state\\n\", \"color: green\", state);\n console.info(\"Props\\n\", debug.props);\n console.groupEnd();\n return state;\n };\n"],"names":["require$$0","h","a","b","k","l","m","n","p","q","d","f","c","g","r","t","u","useSyncExternalStoreShim_production_min","React","ReactSharedInternals","error","format","_len2","args","_key2","printWarning","level","ReactDebugCurrentFrame","stack","argsWithFormat","item","is","x","y","objectIs","useState","useEffect","useLayoutEffect","useDebugValue","didWarnOld18Alpha","didWarnUncachedGetSnapshot","useSyncExternalStore","subscribe","getSnapshot","getServerSnapshot","value","cachedValue","_useState","inst","forceUpdate","checkIfSnapshotChanged","handleStoreChange","latestGetSnapshot","prevValue","nextValue","useSyncExternalStore$1","canUseDOM","isServerEnvironment","shim","useSyncExternalStore$2","useSyncExternalStoreShim_development","shimModule","require$$1","v","w","withSelector_production_min","e","useRef","useMemo","useSyncExternalStoreWithSelector","selector","isEqual","instRef","_useMemo","hasMemo","memoizedSnapshot","memoizedSelection","memoizedSelector","nextSnapshot","_nextSelection","currentSelection","prevSnapshot","prevSelection","nextSelection","maybeGetServerSnapshot","getSnapshotWithSelector","getServerSnapshotWithSelector","getSelection","getServerSelection","withSelector_development","withSelectorModule","useMutable","state","mutable","usePrevious","ref","isObject","obj","keys","entries","isPromise","promise","isPrimitive","type","shallowCompare","left","right","i","key","clone","instance","dispatchCallback","prev","setter","useLegacyReducer","initialState","reducers","props","setState","refProps","getProps","useCallback","dispatches","acc","name","dispatch","params","dispatcher","previousState","reduce","mutations","debug","el","debugFunc","now","result","set","newState","resolved","optimizedFunc","useReducer","reducer","options","mutableState","mutableProps","mutableReducer","middleware","savedInitialState","previous","previousRef","middle","dispatchers","createGlobalReducer","rootOptions","rootMutations","listeners","addListener","listener","callback","exec","debugOptions","defaultSelector","method","fn","comparator","createStoragePlugin","storage","_","createLocalStoragePlugin","createSessionStoragePlugin","createLoggerPlugin","groupName"],"mappings":";;;;;;;;yCASa,IAAI,EAAEA,EAAiB,SAASC,EAAEC,EAAEC,EAAE,CAAC,OAAOD,IAAIC,IAAQD,IAAJ,GAAO,EAAEA,IAAI,EAAEC,IAAID,IAAIA,GAAGC,IAAIA,CAAC,CAAC,IAAIC,EAAe,OAAO,OAAO,IAA3B,WAA8B,OAAO,GAAGH,EAAEI,EAAE,EAAE,SAASC,EAAE,EAAE,UAAUC,EAAE,EAAE,gBAAgBC,EAAE,EAAE,cAAc,SAASC,EAAEP,EAAEC,EAAE,CAAC,IAAIO,EAAEP,EAAC,EAAGQ,EAAEN,EAAE,CAAC,KAAK,CAAC,MAAMK,EAAE,YAAYP,CAAC,CAAC,CAAC,EAAES,EAAED,EAAE,CAAC,EAAE,KAAKE,EAAEF,EAAE,CAAC,EAAE,OAAAJ,EAAE,UA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ACRC,GACD,CAA8B/E,EAAcoB,EAAamB,KACrD,QAAQ,MAAMwC,CAAS,EACvB,QAAQ,KAAK,iBAAiBxC,EAAM,MAAM,KAAKA,EAAM,IAAI;AAAA,EAAQ,cAAe,eAAgBnB,CAAI,EAC5F,QAAA,KAAK;AAAA,EAAsB,gBAAiBA,CAAI,EAChD,QAAA,KAAK;AAAA,EAAqB,eAAgBpB,CAAK,EAC/C,QAAA,KAAK;AAAA,EAAWuC,EAAM,KAAK,EACnC,QAAQ,SAAS,EACVvC","x_google_ignoreList":[0,1,2,3,4,5]}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export type { Action, Callback, Comparator, Debug, Dispatch, FnMap, Listener, MapReducerReturn, MapReducers, MappedReducers, PromiseBox, ReducerActions, ReducerArgs, ReducerMiddleware, UseReducer, VoidFn } from "./types";
2
- export { useReducer, useLegacyReducer, createGlobalReducer } from "./use-typed-reducer";
3
- export { clone, shallowCompare, isPrimitive, isPromise, dispatchCallback, entries, keys, isObject } from "./lib";
4
- export { usePrevious, useMutable } from "./hooks";
5
- export { createLocalStoragePlugin, createLoggerPlugin, createSessionStoragePlugin, createStoragePlugin, type StoragePluginManager } from "./plugins";
1
+ export type { Action, Callback, Debug, Dispatch, FnMap, Listener, MapReducerReturn, MapReducers, MappedReducers, PromiseBox, ReducerActions, ReducerArgs, ReducerMiddleware, UseReducer, VoidFn } from './types';
2
+ export { useReducer, useLegacyReducer, createGlobalReducer } from './use-typed-reducer';
3
+ export { clone, shallowCompare, isPrimitive, isPromise, dispatchCallback, entries, keys, isObject } from './lib';
4
+ export { usePrevious, useMutable } from './hooks';
5
+ export { createLocalStoragePlugin, createLoggerPlugin, createSessionStoragePlugin, createStoragePlugin, type StoragePluginManager } from './plugins';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACR,MAAM,EACN,QAA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,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -242,7 +242,15 @@ function ae() {
242
242
  }
243
243
  process.env.NODE_ENV === "production" ? U.exports = se() : U.exports = ae();
244
244
  var ie = U.exports;
245
- const ve = (e) => e && typeof e == "object", _e = Object.keys, k = (e) => Object.entries(e), q = (e) => e instanceof Promise, X = (e) => {
245
+ const A = (e) => {
246
+ const r = D(e ?? {});
247
+ return x(() => void (r.current = e), [e]), r;
248
+ }, ee = (e) => {
249
+ const r = D();
250
+ return x(() => {
251
+ r.current = e;
252
+ }, [e]), r.current;
253
+ }, ve = (e) => e && typeof e == "object", _e = Object.keys, k = (e) => Object.entries(e), q = (e) => e instanceof Promise, X = (e) => {
246
254
  const r = typeof e;
247
255
  return r === "string" || r === "number" || r === "bigint" || r === "boolean" || r === "undefined" || r === null;
248
256
  }, le = (e, r) => {
@@ -271,15 +279,7 @@ const ve = (e) => e && typeof e == "object", _e = Object.keys, k = (e) => Object
271
279
  return !0;
272
280
  }
273
281
  return e !== e && r !== r;
274
- }, pe = (e) => Object.assign(Object.create(Object.getPrototypeOf(e)), e), Oe = (e, r) => typeof r == "function" ? r(e) : r, A = (e) => {
275
- const r = D(e ?? {});
276
- return x(() => void (r.current = e), [e]), r;
277
- }, ee = (e) => {
278
- const r = D();
279
- return x(() => {
280
- r.current = e;
281
- }, [e]), r.current;
282
- }, Ee = (e, r, t) => {
282
+ }, pe = (e) => Object.assign(Object.create(Object.getPrototypeOf(e)), e), Oe = (e, r) => typeof r == "function" ? r(e) : r, Ee = (e, r, t) => {
283
283
  const [o, l] = N(e), a = A(t ?? {}), E = ne(() => a.current, [a]), m = ue(
284
284
  () => k(r).reduce(
285
285
  (O, [_, i]) => ({
@@ -336,7 +336,7 @@ const ve = (e) => e && typeof e == "object", _e = Object.keys, k = (e) => Object
336
336
  {}
337
337
  );
338
338
  });
339
- return [o, p];
339
+ return [o, p, E.current];
340
340
  }, he = (e, r, t) => {
341
341
  let o = e;
342
342
  const l = (t == null ? void 0 : t.interceptor) ?? [], a = () => o, E = /* @__PURE__ */ new Set(), m = (u) => (E.add(u), () => E.delete(u)), O = (u) => {
@@ -372,7 +372,7 @@ const ve = (e) => e && typeof e == "object", _e = Object.keys, k = (e) => Object
372
372
  Array.isArray(d.current) && d.current.forEach((S) => {
373
373
  S(h, g, { method: "@globalState@", time: -1, props: {}, selector: c });
374
374
  });
375
- }, [h, g, d]), [h, n];
375
+ }, [h, g, d]), [h, n, {}];
376
376
  },
377
377
  { dispatchers: n }
378
378
  );