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
*
*/
2022-02-23 21:46:34 +00:00
!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,f=a.error,s=a.className,g="."+e,h="module-"+e,d=A(this),o=d.find(">"+r.sides),l=o.find(">"+r.side),m=!1,u=this,p=d.data(h),c={initialize:function(){c.verbose("Initializing module for",u),c.set.defaultSide(),c.instantiate()},instantiate:function(){c.verbose("Storing instance of module",c),p=c,d.data(h,p)},destroy:function(){c.verbose("Destroying previous module for",u),d.removeData(h).off(g)},refresh:function(){c.verbose("Refreshing selector cache for",u),d=A(u),o=A(this).find(r.sides),l=A(this).find(r.side)},repaint:function(){c.verbose("Forcing repaint event");(o[0]||E.createElement("div")).offsetWidth},animate:function(e,t){c.verbose("Animating box with properties",e),t=t||function(e){c.verbose("Executing animation callback"),e!==Y&&e.stopPropagation(),c.reset(),c.set.active()},a.beforeChange.call(n[0]),c.get.transitionEvent()?(c.verbose("Starting CSS animation"),d.addClass(s.animating),o.css(e).one(c.get.transitionEvent(),t),c.set.duration(a.duration),W(function(){d.addClass(s.animating),i.addClass(s.hidden)})):t()},queue:function(e){c.debug("Queueing animation of",e),o.one(c.get.transitionEvent(),function(){c.debug("Executing queued animation"),setTimeout(function(){d.shape(e)},0)})},reset:function(){c.verbose("Animating states reset"),d.removeClass(s.animating).attr("style","").removeAttr("style"),o.attr("style","").removeAttr("style"),l.attr("style","").removeAttr("style").removeClass(s.hidden),n.removeClass(s.animating).attr("style","").removeAttr("style")},is:{complete:function(){return l.filter("."+s.active)[0]==n[0]},animating:function(){return d.hasClass(s.animating)},hidden:function(){return 0<d.closest(":hidden").length}},set:{defaultSide:function(){i=l.filter("."+a.className.active),n=0<i.next(r.side).length?i.next(r.side):l.first(),m=!1,c.verbose("Active side set to",i),c.verbose("Next side set to",n)},duration:function(e){e=e||a.duration,c.verbose("Setting animation duration",e="number"==typeof e?e+"ms":e),!a.duration&&0!==a.duration||o.add(l).css({"-webkit-transition-duration":e,"-moz-transition-duration":e,"-ms-transition-duration":e,"-o-transition-duration":e,"transition-duration":e})},currentStageSize:function(){var e=l.filter("."+a.className.active),t=e.outerWidth(!0),e=e.outerHeight(!0);d.css({width:t,height:e})},stageSize:function(){var e=d.clone().addClass(s.loading),t=e.find(">"+r.sides+">"+r.side),i=t.filter("."+a.className.active),t=m?t.eq(m):0<i.next(r.side).length?i.next(r.side):t.first(),n="next"===a.width?t.outerWidth(!0):"initial"===a.width?d.width():a.width,o="next"===a.height?t.outerHeight(!0):"initial"===a.height?d.height():a.height;i.removeClass(s.active),t.addClass(s.active),e.insertAfter(d),e.remove(),"auto"!==a.width&&(d.css("width",n+a.jitter),c.verbose("Specifying width during animation",n)),"auto"!==a.height&&(d.css("height",o+a.jitter),c.verbose("Specifying height during animation",o))},nextSide:function(e){m=e,n=l.filter(e),m=l.index(n),0===n.length&&(c.set.defaultSide(),c.error(f.side)),c.verbose("Next side manually set to",n)},active:function(){c.verbose("Setting new side to active",n),l.removeClass(s.active),n.addClass(s.active),a.onChange.call(n[0]),c.set.defaultSide()}},flip:{to:function(e,t){var i;c.is.hidden()?c.debug("Module not visible",n):!c.is.complete()||c.is.animating()||a.allowRepeats?(i=c.get.transform[e](),c.is.animating()?c.queue("flip "+e):(c.debug("Flipping "+e,n),c.set.stageSize(),c.stage[t](),c.animate(i)))