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

draggable-helper

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

draggable-helper - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

97

dist/draggable-helper.cjs.js
/*!
* draggable-helper v3.0.0
* draggable-helper v3.0.1
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)

@@ -59,8 +59,22 @@ * Released under the MIT License.

/*!
* helper-js v1.4.13
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}
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;
}
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
function getOffsetParent(el) {

@@ -78,2 +92,3 @@ var offsetParent = el.offsetParent;

function getPosition(el) {

@@ -100,2 +115,3 @@ var offsetParent = getOffsetParent(el);

} // get position of a el if its offset is given. like jQuery.offset.
function getBoundingClientRect(el) {

@@ -126,2 +142,3 @@ // refer: http://www.51xuediannao.com/javascript/getBoundingClientRect.html

}
function findParent(el, callback, opt) {

@@ -142,2 +159,3 @@ var cur = opt && opt.withSelf ? el : el.parentElement;

}
function backupAttr(el, name) {

@@ -147,2 +165,3 @@ var key = "original_".concat(name);

}
function restoreAttr(el, name) {

@@ -153,2 +172,3 @@ var key = "original_".concat(name);

function hasClass(el, className) {

@@ -162,2 +182,3 @@ if (el.classList) {

function addClass(el, className) {

@@ -174,10 +195,15 @@ if (!hasClass(el, className)) {

/*!
* helper-js v1.3.9
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
* drag-event-service v1.0.1
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
/*!
* helper-js v1.4.14
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
function onDOM(el, name, handler) {
for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key6 = 3; _key6 < _len5; _key6++) {
args[_key6 - 3] = arguments[_key6];
for (var _len6 = arguments.length, args = new Array(_len6 > 3 ? _len6 - 3 : 0), _key8 = 3; _key8 < _len6; _key8++) {
args[_key8 - 3] = arguments[_key8];
}

@@ -193,5 +219,6 @@

}
function offDOM(el, name, handler) {
for (var _len6 = arguments.length, args = new Array(_len6 > 3 ? _len6 - 3 : 0), _key7 = 3; _key7 < _len6; _key7++) {
args[_key7 - 3] = arguments[_key7];
for (var _len7 = arguments.length, args = new Array(_len7 > 3 ? _len7 - 3 : 0), _key9 = 3; _key9 < _len7; _key9++) {
args[_key9 - 3] = arguments[_key9];
}

@@ -206,30 +233,5 @@

}
}
} // support desktop and mobile
/*!
* drag-event-service v1.0.0
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}
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;
}
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
var events = {

@@ -252,4 +254,2 @@ start: ['mousedown', 'touchstart'],

on: function on(el, name, handler, options) {
var _hp$onDOM, _hp$onDOM2;
var _resolveOptions = resolveOptions(options),

@@ -297,5 +297,4 @@ args = _resolveOptions.args,

(_hp$onDOM = onDOM).call.apply(_hp$onDOM, [null, el, events[name][0], wrapper].concat(_toConsumableArray(args).concat(_toConsumableArray(mouseArgs))));
(_hp$onDOM2 = onDOM).call.apply(_hp$onDOM2, [null, el, events[name][1], wrapper].concat(_toConsumableArray(args).concat(_toConsumableArray(touchArgs))));
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))));
},

@@ -315,8 +314,4 @@ off: function off(el, name, handler, options) {

if (handler === handler2) {
var _hp$offDOM, _hp$offDOM2;
(_hp$offDOM = offDOM).call.apply(_hp$offDOM, [null, el, events[name][0], wrapper].concat(_toConsumableArray(args).concat(_toConsumableArray(mouseArgs))));
(_hp$offDOM2 = offDOM).call.apply(_hp$offDOM2, [null, el, events[name][1], wrapper].concat(_toConsumableArray(args).concat(_toConsumableArray(mouseArgs))));
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))));
store.splice(i, 1);

@@ -323,0 +318,0 @@ }

/*!
* draggable-helper v3.0.0
* draggable-helper v3.0.1
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)

@@ -55,8 +55,22 @@ * Released under the MIT License.

/*!
* helper-js v1.4.13
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}
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;
}
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
function getOffsetParent(el) {

@@ -74,2 +88,3 @@ var offsetParent = el.offsetParent;

function getPosition(el) {

@@ -96,2 +111,3 @@ var offsetParent = getOffsetParent(el);

} // get position of a el if its offset is given. like jQuery.offset.
function getBoundingClientRect(el) {

@@ -122,2 +138,3 @@ // refer: http://www.51xuediannao.com/javascript/getBoundingClientRect.html

}
function findParent(el, callback, opt) {

@@ -138,2 +155,3 @@ var cur = opt && opt.withSelf ? el : el.parentElement;

}
function backupAttr(el, name) {

@@ -143,2 +161,3 @@ var key = "original_".concat(name);

}
function restoreAttr(el, name) {

@@ -149,2 +168,3 @@ var key = "original_".concat(name);

function hasClass(el, className) {

@@ -158,2 +178,3 @@ if (el.classList) {

function addClass(el, className) {

@@ -170,10 +191,15 @@ if (!hasClass(el, className)) {

/*!
* helper-js v1.3.9
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
* drag-event-service v1.0.1
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
/*!
* helper-js v1.4.14
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
function onDOM(el, name, handler) {
for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key6 = 3; _key6 < _len5; _key6++) {
args[_key6 - 3] = arguments[_key6];
for (var _len6 = arguments.length, args = new Array(_len6 > 3 ? _len6 - 3 : 0), _key8 = 3; _key8 < _len6; _key8++) {
args[_key8 - 3] = arguments[_key8];
}

@@ -189,5 +215,6 @@

}
function offDOM(el, name, handler) {
for (var _len6 = arguments.length, args = new Array(_len6 > 3 ? _len6 - 3 : 0), _key7 = 3; _key7 < _len6; _key7++) {
args[_key7 - 3] = arguments[_key7];
for (var _len7 = arguments.length, args = new Array(_len7 > 3 ? _len7 - 3 : 0), _key9 = 3; _key9 < _len7; _key9++) {
args[_key9 - 3] = arguments[_key9];
}

@@ -202,30 +229,5 @@

}
}
} // support desktop and mobile
/*!
* drag-event-service v1.0.0
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}
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;
}
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
var events = {

@@ -248,4 +250,2 @@ start: ['mousedown', 'touchstart'],

on: function on(el, name, handler, options) {
var _hp$onDOM, _hp$onDOM2;
var _resolveOptions = resolveOptions(options),

@@ -293,5 +293,4 @@ args = _resolveOptions.args,

(_hp$onDOM = onDOM).call.apply(_hp$onDOM, [null, el, events[name][0], wrapper].concat(_toConsumableArray(args).concat(_toConsumableArray(mouseArgs))));
(_hp$onDOM2 = onDOM).call.apply(_hp$onDOM2, [null, el, events[name][1], wrapper].concat(_toConsumableArray(args).concat(_toConsumableArray(touchArgs))));
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))));
},

@@ -311,8 +310,4 @@ off: function off(el, name, handler, options) {

if (handler === handler2) {
var _hp$offDOM, _hp$offDOM2;
(_hp$offDOM = offDOM).call.apply(_hp$offDOM, [null, el, events[name][0], wrapper].concat(_toConsumableArray(args).concat(_toConsumableArray(mouseArgs))));
(_hp$offDOM2 = offDOM).call.apply(_hp$offDOM2, [null, el, events[name][1], wrapper].concat(_toConsumableArray(args).concat(_toConsumableArray(mouseArgs))));
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))));
store.splice(i, 1);

@@ -319,0 +314,0 @@ }

/*!
* draggable-helper v3.0.0
* draggable-helper v3.0.1
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)

@@ -61,8 +61,22 @@ * Released under the MIT License.

/*!
* helper-js v1.4.13
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}
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;
}
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
function getOffsetParent(el) {

@@ -80,2 +94,3 @@ var offsetParent = el.offsetParent;

function getPosition(el) {

@@ -102,2 +117,3 @@ var offsetParent = getOffsetParent(el);

} // get position of a el if its offset is given. like jQuery.offset.
function getBoundingClientRect(el) {

@@ -128,2 +144,3 @@ // refer: http://www.51xuediannao.com/javascript/getBoundingClientRect.html

}
function findParent(el, callback, opt) {

@@ -144,2 +161,3 @@ var cur = opt && opt.withSelf ? el : el.parentElement;

}
function backupAttr(el, name) {

@@ -149,2 +167,3 @@ var key = "original_".concat(name);

}
function restoreAttr(el, name) {

@@ -155,2 +174,3 @@ var key = "original_".concat(name);

function hasClass(el, className) {

@@ -164,2 +184,3 @@ if (el.classList) {

function addClass(el, className) {

@@ -176,10 +197,15 @@ if (!hasClass(el, className)) {

/*!
* helper-js v1.3.9
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
* drag-event-service v1.0.1
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
/*!
* helper-js v1.4.14
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
function onDOM(el, name, handler) {
for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key6 = 3; _key6 < _len5; _key6++) {
args[_key6 - 3] = arguments[_key6];
for (var _len6 = arguments.length, args = new Array(_len6 > 3 ? _len6 - 3 : 0), _key8 = 3; _key8 < _len6; _key8++) {
args[_key8 - 3] = arguments[_key8];
}

@@ -195,5 +221,6 @@

}
function offDOM(el, name, handler) {
for (var _len6 = arguments.length, args = new Array(_len6 > 3 ? _len6 - 3 : 0), _key7 = 3; _key7 < _len6; _key7++) {
args[_key7 - 3] = arguments[_key7];
for (var _len7 = arguments.length, args = new Array(_len7 > 3 ? _len7 - 3 : 0), _key9 = 3; _key9 < _len7; _key9++) {
args[_key9 - 3] = arguments[_key9];
}

@@ -208,30 +235,5 @@

}
}
} // support desktop and mobile
/*!
* drag-event-service v1.0.0
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}
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;
}
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
var events = {

@@ -254,4 +256,2 @@ start: ['mousedown', 'touchstart'],

on: function on(el, name, handler, options) {
var _hp$onDOM, _hp$onDOM2;
var _resolveOptions = resolveOptions(options),

@@ -299,5 +299,4 @@ args = _resolveOptions.args,

(_hp$onDOM = onDOM).call.apply(_hp$onDOM, [null, el, events[name][0], wrapper].concat(_toConsumableArray(args).concat(_toConsumableArray(mouseArgs))));
(_hp$onDOM2 = onDOM).call.apply(_hp$onDOM2, [null, el, events[name][1], wrapper].concat(_toConsumableArray(args).concat(_toConsumableArray(touchArgs))));
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))));
},

@@ -317,8 +316,4 @@ off: function off(el, name, handler, options) {

if (handler === handler2) {
var _hp$offDOM, _hp$offDOM2;
(_hp$offDOM = offDOM).call.apply(_hp$offDOM, [null, el, events[name][0], wrapper].concat(_toConsumableArray(args).concat(_toConsumableArray(mouseArgs))));
(_hp$offDOM2 = offDOM).call.apply(_hp$offDOM2, [null, el, events[name][1], wrapper].concat(_toConsumableArray(args).concat(_toConsumableArray(mouseArgs))));
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))));
store.splice(i, 1);

@@ -325,0 +320,0 @@ }

/*!
* draggable-helper v3.0.0
* draggable-helper v3.0.1
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).draggableHelper={})}(this,(function(t){"use strict";function e(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function r(t){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?n(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).draggableHelper={})}(this,(function(t){"use strict";function e(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function r(t){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?n(Object(o),!0).forEach((function(n){e(t,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function o(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function a(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),n={x:t.offsetLeft,y:t.offsetTop},r=t;(r=r.parentElement)!==e&&r;)n.x-=r.scrollLeft,n.y-=r.scrollTop;return n}function i(t,e){t["original_".concat(e)]=t.getAttribute(e)}function c(t,e){var n="original_".concat(e);t.setAttribute(e,t[n])}function l(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)}
/*!
* helper-js v1.4.13
* drag-event-service v1.0.1
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/function o(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),n={x:t.offsetLeft,y:t.offsetTop},r=t;(r=r.parentElement)!==e&&r;)n.x-=r.scrollLeft,n.y-=r.scrollTop;return n}function a(t,e){t["original_".concat(e)]=t.getAttribute(e)}function i(t,e){var n="original_".concat(e);t.setAttribute(e,t[n])}function c(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)}
*/
/*!
* helper-js v1.3.9
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
function l(t,e,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),a=3;a<r;a++)o[a-3]=arguments[a];t.addEventListener?t.addEventListener.apply(t,[e,n].concat(o)):t.attachEvent&&t.attachEvent.apply(t,["on".concat(e),n].concat(o))}function u(t,e,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),a=3;a<r;a++)o[a-3]=arguments[a];t.removeEventListener?t.removeEventListener.apply(t,[e,n].concat(o)):t.detachEvent&&t.detachEvent.apply(t,["on".concat(e),n].concat(o))}
/*!
* drag-event-service v1.0.0
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/function s(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var f={start:["mousedown","touchstart"],move:["mousemove","touchmove"],end:["mouseup","touchend"]},p={isTouch:function(t){return t.type&&t.type.startsWith("touch")},_getStore:function(t){return t._wrapperStore||(t._wrapperStore=[]),t._wrapperStore},on:function(t,e,n,r){var o,a,i=g(r),c=i.args,u=i.mouseArgs,p=i.touchArgs,d=this._getStore(t),v=this,m=function(t){var r;if(v.isTouch(t))r={x:t.changedTouches[0].pageX,y:t.changedTouches[0].pageY};else if(r={x:t.pageX,y:t.pageY},"start"===e&&1!==t.which)return;return n.call(this,t,r)};d.push({handler:n,wrapper:m}),(o=l).call.apply(o,[null,t,f[e][0],m].concat(s(c).concat(s(u)))),(a=l).call.apply(a,[null,t,f[e][1],m].concat(s(c).concat(s(p))))},off:function(t,e,n,r){for(var o=g(r),a=o.args,i=o.mouseArgs,c=this._getStore(t),l=c.length-1;l>=0;l--){var p,d,v=c[l],m=v.handler,y=v.wrapper;if(n===m)(p=u).call.apply(p,[null,t,f[e][0],y].concat(s(a).concat(s(i)))),(d=u).call.apply(d,[null,t,f[e][1],y].concat(s(a).concat(s(i)))),c.splice(l,1)}}};function g(t){return t||(t={}),{args:t.args||[],mouseArgs:t.mouseArgs||[],touchArgs:t.touchArgs||[]}}var d=["INPUT","TEXTAREA","SELECT","OPTGROUP","OPTION"],v="undraggable";t.default=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=r({minTranslate:10,draggingClass:"dragging"},e);var n={movedCount:0},l=function(){p.off(t,"start",t._draggbleEventHandler),delete t._draggbleEventHandler};return t._draggbleEventHandler&&l(),t._draggbleEventHandler=u,p.on(t,"start",u),l;function u(o,a){e.triggerBySelf&&o.target!==t||(d.includes(o.target.tagName)||c(o.target,v)||function(t,e,n){for(var r=n&&n.withSelf?t:t.parentElement;r;){var o=e(r);if("break"===o)return;if(o)return r;r=r.parentElement}}(o.target,(function(e){return!!c(e,v)||(e===t?"break":void 0)}))||(o.preventDefault(),n.mouse={x:a.x,y:a.y},n.startEvent=o,n.initialMouse=r({},n.mouse),p.on(document,"move",f,{touchArgs:[{passive:!1}]}),p.on(window,"end",g)))}function s(i){var l=e.beforeDrag&&e.beforeDrag(n.startEvent,i,n,e);if(!1===l)return!1;var u=function(){var r=e.getEl?e.getEl(t,n,e):t,a=r;n.originalEl=r,e.clone&&(a=r.cloneNode(!0),r.parentElement.appendChild(a));return{position:o(r),el:a}}(),s=u.el,f=u.position;if(n.el=s,n.initialPosition=r({},f),!1===(l=e.drag&&e.drag(n.startEvent,i,n,e)))return!1;var p=function(t){var e=t.getBoundingClientRect(),n=e.top-document.documentElement.clientTop,r=e.bottom,o=e.left-document.documentElement.clientLeft,a=e.right;return{top:n,right:a,bottom:r,left:o,width:e.width||a-o,height:e.height||r-n,x:o,y:n}}(s),g=r({width:"".concat(Math.ceil(p.width),"px"),height:"".concat(Math.ceil(p.height),"px"),zIndex:9999,opacity:.8,position:"absolute",left:f.x+"px",top:f.y+"px"},e.style||e.getStyle&&e.getStyle(n,e)||{});for(var d in a(s,"style"),g)s.style[d]=g[d];a(s,"class"),function(t,e){c(t,e)||(t.classList?t.classList.add(e):t.className+=" "+e)}(s,e.draggingClass)}function f(t,r){t.preventDefault(),n.mouse={x:r.x,y:r.y};var o=n.move={x:n.mouse.x-n.initialMouse.x,y:n.mouse.y-n.initialMouse.y};if(0===n.movedCount&&e.minTranslate){var a=Math.pow(n.move.x,2),i=Math.pow(n.move.y,2);if(Math.pow(a+i,.5)<e.minTranslate)return}var c=!0;if(0===n.movedCount&&!1===s(t)&&(c=!1),c&&e.moving&&!1===e.moving(t,n,e)&&(c=!1),c){if(!n||!n.el)return;Object.assign(n.el.style,{left:n.initialPosition.x+o.x+"px",top:n.initialPosition.y+o.y+"px"}),n.movedCount++}}function g(t){if(p.off(document,"move",f,{touchArgs:[{passive:!1}]}),p.off(window,"end",g),n.movedCount>0){n.movedCount=0,n.endEvent=t;var r=n.el;e.clone?r.parentElement.removeChild(r):(i(r,"style"),i(r,"class")),e.drop&&e.drop(t,n,e)}n={movedCount:0}}},Object.defineProperty(t,"__esModule",{value:!0})}));
* helper-js v1.4.14
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
function u(t,e,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),a=3;a<r;a++)o[a-3]=arguments[a];t.addEventListener?t.addEventListener.apply(t,[e,n].concat(o)):t.attachEvent&&t.attachEvent.apply(t,["on".concat(e),n].concat(o))}function s(t,e,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),a=3;a<r;a++)o[a-3]=arguments[a];t.removeEventListener?t.removeEventListener.apply(t,[e,n].concat(o)):t.detachEvent&&t.detachEvent.apply(t,["on".concat(e),n].concat(o))}var f={start:["mousedown","touchstart"],move:["mousemove","touchmove"],end:["mouseup","touchend"]},p={isTouch:function(t){return t.type&&t.type.startsWith("touch")},_getStore:function(t){return t._wrapperStore||(t._wrapperStore=[]),t._wrapperStore},on:function(t,e,n,r){var a=g(r),i=a.args,c=a.mouseArgs,l=a.touchArgs,s=this._getStore(t),p=this,d=function(t){var r;if(p.isTouch(t))r={x:t.changedTouches[0].pageX,y:t.changedTouches[0].pageY};else if(r={x:t.pageX,y:t.pageY},"start"===e&&1!==t.which)return;return n.call(this,t,r)};s.push({handler:n,wrapper:d}),u.call.apply(u,[null,t,f[e][0],d].concat([].concat(o(i),o(c)))),u.call.apply(u,[null,t,f[e][1],d].concat([].concat(o(i),o(l))))},off:function(t,e,n,r){for(var a=g(r),i=a.args,c=a.mouseArgs,l=this._getStore(t),u=l.length-1;u>=0;u--){var p=l[u],d=p.handler,v=p.wrapper;n===d&&(s.call.apply(s,[null,t,f[e][0],v].concat([].concat(o(i),o(c)))),s.call.apply(s,[null,t,f[e][1],v].concat([].concat(o(i),o(c)))),l.splice(u,1))}}};function g(t){return t||(t={}),{args:t.args||[],mouseArgs:t.mouseArgs||[],touchArgs:t.touchArgs||[]}}var d=["INPUT","TEXTAREA","SELECT","OPTGROUP","OPTION"],v="undraggable";t.default=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=r({minTranslate:10,draggingClass:"dragging"},e);var n={movedCount:0},o=function(){p.off(t,"start",t._draggbleEventHandler),delete t._draggbleEventHandler};return t._draggbleEventHandler&&o(),t._draggbleEventHandler=u,p.on(t,"start",u),o;function u(o,a){e.triggerBySelf&&o.target!==t||(d.includes(o.target.tagName)||l(o.target,v)||function(t,e,n){for(var r=n&&n.withSelf?t:t.parentElement;r;){var o=e(r);if("break"===o)return;if(o)return r;r=r.parentElement}}(o.target,(function(e){return!!l(e,v)||(e===t?"break":void 0)}))||(o.preventDefault(),n.mouse={x:a.x,y:a.y},n.startEvent=o,n.initialMouse=r({},n.mouse),p.on(document,"move",f,{touchArgs:[{passive:!1}]}),p.on(window,"end",g)))}function s(o){var c=e.beforeDrag&&e.beforeDrag(n.startEvent,o,n,e);if(!1===c)return!1;var u=function(){var r=e.getEl?e.getEl(t,n,e):t,o=r;n.originalEl=r,e.clone&&(o=r.cloneNode(!0),r.parentElement.appendChild(o));return{position:a(r),el:o}}(),s=u.el,f=u.position;if(n.el=s,n.initialPosition=r({},f),!1===(c=e.drag&&e.drag(n.startEvent,o,n,e)))return!1;var p=function(t){var e=t.getBoundingClientRect(),n=e.top-document.documentElement.clientTop,r=e.bottom,o=e.left-document.documentElement.clientLeft,a=e.right;return{top:n,right:a,bottom:r,left:o,width:e.width||a-o,height:e.height||r-n,x:o,y:n}}(s),g=r({width:"".concat(Math.ceil(p.width),"px"),height:"".concat(Math.ceil(p.height),"px"),zIndex:9999,opacity:.8,position:"absolute",left:f.x+"px",top:f.y+"px"},e.style||e.getStyle&&e.getStyle(n,e)||{});for(var d in i(s,"style"),g)s.style[d]=g[d];i(s,"class"),function(t,e){l(t,e)||(t.classList?t.classList.add(e):t.className+=" "+e)}(s,e.draggingClass)}function f(t,r){t.preventDefault(),n.mouse={x:r.x,y:r.y};var o=n.move={x:n.mouse.x-n.initialMouse.x,y:n.mouse.y-n.initialMouse.y};if(0===n.movedCount&&e.minTranslate){var a=Math.pow(n.move.x,2),i=Math.pow(n.move.y,2);if(Math.pow(a+i,.5)<e.minTranslate)return}var c=!0;if(0===n.movedCount&&!1===s(t)&&(c=!1),c&&e.moving&&!1===e.moving(t,n,e)&&(c=!1),c){if(!n||!n.el)return;Object.assign(n.el.style,{left:n.initialPosition.x+o.x+"px",top:n.initialPosition.y+o.y+"px"}),n.movedCount++}}function g(t){if(p.off(document,"move",f,{touchArgs:[{passive:!1}]}),p.off(window,"end",g),n.movedCount>0){n.movedCount=0,n.endEvent=t;var r=n.el;e.clone?r.parentElement.removeChild(r):(c(r,"style"),c(r,"class")),e.drop&&e.drop(t,n,e)}n={movedCount:0}}},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=draggable-helper.min.js.map
{
"name": "draggable-helper",
"version": "3.0.0",
"version": "3.0.1",
"description": "",

@@ -11,4 +11,5 @@ "main": "dist/draggable-helper.cjs.js",

"scripts": {
"build": "node build/build.js",
"dev": "node build/build.js --watch"
"build": "node scripts/build.js",
"dev": "node scripts/build.js --watch",
"build-test": "rollup -c"
},

@@ -25,21 +26,9 @@ "author": "phphe <phphe@outlook.com> (https://github.com/phphe)",

"devDependencies": {
"@babel/core": "^7.7.7",
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-proposal-export-namespace-from": "^7.7.4",
"@babel/plugin-proposal-json-strings": "^7.7.4",
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
"@babel/plugin-syntax-import-meta": "^7.7.4",
"@babel/preset-env": "^7.7.7",
"@rollup/plugin-json": "^4.0.1",
"@rollup/plugin-node-resolve": "^6.0.0",
"commander": "^4.0.1",
"rollup": "^1.27.14",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-terser": "^5.1.3"
"rollup-helper": "^2.0.1"
},
"dependencies": {
"helper-js": "^1.4.13",
"drag-event-service": "^1.0.0"
"drag-event-service": "^1.0.1",
"helper-js": "^1.4.14"
},
"license": "MIT"
}

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