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

@tinacms/core

Package Overview
Dependencies
Maintainers
9
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.1.0-alpha.8 to 0.1.0-alpha.9

build/field-plugin.d.ts

12

build/cms-forms/form-manager.d.ts

@@ -1,7 +0,5 @@

import * as React from 'react';
import { Subscribable } from '../subscribable';
import { Form, Field, FormOptions } from './form';
import { Form, FormOptions } from './form';
export declare class FormManager extends Subscribable {
private __forms;
private __fields;
createForm: <S>(options: FormOptions<S>) => Form<S>;

@@ -12,9 +10,1 @@ findForm(id: string): Form | null;

}
export interface FieldPlugin {
__type: 'field';
name: string;
Component: React.FC<any>;
type?: string;
validate?(value: any, allValues: any, meta: any, field: Field): string | object | undefined;
parse?: (value: string, name: string) => any;
}

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

import { FormManager, FieldPlugin } from './cms-forms';
import { PluginManager, PluginType, Plugin } from './plugins';
import { FormManager } from './cms-forms';
import { PluginManager } from './plugins';
export declare class CMS {

@@ -7,21 +7,6 @@ forms: FormManager;

api: {
[key: string]: API;
[key: string]: any;
};
constructor();
readonly fields: PluginType<FieldPlugin>;
readonly screens: PluginType<ScreenPlugin>;
registerApi(name: string, api: API): void;
registerApi(name: string, api: any): void;
}
export interface API {
onSubmit?(data: any): any;
onChange?(data: any): any;
onUploadMedia?(data: any): any;
onDelete?(data: any): any;
isAuthenticated?(): any;
authenticate?(): Promise<any>;
removeAuthentication?(): any;
}
export interface ScreenPlugin extends Plugin {
__type: 'screen';
Component: any;
}

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("final-form")):"function"==typeof define&&define.amd?define(["exports","final-form"],e):e((t=t||self)["@tinacms/core"]={},t.finalForm)}(this,function(t,u){"use strict";var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function e(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var r=(i.prototype.subscribe=function(t){var e=this;return this.__subscribers.push(t),function(){return e.unsubscribe(t)}},i.prototype.unsubscribe=function(t){var e=this.__subscribers.indexOf(t);this.__subscribers.splice(e,1)},i.prototype.notifiySubscribers=function(){this.__subscribers.forEach(function(t){return t()})},i);function i(){this.__subscribers=[]}var o=(Object.defineProperty(s.prototype,"values",{get:function(){return this.finalForm.getState().values},enumerable:!0,configurable:!0}),s);function s(t){var r=this,e=t.id,n=t.label,i=t.fields,o=t.actions,s=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(t,["id","label","fields","actions"]);this.subscribe=function(t,e){return r.finalForm.subscribe(t,e)},this.submit=function(){return r.finalForm.submit()},this.id=e,this.label=n,this.fields=i,this.finalForm=u.createForm(s),this.actions=o||[]}var f,p=(e(c,f=r),c.prototype.findForm=function(t){return this.__forms[t]},c.prototype.all=function(){var e=this;return Object.keys(this.__forms).map(function(t){return e.__forms[t]})},c);function c(){var r=null!==f&&f.apply(this,arguments)||this;return r.__forms={},r.__fields={},r.createForm=function(t){var e=new o(t);return r.__forms[t.id]=e,r.notifiySubscribers(),e},r.removeForm=function(t){delete r.__forms[t],r.notifiySubscribers()},r}var a=(l.prototype.findOrCreateMap=function(t){return this.plugins[t]=this.plugins[t]||new _(t)},l.prototype.add=function(t){this.findOrCreateMap(t.__type).add(t)},l.prototype.remove=function(t){this.findOrCreateMap(t.__type).remove(t)},l.prototype.all=function(t){return this.findOrCreateMap(t).all()},l);function l(){this.plugins={}}var b,_=(e(y,b=r),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,r=this.__plugins[e];return delete this.__plugins[e],this.notifiySubscribers(),r},y);function y(t){var e=b.call(this)||this;return e.__type=t,e.__plugins={},e}var h=(Object.defineProperty(d.prototype,"fields",{get:function(){return this.plugins.findOrCreateMap("field")},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"screens",{get:function(){return this.plugins.findOrCreateMap("screen")},enumerable:!0,configurable:!0}),d.prototype.registerApi=function(t,e){this.api[t]=e},d);function d(){this.api={},this.forms=new p,this.plugins=new a}t.CMS=h,t.Form=o,t.FormManager=p,t.PluginManager=a,t.PluginType=_,t.Subscribable=r,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("final-form")):"function"==typeof define&&define.amd?define(["exports","final-form"],r):r((t=t||self)["@tinacms/core"]={},t.finalForm)}(this,function(t,u){"use strict";var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(t,r)};function r(t,r){function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var e=(i.prototype.subscribe=function(t){var r=this;return this.__subscribers.push(t),function(){return r.unsubscribe(t)}},i.prototype.unsubscribe=function(t){var r=this.__subscribers.indexOf(t);this.__subscribers.splice(r,1)},i.prototype.notifiySubscribers=function(){this.__subscribers.forEach(function(t){return t()})},i);function i(){this.__subscribers=[]}var o=(Object.defineProperty(s.prototype,"values",{get:function(){return this.finalForm.getState().values},enumerable:!0,configurable:!0}),s);function s(t){var e=this,r=t.id,n=t.label,i=t.fields,o=t.actions,s=function(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)r.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(e[n[i]]=t[n[i]])}return e}(t,["id","label","fields","actions"]);this.subscribe=function(t,r){return e.finalForm.subscribe(t,r)},this.submit=function(){return e.finalForm.submit()},this.id=r,this.label=n,this.fields=i,this.finalForm=u.createForm(s),this.actions=o||[]}var f,p=(r(c,f=e),c.prototype.findForm=function(t){return this.__forms[t]},c.prototype.all=function(){var r=this;return Object.keys(this.__forms).map(function(t){return r.__forms[t]})},c);function c(){var e=null!==f&&f.apply(this,arguments)||this;return e.__forms={},e.createForm=function(t){var r=new o(t);return e.__forms[t.id]=r,e.notifiySubscribers(),r},e.removeForm=function(t){delete e.__forms[t],e.notifiySubscribers()},e}var a=(l.prototype.findOrCreateMap=function(t){return this.plugins[t]=this.plugins[t]||new b(t)},l.prototype.add=function(t){this.findOrCreateMap(t.__type).add(t)},l.prototype.remove=function(t){this.findOrCreateMap(t.__type).remove(t)},l.prototype.all=function(t){return this.findOrCreateMap(t).all()},l);function l(){this.plugins={}}var _,b=(r(y,_=e),y.prototype.add=function(t){var r=t;r.__type||(r.__type=this.__type),this.__plugins[r.name]=r,this.notifiySubscribers()},y.prototype.all=function(){var r=this;return Object.keys(this.__plugins).map(function(t){return r.__plugins[t]})},y.prototype.find=function(t){return this.__plugins[t]},y.prototype.remove=function(t){var r="string"==typeof t?t:t.name,e=this.__plugins[r];return delete this.__plugins[r],this.notifiySubscribers(),e},y);function y(t){var r=_.call(this)||this;return r.__type=t,r.__plugins={},r}var h=(m.prototype.registerApi=function(t,r){this.api[t]=r},m);function m(){this.api={},this.forms=new p,this.plugins=new a}t.CMS=h,t.Form=o,t.FormManager=p,t.PluginManager=a,t.PluginType=b,t.Subscribable=e,Object.defineProperty(t,"__esModule",{value:!0})});

@@ -9,3 +9,3 @@ import { Subscribable } from './subscribable';

private plugins;
findOrCreateMap<T extends Plugin = Plugin>(type: string): PluginType<T>;
findOrCreateMap<T extends Plugin = Plugin>(type: T['__type']): PluginType<T>;
add(view: Plugin): void;

@@ -12,0 +12,0 @@ remove(view: Plugin): void;

@@ -6,2 +6,13 @@ # Change Log

# [0.1.0-alpha.9](https://github.com/tinacms/tinacms/compare/@tinacms/core@0.1.0-alpha.8...@tinacms/core@0.1.0-alpha.9) (2019-09-25)
### Bug Fixes
* tighten types around `cms.plugins.findOrCreateMap` ([2791bf7](https://github.com/tinacms/tinacms/commit/2791bf7))
# [0.1.0-alpha.8](https://github.com/tinacms/tinacms/compare/@tinacms/core@0.1.0-alpha.7...@tinacms/core@0.1.0-alpha.8) (2019-09-23)

@@ -8,0 +19,0 @@

{
"name": "@tinacms/core",
"version": "0.1.0-alpha.8",
"version": "0.1.0-alpha.9",
"main": "build/index.js",

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

},
"gitHead": "e68cb05b97a4a5eb0a1fca2c06abac9793d496c8"
"gitHead": "a3211f8fecd0eaad6045fb5a0ac4fe12f2a35000"
}

@@ -29,29 +29,2 @@ # @tinacms/core

### Add fields plugins:
```javascript
cms.forms.addFieldPlugin({
name: "text",
Component({ input, field }) {
return (
<label name={input.name}>
{field.name}
<input {...} />
</label>
)
}
})
```
### Field Plugin Props
```
- input: [See Input Props here](https://github.com/final-form/react-final-form#fieldrenderprops)
- meta: [See Meta Props here](https://github.com/final-form/react-final-form#fieldrenderprops)
- field:
- name: string;
- component: React.FC<any> | string;
```
### Register a new form:

@@ -103,8 +76,2 @@

#### `addFieldPlugin(): void`
#### `getFieldPlugin(name: string): FieldPlugin | null`
### `FormOptions<S>`
### `FieldPlugin`
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