wishthis/semantic/dist/components/transition.min.js

11 lines
13 KiB
JavaScript
Raw Normal View History

2022-01-13 13:00:31 +00:00
/*
2023-08-17 09:47:40 +00:00
* # Fomantic UI - 2.9.2
2022-01-13 13:00:31 +00:00
* https://github.com/fomantic/Fomantic-UI
2023-08-17 09:47:40 +00:00
* https://fomantic-ui.com/
2022-01-13 13:00:31 +00:00
*
2023-08-17 09:47:40 +00:00
* Copyright 2023 Contributors
2022-01-13 13:00:31 +00:00
* Released under the MIT license
2023-08-17 09:47:40 +00:00
* https://opensource.org/licenses/MIT
2022-01-13 13:00:31 +00:00
*
*/
2023-08-17 09:47:40 +00:00
!function(w,n){"use strict";void 0!==n&&n.Math===Math||globalThis,w.fn.transition=function(){var p,o=w(this),r=o.selector||"",s=Date.now(),g=[],v=arguments,b=v[0],y=[].slice.call(arguments,1),h="string"==typeof b;return o.each(function(i){var l,d,e,c,t,n,a,u=w(this),m=this,f={initialize:function(){l=f.get.settings.apply(m,v),c=l.className,e=l.error,t=l.metadata,a="."+l.namespace,n="module-"+l.namespace,d=u.data(n)||f,!1===(h=h&&f.invoke(b))&&(f.verbose("Converted arguments into settings object",l),l.interval?f.delay(l.interval):f.animate(),f.instantiate())},instantiate:function(){f.verbose("Storing instance of module",f),d=f,u.data(n,d)},destroy:function(){f.verbose("Destroying previous module for",m),u.removeData(n)},refresh:function(){f.verbose("Refreshing display type on next animation"),delete f.displayType},forceRepaint:function(){f.verbose("Forcing element repaint");var n=u.parent(),e=u.next();0===e.length?u.detach().appendTo(n):u.detach().insertBefore(e)},repaint:function(){f.verbose("Repainting element");m.offsetWidth},delay:function(n){var e=(e=f.get.animationDirection())||(f.can.transition()?f.get.direction():"static");n=void 0!==n?n:l.interval,e="auto"===l.reverse&&e===c.outward||!0===l.reverse?(o.length-i)*n:i*n,f.debug("Delaying animation by",e),setTimeout(f.animate,e)},animate:function(n){if(l=n||l,f.debug("Preparing animation",l.animation),f.is.animating()){if(l.queue)return!l.allowRepeats&&f.has.direction()&&f.is.occurring()&&!0!==f.queuing?f.debug("Animation is currently occurring, preventing queueing same animation",l.animation):f.queue(l.animation),!1;if(!l.allowRepeats&&f.is.occurring())return f.debug("Animation is already occurring, will not execute repeated animation",l.animation),!1;f.debug("New animation started, completing previous early",l.animation),d.complete()}f.can.animate()?f.set.animating(l.animation):f.error(e.noAnimation,l.animation,m)},reset:function(){f.debug("Resetting animation to beginning conditions"),f.remove.animationCallbacks(),f.restore.conditions(),f.remove.animating()},queue:function(n){f.debug("Queueing animation of",n),f.queuing=!0,u.one("animationend.queue"+a,function(){f.queuing=!1,f.repaint(),f.animate.apply(this,l)})},complete:function(n){n&&n.target===m&&n.stopPropagation(),f.debug("Animation complete",l.animation),f.remove.completeCallback(),f.remove.failSafe(),f.is.looping()||(f.is.outward()?(f.verbose("Animation is outward, hiding element"),f.restore.conditions(),f.hide()):f.is.inward()?(f.verbose("Animation is inward, showing element"),f.restore.conditions(),f.show()):(f.verbose("Static animation completed"),f.restore.conditions(),l.onComplete.call(m)))},force:{visible:function(){var n=u.attr("style"),n=f.get.userStyle(n),e=f.get.displayType(),n=n+"display: "+e+" !important;",i=u[0].style.display;return!e||"none"===i&&l.skipInlineHidden||u[0].tagName.match(/(script|link|style)/i)?(f.remove.transition(),!1):(f.verbose("Overriding default display to show element",e),u.attr("style",n),!0)},hidden:function(){var n=u.attr("style"),n=void 0===n||""===n;"none"===u.css("display")||f.is.hidden()?n&&u.removeAttr("style"):(f.verbose("Overriding default display to hide element"),u.css("display","none"))}},has:{direction:function(n){var i=!1;return"string"==typeof(n=n||l.animation)&&(n=n.split(" "),w.each(n,function(n,e){e!==c.inward&&e!==c.outward||(i=!0)})),i},inlineDisplay:function(){var n=u.attr("style")||"";return Array.isArray(n.match(/display.*?;/,""))}},set:{animating:function(n){f.remove.completeCallback(),n=n||l.animation;n=f.get.animationClass(n);f.save.animation(n),f.force.visible()&&(f.remove.hidden(),f.remove.direction(),f.start.animation(n))},duration:function(n,e){!(e="number"==typeof(e=e||l.duration)?e+"ms":e)&&0!==e||(f.verbose("Setting animation duration",e),u.css({"animation-duration":e}))},direction:function(n){(n=n||f.get.direction())===c.inward?f.set.inward():f.set.outward()},looping:function(){f.debug("Transition set to loop"),u.addClass(c.looping)},hidden:function(){u.addClass(c.transition).addClass(c.hidden)},inward:function(){f.debug("Setting directi