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 4.0.0 to 4.0.1

2

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

@@ -4,0 +4,0 @@ * Released under the MIT License.

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

@@ -4,0 +4,0 @@ * Released under the MIT License.

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

@@ -29,8 +29,841 @@ * Released under the MIT License.

/*!
* helper-js v1.4.25
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
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) {
function _getPrototypeOf(o) {
module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
module.exports = _getPrototypeOf;
});
function _superPropBase(object, property) {
while (!Object.prototype.hasOwnProperty.call(object, property)) {
object = getPrototypeOf(object);
if (object === null) break;
}
return object;
}
var superPropBase = _superPropBase;
var get = createCommonjsModule(function (module) {
function _get(target, property, receiver) {
if (typeof Reflect !== "undefined" && Reflect.get) {
module.exports = _get = Reflect.get;
} else {
module.exports = _get = function _get(target, property, receiver) {
var base = superPropBase(target, property);
if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) {
return desc.get.call(receiver);
}
return desc.value;
};
}
return _get(target, property, receiver || target);
}
module.exports = _get;
});
var setPrototypeOf = createCommonjsModule(function (module) {
function _setPrototypeOf(o, p) {
module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
module.exports = _setPrototypeOf;
});
var runtime_1 = createCommonjsModule(function (module) {
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var runtime = (function (exports) {
var Op = Object.prototype;
var hasOwn = Op.hasOwnProperty;
var undefined$1; // More compressible than void 0.
var $Symbol = typeof Symbol === "function" ? Symbol : {};
var iteratorSymbol = $Symbol.iterator || "@@iterator";
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function wrap(innerFn, outerFn, self, tryLocsList) {
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
var generator = Object.create(protoGenerator.prototype);
var context = new Context(tryLocsList || []);
// The ._invoke method unifies the implementations of the .next,
// .throw, and .return methods.
generator._invoke = makeInvokeMethod(innerFn, self, context);
return generator;
}
exports.wrap = wrap;
// Try/catch helper to minimize deoptimizations. Returns a completion
// record like context.tryEntries[i].completion. This interface could
// have been (and was previously) designed to take a closure to be
// invoked without arguments, but in all the cases we care about we
// already have an existing method we want to call, so there's no need
// to create a new function object. We can even get away with assuming
// the method takes exactly one argument, since that happens to be true
// in every case, so we don't have to touch the arguments object. The
// only additional allocation required is the completion record, which
// has a stable shape and so hopefully should be cheap to allocate.
function tryCatch(fn, obj, arg) {
try {
return { type: "normal", arg: fn.call(obj, arg) };
} catch (err) {
return { type: "throw", arg: err };
}
}
var GenStateSuspendedStart = "suspendedStart";
var GenStateSuspendedYield = "suspendedYield";
var GenStateExecuting = "executing";
var GenStateCompleted = "completed";
// Returning this object from the innerFn has the same effect as
// breaking out of the dispatch switch statement.
var ContinueSentinel = {};
// Dummy constructor functions that we use as the .constructor and
// .constructor.prototype properties for functions that return Generator
// objects. For full spec compliance, you may wish to configure your
// minifier not to mangle the names of these two functions.
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
// This is a polyfill for %IteratorPrototype% for environments that
// don't natively support it.
var IteratorPrototype = {};
IteratorPrototype[iteratorSymbol] = function () {
return this;
};
var getProto = Object.getPrototypeOf;
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
if (NativeIteratorPrototype &&
NativeIteratorPrototype !== Op &&
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
// This environment has a native %IteratorPrototype%; use it instead
// of the polyfill.
IteratorPrototype = NativeIteratorPrototype;
}
var Gp = GeneratorFunctionPrototype.prototype =
Generator.prototype = Object.create(IteratorPrototype);
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
GeneratorFunctionPrototype.constructor = GeneratorFunction;
GeneratorFunctionPrototype[toStringTagSymbol] =
GeneratorFunction.displayName = "GeneratorFunction";
// Helper for defining the .next, .throw, and .return methods of the
// Iterator interface in terms of a single ._invoke method.
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
prototype[method] = function(arg) {
return this._invoke(method, arg);
};
});
}
exports.isGeneratorFunction = function(genFun) {
var ctor = typeof genFun === "function" && genFun.constructor;
return ctor
? ctor === GeneratorFunction ||
// For the native GeneratorFunction constructor, the best we can
// do is to check its .name property.
(ctor.displayName || ctor.name) === "GeneratorFunction"
: false;
};
exports.mark = function(genFun) {
if (Object.setPrototypeOf) {
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
} else {
genFun.__proto__ = GeneratorFunctionPrototype;
if (!(toStringTagSymbol in genFun)) {
genFun[toStringTagSymbol] = "GeneratorFunction";
}
}
genFun.prototype = Object.create(Gp);
return genFun;
};
// Within the body of any async function, `await x` is transformed to
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
// `hasOwn.call(value, "__await")` to determine if the yielded value is
// meant to be awaited.
exports.awrap = function(arg) {
return { __await: arg };
};
function AsyncIterator(generator) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if (record.type === "throw") {
reject(record.arg);
} else {
var result = record.arg;
var value = result.value;
if (value &&
typeof value === "object" &&
hasOwn.call(value, "__await")) {
return Promise.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
});
}
return Promise.resolve(value).then(function(unwrapped) {
// When a yielded Promise is resolved, its final value becomes
// the .value of the Promise<{value,done}> result for the
// current iteration.
result.value = unwrapped;
resolve(result);
}, function(error) {
// If a rejected Promise was yielded, throw the rejection back
// into the async generator function so it can be handled there.
return invoke("throw", error, resolve, reject);
});
}
}
var previousPromise;
function enqueue(method, arg) {
function callInvokeWithMethodAndArg() {
return new Promise(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise =
// If enqueue has been called before, then we want to wait until
// all previous Promises have been resolved before calling invoke,
// so that results are always delivered in the correct order. If
// enqueue has not been called before, then it is important to
// call invoke immediately, without waiting on a callback to fire,
// so that the async generator function has the opportunity to do
// any necessary setup in a predictable way. This predictability
// is why the Promise constructor synchronously invokes its
// executor callback, and why async functions synchronously
// execute code before the first await. Since we implement simple
// async functions in terms of async generators, it is especially
// important to get this right, even though it requires care.
previousPromise ? previousPromise.then(
callInvokeWithMethodAndArg,
// Avoid propagating failures to Promises returned by later
// invocations of the iterator.
callInvokeWithMethodAndArg
) : callInvokeWithMethodAndArg();
}
// Define the unified helper method that is used to implement .next,
// .throw, and .return (see defineIteratorMethods).
this._invoke = enqueue;
}
defineIteratorMethods(AsyncIterator.prototype);
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
return this;
};
exports.AsyncIterator = AsyncIterator;
// Note that simple async functions are implemented on top of
// AsyncIterator objects; they just return a Promise for the value of
// the final result produced by the iterator.
exports.async = function(innerFn, outerFn, self, tryLocsList) {
var iter = new AsyncIterator(
wrap(innerFn, outerFn, self, tryLocsList)
);
return exports.isGeneratorFunction(outerFn)
? iter // If outerFn is a generator, return the full iterator.
: iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
};
function makeInvokeMethod(innerFn, self, context) {
var state = GenStateSuspendedStart;
return function invoke(method, arg) {
if (state === GenStateExecuting) {
throw new Error("Generator is already running");
}
if (state === GenStateCompleted) {
if (method === "throw") {
throw arg;
}
// Be forgiving, per 25.3.3.3.3 of the spec:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
return doneResult();
}
context.method = method;
context.arg = arg;
while (true) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if (context.method === "next") {
// Setting context._sent for legacy support of Babel's
// function.sent implementation.
context.sent = context._sent = context.arg;
} else if (context.method === "throw") {
if (state === GenStateSuspendedStart) {
state = GenStateCompleted;
throw context.arg;
}
context.dispatchException(context.arg);
} else if (context.method === "return") {
context.abrupt("return", context.arg);
}
state = GenStateExecuting;
var record = tryCatch(innerFn, self, context);
if (record.type === "normal") {
// If an exception is thrown from innerFn, we leave state ===
// GenStateExecuting and loop back for another invocation.
state = context.done
? GenStateCompleted
: GenStateSuspendedYield;
if (record.arg === ContinueSentinel) {
continue;
}
return {
value: record.arg,
done: context.done
};
} else if (record.type === "throw") {
state = GenStateCompleted;
// Dispatch the exception by looping back around to the
// context.dispatchException(context.arg) call above.
context.method = "throw";
context.arg = record.arg;
}
}
};
}
// Call delegate.iterator[context.method](context.arg) and handle the
// result, either by returning a { value, done } result from the
// delegate iterator, or by modifying context.method and context.arg,
// setting context.delegate to null, and returning the ContinueSentinel.
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (method === undefined$1) {
// A .throw or .return when the delegate iterator has no .throw
// method always terminates the yield* loop.
context.delegate = null;
if (context.method === "throw") {
// Note: ["return"] must be used for ES3 parsing compatibility.
if (delegate.iterator["return"]) {
// If the delegate iterator has a return method, give it a
// chance to clean up.
context.method = "return";
context.arg = undefined$1;
maybeInvokeDelegate(delegate, context);
if (context.method === "throw") {
// If maybeInvokeDelegate(context) changed context.method from
// "return" to "throw", let that override the TypeError below.
return ContinueSentinel;
}
}
context.method = "throw";
context.arg = new TypeError(
"The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if (record.type === "throw") {
context.method = "throw";
context.arg = record.arg;
context.delegate = null;
return ContinueSentinel;
}
var info = record.arg;
if (! info) {
context.method = "throw";
context.arg = new TypeError("iterator result is not an object");
context.delegate = null;
return ContinueSentinel;
}
if (info.done) {
// Assign the result of the finished delegate to the temporary
// variable specified by delegate.resultName (see delegateYield).
context[delegate.resultName] = info.value;
// Resume execution at the desired location (see delegateYield).
context.next = delegate.nextLoc;
// If context.method was "throw" but the delegate handled the
// exception, let the outer generator proceed normally. If
// context.method was "next", forget context.arg since it has been
// "consumed" by the delegate iterator. If context.method was
// "return", allow the original .return call to continue in the
// outer generator.
if (context.method !== "return") {
context.method = "next";
context.arg = undefined$1;
}
} else {
// Re-yield the result returned by the delegate method.
return info;
}
// The delegate iterator is finished, so forget it and continue with
// the outer generator.
context.delegate = null;
return ContinueSentinel;
}
// Define Generator.prototype.{next,throw,return} in terms of the
// unified ._invoke helper method.
defineIteratorMethods(Gp);
Gp[toStringTagSymbol] = "Generator";
// A Generator should always return itself as the iterator object when the
// @@iterator function is called on it. Some browsers' implementations of the
// iterator prototype chain incorrectly implement this, causing the Generator
// object to not be returned from this call. This ensures that doesn't happen.
// See https://github.com/facebook/regenerator/issues/274 for more details.
Gp[iteratorSymbol] = function() {
return this;
};
Gp.toString = function() {
return "[object Generator]";
};
function pushTryEntry(locs) {
var entry = { tryLoc: locs[0] };
if (1 in locs) {
entry.catchLoc = locs[1];
}
if (2 in locs) {
entry.finallyLoc = locs[2];
entry.afterLoc = locs[3];
}
this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal";
delete record.arg;
entry.completion = record;
}
function Context(tryLocsList) {
// The root entry object (effectively a try statement without a catch
// or a finally block) gives us a place to store values thrown from
// locations where there is no enclosing try statement.
this.tryEntries = [{ tryLoc: "root" }];
tryLocsList.forEach(pushTryEntry, this);
this.reset(true);
}
exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
keys.reverse();
// Rather than returning an object with a next method, we keep
// things simple and return the next function itself.
return function next() {
while (keys.length) {
var key = keys.pop();
if (key in object) {
next.value = key;
next.done = false;
return next;
}
}
// To avoid creating an additional object, we just hang the .value
// and .done properties off the next function object itself. This
// also ensures that the minifier will not anonymize the function.
next.done = true;
return next;
};
};
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) {
return iteratorMethod.call(iterable);
}
if (typeof iterable.next === "function") {
return iterable;
}
if (!isNaN(iterable.length)) {
var i = -1, next = function next() {
while (++i < iterable.length) {
if (hasOwn.call(iterable, i)) {
next.value = iterable[i];
next.done = false;
return next;
}
}
next.value = undefined$1;
next.done = true;
return next;
};
return next.next = next;
}
}
// Return an iterator with no values.
return { next: doneResult };
}
exports.values = values;
function doneResult() {
return { value: undefined$1, done: true };
}
Context.prototype = {
constructor: Context,
reset: function(skipTempReset) {
this.prev = 0;
this.next = 0;
// Resetting context._sent for legacy support of Babel's
// function.sent implementation.
this.sent = this._sent = undefined$1;
this.done = false;
this.delegate = null;
this.method = "next";
this.arg = undefined$1;
this.tryEntries.forEach(resetTryEntry);
if (!skipTempReset) {
for (var name in this) {
// Not sure about the optimal order of these conditions:
if (name.charAt(0) === "t" &&
hasOwn.call(this, name) &&
!isNaN(+name.slice(1))) {
this[name] = undefined$1;
}
}
}
},
stop: function() {
this.done = true;
var rootEntry = this.tryEntries[0];
var rootRecord = rootEntry.completion;
if (rootRecord.type === "throw") {
throw rootRecord.arg;
}
return this.rval;
},
dispatchException: function(exception) {
if (this.done) {
throw exception;
}
var context = this;
function handle(loc, caught) {
record.type = "throw";
record.arg = exception;
context.next = loc;
if (caught) {
// If the dispatched exception was caught by a catch block,
// then let that catch block handle the exception normally.
context.method = "next";
context.arg = undefined$1;
}
return !! caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
var record = entry.completion;
if (entry.tryLoc === "root") {
// Exception thrown outside of any try block that could handle
// it, so set the completion value of the entire function to
// throw the exception.
return handle("end");
}
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc");
var hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
} else if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else if (hasCatch) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
}
} else if (hasFinally) {
if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else {
throw new Error("try statement without catch or finally");
}
}
}
},
abrupt: function(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev &&
hasOwn.call(entry, "finallyLoc") &&
this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
if (finallyEntry &&
(type === "break" ||
type === "continue") &&
finallyEntry.tryLoc <= arg &&
arg <= finallyEntry.finallyLoc) {
// Ignore the finally entry if control is not jumping to a
// location outside the try/catch block.
finallyEntry = null;
}
var record = finallyEntry ? finallyEntry.completion : {};
record.type = type;
record.arg = arg;
if (finallyEntry) {
this.method = "next";
this.next = finallyEntry.finallyLoc;
return ContinueSentinel;
}
return this.complete(record);
},
complete: function(record, afterLoc) {
if (record.type === "throw") {
throw record.arg;
}
if (record.type === "break" ||
record.type === "continue") {
this.next = record.arg;
} else if (record.type === "return") {
this.rval = this.arg = record.arg;
this.method = "return";
this.next = "end";
} else if (record.type === "normal" && afterLoc) {
this.next = afterLoc;
}
return ContinueSentinel;
},
finish: function(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) {
this.complete(entry.completion, entry.afterLoc);
resetTryEntry(entry);
return ContinueSentinel;
}
}
},
"catch": function(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if (record.type === "throw") {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
// The context.catch method must only be called with a location
// argument that corresponds to a known catch block.
throw new Error("illegal catch attempt");
},
delegateYield: function(iterable, resultName, nextLoc) {
this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
};
if (this.method === "next") {
// Deliberately forget the last sent value so that we don't
// accidentally pass it on to the delegate.
this.arg = undefined$1;
}
return ContinueSentinel;
}
};
// Regardless of whether this script is executing as a CommonJS module
// or not, return the runtime object so that we can declare the variable
// regeneratorRuntime in the outer scope, which allows this module to be
// injected easily by `bin/regenerator --include-runtime script.js`.
return exports;
}(
// If this script is executing as a CommonJS module, use module.exports
// as the regeneratorRuntime namespace. Otherwise create a new empty
// object. Either way, the resulting object will be used to initialize
// the regeneratorRuntime variable at the top of this file.
module.exports
));
try {
regeneratorRuntime = runtime;
} catch (accidentalStrictMode) {
// This module should not be running in strict mode, so the above
// assignment should always work unless something is misconfigured. Just
// in case runtime.js accidentally runs in strict mode, we can escape
// strict mode using a global Function call. This could conceivably fail
// if a Content Security Policy forbids using Function, but in that case
// the proper solution is to fix the accidental strict mode problem. If
// you've misconfigured your bundler to force strict mode and applied a
// CSP to forbid Function, and you're not willing to fix either of those
// problems, please detail your unique predicament in a GitHub issue.
Function("r", "regeneratorRuntime = r")(runtime);
}
});
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;
}
}
var arrayWithoutHoles = _arrayWithoutHoles;
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
var iterableToArray = _iterableToArray;
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
var nonIterableSpread = _nonIterableSpread;
function _toConsumableArray(arr) {
return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();
}
var toConsumableArray = _toConsumableArray;
function getOffsetParent(el) {

@@ -48,2 +881,3 @@ var offsetParent = el.offsetParent;

function getPosition(el) {

@@ -70,2 +904,3 @@ var offsetParent = getOffsetParent(el);

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

@@ -86,12 +921,13 @@ // refer: http://www.51xuediannao.com/javascript/getBoundingClientRect.html

return {
top,
right,
bottom,
left,
width,
height,
x,
y
top: top,
right: right,
bottom: bottom,
left: left,
width: width,
height: height,
x: x,
y: y
};
}
function findParent(el, callback, opt) {

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

}
function backupAttr(el, name) {

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

}
function restoreAttr(el, name) {

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

function hasClass(el, className) {

@@ -132,2 +971,3 @@ if (el.classList) {

function addClass(el, className) {

@@ -143,7 +983,2 @@ if (!hasClass(el, className)) {

/*!
* helper-js v1.4.21
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/

@@ -157,8 +992,9 @@ function onDOM(el, name, handler) {

// 所有主流浏览器,除了 IE 8 及更早 IE版本
el.addEventListener(name, handler, ...args);
el.addEventListener.apply(el, [name, handler].concat(args));
} else if (el.attachEvent) {
// IE 8 及更早 IE 版本
el.attachEvent("on".concat(name), handler, ...args);
el.attachEvent.apply(el, ["on".concat(name), handler].concat(args));
}
}
function offDOM(el, name, handler) {

@@ -171,16 +1007,9 @@ for (var _len7 = arguments.length, args = new Array(_len7 > 3 ? _len7 - 3 : 0), _key9 = 3; _key9 < _len7; _key9++) {

// 所有主流浏览器,除了 IE 8 及更早 IE版本
el.removeEventListener(name, handler, ...args);
el.removeEventListener.apply(el, [name, handler].concat(args));
} else if (el.detachEvent) {
// IE 8 及更早 IE 版本
el.detachEvent("on".concat(name), handler, ...args);
el.detachEvent.apply(el, ["on".concat(name), handler].concat(args));
}
}
/*!
* drag-event-service v1.0.2
* (c) phphe <phphe@outlook.com> (https://github.com/phphe)
* Released under the MIT License.
*/
// support desktop and mobile
var events = {

@@ -192,7 +1021,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) {

@@ -204,10 +1032,8 @@ el._wrapperStore = [];

},
on: function on(el, name, handler, options) {
var _resolveOptions = resolveOptions(options),
args = _resolveOptions.args,
mouseArgs = _resolveOptions.mouseArgs,
touchArgs = _resolveOptions.touchArgs;
on(el, name, handler, options) {
var {
args,
mouseArgs,
touchArgs
} = resolveOptions(options);
var store = this._getStore(el);

@@ -244,4 +1070,4 @@

store.push({
handler,
wrapper
handler: handler,
wrapper: wrapper
}); // follow format will cause big bundle size

@@ -251,24 +1077,20 @@ // 以下写法将会使打包工具认为hp是上下文, 导致打包整个hp

onDOM.call(null, el, events[name][0], wrapper, ...[...args, ...mouseArgs]);
onDOM.call(null, el, events[name][1], wrapper, ...[...args, ...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))));
},
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]);
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);

@@ -278,3 +1100,2 @@ }

}
};

@@ -291,5 +1112,5 @@

return {
args,
mouseArgs,
touchArgs
args: args,
mouseArgs: mouseArgs,
touchArgs: touchArgs
};

@@ -296,0 +1117,0 @@ }

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

@@ -11,6 +11,3 @@ "main": "dist/draggable-helper.cjs.js",

"scripts": {
"build": "node scripts/build.js",
"dev": "rollup -w -c scripts/config.js --environment TARGET:umd",
"build:esm": "rollup -c scripts/config.js --environment TARGET:esm",
"dev:esm": "rollup -w -c scripts/config.js --environment TARGET:esm"
"build": "rogo"
},

@@ -27,10 +24,10 @@ "author": "phphe <phphe@outlook.com> (https://github.com/phphe)",

"devDependencies": {
"rollup-helper": "^2.0.12"
"rogo": "^1.0.0"
},
"dependencies": {
"@babel/runtime": "^7.7.7",
"drag-event-service": "^1.0.2",
"helper-js": "^1.4.25"
"drag-event-service": "^1.0.3",
"helper-js": "^1.4.27"
},
"license": "MIT"
}
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