@zoff-tech/zt-bottom-drawer
Version:
Bottom Drawer / Web Component
2 lines • 3.65 kB
JavaScript
import{r as t,d as i,h as e,e as s}from"./p-f6c816ce.js";import{getTimeGivenProgression as n}from"@utils/animation/cubic-bezier";import{attachComponent as a,detachComponent as o}from"@utils/framework-delegate";import{shallowEqualStringMap as h,hasLazyBuild as r}from"@utils/helpers";import{transition as l}from"@utils/transition";import{g as c,c as d}from"./p-0b9b2444.js";const u=":host{left:0;right:0;top:0;bottom:0;position:absolute;contain:layout size style;overflow:hidden;z-index:0}";const f=class{constructor(e){t(this,e);this.ionNavWillLoad=i(this,"ionNavWillLoad",7);this.ionNavWillChange=i(this,"ionNavWillChange",3);this.ionNavDidChange=i(this,"ionNavDidChange",3);this.gestureOrAnimationInProgress=false;this.mode=c(this);this.delegate=undefined;this.animated=true;this.animation=undefined;this.swipeHandler=undefined}swipeHandlerChanged(){if(this.gesture){this.gesture.enable(this.swipeHandler!==undefined)}}async connectedCallback(){const t=()=>{this.gestureOrAnimationInProgress=true;if(this.swipeHandler){this.swipeHandler.onStart()}};this.gesture=(await import("./p-83368520.js")).createSwipeBackGesture(this.el,(()=>!this.gestureOrAnimationInProgress&&!!this.swipeHandler&&this.swipeHandler.canStart()),(()=>t()),(t=>{var i;return(i=this.ani)===null||i===void 0?void 0:i.progressStep(t)}),((t,i,e)=>{if(this.ani){this.ani.onFinish((()=>{this.gestureOrAnimationInProgress=false;if(this.swipeHandler){this.swipeHandler.onEnd(t)}}),{oneTimeCallback:true});let s=t?-.001:.001;if(!t){this.ani.easing("cubic-bezier(1, 0, 0.68, 0.28)");s+=n([0,0],[1,0],[.68,.28],[1,1],i)[0]}else{s+=n([0,0],[.32,.72],[0,1],[1,1],i)[0]}this.ani.progressEnd(t?1:0,s,e)}else{this.gestureOrAnimationInProgress=false}}));this.swipeHandlerChanged()}componentWillLoad(){this.ionNavWillLoad.emit()}disconnectedCallback(){if(this.gesture){this.gesture.destroy();this.gesture=undefined}}async commit(t,i,e){const s=await this.lock();let n=false;try{n=await this.transition(t,i,e)}catch(t){console.error(t)}s();return n}async setRouteId(t,i,e,s){const n=await this.setRoot(t,i,{duration:e==="root"?0:undefined,direction:e==="back"?"back":"forward",animationBuilder:s});return{changed:n,element:this.activeEl}}async getRouteId(){const t=this.activeEl;return t?{id:t.tagName,element:t,params:this.activeParams}:undefined}async setRoot(t,i,e){if(this.activeComponent===t&&h(i,this.activeParams)){return false}const s=this.activeEl;const n=await a(this.delegate,this.el,t,["ion-page","ion-page-invisible"],i);this.activeComponent=t;this.activeEl=n;this.activeParams=i;await this.commit(n,s,e);await o(this.delegate,s);return true}async transition(t,i,e={}){if(i===t){return false}this.ionNavWillChange.emit();const{el:s,mode:n}=this;const a=this.animated&&d.getBoolean("animated",true);const o=e.animationBuilder||this.animation||d.get("navAnimation");await l(Object.assign(Object.assign({mode:n,animated:a,enteringEl:t,leavingEl:i,baseEl:s,deepWait:r(s),progressCallback:e.progressAnimation?t=>{if(t!==undefined&&!this.gestureOrAnimationInProgress){this.gestureOrAnimationInProgress=true;t.onFinish((()=>{this.gestureOrAnimationInProgress=false;if(this.swipeHandler){this.swipeHandler.onEnd(false)}}),{oneTimeCallback:true});t.progressEnd(0,0,0)}else{this.ani=t}}:undefined},e),{animationBuilder:o}));this.ionNavDidChange.emit();return true}async lock(){const t=this.waitPromise;let i;this.waitPromise=new Promise((t=>i=t));if(t!==undefined){await t}return i}render(){return e("slot",null)}get el(){return s(this)}static get watchers(){return{swipeHandler:["swipeHandlerChanged"]}}};f.style=u;export{f as ion_router_outlet};
//# sourceMappingURL=p-69b32b32.entry.js.map