use-typed-reducer 3.3.0 → 3.3.2

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
@@ -1,8 +1,21 @@
1
1
  # use-typed-reducer
2
2
 
3
- Another way to use [useReducer](https://reactjs.org/docs/hooks-reference.html#usereducer) hook, with strongly type rules defined by you
3
+ Another way to use [useReducer](https://reactjs.org/docs/hooks-reference.html#usereducer) hook, with strongly type rules defined by you.
4
4
 
5
- ## Install
5
+ **Now you can control your local state or global state using the same API**. Check the [createGlobalReducer](#createglobalreducer) for global state.
6
+
7
+ <!-- TOC -->
8
+ * [use-typed-reducer](#use-typed-reducer)
9
+ * [Install](#install)
10
+ * [Why use *use-typed-reducer*](#why-use-use-typed-reducer)
11
+ * [Using](#using)
12
+ * [useReducer (default import) or `useTypedReducer`](#usereducer-default-import-or-usetypedreducer)
13
+ * [useReducerWithProps](#usereducerwithprops)
14
+ * [useReducer](#usereducer)
15
+ * [createGlobalReducer](#createglobalreducer)
16
+ <!-- TOC -->
17
+
18
+ # Install
6
19
 
7
20
  With npm:
8
21
  ```bash
@@ -14,15 +27,15 @@ With yarn:
14
27
  yarn add use-typed-reducer
15
28
  ```
16
29
 
17
- ## Why use *use-typed-reducer*
30
+ # Why use *use-typed-reducer*
18
31
 
19
32
  The original useReducer forces you to use the well-known redux pattern. We need to pass the parameters in an object and a mandatory "type" to identify the action being performed.
20
33
 
21
34
  With useTypedReducer, you can use your function the way you prefer, it will infer the parameters and return a new function with the current state so that you can make the changes you want to the new state
22
35
 
23
- ## Using
36
+ # Using
24
37
 
25
- ### useReducer (default import) or `useTypedReducer`
38
+ ## useReducer (default import) or `useTypedReducer`
26
39
 
27
40
  `useTypedReducer` receive the initialState and dictionary/object with all reducers and return tuple with state and dispatch. Dispatch has the same key and functions of given dictionary in `useTypedReducer`, but return a new function to update state. This void `dispatch({ type: "ACTION" })`
28
41
 
@@ -66,7 +79,7 @@ const Component = () => {
66
79
  ```
67
80
 
68
81
 
69
- ### useReducerWithProps
82
+ ## useReducerWithProps
70
83
 
71
84
  The same of useTypedReducer, but receive a `getProps` as second argument in the second function.
72
85
 
@@ -114,7 +127,7 @@ const Component = (props: Props) => {
114
127
  };
115
128
  ```
116
129
 
117
- ## useReducer
130
+ # useReducer
118
131
 
119
132
  This is the new way to control your state, but with the old way of use-typed-reducer. Now you have a function to getState and a function to get the props. With this you can avoid to take a function that return a function to update state.
120
133
 
@@ -127,7 +140,7 @@ export const useMath = () => {
127
140
  };
128
141
  ```
129
142
 
130
- ## createGlobalReducer
143
+ # createGlobalReducer
131
144
 
132
145
  If you need a way to create a global state, you can use this function. This enables you to create a global state without a Context provider. The API is the same API of `useReducer`, but returns a hook to use the global context.
133
146
 
package/dist/index.cjs ADDED
@@ -0,0 +1,34 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("react");var K={exports:{}},I={},D={exports:{}},W={};/**
2
+ * @license React
3
+ * use-sync-external-store-shim.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var q;function Z(){if(q)return W;q=1;var e=T;function t(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var v=typeof Object.is=="function"?Object.is:t,_=e.useState,S=e.useEffect,d=e.useLayoutEffect,E=e.useDebugValue;function L(r,o){var i=o(),u=_({inst:{value:i,getSnapshot:o}}),s=u[0].inst,l=u[1];return d(function(){s.value=i,s.getSnapshot=o,y(s)&&l({inst:s})},[r,i,o]),S(function(){return y(s)&&l({inst:s}),r(function(){y(s)&&l({inst:s})})},[r]),E(i),i}function y(r){var o=r.getSnapshot;r=r.value;try{var i=o();return!v(r,i)}catch{return!0}}function p(r,o){return o()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:L;return W.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,W}var B={};/**
10
+ * @license React
11
+ * use-sync-external-store-shim.development.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var P;function ee(){return P||(P=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=T,t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(c){{for(var n=arguments.length,O=new Array(n>1?n-1:0),a=1;a<n;a++)O[a-1]=arguments[a];_("error",c,O)}}function _(c,n,O){{var a=t.ReactDebugCurrentFrame,h=a.getStackAddendum();h!==""&&(n+="%s",O=O.concat([h]));var A=O.map(function(w){return String(w)});A.unshift("Warning: "+n),Function.prototype.apply.call(console[c],console,A)}}function S(c,n){return c===n&&(c!==0||1/c===1/n)||c!==c&&n!==n}var d=typeof Object.is=="function"?Object.is:S,E=e.useState,L=e.useEffect,y=e.useLayoutEffect,p=e.useDebugValue,f=!1,r=!1;function o(c,n,O){f||e.startTransition!==void 0&&(f=!0,v("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."));var a=n();if(!r){var h=n();d(a,h)||(v("The result of getSnapshot should be cached to avoid an infinite loop"),r=!0)}var A=E({inst:{value:a,getSnapshot:n}}),w=A[0].inst,V=A[1];return y(function(){w.value=a,w.getSnapshot=n,i(w)&&V({inst:w})},[c,a,n]),L(function(){i(w)&&V({inst:w});var x=function(){i(w)&&V({inst:w})};return c(x)},[c]),p(a),a}function i(c){var n=c.getSnapshot,O=c.value;try{var a=n();return!d(O,a)}catch{return!0}}function u(c,n,O){return n()}var s=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",l=!s,m=l?u:o,R=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m;B.useSyncExternalStore=R,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),B}var U;function F(){return U||(U=1,process.env.NODE_ENV==="production"?D.exports=Z():D.exports=ee()),D.exports}/**
18
+ * @license React
19
+ * use-sync-external-store-shim/with-selector.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var k;function te(){if(k)return I;k=1;var e=T,t=F();function v(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var _=typeof Object.is=="function"?Object.is:v,S=t.useSyncExternalStore,d=e.useRef,E=e.useEffect,L=e.useMemo,y=e.useDebugValue;return I.useSyncExternalStoreWithSelector=function(p,f,r,o,i){var u=d(null);if(u.current===null){var s={hasValue:!1,value:null};u.current=s}else s=u.current;u=L(function(){function m(a){if(!R){if(R=!0,c=a,a=o(a),i!==void 0&&s.hasValue){var h=s.value;if(i(h,a))return n=h}return n=a}if(h=n,_(c,a))return h;var A=o(a);return i!==void 0&&i(h,A)?h:(c=a,n=A)}var R=!1,c,n,O=r===void 0?null:r;return[function(){return m(f())},O===null?void 0:function(){return m(O())}]},[f,r,o,i]);var l=S(p,u[0],u[1]);return E(function(){s.hasValue=!0,s.value=l},[l]),y(l),l},I}var H={};/**
26
+ * @license React
27
+ * use-sync-external-store-shim/with-selector.development.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var $;function re(){return $||($=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=T,t=F();function v(f,r){return f===r&&(f!==0||1/f===1/r)||f!==f&&r!==r}var _=typeof Object.is=="function"?Object.is:v,S=t.useSyncExternalStore,d=e.useRef,E=e.useEffect,L=e.useMemo,y=e.useDebugValue;function p(f,r,o,i,u){var s=d(null),l;s.current===null?(l={hasValue:!1,value:null},s.current=l):l=s.current;var m=L(function(){var O=!1,a,h,A=function(b){if(!O){O=!0,a=b;var M=i(b);if(u!==void 0&&l.hasValue){var j=l.value;if(u(j,M))return h=j,j}return h=M,M}var X=a,C=h;if(_(X,b))return C;var G=i(b);return u!==void 0&&u(C,G)?C:(a=b,h=G,G)},w=o===void 0?null:o,V=function(){return A(r())},x=w===null?void 0:function(){return A(w())};return[V,x]},[r,o,i,u]),R=m[0],c=m[1],n=S(f,R,c);return E(function(){l.hasValue=!0,l.value=n},[n]),y(n),n}H.useSyncExternalStoreWithSelector=p,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),H}process.env.NODE_ENV==="production"?K.exports=te():K.exports=re();var ne=K.exports;const z=e=>{const t=typeof e;return t==="string"||t==="number"||t==="bigint"||t==="boolean"||t==="undefined"||t===null},ue=(e,t)=>{if(e===t||Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t)&&e.length!==t.length)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();const v=Object.keys(e);if(length=v.length,length!==Object.keys(t).length)return!1;let _=length;for(;_--!==0;)if(!Object.prototype.hasOwnProperty.call(t,v[_]))return!1;_=length;for(let S=length;S--!==0;){const d=v[S];if(!(z(e[d])&&z(t[d])&&t[d]===e[d]))return!1}return!0}return e!==e&&t!==t},N=e=>Object.entries(e),Y=e=>e instanceof Promise,J=(e,t,v)=>{const[_,S]=T.useState(e),d=g(v??{}),E=T.useCallback(()=>d.current,[d]),L=T.useMemo(()=>N(t).reduce((y,[p,f])=>({...y,[p]:async(...r)=>{const o=await f(...r);return S(i=>o(i,E()))}}),t),[t,E]);return[_,L]},g=e=>{const t=T.useRef(e??{});return T.useEffect(()=>void(t.current=e),[e]),t},oe=(e,t)=>typeof t=="function"?t(e):t,Q=(e,t,v,_)=>v.reduce((S,d)=>d(S,_),{...t,...e}),se=(e,t,v,_)=>{const[S,d]=T.useState(()=>e),E=g(S),L=g(v??{}),y=g(t),p=g(_??[]),f=T.useRef(e),r=T.useMemo(()=>{const o=y.current({state:()=>E.current,props:()=>L.current,initialState:f.current});return N(o).reduce((i,[u,s])=>({...i,[u]:(...l)=>{const m=s(...l),R=c=>d(n=>Q(c,n,p.current,u));return Y(m)?void m.then(R):R(m)}}),{})},[L,y,E]);return[S,r]},ce=()=>e=>e,ae=(e,t,v,_)=>{let S=e;const d=()=>S,E=new Set,L=u=>(E.add(u),()=>E.delete(u)),y=u=>{const s={...S},l=u(S);S=l,E.forEach(m=>m(l,s))},f={state:d,props:()=>v||{},initialState:e},r=_||[],o=N(t(f)).reduce((u,[s,l])=>({...u,[s]:(...m)=>{const R=l(...m),c=n=>y(O=>Q(n,O,r,s));return Y(R)?R.then(c):c(R)}}),{}),i=u=>u;return Object.assign(function(s,l=ue){return[ne.useSyncExternalStoreWithSelector(L,d,d,s||i,l),o]},{dispatchers:o})};exports.createGlobalReducer=ae;exports.createReducer=ce;exports.default=J;exports.dispatchCallback=oe;exports.useMutable=g;exports.useReducer=se;exports.useTypedReducer=J;
34
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +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/shallow-compare.ts","../src/index.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","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","import { MutableRefObject, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useSyncExternalStoreWithSelector } from \"use-sync-external-store/shim/with-selector\";\nimport { shallowCompare } from \"./shallow-compare\";\n\ntype Listener<State> = (state: State, previous: State) => void;\n\ntype PromiseBox<T> = T | Promise<T>;\n\ntype VoidFn<Fn extends (...any: any[]) => any> = ReturnType<Fn> extends Promise<any>\n ? (...a: Parameters<Fn>) => Promise<void>\n : (...a: Parameters<Fn>) => void;\n\ntype Action<State, Props> = (...args: any) => PromiseBox<(state: State, Props: Props) => State>;\n\nexport type Dispatch<State, Props extends {}, Fns extends { [key in keyof Fns]: Action<State, Props> }> = {\n [R in keyof Fns]: (...args: any[]) => PromiseBox<(state: State, Props: Props) => State>;\n};\n\ntype MapArray<T, F> = { [K in keyof T]: [K, F] };\n\ntype MapReducers<State extends {}, Props extends {}, Reducers extends Dispatch<State, Props, Reducers>> = {\n [R in keyof Reducers]: VoidFn<Reducers[R]>;\n};\n\ntype ReducerArgs<State extends {}, Props extends object> = {\n state: () => State;\n props: () => Props;\n initialState: State;\n};\n\ntype FnMap<State> = { [k: string]: (...args: any[]) => PromiseBox<Partial<State>> };\n\ntype MappedReducers<State extends {}, Fns extends FnMap<State>> = {\n [F in keyof Fns]: (...args: Parameters<Fns[F]>) => PromiseBox<Partial<State>>;\n};\n\ntype MapReducerReturn<State extends {}, Fns extends FnMap<State>> = { [F in keyof Fns]: VoidFn<Fns[F]> };\n\ntype UseReducerReduce<State extends object, Props extends object> = (\n args: ReducerArgs<State, Props>\n) => MappedReducers<State, FnMap<State>>;\n\ntype UseReducer<\n Selector,\n State extends {},\n Props extends {},\n Reducers extends UseReducerReduce<State, Props>\n> = readonly [state: Selector, dispatchers: MapReducerReturn<State, ReturnType<Reducers>>];\n\ntype ReducerMiddleware<\n State extends object,\n Props extends object,\n Reducers extends (args: ReducerArgs<State, Props>) => MappedReducers<State, FnMap<State>>\n> = Array<(state: State, key: keyof ReturnType<Reducers>) => State>;\n\ntype Callback<T> = T | ((prev: T) => T);\n\nconst entries = <T extends {}, F>(t: T): MapArray<T[], F> => Object.entries(t) as any;\n\nconst isPromise = <T>(promise: any): promise is Promise<T> => promise instanceof Promise;\n\nexport const useTypedReducer = <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\nexport const useMutable = <T extends {}>(state: T): MutableRefObject<T> => {\n const mutable = useRef(state ?? {});\n useEffect(() => void (mutable.current = state), [state]);\n return mutable;\n};\n\nexport const dispatchCallback = <Prev extends any, T extends Callback<Prev>>(prev: Prev, setter: T) =>\n typeof setter === \"function\" ? setter(prev) : setter;\n\nexport type DispatchCallback<T extends any> = Callback<T>;\n\nconst reduceMiddleware = <State extends {}, Middlewares extends Array<(state: State, key: string) => State>>(\n state: State,\n prev: State,\n middleware: Middlewares,\n key: string\n) => middleware.reduce<State>((acc, fn) => fn(acc, key), { ...prev, ...state });\n\nexport const useReducer = <\n State extends {},\n Reducers extends UseReducerReduce<State, Props>,\n Props extends object,\n Middlewares extends ReducerMiddleware<State, Props, Reducers>\n>(\n initialState: State,\n reducer: Reducers,\n props?: Props,\n middlewares?: Middlewares\n): UseReducer<State, State, Props, Reducers> => {\n const [state, setState] = useState<State>(() => initialState);\n const mutableState = useMutable(state);\n const mutableProps = useMutable(props ?? ({} as Props));\n const mutableReducer = useMutable(reducer);\n const middleware = useMutable<Middlewares>(middlewares ?? ([] as unknown as Middlewares));\n const savedInitialState = useRef(initialState);\n\n const dispatchers = useMemo<MapReducerReturn<State, ReturnType<Reducers>>>(() => {\n const reducers = mutableReducer.current({\n state: () => mutableState.current,\n props: () => mutableProps.current,\n initialState: savedInitialState.current\n });\n\n return entries<string, any>(reducers as any).reduce(\n (acc, [name, dispatch]: any) => ({\n ...acc,\n [name]: (...params: any[]) => {\n const result = dispatch(...params);\n const set = (newState: State) =>\n setState((prev) => reduceMiddleware(newState, prev, middleware.current, name));\n return isPromise<State>(result) ? void result.then(set) : set(result);\n }\n }),\n {} as MapReducerReturn<State, ReturnType<Reducers>>\n );\n }, [mutableProps, mutableReducer, mutableState]);\n return [state, dispatchers] as const;\n};\n\nexport const createReducer =\n <State extends {} = {}, Props extends object = {}>() =>\n <Reducer extends (args: ReducerArgs<State, Props>) => MappedReducers<State, FnMap<State>>>(reducer: Reducer) =>\n reducer;\n\nexport const createGlobalReducer = <\n State extends {},\n Reducers extends UseReducerReduce<State, Props>,\n Props extends object,\n Middlewares extends ReducerMiddleware<State, Props, Reducers>\n>(\n initialState: State,\n reducer: Reducers,\n props?: Props,\n middlewares?: Middlewares\n): (<Selector extends (state: State) => any>(\n selector?: Selector,\n comparator?: (a: any, b: any) => boolean\n) => UseReducer<Selector extends (state: State) => State ? State : ReturnType<Selector>, State, Props, Reducers>) & {\n dispatchers: MapReducerReturn<State, ReturnType<Reducers>>;\n} => {\n let state = initialState;\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 getProps = () => (props as Props) || ({} as Props);\n const args = { state: getSnapshot, props: getProps, initialState };\n const middlewareList: Middlewares = middlewares || ([] as unknown as Middlewares);\n const dispatchers: MapReducerReturn<State, ReturnType<Reducers>> = entries(reducer(args)).reduce<any>(\n (acc, [name, fn]: any) => ({\n ...acc,\n [name]: (...args: any[]) => {\n const result = fn(...args);\n const set = (newState: State) =>\n setState((prev) => reduceMiddleware(newState, prev, middlewareList, name));\n return isPromise<State>(result) ? result.then(set) : set(result);\n }\n }),\n {}\n );\n\n const defaultSelector = (state: State) => state;\n\n return Object.assign(\n function useStore<Selector extends (state: State) => any>(selector?: Selector, comparator = shallowCompare) {\n const state = useSyncExternalStoreWithSelector(\n addListener,\n getSnapshot,\n getSnapshot,\n selector || defaultSelector,\n comparator\n );\n return [state, dispatchers] as const;\n },\n { dispatchers }\n );\n};\n\nexport default useTypedReducer;\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","isPrimitive","type","shallowCompare","left","right","keys","i","key","entries","isPromise","promise","useTypedReducer","initialState","reducers","props","state","setState","refProps","useMutable","getProps","useCallback","dispatches","acc","name","dispatch","params","dispatcher","previousState","mutable","dispatchCallback","prev","setter","reduceMiddleware","middleware","fn","useReducer","reducer","middlewares","mutableState","mutableProps","mutableReducer","savedInitialState","dispatchers","result","set","newState","createReducer","createGlobalReducer","listeners","addListener","listener","callback","exec","middlewareList","defaultSelector","comparator"],"mappings":";;;;;;;;wCASa,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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AAO,OAAO,OACV,SAA0DpC,EAAqB4E,EAAarD,GAAgB,CAQjG,MAAA,CAPOxB,GAAA,iCACVuE,EACAjG,EACAA,EACA2B,GAAY2E,EACZC,CAAA,EAEWb,CAAW,CAC9B,EACA,CAAE,YAAAA,CAAY,CAAA,CAEtB","x_google_ignoreList":[0,1,2,3,4,5]}
package/dist/index.d.ts CHANGED
@@ -1,38 +1,41 @@
1
- import { MutableRefObject } from "react";
2
- declare type PromiseBox<T> = T | Promise<T>;
3
- declare type VoidFn<Fn extends (...any: any[]) => any> = ReturnType<Fn> extends Promise<any> ? (...a: Parameters<Fn>) => Promise<void> : (...a: Parameters<Fn>) => void;
4
- declare type Action<State> = (...args: any) => PromiseBox<(state: State) => State>;
5
- export declare type Dispatch<State, Fns extends {
6
- [key in keyof Fns]: Action<State>;
7
- }> = {
8
- [R in keyof Fns]: (...args: any[]) => PromiseBox<(state: State) => State>;
9
- };
10
- declare type MapReducers<State extends {}, Reducers extends Dispatch<State, Reducers>> = {
11
- [R in keyof Reducers]: VoidFn<Reducers[R]>;
12
- };
13
- declare type ReducerArgs<State extends {}, Props extends object> = {
14
- state: () => State;
15
- props: () => Props;
16
- initialState: State;
17
- };
18
- declare type FnMap<State> = {
19
- [k: string]: (...args: any[]) => PromiseBox<Partial<State>>;
20
- };
21
- declare type MappedReducers<State extends {}, Fns extends FnMap<State>> = {
22
- [F in keyof Fns]: (...args: Parameters<Fns[F]>) => PromiseBox<Partial<State>>;
23
- };
24
- declare type MapReducerReturn<State extends {}, Fns extends FnMap<State>> = {
25
- [F in keyof Fns]: VoidFn<Fns[F]>;
26
- };
27
- declare type UseReducerReduce<State extends object, Props extends object> = (args: ReducerArgs<State, Props>) => MappedReducers<State, FnMap<State>>;
28
- declare type UseReducer<Selector, State extends {}, Props extends {}, Reducers extends UseReducerReduce<State, Props>> = readonly [state: Selector, dispatchers: MapReducerReturn<State, ReturnType<Reducers>>];
29
- declare type ReducerMiddleware<State extends object, Props extends object, Reducers extends (args: ReducerArgs<State, Props>) => MappedReducers<State, FnMap<State>>> = Array<(state: State, key: keyof ReturnType<Reducers>) => State>;
30
- declare type Callback<T> = T | ((prev: T) => T);
31
- export declare const useTypedReducer: <State extends {}, Reducers extends Dispatch<State, Reducers>>(initialState: State, reducers: Reducers) => [state: State, dispatch: MapReducers<State, Reducers>];
32
- export declare const useMutable: <T extends {}>(state: T) => MutableRefObject<T>;
33
- export declare const dispatchCallback: <Prev extends unknown, T extends Callback<Prev>>(prev: Prev, setter: T) => any;
34
- export declare type DispatchCallback<T extends any> = Callback<T>;
35
- export declare const useReducer: <State extends {}, Reducers extends UseReducerReduce<State, Props>, Props extends object, Middlewares extends ReducerMiddleware<State, Props, Reducers>>(initialState: State, reducer: Reducers, props?: Props | undefined, middlewares?: Middlewares | undefined) => UseReducer<State, State, Props, Reducers>;
36
- export declare const createReducer: <State extends {} = {}, Props extends object = {}>() => <Reducer extends (args: ReducerArgs<State, Props>) => MappedReducers<State, FnMap<State>>>(reducer: Reducer) => Reducer;
37
- export declare const createGlobalReducer: <State extends {}, Reducers extends UseReducerReduce<State, Props>, Props extends object, Middlewares extends ReducerMiddleware<State, Props, Reducers>>(initialState: State, reducer: Reducers, props?: Props | undefined, middlewares?: Middlewares | undefined) => <Selector extends (state: State) => any>(selector?: Selector | undefined) => UseReducer<Selector extends (state: State) => State ? State : ReturnType<Selector>, State, Props, Reducers>;
38
- export default useTypedReducer;
1
+ import { MutableRefObject } from "react";
2
+ type PromiseBox<T> = T | Promise<T>;
3
+ type VoidFn<Fn extends (...any: any[]) => any> = ReturnType<Fn> extends Promise<any> ? (...a: Parameters<Fn>) => Promise<void> : (...a: Parameters<Fn>) => void;
4
+ type Action<State, Props> = (...args: any) => PromiseBox<(state: State, Props: Props) => State>;
5
+ export type Dispatch<State, Props extends {}, Fns extends {
6
+ [key in keyof Fns]: Action<State, Props>;
7
+ }> = {
8
+ [R in keyof Fns]: (...args: any[]) => PromiseBox<(state: State, Props: Props) => State>;
9
+ };
10
+ type MapReducers<State extends {}, Props extends {}, Reducers extends Dispatch<State, Props, Reducers>> = {
11
+ [R in keyof Reducers]: VoidFn<Reducers[R]>;
12
+ };
13
+ type ReducerArgs<State extends {}, Props extends object> = {
14
+ state: () => State;
15
+ props: () => Props;
16
+ initialState: State;
17
+ };
18
+ type FnMap<State> = {
19
+ [k: string]: (...args: any[]) => PromiseBox<Partial<State>>;
20
+ };
21
+ type MappedReducers<State extends {}, Fns extends FnMap<State>> = {
22
+ [F in keyof Fns]: (...args: Parameters<Fns[F]>) => PromiseBox<Partial<State>>;
23
+ };
24
+ type MapReducerReturn<State extends {}, Fns extends FnMap<State>> = {
25
+ [F in keyof Fns]: VoidFn<Fns[F]>;
26
+ };
27
+ type UseReducerReduce<State extends object, Props extends object> = (args: ReducerArgs<State, Props>) => MappedReducers<State, FnMap<State>>;
28
+ type UseReducer<Selector, State extends {}, Props extends {}, Reducers extends UseReducerReduce<State, Props>> = readonly [state: Selector, dispatchers: MapReducerReturn<State, ReturnType<Reducers>>];
29
+ type ReducerMiddleware<State extends object, Props extends object, Reducers extends (args: ReducerArgs<State, Props>) => MappedReducers<State, FnMap<State>>> = Array<(state: State, key: keyof ReturnType<Reducers>) => State>;
30
+ type Callback<T> = T | ((prev: T) => T);
31
+ export declare const useTypedReducer: <State extends {}, Reducers extends Dispatch<State, Props, Reducers>, Props extends {}>(initialState: State, reducers: Reducers, props?: Props | undefined) => [state: State, dispatch: MapReducers<State, Props, Reducers>];
32
+ export declare const useMutable: <T extends {}>(state: T) => MutableRefObject<T>;
33
+ export declare const dispatchCallback: <Prev extends unknown, T extends Callback<Prev>>(prev: Prev, setter: T) => any;
34
+ export type DispatchCallback<T extends any> = Callback<T>;
35
+ export declare const useReducer: <State extends {}, Reducers extends UseReducerReduce<State, Props>, Props extends object, Middlewares extends ReducerMiddleware<State, Props, Reducers>>(initialState: State, reducer: Reducers, props?: Props | undefined, middlewares?: Middlewares | undefined) => UseReducer<State, State, Props, Reducers>;
36
+ export declare const createReducer: <State extends {} = {}, Props extends object = {}>() => <Reducer extends (args: ReducerArgs<State, Props>) => MappedReducers<State, FnMap<State>>>(reducer: Reducer) => Reducer;
37
+ export declare const createGlobalReducer: <State extends {}, Reducers extends UseReducerReduce<State, Props>, Props extends object, Middlewares extends ReducerMiddleware<State, Props, Reducers>>(initialState: State, reducer: Reducers, props?: Props | undefined, middlewares?: Middlewares | undefined) => (<Selector extends (state: State) => any>(selector?: Selector | undefined, comparator?: ((a: any, b: any) => boolean) | undefined) => UseReducer<Selector extends (state: State) => State ? State : ReturnType<Selector>, State, Props, Reducers>) & {
38
+ dispatchers: MapReducerReturn<State, ReturnType<Reducers>>;
39
+ };
40
+ export default useTypedReducer;
41
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAqD,MAAM,OAAO,CAAC;AAM5F,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEpC,KAAK,MAAM,CAAC,EAAE,SAAS,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAC9E,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GACvC,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;AAErC,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,UAAU,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,KAAK,KAAK,CAAC,CAAC;AAEhG,MAAM,MAAM,QAAQ,CAAC,KAAK,EAAE,KAAK,SAAS,EAAE,EAAE,GAAG,SAA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