pwa-camera-modal-instance.cjs.entry.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. const index = require('./index-d7f36e37.js');
  4. const 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%}}";
  5. const PWACameraModal = class {
  6. constructor(hostRef) {
  7. index.registerInstance(this, hostRef);
  8. this.onPhoto = index.createEvent(this, "onPhoto", 7);
  9. this.noDeviceError = index.createEvent(this, "noDeviceError", 7);
  10. this.handlePhoto = async (photo) => {
  11. this.onPhoto.emit(photo);
  12. };
  13. this.handleNoDeviceError = async (photo) => {
  14. this.noDeviceError.emit(photo);
  15. };
  16. this.facingMode = 'user';
  17. this.hidePicker = false;
  18. this.noDevicesText = 'No camera found';
  19. this.noDevicesButtonText = 'Choose image';
  20. }
  21. handleBackdropClick(e) {
  22. if (e.target !== this.el) {
  23. this.onPhoto.emit(null);
  24. }
  25. }
  26. handleComponentClick(e) {
  27. e.stopPropagation();
  28. }
  29. handleBackdropKeyUp(e) {
  30. if (e.key === "Escape") {
  31. this.onPhoto.emit(null);
  32. }
  33. }
  34. render() {
  35. 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 }))));
  36. }
  37. get el() { return index.getElement(this); }
  38. };
  39. PWACameraModal.style = cameraModalInstanceCss;
  40. exports.pwa_camera_modal_instance = PWACameraModal;