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

drag-drop

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drag-drop - npm Package Compare versions

Comparing version 2.3.2 to 2.4.0

2

dragdrop.bundle.js

@@ -1,1 +0,1 @@

!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.DragDrop=n()}}(function(){return function n(t,e,r){function o(u,a){if(!e[u]){if(!t[u]){var c="function"==typeof require&&require;if(!a&&c)return c(u,!0);if(i)return i(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var l=e[u]={exports:{}};t[u][0].call(l.exports,function(n){var e=t[u][1][n];return o(e?e:n)},l,l.exports,n,t,e,r)}return e[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(n,t,e){function r(){l=!1,a.length?f=a.concat(f):s=-1,f.length&&o()}function o(){if(!l){var n=setTimeout(r);l=!0;for(var t=f.length;t;){for(a=f,f=[];++s<t;)a&&a[s].run();s=-1,t=f.length}a=null,l=!1,clearTimeout(n)}}function i(n,t){this.fun=n,this.array=t}function u(){}var a,c=t.exports={},f=[],l=!1,s=-1;c.nextTick=function(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];f.push(new i(n,t)),1!==f.length||l||setTimeout(o,0)},i.prototype.run=function(){this.fun.apply(null,this.array)},c.title="browser",c.browser=!0,c.env={},c.argv=[],c.version="",c.versions={},c.on=u,c.addListener=u,c.once=u,c.off=u,c.removeListener=u,c.removeAllListeners=u,c.emit=u,c.binding=function(n){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(n){throw new Error("process.chdir is not supported")},c.umask=function(){return 0}},{}],2:[function(n,t,e){t.exports=function(n,t){function e(n,r){return n.reduce(function(n,o){return Array.isArray(o)&&t>r?n.concat(e(o,r+1)):n.concat(o)},[])}return t="number"==typeof t?t:1/0,e(n,1)}},{}],3:[function(n,t,e){function r(n,t,e){var r=!0,a=!0;if("function"!=typeof n)throw new TypeError(u);return e===!1?r=!1:o(e)&&(r="leading"in e?!!e.leading:r,a="trailing"in e?!!e.trailing:a),i(n,t,{leading:r,maxWait:+t,trailing:a})}function o(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}var i=n("lodash.debounce"),u="Expected a function";t.exports=r},{"lodash.debounce":4}],4:[function(n,t,e){function r(n,t,e){function r(){h&&clearTimeout(h),p&&clearTimeout(p),w=0,p=h=y=void 0}function i(t,e){e&&clearTimeout(e),p=h=y=void 0,t&&(w=f(),v=n.apply(m,d),h||p||(d=m=void 0))}function c(){var n=t-(f()-g);0>=n||n>t?i(y,p):h=setTimeout(c,n)}function l(){i(x,h)}function s(){if(d=arguments,g=f(),m=this,y=x&&(h||!T),E===!1)var e=T&&!h;else{p||T||(w=g);var r=E-(g-w),o=0>=r||r>E;o?(p&&(p=clearTimeout(p)),w=g,v=n.apply(m,d)):p||(p=setTimeout(l,r))}return o&&h?h=clearTimeout(h):h||t===E||(h=setTimeout(c,t)),e&&(o=!0,v=n.apply(m,d)),!o||h||p||(d=m=void 0),v}var d,p,v,g,m,h,y,w=0,E=!1,x=!0;if("function"!=typeof n)throw new TypeError(u);if(t=0>t?0:+t||0,e===!0){var T=!0;x=!1}else o(e)&&(T=!!e.leading,E="maxWait"in e&&a(+e.maxWait||0,t),x="trailing"in e?!!e.trailing:x);return s.cancel=r,s}function o(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}var i=n("lodash._getnative"),u="Expected a function",a=Math.max,c=i(Date,"now"),f=c||function(){return(new Date).getTime()};t.exports=r},{"lodash._getnative":5}],5:[function(n,t,e){function r(n){return!!n&&"object"==typeof n}function o(n,t){var e=null==n?void 0:n[t];return a(e)?e:void 0}function i(n){return u(n)&&p.call(n)==c}function u(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function a(n){return null==n?!1:i(n)?v.test(s.call(n)):r(n)&&f.test(n)}var c="[object Function]",f=/^\[object .+?Constructor\]$/,l=Object.prototype,s=Function.prototype.toString,d=l.hasOwnProperty,p=l.toString,v=RegExp("^"+s.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=o},{}],6:[function(n,t,e){(function(n){t.exports=function(t,e){function r(t){function r(){e&&e(t,i),e=null}c?n.nextTick(r):r()}function o(n,t,e){i[n]=e,(0===--u||t)&&r(t)}var i,u,a,c=!0;Array.isArray(t)?(i=[],u=t.length):(a=Object.keys(t),i={},u=a.length),u?a?a.forEach(function(n){t[n](o.bind(void 0,n))}):t.forEach(function(n,t){n(o.bind(void 0,t))}):r(null),c=!1}}).call(this,n("_process"))},{_process:1}],"/":[function(n,t,e){function r(n,t){"string"==typeof n&&(n=window.document.querySelector(n));var e=i(n),r=u(n,t);return n.addEventListener("dragenter",o,!1),n.addEventListener("dragover",e,!1),n.addEventListener("drop",r,!1),function(){n instanceof window.Element&&n.classList.remove("drag"),n.removeEventListener("dragenter",o,!1),n.removeEventListener("dragover",e,!1),n.removeEventListener("drop",r,!1)}}function o(n){return n.stopPropagation(),n.preventDefault(),!1}function i(n){var t=s(function(){n instanceof window.Element&&n.classList.add("drag"),n.timeout&&clearTimeout(n.timeout),n.timeout=setTimeout(function(){n instanceof window.Element&&n.classList.remove("drag")},150)},100,{trailing:!1});return function(n){return n.stopPropagation(),n.preventDefault(),n.dataTransfer.dropEffect="copy",t(),!1}}function u(n,t){return function(e){e.stopPropagation(),e.preventDefault(),n instanceof window.Element&&n.classList.remove("drag");var r={x:e.clientX,y:e.clientY};if(e.dataTransfer.items)l(c(e.dataTransfer.items).map(function(n){return function(t){a(n.webkitGetAsEntry(),t)}}),function(n,e){n||t(f(e),r)});else{var o=c(e.dataTransfer.files);o.forEach(function(n){n.fullPath="/"+n.name}),t(o,r)}return!1}}function a(n,t){function e(){i.readEntries(function(n){n.length>0?(o=o.concat(c(n)),e()):r()})}function r(){l(o.map(function(n){return function(t){a(n,t)}}),t)}var o=[];if(n.isFile)n.file(function(e){e.fullPath=n.fullPath,t(null,e)});else if(n.isDirectory){var i=n.createReader();e()}}function c(n){return Array.prototype.slice.call(n||[],0)}t.exports=r;var f=n("flatten"),l=n("run-parallel"),s=n("lodash.throttle")},{flatten:2,"lodash.throttle":3,"run-parallel":6}]},{},[])("/")});
!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.DragDrop=n()}}(function(){return function n(e,t,r){function o(u,a){if(!t[u]){if(!e[u]){var f="function"==typeof require&&require;if(!a&&f)return f(u,!0);if(i)return i(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var s=t[u]={exports:{}};e[u][0].call(s.exports,function(n){var t=e[u][1][n];return o(t?t:n)},s,s.exports,n,e,t,r)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(n,e,t){function r(){s=!1,a.length?c=a.concat(c):l=-1,c.length&&o()}function o(){if(!s){var n=setTimeout(r);s=!0;for(var e=c.length;e;){for(a=c,c=[];++l<e;)a&&a[l].run();l=-1,e=c.length}a=null,s=!1,clearTimeout(n)}}function i(n,e){this.fun=n,this.array=e}function u(){}var a,f=e.exports={},c=[],s=!1,l=-1;f.nextTick=function(n){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];c.push(new i(n,e)),1!==c.length||s||setTimeout(o,0)},i.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=u,f.addListener=u,f.once=u,f.off=u,f.removeListener=u,f.removeAllListeners=u,f.emit=u,f.binding=function(n){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(n){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},{}],2:[function(n,e,t){e.exports=function(n,e){function t(n,r){return n.reduce(function(n,o){return Array.isArray(o)&&e>r?n.concat(t(o,r+1)):n.concat(o)},[])}return e="number"==typeof e?e:1/0,t(n,1)}},{}],3:[function(n,e,t){(function(n){e.exports=function(e,t){function r(e){function r(){t&&t(e,i),t=null}f?n.nextTick(r):r()}function o(n,e,t){i[n]=t,(0===--u||e)&&r(e)}var i,u,a,f=!0;Array.isArray(e)?(i=[],u=e.length):(a=Object.keys(e),i={},u=a.length),u?a?a.forEach(function(n){e[n](o.bind(void 0,n))}):e.forEach(function(n,e){n(o.bind(void 0,e))}):r(null),f=!1}}).call(this,n("_process"))},{_process:1}],"/":[function(n,e,t){function r(n,e){"string"==typeof n&&(n=window.document.querySelector(n));var t=i(n),r=u(n),f=a(n,e);return n.addEventListener("dragenter",o,!1),n.addEventListener("dragover",t,!1),n.addEventListener("dragleave",r,!1),n.addEventListener("drop",f,!1),function(){n instanceof window.Element&&n.classList.remove("drag"),n.removeEventListener("dragenter",o,!1),n.removeEventListener("dragover",t,!1),n.removeEventListener("dragleave",r,!1),n.removeEventListener("drop",f,!1)}}function o(n){return n.stopPropagation(),n.preventDefault(),!1}function i(n){return function(e){return e.stopPropagation(),e.preventDefault(),n instanceof window.Element&&n.classList.add("drag"),e.dataTransfer.dropEffect="copy",!1}}function u(n){return function(e){return e.stopPropagation(),e.preventDefault(),n instanceof window.Element&&n.classList.remove("drag"),!1}}function a(n,e){return function(t){t.stopPropagation(),t.preventDefault(),n instanceof window.Element&&n.classList.remove("drag");var r={x:t.clientX,y:t.clientY};if(t.dataTransfer.items)l(c(t.dataTransfer.items).map(function(n){return function(e){f(n.webkitGetAsEntry(),e)}}),function(n,t){n||e(s(t),r)});else{var o=c(t.dataTransfer.files);o.forEach(function(n){n.fullPath="/"+n.name}),e(o,r)}return!1}}function f(n,e){function t(){i.readEntries(function(n){n.length>0?(o=o.concat(c(n)),t()):r()})}function r(){l(o.map(function(n){return function(e){f(n,e)}}),e)}var o=[];if(n.isFile)n.file(function(t){t.fullPath=n.fullPath,e(null,t)});else if(n.isDirectory){var i=n.createReader();t()}}function c(n){return Array.prototype.slice.call(n||[],0)}e.exports=r;var s=n("flatten"),l=n("run-parallel")},{flatten:2,"run-parallel":3}]},{},[])("/")});

@@ -5,3 +5,2 @@ module.exports = dragDrop

var parallel = require('run-parallel')
var throttle = require('lodash.throttle')

@@ -12,2 +11,3 @@ function dragDrop (elem, ondrop) {

var onDragOver = makeOnDragOver(elem)
var onDragLeave = makeOnDragLeave(elem)
var onDrop = makeOnDrop(elem, ondrop)

@@ -17,2 +17,3 @@

elem.addEventListener('dragover', onDragOver, false)
elem.addEventListener('dragleave', onDragLeave, false)
elem.addEventListener('drop', onDrop, false)

@@ -25,2 +26,3 @@

elem.removeEventListener('dragover', onDragOver, false)
elem.removeEventListener('dragleave', onDragLeave, false)
elem.removeEventListener('drop', onDrop, false)

@@ -37,16 +39,16 @@ }

function makeOnDragOver (elem) {
var fn = throttle(function () {
return function (e) {
e.stopPropagation()
e.preventDefault()
if (elem instanceof window.Element) elem.classList.add('drag')
e.dataTransfer.dropEffect = 'copy'
return false
}
}
if (elem.timeout) clearTimeout(elem.timeout)
elem.timeout = setTimeout(function () {
if (elem instanceof window.Element) elem.classList.remove('drag')
}, 150)
}, 100, {trailing: false})
function makeOnDragLeave (elem) {
return function (e) {
e.stopPropagation()
e.preventDefault()
e.dataTransfer.dropEffect = 'copy'
fn()
if (elem instanceof window.Element) elem.classList.remove('drag')
return false

@@ -53,0 +55,0 @@ }

{
"name": "drag-drop",
"description": "HTML5 drag & drop for humans",
"version": "2.3.2",
"version": "2.4.0",
"author": "Feross Aboukhadijeh <feross@feross.org> (http://feross.org/)",

@@ -12,3 +12,2 @@ "bugs": {

"flatten": "0.0.1",
"lodash.throttle": "^3.0.1",
"run-parallel": "^1.0.0"

@@ -15,0 +14,0 @@ },

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