Socket
Socket
Sign inDemoInstall

@vlzh/react-modal-manager

Package Overview
Dependencies
7
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.6 to 1.0.0

.babelrc.json

19

.eslintrc.js

@@ -5,3 +5,3 @@ module.exports = {

es6: true,
node: true
node: true,
},

@@ -12,12 +12,13 @@ extends: [

"plugin:jest/recommended",
"plugin:prettier/recommended"
"prettier/@typescript-eslint",
"plugin:@typescript-eslint/recommended",
],
plugins: ["react", "jest", "prettier"],
parser: "babel-eslint",
plugins: ["react", "jest", "prettier", "@typescript-eslint"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true
jsx: true,
},
ecmaVersion: 2018,
sourceType: "module"
sourceType: "module",
},

@@ -28,8 +29,8 @@ rules: {

quotes: ["error", "double"],
semi: ["error", "always"]
semi: ["error", "always"],
},
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly"
}
SharedArrayBuffer: "readonly",
},
};

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n((e=e||self)["@vlzh/react-modal-manager"]={},e.React)}(this,(function(e,n){"use strict";var t="default"in n?n.default:n;function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function o(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(){return(i=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function u(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var t=[],r=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(r=(i=u.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw a}}return t}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var c=["afterOpen","beforeOpen","afterClose","beforeClose"],l=function e(n){r(this,e),this.modal_name=n},s=function(e,t){var r=u(n.useState(0),2)[1];return n.useEffect((function(){return t&&(e.addModal(t),e.addSubscriber(t,(function(){r(Math.random())}))),function(){t&&e.removeSubscriber(t)}})),{openModal:function(){return e.openModal.apply(e,arguments)},closeModal:function(){return e.closeModal.apply(e,arguments)},isOpen:function(){return e.isOpen.apply(e,arguments)}}},f=new(function(){function e(){r(this,e),a(this,"modals",[]),a(this,"open",[]),a(this,"subscribers",{}),a(this,"callbacks",{afterOpen:[],beforeOpen:[],afterClose:[],beforeClose:[]}),a(this,"scroll_point",0)}var n,t,i;return n=e,(t=[{key:"addModal",value:function(e){this.include(e)||this.modals.push(e)}},{key:"delModal",value:function(e){this.modals=this.modals.filter((function(n){return n!==e}))}},{key:"openModal",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.include(e))throw new Error("manager do not have modal '".concat(e,"'"));this.callbacks.beforeOpen.forEach((function(n){return n(new l(e))})),n&&(this.open=[]),this.open.push(e),this.callSubscribers(e),this.callbacks.afterOpen.forEach((function(n){return n(new l(e))}))}},{key:"closeModal",value:function(e){if(!this.include(e))throw new Error("manager do not have modal '".concat(e,"'"));this.callbacks.beforeClose.forEach((function(n){return n(new l(e))})),this.open=this.open.filter((function(n){return n!==e})),this.callSubscribers(e),this.callbacks.afterClose.forEach((function(n){return n(new l(e))}))}},{key:"isOpen",value:function(e){return this.open.includes(e)}},{key:"include",value:function(e){return this.modals.includes(e)}},{key:"addSubscriber",value:function(e,n){this.subscribers[e]=n}},{key:"removeSubscriber",value:function(e){delete this.subscribers[e]}},{key:"callSubscribers",value:function(e){for(var n in this.subscribers)e?e===n&&this.subscribers[n]():this.subscribers[n]()}},{key:"on",value:function(e,n){if(!c.includes(e))throw new Error("Unknown event ".concat(e));this.callbacks[e].push(n)}}])&&o(n.prototype,t),i&&o(n,i),e}());e.manager=f,e.useModalManager=function(e){return s(f,e)},e.withModalManager=function(e){return function(e,n){return function(r){var o=function(o){var a=s(e,n);return t.createElement(r,i({},a,o))},a=r.displayName||r.name||"Unknown";return o.displayName="withModalManager(".concat(a,")"),o}}(f,e)},Object.defineProperty(e,"__esModule",{value:!0})}));
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./react-modal-manager.cjs.production.min.js')
} else {
module.exports = require('./react-modal-manager.cjs.development.js')
}
{
"name": "@vlzh/react-modal-manager",
"private": false,
"version": "0.1.6",
"version": "1.0.0",
"main": "dist/index.js",
"module": "dist/react-modal-manager.esm.js",
"typings": "dist/index.d.ts",
"repository": {

@@ -16,6 +18,6 @@ "type": "git",

"scripts": {
"build:dev": "rm -rf ./dist && yarn rollup -c ./rollup.config.js",
"build": "rm -rf ./dist && NODE_ENV=production yarn rollup -c ./rollup.config.js",
"start:example": "parcel serve ./example/example.html",
"test": "jest"
"build": "tsdx build",
"lint": "yarn eslint ./src",
"test": "tsdx test",
"start:example": "parcel serve ./example/example.html"
},

@@ -29,23 +31,22 @@ "keywords": [

"devDependencies": {
"@babel/core": "^7.8.3",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"@babel/preset-react": "^7.8.3",
"babel-eslint": "^10.0.3",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.9.0",
"eslint-plugin-jest": "^23.6.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.18.0",
"jest": "^24.9.0",
"@babel/core": "^7.10.2",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/preset-env": "^7.10.2",
"@babel/preset-react": "^7.10.1",
"@types/react": "^16.9.35",
"@typescript-eslint/eslint-plugin": "^3.1.0",
"@typescript-eslint/parser": "^3.1.0",
"babel-eslint": "^10.1.0",
"eslint": "^7.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jest": "^23.13.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.20.0",
"jest": "^26.0.1",
"parcel-bundler": "^1.12.4",
"prettier": "^1.19.1",
"react-dom": "^16.12.0",
"react-modal": "^3.11.1",
"rollup": "^1.29.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^5.2.0",
"rollup-plugin-uglify": "^6.0.4"
"prettier": "^2.0.5",
"react-dom": "^16.13.1",
"react-modal": "^3.11.2",
"tsdx": "^0.13.2",
"typescript": "^3.9.5"
},

@@ -55,8 +56,6 @@ "peerDependencies": {

},
"prettier": {
"tabWidth": 4
},
"dependencies": {
"react": "^16.12.0"
"@arkweid/lefthook": "^0.7.2",
"react": "^16.13.1"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc