draggable-helper
Advanced tools
Comparing version 4.0.1 to 4.0.2
/*! | ||
* draggable-helper v4.0.1 | ||
* draggable-helper v4.0.2 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Homepage: undefined | ||
* Released under the MIT License. | ||
@@ -71,3 +72,3 @@ */ | ||
var destroy = () => { | ||
var destroy = function destroy() { | ||
DragEventService.off(dragHandlerEl, 'start', dragHandlerEl._draggbleEventHandler); | ||
@@ -84,3 +85,3 @@ delete dragHandlerEl._draggbleEventHandler; | ||
return { | ||
destroy, | ||
destroy: destroy, | ||
options: opt | ||
@@ -103,3 +104,3 @@ }; | ||
var isParentUndraggable = hp.findParent(e.target, el => { | ||
var isParentUndraggable = hp.findParent(e.target, function (el) { | ||
if (hp.hasClass(el, UNDRAGGABLE_CLASS)) { | ||
@@ -146,6 +147,6 @@ return true; | ||
var { | ||
el, | ||
position | ||
} = resolveDragedElAndInitialPosition(); | ||
var _resolveDragedElAndIn = resolveDragedElAndInitialPosition(), | ||
el = _resolveDragedElAndIn.el, | ||
position = _resolveDragedElAndIn.position; | ||
store.el = el; | ||
@@ -243,7 +244,6 @@ store.initialPosition = _objectSpread({}, position); | ||
store.endEvent = e; | ||
var { | ||
el | ||
} = store; | ||
var _store = store, | ||
el = _store.el; | ||
var restoreDOM = () => { | ||
var restoreDOM = function restoreDOM() { | ||
if (opt.clone) { | ||
@@ -281,3 +281,3 @@ el.parentElement.removeChild(el); | ||
position: hp.getPosition(el0), | ||
el | ||
el: el | ||
}; | ||
@@ -284,0 +284,0 @@ } |
/*! | ||
* draggable-helper v4.0.1 | ||
* draggable-helper v4.0.2 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Homepage: undefined | ||
* Released under the MIT License. | ||
@@ -67,3 +68,3 @@ */ | ||
var destroy = () => { | ||
var destroy = function destroy() { | ||
DragEventService.off(dragHandlerEl, 'start', dragHandlerEl._draggbleEventHandler); | ||
@@ -80,3 +81,3 @@ delete dragHandlerEl._draggbleEventHandler; | ||
return { | ||
destroy, | ||
destroy: destroy, | ||
options: opt | ||
@@ -99,3 +100,3 @@ }; | ||
var isParentUndraggable = findParent(e.target, el => { | ||
var isParentUndraggable = findParent(e.target, function (el) { | ||
if (hasClass(el, UNDRAGGABLE_CLASS)) { | ||
@@ -142,6 +143,6 @@ return true; | ||
var { | ||
el, | ||
position | ||
} = resolveDragedElAndInitialPosition(); | ||
var _resolveDragedElAndIn = resolveDragedElAndInitialPosition(), | ||
el = _resolveDragedElAndIn.el, | ||
position = _resolveDragedElAndIn.position; | ||
store.el = el; | ||
@@ -239,7 +240,6 @@ store.initialPosition = _objectSpread({}, position); | ||
store.endEvent = e; | ||
var { | ||
el | ||
} = store; | ||
var _store = store, | ||
el = _store.el; | ||
var restoreDOM = () => { | ||
var restoreDOM = function restoreDOM() { | ||
if (opt.clone) { | ||
@@ -277,3 +277,3 @@ el.parentElement.removeChild(el); | ||
position: getPosition(el0), | ||
el | ||
el: el | ||
}; | ||
@@ -280,0 +280,0 @@ } |
/*! | ||
* draggable-helper v4.0.1 | ||
* draggable-helper v4.0.2 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Homepage: undefined | ||
* Released under the MIT License. | ||
@@ -33,20 +34,2 @@ */ | ||
var _typeof_1 = createCommonjsModule(function (module) { | ||
function _typeof(obj) { | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
module.exports = _typeof = function _typeof(obj) { | ||
return typeof obj; | ||
}; | ||
} else { | ||
module.exports = _typeof = function _typeof(obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
} | ||
return _typeof(obj); | ||
} | ||
module.exports = _typeof; | ||
}); | ||
var getPrototypeOf = createCommonjsModule(function (module) { | ||
@@ -111,2 +94,45 @@ function _getPrototypeOf(o) { | ||
var _typeof_1 = createCommonjsModule(function (module) { | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
module.exports = _typeof = function _typeof(obj) { | ||
return typeof obj; | ||
}; | ||
} else { | ||
module.exports = _typeof = function _typeof(obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
} | ||
return _typeof(obj); | ||
} | ||
module.exports = _typeof; | ||
}); | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) { | ||
arr2[i] = arr[i]; | ||
} | ||
return arr2; | ||
} | ||
var arrayLikeToArray = _arrayLikeToArray; | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(n); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen); | ||
} | ||
var unsupportedIterableToArray = _unsupportedIterableToArray; | ||
var runtime_1 = createCommonjsModule(function (module) { | ||
@@ -244,3 +270,3 @@ /** | ||
function AsyncIterator(generator) { | ||
function AsyncIterator(generator, PromiseImpl) { | ||
function invoke(method, arg, resolve, reject) { | ||
@@ -256,3 +282,3 @@ var record = tryCatch(generator[method], generator, arg); | ||
hasOwn.call(value, "__await")) { | ||
return Promise.resolve(value.__await).then(function(value) { | ||
return PromiseImpl.resolve(value.__await).then(function(value) { | ||
invoke("next", value, resolve, reject); | ||
@@ -264,3 +290,3 @@ }, function(err) { | ||
return Promise.resolve(value).then(function(unwrapped) { | ||
return PromiseImpl.resolve(value).then(function(unwrapped) { | ||
// When a yielded Promise is resolved, its final value becomes | ||
@@ -283,3 +309,3 @@ // the .value of the Promise<{value,done}> result for the | ||
function callInvokeWithMethodAndArg() { | ||
return new Promise(function(resolve, reject) { | ||
return new PromiseImpl(function(resolve, reject) { | ||
invoke(method, arg, resolve, reject); | ||
@@ -324,5 +350,8 @@ }); | ||
// the final result produced by the iterator. | ||
exports.async = function(innerFn, outerFn, self, tryLocsList) { | ||
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) { | ||
if (PromiseImpl === void 0) PromiseImpl = Promise; | ||
var iter = new AsyncIterator( | ||
wrap(innerFn, outerFn, self, tryLocsList) | ||
wrap(innerFn, outerFn, self, tryLocsList), | ||
PromiseImpl | ||
); | ||
@@ -846,9 +875,3 @@ | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { | ||
arr2[i] = arr[i]; | ||
} | ||
return arr2; | ||
} | ||
if (Array.isArray(arr)) return arrayLikeToArray(arr); | ||
} | ||
@@ -859,3 +882,3 @@ | ||
function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); | ||
} | ||
@@ -866,3 +889,3 @@ | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
@@ -873,3 +896,3 @@ | ||
function _toConsumableArray(arr) { | ||
return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread(); | ||
return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread(); | ||
} | ||
@@ -879,2 +902,10 @@ | ||
/*! | ||
* helper-js v1.4.36 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Homepage: undefined | ||
* Released under the MIT License. | ||
*/ | ||
function getOffsetParent(el) { | ||
@@ -1016,2 +1047,8 @@ var offsetParent = el.offsetParent; | ||
/*! | ||
* drag-event-service v1.0.4 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Homepage: undefined | ||
* Released under the MIT License. | ||
*/ | ||
var events = { | ||
@@ -1034,2 +1071,4 @@ start: ['mousedown', 'touchstart'], | ||
on: function on(el, name, handler, options) { | ||
var _hp$onDOM, _hp$onDOM2; | ||
var _resolveOptions = resolveOptions(options), | ||
@@ -1077,4 +1116,5 @@ args = _resolveOptions.args, | ||
onDOM.call.apply(onDOM, [null, el, events[name][0], wrapper].concat([].concat(toConsumableArray(args), toConsumableArray(mouseArgs)))); | ||
onDOM.call.apply(onDOM, [null, el, events[name][1], wrapper].concat([].concat(toConsumableArray(args), toConsumableArray(touchArgs)))); | ||
(_hp$onDOM = onDOM).call.apply(_hp$onDOM, [null, el, events[name][0], wrapper].concat([].concat(toConsumableArray(args), toConsumableArray(mouseArgs)))); | ||
(_hp$onDOM2 = onDOM).call.apply(_hp$onDOM2, [null, el, events[name][1], wrapper].concat([].concat(toConsumableArray(args), toConsumableArray(touchArgs)))); | ||
}, | ||
@@ -1094,4 +1134,8 @@ off: function off(el, name, handler, options) { | ||
if (handler === handler2) { | ||
offDOM.call.apply(offDOM, [null, el, events[name][0], wrapper].concat([].concat(toConsumableArray(args), toConsumableArray(mouseArgs)))); | ||
offDOM.call.apply(offDOM, [null, el, events[name][1], wrapper].concat([].concat(toConsumableArray(args), toConsumableArray(mouseArgs)))); | ||
var _hp$offDOM, _hp$offDOM2; | ||
(_hp$offDOM = offDOM).call.apply(_hp$offDOM, [null, el, events[name][0], wrapper].concat([].concat(toConsumableArray(args), toConsumableArray(mouseArgs)))); | ||
(_hp$offDOM2 = offDOM).call.apply(_hp$offDOM2, [null, el, events[name][1], wrapper].concat([].concat(toConsumableArray(args), toConsumableArray(mouseArgs)))); | ||
store.splice(i, 1); | ||
@@ -1098,0 +1142,0 @@ } |
/*! | ||
* draggable-helper v4.0.1 | ||
* draggable-helper v4.0.2 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Homepage: undefined | ||
* Released under the MIT License. | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).draggableHelper=e()}(this,(function(){"use strict";var t=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t};function e(t,e){return t(e={exports:{}},e.exports),e.exports}e((function(t){function e(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=e=function(t){return typeof t}:t.exports=e=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(r)}t.exports=e}));var r=e((function(t){function e(r){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},e(r)}t.exports=e}));var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t};e((function(t){function e(r,o,i){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=e=Reflect.get:t.exports=e=function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}},e(r,o,i||r)}t.exports=e})),e((function(t){function e(r,n){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(r,n)}t.exports=e})),e((function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r,n){var o=e&&e.prototype instanceof s?e:s,i=Object.create(o.prototype),a=new E(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return L()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=w(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=u(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function s(){}function f(){}function p(){}var h={};h[o]=function(){return this};var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==e&&r.call(v,o)&&(h=v);var d=p.prototype=s.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function m(t){var e;this._invoke=function(n,o){function i(){return new Promise((function(e,i){!function e(n,o,i,a){var c=u(t[n],t,o);if("throw"!==c.type){var l=c.arg,s=l.value;return s&&"object"==typeof s&&r.call(s,"__await")?Promise.resolve(s.__await).then((function(t){e("next",t,i,a)}),(function(t){e("throw",t,i,a)})):Promise.resolve(s).then((function(t){l.value=t,i(l)}),(function(t){return e("throw",t,i,a)}))}a(c.arg)}(n,o,e,i)}))}return e=e?e.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return f.prototype=d.constructor=p,p.constructor=f,p[a]=f.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(d),t},t.awrap=function(t){return{__await:t}},g(m.prototype),m.prototype[i]=function(){return this},t.AsyncIterator=m,t.async=function(e,r,n,o){var i=new m(c(e,r,n,o));return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},g(d),d[a]="Generator",d[o]=function(){return this},d.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=O,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));var o=function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}};var i=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)};var a=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")};var c=function(t){return o(t)||i(t)||a()};function u(t){for(var e=function(t){var e=t.offsetParent;return(!e||e===document.body&&"static"===getComputedStyle(document.body).position)&&(e=document.body.parentElement),e}(t),r={x:t.offsetLeft,y:t.offsetTop},n=t;(n=n.parentElement)!==e&&n;)r.x-=n.scrollLeft,r.y-=n.scrollTop;return r}function l(t){var e=t.getBoundingClientRect(),r=e.top-document.documentElement.clientTop,n=e.bottom,o=e.left-document.documentElement.clientLeft,i=e.right;return{top:r,right:i,bottom:n,left:o,width:e.width||i-o,height:e.height||n-r,x:o,y:r}}function s(t,e,r){for(var n=r&&r.withSelf?t:t.parentElement;n;){var o=e(n);if("break"===o)return;if(o)return n;n=n.parentElement}}function f(t,e){t["original_".concat(e)]=t.getAttribute(e)}function p(t,e){var r="original_".concat(e);t.setAttribute(e,t[r])}function h(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)}function y(t,e){h(t,e)||(t.classList?t.classList.add(e):t.className+=" "+e)}function v(t,e,r){for(var n=arguments.length,o=new Array(n>3?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];t.addEventListener?t.addEventListener.apply(t,[e,r].concat(o)):t.attachEvent&&t.attachEvent.apply(t,["on".concat(e),r].concat(o))}function d(t,e,r){for(var n=arguments.length,o=new Array(n>3?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];t.removeEventListener?t.removeEventListener.apply(t,[e,r].concat(o)):t.detachEvent&&t.detachEvent.apply(t,["on".concat(e),r].concat(o))}var g={start:["mousedown","touchstart"],move:["mousemove","touchmove"],end:["mouseup","touchend"]},m={isTouch:function(t){return t.type&&t.type.startsWith("touch")},_getStore:function(t){return t._wrapperStore||(t._wrapperStore=[]),t._wrapperStore},on:function(t,e,r,n){var o=w(n),i=o.args,a=o.mouseArgs,u=o.touchArgs,l=this._getStore(t),s=this,f=function(t){var n;if(s.isTouch(t))n={x:t.changedTouches[0].pageX,y:t.changedTouches[0].pageY};else if(n={x:t.pageX,y:t.pageY},"start"===e&&1!==t.which)return;return r.call(this,t,n)};l.push({handler:r,wrapper:f}),v.call.apply(v,[null,t,g[e][0],f].concat([].concat(c(i),c(a)))),v.call.apply(v,[null,t,g[e][1],f].concat([].concat(c(i),c(u))))},off:function(t,e,r,n){for(var o=w(n),i=o.args,a=o.mouseArgs,u=this._getStore(t),l=u.length-1;l>=0;l--){var s=u[l],f=s.handler,p=s.wrapper;r===f&&(d.call.apply(d,[null,t,g[e][0],p].concat([].concat(c(i),c(a)))),d.call.apply(d,[null,t,g[e][1],p].concat([].concat(c(i),c(a)))),u.splice(l,1))}}};function w(t){return t||(t={}),{args:t.args||[],mouseArgs:t.mouseArgs||[],touchArgs:t.touchArgs||[]}}function b(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function x(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?b(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var E=["INPUT","TEXTAREA","SELECT","OPTGROUP","OPTION"];return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=x({minTranslate:10,draggingClass:"dragging"},e);var r={movedCount:0},n=function(){m.off(t,"start",t._draggbleEventHandler),delete t._draggbleEventHandler};return t._draggbleEventHandler&&n(),t._draggbleEventHandler=o,m.on(t,"start",o),{destroy:n,options:e};function o(n,o){e.triggerBySelf&&n.target!==t||(E.includes(n.target.tagName)||h(n.target,"undraggable")||s(n.target,(function(e){return!!h(e,"undraggable")||(e===t?"break":void 0)}))||(n.preventDefault(),r.mouse={x:o.x,y:o.y},r.startEvent=n,r.initialMouse=x({},r.mouse),m.on(document,"move",a,{touchArgs:[{passive:!1}]}),m.on(window,"end",c)))}function i(t){var n=e.beforeDrag&&e.beforeDrag(r.startEvent,t,r,e);if(!1===n)return!1;var o=v(),i=o.el,a=o.position;if(r.el=i,r.initialPosition=x({},a),!1===(n=e.drag&&e.drag(r.startEvent,t,r,e)))return!1;var c=l(i),u=x({width:"".concat(Math.ceil(c.width),"px"),height:"".concat(Math.ceil(c.height),"px"),zIndex:9999,opacity:.8,position:"absolute",left:a.x+"px",top:a.y+"px"},e.style||e.getStyle&&e.getStyle(r,e)||{});for(var s in f(i,"style"),u)i.style[s]=u[s];f(i,"class"),y(i,e.draggingClass)}function a(t,n){t.preventDefault(),r.mouse={x:n.x,y:n.y};var o=r.move={x:r.mouse.x-r.initialMouse.x,y:r.mouse.y-r.initialMouse.y};if(0===r.movedCount&&e.minTranslate){var a=Math.pow(r.move.x,2),c=Math.pow(r.move.y,2);if(Math.pow(a+c,.5)<e.minTranslate)return}var u=!0;if(0===r.movedCount&&!1===i(t)&&(u=!1),u&&e.moving&&!1===e.moving(t,r,e)&&(u=!1),u){if(!r||!r.el)return;Object.assign(r.el.style,{left:r.initialPosition.x+o.x+"px",top:r.initialPosition.y+o.y+"px"}),r.movedCount++}}function c(t){if(m.off(document,"move",a,{touchArgs:[{passive:!1}]}),m.off(window,"end",c),r.movedCount>0){r.movedCount=0,r.endEvent=t;var n=r.el,o=function(){e.clone?n.parentElement.removeChild(n):(p(n,"style"),p(n,"class"))};e.restoreDOMManuallyOndrop||(o(),o=null),r.restoreDOM=o,e.drop&&e.drop(t,r,e)}r={movedCount:0}}function v(){var n=e.getEl?e.getEl(t,r,e):t,o=n;return r.originalEl=n,e.clone&&(o=n.cloneNode(!0),n.parentElement.appendChild(o)),{position:u(n),el:o}}}})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).draggableHelper=e()}(this,(function(){"use strict";var t=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t};function e(t,e){return t(e={exports:{}},e.exports),e.exports}var r=e((function(t){function e(r){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},e(r)}t.exports=e}));var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t};e((function(t){function e(r,o,i){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=e=Reflect.get:t.exports=e=function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(r):i.value}},e(r,o,i||r)}t.exports=e})),e((function(t){function e(r,n){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(r,n)}t.exports=e})),e((function(t){function e(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=e=function(t){return typeof t}:t.exports=e=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(r)}t.exports=e}));var o=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n};var i=function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}};e((function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r,n){var o=e&&e.prototype instanceof s?e:s,i=Object.create(o.prototype),a=new E(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return L()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=b(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=u(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(t,r,a),i}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l={};function s(){}function f(){}function p(){}var h={};h[o]=function(){return this};var y=Object.getPrototypeOf,d=y&&y(y(O([])));d&&d!==e&&r.call(d,o)&&(h=d);var v=p.prototype=s.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function m(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,c){var l=u(t[o],t,i);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(l.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return f.prototype=v.constructor=p,p.constructor=f,p[a]=f.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},g(m.prototype),m.prototype[i]=function(){return this},t.AsyncIterator=m,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new m(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(v),v[a]="Generator",v[o]=function(){return this},v.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=O,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));var a=function(t){if(Array.isArray(t))return o(t)};var c=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)};var u=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")};var l=function(t){return a(t)||c(t)||i(t)||u()}; | ||
/*! | ||
* helper-js v1.4.36 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Homepage: undefined | ||
* Released under the MIT License. | ||
*/function s(t){for(var e=function(t){var e=t.offsetParent;return(!e||e===document.body&&"static"===getComputedStyle(document.body).position)&&(e=document.body.parentElement),e}(t),r={x:t.offsetLeft,y:t.offsetTop},n=t;(n=n.parentElement)!==e&&n;)r.x-=n.scrollLeft,r.y-=n.scrollTop;return r}function f(t){var e=t.getBoundingClientRect(),r=e.top-document.documentElement.clientTop,n=e.bottom,o=e.left-document.documentElement.clientLeft,i=e.right;return{top:r,right:i,bottom:n,left:o,width:e.width||i-o,height:e.height||n-r,x:o,y:r}}function p(t,e,r){for(var n=r&&r.withSelf?t:t.parentElement;n;){var o=e(n);if("break"===o)return;if(o)return n;n=n.parentElement}}function h(t,e){t["original_".concat(e)]=t.getAttribute(e)}function y(t,e){var r="original_".concat(e);t.setAttribute(e,t[r])}function d(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)}function v(t,e){d(t,e)||(t.classList?t.classList.add(e):t.className+=" "+e)}function g(t,e,r){for(var n=arguments.length,o=new Array(n>3?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];t.addEventListener?t.addEventListener.apply(t,[e,r].concat(o)):t.attachEvent&&t.attachEvent.apply(t,["on".concat(e),r].concat(o))}function m(t,e,r){for(var n=arguments.length,o=new Array(n>3?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];t.removeEventListener?t.removeEventListener.apply(t,[e,r].concat(o)):t.detachEvent&&t.detachEvent.apply(t,["on".concat(e),r].concat(o))} | ||
/*! | ||
* drag-event-service v1.0.4 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Homepage: undefined | ||
* Released under the MIT License. | ||
*/var b={start:["mousedown","touchstart"],move:["mousemove","touchmove"],end:["mouseup","touchend"]},w={isTouch:function(t){return t.type&&t.type.startsWith("touch")},_getStore:function(t){return t._wrapperStore||(t._wrapperStore=[]),t._wrapperStore},on:function(t,e,r,n){var o,i,a=x(n),c=a.args,u=a.mouseArgs,s=a.touchArgs,f=this._getStore(t),p=this,h=function(t){var n;if(p.isTouch(t))n={x:t.changedTouches[0].pageX,y:t.changedTouches[0].pageY};else if(n={x:t.pageX,y:t.pageY},"start"===e&&1!==t.which)return;return r.call(this,t,n)};f.push({handler:r,wrapper:h}),(o=g).call.apply(o,[null,t,b[e][0],h].concat([].concat(l(c),l(u)))),(i=g).call.apply(i,[null,t,b[e][1],h].concat([].concat(l(c),l(s))))},off:function(t,e,r,n){for(var o=x(n),i=o.args,a=o.mouseArgs,c=this._getStore(t),u=c.length-1;u>=0;u--){var s,f,p=c[u],h=p.handler,y=p.wrapper;if(r===h)(s=m).call.apply(s,[null,t,b[e][0],y].concat([].concat(l(i),l(a)))),(f=m).call.apply(f,[null,t,b[e][1],y].concat([].concat(l(i),l(a)))),c.splice(u,1)}}};function x(t){return t||(t={}),{args:t.args||[],mouseArgs:t.mouseArgs||[],touchArgs:t.touchArgs||[]}}function E(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function O(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?E(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var L=["INPUT","TEXTAREA","SELECT","OPTGROUP","OPTION"];return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=O({minTranslate:10,draggingClass:"dragging"},e);var r={movedCount:0},n=function(){w.off(t,"start",t._draggbleEventHandler),delete t._draggbleEventHandler};return t._draggbleEventHandler&&n(),t._draggbleEventHandler=o,w.on(t,"start",o),{destroy:n,options:e};function o(n,o){e.triggerBySelf&&n.target!==t||(L.includes(n.target.tagName)||d(n.target,"undraggable")||p(n.target,(function(e){return!!d(e,"undraggable")||(e===t?"break":void 0)}))||(n.preventDefault(),r.mouse={x:o.x,y:o.y},r.startEvent=n,r.initialMouse=O({},r.mouse),w.on(document,"move",a,{touchArgs:[{passive:!1}]}),w.on(window,"end",c)))}function i(t){var n=e.beforeDrag&&e.beforeDrag(r.startEvent,t,r,e);if(!1===n)return!1;var o=u(),i=o.el,a=o.position;if(r.el=i,r.initialPosition=O({},a),!1===(n=e.drag&&e.drag(r.startEvent,t,r,e)))return!1;var c=f(i),l=O({width:"".concat(Math.ceil(c.width),"px"),height:"".concat(Math.ceil(c.height),"px"),zIndex:9999,opacity:.8,position:"absolute",left:a.x+"px",top:a.y+"px"},e.style||e.getStyle&&e.getStyle(r,e)||{});for(var s in h(i,"style"),l)i.style[s]=l[s];h(i,"class"),v(i,e.draggingClass)}function a(t,n){t.preventDefault(),r.mouse={x:n.x,y:n.y};var o=r.move={x:r.mouse.x-r.initialMouse.x,y:r.mouse.y-r.initialMouse.y};if(0===r.movedCount&&e.minTranslate){var a=Math.pow(r.move.x,2),c=Math.pow(r.move.y,2);if(Math.pow(a+c,.5)<e.minTranslate)return}var u=!0;if(0===r.movedCount&&!1===i(t)&&(u=!1),u&&e.moving&&!1===e.moving(t,r,e)&&(u=!1),u){if(!r||!r.el)return;Object.assign(r.el.style,{left:r.initialPosition.x+o.x+"px",top:r.initialPosition.y+o.y+"px"}),r.movedCount++}}function c(t){if(w.off(document,"move",a,{touchArgs:[{passive:!1}]}),w.off(window,"end",c),r.movedCount>0){r.movedCount=0,r.endEvent=t;var n=r.el,o=function(){e.clone?n.parentElement.removeChild(n):(y(n,"style"),y(n,"class"))};e.restoreDOMManuallyOndrop||(o(),o=null),r.restoreDOM=o,e.drop&&e.drop(t,r,e)}r={movedCount:0}}function u(){var n=e.getEl?e.getEl(t,r,e):t,o=n;return r.originalEl=n,e.clone&&(o=n.cloneNode(!0),n.parentElement.appendChild(o)),{position:s(n),el:o}}}})); |
{ | ||
"name": "draggable-helper", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "", | ||
@@ -11,3 +11,4 @@ "main": "dist/draggable-helper.cjs.js", | ||
"scripts": { | ||
"build": "rogo" | ||
"compile-scripts": "tsc --target ES6 --module CommonJS scripts/build.ts", | ||
"build": "rollup -c scripts/build.js & node scripts/build.js --report" | ||
}, | ||
@@ -24,10 +25,10 @@ "author": "phphe <phphe@outlook.com> (https://github.com/phphe)", | ||
"devDependencies": { | ||
"rogo": "^1.0.0" | ||
"rogo": "^2.0.2" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.7.7", | ||
"drag-event-service": "^1.0.3", | ||
"helper-js": "^1.4.27" | ||
"drag-event-service": "^1.0.4", | ||
"helper-js": "^1.4.36" | ||
}, | ||
"license": "MIT" | ||
} |
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
82190
1725
Updateddrag-event-service@^1.0.4
Updatedhelper-js@^1.4.36