@ionic/pwa-elements
Advanced tools
Comparing version 3.2.2 to 3.3.0
@@ -23,5 +23,5 @@ 'use strict'; | ||
patchBrowser().then(options => { | ||
return index.bootstrapLazy([["pwa-camera-modal.cjs",[[1,"pwa-camera-modal",{"facingMode":[1,"facing-mode"],"present":[64],"dismiss":[64]}]]],["pwa-action-sheet.cjs",[[1,"pwa-action-sheet",{"header":[1],"cancelable":[4],"options":[16],"open":[32]}]]],["pwa-toast.cjs",[[1,"pwa-toast",{"message":[1],"duration":[2],"closing":[32]}]]],["pwa-camera.cjs",[[1,"pwa-camera",{"facingMode":[1,"facing-mode"],"handlePhoto":[16],"handleNoDeviceError":[16],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"],"photo":[32],"photoSrc":[32],"showShutterOverlay":[32],"flashIndex":[32],"hasCamera":[32],"rotation":[32],"deviceError":[32]}]]],["pwa-camera-modal-instance.cjs",[[1,"pwa-camera-modal-instance",{"facingMode":[1,"facing-mode"],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]], options); | ||
return index.bootstrapLazy([["pwa-camera-modal.cjs",[[1,"pwa-camera-modal",{"facingMode":[1,"facing-mode"],"hidePicker":[4,"hide-picker"],"present":[64],"dismiss":[64]}]]],["pwa-action-sheet.cjs",[[1,"pwa-action-sheet",{"header":[1],"cancelable":[4],"options":[16],"open":[32]}]]],["pwa-toast.cjs",[[1,"pwa-toast",{"message":[1],"duration":[2],"closing":[32]}]]],["pwa-camera.cjs",[[1,"pwa-camera",{"facingMode":[1,"facing-mode"],"handlePhoto":[16],"hidePicker":[4,"hide-picker"],"handleNoDeviceError":[16],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"],"photo":[32],"photoSrc":[32],"showShutterOverlay":[32],"flashIndex":[32],"hasCamera":[32],"rotation":[32],"deviceError":[32]}]]],["pwa-camera-modal-instance.cjs",[[1,"pwa-camera-modal-instance",{"facingMode":[1,"facing-mode"],"hidePicker":[4,"hide-picker"],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]], options); | ||
}); | ||
exports.setNonce = index.setNonce; |
@@ -17,3 +17,3 @@ 'use strict'; | ||
return patchEsm().then(() => { | ||
return index.bootstrapLazy([["pwa-camera-modal.cjs",[[1,"pwa-camera-modal",{"facingMode":[1,"facing-mode"],"present":[64],"dismiss":[64]}]]],["pwa-action-sheet.cjs",[[1,"pwa-action-sheet",{"header":[1],"cancelable":[4],"options":[16],"open":[32]}]]],["pwa-toast.cjs",[[1,"pwa-toast",{"message":[1],"duration":[2],"closing":[32]}]]],["pwa-camera.cjs",[[1,"pwa-camera",{"facingMode":[1,"facing-mode"],"handlePhoto":[16],"handleNoDeviceError":[16],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"],"photo":[32],"photoSrc":[32],"showShutterOverlay":[32],"flashIndex":[32],"hasCamera":[32],"rotation":[32],"deviceError":[32]}]]],["pwa-camera-modal-instance.cjs",[[1,"pwa-camera-modal-instance",{"facingMode":[1,"facing-mode"],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]], options); | ||
return index.bootstrapLazy([["pwa-camera-modal.cjs",[[1,"pwa-camera-modal",{"facingMode":[1,"facing-mode"],"hidePicker":[4,"hide-picker"],"present":[64],"dismiss":[64]}]]],["pwa-action-sheet.cjs",[[1,"pwa-action-sheet",{"header":[1],"cancelable":[4],"options":[16],"open":[32]}]]],["pwa-toast.cjs",[[1,"pwa-toast",{"message":[1],"duration":[2],"closing":[32]}]]],["pwa-camera.cjs",[[1,"pwa-camera",{"facingMode":[1,"facing-mode"],"handlePhoto":[16],"hidePicker":[4,"hide-picker"],"handleNoDeviceError":[16],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"],"photo":[32],"photoSrc":[32],"showShutterOverlay":[32],"flashIndex":[32],"hasCamera":[32],"rotation":[32],"deviceError":[32]}]]],["pwa-camera-modal-instance.cjs",[[1,"pwa-camera-modal-instance",{"facingMode":[1,"facing-mode"],"hidePicker":[4,"hide-picker"],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]], options); | ||
}); | ||
@@ -20,0 +20,0 @@ }; |
@@ -21,2 +21,3 @@ 'use strict'; | ||
this.facingMode = 'user'; | ||
this.hidePicker = false; | ||
this.noDevicesText = 'No camera found'; | ||
@@ -39,3 +40,3 @@ this.noDevicesButtonText = 'Choose image'; | ||
render() { | ||
return (index.h("div", { class: "wrapper", onClick: e => this.handleBackdropClick(e) }, index.h("div", { class: "content" }, index.h("pwa-camera", { onClick: e => this.handleComponentClick(e), facingMode: this.facingMode, handlePhoto: this.handlePhoto, handleNoDeviceError: this.handleNoDeviceError, noDevicesButtonText: this.noDevicesButtonText, noDevicesText: this.noDevicesText })))); | ||
return (index.h("div", { class: "wrapper", onClick: e => this.handleBackdropClick(e) }, index.h("div", { class: "content" }, index.h("pwa-camera", { onClick: e => this.handleComponentClick(e), facingMode: this.facingMode, hidePicker: this.hidePicker, handlePhoto: this.handlePhoto, handleNoDeviceError: this.handleNoDeviceError, noDevicesButtonText: this.noDevicesButtonText, noDevicesText: this.noDevicesText })))); | ||
} | ||
@@ -42,0 +43,0 @@ get el() { return index.getElement(this); } |
@@ -15,2 +15,3 @@ 'use strict'; | ||
this.facingMode = 'user'; | ||
this.hidePicker = false; | ||
} | ||
@@ -20,2 +21,3 @@ async present() { | ||
camera.facingMode = this.facingMode; | ||
camera.hidePicker = this.hidePicker; | ||
camera.addEventListener('onPhoto', async (e) => { | ||
@@ -22,0 +24,0 @@ if (!this._modal) { |
@@ -227,2 +227,3 @@ 'use strict'; | ||
this.handlePhoto = undefined; | ||
this.hidePicker = false; | ||
this.handleNoDeviceError = undefined; | ||
@@ -475,3 +476,3 @@ this.noDevicesText = 'No camera found'; | ||
return (index.h("div", { class: "camera-wrapper" }, index.h("div", { class: "camera-header" }, index.h("section", { class: "items" }, index.h("div", { class: "item close", onClick: e => this.handleClose(e) }, index.h("img", { src: this.iconExit() })), index.h("div", { class: "item flash", onClick: e => this.handleFlashClick(e) }, this.flashModes.length > 0 && (index.h("div", null, this.flashMode == 'off' ? index.h("img", { src: this.iconFlashOff() }) : '', this.flashMode == 'auto' ? index.h("img", { src: this.iconFlashAuto() }) : '', this.flashMode == 'flash' ? index.h("img", { src: this.iconFlashOn() }) : ''))))), (this.hasCamera === false || !!this.deviceError) && (index.h("div", { class: "no-device" }, index.h("h2", null, this.noDevicesText), index.h("label", { htmlFor: "_pwa-elements-camera-input" }, this.noDevicesButtonText), index.h("input", { type: "file", id: "_pwa-elements-camera-input", onChange: this.handleFileInputChange, accept: "image/*", class: "select-file-button" }))), this.photoSrc ? (index.h("div", { class: "accept" }, index.h("div", { class: "accept-image", style: Object.assign({ backgroundImage: `url(${this.photoSrc})` }, acceptStyles) }))) : (index.h("div", { class: "camera-video" }, this.showShutterOverlay && (index.h("div", { class: "shutter-overlay" })), this.hasImageCapture() ? (index.h("video", { ref: (el) => this.videoElement = el, onLoadedMetaData: this.handleVideoMetadata, autoplay: true, playsinline: true })) : (index.h("canvas", { ref: (el) => this.canvasElement = el, width: "100%", height: "100%" })), index.h("canvas", { class: "offscreen-image-render", ref: e => this.offscreenCanvas = e, width: "100%", height: "100%" }))), this.hasCamera && (index.h("div", { class: "camera-footer" }, !this.photo ? ([ | ||
index.h("div", { class: "pick-image", onClick: this.handlePickFile }, index.h("label", { htmlFor: "_pwa-elements-file-pick" }, this.iconPhotos()), index.h("input", { type: "file", id: "_pwa-elements-file-pick", onChange: this.handleFileInputChange, accept: "image/*", class: "pick-image-button" })), | ||
!this.hidePicker && (index.h("div", { class: "pick-image", onClick: this.handlePickFile }, index.h("label", { htmlFor: "_pwa-elements-file-pick" }, this.iconPhotos()), index.h("input", { type: "file", id: "_pwa-elements-file-pick", onChange: this.handleFileInputChange, accept: "image/*", class: "pick-image-button" }))), | ||
index.h("div", { class: "shutter", onClick: this.handleShutterClick }, index.h("div", { class: "shutter-button" })), | ||
@@ -478,0 +479,0 @@ index.h("div", { class: "rotate", onClick: this.handleRotateClick }, index.h("img", { src: this.iconReverseCamera() })), |
@@ -11,2 +11,3 @@ import { h } from '@stencil/core'; | ||
this.facingMode = 'user'; | ||
this.hidePicker = false; | ||
this.noDevicesText = 'No camera found'; | ||
@@ -29,3 +30,3 @@ this.noDevicesButtonText = 'Choose image'; | ||
render() { | ||
return (h("div", { class: "wrapper", onClick: e => this.handleBackdropClick(e) }, h("div", { class: "content" }, h("pwa-camera", { onClick: e => this.handleComponentClick(e), facingMode: this.facingMode, handlePhoto: this.handlePhoto, handleNoDeviceError: this.handleNoDeviceError, noDevicesButtonText: this.noDevicesButtonText, noDevicesText: this.noDevicesText })))); | ||
return (h("div", { class: "wrapper", onClick: e => this.handleBackdropClick(e) }, h("div", { class: "content" }, h("pwa-camera", { onClick: e => this.handleComponentClick(e), facingMode: this.facingMode, hidePicker: this.hidePicker, handlePhoto: this.handlePhoto, handleNoDeviceError: this.handleNoDeviceError, noDevicesButtonText: this.noDevicesButtonText, noDevicesText: this.noDevicesText })))); | ||
} | ||
@@ -64,2 +65,20 @@ static get is() { return "pwa-camera-modal-instance"; } | ||
}, | ||
"hidePicker": { | ||
"type": "boolean", | ||
"mutable": false, | ||
"complexType": { | ||
"original": "boolean", | ||
"resolved": "boolean", | ||
"references": {} | ||
}, | ||
"required": false, | ||
"optional": false, | ||
"docs": { | ||
"tags": [], | ||
"text": "" | ||
}, | ||
"attribute": "hide-picker", | ||
"reflect": false, | ||
"defaultValue": "false" | ||
}, | ||
"noDevicesText": { | ||
@@ -66,0 +85,0 @@ "type": "string", |
@@ -5,2 +5,3 @@ import { h } from '@stencil/core'; | ||
this.facingMode = 'user'; | ||
this.hidePicker = false; | ||
} | ||
@@ -10,2 +11,3 @@ async present() { | ||
camera.facingMode = this.facingMode; | ||
camera.hidePicker = this.hidePicker; | ||
camera.addEventListener('onPhoto', async (e) => { | ||
@@ -65,2 +67,20 @@ if (!this._modal) { | ||
"defaultValue": "'user'" | ||
}, | ||
"hidePicker": { | ||
"type": "boolean", | ||
"mutable": false, | ||
"complexType": { | ||
"original": "boolean", | ||
"resolved": "boolean", | ||
"references": {} | ||
}, | ||
"required": false, | ||
"optional": false, | ||
"docs": { | ||
"tags": [], | ||
"text": "" | ||
}, | ||
"attribute": "hide-picker", | ||
"reflect": false, | ||
"defaultValue": "false" | ||
} | ||
@@ -67,0 +87,0 @@ }; |
@@ -64,2 +64,3 @@ import { h, Build, forceUpdate } from '@stencil/core'; | ||
this.handlePhoto = undefined; | ||
this.hidePicker = false; | ||
this.handleNoDeviceError = undefined; | ||
@@ -315,3 +316,3 @@ this.noDevicesText = 'No camera found'; | ||
return (h("div", { class: "camera-wrapper" }, h("div", { class: "camera-header" }, h("section", { class: "items" }, h("div", { class: "item close", onClick: e => this.handleClose(e) }, h("img", { src: this.iconExit() })), h("div", { class: "item flash", onClick: e => this.handleFlashClick(e) }, this.flashModes.length > 0 && (h("div", null, this.flashMode == 'off' ? h("img", { src: this.iconFlashOff() }) : '', this.flashMode == 'auto' ? h("img", { src: this.iconFlashAuto() }) : '', this.flashMode == 'flash' ? h("img", { src: this.iconFlashOn() }) : ''))))), (this.hasCamera === false || !!this.deviceError) && (h("div", { class: "no-device" }, h("h2", null, this.noDevicesText), h("label", { htmlFor: "_pwa-elements-camera-input" }, this.noDevicesButtonText), h("input", { type: "file", id: "_pwa-elements-camera-input", onChange: this.handleFileInputChange, accept: "image/*", class: "select-file-button" }))), this.photoSrc ? (h("div", { class: "accept" }, h("div", { class: "accept-image", style: Object.assign({ backgroundImage: `url(${this.photoSrc})` }, acceptStyles) }))) : (h("div", { class: "camera-video" }, this.showShutterOverlay && (h("div", { class: "shutter-overlay" })), this.hasImageCapture() ? (h("video", { ref: (el) => this.videoElement = el, onLoadedMetaData: this.handleVideoMetadata, autoplay: true, playsinline: true })) : (h("canvas", { ref: (el) => this.canvasElement = el, width: "100%", height: "100%" })), h("canvas", { class: "offscreen-image-render", ref: e => this.offscreenCanvas = e, width: "100%", height: "100%" }))), this.hasCamera && (h("div", { class: "camera-footer" }, !this.photo ? ([ | ||
h("div", { class: "pick-image", onClick: this.handlePickFile }, h("label", { htmlFor: "_pwa-elements-file-pick" }, this.iconPhotos()), h("input", { type: "file", id: "_pwa-elements-file-pick", onChange: this.handleFileInputChange, accept: "image/*", class: "pick-image-button" })), | ||
!this.hidePicker && (h("div", { class: "pick-image", onClick: this.handlePickFile }, h("label", { htmlFor: "_pwa-elements-file-pick" }, this.iconPhotos()), h("input", { type: "file", id: "_pwa-elements-file-pick", onChange: this.handleFileInputChange, accept: "image/*", class: "pick-image-button" }))), | ||
h("div", { class: "shutter", onClick: this.handleShutterClick }, h("div", { class: "shutter-button" })), | ||
@@ -373,2 +374,20 @@ h("div", { class: "rotate", onClick: this.handleRotateClick }, h("img", { src: this.iconReverseCamera() })), | ||
}, | ||
"hidePicker": { | ||
"type": "boolean", | ||
"mutable": false, | ||
"complexType": { | ||
"original": "boolean", | ||
"resolved": "boolean", | ||
"references": {} | ||
}, | ||
"required": false, | ||
"optional": false, | ||
"docs": { | ||
"tags": [], | ||
"text": "" | ||
}, | ||
"attribute": "hide-picker", | ||
"reflect": false, | ||
"defaultValue": "false" | ||
}, | ||
"handleNoDeviceError": { | ||
@@ -375,0 +394,0 @@ "type": "unknown", |
@@ -1,1 +0,1 @@ | ||
import{p as promiseResolve,b as bootstrapLazy}from"./index-1c5c47b4.js";export{s as setNonce}from"./index-1c5c47b4.js";var patchBrowser=function(){var e=import.meta.url;var a={};if(e!==""){a.resourcesUrl=new URL(".",e).href}return promiseResolve(a)};patchBrowser().then((function(e){return bootstrapLazy([["pwa-camera-modal",[[1,"pwa-camera-modal",{facingMode:[1,"facing-mode"],present:[64],dismiss:[64]}]]],["pwa-action-sheet",[[1,"pwa-action-sheet",{header:[1],cancelable:[4],options:[16],open:[32]}]]],["pwa-toast",[[1,"pwa-toast",{message:[1],duration:[2],closing:[32]}]]],["pwa-camera",[[1,"pwa-camera",{facingMode:[1,"facing-mode"],handlePhoto:[16],handleNoDeviceError:[16],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"],photo:[32],photoSrc:[32],showShutterOverlay:[32],flashIndex:[32],hasCamera:[32],rotation:[32],deviceError:[32]}]]],["pwa-camera-modal-instance",[[1,"pwa-camera-modal-instance",{facingMode:[1,"facing-mode"],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]],e)})); | ||
import{p as promiseResolve,b as bootstrapLazy}from"./index-1c5c47b4.js";export{s as setNonce}from"./index-1c5c47b4.js";var patchBrowser=function(){var e=import.meta.url;var a={};if(e!==""){a.resourcesUrl=new URL(".",e).href}return promiseResolve(a)};patchBrowser().then((function(e){return bootstrapLazy([["pwa-camera-modal",[[1,"pwa-camera-modal",{facingMode:[1,"facing-mode"],hidePicker:[4,"hide-picker"],present:[64],dismiss:[64]}]]],["pwa-action-sheet",[[1,"pwa-action-sheet",{header:[1],cancelable:[4],options:[16],open:[32]}]]],["pwa-toast",[[1,"pwa-toast",{message:[1],duration:[2],closing:[32]}]]],["pwa-camera",[[1,"pwa-camera",{facingMode:[1,"facing-mode"],handlePhoto:[16],hidePicker:[4,"hide-picker"],handleNoDeviceError:[16],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"],photo:[32],photoSrc:[32],showShutterOverlay:[32],flashIndex:[32],hasCamera:[32],rotation:[32],deviceError:[32]}]]],["pwa-camera-modal-instance",[[1,"pwa-camera-modal-instance",{facingMode:[1,"facing-mode"],hidePicker:[4,"hide-picker"],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]],e)})); |
@@ -1,1 +0,1 @@ | ||
import{p as promiseResolve,b as bootstrapLazy}from"./index-1c5c47b4.js";export{s as setNonce}from"./index-1c5c47b4.js";var patchEsm=function(){return promiseResolve()};var defineCustomElements=function(e,o){if(typeof window==="undefined")return Promise.resolve();return patchEsm().then((function(){return bootstrapLazy([["pwa-camera-modal",[[1,"pwa-camera-modal",{facingMode:[1,"facing-mode"],present:[64],dismiss:[64]}]]],["pwa-action-sheet",[[1,"pwa-action-sheet",{header:[1],cancelable:[4],options:[16],open:[32]}]]],["pwa-toast",[[1,"pwa-toast",{message:[1],duration:[2],closing:[32]}]]],["pwa-camera",[[1,"pwa-camera",{facingMode:[1,"facing-mode"],handlePhoto:[16],handleNoDeviceError:[16],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"],photo:[32],photoSrc:[32],showShutterOverlay:[32],flashIndex:[32],hasCamera:[32],rotation:[32],deviceError:[32]}]]],["pwa-camera-modal-instance",[[1,"pwa-camera-modal-instance",{facingMode:[1,"facing-mode"],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]],o)}))};export{defineCustomElements}; | ||
import{p as promiseResolve,b as bootstrapLazy}from"./index-1c5c47b4.js";export{s as setNonce}from"./index-1c5c47b4.js";var patchEsm=function(){return promiseResolve()};var defineCustomElements=function(e,o){if(typeof window==="undefined")return Promise.resolve();return patchEsm().then((function(){return bootstrapLazy([["pwa-camera-modal",[[1,"pwa-camera-modal",{facingMode:[1,"facing-mode"],hidePicker:[4,"hide-picker"],present:[64],dismiss:[64]}]]],["pwa-action-sheet",[[1,"pwa-action-sheet",{header:[1],cancelable:[4],options:[16],open:[32]}]]],["pwa-toast",[[1,"pwa-toast",{message:[1],duration:[2],closing:[32]}]]],["pwa-camera",[[1,"pwa-camera",{facingMode:[1,"facing-mode"],handlePhoto:[16],hidePicker:[4,"hide-picker"],handleNoDeviceError:[16],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"],photo:[32],photoSrc:[32],showShutterOverlay:[32],flashIndex:[32],hasCamera:[32],rotation:[32],deviceError:[32]}]]],["pwa-camera-modal-instance",[[1,"pwa-camera-modal-instance",{facingMode:[1,"facing-mode"],hidePicker:[4,"hide-picker"],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]],o)}))};export{defineCustomElements}; |
@@ -1,1 +0,1 @@ | ||
var __awaiter=this&&this.__awaiter||function(e,t,n,o){function r(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function a(e){try{s(o.next(e))}catch(e){i(e)}}function c(e){try{s(o["throw"](e))}catch(e){i(e)}}function s(e){e.done?n(e.value):r(e.value).then(a,c)}s((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,r,i,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(e){return function(t){return s([e,t])}}function s(c){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,c[0]&&(n=0)),n)try{if(o=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:n.label++;return{value:c[1],done:false};case 5:n.label++;r=c[1];c=[0];continue;case 7:c=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1];i=c;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(c);break}if(i[2])n.ops.pop();n.trys.pop();continue}c=t.call(e,n)}catch(e){c=[6,e];r=0}finally{o=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,g as getElement}from"./index-1c5c47b4.js";var cameraModalInstanceCss=":host{z-index:1000;position:fixed;top:0;left:0;width:100%;height:100%;display:-ms-flexbox;display:flex;contain:strict;--inset-width:600px;--inset-height:600px}.wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:rgba(0, 0, 0, 0.15)}.content{-webkit-box-shadow:0px 0px 5px rgba(0, 0, 0, 0.2);box-shadow:0px 0px 5px rgba(0, 0, 0, 0.2);width:var(--inset-width);height:var(--inset-height);max-height:100%}@media only screen and (max-width: 600px){.content{width:100%;height:100%}}";var PWACameraModal=function(){function e(e){var t=this;registerInstance(this,e);this.onPhoto=createEvent(this,"onPhoto",7);this.noDeviceError=createEvent(this,"noDeviceError",7);this.handlePhoto=function(e){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){this.onPhoto.emit(e);return[2]}))}))};this.handleNoDeviceError=function(e){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){this.noDeviceError.emit(e);return[2]}))}))};this.facingMode="user";this.noDevicesText="No camera found";this.noDevicesButtonText="Choose image"}e.prototype.handleBackdropClick=function(e){if(e.target!==this.el){this.onPhoto.emit(null)}};e.prototype.handleComponentClick=function(e){e.stopPropagation()};e.prototype.handleBackdropKeyUp=function(e){if(e.key==="Escape"){this.onPhoto.emit(null)}};e.prototype.render=function(){var e=this;return h("div",{class:"wrapper",onClick:function(t){return e.handleBackdropClick(t)}},h("div",{class:"content"},h("pwa-camera",{onClick:function(t){return e.handleComponentClick(t)},facingMode:this.facingMode,handlePhoto:this.handlePhoto,handleNoDeviceError:this.handleNoDeviceError,noDevicesButtonText:this.noDevicesButtonText,noDevicesText:this.noDevicesText})))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();PWACameraModal.style=cameraModalInstanceCss;export{PWACameraModal as pwa_camera_modal_instance}; | ||
var __awaiter=this&&this.__awaiter||function(e,t,n,o){function r(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function a(e){try{s(o.next(e))}catch(e){i(e)}}function c(e){try{s(o["throw"](e))}catch(e){i(e)}}function s(e){e.done?n(e.value):r(e.value).then(a,c)}s((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,r,i,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(e){return function(t){return s([e,t])}}function s(c){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,c[0]&&(n=0)),n)try{if(o=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:n.label++;return{value:c[1],done:false};case 5:n.label++;r=c[1];c=[0];continue;case 7:c=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1];i=c;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(c);break}if(i[2])n.ops.pop();n.trys.pop();continue}c=t.call(e,n)}catch(e){c=[6,e];r=0}finally{o=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,g as getElement}from"./index-1c5c47b4.js";var cameraModalInstanceCss=":host{z-index:1000;position:fixed;top:0;left:0;width:100%;height:100%;display:-ms-flexbox;display:flex;contain:strict;--inset-width:600px;--inset-height:600px}.wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:rgba(0, 0, 0, 0.15)}.content{-webkit-box-shadow:0px 0px 5px rgba(0, 0, 0, 0.2);box-shadow:0px 0px 5px rgba(0, 0, 0, 0.2);width:var(--inset-width);height:var(--inset-height);max-height:100%}@media only screen and (max-width: 600px){.content{width:100%;height:100%}}";var PWACameraModal=function(){function e(e){var t=this;registerInstance(this,e);this.onPhoto=createEvent(this,"onPhoto",7);this.noDeviceError=createEvent(this,"noDeviceError",7);this.handlePhoto=function(e){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){this.onPhoto.emit(e);return[2]}))}))};this.handleNoDeviceError=function(e){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){this.noDeviceError.emit(e);return[2]}))}))};this.facingMode="user";this.hidePicker=false;this.noDevicesText="No camera found";this.noDevicesButtonText="Choose image"}e.prototype.handleBackdropClick=function(e){if(e.target!==this.el){this.onPhoto.emit(null)}};e.prototype.handleComponentClick=function(e){e.stopPropagation()};e.prototype.handleBackdropKeyUp=function(e){if(e.key==="Escape"){this.onPhoto.emit(null)}};e.prototype.render=function(){var e=this;return h("div",{class:"wrapper",onClick:function(t){return e.handleBackdropClick(t)}},h("div",{class:"content"},h("pwa-camera",{onClick:function(t){return e.handleComponentClick(t)},facingMode:this.facingMode,hidePicker:this.hidePicker,handlePhoto:this.handlePhoto,handleNoDeviceError:this.handleNoDeviceError,noDevicesButtonText:this.noDevicesButtonText,noDevicesText:this.noDevicesText})))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();PWACameraModal.style=cameraModalInstanceCss;export{PWACameraModal as pwa_camera_modal_instance}; |
@@ -1,1 +0,1 @@ | ||
var __awaiter=this&&this.__awaiter||function(t,e,n,r){function o(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r["throw"](t))}catch(t){i(t)}}function c(t){t.done?n(t.value):o(t.value).then(a,s)}c((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return c([t,e])}}function c(s){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(r=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;o=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){n.label=s[1];break}if(s[0]===6&&n.label<i[1]){n.label=i[1];i=s;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(s);break}if(i[2])n.ops.pop();n.trys.pop();continue}s=e.call(t,n)}catch(t){s=[6,t];o=0}finally{r=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h}from"./index-1c5c47b4.js";var cameraModalCss=":host{z-index:1000;position:fixed;top:0;left:0;width:100%;height:100%;display:-ms-flexbox;display:flex;contain:strict}.wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:rgba(0, 0, 0, 0.15)}.content{-webkit-box-shadow:0px 0px 5px rgba(0, 0, 0, 0.2);box-shadow:0px 0px 5px rgba(0, 0, 0, 0.2);width:600px;height:600px}";var PWACameraModal=function(){function t(t){registerInstance(this,t);this.onPhoto=createEvent(this,"onPhoto",7);this.noDeviceError=createEvent(this,"noDeviceError",7);this.facingMode="user"}t.prototype.present=function(){return __awaiter(this,void 0,void 0,(function(){var t;var e=this;return __generator(this,(function(n){t=document.createElement("pwa-camera-modal-instance");t.facingMode=this.facingMode;t.addEventListener("onPhoto",(function(t){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(n){if(!this._modal){return[2]}e=t.detail;this.onPhoto.emit(e);return[2]}))}))}));t.addEventListener("noDeviceError",(function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){this.noDeviceError.emit(t);return[2]}))}))}));document.body.append(t);this._modal=t;return[2]}))}))};t.prototype.dismiss=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(!this._modal){return[2]}this._modal&&this._modal.parentNode.removeChild(this._modal);this._modal=null;return[2]}))}))};t.prototype.render=function(){return h("div",null)};return t}();PWACameraModal.style=cameraModalCss;export{PWACameraModal as pwa_camera_modal}; | ||
var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r["throw"](e))}catch(e){o(e)}}function c(e){e.done?n(e.value):i(e.value).then(a,s)}c((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(r=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;i=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){n.label=s[1];break}if(s[0]===6&&n.label<o[1]){n.label=o[1];o=s;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(s);break}if(o[2])n.ops.pop();n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e];i=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h}from"./index-1c5c47b4.js";var cameraModalCss=":host{z-index:1000;position:fixed;top:0;left:0;width:100%;height:100%;display:-ms-flexbox;display:flex;contain:strict}.wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:rgba(0, 0, 0, 0.15)}.content{-webkit-box-shadow:0px 0px 5px rgba(0, 0, 0, 0.2);box-shadow:0px 0px 5px rgba(0, 0, 0, 0.2);width:600px;height:600px}";var PWACameraModal=function(){function e(e){registerInstance(this,e);this.onPhoto=createEvent(this,"onPhoto",7);this.noDeviceError=createEvent(this,"noDeviceError",7);this.facingMode="user";this.hidePicker=false}e.prototype.present=function(){return __awaiter(this,void 0,void 0,(function(){var e;var t=this;return __generator(this,(function(n){e=document.createElement("pwa-camera-modal-instance");e.facingMode=this.facingMode;e.hidePicker=this.hidePicker;e.addEventListener("onPhoto",(function(e){return __awaiter(t,void 0,void 0,(function(){var t;return __generator(this,(function(n){if(!this._modal){return[2]}t=e.detail;this.onPhoto.emit(t);return[2]}))}))}));e.addEventListener("noDeviceError",(function(e){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){this.noDeviceError.emit(e);return[2]}))}))}));document.body.append(e);this._modal=e;return[2]}))}))};e.prototype.dismiss=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(!this._modal){return[2]}this._modal&&this._modal.parentNode.removeChild(this._modal);this._modal=null;return[2]}))}))};e.prototype.render=function(){return h("div",null)};return e}();PWACameraModal.style=cameraModalCss;export{PWACameraModal as pwa_camera_modal}; |
@@ -19,2 +19,2 @@ var __awaiter=this&&this.__awaiter||function(e,t,i,n){function r(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n["throw"](e))}catch(e){a(e)}}function c(e){e.done?i(e.value):r(e.value).then(o,s)}c((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,r,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,s[0]&&(i=0)),i)try{if(n=1,r&&(a=s[0]&2?r["return"]:s[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;if(r=0,a)s=[s[0]&2,a.value];switch(s[0]){case 0:case 1:a=s;break;case 4:i.label++;return{value:s[1],done:false};case 5:i.label++;r=s[1];s=[0];continue;case 7:s=i.ops.pop();i.trys.pop();continue;default:if(!(a=i.trys,a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){i=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){i.label=s[1];break}if(s[0]===6&&i.label<a[1]){i.label=a[1];a=s;break}if(a&&i.label<a[2]){i.label=a[2];i.ops.push(s);break}if(a[2])i.ops.pop();i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e];r=0}finally{n=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,f as forceUpdate,h,g as getElement}from"./index-1c5c47b4.js"; | ||
* limitations under the License. | ||
*/var ImageCapture=window.ImageCapture;if(typeof ImageCapture==="undefined"){ImageCapture=function(){function e(e){var t=this;if(e.kind!=="video")throw new DOMException("NotSupportedError");this._videoStreamTrack=e;if(!("readyState"in this._videoStreamTrack)){this._videoStreamTrack.readyState="live"}this._previewStream=new MediaStream([e]);this.videoElement=document.createElement("video");this.videoElementPlaying=new Promise((function(e){t.videoElement.addEventListener("playing",e)}));if(HTMLMediaElement){this.videoElement.srcObject=this._previewStream}else{this.videoElement.src=URL.createObjectURL(this._previewStream)}this.videoElement.muted=true;this.videoElement.setAttribute("playsinline","");this.videoElement.play();this.canvasElement=document.createElement("canvas");this.canvas2dContext=this.canvasElement.getContext("2d")}Object.defineProperty(e.prototype,"videoStreamTrack",{get:function(){return this._videoStreamTrack},enumerable:false,configurable:true});e.prototype.getPhotoCapabilities=function(){return new Promise((function e(t,i){var n={current:0,min:0,max:0};t({exposureCompensation:n,exposureMode:"none",fillLightMode:["none"],focusMode:"none",imageHeight:n,imageWidth:n,iso:n,redEyeReduction:false,whiteBalanceMode:"none",zoom:n});i(new DOMException("OperationError"))}))};e.prototype.setOptions=function(e){if(e===void 0){e={}}return new Promise((function e(t,i){}))};e.prototype.takePhoto=function(){var e=this;return new Promise((function t(i,n){if(e._videoStreamTrack.readyState!=="live"){return n(new DOMException("InvalidStateError"))}e.videoElementPlaying.then((function(){try{e.canvasElement.width=e.videoElement.videoWidth;e.canvasElement.height=e.videoElement.videoHeight;e.canvas2dContext.drawImage(e.videoElement,0,0);e.canvasElement.toBlob(i)}catch(e){n(new DOMException("UnknownError"))}}))}))};e.prototype.grabFrame=function(){var e=this;return new Promise((function t(i,n){if(e._videoStreamTrack.readyState!=="live"){return n(new DOMException("InvalidStateError"))}e.videoElementPlaying.then((function(){try{e.canvasElement.width=e.videoElement.videoWidth;e.canvasElement.height=e.videoElement.videoHeight;e.canvas2dContext.drawImage(e.videoElement,0,0);i(window.createImageBitmap(e.canvasElement))}catch(e){n(new DOMException("UnknownError"))}}))}))};return e}()}window.ImageCapture=ImageCapture;var cameraCss=":host{--header-height:4em;--footer-height:9em;--header-height-landscape:3em;--footer-height-landscape:6em;--shutter-size:6em;--icon-size-header:1.5em;--icon-size-footer:2.5em;--margin-size-header:1.5em;--margin-size-footer:2.0em;font-family:-apple-system, BlinkMacSystemFont,\n “Segoe UI”, “Roboto”, “Droid Sans”, “Helvetica Neue”, sans-serif;display:block;width:100%;height:100%}.items{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;width:100%;height:100%;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.items .item{-ms-flex:1;flex:1;text-align:center}.items .item:first-child{text-align:left}.items .item:last-child{text-align:right}.camera-wrapper{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:100%;height:100%}.camera-header{color:white;background-color:black;height:var(--header-height)}.camera-header .items{padding:var(--margin-size-header)}.camera-footer{position:relative;color:white;background-color:black;height:var(--footer-height)}.camera-footer .items{padding:var(--margin-size-footer)}@media (max-height: 375px){.camera-header{--header-height:var(--header-height-landscape)}.camera-footer{--footer-height:var(--footer-height-landscape)}.camera-footer .shutter{--shutter-size:4em}}.camera-video{position:relative;-ms-flex:1;flex:1;overflow:hidden;background-color:black}video{width:100%;height:100%;max-height:100%;min-height:100%;-o-object-fit:cover;object-fit:cover;background-color:black}.pick-image{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;position:absolute;left:var(--margin-size-footer);top:0;height:100%;width:var(--icon-size-footer);color:white}.pick-image input{visibility:hidden}.pick-image svg{cursor:pointer;fill:white;width:var(--icon-size-footer);height:var(--icon-size-footer)}.shutter{position:absolute;left:50%;top:50%;width:var(--shutter-size);height:var(--shutter-size);margin-top:calc(var(--shutter-size) / -2);margin-left:calc(var(--shutter-size) / -2);border-radius:100%;background-color:#c6cdd8;padding:12px;-webkit-box-sizing:border-box;box-sizing:border-box}.shutter:active .shutter-button{background-color:#9da9bb}.shutter-button{background-color:white;border-radius:100%;width:100%;height:100%}.rotate{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;position:absolute;right:var(--margin-size-footer);top:0;height:100%;width:var(--icon-size-footer);color:white}.rotate img{width:var(--icon-size-footer);height:var(--icon-size-footer)}.shutter-overlay{z-index:5;position:absolute;width:100%;height:100%;background-color:black}.error{width:100%;height:100%;color:white;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}.no-device{background-color:black;-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;color:white}.no-device label{cursor:pointer;background:#fff;border-radius:6px;padding:6px 8px;color:black}.no-device input{visibility:hidden;height:0;margin-top:16px}.accept{background-color:black;-ms-flex:1;flex:1;overflow:hidden}.accept .accept-image{width:100%;height:100%;max-height:100%;background-position:center center;background-size:cover;background-repeat:no-repeat}.close img{cursor:pointer;width:var(--icon-size-header);height:var(--icon-size-header)}.flash img{width:var(--icon-size-header);height:var(--icon-size-header)}.accept-use img{width:var(--icon-size-footer);height:var(--icon-size-footer)}.accept-cancel img{width:var(--icon-size-footer);height:var(--icon-size-footer)}.offscreen-image-render{top:0;left:0;visibility:hidden;pointer-events:none;width:100%;height:100%}";var CameraPWA=function(){function e(e){var t=this;registerInstance(this,e);this.hasMultipleCameras=false;this.hasFlash=false;this.flashModes=[];this.flashMode="off";this.handlePickFile=function(e){};this.handleShutterClick=function(e){console.debug("shutter click");t.capture()};this.handleRotateClick=function(e){t.rotate()};this.handleClose=function(e){t.handlePhoto&&t.handlePhoto(null)};this.handleFlashClick=function(e){t.cycleFlash()};this.handleCancelPhoto=function(e){var i=t.stream&&t.stream.getTracks()[0];var n=i&&i.getConstraints();t.photo=null;t.photoSrc=null;if(n){t.initCamera({video:{facingMode:n.facingMode}})}else{t.initCamera()}};this.handleAcceptPhoto=function(e){t.handlePhoto&&t.handlePhoto(t.photo)};this.handleFileInputChange=function(e){return __awaiter(t,void 0,void 0,(function(){var t,i,n,r;return __generator(this,(function(a){switch(a.label){case 0:t=e.target;i=t.files[0];a.label=1;case 1:a.trys.push([1,3,,4]);return[4,this.getOrientation(i)];case 2:n=a.sent();console.debug("Got orientation",n);this.photoOrientation=n;return[3,4];case 3:r=a.sent();return[3,4];case 4:this.handlePhoto&&this.handlePhoto(i);return[2]}}))}))};this.handleVideoMetadata=function(e){console.debug("Video metadata",e)};this.facingMode="user";this.handlePhoto=undefined;this.handleNoDeviceError=undefined;this.noDevicesText="No camera found";this.noDevicesButtonText="Choose image";this.photo=undefined;this.photoSrc=undefined;this.showShutterOverlay=false;this.flashIndex=0;this.hasCamera=null;this.rotation=0;this.deviceError=null}e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:this.defaultConstraints={video:{facingMode:this.facingMode}};return[4,this.queryDevices()];case 1:e.sent();return[4,this.initCamera()];case 2:e.sent();return[2]}}))}))};e.prototype.disconnectedCallback=function(){this.stopStream();this.photoSrc&&URL.revokeObjectURL(this.photoSrc)};e.prototype.hasImageCapture=function(){return"ImageCapture"in window};e.prototype.queryDevices=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,navigator.mediaDevices.enumerateDevices()];case 1:e=n.sent();t=e.filter((function(e){return e.kind=="videoinput"}));this.hasCamera=!!t.length;this.hasMultipleCameras=t.length>1;return[3,3];case 2:i=n.sent();this.deviceError=i;return[3,3];case 3:return[2]}}))}))};e.prototype.initCamera=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(n){switch(n.label){case 0:if(!e){e=this.defaultConstraints}n.label=1;case 1:n.trys.push([1,3,,4]);return[4,navigator.mediaDevices.getUserMedia(Object.assign({video:true,audio:false},e))];case 2:t=n.sent();this.initStream(t);return[3,4];case 3:i=n.sent();this.deviceError=i;this.handleNoDeviceError&&this.handleNoDeviceError(i);return[3,4];case 4:return[2]}}))}))};e.prototype.initStream=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:this.stream=e;this.videoElement.srcObject=e;if(!this.hasImageCapture())return[3,2];this.imageCapture=new window.ImageCapture(e.getVideoTracks()[0]);return[4,this.initPhotoCapabilities(this.imageCapture)];case 1:t.sent();return[3,3];case 2:this.deviceError="No image capture";this.handleNoDeviceError&&this.handleNoDeviceError();t.label=3;case 3:forceUpdate(this.el);return[2]}}))}))};e.prototype.initPhotoCapabilities=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(i){switch(i.label){case 0:return[4,e.getPhotoCapabilities()];case 1:t=i.sent();if(t.fillLightMode&&t.fillLightMode.length>1){this.flashModes=t.fillLightMode.map((function(e){return e}));if(this.flashMode){this.flashMode=this.flashModes[this.flashModes.indexOf(this.flashMode)]||"off";this.flashIndex=this.flashModes.indexOf(this.flashMode)||0}else{this.flashIndex=0}}return[2]}}))}))};e.prototype.stopStream=function(){if(this.videoElement){this.videoElement.srcObject=null}this.stream&&this.stream.getTracks().forEach((function(e){return e.stop()}))};e.prototype.capture=function(){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(i){switch(i.label){case 0:if(!this.hasImageCapture())return[3,5];i.label=1;case 1:i.trys.push([1,4,,5]);return[4,this.imageCapture.takePhoto({fillLightMode:this.flashModes.length>1?this.flashMode:undefined})];case 2:e=i.sent();return[4,this.flashScreen()];case 3:i.sent();this.promptAccept(e);return[3,5];case 4:t=i.sent();console.error("Unable to take photo!",t);return[3,5];case 5:this.stopStream();return[2]}}))}))};e.prototype.promptAccept=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(i){switch(i.label){case 0:this.photo=e;return[4,this.getOrientation(e)];case 1:t=i.sent();console.debug("Got orientation",t);this.photoOrientation=t;if(t){switch(t){case 1:case 2:this.rotation=0;break;case 3:case 4:this.rotation=180;break;case 5:case 6:this.rotation=90;break;case 7:case 8:this.rotation=270;break}}this.photoSrc=URL.createObjectURL(e);return[2]}}))}))};e.prototype.getOrientation=function(e){return new Promise((function(t){var i=new FileReader;i.onload=function(e){var i=new DataView(e.target.result);if(i.getUint16(0,false)!==65496){return t(-2)}var n=i.byteLength;var r=2;while(r<n){var a=i.getUint16(r,false);r+=2;if(a===65505){if(i.getUint32(r+=2,false)!==1165519206){return t(-1)}var o=i.getUint16(r+=6,false)===18761;r+=i.getUint32(r+4,o);var s=i.getUint16(r,o);r+=2;for(var c=0;c<s;c++){if(i.getUint16(r+c*12,o)===274){return t(i.getUint16(r+c*12+8,o))}}}else if((a&65280)!==65280){break}else{r+=i.getUint16(r,false)}}return t(-1)};i.readAsArrayBuffer(e.slice(0,64*1024))}))};e.prototype.rotate=function(){this.stopStream();var e=this.stream&&this.stream.getTracks()[0];if(!e){return}var t=e.getConstraints();var i=t.facingMode;if(!i){var n=e.getCapabilities();if(n.facingMode){i=n.facingMode[0]}}if(i==="environment"){this.initCamera({video:{facingMode:"user"}})}else{this.initCamera({video:{facingMode:"environment"}})}};e.prototype.setFlashMode=function(e){console.debug("New flash mode: ",e);this.flashMode=e};e.prototype.cycleFlash=function(){if(this.flashModes.length>0){this.flashIndex=(this.flashIndex+1)%this.flashModes.length;this.setFlashMode(this.flashModes[this.flashIndex])}};e.prototype.flashScreen=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){return[2,new Promise((function(t,i){e.showShutterOverlay=true;setTimeout((function(){e.showShutterOverlay=false;t()}),100)}))]}))}))};e.prototype.iconExit=function(){return"data:image/svg+xml,%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512 512' enable-background='new 0 0 512 512' xml:space='preserve'%3E%3Cg id='Icon_5_'%3E%3Cg%3E%3Cpath fill='%23FFFFFF' d='M402.2,134L378,109.8c-1.6-1.6-4.1-1.6-5.7,0L258.8,223.4c-1.6,1.6-4.1,1.6-5.7,0L139.6,109.8 c-1.6-1.6-4.1-1.6-5.7,0L109.8,134c-1.6,1.6-1.6,4.1,0,5.7l113.5,113.5c1.6,1.6,1.6,4.1,0,5.7L109.8,372.4c-1.6,1.6-1.6,4.1,0,5.7 l24.1,24.1c1.6,1.6,4.1,1.6,5.7,0l113.5-113.5c1.6-1.6,4.1-1.6,5.7,0l113.5,113.5c1.6,1.6,4.1,1.6,5.7,0l24.1-24.1 c1.6-1.6,1.6-4.1,0-5.7L288.6,258.8c-1.6-1.6-1.6-4.1,0-5.7l113.5-113.5C403.7,138.1,403.7,135.5,402.2,134z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"};e.prototype.iconPhotos=function(){return h("svg",{xmlns:"http://www.w3.org/2000/svg",width:"512",height:"512",viewBox:"0 0 512 512"},h("path",{d:"M450.29,112H142c-34,0-62,27.51-62,61.33V418.67C80,452.49,108,480,142,480H450c34,0,62-26.18,62-60V173.33C512,139.51,484.32,112,450.29,112Zm-77.15,61.34a46,46,0,1,1-46.28,46A46.19,46.19,0,0,1,373.14,173.33Zm-231.55,276c-17,0-29.86-13.75-29.86-30.66V353.85l90.46-80.79a46.54,46.54,0,0,1,63.44,1.83L328.27,337l-113,112.33ZM480,418.67a30.67,30.67,0,0,1-30.71,30.66H259L376.08,333a46.24,46.24,0,0,1,59.44-.16L480,370.59Z"}),h("path",{d:"M384,32H64A64,64,0,0,0,0,96V352a64.11,64.11,0,0,0,48,62V152a72,72,0,0,1,72-72H446A64.11,64.11,0,0,0,384,32Z"}))};e.prototype.iconConfirm=function(){return"data:image/svg+xml,%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512 512' enable-background='new 0 0 512 512' xml:space='preserve'%3E%3Ccircle fill='%232CD865' cx='256' cy='256' r='256'/%3E%3Cg id='Icon_1_'%3E%3Cg%3E%3Cg%3E%3Cpath fill='%23FFFFFF' d='M208,301.4l-55.4-55.5c-1.5-1.5-4-1.6-5.6-0.1l-23.4,22.3c-1.6,1.6-1.7,4.1-0.1,5.7l81.6,81.4 c3.1,3.1,8.2,3.1,11.3,0l171.8-171.7c1.6-1.6,1.6-4.2-0.1-5.7l-23.4-22.3c-1.6-1.5-4.1-1.5-5.6,0.1L213.7,301.4 C212.1,303,209.6,303,208,301.4z'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E"};e.prototype.iconReverseCamera=function(){return"data:image/svg+xml,%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512 512' enable-background='new 0 0 512 512' xml:space='preserve'%3E%3Cg%3E%3Cpath fill='%23FFFFFF' d='M352,0H160C72,0,0,72,0,160v192c0,88,72,160,160,160h192c88,0,160-72,160-160V160C512,72,440,0,352,0z M356.7,365.8l-3.7,3.3c-27,23.2-61.4,35.9-96.8,35.9c-72.4,0-135.8-54.7-147-125.6c-0.3-1.9-2-3.3-3.9-3.3H64 c-3.3,0-5.2-3.8-3.2-6.4l61.1-81.4c1.6-2.1,4.7-2.1,6.4-0.1l63.3,81.4c2,2.6,0.2,6.5-3.2,6.5h-40.6c-2.5,0-4.5,2.4-3.9,4.8 c11.5,51.5,59.2,90.6,112.4,90.6c26.4,0,51.8-9.7,73.7-27.9l3.1-2.5c1.6-1.3,3.9-1.1,5.3,0.3l18.5,18.6 C358.5,361.6,358.4,364.3,356.7,365.8z M451.4,245.6l-61,83.5c-1.6,2.2-4.8,2.2-6.4,0.1l-63.3-83.3c-2-2.6-0.1-6.4,3.2-6.4h40.8 c2.5,0,4.4-2.3,3.9-4.8c-5.1-24.2-17.8-46.5-36.5-63.7c-21.2-19.4-48.2-30.1-76-30.1c-26.5,0-52.6,9.7-73.7,27.3l-3.1,2.5 c-1.6,1.3-3.9,1.2-5.4-0.3l-18.5-18.5c-1.6-1.6-1.5-4.3,0.2-5.9l3.5-3.1c27-23.2,61.4-35.9,96.8-35.9c38,0,73.9,13.7,101.2,38.7 c23.2,21.1,40.3,55.2,45.7,90.1c0.3,1.9,1.9,3.4,3.9,3.4h41.3C451.4,239.2,453.3,243,451.4,245.6z'/%3E%3C/g%3E%3C/svg%3E"};e.prototype.iconRetake=function(){return"data:image/svg+xml,%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512 512' enable-background='new 0 0 512 512' xml:space='preserve'%3E%3Ccircle fill='%23727A87' cx='256' cy='256' r='256'/%3E%3Cg id='Icon_5_'%3E%3Cg%3E%3Cpath fill='%23FFFFFF' d='M394.2,142L370,117.8c-1.6-1.6-4.1-1.6-5.7,0L258.8,223.4c-1.6,1.6-4.1,1.6-5.7,0L147.6,117.8 c-1.6-1.6-4.1-1.6-5.7,0L117.8,142c-1.6,1.6-1.6,4.1,0,5.7l105.5,105.5c1.6,1.6,1.6,4.1,0,5.7L117.8,364.4c-1.6,1.6-1.6,4.1,0,5.7 l24.1,24.1c1.6,1.6,4.1,1.6,5.7,0l105.5-105.5c1.6-1.6,4.1-1.6,5.7,0l105.5,105.5c1.6,1.6,4.1,1.6,5.7,0l24.1-24.1 c1.6-1.6,1.6-4.1,0-5.7L288.6,258.8c-1.6-1.6-1.6-4.1,0-5.7l105.5-105.5C395.7,146.1,395.7,143.5,394.2,142z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"};e.prototype.iconFlashOff=function(){return"data:image/svg+xml,%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512 512' style='enable-background:new 0 0 512 512;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%23FFFFFF;%7D%0A%3C/style%3E%3Cg%3E%3Cpath class='st0' d='M498,483.7L42.3,28L14,56.4l149.8,149.8L91,293.8c-2.5,3-0.1,7.2,3.9,7.2h143.9c1.6,0,2.7,1.3,2.4,2.7 L197.6,507c-1,4.4,5.8,6.9,8.9,3.2l118.6-142.8L469.6,512L498,483.7z'/%3E%3Cpath class='st0' d='M449,218.2c2.5-3,0.1-7.2-3.9-7.2H301.2c-1.6,0-2.7-1.3-2.4-2.7L342.4,5c1-4.4-5.8-6.9-8.9-3.2L214.9,144.6 l161.3,161.3L449,218.2z'/%3E%3C/g%3E%3C/svg%3E"};e.prototype.iconFlashOn=function(){return"data:image/svg+xml,%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512 512' style='enable-background:new 0 0 512 512;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%23FFFFFF;%7D%0A%3C/style%3E%3Cpath class='st0' d='M287.2,211c-1.6,0-2.7-1.3-2.4-2.7L328.4,5c1-4.4-5.8-6.9-8.9-3.2L77,293.8c-2.5,3-0.1,7.2,3.9,7.2h143.9 c1.6,0,2.7,1.3,2.4,2.7L183.6,507c-1,4.4,5.8,6.9,8.9,3.2l242.5-292c2.5-3,0.1-7.2-3.9-7.2L287.2,211L287.2,211z'/%3E%3C/svg%3E"};e.prototype.iconFlashAuto=function(){return"data:image/svg+xml,%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512 512' style='enable-background:new 0 0 512 512;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%23FFFFFF;%7D%0A%3C/style%3E%3Cpath class='st0' d='M287.2,211c-1.6,0-2.7-1.3-2.4-2.7L328.4,5c1-4.4-5.8-6.9-8.9-3.2L77,293.8c-2.5,3-0.1,7.2,3.9,7.2h143.9 c1.6,0,2.7,1.3,2.4,2.7L183.6,507c-1,4.4,5.8,6.9,8.9,3.2l242.5-292c2.5-3,0.1-7.2-3.9-7.2L287.2,211L287.2,211z'/%3E%3Cg%3E%3Cpath class='st0' d='M321.3,186l74-186H438l74,186h-43.5l-11.9-32.5h-80.9l-12,32.5H321.3z M415.8,47.9l-27.2,70.7h54.9l-27.2-70.7 H415.8z'/%3E%3C/g%3E%3C/svg%3E"};e.prototype.render=function(){var e=this;var t={};return h("div",{class:"camera-wrapper"},h("div",{class:"camera-header"},h("section",{class:"items"},h("div",{class:"item close",onClick:function(t){return e.handleClose(t)}},h("img",{src:this.iconExit()})),h("div",{class:"item flash",onClick:function(t){return e.handleFlashClick(t)}},this.flashModes.length>0&&h("div",null,this.flashMode=="off"?h("img",{src:this.iconFlashOff()}):"",this.flashMode=="auto"?h("img",{src:this.iconFlashAuto()}):"",this.flashMode=="flash"?h("img",{src:this.iconFlashOn()}):"")))),(this.hasCamera===false||!!this.deviceError)&&h("div",{class:"no-device"},h("h2",null,this.noDevicesText),h("label",{htmlFor:"_pwa-elements-camera-input"},this.noDevicesButtonText),h("input",{type:"file",id:"_pwa-elements-camera-input",onChange:this.handleFileInputChange,accept:"image/*",class:"select-file-button"})),this.photoSrc?h("div",{class:"accept"},h("div",{class:"accept-image",style:Object.assign({backgroundImage:"url(".concat(this.photoSrc,")")},t)})):h("div",{class:"camera-video"},this.showShutterOverlay&&h("div",{class:"shutter-overlay"}),this.hasImageCapture()?h("video",{ref:function(t){return e.videoElement=t},onLoadedMetaData:this.handleVideoMetadata,autoplay:true,playsinline:true}):h("canvas",{ref:function(t){return e.canvasElement=t},width:"100%",height:"100%"}),h("canvas",{class:"offscreen-image-render",ref:function(t){return e.offscreenCanvas=t},width:"100%",height:"100%"})),this.hasCamera&&h("div",{class:"camera-footer"},!this.photo?[h("div",{class:"pick-image",onClick:this.handlePickFile},h("label",{htmlFor:"_pwa-elements-file-pick"},this.iconPhotos()),h("input",{type:"file",id:"_pwa-elements-file-pick",onChange:this.handleFileInputChange,accept:"image/*",class:"pick-image-button"})),h("div",{class:"shutter",onClick:this.handleShutterClick},h("div",{class:"shutter-button"})),h("div",{class:"rotate",onClick:this.handleRotateClick},h("img",{src:this.iconReverseCamera()}))]:h("section",{class:"items"},h("div",{class:"item accept-cancel",onClick:function(t){return e.handleCancelPhoto(t)}},h("img",{src:this.iconRetake()})),h("div",{class:"item accept-use",onClick:function(t){return e.handleAcceptPhoto(t)}},h("img",{src:this.iconConfirm()})))))};Object.defineProperty(e,"assetsDirs",{get:function(){return["icons"]},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();CameraPWA.style=cameraCss;export{CameraPWA as pwa_camera}; | ||
*/var ImageCapture=window.ImageCapture;if(typeof ImageCapture==="undefined"){ImageCapture=function(){function e(e){var t=this;if(e.kind!=="video")throw new DOMException("NotSupportedError");this._videoStreamTrack=e;if(!("readyState"in this._videoStreamTrack)){this._videoStreamTrack.readyState="live"}this._previewStream=new MediaStream([e]);this.videoElement=document.createElement("video");this.videoElementPlaying=new Promise((function(e){t.videoElement.addEventListener("playing",e)}));if(HTMLMediaElement){this.videoElement.srcObject=this._previewStream}else{this.videoElement.src=URL.createObjectURL(this._previewStream)}this.videoElement.muted=true;this.videoElement.setAttribute("playsinline","");this.videoElement.play();this.canvasElement=document.createElement("canvas");this.canvas2dContext=this.canvasElement.getContext("2d")}Object.defineProperty(e.prototype,"videoStreamTrack",{get:function(){return this._videoStreamTrack},enumerable:false,configurable:true});e.prototype.getPhotoCapabilities=function(){return new Promise((function e(t,i){var n={current:0,min:0,max:0};t({exposureCompensation:n,exposureMode:"none",fillLightMode:["none"],focusMode:"none",imageHeight:n,imageWidth:n,iso:n,redEyeReduction:false,whiteBalanceMode:"none",zoom:n});i(new DOMException("OperationError"))}))};e.prototype.setOptions=function(e){if(e===void 0){e={}}return new Promise((function e(t,i){}))};e.prototype.takePhoto=function(){var e=this;return new Promise((function t(i,n){if(e._videoStreamTrack.readyState!=="live"){return n(new DOMException("InvalidStateError"))}e.videoElementPlaying.then((function(){try{e.canvasElement.width=e.videoElement.videoWidth;e.canvasElement.height=e.videoElement.videoHeight;e.canvas2dContext.drawImage(e.videoElement,0,0);e.canvasElement.toBlob(i)}catch(e){n(new DOMException("UnknownError"))}}))}))};e.prototype.grabFrame=function(){var e=this;return new Promise((function t(i,n){if(e._videoStreamTrack.readyState!=="live"){return n(new DOMException("InvalidStateError"))}e.videoElementPlaying.then((function(){try{e.canvasElement.width=e.videoElement.videoWidth;e.canvasElement.height=e.videoElement.videoHeight;e.canvas2dContext.drawImage(e.videoElement,0,0);i(window.createImageBitmap(e.canvasElement))}catch(e){n(new DOMException("UnknownError"))}}))}))};return e}()}window.ImageCapture=ImageCapture;var cameraCss=":host{--header-height:4em;--footer-height:9em;--header-height-landscape:3em;--footer-height-landscape:6em;--shutter-size:6em;--icon-size-header:1.5em;--icon-size-footer:2.5em;--margin-size-header:1.5em;--margin-size-footer:2.0em;font-family:-apple-system, BlinkMacSystemFont,\n “Segoe UI”, “Roboto”, “Droid Sans”, “Helvetica Neue”, sans-serif;display:block;width:100%;height:100%}.items{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;width:100%;height:100%;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.items .item{-ms-flex:1;flex:1;text-align:center}.items .item:first-child{text-align:left}.items .item:last-child{text-align:right}.camera-wrapper{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:100%;height:100%}.camera-header{color:white;background-color:black;height:var(--header-height)}.camera-header .items{padding:var(--margin-size-header)}.camera-footer{position:relative;color:white;background-color:black;height:var(--footer-height)}.camera-footer .items{padding:var(--margin-size-footer)}@media (max-height: 375px){.camera-header{--header-height:var(--header-height-landscape)}.camera-footer{--footer-height:var(--footer-height-landscape)}.camera-footer .shutter{--shutter-size:4em}}.camera-video{position:relative;-ms-flex:1;flex:1;overflow:hidden;background-color:black}video{width:100%;height:100%;max-height:100%;min-height:100%;-o-object-fit:cover;object-fit:cover;background-color:black}.pick-image{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;position:absolute;left:var(--margin-size-footer);top:0;height:100%;width:var(--icon-size-footer);color:white}.pick-image input{visibility:hidden}.pick-image svg{cursor:pointer;fill:white;width:var(--icon-size-footer);height:var(--icon-size-footer)}.shutter{position:absolute;left:50%;top:50%;width:var(--shutter-size);height:var(--shutter-size);margin-top:calc(var(--shutter-size) / -2);margin-left:calc(var(--shutter-size) / -2);border-radius:100%;background-color:#c6cdd8;padding:12px;-webkit-box-sizing:border-box;box-sizing:border-box}.shutter:active .shutter-button{background-color:#9da9bb}.shutter-button{background-color:white;border-radius:100%;width:100%;height:100%}.rotate{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;position:absolute;right:var(--margin-size-footer);top:0;height:100%;width:var(--icon-size-footer);color:white}.rotate img{width:var(--icon-size-footer);height:var(--icon-size-footer)}.shutter-overlay{z-index:5;position:absolute;width:100%;height:100%;background-color:black}.error{width:100%;height:100%;color:white;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}.no-device{background-color:black;-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;color:white}.no-device label{cursor:pointer;background:#fff;border-radius:6px;padding:6px 8px;color:black}.no-device input{visibility:hidden;height:0;margin-top:16px}.accept{background-color:black;-ms-flex:1;flex:1;overflow:hidden}.accept .accept-image{width:100%;height:100%;max-height:100%;background-position:center center;background-size:cover;background-repeat:no-repeat}.close img{cursor:pointer;width:var(--icon-size-header);height:var(--icon-size-header)}.flash img{width:var(--icon-size-header);height:var(--icon-size-header)}.accept-use img{width:var(--icon-size-footer);height:var(--icon-size-footer)}.accept-cancel img{width:var(--icon-size-footer);height:var(--icon-size-footer)}.offscreen-image-render{top:0;left:0;visibility:hidden;pointer-events:none;width:100%;height:100%}";var CameraPWA=function(){function e(e){var t=this;registerInstance(this,e);this.hasMultipleCameras=false;this.hasFlash=false;this.flashModes=[];this.flashMode="off";this.handlePickFile=function(e){};this.handleShutterClick=function(e){console.debug("shutter click");t.capture()};this.handleRotateClick=function(e){t.rotate()};this.handleClose=function(e){t.handlePhoto&&t.handlePhoto(null)};this.handleFlashClick=function(e){t.cycleFlash()};this.handleCancelPhoto=function(e){var i=t.stream&&t.stream.getTracks()[0];var n=i&&i.getConstraints();t.photo=null;t.photoSrc=null;if(n){t.initCamera({video:{facingMode:n.facingMode}})}else{t.initCamera()}};this.handleAcceptPhoto=function(e){t.handlePhoto&&t.handlePhoto(t.photo)};this.handleFileInputChange=function(e){return __awaiter(t,void 0,void 0,(function(){var t,i,n,r;return __generator(this,(function(a){switch(a.label){case 0:t=e.target;i=t.files[0];a.label=1;case 1:a.trys.push([1,3,,4]);return[4,this.getOrientation(i)];case 2:n=a.sent();console.debug("Got orientation",n);this.photoOrientation=n;return[3,4];case 3:r=a.sent();return[3,4];case 4:this.handlePhoto&&this.handlePhoto(i);return[2]}}))}))};this.handleVideoMetadata=function(e){console.debug("Video metadata",e)};this.facingMode="user";this.handlePhoto=undefined;this.hidePicker=false;this.handleNoDeviceError=undefined;this.noDevicesText="No camera found";this.noDevicesButtonText="Choose image";this.photo=undefined;this.photoSrc=undefined;this.showShutterOverlay=false;this.flashIndex=0;this.hasCamera=null;this.rotation=0;this.deviceError=null}e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:this.defaultConstraints={video:{facingMode:this.facingMode}};return[4,this.queryDevices()];case 1:e.sent();return[4,this.initCamera()];case 2:e.sent();return[2]}}))}))};e.prototype.disconnectedCallback=function(){this.stopStream();this.photoSrc&&URL.revokeObjectURL(this.photoSrc)};e.prototype.hasImageCapture=function(){return"ImageCapture"in window};e.prototype.queryDevices=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,navigator.mediaDevices.enumerateDevices()];case 1:e=n.sent();t=e.filter((function(e){return e.kind=="videoinput"}));this.hasCamera=!!t.length;this.hasMultipleCameras=t.length>1;return[3,3];case 2:i=n.sent();this.deviceError=i;return[3,3];case 3:return[2]}}))}))};e.prototype.initCamera=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(n){switch(n.label){case 0:if(!e){e=this.defaultConstraints}n.label=1;case 1:n.trys.push([1,3,,4]);return[4,navigator.mediaDevices.getUserMedia(Object.assign({video:true,audio:false},e))];case 2:t=n.sent();this.initStream(t);return[3,4];case 3:i=n.sent();this.deviceError=i;this.handleNoDeviceError&&this.handleNoDeviceError(i);return[3,4];case 4:return[2]}}))}))};e.prototype.initStream=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:this.stream=e;this.videoElement.srcObject=e;if(!this.hasImageCapture())return[3,2];this.imageCapture=new window.ImageCapture(e.getVideoTracks()[0]);return[4,this.initPhotoCapabilities(this.imageCapture)];case 1:t.sent();return[3,3];case 2:this.deviceError="No image capture";this.handleNoDeviceError&&this.handleNoDeviceError();t.label=3;case 3:forceUpdate(this.el);return[2]}}))}))};e.prototype.initPhotoCapabilities=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(i){switch(i.label){case 0:return[4,e.getPhotoCapabilities()];case 1:t=i.sent();if(t.fillLightMode&&t.fillLightMode.length>1){this.flashModes=t.fillLightMode.map((function(e){return e}));if(this.flashMode){this.flashMode=this.flashModes[this.flashModes.indexOf(this.flashMode)]||"off";this.flashIndex=this.flashModes.indexOf(this.flashMode)||0}else{this.flashIndex=0}}return[2]}}))}))};e.prototype.stopStream=function(){if(this.videoElement){this.videoElement.srcObject=null}this.stream&&this.stream.getTracks().forEach((function(e){return e.stop()}))};e.prototype.capture=function(){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(i){switch(i.label){case 0:if(!this.hasImageCapture())return[3,5];i.label=1;case 1:i.trys.push([1,4,,5]);return[4,this.imageCapture.takePhoto({fillLightMode:this.flashModes.length>1?this.flashMode:undefined})];case 2:e=i.sent();return[4,this.flashScreen()];case 3:i.sent();this.promptAccept(e);return[3,5];case 4:t=i.sent();console.error("Unable to take photo!",t);return[3,5];case 5:this.stopStream();return[2]}}))}))};e.prototype.promptAccept=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(i){switch(i.label){case 0:this.photo=e;return[4,this.getOrientation(e)];case 1:t=i.sent();console.debug("Got orientation",t);this.photoOrientation=t;if(t){switch(t){case 1:case 2:this.rotation=0;break;case 3:case 4:this.rotation=180;break;case 5:case 6:this.rotation=90;break;case 7:case 8:this.rotation=270;break}}this.photoSrc=URL.createObjectURL(e);return[2]}}))}))};e.prototype.getOrientation=function(e){return new Promise((function(t){var i=new FileReader;i.onload=function(e){var i=new DataView(e.target.result);if(i.getUint16(0,false)!==65496){return t(-2)}var n=i.byteLength;var r=2;while(r<n){var a=i.getUint16(r,false);r+=2;if(a===65505){if(i.getUint32(r+=2,false)!==1165519206){return t(-1)}var o=i.getUint16(r+=6,false)===18761;r+=i.getUint32(r+4,o);var s=i.getUint16(r,o);r+=2;for(var c=0;c<s;c++){if(i.getUint16(r+c*12,o)===274){return t(i.getUint16(r+c*12+8,o))}}}else if((a&65280)!==65280){break}else{r+=i.getUint16(r,false)}}return t(-1)};i.readAsArrayBuffer(e.slice(0,64*1024))}))};e.prototype.rotate=function(){this.stopStream();var e=this.stream&&this.stream.getTracks()[0];if(!e){return}var t=e.getConstraints();var i=t.facingMode;if(!i){var n=e.getCapabilities();if(n.facingMode){i=n.facingMode[0]}}if(i==="environment"){this.initCamera({video:{facingMode:"user"}})}else{this.initCamera({video:{facingMode:"environment"}})}};e.prototype.setFlashMode=function(e){console.debug("New flash mode: ",e);this.flashMode=e};e.prototype.cycleFlash=function(){if(this.flashModes.length>0){this.flashIndex=(this.flashIndex+1)%this.flashModes.length;this.setFlashMode(this.flashModes[this.flashIndex])}};e.prototype.flashScreen=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){return[2,new Promise((function(t,i){e.showShutterOverlay=true;setTimeout((function(){e.showShutterOverlay=false;t()}),100)}))]}))}))};e.prototype.iconExit=function(){return"data:image/svg+xml,%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512 512' enable-background='new 0 0 512 512' xml:space='preserve'%3E%3Cg id='Icon_5_'%3E%3Cg%3E%3Cpath fill='%23FFFFFF' d='M402.2,134L378,109.8c-1.6-1.6-4.1-1.6-5.7,0L258.8,223.4c-1.6,1.6-4.1,1.6-5.7,0L139.6,109.8 c-1.6-1.6-4.1-1.6-5.7,0L109.8,134c-1.6,1.6-1.6,4.1,0,5.7l113.5,113.5c1.6,1.6,1.6,4.1,0,5.7L109.8,372.4c-1.6,1.6-1.6,4.1,0,5.7 l24.1,24.1c1.6,1.6,4.1,1.6,5.7,0l113.5-113.5c1.6-1.6,4.1-1.6,5.7,0l113.5,113.5c1.6,1.6,4.1,1.6,5.7,0l24.1-24.1 c1.6-1.6,1.6-4.1,0-5.7L288.6,258.8c-1.6-1.6-1.6-4.1,0-5.7l113.5-113.5C403.7,138.1,403.7,135.5,402.2,134z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"};e.prototype.iconPhotos=function(){return h("svg",{xmlns:"http://www.w3.org/2000/svg",width:"512",height:"512",viewBox:"0 0 512 512"},h("path",{d:"M450.29,112H142c-34,0-62,27.51-62,61.33V418.67C80,452.49,108,480,142,480H450c34,0,62-26.18,62-60V173.33C512,139.51,484.32,112,450.29,112Zm-77.15,61.34a46,46,0,1,1-46.28,46A46.19,46.19,0,0,1,373.14,173.33Zm-231.55,276c-17,0-29.86-13.75-29.86-30.66V353.85l90.46-80.79a46.54,46.54,0,0,1,63.44,1.83L328.27,337l-113,112.33ZM480,418.67a30.67,30.67,0,0,1-30.71,30.66H259L376.08,333a46.24,46.24,0,0,1,59.44-.16L480,370.59Z"}),h("path",{d:"M384,32H64A64,64,0,0,0,0,96V352a64.11,64.11,0,0,0,48,62V152a72,72,0,0,1,72-72H446A64.11,64.11,0,0,0,384,32Z"}))};e.prototype.iconConfirm=function(){return"data:image/svg+xml,%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512 512' enable-background='new 0 0 512 512' xml:space='preserve'%3E%3Ccircle fill='%232CD865' cx='256' cy='256' r='256'/%3E%3Cg id='Icon_1_'%3E%3Cg%3E%3Cg%3E%3Cpath fill='%23FFFFFF' d='M208,301.4l-55.4-55.5c-1.5-1.5-4-1.6-5.6-0.1l-23.4,22.3c-1.6,1.6-1.7,4.1-0.1,5.7l81.6,81.4 c3.1,3.1,8.2,3.1,11.3,0l171.8-171.7c1.6-1.6,1.6-4.2-0.1-5.7l-23.4-22.3c-1.6-1.5-4.1-1.5-5.6,0.1L213.7,301.4 C212.1,303,209.6,303,208,301.4z'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E"};e.prototype.iconReverseCamera=function(){return"data:image/svg+xml,%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512 512' enable-background='new 0 0 512 512' xml:space='preserve'%3E%3Cg%3E%3Cpath fill='%23FFFFFF' d='M352,0H160C72,0,0,72,0,160v192c0,88,72,160,160,160h192c88,0,160-72,160-160V160C512,72,440,0,352,0z M356.7,365.8l-3.7,3.3c-27,23.2-61.4,35.9-96.8,35.9c-72.4,0-135.8-54.7-147-125.6c-0.3-1.9-2-3.3-3.9-3.3H64 c-3.3,0-5.2-3.8-3.2-6.4l61.1-81.4c1.6-2.1,4.7-2.1,6.4-0.1l63.3,81.4c2,2.6,0.2,6.5-3.2,6.5h-40.6c-2.5,0-4.5,2.4-3.9,4.8 c11.5,51.5,59.2,90.6,112.4,90.6c26.4,0,51.8-9.7,73.7-27.9l3.1-2.5c1.6-1.3,3.9-1.1,5.3,0.3l18.5,18.6 C358.5,361.6,358.4,364.3,356.7,365.8z M451.4,245.6l-61,83.5c-1.6,2.2-4.8,2.2-6.4,0.1l-63.3-83.3c-2-2.6-0.1-6.4,3.2-6.4h40.8 c2.5,0,4.4-2.3,3.9-4.8c-5.1-24.2-17.8-46.5-36.5-63.7c-21.2-19.4-48.2-30.1-76-30.1c-26.5,0-52.6,9.7-73.7,27.3l-3.1,2.5 c-1.6,1.3-3.9,1.2-5.4-0.3l-18.5-18.5c-1.6-1.6-1.5-4.3,0.2-5.9l3.5-3.1c27-23.2,61.4-35.9,96.8-35.9c38,0,73.9,13.7,101.2,38.7 c23.2,21.1,40.3,55.2,45.7,90.1c0.3,1.9,1.9,3.4,3.9,3.4h41.3C451.4,239.2,453.3,243,451.4,245.6z'/%3E%3C/g%3E%3C/svg%3E"};e.prototype.iconRetake=function(){return"data:image/svg+xml,%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512 512' enable-background='new 0 0 512 512' xml:space='preserve'%3E%3Ccircle fill='%23727A87' cx='256' cy='256' r='256'/%3E%3Cg id='Icon_5_'%3E%3Cg%3E%3Cpath fill='%23FFFFFF' d='M394.2,142L370,117.8c-1.6-1.6-4.1-1.6-5.7,0L258.8,223.4c-1.6,1.6-4.1,1.6-5.7,0L147.6,117.8 c-1.6-1.6-4.1-1.6-5.7,0L117.8,142c-1.6,1.6-1.6,4.1,0,5.7l105.5,105.5c1.6,1.6,1.6,4.1,0,5.7L117.8,364.4c-1.6,1.6-1.6,4.1,0,5.7 l24.1,24.1c1.6,1.6,4.1,1.6,5.7,0l105.5-105.5c1.6-1.6,4.1-1.6,5.7,0l105.5,105.5c1.6,1.6,4.1,1.6,5.7,0l24.1-24.1 c1.6-1.6,1.6-4.1,0-5.7L288.6,258.8c-1.6-1.6-1.6-4.1,0-5.7l105.5-105.5C395.7,146.1,395.7,143.5,394.2,142z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"};e.prototype.iconFlashOff=function(){return"data:image/svg+xml,%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512 512' style='enable-background:new 0 0 512 512;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%23FFFFFF;%7D%0A%3C/style%3E%3Cg%3E%3Cpath class='st0' d='M498,483.7L42.3,28L14,56.4l149.8,149.8L91,293.8c-2.5,3-0.1,7.2,3.9,7.2h143.9c1.6,0,2.7,1.3,2.4,2.7 L197.6,507c-1,4.4,5.8,6.9,8.9,3.2l118.6-142.8L469.6,512L498,483.7z'/%3E%3Cpath class='st0' d='M449,218.2c2.5-3,0.1-7.2-3.9-7.2H301.2c-1.6,0-2.7-1.3-2.4-2.7L342.4,5c1-4.4-5.8-6.9-8.9-3.2L214.9,144.6 l161.3,161.3L449,218.2z'/%3E%3C/g%3E%3C/svg%3E"};e.prototype.iconFlashOn=function(){return"data:image/svg+xml,%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512 512' style='enable-background:new 0 0 512 512;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%23FFFFFF;%7D%0A%3C/style%3E%3Cpath class='st0' d='M287.2,211c-1.6,0-2.7-1.3-2.4-2.7L328.4,5c1-4.4-5.8-6.9-8.9-3.2L77,293.8c-2.5,3-0.1,7.2,3.9,7.2h143.9 c1.6,0,2.7,1.3,2.4,2.7L183.6,507c-1,4.4,5.8,6.9,8.9,3.2l242.5-292c2.5-3,0.1-7.2-3.9-7.2L287.2,211L287.2,211z'/%3E%3C/svg%3E"};e.prototype.iconFlashAuto=function(){return"data:image/svg+xml,%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 512 512' style='enable-background:new 0 0 512 512;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%23FFFFFF;%7D%0A%3C/style%3E%3Cpath class='st0' d='M287.2,211c-1.6,0-2.7-1.3-2.4-2.7L328.4,5c1-4.4-5.8-6.9-8.9-3.2L77,293.8c-2.5,3-0.1,7.2,3.9,7.2h143.9 c1.6,0,2.7,1.3,2.4,2.7L183.6,507c-1,4.4,5.8,6.9,8.9,3.2l242.5-292c2.5-3,0.1-7.2-3.9-7.2L287.2,211L287.2,211z'/%3E%3Cg%3E%3Cpath class='st0' d='M321.3,186l74-186H438l74,186h-43.5l-11.9-32.5h-80.9l-12,32.5H321.3z M415.8,47.9l-27.2,70.7h54.9l-27.2-70.7 H415.8z'/%3E%3C/g%3E%3C/svg%3E"};e.prototype.render=function(){var e=this;var t={};return h("div",{class:"camera-wrapper"},h("div",{class:"camera-header"},h("section",{class:"items"},h("div",{class:"item close",onClick:function(t){return e.handleClose(t)}},h("img",{src:this.iconExit()})),h("div",{class:"item flash",onClick:function(t){return e.handleFlashClick(t)}},this.flashModes.length>0&&h("div",null,this.flashMode=="off"?h("img",{src:this.iconFlashOff()}):"",this.flashMode=="auto"?h("img",{src:this.iconFlashAuto()}):"",this.flashMode=="flash"?h("img",{src:this.iconFlashOn()}):"")))),(this.hasCamera===false||!!this.deviceError)&&h("div",{class:"no-device"},h("h2",null,this.noDevicesText),h("label",{htmlFor:"_pwa-elements-camera-input"},this.noDevicesButtonText),h("input",{type:"file",id:"_pwa-elements-camera-input",onChange:this.handleFileInputChange,accept:"image/*",class:"select-file-button"})),this.photoSrc?h("div",{class:"accept"},h("div",{class:"accept-image",style:Object.assign({backgroundImage:"url(".concat(this.photoSrc,")")},t)})):h("div",{class:"camera-video"},this.showShutterOverlay&&h("div",{class:"shutter-overlay"}),this.hasImageCapture()?h("video",{ref:function(t){return e.videoElement=t},onLoadedMetaData:this.handleVideoMetadata,autoplay:true,playsinline:true}):h("canvas",{ref:function(t){return e.canvasElement=t},width:"100%",height:"100%"}),h("canvas",{class:"offscreen-image-render",ref:function(t){return e.offscreenCanvas=t},width:"100%",height:"100%"})),this.hasCamera&&h("div",{class:"camera-footer"},!this.photo?[!this.hidePicker&&h("div",{class:"pick-image",onClick:this.handlePickFile},h("label",{htmlFor:"_pwa-elements-file-pick"},this.iconPhotos()),h("input",{type:"file",id:"_pwa-elements-file-pick",onChange:this.handleFileInputChange,accept:"image/*",class:"pick-image-button"})),h("div",{class:"shutter",onClick:this.handleShutterClick},h("div",{class:"shutter-button"})),h("div",{class:"rotate",onClick:this.handleRotateClick},h("img",{src:this.iconReverseCamera()}))]:h("section",{class:"items"},h("div",{class:"item accept-cancel",onClick:function(t){return e.handleCancelPhoto(t)}},h("img",{src:this.iconRetake()})),h("div",{class:"item accept-use",onClick:function(t){return e.handleAcceptPhoto(t)}},h("img",{src:this.iconConfirm()})))))};Object.defineProperty(e,"assetsDirs",{get:function(){return["icons"]},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();CameraPWA.style=cameraCss;export{CameraPWA as pwa_camera}; |
@@ -20,3 +20,3 @@ import { p as promiseResolve, b as bootstrapLazy } from './index-1c5c47b4.js'; | ||
patchBrowser().then(options => { | ||
return bootstrapLazy([["pwa-camera-modal",[[1,"pwa-camera-modal",{"facingMode":[1,"facing-mode"],"present":[64],"dismiss":[64]}]]],["pwa-action-sheet",[[1,"pwa-action-sheet",{"header":[1],"cancelable":[4],"options":[16],"open":[32]}]]],["pwa-toast",[[1,"pwa-toast",{"message":[1],"duration":[2],"closing":[32]}]]],["pwa-camera",[[1,"pwa-camera",{"facingMode":[1,"facing-mode"],"handlePhoto":[16],"handleNoDeviceError":[16],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"],"photo":[32],"photoSrc":[32],"showShutterOverlay":[32],"flashIndex":[32],"hasCamera":[32],"rotation":[32],"deviceError":[32]}]]],["pwa-camera-modal-instance",[[1,"pwa-camera-modal-instance",{"facingMode":[1,"facing-mode"],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]], options); | ||
return bootstrapLazy([["pwa-camera-modal",[[1,"pwa-camera-modal",{"facingMode":[1,"facing-mode"],"hidePicker":[4,"hide-picker"],"present":[64],"dismiss":[64]}]]],["pwa-action-sheet",[[1,"pwa-action-sheet",{"header":[1],"cancelable":[4],"options":[16],"open":[32]}]]],["pwa-toast",[[1,"pwa-toast",{"message":[1],"duration":[2],"closing":[32]}]]],["pwa-camera",[[1,"pwa-camera",{"facingMode":[1,"facing-mode"],"handlePhoto":[16],"hidePicker":[4,"hide-picker"],"handleNoDeviceError":[16],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"],"photo":[32],"photoSrc":[32],"showShutterOverlay":[32],"flashIndex":[32],"hasCamera":[32],"rotation":[32],"deviceError":[32]}]]],["pwa-camera-modal-instance",[[1,"pwa-camera-modal-instance",{"facingMode":[1,"facing-mode"],"hidePicker":[4,"hide-picker"],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]], options); | ||
}); |
@@ -14,3 +14,3 @@ import { p as promiseResolve, b as bootstrapLazy } from './index-1c5c47b4.js'; | ||
return patchEsm().then(() => { | ||
return bootstrapLazy([["pwa-camera-modal",[[1,"pwa-camera-modal",{"facingMode":[1,"facing-mode"],"present":[64],"dismiss":[64]}]]],["pwa-action-sheet",[[1,"pwa-action-sheet",{"header":[1],"cancelable":[4],"options":[16],"open":[32]}]]],["pwa-toast",[[1,"pwa-toast",{"message":[1],"duration":[2],"closing":[32]}]]],["pwa-camera",[[1,"pwa-camera",{"facingMode":[1,"facing-mode"],"handlePhoto":[16],"handleNoDeviceError":[16],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"],"photo":[32],"photoSrc":[32],"showShutterOverlay":[32],"flashIndex":[32],"hasCamera":[32],"rotation":[32],"deviceError":[32]}]]],["pwa-camera-modal-instance",[[1,"pwa-camera-modal-instance",{"facingMode":[1,"facing-mode"],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]], options); | ||
return bootstrapLazy([["pwa-camera-modal",[[1,"pwa-camera-modal",{"facingMode":[1,"facing-mode"],"hidePicker":[4,"hide-picker"],"present":[64],"dismiss":[64]}]]],["pwa-action-sheet",[[1,"pwa-action-sheet",{"header":[1],"cancelable":[4],"options":[16],"open":[32]}]]],["pwa-toast",[[1,"pwa-toast",{"message":[1],"duration":[2],"closing":[32]}]]],["pwa-camera",[[1,"pwa-camera",{"facingMode":[1,"facing-mode"],"handlePhoto":[16],"hidePicker":[4,"hide-picker"],"handleNoDeviceError":[16],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"],"photo":[32],"photoSrc":[32],"showShutterOverlay":[32],"flashIndex":[32],"hasCamera":[32],"rotation":[32],"deviceError":[32]}]]],["pwa-camera-modal-instance",[[1,"pwa-camera-modal-instance",{"facingMode":[1,"facing-mode"],"hidePicker":[4,"hide-picker"],"noDevicesText":[1,"no-devices-text"],"noDevicesButtonText":[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]], options); | ||
}); | ||
@@ -17,0 +17,0 @@ }; |
@@ -17,2 +17,3 @@ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-1c5c47b4.js'; | ||
this.facingMode = 'user'; | ||
this.hidePicker = false; | ||
this.noDevicesText = 'No camera found'; | ||
@@ -35,3 +36,3 @@ this.noDevicesButtonText = 'Choose image'; | ||
render() { | ||
return (h("div", { class: "wrapper", onClick: e => this.handleBackdropClick(e) }, h("div", { class: "content" }, h("pwa-camera", { onClick: e => this.handleComponentClick(e), facingMode: this.facingMode, handlePhoto: this.handlePhoto, handleNoDeviceError: this.handleNoDeviceError, noDevicesButtonText: this.noDevicesButtonText, noDevicesText: this.noDevicesText })))); | ||
return (h("div", { class: "wrapper", onClick: e => this.handleBackdropClick(e) }, h("div", { class: "content" }, h("pwa-camera", { onClick: e => this.handleComponentClick(e), facingMode: this.facingMode, hidePicker: this.hidePicker, handlePhoto: this.handlePhoto, handleNoDeviceError: this.handleNoDeviceError, noDevicesButtonText: this.noDevicesButtonText, noDevicesText: this.noDevicesText })))); | ||
} | ||
@@ -38,0 +39,0 @@ get el() { return getElement(this); } |
@@ -11,2 +11,3 @@ import { r as registerInstance, c as createEvent, h } from './index-1c5c47b4.js'; | ||
this.facingMode = 'user'; | ||
this.hidePicker = false; | ||
} | ||
@@ -16,2 +17,3 @@ async present() { | ||
camera.facingMode = this.facingMode; | ||
camera.hidePicker = this.hidePicker; | ||
camera.addEventListener('onPhoto', async (e) => { | ||
@@ -18,0 +20,0 @@ if (!this._modal) { |
@@ -223,2 +223,3 @@ import { r as registerInstance, f as forceUpdate, h, g as getElement } from './index-1c5c47b4.js'; | ||
this.handlePhoto = undefined; | ||
this.hidePicker = false; | ||
this.handleNoDeviceError = undefined; | ||
@@ -471,3 +472,3 @@ this.noDevicesText = 'No camera found'; | ||
return (h("div", { class: "camera-wrapper" }, h("div", { class: "camera-header" }, h("section", { class: "items" }, h("div", { class: "item close", onClick: e => this.handleClose(e) }, h("img", { src: this.iconExit() })), h("div", { class: "item flash", onClick: e => this.handleFlashClick(e) }, this.flashModes.length > 0 && (h("div", null, this.flashMode == 'off' ? h("img", { src: this.iconFlashOff() }) : '', this.flashMode == 'auto' ? h("img", { src: this.iconFlashAuto() }) : '', this.flashMode == 'flash' ? h("img", { src: this.iconFlashOn() }) : ''))))), (this.hasCamera === false || !!this.deviceError) && (h("div", { class: "no-device" }, h("h2", null, this.noDevicesText), h("label", { htmlFor: "_pwa-elements-camera-input" }, this.noDevicesButtonText), h("input", { type: "file", id: "_pwa-elements-camera-input", onChange: this.handleFileInputChange, accept: "image/*", class: "select-file-button" }))), this.photoSrc ? (h("div", { class: "accept" }, h("div", { class: "accept-image", style: Object.assign({ backgroundImage: `url(${this.photoSrc})` }, acceptStyles) }))) : (h("div", { class: "camera-video" }, this.showShutterOverlay && (h("div", { class: "shutter-overlay" })), this.hasImageCapture() ? (h("video", { ref: (el) => this.videoElement = el, onLoadedMetaData: this.handleVideoMetadata, autoplay: true, playsinline: true })) : (h("canvas", { ref: (el) => this.canvasElement = el, width: "100%", height: "100%" })), h("canvas", { class: "offscreen-image-render", ref: e => this.offscreenCanvas = e, width: "100%", height: "100%" }))), this.hasCamera && (h("div", { class: "camera-footer" }, !this.photo ? ([ | ||
h("div", { class: "pick-image", onClick: this.handlePickFile }, h("label", { htmlFor: "_pwa-elements-file-pick" }, this.iconPhotos()), h("input", { type: "file", id: "_pwa-elements-file-pick", onChange: this.handleFileInputChange, accept: "image/*", class: "pick-image-button" })), | ||
!this.hidePicker && (h("div", { class: "pick-image", onClick: this.handlePickFile }, h("label", { htmlFor: "_pwa-elements-file-pick" }, this.iconPhotos()), h("input", { type: "file", id: "_pwa-elements-file-pick", onChange: this.handleFileInputChange, accept: "image/*", class: "pick-image-button" }))), | ||
h("div", { class: "shutter", onClick: this.handleShutterClick }, h("div", { class: "shutter-button" })), | ||
@@ -474,0 +475,0 @@ h("div", { class: "rotate", onClick: this.handleRotateClick }, h("img", { src: this.iconReverseCamera() })), |
@@ -1,1 +0,1 @@ | ||
import{p as e,b as a}from"./p-386e91ad.js";export{s as setNonce}from"./p-386e91ad.js";(()=>{const a=import.meta.url,o={};return""!==a&&(o.resourcesUrl=new URL(".",a).href),e(o)})().then((e=>a([["p-f1ff686b",[[1,"pwa-camera-modal",{facingMode:[1,"facing-mode"],present:[64],dismiss:[64]}]]],["p-d0cae4dc",[[1,"pwa-action-sheet",{header:[1],cancelable:[4],options:[16],open:[32]}]]],["p-b57f4873",[[1,"pwa-toast",{message:[1],duration:[2],closing:[32]}]]],["p-b60ac9a7",[[1,"pwa-camera",{facingMode:[1,"facing-mode"],handlePhoto:[16],handleNoDeviceError:[16],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"],photo:[32],photoSrc:[32],showShutterOverlay:[32],flashIndex:[32],hasCamera:[32],rotation:[32],deviceError:[32]}]]],["p-cb76a7f9",[[1,"pwa-camera-modal-instance",{facingMode:[1,"facing-mode"],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]],e))); | ||
import{p as e,b as o}from"./p-386e91ad.js";export{s as setNonce}from"./p-386e91ad.js";(()=>{const o=import.meta.url,a={};return""!==o&&(a.resourcesUrl=new URL(".",o).href),e(a)})().then((e=>o([["p-3bb700a2",[[1,"pwa-camera-modal",{facingMode:[1,"facing-mode"],hidePicker:[4,"hide-picker"],present:[64],dismiss:[64]}]]],["p-d0cae4dc",[[1,"pwa-action-sheet",{header:[1],cancelable:[4],options:[16],open:[32]}]]],["p-b57f4873",[[1,"pwa-toast",{message:[1],duration:[2],closing:[32]}]]],["p-665001c2",[[1,"pwa-camera",{facingMode:[1,"facing-mode"],handlePhoto:[16],hidePicker:[4,"hide-picker"],handleNoDeviceError:[16],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"],photo:[32],photoSrc:[32],showShutterOverlay:[32],flashIndex:[32],hasCamera:[32],rotation:[32],deviceError:[32]}]]],["p-d212ae1d",[[1,"pwa-camera-modal-instance",{facingMode:[1,"facing-mode"],hidePicker:[4,"hide-picker"],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]],e))); |
@@ -1,1 +0,1 @@ | ||
System.register(["./p-335782c2.system.js"],(function(e,t){"use strict";var n,o;return{setters:[function(t){n=t.p;o=t.b;e("setNonce",t.s)}],execute:function(){var e=function(){var e=t.meta.url;var o={};if(e!==""){o.resourcesUrl=new URL(".",e).href}return n(o)};e().then((function(e){return o([["p-6200738f.system",[[1,"pwa-camera-modal",{facingMode:[1,"facing-mode"],present:[64],dismiss:[64]}]]],["p-5b57434a.system",[[1,"pwa-action-sheet",{header:[1],cancelable:[4],options:[16],open:[32]}]]],["p-db3c6183.system",[[1,"pwa-toast",{message:[1],duration:[2],closing:[32]}]]],["p-3ffb9553.system",[[1,"pwa-camera",{facingMode:[1,"facing-mode"],handlePhoto:[16],handleNoDeviceError:[16],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"],photo:[32],photoSrc:[32],showShutterOverlay:[32],flashIndex:[32],hasCamera:[32],rotation:[32],deviceError:[32]}]]],["p-67f75ea8.system",[[1,"pwa-camera-modal-instance",{facingMode:[1,"facing-mode"],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]],e)}))}}})); | ||
System.register(["./p-335782c2.system.js"],(function(e,t){"use strict";var n,o;return{setters:[function(t){n=t.p;o=t.b;e("setNonce",t.s)}],execute:function(){var e=function(){var e=t.meta.url;var o={};if(e!==""){o.resourcesUrl=new URL(".",e).href}return n(o)};e().then((function(e){return o([["p-1b81a39d.system",[[1,"pwa-camera-modal",{facingMode:[1,"facing-mode"],hidePicker:[4,"hide-picker"],present:[64],dismiss:[64]}]]],["p-5b57434a.system",[[1,"pwa-action-sheet",{header:[1],cancelable:[4],options:[16],open:[32]}]]],["p-db3c6183.system",[[1,"pwa-toast",{message:[1],duration:[2],closing:[32]}]]],["p-fab2e7af.system",[[1,"pwa-camera",{facingMode:[1,"facing-mode"],handlePhoto:[16],hidePicker:[4,"hide-picker"],handleNoDeviceError:[16],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"],photo:[32],photoSrc:[32],showShutterOverlay:[32],flashIndex:[32],hasCamera:[32],rotation:[32],deviceError:[32]}]]],["p-550557d3.system",[[1,"pwa-camera-modal-instance",{facingMode:[1,"facing-mode"],hidePicker:[4,"hide-picker"],noDevicesText:[1,"no-devices-text"],noDevicesButtonText:[1,"no-devices-button-text"]},[[16,"keyup","handleBackdropKeyUp"]]]]]],e)}))}}})); |
@@ -20,2 +20,3 @@ /* eslint-disable */ | ||
"handlePhoto": (photo: Blob) => void; | ||
"hidePicker": boolean; | ||
"noDevicesButtonText": string; | ||
@@ -27,2 +28,3 @@ "noDevicesText": string; | ||
"facingMode": string; | ||
"hidePicker": boolean; | ||
"present": () => Promise<void>; | ||
@@ -32,2 +34,3 @@ } | ||
"facingMode": string; | ||
"hidePicker": boolean; | ||
"noDevicesButtonText": string; | ||
@@ -103,2 +106,3 @@ "noDevicesText": string; | ||
"handlePhoto"?: (photo: Blob) => void; | ||
"hidePicker"?: boolean; | ||
"noDevicesButtonText"?: string; | ||
@@ -109,2 +113,3 @@ "noDevicesText"?: string; | ||
"facingMode"?: string; | ||
"hidePicker"?: boolean; | ||
"onNoDeviceError"?: (event: PwaCameraModalCustomEvent<any>) => void; | ||
@@ -115,2 +120,3 @@ "onOnPhoto"?: (event: PwaCameraModalCustomEvent<any>) => void; | ||
"facingMode"?: string; | ||
"hidePicker"?: boolean; | ||
"noDevicesButtonText"?: string; | ||
@@ -117,0 +123,0 @@ "noDevicesText"?: string; |
@@ -7,2 +7,3 @@ import { EventEmitter } from '../../stencil-public-runtime'; | ||
facingMode: string; | ||
hidePicker: boolean; | ||
noDevicesText: string; | ||
@@ -9,0 +10,0 @@ noDevicesButtonText: string; |
import { EventEmitter } from '../../stencil-public-runtime'; | ||
export declare class PWACameraModal { | ||
facingMode: string; | ||
hidePicker: boolean; | ||
onPhoto: EventEmitter; | ||
@@ -5,0 +6,0 @@ noDeviceError: EventEmitter; |
@@ -7,2 +7,3 @@ import { FlashMode } from '../../definitions'; | ||
handlePhoto: (photo: Blob) => void; | ||
hidePicker: boolean; | ||
handleNoDeviceError: (e?: any) => void; | ||
@@ -9,0 +10,0 @@ noDevicesText: string; |
{ | ||
"name": "@ionic/pwa-elements", | ||
"version": "3.2.2", | ||
"version": "3.3.0", | ||
"description": "Stencil Component Starter", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
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
752874
9526