reaxify 0.0.13 → 0.0.14

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.
@@ -1 +1 @@
1
- "use strict";const v=require("../components/Form/index.cjs.js"),o=require("../helpers/randomID.cjs.js"),s=require("react");function x({rules:c}){const{setFormControl:e,removeFormControl:u}=s.useContext(v.FormContext),[b,i]=s.useState(!1),[g,a]=s.useState(null),f=s.useCallback(t=>{const r=t.id,n=t.value;if(!c.length){e==null||e(r,()=>!0),a(null),i(!1);return}for(const p of c){const l=p(n);if(typeof l=="string"){e==null||e(r,()=>(i(!0),!1)),a(l),i(!0);return}}e==null||e(r,()=>!0),a(null),i(!1)},[c,e]);return{ref:s.useCallback(t=>{if(!t)return;t.id||(t.id=o());const r=t.id;f(t);const n=new MutationObserver(()=>f(t));return n.observe(t,{attributes:!0,childList:!0,subtree:!0}),()=>{n.disconnect(),u==null||u(r)}},[f,u]),error:b,errorMessage:g}}module.exports=x;
1
+ "use strict";const v=require("../components/Form/index.cjs.js"),o=require("../helpers/randomID.cjs.js"),s=require("react");function x({rules:n}){const{setFormControl:e,removeFormControl:u}=s.useContext(v.FormContext),[b,c]=s.useState(!1),[g,a]=s.useState(null),f=s.useCallback(t=>{const r=t.id,i=t.value;if(!n.length){e==null||e(r,()=>!0),a(null),c(!1);return}for(const p of n){const l=p(i);if(typeof l=="string"){e==null||e(r,()=>(c(!0),!1)),a(l);return}}e==null||e(r,()=>!0),a(null),c(!1)},[n,e]);return{ref:s.useCallback(t=>{if(!t)return;t.id||(t.id=o());const r=t.id;f(t);const i=new MutationObserver(()=>f(t));return i.observe(t,{attributes:!0,childList:!0,subtree:!0}),()=>{i.disconnect(),u==null||u(r)}},[f,u]),error:b,errorMessage:g}}module.exports=x;
@@ -1,24 +1,24 @@
1
1
  import { FormContext as v } from "../components/Form/index.es.js";
2
2
  import x from "../helpers/randomID.es.js";
3
3
  import { useContext as M, useState as l, useCallback as p } from "react";
4
- function d({ rules: n }) {
5
- const { setFormControl: r, removeFormControl: s } = M(v), [o, u] = l(!1), [b, a] = l(null), f = p(
4
+ function d({ rules: i }) {
5
+ const { setFormControl: r, removeFormControl: s } = M(v), [o, n] = l(!1), [b, a] = l(null), f = p(
6
6
  (t) => {
7
- const e = t.id, i = t.value;
8
- if (!n.length) {
9
- r == null || r(e, () => !0), a(null), u(!1);
7
+ const e = t.id, u = t.value;
8
+ if (!i.length) {
9
+ r == null || r(e, () => !0), a(null), n(!1);
10
10
  return;
11
11
  }
12
- for (const g of n) {
13
- const c = g(i);
12
+ for (const g of i) {
13
+ const c = g(u);
14
14
  if (typeof c == "string") {
15
- r == null || r(e, () => (u(!0), !1)), a(c), u(!0);
15
+ r == null || r(e, () => (n(!0), !1)), a(c);
16
16
  return;
17
17
  }
18
18
  }
19
- r == null || r(e, () => !0), a(null), u(!1);
19
+ r == null || r(e, () => !0), a(null), n(!1);
20
20
  },
21
- [n, r]
21
+ [i, r]
22
22
  );
23
23
  return { ref: p(
24
24
  (t) => {
@@ -26,13 +26,13 @@ function d({ rules: n }) {
26
26
  t.id || (t.id = x());
27
27
  const e = t.id;
28
28
  f(t);
29
- const i = new MutationObserver(() => f(t));
30
- return i.observe(t, {
29
+ const u = new MutationObserver(() => f(t));
30
+ return u.observe(t, {
31
31
  attributes: !0,
32
32
  childList: !0,
33
33
  subtree: !0
34
34
  }), () => {
35
- i.disconnect(), s == null || s(e);
35
+ u.disconnect(), s == null || s(e);
36
36
  };
37
37
  },
38
38
  [f, s]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reaxify",
3
3
  "private": false,
4
- "version": "0.0.13",
4
+ "version": "0.0.14",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "files": [