Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tinacms/core

Package Overview
Dependencies
Maintainers
10
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tinacms/core - npm Package Compare versions

Comparing version 0.4.2-alpha.0 to 0.4.3

19

build/cms-forms/form.d.ts

@@ -19,3 +19,3 @@ /**

/// <reference types="react" />
import { FormApi, Config } from 'final-form';
import { FormApi, Config, Unsubscribe } from 'final-form';
export interface FormOptions<S> extends Config<S> {

@@ -39,2 +39,7 @@ id: any;

}
interface FieldSubscription {
path: string;
field: Field;
unsubscribe: Unsubscribe;
}
export declare class Form<S = any> {

@@ -46,2 +51,8 @@ id: any;

actions: any[];
fieldSubscriptions: {
[key: string]: FieldSubscription;
};
hiddenFields: {
[key: string]: FieldSubscription;
};
initialValues: any;

@@ -51,7 +62,11 @@ reset?(): void;

updateFields(fields: Field[]): void;
private discoverHiddenFields;
private removeDeclaredFieldsFromHiddenLookup;
private registerFields;
subscribe: FormApi<S>['subscribe'];
submit: FormApi<S>['submit'];
readonly values: S;
readonly name: any;
private readonly inactiveFields;
updateValues(values: S): void;
}
export {};

@@ -18,2 +18,3 @@ /**

*/
export * from './form-manager';
export * from './form';

6

build/cms.d.ts

@@ -18,5 +18,6 @@ /**

*/
import { Form } from './cms-forms';
import { FormManager } from './cms-forms';
import { PluginManager } from './plugins';
export declare class CMS {
forms: FormManager;
plugins: PluginManager;

@@ -28,5 +29,2 @@ api: {

registerApi(name: string, api: any): void;
readonly forms: import("./plugins").PluginType<Form<any> & {
__type: string;
}>;
}

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("final-form-arrays"),require("final-form")):"function"==typeof define&&define.amd?define(["exports","final-form-arrays","final-form"],e):e((t=t||self)["@tinacms/core"]={},t.arrayMutators,t.finalForm)}(this,function(t,c,f){"use strict";c=c&&c.hasOwnProperty("default")?c.default:c;var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var l=function(){return(l=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function p(n,r){var i,o,s,t,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return u.label++,{value:e[1],done:!1};case 5:u.label++,o=e[1],e=[0];continue;case 7:e=u.ops.pop(),u.trys.pop();continue;default:if(!(s=0<(s=u.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){u=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){u.label=e[1];break}if(6===e[0]&&u.label<s[1]){u.label=s[1],s=e;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(e);break}s[2]&&u.ops.pop(),u.trys.pop();continue}e=r.call(n,u)}catch(t){e=[6,t],o=0}finally{i=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}var e=(r.prototype.subscribe=function(t){var e=this;return this.__subscribers.push(t),function(){return e.unsubscribe(t)}},r.prototype.unsubscribe=function(t){var e=this.__subscribers.indexOf(t);this.__subscribers.splice(e,1)},r.prototype.notifiySubscribers=function(){this.__subscribers.forEach(function(t){return t()})},r);function r(){this.__subscribers=[]}var i=(o.prototype.findOrCreateMap=function(t){return this.plugins[t]=this.plugins[t]||new h(t)},o.prototype.add=function(t){this.findOrCreateMap(t.__type).add(t)},o.prototype.remove=function(t){this.findOrCreateMap(t.__type).remove(t)},o.prototype.all=function(t){return this.findOrCreateMap(t).all()},o);function o(){this.plugins={}}var s,u,a,h=(n(s=y,u=a=e),void(s.prototype=null===u?Object.create(u):(b.prototype=u.prototype,new b)),y.prototype.add=function(t){var e=t;e.__type||(e.__type=this.__type),this.__plugins[e.name]=e,this.notifiySubscribers()},y.prototype.all=function(){var e=this;return Object.keys(this.__plugins).map(function(t){return e.__plugins[t]})},y.prototype.find=function(t){return this.__plugins[t]},y.prototype.remove=function(t){var e="string"==typeof t?t:t.name,n=this.__plugins[e];return delete this.__plugins[e],this.notifiySubscribers(),n},y);function b(){this.constructor=s}function y(t){var e=a.call(this)||this;return e.__type=t,e.__plugins={},e}var d=(_.prototype.registerApi=function(t,e){this.api[t]=e},Object.defineProperty(_.prototype,"forms",{get:function(){return this.plugins.findOrCreateMap("form")},enumerable:!0,configurable:!0}),_);function _(){this.api={},this.plugins=new i}var v=(m.prototype.updateFields=function(t){this.fields=t},Object.defineProperty(m.prototype,"values",{get:function(){return this.finalForm.getState().values},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"name",{get:function(){return this.id},enumerable:!0,configurable:!0}),m.prototype.updateValues=function(t){var e=this;this.finalForm.batch(function(){e.finalForm.getState().active?function i(o,t,s){var u=o.getState().active;Object.entries(t).forEach(function(t){var e=t[0],n=t[1],r=s?s+"."+e:e;"object"==typeof n?u.startsWith(r)?i(o,n,r):o.change(r,n):r!==u&&o.change(r,n)})}(e.finalForm,t):function(r,t){Object.entries(t).forEach(function(t){var e=t[0],n=t[1];r.change(e,n)})}(e.finalForm,t)})},m);function m(t){var n=this,e=t.id,r=t.label,i=t.fields,o=t.actions,s=t.reset,u=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["id","label","fields","actions","reset"]);this.subscribe=function(t,e){return n.finalForm.subscribe(t,e)},this.submit=function(){return n.finalForm.submit()};var a=u.initialValues||{};this.id=e,this.label=r,this.fields=i,this.finalForm=f.createForm(l({},u,{initialValues:a,onSubmit:function(n,r,i){return function(o,s,u,a){return new(u=u||Promise)(function(t,e){function n(t){try{i(a.next(t))}catch(t){e(t)}}function r(t){try{i(a.throw(t))}catch(t){e(t)}}function i(e){e.done?t(e.value):new u(function(t){t(e.value)}).then(n,r)}i((a=a.apply(o,s||[])).next())})}(this,void 0,void 0,function(){var e;return p(this,function(t){switch(t.label){case 0:return[4,u.onSubmit(n,r,i)];case 1:return e=t.sent(),r.initialize(n),[2,e]}})})},mutators:l({},c,u.mutators)})),this.reset=s,this.actions=o||[],this.initialValues=a,this.updateFields(this.fields)}t.CMS=d,t.Form=v,t.PluginManager=i,t.PluginType=h,t.Subscribable=e,Object.defineProperty(t,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("final-form-arrays"),require("final-form")):"function"==typeof define&&define.amd?define(["exports","final-form-arrays","final-form"],t):t((e=e||self)["@tinacms/core"]={},e.arrayMutators,e.finalForm)}(this,function(e,c,l){"use strict";c=c&&c.hasOwnProperty("default")?c.default:c;var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function t(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var f=function(){return(f=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function p(i,r){var n,o,s,e,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,o&&(s=2&t[0]?o.return:t[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,t[1])).done)return s;switch(o=0,s&&(t=[2&t[0],s.value]),t[0]){case 0:case 1:s=t;break;case 4:return u.label++,{value:t[1],done:!1};case 5:u.label++,o=t[1],t=[0];continue;case 7:t=u.ops.pop(),u.trys.pop();continue;default:if(!(s=0<(s=u.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){u=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3])){u.label=t[1];break}if(6===t[0]&&u.label<s[1]){u.label=s[1],s=t;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(t);break}s[2]&&u.ops.pop(),u.trys.pop();continue}t=r.call(i,u)}catch(e){t=[6,e],o=0}finally{n=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}var i=(n.prototype.subscribe=function(e){var t=this;return this.__subscribers.push(e),function(){return t.unsubscribe(e)}},n.prototype.unsubscribe=function(e){var t=this.__subscribers.indexOf(e);this.__subscribers.splice(t,1)},n.prototype.notifiySubscribers=function(){this.__subscribers.forEach(function(e){return e()})},n);function n(){this.__subscribers=[]}var d=require("lodash.get");function o(i){var r=[],e=Object.entries(i.hiddenFields),t=Object.entries(i.fieldSubscriptions);return e.concat(t).forEach(function(e){var t=e[0];r=r.concat(function e(t,i){var r=[];if(/INDEX/.test(i)){var n=i.split(".INDEX.")[0],o=d(t.finalForm.getState().values,n,[]);if(o)for(var s=0;s<o.length;s++){var u=i.replace("INDEX",""+s),a=e(t,u);r=r.concat(a)}}else{var c=t.finalForm.getFieldState(i);c&&c.active||r.push(i)}return r}(i,t))}),r}var s=require("lodash.get"),u=(a.prototype.updateFields=function(e){this.fields=e,this.registerFields(this.fields),this.discoverHiddenFields(this.initialValues),this.removeDeclaredFieldsFromHiddenLookup()},a.prototype.discoverHiddenFields=function(e,o){var s=this;Object.entries(e).map(function(e){var t=e[0],i=e[1],r=o?o+"."+t:t;if(Array.isArray(i))if(i.find(function(e){return"object"==typeof e})){var n=r+".INDEX";i.forEach(function(e){s.discoverHiddenFields(e,n)})}else s.hiddenFields[r]={path:r,field:{name:r,component:null},unsubscribe:s.finalForm.registerField(r,function(){},{})};else"object"==typeof i&&null!==i?s.discoverHiddenFields(i,r):s.hiddenFields[r]={path:r,field:{name:r,component:null},unsubscribe:s.finalForm.registerField(r,function(){},{})}})},a.prototype.removeDeclaredFieldsFromHiddenLookup=function(){var i=this;Object.keys(this.fieldSubscriptions).forEach(function(e){var t=i.hiddenFields[e];t&&(t.unsubscribe(),delete i.hiddenFields[e])})},a.prototype.registerFields=function(e,n){var o=this;e.forEach(function(e){var t=n?n+"."+e.name:e.name,i=["group"].includes(e.component);if(["group-list","blocks"].includes(e.component)){var r=e.fields||[];o.registerFields(r,t+".INDEX")}else i?(r=e.fields||[],o.registerFields(r,t)):o.fieldSubscriptions[t]={path:t,field:e,unsubscribe:o.finalForm.registerField(t,function(){},{})}})},Object.defineProperty(a.prototype,"values",{get:function(){return this.finalForm.getState().values},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"inactiveFields",{get:function(){return o(this)},enumerable:!0,configurable:!0}),a.prototype.updateValues=function(t){var i=this;this.finalForm.batch(function(){i.inactiveFields.forEach(function(e){i.finalForm.change(e,s(t,e))})})},a);function a(e){var i=this,t=e.id,r=e.label,n=e.fields,o=e.actions,s=e.reset,u=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i}(e,["id","label","fields","actions","reset"]);this.fieldSubscriptions={},this.hiddenFields={},this.subscribe=function(e,t){return i.finalForm.subscribe(e,t)},this.submit=function(){return i.finalForm.submit()};var a=u.initialValues||{};this.id=t,this.label=r,this.fields=n,this.finalForm=l.createForm(f({},u,{initialValues:a,onSubmit:function(i,r,n){return function(o,s,u,a){return new(u=u||Promise)(function(e,t){function i(e){try{n(a.next(e))}catch(e){t(e)}}function r(e){try{n(a.throw(e))}catch(e){t(e)}}function n(t){t.done?e(t.value):new u(function(e){e(t.value)}).then(i,r)}n((a=a.apply(o,s||[])).next())})}(this,void 0,void 0,function(){var t;return p(this,function(e){switch(e.label){case 0:return[4,u.onSubmit(i,r,n)];case 1:return t=e.sent(),r.initialize(i),[2,t]}})})},mutators:f({},c,u.mutators)})),this.reset=s,this.actions=o||[],this.initialValues=a,this.updateFields(this.fields)}var h,b=(t(y,h=i),y.prototype.findForm=function(e){return this.__forms[e]},y.prototype.all=function(){var t=this;return Object.keys(this.__forms).map(function(e){return t.__forms[e]})},y);function y(){var i=null!==h&&h.apply(this,arguments)||this;return i.__forms={},i.createForm=function(e){var t=new u(e);return i.__forms[e.id]=t,i.notifiySubscribers(),t},i.removeForm=function(e){delete i.__forms[e],i.notifiySubscribers()},i}var v=(m.prototype.findOrCreateMap=function(e){return this.plugins[e]=this.plugins[e]||new g(e)},m.prototype.add=function(e){this.findOrCreateMap(e.__type).add(e)},m.prototype.remove=function(e){this.findOrCreateMap(e.__type).remove(e)},m.prototype.all=function(e){return this.findOrCreateMap(e).all()},m);function m(){this.plugins={}}var _,g=(t(F,_=i),F.prototype.add=function(e){var t=e;t.__type||(t.__type=this.__type),this.__plugins[t.name]=t,this.notifiySubscribers()},F.prototype.all=function(){var t=this;return Object.keys(this.__plugins).map(function(e){return t.__plugins[e]})},F.prototype.find=function(e){return this.__plugins[e]},F.prototype.remove=function(e){var t="string"==typeof e?e:e.name,i=this.__plugins[t];return delete this.__plugins[t],this.notifiySubscribers(),i},F);function F(e){var t=_.call(this)||this;return t.__type=e,t.__plugins={},t}var O=(w.prototype.registerApi=function(e,t){this.api[e]=t},w);function w(){this.api={},this.forms=new b,this.plugins=new v}e.CMS=O,e.Form=u,e.FormManager=b,e.PluginManager=v,e.PluginType=g,e.Subscribable=i,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "@tinacms/core",
"version": "0.4.2-alpha.0",
"version": "0.4.3",
"main": "build/index.js",

@@ -30,3 +30,3 @@ "types": "build/index.d.ts",

"devDependencies": {
"@tinacms/scripts": "^0.1.9-alpha.0",
"@tinacms/scripts": "^0.1.10",
"@types/jest": "^24.0.15",

@@ -44,3 +44,3 @@ "@types/react": "^16.8.23",

},
"gitHead": "75b314dae98a508b935022424615b1dafaabfbe5"
"gitHead": "c6fa62065be4e6b69d222666778c9f65f41873a5"
}
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