From 802dea814648def3f2e7e1111fb783aef474d2cc Mon Sep 17 00:00:00 2001 From: hicodx Date: Wed, 14 Aug 2024 17:41:23 -0500 Subject: [PATCH] se quito el parametro de show --- dist/index.js | 2 +- src/modal/toast.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 1752f6d..a1037d8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1 +1 @@ -"use strict";var re=Object.defineProperty,oe=Object.defineProperties;var ie=Object.getOwnPropertyDescriptors;var Y=Object.getOwnPropertySymbols;var ae=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable;var W=(t,e,n)=>e in t?re(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,p=(t,e)=>{for(var n in e||(e={}))ae.call(e,n)&&W(t,n,e[n]);if(Y)for(var n of Y(e))ce.call(e,n)&&W(t,n,e[n]);return t},X=(t,e)=>oe(t,ie(e));var B=(t,e,n)=>new Promise((o,i)=>{var a=l=>{try{s(n.next(l))}catch(f){i(f)}},u=l=>{try{s(n.throw(l))}catch(f){i(f)}},s=l=>l.done?o(l.value):Promise.resolve(l.value).then(a,u);s((n=n.apply(t,e)).next())});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("tabris");require("string-tocapitalize");function w(t,e){const n=new Proxy(t,{construct(o,i){return new o(i[0])},apply(o,i,a){return new n(a[0])}});return n}const P=class P{};P.LONG=3e3,P.MEDIUM=2100,P.SHORT=1500;let k=P;function L(t,e,n){return t.animate({opacity:1},{delay:e!=null?e:0,duration:n,easing:"ease-in"})}function j(t,e,n){return t.animate({opacity:0},{delay:e,duration:n,easing:"ease-out"})}function J(t,e,n){return B(this,null,function*(){yield L(t,e,300),yield j(t,n,n)})}class se extends r.EventObject{}class K{constructor(e={}){const n=[];let o,i,a=!1,u=!1,s=!1;const{width:l}=r.contentView.bounds,{screenWidth:f}=device,d=560,D={elevation:24,centerY:!0,padding:10,cornerRadius:5,opacity:0,background:"white",id:"modal-container"};d>f||d>l?Object.assign(D,{left:24,right:24}):Object.assign(D,{width:d});const S=new r.Composite({left:0,right:0,top:0,bottom:0,opacity:1,highlightOnTouch:!1,background:new r.Color(0,0,0,50)}).onTap(c=>c.preventDefault()),m=new r.Composite(D).appendTo(S);"title"in e&&m.append(new r.TextView({id:"modal-title",font:"medium 18px",padding:10,left:0,right:0,text:e.title.toCapitalize()}));const v=new r.Composite({top:"#modal-title",bottom:r.LayoutData.prev,right:0,left:0}),M=new r.ScrollView({layoutData:"stretchX"}).appendTo(v);m.onBoundsChanged(({value:c})=>{const{height:y}=r.contentView.bounds;yy?d-(d>y?20+d-y:0):d>c.height?c.height:d}),v.layoutData=p({},v.layoutData),M.layoutData="stretch")}),Object.defineProperty(this,"setButtonAccept",{configurable:!1,value:c=>(o||(o=N("accept",c)),o)}),Object.defineProperty(this,"setButtonCancel",{configurable:!1,value:c=>(i||(i=N("cancel",c)),i)}),Object.defineProperty(this,"addView",{configurable:!1,value:(...c)=>M.append(c)}),Object.defineProperty(this,"show",{configurable:!1,value:()=>{a||(a=!0,m.append(new r.Composite({layoutData:"stretchX",id:"buttons-modal",bottom:0}).append(n))),(!s||u)&&(s=!0,u=!1,m.append(v),r.contentView.append(S),L(m,0,100))}}),Object.defineProperty(this,"removeView",{configurable:!1,value:()=>M.children().dispose()}),Object.defineProperty(this,"removeButtons",{configurable:!1,value:()=>{o=i=null,n.forEach(c=>{c.dispose()})}}),Object.defineProperty(this,"remove",{configurable:!1,value:()=>{u||j(S,0,250).then(()=>{u=!0,s=!1,S.detach()})}});function N(c,y){const O=new r.Button({text:y,top:n.length===0?"prev() 20":"auto",right:n.length===0?0:"prev()",bottom:0,style:"text"}),H=new r.Listeners(O,c);return O.onTap(()=>H.trigger(new se)),n.push(O),H}}}class V extends k{constructor(e,n){super();const i=r.sizeMeasurement.measureTextsSync([{text:e,font:"12px"}])[0].width>r.contentView.bounds.width-20,a={};i?(a.left=20,a.right=20):a.centerX=!0;const u=r.TextView({text:e,font:"12px",textColor:"white",left:0,right:0}),s=r.Composite(p({background:"black",padding:10,cornerRadius:10,bottom:30,opacity:0},a)).append(u);Object.defineProperty(this,"show",{configurable:!1,value:()=>B(this,null,function*(){r.contentView.append(s),yield J(s,0,n),s.dispose()})})}static makeText(e,n=V.SHORT){return new V(e,n)}}function U(t,e){const n=t.children;delete t.children;const o=new e(t);return n&&o.append(n),o}class ue extends r.Composite{constructor(e){super({id:e,top:r.Constraint.prev,right:0,left:0,height:56,highlightOnTouch:!0})}}const le=t=>()=>t,fe=({children:t})=>()=>{const e=[];for(const n of t)typeof n=="function"&&e.push(n());return e},de=(t,e)=>{console.warn("deprecated function [menuDrawer] use setMenuDrawer"),z(t,e)};function G(){const t=r.drawer.find("#scrollableLayoutMenuDrawer"),e=t.length!==0?t.only():r.ScrollView({id:"scrollableLayoutMenuDrawer",top:r.Constraint.prev,left:0,right:0,bottom:0});return t.length===0&&r.drawer.append(e),e}function z(t,e){G().append(t.map(n=>{const o=r.Row({layoutData:"stretch",alignment:"centerY"});n.image&&o.append(r.ImageView({image:n.image,width:24,left:28}));const i=n.image?12:64;return o.append(r.TextView({text:n.text,font:"20px sans-serif",left:i})),new ue(n.id).append(o).onTap(function(){e(this),setTimeout(()=>r.drawer.close(),100)})}))}function F(t){const e=G(),n=r.drawer.find("#voirContentDrawer"),o=n.length===0?r.Composite({top:[r.Constraint.prev,15],left:0,right:0,id:"voirContentDrawer",padding:8}).append(t):n.only().append(t);n.length===0&&e.append(o)}const h=new Map;class Q extends r.NavigationView{set contentDrawer(e){this._contentDrawer=e}get contentDrawer(){return this._contentDrawer}set onActionSelect(e){this._onActionSelect=e}get onActionSelect(){return this._onActionSelect}set menuDrawer(e){this._dataMenuDrawer=e()}get menuDrawer(){return this._dataMenuDrawer}set onDrawerItemSelected(e){this._onDrawerItemSelected=e}get onDrawerItemSelected(){return this._onDrawerItemSelected}_render(){var e;((e=this.menuDrawer)==null?void 0:e.length)>0&&z(this.menuDrawer,this.onDrawerItemSelected),this._contentDrawer&&F(this._contentDrawer)}constructor(e){super(e),e.drawerActionVisible&&this._render(),this.on("addChild",({child:o})=>{o instanceof r.Action&&this._onActionSelect&&!o.data.voirInitalizedEvent&&o.onSelect(({target:i})=>this._onActionSelect(i)),o instanceof r.Page&&(h.set(o,{hidden:!1,actions:null,isDisposed:!1}),o.on("appear",()=>{const i=h.get(o);typeof i=="object"&&i.hidden&&(i.actions!==null&&this.append(i.actions),i.hidden=!1),h.size===1&&n(!0)}),o.on("disappear",()=>{var a;const i=h.get(o);n(!1),i.hidden||(i.hidden=!0,(a=i.actions)==null||a.forEach(u=>u.detach())),i.isDisposed&&h.delete(o)}),o.on("dispose",()=>{h.get(o).isDisposed=!0}))});function n(o){e!=null&&e.drawerActionVisible&&(r.drawer.enabled=o)}}append(...e){const n=super.append(...e);return setTimeout(()=>he(e),0),n}}function pe(t){const e=t.find(i=>i instanceof r.Page),n=t.filter(i=>i instanceof r.Action||i instanceof r.SearchAction?i.data.voirInitalizedEvent=!0:!1),o=h.get(e);return e&&n.length&&o.actions===null&&(o.actions=n),o}function he(t){let e=t.length>1?t:Array.isArray(t[0])?t.shift():t;if(e.some(n=>Array.isArray(n)))throw new Error("error parameter");if(Array.isArray(e)&&e.length>0)return pe(e)}function we(t){return U(t,Q)}const ge=w(we),C="voir-native-preference";localStorage.getItem(C)||localStorage.setItem(C,"{}");const b=JSON.parse(localStorage.getItem(C)),_=(t,e)=>{b[t]=e,localStorage.setItem(C,JSON.stringify(b))},E=t=>b[t],Z=t=>t in b,x=(t,e,n)=>r.NativeObject.defineProperty(t,e,n),me={left:0,right:"10%"},q=t=>e=>t.onTap(e);class g extends r.Composite{set onSelect(e){q(this)(e)}get onSelect(){return q(this)}constructor(e){super(p({left:0,right:0,padding:10,top:"prev()",highlightOnTouch:!0},e)),Z(this.key)||_(this.key,this.value);const n=this.summary.length===0?!0:0,o={text:this.title.toCapitalize()};n?o.centerY=!0:o.top="prev()",this.append(new r.TextView(o)),this.summary.length>0&&this.append(new r.TextView(p({text:this.summary,top:["prev()",0]},me)))}}x(g.prototype,"title",{type:"string",default:""});x(g.prototype,"summary",{type:"string",default:""});x(g.prototype,"key",{type:"string",default:""});x(g.prototype,"value",{type:"string",default:""});class A extends g{constructor(e){var i;let n;const o=e.onSelect;e.onSelect=()=>n&&(n.checked=!n.checked),super(e),n=this._getButton({right:0,centerY:!0,checked:(i=E(this.key))!=null?i:this.value}),typeof n!="undefined"&&(this.addListener(n,o),this.append(n))}addListener(e,n){e.on("checkedChanged",o=>{_(this.key,e.checked),typeof n=="function"&&n.call(this,o)})}}function ye(t={}){return new $(t)}class $ extends A{constructor(e){super(e)}_getButton(e){return new r.CheckBox(e)}}const xe=w(ye);function Pe(t={}){return new ee(t)}class ee extends A{constructor(e){super(e)}_getButton(e){return new r.Switch(e)}}const Ce=w(Pe);function be(t){return new te(t)}class te extends g{constructor(e){super(e)}}const De=w(be);class ne extends r.Page{constructor(e){super(e)}}function Se(t){return U(p({layoutData:"stretch"},t),ne)}const ve=w(Se);function ke(t={}){return new T(t)}class T extends A{_getButton(){}constructor(e){const n=e.onSelect;super(e),this.onSelect(()=>{const i=new K({title:this.title.toCapitalize()});this.entries&&this.entries.length>0&&i.addView(...this.entries.map((a,u)=>{var l;const s=r.RadioButton({text:a.text,checked:(l=a.checked)!=null?l:parseInt(E(this.key))===u,layoutData:{top:[r.LayoutData.prev,5],left:0,right:0}}).onSelect(f=>{f.checked&&(_(this.key,u),typeof n=="function"&&n.call(this,f))});return a.id&&(s.id=a.id),s})),i.setButtonAccept(this.textButtonAccept.toUpperCase()).addListener(o.bind(i)),i.show()});function o(){this.remove()}}}const Ve=w(ke);x(T.prototype,"entries",{type:"any",default:[]});x(T.prototype,"textButtonAccept",{type:"string",default:"accept"});let I;r.contentView.on("addChild",({child:t})=>{t instanceof r.NavigationView&&!I&&(I=t)});function R(...t){return I.append(...t)}class _e{constructor(){const e=[];if(typeof this.renderAction=="function"){const n=this.renderAction();n&&e.push(...Array.from(n))}R(...e,this.render())}}const Ae=Object.freeze({Render:_e,factory(t){return w(t)}});exports.$preference=b;exports.AbstractItemPreference=g;exports.AnimationTime=k;exports.CheckBoxPreference=xe;exports.CheckBoxPreferenceComponent=$;exports.Checked=A;exports.CoordinatePage=ge;exports.CoordinatePageComponent=Q;exports.DrawerMenu=fe;exports.DrawerMenuItem=le;exports.ListPreference=Ve;exports.ListPreferenceComponent=T;exports.Modal=K;exports.PreferenceScreen=ve;exports.PreferenceScreenComponent=ne;exports.SwitchPreference=Ce;exports.SwitchPreferenceComponent=ee;exports.TextPreference=De;exports.TextPreferenceComponent=te;exports.Toast=V;exports.Voir=Ae;exports.addView=R;exports.animate=J;exports.animateHidden=j;exports.animateShow=L;exports.default=R;exports.existsKeyPreference=Z;exports.getValuePreference=E;exports.menuDrawer=de;exports.name_key_pref=C;exports.setContentDrawer=F;exports.setMenuDrawer=z;exports.setPreference=_; +"use strict";var ce=Object.defineProperty,le=Object.defineProperties;var ue=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var fe=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable;var G=(n,e,t)=>e in n?ce(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,p=(n,e)=>{for(var t in e||(e={}))fe.call(e,t)&&G(n,t,e[t]);if(U)for(var t of U(e))de.call(e,t)&&G(n,t,e[t]);return n},V=(n,e)=>le(n,ue(e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("tabris");require("string-tocapitalize");function P(n){return new Proxy(n,{apply(t,r,s){return Reflect.construct(t,s)}})}function pe(n){const e={get(t,r,s){return Reflect.get(t,r,s)},apply(t,r,s){return typeof t.name=="string"&&typeof t.constructor=="function"?Reflect.construct(t,s):Reflect.apply(null,t,s)}};return new Proxy(n,e)}const x=class x{};x.LONG=3e3,x.MEDIUM=2100,x.SHORT=1500;let T=x;function H(n,e,t){return n.animate({opacity:1},{delay:e!=null?e:0,duration:t,easing:"ease-in"})}function N(n,e,t){return n.animate({opacity:0},{delay:e,duration:t,easing:"ease-out"})}function Q(n,e,t){return Promise.resolve(H(n,e,300)).then(()=>Promise.resolve(N(n,t,t)))}class he extends o.EventObject{}class Z{constructor(e={}){const t=[];let r,s,i=!1,u=!1,l=!1;const{width:c}=o.contentView.bounds,{screenWidth:d}=device,f=560,w={elevation:24,centerY:!0,padding:10,cornerRadius:5,opacity:0,background:"white",id:"modal-container"};f>d||f>c?Object.assign(w,{left:24,right:24}):Object.assign(w,{width:f});const _=new o.Composite({left:0,right:0,top:0,bottom:0,opacity:1,highlightOnTouch:!1,background:new o.Color(0,0,0,50)}).onTap(a=>a.preventDefault()),y=new o.Composite(w).appendTo(_);"title"in e&&y.append(new o.TextView({id:"modal-title",font:"medium 18px",padding:10,left:0,right:0,text:e.title.toCapitalize()}));const M=new o.Composite({top:"#modal-title",bottom:o.LayoutData.prev,right:0,left:0}),E=new o.ScrollView({layoutData:"stretchX"}).appendTo(M);y.onBoundsChanged(({value:a})=>{const{height:v}=o.contentView.bounds;vv?f-(f>v?20+f-v:0):f>a.height?a.height:f}),M.layoutData=p({},M.layoutData),E.layoutData="stretch")}),Object.defineProperty(this,"setButtonAccept",{configurable:!1,value:a=>(r||(r=J("accept",a)),r)}),Object.defineProperty(this,"setButtonCancel",{configurable:!1,value:a=>(s||(s=J("cancel",a)),s)}),Object.defineProperty(this,"addView",{configurable:!1,value:(...a)=>E.append(a)}),Object.defineProperty(this,"show",{configurable:!1,value:()=>{i||(i=!0,y.append(new o.Composite({layoutData:"stretchX",id:"buttons-modal",bottom:0}).append(t))),(!l||u)&&(l=!0,u=!1,y.append(M),o.contentView.append(_),H(y,0,100))}}),Object.defineProperty(this,"removeView",{configurable:!1,value:()=>E.children().dispose()}),Object.defineProperty(this,"removeButtons",{configurable:!1,value:()=>{r=s=null,t.forEach(a=>{a.dispose()})}}),Object.defineProperty(this,"remove",{configurable:!1,value:()=>{u||N(_,0,250).then(()=>{u=!0,l=!1,_.detach()})}});function J(a,v){const R=new o.Button({text:v,top:t.length===0?"prev() 20":"auto",right:t.length===0?0:"prev()",bottom:0,style:"text"}),K=new o.Listeners(R,a);return R.onTap(()=>K.trigger(new he)),t.push(R),K}}}let h=[];class O extends T{constructor(e,t){super(),this._message=o.TextView({textColor:"white",left:0,right:0}),this._modal=o.Composite({background:"black",padding:10,cornerRadius:10,bottom:30,opacity:0}).append(this._message);const r="12px";o.sizeMeasurement.measureTextsSync([{text:e,font:r}])[0].width>o.contentView.bounds.width-20?(this._modal.left=20,this._modal.right=20):this._modal.centerX=!0,this._message.text=e,this._message.font=r,Object.defineProperty(this,"show",{configurable:!1,value:()=>{if(h.length===1&&u(),h.length>0)h.push({element:this._modal,promise:()=>new Promise(c=>{c(l(this._modal))})});else{const c=l(this._modal);h.push({promise:()=>c,element:this._modal})}}});const u=()=>{if(h.length===0)return;const{promise:c,element:d}=h.at(0);c().then(()=>{h.shift(),d.dispose(),u()}).catch(console.log)};function l(c){return o.contentView.append(c),Q(c,0,t)}}static makeText(e,t=O.SHORT){return new O(e,t)}}const z=new Map;function me(n){return n instanceof Object&&n.constructor?n.constructor:n}function $(n){return z.get(me(n))}b.addListener=(n,e,t)=>{const{store:r}=$(n);r.has(n)||r.set(n,{event:{},listeners:new WeakMap}),r.get(n).event[e]=t};b.listener=(n,e)=>{const{instanceOf:t,store:r}=$(n);for(let{listeners:s,element:i,invoke:u}of t){if(!(e instanceof i))continue;const l=r.get(n);l.listeners.has(e)||l.listeners.set(e,s.map(c=>{const d=new o.Listeners(e,c);return d.addListener(f=>{for(let w of u)l.event[w](f.target,f)}),d}))}};function b(n,e){z.has(n)||z.set(n,V(p({},e),{store:new WeakMap}))}class Y extends o.Composite{constructor(e){super({id:e,top:o.Constraint.prev,right:0,left:0,height:56,highlightOnTouch:!0})}}class A extends o.Row{constructor(e){super({layoutData:"stretch",alignment:"centerY"}),this.id=e.id,this._setElements(e.image,e.text)}_setElements(e,t){const r="voir-img-ref-"+this.id,s="voir-text-ref-"+this.id;e&&this.append(o.ImageView({image:e,width:24,left:28,id:r}));const i=e?12:64;this.append(o.TextView({text:t,font:"20px sans-serif",left:i,id:s}))}}const ge=A,we=({children:n})=>new o.WidgetCollection(n),ye=(n,e)=>{console.warn("deprecated function [menuDrawer] use setMenuDrawer"),X(n,e)};function ee(){const n=o.drawer.find("#scrollableLayoutMenuDrawer"),e=n.length!==0?n.only():o.ScrollView({id:"scrollableLayoutMenuDrawer",top:o.Constraint.prev,left:0,right:0,bottom:0});return n.length===0&&o.drawer.append(e),e}function X(n,e){ee().append(n.map(t=>{const r=t instanceof A,s=t.id;return r&&(t.id=""),new Y(s).append(r?t:new A({image:t.image,text:t.text})).onTap(function(){typeof e=="function"&&e(this);const i=setTimeout(()=>(o.drawer.close(),clearTimeout(i)),100)})}))}function te(n){const e=ee(),t=o.drawer.find("#voirContentDrawer"),r=t.length===0?o.Composite({top:[o.Constraint.prev,15],left:0,right:0,id:"voirContentDrawer",padding:8}).append(n):t.only().append(n);t.length===0&&e.append(r)}const m=new Map,L=class L extends o.NavigationView{constructor(e){super(e),this._renderWidgetInDrawer=(()=>{let t=!1;return()=>{if(t)return;t=!0;const r=()=>{X(this.menuDrawer),te(this.contentDrawer),this.menuDrawer.forEach(s=>{b.listener(this,s.parent())})};this.drawerActionVisible&&r()}})()}set contentDrawer(e){this._contentDrawer=e}get contentDrawer(){return this._contentDrawer}set menuDrawer(e){this._dataMenuDrawer=e.toArray()}get menuDrawer(){return this._dataMenuDrawer}on(e,t,r){return typeof e=="string"&&L.events.includes(e)&&b.addListener(this,e,t),super.on(e,t,r)}_addChild(e){b.listener(this,e),e instanceof o.Page&&(m.set(e,{hidden:!1,actions:null,isDisposed:!1}),e.on("appear",()=>{this._renderWidgetInDrawer();const r=m.get(e);typeof r=="object"&&r.hidden&&(r.actions!==null&&this.append(r.actions),r.hidden=!1),m.size===1&&t(!0)}),e.on("disappear",()=>{var s;const r=m.get(e);t(!1),r.hidden||(r.hidden=!0,(s=r.actions)==null||s.forEach(i=>i.detach())),r.isDisposed&&m.delete(e)}),e.on("dispose",()=>{m.get(e).isDisposed=!0}));const t=r=>{this!=null&&this.drawerActionVisible&&(o.drawer.enabled=r)};return super._addChild(e)}append(...e){const t=super.append(...e);return setTimeout(()=>be(e),0),t}};L.events=["actionSelected","drawerItemSelected"];let D=L;function ve(n){const e=n.find(s=>s instanceof o.Page),t=n.filter(s=>s instanceof o.Action||s instanceof o.SearchAction?s.data.voirInitializedEvent=!0:!1),r=m.get(e);return e&&t.length&&r.actions===null&&(r.actions=t),r}function be(n){let e=n.length>1?n:Array.isArray(n[0])?n.shift():n;if(e.some(t=>Array.isArray(t)))throw new Error("error parameter");if(Array.isArray(e)&&e.length>0)return ve(e)}b(D,{instanceOf:[{element:o.Action,listeners:["select"],invoke:["actionSelected"]},{element:o.SearchAction,listeners:["select"],invoke:["actionSelected"]},{element:Y,listeners:["tap"],invoke:["drawerItemSelected"]}],nameEvents:["actionSelected","drawerItemSelected"]});const Pe=P(D),S="voir-native-preference";localStorage.getItem(S)||localStorage.setItem(S,"{}");const k=JSON.parse(localStorage.getItem(S)),I=(n,e)=>{k[n]=e,localStorage.setItem(S,JSON.stringify(k))},q=n=>k[n],ne=n=>n in k,C=(n,e,t)=>o.NativeObject.defineProperty(n,e,t),Ce={left:0,right:"10%"},F=n=>e=>n.onTap(e);class g extends o.Composite{set onSelect(e){F(this)(e)}get onSelect(){return F(this)}constructor(e){super(p({left:0,right:0,padding:10,top:"prev()",highlightOnTouch:!0},e)),ne(this.key)||I(this.key,this.value);const t=this.summary.length===0?!0:0,r={text:this.title.toCapitalize()};t?r.centerY=!0:r.top="prev()",this.append(new o.TextView(r)),this.summary.length>0&&this.append(new o.TextView(p({text:this.summary,top:["prev()",0]},Ce)))}}C(g.prototype,"title",{type:"string",default:""});C(g.prototype,"summary",{type:"string",default:""});C(g.prototype,"key",{type:"string",default:""});C(g.prototype,"value",{type:"string",default:""});class B extends g{constructor(e){var s;let t;const r=e.onSelect;e.onSelect=()=>t&&(t.checked=!t.checked),super(e),t=this._getButton({right:0,centerY:!0,checked:(s=q(this.key))!=null?s:this.value}),typeof t!="undefined"&&(this.addListener(t,r),this.append(t))}addListener(e,t){e.on("checkedChanged",r=>{I(this.key,e.checked),typeof t=="function"&&t.call(this,r)})}}class re extends B{constructor(e){super(e)}_getButton(e){return new o.CheckBox(e)}}const xe=P(re);class oe extends B{constructor(e){super(e)}_getButton(e){return new o.Switch(e)}}const De=P(oe);class se extends g{constructor(e){super(e)}}const Se=P(se);class ie extends o.Page{constructor(e){super(V(p({},e),{layoutData:"stretch"}))}}const ke=P(ie);class j extends B{_getButton(){}constructor(e){const t=e.onSelect;super(e),this.onSelect(()=>{const s=new Z({title:this.title.toCapitalize()});this.entries&&this.entries.length>0&&s.addView(...this.entries.map((i,u)=>{var c;const l=o.RadioButton({text:i.text,checked:(c=i.checked)!=null?c:parseInt(q(this.key))===u,layoutData:{top:[o.LayoutData.prev,5],left:0,right:0}}).onSelect(d=>{d.checked&&(I(this.key,u),typeof t=="function"&&t.call(this,d))});return i.id&&(l.id=i.id),l})),s.setButtonAccept(this.textButtonAccept.toUpperCase()).addListener(r.bind(s)),s.show()});function r(){this.remove()}}}const _e=P(j);C(j.prototype,"entries",{type:"any",default:[]});C(j.prototype,"textButtonAccept",{type:"string",default:"accept"});let W;o.contentView.on("addChild",({child:n})=>{n instanceof o.NavigationView&&!W&&(W=n)});function ae(...n){return W.append(...n)}class Me{constructor(){const e=[];if(typeof this.renderAction=="function"){const t=this.renderAction();t&&e.push(...Array.from(t))}ae(...e,this.render())}}const Ve=Object.freeze({Render:Me,factory(n){return pe(n)}});exports.$preference=k;exports.AbstractItemPreference=g;exports.AnimationTime=T;exports.CheckBoxPreference=xe;exports.CheckBoxPreferenceComponent=re;exports.Checked=B;exports.CoordinatePage=Pe;exports.CoordinatePageComponent=D;exports.DrawerMenu=we;exports.DrawerMenuItem=ge;exports.ListPreference=_e;exports.ListPreferenceComponent=j;exports.MenuAction=Y;exports.MenuItem=A;exports.Modal=Z;exports.PreferenceScreen=ke;exports.PreferenceScreenComponent=ie;exports.SwitchPreference=De;exports.SwitchPreferenceComponent=oe;exports.TextPreference=Se;exports.TextPreferenceComponent=se;exports.Toast=O;exports.Voir=Ve;exports.addView=ae;exports.animate=Q;exports.animateHidden=N;exports.animateShow=H;exports.existsKeyPreference=ne;exports.getValuePreference=q;exports.menuDrawer=ye;exports.name_key_pref=S;exports.setContentDrawer=te;exports.setMenuDrawer=X;exports.setPreference=I; diff --git a/src/modal/toast.ts b/src/modal/toast.ts index bdeec95..c232895 100644 --- a/src/modal/toast.ts +++ b/src/modal/toast.ts @@ -11,7 +11,7 @@ import { animate } from "./animation"; let stackToast: ({element: Composite, promise: ()=> Promise})[] = []; export default class Toast extends AnimationTime { - show: (time: number) => any; + show: () => any; readonly _message = TextView({ textColor: "white",