@tindtechnologies/universalviewer
Version:
The Universal Viewer is a community-developed open source project on a mission to help you share your 📚📜📰📽️📻🗿 with the 🌎
2 lines (1 loc) • 9.54 kB
JavaScript
import{f as R}from"./chunk-LFCA4LRO.js";import{a as q,b as H}from"./chunk-TVVVZZ43.js";import{a as c}from"./chunk-47FI7OS3.js";import{c as O}from"./chunk-Y2TXPXZV.js";import{e as _,i as B,j as I,k as W,n as L}from"./chunk-LE3CSG7S.js";import"./chunk-4DAZ7WDM.js";import{a as V,e as x,f as j,i as A,l as z,o as C}from"./chunk-VNJCZCB4.js";import"./chunk-L67DAW3A.js";var N=function(r,a,e,i){return new(e||(e=Promise))(function(n,o){function p(t){try{v(i.next(t))}catch(s){o(s)}}function l(t){try{v(i.throw(t))}catch(s){o(s)}}function v(t){t.done?n(t.value):new e(function(s){s(t.value)}).then(p,l)}v((i=i.apply(r,a||[])).next())})},M=function(r,a){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,n,o,p;return p={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function l(t){return function(s){return v([t,s])}}function v(t){if(i)throw new TypeError("Generator is already executing.");for(;e;)try{if(i=1,n&&(o=t[0]&2?n.return:t[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,t[1])).done)return o;switch(n=0,o&&(t=[t[0]&2,o.value]),t[0]){case 0:case 1:o=t;break;case 4:return e.label++,{value:t[1],done:!1};case 5:e.label++,n=t[1],t=[0];continue;case 7:t=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(t[0]===6||t[0]===2)){e=0;continue}if(t[0]===3&&(!o||t[1]>o[0]&&t[1]<o[3])){e.label=t[1];break}if(t[0]===6&&e.label<o[1]){e.label=o[1],o=t;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(t);break}o[2]&&e.ops.pop(),e.trys.pop();continue}t=a.call(r,e)}catch(s){t=[6,s],n=0}finally{i=o=0}if(t[0]&5)throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}},G=function(r,a){var e="top",i="left",n=r.querySelector(".popover-content"),o=n.getBoundingClientRect(),p=o.width,l=o.height,v=r.ownerDocument.defaultView.innerWidth,t=r.ownerDocument.defaultView.innerHeight,s=a&&a.target&&a.target.getBoundingClientRect(),h=s!=null&&"top"in s?s.top:t/2-l/2,g=s!=null&&"left"in s?s.left:v/2,d=s&&s.width||0,u=s&&s.height||0,w=r.querySelector(".popover-arrow"),b=w.getBoundingClientRect(),m=b.width,D=b.height;s==null&&(w.style.display="none");var y={top:h+u,left:g+d/2-m/2},f={top:h+u+(D-1),left:g+d/2-p/2},k=!1,P=!1;f.left<S+25?(k=!0,f.left=S):p+S+f.left+25>v&&(P=!0,f.left=v-p-S,i="right"),h+u+l>t&&h-l>0?(y.top=h-(D+1),f.top=h-l-(D-1),r.className=r.className+" popover-bottom",e="bottom"):h+u+l>t&&(n.style.bottom=S+"%"),w.style.top=y.top+"px",w.style.left=y.left+"px",n.style.top=f.top+"px",n.style.left=f.left+"px",k&&(n.style.left="calc("+f.left+"px + var(--ion-safe-area-left, 0px))"),P&&(n.style.left="calc("+f.left+"px - var(--ion-safe-area-right, 0px))"),n.style.transformOrigin=e+" "+i;var Y=c(),T=c(),E=c();return T.addElement(r.querySelector("ion-backdrop")).fromTo("opacity",.01,.08),E.addElement(r.querySelector(".popover-wrapper")).fromTo("opacity",.01,1),Y.addElement(r).easing("ease").duration(100).addAnimation([T,E])},S=5,X=function(r){var a=c(),e=c(),i=c();return e.addElement(r.querySelector("ion-backdrop")).fromTo("opacity",.08,0),i.addElement(r.querySelector(".popover-wrapper")).fromTo("opacity",.99,0),a.addElement(r).easing("ease").duration(500).addAnimation([e,i])},F=function(r,a){var e=12,i=r.ownerDocument,n=i.dir==="rtl",o="top",p=n?"right":"left",l=r.querySelector(".popover-content"),v=l.getBoundingClientRect(),t=v.width,s=v.height,h=i.defaultView.innerWidth,g=i.defaultView.innerHeight,d=a&&a.target&&a.target.getBoundingClientRect(),u=d!=null&&"bottom"in d?d.bottom:g/2-s/2,w=d!=null&&"left"in d?n?d.left-t+d.width:d.left:h/2-t/2,b=d&&d.height||0,m={top:u,left:w};m.left<e?(m.left=e,p="left"):t+e+m.left>h&&(m.left=h-t-e,p="right"),u+b+s>g&&u-s>0?(m.top=u-s-b,r.className=r.className+" popover-bottom",o="bottom"):u+b+s>g&&(l.style.bottom=e+"px");var D=c(),y=c(),f=c(),k=c(),P=c();return y.addElement(r.querySelector("ion-backdrop")).fromTo("opacity",.01,.32),f.addElement(r.querySelector(".popover-wrapper")).fromTo("opacity",.01,1),k.addElement(l).beforeStyles({top:m.top+"px",left:m.left+"px","transform-origin":o+" "+p}).fromTo("transform","scale(0.001)","scale(1)"),P.addElement(r.querySelector(".popover-viewport")).fromTo("opacity",.01,1),D.addElement(r).easing("cubic-bezier(0.36,0.66,0.04,1)").duration(300).addAnimation([y,f,k,P])},K=function(r){var a=c(),e=c(),i=c();return e.addElement(r.querySelector("ion-backdrop")).fromTo("opacity",.32,0),i.addElement(r.querySelector(".popover-wrapper")).fromTo("opacity",.99,0),a.addElement(r).easing("ease").duration(500).addAnimation([e,i])},re=function(){function r(a){var e=this;V(this,a),this.presented=!1,this.mode=C(this),this.keyboardClose=!0,this.backdropDismiss=!0,this.showBackdrop=!0,this.translucent=!1,this.animated=!0,this.onDismiss=function(i){i.stopPropagation(),i.preventDefault(),e.dismiss()},this.onBackdropTap=function(){e.dismiss(void 0,L)},this.onLifecycle=function(i){var n=e.usersElement,o=J[i.type];if(n&&o){var p=new CustomEvent(o,{bubbles:!1,cancelable:!1,detail:i.detail});n.dispatchEvent(p)}},_(this.el),this.didPresent=A(this,"ionPopoverDidPresent",7),this.willPresent=A(this,"ionPopoverWillPresent",7),this.willDismiss=A(this,"ionPopoverWillDismiss",7),this.didDismiss=A(this,"ionPopoverDidDismiss",7)}return r.prototype.present=function(){return N(this,void 0,void 0,function(){var a,e,i;return M(this,function(n){switch(n.label){case 0:if(this.presented)return[2];if(a=this.el.querySelector(".popover-content"),!a)throw new Error("container is undefined");return e=Object.assign(Object.assign({},this.componentProps),{popover:this.el}),i=this,[4,q(this.delegate,a,this.component,["popover-viewport",this.el["s-sc"]],e)];case 1:return i.usersElement=n.sent(),[4,R(this.usersElement)];case 2:return n.sent(),[2,B(this,"popoverEnter",G,F,this.event)]}})})},r.prototype.dismiss=function(a,e){return N(this,void 0,void 0,function(){var i;return M(this,function(n){switch(n.label){case 0:return[4,I(this,a,e,"popoverLeave",X,K,this.event)];case 1:return i=n.sent(),i?[4,H(this.delegate,this.usersElement)]:[3,3];case 2:n.sent(),n.label=3;case 3:return[2,i]}})})},r.prototype.onDidDismiss=function(){return W(this.el,"ionPopoverDidDismiss")},r.prototype.onWillDismiss=function(){return W(this.el,"ionPopoverWillDismiss")},r.prototype.render=function(){var a,e=C(this),i=this.onLifecycle;return x(j,{"aria-modal":"true","no-router":!0,style:{zIndex:""+(2e4+this.overlayIndex)},class:Object.assign(Object.assign({},O(this.cssClass)),(a={},a[e]=!0,a["popover-translucent"]=this.translucent,a)),onIonPopoverDidPresent:i,onIonPopoverWillPresent:i,onIonPopoverWillDismiss:i,onIonPopoverDidDismiss:i,onIonDismiss:this.onDismiss,onIonBackdropTap:this.onBackdropTap},x("ion-backdrop",{tappable:this.backdropDismiss,visible:this.showBackdrop}),x("div",{class:"popover-wrapper"},x("div",{class:"popover-arrow"}),x("div",{class:"popover-content"})))},Object.defineProperty(r.prototype,"el",{get:function(){return z(this)},enumerable:!0,configurable:!0}),Object.defineProperty(r,"style",{get:function(){return'.sc-ion-popover-ios-h{--background:var(--ion-background-color,#fff);--min-width:0;--min-height:0;--max-width:auto;--height:auto;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:fixed;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;color:var(--ion-text-color,#000);z-index:1001}.overlay-hidden.sc-ion-popover-ios-h{display:none}.popover-wrapper.sc-ion-popover-ios{opacity:0;z-index:10}.popover-content.sc-ion-popover-ios{display:-ms-flexbox;display:flex;position:absolute;-ms-flex-direction:column;flex-direction:column;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:auto;z-index:10}.popover-viewport.sc-ion-popover-ios{--ion-safe-area-top:0px;--ion-safe-area-right:0px;--ion-safe-area-bottom:0px;--ion-safe-area-left:0px}.sc-ion-popover-ios-h{--width:200px;--max-height:90%;--box-shadow:none}.popover-content.sc-ion-popover-ios{border-radius:10px}.popover-arrow.sc-ion-popover-ios{display:block;position:absolute;width:20px;height:10px;overflow:hidden}.popover-arrow.sc-ion-popover-ios:after{left:3px;top:3px;border-radius:3px;position:absolute;width:14px;height:14px;-webkit-transform:rotate(45deg);transform:rotate(45deg);background:var(--background);content:"";z-index:10}[dir=rtl].sc-ion-popover-ios-h .popover-arrow.sc-ion-popover-ios:after, [dir=rtl] .sc-ion-popover-ios-h .popover-arrow.sc-ion-popover-ios:after, [dir=rtl].sc-ion-popover-ios .popover-arrow.sc-ion-popover-ios:after{left:unset;right:unset;right:3px}.popover-bottom.sc-ion-popover-ios-h .popover-arrow.sc-ion-popover-ios{top:auto;bottom:-10px}.popover-bottom.sc-ion-popover-ios-h .popover-arrow.sc-ion-popover-ios:after{top:-6px}@supports ((-webkit-backdrop-filter:blur(0)) or (backdrop-filter:blur(0))){.popover-translucent.sc-ion-popover-ios-h .popover-arrow.sc-ion-popover-ios:after, .popover-translucent.sc-ion-popover-ios-h .popover-content.sc-ion-popover-ios{background:rgba(var(--ion-background-color-rgb,255,255,255),.8);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}}'},enumerable:!0,configurable:!0}),r}(),J={ionPopoverDidPresent:"ionViewDidEnter",ionPopoverWillPresent:"ionViewWillEnter",ionPopoverWillDismiss:"ionViewWillLeave",ionPopoverDidDismiss:"ionViewDidLeave"};export{re as ion_popover};