@zoff-tech/zt-bottom-drawer
Version:
Bottom Drawer / Web Component
5 lines • 1.47 kB
JavaScript
import{K as t}from"./p-1ae586af.js";import"./p-c8e8aee0.js";
/*!
* (C) Ionic http://ionicframework.com - MIT License
*/const e="ionKeyboardDidShow";const o="ionKeyboardDidHide";const s=150;let n={};let c={};let a=false;const i=()=>{n={};c={};a=false};const f=e=>{const o=t.getEngine();if(o){r(e)}else{if(!e.visualViewport){return}c=y(e.visualViewport);e.visualViewport.onresize=()=>{w(e);if(p()||h(e)){d(e)}else if(b(e)){l(e)}}}};const r=t=>{t.addEventListener("keyboardDidShow",(e=>d(t,e)));t.addEventListener("keyboardDidHide",(()=>l(t)))};const d=(t,e)=>{m(t,e);a=true};const l=t=>{u(t);a=false};const p=()=>{const t=(n.height-c.height)*c.scale;return!a&&n.width===c.width&&t>s};const h=t=>a&&!b(t);const b=t=>a&&c.height===t.innerHeight;const m=(t,o)=>{const s=o?o.keyboardHeight:t.innerHeight-c.height;const n=new CustomEvent(e,{detail:{keyboardHeight:s}});t.dispatchEvent(n)};const u=t=>{const e=new CustomEvent(o);t.dispatchEvent(e)};const w=t=>{n=Object.assign({},c);c=y(t.visualViewport)};const y=t=>({width:Math.round(t.width),height:Math.round(t.height),offsetTop:t.offsetTop,offsetLeft:t.offsetLeft,pageTop:t.pageTop,pageLeft:t.pageLeft,scale:t.scale});export{o as KEYBOARD_DID_CLOSE,e as KEYBOARD_DID_OPEN,y as copyVisualViewport,b as keyboardDidClose,p as keyboardDidOpen,h as keyboardDidResize,i as resetKeyboardAssist,l as setKeyboardClose,d as setKeyboardOpen,f as startKeyboardAssist,w as trackViewportChanges};
//# sourceMappingURL=p-a82d38b6.js.map