reaxes-react 0.1.0 → 0.1.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/changelog.md CHANGED
@@ -1,3 +1,29 @@
1
+ # 0.1.2
2
+ - fixed types of useReaxable , for reaxes@1.4.0 compatibility
3
+ ```ts
4
+ const {
5
+ store ,
6
+ setState ,
7
+ mutate ,
8
+ } = useReaxable( {
9
+ user : {
10
+ name : 'jack' ,
11
+ age : 18 ,
12
+ } ,
13
+ } );
14
+ //easy to set nested state
15
+ setState.user({
16
+ age : 20 ,
17
+ });
18
+ //or
19
+ mutate.user( user => {
20
+ user.age = 21 ;
21
+ });
22
+ ```
23
+
24
+ # 0.1.1
25
+ * 修复types和hooks type
26
+
1
27
  # 0.1.0
2
28
  * 新增`useReaxable` hook
3
29
 
package/esm/hooks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"esm/hooks.js","mappings":"iDACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,I,sBCIlF,MAAM,EAJE,CAACI,IACR,IAAIC,EAAI,CAAC,EAAgC,OAA7Bf,EAAoBgB,EAAED,EAAGD,GAAWC,GAGZA,CAAE,CAAE,eAAoB,IAAOE,EAAiD,iBCArH,MAAM,EAJE,CAACH,IACR,IAAIC,EAAI,CAAC,EAAgC,OAA7Bf,EAAoBgB,EAAED,EAAGD,GAAWC,GAGZ,CAAE,CAAE,OAAY,IAAOG,EAAwC,SCJ7F,IAAMC,EAAc,SAAEC,GAAK,OAAMC,EAAAA,EAAAA,SAAQC,EAAAA,EAAAA,gBAAgBF,IAAUG,OAAO,E","sources":["webpack://mono-reaxes/webpack/bootstrap","webpack://mono-reaxes/webpack/runtime/define property getters","webpack://mono-reaxes/webpack/runtime/hasOwnProperty shorthand","webpack://mono-reaxes/external module \"reaxes\"","webpack://mono-reaxes/external module \"react\"","webpack://mono-reaxes/./packages/reaxes-react/src/hooks/useReaxable.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","var x = (y) => {\n\tvar x = {}; __webpack_require__.d(x, y); return x\n} \nvar y = (x) => (() => (x))\nconst __WEBPACK_NAMESPACE_OBJECT__ = x({ [\"createReaxable\"]: () => (__WEBPACK_EXTERNAL_MODULE_reaxes__.createReaxable) });","var x = (y) => {\n\tvar x = {}; __webpack_require__.d(x, y); return x\n} \nvar y = (x) => (() => (x))\nconst __WEBPACK_NAMESPACE_OBJECT__ = x({ [\"useRef\"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useRef) });","export const useReaxable = ( state ) => useRef( createReaxable( state ) ).current;\n\nimport { createReaxable } from 'reaxes';\nimport { useRef } from 'react';\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","y","x","d","__WEBPACK_EXTERNAL_MODULE_reaxes__","__WEBPACK_EXTERNAL_MODULE_react__","useReaxable","state","useRef","createReaxable","current"],"sourceRoot":""}
1
+ {"version":3,"file":"esm/hooks.js","mappings":"iDACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,I,sBCIlF,MAAM,EAJE,CAACI,IACR,IAAIC,EAAI,CAAC,EAAgC,OAA7Bf,EAAoBgB,EAAED,EAAGD,GAAWC,GAGZA,CAAE,CAAE,eAAoB,IAAOE,EAAiD,iBCArH,MAAM,EAJE,CAACH,IACR,IAAIC,EAAI,CAAC,EAAgC,OAA7Bf,EAAoBgB,EAAED,EAAGD,GAAWC,GAGZ,CAAE,CAAE,OAAY,IAAOG,EAAwC,SCH7F,IAAMC,EAAc,SAAoBC,GAAS,OAAMC,EAAAA,EAAAA,SAASC,EAAAA,EAAAA,gBAAmCF,IAAUG,OAAO,E","sources":["webpack://mono-reaxes/webpack/bootstrap","webpack://mono-reaxes/webpack/runtime/define property getters","webpack://mono-reaxes/webpack/runtime/hasOwnProperty shorthand","webpack://mono-reaxes/external module \"reaxes\"","webpack://mono-reaxes/external module \"react\"","webpack://mono-reaxes/./packages/reaxes-react/src/hooks/useReaxable.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","var x = (y) => {\n\tvar x = {}; __webpack_require__.d(x, y); return x\n} \nvar y = (x) => (() => (x))\nconst __WEBPACK_NAMESPACE_OBJECT__ = x({ [\"createReaxable\"]: () => (__WEBPACK_EXTERNAL_MODULE_reaxes__.createReaxable) });","var x = (y) => {\n\tvar x = {}; __webpack_require__.d(x, y); return x\n} \nvar y = (x) => (() => (x))\nconst __WEBPACK_NAMESPACE_OBJECT__ = x({ [\"useRef\"]: () => (__WEBPACK_EXTERNAL_MODULE_react__.useRef) });","\nexport const useReaxable = <S extends object>( state : S ) => useRef( (createReaxable as CreateReaxable)( state ) ).current;\n\nimport { createReaxable , type CreateReaxable} from 'reaxes';\nimport type {NestedMutate,NestedSetState,ResurivePartial} from 'reaxes';\nimport { useRef } from 'react';\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","y","x","d","__WEBPACK_EXTERNAL_MODULE_reaxes__","__WEBPACK_EXTERNAL_MODULE_react__","useReaxable","state","useRef","createReaxable","current"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,20 +1,34 @@
1
1
  {
2
2
  "name": "reaxes-react",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Combine React with Reaxes, automatically re-render React components when the data in the store changes.",
5
- "main": "esm/index.js",
6
- "module": "esm/index.js",
7
- "types": "types/index.d.ts",
8
5
  "author": "Kane",
9
6
  "license": "WTFPL",
7
+ "types": "./types/index.d.ts",
8
+ "typesVersions": {
9
+ "*": {
10
+ "index.d.ts": [
11
+ "types/index.d.ts"
12
+ ],
13
+ "hooks": [
14
+ "types/hooks/index.d.ts"
15
+ ]
16
+ }
17
+ },
10
18
  "exports": {
11
19
  ".": {
12
20
  "import": "./esm/index.js",
13
- "require": "./esm/index.js"
21
+ "require": "./esm/index.js",
22
+ "types": {
23
+ "default": "./types/index.d.ts"
24
+ }
14
25
  },
15
26
  "./hooks": {
16
27
  "import": "./esm/hooks.js",
17
- "require": "./esm/hooks.js"
28
+ "require": "./esm/hooks.js",
29
+ "types": {
30
+ "default": "./types/hooks/index.d.ts"
31
+ }
18
32
  }
19
33
  },
20
34
  "dependencies": {
@@ -1,6 +1,7 @@
1
- export declare const useReaxable: (state: any) => {
2
- store: any;
3
- mutate: <T extends (store: any) => void>(callback: T) => any;
4
- setState: (partialState: Partial<any>) => any;
5
- mergeState: (partialState: Partial<any>) => any;
1
+ export declare const useReaxable: <S extends object>(state: S) => {
2
+ store: S;
3
+ mutate: NestedMutate<S>;
4
+ setState: NestedSetState<S>;
5
+ merge: (partialState: ResurivePartial<S>) => S;
6
6
  };
7
+ import type { NestedMutate, NestedSetState, ResurivePartial } from 'reaxes';