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 1.2.4 to 1.3.0

2

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

@@ -5,0 +5,0 @@ "main": "dist/dragula.js",

@@ -30,2 +30,3 @@ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.dragula=e()}}(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){

var api = emitter({
end: end,
cancel: cancel,

@@ -109,2 +110,10 @@ remove: remove,

function end () {
if (!_dragging) {
return;
}
var item = _copy || _item;
drop(item, item.parentElement);
}
function release (e) {

@@ -121,3 +130,3 @@ if (!_dragging) {

if (dropTarget && (o.copy === false || dropTarget !== _source)) {
drop();
drop(item, dropTarget);
} else if (o.removeOnSpill) {

@@ -128,11 +137,11 @@ remove();

}
}
function drop () {
if (isInitialPlacement(dropTarget)) {
api.emit('cancel', item, _source);
} else {
api.emit('drop', item, dropTarget, _source);
}
cleanup();
function drop (item, target) {
if (isInitialPlacement(target)) {
api.emit('cancel', item, _source);
} else {
api.emit('drop', item, target, _source);
}
cleanup();
}

@@ -622,2 +631,2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gIH1cbn1cblxuZnVuY3Rpb24gZmluZCAoZWwsIHR5cGUsIGZuKSB7XG4gIHZhciBpLCBpdGVtO1xuICBmb3IgKGkgPSAwOyBpIDwgaGFyZENhY2hlLmxlbmd0aDsgaSsrKSB7XG4gICAgaXRlbSA9IGhhcmRDYWNoZVtpXTtcbiAgICBpZiAoaXRlbS5lbGVtZW50ID09PSBlbCAmJiBpdGVtLnR5cGUgPT09IHR5cGUgJiYgaXRlbS5mbiA9PT0gZm4pIHtcbiAgICAgIHJldHVybiBpO1xuICAgIH1cbiAgfVxufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHtcbiAgYWRkOiBhZGRFdmVudCxcbiAgcmVtb3ZlOiByZW1vdmVFdmVudCxcbiAgZmFicmljYXRlOiBmYWJyaWNhdGVFdmVudFxufTtcbiJdfQ==

@@ -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;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.dragula=e()}}(function(){return function e(n,t,r){function o(u,c){if(!t[u]){if(!n[u]){var f="function"==typeof require&&require;if(!c&&f)return f(u,!0);if(i)return i(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}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){(function(t){"use strict";function r(e,n){function t(n){function t(e){o(e,r,"mousedown",u)}var r=n?"remove":"add";o(g,r,"mouseup",h),e.forEach(t)}function r(){t(!0),h({})}function u(n){if(!(0!==n.which&&1!==n.which||n.metaKey||n.ctrlKey||B)){var t=n.target;if(-1===e.indexOf(t)){for(;-1===e.indexOf(t.parentElement);){if(v(t))return;t=t.parentElement}if(!v(t)){var r=t.parentElement,o=q.moves(t,r);if(o){var u=i(t);n.preventDefault(),q.copy?(k=t.cloneNode(!0),l(k,"gu-transit")):l(t,"gu-transit"),P=r,D=t,M=R=a(t),_=p("pageX",n)-u.left,j=p("pageY",n)-u.top,U.emit("drag",D,P),N(),O(n)}}}}}function v(e){return"A"===e.tagName||"BUTTON"===e.tagName}function h(e){function n(){x(u)?U.emit("cancel",t,P):U.emit("drop",t,u,P),E()}if(B){var t=k||D,r=p("clientX",e),o=p("clientY",e),i=c(L,r,o),u=b(i,r,o);!u||q.copy!==!1&&u===P?q.removeOnSpill?y():w():n()}}function y(){if(B){var e=k||D,n=e.parentElement;n&&n.removeChild(e),U.emit(q.copy?"cancel":"remove",e,n),E()}}function w(e){if(B){var n=arguments.length>0?e:q.revertOnSpill,t=k||D,r=t.parentElement;r===P&&q.copy&&r.removeChild(k);var o=x(r);o===!1&&q.copy===!1&&n&&P.insertBefore(t,M),o||n?U.emit("cancel",t,P):U.emit("drop",t,r,P),E()}}function E(){var e=k||D;T(),s(e,"gu-transit"),P=D=k=M=R=null}function x(e,n){var t=void 0!==n?n:R;return e===P&&t===M}function b(n,t,r){function o(){var o=-1!==e.indexOf(i);if(o===!1)return!1;var u=S(i,n),c=C(i,u,t,r),f=x(i,c);return f?!0:q.accepts(D,i,P,c)}for(var i=n;i&&!o();)i=i.parentElement;return i}function O(e){var n=p("clientX",e),t=p("clientY",e),r=n-_,o=t-j;L.style.left=r+"px",L.style.top=o+"px";var i=c(L,n,t),u=b(i,n,t);if(u!==P||!q.copy){var f=k||D,l=S(u,i);if(null!==l){var s=C(u,l,n,t);(null===s||s!==f&&s!==a(f))&&(R=s,u.insertBefore(f,s),U.emit("shadow",f,u))}}}function N(){var e=D.getBoundingClientRect();B=!0,L=D.cloneNode(!0),L.style.width=e.width+"px",L.style.height=e.height+"px",s(L,"gu-transit"),l(L," gu-mirror"),m.appendChild(L),o(g,"add","mousemove",O),l(m,"gu-unselectable")}function T(){L&&(s(m,"gu-unselectable"),o(g,"remove","mousemove",O),L.parentElement.removeChild(L),L=null,B=!1)}function S(e,n){for(var t=n;t!==e&&t.parentElement!==e;)t=t.parentElement;return t===g?null:t}function C(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(),c&&i.left>t)return o;if(!c&&i.top>r)return o}return null}function i(){var e=n.getBoundingClientRect();return u(c?t>e.left+e.width/2:r>e.top+e.height/2)}function u(e){return e?a(n):n}var c="horizontal"===q.direction,f=n!==e?i():o();return f}var B,L,P,D,_,j,M,R,k,q=n||{};void 0===q.moves&&(q.moves=f),void 0===q.accepts&&(q.accepts=f),void 0===q.copy&&(q.copy=!1),void 0===q.revertOnSpill&&(q.revertOnSpill=!1),void 0===q.removeOnSpill&&(q.removeOnSpill=!1),void 0===q.direction&&(q.direction="vertical");var U=d({cancel:w,remove:y,destroy:r});return t(),U}function o(e,n,r,o){var i={mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"},u={mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"};t.navigator.msPointerEnabled&&v[n](e,u[r],o),v[n](e,i[r],o),v[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){return"undefined"!=typeof t[n]?t[n]:g.clientHeight?g[e]:m[e]}function c(e,n,t){if(!n&&!t)return null;var r=e.className;e.className+=" gu-hide";var o=document.elementFromPoint(n,t);return e.className=r,o}function f(){return!0}function a(e){function n(){var n=e;do n=n.nextSibling;while(n&&1!==n.nodeType);return n}return e.nextElementSibling||n()}function l(e,n){-1===e.className.indexOf(" "+n)&&(e.className+=" "+n)}function s(e,n){e.className=e.className.replace(new RegExp(" "+n,"g"),"")}function p(e,n){return"undefined"==typeof n.targetTouches?n[e]:n.targetTouches&&n.targetTouches.length&&n.targetTouches[0][e]||0}var d=e("contra.emitter"),v=e("crossvent"),m=document.body,g=document.documentElement;n.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"contra.emitter":3,crossvent:5}],2:[function(e,n){function t(){if(!u){u=!0;for(var e,n=i.length;n;){e=i,i=[];for(var t=-1;++t<n;)e[t]();n=i.length}u=!1}}function r(){}var o=n.exports={},i=[],u=!1;o.nextTick=function(e){i.push(e),u||setTimeout(t,0)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=r,o.addListener=r,o.once=r,o.off=r,o.removeListener=r,o.removeAllListeners=r,o.emit=r,o.binding=function(){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],3:[function(e,n){n.exports=e("./src/contra.emitter.js")},{"./src/contra.emitter.js":4}],4:[function(e,n){(function(e){!function(t,r){"use strict";function o(e,n){return Array.prototype.slice.call(e,n)}function i(e,n,t){e&&c(function(){e.apply(t||null,n||[])})}function u(e,n){var t=n||{},u={};return e===r&&(e={}),e.on=function(n,t){return u[n]?u[n].push(t):u[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 u[n];else if(0===r)u={};else{var o=u[n];if(!o)return e;o.splice(o.indexOf(t),1)}return e},e.emit=function(){var n=o(arguments);return e.emitterSnapshot(n.shift()).apply(this,n)},e.emitterSnapshot=function(n){var r=(u[n]||[]).slice(0);return function(){var c=o(arguments),f=this||e;if("error"===n&&t["throws"]!==!1&&!r.length)throw 1===c.length?c[0]:c;return u[n]=r.filter(function(e){return t.async?i(e,c,f):e.apply(f,c),!e._once}),e}},e}var c,f=""+r,a="function"==typeof setImmediate;c=a?function(e){setImmediate(e)}:typeof e!==f&&e.nextTick?e.nextTick:function(e){setTimeout(e,0)},typeof n!==f&&n.exports?n.exports=u:(t.contra=t.contra||{},t.contra.emitter=u)}(this)}).call(this,e("_process"))},{_process:2}],5:[function(e,n){(function(e){"use strict";function t(e,n,t,r){return e.addEventListener(n,t,r)}function r(e,n,t){return e.attachEvent("on"+n,f(e,n,t))}function o(e,n,t,r){return e.removeEventListener(n,t,r)}function i(e,n,t){return e.detachEvent("on"+n,a(e,n,t))}function u(e,n){var t;s.createEvent?(t=s.createEvent("Event"),t.initEvent(n,!0,!0),e.dispatchEvent(t)):s.createEventObject&&(t=s.createEventObject(),e.fireEvent("on"+n,t))}function c(n,t,r){return function(t){var o=t||e.event;o.target=o.target||o.srcElement,o.preventDefault=o.preventDefault||function(){o.returnValue=!1},o.stopPropagation=o.stopPropagation||function(){o.cancelBubble=!0},r.call(n,o)}}function f(e,n,t){var r=a(e,n,t)||c(e,n,t);return v.push({wrapper:r,element:e,type:n,fn:t}),r}function a(e,n,t){var r=l(e,n,t);if(r){var o=v[r].wrapper;return v.splice(r,1),o}}function l(e,n,t){var r,o;for(r=0;r<v.length;r++)if(o=v[r],o.element===e&&o.type===n&&o.fn===t)return r}var s=document,p=t,d=o,v=[];e.addEventListener||(p=r,d=i),n.exports={add:p,remove:d,fabricate:u}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(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;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.dragula=e()}}(function(){return function e(n,t,r){function o(u,c){if(!t[u]){if(!n[u]){var f="function"==typeof require&&require;if(!c&&f)return f(u,!0);if(i)return i(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}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){(function(t){"use strict";function r(e,n){function t(n){function t(e){o(e,r,"mousedown",u)}var r=n?"remove":"add";o(g,r,"mouseup",y),e.forEach(t)}function r(){t(!0),y({})}function u(n){if(!(0!==n.which&&1!==n.which||n.metaKey||n.ctrlKey||P)){var t=n.target;if(-1===e.indexOf(t)){for(;-1===e.indexOf(t.parentElement);){if(v(t))return;t=t.parentElement}if(!v(t)){var r=t.parentElement,o=X.moves(t,r);if(o){var u=i(t);n.preventDefault(),X.copy?(U=t.cloneNode(!0),l(U,"gu-transit")):l(t,"gu-transit"),_=r,j=t,k=q=a(t),M=p("pageX",n)-u.left,R=p("pageY",n)-u.top,Y.emit("drag",j,_),S(),T(n)}}}}}function v(e){return"A"===e.tagName||"BUTTON"===e.tagName}function h(){if(P){var e=U||j;w(e,e.parentElement)}}function y(e){if(P){var n=U||j,t=p("clientX",e),r=p("clientY",e),o=c(D,t,r),i=N(o,t,r);!i||X.copy!==!1&&i===_?X.removeOnSpill?E():x():w(n,i)}}function w(e,n){O(n)?Y.emit("cancel",e,_):Y.emit("drop",e,n,_),b()}function E(){if(P){var e=U||j,n=e.parentElement;n&&n.removeChild(e),Y.emit(X.copy?"cancel":"remove",e,n),b()}}function x(e){if(P){var n=arguments.length>0?e:X.revertOnSpill,t=U||j,r=t.parentElement;r===_&&X.copy&&r.removeChild(U);var o=O(r);o===!1&&X.copy===!1&&n&&_.insertBefore(t,k),o||n?Y.emit("cancel",t,_):Y.emit("drop",t,r,_),b()}}function b(){var e=U||j;C(),s(e,"gu-transit"),_=j=U=k=q=null}function O(e,n){var t=void 0!==n?n:q;return e===_&&t===k}function N(n,t,r){function o(){var o=-1!==e.indexOf(i);if(o===!1)return!1;var u=B(i,n),c=L(i,u,t,r),f=O(i,c);return f?!0:X.accepts(j,i,_,c)}for(var i=n;i&&!o();)i=i.parentElement;return i}function T(e){var n=p("clientX",e),t=p("clientY",e),r=n-M,o=t-R;D.style.left=r+"px",D.style.top=o+"px";var i=c(D,n,t),u=N(i,n,t);if(u!==_||!X.copy){var f=U||j,l=B(u,i);if(null!==l){var s=L(u,l,n,t);(null===s||s!==f&&s!==a(f))&&(q=s,u.insertBefore(f,s),Y.emit("shadow",f,u))}}}function S(){var e=j.getBoundingClientRect();P=!0,D=j.cloneNode(!0),D.style.width=e.width+"px",D.style.height=e.height+"px",s(D,"gu-transit"),l(D," gu-mirror"),m.appendChild(D),o(g,"add","mousemove",T),l(m,"gu-unselectable")}function C(){D&&(s(m,"gu-unselectable"),o(g,"remove","mousemove",T),D.parentElement.removeChild(D),D=null,P=!1)}function B(e,n){for(var t=n;t!==e&&t.parentElement!==e;)t=t.parentElement;return t===g?null:t}function L(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(),c&&i.left>t)return o;if(!c&&i.top>r)return o}return null}function i(){var e=n.getBoundingClientRect();return u(c?t>e.left+e.width/2:r>e.top+e.height/2)}function u(e){return e?a(n):n}var c="horizontal"===X.direction,f=n!==e?i():o();return f}var P,D,_,j,M,R,k,q,U,X=n||{};void 0===X.moves&&(X.moves=f),void 0===X.accepts&&(X.accepts=f),void 0===X.copy&&(X.copy=!1),void 0===X.revertOnSpill&&(X.revertOnSpill=!1),void 0===X.removeOnSpill&&(X.removeOnSpill=!1),void 0===X.direction&&(X.direction="vertical");var Y=d({end:h,cancel:x,remove:E,destroy:r});return t(),Y}function o(e,n,r,o){var i={mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"},u={mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"};t.navigator.msPointerEnabled&&v[n](e,u[r],o),v[n](e,i[r],o),v[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){return"undefined"!=typeof t[n]?t[n]:g.clientHeight?g[e]:m[e]}function c(e,n,t){if(!n&&!t)return null;var r=e.className;e.className+=" gu-hide";var o=document.elementFromPoint(n,t);return e.className=r,o}function f(){return!0}function a(e){function n(){var n=e;do n=n.nextSibling;while(n&&1!==n.nodeType);return n}return e.nextElementSibling||n()}function l(e,n){-1===e.className.indexOf(" "+n)&&(e.className+=" "+n)}function s(e,n){e.className=e.className.replace(new RegExp(" "+n,"g"),"")}function p(e,n){return"undefined"==typeof n.targetTouches?n[e]:n.targetTouches&&n.targetTouches.length&&n.targetTouches[0][e]||0}var d=e("contra.emitter"),v=e("crossvent"),m=document.body,g=document.documentElement;n.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"contra.emitter":3,crossvent:5}],2:[function(e,n){function t(){if(!u){u=!0;for(var e,n=i.length;n;){e=i,i=[];for(var t=-1;++t<n;)e[t]();n=i.length}u=!1}}function r(){}var o=n.exports={},i=[],u=!1;o.nextTick=function(e){i.push(e),u||setTimeout(t,0)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=r,o.addListener=r,o.once=r,o.off=r,o.removeListener=r,o.removeAllListeners=r,o.emit=r,o.binding=function(){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],3:[function(e,n){n.exports=e("./src/contra.emitter.js")},{"./src/contra.emitter.js":4}],4:[function(e,n){(function(e){!function(t,r){"use strict";function o(e,n){return Array.prototype.slice.call(e,n)}function i(e,n,t){e&&c(function(){e.apply(t||null,n||[])})}function u(e,n){var t=n||{},u={};return e===r&&(e={}),e.on=function(n,t){return u[n]?u[n].push(t):u[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 u[n];else if(0===r)u={};else{var o=u[n];if(!o)return e;o.splice(o.indexOf(t),1)}return e},e.emit=function(){var n=o(arguments);return e.emitterSnapshot(n.shift()).apply(this,n)},e.emitterSnapshot=function(n){var r=(u[n]||[]).slice(0);return function(){var c=o(arguments),f=this||e;if("error"===n&&t["throws"]!==!1&&!r.length)throw 1===c.length?c[0]:c;return u[n]=r.filter(function(e){return t.async?i(e,c,f):e.apply(f,c),!e._once}),e}},e}var c,f=""+r,a="function"==typeof setImmediate;c=a?function(e){setImmediate(e)}:typeof e!==f&&e.nextTick?e.nextTick:function(e){setTimeout(e,0)},typeof n!==f&&n.exports?n.exports=u:(t.contra=t.contra||{},t.contra.emitter=u)}(this)}).call(this,e("_process"))},{_process:2}],5:[function(e,n){(function(e){"use strict";function t(e,n,t,r){return e.addEventListener(n,t,r)}function r(e,n,t){return e.attachEvent("on"+n,f(e,n,t))}function o(e,n,t,r){return e.removeEventListener(n,t,r)}function i(e,n,t){return e.detachEvent("on"+n,a(e,n,t))}function u(e,n){var t;s.createEvent?(t=s.createEvent("Event"),t.initEvent(n,!0,!0),e.dispatchEvent(t)):s.createEventObject&&(t=s.createEventObject(),e.fireEvent("on"+n,t))}function c(n,t,r){return function(t){var o=t||e.event;o.target=o.target||o.srcElement,o.preventDefault=o.preventDefault||function(){o.returnValue=!1},o.stopPropagation=o.stopPropagation||function(){o.cancelBubble=!0},r.call(n,o)}}function f(e,n,t){var r=a(e,n,t)||c(e,n,t);return v.push({wrapper:r,element:e,type:n,fn:t}),r}function a(e,n,t){var r=l(e,n,t);if(r){var o=v[r].wrapper;return v.splice(r,1),o}}function l(e,n,t){var r,o;for(r=0;r<v.length;r++)if(o=v[r],o.element===e&&o.type===n&&o.fn===t)return r}var s=document,p=t,d=o,v=[];e.addEventListener||(p=r,d=i),n.exports={add:p,remove:d,fabricate:u}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)});

@@ -28,2 +28,3 @@ 'use strict';

var api = emitter({
end: end,
cancel: cancel,

@@ -107,2 +108,10 @@ remove: remove,

function end () {
if (!_dragging) {
return;
}
var item = _copy || _item;
drop(item, item.parentElement);
}
function release (e) {

@@ -119,3 +128,3 @@ if (!_dragging) {

if (dropTarget && (o.copy === false || dropTarget !== _source)) {
drop();
drop(item, dropTarget);
} else if (o.removeOnSpill) {

@@ -126,11 +135,11 @@ remove();

}
}
function drop () {
if (isInitialPlacement(dropTarget)) {
api.emit('cancel', item, _source);
} else {
api.emit('drop', item, dropTarget, _source);
}
cleanup();
function drop (item, target) {
if (isInitialPlacement(target)) {
api.emit('cancel', item, _source);
} else {
api.emit('drop', item, target, _source);
}
cleanup();
}

@@ -137,0 +146,0 @@

{
"name": "dragula",
"version": "1.2.4",
"version": "1.3.0",
"description": "Drag and drop so simple it hurts",

@@ -5,0 +5,0 @@ "main": "dragula.js",

Sorry, the diff of this file is not supported yet

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