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

@easepick/base-plugin

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@easepick/base-plugin - npm Package Compare versions

Comparing version 1.0.0-beta.4 to 1.0.0-beta.5

69

dist/index.esm.js

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

class e{picker;options;priority=0;dependencies=[];attach(e){if(this.options={...this.options,...e.options[this.getName()]||{}},this.picker=e,this.dependenciesNotFound()){const e=this.dependencies.filter((e=>!this.pluginsAsStringArray().includes(e)));return void console.warn(`${this.getName()}: required dependencies (${e.join(", ")}).`)}const t=this.camelCaseToKebab(this.getName());this.picker.ui.container.classList.add(t),this.onAttach()}detach(){const e=this.camelCaseToKebab(this.getName());this.picker.ui.container.classList.remove(e),"function"==typeof this.onDetach&&this.onDetach()}dependenciesNotFound(){return this.dependencies.length&&!this.dependencies.every((e=>this.pluginsAsStringArray().includes(e)))}pluginsAsStringArray(){return this.picker.options.plugins.map((e=>"function"==typeof e?(new e).getName():e))}camelCaseToKebab(e){return e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}}export{e as BasePlugin};
class BasePlugin {
picker;
options;
priority = 0;
dependencies = [];
/**
* - Called automatically via PluginManager.initialize() or PluginManager.addInstance() -
* Add plugin to the picker
*
* @param picker
*/
attach(picker) {
this.options = {
...this.options,
...(picker.options[this['getName']()] || {}),
};
this.picker = picker;
if (this.dependenciesNotFound()) {
const deps = this.dependencies.filter(x => !this.pluginsAsStringArray().includes(x));
console.warn(`${this['getName']()}: required dependencies (${deps.join(', ')}).`);
return;
}
const pluginClass = this.camelCaseToKebab(this['getName']());
this.picker.ui.container.classList.add(pluginClass);
this['onAttach']();
}
/**
* - Called automatically via PluginManager.removeInstance() -
* Remove plugin from the picker
*/
detach() {
const pluginClass = this.camelCaseToKebab(this['getName']());
this.picker.ui.container.classList.remove(pluginClass);
if (typeof this['onDetach'] === 'function') {
this['onDetach']();
}
}
/**
* Check dependencies for plugin
*
* @returns Boolean
*/
dependenciesNotFound() {
return this.dependencies.length
&& !this.dependencies.every(v => this.pluginsAsStringArray().includes(v));
}
/**
* Return plugins list as string array
*
* @returns []
*/
pluginsAsStringArray() {
return this.picker.options.plugins
.map(x => typeof x === 'function' ? (new x).getName() : x);
}
/**
* Return camelCase in kebab-case
* Eg.: `userName` -> `user-name`
*
* @param str
* @returns String
*/
camelCaseToKebab(str) {
return str.replace(/([a-zA-Z])(?=[A-Z])/g, '$1-').toLowerCase();
}
}
export { BasePlugin };
/**
* @license
* Package: @easepick/base-plugin
* Version: 1.0.0-beta.3
* Version: 1.0.0-beta.4
* https://easepick.com/

@@ -10,2 +10,79 @@ * Copyright 2022 Rinat G.

*/
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((e="undefined"!=typeof globalThis?globalThis:e||self).easepick=e.easepick||{})}(this,(function(e){"use strict";e.BasePlugin=class{picker;options;priority=0;dependencies=[];attach(e){if(this.options={...this.options,...e.options[this.getName()]||{}},this.picker=e,this.dependenciesNotFound()){const e=this.dependencies.filter((e=>!this.pluginsAsStringArray().includes(e)));return void console.warn(`${this.getName()}: required dependencies (${e.join(", ")}).`)}const i=this.camelCaseToKebab(this.getName());this.picker.ui.container.classList.add(i),this.onAttach()}detach(){const e=this.camelCaseToKebab(this.getName());this.picker.ui.container.classList.remove(e),"function"==typeof this.onDetach&&this.onDetach()}dependenciesNotFound(){return this.dependencies.length&&!this.dependencies.every((e=>this.pluginsAsStringArray().includes(e)))}pluginsAsStringArray(){return this.picker.options.plugins.map((e=>"function"==typeof e?(new e).getName():e))}camelCaseToKebab(e){return e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}},Object.defineProperty(e,"__esModule",{value:!0})}));
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.easepick = global.easepick || {}));
})(this, (function (exports) { 'use strict';
class BasePlugin {
picker;
options;
priority = 0;
dependencies = [];
/**
* - Called automatically via PluginManager.initialize() or PluginManager.addInstance() -
* Add plugin to the picker
*
* @param picker
*/
attach(picker) {
this.options = {
...this.options,
...(picker.options[this['getName']()] || {}),
};
this.picker = picker;
if (this.dependenciesNotFound()) {
const deps = this.dependencies.filter(x => !this.pluginsAsStringArray().includes(x));
console.warn(`${this['getName']()}: required dependencies (${deps.join(', ')}).`);
return;
}
const pluginClass = this.camelCaseToKebab(this['getName']());
this.picker.ui.container.classList.add(pluginClass);
this['onAttach']();
}
/**
* - Called automatically via PluginManager.removeInstance() -
* Remove plugin from the picker
*/
detach() {
const pluginClass = this.camelCaseToKebab(this['getName']());
this.picker.ui.container.classList.remove(pluginClass);
if (typeof this['onDetach'] === 'function') {
this['onDetach']();
}
}
/**
* Check dependencies for plugin
*
* @returns Boolean
*/
dependenciesNotFound() {
return this.dependencies.length
&& !this.dependencies.every(v => this.pluginsAsStringArray().includes(v));
}
/**
* Return plugins list as string array
*
* @returns []
*/
pluginsAsStringArray() {
return this.picker.options.plugins
.map(x => typeof x === 'function' ? (new x).getName() : x);
}
/**
* Return camelCase in kebab-case
* Eg.: `userName` -> `user-name`
*
* @param str
* @returns String
*/
camelCaseToKebab(str) {
return str.replace(/([a-zA-Z])(?=[A-Z])/g, '$1-').toLowerCase();
}
}
exports.BasePlugin = BasePlugin;
Object.defineProperty(exports, '__esModule', { value: true });
}));

4

package.json
{
"name": "@easepick/base-plugin",
"description": "Base plugin for easepick.",
"version": "1.0.0-beta.4",
"version": "1.0.0-beta.5",
"main": "dist/index.umd.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts",
"devDependencies": {
"dependencies": {
"@easepick/core": "^1.0.0-beta.0"

@@ -10,0 +10,0 @@ },

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