UNPKG

forms-reactive

Version:

Reactive Form Web Component

17 lines 4.24 kB
import{d as t}from"./p-3647f076.js";import{MENU_BACK_BUTTON_PRIORITY as n}from"./p-955d90ef.js";import{p as e}from"./p-8613551a.js";import{d as s}from"./p-c1432a35.js";import{g as r}from"./p-9c83f640.js";import{c as o}from"./p-1fd4aad1.js"; /*! * (C) Ionic http://ionicframework.com - MIT License */const a=t=>o().duration(t?400:300); /*! * (C) Ionic http://ionicframework.com - MIT License */const i=t=>{let n;let e;const s=t.width+8;const i=o();const c=o();if(t.isEndSide){n=s+"px";e="0px"}else{n=-s+"px";e="0px"}i.addElement(t.menuInnerEl).fromTo("transform",`translateX(${n})`,`translateX(${e})`);const u=r(t);const f=u==="ios";const l=f?.2:.25;c.addElement(t.backdropEl).fromTo("opacity",.01,l);return a(f).addAnimation([i,c])}; /*! * (C) Ionic http://ionicframework.com - MIT License */const c=t=>{let n;let e;const s=r(t);const i=t.width;if(t.isEndSide){n=-i+"px";e=i+"px"}else{n=i+"px";e=-i+"px"}const c=o().addElement(t.menuInnerEl).fromTo("transform",`translateX(${e})`,"translateX(0px)");const u=o().addElement(t.contentEl).fromTo("transform","translateX(0px)",`translateX(${n})`);const f=o().addElement(t.backdropEl).fromTo("opacity",.01,.32);return a(s==="ios").addAnimation([c,u,f])}; /*! * (C) Ionic http://ionicframework.com - MIT License */const u=t=>{const n=r(t);const e=t.width*(t.isEndSide?-1:1)+"px";const s=o().addElement(t.contentEl).fromTo("transform","translateX(0px)",`translateX(${e})`);return a(n==="ios").addAnimation(s)}; /*! * (C) Ionic http://ionicframework.com - MIT License */const f=()=>{const r=new Map;const o=[];const a=async t=>{const n=await y(t,true);if(n){return n.open()}return false};const f=async t=>{const n=await(t!==undefined?y(t,true):h());if(n!==undefined){return n.close()}return false};const l=async t=>{const n=await y(t,true);if(n){return n.toggle()}return false};const p=async(t,n)=>{const e=await y(n);if(e){e.disabled=!t}return e};const d=async(t,n)=>{const e=await y(n);if(e){e.swipeGesture=t}return e};const m=async t=>{if(t!=null){const n=await y(t);return n!==undefined&&n.isOpen()}else{const t=await h();return t!==undefined}};const w=async t=>{const n=await y(t);if(n){return!n.disabled}return false};const y=async(t,n=false)=>{await q();if(t==="start"||t==="end"){const s=o.filter((n=>n.side===t&&!n.disabled));if(s.length>=1){if(s.length>1&&n){e(`menuController queried for a menu on the "${t}" side, but ${s.length} menus were found. The first menu reference will be used. If this is not the behavior you want then pass the ID of the menu instead of its side.`,s.map((t=>t.el)))}return s[0].el}const r=o.filter((n=>n.side===t));if(r.length>=1){if(r.length>1&&n){e(`menuController queried for a menu on the "${t}" side, but ${r.length} menus were found. The first menu reference will be used. If this is not the behavior you want then pass the ID of the menu instead of its side.`,r.map((t=>t.el)))}return r[0].el}}else if(t!=null){return O((n=>n.menuId===t))}const s=O((t=>!t.disabled));if(s){return s}return o.length>0?o[0].el:undefined};const h=async()=>{await q();return _()};const x=async()=>{await q();return A()};const g=async()=>{await q();return I()};const $=(t,n)=>{r.set(t,n)};const b=t=>{if(o.indexOf(t)<0){o.push(t)}};const X=t=>{const n=o.indexOf(t);if(n>-1){o.splice(n,1)}};const j=async(t,n,e,s)=>{if(I()){return false}if(n){const n=await h();if(n&&t.el!==n){await n.setOpen(false,false)}}return t._setOpen(n,e,s)};const v=(t,n)=>{const e=r.get(t);if(!e){throw new Error("animation not registered")}const s=e(n);return s};const _=()=>O((t=>t._isOpen));const A=()=>o.map((t=>t.el));const I=()=>o.some((t=>t.isAnimating));const O=t=>{const n=o.find(t);if(n!==undefined){return n.el}return undefined};const q=()=>Promise.all(Array.from(document.querySelectorAll("ion-menu")).map((t=>new Promise((n=>s(t,n))))));$("reveal",u);$("push",c);$("overlay",i);t===null||t===void 0?void 0:t.addEventListener("ionBackButton",(t=>{const e=_();if(e){t.detail.register(n,(()=>e.close()))}}));return{registerAnimation:$,get:y,getMenus:x,getOpen:h,isEnabled:w,swipeGesture:d,isAnimating:g,isOpen:m,enable:p,toggle:l,close:f,open:a,_getOpenSync:_,_createAnimation:v,_register:b,_unregister:X,_setOpen:j}};const l=f();export{l as m}; //# sourceMappingURL=p-4da36daf.js.map