@georapbox/files-dropzone-element 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
[](https://www.npmjs.com/package/@georapbox/files-dropzone-element)
|
|
3
3
|
|
|
4
4
|
[demo]: https://georapbox.github.io/files-dropzone-element/
|
|
5
|
-
[getUserMedia]: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
|
|
6
|
-
[MediaDevices]: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices
|
|
7
|
-
[constraints]: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#parameters
|
|
8
5
|
[license]: https://georapbox.mit-license.org/@2023
|
|
9
6
|
[changelog]: https://github.com/georapbox/files-dropzone-element/blob/main/CHANGELOG.md
|
|
10
7
|
|
|
@@ -56,14 +53,15 @@ By default, the component comes with basic styling. However, you can customise t
|
|
|
56
53
|
| ---- | -------- | ---- | -------- | ------- | ----------- |
|
|
57
54
|
| `accept`<sup>1</sup> | ✓ | String | - | `null` | A string containing one or more of unique file type specifiers, separated by commas. Files that do not match one of the accepted file type specifiers, will be rejected. |
|
|
58
55
|
| `disabled` | ✓ | Boolean | - | `false` | Disables the dropzone. |
|
|
59
|
-
| `maxFiles`<br>*`max-files`* | ✓ | Number | - | `Infinity` | Maximum accepted number of files. Note that this property has effect only when `multiple` is
|
|
56
|
+
| `maxFiles`<br>*`max-files`* | ✓ | Number | - | `Infinity` | Maximum accepted number of files. Note that this property has effect only when `multiple` is `true`. If its value is set to `0` or any negative number, it will allow any number of files. If the number of dropped files is greater than the value set, all of the files will be rejected to avoid making unsafe assumptions on which files to accept. |
|
|
60
57
|
| `maxSize`<br>*`max-size`* | ✓ | Number | - | `Infinity` | Maximum file size (in bytes). |
|
|
61
58
|
| `minSize`<br>*`min-size`* | ✓ | Number | - | `0` | Minimum file size (in bytes). |
|
|
62
|
-
| `multiple` | ✓ | Boolean | - | `false` | If
|
|
63
|
-
| `noClick`<br>*`no-click`* | ✓ | Boolean | - | `false` | If
|
|
64
|
-
|`noDrag`<br>*`no-drag`*| ✓ | Boolean | - | `false` | If
|
|
65
|
-
| `noKeyboard`<br>*`no-keyboard`* | ✓ | Boolean | - | `false` | If
|
|
66
|
-
| `
|
|
59
|
+
| `multiple` | ✓ | Boolean | - | `false` | If `true`, allows drag 'n' drop (or selection from the file dialog) of multiple files. If set to `false` and many files are dropped, all of them will be rejected to avoid making unsafe assumptions on which files to accept. |
|
|
60
|
+
| `noClick`<br>*`no-click`* | ✓ | Boolean | - | `false` | If `true`, disables the ability to select files by clicking on the dropzone area, using the native file dialog. |
|
|
61
|
+
|`noDrag`<br>*`no-drag`*| ✓ | Boolean | - | `false` | If `true`, disables drag 'n' drop. |
|
|
62
|
+
| `noKeyboard`<br>*`no-keyboard`* | ✓ | Boolean | - | `false` | If `true`, disables the ability to select files using the SPACE/ENTER keys and also disables the ability to focus on the element using the keyboard. |
|
|
63
|
+
| `autoFocus`<br>*`auto-focus`* | ✓ | Boolean | - | `false` | If `true`, the dropzone will be focused when the component is rendered. It has no effect if the `noKeyboard` or `disabled` properties are set to `true`. |
|
|
64
|
+
| `noStyle`<br>*`no-style`* | ✓ | Boolean | - | `false` | If `true`, it will remove all default styling. It can be useful in cases you want to style the component's parts from scratch. Note that the available [CSS Custom Properties](#css-custom-properties) can still be used. |
|
|
67
65
|
|
|
68
66
|
<sup>1</sup> Each unique file type specifier may take one of the following forms:
|
|
69
67
|
- A valid case-insensitive filename extension, starting with a period (".") character. For example: `.jpg`, `.pdf`, or `.doc`.
|
|
@@ -91,12 +89,14 @@ By default, the component comes with basic styling. However, you can customise t
|
|
|
91
89
|
| `--dropzone-border-radius` | The border radius of the dropzone area. | `0.25rem` |
|
|
92
90
|
| `--dropzone-border-width` | The border width of the dropzone area. | `2px` |
|
|
93
91
|
| `--dropzone-border-style` | The border style of the dropzone area. | `dashed` |
|
|
94
|
-
| `--dropzone-border-color` | The border color of the dropzone area. | `#
|
|
95
|
-
| `--dropzone-border-color-dragover` | The border color of the dropzone area in dragover state. | `#
|
|
92
|
+
| `--dropzone-border-color` | The border color of the dropzone area. | `#6c757d` |
|
|
93
|
+
| `--dropzone-border-color-dragover` | The border color of the dropzone area in dragover state. | `#0d6efd` |
|
|
96
94
|
| `--dropzone-background-color` | The background color of the dropzone area. | `#ffffff` |
|
|
97
95
|
| `--dropzone-background-color-dragover` | The background color of the dropzone area in dragover state. | `#f4f4f5` |
|
|
98
96
|
| `--dropzone-body-color` | The text color of the dropzone area. | `#3f3f46` |
|
|
99
97
|
| `--dropzone-body-color-dragover` | The text color of the dropzone area in dragover state. | `#3f3f46` |
|
|
98
|
+
| `--dropzone-focus-shadow-rgb` | The RGB color of the dropzone area focus shadow. | `49, 132, 253` |
|
|
99
|
+
| `--transition-duration` | The transition's duration for the dropzone area. | `0.2s` |
|
|
100
100
|
|
|
101
101
|
### Methods
|
|
102
102
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e,t,i,o;function n(e,t,i){if(!t.has(e))throw new TypeError("attempted to "+i+" private field on non-instance");return t.get(e)}function s(e,t){return t.get?t.get.call(e):t.value}function a(e,t){return s(e,n(e,t,"get"))}function r(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function l(e,t,i){r(e,t),t.set(e,i)}function d(e,t,i){if(t.set)t.set.call(e,i);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=i}}function p(e,t,i){return d(e,n(e,t,"set"),i),i}function c(e,t,i){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return i}function h(e,t){r(e,t),t.add(e)}function u(e,t=""){if(!t)return!0;const i=[...new Set(t.split(",").map((e=>e.trim())).filter(Boolean))],o=e.type,n=o.replace(/\/.*$/,"");for(const t of i)if("."===t.charAt(0)){if(-1!==e.name.toLowerCase().indexOf(t.toLowerCase(),e.name.length-t.length))return!0}else if(/\/\*$/.test(t)){if(n===t.replace(/\/.*$/,""))return!0}else if(o===t)return!0;return!1}e={},t="FilesDropzone",i=function(){return N},Object.defineProperty(e,t,{get:i,set:o,enumerable:!0,configurable:!0});const m=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]),b=[".DS_Store","Thumbs.db"],f=(e,t)=>{const i=(e=>{const{name:t}=e;if(t&&-1!==t.lastIndexOf(".")&&!e.type){const i=t.split(".").pop().toLowerCase(),o=m.get(i);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e})(e);if("string"!=typeof i.path){const{webkitRelativePath:o}=e;Object.defineProperty(i,"path",{value:"string"==typeof t?t:o||e.name,writable:!1,configurable:!1,enumerable:!0})}return i},v=async e=>await new Promise(((t,i)=>{e.readEntries(t,i)})),g=async e=>{const t=[];let i=await v(e);for(;i.length>0;)t.push(...i),i=await v(e);return t},w=e=>new Promise(((t,i)=>{e.file((i=>t(f(i,e.fullPath))),i)})),y=async e=>{const t=[];for(const i of e)-1===b.indexOf(i.name)&&t.push(f(i));return t},x=async e=>e.dataTransfer?e.dataTransfer.items?await(async e=>{const t=[],i=[];for(const t of e){if("file"!==t.kind)continue;const e=t.getAsEntry?t.getAsEntry():t.webkitGetAsEntry();i.push(e)}for(;i.length>0;){const e=i.shift();if(e)if(e.isFile){const i=await w(e);-1===b.indexOf(i.name)&&t.push(i)}else e.isDirectory&&i.push(...await g(e.createReader()))}return t})(e.dataTransfer.items):await y(e.dataTransfer.files):await y(e.target.files),z="files-dropzone",E="TOO_MANY_FILES",k=document.createElement("template");k.innerHTML='\n <style>\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #71717a;\n --dropzone-border-color-dragover: #0ea5e9;\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border 0.2s ease-in-out, background-color 0.2s ease-in-out, color 0.2s ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n </style>\n\n <input type="file" id="fileInput" hidden>\n\n <div part="dropzone" class="dropzone" id="dropzoneEl" tabindex="0" role="presentation">\n <slot>Drag \'n\' drop files here, or click to select files</slot>\n </div>\n';var A=new WeakMap,L=new WeakMap,j=new WeakMap,S=new WeakMap,C=new WeakMap,F=new WeakMap,T=new WeakMap,M=new WeakMap,$=new WeakMap,O=new WeakSet,D=new WeakSet;class N extends HTMLElement{static get observedAttributes(){return["accept","disabled","multiple","no-keyboard"]}attributeChangedCallback(e,t,i){"accept"===e&&t!==i&&a(this,A)&&(a(this,A).accept=this.accept),"disabled"===e&&t!==i&&a(this,A)&&(a(this,A).disabled=this.disabled,this.disabled?a(this,L).removeAttribute("tabindex"):a(this,L).setAttribute("tabindex","0")),"multiple"===e&&t!==i&&a(this,A)&&(a(this,A).multiple=this.multiple),"no-keyboard"===e&&t!==i&&a(this,L)&&(this.noKeyboard?a(this,L).removeAttribute("tabindex"):a(this,L).setAttribute("tabindex","0"))}connectedCallback(){c(this,D,W).call(this,"accept"),c(this,D,W).call(this,"disabled"),c(this,D,W).call(this,"maxFiles"),c(this,D,W).call(this,"maxSize"),c(this,D,W).call(this,"minSize"),c(this,D,W).call(this,"multiple"),c(this,D,W).call(this,"noClick"),c(this,D,W).call(this,"noDrag"),c(this,D,W).call(this,"noKeyboard"),c(this,D,W).call(this,"noStyle"),a(this,A).addEventListener("change",a(this,j)),a(this,L).addEventListener("dragenter",a(this,S)),a(this,L).addEventListener("dragover",a(this,C)),a(this,L).addEventListener("dragleave",a(this,F)),a(this,L).addEventListener("drop",a(this,T)),a(this,L).addEventListener("click",a(this,M)),a(this,L).addEventListener("keyup",a(this,$))}disconnectedCallback(){a(this,A).removeEventListener("change",a(this,j)),a(this,L).removeEventListener("dragenter",a(this,S)),a(this,L).removeEventListener("dragover",a(this,C)),a(this,L).removeEventListener("dragleave",a(this,F)),a(this,L).removeEventListener("drop",a(this,T)),a(this,L).removeEventListener("click",a(this,M)),a(this,L).removeEventListener("keyup",a(this,$))}get accept(){return this.getAttribute("accept")}set accept(e){this.setAttribute("accept",e)}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get maxFiles(){const e=Number(this.getAttribute("max-files"))||0;return e<=0?1/0:Math.floor(Math.abs(e))}set maxFiles(e){this.setAttribute("max-files",e)}get maxSize(){const e=this.getAttribute("max-size");if(null===e)return 1/0;const t=Number(e);return Number.isNaN(t)?1/0:t}set maxSize(e){this.setAttribute("max-size",e)}get minSize(){const e=this.getAttribute("min-size");if(null===e)return 0;const t=Number(e);return Number.isNaN(t)?0:t}set minSize(e){this.setAttribute("min-size",e)}get multiple(){return this.hasAttribute("multiple")}set multiple(e){e?this.setAttribute("multiple",""):this.removeAttribute("multiple")}get noClick(){return this.hasAttribute("no-click")}set noClick(e){e?this.setAttribute("no-click",""):this.removeAttribute("no-click")}get noDrag(){return this.hasAttribute("no-drag")}set noDrag(e){e?this.setAttribute("no-drag",""):this.removeAttribute("no-drag")}get noKeyboard(){return this.hasAttribute("no-keyboard")}set noKeyboard(e){e?this.setAttribute("no-keyboard",""):this.removeAttribute("no-keyboard")}get noStyle(){return this.hasAttribute("no-style")}set noStyle(e){e?this.setAttribute("no-style",""):this.removeAttribute("no-style")}openFileDialog(){this.disabled||a(this,A).click()}static defineCustomElement(e=z){"undefined"==typeof window||window.customElements.get(e)||window.customElements.define(e,N)}constructor(){super(),h(this,O),h(this,D),l(this,A,{writable:!0,value:void 0}),l(this,L,{writable:!0,value:void 0}),l(this,j,{writable:!0,value:async e=>{try{c(this,O,I).call(this,await x(e))}catch(e){this.dispatchEvent(new CustomEvent(`${z}-error`,{bubbles:!0,composed:!0,detail:{error:e}}))}}}),l(this,S,{writable:!0,value:()=>{this.disabled||this.noDrag||this.dispatchEvent(new Event(`${z}-dragenter`,{bubbles:!0,composed:!0}))}}),l(this,C,{writable:!0,value:e=>{e.preventDefault(),this.disabled||this.noDrag?e.dataTransfer.dropEffect="none":(e.dataTransfer.dropEffect="copy",a(this,L).classList.add("dropzone--dragover"),a(this,L).part.add("dropzone--dragover"),this.dispatchEvent(new Event(`${z}-dragover`,{bubbles:!0,composed:!0})))}}),l(this,F,{writable:!0,value:()=>{this.disabled||this.noDrag||(a(this,L).classList.remove("dropzone--dragover"),a(this,L).part.remove("dropzone--dragover"),this.dispatchEvent(new Event(`${z}-dragleave`,{bubbles:!0,composed:!0})))}}),l(this,T,{writable:!0,value:async e=>{if(!this.disabled&&!this.noDrag){e.preventDefault(),a(this,L).classList.remove("dropzone--dragover"),a(this,L).part.remove("dropzone--dragover");try{c(this,O,I).call(this,await x(e))}catch(e){this.dispatchEvent(new CustomEvent(`${z}-error`,{bubbles:!0,composed:!0,detail:{error:e}}))}}}}),l(this,M,{writable:!0,value:()=>{this.disabled||this.noClick||a(this,A).click()}}),l(this,$,{writable:!0,value:e=>{this.disabled||this.noKeyboard||" "!==e.key&&"Enter"!==e.key||a(this,A).click()}}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(k.content.cloneNode(!0))),p(this,A,this.shadowRoot.getElementById("fileInput")),p(this,L,this.shadowRoot.getElementById("dropzoneEl"))}}function I(e){if(!Array.isArray(e)||!e.length)return;const t=[],i=[],o=e.length;if(!this.multiple&&o>1)for(const t of e)i.push({file:t,errors:[{code:E,message:"Too many files selected. Only 1 file is allowed."}]});else if(this.multiple&&o>this.maxFiles)for(const t of e)i.push({file:t,errors:[{code:E,message:`Too many files selected. Only ${this.maxFiles} ${this.maxFiles>1?"files are":"file is"} allowed.`}]});else for(const o of e){const e=u(o,this.accept),n=o.size>this.maxSize,s=o.size<this.minSize;if(!e||n||s){const t=[];e||t.push({code:"INVALID_MIME_TYPE",message:`File type "${o.type}" is not accepted.`}),n&&t.push({code:"FILE_TOO_LARGE",message:`File size ${o.size} exceeds the maximum size of ${this.maxSize}.`}),s&&t.push({code:"FILE_TOO_SMALL",message:`File size ${o.size} is smaller than the minimum size of ${this.minSize}.`}),i.push({file:o,errors:t})}else t.push(o)}this.dispatchEvent(new CustomEvent(`${z}-drop`,{bubbles:!0,composed:!0,detail:{acceptedFiles:t,rejectedFiles:i}})),t.length>0&&this.dispatchEvent(new CustomEvent(`${z}-drop-accepted`,{bubbles:!0,composed:!0,detail:{acceptedFiles:t}})),i.length>0&&this.dispatchEvent(new CustomEvent(`${z}-drop-rejected`,{bubbles:!0,composed:!0,detail:{rejectedFiles:i}})),a(this,A).value=a(this,A).defaultValue}function W(e){if(Object.prototype.hasOwnProperty.call(this,e)){const t=this[e];delete this[e],this[e]=t}}N.defineCustomElement();export{N as FilesDropzone};
|
|
1
|
+
var e,t,i,o;function n(e,t,i){if(!t.has(e))throw new TypeError("attempted to "+i+" private field on non-instance");return t.get(e)}function s(e,t){return t.get?t.get.call(e):t.value}function a(e,t){return s(e,n(e,t,"get"))}function r(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function l(e,t,i){r(e,t),t.set(e,i)}function d(e,t,i){if(t.set)t.set.call(e,i);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=i}}function c(e,t,i){return d(e,n(e,t,"set"),i),i}function p(e,t,i){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return i}function h(e,t){r(e,t),t.add(e)}function u(e,t=""){if(!t)return!0;const i=[...new Set(t.split(",").map((e=>e.trim())).filter(Boolean))],o=e.type,n=o.replace(/\/.*$/,"");for(const t of i)if("."===t.charAt(0)){if(-1!==e.name.toLowerCase().indexOf(t.toLowerCase(),e.name.length-t.length))return!0}else if(/\/\*$/.test(t)){if(n===t.replace(/\/.*$/,""))return!0}else if(o===t)return!0;return!1}e={},t="FilesDropzone",i=function(){return N},Object.defineProperty(e,t,{get:i,set:o,enumerable:!0,configurable:!0});const m=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]),b=[".DS_Store","Thumbs.db"],f=(e,t)=>{const i=(e=>{const{name:t}=e;if(t&&-1!==t.lastIndexOf(".")&&!e.type){const i=t.split(".").pop().toLowerCase(),o=m.get(i);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e})(e);if("string"!=typeof i.path){const{webkitRelativePath:o}=e;Object.defineProperty(i,"path",{value:"string"==typeof t?t:o||e.name,writable:!1,configurable:!1,enumerable:!0})}return i},v=async e=>await new Promise(((t,i)=>{e.readEntries(t,i)})),g=async e=>{const t=[];let i=await v(e);for(;i.length>0;)t.push(...i),i=await v(e);return t},w=e=>new Promise(((t,i)=>{e.file((i=>t(f(i,e.fullPath))),i)})),y=async e=>{const t=[];for(const i of e)-1===b.indexOf(i.name)&&t.push(f(i));return t},x=async e=>e.dataTransfer?e.dataTransfer.items?await(async e=>{const t=[],i=[];for(const t of e){if("file"!==t.kind)continue;const e=t.getAsEntry?t.getAsEntry():t.webkitGetAsEntry();i.push(e)}for(;i.length>0;){const e=i.shift();if(e)if(e.isFile){const i=await w(e);-1===b.indexOf(i.name)&&t.push(i)}else e.isDirectory&&i.push(...await g(e.createReader()))}return t})(e.dataTransfer.items):await y(e.dataTransfer.files):await y(e.target.files),z="files-dropzone",E="TOO_MANY_FILES",k=document.createElement("template");k.innerHTML='\n <style>\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #6c757d;\n --dropzone-border-color-dragover: #0d6efd;\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n --dropzone-focus-shadow-rgb: 49,132,253;\n --transition-duration: 0.2s;\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border var(--transition-duration) ease-in-out, background-color var(--transition-duration) ease-in-out, color var(--transition-duration) ease-in-out, box-shadow var(--transition-duration) ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone:focus-visible {\n outline: none;\n box-shadow: 0 0 0 0.25rem rgba(var(--dropzone-focus-shadow-rgb), 0.5);\n }\n </style>\n\n <input type="file" id="fileInput" hidden>\n\n <div part="dropzone" class="dropzone" id="dropzoneEl" tabindex="0" role="presentation">\n <slot>Drag \'n\' drop files here, or click to select files</slot>\n </div>\n';var A=new WeakMap,L=new WeakMap,F=new WeakMap,j=new WeakMap,S=new WeakMap,C=new WeakMap,T=new WeakMap,M=new WeakMap,$=new WeakMap,O=new WeakSet,D=new WeakSet;class N extends HTMLElement{static get observedAttributes(){return["accept","disabled","multiple","no-keyboard"]}attributeChangedCallback(e,t,i){"accept"===e&&t!==i&&a(this,A)&&(a(this,A).accept=this.accept),"disabled"===e&&t!==i&&a(this,A)&&(a(this,A).disabled=this.disabled,this.disabled?a(this,L).removeAttribute("tabindex"):a(this,L).setAttribute("tabindex","0")),"multiple"===e&&t!==i&&a(this,A)&&(a(this,A).multiple=this.multiple),"no-keyboard"===e&&t!==i&&a(this,L)&&(this.noKeyboard?a(this,L).removeAttribute("tabindex"):a(this,L).setAttribute("tabindex","0"))}connectedCallback(){p(this,D,W).call(this,"accept"),p(this,D,W).call(this,"disabled"),p(this,D,W).call(this,"maxFiles"),p(this,D,W).call(this,"maxSize"),p(this,D,W).call(this,"minSize"),p(this,D,W).call(this,"multiple"),p(this,D,W).call(this,"noClick"),p(this,D,W).call(this,"noDrag"),p(this,D,W).call(this,"noKeyboard"),p(this,D,W).call(this,"autoFocus"),p(this,D,W).call(this,"noStyle"),a(this,A).addEventListener("change",a(this,F)),a(this,L).addEventListener("dragenter",a(this,j)),a(this,L).addEventListener("dragover",a(this,S)),a(this,L).addEventListener("dragleave",a(this,C)),a(this,L).addEventListener("drop",a(this,T)),a(this,L).addEventListener("click",a(this,M)),a(this,L).addEventListener("keyup",a(this,$)),this.autoFocus&&a(this,L).focus()}disconnectedCallback(){a(this,A).removeEventListener("change",a(this,F)),a(this,L).removeEventListener("dragenter",a(this,j)),a(this,L).removeEventListener("dragover",a(this,S)),a(this,L).removeEventListener("dragleave",a(this,C)),a(this,L).removeEventListener("drop",a(this,T)),a(this,L).removeEventListener("click",a(this,M)),a(this,L).removeEventListener("keyup",a(this,$))}get accept(){return this.getAttribute("accept")}set accept(e){this.setAttribute("accept",e)}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get maxFiles(){const e=Number(this.getAttribute("max-files"))||0;return e<=0?1/0:Math.floor(Math.abs(e))}set maxFiles(e){this.setAttribute("max-files",e)}get maxSize(){const e=this.getAttribute("max-size");if(null===e)return 1/0;const t=Number(e);return Number.isNaN(t)?1/0:t}set maxSize(e){this.setAttribute("max-size",e)}get minSize(){const e=this.getAttribute("min-size");if(null===e)return 0;const t=Number(e);return Number.isNaN(t)?0:t}set minSize(e){this.setAttribute("min-size",e)}get multiple(){return this.hasAttribute("multiple")}set multiple(e){e?this.setAttribute("multiple",""):this.removeAttribute("multiple")}get noClick(){return this.hasAttribute("no-click")}set noClick(e){e?this.setAttribute("no-click",""):this.removeAttribute("no-click")}get noDrag(){return this.hasAttribute("no-drag")}set noDrag(e){e?this.setAttribute("no-drag",""):this.removeAttribute("no-drag")}get noKeyboard(){return this.hasAttribute("no-keyboard")}set noKeyboard(e){e?this.setAttribute("no-keyboard",""):this.removeAttribute("no-keyboard")}get autoFocus(){return this.hasAttribute("auto-focus")}set autoFocus(e){e?this.setAttribute("auto-focus",""):this.removeAttribute("auto-focus")}get noStyle(){return this.hasAttribute("no-style")}set noStyle(e){e?this.setAttribute("no-style",""):this.removeAttribute("no-style")}openFileDialog(){this.disabled||a(this,A).click()}static defineCustomElement(e=z){"undefined"==typeof window||window.customElements.get(e)||window.customElements.define(e,N)}constructor(){super(),h(this,O),h(this,D),l(this,A,{writable:!0,value:void 0}),l(this,L,{writable:!0,value:void 0}),l(this,F,{writable:!0,value:async e=>{try{p(this,O,I).call(this,await x(e))}catch(e){this.dispatchEvent(new CustomEvent(`${z}-error`,{bubbles:!0,composed:!0,detail:{error:e}}))}}}),l(this,j,{writable:!0,value:()=>{this.disabled||this.noDrag||this.dispatchEvent(new Event(`${z}-dragenter`,{bubbles:!0,composed:!0}))}}),l(this,S,{writable:!0,value:e=>{e.preventDefault(),this.disabled||this.noDrag?e.dataTransfer.dropEffect="none":(e.dataTransfer.dropEffect="copy",a(this,L).classList.add("dropzone--dragover"),a(this,L).part.add("dropzone--dragover"),this.dispatchEvent(new Event(`${z}-dragover`,{bubbles:!0,composed:!0})))}}),l(this,C,{writable:!0,value:()=>{this.disabled||this.noDrag||(a(this,L).classList.remove("dropzone--dragover"),a(this,L).part.remove("dropzone--dragover"),this.dispatchEvent(new Event(`${z}-dragleave`,{bubbles:!0,composed:!0})))}}),l(this,T,{writable:!0,value:async e=>{if(!this.disabled&&!this.noDrag){e.preventDefault(),a(this,L).classList.remove("dropzone--dragover"),a(this,L).part.remove("dropzone--dragover");try{p(this,O,I).call(this,await x(e))}catch(e){this.dispatchEvent(new CustomEvent(`${z}-error`,{bubbles:!0,composed:!0,detail:{error:e}}))}}}}),l(this,M,{writable:!0,value:()=>{this.disabled||this.noClick||a(this,A).click()}}),l(this,$,{writable:!0,value:e=>{this.disabled||this.noKeyboard||" "!==e.key&&"Enter"!==e.key||a(this,A).click()}}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(k.content.cloneNode(!0))),c(this,A,this.shadowRoot.getElementById("fileInput")),c(this,L,this.shadowRoot.getElementById("dropzoneEl"))}}function I(e){if(!Array.isArray(e)||!e.length)return;const t=[],i=[],o=e.length;if(!this.multiple&&o>1)for(const t of e)i.push({file:t,errors:[{code:E,message:"Too many files selected. Only 1 file is allowed."}]});else if(this.multiple&&o>this.maxFiles)for(const t of e)i.push({file:t,errors:[{code:E,message:`Too many files selected. Only ${this.maxFiles} ${this.maxFiles>1?"files are":"file is"} allowed.`}]});else for(const o of e){const e=u(o,this.accept),n=o.size>this.maxSize,s=o.size<this.minSize;if(!e||n||s){const t=[];e||t.push({code:"INVALID_MIME_TYPE",message:`File type "${o.type}" is not accepted.`}),n&&t.push({code:"FILE_TOO_LARGE",message:`File size ${o.size} exceeds the maximum size of ${this.maxSize}.`}),s&&t.push({code:"FILE_TOO_SMALL",message:`File size ${o.size} is smaller than the minimum size of ${this.minSize}.`}),i.push({file:o,errors:t})}else t.push(o)}this.dispatchEvent(new CustomEvent(`${z}-drop`,{bubbles:!0,composed:!0,detail:{acceptedFiles:t,rejectedFiles:i}})),t.length>0&&this.dispatchEvent(new CustomEvent(`${z}-drop-accepted`,{bubbles:!0,composed:!0,detail:{acceptedFiles:t}})),i.length>0&&this.dispatchEvent(new CustomEvent(`${z}-drop-rejected`,{bubbles:!0,composed:!0,detail:{rejectedFiles:i}})),a(this,A).value=a(this,A).defaultValue}function W(e){if(Object.prototype.hasOwnProperty.call(this,e)){const t=this[e];delete this[e],this[e]=t}}N.defineCustomElement();export{N as FilesDropzone};
|
|
2
2
|
//# sourceMappingURL=files-dropzone-defined.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"YAAe,SAAAA,EAAsCC,EAAUC,EAAYC,GACzE,IAAKD,EAAWE,IAAIH,GAClB,MAAM,IAAII,UAAU,gBAAkBF,EAAS,kCAEjD,OAAOD,EAAWI,IAAIL,EACxB,CCLe,SAAAM,EAAkCN,EAAUO,GACzD,OAAIA,EAAWF,IACNE,EAAWF,IAAIG,KAAKR,GAEtBO,EAAWE,KACpB,CCFe,SAAAC,EAA+BV,EAAUC,GAEtD,OAAOK,EAAwBN,EADdD,EAA4BC,EAAUC,EAAY,OAErE,CCNe,SAAAU,EAAoCC,EAAKC,GACtD,GAAIA,EAAkBV,IAAIS,GACxB,MAAM,IAAIR,UAAU,iEAExB,CCFe,SAAAU,EAAgCF,EAAKX,EAAYQ,GAC9DE,EAA2BC,EAAKX,GAChCA,EAAWc,IAAIH,EAAKH,EACtB,CCLe,SAAAO,EAAkChB,EAAUO,EAAYE,GACrE,GAAIF,EAAWQ,IACbR,EAAWQ,IAAIP,KAAKR,EAAUS,OACzB,CACL,IAAKF,EAAWU,SAId,MAAM,IAAIb,UAAU,4CAEtBG,EAAWE,MAAQA,CACrB,CAC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,KA5ZY,oBA6ZZC,QAAS,cAAc9J,EAAKW,2BAI5BqJ,GACFJ,EAAO/G,KAAK,CACVgH,KAraS,iBAsaTC,QAAS,aAAa9J,EAAKiK,oCAAoCnE,KAAKqB,aAIpE+C,GACFN,EAAO/G,KAAK,CACVgH,KA3aS,iBA4aTC,QAAS,aAAa9J,EAAKiK,4CAA4CnE,KAAKuB,aAIhFqC,EAAc7G,KAAK,C,KAAE7C,E,OAAM4J,GAC7B,MA1BEH,EAAc5G,KAAK7C,EA2BvB,CAGF8F,KAAKsC,cAAc,IAAIC,YAAY,GAAGhE,SAAuB,CAC3DiE,SAAS,EACTC,UAAU,EACVC,OAAQ,C,cACNiB,E,cACAC,MAIAD,EAActI,OAAS,GACzB2E,KAAKsC,cAAc,IAAIC,YAAY,GAAGhE,kBAAgC,CACpEiE,SAAS,EACTC,UAAU,EACVC,OAAQ,C,cACNiB,MAKFC,EAAcvI,OAAS,GACzB2E,KAAKsC,cAAc,IAAIC,YAAY,GAAGhE,kBAAgC,CACpEiE,SAAS,EACTC,UAAU,EACVC,OAAQ,C,cACNkB,MAKNzK,EAAA6G,KAAMnB,GAAU3F,MAAQC,EAAA6G,KAAMnB,GAAUwF,YAC1C,CAgBA,SAAA7D,EAAiB8D,GACf,GAAItI,OAAOuI,UAAUC,eAAevL,KAAK+G,KAAMsE,GAAO,CACpD,MAAMpL,EAAQ8G,KAAKsE,UACZtE,KAAKsE,GACZtE,KAAKsE,GAAQpL,CACf,CACF,CC7eFwG,EAAc+E,6B","sources":["node_modules/@swc/helpers/src/_class_extract_field_descriptor.mjs","node_modules/@swc/helpers/src/_class_apply_descriptor_get.mjs","node_modules/@swc/helpers/src/_class_private_field_get.mjs","node_modules/@swc/helpers/src/_check_private_redeclaration.mjs","node_modules/@swc/helpers/src/_class_private_field_init.mjs","node_modules/@swc/helpers/src/_class_apply_descriptor_set.mjs","node_modules/@swc/helpers/src/_class_private_field_set.mjs","node_modules/@swc/helpers/src/_class_private_method_get.mjs","node_modules/@swc/helpers/src/_class_private_method_init.mjs","src/utils/is-valid-file.js","src/utils/files-selector.js","src/files-dropzone.js","src/files-dropzone-defined.js"],"sourcesContent":["export default function _classExtractFieldDescriptor(receiver, privateMap, action) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to \" + action + \" private field on non-instance\");\n }\n return privateMap.get(receiver);\n}\n","export default function _classApplyDescriptorGet(receiver, descriptor) {\n if (descriptor.get) {\n return descriptor.get.call(receiver);\n }\n return descriptor.value;\n}\n","import classExtractFieldDescriptor from './_class_extract_field_descriptor.mjs';\nimport classApplyDescriptorGet from './_class_apply_descriptor_get.mjs';\n\nexport default function _classPrivateFieldGet(receiver, privateMap) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"get\");\n return classApplyDescriptorGet(receiver, descriptor);\n}\n","export default function _checkPrivateRedeclaration(obj, privateCollection) {\n if (privateCollection.has(obj)) {\n throw new TypeError(\"Cannot initialize the same private elements twice on an object\");\n }\n}\n","import _checkPrivateRedeclaration from \"./_check_private_redeclaration.mjs\";\n\nexport default function _classPrivateFieldInit(obj, privateMap, value) {\n _checkPrivateRedeclaration(obj, privateMap);\n privateMap.set(obj, value);\n}\n","export default function _classApplyDescriptorSet(receiver, descriptor, value) {\n if (descriptor.set) {\n descriptor.set.call(receiver, value);\n } else {\n if (!descriptor.writable) {\n // This should only throw in strict mode, but class bodies are\n // always strict and private fields can only be used inside\n // class bodies.\n throw new TypeError(\"attempted to set read only private field\");\n }\n descriptor.value = value;\n }\n}\n","import classExtractFieldDescriptor from './_class_extract_field_descriptor.mjs';\nimport classApplyDescriptorSet from './_class_apply_descriptor_set.mjs';\n\nexport default function _classPrivateFieldSet(receiver, privateMap, value) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"set\");\n classApplyDescriptorSet(receiver, descriptor, value);\n return value;\n}\n","export default function _classPrivateMethodGet(receiver, privateSet, fn) {\n if (!privateSet.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return fn;\n}\n","import _checkPrivateRedeclaration from \"./_check_private_redeclaration.mjs\";\n\nexport default function _classPrivateMethodInit(obj, privateSet) {\n _checkPrivateRedeclaration(obj, privateSet);\n privateSet.add(obj);\n}\n","/**\n * Checks if a file is valid based on the accepted file type specifiers.\n *\n * @param {File} file The File object to validate.\n * @param {String} [acceptedTypeSpecifiers=''] The accepted file type specifiers.\n * @returns {Boolean} True if the file is valid, false otherwise.\n */\nexport function isValidFile(file, acceptedTypeSpecifiers = '') {\n if (!acceptedTypeSpecifiers) {\n return true;\n }\n\n const acceptedMimeTypesList = [\n ...new Set(acceptedTypeSpecifiers.split(',').map(v => v.trim()).filter(Boolean))\n ];\n\n const fileMimeType = file.type;\n const baseMimeType = fileMimeType.replace(/\\/.*$/, '');\n\n for (const validType of acceptedMimeTypesList) {\n if (validType.charAt(0) === '.') {\n if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) {\n return true;\n }\n } else if (/\\/\\*$/.test(validType)) {\n // Check for mime type that looks like \"image/*\" or similar.\n if (baseMimeType === validType.replace(/\\/.*$/, '')) {\n return true;\n }\n } else {\n if (fileMimeType === validType) {\n return true;\n }\n }\n }\n\n return false;\n}\n","const COMMON_MIME_TYPES = new Map([\n // https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\n ['aac', 'audio/aac'],\n ['abw', 'application/x-abiword'],\n ['arc', 'application/x-freearc'],\n ['avif', 'image/avif'],\n ['avi', 'video/x-msvideo'],\n ['azw', 'application/vnd.amazon.ebook'],\n ['bin', 'application/octet-stream'],\n ['bmp', 'image/bmp'],\n ['bz', 'application/x-bzip'],\n ['bz2', 'application/x-bzip2'],\n ['cda', 'application/x-cdf'],\n ['csh', 'application/x-csh'],\n ['css', 'text/css'],\n ['csv', 'text/csv'],\n ['doc', 'application/msword'],\n ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],\n ['eot', 'application/vnd.ms-fontobject'],\n ['epub', 'application/epub+zip'],\n ['gz', 'application/gzip'],\n ['gif', 'image/gif'],\n ['heic', 'image/heic'],\n ['heif', 'image/heif'],\n ['htm', 'text/html'],\n ['html', 'text/html'],\n ['ico', 'image/vnd.microsoft.icon'],\n ['ics', 'text/calendar'],\n ['jar', 'application/java-archive'],\n ['jpeg', 'image/jpeg'],\n ['jpg', 'image/jpeg'],\n ['js', 'text/javascript'],\n ['json', 'application/json'],\n ['jsonld', 'application/ld+json'],\n ['mid', 'audio/midi'],\n ['midi', 'audio/midi'],\n ['mjs', 'text/javascript'],\n ['mp3', 'audio/mpeg'],\n ['mp4', 'video/mp4'],\n ['mpeg', 'video/mpeg'],\n ['mpkg', 'application/vnd.apple.installer+xml'],\n ['odp', 'application/vnd.oasis.opendocument.presentation'],\n ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],\n ['odt', 'application/vnd.oasis.opendocument.text'],\n ['oga', 'audio/ogg'],\n ['ogv', 'video/ogg'],\n ['ogx', 'application/ogg'],\n ['opus', 'audio/opus'],\n ['otf', 'font/otf'],\n ['png', 'image/png'],\n ['pdf', 'application/pdf'],\n ['php', 'application/x-httpd-php'],\n ['ppt', 'application/vnd.ms-powerpoint'],\n ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],\n ['rar', 'application/vnd.rar'],\n ['rtf', 'application/rtf'],\n ['sh', 'application/x-sh'],\n ['svg', 'image/svg+xml'],\n ['swf', 'application/x-shockwave-flash'],\n ['tar', 'application/x-tar'],\n ['tif', 'image/tiff'],\n ['tiff', 'image/tiff'],\n ['ts', 'video/mp2t'],\n ['ttf', 'font/ttf'],\n ['txt', 'text/plain'],\n ['vsd', 'application/vnd.visio'],\n ['wav', 'audio/wav'],\n ['weba', 'audio/webm'],\n ['webm', 'video/webm'],\n ['webp', 'image/webp'],\n ['woff', 'font/woff'],\n ['woff2', 'font/woff2'],\n ['xhtml', 'application/xhtml+xml'],\n ['xls', 'application/vnd.ms-excel'],\n ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],\n ['xml', 'application/xml'],\n ['xul', 'application/vnd.mozilla.xul+xml'],\n ['zip', 'application/zip'],\n ['7z', 'application/x-7z-compressed'],\n\n // Others\n ['mkv', 'video/x-matroska'],\n ['mov', 'video/quicktime'],\n ['msg', 'application/vnd.ms-outlook']\n]);\n\nconst FILES_TO_IGNORE = [\n // Thumbnail cache files for macOS and Windows\n '.DS_Store', // macOs\n 'Thumbs.db' // Windows\n];\n\n/**\n * Adds a `type` property to the file object if it doesn't have one and the file has an extension.\n * This is needed because Firefox doesn't add a type property to files dragged from the desktop.\n * @bug https://bugzilla.mozilla.org/show_bug.cgi?id=1424689\n *\n * @param {File} file The file object to add the type property to.\n * @returns {File} The file object with the type property added.\n */\nconst toFileWithMimeType = file => {\n const { name } = file;\n const hasExtension = name && name.lastIndexOf('.') !== -1;\n\n if (hasExtension && !file.type) {\n const extension = name.split('.').pop().toLowerCase();\n const type = COMMON_MIME_TYPES.get(extension);\n\n if (type) {\n Object.defineProperty(file, 'type', {\n value: type,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n }\n\n return file;\n};\n\n/**\n * Adds a `path` property to the file object if it doesn't have one.\n * If `path` is not provided, the `webkitRelativePath` property of the file will be used\n * or the file's name if `webkitRelativePath` is not available.\n *\n * @param {File} file The file object to add the path property to.\n * @param {String} [path] The path to set on the file object.\n * @returns {File} The file object with the path property added.\n */\nconst toFileWithPath = (file, path) => {\n const fileWithMimeType = toFileWithMimeType(file);\n\n if (typeof fileWithMimeType.path !== 'string') {\n const { webkitRelativePath } = file;\n\n Object.defineProperty(fileWithMimeType, 'path', {\n value: typeof path === 'string' ? path : webkitRelativePath || file.name,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n\n return fileWithMimeType;\n};\n\n/**\n * Wrap `FileSystemDirectoryReader.readEntries` in a promise to make working with read entries easier.\n * https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader/readEntries\n *\n * @param {FileSystemDirectoryReader} directoryReader The directory reader to read entries from.\n * @returns {Promise<FileSystemFileEntry[]>} A promise that resolves with an array of `FileSystemFileEntry` objects.\n */\nconst readEntriesPromise = async directoryReader => {\n return await new Promise((resolve, reject) => {\n directoryReader.readEntries(resolve, reject);\n });\n};\n\n/**\n * Read all entries in a directory or sub-directory\n * by calling `readEntries` until it returns an empty array.\n *\n * @param {FileSystemDirectoryReader} directoryReader The directory reader to read entries from.\n * @returns {Promise<FileSystemFileEntry[]>} A promise that resolves with an array of `FileSystemFileEntry` objects.\n */\nconst readAllDirectoryEntries = async directoryReader => {\n const entries = [];\n let readEntries = await readEntriesPromise(directoryReader);\n\n while (readEntries.length > 0) {\n entries.push(...readEntries);\n readEntries = await readEntriesPromise(directoryReader);\n }\n\n return entries;\n};\n\n/**\n * Get a `File` object from a `FileSystemFileEntry` object.\n *\n * @param {FileSystemFileEntry} fileEntry The file entry to get a `File` object from.\n * @returns {Promise<File>} A promise that resolves with a `File` object.\n */\nconst getFileFromFileEntry = fileEntry => {\n return new Promise((resolve, reject) => {\n fileEntry.file(file => resolve(toFileWithPath(file, fileEntry.fullPath)), reject);\n });\n};\n\n/**\n * Get an array of `File` objects from a `DataTransferItemList` object.\n *\n * @param {DataTransferItemList} dataTransferItemList The item list to get an array of `File` objects from.\n * @returns {Promise<File[]>} A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromDataTransferItemList = async dataTransferItemList => {\n const files = [];\n\n // Chromium browsers read only 100 files at a time as per the spec, so we need to use\n // BFS (Breadth-first search) to traverse the entire directory/file structure.\n // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry#javascript_content\n const queue = [];\n\n for (const item of dataTransferItemList) {\n if (item.kind !== 'file') {\n // Ignore non-file items, such as links.\n continue;\n }\n\n // https://developer.mozilla.org/docs/Web/API/DataTransferItem/webkitGetAsEntry\n // This function is implemented as `webkitGetAsEntry()` in non-WebKit browsers\n // including Firefox at this time but it may be renamed to `getAsEntry()` in the future.\n const entry = item.getAsEntry ? item.getAsEntry() : item.webkitGetAsEntry();\n\n queue.push(entry);\n }\n\n while (queue.length > 0) {\n const entry = queue.shift();\n\n if (!entry) {\n continue;\n } else if (entry.isFile) {\n const file = await getFileFromFileEntry(entry);\n\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(file);\n }\n } else if (entry.isDirectory) {\n queue.push(...await readAllDirectoryEntries(entry.createReader()));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from a `FileList` object.\n *\n * @param {FileList} fileList The file list to get an array of `File` objects from.\n * @returns {Promise<File[]>} A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromFileList = async fileList => {\n const files = [];\n\n for (const file of fileList) {\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(toFileWithPath(file));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from an event.\n * This function supports both `drop` and `change` events.\n *\n * @param {DragEvent | Event} evt The event to get an array of `File` objects from.\n * @returns {Promise<File[]>} A promise that resolves with an array of `File` objects.\n */\nexport const getFilesFromEvent = async evt => {\n if (evt.dataTransfer) {\n return evt.dataTransfer.items\n ? await getFilesFromDataTransferItemList(evt.dataTransfer.items)\n : await getFilesFromFileList(evt.dataTransfer.files);\n }\n\n return await getFilesFromFileList(evt.target.files);\n};\n","import { isValidFile } from './utils/is-valid-file.js';\nimport { getFilesFromEvent } from './utils/files-selector.js';\n\nconst COMPONENT_NAME = 'files-dropzone';\nconst TOO_MANY_FILES = 'TOO_MANY_FILES';\nconst FILE_TOO_LARGE = 'FILE_TOO_LARGE';\nconst FILE_TOO_SMALL = 'FILE_TOO_SMALL';\nconst INVALID_MIME_TYPE = 'INVALID_MIME_TYPE';\nconst template = document.createElement('template');\n\ntemplate.innerHTML = /* html */`\n <style>\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #71717a;\n --dropzone-border-color-dragover: #0ea5e9;\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border 0.2s ease-in-out, background-color 0.2s ease-in-out, color 0.2s ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n </style>\n\n <input type=\"file\" id=\"fileInput\" hidden>\n\n <div part=\"dropzone\" class=\"dropzone\" id=\"dropzoneEl\" tabindex=\"0\" role=\"presentation\">\n <slot>Drag 'n' drop files here, or click to select files</slot>\n </div>\n`;\n\nclass FilesDropzone extends HTMLElement {\n #fileInput;\n #dropzoneEl;\n\n constructor() {\n super();\n\n if (!this.shadowRoot) {\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n }\n\n this.#fileInput = this.shadowRoot.getElementById('fileInput');\n this.#dropzoneEl = this.shadowRoot.getElementById('dropzoneEl');\n }\n\n static get observedAttributes() {\n return ['accept', 'disabled', 'multiple', 'no-keyboard'];\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'accept' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.accept = this.accept;\n }\n\n if (name === 'disabled' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.disabled = this.disabled;\n\n if (this.disabled) {\n this.#dropzoneEl.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl.setAttribute('tabindex', '0');\n }\n }\n\n if (name === 'multiple' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.multiple = this.multiple;\n }\n\n if (name === 'no-keyboard' && oldValue !== newValue && this.#dropzoneEl) {\n if (this.noKeyboard) {\n this.#dropzoneEl.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl.setAttribute('tabindex', '0');\n }\n }\n }\n\n connectedCallback() {\n this.#upgradeProperty('accept');\n this.#upgradeProperty('disabled');\n this.#upgradeProperty('maxFiles');\n this.#upgradeProperty('maxSize');\n this.#upgradeProperty('minSize');\n this.#upgradeProperty('multiple');\n this.#upgradeProperty('noClick');\n this.#upgradeProperty('noDrag');\n this.#upgradeProperty('noKeyboard');\n this.#upgradeProperty('noStyle');\n\n this.#fileInput.addEventListener('change', this.#onFileInputChange);\n this.#dropzoneEl.addEventListener('dragenter', this.#onDragEnter);\n this.#dropzoneEl.addEventListener('dragover', this.#onDragOver);\n this.#dropzoneEl.addEventListener('dragleave', this.#onDragLeave);\n this.#dropzoneEl.addEventListener('drop', this.#onDrop);\n this.#dropzoneEl.addEventListener('click', this.#onClick);\n this.#dropzoneEl.addEventListener('keyup', this.#onKeyUp);\n }\n\n disconnectedCallback() {\n this.#fileInput.removeEventListener('change', this.#onFileInputChange);\n this.#dropzoneEl.removeEventListener('dragenter', this.#onDragEnter);\n this.#dropzoneEl.removeEventListener('dragover', this.#onDragOver);\n this.#dropzoneEl.removeEventListener('dragleave', this.#onDragLeave);\n this.#dropzoneEl.removeEventListener('drop', this.#onDrop);\n this.#dropzoneEl.removeEventListener('click', this.#onClick);\n this.#dropzoneEl.removeEventListener('keyup', this.#onKeyUp);\n }\n\n get accept() {\n return this.getAttribute('accept');\n }\n\n set accept(value) {\n this.setAttribute('accept', value);\n }\n\n get disabled() {\n return this.hasAttribute('disabled');\n }\n\n set disabled(value) {\n if (value) {\n this.setAttribute('disabled', '');\n } else {\n this.removeAttribute('disabled');\n }\n }\n\n get maxFiles() {\n const num = Number(this.getAttribute('max-files')) || 0;\n\n if (num <= 0) {\n return Infinity;\n }\n\n return Math.floor(Math.abs(num));\n }\n\n set maxFiles(value) {\n this.setAttribute('max-files', value);\n }\n\n get maxSize() {\n const value = this.getAttribute('max-size');\n\n if (value === null) {\n return Infinity;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? Infinity : num;\n }\n\n set maxSize(value) {\n this.setAttribute('max-size', value);\n }\n\n get minSize() {\n const value = this.getAttribute('min-size');\n\n if (value === null) {\n return 0;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? 0 : num;\n }\n\n set minSize(value) {\n this.setAttribute('min-size', value);\n }\n\n get multiple() {\n return this.hasAttribute('multiple');\n }\n\n set multiple(value) {\n if (value) {\n this.setAttribute('multiple', '');\n } else {\n this.removeAttribute('multiple');\n }\n }\n\n get noClick() {\n return this.hasAttribute('no-click');\n }\n\n set noClick(value) {\n if (value) {\n this.setAttribute('no-click', '');\n } else {\n this.removeAttribute('no-click');\n }\n }\n\n get noDrag() {\n return this.hasAttribute('no-drag');\n }\n\n set noDrag(value) {\n if (value) {\n this.setAttribute('no-drag', '');\n } else {\n this.removeAttribute('no-drag');\n }\n }\n\n get noKeyboard() {\n return this.hasAttribute('no-keyboard');\n }\n\n set noKeyboard(value) {\n if (value) {\n this.setAttribute('no-keyboard', '');\n } else {\n this.removeAttribute('no-keyboard');\n }\n }\n\n get noStyle() {\n return this.hasAttribute('no-style');\n }\n\n set noStyle(value) {\n if (value) {\n this.setAttribute('no-style', '');\n } else {\n this.removeAttribute('no-style');\n }\n }\n\n #onFileInputChange = async evt => {\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n #onDragEnter = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragenter`, {\n bubbles: true,\n composed: true\n }));\n };\n\n #onDragOver = evt => {\n evt.preventDefault();\n\n if (this.disabled || this.noDrag) {\n evt.dataTransfer.dropEffect = 'none';\n return;\n }\n\n evt.dataTransfer.dropEffect = 'copy';\n\n this.#dropzoneEl.classList.add('dropzone--dragover');\n this.#dropzoneEl.part.add('dropzone--dragover');\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragover`, {\n bubbles: true,\n composed: true\n }));\n };\n\n #onDragLeave = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragleave`, {\n bubbles: true,\n composed: true\n }));\n };\n\n #onDrop = async evt => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n evt.preventDefault();\n\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n #onClick = () => {\n if (this.disabled || this.noClick) {\n return;\n }\n\n this.#fileInput.click();\n };\n\n #onKeyUp = evt => {\n if (this.disabled || this.noKeyboard) {\n return;\n }\n\n if (evt.key === ' ' || evt.key === 'Enter') {\n this.#fileInput.click();\n }\n };\n\n #handleFilesSelect(files) {\n if (!Array.isArray(files) || !files.length) {\n return;\n }\n\n const acceptedFiles = [];\n const rejectedFiles = [];\n const filesLength = files.length;\n\n // If the component is not in multiple mode, reject all files.\n if (!this.multiple && filesLength > 1) {\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only 1 file is allowed.`\n }]\n });\n }\n } else if (this.multiple && filesLength > this.maxFiles) {\n // If the component is in multiple mode, but the number of files exceeds\n // the maxFiles attribute, reject all files.\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only ${this.maxFiles} ${this.maxFiles > 1 ? 'files are' : 'file is'} allowed.`\n }]\n });\n }\n } else {\n // Validate each file. If it's valid, add it to the accepted files array,\n // otherwise add it to the rejected files array.\n for (const file of files) {\n const fileHasValidType = isValidFile(file, this.accept);\n const fileExceedsMaxSize = file.size > this.maxSize;\n const fileIsSmallerThanMinSize = file.size < this.minSize;\n\n if (fileHasValidType && !fileExceedsMaxSize && !fileIsSmallerThanMinSize) {\n acceptedFiles.push(file);\n } else {\n const errors = [];\n\n if (!fileHasValidType) {\n errors.push({\n code: INVALID_MIME_TYPE,\n message: `File type \"${file.type}\" is not accepted.`\n });\n }\n\n if (fileExceedsMaxSize) {\n errors.push({\n code: FILE_TOO_LARGE,\n message: `File size ${file.size} exceeds the maximum size of ${this.maxSize}.`\n });\n }\n\n if (fileIsSmallerThanMinSize) {\n errors.push({\n code: FILE_TOO_SMALL,\n message: `File size ${file.size} is smaller than the minimum size of ${this.minSize}.`\n });\n }\n\n rejectedFiles.push({ file, errors });\n }\n }\n }\n\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles,\n rejectedFiles\n }\n }));\n\n if (acceptedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-accepted`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles\n }\n }));\n }\n\n if (rejectedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-rejected`, {\n bubbles: true,\n composed: true,\n detail: {\n rejectedFiles\n }\n }));\n }\n\n this.#fileInput.value = this.#fileInput.defaultValue;\n }\n\n openFileDialog() {\n if (this.disabled) {\n return;\n }\n\n this.#fileInput.click();\n }\n\n /**\n * https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties\n * This is to safe guard against cases where, for instance, a framework may have added the element to the page and set a\n * value on one of its properties, but lazy loaded its definition. Without this guard, the upgraded element would miss that\n * property and the instance property would prevent the class property setter from ever being called.\n */\n #upgradeProperty(prop) {\n if (Object.prototype.hasOwnProperty.call(this, prop)) {\n const value = this[prop];\n delete this[prop];\n this[prop] = value;\n }\n }\n\n static defineCustomElement(elementName = COMPONENT_NAME) {\n if (typeof window !== 'undefined' && !window.customElements.get(elementName)) {\n window.customElements.define(elementName, FilesDropzone);\n }\n }\n}\n\nexport { FilesDropzone };\n","import { FilesDropzone } from './files-dropzone.js';\n\nFilesDropzone.defineCustomElement();\n\nexport { FilesDropzone };\n"],"names":["$54e5dea46d3d830b$export$2e2bcd8739ae039","receiver","privateMap","action","has","TypeError","get","$4a9af28d8c332738$export$2e2bcd8739ae039","descriptor","call","value","$0ebd1ade8fb3d51f$export$2e2bcd8739ae039","$ce94785d052866a0$export$2e2bcd8739ae039","obj","privateCollection","$96b9e3133fa8e43f$export$2e2bcd8739ae039","set","$a5f62c39645bb2ba$export$2e2bcd8739ae039","writable","$6108fbe778b62371$export$2e2bcd8739ae039","$1b12450ac511053e$export$2e2bcd8739ae039","privateSet","fn","$39719070878026a5$export$2e2bcd8739ae039","add","$38f222170fd4d21a$export$7c47054fed488f80","file","acceptedTypeSpecifiers","acceptedMimeTypesList","Set","split","map","v","trim","filter","Boolean","fileMimeType","type","baseMimeType","replace","validType","charAt","name","toLowerCase","indexOf","length","test","$f31161edf38949e9$var$COMMON_MIME_TYPES","Map","$f31161edf38949e9$var$FILES_TO_IGNORE","$f31161edf38949e9$var$toFileWithPath","path","fileWithMimeType","lastIndexOf","extension","pop","Object","defineProperty","configurable","enumerable","$f31161edf38949e9$var$toFileWithMimeType","webkitRelativePath","$f31161edf38949e9$var$readEntriesPromise","async","directoryReader","Promise","resolve","reject","readEntries","$f31161edf38949e9$var$readAllDirectoryEntries","entries","push","$f31161edf38949e9$var$getFileFromFileEntry","fileEntry","fullPath","$f31161edf38949e9$var$getFilesFromFileList","fileList","files","$f31161edf38949e9$export$6d52664cd15c442","evt","dataTransfer","items","dataTransferItemList","queue","item","kind","entry","getAsEntry","webkitGetAsEntry","shift","isFile","isDirectory","createReader","$f31161edf38949e9$var$getFilesFromDataTransferItemList","target","$862aa3736b0514bc$var$COMPONENT_NAME","$862aa3736b0514bc$var$TOO_MANY_FILES","$862aa3736b0514bc$var$template","document","createElement","innerHTML","$862aa3736b0514bc$var$_fileInput","WeakMap","$862aa3736b0514bc$var$_dropzoneEl","$862aa3736b0514bc$var$_onFileInputChange","$862aa3736b0514bc$var$_onDragEnter","$862aa3736b0514bc$var$_onDragOver","$862aa3736b0514bc$var$_onDragLeave","$862aa3736b0514bc$var$_onDrop","$862aa3736b0514bc$var$_onClick","$862aa3736b0514bc$var$_onKeyUp","$862aa3736b0514bc$var$_handleFilesSelect","WeakSet","$862aa3736b0514bc$var$_upgradeProperty","$862aa3736b0514bc$export$6ccd1735166caad9","HTMLElement","observedAttributes","attributeChangedCallback","oldValue","newValue","this","accept","disabled","removeAttribute","setAttribute","multiple","noKeyboard","connectedCallback","$862aa3736b0514bc$var$upgradeProperty","addEventListener","disconnectedCallback","removeEventListener","getAttribute","hasAttribute","maxFiles","num","Number","Infinity","Math","floor","abs","maxSize","isNaN","minSize","noClick","noDrag","noStyle","openFileDialog","click","static","elementName","window","customElements","define","constructor","super","$862aa3736b0514bc$var$handleFilesSelect","error","dispatchEvent","CustomEvent","bubbles","composed","detail","Event","preventDefault","dropEffect","classList","part","remove","key","shadowRoot","attachShadow","mode","appendChild","content","cloneNode","getElementById","Array","isArray","acceptedFiles","rejectedFiles","filesLength","errors","code","message","fileHasValidType","fileExceedsMaxSize","size","fileIsSmallerThanMinSize","defaultValue","prop","prototype","hasOwnProperty","defineCustomElement"],"version":3,"file":"files-dropzone-defined.js.map"}
|
|
1
|
+
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EA2BvB,CAGF8F,KAAKwC,cAAc,IAAIC,YAAY,GAAGlE,SAAuB,CAC3DmE,SAAS,EACTC,UAAU,EACVC,OAAQ,C,cACNiB,E,cACAC,MAIAD,EAAcxI,OAAS,GACzB2E,KAAKwC,cAAc,IAAIC,YAAY,GAAGlE,kBAAgC,CACpEmE,SAAS,EACTC,UAAU,EACVC,OAAQ,C,cACNiB,MAKFC,EAAczI,OAAS,GACzB2E,KAAKwC,cAAc,IAAIC,YAAY,GAAGlE,kBAAgC,CACpEmE,SAAS,EACTC,UAAU,EACVC,OAAQ,C,cACNkB,MAKN3K,EAAA6G,KAAMnB,GAAU3F,MAAQC,EAAA6G,KAAMnB,GAAU0F,YAC1C,CAgBA,SAAA/D,EAAiBgE,GACf,GAAIxI,OAAOyI,UAAUC,eAAezL,KAAK+G,KAAMwE,GAAO,CACpD,MAAMtL,EAAQ8G,KAAKwE,UACZxE,KAAKwE,GACZxE,KAAKwE,GAAQtL,CACf,CACF,CCngBFwG,EAAciF,6B","sources":["node_modules/@swc/helpers/src/_class_extract_field_descriptor.mjs","node_modules/@swc/helpers/src/_class_apply_descriptor_get.mjs","node_modules/@swc/helpers/src/_class_private_field_get.mjs","node_modules/@swc/helpers/src/_check_private_redeclaration.mjs","node_modules/@swc/helpers/src/_class_private_field_init.mjs","node_modules/@swc/helpers/src/_class_apply_descriptor_set.mjs","node_modules/@swc/helpers/src/_class_private_field_set.mjs","node_modules/@swc/helpers/src/_class_private_method_get.mjs","node_modules/@swc/helpers/src/_class_private_method_init.mjs","src/utils/is-valid-file.js","src/utils/files-selector.js","src/files-dropzone.js","src/files-dropzone-defined.js"],"sourcesContent":["export default function _classExtractFieldDescriptor(receiver, privateMap, action) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to \" + action + \" private field on non-instance\");\n }\n return privateMap.get(receiver);\n}\n","export default function _classApplyDescriptorGet(receiver, descriptor) {\n if (descriptor.get) {\n return descriptor.get.call(receiver);\n }\n return descriptor.value;\n}\n","import classExtractFieldDescriptor from './_class_extract_field_descriptor.mjs';\nimport classApplyDescriptorGet from './_class_apply_descriptor_get.mjs';\n\nexport default function _classPrivateFieldGet(receiver, privateMap) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"get\");\n return classApplyDescriptorGet(receiver, descriptor);\n}\n","export default function _checkPrivateRedeclaration(obj, privateCollection) {\n if (privateCollection.has(obj)) {\n throw new TypeError(\"Cannot initialize the same private elements twice on an object\");\n }\n}\n","import _checkPrivateRedeclaration from \"./_check_private_redeclaration.mjs\";\n\nexport default function _classPrivateFieldInit(obj, privateMap, value) {\n _checkPrivateRedeclaration(obj, privateMap);\n privateMap.set(obj, value);\n}\n","export default function _classApplyDescriptorSet(receiver, descriptor, value) {\n if (descriptor.set) {\n descriptor.set.call(receiver, value);\n } else {\n if (!descriptor.writable) {\n // This should only throw in strict mode, but class bodies are\n // always strict and private fields can only be used inside\n // class bodies.\n throw new TypeError(\"attempted to set read only private field\");\n }\n descriptor.value = value;\n }\n}\n","import classExtractFieldDescriptor from './_class_extract_field_descriptor.mjs';\nimport classApplyDescriptorSet from './_class_apply_descriptor_set.mjs';\n\nexport default function _classPrivateFieldSet(receiver, privateMap, value) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"set\");\n classApplyDescriptorSet(receiver, descriptor, value);\n return value;\n}\n","export default function _classPrivateMethodGet(receiver, privateSet, fn) {\n if (!privateSet.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return fn;\n}\n","import _checkPrivateRedeclaration from \"./_check_private_redeclaration.mjs\";\n\nexport default function _classPrivateMethodInit(obj, privateSet) {\n _checkPrivateRedeclaration(obj, privateSet);\n privateSet.add(obj);\n}\n","/**\n * Checks if a file is valid based on the accepted file type specifiers.\n *\n * @param {File} file The File object to validate.\n * @param {String} [acceptedTypeSpecifiers=''] The accepted file type specifiers.\n * @returns {Boolean} True if the file is valid, false otherwise.\n */\nexport function isValidFile(file, acceptedTypeSpecifiers = '') {\n if (!acceptedTypeSpecifiers) {\n return true;\n }\n\n const acceptedMimeTypesList = [\n ...new Set(acceptedTypeSpecifiers.split(',').map(v => v.trim()).filter(Boolean))\n ];\n\n const fileMimeType = file.type;\n const baseMimeType = fileMimeType.replace(/\\/.*$/, '');\n\n for (const validType of acceptedMimeTypesList) {\n if (validType.charAt(0) === '.') {\n if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) {\n return true;\n }\n } else if (/\\/\\*$/.test(validType)) {\n // Check for mime type that looks like \"image/*\" or similar.\n if (baseMimeType === validType.replace(/\\/.*$/, '')) {\n return true;\n }\n } else {\n if (fileMimeType === validType) {\n return true;\n }\n }\n }\n\n return false;\n}\n","const COMMON_MIME_TYPES = new Map([\n // https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\n ['aac', 'audio/aac'],\n ['abw', 'application/x-abiword'],\n ['arc', 'application/x-freearc'],\n ['avif', 'image/avif'],\n ['avi', 'video/x-msvideo'],\n ['azw', 'application/vnd.amazon.ebook'],\n ['bin', 'application/octet-stream'],\n ['bmp', 'image/bmp'],\n ['bz', 'application/x-bzip'],\n ['bz2', 'application/x-bzip2'],\n ['cda', 'application/x-cdf'],\n ['csh', 'application/x-csh'],\n ['css', 'text/css'],\n ['csv', 'text/csv'],\n ['doc', 'application/msword'],\n ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],\n ['eot', 'application/vnd.ms-fontobject'],\n ['epub', 'application/epub+zip'],\n ['gz', 'application/gzip'],\n ['gif', 'image/gif'],\n ['heic', 'image/heic'],\n ['heif', 'image/heif'],\n ['htm', 'text/html'],\n ['html', 'text/html'],\n ['ico', 'image/vnd.microsoft.icon'],\n ['ics', 'text/calendar'],\n ['jar', 'application/java-archive'],\n ['jpeg', 'image/jpeg'],\n ['jpg', 'image/jpeg'],\n ['js', 'text/javascript'],\n ['json', 'application/json'],\n ['jsonld', 'application/ld+json'],\n ['mid', 'audio/midi'],\n ['midi', 'audio/midi'],\n ['mjs', 'text/javascript'],\n ['mp3', 'audio/mpeg'],\n ['mp4', 'video/mp4'],\n ['mpeg', 'video/mpeg'],\n ['mpkg', 'application/vnd.apple.installer+xml'],\n ['odp', 'application/vnd.oasis.opendocument.presentation'],\n ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],\n ['odt', 'application/vnd.oasis.opendocument.text'],\n ['oga', 'audio/ogg'],\n ['ogv', 'video/ogg'],\n ['ogx', 'application/ogg'],\n ['opus', 'audio/opus'],\n ['otf', 'font/otf'],\n ['png', 'image/png'],\n ['pdf', 'application/pdf'],\n ['php', 'application/x-httpd-php'],\n ['ppt', 'application/vnd.ms-powerpoint'],\n ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],\n ['rar', 'application/vnd.rar'],\n ['rtf', 'application/rtf'],\n ['sh', 'application/x-sh'],\n ['svg', 'image/svg+xml'],\n ['swf', 'application/x-shockwave-flash'],\n ['tar', 'application/x-tar'],\n ['tif', 'image/tiff'],\n ['tiff', 'image/tiff'],\n ['ts', 'video/mp2t'],\n ['ttf', 'font/ttf'],\n ['txt', 'text/plain'],\n ['vsd', 'application/vnd.visio'],\n ['wav', 'audio/wav'],\n ['weba', 'audio/webm'],\n ['webm', 'video/webm'],\n ['webp', 'image/webp'],\n ['woff', 'font/woff'],\n ['woff2', 'font/woff2'],\n ['xhtml', 'application/xhtml+xml'],\n ['xls', 'application/vnd.ms-excel'],\n ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],\n ['xml', 'application/xml'],\n ['xul', 'application/vnd.mozilla.xul+xml'],\n ['zip', 'application/zip'],\n ['7z', 'application/x-7z-compressed'],\n\n // Others\n ['mkv', 'video/x-matroska'],\n ['mov', 'video/quicktime'],\n ['msg', 'application/vnd.ms-outlook']\n]);\n\nconst FILES_TO_IGNORE = [\n // Thumbnail cache files for macOS and Windows\n '.DS_Store', // macOs\n 'Thumbs.db' // Windows\n];\n\n/**\n * Adds a `type` property to the file object if it doesn't have one and the file has an extension.\n * This is needed because Firefox doesn't add a type property to files dragged from the desktop.\n * @bug https://bugzilla.mozilla.org/show_bug.cgi?id=1424689\n *\n * @param {File} file The file object to add the type property to.\n * @returns {File} The file object with the type property added.\n */\nconst toFileWithMimeType = file => {\n const { name } = file;\n const hasExtension = name && name.lastIndexOf('.') !== -1;\n\n if (hasExtension && !file.type) {\n const extension = name.split('.').pop().toLowerCase();\n const type = COMMON_MIME_TYPES.get(extension);\n\n if (type) {\n Object.defineProperty(file, 'type', {\n value: type,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n }\n\n return file;\n};\n\n/**\n * Adds a `path` property to the file object if it doesn't have one.\n * If `path` is not provided, the `webkitRelativePath` property of the file will be used\n * or the file's name if `webkitRelativePath` is not available.\n *\n * @param {File} file The file object to add the path property to.\n * @param {String} [path] The path to set on the file object.\n * @returns {File} The file object with the path property added.\n */\nconst toFileWithPath = (file, path) => {\n const fileWithMimeType = toFileWithMimeType(file);\n\n if (typeof fileWithMimeType.path !== 'string') {\n const { webkitRelativePath } = file;\n\n Object.defineProperty(fileWithMimeType, 'path', {\n value: typeof path === 'string' ? path : webkitRelativePath || file.name,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n\n return fileWithMimeType;\n};\n\n/**\n * Wrap `FileSystemDirectoryReader.readEntries` in a promise to make working with read entries easier.\n * https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader/readEntries\n *\n * @param {FileSystemDirectoryReader} directoryReader The directory reader to read entries from.\n * @returns {Promise<FileSystemFileEntry[]>} A promise that resolves with an array of `FileSystemFileEntry` objects.\n */\nconst readEntriesPromise = async directoryReader => {\n return await new Promise((resolve, reject) => {\n directoryReader.readEntries(resolve, reject);\n });\n};\n\n/**\n * Read all entries in a directory or sub-directory\n * by calling `readEntries` until it returns an empty array.\n *\n * @param {FileSystemDirectoryReader} directoryReader The directory reader to read entries from.\n * @returns {Promise<FileSystemFileEntry[]>} A promise that resolves with an array of `FileSystemFileEntry` objects.\n */\nconst readAllDirectoryEntries = async directoryReader => {\n const entries = [];\n let readEntries = await readEntriesPromise(directoryReader);\n\n while (readEntries.length > 0) {\n entries.push(...readEntries);\n readEntries = await readEntriesPromise(directoryReader);\n }\n\n return entries;\n};\n\n/**\n * Get a `File` object from a `FileSystemFileEntry` object.\n *\n * @param {FileSystemFileEntry} fileEntry The file entry to get a `File` object from.\n * @returns {Promise<File>} A promise that resolves with a `File` object.\n */\nconst getFileFromFileEntry = fileEntry => {\n return new Promise((resolve, reject) => {\n fileEntry.file(file => resolve(toFileWithPath(file, fileEntry.fullPath)), reject);\n });\n};\n\n/**\n * Get an array of `File` objects from a `DataTransferItemList` object.\n *\n * @param {DataTransferItemList} dataTransferItemList The item list to get an array of `File` objects from.\n * @returns {Promise<File[]>} A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromDataTransferItemList = async dataTransferItemList => {\n const files = [];\n\n // Chromium browsers read only 100 files at a time as per the spec, so we need to use\n // BFS (Breadth-first search) to traverse the entire directory/file structure.\n // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry#javascript_content\n const queue = [];\n\n for (const item of dataTransferItemList) {\n if (item.kind !== 'file') {\n // Ignore non-file items, such as links.\n continue;\n }\n\n // https://developer.mozilla.org/docs/Web/API/DataTransferItem/webkitGetAsEntry\n // This function is implemented as `webkitGetAsEntry()` in non-WebKit browsers\n // including Firefox at this time but it may be renamed to `getAsEntry()` in the future.\n const entry = item.getAsEntry ? item.getAsEntry() : item.webkitGetAsEntry();\n\n queue.push(entry);\n }\n\n while (queue.length > 0) {\n const entry = queue.shift();\n\n if (!entry) {\n continue;\n } else if (entry.isFile) {\n const file = await getFileFromFileEntry(entry);\n\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(file);\n }\n } else if (entry.isDirectory) {\n queue.push(...await readAllDirectoryEntries(entry.createReader()));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from a `FileList` object.\n *\n * @param {FileList} fileList The file list to get an array of `File` objects from.\n * @returns {Promise<File[]>} A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromFileList = async fileList => {\n const files = [];\n\n for (const file of fileList) {\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(toFileWithPath(file));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from an event.\n * This function supports both `drop` and `change` events.\n *\n * @param {DragEvent | Event} evt The event to get an array of `File` objects from.\n * @returns {Promise<File[]>} A promise that resolves with an array of `File` objects.\n */\nexport const getFilesFromEvent = async evt => {\n if (evt.dataTransfer) {\n return evt.dataTransfer.items\n ? await getFilesFromDataTransferItemList(evt.dataTransfer.items)\n : await getFilesFromFileList(evt.dataTransfer.files);\n }\n\n return await getFilesFromFileList(evt.target.files);\n};\n","import { isValidFile } from './utils/is-valid-file.js';\nimport { getFilesFromEvent } from './utils/files-selector.js';\n\nconst COMPONENT_NAME = 'files-dropzone';\nconst TOO_MANY_FILES = 'TOO_MANY_FILES';\nconst FILE_TOO_LARGE = 'FILE_TOO_LARGE';\nconst FILE_TOO_SMALL = 'FILE_TOO_SMALL';\nconst INVALID_MIME_TYPE = 'INVALID_MIME_TYPE';\nconst template = document.createElement('template');\n\ntemplate.innerHTML = /* html */`\n <style>\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #6c757d;\n --dropzone-border-color-dragover: #0d6efd;\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n --dropzone-focus-shadow-rgb: 49,132,253;\n --transition-duration: 0.2s;\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border var(--transition-duration) ease-in-out, background-color var(--transition-duration) ease-in-out, color var(--transition-duration) ease-in-out, box-shadow var(--transition-duration) ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone:focus-visible {\n outline: none;\n box-shadow: 0 0 0 0.25rem rgba(var(--dropzone-focus-shadow-rgb), 0.5);\n }\n </style>\n\n <input type=\"file\" id=\"fileInput\" hidden>\n\n <div part=\"dropzone\" class=\"dropzone\" id=\"dropzoneEl\" tabindex=\"0\" role=\"presentation\">\n <slot>Drag 'n' drop files here, or click to select files</slot>\n </div>\n`;\n\nclass FilesDropzone extends HTMLElement {\n #fileInput;\n #dropzoneEl;\n\n constructor() {\n super();\n\n if (!this.shadowRoot) {\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n }\n\n this.#fileInput = this.shadowRoot.getElementById('fileInput');\n this.#dropzoneEl = this.shadowRoot.getElementById('dropzoneEl');\n }\n\n static get observedAttributes() {\n return ['accept', 'disabled', 'multiple', 'no-keyboard'];\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'accept' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.accept = this.accept;\n }\n\n if (name === 'disabled' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.disabled = this.disabled;\n\n if (this.disabled) {\n this.#dropzoneEl.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl.setAttribute('tabindex', '0');\n }\n }\n\n if (name === 'multiple' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.multiple = this.multiple;\n }\n\n if (name === 'no-keyboard' && oldValue !== newValue && this.#dropzoneEl) {\n if (this.noKeyboard) {\n this.#dropzoneEl.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl.setAttribute('tabindex', '0');\n }\n }\n }\n\n connectedCallback() {\n this.#upgradeProperty('accept');\n this.#upgradeProperty('disabled');\n this.#upgradeProperty('maxFiles');\n this.#upgradeProperty('maxSize');\n this.#upgradeProperty('minSize');\n this.#upgradeProperty('multiple');\n this.#upgradeProperty('noClick');\n this.#upgradeProperty('noDrag');\n this.#upgradeProperty('noKeyboard');\n this.#upgradeProperty('autoFocus');\n this.#upgradeProperty('noStyle');\n\n this.#fileInput.addEventListener('change', this.#onFileInputChange);\n this.#dropzoneEl.addEventListener('dragenter', this.#onDragEnter);\n this.#dropzoneEl.addEventListener('dragover', this.#onDragOver);\n this.#dropzoneEl.addEventListener('dragleave', this.#onDragLeave);\n this.#dropzoneEl.addEventListener('drop', this.#onDrop);\n this.#dropzoneEl.addEventListener('click', this.#onClick);\n this.#dropzoneEl.addEventListener('keyup', this.#onKeyUp);\n\n this.autoFocus && this.#dropzoneEl.focus();\n }\n\n disconnectedCallback() {\n this.#fileInput.removeEventListener('change', this.#onFileInputChange);\n this.#dropzoneEl.removeEventListener('dragenter', this.#onDragEnter);\n this.#dropzoneEl.removeEventListener('dragover', this.#onDragOver);\n this.#dropzoneEl.removeEventListener('dragleave', this.#onDragLeave);\n this.#dropzoneEl.removeEventListener('drop', this.#onDrop);\n this.#dropzoneEl.removeEventListener('click', this.#onClick);\n this.#dropzoneEl.removeEventListener('keyup', this.#onKeyUp);\n }\n\n get accept() {\n return this.getAttribute('accept');\n }\n\n set accept(value) {\n this.setAttribute('accept', value);\n }\n\n get disabled() {\n return this.hasAttribute('disabled');\n }\n\n set disabled(value) {\n if (value) {\n this.setAttribute('disabled', '');\n } else {\n this.removeAttribute('disabled');\n }\n }\n\n get maxFiles() {\n const num = Number(this.getAttribute('max-files')) || 0;\n\n if (num <= 0) {\n return Infinity;\n }\n\n return Math.floor(Math.abs(num));\n }\n\n set maxFiles(value) {\n this.setAttribute('max-files', value);\n }\n\n get maxSize() {\n const value = this.getAttribute('max-size');\n\n if (value === null) {\n return Infinity;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? Infinity : num;\n }\n\n set maxSize(value) {\n this.setAttribute('max-size', value);\n }\n\n get minSize() {\n const value = this.getAttribute('min-size');\n\n if (value === null) {\n return 0;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? 0 : num;\n }\n\n set minSize(value) {\n this.setAttribute('min-size', value);\n }\n\n get multiple() {\n return this.hasAttribute('multiple');\n }\n\n set multiple(value) {\n if (value) {\n this.setAttribute('multiple', '');\n } else {\n this.removeAttribute('multiple');\n }\n }\n\n get noClick() {\n return this.hasAttribute('no-click');\n }\n\n set noClick(value) {\n if (value) {\n this.setAttribute('no-click', '');\n } else {\n this.removeAttribute('no-click');\n }\n }\n\n get noDrag() {\n return this.hasAttribute('no-drag');\n }\n\n set noDrag(value) {\n if (value) {\n this.setAttribute('no-drag', '');\n } else {\n this.removeAttribute('no-drag');\n }\n }\n\n get noKeyboard() {\n return this.hasAttribute('no-keyboard');\n }\n\n set noKeyboard(value) {\n if (value) {\n this.setAttribute('no-keyboard', '');\n } else {\n this.removeAttribute('no-keyboard');\n }\n }\n\n get autoFocus() {\n return this.hasAttribute('auto-focus');\n }\n\n set autoFocus(value) {\n if (value) {\n this.setAttribute('auto-focus', '');\n } else {\n this.removeAttribute('auto-focus');\n }\n }\n\n get noStyle() {\n return this.hasAttribute('no-style');\n }\n\n set noStyle(value) {\n if (value) {\n this.setAttribute('no-style', '');\n } else {\n this.removeAttribute('no-style');\n }\n }\n\n #onFileInputChange = async evt => {\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n #onDragEnter = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragenter`, {\n bubbles: true,\n composed: true\n }));\n };\n\n #onDragOver = evt => {\n evt.preventDefault();\n\n if (this.disabled || this.noDrag) {\n evt.dataTransfer.dropEffect = 'none';\n return;\n }\n\n evt.dataTransfer.dropEffect = 'copy';\n\n this.#dropzoneEl.classList.add('dropzone--dragover');\n this.#dropzoneEl.part.add('dropzone--dragover');\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragover`, {\n bubbles: true,\n composed: true\n }));\n };\n\n #onDragLeave = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragleave`, {\n bubbles: true,\n composed: true\n }));\n };\n\n #onDrop = async evt => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n evt.preventDefault();\n\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n #onClick = () => {\n if (this.disabled || this.noClick) {\n return;\n }\n\n this.#fileInput.click();\n };\n\n #onKeyUp = evt => {\n if (this.disabled || this.noKeyboard) {\n return;\n }\n\n if (evt.key === ' ' || evt.key === 'Enter') {\n this.#fileInput.click();\n }\n };\n\n #handleFilesSelect(files) {\n if (!Array.isArray(files) || !files.length) {\n return;\n }\n\n const acceptedFiles = [];\n const rejectedFiles = [];\n const filesLength = files.length;\n\n // If the component is not in multiple mode, reject all files.\n if (!this.multiple && filesLength > 1) {\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only 1 file is allowed.`\n }]\n });\n }\n } else if (this.multiple && filesLength > this.maxFiles) {\n // If the component is in multiple mode, but the number of files exceeds\n // the maxFiles attribute, reject all files.\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only ${this.maxFiles} ${this.maxFiles > 1 ? 'files are' : 'file is'} allowed.`\n }]\n });\n }\n } else {\n // Validate each file. If it's valid, add it to the accepted files array,\n // otherwise add it to the rejected files array.\n for (const file of files) {\n const fileHasValidType = isValidFile(file, this.accept);\n const fileExceedsMaxSize = file.size > this.maxSize;\n const fileIsSmallerThanMinSize = file.size < this.minSize;\n\n if (fileHasValidType && !fileExceedsMaxSize && !fileIsSmallerThanMinSize) {\n acceptedFiles.push(file);\n } else {\n const errors = [];\n\n if (!fileHasValidType) {\n errors.push({\n code: INVALID_MIME_TYPE,\n message: `File type \"${file.type}\" is not accepted.`\n });\n }\n\n if (fileExceedsMaxSize) {\n errors.push({\n code: FILE_TOO_LARGE,\n message: `File size ${file.size} exceeds the maximum size of ${this.maxSize}.`\n });\n }\n\n if (fileIsSmallerThanMinSize) {\n errors.push({\n code: FILE_TOO_SMALL,\n message: `File size ${file.size} is smaller than the minimum size of ${this.minSize}.`\n });\n }\n\n rejectedFiles.push({ file, errors });\n }\n }\n }\n\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles,\n rejectedFiles\n }\n }));\n\n if (acceptedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-accepted`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles\n }\n }));\n }\n\n if (rejectedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-rejected`, {\n bubbles: true,\n composed: true,\n detail: {\n rejectedFiles\n }\n }));\n }\n\n this.#fileInput.value = this.#fileInput.defaultValue;\n }\n\n openFileDialog() {\n if (this.disabled) {\n return;\n }\n\n this.#fileInput.click();\n }\n\n /**\n * https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties\n * This is to safe guard against cases where, for instance, a framework may have added the element to the page and set a\n * value on one of its properties, but lazy loaded its definition. Without this guard, the upgraded element would miss that\n * property and the instance property would prevent the class property setter from ever being called.\n */\n #upgradeProperty(prop) {\n if (Object.prototype.hasOwnProperty.call(this, prop)) {\n const value = this[prop];\n delete this[prop];\n this[prop] = value;\n }\n }\n\n static defineCustomElement(elementName = COMPONENT_NAME) {\n if (typeof window !== 'undefined' && !window.customElements.get(elementName)) {\n window.customElements.define(elementName, FilesDropzone);\n }\n }\n}\n\nexport { FilesDropzone };\n","import { FilesDropzone } from './files-dropzone.js';\n\nFilesDropzone.defineCustomElement();\n\nexport { FilesDropzone };\n"],"names":["$54e5dea46d3d830b$export$2e2bcd8739ae039","receiver","privateMap","action","has","TypeError","get","$4a9af28d8c332738$export$2e2bcd8739ae039","descriptor","call","value","$0ebd1ade8fb3d51f$export$2e2bcd8739ae039","$ce94785d052866a0$export$2e2bcd8739ae039","obj","privateCollection","$96b9e3133fa8e43f$export$2e2bcd8739ae039","set","$a5f62c39645bb2ba$export$2e2bcd8739ae039","writable","$6108fbe778b62371$export$2e2bcd8739ae039","$1b12450ac511053e$export$2e2bcd8739ae039","privateSet","fn","$39719070878026a5$export$2e2bcd8739ae039","add","$38f222170fd4d21a$export$7c47054fed488f80","file","acceptedTypeSpecifiers","acceptedMimeTypesList","Set","split","map","v","trim","filter","Boolean","fileMimeType","type","baseMimeType","replace","validType","charAt","name","toLowerCase","indexOf","length","test","$f31161edf38949e9$var$COMMON_MIME_TYPES","Map","$f31161edf38949e9$var$FILES_TO_IGNORE","$f31161edf38949e9$var$toFileWithPath","path","fileWithMimeType","lastIndexOf","extension","pop","Object","defineProperty","configurable","enumerable","$f31161edf38949e9$var$toFileWithMimeType","webkitRelativePath","$f31161edf38949e9$var$readEntriesPromise","async","directoryReader","Promise","resolve","reject","readEntries","$f31161edf38949e9$var$readAllDirectoryEntries","entries","push","$f31161edf38949e9$var$getFileFromFileEntry","fileEntry","fullPath","$f31161edf38949e9$var$getFilesFromFileList","fileList","files","$f31161edf38949e9$export$6d52664cd15c442","evt","dataTransfer","items","dataTransferItemList","queue","item","kind","entry","getAsEntry","webkitGetAsEntry","shift","isFile","isDirectory","createReader","$f31161edf38949e9$var$getFilesFromDataTransferItemList","target","$862aa3736b0514bc$var$COMPONENT_NAME","$862aa3736b0514bc$var$TOO_MANY_FILES","$862aa3736b0514bc$var$template","document","createElement","innerHTML","$862aa3736b0514bc$var$_fileInput","WeakMap","$862aa3736b0514bc$var$_dropzoneEl","$862aa3736b0514bc$var$_onFileInputChange","$862aa3736b0514bc$var$_onDragEnter","$862aa3736b0514bc$var$_onDragOver","$862aa3736b0514bc$var$_onDragLeave","$862aa3736b0514bc$var$_onDrop","$862aa3736b0514bc$var$_onClick","$862aa3736b0514bc$var$_onKeyUp","$862aa3736b0514bc$var$_handleFilesSelect","WeakSet","$862aa3736b0514bc$var$_upgradeProperty","$862aa3736b0514bc$export$6ccd1735166caad9","HTMLElement","observedAttributes","attributeChangedCallback","oldValue","newValue","this","accept","disabled","removeAttribute","setAttribute","multiple","noKeyboard","connectedCallback","$862aa3736b0514bc$var$upgradeProperty","addEventListener","autoFocus","focus","disconnectedCallback","removeEventListener","getAttribute","hasAttribute","maxFiles","num","Number","Infinity","Math","floor","abs","maxSize","isNaN","minSize","noClick","noDrag","noStyle","openFileDialog","click","static","elementName","window","customElements","define","constructor","super","$862aa3736b0514bc$var$handleFilesSelect","error","dispatchEvent","CustomEvent","bubbles","composed","detail","Event","preventDefault","dropEffect","classList","part","remove","key","shadowRoot","attachShadow","mode","appendChild","content","cloneNode","getElementById","Array","isArray","acceptedFiles","rejectedFiles","filesLength","errors","code","message","fileHasValidType","fileExceedsMaxSize","size","fileIsSmallerThanMinSize","defaultValue","prop","prototype","hasOwnProperty","defineCustomElement"],"version":3,"file":"files-dropzone-defined.js.map"}
|
package/dist/files-dropzone.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e,t,i){if(!t.has(e))throw new TypeError("attempted to "+i+" private field on non-instance");return t.get(e)}function t(e,t){return t.get?t.get.call(e):t.value}function i(i,o){return t(i,e(i,o,"get"))}function o(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function n(e,t,i){o(e,t),t.set(e,i)}function s(e,t,i){if(t.set)t.set.call(e,i);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=i}}function a(t,i,o){return s(t,e(t,i,"set"),o),o}function r(e,t,i){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return i}function l(e,t){o(e,t),t.add(e)}function d(e,t=""){if(!t)return!0;const i=[...new Set(t.split(",").map((e=>e.trim())).filter(Boolean))],o=e.type,n=o.replace(/\/.*$/,"");for(const t of i)if("."===t.charAt(0)){if(-1!==e.name.toLowerCase().indexOf(t.toLowerCase(),e.name.length-t.length))return!0}else if(/\/\*$/.test(t)){if(n===t.replace(/\/.*$/,""))return!0}else if(o===t)return!0;return!1}const p=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]),c=[".DS_Store","Thumbs.db"],h=(e,t)=>{const i=(e=>{const{name:t}=e;if(t&&-1!==t.lastIndexOf(".")&&!e.type){const i=t.split(".").pop().toLowerCase(),o=p.get(i);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e})(e);if("string"!=typeof i.path){const{webkitRelativePath:o}=e;Object.defineProperty(i,"path",{value:"string"==typeof t?t:o||e.name,writable:!1,configurable:!1,enumerable:!0})}return i},m=async e=>await new Promise(((t,i)=>{e.readEntries(t,i)})),u=async e=>{const t=[];let i=await m(e);for(;i.length>0;)t.push(...i),i=await m(e);return t},b=e=>new Promise(((t,i)=>{e.file((i=>t(h(i,e.fullPath))),i)})),f=async e=>{const t=[];for(const i of e)-1===c.indexOf(i.name)&&t.push(h(i));return t},v=async e=>e.dataTransfer?e.dataTransfer.items?await(async e=>{const t=[],i=[];for(const t of e){if("file"!==t.kind)continue;const e=t.getAsEntry?t.getAsEntry():t.webkitGetAsEntry();i.push(e)}for(;i.length>0;){const e=i.shift();if(e)if(e.isFile){const i=await b(e);-1===c.indexOf(i.name)&&t.push(i)}else e.isDirectory&&i.push(...await u(e.createReader()))}return t})(e.dataTransfer.items):await f(e.dataTransfer.files):await f(e.target.files),g="files-dropzone",w="TOO_MANY_FILES",y=document.createElement("template");y.innerHTML='\n <style>\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #71717a;\n --dropzone-border-color-dragover: #0ea5e9;\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border 0.2s ease-in-out, background-color 0.2s ease-in-out, color 0.2s ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n </style>\n\n <input type="file" id="fileInput" hidden>\n\n <div part="dropzone" class="dropzone" id="dropzoneEl" tabindex="0" role="presentation">\n <slot>Drag \'n\' drop files here, or click to select files</slot>\n </div>\n';var x=new WeakMap,z=new WeakMap,E=new WeakMap,k=new WeakMap,A=new WeakMap,L=new WeakMap,j=new WeakMap,S=new WeakMap,C=new WeakMap,F=new WeakSet,T=new WeakSet;class M extends HTMLElement{static get observedAttributes(){return["accept","disabled","multiple","no-keyboard"]}attributeChangedCallback(e,t,o){"accept"===e&&t!==o&&i(this,x)&&(i(this,x).accept=this.accept),"disabled"===e&&t!==o&&i(this,x)&&(i(this,x).disabled=this.disabled,this.disabled?i(this,z).removeAttribute("tabindex"):i(this,z).setAttribute("tabindex","0")),"multiple"===e&&t!==o&&i(this,x)&&(i(this,x).multiple=this.multiple),"no-keyboard"===e&&t!==o&&i(this,z)&&(this.noKeyboard?i(this,z).removeAttribute("tabindex"):i(this,z).setAttribute("tabindex","0"))}connectedCallback(){r(this,T,O).call(this,"accept"),r(this,T,O).call(this,"disabled"),r(this,T,O).call(this,"maxFiles"),r(this,T,O).call(this,"maxSize"),r(this,T,O).call(this,"minSize"),r(this,T,O).call(this,"multiple"),r(this,T,O).call(this,"noClick"),r(this,T,O).call(this,"noDrag"),r(this,T,O).call(this,"noKeyboard"),r(this,T,O).call(this,"noStyle"),i(this,x).addEventListener("change",i(this,E)),i(this,z).addEventListener("dragenter",i(this,k)),i(this,z).addEventListener("dragover",i(this,A)),i(this,z).addEventListener("dragleave",i(this,L)),i(this,z).addEventListener("drop",i(this,j)),i(this,z).addEventListener("click",i(this,S)),i(this,z).addEventListener("keyup",i(this,C))}disconnectedCallback(){i(this,x).removeEventListener("change",i(this,E)),i(this,z).removeEventListener("dragenter",i(this,k)),i(this,z).removeEventListener("dragover",i(this,A)),i(this,z).removeEventListener("dragleave",i(this,L)),i(this,z).removeEventListener("drop",i(this,j)),i(this,z).removeEventListener("click",i(this,S)),i(this,z).removeEventListener("keyup",i(this,C))}get accept(){return this.getAttribute("accept")}set accept(e){this.setAttribute("accept",e)}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get maxFiles(){const e=Number(this.getAttribute("max-files"))||0;return e<=0?1/0:Math.floor(Math.abs(e))}set maxFiles(e){this.setAttribute("max-files",e)}get maxSize(){const e=this.getAttribute("max-size");if(null===e)return 1/0;const t=Number(e);return Number.isNaN(t)?1/0:t}set maxSize(e){this.setAttribute("max-size",e)}get minSize(){const e=this.getAttribute("min-size");if(null===e)return 0;const t=Number(e);return Number.isNaN(t)?0:t}set minSize(e){this.setAttribute("min-size",e)}get multiple(){return this.hasAttribute("multiple")}set multiple(e){e?this.setAttribute("multiple",""):this.removeAttribute("multiple")}get noClick(){return this.hasAttribute("no-click")}set noClick(e){e?this.setAttribute("no-click",""):this.removeAttribute("no-click")}get noDrag(){return this.hasAttribute("no-drag")}set noDrag(e){e?this.setAttribute("no-drag",""):this.removeAttribute("no-drag")}get noKeyboard(){return this.hasAttribute("no-keyboard")}set noKeyboard(e){e?this.setAttribute("no-keyboard",""):this.removeAttribute("no-keyboard")}get noStyle(){return this.hasAttribute("no-style")}set noStyle(e){e?this.setAttribute("no-style",""):this.removeAttribute("no-style")}openFileDialog(){this.disabled||i(this,x).click()}static defineCustomElement(e=g){"undefined"==typeof window||window.customElements.get(e)||window.customElements.define(e,M)}constructor(){super(),l(this,F),l(this,T),n(this,x,{writable:!0,value:void 0}),n(this,z,{writable:!0,value:void 0}),n(this,E,{writable:!0,value:async e=>{try{r(this,F,$).call(this,await v(e))}catch(e){this.dispatchEvent(new CustomEvent(`${g}-error`,{bubbles:!0,composed:!0,detail:{error:e}}))}}}),n(this,k,{writable:!0,value:()=>{this.disabled||this.noDrag||this.dispatchEvent(new Event(`${g}-dragenter`,{bubbles:!0,composed:!0}))}}),n(this,A,{writable:!0,value:e=>{e.preventDefault(),this.disabled||this.noDrag?e.dataTransfer.dropEffect="none":(e.dataTransfer.dropEffect="copy",i(this,z).classList.add("dropzone--dragover"),i(this,z).part.add("dropzone--dragover"),this.dispatchEvent(new Event(`${g}-dragover`,{bubbles:!0,composed:!0})))}}),n(this,L,{writable:!0,value:()=>{this.disabled||this.noDrag||(i(this,z).classList.remove("dropzone--dragover"),i(this,z).part.remove("dropzone--dragover"),this.dispatchEvent(new Event(`${g}-dragleave`,{bubbles:!0,composed:!0})))}}),n(this,j,{writable:!0,value:async e=>{if(!this.disabled&&!this.noDrag){e.preventDefault(),i(this,z).classList.remove("dropzone--dragover"),i(this,z).part.remove("dropzone--dragover");try{r(this,F,$).call(this,await v(e))}catch(e){this.dispatchEvent(new CustomEvent(`${g}-error`,{bubbles:!0,composed:!0,detail:{error:e}}))}}}}),n(this,S,{writable:!0,value:()=>{this.disabled||this.noClick||i(this,x).click()}}),n(this,C,{writable:!0,value:e=>{this.disabled||this.noKeyboard||" "!==e.key&&"Enter"!==e.key||i(this,x).click()}}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(y.content.cloneNode(!0))),a(this,x,this.shadowRoot.getElementById("fileInput")),a(this,z,this.shadowRoot.getElementById("dropzoneEl"))}}function $(e){if(!Array.isArray(e)||!e.length)return;const t=[],o=[],n=e.length;if(!this.multiple&&n>1)for(const t of e)o.push({file:t,errors:[{code:w,message:"Too many files selected. Only 1 file is allowed."}]});else if(this.multiple&&n>this.maxFiles)for(const t of e)o.push({file:t,errors:[{code:w,message:`Too many files selected. Only ${this.maxFiles} ${this.maxFiles>1?"files are":"file is"} allowed.`}]});else for(const i of e){const e=d(i,this.accept),n=i.size>this.maxSize,s=i.size<this.minSize;if(!e||n||s){const t=[];e||t.push({code:"INVALID_MIME_TYPE",message:`File type "${i.type}" is not accepted.`}),n&&t.push({code:"FILE_TOO_LARGE",message:`File size ${i.size} exceeds the maximum size of ${this.maxSize}.`}),s&&t.push({code:"FILE_TOO_SMALL",message:`File size ${i.size} is smaller than the minimum size of ${this.minSize}.`}),o.push({file:i,errors:t})}else t.push(i)}this.dispatchEvent(new CustomEvent(`${g}-drop`,{bubbles:!0,composed:!0,detail:{acceptedFiles:t,rejectedFiles:o}})),t.length>0&&this.dispatchEvent(new CustomEvent(`${g}-drop-accepted`,{bubbles:!0,composed:!0,detail:{acceptedFiles:t}})),o.length>0&&this.dispatchEvent(new CustomEvent(`${g}-drop-rejected`,{bubbles:!0,composed:!0,detail:{rejectedFiles:o}})),i(this,x).value=i(this,x).defaultValue}function O(e){if(Object.prototype.hasOwnProperty.call(this,e)){const t=this[e];delete this[e],this[e]=t}}export{M as FilesDropzone};
|
|
1
|
+
function e(e,t,i){if(!t.has(e))throw new TypeError("attempted to "+i+" private field on non-instance");return t.get(e)}function t(e,t){return t.get?t.get.call(e):t.value}function i(i,o){return t(i,e(i,o,"get"))}function o(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function n(e,t,i){o(e,t),t.set(e,i)}function s(e,t,i){if(t.set)t.set.call(e,i);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=i}}function a(t,i,o){return s(t,e(t,i,"set"),o),o}function r(e,t,i){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return i}function l(e,t){o(e,t),t.add(e)}function d(e,t=""){if(!t)return!0;const i=[...new Set(t.split(",").map((e=>e.trim())).filter(Boolean))],o=e.type,n=o.replace(/\/.*$/,"");for(const t of i)if("."===t.charAt(0)){if(-1!==e.name.toLowerCase().indexOf(t.toLowerCase(),e.name.length-t.length))return!0}else if(/\/\*$/.test(t)){if(n===t.replace(/\/.*$/,""))return!0}else if(o===t)return!0;return!1}const c=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]),p=[".DS_Store","Thumbs.db"],h=(e,t)=>{const i=(e=>{const{name:t}=e;if(t&&-1!==t.lastIndexOf(".")&&!e.type){const i=t.split(".").pop().toLowerCase(),o=c.get(i);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e})(e);if("string"!=typeof i.path){const{webkitRelativePath:o}=e;Object.defineProperty(i,"path",{value:"string"==typeof t?t:o||e.name,writable:!1,configurable:!1,enumerable:!0})}return i},u=async e=>await new Promise(((t,i)=>{e.readEntries(t,i)})),m=async e=>{const t=[];let i=await u(e);for(;i.length>0;)t.push(...i),i=await u(e);return t},b=e=>new Promise(((t,i)=>{e.file((i=>t(h(i,e.fullPath))),i)})),f=async e=>{const t=[];for(const i of e)-1===p.indexOf(i.name)&&t.push(h(i));return t},v=async e=>e.dataTransfer?e.dataTransfer.items?await(async e=>{const t=[],i=[];for(const t of e){if("file"!==t.kind)continue;const e=t.getAsEntry?t.getAsEntry():t.webkitGetAsEntry();i.push(e)}for(;i.length>0;){const e=i.shift();if(e)if(e.isFile){const i=await b(e);-1===p.indexOf(i.name)&&t.push(i)}else e.isDirectory&&i.push(...await m(e.createReader()))}return t})(e.dataTransfer.items):await f(e.dataTransfer.files):await f(e.target.files),g="files-dropzone",w="TOO_MANY_FILES",x=document.createElement("template");x.innerHTML='\n <style>\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #6c757d;\n --dropzone-border-color-dragover: #0d6efd;\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n --dropzone-focus-shadow-rgb: 49,132,253;\n --transition-duration: 0.2s;\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border var(--transition-duration) ease-in-out, background-color var(--transition-duration) ease-in-out, color var(--transition-duration) ease-in-out, box-shadow var(--transition-duration) ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone:focus-visible {\n outline: none;\n box-shadow: 0 0 0 0.25rem rgba(var(--dropzone-focus-shadow-rgb), 0.5);\n }\n </style>\n\n <input type="file" id="fileInput" hidden>\n\n <div part="dropzone" class="dropzone" id="dropzoneEl" tabindex="0" role="presentation">\n <slot>Drag \'n\' drop files here, or click to select files</slot>\n </div>\n';var y=new WeakMap,z=new WeakMap,E=new WeakMap,k=new WeakMap,A=new WeakMap,L=new WeakMap,F=new WeakMap,j=new WeakMap,S=new WeakMap,C=new WeakSet,T=new WeakSet;class M extends HTMLElement{static get observedAttributes(){return["accept","disabled","multiple","no-keyboard"]}attributeChangedCallback(e,t,o){"accept"===e&&t!==o&&i(this,y)&&(i(this,y).accept=this.accept),"disabled"===e&&t!==o&&i(this,y)&&(i(this,y).disabled=this.disabled,this.disabled?i(this,z).removeAttribute("tabindex"):i(this,z).setAttribute("tabindex","0")),"multiple"===e&&t!==o&&i(this,y)&&(i(this,y).multiple=this.multiple),"no-keyboard"===e&&t!==o&&i(this,z)&&(this.noKeyboard?i(this,z).removeAttribute("tabindex"):i(this,z).setAttribute("tabindex","0"))}connectedCallback(){r(this,T,O).call(this,"accept"),r(this,T,O).call(this,"disabled"),r(this,T,O).call(this,"maxFiles"),r(this,T,O).call(this,"maxSize"),r(this,T,O).call(this,"minSize"),r(this,T,O).call(this,"multiple"),r(this,T,O).call(this,"noClick"),r(this,T,O).call(this,"noDrag"),r(this,T,O).call(this,"noKeyboard"),r(this,T,O).call(this,"autoFocus"),r(this,T,O).call(this,"noStyle"),i(this,y).addEventListener("change",i(this,E)),i(this,z).addEventListener("dragenter",i(this,k)),i(this,z).addEventListener("dragover",i(this,A)),i(this,z).addEventListener("dragleave",i(this,L)),i(this,z).addEventListener("drop",i(this,F)),i(this,z).addEventListener("click",i(this,j)),i(this,z).addEventListener("keyup",i(this,S)),this.autoFocus&&i(this,z).focus()}disconnectedCallback(){i(this,y).removeEventListener("change",i(this,E)),i(this,z).removeEventListener("dragenter",i(this,k)),i(this,z).removeEventListener("dragover",i(this,A)),i(this,z).removeEventListener("dragleave",i(this,L)),i(this,z).removeEventListener("drop",i(this,F)),i(this,z).removeEventListener("click",i(this,j)),i(this,z).removeEventListener("keyup",i(this,S))}get accept(){return this.getAttribute("accept")}set accept(e){this.setAttribute("accept",e)}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get maxFiles(){const e=Number(this.getAttribute("max-files"))||0;return e<=0?1/0:Math.floor(Math.abs(e))}set maxFiles(e){this.setAttribute("max-files",e)}get maxSize(){const e=this.getAttribute("max-size");if(null===e)return 1/0;const t=Number(e);return Number.isNaN(t)?1/0:t}set maxSize(e){this.setAttribute("max-size",e)}get minSize(){const e=this.getAttribute("min-size");if(null===e)return 0;const t=Number(e);return Number.isNaN(t)?0:t}set minSize(e){this.setAttribute("min-size",e)}get multiple(){return this.hasAttribute("multiple")}set multiple(e){e?this.setAttribute("multiple",""):this.removeAttribute("multiple")}get noClick(){return this.hasAttribute("no-click")}set noClick(e){e?this.setAttribute("no-click",""):this.removeAttribute("no-click")}get noDrag(){return this.hasAttribute("no-drag")}set noDrag(e){e?this.setAttribute("no-drag",""):this.removeAttribute("no-drag")}get noKeyboard(){return this.hasAttribute("no-keyboard")}set noKeyboard(e){e?this.setAttribute("no-keyboard",""):this.removeAttribute("no-keyboard")}get autoFocus(){return this.hasAttribute("auto-focus")}set autoFocus(e){e?this.setAttribute("auto-focus",""):this.removeAttribute("auto-focus")}get noStyle(){return this.hasAttribute("no-style")}set noStyle(e){e?this.setAttribute("no-style",""):this.removeAttribute("no-style")}openFileDialog(){this.disabled||i(this,y).click()}static defineCustomElement(e=g){"undefined"==typeof window||window.customElements.get(e)||window.customElements.define(e,M)}constructor(){super(),l(this,C),l(this,T),n(this,y,{writable:!0,value:void 0}),n(this,z,{writable:!0,value:void 0}),n(this,E,{writable:!0,value:async e=>{try{r(this,C,$).call(this,await v(e))}catch(e){this.dispatchEvent(new CustomEvent(`${g}-error`,{bubbles:!0,composed:!0,detail:{error:e}}))}}}),n(this,k,{writable:!0,value:()=>{this.disabled||this.noDrag||this.dispatchEvent(new Event(`${g}-dragenter`,{bubbles:!0,composed:!0}))}}),n(this,A,{writable:!0,value:e=>{e.preventDefault(),this.disabled||this.noDrag?e.dataTransfer.dropEffect="none":(e.dataTransfer.dropEffect="copy",i(this,z).classList.add("dropzone--dragover"),i(this,z).part.add("dropzone--dragover"),this.dispatchEvent(new Event(`${g}-dragover`,{bubbles:!0,composed:!0})))}}),n(this,L,{writable:!0,value:()=>{this.disabled||this.noDrag||(i(this,z).classList.remove("dropzone--dragover"),i(this,z).part.remove("dropzone--dragover"),this.dispatchEvent(new Event(`${g}-dragleave`,{bubbles:!0,composed:!0})))}}),n(this,F,{writable:!0,value:async e=>{if(!this.disabled&&!this.noDrag){e.preventDefault(),i(this,z).classList.remove("dropzone--dragover"),i(this,z).part.remove("dropzone--dragover");try{r(this,C,$).call(this,await v(e))}catch(e){this.dispatchEvent(new CustomEvent(`${g}-error`,{bubbles:!0,composed:!0,detail:{error:e}}))}}}}),n(this,j,{writable:!0,value:()=>{this.disabled||this.noClick||i(this,y).click()}}),n(this,S,{writable:!0,value:e=>{this.disabled||this.noKeyboard||" "!==e.key&&"Enter"!==e.key||i(this,y).click()}}),this.shadowRoot||(this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(x.content.cloneNode(!0))),a(this,y,this.shadowRoot.getElementById("fileInput")),a(this,z,this.shadowRoot.getElementById("dropzoneEl"))}}function $(e){if(!Array.isArray(e)||!e.length)return;const t=[],o=[],n=e.length;if(!this.multiple&&n>1)for(const t of e)o.push({file:t,errors:[{code:w,message:"Too many files selected. Only 1 file is allowed."}]});else if(this.multiple&&n>this.maxFiles)for(const t of e)o.push({file:t,errors:[{code:w,message:`Too many files selected. Only ${this.maxFiles} ${this.maxFiles>1?"files are":"file is"} allowed.`}]});else for(const i of e){const e=d(i,this.accept),n=i.size>this.maxSize,s=i.size<this.minSize;if(!e||n||s){const t=[];e||t.push({code:"INVALID_MIME_TYPE",message:`File type "${i.type}" is not accepted.`}),n&&t.push({code:"FILE_TOO_LARGE",message:`File size ${i.size} exceeds the maximum size of ${this.maxSize}.`}),s&&t.push({code:"FILE_TOO_SMALL",message:`File size ${i.size} is smaller than the minimum size of ${this.minSize}.`}),o.push({file:i,errors:t})}else t.push(i)}this.dispatchEvent(new CustomEvent(`${g}-drop`,{bubbles:!0,composed:!0,detail:{acceptedFiles:t,rejectedFiles:o}})),t.length>0&&this.dispatchEvent(new CustomEvent(`${g}-drop-accepted`,{bubbles:!0,composed:!0,detail:{acceptedFiles:t}})),o.length>0&&this.dispatchEvent(new CustomEvent(`${g}-drop-rejected`,{bubbles:!0,composed:!0,detail:{rejectedFiles:o}})),i(this,y).value=i(this,y).defaultValue}function O(e){if(Object.prototype.hasOwnProperty.call(this,e)){const t=this[e];delete this[e],this[e]=t}}export{M as FilesDropzone};
|
|
2
2
|
//# sourceMappingURL=files-dropzone.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAe,SAAAA,EAAsCC,EAAUC,EAAYC,GACzE,IAAKD,EAAWE,IAAIH,GAClB,MAAM,IAAII,UAAU,gBAAkBF,EAAS,kCAEjD,OAAOD,EAAWI,IAAIL,EACxB,CCLe,SAAAM,EAAkCN,EAAUO,GACzD,OAAIA,EAAWF,IAC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UwF,YAC1C,CAgBA,SAAA7D,EAAiB8D,GACf,GAAItI,OAAOuI,UAAUC,eAAevL,KAAK+G,KAAMsE,GAAO,CACpD,MAAMpL,EAAQ8G,KAAKsE,UACZtE,KAAKsE,GACZtE,KAAKsE,GAAQpL,CACf,CACF,Q","sources":["node_modules/@swc/helpers/src/_class_extract_field_descriptor.mjs","node_modules/@swc/helpers/src/_class_apply_descriptor_get.mjs","node_modules/@swc/helpers/src/_class_private_field_get.mjs","node_modules/@swc/helpers/src/_check_private_redeclaration.mjs","node_modules/@swc/helpers/src/_class_private_field_init.mjs","node_modules/@swc/helpers/src/_class_apply_descriptor_set.mjs","node_modules/@swc/helpers/src/_class_private_field_set.mjs","node_modules/@swc/helpers/src/_class_private_method_get.mjs","node_modules/@swc/helpers/src/_class_private_method_init.mjs","src/utils/is-valid-file.js","src/utils/files-selector.js","src/files-dropzone.js"],"sourcesContent":["export default function _classExtractFieldDescriptor(receiver, privateMap, action) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to \" + action + \" private field on non-instance\");\n }\n return privateMap.get(receiver);\n}\n","export default function _classApplyDescriptorGet(receiver, descriptor) {\n if (descriptor.get) {\n return descriptor.get.call(receiver);\n }\n return descriptor.value;\n}\n","import classExtractFieldDescriptor from './_class_extract_field_descriptor.mjs';\nimport classApplyDescriptorGet from './_class_apply_descriptor_get.mjs';\n\nexport default function _classPrivateFieldGet(receiver, privateMap) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"get\");\n return classApplyDescriptorGet(receiver, descriptor);\n}\n","export default function _checkPrivateRedeclaration(obj, privateCollection) {\n if (privateCollection.has(obj)) {\n throw new TypeError(\"Cannot initialize the same private elements twice on an object\");\n }\n}\n","import _checkPrivateRedeclaration from \"./_check_private_redeclaration.mjs\";\n\nexport default function _classPrivateFieldInit(obj, privateMap, value) {\n _checkPrivateRedeclaration(obj, privateMap);\n privateMap.set(obj, value);\n}\n","export default function _classApplyDescriptorSet(receiver, descriptor, value) {\n if (descriptor.set) {\n descriptor.set.call(receiver, value);\n } else {\n if (!descriptor.writable) {\n // This should only throw in strict mode, but class bodies are\n // always strict and private fields can only be used inside\n // class bodies.\n throw new TypeError(\"attempted to set read only private field\");\n }\n descriptor.value = value;\n }\n}\n","import classExtractFieldDescriptor from './_class_extract_field_descriptor.mjs';\nimport classApplyDescriptorSet from './_class_apply_descriptor_set.mjs';\n\nexport default function _classPrivateFieldSet(receiver, privateMap, value) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"set\");\n classApplyDescriptorSet(receiver, descriptor, value);\n return value;\n}\n","export default function _classPrivateMethodGet(receiver, privateSet, fn) {\n if (!privateSet.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return fn;\n}\n","import _checkPrivateRedeclaration from \"./_check_private_redeclaration.mjs\";\n\nexport default function _classPrivateMethodInit(obj, privateSet) {\n _checkPrivateRedeclaration(obj, privateSet);\n privateSet.add(obj);\n}\n","/**\n * Checks if a file is valid based on the accepted file type specifiers.\n *\n * @param {File} file The File object to validate.\n * @param {String} [acceptedTypeSpecifiers=''] The accepted file type specifiers.\n * @returns {Boolean} True if the file is valid, false otherwise.\n */\nexport function isValidFile(file, acceptedTypeSpecifiers = '') {\n if (!acceptedTypeSpecifiers) {\n return true;\n }\n\n const acceptedMimeTypesList = [\n ...new Set(acceptedTypeSpecifiers.split(',').map(v => v.trim()).filter(Boolean))\n ];\n\n const fileMimeType = file.type;\n const baseMimeType = fileMimeType.replace(/\\/.*$/, '');\n\n for (const validType of acceptedMimeTypesList) {\n if (validType.charAt(0) === '.') {\n if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) {\n return true;\n }\n } else if (/\\/\\*$/.test(validType)) {\n // Check for mime type that looks like \"image/*\" or similar.\n if (baseMimeType === validType.replace(/\\/.*$/, '')) {\n return true;\n }\n } else {\n if (fileMimeType === validType) {\n return true;\n }\n }\n }\n\n return false;\n}\n","const COMMON_MIME_TYPES = new Map([\n // https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\n ['aac', 'audio/aac'],\n ['abw', 'application/x-abiword'],\n ['arc', 'application/x-freearc'],\n ['avif', 'image/avif'],\n ['avi', 'video/x-msvideo'],\n ['azw', 'application/vnd.amazon.ebook'],\n ['bin', 'application/octet-stream'],\n ['bmp', 'image/bmp'],\n ['bz', 'application/x-bzip'],\n ['bz2', 'application/x-bzip2'],\n ['cda', 'application/x-cdf'],\n ['csh', 'application/x-csh'],\n ['css', 'text/css'],\n ['csv', 'text/csv'],\n ['doc', 'application/msword'],\n ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],\n ['eot', 'application/vnd.ms-fontobject'],\n ['epub', 'application/epub+zip'],\n ['gz', 'application/gzip'],\n ['gif', 'image/gif'],\n ['heic', 'image/heic'],\n ['heif', 'image/heif'],\n ['htm', 'text/html'],\n ['html', 'text/html'],\n ['ico', 'image/vnd.microsoft.icon'],\n ['ics', 'text/calendar'],\n ['jar', 'application/java-archive'],\n ['jpeg', 'image/jpeg'],\n ['jpg', 'image/jpeg'],\n ['js', 'text/javascript'],\n ['json', 'application/json'],\n ['jsonld', 'application/ld+json'],\n ['mid', 'audio/midi'],\n ['midi', 'audio/midi'],\n ['mjs', 'text/javascript'],\n ['mp3', 'audio/mpeg'],\n ['mp4', 'video/mp4'],\n ['mpeg', 'video/mpeg'],\n ['mpkg', 'application/vnd.apple.installer+xml'],\n ['odp', 'application/vnd.oasis.opendocument.presentation'],\n ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],\n ['odt', 'application/vnd.oasis.opendocument.text'],\n ['oga', 'audio/ogg'],\n ['ogv', 'video/ogg'],\n ['ogx', 'application/ogg'],\n ['opus', 'audio/opus'],\n ['otf', 'font/otf'],\n ['png', 'image/png'],\n ['pdf', 'application/pdf'],\n ['php', 'application/x-httpd-php'],\n ['ppt', 'application/vnd.ms-powerpoint'],\n ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],\n ['rar', 'application/vnd.rar'],\n ['rtf', 'application/rtf'],\n ['sh', 'application/x-sh'],\n ['svg', 'image/svg+xml'],\n ['swf', 'application/x-shockwave-flash'],\n ['tar', 'application/x-tar'],\n ['tif', 'image/tiff'],\n ['tiff', 'image/tiff'],\n ['ts', 'video/mp2t'],\n ['ttf', 'font/ttf'],\n ['txt', 'text/plain'],\n ['vsd', 'application/vnd.visio'],\n ['wav', 'audio/wav'],\n ['weba', 'audio/webm'],\n ['webm', 'video/webm'],\n ['webp', 'image/webp'],\n ['woff', 'font/woff'],\n ['woff2', 'font/woff2'],\n ['xhtml', 'application/xhtml+xml'],\n ['xls', 'application/vnd.ms-excel'],\n ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],\n ['xml', 'application/xml'],\n ['xul', 'application/vnd.mozilla.xul+xml'],\n ['zip', 'application/zip'],\n ['7z', 'application/x-7z-compressed'],\n\n // Others\n ['mkv', 'video/x-matroska'],\n ['mov', 'video/quicktime'],\n ['msg', 'application/vnd.ms-outlook']\n]);\n\nconst FILES_TO_IGNORE = [\n // Thumbnail cache files for macOS and Windows\n '.DS_Store', // macOs\n 'Thumbs.db' // Windows\n];\n\n/**\n * Adds a `type` property to the file object if it doesn't have one and the file has an extension.\n * This is needed because Firefox doesn't add a type property to files dragged from the desktop.\n * @bug https://bugzilla.mozilla.org/show_bug.cgi?id=1424689\n *\n * @param {File} file The file object to add the type property to.\n * @returns {File} The file object with the type property added.\n */\nconst toFileWithMimeType = file => {\n const { name } = file;\n const hasExtension = name && name.lastIndexOf('.') !== -1;\n\n if (hasExtension && !file.type) {\n const extension = name.split('.').pop().toLowerCase();\n const type = COMMON_MIME_TYPES.get(extension);\n\n if (type) {\n Object.defineProperty(file, 'type', {\n value: type,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n }\n\n return file;\n};\n\n/**\n * Adds a `path` property to the file object if it doesn't have one.\n * If `path` is not provided, the `webkitRelativePath` property of the file will be used\n * or the file's name if `webkitRelativePath` is not available.\n *\n * @param {File} file The file object to add the path property to.\n * @param {String} [path] The path to set on the file object.\n * @returns {File} The file object with the path property added.\n */\nconst toFileWithPath = (file, path) => {\n const fileWithMimeType = toFileWithMimeType(file);\n\n if (typeof fileWithMimeType.path !== 'string') {\n const { webkitRelativePath } = file;\n\n Object.defineProperty(fileWithMimeType, 'path', {\n value: typeof path === 'string' ? path : webkitRelativePath || file.name,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n\n return fileWithMimeType;\n};\n\n/**\n * Wrap `FileSystemDirectoryReader.readEntries` in a promise to make working with read entries easier.\n * https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader/readEntries\n *\n * @param {FileSystemDirectoryReader} directoryReader The directory reader to read entries from.\n * @returns {Promise<FileSystemFileEntry[]>} A promise that resolves with an array of `FileSystemFileEntry` objects.\n */\nconst readEntriesPromise = async directoryReader => {\n return await new Promise((resolve, reject) => {\n directoryReader.readEntries(resolve, reject);\n });\n};\n\n/**\n * Read all entries in a directory or sub-directory\n * by calling `readEntries` until it returns an empty array.\n *\n * @param {FileSystemDirectoryReader} directoryReader The directory reader to read entries from.\n * @returns {Promise<FileSystemFileEntry[]>} A promise that resolves with an array of `FileSystemFileEntry` objects.\n */\nconst readAllDirectoryEntries = async directoryReader => {\n const entries = [];\n let readEntries = await readEntriesPromise(directoryReader);\n\n while (readEntries.length > 0) {\n entries.push(...readEntries);\n readEntries = await readEntriesPromise(directoryReader);\n }\n\n return entries;\n};\n\n/**\n * Get a `File` object from a `FileSystemFileEntry` object.\n *\n * @param {FileSystemFileEntry} fileEntry The file entry to get a `File` object from.\n * @returns {Promise<File>} A promise that resolves with a `File` object.\n */\nconst getFileFromFileEntry = fileEntry => {\n return new Promise((resolve, reject) => {\n fileEntry.file(file => resolve(toFileWithPath(file, fileEntry.fullPath)), reject);\n });\n};\n\n/**\n * Get an array of `File` objects from a `DataTransferItemList` object.\n *\n * @param {DataTransferItemList} dataTransferItemList The item list to get an array of `File` objects from.\n * @returns {Promise<File[]>} A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromDataTransferItemList = async dataTransferItemList => {\n const files = [];\n\n // Chromium browsers read only 100 files at a time as per the spec, so we need to use\n // BFS (Breadth-first search) to traverse the entire directory/file structure.\n // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry#javascript_content\n const queue = [];\n\n for (const item of dataTransferItemList) {\n if (item.kind !== 'file') {\n // Ignore non-file items, such as links.\n continue;\n }\n\n // https://developer.mozilla.org/docs/Web/API/DataTransferItem/webkitGetAsEntry\n // This function is implemented as `webkitGetAsEntry()` in non-WebKit browsers\n // including Firefox at this time but it may be renamed to `getAsEntry()` in the future.\n const entry = item.getAsEntry ? item.getAsEntry() : item.webkitGetAsEntry();\n\n queue.push(entry);\n }\n\n while (queue.length > 0) {\n const entry = queue.shift();\n\n if (!entry) {\n continue;\n } else if (entry.isFile) {\n const file = await getFileFromFileEntry(entry);\n\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(file);\n }\n } else if (entry.isDirectory) {\n queue.push(...await readAllDirectoryEntries(entry.createReader()));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from a `FileList` object.\n *\n * @param {FileList} fileList The file list to get an array of `File` objects from.\n * @returns {Promise<File[]>} A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromFileList = async fileList => {\n const files = [];\n\n for (const file of fileList) {\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(toFileWithPath(file));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from an event.\n * This function supports both `drop` and `change` events.\n *\n * @param {DragEvent | Event} evt The event to get an array of `File` objects from.\n * @returns {Promise<File[]>} A promise that resolves with an array of `File` objects.\n */\nexport const getFilesFromEvent = async evt => {\n if (evt.dataTransfer) {\n return evt.dataTransfer.items\n ? await getFilesFromDataTransferItemList(evt.dataTransfer.items)\n : await getFilesFromFileList(evt.dataTransfer.files);\n }\n\n return await getFilesFromFileList(evt.target.files);\n};\n","import { isValidFile } from './utils/is-valid-file.js';\nimport { getFilesFromEvent } from './utils/files-selector.js';\n\nconst COMPONENT_NAME = 'files-dropzone';\nconst TOO_MANY_FILES = 'TOO_MANY_FILES';\nconst FILE_TOO_LARGE = 'FILE_TOO_LARGE';\nconst FILE_TOO_SMALL = 'FILE_TOO_SMALL';\nconst INVALID_MIME_TYPE = 'INVALID_MIME_TYPE';\nconst template = document.createElement('template');\n\ntemplate.innerHTML = /* html */`\n <style>\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #71717a;\n --dropzone-border-color-dragover: #0ea5e9;\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border 0.2s ease-in-out, background-color 0.2s ease-in-out, color 0.2s ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n </style>\n\n <input type=\"file\" id=\"fileInput\" hidden>\n\n <div part=\"dropzone\" class=\"dropzone\" id=\"dropzoneEl\" tabindex=\"0\" role=\"presentation\">\n <slot>Drag 'n' drop files here, or click to select files</slot>\n </div>\n`;\n\nclass FilesDropzone extends HTMLElement {\n #fileInput;\n #dropzoneEl;\n\n constructor() {\n super();\n\n if (!this.shadowRoot) {\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n }\n\n this.#fileInput = this.shadowRoot.getElementById('fileInput');\n this.#dropzoneEl = this.shadowRoot.getElementById('dropzoneEl');\n }\n\n static get observedAttributes() {\n return ['accept', 'disabled', 'multiple', 'no-keyboard'];\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'accept' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.accept = this.accept;\n }\n\n if (name === 'disabled' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.disabled = this.disabled;\n\n if (this.disabled) {\n this.#dropzoneEl.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl.setAttribute('tabindex', '0');\n }\n }\n\n if (name === 'multiple' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.multiple = this.multiple;\n }\n\n if (name === 'no-keyboard' && oldValue !== newValue && this.#dropzoneEl) {\n if (this.noKeyboard) {\n this.#dropzoneEl.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl.setAttribute('tabindex', '0');\n }\n }\n }\n\n connectedCallback() {\n this.#upgradeProperty('accept');\n this.#upgradeProperty('disabled');\n this.#upgradeProperty('maxFiles');\n this.#upgradeProperty('maxSize');\n this.#upgradeProperty('minSize');\n this.#upgradeProperty('multiple');\n this.#upgradeProperty('noClick');\n this.#upgradeProperty('noDrag');\n this.#upgradeProperty('noKeyboard');\n this.#upgradeProperty('noStyle');\n\n this.#fileInput.addEventListener('change', this.#onFileInputChange);\n this.#dropzoneEl.addEventListener('dragenter', this.#onDragEnter);\n this.#dropzoneEl.addEventListener('dragover', this.#onDragOver);\n this.#dropzoneEl.addEventListener('dragleave', this.#onDragLeave);\n this.#dropzoneEl.addEventListener('drop', this.#onDrop);\n this.#dropzoneEl.addEventListener('click', this.#onClick);\n this.#dropzoneEl.addEventListener('keyup', this.#onKeyUp);\n }\n\n disconnectedCallback() {\n this.#fileInput.removeEventListener('change', this.#onFileInputChange);\n this.#dropzoneEl.removeEventListener('dragenter', this.#onDragEnter);\n this.#dropzoneEl.removeEventListener('dragover', this.#onDragOver);\n this.#dropzoneEl.removeEventListener('dragleave', this.#onDragLeave);\n this.#dropzoneEl.removeEventListener('drop', this.#onDrop);\n this.#dropzoneEl.removeEventListener('click', this.#onClick);\n this.#dropzoneEl.removeEventListener('keyup', this.#onKeyUp);\n }\n\n get accept() {\n return this.getAttribute('accept');\n }\n\n set accept(value) {\n this.setAttribute('accept', value);\n }\n\n get disabled() {\n return this.hasAttribute('disabled');\n }\n\n set disabled(value) {\n if (value) {\n this.setAttribute('disabled', '');\n } else {\n this.removeAttribute('disabled');\n }\n }\n\n get maxFiles() {\n const num = Number(this.getAttribute('max-files')) || 0;\n\n if (num <= 0) {\n return Infinity;\n }\n\n return Math.floor(Math.abs(num));\n }\n\n set maxFiles(value) {\n this.setAttribute('max-files', value);\n }\n\n get maxSize() {\n const value = this.getAttribute('max-size');\n\n if (value === null) {\n return Infinity;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? Infinity : num;\n }\n\n set maxSize(value) {\n this.setAttribute('max-size', value);\n }\n\n get minSize() {\n const value = this.getAttribute('min-size');\n\n if (value === null) {\n return 0;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? 0 : num;\n }\n\n set minSize(value) {\n this.setAttribute('min-size', value);\n }\n\n get multiple() {\n return this.hasAttribute('multiple');\n }\n\n set multiple(value) {\n if (value) {\n this.setAttribute('multiple', '');\n } else {\n this.removeAttribute('multiple');\n }\n }\n\n get noClick() {\n return this.hasAttribute('no-click');\n }\n\n set noClick(value) {\n if (value) {\n this.setAttribute('no-click', '');\n } else {\n this.removeAttribute('no-click');\n }\n }\n\n get noDrag() {\n return this.hasAttribute('no-drag');\n }\n\n set noDrag(value) {\n if (value) {\n this.setAttribute('no-drag', '');\n } else {\n this.removeAttribute('no-drag');\n }\n }\n\n get noKeyboard() {\n return this.hasAttribute('no-keyboard');\n }\n\n set noKeyboard(value) {\n if (value) {\n this.setAttribute('no-keyboard', '');\n } else {\n this.removeAttribute('no-keyboard');\n }\n }\n\n get noStyle() {\n return this.hasAttribute('no-style');\n }\n\n set noStyle(value) {\n if (value) {\n this.setAttribute('no-style', '');\n } else {\n this.removeAttribute('no-style');\n }\n }\n\n #onFileInputChange = async evt => {\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n #onDragEnter = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragenter`, {\n bubbles: true,\n composed: true\n }));\n };\n\n #onDragOver = evt => {\n evt.preventDefault();\n\n if (this.disabled || this.noDrag) {\n evt.dataTransfer.dropEffect = 'none';\n return;\n }\n\n evt.dataTransfer.dropEffect = 'copy';\n\n this.#dropzoneEl.classList.add('dropzone--dragover');\n this.#dropzoneEl.part.add('dropzone--dragover');\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragover`, {\n bubbles: true,\n composed: true\n }));\n };\n\n #onDragLeave = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragleave`, {\n bubbles: true,\n composed: true\n }));\n };\n\n #onDrop = async evt => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n evt.preventDefault();\n\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n #onClick = () => {\n if (this.disabled || this.noClick) {\n return;\n }\n\n this.#fileInput.click();\n };\n\n #onKeyUp = evt => {\n if (this.disabled || this.noKeyboard) {\n return;\n }\n\n if (evt.key === ' ' || evt.key === 'Enter') {\n this.#fileInput.click();\n }\n };\n\n #handleFilesSelect(files) {\n if (!Array.isArray(files) || !files.length) {\n return;\n }\n\n const acceptedFiles = [];\n const rejectedFiles = [];\n const filesLength = files.length;\n\n // If the component is not in multiple mode, reject all files.\n if (!this.multiple && filesLength > 1) {\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only 1 file is allowed.`\n }]\n });\n }\n } else if (this.multiple && filesLength > this.maxFiles) {\n // If the component is in multiple mode, but the number of files exceeds\n // the maxFiles attribute, reject all files.\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only ${this.maxFiles} ${this.maxFiles > 1 ? 'files are' : 'file is'} allowed.`\n }]\n });\n }\n } else {\n // Validate each file. If it's valid, add it to the accepted files array,\n // otherwise add it to the rejected files array.\n for (const file of files) {\n const fileHasValidType = isValidFile(file, this.accept);\n const fileExceedsMaxSize = file.size > this.maxSize;\n const fileIsSmallerThanMinSize = file.size < this.minSize;\n\n if (fileHasValidType && !fileExceedsMaxSize && !fileIsSmallerThanMinSize) {\n acceptedFiles.push(file);\n } else {\n const errors = [];\n\n if (!fileHasValidType) {\n errors.push({\n code: INVALID_MIME_TYPE,\n message: `File type \"${file.type}\" is not accepted.`\n });\n }\n\n if (fileExceedsMaxSize) {\n errors.push({\n code: FILE_TOO_LARGE,\n message: `File size ${file.size} exceeds the maximum size of ${this.maxSize}.`\n });\n }\n\n if (fileIsSmallerThanMinSize) {\n errors.push({\n code: FILE_TOO_SMALL,\n message: `File size ${file.size} is smaller than the minimum size of ${this.minSize}.`\n });\n }\n\n rejectedFiles.push({ file, errors });\n }\n }\n }\n\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles,\n rejectedFiles\n }\n }));\n\n if (acceptedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-accepted`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles\n }\n }));\n }\n\n if (rejectedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-rejected`, {\n bubbles: true,\n composed: true,\n detail: {\n rejectedFiles\n }\n }));\n }\n\n this.#fileInput.value = this.#fileInput.defaultValue;\n }\n\n openFileDialog() {\n if (this.disabled) {\n return;\n }\n\n this.#fileInput.click();\n }\n\n /**\n * https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties\n * This is to safe guard against cases where, for instance, a framework may have added the element to the page and set a\n * value on one of its properties, but lazy loaded its definition. Without this guard, the upgraded element would miss that\n * property and the instance property would prevent the class property setter from ever being called.\n */\n #upgradeProperty(prop) {\n if (Object.prototype.hasOwnProperty.call(this, prop)) {\n const value = this[prop];\n delete this[prop];\n this[prop] = value;\n }\n }\n\n static defineCustomElement(elementName = COMPONENT_NAME) {\n if (typeof window !== 'undefined' && !window.customElements.get(elementName)) {\n window.customElements.define(elementName, FilesDropzone);\n }\n }\n}\n\nexport { FilesDropzone };\n"],"names":["$54e5dea46d3d830b$export$2e2bcd8739ae039","receiver","privateMap","action","has","TypeError","get","$4a9af28d8c332738$export$2e2bcd8739ae039","descriptor","call","value","$0ebd1ade8fb3d51f$export$2e2bcd8739ae039","$ce94785d052866a0$export$2e2bcd8739ae039","obj","privateCollection","$96b9e3133fa8e43f$export$2e2bcd8739ae039","set","$a5f62c39645bb2ba$export$2e2bcd8739ae039","writable","$6108fbe778b62371$export$2e2bcd8739ae039","$1b12450ac511053e$export$2e2bcd8739ae039","privateSet","fn","$39719070878026a5$export$2e2bcd8739ae039","add","$38f222170fd4d21a$export$7c47054fed488f80","file","acceptedTypeSpecifiers","acceptedMimeTypesList","Set","split","map","v","trim","filter","Boolean","fileMimeType","type","baseMimeType","replace","validType","charAt","name","toLowerCase","indexOf","length","test","$f31161edf38949e9$var$COMMON_MIME_TYPES","Map","$f31161edf38949e9$var$FILES_TO_IGNORE","$f31161edf38949e9$var$toFileWithPath","path","fileWithMimeType","lastIndexOf","extension","pop","Object","defineProperty","configurable","enumerable","$f31161edf38949e9$var$toFileWithMimeType","webkitRelativePath","$f31161edf38949e9$var$readEntriesPromise","async","directoryReader","Promise","resolve","reject","readEntries","$f31161edf38949e9$var$readAllDirectoryEntries","entries","push","$f31161edf38949e9$var$getFileFromFileEntry","fileEntry","fullPath","$f31161edf38949e9$var$getFilesFromFileList","fileList","files","$f31161edf38949e9$export$6d52664cd15c442","evt","dataTransfer","items","dataTransferItemList","queue","item","kind","entry","getAsEntry","webkitGetAsEntry","shift","isFile","isDirectory","createReader","$f31161edf38949e9$var$getFilesFromDataTransferItemList","target","$862aa3736b0514bc$var$COMPONENT_NAME","$862aa3736b0514bc$var$TOO_MANY_FILES","$862aa3736b0514bc$var$template","document","createElement","innerHTML","$862aa3736b0514bc$var$_fileInput","WeakMap","$862aa3736b0514bc$var$_dropzoneEl","$862aa3736b0514bc$var$_onFileInputChange","$862aa3736b0514bc$var$_onDragEnter","$862aa3736b0514bc$var$_onDragOver","$862aa3736b0514bc$var$_onDragLeave","$862aa3736b0514bc$var$_onDrop","$862aa3736b0514bc$var$_onClick","$862aa3736b0514bc$var$_onKeyUp","$862aa3736b0514bc$var$_handleFilesSelect","WeakSet","$862aa3736b0514bc$var$_upgradeProperty","$862aa3736b0514bc$export$6ccd1735166caad9","HTMLElement","observedAttributes","attributeChangedCallback","oldValue","newValue","this","accept","disabled","removeAttribute","setAttribute","multiple","noKeyboard","connectedCallback","$862aa3736b0514bc$var$upgradeProperty","addEventListener","disconnectedCallback","removeEventListener","getAttribute","hasAttribute","maxFiles","num","Number","Infinity","Math","floor","abs","maxSize","isNaN","minSize","noClick","noDrag","noStyle","openFileDialog","click","static","elementName","window","customElements","define","constructor","super","$862aa3736b0514bc$var$handleFilesSelect","error","dispatchEvent","CustomEvent","bubbles","composed","detail","Event","preventDefault","dropEffect","classList","part","remove","key","shadowRoot","attachShadow","mode","appendChild","content","cloneNode","getElementById","Array","isArray","acceptedFiles","rejectedFiles","filesLength","errors","code","message","fileHasValidType","fileExceedsMaxSize","size","fileIsSmallerThanMinSize","defaultValue","prop","prototype","hasOwnProperty"],"version":3,"file":"files-dropzone.js.map"}
|
|
1
|
+
{"mappings":"AAAe,SAAAA,EAAsCC,EAAUC,EAAYC,GACzE,IAAKD,EAAWE,IAAIH,GAClB,MAAM,IAAII,UAAU,gBAAkBF,EAAS,kCAEjD,OAAOD,EAAWI,IAAIL,EACxB,CCLe,SAAAM,EAAkCN,EAAUO,GACzD,OAAIA,EAAWF,IACNE,EAAWF,IAAIG,KAAKR,GAEtBO,EAAWE,KACpB,CCFe,SAAAC,EAA+BV,EAAUC,GAEtD,OAAOK,EAAwBN,EADdD,EAA4BC,EAAUC,EAAY,OAErE,CCNe,SAAAU,EAAoCC,EAAKC,GACtD,GAAIA,EAAkBV,IAAIS,GACxB,MAAM,IAAIR,UAAU,iEAExB,CCFe,SAAAU,EAAgCF,EAAKX,EAAYQ,GAC9DE,EAA2BC,EAAKX,GAChCA,EAAWc,IAAIH,EAAKH,EACtB,CCLe,SAAAO,EAAkChB,EAAUO,EAAYE,GACrE,GAAIF,EAAWQ,IACbR,EAAWQ,IAAIP,KAAKR,EAAUS,OACzB,CACL,IAAKF,EAAWU,SAId,MAAM,IAAIb,UAAU,4CAEtBG,EAAWE,MAAQA,CACrB,CACF,CCTe,SAAAS,EAA+BlB,EAAUC,EAAYQ,GAGlE,OADAO,EAAwBhB,EADPD,EAA4BC,EAAUC,EAAY,OACrBQ,GACvCA,CACT,CCPe,SAAAU,EAAgCnB,EAAUoB,EAAYC,GACnE,IAAKD,EA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AEzC,CACL,MAAMN,EAAS,GAEVG,GACHH,EAAOjH,KAAK,CACVkH,KAlbY,oBAmbZC,QAAS,cAAchK,EAAKW,2BAI5BuJ,GACFJ,EAAOjH,KAAK,CACVkH,KA3bS,iBA4bTC,QAAS,aAAahK,EAAKmK,oCAAoCrE,KAAKuB,aAIpE+C,GACFN,EAAOjH,KAAK,CACVkH,KAjcS,iBAkcTC,QAAS,aAAahK,EAAKmK,4CAA4CrE,KAAKyB,aAIhFqC,EAAc/G,KAAK,C,KAAE7C,E,OAAM8J,GAC7B,MA1BEH,EAAc9G,KAAK7C,EA2BvB,CAGF8F,KAAKwC,cAAc,IAAIC,YAAY,GAAGlE,SAAuB,CAC3DmE,SAAS,EACTC,UAAU,EACVC,OAAQ,C,cACNiB,E,cACAC,MAIAD,EAAcxI,OAAS,GACzB2E,KAAKwC,cAAc,IAAIC,YAAY,GAAGlE,kBAAgC,CACpEmE,SAAS,EACTC,UAAU,EACVC,OAAQ,C,cACNiB,MAKFC,EAAczI,OAAS,GACzB2E,KAAKwC,cAAc,IAAIC,YAAY,GAAGlE,kBAAgC,CACpEmE,SAAS,EACTC,UAAU,EACVC,OAAQ,C,cACNkB,MAKN3K,EAAA6G,KAAMnB,GAAU3F,MAAQC,EAAA6G,KAAMnB,GAAU0F,YAC1C,CAgBA,SAAA/D,EAAiBgE,GACf,GAAIxI,OAAOyI,UAAUC,eAAezL,KAAK+G,KAAMwE,GAAO,CACpD,MAAMtL,EAAQ8G,KAAKwE,UACZxE,KAAKwE,GACZxE,KAAKwE,GAAQtL,CACf,CACF,Q","sources":["node_modules/@swc/helpers/src/_class_extract_field_descriptor.mjs","node_modules/@swc/helpers/src/_class_apply_descriptor_get.mjs","node_modules/@swc/helpers/src/_class_private_field_get.mjs","node_modules/@swc/helpers/src/_check_private_redeclaration.mjs","node_modules/@swc/helpers/src/_class_private_field_init.mjs","node_modules/@swc/helpers/src/_class_apply_descriptor_set.mjs","node_modules/@swc/helpers/src/_class_private_field_set.mjs","node_modules/@swc/helpers/src/_class_private_method_get.mjs","node_modules/@swc/helpers/src/_class_private_method_init.mjs","src/utils/is-valid-file.js","src/utils/files-selector.js","src/files-dropzone.js"],"sourcesContent":["export default function _classExtractFieldDescriptor(receiver, privateMap, action) {\n if (!privateMap.has(receiver)) {\n throw new TypeError(\"attempted to \" + action + \" private field on non-instance\");\n }\n return privateMap.get(receiver);\n}\n","export default function _classApplyDescriptorGet(receiver, descriptor) {\n if (descriptor.get) {\n return descriptor.get.call(receiver);\n }\n return descriptor.value;\n}\n","import classExtractFieldDescriptor from './_class_extract_field_descriptor.mjs';\nimport classApplyDescriptorGet from './_class_apply_descriptor_get.mjs';\n\nexport default function _classPrivateFieldGet(receiver, privateMap) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"get\");\n return classApplyDescriptorGet(receiver, descriptor);\n}\n","export default function _checkPrivateRedeclaration(obj, privateCollection) {\n if (privateCollection.has(obj)) {\n throw new TypeError(\"Cannot initialize the same private elements twice on an object\");\n }\n}\n","import _checkPrivateRedeclaration from \"./_check_private_redeclaration.mjs\";\n\nexport default function _classPrivateFieldInit(obj, privateMap, value) {\n _checkPrivateRedeclaration(obj, privateMap);\n privateMap.set(obj, value);\n}\n","export default function _classApplyDescriptorSet(receiver, descriptor, value) {\n if (descriptor.set) {\n descriptor.set.call(receiver, value);\n } else {\n if (!descriptor.writable) {\n // This should only throw in strict mode, but class bodies are\n // always strict and private fields can only be used inside\n // class bodies.\n throw new TypeError(\"attempted to set read only private field\");\n }\n descriptor.value = value;\n }\n}\n","import classExtractFieldDescriptor from './_class_extract_field_descriptor.mjs';\nimport classApplyDescriptorSet from './_class_apply_descriptor_set.mjs';\n\nexport default function _classPrivateFieldSet(receiver, privateMap, value) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"set\");\n classApplyDescriptorSet(receiver, descriptor, value);\n return value;\n}\n","export default function _classPrivateMethodGet(receiver, privateSet, fn) {\n if (!privateSet.has(receiver)) {\n throw new TypeError(\"attempted to get private field on non-instance\");\n }\n\n return fn;\n}\n","import _checkPrivateRedeclaration from \"./_check_private_redeclaration.mjs\";\n\nexport default function _classPrivateMethodInit(obj, privateSet) {\n _checkPrivateRedeclaration(obj, privateSet);\n privateSet.add(obj);\n}\n","/**\n * Checks if a file is valid based on the accepted file type specifiers.\n *\n * @param {File} file The File object to validate.\n * @param {String} [acceptedTypeSpecifiers=''] The accepted file type specifiers.\n * @returns {Boolean} True if the file is valid, false otherwise.\n */\nexport function isValidFile(file, acceptedTypeSpecifiers = '') {\n if (!acceptedTypeSpecifiers) {\n return true;\n }\n\n const acceptedMimeTypesList = [\n ...new Set(acceptedTypeSpecifiers.split(',').map(v => v.trim()).filter(Boolean))\n ];\n\n const fileMimeType = file.type;\n const baseMimeType = fileMimeType.replace(/\\/.*$/, '');\n\n for (const validType of acceptedMimeTypesList) {\n if (validType.charAt(0) === '.') {\n if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) {\n return true;\n }\n } else if (/\\/\\*$/.test(validType)) {\n // Check for mime type that looks like \"image/*\" or similar.\n if (baseMimeType === validType.replace(/\\/.*$/, '')) {\n return true;\n }\n } else {\n if (fileMimeType === validType) {\n return true;\n }\n }\n }\n\n return false;\n}\n","const COMMON_MIME_TYPES = new Map([\n // https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\n ['aac', 'audio/aac'],\n ['abw', 'application/x-abiword'],\n ['arc', 'application/x-freearc'],\n ['avif', 'image/avif'],\n ['avi', 'video/x-msvideo'],\n ['azw', 'application/vnd.amazon.ebook'],\n ['bin', 'application/octet-stream'],\n ['bmp', 'image/bmp'],\n ['bz', 'application/x-bzip'],\n ['bz2', 'application/x-bzip2'],\n ['cda', 'application/x-cdf'],\n ['csh', 'application/x-csh'],\n ['css', 'text/css'],\n ['csv', 'text/csv'],\n ['doc', 'application/msword'],\n ['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],\n ['eot', 'application/vnd.ms-fontobject'],\n ['epub', 'application/epub+zip'],\n ['gz', 'application/gzip'],\n ['gif', 'image/gif'],\n ['heic', 'image/heic'],\n ['heif', 'image/heif'],\n ['htm', 'text/html'],\n ['html', 'text/html'],\n ['ico', 'image/vnd.microsoft.icon'],\n ['ics', 'text/calendar'],\n ['jar', 'application/java-archive'],\n ['jpeg', 'image/jpeg'],\n ['jpg', 'image/jpeg'],\n ['js', 'text/javascript'],\n ['json', 'application/json'],\n ['jsonld', 'application/ld+json'],\n ['mid', 'audio/midi'],\n ['midi', 'audio/midi'],\n ['mjs', 'text/javascript'],\n ['mp3', 'audio/mpeg'],\n ['mp4', 'video/mp4'],\n ['mpeg', 'video/mpeg'],\n ['mpkg', 'application/vnd.apple.installer+xml'],\n ['odp', 'application/vnd.oasis.opendocument.presentation'],\n ['ods', 'application/vnd.oasis.opendocument.spreadsheet'],\n ['odt', 'application/vnd.oasis.opendocument.text'],\n ['oga', 'audio/ogg'],\n ['ogv', 'video/ogg'],\n ['ogx', 'application/ogg'],\n ['opus', 'audio/opus'],\n ['otf', 'font/otf'],\n ['png', 'image/png'],\n ['pdf', 'application/pdf'],\n ['php', 'application/x-httpd-php'],\n ['ppt', 'application/vnd.ms-powerpoint'],\n ['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],\n ['rar', 'application/vnd.rar'],\n ['rtf', 'application/rtf'],\n ['sh', 'application/x-sh'],\n ['svg', 'image/svg+xml'],\n ['swf', 'application/x-shockwave-flash'],\n ['tar', 'application/x-tar'],\n ['tif', 'image/tiff'],\n ['tiff', 'image/tiff'],\n ['ts', 'video/mp2t'],\n ['ttf', 'font/ttf'],\n ['txt', 'text/plain'],\n ['vsd', 'application/vnd.visio'],\n ['wav', 'audio/wav'],\n ['weba', 'audio/webm'],\n ['webm', 'video/webm'],\n ['webp', 'image/webp'],\n ['woff', 'font/woff'],\n ['woff2', 'font/woff2'],\n ['xhtml', 'application/xhtml+xml'],\n ['xls', 'application/vnd.ms-excel'],\n ['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],\n ['xml', 'application/xml'],\n ['xul', 'application/vnd.mozilla.xul+xml'],\n ['zip', 'application/zip'],\n ['7z', 'application/x-7z-compressed'],\n\n // Others\n ['mkv', 'video/x-matroska'],\n ['mov', 'video/quicktime'],\n ['msg', 'application/vnd.ms-outlook']\n]);\n\nconst FILES_TO_IGNORE = [\n // Thumbnail cache files for macOS and Windows\n '.DS_Store', // macOs\n 'Thumbs.db' // Windows\n];\n\n/**\n * Adds a `type` property to the file object if it doesn't have one and the file has an extension.\n * This is needed because Firefox doesn't add a type property to files dragged from the desktop.\n * @bug https://bugzilla.mozilla.org/show_bug.cgi?id=1424689\n *\n * @param {File} file The file object to add the type property to.\n * @returns {File} The file object with the type property added.\n */\nconst toFileWithMimeType = file => {\n const { name } = file;\n const hasExtension = name && name.lastIndexOf('.') !== -1;\n\n if (hasExtension && !file.type) {\n const extension = name.split('.').pop().toLowerCase();\n const type = COMMON_MIME_TYPES.get(extension);\n\n if (type) {\n Object.defineProperty(file, 'type', {\n value: type,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n }\n\n return file;\n};\n\n/**\n * Adds a `path` property to the file object if it doesn't have one.\n * If `path` is not provided, the `webkitRelativePath` property of the file will be used\n * or the file's name if `webkitRelativePath` is not available.\n *\n * @param {File} file The file object to add the path property to.\n * @param {String} [path] The path to set on the file object.\n * @returns {File} The file object with the path property added.\n */\nconst toFileWithPath = (file, path) => {\n const fileWithMimeType = toFileWithMimeType(file);\n\n if (typeof fileWithMimeType.path !== 'string') {\n const { webkitRelativePath } = file;\n\n Object.defineProperty(fileWithMimeType, 'path', {\n value: typeof path === 'string' ? path : webkitRelativePath || file.name,\n writable: false,\n configurable: false,\n enumerable: true\n });\n }\n\n return fileWithMimeType;\n};\n\n/**\n * Wrap `FileSystemDirectoryReader.readEntries` in a promise to make working with read entries easier.\n * https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader/readEntries\n *\n * @param {FileSystemDirectoryReader} directoryReader The directory reader to read entries from.\n * @returns {Promise<FileSystemFileEntry[]>} A promise that resolves with an array of `FileSystemFileEntry` objects.\n */\nconst readEntriesPromise = async directoryReader => {\n return await new Promise((resolve, reject) => {\n directoryReader.readEntries(resolve, reject);\n });\n};\n\n/**\n * Read all entries in a directory or sub-directory\n * by calling `readEntries` until it returns an empty array.\n *\n * @param {FileSystemDirectoryReader} directoryReader The directory reader to read entries from.\n * @returns {Promise<FileSystemFileEntry[]>} A promise that resolves with an array of `FileSystemFileEntry` objects.\n */\nconst readAllDirectoryEntries = async directoryReader => {\n const entries = [];\n let readEntries = await readEntriesPromise(directoryReader);\n\n while (readEntries.length > 0) {\n entries.push(...readEntries);\n readEntries = await readEntriesPromise(directoryReader);\n }\n\n return entries;\n};\n\n/**\n * Get a `File` object from a `FileSystemFileEntry` object.\n *\n * @param {FileSystemFileEntry} fileEntry The file entry to get a `File` object from.\n * @returns {Promise<File>} A promise that resolves with a `File` object.\n */\nconst getFileFromFileEntry = fileEntry => {\n return new Promise((resolve, reject) => {\n fileEntry.file(file => resolve(toFileWithPath(file, fileEntry.fullPath)), reject);\n });\n};\n\n/**\n * Get an array of `File` objects from a `DataTransferItemList` object.\n *\n * @param {DataTransferItemList} dataTransferItemList The item list to get an array of `File` objects from.\n * @returns {Promise<File[]>} A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromDataTransferItemList = async dataTransferItemList => {\n const files = [];\n\n // Chromium browsers read only 100 files at a time as per the spec, so we need to use\n // BFS (Breadth-first search) to traverse the entire directory/file structure.\n // https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry#javascript_content\n const queue = [];\n\n for (const item of dataTransferItemList) {\n if (item.kind !== 'file') {\n // Ignore non-file items, such as links.\n continue;\n }\n\n // https://developer.mozilla.org/docs/Web/API/DataTransferItem/webkitGetAsEntry\n // This function is implemented as `webkitGetAsEntry()` in non-WebKit browsers\n // including Firefox at this time but it may be renamed to `getAsEntry()` in the future.\n const entry = item.getAsEntry ? item.getAsEntry() : item.webkitGetAsEntry();\n\n queue.push(entry);\n }\n\n while (queue.length > 0) {\n const entry = queue.shift();\n\n if (!entry) {\n continue;\n } else if (entry.isFile) {\n const file = await getFileFromFileEntry(entry);\n\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(file);\n }\n } else if (entry.isDirectory) {\n queue.push(...await readAllDirectoryEntries(entry.createReader()));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from a `FileList` object.\n *\n * @param {FileList} fileList The file list to get an array of `File` objects from.\n * @returns {Promise<File[]>} A promise that resolves with an array of `File` objects.\n */\nconst getFilesFromFileList = async fileList => {\n const files = [];\n\n for (const file of fileList) {\n if (FILES_TO_IGNORE.indexOf(file.name) === -1) {\n files.push(toFileWithPath(file));\n }\n }\n\n return files;\n};\n\n/**\n * Get an array of `File` objects from an event.\n * This function supports both `drop` and `change` events.\n *\n * @param {DragEvent | Event} evt The event to get an array of `File` objects from.\n * @returns {Promise<File[]>} A promise that resolves with an array of `File` objects.\n */\nexport const getFilesFromEvent = async evt => {\n if (evt.dataTransfer) {\n return evt.dataTransfer.items\n ? await getFilesFromDataTransferItemList(evt.dataTransfer.items)\n : await getFilesFromFileList(evt.dataTransfer.files);\n }\n\n return await getFilesFromFileList(evt.target.files);\n};\n","import { isValidFile } from './utils/is-valid-file.js';\nimport { getFilesFromEvent } from './utils/files-selector.js';\n\nconst COMPONENT_NAME = 'files-dropzone';\nconst TOO_MANY_FILES = 'TOO_MANY_FILES';\nconst FILE_TOO_LARGE = 'FILE_TOO_LARGE';\nconst FILE_TOO_SMALL = 'FILE_TOO_SMALL';\nconst INVALID_MIME_TYPE = 'INVALID_MIME_TYPE';\nconst template = document.createElement('template');\n\ntemplate.innerHTML = /* html */`\n <style>\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n :host([hidden]),\n [hidden] {\n display: none !important;\n }\n\n :host {\n --dropzone-border-width: 2px;\n --dropzone-border-style: dashed;\n --dropzone-border-radius: 0.25rem;\n --dropzone-border-color: #6c757d;\n --dropzone-border-color-dragover: #0d6efd;\n --dropzone-background-color: #ffffff;\n --dropzone-background-color-dragover: #f4f4f5;\n --dropzone-body-color: #3f3f46;\n --dropzone-body-color-dragover: var(--dropzone-body-color);\n --dropzone-focus-shadow-rgb: 49,132,253;\n --transition-duration: 0.2s;\n\n display: block;\n }\n\n :host(:not([no-style])) .dropzone {\n border: var(--dropzone-border-width) var(--dropzone-border-style) var(--dropzone-border-color);\n border-radius: var(--dropzone-border-radius);\n padding: 3rem 1rem;\n overflow: hidden;\n background-color: var(--dropzone-background-color);\n color: var(--dropzone-body-color);\n text-align: center;\n cursor: pointer;\n transition: border var(--transition-duration) ease-in-out, background-color var(--transition-duration) ease-in-out, color var(--transition-duration) ease-in-out, box-shadow var(--transition-duration) ease-in-out;\n }\n\n :host(:not([no-style])[no-click]) .dropzone {\n cursor: default;\n }\n\n :host(:not([no-style])[disabled]) .dropzone {\n opacity: 0.8;\n cursor: not-allowed;\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone--dragover {\n border-color: var(--dropzone-border-color-dragover);\n background-color: var(--dropzone-background-color-dragover);\n color: var(--dropzone-body-color-dragover);\n }\n\n :host(:not([no-style]):not([disabled])) .dropzone:focus-visible {\n outline: none;\n box-shadow: 0 0 0 0.25rem rgba(var(--dropzone-focus-shadow-rgb), 0.5);\n }\n </style>\n\n <input type=\"file\" id=\"fileInput\" hidden>\n\n <div part=\"dropzone\" class=\"dropzone\" id=\"dropzoneEl\" tabindex=\"0\" role=\"presentation\">\n <slot>Drag 'n' drop files here, or click to select files</slot>\n </div>\n`;\n\nclass FilesDropzone extends HTMLElement {\n #fileInput;\n #dropzoneEl;\n\n constructor() {\n super();\n\n if (!this.shadowRoot) {\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(template.content.cloneNode(true));\n }\n\n this.#fileInput = this.shadowRoot.getElementById('fileInput');\n this.#dropzoneEl = this.shadowRoot.getElementById('dropzoneEl');\n }\n\n static get observedAttributes() {\n return ['accept', 'disabled', 'multiple', 'no-keyboard'];\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n if (name === 'accept' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.accept = this.accept;\n }\n\n if (name === 'disabled' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.disabled = this.disabled;\n\n if (this.disabled) {\n this.#dropzoneEl.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl.setAttribute('tabindex', '0');\n }\n }\n\n if (name === 'multiple' && oldValue !== newValue && this.#fileInput) {\n this.#fileInput.multiple = this.multiple;\n }\n\n if (name === 'no-keyboard' && oldValue !== newValue && this.#dropzoneEl) {\n if (this.noKeyboard) {\n this.#dropzoneEl.removeAttribute('tabindex');\n } else {\n this.#dropzoneEl.setAttribute('tabindex', '0');\n }\n }\n }\n\n connectedCallback() {\n this.#upgradeProperty('accept');\n this.#upgradeProperty('disabled');\n this.#upgradeProperty('maxFiles');\n this.#upgradeProperty('maxSize');\n this.#upgradeProperty('minSize');\n this.#upgradeProperty('multiple');\n this.#upgradeProperty('noClick');\n this.#upgradeProperty('noDrag');\n this.#upgradeProperty('noKeyboard');\n this.#upgradeProperty('autoFocus');\n this.#upgradeProperty('noStyle');\n\n this.#fileInput.addEventListener('change', this.#onFileInputChange);\n this.#dropzoneEl.addEventListener('dragenter', this.#onDragEnter);\n this.#dropzoneEl.addEventListener('dragover', this.#onDragOver);\n this.#dropzoneEl.addEventListener('dragleave', this.#onDragLeave);\n this.#dropzoneEl.addEventListener('drop', this.#onDrop);\n this.#dropzoneEl.addEventListener('click', this.#onClick);\n this.#dropzoneEl.addEventListener('keyup', this.#onKeyUp);\n\n this.autoFocus && this.#dropzoneEl.focus();\n }\n\n disconnectedCallback() {\n this.#fileInput.removeEventListener('change', this.#onFileInputChange);\n this.#dropzoneEl.removeEventListener('dragenter', this.#onDragEnter);\n this.#dropzoneEl.removeEventListener('dragover', this.#onDragOver);\n this.#dropzoneEl.removeEventListener('dragleave', this.#onDragLeave);\n this.#dropzoneEl.removeEventListener('drop', this.#onDrop);\n this.#dropzoneEl.removeEventListener('click', this.#onClick);\n this.#dropzoneEl.removeEventListener('keyup', this.#onKeyUp);\n }\n\n get accept() {\n return this.getAttribute('accept');\n }\n\n set accept(value) {\n this.setAttribute('accept', value);\n }\n\n get disabled() {\n return this.hasAttribute('disabled');\n }\n\n set disabled(value) {\n if (value) {\n this.setAttribute('disabled', '');\n } else {\n this.removeAttribute('disabled');\n }\n }\n\n get maxFiles() {\n const num = Number(this.getAttribute('max-files')) || 0;\n\n if (num <= 0) {\n return Infinity;\n }\n\n return Math.floor(Math.abs(num));\n }\n\n set maxFiles(value) {\n this.setAttribute('max-files', value);\n }\n\n get maxSize() {\n const value = this.getAttribute('max-size');\n\n if (value === null) {\n return Infinity;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? Infinity : num;\n }\n\n set maxSize(value) {\n this.setAttribute('max-size', value);\n }\n\n get minSize() {\n const value = this.getAttribute('min-size');\n\n if (value === null) {\n return 0;\n }\n\n const num = Number(value);\n\n return Number.isNaN(num) ? 0 : num;\n }\n\n set minSize(value) {\n this.setAttribute('min-size', value);\n }\n\n get multiple() {\n return this.hasAttribute('multiple');\n }\n\n set multiple(value) {\n if (value) {\n this.setAttribute('multiple', '');\n } else {\n this.removeAttribute('multiple');\n }\n }\n\n get noClick() {\n return this.hasAttribute('no-click');\n }\n\n set noClick(value) {\n if (value) {\n this.setAttribute('no-click', '');\n } else {\n this.removeAttribute('no-click');\n }\n }\n\n get noDrag() {\n return this.hasAttribute('no-drag');\n }\n\n set noDrag(value) {\n if (value) {\n this.setAttribute('no-drag', '');\n } else {\n this.removeAttribute('no-drag');\n }\n }\n\n get noKeyboard() {\n return this.hasAttribute('no-keyboard');\n }\n\n set noKeyboard(value) {\n if (value) {\n this.setAttribute('no-keyboard', '');\n } else {\n this.removeAttribute('no-keyboard');\n }\n }\n\n get autoFocus() {\n return this.hasAttribute('auto-focus');\n }\n\n set autoFocus(value) {\n if (value) {\n this.setAttribute('auto-focus', '');\n } else {\n this.removeAttribute('auto-focus');\n }\n }\n\n get noStyle() {\n return this.hasAttribute('no-style');\n }\n\n set noStyle(value) {\n if (value) {\n this.setAttribute('no-style', '');\n } else {\n this.removeAttribute('no-style');\n }\n }\n\n #onFileInputChange = async evt => {\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n #onDragEnter = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragenter`, {\n bubbles: true,\n composed: true\n }));\n };\n\n #onDragOver = evt => {\n evt.preventDefault();\n\n if (this.disabled || this.noDrag) {\n evt.dataTransfer.dropEffect = 'none';\n return;\n }\n\n evt.dataTransfer.dropEffect = 'copy';\n\n this.#dropzoneEl.classList.add('dropzone--dragover');\n this.#dropzoneEl.part.add('dropzone--dragover');\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragover`, {\n bubbles: true,\n composed: true\n }));\n };\n\n #onDragLeave = () => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n\n this.dispatchEvent(new Event(`${COMPONENT_NAME}-dragleave`, {\n bubbles: true,\n composed: true\n }));\n };\n\n #onDrop = async evt => {\n if (this.disabled || this.noDrag) {\n return;\n }\n\n evt.preventDefault();\n\n this.#dropzoneEl.classList.remove('dropzone--dragover');\n this.#dropzoneEl.part.remove('dropzone--dragover');\n\n try {\n this.#handleFilesSelect(await getFilesFromEvent(evt));\n } catch (error) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-error`, {\n bubbles: true,\n composed: true,\n detail: { error }\n }));\n }\n };\n\n #onClick = () => {\n if (this.disabled || this.noClick) {\n return;\n }\n\n this.#fileInput.click();\n };\n\n #onKeyUp = evt => {\n if (this.disabled || this.noKeyboard) {\n return;\n }\n\n if (evt.key === ' ' || evt.key === 'Enter') {\n this.#fileInput.click();\n }\n };\n\n #handleFilesSelect(files) {\n if (!Array.isArray(files) || !files.length) {\n return;\n }\n\n const acceptedFiles = [];\n const rejectedFiles = [];\n const filesLength = files.length;\n\n // If the component is not in multiple mode, reject all files.\n if (!this.multiple && filesLength > 1) {\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only 1 file is allowed.`\n }]\n });\n }\n } else if (this.multiple && filesLength > this.maxFiles) {\n // If the component is in multiple mode, but the number of files exceeds\n // the maxFiles attribute, reject all files.\n for (const file of files) {\n rejectedFiles.push({\n file,\n errors: [{\n code: TOO_MANY_FILES,\n message: `Too many files selected. Only ${this.maxFiles} ${this.maxFiles > 1 ? 'files are' : 'file is'} allowed.`\n }]\n });\n }\n } else {\n // Validate each file. If it's valid, add it to the accepted files array,\n // otherwise add it to the rejected files array.\n for (const file of files) {\n const fileHasValidType = isValidFile(file, this.accept);\n const fileExceedsMaxSize = file.size > this.maxSize;\n const fileIsSmallerThanMinSize = file.size < this.minSize;\n\n if (fileHasValidType && !fileExceedsMaxSize && !fileIsSmallerThanMinSize) {\n acceptedFiles.push(file);\n } else {\n const errors = [];\n\n if (!fileHasValidType) {\n errors.push({\n code: INVALID_MIME_TYPE,\n message: `File type \"${file.type}\" is not accepted.`\n });\n }\n\n if (fileExceedsMaxSize) {\n errors.push({\n code: FILE_TOO_LARGE,\n message: `File size ${file.size} exceeds the maximum size of ${this.maxSize}.`\n });\n }\n\n if (fileIsSmallerThanMinSize) {\n errors.push({\n code: FILE_TOO_SMALL,\n message: `File size ${file.size} is smaller than the minimum size of ${this.minSize}.`\n });\n }\n\n rejectedFiles.push({ file, errors });\n }\n }\n }\n\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles,\n rejectedFiles\n }\n }));\n\n if (acceptedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-accepted`, {\n bubbles: true,\n composed: true,\n detail: {\n acceptedFiles\n }\n }));\n }\n\n if (rejectedFiles.length > 0) {\n this.dispatchEvent(new CustomEvent(`${COMPONENT_NAME}-drop-rejected`, {\n bubbles: true,\n composed: true,\n detail: {\n rejectedFiles\n }\n }));\n }\n\n this.#fileInput.value = this.#fileInput.defaultValue;\n }\n\n openFileDialog() {\n if (this.disabled) {\n return;\n }\n\n this.#fileInput.click();\n }\n\n /**\n * https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties\n * This is to safe guard against cases where, for instance, a framework may have added the element to the page and set a\n * value on one of its properties, but lazy loaded its definition. Without this guard, the upgraded element would miss that\n * property and the instance property would prevent the class property setter from ever being called.\n */\n #upgradeProperty(prop) {\n if (Object.prototype.hasOwnProperty.call(this, prop)) {\n const value = this[prop];\n delete this[prop];\n this[prop] = value;\n }\n }\n\n static defineCustomElement(elementName = COMPONENT_NAME) {\n if (typeof window !== 'undefined' && !window.customElements.get(elementName)) {\n window.customElements.define(elementName, FilesDropzone);\n }\n }\n}\n\nexport { FilesDropzone };\n"],"names":["$54e5dea46d3d830b$export$2e2bcd8739ae039","receiver","privateMap","action","has","TypeError","get","$4a9af28d8c332738$export$2e2bcd8739ae039","descriptor","call","value","$0ebd1ade8fb3d51f$export$2e2bcd8739ae039","$ce94785d052866a0$export$2e2bcd8739ae039","obj","privateCollection","$96b9e3133fa8e43f$export$2e2bcd8739ae039","set","$a5f62c39645bb2ba$export$2e2bcd8739ae039","writable","$6108fbe778b62371$export$2e2bcd8739ae039","$1b12450ac511053e$export$2e2bcd8739ae039","privateSet","fn","$39719070878026a5$export$2e2bcd8739ae039","add","$38f222170fd4d21a$export$7c47054fed488f80","file","acceptedTypeSpecifiers","acceptedMimeTypesList","Set","split","map","v","trim","filter","Boolean","fileMimeType","type","baseMimeType","replace","validType","charAt","name","toLowerCase","indexOf","length","test","$f31161edf38949e9$var$COMMON_MIME_TYPES","Map","$f31161edf38949e9$var$FILES_TO_IGNORE","$f31161edf38949e9$var$toFileWithPath","path","fileWithMimeType","lastIndexOf","extension","pop","Object","defineProperty","configurable","enumerable","$f31161edf38949e9$var$toFileWithMimeType","webkitRelativePath","$f31161edf38949e9$var$readEntriesPromise","async","directoryReader","Promise","resolve","reject","readEntries","$f31161edf38949e9$var$readAllDirectoryEntries","entries","push","$f31161edf38949e9$var$getFileFromFileEntry","fileEntry","fullPath","$f31161edf38949e9$var$getFilesFromFileList","fileList","files","$f31161edf38949e9$export$6d52664cd15c442","evt","dataTransfer","items","dataTransferItemList","queue","item","kind","entry","getAsEntry","webkitGetAsEntry","shift","isFile","isDirectory","createReader","$f31161edf38949e9$var$getFilesFromDataTransferItemList","target","$862aa3736b0514bc$var$COMPONENT_NAME","$862aa3736b0514bc$var$TOO_MANY_FILES","$862aa3736b0514bc$var$template","document","createElement","innerHTML","$862aa3736b0514bc$var$_fileInput","WeakMap","$862aa3736b0514bc$var$_dropzoneEl","$862aa3736b0514bc$var$_onFileInputChange","$862aa3736b0514bc$var$_onDragEnter","$862aa3736b0514bc$var$_onDragOver","$862aa3736b0514bc$var$_onDragLeave","$862aa3736b0514bc$var$_onDrop","$862aa3736b0514bc$var$_onClick","$862aa3736b0514bc$var$_onKeyUp","$862aa3736b0514bc$var$_handleFilesSelect","WeakSet","$862aa3736b0514bc$var$_upgradeProperty","$862aa3736b0514bc$export$6ccd1735166caad9","HTMLElement","observedAttributes","attributeChangedCallback","oldValue","newValue","this","accept","disabled","removeAttribute","setAttribute","multiple","noKeyboard","connectedCallback","$862aa3736b0514bc$var$upgradeProperty","addEventListener","autoFocus","focus","disconnectedCallback","removeEventListener","getAttribute","hasAttribute","maxFiles","num","Number","Infinity","Math","floor","abs","maxSize","isNaN","minSize","noClick","noDrag","noStyle","openFileDialog","click","static","elementName","window","customElements","define","constructor","super","$862aa3736b0514bc$var$handleFilesSelect","error","dispatchEvent","CustomEvent","bubbles","composed","detail","Event","preventDefault","dropEffect","classList","part","remove","key","shadowRoot","attachShadow","mode","appendChild","content","cloneNode","getElementById","Array","isArray","acceptedFiles","rejectedFiles","filesLength","errors","code","message","fileHasValidType","fileExceedsMaxSize","size","fileIsSmallerThanMinSize","defaultValue","prop","prototype","hasOwnProperty"],"version":3,"file":"files-dropzone.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@georapbox/files-dropzone-element",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A custom element that creates a drag and drop zone for files",
|
|
5
5
|
"main": "dist/files-dropzone.js",
|
|
6
6
|
"module": "dist/files-dropzone.js",
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@esm-bundle/chai": "~4.3.4-fix.0",
|
|
69
69
|
"@open-wc/testing": "~3.1.7",
|
|
70
|
-
"@web/test-runner": "~0.15.
|
|
70
|
+
"@web/test-runner": "~0.15.2",
|
|
71
71
|
"@web/test-runner-playwright": "~0.9.0",
|
|
72
|
-
"eslint": "~8.
|
|
72
|
+
"eslint": "~8.37.0",
|
|
73
73
|
"eslint-plugin-wc": "~1.4.0",
|
|
74
74
|
"npm-run-all": "~4.1.5",
|
|
75
75
|
"parcel": "~2.8.3",
|
|
76
|
-
"rimraf": "~4.1
|
|
77
|
-
"sinon": "~15.0.
|
|
76
|
+
"rimraf": "~4.4.1",
|
|
77
|
+
"sinon": "~15.0.3"
|
|
78
78
|
}
|
|
79
79
|
}
|
package/src/files-dropzone.js
CHANGED
|
@@ -25,12 +25,14 @@ template.innerHTML = /* html */`
|
|
|
25
25
|
--dropzone-border-width: 2px;
|
|
26
26
|
--dropzone-border-style: dashed;
|
|
27
27
|
--dropzone-border-radius: 0.25rem;
|
|
28
|
-
--dropzone-border-color: #
|
|
29
|
-
--dropzone-border-color-dragover: #
|
|
28
|
+
--dropzone-border-color: #6c757d;
|
|
29
|
+
--dropzone-border-color-dragover: #0d6efd;
|
|
30
30
|
--dropzone-background-color: #ffffff;
|
|
31
31
|
--dropzone-background-color-dragover: #f4f4f5;
|
|
32
32
|
--dropzone-body-color: #3f3f46;
|
|
33
33
|
--dropzone-body-color-dragover: var(--dropzone-body-color);
|
|
34
|
+
--dropzone-focus-shadow-rgb: 49,132,253;
|
|
35
|
+
--transition-duration: 0.2s;
|
|
34
36
|
|
|
35
37
|
display: block;
|
|
36
38
|
}
|
|
@@ -44,7 +46,7 @@ template.innerHTML = /* html */`
|
|
|
44
46
|
color: var(--dropzone-body-color);
|
|
45
47
|
text-align: center;
|
|
46
48
|
cursor: pointer;
|
|
47
|
-
transition: border
|
|
49
|
+
transition: border var(--transition-duration) ease-in-out, background-color var(--transition-duration) ease-in-out, color var(--transition-duration) ease-in-out, box-shadow var(--transition-duration) ease-in-out;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
:host(:not([no-style])[no-click]) .dropzone {
|
|
@@ -61,6 +63,11 @@ template.innerHTML = /* html */`
|
|
|
61
63
|
background-color: var(--dropzone-background-color-dragover);
|
|
62
64
|
color: var(--dropzone-body-color-dragover);
|
|
63
65
|
}
|
|
66
|
+
|
|
67
|
+
:host(:not([no-style]):not([disabled])) .dropzone:focus-visible {
|
|
68
|
+
outline: none;
|
|
69
|
+
box-shadow: 0 0 0 0.25rem rgba(var(--dropzone-focus-shadow-rgb), 0.5);
|
|
70
|
+
}
|
|
64
71
|
</style>
|
|
65
72
|
|
|
66
73
|
<input type="file" id="fileInput" hidden>
|
|
@@ -128,6 +135,7 @@ class FilesDropzone extends HTMLElement {
|
|
|
128
135
|
this.#upgradeProperty('noClick');
|
|
129
136
|
this.#upgradeProperty('noDrag');
|
|
130
137
|
this.#upgradeProperty('noKeyboard');
|
|
138
|
+
this.#upgradeProperty('autoFocus');
|
|
131
139
|
this.#upgradeProperty('noStyle');
|
|
132
140
|
|
|
133
141
|
this.#fileInput.addEventListener('change', this.#onFileInputChange);
|
|
@@ -137,6 +145,8 @@ class FilesDropzone extends HTMLElement {
|
|
|
137
145
|
this.#dropzoneEl.addEventListener('drop', this.#onDrop);
|
|
138
146
|
this.#dropzoneEl.addEventListener('click', this.#onClick);
|
|
139
147
|
this.#dropzoneEl.addEventListener('keyup', this.#onKeyUp);
|
|
148
|
+
|
|
149
|
+
this.autoFocus && this.#dropzoneEl.focus();
|
|
140
150
|
}
|
|
141
151
|
|
|
142
152
|
disconnectedCallback() {
|
|
@@ -263,6 +273,18 @@ class FilesDropzone extends HTMLElement {
|
|
|
263
273
|
}
|
|
264
274
|
}
|
|
265
275
|
|
|
276
|
+
get autoFocus() {
|
|
277
|
+
return this.hasAttribute('auto-focus');
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
set autoFocus(value) {
|
|
281
|
+
if (value) {
|
|
282
|
+
this.setAttribute('auto-focus', '');
|
|
283
|
+
} else {
|
|
284
|
+
this.removeAttribute('auto-focus');
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
266
288
|
get noStyle() {
|
|
267
289
|
return this.hasAttribute('no-style');
|
|
268
290
|
}
|