Files
vanillajs-seed/node_modules/pnotify/dist/es/PNotifyReference.js
2019-04-12 20:01:07 +02:00

2 lines
5.5 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import PNotify from"./PNotify.js";function data(){return Object.assign({_notice:null,_options:{},_mouseIsIn:!1},PNotify.modules.Reference.defaults)}var methods={initModule(e){this.set(e);const{_notice:t}=this.get();t.on("mouseenter",()=>this.set({_mouseIsIn:!0})),t.on("mouseleave",()=>this.set({_mouseIsIn:!1}))},doSomething(){let e=0;const{_notice:t}=this.get(),n=setInterval(()=>{360===(e+=10)&&(e=0,clearInterval(n)),t.refs.elem.style.transform="rotate("+e+"deg)"},20)},update(){},beforeOpen(){},afterOpen(){},beforeClose(){},afterClose(){},beforeDestroy(){},afterDestroy(){}};function oncreate(){this.fire("init",{module:this})}function setup(e){e.key="Reference",e.defaults={putThing:!1,labels:{text:"Spin Around"}},PNotify.modules.Reference=e,PNotify.modulesAppendContainer.push(e),Object.assign(PNotify.icons.brighttheme,{athing:"bt-icon bt-icon-refresh"}),Object.assign(PNotify.icons.bootstrap3,{athing:"glyphicon glyphicon-refresh"}),Object.assign(PNotify.icons.fontawesome4,{athing:"fa fa-refresh"}),Object.assign(PNotify.icons.fontawesome5,{athing:"fas fa-sync"}),PNotify.icons.material||(PNotify.icons.material={}),Object.assign(PNotify.icons.material,{athing:"material-icons pnotify-material-icon-refresh"})}function add_css(){var e=createElement("style");e.id="svelte-1qy4b0e-style",e.textContent=".ui-pnotify-reference-button.svelte-1qy4b0e{float:right}.ui-pnotify-reference-clearing.svelte-1qy4b0e{clear:right;line-height:0}",append(document.head,e)}function create_main_fragment(e,t){var n,i=t.putThing&&create_if_block(e,t);return{c(){i&&i.c(),n=createComment()},m(e,t){i&&i.m(e,t),insert(e,n,t)},p(t,s){s.putThing?i?i.p(t,s):((i=create_if_block(e,s)).c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null)},d(e){i&&i.d(e),e&&detachNode(n)}}}function create_if_block(e,t){var n,i,s,o,r,a,c,f,l=t.labels.text;function h(t){e.doSomething()}return{c(){n=createElement("button"),i=createElement("i"),o=createText(" "),r=createText(l),c=createText("\n \n "),f=createElement("div"),i.className=s=t._notice.get()._icons.athing+" svelte-1qy4b0e",addListener(n,"click",h),n.className="ui-pnotify-reference-button btn btn-default svelte-1qy4b0e",n.type="button",n.disabled=a=!t._mouseIsIn,f.className="ui-pnotify-reference-clearing svelte-1qy4b0e"},m(t,s){insert(t,n,s),append(n,i),append(n,o),append(n,r),e.refs.thingElem=n,insert(t,c,s),insert(t,f,s)},p(e,t){e._notice&&s!==(s=t._notice.get()._icons.athing+" svelte-1qy4b0e")&&(i.className=s),e.labels&&l!==(l=t.labels.text)&&setData(r,l),e._mouseIsIn&&a!==(a=!t._mouseIsIn)&&(n.disabled=a)},d(t){t&&detachNode(n),removeListener(n,"click",h),e.refs.thingElem===n&&(e.refs.thingElem=null),t&&(detachNode(c),detachNode(f))}}}function PNotifyReference(e){init(this,e),this.refs={},this._state=assign(data(),e.data),this._intro=!0,document.getElementById("svelte-1qy4b0e-style")||add_css(),this._fragment=create_main_fragment(this,this._state),this.root._oncreate.push(()=>{oncreate.call(this),this.fire("update",{changed:assignTrue({},this._state),current:this._state})}),e.target&&(this._fragment.c(),this._mount(e.target,e.anchor),flush(this))}function createElement(e){return document.createElement(e)}function append(e,t){e.appendChild(t)}function createComment(){return document.createComment("")}function insert(e,t,n){e.insertBefore(t,n)}function detachNode(e){e.parentNode.removeChild(e)}function createText(e){return document.createTextNode(e)}function addListener(e,t,n,i){e.addEventListener(t,n,i)}function setData(e,t){e.data=""+t}function removeListener(e,t,n,i){e.removeEventListener(t,n,i)}function init(e,t){e._handlers=blankObject(),e._slots=blankObject(),e._bind=t._bind,e._staged={},e.options=t,e.root=t.root||e,e.store=t.store||e.root.store,t.root||(e._beforecreate=[],e._oncreate=[],e._aftercreate=[])}function assign(e,t){for(var n in t)e[n]=t[n];return e}function assignTrue(e,t){for(var n in t)e[n]=1;return e}function flush(e){e._lock=!0,callAll(e._beforecreate),callAll(e._oncreate),callAll(e._aftercreate),e._lock=!1}function destroy(e){this.destroy=noop,this.fire("destroy"),this.set=noop,this._fragment.d(!1!==e),this._fragment=null,this._state={}}function get(){return this._state}function fire(e,t){var n=e in this._handlers&&this._handlers[e].slice();if(n)for(var i=0;i<n.length;i+=1){var s=n[i];if(!s.__calling)try{s.__calling=!0,s.call(this,t)}finally{s.__calling=!1}}}function on(e,t){var n=this._handlers[e]||(this._handlers[e]=[]);return n.push(t),{cancel:function(){var e=n.indexOf(t);~e&&n.splice(e,1)}}}function set(e){this._set(assign({},e)),this.root._lock||flush(this.root)}function _set(e){var t=this._state,n={},i=!1;for(var s in e=assign(this._staged,e),this._staged={},e)this._differs(e[s],t[s])&&(n[s]=i=!0);i&&(this._state=assign(assign({},t),e),this._recompute(n,this._state),this._bind&&this._bind(n,this._state),this._fragment&&(this.fire("state",{changed:n,current:this._state,previous:t}),this._fragment.p(n,this._state),this.fire("update",{changed:n,current:this._state,previous:t})))}function _stage(e){assign(this._staged,e)}function _mount(e,t){this._fragment[this._fragment.i?"i":"m"](e,t||null)}function _differs(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function noop(){}function blankObject(){return Object.create(null)}function callAll(e){for(;e&&e.length;)e.shift()()}assign(PNotifyReference.prototype,{destroy:destroy,get:get,fire:fire,on:on,set:set,_set:_set,_stage:_stage,_mount:_mount,_differs:_differs}),assign(PNotifyReference.prototype,methods),PNotifyReference.prototype._recompute=noop,setup(PNotifyReference);export default PNotifyReference;
//# sourceMappingURL=PNotifyReference.js.map