New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

spon-draw

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spon-draw - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

2

dist/index.min.js

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

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.sponDraw=n()}(this,function(){"use strict";var t=function(t,n,i){var e=!1;return new Promise(function(o){i&&i(),n.addEventListener(t,function i(o,s){if(s.stopPropagation(),n.removeEventListener(t,i),s.target===n&&!e)return e=!0,void o()}.bind(null,o),!1)})},n=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])}return t};function i(t){if(Array.isArray(t)){for(var n=0,i=Array(t.length);n<t.length;n++)i[n]=t[n];return i}return Array.from(t)}return function e(){var o,s=this,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.defaults={openButton:"[data-menu-opener]",overlay:document.getElementById("site-menu"),contents:document.getElementById("menu-inner"),closeButton:"[data-menu-closer]",init:!1,buttonActiveClass:"is-active",overlayVisibleClass:"is-visible",overlayAnimationClass:"is-animating",transition:!0,animationType:"transition",name:"menu",before:null},this.FOCUSABLE_ELEMENTS=["a[href]","button:not([disabled]):not([aria-hidden]):not([data-menu-closer])"],this.isVisible=!1,this.isAnimating=!1,this.isInitialized=!1,this.setOptions=function(t){return s.options=n({},s.options,t),s},this._before=function(t){var n=s.options.before;return"function"==typeof n?new Promise(function(i){n(t,i)}):Promise.resolve()},this.addEvents=function(){var t=s.dom,n=t.openButton,i=t.closeButton,e=t.contents;return n.forEach(function(t){t.addEventListener("click",s.onClick),t.addEventListener("touchstart",s.onClick)}),i.forEach(function(t){t.addEventListener("click",s.onClick),t.addEventListener("touchstart",s.onClick)}),e&&e.addEventListener("click",s.blockClicks),document.addEventListener("keydown",s.onKeyDown),s},this.removeEvents=function(){var t=s.dom,n=t.openButton,i=t.closeButton,e=t.contents;return n.forEach(function(t){t.removeEventListener("click",s.onClick),t.removeEventListener("touchstart",s.onClick)}),i.forEach(function(t){t.removeEventListener("click",s.onClick),t.removeEventListener("touchstart",s.onClick)}),e&&e.removeEventListener("click",s.blockClicks),s},this.onClick=function(t){t.preventDefault(),s.isAnimating||(s.isAnimating=!0,s.$focus=document.activeElement,s.isVisible||(s.initialFocus=t.target),s._before({event:t,state:s.isVisible,dom:s.dom}).then(function(){s.isVisible?s.close():s.open()}))},this.$focus=null,this.onKeyDown=function(t){var n=t.keyCode;s.isVisible&&27===n&&s.close(),!s.isVisible&&32===n&&document.activeElement.hasAttribute("data-menu-opener")&&(s.$focus=document.activeElement,s.open())},this.blockClicks=function(t){t.stopPropagation()},this.open=function(){var n=s.options,i=n.buttonActiveClass,e=n.overlayVisibleClass,o=n.overlayAnimationClass,a=n.transition,r=s.dom,c=r.overlay,l=r.openButton,u=r.contents.querySelectorAll(s.FOCUSABLE_ELEMENTS);return u.length&&u[0].focus(),s.emit("open",{dom:s.dom}),l.forEach(function(t){t.setAttribute("aria-expanded",!0),t.classList.add(i)}),c.classList.add(e),c.setAttribute("aria-hidden",!1),a?(c.classList.add(o),t(s.animationEndEvents,c).then(s.onTransitionEnd)):(s.isVisible=!0,s.isAnimating=!1),s},this.close=function(){var n=s.dom.overlay,i=s.options.transition;return s.emit("close",{dom:s.dom}),s.reset(),s.$focus&&s.$focus.focus(),i?t(s.animationEndEvents,n).then(s.onTransitionEnd):(s.isVisible=!1,s.isAnimating=!1),s},this.reset=function(){var t=s.options,n=t.buttonActiveClass,i=t.overlayAnimationClass,e=t.overlayVisibleClass,o=s.dom,a=o.overlay;o.openButton.forEach(function(t){t.setAttribute("aria-expanded",!1),t.classList.remove(n)}),a.classList.remove(i,e),a.setAttribute("aria-hidden",!0)},this.onTransitionEnd=function(){var t=s.dom.overlay,n=s.options.overlayAnimationClass;s.isVisible=!s.isVisible,s.isAnimating=!1;var i=s.isVisible?"after:open":"after:close";s.emit(i,{dom:s.dom,state:s.isVisible}),t.classList.remove(n)},this.destroy=function(){if(s.isInitialized)return s.isInitialized=!1,s.isVisible=!1,s.isAnimating=!1,s.reset(),s.removeEvents(),s},this.init=function(){if(!s.isInitialized){s.isInitialized=!0;var t=s.options,n=t.contents,e=t.overlay,o=t.openButton,a=t.closeButton,r=t.animationType,c=t.name;s.animationEndEvents=function(){var t="transition"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transition")?{OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",transition:"transitionend"}:{OAnimation:"oAnimationEnd",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",animation:"animationend"},n=document.createElement("fake");return Object.keys(t).reduce(function(i,e){return void 0!==n.style[e]?t[e]:i},"")}(r),s.dom={html:document.getElementsByTagName("html")[0],body:document.body,openButton:[].concat(i(document.querySelectorAll(o))),closeButton:[].concat(i(document.querySelectorAll(a))),overlay:e,contents:n};var l=s.dom.openButton[0].getAttribute("id"),u=e.getAttribute("id");return s.dom.openButton.forEach(function(t){t.setAttribute("aria-expanded",!1),t.setAttribute("aria-label",c),t.setAttribute("aria-controls",u)}),e.setAttribute("aria-hidden",!0),l?e.setAttribute("aria-labelledby",l):console.warn("sponDraw: menu button should have an id"),s.addEvents(),s}},this.options=n({},this.defaults,a),this.options.init&&this.init(),Object.assign(this,(o=o||Object.create(null),{on:function(t,n){(o[t]||(o[t]=[])).push(n)},off:function(t,n){o[t]&&o[t].splice(o[t].indexOf(n)>>>0,1)},emit:function(t,n){(o[t]||[]).slice().map(function(t){t(n)}),(o["*"]||[]).slice().map(function(i){i(t,n)})}}))}});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.sponDraw=n()}(this,function(){"use strict";var t=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])}return t};function n(t){if(Array.isArray(t)){for(var n=0,i=Array(t.length);n<t.length;n++)i[n]=t[n];return i}return Array.from(t)}var i=function(t,n,i){var e=!1;return new Promise(function(o){i&&i(),n.addEventListener(t,function i(o,s){if(s.stopPropagation(),n.removeEventListener(t,i),s.target===n&&!e)return e=!0,void o()}.bind(null,o),!1)})};return function e(){var o,s=this,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.defaults={openButton:"[data-menu-opener]",overlay:document.getElementById("site-menu"),contents:document.getElementById("menu-inner"),closeButton:"[data-menu-closer]",init:!1,buttonActiveClass:"is-active",overlayVisibleClass:"is-visible",overlayAnimationClass:"is-animating",transition:!0,animationType:"transition",name:"menu",before:null},this.FOCUSABLE_ELEMENTS=["a[href]","button:not([disabled]):not([aria-hidden]):not([data-menu-closer])"],this.isVisible=!1,this.isAnimating=!1,this.isInitialized=!1,this.setOptions=function(n){return s.options=t({},s.options,n),s},this._before=function(t){var n=s.options.before;return"function"==typeof n?new Promise(function(i){n(t,i)}):Promise.resolve()},this.addEvents=function(){var t=s.dom,n=t.openButton,i=t.closeButton,e=t.contents;return n.forEach(function(t){t.addEventListener("click",s.onClick),t.addEventListener("touchstart",s.onClick)}),i.forEach(function(t){t.addEventListener("click",s.onClick),t.addEventListener("touchstart",s.onClick)}),e&&e.addEventListener("click",s.blockClicks),document.addEventListener("keydown",s.onKeyDown),s},this.removeEvents=function(){var t=s.dom,n=t.openButton,i=t.closeButton,e=t.contents;return n.forEach(function(t){t.removeEventListener("click",s.onClick),t.removeEventListener("touchstart",s.onClick)}),i.forEach(function(t){t.removeEventListener("click",s.onClick),t.removeEventListener("touchstart",s.onClick)}),e&&e.removeEventListener("click",s.blockClicks),s},this.onClick=function(t){t.preventDefault(),s.isAnimating||(s.isAnimating=!0,s.$focus=document.activeElement,s.isVisible||(s.initialFocus=t.target),s._before({event:t,state:s.isVisible,dom:s.dom}).then(function(){s.isVisible?s.close():s.open()}))},this.$focus=null,this.onKeyDown=function(t){var n=t.keyCode;s.isVisible&&27===n&&s.close(),!s.isVisible&&32===n&&document.activeElement.hasAttribute("data-menu-opener")&&(s.$focus=document.activeElement,s.open())},this.blockClicks=function(t){t.stopPropagation()},this.open=function(){var t=s.options,n=t.buttonActiveClass,e=t.overlayVisibleClass,o=t.overlayAnimationClass,a=t.transition,r=s.dom,c=r.overlay,l=r.openButton,u=r.contents.querySelectorAll(s.FOCUSABLE_ELEMENTS);return u.length&&u[0].focus(),s.emit("open",{dom:s.dom}),l.forEach(function(t){t.setAttribute("aria-expanded",!0),t.classList.add(n)}),c.classList.add(e),c.setAttribute("aria-hidden",!1),a?(c.classList.add(o),i(s.animationEndEvents,c).then(s.onTransitionEnd)):(s.isVisible=!0,s.isAnimating=!1),s},this.close=function(){var t=s.dom.overlay,n=s.options.transition;return s.emit("close",{dom:s.dom}),s.reset(),s.$focus&&s.$focus.focus(),n?i(s.animationEndEvents,t).then(s.onTransitionEnd):(s.isVisible=!1,s.isAnimating=!1),s},this.reset=function(){var t=s.options,n=t.buttonActiveClass,i=t.overlayAnimationClass,e=t.overlayVisibleClass,o=s.dom,a=o.overlay;o.openButton.forEach(function(t){t.setAttribute("aria-expanded",!1),t.classList.remove(n)}),a.classList.remove(i,e),a.setAttribute("aria-hidden",!0)},this.onTransitionEnd=function(){var t=s.dom.overlay,n=s.options.overlayAnimationClass;s.isVisible=!s.isVisible,s.isAnimating=!1;var i=s.isVisible?"after:open":"after:close";s.emit(i,{dom:s.dom,state:s.isVisible}),t.classList.remove(n)},this.destroy=function(){if(s.isInitialized)return s.isInitialized=!1,s.isVisible=!1,s.isAnimating=!1,s.reset(),s.removeEvents(),s},this.init=function(){if(!s.isInitialized){s.isInitialized=!0;var t=s.options,i=t.contents,e=t.overlay,o=t.openButton,a=t.closeButton,r=t.animationType,c=t.name;s.animationEndEvents=function(){var t="transition"===(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transition")?{OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",transition:"transitionend"}:{OAnimation:"oAnimationEnd",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",animation:"animationend"},n=document.createElement("fake");return Object.keys(t).reduce(function(i,e){return void 0!==n.style[e]?t[e]:i},"")}(r),s.dom={html:document.getElementsByTagName("html")[0],body:document.body,openButton:[].concat(n(document.querySelectorAll(o))),closeButton:[].concat(n(document.querySelectorAll(a))),overlay:e,contents:i};var l=s.dom.openButton[0].getAttribute("id"),u=e.getAttribute("id");return s.dom.openButton.forEach(function(t){t.setAttribute("aria-expanded",!1),t.setAttribute("aria-label",c),t.setAttribute("aria-controls",u)}),e.setAttribute("aria-hidden",!0),l?e.setAttribute("aria-labelledby",l):console.warn("sponDraw: menu button should have an id"),s.addEvents(),s}},this.options=t({},this.defaults,a),this.options.init&&this.init(),Object.assign(this,(o=o||Object.create(null),{on:function(t,n){(o[t]||(o[t]=[])).push(n)},off:function(t,n){o[t]&&o[t].splice(o[t].indexOf(n)>>>0,1)},emit:function(t,n){(o[t]||[]).slice().map(function(t){t(n)}),(o["*"]||[]).slice().map(function(i){i(t,n)})}}))}});
{
"name": "spon-draw",
"version": "0.0.4",
"version": "0.0.5",
"main": "dist/index.min.js",

@@ -5,0 +5,0 @@ "devDependencies": {

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