file-drop-element
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
function t(t,e,r,n){var i,s=arguments.length,o=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s<3?i(o):s>3?i(e,r,o):i(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o}function e(t,e,r){return{get(){const t=r.value.bind(this);return Object.defineProperty(this,e,{value:t}),t}}}function r(t,e){const r=e.toLowerCase().split(",").map(t=>t.trim().split("/").map(t=>t.trim())).filter(t=>2===t.length);return Array.from(t).find(t=>{if("file"!==t.kind)return!1;const[e,n]=t.type.toLowerCase().split("/").map(t=>t.trim());for(const[t,i]of r)if(e===t&&("*"===i||n===i))return!0;return!1})}function n(t,e){const n=r(t.items,e);if(n)return n.getAsFile()||void 0}class i extends Event{constructor(t,e){var r,n;super(t,e),(r=this)instanceof(n=i)||Object.setPrototypeOf(r,n.prototype),this._file=e.file,this._action=e.action}get action(){return this._action}get file(){return this._file}}class s extends HTMLElement{constructor(){super(),this._dragEnterCount=0,this.addEventListener("dragover",t=>t.preventDefault()),this.addEventListener("drop",this._onDrop),this.addEventListener("dragenter",this._onDragEnter),this.addEventListener("dragend",()=>this._reset()),this.addEventListener("dragleave",this._onDragLeave),this.addEventListener("paste",this._onPaste)}get accept(){return this.getAttribute("accept")||""}set accept(t){this.setAttribute("accept",t)}_onDragEnter(t){if(this._dragEnterCount+=1,this._dragEnterCount>1)return;const e=!t.dataTransfer.items.length||!!r(t.dataTransfer.items,this.accept);this.classList.add(e?"drop-valid":"drop-invalid")}_onDragLeave(){this._dragEnterCount-=1,0===this._dragEnterCount&&this._reset()}_onDrop(t){t.preventDefault(),this._reset();const e=n(t.dataTransfer,this.accept);void 0!==e&&this.dispatchEvent(new i("filedrop",{action:"drop",file:e}))}_onPaste(t){const e=n(t.clipboardData,this.accept);void 0!==e&&this.dispatchEvent(new i("filedrop",{action:"paste",file:e}))}_reset(){this._dragEnterCount=0,this.classList.remove("drop-valid"),this.classList.remove("drop-invalid")}}t([e],s.prototype,"_onDragEnter",null),t([e],s.prototype,"_onDragLeave",null),t([e],s.prototype,"_onDrop",null),t([e],s.prototype,"_onPaste",null),exports.FileDropEvent=i,exports.FileDropElement=s; | ||
function t(t,e,r,n){var i,s=arguments.length,o=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s<3?i(o):s>3?i(e,r,o):i(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o}function e(t,e,r){return{get(){const t=r.value.bind(this);return Object.defineProperty(this,e,{value:t}),t}}}function r(t,e){const r=e.toLowerCase().split(",").map(t=>t.trim().split("/").map(t=>t.trim())).filter(t=>2===t.length);return Array.from(t).find(t=>{if("file"!==t.kind)return!1;const[e,n]=t.type.toLowerCase().split("/").map(t=>t.trim());for(const[t,i]of r)if(e===t&&("*"===i||n===i))return!0;return!1})}function n(t,e){const n=r(t.items,e);if(n)return n.getAsFile()||void 0}class i extends Event{constructor(t,e){var r,n;super(t,e),(r=this)instanceof(n=i)||Object.setPrototypeOf(r,n.prototype),this._file=e.file,this._action=e.action}get action(){return this._action}get file(){return this._file}}class s extends HTMLElement{constructor(){super(),this._dragEnterCount=0,this.addEventListener("dragover",t=>t.preventDefault()),this.addEventListener("drop",this._onDrop),this.addEventListener("dragenter",this._onDragEnter),this.addEventListener("dragend",()=>this._reset()),this.addEventListener("dragleave",this._onDragLeave),this.addEventListener("paste",this._onPaste)}get accept(){return this.getAttribute("accept")||""}set accept(t){this.setAttribute("accept",t)}_onDragEnter(t){if(this._dragEnterCount+=1,this._dragEnterCount>1)return;const e=!t.dataTransfer.items.length||!!r(t.dataTransfer.items,this.accept);this.classList.add(e?"drop-valid":"drop-invalid")}_onDragLeave(){this._dragEnterCount-=1,0===this._dragEnterCount&&this._reset()}_onDrop(t){t.preventDefault(),this._reset();const e=n(t.dataTransfer,this.accept);void 0!==e&&this.dispatchEvent(new i("filedrop",{action:"drop",file:e}))}_onPaste(t){const e=n(t.clipboardData,this.accept);void 0!==e&&this.dispatchEvent(new i("filedrop",{action:"paste",file:e}))}_reset(){this._dragEnterCount=0,this.classList.remove("drop-valid"),this.classList.remove("drop-invalid")}}t([e],s.prototype,"_onDragEnter",null),t([e],s.prototype,"_onDragLeave",null),t([e],s.prototype,"_onDrop",null),t([e],s.prototype,"_onPaste",null),customElements.define("file-drop",s),exports.FileDropEvent=i,exports.FileDropElement=s; | ||
//# sourceMappingURL=filedrop.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.fileDropElement={})}(this,function(t){function e(t,e,r,n){var i,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,r,s):i(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s}function r(t,e,r){return{get(){const t=r.value.bind(this);return Object.defineProperty(this,e,{value:t}),t}}}function n(t,e){const r=e.toLowerCase().split(",").map(t=>t.trim().split("/").map(t=>t.trim())).filter(t=>2===t.length);return Array.from(t).find(t=>{if("file"!==t.kind)return!1;const[e,n]=t.type.toLowerCase().split("/").map(t=>t.trim());for(const[t,i]of r)if(e===t&&("*"===i||n===i))return!0;return!1})}function i(t,e){const r=n(t.items,e);if(r)return r.getAsFile()||void 0}class o extends Event{constructor(t,e){var r,n;super(t,e),(r=this)instanceof(n=o)||Object.setPrototypeOf(r,n.prototype),this._file=e.file,this._action=e.action}get action(){return this._action}get file(){return this._file}}class s extends HTMLElement{constructor(){super(),this._dragEnterCount=0,this.addEventListener("dragover",t=>t.preventDefault()),this.addEventListener("drop",this._onDrop),this.addEventListener("dragenter",this._onDragEnter),this.addEventListener("dragend",()=>this._reset()),this.addEventListener("dragleave",this._onDragLeave),this.addEventListener("paste",this._onPaste)}get accept(){return this.getAttribute("accept")||""}set accept(t){this.setAttribute("accept",t)}_onDragEnter(t){if(this._dragEnterCount+=1,this._dragEnterCount>1)return;const e=!t.dataTransfer.items.length||!!n(t.dataTransfer.items,this.accept);this.classList.add(e?"drop-valid":"drop-invalid")}_onDragLeave(){this._dragEnterCount-=1,0===this._dragEnterCount&&this._reset()}_onDrop(t){t.preventDefault(),this._reset();const e=i(t.dataTransfer,this.accept);void 0!==e&&this.dispatchEvent(new o("filedrop",{action:"drop",file:e}))}_onPaste(t){const e=i(t.clipboardData,this.accept);void 0!==e&&this.dispatchEvent(new o("filedrop",{action:"paste",file:e}))}_reset(){this._dragEnterCount=0,this.classList.remove("drop-valid"),this.classList.remove("drop-invalid")}}e([r],s.prototype,"_onDragEnter",null),e([r],s.prototype,"_onDragLeave",null),e([r],s.prototype,"_onDrop",null),e([r],s.prototype,"_onPaste",null),t.FileDropEvent=o,t.FileDropElement=s}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.fileDropElement={})}(this,function(t){function e(t,e,r,n){var i,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,r,s):i(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s}function r(t,e,r){return{get(){const t=r.value.bind(this);return Object.defineProperty(this,e,{value:t}),t}}}function n(t,e){const r=e.toLowerCase().split(",").map(t=>t.trim().split("/").map(t=>t.trim())).filter(t=>2===t.length);return Array.from(t).find(t=>{if("file"!==t.kind)return!1;const[e,n]=t.type.toLowerCase().split("/").map(t=>t.trim());for(const[t,i]of r)if(e===t&&("*"===i||n===i))return!0;return!1})}function i(t,e){const r=n(t.items,e);if(r)return r.getAsFile()||void 0}class o extends Event{constructor(t,e){var r,n;super(t,e),(r=this)instanceof(n=o)||Object.setPrototypeOf(r,n.prototype),this._file=e.file,this._action=e.action}get action(){return this._action}get file(){return this._file}}class s extends HTMLElement{constructor(){super(),this._dragEnterCount=0,this.addEventListener("dragover",t=>t.preventDefault()),this.addEventListener("drop",this._onDrop),this.addEventListener("dragenter",this._onDragEnter),this.addEventListener("dragend",()=>this._reset()),this.addEventListener("dragleave",this._onDragLeave),this.addEventListener("paste",this._onPaste)}get accept(){return this.getAttribute("accept")||""}set accept(t){this.setAttribute("accept",t)}_onDragEnter(t){if(this._dragEnterCount+=1,this._dragEnterCount>1)return;const e=!t.dataTransfer.items.length||!!n(t.dataTransfer.items,this.accept);this.classList.add(e?"drop-valid":"drop-invalid")}_onDragLeave(){this._dragEnterCount-=1,0===this._dragEnterCount&&this._reset()}_onDrop(t){t.preventDefault(),this._reset();const e=i(t.dataTransfer,this.accept);void 0!==e&&this.dispatchEvent(new o("filedrop",{action:"drop",file:e}))}_onPaste(t){const e=i(t.clipboardData,this.accept);void 0!==e&&this.dispatchEvent(new o("filedrop",{action:"paste",file:e}))}_reset(){this._dragEnterCount=0,this.classList.remove("drop-valid"),this.classList.remove("drop-invalid")}}e([r],s.prototype,"_onDragEnter",null),e([r],s.prototype,"_onDragLeave",null),e([r],s.prototype,"_onDrop",null),e([r],s.prototype,"_onPaste",null),customElements.define("file-drop",s),t.FileDropEvent=o,t.FileDropElement=s}); | ||
//# sourceMappingURL=filedrop.umd.js.map |
@@ -178,2 +178,4 @@ /** | ||
customElements.define('file-drop', FileDropElement); | ||
// Keeping JSX happy | ||
@@ -180,0 +182,0 @@ declare global { |
{ | ||
"name": "file-drop-element", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "File Drop Custom Element", | ||
@@ -5,0 +5,0 @@ "main": "dist/filedrop.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
55509
0.99%276
0.36%0
-100%