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

dragula

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dragula - npm Package Compare versions

Comparing version 3.0.6 to 3.0.7

2

bower.json
{
"name": "dragula.js",
"version": "3.0.6",
"version": "3.0.7",
"description": "Drag and drop so simple it hurts",

@@ -5,0 +5,0 @@ "main": [

@@ -733,2 +733,8 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.dragula = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

module.exports = {
add: addEvent,
remove: removeEvent,
fabricate: fabricateEvent
};
function addEventEasy (el, type, fn, capturing) {

@@ -838,2 +844,2 @@ return el.addEventListener(type, fn, capturing);

});
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJjbGFzc2VzLmpzIiwiZHJhZ3VsYS5qcyIsIm5vZGVfbW9kdWxlcy9jb250cmEvZGVib3VuY2UuanMiLCJub2RlX21vZHVsZXMvY29udHJhL2VtaXR0ZXIuanMiLCJ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HJldHVybiB3cmFwcGVyO1xufVxuXG5mdW5jdGlvbiB1bndyYXAgKGVsLCB0eXBlLCBmbikge1xuICB2YXIgaSA9IGZpbmQoZWwsIHR5cGUsIGZuKTtcbiAgaWYgKGkpIHtcbiAgICB2YXIgd3JhcHBlciA9IGhhcmRDYWNoZVtpXS53cmFwcGVyO1xuICAgIGhhcmRDYWNoZS5zcGxpY2UoaSwgMSk7IC8vIGZyZWUgdXAgYSB0YWQgb2YgbWVtb3J5XG4gICAgcmV0dXJuIHdyYXBwZXI7XG4gIH1cbn1cblxuZnVuY3Rpb24gZmluZCAoZWwsIHR5cGUsIGZuKSB7XG4gIHZhciBpLCBpdGVtO1xuICBmb3IgKGkgPSAwOyBpIDwgaGFyZENhY2hlLmxlbmd0aDsgaSsrKSB7XG4gICAgaXRlbSA9IGhhcmRDYWNoZVtpXTtcbiAgICBpZiAoaXRlbS5lbGVtZW50ID09PSBlbCAmJiBpdGVtLnR5cGUgPT09IHR5cGUgJiYgaXRlbS5mbiA9PT0gZm4pIHtcbiAgICAgIHJldHVybiBpO1xuICAgIH1cbiAgfVxufVxuIiwiJ3VzZSBzdHJpY3QnO1xuXG52YXIgZXZlbnRtYXAgPSBbXTtcbnZhciBldmVudG5hbWUgPSAnJztcbnZhciByb24gPSAvXm9uLztcblxuZm9yIChldmVudG5hbWUgaW4gZ2xvYmFsKSB7XG4gIGlmIChyb24udGVzdChldmVudG5hbWUpKSB7XG4gICAgZXZlbnRtYXAucHVzaChldmVudG5hbWUuc2xpY2UoMikpO1xuICB9XG59XG5cbm1vZHVsZS5leHBvcnRzID0gZXZlbnRtYXA7XG4iXX0=

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

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.dragula=e()}}(function(){return function e(n,t,r){function o(u,a){if(!t[u]){if(!n[u]){var c="function"==typeof require&&require;if(!a&&c)return c(u,!0);if(i)return i(u,!0);var l=new Error("Cannot find module '"+u+"'");throw l.code="MODULE_NOT_FOUND",l}var f=t[u]={exports:{}};n[u][0].call(f.exports,function(e){var t=n[u][1][e];return o(t?t:e)},f,f.exports,e,n,t,r)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,n,t){"use strict";function r(e){var n=u[e];return n?n.lastIndex=0:u[e]=n=new RegExp(a+e+c,"g"),n}function o(e,n){var t=e.className;t.length?r(n).test(t)||(e.className+=" "+n):e.className=n}function i(e,n){e.className=e.className.replace(r(n)," ").trim()}var u={},a="(?:^|\\s)",c="(?:\\s|$)";n.exports={add:o,rm:i}},{}],2:[function(e,n,t){(function(t){"use strict";function r(e,n){function t(e){return-1!==te.containers.indexOf(e)||ne.isContainer(e)}function r(e){var n=e?"remove":"add";o(Z,n,"mousedown",b),o(Z,n,"mouseup",T)}function u(e){var n=e?"remove":"add";o(Z,n,"mousemove",w)}function d(e){var n=e?"remove":"add";o(Z,n,"selectstart",y),o(Z,n,"click",y)}function g(){r(!0),T({})}function y(e){Q&&e.preventDefault()}function b(e){var n=0!==e.which&&1!==e.which||e.metaKey||e.ctrlKey;if(!n){var t=e.target,r=E(t);r&&(Q=r,u(),"mousedown"===e.type&&(e.preventDefault(),("INPUT"===t.tagName||"TEXTAREA"===t.tagName)&&t.focus()))}}function w(e){u(!0),d(),N(),C(Q);var n=i(K);z=s("pageX",e)-n.left,H=s("pageY",e)-n.top,h.add(G||K,"gu-transit"),k(),A(e)}function E(e){if(!(te.dragging&&j||t(e))){for(var n=e;e.parentElement&&t(e.parentElement)===!1;){if(ne.invalid(e,n))return;if(e=e.parentElement,!e)return}var r=e.parentElement;if(r&&!ne.invalid(e,n)){var o=ne.moves(e,r,n);if(o)return{item:e,source:r}}}}function x(e){var n=E(e);n&&C(n)}function C(e){ne.copy&&(G=e.item.cloneNode(!0),te.emit("cloned",G,e.item,"copy")),F=e.source,K=e.item,V=$=f(e.item),te.dragging=!0,te.emit("drag",K,F)}function O(){return!1}function N(){if(te.dragging){var e=G||K;B(e,e.parentElement)}}function S(){Q=!1,u(!0),d(!0)}function T(e){if(S(),te.dragging){var n=G||K,t=s("clientX",e),r=s("clientY",e),o=a(j,t,r),i=Y(o,t,r);!i||ne.copy!==!1&&i===F?ne.removeOnSpill?D():P():B(n,i)}}function B(e,n){R(n)?te.emit("cancel",e,F):te.emit("drop",e,n,F),X()}function D(){if(te.dragging){var e=G||K,n=e.parentElement;n&&n.removeChild(e),te.emit(ne.copy?"cancel":"remove",e,n),X()}}function P(e){if(te.dragging){var n=arguments.length>0?e:ne.revertOnSpill,t=G||K,r=t.parentElement;r===F&&ne.copy&&r.removeChild(G);var o=R(r);o===!1&&ne.copy===!1&&n&&F.insertBefore(t,V),o||n?te.emit("cancel",t,F):te.emit("drop",t,r,F),X()}}function X(){var e=G||K;S(),q(),e&&h.rm(e,"gu-transit"),J&&clearTimeout(J),te.dragging=!1,te.emit("out",e,ee,F),te.emit("dragend",e),F=K=G=V=$=J=ee=null}function R(e,n){var t;return t=void 0!==n?n:j?$:f(G||K),e===F&&t===V}function Y(e,n,r){function o(){var o=t(i);if(o===!1)return!1;var u=I(i,e),a=U(i,u,n,r),c=R(i,a);return c?!0:ne.accepts(K,i,F,a)}for(var i=e;i&&!o();)i=i.parentElement;return i}function A(e){function n(e){te.emit(e,l,ee,F)}function t(){m&&n("over")}function r(){ee&&n("out")}if(j){e.preventDefault();var o=s("clientX",e),i=s("clientY",e),u=o-z,c=i-H;j.style.left=u+"px",j.style.top=c+"px";var l=G||K,d=a(j,o,i),v=Y(d,o,i),m=null!==v&&v!==ee;if((m||null===v)&&(r(),ee=v,t()),v===F&&ne.copy)return void(l.parentElement&&l.parentElement.removeChild(l));var p,g=I(v,d);if(null!==g)p=U(v,g,o,i);else{if(ne.revertOnSpill!==!0||ne.copy)return void(ne.copy&&l.parentElement&&l.parentElement.removeChild(l));p=V,v=F}(null===p||p!==l&&p!==f(l)&&p!==$)&&($=p,v.insertBefore(l,p),te.emit("shadow",l,v))}}function L(e){h.rm(e,"gu-hide")}function M(e){te.dragging&&h.add(e,"gu-hide")}function k(){if(!j){var e=K.getBoundingClientRect();j=K.cloneNode(!0),j.style.width=v(e)+"px",j.style.height=m(e)+"px",h.rm(j,"gu-transit"),h.add(j,"gu-mirror"),ne.mirrorContainer.appendChild(j),o(Z,"add","mousemove",A),h.add(ne.mirrorContainer,"gu-unselectable"),te.emit("cloned",j,K,"mirror")}}function q(){j&&(h.rm(ne.mirrorContainer,"gu-unselectable"),o(Z,"remove","mousemove",A),j.parentElement.removeChild(j),j=null)}function I(e,n){for(var t=n;t!==e&&t.parentElement!==e;)t=t.parentElement;return t===Z?null:t}function U(e,n,t,r){function o(){var n,o,i,u=e.children.length;for(n=0;u>n;n++){if(o=e.children[n],i=o.getBoundingClientRect(),a&&i.left>t)return o;if(!a&&i.top>r)return o}return null}function i(){var e=n.getBoundingClientRect();return u(a?t>e.left+v(e)/2:r>e.top+m(e)/2)}function u(e){return e?f(n):n}var a="horizontal"===ne.direction,c=n!==e?i():o();return c}var _=arguments.length;1===_&&Array.isArray(e)===!1&&(n=e,e=[]);var j,F,K,z,H,V,$,G,J,Q,W=document.body,Z=document.documentElement,ee=null,ne=n||{};void 0===ne.moves&&(ne.moves=l),void 0===ne.accepts&&(ne.accepts=l),void 0===ne.invalid&&(ne.invalid=O),void 0===ne.containers&&(ne.containers=e||[]),void 0===ne.isContainer&&(ne.isContainer=c),void 0===ne.copy&&(ne.copy=!1),void 0===ne.revertOnSpill&&(ne.revertOnSpill=!1),void 0===ne.removeOnSpill&&(ne.removeOnSpill=!1),void 0===ne.direction&&(ne.direction="vertical"),void 0===ne.mirrorContainer&&(ne.mirrorContainer=W);var te=p({containers:ne.containers,start:x,end:N,cancel:P,remove:D,destroy:g,dragging:!1});return ne.removeOnSpill===!0&&te.on("over",L).on("out",M),r(),te}function o(e,n,r,o){var i={mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"},u={mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"};t.navigator.msPointerEnabled&&g[n](e,u[r],o),g[n](e,i[r],o),g[n](e,r,o)}function i(e){var n=e.getBoundingClientRect();return{left:n.left+u("scrollLeft","pageXOffset"),top:n.top+u("scrollTop","pageYOffset")}}function u(e,n){if("undefined"!=typeof t[n])return t[n];var r=document.documentElement;if(r.clientHeight)return r[e];var o=document.body;return o[e]}function a(e,n,t){var r,o=e||{},i=o.className;return o.className+=" gu-hide",r=document.elementFromPoint(n,t),o.className=i,r}function c(){return!1}function l(){return!0}function f(e){function n(){var n=e;do n=n.nextSibling;while(n&&1!==n.nodeType);return n}return e.nextElementSibling||n()}function d(e){return e.targetTouches&&e.targetTouches.length?e.targetTouches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}function s(e,n){var t=d(n),r={pageX:"clientX",pageY:"clientY"};return e in r&&!(e in t)&&r[e]in t&&(e=r[e]),t[e]}function v(e){return e.width||e.right-e.left}function m(e){return e.height||e.bottom-e.top}var p=e("contra/emitter"),g=e("crossvent"),h=e("./classes");n.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./classes":1,"contra/emitter":4,crossvent:8}],3:[function(e,n,t){"use strict";var r=e("ticky");n.exports=function(e,n,t){e&&r(function(){e.apply(t||null,n||[])})}},{ticky:6}],4:[function(e,n,t){"use strict";var r=e("atoa"),o=e("./debounce");n.exports=function(e,n){var t=n||{},i={};return void 0===e&&(e={}),e.on=function(n,t){return i[n]?i[n].push(t):i[n]=[t],e},e.once=function(n,t){return t._once=!0,e.on(n,t),e},e.off=function(n,t){var r=arguments.length;if(1===r)delete i[n];else if(0===r)i={};else{var o=i[n];if(!o)return e;o.splice(o.indexOf(t),1)}return e},e.emit=function(){var n=r(arguments);return e.emitterSnapshot(n.shift()).apply(this,n)},e.emitterSnapshot=function(n){var u=(i[n]||[]).slice(0);return function(){var i=r(arguments),a=this||e;if("error"===n&&t["throws"]!==!1&&!u.length)throw 1===i.length?i[0]:i;return u.forEach(function(r){t.async?o(r,i,a):r.apply(a,i),r._once&&e.off(n,r)}),e}},e}},{"./debounce":3,atoa:5}],5:[function(e,n,t){n.exports=function(e,n){return Array.prototype.slice.call(e,n)}},{}],6:[function(e,n,t){var r,o="function"==typeof setImmediate;r=o?function(e){setImmediate(e)}:function(e){setTimeout(e,0)},n.exports=r},{}],7:[function(e,n,t){(function(e){function t(){try{var e=new r("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(n){}return!1}var r=e.CustomEvent;n.exports=t()?r:"function"==typeof document.createEvent?function(e,n){var t=document.createEvent("CustomEvent");return n?t.initCustomEvent(e,n.bubbles,n.cancelable,n.detail):t.initCustomEvent(e,!1,!1,void 0),t}:function(e,n){var t=document.createEventObject();return t.type=e,n?(t.bubbles=Boolean(n.bubbles),t.cancelable=Boolean(n.cancelable),t.detail=n.detail):(t.bubbles=!1,t.cancelable=!1,t.detail=void 0),t}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],8:[function(e,n,t){(function(n){"use strict";function t(e,n,t,r){return e.addEventListener(n,t,r)}function r(e,n,t){return e.attachEvent("on"+n,a(e,n,t))}function o(e,n,t,r){return e.removeEventListener(n,t,r)}function i(e,n,t){var r=c(e,n,t);return r?e.detachEvent("on"+n,r):void 0}function u(e,t,r){return function(t){var o=t||n.event;o.target=o.target||o.srcElement,o.preventDefault=o.preventDefault||function(){o.returnValue=!1},o.stopPropagation=o.stopPropagation||function(){o.cancelBubble=!0},o.which=o.which||o.keyCode,r.call(e,o)}}function a(e,n,t){var r=c(e,n,t)||u(e,n,t);return s.push({wrapper:r,element:e,type:n,fn:t}),r}function c(e,n,t){var r=l(e,n,t);if(r){var o=s[r].wrapper;return s.splice(r,1),o}}function l(e,n,t){var r,o;for(r=0;r<s.length;r++)if(o=s[r],o.element===e&&o.type===n&&o.fn===t)return r}var f=(e("custom-event"),e("./eventmap"),n.document,t),d=o,s=[];n.addEventListener||(f=r,d=i)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./eventmap":9,"custom-event":7}],9:[function(e,n,t){(function(e){"use strict";var t=[],r="",o=/^on/;for(r in e)o.test(r)&&t.push(r.slice(2));n.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[2])(2)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.dragula=e()}}(function(){return function e(n,t,r){function o(u,a){if(!t[u]){if(!n[u]){var c="function"==typeof require&&require;if(!a&&c)return c(u,!0);if(i)return i(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var l=t[u]={exports:{}};n[u][0].call(l.exports,function(e){var t=n[u][1][e];return o(t?t:e)},l,l.exports,e,n,t,r)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,n,t){"use strict";function r(e){var n=u[e];return n?n.lastIndex=0:u[e]=n=new RegExp(a+e+c,"g"),n}function o(e,n){var t=e.className;t.length?r(n).test(t)||(e.className+=" "+n):e.className=n}function i(e,n){e.className=e.className.replace(r(n)," ").trim()}var u={},a="(?:^|\\s)",c="(?:\\s|$)";n.exports={add:o,rm:i}},{}],2:[function(e,n,t){(function(t){"use strict";function r(e,n){function t(e){return-1!==te.containers.indexOf(e)||ne.isContainer(e)}function r(e){var n=e?"remove":"add";o(Z,n,"mousedown",E),o(Z,n,"mouseup",T)}function u(e){var n=e?"remove":"add";o(Z,n,"mousemove",b)}function d(e){var n=e?"remove":"add";o(Z,n,"selectstart",y),o(Z,n,"click",y)}function g(){r(!0),T({})}function y(e){Q&&e.preventDefault()}function E(e){var n=0!==e.which&&1!==e.which||e.metaKey||e.ctrlKey;if(!n){var t=e.target,r=w(t);r&&(Q=r,u(),"mousedown"===e.type&&(e.preventDefault(),("INPUT"===t.tagName||"TEXTAREA"===t.tagName)&&t.focus()))}}function b(e){u(!0),d(),N(),C(Q);var n=i(K);z=s("pageX",e)-n.left,H=s("pageY",e)-n.top,h.add(G||K,"gu-transit"),j(),A(e)}function w(e){if(!(te.dragging&&_||t(e))){for(var n=e;e.parentElement&&t(e.parentElement)===!1;){if(ne.invalid(e,n))return;if(e=e.parentElement,!e)return}var r=e.parentElement;if(r&&!ne.invalid(e,n)){var o=ne.moves(e,r,n);if(o)return{item:e,source:r}}}}function x(e){var n=w(e);n&&C(n)}function C(e){ne.copy&&(G=e.item.cloneNode(!0),te.emit("cloned",G,e.item,"copy")),F=e.source,K=e.item,V=$=l(e.item),te.dragging=!0,te.emit("drag",K,F)}function O(){return!1}function N(){if(te.dragging){var e=G||K;B(e,e.parentElement)}}function S(){Q=!1,u(!0),d(!0)}function T(e){if(S(),te.dragging){var n=G||K,t=s("clientX",e),r=s("clientY",e),o=a(_,t,r),i=Y(o,t,r);!i||ne.copy!==!1&&i===F?ne.removeOnSpill?D():P():B(n,i)}}function B(e,n){R(n)?te.emit("cancel",e,F):te.emit("drop",e,n,F),X()}function D(){if(te.dragging){var e=G||K,n=e.parentElement;n&&n.removeChild(e),te.emit(ne.copy?"cancel":"remove",e,n),X()}}function P(e){if(te.dragging){var n=arguments.length>0?e:ne.revertOnSpill,t=G||K,r=t.parentElement;r===F&&ne.copy&&r.removeChild(G);var o=R(r);o===!1&&ne.copy===!1&&n&&F.insertBefore(t,V),o||n?te.emit("cancel",t,F):te.emit("drop",t,r,F),X()}}function X(){var e=G||K;S(),k(),e&&h.rm(e,"gu-transit"),J&&clearTimeout(J),te.dragging=!1,te.emit("out",e,ee,F),te.emit("dragend",e),F=K=G=V=$=J=ee=null}function R(e,n){var t;return t=void 0!==n?n:_?$:l(G||K),e===F&&t===V}function Y(e,n,r){function o(){var o=t(i);if(o===!1)return!1;var u=q(i,e),a=I(i,u,n,r),c=R(i,a);return c?!0:ne.accepts(K,i,F,a)}for(var i=e;i&&!o();)i=i.parentElement;return i}function A(e){function n(e){te.emit(e,f,ee,F)}function t(){m&&n("over")}function r(){ee&&n("out")}if(_){e.preventDefault();var o=s("clientX",e),i=s("clientY",e),u=o-z,c=i-H;_.style.left=u+"px",_.style.top=c+"px";var f=G||K,d=a(_,o,i),v=Y(d,o,i),m=null!==v&&v!==ee;if((m||null===v)&&(r(),ee=v,t()),v===F&&ne.copy)return void(f.parentElement&&f.parentElement.removeChild(f));var p,g=q(v,d);if(null!==g)p=I(v,g,o,i);else{if(ne.revertOnSpill!==!0||ne.copy)return void(ne.copy&&f.parentElement&&f.parentElement.removeChild(f));p=V,v=F}(null===p||p!==f&&p!==l(f)&&p!==$)&&($=p,v.insertBefore(f,p),te.emit("shadow",f,v))}}function L(e){h.rm(e,"gu-hide")}function M(e){te.dragging&&h.add(e,"gu-hide")}function j(){if(!_){var e=K.getBoundingClientRect();_=K.cloneNode(!0),_.style.width=v(e)+"px",_.style.height=m(e)+"px",h.rm(_,"gu-transit"),h.add(_,"gu-mirror"),ne.mirrorContainer.appendChild(_),o(Z,"add","mousemove",A),h.add(ne.mirrorContainer,"gu-unselectable"),te.emit("cloned",_,K,"mirror")}}function k(){_&&(h.rm(ne.mirrorContainer,"gu-unselectable"),o(Z,"remove","mousemove",A),_.parentElement.removeChild(_),_=null)}function q(e,n){for(var t=n;t!==e&&t.parentElement!==e;)t=t.parentElement;return t===Z?null:t}function I(e,n,t,r){function o(){var n,o,i,u=e.children.length;for(n=0;u>n;n++){if(o=e.children[n],i=o.getBoundingClientRect(),a&&i.left>t)return o;if(!a&&i.top>r)return o}return null}function i(){var e=n.getBoundingClientRect();return u(a?t>e.left+v(e)/2:r>e.top+m(e)/2)}function u(e){return e?l(n):n}var a="horizontal"===ne.direction,c=n!==e?i():o();return c}var U=arguments.length;1===U&&Array.isArray(e)===!1&&(n=e,e=[]);var _,F,K,z,H,V,$,G,J,Q,W=document.body,Z=document.documentElement,ee=null,ne=n||{};void 0===ne.moves&&(ne.moves=f),void 0===ne.accepts&&(ne.accepts=f),void 0===ne.invalid&&(ne.invalid=O),void 0===ne.containers&&(ne.containers=e||[]),void 0===ne.isContainer&&(ne.isContainer=c),void 0===ne.copy&&(ne.copy=!1),void 0===ne.revertOnSpill&&(ne.revertOnSpill=!1),void 0===ne.removeOnSpill&&(ne.removeOnSpill=!1),void 0===ne.direction&&(ne.direction="vertical"),void 0===ne.mirrorContainer&&(ne.mirrorContainer=W);var te=p({containers:ne.containers,start:x,end:N,cancel:P,remove:D,destroy:g,dragging:!1});return ne.removeOnSpill===!0&&te.on("over",L).on("out",M),r(),te}function o(e,n,r,o){var i={mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"},u={mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"};t.navigator.msPointerEnabled&&g[n](e,u[r],o),g[n](e,i[r],o),g[n](e,r,o)}function i(e){var n=e.getBoundingClientRect();return{left:n.left+u("scrollLeft","pageXOffset"),top:n.top+u("scrollTop","pageYOffset")}}function u(e,n){if("undefined"!=typeof t[n])return t[n];var r=document.documentElement;if(r.clientHeight)return r[e];var o=document.body;return o[e]}function a(e,n,t){var r,o=e||{},i=o.className;return o.className+=" gu-hide",r=document.elementFromPoint(n,t),o.className=i,r}function c(){return!1}function f(){return!0}function l(e){function n(){var n=e;do n=n.nextSibling;while(n&&1!==n.nodeType);return n}return e.nextElementSibling||n()}function d(e){return e.targetTouches&&e.targetTouches.length?e.targetTouches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}function s(e,n){var t=d(n),r={pageX:"clientX",pageY:"clientY"};return e in r&&!(e in t)&&r[e]in t&&(e=r[e]),t[e]}function v(e){return e.width||e.right-e.left}function m(e){return e.height||e.bottom-e.top}var p=e("contra/emitter"),g=e("crossvent"),h=e("./classes");n.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./classes":1,"contra/emitter":4,crossvent:8}],3:[function(e,n,t){"use strict";var r=e("ticky");n.exports=function(e,n,t){e&&r(function(){e.apply(t||null,n||[])})}},{ticky:6}],4:[function(e,n,t){"use strict";var r=e("atoa"),o=e("./debounce");n.exports=function(e,n){var t=n||{},i={};return void 0===e&&(e={}),e.on=function(n,t){return i[n]?i[n].push(t):i[n]=[t],e},e.once=function(n,t){return t._once=!0,e.on(n,t),e},e.off=function(n,t){var r=arguments.length;if(1===r)delete i[n];else if(0===r)i={};else{var o=i[n];if(!o)return e;o.splice(o.indexOf(t),1)}return e},e.emit=function(){var n=r(arguments);return e.emitterSnapshot(n.shift()).apply(this,n)},e.emitterSnapshot=function(n){var u=(i[n]||[]).slice(0);return function(){var i=r(arguments),a=this||e;if("error"===n&&t["throws"]!==!1&&!u.length)throw 1===i.length?i[0]:i;return u.forEach(function(r){t.async?o(r,i,a):r.apply(a,i),r._once&&e.off(n,r)}),e}},e}},{"./debounce":3,atoa:5}],5:[function(e,n,t){n.exports=function(e,n){return Array.prototype.slice.call(e,n)}},{}],6:[function(e,n,t){var r,o="function"==typeof setImmediate;r=o?function(e){setImmediate(e)}:function(e){setTimeout(e,0)},n.exports=r},{}],7:[function(e,n,t){(function(e){function t(){try{var e=new r("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(n){}return!1}var r=e.CustomEvent;n.exports=t()?r:"function"==typeof document.createEvent?function(e,n){var t=document.createEvent("CustomEvent");return n?t.initCustomEvent(e,n.bubbles,n.cancelable,n.detail):t.initCustomEvent(e,!1,!1,void 0),t}:function(e,n){var t=document.createEventObject();return t.type=e,n?(t.bubbles=Boolean(n.bubbles),t.cancelable=Boolean(n.cancelable),t.detail=n.detail):(t.bubbles=!1,t.cancelable=!1,t.detail=void 0),t}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],8:[function(e,n,t){(function(t){"use strict";function r(e,n,t,r){return e.addEventListener(n,t,r)}function o(e,n,t){return e.attachEvent("on"+n,f(e,n,t))}function i(e,n,t,r){return e.removeEventListener(n,t,r)}function u(e,n,t){var r=l(e,n,t);return r?e.detachEvent("on"+n,r):void 0}function a(e,n,t){function r(){var e;return m.createEvent?(e=m.createEvent("Event"),e.initEvent(n,!0,!0)):m.createEventObject&&(e=m.createEventObject()),e}function o(){return new s(n,{detail:t})}var i=-1===v.indexOf(n)?o():r();e.dispatchEvent?e.dispatchEvent(i):e.fireEvent("on"+n,i)}function c(e,n,r){return function(n){var o=n||t.event;o.target=o.target||o.srcElement,o.preventDefault=o.preventDefault||function(){o.returnValue=!1},o.stopPropagation=o.stopPropagation||function(){o.cancelBubble=!0},o.which=o.which||o.keyCode,r.call(e,o)}}function f(e,n,t){var r=l(e,n,t)||c(e,n,t);return h.push({wrapper:r,element:e,type:n,fn:t}),r}function l(e,n,t){var r=d(e,n,t);if(r){var o=h[r].wrapper;return h.splice(r,1),o}}function d(e,n,t){var r,o;for(r=0;r<h.length;r++)if(o=h[r],o.element===e&&o.type===n&&o.fn===t)return r}var s=e("custom-event"),v=e("./eventmap"),m=t.document,p=r,g=i,h=[];t.addEventListener||(p=o,g=u),n.exports={add:p,remove:g,fabricate:a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./eventmap":9,"custom-event":7}],9:[function(e,n,t){(function(e){"use strict";var t=[],r="",o=/^on/;for(r in e)o.test(r)&&t.push(r.slice(2));n.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[2])(2)});
{
"name": "dragula",
"version": "3.0.6",
"version": "3.0.7",
"description": "Drag and drop so simple it hurts",

@@ -32,3 +32,3 @@ "main": "dragula.js",

"contra": "1.9.1",
"crossvent": "1.5.3"
"crossvent": "1.5.4"
},

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

Sorry, the diff of this file is not supported yet

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