@mux/mux-uploader-react
Advanced tools
Comparing version 1.0.2-canary.0-2577b78 to 1.0.2-canary.0-2775da4
@@ -309,3 +309,3 @@ { | ||
"inputs": {}, | ||
"bytes": 225820 | ||
"bytes": 225817 | ||
}, | ||
@@ -312,0 +312,0 @@ "dist/index.cjs.js": { |
@@ -309,3 +309,3 @@ { | ||
"inputs": {}, | ||
"bytes": 225347 | ||
"bytes": 225344 | ||
}, | ||
@@ -312,0 +312,0 @@ "dist/index.mjs": { |
@@ -287,3 +287,3 @@ "use strict";"use client";var Yt=Object.create;var ce=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var Jt=Object.getOwnPropertyNames;var Qt=Object.getPrototypeOf,er=Object.prototype.hasOwnProperty;var tr=(e,t)=>{for(var r in t)ce(e,r,{get:t[r],enumerable:!0})},je=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Jt(t))!er.call(e,s)&&s!==r&&ce(e,s,{get:()=>t[s],enumerable:!(n=Zt(t,s))||n.enumerable});return e};var B=(e,t,r)=>(r=e!=null?Yt(Qt(e)):{},je(t||!e||!e.__esModule?ce(r,"default",{value:e,enumerable:!0}):r,e)),rr=e=>je(ce({},"__esModule",{value:!0}),e);var Un={};tr(Un,{MuxUploaderDrop:()=>zt,MuxUploaderFileSelect:()=>It,MuxUploaderPause:()=>jt,MuxUploaderProgress:()=>Ft,MuxUploaderRetry:()=>Ht,MuxUploaderStatus:()=>$t,ProgressTypes:()=>wn,default:()=>Pn});module.exports=rr(Un);var j=B(require("react"));var nr=Object.create,Qe=Object.defineProperty,sr=Object.getOwnPropertyDescriptor,et=Object.getOwnPropertyNames,ir=Object.getPrototypeOf,ar=Object.prototype.hasOwnProperty,K=(e,t)=>function(){return t||(0,e[et(e)[0]])((t={exports:{}}).exports,t),t.exports},or=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of et(t))!ar.call(e,s)&&s!==r&&Qe(e,s,{get:()=>t[s],enumerable:!(n=sr(t,s))||n.enumerable});return e},lr=(e,t,r)=>(r=e!=null?nr(ir(e)):{},or(t||!e||!e.__esModule?Qe(r,"default",{value:e,enumerable:!0}):r,e)),ur=K({"node_modules/global/window.js"(e,t){var r;typeof window!="undefined"?r=window:typeof global!="undefined"?r=global:typeof self!="undefined"?r=self:r={},t.exports=r}}),dr=K({"node_modules/is-function/index.js"(e,t){t.exports=n;var r=Object.prototype.toString;function n(s){if(!s)return!1;var a=r.call(s);return a==="[object Function]"||typeof s=="function"&&a!=="[object RegExp]"||typeof window!="undefined"&&(s===window.setTimeout||s===window.alert||s===window.confirm||s===window.prompt)}}}),pr=K({"node_modules/parse-headers/parse-headers.js"(e,t){var r=function(s){return s.replace(/^\s+|\s+$/g,"")},n=function(s){return Object.prototype.toString.call(s)==="[object Array]"};t.exports=function(s){if(!s)return{};for(var a={},l=r(s).split(` | ||
<mux-uploader-sr-text></mux-uploader-sr-text> | ||
`;var vt=class extends p.HTMLElement{constructor(){var e;super(),this.attachShadow({mode:"open"}).appendChild(Pt.content.cloneNode(!0)),this.updateLayout(),(e=this.hiddenFileInput)==null||e.addEventListener("change",()=>{var t,r;let n=(r=(t=this.hiddenFileInput)==null?void 0:t.files)==null?void 0:r[0];this.toggleAttribute("file-ready",!!n),n&&this.dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:n}))})}static get observedAttributes(){return["pausable","type","no-drop","no-progress","no-status","no-retry","max-file-size","use-large-file-workaround"]}connectedCallback(){this.addEventListener("file-ready",this.handleUpload),this.addEventListener("reset",this.resetState)}disconnectedCallback(){this.removeEventListener("file-ready",this.handleUpload,!1),this.removeEventListener("reset",this.resetState)}attributeChangedCallback(){this.updateLayout()}get hiddenFileInput(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("#hidden-file-input")}get endpoint(){var e;return(e=this.getAttribute("endpoint"))!=null?e:this._endpoint}set endpoint(e){e!==this.endpoint&&(typeof e=="string"?this.setAttribute("endpoint",e):e==null&&this.removeAttribute("endpoint"),this._endpoint=e)}get type(){var e;return(e=this.getAttribute("type"))!=null?e:void 0}set type(e){e!=this.type&&(e?this.setAttribute("type",e):this.removeAttribute("type"))}get noDrop(){return this.hasAttribute("no-drop")}set noDrop(e){this.toggleAttribute("no-drop",!!e)}get noProgress(){return this.hasAttribute("no-progress")}set noProgress(e){this.toggleAttribute("no-progress",!!e)}get noStatus(){return this.hasAttribute("no-status")}set noStatus(e){this.toggleAttribute("no-status",!!e)}get noRetry(){return this.hasAttribute("no-retry")}set noRetry(e){this.toggleAttribute("no-retry",!!e)}get pausable(){return this.hasAttribute("pausable")}set pausable(e){this.toggleAttribute("pausable",!!e)}get dynamicChunkSize(){return this.hasAttribute("dynamic-chunk-size")}set dynamicChunkSize(e){e!==this.hasAttribute("dynamic-chunk-size")&&(e?this.setAttribute("dynamic-chunk-size",""):this.removeAttribute("dynamic-chunk-size"))}get useLargeFileWorkaround(){return this.hasAttribute("use-large-file-workaround")}set useLargeFileWorkaround(e){e!=this.useLargeFileWorkaround&&this.toggleAttribute("use-large-file-workaround",!!e)}get maxFileSize(){let e=this.getAttribute("max-file-size");return e!==null?parseInt(e):void 0}set maxFileSize(e){e?this.setAttribute("max-file-size",e.toString()):this.removeAttribute("max-file-size")}get chunkSize(){let e=this.getAttribute("chunk-size");return e!==null?parseInt(e):void 0}set chunkSize(e){e?this.setAttribute("chunk-size",e.toString()):this.removeAttribute("chunk-size")}get upload(){return this._upload}get paused(){var e,t;return(t=(e=this.upload)==null?void 0:e.paused)!=null?t:!1}set paused(e){if(!this.upload){console.warn("Pausing before an upload has begun is unsupported");return}let t=!!e;t!==this.paused&&(t?this.upload.pause():this.upload.resume(),this.toggleAttribute("paused",t),this.dispatchEvent(new CustomEvent("pausedchange",{detail:t})))}updateLayout(){var e,t;let r=(e=this.shadowRoot)==null?void 0:e.querySelector("mux-uploader-drop, div");r&&r.remove();let n=tn(this);(t=this.shadowRoot)==null||t.appendChild(n)}setError(e){this.setAttribute("upload-error",""),this.dispatchEvent(new CustomEvent("uploaderror",{detail:{message:e}}))}resetState(){this.removeAttribute("upload-error"),this.removeAttribute("upload-in-progress"),this.removeAttribute("upload-complete"),this.hiddenFileInput.value=""}handleUpload(e){let t=this.endpoint,r=this.dynamicChunkSize;if(t)this.removeAttribute("upload-error");else{this.setError("No url or endpoint specified -- cannot handleUpload");return}try{let n=Oe.createUpload({endpoint:t,dynamicChunkSize:r,file:e.detail,maxFileSize:this.maxFileSize,chunkSize:this.chunkSize,useLargeFileWorkaround:this.useLargeFileWorkaround});this._upload=n,this.dispatchEvent(new CustomEvent("uploadstart",{detail:{file:n.file,chunkSize:n.chunkSize}})),this.setAttribute("upload-in-progress",""),n.offline&&this.dispatchEvent(new CustomEvent("offline")),n.on("attempt",s=>{this.dispatchEvent(new CustomEvent("chunkattempt",s))}),n.on("chunkSuccess",s=>{this.dispatchEvent(new CustomEvent("chunksuccess",s))}),n.on("error",s=>{this.setAttribute("upload-error",""),console.error("error handler",s.detail.message),this.dispatchEvent(new CustomEvent("uploaderror",s))}),n.on("progress",s=>{this.dispatchEvent(new CustomEvent("progress",s))}),n.on("success",s=>{this.removeAttribute("upload-in-progress"),this.setAttribute("upload-complete",""),this.dispatchEvent(new CustomEvent("success",s))}),n.on("offline",s=>{this.dispatchEvent(new CustomEvent("offline",s))}),n.on("online",s=>{this.dispatchEvent(new CustomEvent("online",s))})}catch(n){n instanceof Error&&this.setError(n.message)}}};p.customElements.get("mux-uploader")||(p.customElements.define("mux-uploader",vt),p.MuxUploaderElement=vt);var Ut=P.createElement("template");Ut.innerHTML=` | ||
`;var vt=class extends p.HTMLElement{static get observedAttributes(){return["pausable","type","no-drop","no-progress","no-status","no-retry","max-file-size","use-large-file-workaround"]}constructor(){var e;super(),this.attachShadow({mode:"open"}).appendChild(Pt.content.cloneNode(!0)),this.updateLayout(),(e=this.hiddenFileInput)==null||e.addEventListener("change",()=>{var t,r;let n=(r=(t=this.hiddenFileInput)==null?void 0:t.files)==null?void 0:r[0];this.toggleAttribute("file-ready",!!n),n&&this.dispatchEvent(new CustomEvent("file-ready",{composed:!0,bubbles:!0,detail:n}))})}connectedCallback(){this.addEventListener("file-ready",this.handleUpload),this.addEventListener("reset",this.resetState)}disconnectedCallback(){this.removeEventListener("file-ready",this.handleUpload,!1),this.removeEventListener("reset",this.resetState)}attributeChangedCallback(){this.updateLayout()}get hiddenFileInput(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("#hidden-file-input")}get endpoint(){var e;return(e=this.getAttribute("endpoint"))!=null?e:this._endpoint}set endpoint(e){e!==this.endpoint&&(typeof e=="string"?this.setAttribute("endpoint",e):e==null&&this.removeAttribute("endpoint"),this._endpoint=e)}get type(){var e;return(e=this.getAttribute("type"))!=null?e:void 0}set type(e){e!=this.type&&(e?this.setAttribute("type",e):this.removeAttribute("type"))}get noDrop(){return this.hasAttribute("no-drop")}set noDrop(e){this.toggleAttribute("no-drop",!!e)}get noProgress(){return this.hasAttribute("no-progress")}set noProgress(e){this.toggleAttribute("no-progress",!!e)}get noStatus(){return this.hasAttribute("no-status")}set noStatus(e){this.toggleAttribute("no-status",!!e)}get noRetry(){return this.hasAttribute("no-retry")}set noRetry(e){this.toggleAttribute("no-retry",!!e)}get pausable(){return this.hasAttribute("pausable")}set pausable(e){this.toggleAttribute("pausable",!!e)}get dynamicChunkSize(){return this.hasAttribute("dynamic-chunk-size")}set dynamicChunkSize(e){e!==this.hasAttribute("dynamic-chunk-size")&&(e?this.setAttribute("dynamic-chunk-size",""):this.removeAttribute("dynamic-chunk-size"))}get useLargeFileWorkaround(){return this.hasAttribute("use-large-file-workaround")}set useLargeFileWorkaround(e){e!=this.useLargeFileWorkaround&&this.toggleAttribute("use-large-file-workaround",!!e)}get maxFileSize(){let e=this.getAttribute("max-file-size");return e!==null?parseInt(e):void 0}set maxFileSize(e){e?this.setAttribute("max-file-size",e.toString()):this.removeAttribute("max-file-size")}get chunkSize(){let e=this.getAttribute("chunk-size");return e!==null?parseInt(e):void 0}set chunkSize(e){e?this.setAttribute("chunk-size",e.toString()):this.removeAttribute("chunk-size")}get upload(){return this._upload}get paused(){var e,t;return(t=(e=this.upload)==null?void 0:e.paused)!=null?t:!1}set paused(e){if(!this.upload){console.warn("Pausing before an upload has begun is unsupported");return}let t=!!e;t!==this.paused&&(t?this.upload.pause():this.upload.resume(),this.toggleAttribute("paused",t),this.dispatchEvent(new CustomEvent("pausedchange",{detail:t})))}updateLayout(){var e,t;let r=(e=this.shadowRoot)==null?void 0:e.querySelector("mux-uploader-drop, div");r&&r.remove();let n=tn(this);(t=this.shadowRoot)==null||t.appendChild(n)}setError(e){this.setAttribute("upload-error",""),this.dispatchEvent(new CustomEvent("uploaderror",{detail:{message:e}}))}resetState(){this.removeAttribute("upload-error"),this.removeAttribute("upload-in-progress"),this.removeAttribute("upload-complete"),this.hiddenFileInput.value=""}handleUpload(e){let t=this.endpoint,r=this.dynamicChunkSize;if(t)this.removeAttribute("upload-error");else{this.setError("No url or endpoint specified -- cannot handleUpload");return}try{let n=Oe.createUpload({endpoint:t,dynamicChunkSize:r,file:e.detail,maxFileSize:this.maxFileSize,chunkSize:this.chunkSize,useLargeFileWorkaround:this.useLargeFileWorkaround});this._upload=n,this.dispatchEvent(new CustomEvent("uploadstart",{detail:{file:n.file,chunkSize:n.chunkSize}})),this.setAttribute("upload-in-progress",""),n.offline&&this.dispatchEvent(new CustomEvent("offline")),n.on("attempt",s=>{this.dispatchEvent(new CustomEvent("chunkattempt",s))}),n.on("chunkSuccess",s=>{this.dispatchEvent(new CustomEvent("chunksuccess",s))}),n.on("error",s=>{this.setAttribute("upload-error",""),console.error("error handler",s.detail.message),this.dispatchEvent(new CustomEvent("uploaderror",s))}),n.on("progress",s=>{this.dispatchEvent(new CustomEvent("progress",s))}),n.on("success",s=>{this.removeAttribute("upload-in-progress"),this.setAttribute("upload-complete",""),this.dispatchEvent(new CustomEvent("success",s))}),n.on("offline",s=>{this.dispatchEvent(new CustomEvent("offline",s))}),n.on("online",s=>{this.dispatchEvent(new CustomEvent("online",s))})}catch(n){n instanceof Error&&this.setError(n.message)}}};p.customElements.get("mux-uploader")||(p.customElements.define("mux-uploader",vt),p.MuxUploaderElement=vt);var Ut=P.createElement("template");Ut.innerHTML=` | ||
<style> | ||
@@ -290,0 +290,0 @@ |
{ | ||
"name": "@mux/mux-uploader-react", | ||
"version": "1.0.2-canary.0-2577b78", | ||
"version": "1.0.2-canary.0-2775da4", | ||
"description": "An uploader element for React that handles Mux Direct Uploads and a visual progress bar for you", | ||
@@ -73,3 +73,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@mux/mux-uploader": "1.0.2-canary.0-2577b78", | ||
"@mux/mux-uploader": "1.0.2-canary.0-2775da4", | ||
"prop-types": "^15.7.2" | ||
@@ -76,0 +76,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
632732
+ Added@mux/mux-uploader@1.0.2-canary.0-2775da4(transitive)
- Removed@mux/mux-uploader@1.0.2-canary.0-2577b78(transitive)