Socket
Socket
Sign inDemoInstall

@tinacms/react-core

Package Overview
Dependencies
Maintainers
13
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tinacms/react-core - npm Package Compare versions

Comparing version 0.33.0 to 0.34.0-alpha.0

2

build/index.js

@@ -1,1 +0,1 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("@tinacms/forms")):"function"==typeof define&&define.amd?define(["exports","react","@tinacms/forms"],n):n((e=e||self)["@tinacms/react-core"]={},e.React,e.forms)}(this,function(e,a,u){"use strict";var t="useCMS could not find an instance of CMS",r=a.createContext(null);function i(){var e=a.useContext(r);if(!e)throw new Error(t);var n=a.useState(e.enabled)[1];return a.useEffect(function(){return e.events.subscribe("cms",function(){n(e.enabled)})},[e]),e}var o=function(){return(o=Object.assign||function(e){for(var n,t=1,u=arguments.length;t<u;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e}).apply(this,arguments)};var f=c;function c(e){var n,t=i();n=Array.isArray(e)?e:[e],a.useEffect(function(){return n.forEach(function(e){e&&t.plugins.add(e)}),function(){n.forEach(function(e){e&&t.plugins.remove(e)})}},function(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var u=Array(e),r=0;for(n=0;n<t;n++)for(var i=arguments[n],o=0,f=i.length;o<f;o++,r++)u[r]=i[o];return u}([t.plugins],n))}function s(e,n){void 0===n&&(n={});var t=e.loadInitialValues,u=function(e,n){var t={};for(var u in e)Object.prototype.hasOwnProperty.call(e,u)&&n.indexOf(u)<0&&(t[u]=e[u]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(u=Object.getOwnPropertySymbols(e);r<u.length;r++)n.indexOf(u[r])<0&&Object.prototype.propertyIsEnumerable.call(e,u[r])&&(t[u[r]]=e[u[r]])}return t}(e,["loadInitialValues"]);u.initialValues=u.initialValues||n.values;var r=a.useState(u.initialValues)[1],i=a.useState(function(){return l(u,function(e){r(e.values)})}),o=i[0],f=i[1];return a.useEffect(function(){o.id!==u.id&&f(l(u,function(e){r(e.values)}))},[u.id]),a.useEffect(function(){t&&t().then(function(e){o.updateInitialValues(e)})},[o]),function(e,n){a.useEffect(function(){void 0!==n&&e.updateFields(n)},[e,n])}(o,n.fields),function(e,n){a.useEffect(function(){void 0!==n&&(e.label=n)},[e,n])}(o,n.label),function(e,n){a.useEffect(function(){void 0!==n&&e.updateValues(n)},[e,n])}(o,n.values),[o?o.values:u.initialValues,o]}function l(e,n){var t=new u.Form(e);return t.subscribe(n,{values:!0}),t}function n(n,t){return function(e){return f(t),a.createElement(n,o({},e))}}var v=n;e.CMSContext=r,e.ERROR_MISSING_CMS=t,e.useCMS=i,e.useCMSEvent=function(e,n,t){var u=i();a.useEffect(function(){return u.events.subscribe(e,n)},t)},e.useForm=s,e.useLocalForm=function(e,n){void 0===n&&(n={});var t=s(e,n),u=t[0],r=t[1];return c(r),[u,r]},e.usePlugin=f,e.usePlugins=c,e.useSubscribable=function(e,n){var t=a.useState(0)[1];a.useEffect(function(){return e.subscribe(function(){t(function(e){return e+1}),n&&n()})})},e.useWatchFormValues=function(e,t){a.useEffect(function(){if(e){var n=!0;return e.subscribe(function(e){n?n=!1:t(e)},{values:!0})}},[t,e])},e.withPlugin=v,e.withPlugins=n,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("@tinacms/forms")):"function"==typeof define&&define.amd?define(["exports","react","@tinacms/forms"],n):n((e=e||self)["@tinacms/react-core"]={},e.React,e.forms)}(this,function(e,b,r){"use strict";var t="useCMS could not find an instance of CMS",u=b.createContext(null);function i(){var e=b.useContext(u);if(!e)throw new Error(t);var n=b.useState(e.enabled)[1];return b.useEffect(function(){return e.events.subscribe("cms",function(){n(e.enabled)})},[e]),e}var o=function(){return(o=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var u in n=arguments[t])Object.prototype.hasOwnProperty.call(n,u)&&(e[u]=n[u]);return e}).apply(this,arguments)};function d(i,o,a,c){return new(a=a||Promise)(function(e,n){function t(e){try{u(c.next(e))}catch(e){n(e)}}function r(e){try{u(c.throw(e))}catch(e){n(e)}}function u(n){n.done?e(n.value):new a(function(e){e(n.value)}).then(t,r)}u((c=c.apply(i,o||[])).next())})}function p(t,r){var u,i,o,e,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return e={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function n(n){return function(e){return function(n){if(u)throw new TypeError("Generator is already executing.");for(;a;)try{if(u=1,i&&(o=2&n[0]?i.return:n[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,n[1])).done)return o;switch(i=0,o&&(n=[2&n[0],o.value]),n[0]){case 0:case 1:o=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,i=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!(o=0<(o=a.trys).length&&o[o.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]<o[3])){a.label=n[1];break}if(6===n[0]&&a.label<o[1]){a.label=o[1],o=n;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(n);break}o[2]&&a.ops.pop(),a.trys.pop();continue}n=r.call(t,a)}catch(e){n=[6,e],i=0}finally{u=o=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,e])}}}var a=c;function c(e){var n,t=i();n=Array.isArray(e)?e:[e],b.useEffect(function(){return n.forEach(function(e){e&&t.plugins.add(e)}),function(){n.forEach(function(e){e&&t.plugins.remove(e)})}},function(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var r=Array(e),u=0;for(n=0;n<t;n++)for(var i=arguments[n],o=0,a=i.length;o<a;o++,u++)r[u]=i[o];return r}([t.plugins],n))}function h(e,n,t){var r=i();b.useEffect(function(){return r.events.subscribe(e,n)},t)}function f(e,n){var t=this;void 0===n&&(n={});var r=e.loadInitialValues,u=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var u=0;for(r=Object.getOwnPropertySymbols(e);u<r.length;u++)n.indexOf(r[u])<0&&Object.prototype.propertyIsEnumerable.call(e,r[u])&&(t[r[u]]=e[r[u]])}return t}(e,["loadInitialValues"]);u.initialValues=u.initialValues||n.values;var i=b.useState(u.initialValues)[1],o=b.useState(function(){return y(u,function(e){i(e.values)})}),a=o[0],c=o[1];b.useEffect(function(){a.id!==u.id&&c(y(u,function(e){i(e.values)}))},[u.id]);var f=b.useState(function(){return!!r}),s=f[0],l=f[1],v=b.useCallback(function(){return d(t,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return r?(l(!0),[4,r().then(function(e){a.updateInitialValues(e)}).finally(function(){l(!1)})]):[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})},[a,l]);return b.useEffect(function(){v()},[a,v]),h("unstable:reload-form-data",function(){return d(t,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,v()];case 1:return e.sent(),[4,a.reset()];case 2:return e.sent(),[2]}})})},[v,a]),function(e,n){b.useEffect(function(){void 0!==n&&e.updateFields(n)},[e,n])}(a,n.fields),function(e,n){b.useEffect(function(){void 0!==n&&(e.label=n)},[e,n])}(a,n.label),function(e,n){b.useEffect(function(){void 0!==n&&e.updateValues(n)},[e,n])}(a,n.values),[a?a.values:u.initialValues,a,s]}function y(e,n){var t=new r.Form(e);return t.subscribe(n,{values:!0}),t}function n(n,t){return function(e){return a(t),b.createElement(n,o({},e))}}var s=n;e.CMSContext=u,e.ERROR_MISSING_CMS=t,e.useCMS=i,e.useCMSEvent=h,e.useForm=f,e.useLocalForm=function(e,n){void 0===n&&(n={});var t=f(e,n),r=t[0],u=t[1];return c(u),[r,u]},e.usePlugin=a,e.usePlugins=c,e.useSubscribable=function(e,n){var t=b.useState(0)[1];b.useEffect(function(){return e.subscribe(function(){t(function(e){return e+1}),n&&n()})})},e.useWatchFormValues=function(e,t){b.useEffect(function(){if(e){var n=!0;return e.subscribe(function(e){n?n=!1:t(e)},{values:!0})}},[t,e])},e.withPlugin=s,e.withPlugins=n,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -31,2 +31,2 @@ /**

*/
export declare function useForm<FormShape = any>({ loadInitialValues, ...options }: FormOptions<any>, watch?: Partial<WatchableFormValue>): [FormShape, Form];
export declare function useForm<FormShape = any>({ loadInitialValues, ...options }: FormOptions<any>, watch?: Partial<WatchableFormValue>): [FormShape, Form, boolean];
{
"name": "@tinacms/react-core",
"version": "0.33.0",
"version": "0.34.0-alpha.0",
"license": "Apache-2.0",

@@ -32,3 +32,3 @@ "main": "build/index.js",

},
"gitHead": "f33c4baf5c8eae59b8edc9c2a7c7ef22482dc38f"
"gitHead": "d04ac723c349135317a11e9a447b7b0d38cb355f"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc