drag-event-service
Advanced tools
Comparing version 1.0.3 to 1.0.4
/*! | ||
* drag-event-service v1.0.3 | ||
* drag-event-service v1.0.4 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Homepage: undefined | ||
* Released under the MIT License. | ||
@@ -8,5 +9,7 @@ */ | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var _toConsumableArray = _interopDefault(require('@babel/runtime/helpers/toConsumableArray')); | ||
var hp = require('helper-js'); | ||
// support desktop and mobile | ||
var events = { | ||
@@ -18,7 +21,6 @@ start: ['mousedown', 'touchstart'], | ||
var index = { | ||
isTouch(e) { | ||
isTouch: function isTouch(e) { | ||
return e.type && e.type.startsWith('touch'); | ||
}, | ||
_getStore(el) { | ||
_getStore: function _getStore(el) { | ||
if (!el._wrapperStore) { | ||
@@ -30,9 +32,9 @@ el._wrapperStore = []; | ||
}, | ||
on: function on(el, name, handler, options) { | ||
var _hp$onDOM, _hp$onDOM2; | ||
on(el, name, handler, options) { | ||
var { | ||
args, | ||
mouseArgs, | ||
touchArgs | ||
} = resolveOptions(options); | ||
var _resolveOptions = resolveOptions(options), | ||
args = _resolveOptions.args, | ||
mouseArgs = _resolveOptions.mouseArgs, | ||
touchArgs = _resolveOptions.touchArgs; | ||
@@ -70,4 +72,4 @@ var store = this._getStore(el); | ||
store.push({ | ||
handler, | ||
wrapper | ||
handler: handler, | ||
wrapper: wrapper | ||
}); // follow format will cause big bundle size | ||
@@ -77,24 +79,25 @@ // 以下写法将会使打包工具认为hp是上下文, 导致打包整个hp | ||
hp.onDOM.call(null, el, events[name][0], wrapper, ...[...args, ...mouseArgs]); | ||
hp.onDOM.call(null, el, events[name][1], wrapper, ...[...args, ...touchArgs]); | ||
(_hp$onDOM = hp.onDOM).call.apply(_hp$onDOM, [null, el, events[name][0], wrapper].concat([].concat(_toConsumableArray(args), _toConsumableArray(mouseArgs)))); | ||
(_hp$onDOM2 = hp.onDOM).call.apply(_hp$onDOM2, [null, el, events[name][1], wrapper].concat([].concat(_toConsumableArray(args), _toConsumableArray(touchArgs)))); | ||
}, | ||
off: function off(el, name, handler, options) { | ||
var _resolveOptions2 = resolveOptions(options), | ||
args = _resolveOptions2.args, | ||
mouseArgs = _resolveOptions2.mouseArgs; | ||
off(el, name, handler, options) { | ||
var { | ||
args, | ||
mouseArgs, | ||
touchArgs | ||
} = resolveOptions(options); | ||
var store = this._getStore(el); | ||
for (var i = store.length - 1; i >= 0; i--) { | ||
var { | ||
handler: handler2, | ||
wrapper | ||
} = store[i]; | ||
var _store$i = store[i], | ||
handler2 = _store$i.handler, | ||
wrapper = _store$i.wrapper; | ||
if (handler === handler2) { | ||
hp.offDOM.call(null, el, events[name][0], wrapper, ...[...args, ...mouseArgs]); | ||
hp.offDOM.call(null, el, events[name][1], wrapper, ...[...args, ...mouseArgs]); | ||
var _hp$offDOM, _hp$offDOM2; | ||
(_hp$offDOM = hp.offDOM).call.apply(_hp$offDOM, [null, el, events[name][0], wrapper].concat([].concat(_toConsumableArray(args), _toConsumableArray(mouseArgs)))); | ||
(_hp$offDOM2 = hp.offDOM).call.apply(_hp$offDOM2, [null, el, events[name][1], wrapper].concat([].concat(_toConsumableArray(args), _toConsumableArray(mouseArgs)))); | ||
store.splice(i, 1); | ||
@@ -104,3 +107,2 @@ } | ||
} | ||
}; | ||
@@ -117,5 +119,5 @@ | ||
return { | ||
args, | ||
mouseArgs, | ||
touchArgs | ||
args: args, | ||
mouseArgs: mouseArgs, | ||
touchArgs: touchArgs | ||
}; | ||
@@ -122,0 +124,0 @@ } |
/*! | ||
* drag-event-service v1.0.3 | ||
* drag-event-service v1.0.4 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Homepage: undefined | ||
* Released under the MIT License. | ||
*/ | ||
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray'; | ||
import { onDOM, offDOM } from 'helper-js'; | ||
// support desktop and mobile | ||
var events = { | ||
@@ -15,7 +16,6 @@ start: ['mousedown', 'touchstart'], | ||
var index = { | ||
isTouch(e) { | ||
isTouch: function isTouch(e) { | ||
return e.type && e.type.startsWith('touch'); | ||
}, | ||
_getStore(el) { | ||
_getStore: function _getStore(el) { | ||
if (!el._wrapperStore) { | ||
@@ -27,9 +27,9 @@ el._wrapperStore = []; | ||
}, | ||
on: function on(el, name, handler, options) { | ||
var _hp$onDOM, _hp$onDOM2; | ||
on(el, name, handler, options) { | ||
var { | ||
args, | ||
mouseArgs, | ||
touchArgs | ||
} = resolveOptions(options); | ||
var _resolveOptions = resolveOptions(options), | ||
args = _resolveOptions.args, | ||
mouseArgs = _resolveOptions.mouseArgs, | ||
touchArgs = _resolveOptions.touchArgs; | ||
@@ -67,4 +67,4 @@ var store = this._getStore(el); | ||
store.push({ | ||
handler, | ||
wrapper | ||
handler: handler, | ||
wrapper: wrapper | ||
}); // follow format will cause big bundle size | ||
@@ -74,24 +74,25 @@ // 以下写法将会使打包工具认为hp是上下文, 导致打包整个hp | ||
onDOM.call(null, el, events[name][0], wrapper, ...[...args, ...mouseArgs]); | ||
onDOM.call(null, el, events[name][1], wrapper, ...[...args, ...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)))); | ||
}, | ||
off: function off(el, name, handler, options) { | ||
var _resolveOptions2 = resolveOptions(options), | ||
args = _resolveOptions2.args, | ||
mouseArgs = _resolveOptions2.mouseArgs; | ||
off(el, name, handler, options) { | ||
var { | ||
args, | ||
mouseArgs, | ||
touchArgs | ||
} = resolveOptions(options); | ||
var store = this._getStore(el); | ||
for (var i = store.length - 1; i >= 0; i--) { | ||
var { | ||
handler: handler2, | ||
wrapper | ||
} = store[i]; | ||
var _store$i = store[i], | ||
handler2 = _store$i.handler, | ||
wrapper = _store$i.wrapper; | ||
if (handler === handler2) { | ||
offDOM.call(null, el, events[name][0], wrapper, ...[...args, ...mouseArgs]); | ||
offDOM.call(null, el, events[name][1], wrapper, ...[...args, ...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); | ||
@@ -101,3 +102,2 @@ } | ||
} | ||
}; | ||
@@ -114,5 +114,5 @@ | ||
return { | ||
args, | ||
mouseArgs, | ||
touchArgs | ||
args: args, | ||
mouseArgs: mouseArgs, | ||
touchArgs: touchArgs | ||
}; | ||
@@ -119,0 +119,0 @@ } |
/*! | ||
* drag-event-service v1.0.3 | ||
* drag-event-service v1.0.4 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Homepage: undefined | ||
* Released under the MIT License. | ||
@@ -12,16 +13,22 @@ */ | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { | ||
arr2[i] = arr[i]; | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
return arr2; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) { | ||
arr2[i] = arr[i]; | ||
} | ||
return arr2; | ||
} | ||
var arrayLikeToArray = _arrayLikeToArray; | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return arrayLikeToArray(arr); | ||
} | ||
var arrayWithoutHoles = _arrayWithoutHoles; | ||
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); | ||
} | ||
@@ -31,4 +38,15 @@ | ||
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; | ||
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."); | ||
} | ||
@@ -39,3 +57,3 @@ | ||
function _toConsumableArray(arr) { | ||
return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread(); | ||
return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread(); | ||
} | ||
@@ -49,20 +67,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) { | ||
@@ -127,2 +127,22 @@ 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; | ||
}); | ||
var runtime_1 = createCommonjsModule(function (module) { | ||
@@ -260,3 +280,3 @@ /** | ||
function AsyncIterator(generator) { | ||
function AsyncIterator(generator, PromiseImpl) { | ||
function invoke(method, arg, resolve, reject) { | ||
@@ -272,3 +292,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); | ||
@@ -280,3 +300,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 | ||
@@ -299,3 +319,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); | ||
@@ -340,5 +360,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 | ||
); | ||
@@ -861,2 +884,10 @@ | ||
/*! | ||
* helper-js v1.4.36 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Homepage: undefined | ||
* Released under the MIT License. | ||
*/ | ||
function onDOM(el, name, handler) { | ||
@@ -863,0 +894,0 @@ for (var _len6 = arguments.length, args = new Array(_len6 > 3 ? _len6 - 3 : 0), _key8 = 3; _key8 < _len6; _key8++) { |
/*! | ||
* drag-event-service v1.0.3 | ||
* drag-event-service v1.0.4 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Homepage: undefined | ||
* Released under the MIT License. | ||
*/ | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t=t||self).dragEventService=r()}(this,(function(){"use strict";var t=function(t){if(Array.isArray(t)){for(var r=0,e=new Array(t.length);r<t.length;r++)e[r]=t[r];return e}};var r=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)};var e=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")};var n=function(n){return t(n)||r(n)||e()};function o(t,r){return t(r={exports:{}},r.exports),r.exports}o((function(t){function r(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=r=function(t){return typeof t}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(e)}t.exports=r}));var i=o((function(t){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},r(e)}t.exports=r}));var a=function(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=i(t)););return t};o((function(t){function r(e,n,o){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=r=Reflect.get:t.exports=r=function(t,r,e){var n=a(t,r);if(n){var o=Object.getOwnPropertyDescriptor(n,r);return o.get?o.get.call(e):o.value}},r(e,n,o||e)}t.exports=r})),o((function(t){function r(e,n){return t.exports=r=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t},r(e,n)}t.exports=r})),o((function(t){var r=function(t){var r=Object.prototype,e=r.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,r,e,n){var o=r&&r.prototype instanceof s?r:s,i=Object.create(o.prototype),a=new E(n||[]);return i._invoke=function(t,r,e){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 _()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=w(a,e);if(c){if(c===f)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var s=u(t,r,e);if("normal"===s.type){if(n=e.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:e.done}}"throw"===s.type&&(n="completed",e.method="throw",e.arg=s.arg)}}}(t,e,a),i}function u(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function s(){}function l(){}function h(){}var p={};p[o]=function(){return this};var y=Object.getPrototypeOf,v=y&&y(y(L([])));v&&v!==r&&e.call(v,o)&&(p=v);var d=h.prototype=s.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(r){t[r]=function(t){return this._invoke(r,t)}}))}function m(t){var r;this._invoke=function(n,o){function i(){return new Promise((function(r,i){!function r(n,o,i,a){var c=u(t[n],t,o);if("throw"!==c.type){var f=c.arg,s=f.value;return s&&"object"==typeof s&&e.call(s,"__await")?Promise.resolve(s.__await).then((function(t){r("next",t,i,a)}),(function(t){r("throw",t,i,a)})):Promise.resolve(s).then((function(t){f.value=t,i(f)}),(function(t){return r("throw",t,i,a)}))}a(c.arg)}(n,o,r,i)}))}return r=r?r.then(i,i):i()}}function w(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,w(t,r),"throw"===r.method))return f;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=u(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,f;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function b(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function L(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n<t.length;)if(e.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return i.next=i}}return{next:_}}function _(){return{value:void 0,done:!0}}return l.prototype=d.constructor=h,h.constructor=l,h[a]=l.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===l||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,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(r,e,n,o){var i=new m(c(r,e,n,o));return t.isGeneratorFunction(e)?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 r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=L,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(b),!t)for(var r in this)"t"===r.charAt(0)&&e.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=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 r=this;function n(e,n){return a.type="throw",a.arg=t,r.next=e,n&&(r.method="next",r.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=e.call(i,"catchLoc"),u=e.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,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,r){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&&r&&(this.next=r),f},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),b(e),f}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;b(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:L(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}}));function c(t,r,e){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,[r,e].concat(o)):t.attachEvent&&t.attachEvent.apply(t,["on".concat(r),e].concat(o))}function u(t,r,e){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,[r,e].concat(o)):t.detachEvent&&t.detachEvent.apply(t,["on".concat(r),e].concat(o))}var f={start:["mousedown","touchstart"],move:["mousemove","touchmove"],end:["mouseup","touchend"]};function s(t){return t||(t={}),{args:t.args||[],mouseArgs:t.mouseArgs||[],touchArgs:t.touchArgs||[]}}return{isTouch:function(t){return t.type&&t.type.startsWith("touch")},_getStore:function(t){return t._wrapperStore||(t._wrapperStore=[]),t._wrapperStore},on:function(t,r,e,o){var i,a,u=s(o),l=u.args,h=u.mouseArgs,p=u.touchArgs,y=this._getStore(t),v=this,d=function(t){var n;if(v.isTouch(t))n={x:t.changedTouches[0].pageX,y:t.changedTouches[0].pageY};else if(n={x:t.pageX,y:t.pageY},"start"===r&&1!==t.which)return;return e.call(this,t,n)};y.push({handler:e,wrapper:d}),(i=c).call.apply(i,[null,t,f[r][0],d].concat([].concat(n(l),n(h)))),(a=c).call.apply(a,[null,t,f[r][1],d].concat([].concat(n(l),n(p))))},off:function(t,r,e,o){for(var i=s(o),a=i.args,c=i.mouseArgs,l=this._getStore(t),h=l.length-1;h>=0;h--){var p,y,v=l[h],d=v.handler,g=v.wrapper;if(e===d)(p=u).call.apply(p,[null,t,f[r][0],g].concat([].concat(n(a),n(c)))),(y=u).call.apply(y,[null,t,f[r][1],g].concat([].concat(n(a),n(c)))),l.splice(h,1)}}}})); | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t=t||self).dragEventService=r()}(this,(function(){"use strict";var t=function(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n};var r=function(r){if(Array.isArray(r))return t(r)};var e=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)};var n=function(r,e){if(r){if("string"==typeof r)return t(r,e);var n=Object.prototype.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(r,e):void 0}};var o=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 i=function(t){return r(t)||e(t)||n(t)||o()};function a(t,r){return t(r={exports:{}},r.exports),r.exports}var c=a((function(t){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},r(e)}t.exports=r}));var u=function(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=c(t)););return t};a((function(t){function r(e,n,o){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=r=Reflect.get:t.exports=r=function(t,r,e){var n=u(t,r);if(n){var o=Object.getOwnPropertyDescriptor(n,r);return o.get?o.get.call(e):o.value}},r(e,n,o||e)}t.exports=r})),a((function(t){function r(e,n){return t.exports=r=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t},r(e,n)}t.exports=r})),a((function(t){function r(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=r=function(t){return typeof t}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(e)}t.exports=r})),a((function(t){var r=function(t){var r=Object.prototype,e=r.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,r,e,n){var o=r&&r.prototype instanceof s?r:s,i=Object.create(o.prototype),a=new E(n||[]);return i._invoke=function(t,r,e){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 _()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=w(a,e);if(c){if(c===f)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var s=u(t,r,e);if("normal"===s.type){if(n=e.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:e.done}}"throw"===s.type&&(n="completed",e.method="throw",e.arg=s.arg)}}}(t,e,a),i}function u(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f={};function s(){}function l(){}function h(){}var p={};p[o]=function(){return this};var y=Object.getPrototypeOf,v=y&&y(y(L([])));v&&v!==r&&e.call(v,o)&&(p=v);var d=h.prototype=s.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(r){t[r]=function(t){return this._invoke(r,t)}}))}function m(t,r){var n;this._invoke=function(o,i){function a(){return new r((function(n,a){!function n(o,i,a,c){var f=u(t[o],t,i);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==typeof l&&e.call(l,"__await")?r.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):r.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(f.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,w(t,r),"throw"===r.method))return f;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=u(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,f;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function b(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function L(t){if(t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n<t.length;)if(e.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return i.next=i}}return{next:_}}function _(){return{value:void 0,done:!0}}return l.prototype=d.constructor=h,h.constructor=l,h[a]=l.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===l||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,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(r,e,n,o,i){void 0===i&&(i=Promise);var a=new m(c(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(d),d[a]="Generator",d[o]=function(){return this},d.toString=function(){return"[object Generator]"},t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=L,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(b),!t)for(var r in this)"t"===r.charAt(0)&&e.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=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 r=this;function n(e,n){return a.type="throw",a.arg=t,r.next=e,n&&(r.method="next",r.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=e.call(i,"catchLoc"),u=e.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,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,r){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&&r&&(this.next=r),f},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),b(e),f}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;b(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:L(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}})); | ||
/*! | ||
* helper-js v1.4.36 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Homepage: undefined | ||
* Released under the MIT License. | ||
*/ | ||
function f(t,r,e){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,[r,e].concat(o)):t.attachEvent&&t.attachEvent.apply(t,["on".concat(r),e].concat(o))}function s(t,r,e){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,[r,e].concat(o)):t.detachEvent&&t.detachEvent.apply(t,["on".concat(r),e].concat(o))}var l={start:["mousedown","touchstart"],move:["mousemove","touchmove"],end:["mouseup","touchend"]};function h(t){return t||(t={}),{args:t.args||[],mouseArgs:t.mouseArgs||[],touchArgs:t.touchArgs||[]}}return{isTouch:function(t){return t.type&&t.type.startsWith("touch")},_getStore:function(t){return t._wrapperStore||(t._wrapperStore=[]),t._wrapperStore},on:function(t,r,e,n){var o,a,c=h(n),u=c.args,s=c.mouseArgs,p=c.touchArgs,y=this._getStore(t),v=this,d=function(t){var n;if(v.isTouch(t))n={x:t.changedTouches[0].pageX,y:t.changedTouches[0].pageY};else if(n={x:t.pageX,y:t.pageY},"start"===r&&1!==t.which)return;return e.call(this,t,n)};y.push({handler:e,wrapper:d}),(o=f).call.apply(o,[null,t,l[r][0],d].concat([].concat(i(u),i(s)))),(a=f).call.apply(a,[null,t,l[r][1],d].concat([].concat(i(u),i(p))))},off:function(t,r,e,n){for(var o=h(n),a=o.args,c=o.mouseArgs,u=this._getStore(t),f=u.length-1;f>=0;f--){var p,y,v=u[f],d=v.handler,g=v.wrapper;if(e===d)(p=s).call.apply(p,[null,t,l[r][0],g].concat([].concat(i(a),i(c)))),(y=s).call.apply(y,[null,t,l[r][1],g].concat([].concat(i(a),i(c)))),u.splice(f,1)}}}})); |
{ | ||
"name": "drag-event-service", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "", | ||
@@ -8,3 +8,4 @@ "main": "dist/drag-event-service.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" | ||
}, | ||
@@ -21,9 +22,9 @@ "author": "phphe <phphe@outlook.com> (https://github.com/phphe)", | ||
"devDependencies": { | ||
"rogo": "^1.0.0" | ||
"rogo": "^2.0.2" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.7.7", | ||
"helper-js": "^1.4.27" | ||
"helper-js": "^1.4.36" | ||
}, | ||
"license": "MIT" | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
63684
10
1395
0
Updatedhelper-js@^1.4.36