@tinacms/react-core
Advanced tools
Comparing version 0.2.1-alpha.0 to 0.2.1-canary.2
@@ -113,11 +113,7 @@ 'use strict'; | ||
} | ||
/* eslint-disable-next-line react-hooks/rules-of-hooks */ | ||
var _useForm = useForm(options, watch), | ||
values = _useForm[0], | ||
form = _useForm[1]; | ||
/* eslint-disable-next-line react-hooks/rules-of-hooks */ | ||
usePlugins(form); | ||
@@ -124,0 +120,0 @@ return [values, form]; |
@@ -1,2 +0,2 @@ | ||
"use strict";var e=require("react"),n=require("@tinacms/core"),t="useCMS could not find an instance of CMS",u=e.createContext(null);function i(){var n=e.useContext(u);if(!n)throw new Error(t);return n}var r=s;function s(n){var t,u=i();t=Array.isArray(n)?n:[n],e.useEffect((function(){return t.forEach((function(e){e&&u.plugins.add(e)})),function(){t.forEach((function(e){e&&u.plugins.remove(e)}))}}),[u.plugins].concat(t))}function o(e,n){return void 0===n&&(n={}),[e.initialValues,void 0]}var c=o;function a(n,t){return function(u){return r(t),e.createElement(n,Object.assign({},u))}}var f=a;exports.CMSContext=u,exports.ERROR_MISSING_CMS=t,exports.useCMS=i,exports.useCMSForm=c,exports.useForm=function(t,u){void 0===u&&(u={});var i=e.useState(),r=i[0],s=i[1],o=e.useState(t.initialValues)[1];return e.useEffect((function(){if(t.initialValues){var e=new n.Form(t);s(e);var u=e.subscribe((function(e){o(e.values)}),{values:!0});return function(){u()}}}),[t.id,!!t.initialValues]),function(n,t){e.useEffect((function(){t&&void 0!==n&&t.updateFields(n)}),[t,n])}(u.fields,r),function(n,t){e.useEffect((function(){t&&void 0!==n&&(t.label=n)}),[t,n])}(u.label,r),function(n,t){e.useEffect((function(){t&&void 0!==n&&t.updateValues(n)}),[t,n])}(u.values,r),[r?r.values:t.initialValues,r]},exports.useLocalForm=o,exports.usePlugin=r,exports.usePlugins=s,exports.useSubscribable=function(n,t){var u=e.useState(0)[1];e.useEffect((function(){return n.subscribe((function(){u((function(e){return e+1})),t&&t()}))}))},exports.useWatchFormValues=function(n,t){e.useEffect((function(){if(n){var e=!0;return n.subscribe((function(n){e?e=!1:t(n)}),{values:!0})}}),[t,n])},exports.withPlugin=f,exports.withPlugins=a; | ||
"use strict";var e=require("react"),n=require("@tinacms/core"),t="useCMS could not find an instance of CMS",u=e.createContext(null);function r(){var n=e.useContext(u);if(!n)throw new Error(t);return n}var i=s;function s(n){var t,u=r();t=Array.isArray(n)?n:[n],e.useEffect((function(){return t.forEach((function(e){e&&u.plugins.add(e)})),function(){t.forEach((function(e){e&&u.plugins.remove(e)}))}}),[u.plugins].concat(t))}function o(e,n){void 0===n&&(n={});var t=a(e,n),u=t[0],r=t[1];return s(r),[u,r]}var c=o;function a(t,u){void 0===u&&(u={});var r=e.useState(),i=r[0],s=r[1],o=e.useState(t.initialValues)[1];return e.useEffect((function(){if(t.initialValues){var e=new n.Form(t);s(e);var u=e.subscribe((function(e){o(e.values)}),{values:!0});return function(){u()}}}),[t.id,!!t.initialValues]),function(n,t){e.useEffect((function(){t&&void 0!==n&&t.updateFields(n)}),[t,n])}(u.fields,i),function(n,t){e.useEffect((function(){t&&void 0!==n&&(t.label=n)}),[t,n])}(u.label,i),function(n,t){e.useEffect((function(){t&&void 0!==n&&t.updateValues(n)}),[t,n])}(u.values,i),[i?i.values:t.initialValues,i]}function f(n,t){return function(u){return i(t),e.createElement(n,Object.assign({},u))}}var l=f;exports.CMSContext=u,exports.ERROR_MISSING_CMS=t,exports.useCMS=r,exports.useCMSForm=c,exports.useForm=a,exports.useLocalForm=o,exports.usePlugin=i,exports.usePlugins=s,exports.useSubscribable=function(n,t){var u=e.useState(0)[1];e.useEffect((function(){return n.subscribe((function(){u((function(e){return e+1})),t&&t()}))}))},exports.useWatchFormValues=function(n,t){e.useEffect((function(){if(n){var e=!0;return n.subscribe((function(n){e?e=!1:t(n)}),{values:!0})}}),[t,n])},exports.withPlugin=l,exports.withPlugins=f; | ||
//# sourceMappingURL=react-core.cjs.production.min.js.map |
@@ -112,20 +112,6 @@ import { createContext, useContext, useEffect, useState, createElement } from 'react'; | ||
/** | ||
* We're returning early here which means all the hooks called by this hook | ||
* violate the rules of hooks. In the case of the check for | ||
* `NODE_ENV === 'production'` this should be a non-issue because NODE_ENV | ||
* will never change at runtime. | ||
*/ | ||
if (process.env.NODE_ENV === 'production') { | ||
return [options.initialValues, undefined]; | ||
} | ||
/* eslint-disable-next-line react-hooks/rules-of-hooks */ | ||
var _useForm = useForm(options, watch), | ||
values = _useForm[0], | ||
form = _useForm[1]; | ||
/* eslint-disable-next-line react-hooks/rules-of-hooks */ | ||
usePlugins(form); | ||
@@ -132,0 +118,0 @@ return [values, form]; |
{ | ||
"name": "@tinacms/react-core", | ||
"version": "0.2.1-alpha.0", | ||
"version": "0.2.1-canary.2+35a07fab", | ||
"license": "Apache-2.0", | ||
@@ -32,3 +32,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "560379e2b51ee388de083d30a93f153475cb0e9a" | ||
"gitHead": "35a07fab5c2048a0b9bd166759a9c27db5f2b212" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2
76879
713
1