Socket
Socket
Sign inDemoInstall

lit-popup

Package Overview
Dependencies
1
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.1 to 1.5.0

17

dist/index.js

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

var LitPopup=function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var e=function(){return(e=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function n(t,e,n,o){return new(n||(n=Promise))((function(i,s){function r(t){try{p(o.next(t))}catch(t){s(t)}}function l(t){try{p(o.throw(t))}catch(t){s(t)}}function p(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(r,l)}p((o=o.apply(t,e||[])).next())}))}function o(t,e){var n,o,i,s,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function l(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=(i=r.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=e.call(t,r)}catch(t){s=[6,t],o=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}var i=function(t){return"[lit-popup] "+t},s=27,r="lit-popup--opening",l="lit-popup--closing",p="lit-popup--opened",u="open",c="open-complete",a="close",h="close-complete",f="destroy",d=function(t){var e=function(e){e.keyCode===s&&(e.preventDefault(),t.isOpen&&t.close())},n=function(){document.removeEventListener("keydown",e)};return t.on(u,(function(){document.addEventListener("keydown",e)})),t.on(a,n),function(){n()}},v={contextElement:document,plugins:[],innerContainerSelector:".lit-popup-container",onOpen:function(){},openAnimation:function(){return Promise.resolve()},onOpenComplete:function(){},onClose:function(){},closeAnimation:function(){return Promise.resolve()},onCloseComplete:function(){},onDestroy:function(){}};return function(){function s(n,o){var s=this;if(void 0===o&&(o={}),!n)throw new Error(i("Expected a name as a first argument."));this.options=e({},v,o),this.isOpen=!1;var r=this.options.contextElement.querySelector('[data-lit-popup="'+n+'"]');if(!r)throw new Error(i("Element not found."));this.el=r,this.listeners=[],this.innerContainer=this.el.querySelector(this.options.innerContainerSelector),this.plugins=[d].concat(this.options.plugins),this.pluginDestroyers=[],this.previousActiveElement=null,this.open=this.open.bind(this),this.close=this.close.bind(this),this.openDelegation=t(document,'[data-lit-popup-open="'+n+'"]',"click",this.open),this.closeDelegation=t(document,'[data-lit-popup-close="'+n+'"]',"click",this.close),this.pluginDestroyers=this.plugins.map((function(t){return t(s)}))}return s.prototype.destroy=function(){var t=this;this.options.onDestroy(this),this.trigger(f),this.openDelegation.destroy(),this.closeDelegation.destroy(),this.pluginDestroyers.forEach((function(t){return t()})),this.listeners.forEach((function(e){var n=e[0],o=e[1];return t.off(n,o)})),this.listeners=[],this.isOpen=!1,this.el=null,this.innerContainer=null,this.previousActiveElement=null},s.prototype.on=function(t,e){"destroy"===t?this.one(t,e):(this.el.addEventListener(t,e),this.listeners.push([t,e]))},s.prototype.one=function(t,e){!function(t,e,n){t.addEventListener(e,(function o(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];t.removeEventListener(e,o),n.apply(void 0,i)}))}(this.el,t,e)},s.prototype.off=function(t,e){this.el.removeEventListener(t,e)},s.prototype.trigger=function(t,e){!function(t,e,n){var o;if(void 0===n&&(n={}),CustomEvent)try{o=new CustomEvent(e,{detail:n})}catch(t){(o=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,n)}else(o=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,n);t.dispatchEvent(o)}(this.el,t,e)},s.prototype.setOpenAnimation=function(t){this.options.openAnimation=t},s.prototype.setCloseAnimation=function(t){this.options.closeAnimation=t},s.prototype.open=function(t){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return t&&t.preventDefault(),this.previousActiveElement=document.activeElement,this.isOpen=!0,this.el.classList.add(p,r),this.options.onOpen(this,t?t.target.closest("[data-lit-popup-open]"):void 0),this.trigger(u,{triggerElement:t?t.target.closest("[data-lit-popup-open]"):void 0}),[4,this.options.openAnimation(this)];case 1:return e.sent(),this.el.classList.remove(r),this.options.onOpenComplete(this,t?t.target.closest("[data-lit-popup-open]"):void 0),this.trigger(c,{triggerElement:t?t.target.closest("[data-lit-popup-open]"):void 0}),[2]}}))}))},s.prototype.close=function(t){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return t&&t.preventDefault(),this.el.classList.add(l),this.options.onClose(this,t?t.target.closest("[data-lit-popup-open]"):void 0),this.trigger(a,{triggerElement:t?t.target.closest("[data-lit-popup-open]"):void 0}),[4,this.options.closeAnimation(this)];case 1:return e.sent(),this.isOpen=!1,this.el.classList.remove(l),this.el.classList.remove(p),this.innerContainer&&this.innerContainer.scrollTo&&this.innerContainer.scrollTo(0,0),this.options.onCloseComplete(this,t?t.target.closest("[data-lit-popup-open]"):void 0),this.trigger(h,{triggerElement:t?t.target.closest("[data-lit-popup-open]"):void 0}),[2]}}))}))},s}()}(delegate);
import t from"delegate";var e=function(){return e=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},e.apply(this,arguments)};function n(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{p(o.next(t))}catch(t){r(t)}}function l(t){try{p(o.throw(t))}catch(t){r(t)}}function p(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,l)}p((o=o.apply(t,e||[])).next())}))}function o(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function l(r){return function(l){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1],i=r;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(r);break}i[2]&&s.ops.pop(),s.trys.pop();continue}r=e.call(t,s)}catch(t){r=[6,t],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,l])}}}var i=function(t){return"[lit-popup] ".concat(t)},r=27,s="lit-popup--opening",l="lit-popup--closing",p="lit-popup--opened",c="open",a="open-complete",u="close",h="close-complete",f="destroy",d=function(t){var e=function(e){e.keyCode===r&&(e.preventDefault(),t.isOpen&&t.close())},n=function(){document.removeEventListener("keydown",e)};return t.on(c,(function(){document.addEventListener("keydown",e)})),t.on(u,n),function(){n()}},v={contextElement:document,plugins:[],innerContainerSelector:".lit-popup-container",onOpen:function(){},openAnimation:function(){return Promise.resolve()},onOpenComplete:function(){},onClose:function(){},closeAnimation:function(){return Promise.resolve()},onCloseComplete:function(){},onDestroy:function(){}},m=function(){function r(n,o){void 0===o&&(o={});var r=this;if(!n)throw new Error(i("Expected a name as a first argument."));this.options=e(e({},v),o),this.isOpen=!1;var s=this.options.contextElement.querySelector('[data-lit-popup="'.concat(n,'"]'));if(!s)throw new Error(i("Element not found."));this.el=s,this.listeners=[],this.innerContainer=this.el.querySelector(this.options.innerContainerSelector),this.plugins=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))}([d],this.options.plugins,!0),this.pluginDestroyers=[],this.previousActiveElement=null,this.open=this.open.bind(this),this.close=this.close.bind(this),this.openDelegation=t(document,'[data-lit-popup-open="'.concat(n,'"]'),"click",this.open),this.closeDelegation=t(document,'[data-lit-popup-close="'.concat(n,'"]'),"click",this.close),this.pluginDestroyers=this.plugins.map((function(t){return t(r)}))}return r.prototype.destroy=function(){var t=this;this.options.onDestroy(this),this.trigger(f),this.openDelegation.destroy(),this.closeDelegation.destroy(),this.pluginDestroyers.forEach((function(t){return t()})),this.listeners.forEach((function(e){var n=e[0],o=e[1];return t.off(n,o)})),this.listeners=[],this.isOpen=!1,this.el=null,this.innerContainer=null,this.previousActiveElement=null},r.prototype.on=function(t,e){"destroy"===t?this.one(t,e):(this.el.addEventListener(t,e),this.listeners.push([t,e]))},r.prototype.one=function(t,e){!function(t,e,n){t.addEventListener(e,(function o(){for(var i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];t.removeEventListener(e,o),n.apply(void 0,i)}))}(this.el,t,e)},r.prototype.off=function(t,e){this.el.removeEventListener(t,e)},r.prototype.trigger=function(t,e){!function(t,e,n){var o;if(void 0===n&&(n={}),CustomEvent)try{o=new CustomEvent(e,{detail:n})}catch(t){(o=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,n)}else(o=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,n);t.dispatchEvent(o)}(this.el,t,e)},r.prototype.setOpenAnimation=function(t){this.options.openAnimation=t},r.prototype.setCloseAnimation=function(t){this.options.closeAnimation=t},r.prototype.open=function(t){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return t&&t.preventDefault(),this.previousActiveElement=document.activeElement,this.isOpen=!0,this.el.classList.add(p,s),this.options.onOpen(this,t?t.target.closest("[data-lit-popup-open]"):void 0),this.trigger(c,{triggerElement:t?t.target.closest("[data-lit-popup-open]"):void 0}),[4,this.options.openAnimation(this)];case 1:return e.sent(),this.el.classList.remove(s),this.options.onOpenComplete(this,t?t.target.closest("[data-lit-popup-open]"):void 0),this.trigger(a,{triggerElement:t?t.target.closest("[data-lit-popup-open]"):void 0}),[2]}}))}))},r.prototype.close=function(t){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return t&&t.preventDefault(),this.el.classList.add(l),this.options.onClose(this,t?t.target.closest("[data-lit-popup-open]"):void 0),this.trigger(u,{triggerElement:t?t.target.closest("[data-lit-popup-open]"):void 0}),[4,this.options.closeAnimation(this)];case 1:return e.sent(),this.isOpen=!1,this.el.classList.remove(l),this.el.classList.remove(p),this.innerContainer&&this.innerContainer.scrollTo&&this.innerContainer.scrollTo(0,0),this.options.onCloseComplete(this,t?t.target.closest("[data-lit-popup-open]"):void 0),this.trigger(h,{triggerElement:t?t.target.closest("[data-lit-popup-open]"):void 0}),[2]}}))}))},r}();export{m as default};

25

package.json
{
"name": "lit-popup",
"version": "1.4.1",
"version": "1.5.0",
"description": "A modern popup module with no dependencies.",

@@ -10,3 +10,2 @@ "repository": {

"main": "dist/index.js",
"module": "dist/esm/index.js",
"scripts": {

@@ -25,7 +24,8 @@ "prepare": "rimraf ./dist && rollup --config",

"devDependencies": {
"@rollup/plugin-node-resolve": "^13.3.0",
"@types/jest": "^24.0.17",
"@typescript-eslint/eslint-plugin": "^2.0.0",
"@typescript-eslint/parser": "^2.0.0",
"eslint": "^6.1.0",
"eslint-plugin-jest": "^22.15.1",
"@typescript-eslint/eslint-plugin": "^5.22.0",
"@typescript-eslint/parser": "^5.22.0",
"eslint": "^8.14.0",
"eslint-plugin-jest": "^26.1.5",
"eslint-config-prettier": "^6.1.0",

@@ -35,12 +35,11 @@ "eslint-plugin-prettier": "^3.1.0",

"prettier": "^1.18.2",
"rimraf": "^3.0.0",
"rollup": "^1.19.4",
"rollup-plugin-css-porter": "^1.0.2",
"rimraf": "^3.0.2",
"rollup": "^2.71.1",
"rollup-plugin-eslint": "^7.0.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-multi-input": "^1.3.1",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-terser": "^5.1.3",
"rollup-plugin-typescript2": "^0.22.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"ts-jest": "^24.0.2",
"typescript": "^3.5.3"
"typescript": "^4.6.4"
},

@@ -47,0 +46,0 @@ "peerDependencies": {

import typescript from 'rollup-plugin-typescript2';
import resolve from 'rollup-plugin-node-resolve';
import resolve from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import { eslint } from 'rollup-plugin-eslint';
// import css from 'rollup-plugin-css-porter';
import peerDepsExternal from 'rollup-plugin-peer-deps-external';

@@ -11,25 +10,18 @@ import pkg from './package.json';

// const external = [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})];
export default {
input: 'src/index.ts',
output: [
// {
// file: pkg.main,
// format: 'iife',
// name: 'LitPopup',
// },
{
file: pkg.main,
format: 'iife',
name: 'LitPopup',
},
{
file: pkg.module,
format: 'esm',
},
],
// external,
plugins: [
peerDepsExternal(),
resolve({ extensions }),
// css({
// raw: 'dist/css/lit-popup.css',
// minified: 'dist/css/lit-popup.min.css',
// }),
eslint(),

@@ -36,0 +28,0 @@ typescript({

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