Comparing version 2.0.4 to 2.0.5
{ | ||
"name": "dragula.js", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "Drag and drop so simple it hurts", | ||
@@ -5,0 +5,0 @@ "main": [ |
@@ -515,3 +515,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){ | ||
},{"contra/emitter":4,"crossvent":5}],2:[function(require,module,exports){ | ||
},{"contra/emitter":4,"crossvent":6}],2:[function(require,module,exports){ | ||
module.exports = function atoa (a, n) { return Array.prototype.slice.call(a, n); } | ||
@@ -531,3 +531,3 @@ | ||
},{"ticky":6}],4:[function(require,module,exports){ | ||
},{"ticky":8}],4:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -590,4 +590,59 @@ | ||
(function (global){ | ||
var NativeCustomEvent = global.CustomEvent; | ||
function useNative () { | ||
try { | ||
var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } }); | ||
return 'cat' === p.type && 'bar' === p.detail.foo; | ||
} catch (e) { | ||
} | ||
return false; | ||
} | ||
/** | ||
* Cross-browser `CustomEvent` constructor. | ||
* | ||
* https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent | ||
* | ||
* @public | ||
*/ | ||
module.exports = useNative() ? NativeCustomEvent : | ||
// IE >= 9 | ||
'function' === typeof document.createEvent ? function CustomEvent (type, params) { | ||
var e = document.createEvent('CustomEvent'); | ||
if (params) { | ||
e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail); | ||
} else { | ||
e.initCustomEvent(type, false, false, void 0); | ||
} | ||
return e; | ||
} : | ||
// IE <= 8 | ||
function CustomEvent (type, params) { | ||
var e = document.createEventObject(); | ||
e.type = type; | ||
if (params) { | ||
e.bubbles = Boolean(params.bubbles); | ||
e.cancelable = Boolean(params.cancelable); | ||
e.detail = params.detail; | ||
} else { | ||
e.bubbles = false; | ||
e.cancelable = false; | ||
e.detail = void 0; | ||
} | ||
return e; | ||
} | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{}],6:[function(require,module,exports){ | ||
(function (global){ | ||
'use strict'; | ||
var customEvent = require('custom-event'); | ||
var eventmap = require('./eventmap'); | ||
var doc = document; | ||
@@ -619,12 +674,22 @@ var addEvent = addEventEasy; | ||
function fabricateEvent (el, type) { | ||
var e; | ||
if (doc.createEvent) { | ||
e = doc.createEvent('Event'); | ||
e.initEvent(type, true, true); | ||
function fabricateEvent (el, type, model) { | ||
var e = eventmap.indexOf(type) === -1 ? makeCustomEvent() : makeClassicEvent(); | ||
if (el.dispatchEvent) { | ||
el.dispatchEvent(e); | ||
} else if (doc.createEventObject) { | ||
e = doc.createEventObject(); | ||
} else { | ||
el.fireEvent('on' + type, e); | ||
} | ||
function makeClassicEvent () { | ||
var e; | ||
if (doc.createEvent) { | ||
e = doc.createEvent('Event'); | ||
e.initEvent(type, true, true); | ||
} else if (doc.createEventObject) { | ||
e = doc.createEventObject(); | ||
} | ||
return e; | ||
} | ||
function makeCustomEvent () { | ||
return new customEvent(type, { detail: model }); | ||
} | ||
} | ||
@@ -681,3 +746,21 @@ | ||
},{}],6:[function(require,module,exports){ | ||
},{"./eventmap":7,"custom-event":5}],7:[function(require,module,exports){ | ||
(function (global){ | ||
'use strict'; | ||
var eventmap = []; | ||
var eventname = ''; | ||
var ron = /^on/; | ||
for (eventname in global) { | ||
if (ron.test(eventname)) { | ||
eventmap.push(eventname.slice(2)); | ||
} | ||
} | ||
module.exports = eventmap; | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{}],8:[function(require,module,exports){ | ||
var si = typeof setImmediate === 'function', tick; | ||
@@ -693,2 +776,2 @@ if (si) { | ||
}); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJkcmFndWxhLmpzIiwibm9kZV9tb2R1bGVzL2F0b2EvYXRvYS5qcyIsIm5vZGVfbW9kdWxlcy9jb250cmEvZGVib3VuY2UuanMiLCJub2RlX21vZHVsZXMvY29udHJhL2VtaXR0ZXIuanMiLCJub2RlX21vZHVsZXMvY3Jvc3N2ZW50L3NyYy9jcm9zc3ZlbnQuanMiLCJub2RlX21vZHVsZXMvdGlja3kvdGlja3ktYnJvd3Nlci5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7QUNBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNB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xuICAgIGV2ZW50bWFwLnB1c2goZXZlbnRuYW1lLnNsaWNlKDIpKTtcbiAgfVxufVxuXG5tb2R1bGUuZXhwb3J0cyA9IGV2ZW50bWFwO1xuIiwidmFyIHNpID0gdHlwZW9mIHNldEltbWVkaWF0ZSA9PT0gJ2Z1bmN0aW9uJywgdGljaztcbmlmIChzaSkge1xuICB0aWNrID0gZnVuY3Rpb24gKGZuKSB7IHNldEltbWVkaWF0ZShmbik7IH07XG59IGVsc2Uge1xuICB0aWNrID0gZnVuY3Rpb24gKGZuKSB7IHNldFRpbWVvdXQoZm4sIDApOyB9O1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHRpY2s7Il19 |
@@ -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(a,c){if(!t[a]){if(!n[a]){var u="function"==typeof require&&require;if(!c&&u)return u(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var f=t[a]={exports:{}};n[a][0].call(f.exports,function(e){var t=n[a][1][e];return o(t?t:e)},f,f.exports,e,n,t,r)}return t[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,n){(function(t){"use strict";function r(e,n){function t(e){var n=Array.isArray(e)?e:[e];W.containers=W.containers.concat(n),console.warn&&console.warn("drake.addContainer is deprecated. please access drake.containers directly, instead")}function r(e){function n(e){return-1===t.indexOf(e)}var t=Array.isArray(e)?e:[e];W.containers=W.containers.filter(n),console.warn&&console.warn("drake.removeContainer is deprecated. please access drake.containers directly, instead")}function a(e){return-1!==W.containers.indexOf(e)||Q.isContainer(e)}function v(e){var n=e?"remove":"add";o(J,n,"mousedown",E),o(J,n,"mouseup",C)}function y(){v(!0),C({})}function E(e){var n=e.target,t=0!==e.which&&1!==e.which||e.metaKey||e.ctrlKey;if(!t&&b(n)===!0){var r=i(U);_=p("pageX",e)-r.left,j=p("pageY",e)-r.top,F=p("clientX",e),I=p("clientY",e),"number"==typeof Q.delay?V=setTimeout(w,Q.delay):w(),e.preventDefault()}}function w(){d(H||U,"gu-transit"),X(),P()}function b(e){var n=e;if(!(W.dragging&&R||a(e))){for(;a(e.parentElement)===!1;){if(Q.invalid(e,n))return;if(e=e.parentElement,!e)return}if(!Q.invalid(e,n)){var t=e.parentElement,r=Q.moves(e,t,n);if(r)return O(),Q.copy&&(H=e.cloneNode(!0),W.emit("cloned",H,e)),q=t,U=e,K=z=f(e),W.dragging=!0,W.emit("drag",U,q),!0}}}function x(e){return"A"===e.tagName||"BUTTON"===e.tagName}function O(){if(W.dragging){var e=H||U;S(e,e.parentElement)}}function C(e){if(W.dragging){var n=H||U,t=p("clientX",e),r=p("clientY",e),o=c(R,t,r),i=k(o,t,r);!i||Q.copy!==!1&&i===q?Q.removeOnSpill?N():T():S(n,i)}}function S(e,n){B(n)?W.emit("cancel",e,q):W.emit("drop",e,n,q),A()}function N(){if(W.dragging){var e=H||U,n=e.parentElement;n&&n.removeChild(e),W.emit(Q.copy?"cancel":"remove",e,n),A()}}function T(e){if(W.dragging){var n=arguments.length>0?e:Q.revertOnSpill,t=H||U,r=t.parentElement;r===q&&Q.copy&&r.removeChild(H);var o=B(r);o===!1&&Q.copy===!1&&n&&q.insertBefore(t,K),o||n?W.emit("cancel",t,q):W.emit("drop",t,r,q),A()}}function A(){var e=H||U;Y(),e&&s(e,"gu-transit"),V&&clearTimeout(V),q=U=H=K=z=V=null,W.dragging=!1,W.emit("dragend",e)}function B(e,n){var t;return t=void 0!==n?n:R?z:f(U||H),e===q&&t===K}function k(e,n,t){function r(){var r=a(o);if(r===!1)return!1;var i=D(o,e),c=L(o,i,n,t),u=B(o,c);return u?!0:Q.accepts(U,o,q,c)}for(var o=e;o&&!r();)o=o.parentElement;return o}function P(e){if(R){e&&(F=p("clientX",e),I=p("clientY",e));var n=F-_,t=I-j;R.style.left=n+"px",R.style.top=t+"px";var r=H||U,o=c(R,F,I),i=k(o,F,I);if(i===q&&Q.copy)return void(r.parentElement&&r.parentElement.removeChild(r));var a,u=D(i,o);if(null!==u)a=L(i,u,F,I);else{if(Q.revertOnSpill!==!0||Q.copy)return void(!Q.copy&&Q.removeOnSpill!==!0||null===r.parentElement||r.parentElement.removeChild(r));a=K,i=q}(null===a||a!==r&&a!==f(r))&&(z=a,i.insertBefore(r,a),W.emit("shadow",r,i))}}function X(){if(!R){var e=U.getBoundingClientRect();R=U.cloneNode(!0),R.style.width=m(e)+"px",R.style.height=g(e)+"px",s(R,"gu-transit"),d(R," gu-mirror"),G.appendChild(R),o(J,"add","mousemove",P),d(G,"gu-unselectable"),W.emit("cloned",R,U)}}function Y(){R&&(s(G,"gu-unselectable"),o(J,"remove","mousemove",P),R.parentElement.removeChild(R),R=null)}function D(e,n){for(var t=n;t!==e&&t.parentElement!==e;)t=t.parentElement;return t===J?null:t}function L(e,n,t,r){function o(){var n,o,i,a=e.children.length;for(n=0;a>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 a(c?t>e.left+m(e)/2:r>e.top+g(e)/2)}function a(e){return e?f(n):n}var c="horizontal"===Q.direction,u=n!==e?i():o();return u}var M=arguments.length;1===M&&Array.isArray(e)===!1&&(n=e,e=[]);var R,q,U,_,j,F,I,K,z,H,V,G=document.body,J=document.documentElement,Q=n||{};void 0===Q.moves&&(Q.moves=l),void 0===Q.accepts&&(Q.accepts=l),void 0===Q.invalid&&(Q.invalid=x),void 0===Q.containers&&(Q.containers=e||[]),void 0===Q.isContainer&&(Q.isContainer=u),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"),void 0===Q.delay&&(Q.delay=!1),Q.delay===!0&&(Q.delay=300);var W=h({containers:Q.containers,addContainer:t,removeContainer:r,start:b,end:O,cancel:T,remove:N,destroy:y,dragging:!1});return v(),W}function o(e,n,r,o){var i={mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"},a={mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"};t.navigator.msPointerEnabled&&y[n](e,a[r],o),y[n](e,i[r],o),y[n](e,r,o)}function i(e){var n=e.getBoundingClientRect();return{left:n.left+a("scrollLeft","pageXOffset"),top:n.top+a("scrollTop","pageYOffset")}}function a(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 c(e,n,t){if(!n&&!t)return null;var r,o=e||{},i=o.className;return o.className+=" gu-hide",r=document.elementFromPoint(n,t),o.className=i,r}function u(){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,n){-1===e.className.indexOf(" "+n)&&(e.className+=" "+n)}function s(e,n){e.className=e.className.replace(new RegExp(" "+n,"g"),"")}function v(e){return e.targetTouches&&e.targetTouches.length?e.targetTouches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}function p(e,n){var t=v(n),r={pageX:"clientX",pageY:"clientY"};return e in r&&!(e in t)&&r[e]in t&&(e=r[e]),t[e]}function m(e){return e.width||e.right-e.left}function g(e){return e.height||e.bottom-e.top}var h=e("contra/emitter"),y=e("crossvent");n.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"contra/emitter":4,crossvent:5}],2:[function(e,n){n.exports=function(e,n){return Array.prototype.slice.call(e,n)}},{}],3:[function(e,n){"use strict";var t=e("ticky");n.exports=function(e,n,r){e&&t(function(){e.apply(r||null,n||[])})}},{ticky:6}],4:[function(e,n){"use strict";var t=e("atoa"),r=e("./debounce");n.exports=function(e,n){var o=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=t(arguments);return e.emitterSnapshot(n.shift()).apply(this,n)},e.emitterSnapshot=function(n){var a=(i[n]||[]).slice(0);return function(){var i=t(arguments),c=this||e;if("error"===n&&o["throws"]!==!1&&!a.length)throw 1===i.length?i[0]:i;return a.forEach(function(t){o.async?r(t,i,c):t.apply(c,i),t._once&&e.off(n,t)}),e}},e}},{"./debounce":3,atoa: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,u(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,l(e,n,t))}function a(e,n){var t;d.createEvent?(t=d.createEvent("Event"),t.initEvent(n,!0,!0),e.dispatchEvent(t)):d.createEventObject&&(t=d.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},o.which=o.which||o.keyCode,r.call(n,o)}}function u(e,n,t){var r=l(e,n,t)||c(e,n,t);return p.push({wrapper:r,element:e,type:n,fn:t}),r}function l(e,n,t){var r=f(e,n,t);if(r){var o=p[r].wrapper;return p.splice(r,1),o}}function f(e,n,t){var r,o;for(r=0;r<p.length;r++)if(o=p[r],o.element===e&&o.type===n&&o.fn===t)return r}var d=document,s=t,v=o,p=[];e.addEventListener||(s=r,v=i),n.exports={add:s,remove:v,fabricate:a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],6:[function(e,n){var t,r="function"==typeof setImmediate;t=r?function(e){setImmediate(e)}:function(e){setTimeout(e,0)},n.exports=t},{}]},{},[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(a,u){if(!t[a]){if(!n[a]){var c="function"==typeof require&&require;if(!u&&c)return c(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var f=t[a]={exports:{}};n[a][0].call(f.exports,function(e){var t=n[a][1][e];return o(t?t:e)},f,f.exports,e,n,t,r)}return t[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,n){(function(t){"use strict";function r(e,n){function t(e){var n=Array.isArray(e)?e:[e];W.containers=W.containers.concat(n),console.warn&&console.warn("drake.addContainer is deprecated. please access drake.containers directly, instead")}function r(e){function n(e){return-1===t.indexOf(e)}var t=Array.isArray(e)?e:[e];W.containers=W.containers.filter(n),console.warn&&console.warn("drake.removeContainer is deprecated. please access drake.containers directly, instead")}function a(e){return-1!==W.containers.indexOf(e)||Q.isContainer(e)}function v(e){var n=e?"remove":"add";o(J,n,"mousedown",b),o(J,n,"mouseup",O)}function h(){v(!0),O({})}function b(e){var n=e.target,t=0!==e.which&&1!==e.which||e.metaKey||e.ctrlKey;if(!t&&E(n)===!0){var r=i(q);U=p("pageX",e)-r.left,_=p("pageY",e)-r.top,F=p("clientX",e),I=p("clientY",e),"number"==typeof Q.delay?V=setTimeout(w,Q.delay):w(),e.preventDefault()}}function w(){d(H||q,"gu-transit"),X(),P()}function E(e){var n=e;if(!(W.dragging&&R||a(e))){for(;a(e.parentElement)===!1;){if(Q.invalid(e,n))return;if(e=e.parentElement,!e)return}if(!Q.invalid(e,n)){var t=e.parentElement,r=Q.moves(e,t,n);if(r)return C(),Q.copy&&(H=e.cloneNode(!0),W.emit("cloned",H,e)),j=t,q=e,K=z=f(e),W.dragging=!0,W.emit("drag",q,j),!0}}}function x(e){return"A"===e.tagName||"BUTTON"===e.tagName}function C(){if(W.dragging){var e=H||q;S(e,e.parentElement)}}function O(e){if(W.dragging){var n=H||q,t=p("clientX",e),r=p("clientY",e),o=u(R,t,r),i=k(o,t,r);!i||Q.copy!==!1&&i===j?Q.removeOnSpill?N():T():S(n,i)}}function S(e,n){A(n)?W.emit("cancel",e,j):W.emit("drop",e,n,j),B()}function N(){if(W.dragging){var e=H||q,n=e.parentElement;n&&n.removeChild(e),W.emit(Q.copy?"cancel":"remove",e,n),B()}}function T(e){if(W.dragging){var n=arguments.length>0?e:Q.revertOnSpill,t=H||q,r=t.parentElement;r===j&&Q.copy&&r.removeChild(H);var o=A(r);o===!1&&Q.copy===!1&&n&&j.insertBefore(t,K),o||n?W.emit("cancel",t,j):W.emit("drop",t,r,j),B()}}function B(){var e=H||q;Y(),e&&s(e,"gu-transit"),V&&clearTimeout(V),j=q=H=K=z=V=null,W.dragging=!1,W.emit("dragend",e)}function A(e,n){var t;return t=void 0!==n?n:R?z:f(q||H),e===j&&t===K}function k(e,n,t){function r(){var r=a(o);if(r===!1)return!1;var i=D(o,e),u=L(o,i,n,t),c=A(o,u);return c?!0:Q.accepts(q,o,j,u)}for(var o=e;o&&!r();)o=o.parentElement;return o}function P(e){if(R){e&&(F=p("clientX",e),I=p("clientY",e));var n=F-U,t=I-_;R.style.left=n+"px",R.style.top=t+"px";var r=H||q,o=u(R,F,I),i=k(o,F,I);if(i===j&&Q.copy)return void(r.parentElement&&r.parentElement.removeChild(r));var a,c=D(i,o);if(null!==c)a=L(i,c,F,I);else{if(Q.revertOnSpill!==!0||Q.copy)return void(!Q.copy&&Q.removeOnSpill!==!0||null===r.parentElement||r.parentElement.removeChild(r));a=K,i=j}(null===a||a!==r&&a!==f(r))&&(z=a,i.insertBefore(r,a),W.emit("shadow",r,i))}}function X(){if(!R){var e=q.getBoundingClientRect();R=q.cloneNode(!0),R.style.width=m(e)+"px",R.style.height=g(e)+"px",s(R,"gu-transit"),d(R," gu-mirror"),G.appendChild(R),o(J,"add","mousemove",P),d(G,"gu-unselectable"),W.emit("cloned",R,q)}}function Y(){R&&(s(G,"gu-unselectable"),o(J,"remove","mousemove",P),R.parentElement.removeChild(R),R=null)}function D(e,n){for(var t=n;t!==e&&t.parentElement!==e;)t=t.parentElement;return t===J?null:t}function L(e,n,t,r){function o(){var n,o,i,a=e.children.length;for(n=0;a>n;n++){if(o=e.children[n],i=o.getBoundingClientRect(),u&&i.left>t)return o;if(!u&&i.top>r)return o}return null}function i(){var e=n.getBoundingClientRect();return a(u?t>e.left+m(e)/2:r>e.top+g(e)/2)}function a(e){return e?f(n):n}var u="horizontal"===Q.direction,c=n!==e?i():o();return c}var M=arguments.length;1===M&&Array.isArray(e)===!1&&(n=e,e=[]);var R,j,q,U,_,F,I,K,z,H,V,G=document.body,J=document.documentElement,Q=n||{};void 0===Q.moves&&(Q.moves=l),void 0===Q.accepts&&(Q.accepts=l),void 0===Q.invalid&&(Q.invalid=x),void 0===Q.containers&&(Q.containers=e||[]),void 0===Q.isContainer&&(Q.isContainer=c),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"),void 0===Q.delay&&(Q.delay=!1),Q.delay===!0&&(Q.delay=300);var W=y({containers:Q.containers,addContainer:t,removeContainer:r,start:E,end:C,cancel:T,remove:N,destroy:h,dragging:!1});return v(),W}function o(e,n,r,o){var i={mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"},a={mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"};t.navigator.msPointerEnabled&&h[n](e,a[r],o),h[n](e,i[r],o),h[n](e,r,o)}function i(e){var n=e.getBoundingClientRect();return{left:n.left+a("scrollLeft","pageXOffset"),top:n.top+a("scrollTop","pageYOffset")}}function a(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 u(e,n,t){if(!n&&!t)return null;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,n){-1===e.className.indexOf(" "+n)&&(e.className+=" "+n)}function s(e,n){e.className=e.className.replace(new RegExp(" "+n,"g"),"")}function v(e){return e.targetTouches&&e.targetTouches.length?e.targetTouches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}function p(e,n){var t=v(n),r={pageX:"clientX",pageY:"clientY"};return e in r&&!(e in t)&&r[e]in t&&(e=r[e]),t[e]}function m(e){return e.width||e.right-e.left}function g(e){return e.height||e.bottom-e.top}var y=e("contra/emitter"),h=e("crossvent");n.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"contra/emitter":4,crossvent:6}],2:[function(e,n){n.exports=function(e,n){return Array.prototype.slice.call(e,n)}},{}],3:[function(e,n){"use strict";var t=e("ticky");n.exports=function(e,n,r){e&&t(function(){e.apply(r||null,n||[])})}},{ticky:8}],4:[function(e,n){"use strict";var t=e("atoa"),r=e("./debounce");n.exports=function(e,n){var o=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=t(arguments);return e.emitterSnapshot(n.shift()).apply(this,n)},e.emitterSnapshot=function(n){var a=(i[n]||[]).slice(0);return function(){var i=t(arguments),u=this||e;if("error"===n&&o["throws"]!==!1&&!a.length)throw 1===i.length?i[0]:i;return a.forEach(function(t){o.async?r(t,i,u):t.apply(u,i),t._once&&e.off(n,t)}),e}},e}},{"./debounce":3,atoa:2}],5:[function(e,n){(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:{})},{}],6:[function(e,n){(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,l(e,n,t))}function i(e,n,t,r){return e.removeEventListener(n,t,r)}function a(e,n,t){return e.detachEvent("on"+n,f(e,n,t))}function u(e,n,t){function r(){var e;return p.createEvent?(e=p.createEvent("Event"),e.initEvent(n,!0,!0)):p.createEventObject&&(e=p.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 l(e,n,t){var r=f(e,n,t)||c(e,n,t);return y.push({wrapper:r,element:e,type:n,fn:t}),r}function f(e,n,t){var r=d(e,n,t);if(r){var o=y[r].wrapper;return y.splice(r,1),o}}function d(e,n,t){var r,o;for(r=0;r<y.length;r++)if(o=y[r],o.element===e&&o.type===n&&o.fn===t)return r}var s=e("custom-event"),v=e("./eventmap"),p=document,m=r,g=i,y=[];t.addEventListener||(m=o,g=a),n.exports={add:m,remove:g,fabricate:u}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./eventmap":7,"custom-event":5}],7:[function(e,n){(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:{})},{}],8:[function(e,n){var t,r="function"==typeof setImmediate;t=r?function(e){setImmediate(e)}:function(e){setTimeout(e,0)},n.exports=t},{}]},{},[1])(1)}); |
{ | ||
"name": "dragula", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "Drag and drop so simple it hurts", | ||
@@ -27,3 +27,3 @@ "main": "dragula.js", | ||
"contra": "1.9.1", | ||
"crossvent": "1.3.2" | ||
"crossvent": "1.5.0" | ||
}, | ||
@@ -30,0 +30,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
508954
1466
+ Addedcrossvent@1.5.0(transitive)
+ Addedcustom-event@1.0.0(transitive)
- Removedcrossvent@1.3.2(transitive)
Updatedcrossvent@1.5.0