Comparing version 5.0.1 to 5.0.2
@@ -1,1 +0,1 @@ | ||
(function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,b.DragDrop=a()}})(function(){return function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c<g.length;c++)a(g[c]);return a}return b}()({1:[function(a,b){function c(){throw new Error("setTimeout has not been defined")}function d(){throw new Error("clearTimeout has not been defined")}function e(a){if(l===setTimeout)return setTimeout(a,0);if((l===c||!l)&&setTimeout)return l=setTimeout,setTimeout(a,0);try{return l(a,0)}catch(b){try{return l.call(null,a,0)}catch(b){return l.call(this,a,0)}}}function f(a){if(m===clearTimeout)return clearTimeout(a);if((m===d||!m)&&clearTimeout)return m=clearTimeout,clearTimeout(a);try{return m(a)}catch(b){try{return m.call(null,a)}catch(b){return m.call(this,a)}}}function g(){q&&o&&(q=!1,o.length?p=o.concat(p):r=-1,p.length&&h())}function h(){if(!q){var a=e(g);q=!0;for(var b=p.length;b;){for(o=p,p=[];++r<b;)o&&o[r].run();r=-1,b=p.length}o=null,q=!1,f(a)}}function j(a,b){this.fun=a,this.array=b}function k(){}var l,m,n=b.exports={};(function(){try{l="function"==typeof setTimeout?setTimeout:c}catch(a){l=c}try{m="function"==typeof clearTimeout?clearTimeout:d}catch(a){m=d}})();var o,p=[],q=!1,r=-1;n.nextTick=function(a){var b=Array(arguments.length-1);if(1<arguments.length)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];p.push(new j(a,b)),1!==p.length||q||e(h)},j.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=k,n.addListener=k,n.once=k,n.off=k,n.removeListener=k,n.removeAllListeners=k,n.emit=k,n.prependListener=k,n.prependOnceListener=k,n.listeners=function(){return[]},n.binding=function(){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},{}],2:[function(a,b){(function(a){b.exports=function(b,c){function d(b){function d(){c&&c(b,f),c=null}i?a.nextTick(d):d()}function e(a,b,c){f[a]=c,(0==--g||b)&&d(b)}var f,g,h,i=!0;Array.isArray(b)?(f=[],g=b.length):(h=Object.keys(b),f={},g=h.length),g?h?h.forEach(function(a){b[a](function(b,c){e(a,b,c)})}):b.forEach(function(a,b){a(function(a,c){e(b,a,c)})}):d(null),i=!1}}).call(this,a("_process"))},{_process:1}],"/":[function(a,b){function c(a,b){function e(a){a.readEntries(a=>{0<a.length?(g=g.concat(Array.from(a)),e()):f()})}function f(){d(g.map(a=>b=>{c(a,b)}),(c,d)=>{c?b(c):(d.push({fullPath:a.fullPath,name:a.name,isFile:!1,isDirectory:!0}),b(null,d))})}let g=[];if(a.isFile)a.file(c=>{c.fullPath=a.fullPath,c.isFile=!0,c.isDirectory=!1,b(null,c)},a=>{b(a)});else if(a.isDirectory){const b=a.createReader();e(b)}}b.exports=function(a,b){function e(a){return b.onDragEnter&&b.onDragEnter(a),a.stopPropagation(),a.preventDefault(),!1}function f(c){if(c.stopPropagation(),c.preventDefault(),b.onDragOver&&b.onDragOver(c),c.dataTransfer.items){const a=Array.from(c.dataTransfer.items),d=a.filter(a=>"file"===a.kind),e=a.filter(a=>"string"===a.kind);if(0===d.length&&!b.onDropText)return;if(0===e.length&&!b.onDrop)return;if(0===d.length&&0===e.length)return}return a.classList.add("drag"),clearTimeout(j),c.dataTransfer.dropEffect="copy",!1}function g(a){return a.stopPropagation(),a.preventDefault(),b.onDragLeave&&b.onDragLeave(a),clearTimeout(j),j=setTimeout(i,50),!1}function h(a){a.stopPropagation(),a.preventDefault(),b.onDragLeave&&b.onDragLeave(a),clearTimeout(j),i();const e={x:a.clientX,y:a.clientY},f=a.dataTransfer.getData("text");if(f&&b.onDropText&&b.onDropText(f,e),b.onDrop&&a.dataTransfer.items){const f=a.dataTransfer.files,g=Array.from(a.dataTransfer.items).filter(a=>"file"===a.kind);if(0===g.length)return;d(g.map(a=>b=>{c(a.webkitGetAsEntry(),b)}),(a,c)=>{if(a)throw a;const d=c.flat(),g=d.filter(a=>a.isFile),h=d.filter(a=>a.isDirectory);b.onDrop(g,e,f,h)})}return!1}function i(){a.classList.remove("drag")}if("string"==typeof a){const b=a;if(a=window.document.querySelector(a),!a)throw new Error(`"${b}" does not match any HTML elements`)}if(!a)throw new Error(`"${a}" is not a valid HTML element`);"function"==typeof b&&(b={onDrop:b});let j;return a.addEventListener("dragenter",e,!1),a.addEventListener("dragover",f,!1),a.addEventListener("dragleave",g,!1),a.addEventListener("drop",h,!1),function(){i(),a.removeEventListener("dragenter",e,!1),a.removeEventListener("dragover",f,!1),a.removeEventListener("dragleave",g,!1),a.removeEventListener("drop",h,!1)}};const d=a("run-parallel")},{"run-parallel":2}]},{},[])("/")}); | ||
!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).DragDrop=n()}}(function(){var n,e,t,r=n={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function u(n){if(e===setTimeout)return setTimeout(n,0);if((e===o||!e)&&setTimeout)return e=setTimeout,setTimeout(n,0);try{return e(n,0)}catch(t){try{return e.call(null,n,0)}catch(t){return e.call(this,n,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:o}catch(n){e=o}try{t="function"==typeof clearTimeout?clearTimeout:i}catch(n){t=i}}();var c,f=[],l=!1,s=-1;function a(){l&&c&&(l=!1,c.length?f=c.concat(f):s=-1,f.length&&h())}function h(){if(!l){var n=u(a);l=!0;for(var e=f.length;e;){for(c=f,f=[];++s<e;)c&&c[s].run();s=-1,e=f.length}c=null,l=!1,function(n){if(t===clearTimeout)return clearTimeout(n);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(n);try{t(n)}catch(e){try{return t.call(null,n)}catch(e){return t.call(this,n)}}}(n)}}function d(n,e){this.fun=n,this.array=e}function p(){}r.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];f.push(new d(n,e)),1!==f.length||l||u(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=p,r.addListener=p,r.once=p,r.off=p,r.removeListener=p,r.removeAllListeners=p,r.emit=p,r.prependListener=p,r.prependOnceListener=p,r.listeners=function(n){return[]},r.binding=function(n){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(n){throw new Error("process.chdir is not supported")},r.umask=function(){return 0};(function(n){(function(e,t){var r,o,i,u=!0;function c(e){function o(){t&&t(e,r),t=null}u?n.nextTick(o):o()}function f(n,e,t){r[n]=t,(0==--o||e)&&c(e)}Array.isArray(e)?(r=[],o=e.length):(i=Object.keys(e),r={},o=i.length),o?i?i.forEach(function(n){e[n](function(e,t){f(n,e,t)})}):e.forEach(function(n,e){n(function(n,t){f(e,n,t)})}):c(null),u=!1})}).call(this,n)}); |
{ | ||
"name": "drag-drop", | ||
"description": "HTML5 drag & drop for humans", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"author": "Feross Aboukhadijeh <feross@feross.org> (http://feross.org/)", | ||
@@ -14,3 +14,2 @@ "bugs": { | ||
"devDependencies": { | ||
"babel-minify": "^0.5.0", | ||
"browserify": "^16.1.0", | ||
@@ -20,3 +19,4 @@ "ecstatic": "^4.0.0", | ||
"standard": "*", | ||
"tape": "^4.0.0" | ||
"tape": "^4.0.0", | ||
"tinyify": "^2.5.2" | ||
}, | ||
@@ -42,7 +42,8 @@ "homepage": "https://github.com/feross/drag-drop", | ||
"scripts": { | ||
"build": "browserify --plugin tinyify -s DragDrop -r ./ > dragdrop.min.js", | ||
"demo": "html-inline example.html | curl -sT- https://htmlb.in", | ||
"test": "standard && tape test/*.js", | ||
"example": "npm run build && ecstatic", | ||
"build": "browserify -s DragDrop -r ./ | minify > dragdrop.min.js" | ||
"size": "npm run build && cat dragdrop.min.js | gzip | wc -c", | ||
"test": "standard && tape test/*.js" | ||
} | ||
} |
@@ -46,5 +46,5 @@ # drag-drop [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] | ||
```js | ||
var dragDrop = require('drag-drop') | ||
const dragDrop = require('drag-drop') | ||
dragDrop('#dropTarget', function (files, pos, fileList, directories) { | ||
dragDrop('#dropTarget', (files, pos, fileList, directories) => { | ||
console.log('Here are the dropped files', files) // Array of File objects | ||
@@ -64,6 +64,6 @@ console.log('Dropped at coordinates', pos.x, pos.y) | ||
```js | ||
var dragDrop = require('drag-drop') | ||
const dragDrop = require('drag-drop') | ||
// You can pass in a DOM node or a selector string! | ||
dragDrop('#dropTarget', function (files, pos, fileList, directories) { | ||
dragDrop('#dropTarget', (files, pos, fileList, directories) => { | ||
console.log('Here are the dropped files', files) | ||
@@ -75,3 +75,3 @@ console.log('Dropped at coordinates', pos.x, pos.y) | ||
// `files` is an Array! | ||
files.forEach(function (file) { | ||
files.forEach(file => { | ||
console.log(file.name) | ||
@@ -85,11 +85,11 @@ console.log(file.size) | ||
// convert the file to a Buffer that we can use! | ||
var reader = new FileReader() | ||
reader.addEventListener('load', function (e) { | ||
const reader = new FileReader() | ||
reader.addEventListener('load', e => { | ||
// e.target.result is an ArrayBuffer | ||
var arr = new Uint8Array(e.target.result) | ||
var buffer = new Buffer(arr) | ||
const arr = new Uint8Array(e.target.result) | ||
const buffer = new Buffer(arr) | ||
// do something with the buffer! | ||
}) | ||
reader.addEventListener('error', function (err) { | ||
reader.addEventListener('error', err => { | ||
console.error('FileReader error' + err) | ||
@@ -107,6 +107,6 @@ }) | ||
```js | ||
var dragDrop = require('drag-drop/buffer') | ||
const dragDrop = require('drag-drop/buffer') | ||
dragDrop('#dropTarget', function (files) { | ||
files.forEach(function (file) { | ||
dragDrop('#dropTarget', files => { | ||
files.forEach(file => { | ||
// file is actually a buffer! | ||
@@ -123,3 +123,3 @@ console.log(file.readUInt32LE(0)) | ||
}) | ||
} | ||
}) | ||
``` | ||
@@ -133,5 +133,5 @@ | ||
```js | ||
var dragDrop = require('drag-drop') | ||
const dragDrop = require('drag-drop') | ||
var remove = dragDrop('#dropTarget', function (files) { | ||
const remove = dragDrop('#dropTarget', files => { | ||
// ... | ||
@@ -150,6 +150,6 @@ }) | ||
```js | ||
var dragDrop = require('drag-drop') | ||
const dragDrop = require('drag-drop') | ||
dragDrop('#dropTarget', { | ||
onDrop: function (files, pos, fileList, directories) { | ||
onDrop: (files, pos, fileList, directories) => { | ||
console.log('Here are the dropped files', files) | ||
@@ -160,5 +160,5 @@ console.log('Dropped at coordinates', pos.x, pos.y) | ||
}, | ||
onDragEnter: function () {}, | ||
onDragOver: function () {}, | ||
onDragLeave: function () {} | ||
onDragEnter: () => {}, | ||
onDragOver: () => {}, | ||
onDragLeave: () => {} | ||
}) | ||
@@ -173,6 +173,6 @@ ``` | ||
```js | ||
var dragDrop = require('drag-drop') | ||
const dragDrop = require('drag-drop') | ||
dragDrop('#dropTarget', { | ||
onDropText: function (text, pos) { | ||
onDropText: (text, pos) => { | ||
console.log('Here is the dropped text:', text) | ||
@@ -179,0 +179,0 @@ console.log('Dropped at coordinates', pos.x, pos.y) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
0
0
16293