2 lines
7.9 KiB
JavaScript
2 lines
7.9 KiB
JavaScript
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},_extends=Object.assign||function(i){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(i[o]=e[o])}return i},PNotifyMobile=function(e){"use strict";e=e&&e.__esModule?e.default:e;var t,i={initModule:function(i){var o=this;this.set(i);var n=this.get()._notice,s=null,r=null,l=null,a=null,f="left",p="X",e="Width";n.on("touchstart",function(i){if(o.get().swipeDismiss){var t=n.get().stack;if(!1!==t)switch(t.dir1){case"up":case"down":f="left",p="X",e="Width";break;case"left":case"right":f="top",p="Y",e="Height"}s=i.touches[0]["screen"+p],l=n.refs.elem["scroll"+e],a=window.getComputedStyle(n.refs.elem).opacity,n.refs.container.style[f]=0}}),n.on("touchmove",function(i){if(s&&o.get().swipeDismiss){var t=i.touches[0]["screen"+p];r=t-s;var e=(1-Math.abs(r)/l)*a;n.refs.elem.style.opacity=e,n.refs.container.style[f]=r+"px"}}),n.on("touchend",function(){if(s&&o.get().swipeDismiss){if(n.refs.container.classList.add("ui-pnotify-mobile-animate-left"),40<Math.abs(r)){var i=r<0?-2*l:2*l;n.refs.elem.style.opacity=0,n.refs.container.style[f]=i+"px",n.close()}else n.refs.elem.style.removeProperty("opacity"),n.refs.container.style.removeProperty(f);a=l=r=s=null}}),n.on("touchcancel",function(){s&&o.get().swipeDismiss&&(n.refs.elem.style.removeProperty("opacity"),n.refs.container.style.removeProperty(f),a=l=r=s=null)}),this.doMobileStyling()},update:function(){this.doMobileStyling()},beforeOpen:function(){window.addEventListener("resize",this.get()._doMobileStylingBound)},afterClose:function(){if(window.removeEventListener("resize",this.get()._doMobileStylingBound),this.get().swipeDismiss){var i=this.get()._notice;i.refs.elem.style.removeProperty("opacity"),i.refs.container.style.removeProperty("left"),i.refs.container.style.removeProperty("top")}},doMobileStyling:function(){var i=this.get()._notice,t=i.get().stack;if(this.get().styling){if(!1!==t)switch(window.innerWidth<=480?(t.mobileOrigSpacing1||(t.mobileOrigSpacing1=t.spacing1),t.spacing1=0,t.mobileOrigFirstpos1||(t.mobileOrigFirstpos1=t.firstpos1),t.firstpos1=0,t.mobileOrigSpacing2||(t.mobileOrigSpacing2=t.spacing2),t.spacing2=0,t.mobileOrigFirstpos2||(t.mobileOrigFirstpos2=t.firstpos2),t.firstpos2=0):(t.mobileOrigSpacing1&&(t.spacing1=t.mobileOrigSpacing1,delete t.mobileOrigSpacing1),t.mobileOrigFirstpos1&&(t.firstpos1=t.mobileOrigFirstpos1,delete t.mobileOrigFirstpos1),t.mobileOrigSpacing2&&(t.spacing2=t.mobileOrigSpacing2,delete t.mobileOrigSpacing2),t.mobileOrigFirstpos2&&(t.firstpos2=t.mobileOrigFirstpos2,delete t.mobileOrigFirstpos2)),t.dir1){case"down":i.addModuleClass("ui-pnotify-mobile-top");break;case"up":i.addModuleClass("ui-pnotify-mobile-bottom");break;case"left":i.addModuleClass("ui-pnotify-mobile-right");break;case"right":i.addModuleClass("ui-pnotify-mobile-left")}i.addModuleClass("ui-pnotify-mobile-able")}else i.removeModuleClass("ui-pnotify-mobile-able","ui-pnotify-mobile-top","ui-pnotify-mobile-bottom","ui-pnotify-mobile-right","ui-pnotify-mobile-left"),!1!==t&&(t.mobileOrigSpacing1&&(t.spacing1=t.mobileOrigSpacing1,delete t.mobileOrigSpacing1),t.mobileOrigFirstpos1&&(t.firstpos1=t.mobileOrigFirstpos1,delete t.mobileOrigFirstpos1),t.mobileOrigSpacing2&&(t.spacing2=t.mobileOrigSpacing2,delete t.mobileOrigSpacing2),t.mobileOrigFirstpos2&&(t.firstpos2=t.mobileOrigFirstpos2,delete t.mobileOrigFirstpos2))}};function o(){var i=function(i){return document.createElement(i)}("style");i.id="svelte-49u8sj-style",i.textContent="[ui-pnotify] .ui-pnotify-container{position:relative}[ui-pnotify] .ui-pnotify-mobile-animate-left{transition:left .1s ease}[ui-pnotify] .ui-pnotify-mobile-animate-top{transition:top .1s ease}@media(max-width: 480px){[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able{font-size:1.2em;-webkit-font-smoothing:antialiased;-moz-font-smoothing:antialiased;-ms-font-smoothing:antialiased;font-smoothing:antialiased}body > [ui-pnotify].ui-pnotify.ui-pnotify-mobile-able{position:fixed}[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able.ui-pnotify-mobile-top,[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able.ui-pnotify-mobile-bottom{width:100% !important}[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able.ui-pnotify-mobile-left,[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able.ui-pnotify-mobile-right{height:100% !important}[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able .ui-pnotify-shadow{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able.ui-pnotify-mobile-top .ui-pnotify-shadow{border-bottom-width:5px}[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able.ui-pnotify-mobile-bottom .ui-pnotify-shadow{border-top-width:5px}[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able.ui-pnotify-mobile-left .ui-pnotify-shadow{border-right-width:5px}[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able.ui-pnotify-mobile-right .ui-pnotify-shadow{border-left-width:5px}[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able .ui-pnotify-container{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able.ui-pnotify-mobile-top .ui-pnotify-container,[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able.ui-pnotify-mobile-bottom .ui-pnotify-container{width:auto !important}[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able.ui-pnotify-mobile-left .ui-pnotify-container,[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able.ui-pnotify-mobile-right .ui-pnotify-container{height:100% !important}}",function(i,t){i.appendChild(t)}(document.head,i)}function n(i){var t=this;!function(i,t){i._handlers=a(),i._slots=a(),i._bind=t._bind,i._staged={},i.options=t,i.root=t.root||i,i.store=t.store||i.root.store,t.root||(i._beforecreate=[],i._oncreate=[],i._aftercreate=[])}(this,i),this._state=r(_extends({_notice:null,_options:{}},e.modules.Mobile.defaults),i.data),this._intro=!0,document.getElementById("svelte-49u8sj-style")||o(),this._fragment=(this._state,{c:s,m:s,p:s,d:s}),this.root._oncreate.push(function(){(function(){this.set({_doMobileStylingBound:this.doMobileStyling.bind(this)})}).call(t),t.fire("update",{changed:function(i,t){for(var e in t)i[e]=1;return i}({},t._state),current:t._state})}),i.target&&(this._fragment.c(),this._mount(i.target,i.anchor),l(this))}function s(){}function r(i,t){for(var e in t)i[e]=t[e];return i}function l(i){i._lock=!0,f(i._beforecreate),f(i._oncreate),f(i._aftercreate),i._lock=!1}function a(){return Object.create(null)}function f(i){for(;i&&i.length;)i.shift()()}return r(n.prototype,{destroy:function(i){this.destroy=s,this.fire("destroy"),this.set=s,this._fragment.d(!1!==i),this._fragment=null,this._state={}},get:function(){return this._state},fire:function(i,t){var e=i in this._handlers&&this._handlers[i].slice();if(!e)return;for(var o=0;o<e.length;o+=1){var n=e[o];if(!n.__calling)try{n.__calling=!0,n.call(this,t)}finally{n.__calling=!1}}},on:function(i,t){var e=this._handlers[i]||(this._handlers[i]=[]);return e.push(t),{cancel:function(){var i=e.indexOf(t);~i&&e.splice(i,1)}}},set:function(i){if(this._set(r({},i)),this.root._lock)return;l(this.root)},_set:function(i){var t=this._state,e={},o=!1;for(var n in i=r(this._staged,i),this._staged={},i)this._differs(i[n],t[n])&&(e[n]=o=!0);if(!o)return;this._state=r(r({},t),i),this._recompute(e,this._state),this._bind&&this._bind(e,this._state);this._fragment&&(this.fire("state",{changed:e,current:this._state,previous:t}),this._fragment.p(e,this._state),this.fire("update",{changed:e,current:this._state,previous:t}))},_stage:function(i){r(this._staged,i)},_mount:function(i,t){this._fragment[this._fragment.i?"i":"m"](i,t||null)},_differs:function(i,t){return i!=i?t==t:i!==t||i&&"object"===(void 0===i?"undefined":_typeof(i))||"function"==typeof i}}),r(n.prototype,i),n.prototype._recompute=s,(t=n).key="Mobile",t.defaults={swipeDismiss:!0,styling:!0},t.init=function(i){return new t({target:document.body})},e.modules.Mobile=t,n}(PNotify);
|
|
//# sourceMappingURL=PNotifyMobile.js.map
|