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

11 lines
9.7 KiB
JavaScript
Raw Normal View History

2022-01-13 13:00:31 +00:00
/*
* # Fomantic UI - 2.8.8
* https://github.com/fomantic/Fomantic-UI
* http://fomantic-ui.com/
*
* Copyright 2022 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
!function(A,e,E,Y){"use strict";A.isFunction=A.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},e=void 0!==e&&e.Math==Math?e:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),A.fn.shape=function(v){var b,x=A(this),y=(new Date).getTime(),w=[],C=v,S="string"==typeof C,T=[].slice.call(arguments,1),W=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||e.msRequestAnimationFrame||function(e){setTimeout(e,0)};return x.each(function(){var i,n,t=x.selector||"",a=A.isPlainObject(v)?A.extend(!0,{},A.fn.shape.settings,v):A.extend({},A.fn.shape.settings),e=a.namespace,r=a.selector,o=a.error,s=a.className,d="."+e,l="module-"+e,u=A(this),c=u.find(">"+r.sides),f=c.find(">"+r.side),g=!1,h=this,m=u.data(l),p={initialize:function(){p.verbose("Initializing module for",h),p.set.defaultSide(),p.instantiate()},instantiate:function(){p.verbose("Storing instance of module",p),m=p,u.data(l,m)},destroy:function(){p.verbose("Destroying previous module for",h),u.removeData(l).off(d)},refresh:function(){p.verbose("Refreshing selector cache for",h),u=A(h),c=A(this).find(r.sides),f=A(this).find(r.side)},repaint:function(){p.verbose("Forcing repaint event");(c[0]||E.createElement("div")).offsetWidth},animate:function(e,t){p.verbose("Animating box with properties",e),t=t||function(e){p.verbose("Executing animation callback"),e!==Y&&e.stopPropagation(),p.reset(),p.set.active()},a.beforeChange.call(n[0]),p.get.transitionEvent()?(p.verbose("Starting CSS animation"),u.addClass(s.animating),c.css(e).one(p.get.transitionEvent(),t),p.set.duration(a.duration),W(function(){u.addClass(s.animating),i.addClass(s.hidden)})):t()},queue:function(e){p.debug("Queueing animation of",e),c.one(p.get.transitionEvent(),function(){p.debug("Executing queued animation"),setTimeout(function(){u.shape(e)},0)})},reset:function(){p.verbose("Animating states reset"),u.removeClass(s.animating).attr("style","").removeAttr("style"),c.attr("style","").removeAttr("style"),f.attr("style","").removeAttr("style").removeClass(s.hidden),n.removeClass(s.animating).attr("style","").removeAttr("style")},is:{complete:function(){return f.filter("."+s.active)[0]==n[0]},animating:function(){return u.hasClass(s.animating)},hidden:function(){return 0<u.closest(":hidden").length}},set:{defaultSide:function(){i=f.filter("."+a.className.active),n=0<i.next(r.side).length?i.next(r.side):f.first(),g=!1,p.verbose("Active side set to",i),p.verbose("Next side set to",n)},duration:function(e){e=e||a.duration,p.verbose("Setting animation duration",e="number"==typeof e?e+"ms":e),!a.duration&&0!==a.duration||c.add(f).css({"-webkit-transition-duration":e,"-moz-transition-duration":e,"-ms-transition-duration":e,"-o-transition-duration":e,"transition-duration":e})},currentStageSize:function(){var e=f.filter("."+a.className.active),t=e.outerWidth(!0),e=e.outerHeight(!0);u.css({width:t,height:e})},stageSize:function(){var e=u.clone().addClass(s.loading),t=e.find(">"+r.sides+">"+r.side),i=t.filter("."+a.className.active),n=g?t.eq(g):0<i.next(r.side).length?i.next(r.side):t.first(),o="next"===a.width?n.outerWidth(!0):"initial"===a.width?u.width():a.width,t="next"===a.height?n.outerHeight(!0):"initial"===a.height?u.height():a.height;i.removeClass(s.active),n.addClass(s.active),e.insertAfter(u),e.remove(),"auto"!==a.width&&(u.css("width",o+a.jitter),p.verbose("Specifying width during animation",o)),"auto"!==a.height&&(u.css("height",t+a.jitter),p.verbose("Specifying height during animation",t))},nextSide:function(e){g=e,n=f.filter(e),g=f.index(n),0===n.length&&(p.set.defaultSide(),p.error(o.side)),p.verbose("Next side manually set to",n)},active:function(){p.verbose("Setting new side to active",n),f.removeClass(s.active),n.addClass(s.active),a.onChange.call(n[0]),p.set.defaultSide()}},flip:{to:function(e,t){var i;p.is.hidden()?p.debug("Module not visible",n):!p.is.complete()||p.is.animating()||a.allowRepeats?(i=p.get.transform[e](),p.is.animating()?p.queue("flip "+e):(p.debug("Flipping "+e,n),p.set.stageSize(),p.stage[t](),p.animate(i)))