wishthis/node_modules/fomantic-ui/dist/components/transition.min.js
2022-04-07 09:06:43 +02:00

11 lines
No EOL
14 KiB
JavaScript

/*
* # Fomantic UI - 2.9.0-beta.274+23f6671
* https://github.com/fomantic/Fomantic-UI
* http://fomantic-ui.com/
*
* Copyright 2022 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
!function(C,n,S,A){"use strict";C.isFunction=C.isFunction||function(n){return"function"==typeof n&&"number"!=typeof n.nodeType},n=void 0!==n&&n.Math==Math?n:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),C.fn.transition=function(){var f,r=C(this),p=r.selector||"",g=(new Date).getTime(),v=[],b=arguments,y=b[0],h=[].slice.call(arguments,1),w="string"==typeof y;return r.each(function(i){var l,s,e,c,t,a,n,o,d=C(this),u=this,m={initialize:function(){l=m.get.settings.apply(u,b),c=l.className,e=l.error,t=l.metadata,o="."+l.namespace,n="module-"+l.namespace,s=d.data(n)||m,a=m.get.animationEndEvent(),!1===(w=w&&m.invoke(y))&&(m.verbose("Converted arguments into settings object",l),l.interval?m.delay(l.animate):m.animate(),m.instantiate())},instantiate:function(){m.verbose("Storing instance of module",m),s=m,d.data(n,s)},destroy:function(){m.verbose("Destroying previous module for",u),d.removeData(n)},refresh:function(){m.verbose("Refreshing display type on next animation"),delete m.displayType},forceRepaint:function(){m.verbose("Forcing element repaint");var n=d.parent(),e=d.next();0===e.length?d.detach().appendTo(n):d.detach().insertBefore(e)},repaint:function(){m.verbose("Repainting element");u.offsetWidth},delay:function(n){var e=(e=m.get.animationDirection())||(m.can.transition()?m.get.direction():"static");n=n!==A?n:l.interval,n="auto"==l.reverse&&e==c.outward||1==l.reverse?(r.length-i)*l.interval:i*l.interval,m.debug("Delaying animation by",n),setTimeout(m.animate,n)},animate:function(n){if(l=n||l,!m.is.supported())return m.error(e.support),!1;if(m.debug("Preparing animation",l.animation),m.is.animating()){if(l.queue)return!l.allowRepeats&&m.has.direction()&&m.is.occurring()&&!0!==m.queuing?m.debug("Animation is currently occurring, preventing queueing same animation",l.animation):m.queue(l.animation),!1;if(!l.allowRepeats&&m.is.occurring())return m.debug("Animation is already occurring, will not execute repeated animation",l.animation),!1;m.debug("New animation started, completing previous early",l.animation),s.complete()}m.can.animate()?m.set.animating(l.animation):m.error(e.noAnimation,l.animation,u)},reset:function(){m.debug("Resetting animation to beginning conditions"),m.remove.animationCallbacks(),m.restore.conditions(),m.remove.animating()},queue:function(n){m.debug("Queueing animation of",n),m.queuing=!0,d.one(a+".queue"+o,function(){m.queuing=!1,m.repaint(),m.animate.apply(this,l)})},complete:function(n){n&&n.target===u&&n.stopPropagation(),m.debug("Animation complete",l.animation),m.remove.completeCallback(),m.remove.failSafe(),m.is.looping()||(m.is.outward()?(m.verbose("Animation is outward, hiding element"),m.restore.conditions(),m.hide()):m.is.inward()?(m.verbose("Animation is outward, showing element"),m.restore.conditions(),m.show()):(m.verbose("Static animation completed"),m.restore.conditions(),l.onComplete.call(u)))},force:{visible:function(){var n=d.attr("style"),n=m.get.userStyle(n),e=m.get.displayType(),n=n+"display: "+e+" !important;",i=d[0].style.display;return!e||"none"===i&&l.skipInlineHidden||d[0].tagName.match(/(script|link|style)/i)?(m.remove.transition(),!1):(m.verbose("Overriding default display to show element",e),d.attr("style",n),!0)},hidden:function(){var n=d.attr("style"),e=d.css("display"),n=n===A||""===n;"none"===e||m.is.hidden()?n&&d.removeAttr("style"):(m.verbose("Overriding default display to hide element"),d.css("display","none"))}},has:{direction:function(n){var i=!1;return"string"==typeof(n=n||l.animation)&&(n=n.split(" "),C.each(n,function(n,e){e!==c.inward&&e!==c.outward||(i=!0)})),i},inlineDisplay:function(){var n=d.attr("style")||"";return Array.isArray(n.match(/display.*?;/,""))}},set:{animating:function(n){m.remove.completeCallback(),n=n||l.animation;n=m.get.animationClass(n);m.save.animation(n),m.force.visible()&&(m.remove.hidden(),m.remove.direction(),m.start.animation(n))},duration:function(n,e){!(e="number"==typeof(e=e||l.duration)?e+"ms":e)&&0!==e||(m.verbose("Setting animation duration",e),d.css({"animation-duration":e}))},direction:function(n){(n=n||m.get.direction())==c.inward?m.set.inward():m.set.outward()},looping:function(){m.debug("Transition set to loop"),d.addClass(c.looping)},hidden:function(){d.addClass(c.transition).addClass(c.hidden)},inward:function(){m.debug("Setting direction to inward"),d.removeClass(c.outward).addClass(c.inward)},outward:function(){m.debug("Setting direction to outward"),d.removeClass(c.inward).addClass(c.outward)},visible:function(){d.addClass(c.transition).addClass(c.visible)}},start:{animation:function(n){n=n||m.get.animationClass(),m.debug("Starting tween",n),d.addClass(n).one(a+".complete"+o,m.complete),l.useFailSafe&&m.add.failSafe(),m.set.duration(l.duration),l.onStart.call(u)}},save:{animation:function(n){m.cache||(m.cache={}),m.cache.animation=n},displayType:function(n){"none"!==n&&d.data(t.displayType,n)},transitionExists:function(n,e){C.fn.transition.exists[n]=e,m.verbose("Saving existence of transition",n,e)}},restore:{conditions:function(){var n=m.get.currentAnimation();n&&(d.removeClass(n),m.verbose("Removing animation class",m.cache)),m.remove.duration()}},add:{failSafe:function(){var n=m.get.duration();m.timer=setTimeout(function(){d.triggerHandler(a)},n+l.failSafeDelay),m.verbose("Adding fail safe timer",m.timer)}},remove:{animating:function(){d.removeClass(c.animating)},animationCallbacks:function(){m.remove.queueCallback(),m.remove.completeCallback()},queueCallback:function(){d.off(".queue"+o)},completeCallback:function(){d.off(".complete"+o)},display:function(){d.css("display","")},direction:function(){d.removeClass(c.inward).removeClass(c.outward)},duration:function(){d.css("animation-duration","")},failSafe:function(){m.verbose("Removing fail safe timer",m.timer),m.timer&&clearTimeout(m.timer)},hidden:function(){d.removeClass(c.hidden)},visible:function(){d.removeClass(c.visible)},looping:function(){m.debug("Transitions are no longer looping"),m.is.looping()&&(m.reset(),d.removeClass(c.looping))},transition:function(){d.removeClass(c.transition).removeClass(c.visible).removeClass(c.hidden)}},get:{settings:function(n,e,i){return"object"==typeof n?C.extend(!0,{},C.fn.transition.settings,n):"function"==typeof i?C.extend({},C.fn.transition.settings,{animation:n,onComplete:i,duration:e}):"string"==typeof e||"number"==typeof e?C.extend({},C.fn.transition.settings,{animation:n,duration:e}):"object"==typeof e?C.extend({},C.fn.transition.settings,e,{animation:n}):"function"==typeof e?C.extend({},C.fn.transition.settings,{animation:n,onComplete:e}):C.extend({},C.fn.transition.settings,{animation:n})},animationClass:function(n){var n=n||l.animation,e=m.can.transition()&&!m.has.direction()?m.get.direction()+" ":"";return c.animating+" "+c.transition+" "+e+n},currentAnimation:function(){return!(!m.cache||m.cache.animation===A)&&m.cache.animation},currentDirection:function(){return m.is.inward()?c.inward:c.outward},direction:function(){return m.is.hidden()||!m.is.visible()?c.inward:c.outward},animationDirection:function(n){var i;return"string"==typeof(n=n||l.animation)&&(n=n.split(" "),C.each(n,function(n,e){e===c.inward?i=c.inward:e===c.outward&&(i=c.outward)})),i||!1},duration:function(n){return"string"==typeof(n=!1===(n=n||l.duration)?d.css("animation-duration")||0:n)?-1<n.indexOf("ms")?parseFloat(n):1e3*parseFloat(n):n},displayType:function(n){return l.displayType||((n=n===A||n)&&d.data(t.displayType)===A&&(""===(n=d.css("display"))||"none"===n?m.can.transition(!0):m.save.displayType(n)),d.data(t.displayType))},userStyle:function(n){return(n=n||d.attr("style")||"").replace(/display.*?;/,"")},transitionExists:function(n){return C.fn.transition.exists[n]},animationStartEvent:function(){var n,e=S.createElement("div"),i={animation:"animationstart",OAnimation:"oAnimationStart",MozAnimation:"mozAnimationStart",WebkitAnimation:"webkitAnimationStart"};for(n in i)if(e.style[n]!==A)return i[n];return!1},animationEndEvent:function(){var n,e=S.createElement("div"),i={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"mozAnimationEnd",WebkitAnimation:"webkitAnimationEnd"};for(n in i)if(e.style[n]!==A)return i[n];return!1}},can:{transition:function(n){var e,i,t,a,o=l.animation,r=m.get.transitionExists(o),s=m.get.displayType(!1);if(r===A||n){if(m.verbose("Determining whether animation exists"),n=d.attr("class"),e=d.prop("tagName"),i=(e=C("<"+e+" />").addClass(n).insertAfter(d)).addClass(o).removeClass(c.inward).removeClass(c.outward).addClass(c.animating).addClass(c.transition).css("animationName"),t=e.addClass(c.inward).css("animationName"),s||(s=e.attr("class",n).removeAttr("style").removeClass(c.hidden).removeClass(c.visible).show().css("display"),m.verbose("Determining final display state",s),m.save.displayType(s)),e.remove(),i!=t)m.debug("Direction exists for animation",o),a=!0;else{if("none"==i||!i)return void m.debug("No animation defined in css",o);m.debug("Static animation found",o,s),a=!1}m.save.transitionExists(o,a)}return r!==A?r:a},animate:function(){return m.can.transition()!==A}},is:{animating:function(){return d.hasClass(c.animating)},inward:function(){return d.hasClass(c.inward)},outward:function(){return d.hasClass(c.outward)},looping:function(){return d.hasClass(c.looping)},occurring:function(n){return n="."+(n=n||l.animation).replace(" ","."),0<d.filter(n).length},visible:function(){return d.is(":visible")},hidden:function(){return"hidden"===d.css("visibility")},supported:function(){return!1!==a}},hide:function(){if(!1===l.onHide.call(u))return m.verbose("Hide callback returned false cancelling hide"),!1;m.verbose("Hiding element"),m.is.animating()&&m.reset(),u.blur(),m.remove.display(),m.remove.visible(),l.onBeforeHide.call(u,m.hideNow)},hideNow:function(){m.set.hidden(),m.force.hidden(),l.onHidden.call(u),l.onComplete.call(u)},show:function(n){m.force.visible()&&!1!==l.onShow.call(u)&&(m.verbose("Showing element",n),m.remove.hidden(),l.onBeforeShow.call(u,m.showNow))},showNow:function(){m.set.visible(),l.onVisible.call(u),l.onComplete.call(u)},toggle:function(){m.is.visible()?m.hide():m.show()},stop:function(){m.debug("Stopping current animation"),d.triggerHandler(a)},stopAll:function(){m.debug("Stopping all animation"),m.remove.queueCallback(),d.triggerHandler(a)},clear:{queue:function(){m.debug("Clearing animation queue"),m.remove.queueCallback()}},enable:function(){m.verbose("Starting animation"),d.removeClass(c.disabled)},disable:function(){m.debug("Stopping animation"),d.addClass(c.disabled)},setting:function(n,e){if(m.debug("Changing setting",n,e),C.isPlainObject(n))C.extend(!0,l,n);else{if(e===A)return l[n];C.isPlainObject(l[n])?C.extend(!0,l[n],e):l[n]=e}},internal:function(n,e){if(C.isPlainObject(n))C.extend(!0,m,n);else{if(e===A)return m[n];m[n]=e}},debug:function(){!l.silent&&l.debug&&(l.performance?m.performance.log(arguments):(m.debug=Function.prototype.bind.call(console.info,console,l.name+":"),m.debug.apply(console,arguments)))},verbose:function(){!l.silent&&l.verbose&&l.debug&&(l.performance?m.performance.log(arguments):(m.verbose=Function.prototype.bind.call(console.info,console,l.name+":"),m.verbose.apply(console,arguments)))},error:function(){l.silent||(m.error=Function.prototype.bind.call(console.error,console,l.name+":"),m.error.apply(console,arguments))},performance:{log:function(n){var e,i;l.performance&&(i=(e=(new Date).getTime())-(g||e),g=e,v.push({Name:n[0],Arguments:[].slice.call(n,1)||"",Element:u,"Execution Time":i})),clearTimeout(m.performance.timer),m.performance.timer=setTimeout(m.performance.display,500)},display:function(){var n=l.name+":",i=0;g=!1,clearTimeout(m.performance.timer),C.each(v,function(n,e){i+=e["Execution Time"]}),n+=" "+i+"ms",p&&(n+=" '"+p+"'"),1<r.length&&(n+=" ("+r.length+")"),(console.group!==A||console.table!==A)&&0<v.length&&(console.groupCollapsed(n),console.table?console.table(v):C.each(v,function(n,e){console.log(e.Name+": "+e["Execution Time"]+"ms")}),console.groupEnd()),v=[]}},invoke:function(t,n,e){var a,o,i,r=s;return n=n||h,e=u||e,"string"==typeof t&&r!==A&&(t=t.split(/[\. ]/),a=t.length-1,C.each(t,function(n,e){var i=n!=a?e+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(C.isPlainObject(r[i])&&n!=a)r=r[i];else{if(r[i]!==A)return o=r[i],!1;{if(!C.isPlainObject(r[e])||n==a)return r[e]!==A&&(o=r[e]),!1;r=r[e]}}})),C.isFunction(o)?i=o.apply(e,n):o!==A&&(i=o),Array.isArray(f)?f.push(i):f!==A?f=[f,i]:i!==A&&(f=i),o!==A&&o}};m.initialize()}),f!==A?f:this},C.fn.transition.exists={},C.fn.transition.settings={name:"Transition",silent:!1,debug:!1,verbose:!1,performance:!0,namespace:"transition",interval:0,reverse:"auto",onStart:function(){},onComplete:function(){},onShow:function(){},onBeforeShow:function(n){n.call(this)},onVisible:function(){},onHide:function(){},onHidden:function(){},onBeforeHide:function(n){n.call(this)},useFailSafe:!0,failSafeDelay:100,allowRepeats:!1,displayType:!1,animation:"fade",duration:!1,queue:!0,skipInlineHidden:!1,metadata:{displayType:"display"},className:{animating:"animating",disabled:"disabled",hidden:"hidden",inward:"in",loading:"loading",looping:"looping",outward:"out",transition:"transition",visible:"visible"},error:{noAnimation:"Element is no longer attached to DOM. Unable to animate. Use silent setting to suppress this warning in production.",repeated:"That animation is already occurring, cancelling repeated animation",method:"The method you called is not defined",support:"This browser does not support CSS animations"}}}(jQuery,window,document);