fomantic-ui 2.10.0-beta.62 → 2.10.0-beta.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +0 -1
- package/changelog-setup.js +10 -10
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +40 -41
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +2 -2
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +57 -61
- package/dist/components/api.min.js +2 -2
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +1 -1
- package/dist/components/calendar.js +186 -187
- package/dist/components/calendar.min.css +1 -1
- package/dist/components/calendar.min.js +2 -2
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +29 -30
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +2 -2
- package/dist/components/comment.css +1 -1
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +1 -1
- package/dist/components/container.min.css +1 -1
- package/dist/components/dimmer.css +1 -1
- package/dist/components/dimmer.js +22 -23
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +2 -2
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +1 -1
- package/dist/components/dropdown.js +293 -337
- package/dist/components/dropdown.min.css +1 -1
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +33 -35
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/emoji.css +1 -1
- package/dist/components/emoji.min.css +1 -1
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +1 -1
- package/dist/components/flyout.js +74 -81
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +1 -1
- package/dist/components/form.js +141 -146
- package/dist/components/form.min.css +1 -1
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +1 -1
- package/dist/components/grid.min.css +1 -1
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +1 -1
- package/dist/components/icon.min.css +1 -1
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +1 -1
- package/dist/components/input.min.css +1 -1
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/menu.css +1 -1
- package/dist/components/menu.min.css +1 -1
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +1 -1
- package/dist/components/modal.js +80 -81
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +27 -28
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +2 -2
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -1
- package/dist/components/popup.js +62 -72
- package/dist/components/popup.min.css +1 -1
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +51 -55
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +2 -2
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +33 -34
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +1 -1
- package/dist/components/search.js +96 -109
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +1 -1
- package/dist/components/segment.min.css +1 -1
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +44 -45
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +2 -2
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +56 -64
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +16 -17
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +2 -2
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +143 -148
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +24 -25
- package/dist/components/state.min.js +2 -2
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +42 -43
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +2 -2
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +57 -66
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +1 -1
- package/dist/components/table.min.css +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +32 -33
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +2 -2
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +38 -45
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +76 -77
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +53 -53
- package/dist/semantic.js +1753 -1884
- package/dist/semantic.min.css +1 -1
- package/dist/semantic.min.js +2 -2
- package/package.json +1 -1
- package/scripts/nightly-version.js +3 -3
- package/src/definitions/behaviors/api.js +56 -60
- package/src/definitions/behaviors/form.js +140 -145
- package/src/definitions/behaviors/state.js +23 -24
- package/src/definitions/behaviors/visibility.js +75 -76
- package/src/definitions/globals/site.js +15 -16
- package/src/definitions/modules/accordion.js +39 -40
- package/src/definitions/modules/calendar.js +185 -186
- package/src/definitions/modules/checkbox.js +28 -29
- package/src/definitions/modules/dimmer.js +21 -22
- package/src/definitions/modules/dropdown.js +292 -336
- package/src/definitions/modules/embed.js +32 -34
- package/src/definitions/modules/flyout.js +73 -80
- package/src/definitions/modules/modal.js +79 -80
- package/src/definitions/modules/nag.js +26 -27
- package/src/definitions/modules/popup.js +61 -71
- package/src/definitions/modules/progress.js +50 -54
- package/src/definitions/modules/rating.js +32 -33
- package/src/definitions/modules/search.js +95 -108
- package/src/definitions/modules/shape.js +43 -44
- package/src/definitions/modules/sidebar.js +55 -63
- package/src/definitions/modules/slider.js +142 -147
- package/src/definitions/modules/sticky.js +41 -42
- package/src/definitions/modules/tab.js +56 -65
- package/src/definitions/modules/toast.js +31 -32
- package/src/definitions/modules/transition.js +37 -44
- package/tasks/admin/components/create.js +11 -11
- package/tasks/admin/components/init.js +11 -12
- package/tasks/admin/components/update.js +19 -20
- package/tasks/admin/distributions/create.js +24 -36
- package/tasks/admin/distributions/init.js +11 -12
- package/tasks/admin/distributions/update.js +18 -19
- package/tasks/admin/register.js +7 -7
- package/tasks/build/assets.js +1 -1
- package/tasks/build/css.js +1 -1
- package/tasks/build/javascript.js +1 -1
- package/tasks/config/admin/github.js +1 -1
- package/tasks/config/admin/templates/css-package.js +1 -1
- package/tasks/config/admin/templates/less-package.js +1 -1
- package/tasks/config/project/config.js +6 -6
- package/tasks/config/project/install.js +12 -12
- package/tasks/config/project/release.js +5 -11
- package/tasks/config/tasks.js +5 -5
- package/tasks/config/user.js +1 -4
- package/tasks/docs/metadata.js +11 -12
- package/tasks/install.js +9 -9
- package/test/meteor/assets.js +1 -1
- package/test/modules/module.spec.js +18 -18
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* # Fomantic UI - 2.10.0-beta.
|
|
2
|
+
* # Fomantic UI - 2.10.0-beta.64+bcb9c73
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
|
4
4
|
* https://fomantic-ui.com/
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
|
-
!function(z,n,a){"use strict";function B(e){return"function"==typeof e&&"number"!=typeof e.nodeType}n=void 0!==n&&n.Math===Math?n:globalThis,z.fn.slider=function(...e){let t=z(this),E=z(a),D=z(n),A=Date.now(),S=[],F=e[0],O="string"==typeof F,j=e.slice(1),I=0,N;return t.each(function(){let c=z.isPlainObject(F)?z.extend(!0,{},z.fn.slider.settings,F):z.extend({},z.fn.slider.settings),l=c.className,t=c.metadata;var e=c.namespace;let s=c.error,o=c.keys,r=c.interpretLabel,n=!1,a="."+e,i="module-"+e,u=z(this),d,m,g,v,f,h,b,p=this,V=u.data(i),k,T,x,y,w,M=1,R,C,L,P;P={initialize:function(){P.debug("Initializing slider",c),L=!0,I+=1,k=I,P.setup.layout(),P.setup.labels(),P.bind.events(),P.read.metadata(),P.read.settings(),L=!1,P.instantiate()},instantiate:function(){P.verbose("Storing instance of slider",P),V=P,u.data(i,P)},destroy:function(){P.verbose("Destroying previous slider for",u),clearInterval(V.interval),P.unbind.events(),P.unbind.slidingEvents(),delete P.cache,u.removeData(i),V=void 0},setup:{layout:function(){void 0===u.attr("tabindex")&&u.attr("tabindex",0),0===u.find(".inner").length&&u.append('<div class="inner"><div class="track"></div><div class="track-fill"></div><div class="thumb"></div></div>'),P.clear.cache(),g=u.find(".thumb:not(.second)"),c.showThumbTooltip&&g.attr("data-position",c.tooltipConfig.position).attr("data-variation",c.tooltipConfig.variation),d=g,P.is.range()&&(0===u.find(".thumb.second").length&&u.find(".inner").append('<div class="thumb second"></div>'),v=u.find(".thumb.second"),c.showThumbTooltip&&v.attr("data-position",c.tooltipConfig.position).attr("data-variation",c.tooltipConfig.variation)),f=u.find(".track"),h=u.find(".track-fill"),w=g.width()/2},labels:function(){P.is.labeled()&&(0<(b=u.find(".labels:not(.auto)")).length?P.setup.customLabel():P.setup.autoLabel(),c.highlightRange&&b.addClass(l.active),c.showLabelTicks?u.addClass(l.ticked):u.hasClass(l.ticked)&&(c.showLabelTicks="always"))},customLabel:function(){let e=b.find(".label"),a=e.length,i=P.get.min(),o=P.get.max(),r;e.each(function(e){let t=z(this),n=t.attr("data-value");r=n?((n=n>o?o:Math.max(n,i))-i)/(o-i):(e+1)/(a+1),P.update.labelPosition(r,z(this))})},autoLabel:function(){0<(b=u.find(".labels")).length?b.empty():b=u.append('<ul class="auto labels"></ul>').find(".labels");var t=P.get.step(),n=P.get.precision(),a=P.get.numLabels(),i=a-("fixed"!==c.autoAdjustLabels?0:P.get.max().toString().length+4);for(let e=0;e<=a;e++){var o=Math.round((e*(0===t?1:t)+P.get.min())*n)/n,r=P.get.label(e,o),s=0===c.restrictedLabels.length||c.restrictedLabels.includes(r),s=""===r||!s&&"always"!==c.showLabelTicks?null:!(e%P.get.gapRatio())&&e<i||e===a?z("<li/>",{class:l.label,"data-value":o,html:s?r:""}):z("<li/>",{class:"halftick label","data-value":o}),r=e/a;s&&(P.update.labelPosition(r,s),b.append(s))}}},bind:{events:function(){P.bind.globalKeyboardEvents(),P.bind.keyboardEvents(),P.bind.mouseEvents(),c.autoAdjustLabels&&P.bind.windowEvents()},keyboardEvents:function(){P.verbose("Binding keyboard events"),u.on("keydown"+a,P.event.keydown)},globalKeyboardEvents:function(){E.on("keydown"+a+k,P.event.activateFocus)},mouseEvents:function(){P.verbose("Binding mouse and touch events"),u.find(".track, .thumb, .inner").on("mousedown"+a,function(e){e.stopImmediatePropagation(),e.preventDefault(),P.event.down(e)}),u.on("mousedown"+a,P.event.down),u.on("mouseenter"+a,function(e){n=!0}),u.on("mouseleave"+a,function(e){n=!1}),u.find(".thumb").on("touchstart"+a,P.event.touchDown).on("touchmove"+a,P.event.move).on("touchend"+a,P.event.up).on("touchcancel"+a,P.event.touchCancel)},slidingEvents:function(){P.verbose("Binding page wide events while handle is being draged"),E.on("mousemove"+a,P.event.move),E.on("mouseup"+a,P.event.up)},windowEvents:function(){D.on("resize"+a,P.event.resize)}},unbind:{events:function(){u.find(".track, .thumb, .inner").off("mousedown"+a),u.off("mousedown"+a),u.off("mouseenter"+a),u.off("mouseleave"+a),u.find(".thumb").off("touchstart"+a).off("touchmove"+a).off("touchend"+a).off("touchcancel"+a),u.off("keydown"+a),u.off("focusout"+a),E.off("keydown"+a+k,P.event.activateFocus),D.off("resize"+a)},slidingEvents:function(){E.off("mousemove"+a),E.off("mouseup"+a)}},event:{down:function(e){e.preventDefault(),P.is.range()?(e=P.determine.eventPos(e),e=P.determine.pos(e),d=c.preventCrossover&&P.is.range()&&P.thumbVal===P.secondThumbVal?void(C=e):P.determine.closestThumb(e),void 0===R&&(R=P.get.currentThumbValue())):void 0===R&&(R=P.get.value()),P.is.disabled()||P.bind.slidingEvents()},touchDown:function(e){e.preventDefault(),e.stopImmediatePropagation(),void 0===m&&(d=z(e.target),e=e.touches?e:e.originalEvent,m=e.targetTouches[0].identifier,void 0===R&&(R=P.get.currentThumbValue()))},move:function(i){if("mousemove"===i.type&&i.preventDefault(),!P.is.disabled()){let a=P.determine.valueFromEvent(i);if("mousemove"===i.type&&void 0===d&&(e=P.determine.eventPos(i),e=P.determine.pos(e),d=C>e?g:v),P.is.range()&&(c.minRange||c.maxRange)){var e=P.get.currentRangeDiff(a),t=d.hasClass("second");if(c.minRange&&e<c.minRange||c.maxRange&&e>c.maxRange||c.preventCrossover&&!t&&a>P.secondThumbVal||c.preventCrossover&&t&&a<P.thumbVal)return}if(0===P.get.step()||P.is.smooth()){let e=P.thumbVal,t=P.secondThumbVal,n=P.determine.smoothValueFromEvent(i);d.hasClass("second")?(c.preventCrossover&&P.is.range()&&(a=Math.max(e,a),n=Math.max(e,n)),t=a):(c.preventCrossover&&P.is.range()&&(a=Math.min(t,a),n=Math.min(t,n)),e=a),a=Math.abs(e-(t||0)),P.update.position(n),c.onMove.call(p,a,e,t)}else P.update.value(a,function(e,t,n){c.onMove.call(p,e,t,n)})}},up:function(t){if(t.preventDefault(),!P.is.disabled()){let e=P.determine.valueFromEvent(t);P.is.range()&&(c.minRange||c.maxRange)&&(void 0===d&&(d=e<=P.get.currentThumbValue()?g:v),t=P.get.currentRangeDiff(e),c.minRange&&t<c.minRange?e=P.get.edgeValue(e,c.minRange):c.maxRange&&t>c.maxRange&&(e=P.get.edgeValue(e,c.maxRange))),P.set.value(e),P.unbind.slidingEvents(),(m=void 0)!==R&&(R=void 0)}},touchCancel:function(e){e.preventDefault(),(m=void 0)!==R&&(P.update.value(R),R=void 0)},keydown:function(e,t){if(!P.is.disabled()&&(c.preventCrossover&&P.is.range()&&P.thumbVal===P.secondThumbVal&&(d=void 0),P.is.focused()&&E.trigger(e),t||P.is.focused())){t=P.determine.keyMovement(e);if(0!==t)switch(e.preventDefault(),t){case 1:P.takeStep();break;case 2:P.takeStep(P.get.multiplier());break;case-1:P.backStep();break;case-2:P.backStep(P.get.multiplier())}}},activateFocus:function(e){P.is.disabled()||P.is.focused()||!P.is.hover()||0===P.determine.keyMovement(e)||(e.preventDefault(),P.event.keydown(e,!0),u.trigger("focus"))},resize:function(e){M!==P.get.gapRatio()&&(P.resync(),M=P.get.gapRatio())}},clear:{cache:function(){P.cache={}}},resync:function(){P.verbose("Re-syncing thumb position based on value"),P.setup.labels(),P.is.range()&&P.update.position(P.secondThumbVal,v),P.update.position(P.thumbVal,g)},takeStep:function(e){e=e||1;var t=P.get.step(),n=P.get.currentThumbValue();P.verbose("Taking a step"),0<t?P.set.value(n+t*e):0===t&&(n=n+e/(t=P.get.precision()),P.set.value(Math.round(n*t)/t))},backStep:function(e){e=e||1;var t=P.get.step(),n=P.get.currentThumbValue();P.verbose("Going back a step"),0<t?P.set.value(n-t*e):0===t&&(n=n-e/(t=P.get.precision()),P.set.value(Math.round(n*t)/t))},is:{prime:function(a){if(void 0===P.cache["prime"+a]){let n=!0;for(let e=2,t=Math.sqrt(a);e<=t;e++)if(a%e==0){n=!1;break}n=n&&1<a,P.cache["prime"+a]=n}return P.cache["prime"+a]},range:function(){let e=u.hasClass(l.range);return e||!c.minRange&&!c.maxRange||(u.addClass(l.range),e=!0),e},hover:function(){return n},focused:function(){return u.is(":focus")},disabled:function(){return u.hasClass(l.disabled)},labeled:function(){let e=u.hasClass(l.labeled);return!e&&(0<c.restrictedLabels.length||!1!==c.showLabelTicks)&&(u.addClass(l.labeled),e=!0),e},reversed:function(){return u.hasClass(l.reversed)},vertical:function(){return u.hasClass(l.vertical)},smooth:function(){return c.smooth||u.hasClass(l.smooth)}},get:{currentRangeDiff:function(e){let t;return t=d.hasClass("second")?P.thumbVal<e?e-P.thumbVal:P.thumbVal-e:P.secondThumbVal>e?P.secondThumbVal-e:e-P.secondThumbVal},edgeValue:function(e,t){return e=d.hasClass("second")?P.thumbVal<e?P.thumbVal+t:P.thumbVal-t:P.secondThumbVal<e?P.secondThumbVal+t:P.secondThumbVal-t},trackOffset:function(){return P.is.vertical()?f.offset().top:f.offset().left},trackLength:function(){return P.is.vertical()?f.height():f.width()},trackLeft:function(){return P.is.vertical()?f.position().top:f.position().left},trackStartPos:function(){return P.is.reversed()?P.get.trackLeft()+P.get.trackLength():P.get.trackLeft()},trackEndPos:function(){return P.is.reversed()?P.get.trackLeft():P.get.trackLeft()+P.get.trackLength()},trackStartMargin:function(){let e;return(e=P.is.vertical()?P.is.reversed()?u.css("padding-bottom"):u.css("padding-top"):P.is.reversed()?u.css("padding-right"):u.css("padding-left"))||"0px"},trackEndMargin:function(){let e;return(e=P.is.vertical()?P.is.reversed()?u.css("padding-top"):u.css("padding-bottom"):P.is.reversed()?u.css("padding-left"):u.css("padding-right"))||"0px"},precision:function(){if(void 0===P.cache.precision){let e;var t=P.get.step(),t=10**(e=0!==t?2===(t=String(t).split(".")).length?t[1].length:0:c.decimalPlaces);P.debug("Precision determined",t),P.cache.precision=t}return P.cache.precision},min:function(){return c.min},max:function(){var e,t,n,a;return void 0===P.cache.max&&(e=P.get.step(),t=P.get.min(),n=P.get.precision(),n=0===e?0:Math.floor(Math.round((c.max-t)/e*n)/n),0<(a=0===e?0:(c.max-t)%e)&&P.debug("Max value not divisible by given step. Increasing max value.",c.max,e),P.cache.max=0==a?c.max:t+n*e),P.cache.max},step:function(){return c.step},numLabels:function(){var e,t;return void 0===P.cache.numLabels&&(t=P.get.step(),e=P.get.precision(),t=Math.round((P.get.max()-P.get.min())/(0===t?1:t)*e)/e,P.debug("Determined that there should be "+t+" labels"),P.cache.numLabels=t),P.cache.numLabels},labelType:function(){return c.labelType},label:function(t,n){if(B(r))return r(t,n,P);switch(c.labelType){case c.labelTypes.number:return n;case c.labelTypes.letter:{if(t<0||1<P.get.precision())return P.error(s.invalidLetterNumber,t),t;let e="";for(var a=Array.isArray(c.letters)?c.letters:[...String(c.letters)],i=a.length;0<=n;)e=a[n%i]+e,n=Math.floor(n/i)-1;return e}default:return t}},value:function(){return T},settings:function(){return c},currentThumbValue:function(){return void 0!==d&&d.hasClass("second")?P.secondThumbVal:P.thumbVal},thumbValue:function(e){return"second"!==e?P.thumbVal:P.is.range()?P.secondThumbVal:void P.error(s.notrange)},multiplier:function(){return c.pageMultiplier},thumbPosition:function(e){return"second"!==e?x:P.is.range()?y:void P.error(s.notrange)},gapRatio:function(){let t=1;if(c.autoAdjustLabels){var n=P.get.numLabels(),a=P.is.prime(n)?1:0,i=P.get.trackLength();let e=1;if(0<i)for(;i/n*e<c.labelDistance;)(n+a)%e&&"fixed"!==c.autoAdjustLabels||(t=e),e+=1}return t}},determine:{pos:function(e){return P.is.reversed()?P.get.trackStartPos()-e+P.get.trackOffset():e-P.get.trackOffset()-P.get.trackStartPos()},closestThumb:function(e){var t=parseFloat(P.determine.thumbPos(g)),t=Math.abs(e-t),n=parseFloat(P.determine.thumbPos(v)),e=Math.abs(e-n);return(t!==e||P.get.thumbValue()!==P.get.min())&&t<=e?g:v},closestThumbPos:function(e){var t=parseFloat(P.determine.thumbPos(g)),n=Math.abs(e-t),a=parseFloat(P.determine.thumbPos(v));return n<=Math.abs(e-a)?t:a},thumbPos:function(e){return P.is.vertical()?P.is.reversed()?e.css("bottom"):e.css("top"):P.is.reversed()?e.css("right"):e.css("left")},positionFromValue:function(e){var t=P.get.min(),n=P.get.max(),e=n<e?n:Math.max(e,t),a=P.get.trackLength(),n=Math.round((e-t)/(n-t)*a);return P.verbose("Determined position: "+n+" from value: "+e),n},positionFromRatio:function(e){var t=P.get.trackLength(),n=P.get.step(),t=Math.round(e*t),n=0===n?t:Math.round(t/n)*n;return P.verbose("Determined position: "+t+" from ratio: "+e),n},valueFromEvent:function(e){var e=P.determine.eventPos(e),t=P.determine.pos(e);let n;return n=e<P.get.trackOffset()?P.is.reversed()?P.get.max():P.get.min():e>P.get.trackOffset()+P.get.trackLength()?P.is.reversed()?P.get.min():P.get.max():P.determine.value(t)},smoothValueFromEvent:function(e){var t=P.get.min(),n=P.get.max(),a=P.get.trackLength();let i=P.determine.eventPos(e)-P.get.trackOffset(),o;return i=i<0?0:Math.min(i,a),o=i/a,(o=P.is.reversed()?1-o:o)*(n-t)+t},eventPos:function(t){if("touchmove"===t.type||"touchend"===t.type){var n=t.touches?t:t.originalEvent;let e=n.changedTouches[0];for(const i of n.touches)if(i.identifier===m){e=i;break}var n=e.pageY,a=e.pageX;return P.is.vertical()?n:a}n=t.pageY||t.originalEvent.pageY,a=t.pageX||t.originalEvent.pageX;return P.is.vertical()?n:a},value:function(e){var t=P.get.precision(),n=P.is.reversed()?P.get.trackEndPos():P.get.trackStartPos(),n=(e-n)/((P.is.reversed()?P.get.trackStartPos():P.get.trackEndPos())-n),a=P.get.max()-P.get.min(),i=P.get.step(),n=n*a,a=0===i?n:Math.round(n/i)*i;return P.verbose("Determined value based upon position: "+e+" as: "+n),n!=a&&P.verbose("Rounding value to closest step: "+a),P.verbose("Cutting off additional decimal places"),Math.round((a+P.get.min())*t)/t},keyMovement:function(e){var e=e.which,t=!P.is.vertical()||P.is.reversed()?o.downArrow:o.upArrow,n=!P.is.vertical()||P.is.reversed()?o.upArrow:o.downArrow,a=!P.is.vertical()&&P.is.reversed()?o.rightArrow:o.leftArrow,i=!P.is.vertical()&&P.is.reversed()?o.leftArrow:o.rightArrow;return e===t||e===a?-1:e===n||e===i?1:e===o.pageDown?-2:e===o.pageUp?2:0}},handleNewValuePosition:function(e){var t=P.get.min(),n=P.get.max();return e<=t?e=t:n<=e&&(e=n),P.determine.positionFromValue(e)},set:{active:function(a,i){if(c.highlightRange){var t;i<a&&(t=i,i=a,a=t);let e=b.find(".label");e.each(function(e){let t=z(this);var n=t.attr("data-value");n&&(n=parseInt(n,10),a<=n&&n<=i?t.addClass(l.active):t.removeClass(l.active))})}},value:function(a,i){i=!1!==i;let o=void 0===R;R=void 0===R?P.get.value():R,P.update.value(a,function(e,t,n){L&&!c.fireOnInit||!i||(a!==R&&c.onChange.call(p,e,t,n),c.onMove.call(p,e,t,n)),o&&(R=void 0)})},rangeValue:function(e,t,n){var a,i,o;n=!1!==n,P.is.range()?(a=P.get.min(),i=P.get.max(),o=void 0===R,R=void 0===R?P.get.value():R,e<=a?e=a:i<=e&&(e=i),t<=a?t=a:i<=t&&(t=i),P.thumbVal=e,P.secondThumbVal=t,T=Math.abs(P.thumbVal-P.secondThumbVal),P.update.position(P.thumbVal,g),P.update.position(P.secondThumbVal,v),L&&!c.fireOnInit||!n||(T!==R&&c.onChange.call(p,T,P.thumbVal,P.secondThumbVal),c.onMove.call(p,T,P.thumbVal,P.secondThumbVal)),o&&(R=void 0)):P.error(s.notrange)},position:function(e,t){e=P.determine.value(e);"second"===t?(P.secondThumbVal=e,P.update.position(e,v)):(P.thumbVal=e,P.update.position(e,g)),T=Math.abs(P.thumbVal-(P.secondThumbVal||0)),P.set.value(T)}},update:{value:function(e,t){var n=P.get.min(),a=P.get.max();e<=n?e=n:a<=e&&(e=a),P.is.range()?((d=void 0===d?e<=P.get.currentThumbValue()?g:v:d).hasClass("second")?(c.preventCrossover&&P.is.range()&&(e=Math.max(P.thumbVal+(c.minRange||0),e)),P.secondThumbVal=e):(c.preventCrossover&&P.is.range()&&(e=Math.min(P.secondThumbVal-(c.minRange||0),e)),P.thumbVal=e),T=Math.abs(P.thumbVal-P.secondThumbVal)):(T=e,P.thumbVal=T),P.update.position(e),P.debug("Setting slider value to "+T),"function"==typeof t&&t(T,P.thumbVal,P.secondThumbVal)},position:function(e,t){var n=P.handleNewValuePosition(e);let a=t||d,i=P.thumbVal||P.get.min(),o=P.secondThumbVal||P.get.min();c.showThumbTooltip&&(t=P.get.precision(),a.attr("data-tooltip",Math.round(e*t)/t)),P.is.range()&&a.hasClass("second")?(y=n,o=e):(x=n,i=e),P.set.active(i,o);let r,s;var t=P.get.min(),l=P.get.max(),e=(e-t)/(l-t)*100,u=(Math.min(i,o)-t)/(l-t)*100,l=100*(1-(Math.max(i,o)-t)/(l-t));r=P.is.vertical()?P.is.reversed()?(s={bottom:"calc("+e+"% - "+w+"px)",top:"auto"},{bottom:u+"%",top:l+"%"}):(s={top:"calc("+e+"% - "+w+"px)",bottom:"auto"},{top:u+"%",bottom:l+"%"}):P.is.reversed()?(s={right:"calc("+e+"% - "+w+"px)",left:"auto"},{right:u+"%",left:l+"%"}):(s={left:"calc("+e+"% - "+w+"px)",right:"auto"},{left:u+"%",right:l+"%"}),a.css(s),h.css(r),P.debug("Setting slider position to "+n)},labelPosition:function(e,t){var n=P.get.trackStartMargin(),a=P.get.trackEndMargin(),i=P.is.vertical()?P.is.reversed()?"bottom":"top":P.is.reversed()?"right":"left",o=P.is.reversed()&&!P.is.vertical()?" - ":" + ";t.css(i,"calc("+("(100% - "+n+" - "+a+") * "+e)+o+n+")")}},goto:{max:function(){P.set.value(P.get.max())},min:function(){P.set.value(P.get.min())}},read:{metadata:function(){var e={thumbVal:u.data(t.thumbVal),secondThumbVal:u.data(t.secondThumbVal)};e.thumbVal&&(P.is.range()&&e.secondThumbVal?(P.debug("Current value set from metadata",e.thumbVal,e.secondThumbVal),P.set.rangeValue(e.thumbVal,e.secondThumbVal)):(P.debug("Current value set from metadata",e.thumbVal),P.set.value(e.thumbVal)))},settings:function(){var e;!1!==c.start&&(P.is.range()?(((e=c.end-c.start)<0||c.minRange&&e<c.minRange||c.maxRange&&e>c.maxRange||c.minRange&&c.maxRange&&c.minRange>c.maxRange)&&P.error(s.invalidRanges,c.start,c.end,c.minRange,c.maxRange),P.debug("Start position set from settings",c.start,c.end),P.set.rangeValue(c.start,c.end)):(P.debug("Start position set from settings",c.start),P.set.value(c.start)))}},setting:function(e,t){if(P.debug("Changing setting",e,t),z.isPlainObject(e))z.extend(!0,c,e);else{if(void 0===t)return c[e];z.isPlainObject(c[e])?z.extend(!0,c[e],t):c[e]=t}P.clear.cache()},internal:function(e,t){if(z.isPlainObject(e))z.extend(!0,P,e);else{if(void 0===t)return P[e];P[e]=t}},debug:function(...e){!c.silent&&c.debug&&(c.performance?P.performance.log(e):(P.debug=Function.prototype.bind.call(console.info,console,c.name+":"),P.debug.apply(console,e)))},verbose:function(...e){!c.silent&&c.verbose&&c.debug&&(c.performance?P.performance.log(e):(P.verbose=Function.prototype.bind.call(console.info,console,c.name+":"),P.verbose.apply(console,e)))},error:function(...e){c.silent||(P.error=Function.prototype.bind.call(console.error,console,c.name+":"),P.error.apply(console,e))},performance:{log:function(e){var t,n;c.performance&&(n=(t=Date.now())-(A||t),A=t,S.push({Name:e[0],Arguments:e.slice(1),Element:p,"Execution Time":n})),clearTimeout(P.performance.timer),P.performance.timer=setTimeout(function(){P.performance.display()},500)},display:function(){var e=c.name+":";let n=0;A=!1,clearTimeout(P.performance.timer),z.each(S,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",0<S.length&&(console.groupCollapsed(e),console.table(S),console.groupEnd()),S=[]}},invoke:function(a,e=j,t=p){let i=V,o,r,n;return"string"==typeof a&&void 0!==i&&(a=a.split(/[ .]/),o=a.length-1,z.each(a,function(e,t){var n=e!==o?t+a[e+1].charAt(0).toUpperCase()+a[e+1].slice(1):a;if(z.isPlainObject(i[n])&&e!==o)i=i[n];else{if(void 0!==i[n])return r=i[n],!1;{if(!z.isPlainObject(i[t])||e===o)return void 0!==i[t]?r=i[t]:P.error(s.method,a),!1;i=i[t]}}})),B(r)?n=r.apply(t,e):void 0!==r&&(n=r),Array.isArray(N)?N.push(n):void 0!==N?N=[N,n]:void 0!==n&&(N=n),r}},O?(void 0===V&&P.initialize(),P.invoke(F)):(void 0!==V&&V.invoke("destroy"),P.initialize())}),void 0!==N?N:this},z.fn.slider.settings={silent:!1,debug:!1,verbose:!1,performance:!0,name:"Slider",namespace:"slider",error:{method:"The method you called is not defined.",notrange:"This slider is not a range slider",invalidRanges:"Invalid range settings (start/end/minRange/maxRange)",invalidLetterNumber:'Negative values or decimal places for labelType: "letter" are not supported'},metadata:{thumbVal:"thumbVal",secondThumbVal:"secondThumbVal"},min:0,max:20,step:1,start:0,end:20,minRange:!1,maxRange:!1,labelType:"number",showLabelTicks:!1,smooth:!1,autoAdjustLabels:!0,labelDistance:100,preventCrossover:!0,fireOnInit:!1,interpretLabel:!1,letters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",decimalPlaces:2,pageMultiplier:2,selector:{},className:{reversed:"reversed",disabled:"disabled",labeled:"labeled",ticked:"ticked",vertical:"vertical",range:"range",smooth:"smooth",label:"label",active:"active"},keys:{pageUp:33,pageDown:34,leftArrow:37,upArrow:38,rightArrow:39,downArrow:40},restrictedLabels:[],highlightRange:!1,showThumbTooltip:!1,tooltipConfig:{position:"top center",variation:"tiny black"},labelTypes:{number:"number",letter:"letter"},onChange:function(e,t,n){},onMove:function(e,t,n){}}}(jQuery,window,document);
|
|
11
|
+
!function(z,n,a){"use strict";function B(e){return"function"==typeof e&&"number"!=typeof e.nodeType}n=void 0!==n&&n.Math===Math?n:globalThis,z.fn.slider=function(...e){const t=z(this),E=z(a),D=z(n);let A=Date.now(),S=[];const F=e[0],O="string"==typeof F,j=e.slice(1);let I=0,N;return t.each(function(){const c=z.isPlainObject(F)?z.extend(!0,{},z.fn.slider.settings,F):z.extend({},z.fn.slider.settings),l=c.className,t=c.metadata;var e=c.namespace;const s=c.error,o=c.keys,r=c.interpretLabel;let n=!1;const a="."+e,i="module-"+e,u=z(this);let d,m,g,v,f,h,b;const p=this;let V=u.data(i),k,T,x,y,w,M=1,R,C,L;const P={initialize:function(){P.debug("Initializing slider",c),L=!0,I+=1,k=I,P.setup.layout(),P.setup.labels(),P.bind.events(),P.read.metadata(),P.read.settings(),L=!1,P.instantiate()},instantiate:function(){P.verbose("Storing instance of slider",P),V=P,u.data(i,P)},destroy:function(){P.verbose("Destroying previous slider for",u),clearInterval(V.interval),P.unbind.events(),P.unbind.slidingEvents(),delete P.cache,u.removeData(i),V=void 0},setup:{layout:function(){void 0===u.attr("tabindex")&&u.attr("tabindex",0),0===u.find(".inner").length&&u.append('<div class="inner"><div class="track"></div><div class="track-fill"></div><div class="thumb"></div></div>'),P.clear.cache(),g=u.find(".thumb:not(.second)"),c.showThumbTooltip&&g.attr("data-position",c.tooltipConfig.position).attr("data-variation",c.tooltipConfig.variation),d=g,P.is.range()&&(0===u.find(".thumb.second").length&&u.find(".inner").append('<div class="thumb second"></div>'),v=u.find(".thumb.second"),c.showThumbTooltip&&v.attr("data-position",c.tooltipConfig.position).attr("data-variation",c.tooltipConfig.variation)),f=u.find(".track"),h=u.find(".track-fill"),w=g.width()/2},labels:function(){P.is.labeled()&&(0<(b=u.find(".labels:not(.auto)")).length?P.setup.customLabel():P.setup.autoLabel(),c.highlightRange&&b.addClass(l.active),c.showLabelTicks?u.addClass(l.ticked):u.hasClass(l.ticked)&&(c.showLabelTicks="always"))},customLabel:function(){const e=b.find(".label"),a=e.length,i=P.get.min(),o=P.get.max();let r;e.each(function(e){const t=z(this);let n=t.attr("data-value");r=n?((n=n>o?o:Math.max(n,i))-i)/(o-i):(e+1)/(a+1),P.update.labelPosition(r,z(this))})},autoLabel:function(){0<(b=u.find(".labels")).length?b.empty():b=u.append('<ul class="auto labels"></ul>').find(".labels");var t=P.get.step(),n=P.get.precision(),a=P.get.numLabels(),i=a-("fixed"!==c.autoAdjustLabels?0:P.get.max().toString().length+4);for(let e=0;e<=a;e++){var o=Math.round((e*(0===t?1:t)+P.get.min())*n)/n,r=P.get.label(e,o),s=0===c.restrictedLabels.length||c.restrictedLabels.includes(r),s=""===r||!s&&"always"!==c.showLabelTicks?null:!(e%P.get.gapRatio())&&e<i||e===a?z("<li/>",{class:l.label,"data-value":o,html:s?r:""}):z("<li/>",{class:"halftick label","data-value":o}),r=e/a;s&&(P.update.labelPosition(r,s),b.append(s))}}},bind:{events:function(){P.bind.globalKeyboardEvents(),P.bind.keyboardEvents(),P.bind.mouseEvents(),c.autoAdjustLabels&&P.bind.windowEvents()},keyboardEvents:function(){P.verbose("Binding keyboard events"),u.on("keydown"+a,P.event.keydown)},globalKeyboardEvents:function(){E.on("keydown"+a+k,P.event.activateFocus)},mouseEvents:function(){P.verbose("Binding mouse and touch events"),u.find(".track, .thumb, .inner").on("mousedown"+a,function(e){e.stopImmediatePropagation(),e.preventDefault(),P.event.down(e)}),u.on("mousedown"+a,P.event.down),u.on("mouseenter"+a,function(e){n=!0}),u.on("mouseleave"+a,function(e){n=!1}),u.find(".thumb").on("touchstart"+a,P.event.touchDown).on("touchmove"+a,P.event.move).on("touchend"+a,P.event.up).on("touchcancel"+a,P.event.touchCancel)},slidingEvents:function(){P.verbose("Binding page wide events while handle is being draged"),E.on("mousemove"+a,P.event.move),E.on("mouseup"+a,P.event.up)},windowEvents:function(){D.on("resize"+a,P.event.resize)}},unbind:{events:function(){u.find(".track, .thumb, .inner").off("mousedown"+a),u.off("mousedown"+a),u.off("mouseenter"+a),u.off("mouseleave"+a),u.find(".thumb").off("touchstart"+a).off("touchmove"+a).off("touchend"+a).off("touchcancel"+a),u.off("keydown"+a),u.off("focusout"+a),E.off("keydown"+a+k,P.event.activateFocus),D.off("resize"+a)},slidingEvents:function(){E.off("mousemove"+a),E.off("mouseup"+a)}},event:{down:function(e){e.preventDefault(),P.is.range()?(e=P.determine.eventPos(e),e=P.determine.pos(e),d=c.preventCrossover&&P.is.range()&&P.thumbVal===P.secondThumbVal?void(C=e):P.determine.closestThumb(e),void 0===R&&(R=P.get.currentThumbValue())):void 0===R&&(R=P.get.value()),P.is.disabled()||P.bind.slidingEvents()},touchDown:function(e){e.preventDefault(),e.stopImmediatePropagation(),void 0===m&&(d=z(e.target),e=e.touches?e:e.originalEvent,m=e.targetTouches[0].identifier,void 0===R&&(R=P.get.currentThumbValue()))},move:function(i){if("mousemove"===i.type&&i.preventDefault(),!P.is.disabled()){let a=P.determine.valueFromEvent(i);if("mousemove"===i.type&&void 0===d&&(e=P.determine.eventPos(i),e=P.determine.pos(e),d=C>e?g:v),P.is.range()&&(c.minRange||c.maxRange)){var e=P.get.currentRangeDiff(a),t=d.hasClass("second");if(c.minRange&&e<c.minRange||c.maxRange&&e>c.maxRange||c.preventCrossover&&!t&&a>P.secondThumbVal||c.preventCrossover&&t&&a<P.thumbVal)return}if(0===P.get.step()||P.is.smooth()){let e=P.thumbVal,t=P.secondThumbVal,n=P.determine.smoothValueFromEvent(i);d.hasClass("second")?(c.preventCrossover&&P.is.range()&&(a=Math.max(e,a),n=Math.max(e,n)),t=a):(c.preventCrossover&&P.is.range()&&(a=Math.min(t,a),n=Math.min(t,n)),e=a),a=Math.abs(e-(t||0)),P.update.position(n),c.onMove.call(p,a,e,t)}else P.update.value(a,function(e,t,n){c.onMove.call(p,e,t,n)})}},up:function(t){if(t.preventDefault(),!P.is.disabled()){let e=P.determine.valueFromEvent(t);P.is.range()&&(c.minRange||c.maxRange)&&(void 0===d&&(d=e<=P.get.currentThumbValue()?g:v),t=P.get.currentRangeDiff(e),c.minRange&&t<c.minRange?e=P.get.edgeValue(e,c.minRange):c.maxRange&&t>c.maxRange&&(e=P.get.edgeValue(e,c.maxRange))),P.set.value(e),P.unbind.slidingEvents(),(m=void 0)!==R&&(R=void 0)}},touchCancel:function(e){e.preventDefault(),(m=void 0)!==R&&(P.update.value(R),R=void 0)},keydown:function(e,t){if(!P.is.disabled()&&(c.preventCrossover&&P.is.range()&&P.thumbVal===P.secondThumbVal&&(d=void 0),P.is.focused()&&E.trigger(e),t||P.is.focused())){t=P.determine.keyMovement(e);if(0!==t)switch(e.preventDefault(),t){case 1:P.takeStep();break;case 2:P.takeStep(P.get.multiplier());break;case-1:P.backStep();break;case-2:P.backStep(P.get.multiplier())}}},activateFocus:function(e){P.is.disabled()||P.is.focused()||!P.is.hover()||0===P.determine.keyMovement(e)||(e.preventDefault(),P.event.keydown(e,!0),u.trigger("focus"))},resize:function(e){M!==P.get.gapRatio()&&(P.resync(),M=P.get.gapRatio())}},clear:{cache:function(){P.cache={}}},resync:function(){P.verbose("Re-syncing thumb position based on value"),P.setup.labels(),P.is.range()&&P.update.position(P.secondThumbVal,v),P.update.position(P.thumbVal,g)},takeStep:function(e){e=e||1;var t=P.get.step(),n=P.get.currentThumbValue();P.verbose("Taking a step"),0<t?P.set.value(n+t*e):0===t&&(n=n+e/(t=P.get.precision()),P.set.value(Math.round(n*t)/t))},backStep:function(e){e=e||1;var t=P.get.step(),n=P.get.currentThumbValue();P.verbose("Going back a step"),0<t?P.set.value(n-t*e):0===t&&(n=n-e/(t=P.get.precision()),P.set.value(Math.round(n*t)/t))},is:{prime:function(a){if(void 0===P.cache["prime"+a]){let n=!0;for(let e=2,t=Math.sqrt(a);e<=t;e++)if(a%e==0){n=!1;break}n=n&&1<a,P.cache["prime"+a]=n}return P.cache["prime"+a]},range:function(){let e=u.hasClass(l.range);return e||!c.minRange&&!c.maxRange||(u.addClass(l.range),e=!0),e},hover:function(){return n},focused:function(){return u.is(":focus")},disabled:function(){return u.hasClass(l.disabled)},labeled:function(){let e=u.hasClass(l.labeled);return!e&&(0<c.restrictedLabels.length||!1!==c.showLabelTicks)&&(u.addClass(l.labeled),e=!0),e},reversed:function(){return u.hasClass(l.reversed)},vertical:function(){return u.hasClass(l.vertical)},smooth:function(){return c.smooth||u.hasClass(l.smooth)}},get:{currentRangeDiff:function(e){let t;return t=d.hasClass("second")?P.thumbVal<e?e-P.thumbVal:P.thumbVal-e:P.secondThumbVal>e?P.secondThumbVal-e:e-P.secondThumbVal},edgeValue:function(e,t){return e=d.hasClass("second")?P.thumbVal<e?P.thumbVal+t:P.thumbVal-t:P.secondThumbVal<e?P.secondThumbVal+t:P.secondThumbVal-t},trackOffset:function(){return P.is.vertical()?f.offset().top:f.offset().left},trackLength:function(){return P.is.vertical()?f.height():f.width()},trackLeft:function(){return P.is.vertical()?f.position().top:f.position().left},trackStartPos:function(){return P.is.reversed()?P.get.trackLeft()+P.get.trackLength():P.get.trackLeft()},trackEndPos:function(){return P.is.reversed()?P.get.trackLeft():P.get.trackLeft()+P.get.trackLength()},trackStartMargin:function(){let e;return(e=P.is.vertical()?P.is.reversed()?u.css("padding-bottom"):u.css("padding-top"):P.is.reversed()?u.css("padding-right"):u.css("padding-left"))||"0px"},trackEndMargin:function(){let e;return(e=P.is.vertical()?P.is.reversed()?u.css("padding-top"):u.css("padding-bottom"):P.is.reversed()?u.css("padding-left"):u.css("padding-right"))||"0px"},precision:function(){if(void 0===P.cache.precision){let e;var t=P.get.step(),t=10**(e=0!==t?2===(t=String(t).split(".")).length?t[1].length:0:c.decimalPlaces);P.debug("Precision determined",t),P.cache.precision=t}return P.cache.precision},min:function(){return c.min},max:function(){var e,t,n,a;return void 0===P.cache.max&&(e=P.get.step(),t=P.get.min(),n=P.get.precision(),n=0===e?0:Math.floor(Math.round((c.max-t)/e*n)/n),0<(a=0===e?0:(c.max-t)%e)&&P.debug("Max value not divisible by given step. Increasing max value.",c.max,e),P.cache.max=0==a?c.max:t+n*e),P.cache.max},step:function(){return c.step},numLabels:function(){var e,t;return void 0===P.cache.numLabels&&(t=P.get.step(),e=P.get.precision(),t=Math.round((P.get.max()-P.get.min())/(0===t?1:t)*e)/e,P.debug("Determined that there should be "+t+" labels"),P.cache.numLabels=t),P.cache.numLabels},labelType:function(){return c.labelType},label:function(t,n){if(B(r))return r(t,n,P);switch(c.labelType){case c.labelTypes.number:return n;case c.labelTypes.letter:{if(t<0||1<P.get.precision())return P.error(s.invalidLetterNumber,t),t;let e="";for(var a=Array.isArray(c.letters)?c.letters:[...String(c.letters)],i=a.length;0<=n;)e=a[n%i]+e,n=Math.floor(n/i)-1;return e}default:return t}},value:function(){return T},settings:function(){return c},currentThumbValue:function(){return void 0!==d&&d.hasClass("second")?P.secondThumbVal:P.thumbVal},thumbValue:function(e){return"second"!==e?P.thumbVal:P.is.range()?P.secondThumbVal:void P.error(s.notrange)},multiplier:function(){return c.pageMultiplier},thumbPosition:function(e){return"second"!==e?x:P.is.range()?y:void P.error(s.notrange)},gapRatio:function(){let t=1;if(c.autoAdjustLabels){var n=P.get.numLabels(),a=P.is.prime(n)?1:0,i=P.get.trackLength();let e=1;if(0<i)for(;i/n*e<c.labelDistance;)(n+a)%e&&"fixed"!==c.autoAdjustLabels||(t=e),e+=1}return t}},determine:{pos:function(e){return P.is.reversed()?P.get.trackStartPos()-e+P.get.trackOffset():e-P.get.trackOffset()-P.get.trackStartPos()},closestThumb:function(e){var t=parseFloat(P.determine.thumbPos(g)),t=Math.abs(e-t),n=parseFloat(P.determine.thumbPos(v)),e=Math.abs(e-n);return(t!==e||P.get.thumbValue()!==P.get.min())&&t<=e?g:v},closestThumbPos:function(e){var t=parseFloat(P.determine.thumbPos(g)),n=Math.abs(e-t),a=parseFloat(P.determine.thumbPos(v));return n<=Math.abs(e-a)?t:a},thumbPos:function(e){return P.is.vertical()?P.is.reversed()?e.css("bottom"):e.css("top"):P.is.reversed()?e.css("right"):e.css("left")},positionFromValue:function(e){var t=P.get.min(),n=P.get.max(),e=n<e?n:Math.max(e,t),a=P.get.trackLength(),n=Math.round((e-t)/(n-t)*a);return P.verbose("Determined position: "+n+" from value: "+e),n},positionFromRatio:function(e){var t=P.get.trackLength(),n=P.get.step(),t=Math.round(e*t),n=0===n?t:Math.round(t/n)*n;return P.verbose("Determined position: "+t+" from ratio: "+e),n},valueFromEvent:function(e){var e=P.determine.eventPos(e),t=P.determine.pos(e);let n;return n=e<P.get.trackOffset()?P.is.reversed()?P.get.max():P.get.min():e>P.get.trackOffset()+P.get.trackLength()?P.is.reversed()?P.get.min():P.get.max():P.determine.value(t)},smoothValueFromEvent:function(e){var t=P.get.min(),n=P.get.max(),a=P.get.trackLength();let i=P.determine.eventPos(e)-P.get.trackOffset(),o;return i=i<0?0:Math.min(i,a),o=i/a,(o=P.is.reversed()?1-o:o)*(n-t)+t},eventPos:function(t){if("touchmove"===t.type||"touchend"===t.type){var n=t.touches?t:t.originalEvent;let e=n.changedTouches[0];for(const i of n.touches)if(i.identifier===m){e=i;break}var n=e.pageY,a=e.pageX;return P.is.vertical()?n:a}n=t.pageY||t.originalEvent.pageY,a=t.pageX||t.originalEvent.pageX;return P.is.vertical()?n:a},value:function(e){var t=P.get.precision(),n=P.is.reversed()?P.get.trackEndPos():P.get.trackStartPos(),n=(e-n)/((P.is.reversed()?P.get.trackStartPos():P.get.trackEndPos())-n),a=P.get.max()-P.get.min(),i=P.get.step(),n=n*a,a=0===i?n:Math.round(n/i)*i;return P.verbose("Determined value based upon position: "+e+" as: "+n),n!=a&&P.verbose("Rounding value to closest step: "+a),P.verbose("Cutting off additional decimal places"),Math.round((a+P.get.min())*t)/t},keyMovement:function(e){var e=e.which,t=!P.is.vertical()||P.is.reversed()?o.downArrow:o.upArrow,n=!P.is.vertical()||P.is.reversed()?o.upArrow:o.downArrow,a=!P.is.vertical()&&P.is.reversed()?o.rightArrow:o.leftArrow,i=!P.is.vertical()&&P.is.reversed()?o.leftArrow:o.rightArrow;return e===t||e===a?-1:e===n||e===i?1:e===o.pageDown?-2:e===o.pageUp?2:0}},handleNewValuePosition:function(e){var t=P.get.min(),n=P.get.max();return e<=t?e=t:n<=e&&(e=n),P.determine.positionFromValue(e)},set:{active:function(a,i){if(c.highlightRange){var e;i<a&&(e=i,i=a,a=e);const t=b.find(".label");t.each(function(e){const t=z(this);var n=t.attr("data-value");n&&(n=parseInt(n,10),a<=n&&n<=i?t.addClass(l.active):t.removeClass(l.active))})}},value:function(a,i){i=!1!==i;const o=void 0===R;R=void 0===R?P.get.value():R,P.update.value(a,function(e,t,n){L&&!c.fireOnInit||!i||(a!==R&&c.onChange.call(p,e,t,n),c.onMove.call(p,e,t,n)),o&&(R=void 0)})},rangeValue:function(e,t,n){var a,i,o;n=!1!==n,P.is.range()?(a=P.get.min(),i=P.get.max(),o=void 0===R,R=void 0===R?P.get.value():R,e<=a?e=a:i<=e&&(e=i),t<=a?t=a:i<=t&&(t=i),P.thumbVal=e,P.secondThumbVal=t,T=Math.abs(P.thumbVal-P.secondThumbVal),P.update.position(P.thumbVal,g),P.update.position(P.secondThumbVal,v),L&&!c.fireOnInit||!n||(T!==R&&c.onChange.call(p,T,P.thumbVal,P.secondThumbVal),c.onMove.call(p,T,P.thumbVal,P.secondThumbVal)),o&&(R=void 0)):P.error(s.notrange)},position:function(e,t){e=P.determine.value(e);"second"===t?(P.secondThumbVal=e,P.update.position(e,v)):(P.thumbVal=e,P.update.position(e,g)),T=Math.abs(P.thumbVal-(P.secondThumbVal||0)),P.set.value(T)}},update:{value:function(e,t){var n=P.get.min(),a=P.get.max();e<=n?e=n:a<=e&&(e=a),P.is.range()?((d=void 0===d?e<=P.get.currentThumbValue()?g:v:d).hasClass("second")?(c.preventCrossover&&P.is.range()&&(e=Math.max(P.thumbVal+(c.minRange||0),e)),P.secondThumbVal=e):(c.preventCrossover&&P.is.range()&&(e=Math.min(P.secondThumbVal-(c.minRange||0),e)),P.thumbVal=e),T=Math.abs(P.thumbVal-P.secondThumbVal)):(T=e,P.thumbVal=T),P.update.position(e),P.debug("Setting slider value to "+T),"function"==typeof t&&t(T,P.thumbVal,P.secondThumbVal)},position:function(e,t){var n=P.handleNewValuePosition(e);const a=t||d;let i=P.thumbVal||P.get.min(),o=P.secondThumbVal||P.get.min();c.showThumbTooltip&&(t=P.get.precision(),a.attr("data-tooltip",Math.round(e*t)/t)),P.is.range()&&a.hasClass("second")?(y=n,o=e):(x=n,i=e),P.set.active(i,o);let r,s;var t=P.get.min(),l=P.get.max(),e=(e-t)/(l-t)*100,u=(Math.min(i,o)-t)/(l-t)*100,l=100*(1-(Math.max(i,o)-t)/(l-t));r=P.is.vertical()?P.is.reversed()?(s={bottom:"calc("+e+"% - "+w+"px)",top:"auto"},{bottom:u+"%",top:l+"%"}):(s={top:"calc("+e+"% - "+w+"px)",bottom:"auto"},{top:u+"%",bottom:l+"%"}):P.is.reversed()?(s={right:"calc("+e+"% - "+w+"px)",left:"auto"},{right:u+"%",left:l+"%"}):(s={left:"calc("+e+"% - "+w+"px)",right:"auto"},{left:u+"%",right:l+"%"}),a.css(s),h.css(r),P.debug("Setting slider position to "+n)},labelPosition:function(e,t){var n=P.get.trackStartMargin(),a=P.get.trackEndMargin(),i=P.is.vertical()?P.is.reversed()?"bottom":"top":P.is.reversed()?"right":"left",o=P.is.reversed()&&!P.is.vertical()?" - ":" + ";t.css(i,"calc("+("(100% - "+n+" - "+a+") * "+e)+o+n+")")}},goto:{max:function(){P.set.value(P.get.max())},min:function(){P.set.value(P.get.min())}},read:{metadata:function(){var e={thumbVal:u.data(t.thumbVal),secondThumbVal:u.data(t.secondThumbVal)};e.thumbVal&&(P.is.range()&&e.secondThumbVal?(P.debug("Current value set from metadata",e.thumbVal,e.secondThumbVal),P.set.rangeValue(e.thumbVal,e.secondThumbVal)):(P.debug("Current value set from metadata",e.thumbVal),P.set.value(e.thumbVal)))},settings:function(){var e;!1!==c.start&&(P.is.range()?(((e=c.end-c.start)<0||c.minRange&&e<c.minRange||c.maxRange&&e>c.maxRange||c.minRange&&c.maxRange&&c.minRange>c.maxRange)&&P.error(s.invalidRanges,c.start,c.end,c.minRange,c.maxRange),P.debug("Start position set from settings",c.start,c.end),P.set.rangeValue(c.start,c.end)):(P.debug("Start position set from settings",c.start),P.set.value(c.start)))}},setting:function(e,t){if(P.debug("Changing setting",e,t),z.isPlainObject(e))z.extend(!0,c,e);else{if(void 0===t)return c[e];z.isPlainObject(c[e])?z.extend(!0,c[e],t):c[e]=t}P.clear.cache()},internal:function(e,t){if(z.isPlainObject(e))z.extend(!0,P,e);else{if(void 0===t)return P[e];P[e]=t}},debug:function(...e){!c.silent&&c.debug&&(c.performance?P.performance.log(e):(P.debug=Function.prototype.bind.call(console.info,console,c.name+":"),P.debug.apply(console,e)))},verbose:function(...e){!c.silent&&c.verbose&&c.debug&&(c.performance?P.performance.log(e):(P.verbose=Function.prototype.bind.call(console.info,console,c.name+":"),P.verbose.apply(console,e)))},error:function(...e){c.silent||(P.error=Function.prototype.bind.call(console.error,console,c.name+":"),P.error.apply(console,e))},performance:{log:function(e){var t,n;c.performance&&(n=(t=Date.now())-(A||t),A=t,S.push({Name:e[0],Arguments:e.slice(1),Element:p,"Execution Time":n})),clearTimeout(P.performance.timer),P.performance.timer=setTimeout(function(){P.performance.display()},500)},display:function(){var e=c.name+":";let n=0;A=!1,clearTimeout(P.performance.timer),z.each(S,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",0<S.length&&(console.groupCollapsed(e),console.table(S),console.groupEnd()),S=[]}},invoke:function(a,e=j,t=p){let i=V,o,r,n;return"string"==typeof a&&void 0!==i&&(a=a.split(/[ .]/),o=a.length-1,z.each(a,function(e,t){var n=e!==o?t+a[e+1].charAt(0).toUpperCase()+a[e+1].slice(1):a;if(z.isPlainObject(i[n])&&e!==o)i=i[n];else{if(void 0!==i[n])return r=i[n],!1;{if(!z.isPlainObject(i[t])||e===o)return void 0!==i[t]?r=i[t]:P.error(s.method,a),!1;i=i[t]}}})),B(r)?n=r.apply(t,e):void 0!==r&&(n=r),Array.isArray(N)?N.push(n):void 0!==N?N=[N,n]:void 0!==n&&(N=n),r}};O?(void 0===V&&P.initialize(),P.invoke(F)):(void 0!==V&&V.invoke("destroy"),P.initialize())}),void 0!==N?N:this},z.fn.slider.settings={silent:!1,debug:!1,verbose:!1,performance:!0,name:"Slider",namespace:"slider",error:{method:"The method you called is not defined.",notrange:"This slider is not a range slider",invalidRanges:"Invalid range settings (start/end/minRange/maxRange)",invalidLetterNumber:'Negative values or decimal places for labelType: "letter" are not supported'},metadata:{thumbVal:"thumbVal",secondThumbVal:"secondThumbVal"},min:0,max:20,step:1,start:0,end:20,minRange:!1,maxRange:!1,labelType:"number",showLabelTicks:!1,smooth:!1,autoAdjustLabels:!0,labelDistance:100,preventCrossover:!0,fireOnInit:!1,interpretLabel:!1,letters:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",decimalPlaces:2,pageMultiplier:2,selector:{},className:{reversed:"reversed",disabled:"disabled",labeled:"labeled",ticked:"ticked",vertical:"vertical",range:"range",smooth:"smooth",label:"label",active:"active"},keys:{pageUp:33,pageDown:34,leftArrow:37,upArrow:38,rightArrow:39,downArrow:40},restrictedLabels:[],highlightRange:!1,showThumbTooltip:!1,tooltipConfig:{position:"top center",variation:"tiny black"},labelTypes:{number:"number",letter:"letter"},onChange:function(e,t,n){},onMove:function(e,t,n){}}}(jQuery,window,document);
|
package/dist/components/state.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
|
2
|
+
* # Fomantic-UI 2.10.0-beta.64+bcb9c73 - State
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
|
4
4
|
*
|
|
5
5
|
*
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
: globalThis;
|
|
21
21
|
|
|
22
22
|
$.fn.state = function (...args) {
|
|
23
|
-
|
|
23
|
+
const $allModules = $(this);
|
|
24
24
|
|
|
25
25
|
let time = Date.now();
|
|
26
26
|
let performance = [];
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const parameters = args[0];
|
|
29
|
+
const methodInvoked = typeof parameters === 'string';
|
|
30
|
+
const queryArguments = args.slice(1);
|
|
31
|
+
const contextCheck = function (context, win) {
|
|
32
32
|
let $context;
|
|
33
33
|
if ([window, document].includes(context)) {
|
|
34
34
|
$context = $(context);
|
|
@@ -43,28 +43,27 @@
|
|
|
43
43
|
};
|
|
44
44
|
let returnedValue;
|
|
45
45
|
$allModules.each(function () {
|
|
46
|
-
|
|
46
|
+
const settings = $.isPlainObject(parameters)
|
|
47
47
|
? $.extend(true, {}, $.fn.state.settings, parameters)
|
|
48
48
|
: $.extend({}, $.fn.state.settings);
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
const error = settings.error;
|
|
51
|
+
const metadata = settings.metadata;
|
|
52
|
+
const className = settings.className;
|
|
53
|
+
const namespace = settings.namespace;
|
|
54
|
+
const states = settings.states;
|
|
55
|
+
const text = settings.text;
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
const eventNamespace = '.' + namespace;
|
|
58
|
+
const moduleNamespace = namespace + '-module';
|
|
59
59
|
|
|
60
60
|
let $module = $(this);
|
|
61
|
-
|
|
61
|
+
const $context = settings.context ? contextCheck(settings.context, window) : $module;
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
const element = this;
|
|
64
64
|
let instance = $module.data(moduleNamespace);
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
module = {
|
|
66
|
+
const module = {
|
|
68
67
|
|
|
69
68
|
initialize: function () {
|
|
70
69
|
module.verbose('Initializing module');
|
|
@@ -105,7 +104,7 @@
|
|
|
105
104
|
|
|
106
105
|
add: {
|
|
107
106
|
defaults: function () {
|
|
108
|
-
|
|
107
|
+
const userStates = parameters && $.isPlainObject(parameters.states)
|
|
109
108
|
? parameters.states
|
|
110
109
|
: {};
|
|
111
110
|
$.each(settings.defaults, function (type, typeStates) {
|
|
@@ -337,7 +336,7 @@
|
|
|
337
336
|
|
|
338
337
|
flash: {
|
|
339
338
|
text: function (text = settings.text.flash, duration = settings.flashDuration, callback = function () {}) {
|
|
340
|
-
|
|
339
|
+
const previousText = module.get.text();
|
|
341
340
|
module.debug('Flashing text message', text, duration);
|
|
342
341
|
module.update.text(text);
|
|
343
342
|
setTimeout(function () {
|
|
@@ -350,8 +349,8 @@
|
|
|
350
349
|
reset: {
|
|
351
350
|
// on mouseout sets text to previous value
|
|
352
351
|
text: function () {
|
|
353
|
-
|
|
354
|
-
|
|
352
|
+
const activeText = text.active || $module.data(metadata.storedText);
|
|
353
|
+
const inactiveText = text.inactive || $module.data(metadata.storedText);
|
|
355
354
|
if (module.is.textEnabled()) {
|
|
356
355
|
if (module.is.active() && activeText) {
|
|
357
356
|
module.verbose('Resetting active text', activeText);
|
|
@@ -366,7 +365,7 @@
|
|
|
366
365
|
|
|
367
366
|
update: {
|
|
368
367
|
text: function (text) {
|
|
369
|
-
|
|
368
|
+
const currentText = module.get.text();
|
|
370
369
|
if (text && text !== currentText) {
|
|
371
370
|
module.debug('Updating text', text);
|
|
372
371
|
if (settings.selector.text) {
|
|
@@ -482,7 +481,7 @@
|
|
|
482
481
|
query = query.split(/[ .]/);
|
|
483
482
|
maxDepth = query.length - 1;
|
|
484
483
|
$.each(query, function (depth, value) {
|
|
485
|
-
|
|
484
|
+
const camelCaseValue = depth !== maxDepth
|
|
486
485
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
487
486
|
: query;
|
|
488
487
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* # Fomantic UI - 2.10.0-beta.
|
|
2
|
+
* # Fomantic UI - 2.10.0-beta.64+bcb9c73
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
|
4
4
|
* https://fomantic-ui.com/
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
|
-
!function(w,C,i){"use strict";C=void 0!==C&&C.Math===Math?C:globalThis,w.fn.state=function(...e){
|
|
11
|
+
!function(w,C,i){"use strict";C=void 0!==C&&C.Math===Math?C:globalThis,w.fn.state=function(...e){const g=w(this);let b=Date.now(),p=[];const x=e[0],m="string"==typeof x,h=e.slice(1),y=function(e,t){let n;return[C,i].includes(e)?n=w(e):0===(n=w(t.document).find(e)).length&&(n=t.frameElement?y(e,t.parent):C),n};let T;return g.each(function(){const a=w.isPlainObject(x)?w.extend(!0,{},w.fn.state.settings,x):w.extend({},w.fn.state.settings),c=a.error,n=a.metadata,t=a.className;var e=a.namespace;const i=a.states,o=a.text,s="."+e,r=e+"-module";let l=w(this);const d=a.context?y(a.context,C):l,u=this;let f=l.data(r);const v={initialize:function(){v.verbose("Initializing module"),a.automatic&&v.add.defaults(),d.on("mouseenter"+s,v.change.text).on("mouseleave"+s,v.reset.text).on("click"+s,v.toggle.state),v.instantiate()},instantiate:function(){v.verbose("Storing instance of module",v),f=v,l.data(r,v)},destroy:function(){v.verbose("Destroying previous module",f),d.off(s),l.removeData(n.storedText).removeData(r)},refresh:function(){v.verbose("Refreshing selector cache"),l=w(u)},add:{defaults:function(){const n=x&&w.isPlainObject(x.states)?x.states:{};w.each(a.defaults,function(e,t){void 0!==v.is[e]&&v.is[e]()&&(v.verbose("Adding default states",e,u),w.extend(a.states,t,n))})}},is:{active:function(){return l.hasClass(t.active)},loading:function(){return l.hasClass(t.loading)},inactive:function(){return!l.hasClass(t.active)},state:function(e){return void 0!==t[e]&&l.hasClass(t[e])},enabled:function(){return!l.is(a.filter.active)},disabled:function(){return l.is(a.filter.active)},textEnabled:function(){return!l.is(a.filter.text)},button:function(){return l.is(".button:not(a, .submit)")},input:function(){return l.is("input")},progress:function(){return l.is(".ui.progress")}},allow:function(e){v.debug("Now allowing state",e),i[e]=!0},disallow:function(e){v.debug("No longer allowing",e),i[e]=!1},allows:function(e){return i[e]||!1},enable:function(){l.removeClass(t.disabled)},disable:function(){l.addClass(t.disabled)},setState:function(e){v.allows(e)&&l.addClass(t[e])},removeState:function(e){v.allows(e)&&l.removeClass(t[e])},toggle:{state:function(){var e;if(v.allows("active")&&v.is.enabled()){if(v.refresh(),void 0!==w.fn.api)if(e=l.api("get request"),l.api("was cancelled"))v.debug("API Request cancelled by beforesend"),a.activateTest=function(){return!1},a.deactivateTest=function(){return!1};else if(e)return void v.listenTo(e);v.change.state()}}},listenTo:function(e){v.debug("API request detected, waiting for state signal",e),e&&(o.loading&&v.update.text(o.loading),w.when(e).then(function(){"resolved"===e.state()?(v.debug("API request succeeded"),a.activateTest=function(){return!0},a.deactivateTest=function(){return!0}):(v.debug("API request failed"),a.activateTest=function(){return!1},a.deactivateTest=function(){return!1}),v.change.state()}))},change:{state:function(){v.debug("Determining state change direction"),v.is.inactive()?v.activate():v.deactivate(),a.sync&&v.sync(),a.onChange.call(u)},text:function(){v.is.textEnabled()&&(v.is.disabled()?(v.verbose("Changing text to disabled text",o.hover),v.update.text(o.disabled)):v.is.active()?o.hover?(v.verbose("Changing text to hover text",o.hover),v.update.text(o.hover)):o.deactivate&&(v.verbose("Changing text to deactivating text",o.deactivate),v.update.text(o.deactivate)):o.hover?(v.verbose("Changing text to hover text",o.hover),v.update.text(o.hover)):o.activate&&(v.verbose("Changing text to activating text",o.activate),v.update.text(o.activate)))}},activate:function(){a.activateTest.call(u)&&(v.debug("Setting state to active"),l.addClass(t.active),v.update.text(o.active),a.onActivate.call(u))},deactivate:function(){a.deactivateTest.call(u)&&(v.debug("Setting state to inactive"),l.removeClass(t.active),v.update.text(o.inactive),a.onDeactivate.call(u))},sync:function(){v.verbose("Syncing other buttons to current state"),v.is.active()?g.not(l).state("activate"):g.not(l).state("deactivate")},get:{text:function(){return a.selector.text?l.find(a.selector.text).text():l.html()},textFor:function(e){return o[e]||!1}},flash:{text:function(e=a.text.flash,t=a.flashDuration,n=function(){}){const i=v.get.text();v.debug("Flashing text message",e,t),v.update.text(e),setTimeout(function(){v.update.text(i),n.call(u)},t)}},reset:{text:function(){var e=o.active||l.data(n.storedText),t=o.inactive||l.data(n.storedText);v.is.textEnabled()&&(v.is.active()&&e?(v.verbose("Resetting active text",e),v.update.text(e)):t&&(v.verbose("Resetting inactive text",e),v.update.text(t)))}},update:{text:function(e){var t=v.get.text();e&&e!==t?(v.debug("Updating text",e),a.selector.text?l.data(n.storedText,e).find(a.selector.text).text(e):l.data(n.storedText,e).html(e)):v.debug("Text is already set, ignoring update",e)}},setting:function(e,t){if(v.debug("Changing setting",e,t),w.isPlainObject(e))w.extend(!0,a,e);else{if(void 0===t)return a[e];w.isPlainObject(a[e])?w.extend(!0,a[e],t):a[e]=t}},internal:function(e,t){if(w.isPlainObject(e))w.extend(!0,v,e);else{if(void 0===t)return v[e];v[e]=t}},debug:function(...e){!a.silent&&a.debug&&(a.performance?v.performance.log(e):(v.debug=Function.prototype.bind.call(console.info,console,a.name+":"),v.debug.apply(console,e)))},verbose:function(...e){!a.silent&&a.verbose&&a.debug&&(a.performance?v.performance.log(e):(v.verbose=Function.prototype.bind.call(console.info,console,a.name+":"),v.verbose.apply(console,e)))},error:function(...e){a.silent||(v.error=Function.prototype.bind.call(console.error,console,a.name+":"),v.error.apply(console,e))},performance:{log:function(e){var t,n;a.performance&&(n=(t=Date.now())-(b||t),b=t,p.push({Name:e[0],Arguments:e.slice(1),Element:u,"Execution Time":n})),clearTimeout(v.performance.timer),v.performance.timer=setTimeout(function(){v.performance.display()},500)},display:function(){var e=a.name+":";let n=0;b=!1,clearTimeout(v.performance.timer),w.each(p,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",0<p.length&&(console.groupCollapsed(e),console.table(p),console.groupEnd()),p=[]}},invoke:function(i,e=h,t=u){let a=f,o,s,n;var r;return"string"==typeof i&&void 0!==a&&(i=i.split(/[ .]/),o=i.length-1,w.each(i,function(e,t){var n=e!==o?t+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(w.isPlainObject(a[n])&&e!==o)a=a[n];else{if(void 0!==a[n])return s=a[n],!1;{if(!w.isPlainObject(a[t])||e===o)return void 0!==a[t]?s=a[t]:v.error(c.method,i),!1;a=a[t]}}})),"function"==typeof(r=s)&&"number"!=typeof r.nodeType?n=s.apply(t,e):void 0!==s&&(n=s),Array.isArray(T)?T.push(n):void 0!==T?T=[T,n]:void 0!==n&&(T=n),s}};m?(void 0===f&&v.initialize(),v.invoke(x)):(void 0!==f&&f.invoke("destroy"),v.initialize())}),void 0!==T?T:this},w.fn.state.settings={name:"State",debug:!1,verbose:!1,namespace:"state",performance:!0,onActivate:function(){},onDeactivate:function(){},onChange:function(){},activateTest:function(){return!0},deactivateTest:function(){return!0},automatic:!0,sync:!1,flashDuration:1e3,filter:{text:".loading, .disabled",active:".disabled"},context:!1,error:{method:"The method you called is not defined."},metadata:{promise:"promise",storedText:"stored-text"},className:{active:"active",disabled:"disabled",error:"error",loading:"loading",success:"success",warning:"warning"},selector:{text:!1},defaults:{input:{disabled:!0,loading:!0,active:!0},button:{disabled:!0,loading:!0,active:!0},progress:{active:!0,success:!0,warning:!0,error:!0}},states:{active:!0,disabled:!0,error:!0,loading:!0,success:!0,warning:!0},text:{disabled:!1,flash:!1,hover:!1,active:!1,inactive:!1,activate:!1,deactivate:!1}}}(jQuery,window,document);
|
package/dist/components/step.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
|
2
|
+
* # Fomantic-UI 2.10.0-beta.64+bcb9c73 - Sticky
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
|
4
4
|
*
|
|
5
5
|
*
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
: globalThis;
|
|
21
21
|
|
|
22
22
|
$.fn.sticky = function (...args) {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const $allModules = $(this);
|
|
24
|
+
const $document = $(document);
|
|
25
25
|
|
|
26
26
|
let time = Date.now();
|
|
27
27
|
let performance = [];
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const parameters = args[0];
|
|
30
|
+
const methodInvoked = typeof parameters === 'string';
|
|
31
|
+
const queryArguments = args.slice(1);
|
|
32
|
+
const contextCheck = function (context, win) {
|
|
33
33
|
let $context;
|
|
34
34
|
if ([window, document].includes(context)) {
|
|
35
35
|
$context = $(context);
|
|
@@ -45,32 +45,31 @@
|
|
|
45
45
|
let returnedValue;
|
|
46
46
|
|
|
47
47
|
$allModules.each(function () {
|
|
48
|
-
|
|
48
|
+
const settings = $.isPlainObject(parameters)
|
|
49
49
|
? $.extend(true, {}, $.fn.sticky.settings, parameters)
|
|
50
50
|
: $.extend({}, $.fn.sticky.settings);
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
const className = settings.className;
|
|
53
|
+
const namespace = settings.namespace;
|
|
54
|
+
const error = settings.error;
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const eventNamespace = '.' + namespace;
|
|
57
|
+
const moduleNamespace = 'module-' + namespace;
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
const $module = $(this);
|
|
60
|
+
const $window = $(window);
|
|
61
|
+
const $scroll = contextCheck(settings.scrollContext, window);
|
|
62
62
|
let $container;
|
|
63
63
|
let $context;
|
|
64
64
|
|
|
65
65
|
let instance = $module.data(moduleNamespace);
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
const element = this;
|
|
68
68
|
|
|
69
69
|
let documentObserver;
|
|
70
70
|
let observer;
|
|
71
|
-
let module;
|
|
72
71
|
|
|
73
|
-
module = {
|
|
72
|
+
const module = {
|
|
74
73
|
|
|
75
74
|
initialize: function () {
|
|
76
75
|
module.determineContainer();
|
|
@@ -217,7 +216,7 @@
|
|
|
217
216
|
|
|
218
217
|
supports: {
|
|
219
218
|
sticky: function () {
|
|
220
|
-
|
|
219
|
+
const $element = $('<div/>');
|
|
221
220
|
$element.addClass(className.supported);
|
|
222
221
|
|
|
223
222
|
return $element.css('position').match('sticky');
|
|
@@ -232,10 +231,10 @@
|
|
|
232
231
|
module.elementScroll = scroll;
|
|
233
232
|
},
|
|
234
233
|
positions: function () {
|
|
235
|
-
|
|
234
|
+
const scrollContext = {
|
|
236
235
|
height: $scroll.height(),
|
|
237
236
|
};
|
|
238
|
-
|
|
237
|
+
const element = {
|
|
239
238
|
margin: {
|
|
240
239
|
top: parseInt($module.css('margin-top'), 10),
|
|
241
240
|
bottom: parseInt($module.css('margin-bottom'), 10),
|
|
@@ -244,7 +243,7 @@
|
|
|
244
243
|
width: $module.outerWidth(),
|
|
245
244
|
height: $module.outerHeight(),
|
|
246
245
|
};
|
|
247
|
-
|
|
246
|
+
const context = {
|
|
248
247
|
offset: $context.offset(),
|
|
249
248
|
height: $context.outerHeight(),
|
|
250
249
|
};
|
|
@@ -311,12 +310,12 @@
|
|
|
311
310
|
},
|
|
312
311
|
|
|
313
312
|
elementScroll: function (scroll = $scroll.scrollTop()) {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
313
|
+
const element = module.cache.element;
|
|
314
|
+
const scrollContext = module.cache.scrollContext;
|
|
315
|
+
const delta = module.get.scrollChange(scroll);
|
|
316
|
+
const maxScroll = element.height - scrollContext.height + settings.offset;
|
|
318
317
|
let elementScroll = module.get.currentElementScroll();
|
|
319
|
-
|
|
318
|
+
const possibleScroll = elementScroll + delta;
|
|
320
319
|
if (module.cache.fits || possibleScroll < 0) {
|
|
321
320
|
elementScroll = 0;
|
|
322
321
|
} else if (possibleScroll > maxScroll) {
|
|
@@ -352,11 +351,11 @@
|
|
|
352
351
|
.css('margin-top', settings.offset);
|
|
353
352
|
},
|
|
354
353
|
containerSize: function () {
|
|
355
|
-
|
|
354
|
+
const tagName = $container[0].tagName;
|
|
356
355
|
if (tagName === 'HTML' || tagName === 'body') {
|
|
357
356
|
module.determineContainer();
|
|
358
357
|
} else {
|
|
359
|
-
|
|
358
|
+
const tallestHeight = Math.max(module.cache.context.height, module.cache.element.height);
|
|
360
359
|
if (tallestHeight - $container.outerHeight() > settings.jitter) {
|
|
361
360
|
module.debug('Context is taller than container. Specifying exact height for container', module.cache.context.height);
|
|
362
361
|
$container.css({
|
|
@@ -376,7 +375,7 @@
|
|
|
376
375
|
}
|
|
377
376
|
},
|
|
378
377
|
minimumSize: function () {
|
|
379
|
-
|
|
378
|
+
const element = module.cache.element;
|
|
380
379
|
$container
|
|
381
380
|
.css('min-height', element.height);
|
|
382
381
|
},
|
|
@@ -429,26 +428,26 @@
|
|
|
429
428
|
},
|
|
430
429
|
|
|
431
430
|
stick: function (scrollPosition = $scroll.scrollTop()) {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
431
|
+
const cache = module.cache;
|
|
432
|
+
const fits = cache.fits;
|
|
433
|
+
const sameHeight = cache.sameHeight;
|
|
434
|
+
const element = cache.element;
|
|
435
|
+
const scrollContext = cache.scrollContext;
|
|
436
|
+
const context = cache.context;
|
|
437
|
+
const offset = module.is.bottom() && settings.pushing
|
|
439
438
|
? settings.bottomOffset
|
|
440
439
|
: settings.offset;
|
|
441
|
-
|
|
440
|
+
const scroll = {
|
|
442
441
|
top: scrollPosition + offset,
|
|
443
442
|
bottom: scrollPosition + offset + scrollContext.height,
|
|
444
443
|
};
|
|
445
|
-
|
|
444
|
+
const elementScroll = fits
|
|
446
445
|
? 0
|
|
447
446
|
: module.get.elementScroll(scroll.top);
|
|
448
447
|
|
|
449
448
|
// shorthand
|
|
450
|
-
|
|
451
|
-
|
|
449
|
+
const doesntFit = !fits;
|
|
450
|
+
const elementVisible = element.height !== 0;
|
|
452
451
|
if (elementVisible && !sameHeight) {
|
|
453
452
|
if (module.is.initialPosition()) {
|
|
454
453
|
if (scroll.top >= context.bottom) {
|
|
@@ -727,7 +726,7 @@
|
|
|
727
726
|
query = query.split(/[ .]/);
|
|
728
727
|
maxDepth = query.length - 1;
|
|
729
728
|
$.each(query, function (depth, value) {
|
|
730
|
-
|
|
729
|
+
const camelCaseValue = depth !== maxDepth
|
|
731
730
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
732
731
|
: query;
|
|
733
732
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* # Fomantic UI - 2.10.0-beta.
|
|
2
|
+
* # Fomantic UI - 2.10.0-beta.64+bcb9c73
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
|
4
4
|
* https://fomantic-ui.com/
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
|
-
!function(k,z,T){"use strict";z=void 0!==z&&z.Math===Math?z:globalThis,k.fn.sticky=function(...e){let t=k(this);k(T);let p=Date.now(),b=[],v=e[0],x="string"==typeof v,C=e.slice(1),S=function(e,t){let o;return[z,T].includes(e)?o=k(e):0===(o=k(t.document).find(e)).length&&(o=t.frameElement?S(e,t.parent):z),o},y;return t.each(function(){let c=k.isPlainObject(v)?k.extend(!0,{},k.fn.sticky.settings,v):k.extend({},k.fn.sticky.settings),t=c.className;var e=c.namespace;let l=c.error,o="."+e,n="module-"+e,i=k(this),s=k(z),a=S(c.scrollContext,z),r,f,m=i.data(n),d=this,u,h,g;g={initialize:function(){g.determineContainer(),g.determineContext(),g.verbose("Initializing sticky",c,r),g.save.positions(),g.checkErrors(),g.bind.events(),c.observeChanges&&g.observeChanges(),g.instantiate()},instantiate:function(){g.verbose("Storing instance of module",g),m=g,i.data(n,g)},destroy:function(){g.verbose("Destroying previous instance"),g.reset(),u&&u.disconnect(),h&&h.disconnect(),s.off("load"+o,g.event.load).off("resize"+o,g.event.resize),a.off("scrollchange"+o,g.event.scrollchange),i.removeData(n)},observeChanges:function(){u=new MutationObserver(g.event.documentChanged),h=new MutationObserver(g.event.changed),u.observe(T,{childList:!0,subtree:!0}),h.observe(d,{childList:!0,subtree:!0}),h.observe(f[0],{childList:!0,subtree:!0}),g.debug("Setting up mutation observer",h)},determineContainer:function(){r=c.container?S(c.container,z):i.offsetParent()},determineContext:function(){0===(f=c.context?S(c.context,z):r).length&&g.error(l.invalidContext,c.context,i)},checkErrors:function(){g.is.hidden()&&g.error(l.visible,i),g.cache.element.height>g.cache.context.height&&(g.reset(),g.error(l.elementSize,i))},bind:{events:function(){s.on("load"+o,g.event.load).on("resize"+o,g.event.resize),a.off("scroll"+o).on("scroll"+o,g.event.scroll).on("scrollchange"+o,g.event.scrollchange)}},event:{changed:function(e){clearTimeout(g.timer),g.timer=setTimeout(function(){g.verbose("DOM tree modified, updating sticky menu",e),g.refresh()},100)},documentChanged:function(e){Array.prototype.forEach.call(e,function(e){e.removedNodes&&Array.prototype.forEach.call(e.removedNodes,function(e){(e===d||0<k(e).find(d).length)&&(g.debug("Element removed from DOM, tearing down events"),g.destroy())})})},load:function(){g.verbose("Page contents finished loading"),requestAnimationFrame(g.refresh)},resize:function(){g.verbose("Window resized"),requestAnimationFrame(g.refresh)},scroll:function(){requestAnimationFrame(function(){a.triggerHandler("scrollchange"+o,a.scrollTop())})},scrollchange:function(e,t){g.stick(t),c.onScroll.call(d)}},refresh:function(e){g.reset(),c.context||g.determineContext(),e&&g.determineContainer(),g.save.positions(),g.stick(),c.onReposition.call(d)},supports:{sticky:function(){let e=k("<div/>");return e.addClass(t.supported),e.css("position").match("sticky")}},save:{lastScroll:function(e){g.lastScroll=e},elementScroll:function(e){g.elementScroll=e},positions:function(){let e={height:a.height()},t={margin:{top:parseInt(i.css("margin-top"),10),bottom:parseInt(i.css("margin-bottom"),10)},offset:i.offset(),width:i.outerWidth(),height:i.outerHeight()},o={offset:f.offset(),height:f.outerHeight()};g.is.standardScroll()||(g.debug("Non-standard scroll. Removing scroll offset from element offset"),e.top=a.scrollTop(),e.left=a.scrollLeft(),t.offset.top+=e.top,o.offset.top+=e.top,t.offset.left+=e.left,o.offset.left+=e.left),g.cache={fits:t.height+c.offset<=e.height,sameHeight:t.height===o.height,scrollContext:{height:e.height},element:{margin:t.margin,top:t.offset.top-t.margin.top,left:t.offset.left,width:t.width,height:t.height,bottom:t.offset.top+t.height},context:{top:o.offset.top,height:o.height,bottom:o.offset.top+o.height}},g.set.containerSize(),g.stick(),g.debug("Caching element positions",g.cache)}},get:{direction:function(e=a.scrollTop()){let t="down";return t=g.lastScroll&&g.lastScroll>e?"up":t},scrollChange:function(e=a.scrollTop()){return g.lastScroll?e-g.lastScroll:0},currentElementScroll:function(){return g.elementScroll||(g.is.top()?Math.abs(parseInt(i.css("top"),10))||0:Math.abs(parseInt(i.css("bottom"),10))||0)},elementScroll:function(e=a.scrollTop()){var t=g.cache.element,o=g.cache.scrollContext,e=g.get.scrollChange(e),t=t.height-o.height+c.offset;let n=g.get.currentElementScroll();o=n+e;return n=g.cache.fits||o<0?0:t<o?t:o}},remove:{lastScroll:function(){delete g.lastScroll},elementScroll:function(){delete g.elementScroll},minimumSize:function(){r.css("min-height","")},offset:function(){i.css("margin-top","")}},set:{offset:function(){g.verbose("Setting offset on element",c.offset),i.css("margin-top",c.offset)},containerSize:function(){var e=r[0].tagName;"HTML"===e||"body"===e?g.determineContainer():((e=Math.max(g.cache.context.height,g.cache.element.height))-r.outerHeight()>c.jitter?(g.debug("Context is taller than container. Specifying exact height for container",g.cache.context.height),r.css({height:e})):r.css({height:""}),Math.abs(r.outerHeight()-g.cache.context.height)>c.jitter&&(g.debug("Context has padding, specifying exact height for container",g.cache.context.height),r.css({height:g.cache.context.height})))},minimumSize:function(){var e=g.cache.element;r.css("min-height",e.height)},scroll:function(e){g.debug("Setting scroll on element",e),g.elementScroll!==e&&(g.is.top()&&i.css("bottom","").css("top",-e+"px"),g.is.bottom()&&i.css("top","").css("bottom",e+"px"))},size:function(){0!==g.cache.element.height&&0!==g.cache.element.width&&(d.style.setProperty("width",g.cache.element.width+"px","important"),d.style.setProperty("height",g.cache.element.height+"px","important"))}},is:{standardScroll:function(){return a[0]===z},top:function(){return i.hasClass(t.top)},bottom:function(){return i.hasClass(t.bottom)},initialPosition:function(){return!g.is.fixed()&&!g.is.bound()},hidden:function(){return!i.is(":visible")},bound:function(){return i.hasClass(t.bound)},fixed:function(){return i.hasClass(t.fixed)}},stick:function(e=a.scrollTop()){var t=g.cache,o=t.fits,n=t.sameHeight,i=t.element,s=t.scrollContext,t=t.context,r=g.is.bottom()&&c.pushing?c.bottomOffset:c.offset,e={top:e+r,bottom:e+r+s.height},r=o?0:g.get.elementScroll(e.top),s=!o;0===i.height||n||(g.is.initialPosition()?e.top>=t.bottom?(g.debug("Initial element position is bottom of container"),g.bindBottom()):e.top>i.top&&(i.height+e.top-r>=t.bottom&&i.height<t.height?(g.debug("Initial element position is bottom of container"),g.bindBottom()):(g.debug("Initial element position is fixed"),g.fixTop())):g.is.fixed()?g.is.top()?e.top<=i.top?(g.debug("Fixed element reached top of container"),g.setInitialPosition()):i.height+e.top-r>=t.bottom?(g.debug("Fixed element reached bottom of container"),g.bindBottom()):s&&(g.set.scroll(r),g.save.lastScroll(e.top),g.save.elementScroll(r)):g.is.bottom()&&(e.bottom-i.height<=i.top?(g.debug("Bottom fixed rail has reached top of container"),g.setInitialPosition()):e.bottom>=t.bottom?(g.debug("Bottom fixed rail has reached bottom of container"),g.bindBottom()):s&&(g.set.scroll(r),g.save.lastScroll(e.top),g.save.elementScroll(r))):g.is.bottom()&&(e.top<=i.top?(g.debug("Jumped from bottom fixed to top fixed, most likely used home/end button"),g.setInitialPosition()):c.pushing?g.is.bound()&&e.bottom<=t.bottom&&(g.debug("Fixing bottom attached element to bottom of browser."),g.fixBottom()):g.is.bound()&&e.top<=t.bottom-i.height&&(g.debug("Fixing bottom attached element to top of browser."),g.fixTop())))},bindTop:function(){g.debug("Binding element to top of parent container"),g.remove.offset(),c.setSize&&g.set.size(),i.css({left:"",top:"",marginBottom:""}).removeClass(t.fixed).removeClass(t.bottom).addClass(t.bound).addClass(t.top),c.onTop.call(d),c.onUnstick.call(d)},bindBottom:function(){g.debug("Binding element to bottom of parent container"),g.remove.offset(),c.setSize&&g.set.size(),i.css({left:"",top:""}).removeClass(t.fixed).removeClass(t.top).addClass(t.bound).addClass(t.bottom),c.onBottom.call(d),c.onUnstick.call(d)},setInitialPosition:function(){g.debug("Returning to initial position"),g.unfix(),g.unbind()},fixTop:function(){g.debug("Fixing element to top of page"),c.setSize&&g.set.size(),g.set.minimumSize(),g.set.offset(),i.css({left:g.cache.element.left,bottom:"",marginBottom:""}).removeClass(t.bound).removeClass(t.bottom).addClass(t.fixed).addClass(t.top),c.onStick.call(d)},fixBottom:function(){g.debug("Sticking element to bottom of page"),c.setSize&&g.set.size(),g.set.minimumSize(),g.set.offset(),i.css({left:g.cache.element.left,bottom:"",marginBottom:""}).removeClass(t.bound).removeClass(t.top).addClass(t.fixed).addClass(t.bottom),c.onStick.call(d)},unbind:function(){g.is.bound()&&(g.debug("Removing container bound position on element"),g.remove.offset(),i.removeClass(t.bound).removeClass(t.top).removeClass(t.bottom))},unfix:function(){g.is.fixed()&&(g.debug("Removing fixed position on element"),g.remove.minimumSize(),g.remove.offset(),i.removeClass(t.fixed).removeClass(t.top).removeClass(t.bottom),c.onUnstick.call(d))},reset:function(){g.debug("Resetting elements position"),g.unbind(),g.unfix(),g.resetCSS(),g.remove.offset(),g.remove.lastScroll()},resetCSS:function(){i.css({width:"",height:""}),r.css({height:""})},setting:function(e,t){if(k.isPlainObject(e))k.extend(!0,c,e);else{if(void 0===t)return c[e];c[e]=t}},internal:function(e,t){if(k.isPlainObject(e))k.extend(!0,g,e);else{if(void 0===t)return g[e];g[e]=t}},debug:function(...e){!c.silent&&c.debug&&(c.performance?g.performance.log(e):(g.debug=Function.prototype.bind.call(console.info,console,c.name+":"),g.debug.apply(console,e)))},verbose:function(...e){!c.silent&&c.verbose&&c.debug&&(c.performance?g.performance.log(e):(g.verbose=Function.prototype.bind.call(console.info,console,c.name+":"),g.verbose.apply(console,e)))},error:function(...e){c.silent||(g.error=Function.prototype.bind.call(console.error,console,c.name+":"),g.error.apply(console,e))},performance:{log:function(e){var t,o;c.performance&&(o=(t=Date.now())-(p||t),p=t,b.push({Name:e[0],Arguments:e.slice(1),Element:d,"Execution Time":o})),clearTimeout(g.performance.timer),g.performance.timer=setTimeout(function(){g.performance.display()},0)},display:function(){var e=c.name+":";let o=0;p=!1,clearTimeout(g.performance.timer),k.each(b,function(e,t){o+=t["Execution Time"]}),e+=" "+o+"ms",0<b.length&&(console.groupCollapsed(e),console.table(b),console.groupEnd()),b=[]}},invoke:function(n,e=C,t=d){let i=m,s,r,o;var c;return"string"==typeof n&&void 0!==i&&(n=n.split(/[ .]/),s=n.length-1,k.each(n,function(e,t){var o=e!==s?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(k.isPlainObject(i[o])&&e!==s)i=i[o];else{if(void 0!==i[o])return r=i[o],!1;{if(!k.isPlainObject(i[t])||e===s)return void 0!==i[t]?r=i[t]:g.error(l.method,n),!1;i=i[t]}}})),"function"==typeof(c=r)&&"number"!=typeof c.nodeType?o=r.apply(t,e):void 0!==r&&(o=r),Array.isArray(y)?y.push(o):void 0!==y?y=[y,o]:void 0!==o&&(y=o),r}},x?(void 0===m&&g.initialize(),g.invoke(v)):(void 0!==m&&m.invoke("destroy"),g.initialize())}),void 0!==y?y:this},k.fn.sticky.settings={name:"Sticky",namespace:"sticky",silent:!1,debug:!1,verbose:!0,performance:!0,pushing:!1,context:!1,container:!1,scrollContext:z,offset:0,bottomOffset:0,jitter:5,setSize:!0,observeChanges:!1,onReposition:function(){},onScroll:function(){},onStick:function(){},onUnstick:function(){},onTop:function(){},onBottom:function(){},error:{visible:"Element is hidden, you must call refresh after element becomes visible. Use silent setting to suppress this warning in production.",method:"The method you called is not defined.",invalidContext:"Context specified does not exist",elementSize:"Sticky element is larger than its container, cannot create sticky."},className:{bound:"bound",fixed:"fixed",supported:"native",top:"top",bottom:"bottom"}}}(jQuery,window,document);
|
|
11
|
+
!function(k,z,T){"use strict";z=void 0!==z&&z.Math===Math?z:globalThis,k.fn.sticky=function(...e){const t=k(this);k(T);let p=Date.now(),b=[];const v=e[0],x="string"==typeof v,C=e.slice(1),S=function(e,t){let o;return[z,T].includes(e)?o=k(e):0===(o=k(t.document).find(e)).length&&(o=t.frameElement?S(e,t.parent):z),o};let y;return t.each(function(){const c=k.isPlainObject(v)?k.extend(!0,{},k.fn.sticky.settings,v):k.extend({},k.fn.sticky.settings),t=c.className;var e=c.namespace;const l=c.error,o="."+e,n="module-"+e,i=k(this),s=k(z),a=S(c.scrollContext,z);let r,f,m=i.data(n);const d=this;let u,h;const g={initialize:function(){g.determineContainer(),g.determineContext(),g.verbose("Initializing sticky",c,r),g.save.positions(),g.checkErrors(),g.bind.events(),c.observeChanges&&g.observeChanges(),g.instantiate()},instantiate:function(){g.verbose("Storing instance of module",g),m=g,i.data(n,g)},destroy:function(){g.verbose("Destroying previous instance"),g.reset(),u&&u.disconnect(),h&&h.disconnect(),s.off("load"+o,g.event.load).off("resize"+o,g.event.resize),a.off("scrollchange"+o,g.event.scrollchange),i.removeData(n)},observeChanges:function(){u=new MutationObserver(g.event.documentChanged),h=new MutationObserver(g.event.changed),u.observe(T,{childList:!0,subtree:!0}),h.observe(d,{childList:!0,subtree:!0}),h.observe(f[0],{childList:!0,subtree:!0}),g.debug("Setting up mutation observer",h)},determineContainer:function(){r=c.container?S(c.container,z):i.offsetParent()},determineContext:function(){0===(f=c.context?S(c.context,z):r).length&&g.error(l.invalidContext,c.context,i)},checkErrors:function(){g.is.hidden()&&g.error(l.visible,i),g.cache.element.height>g.cache.context.height&&(g.reset(),g.error(l.elementSize,i))},bind:{events:function(){s.on("load"+o,g.event.load).on("resize"+o,g.event.resize),a.off("scroll"+o).on("scroll"+o,g.event.scroll).on("scrollchange"+o,g.event.scrollchange)}},event:{changed:function(e){clearTimeout(g.timer),g.timer=setTimeout(function(){g.verbose("DOM tree modified, updating sticky menu",e),g.refresh()},100)},documentChanged:function(e){Array.prototype.forEach.call(e,function(e){e.removedNodes&&Array.prototype.forEach.call(e.removedNodes,function(e){(e===d||0<k(e).find(d).length)&&(g.debug("Element removed from DOM, tearing down events"),g.destroy())})})},load:function(){g.verbose("Page contents finished loading"),requestAnimationFrame(g.refresh)},resize:function(){g.verbose("Window resized"),requestAnimationFrame(g.refresh)},scroll:function(){requestAnimationFrame(function(){a.triggerHandler("scrollchange"+o,a.scrollTop())})},scrollchange:function(e,t){g.stick(t),c.onScroll.call(d)}},refresh:function(e){g.reset(),c.context||g.determineContext(),e&&g.determineContainer(),g.save.positions(),g.stick(),c.onReposition.call(d)},supports:{sticky:function(){const e=k("<div/>");return e.addClass(t.supported),e.css("position").match("sticky")}},save:{lastScroll:function(e){g.lastScroll=e},elementScroll:function(e){g.elementScroll=e},positions:function(){const e={height:a.height()},t={margin:{top:parseInt(i.css("margin-top"),10),bottom:parseInt(i.css("margin-bottom"),10)},offset:i.offset(),width:i.outerWidth(),height:i.outerHeight()},o={offset:f.offset(),height:f.outerHeight()};g.is.standardScroll()||(g.debug("Non-standard scroll. Removing scroll offset from element offset"),e.top=a.scrollTop(),e.left=a.scrollLeft(),t.offset.top+=e.top,o.offset.top+=e.top,t.offset.left+=e.left,o.offset.left+=e.left),g.cache={fits:t.height+c.offset<=e.height,sameHeight:t.height===o.height,scrollContext:{height:e.height},element:{margin:t.margin,top:t.offset.top-t.margin.top,left:t.offset.left,width:t.width,height:t.height,bottom:t.offset.top+t.height},context:{top:o.offset.top,height:o.height,bottom:o.offset.top+o.height}},g.set.containerSize(),g.stick(),g.debug("Caching element positions",g.cache)}},get:{direction:function(e=a.scrollTop()){let t="down";return t=g.lastScroll&&g.lastScroll>e?"up":t},scrollChange:function(e=a.scrollTop()){return g.lastScroll?e-g.lastScroll:0},currentElementScroll:function(){return g.elementScroll||(g.is.top()?Math.abs(parseInt(i.css("top"),10))||0:Math.abs(parseInt(i.css("bottom"),10))||0)},elementScroll:function(e=a.scrollTop()){var t=g.cache.element,o=g.cache.scrollContext,e=g.get.scrollChange(e),t=t.height-o.height+c.offset;let n=g.get.currentElementScroll();o=n+e;return n=g.cache.fits||o<0?0:t<o?t:o}},remove:{lastScroll:function(){delete g.lastScroll},elementScroll:function(){delete g.elementScroll},minimumSize:function(){r.css("min-height","")},offset:function(){i.css("margin-top","")}},set:{offset:function(){g.verbose("Setting offset on element",c.offset),i.css("margin-top",c.offset)},containerSize:function(){var e=r[0].tagName;"HTML"===e||"body"===e?g.determineContainer():((e=Math.max(g.cache.context.height,g.cache.element.height))-r.outerHeight()>c.jitter?(g.debug("Context is taller than container. Specifying exact height for container",g.cache.context.height),r.css({height:e})):r.css({height:""}),Math.abs(r.outerHeight()-g.cache.context.height)>c.jitter&&(g.debug("Context has padding, specifying exact height for container",g.cache.context.height),r.css({height:g.cache.context.height})))},minimumSize:function(){var e=g.cache.element;r.css("min-height",e.height)},scroll:function(e){g.debug("Setting scroll on element",e),g.elementScroll!==e&&(g.is.top()&&i.css("bottom","").css("top",-e+"px"),g.is.bottom()&&i.css("top","").css("bottom",e+"px"))},size:function(){0!==g.cache.element.height&&0!==g.cache.element.width&&(d.style.setProperty("width",g.cache.element.width+"px","important"),d.style.setProperty("height",g.cache.element.height+"px","important"))}},is:{standardScroll:function(){return a[0]===z},top:function(){return i.hasClass(t.top)},bottom:function(){return i.hasClass(t.bottom)},initialPosition:function(){return!g.is.fixed()&&!g.is.bound()},hidden:function(){return!i.is(":visible")},bound:function(){return i.hasClass(t.bound)},fixed:function(){return i.hasClass(t.fixed)}},stick:function(e=a.scrollTop()){var t=g.cache,o=t.fits,n=t.sameHeight,i=t.element,s=t.scrollContext,t=t.context,r=g.is.bottom()&&c.pushing?c.bottomOffset:c.offset,e={top:e+r,bottom:e+r+s.height},r=o?0:g.get.elementScroll(e.top),s=!o;0===i.height||n||(g.is.initialPosition()?e.top>=t.bottom?(g.debug("Initial element position is bottom of container"),g.bindBottom()):e.top>i.top&&(i.height+e.top-r>=t.bottom&&i.height<t.height?(g.debug("Initial element position is bottom of container"),g.bindBottom()):(g.debug("Initial element position is fixed"),g.fixTop())):g.is.fixed()?g.is.top()?e.top<=i.top?(g.debug("Fixed element reached top of container"),g.setInitialPosition()):i.height+e.top-r>=t.bottom?(g.debug("Fixed element reached bottom of container"),g.bindBottom()):s&&(g.set.scroll(r),g.save.lastScroll(e.top),g.save.elementScroll(r)):g.is.bottom()&&(e.bottom-i.height<=i.top?(g.debug("Bottom fixed rail has reached top of container"),g.setInitialPosition()):e.bottom>=t.bottom?(g.debug("Bottom fixed rail has reached bottom of container"),g.bindBottom()):s&&(g.set.scroll(r),g.save.lastScroll(e.top),g.save.elementScroll(r))):g.is.bottom()&&(e.top<=i.top?(g.debug("Jumped from bottom fixed to top fixed, most likely used home/end button"),g.setInitialPosition()):c.pushing?g.is.bound()&&e.bottom<=t.bottom&&(g.debug("Fixing bottom attached element to bottom of browser."),g.fixBottom()):g.is.bound()&&e.top<=t.bottom-i.height&&(g.debug("Fixing bottom attached element to top of browser."),g.fixTop())))},bindTop:function(){g.debug("Binding element to top of parent container"),g.remove.offset(),c.setSize&&g.set.size(),i.css({left:"",top:"",marginBottom:""}).removeClass(t.fixed).removeClass(t.bottom).addClass(t.bound).addClass(t.top),c.onTop.call(d),c.onUnstick.call(d)},bindBottom:function(){g.debug("Binding element to bottom of parent container"),g.remove.offset(),c.setSize&&g.set.size(),i.css({left:"",top:""}).removeClass(t.fixed).removeClass(t.top).addClass(t.bound).addClass(t.bottom),c.onBottom.call(d),c.onUnstick.call(d)},setInitialPosition:function(){g.debug("Returning to initial position"),g.unfix(),g.unbind()},fixTop:function(){g.debug("Fixing element to top of page"),c.setSize&&g.set.size(),g.set.minimumSize(),g.set.offset(),i.css({left:g.cache.element.left,bottom:"",marginBottom:""}).removeClass(t.bound).removeClass(t.bottom).addClass(t.fixed).addClass(t.top),c.onStick.call(d)},fixBottom:function(){g.debug("Sticking element to bottom of page"),c.setSize&&g.set.size(),g.set.minimumSize(),g.set.offset(),i.css({left:g.cache.element.left,bottom:"",marginBottom:""}).removeClass(t.bound).removeClass(t.top).addClass(t.fixed).addClass(t.bottom),c.onStick.call(d)},unbind:function(){g.is.bound()&&(g.debug("Removing container bound position on element"),g.remove.offset(),i.removeClass(t.bound).removeClass(t.top).removeClass(t.bottom))},unfix:function(){g.is.fixed()&&(g.debug("Removing fixed position on element"),g.remove.minimumSize(),g.remove.offset(),i.removeClass(t.fixed).removeClass(t.top).removeClass(t.bottom),c.onUnstick.call(d))},reset:function(){g.debug("Resetting elements position"),g.unbind(),g.unfix(),g.resetCSS(),g.remove.offset(),g.remove.lastScroll()},resetCSS:function(){i.css({width:"",height:""}),r.css({height:""})},setting:function(e,t){if(k.isPlainObject(e))k.extend(!0,c,e);else{if(void 0===t)return c[e];c[e]=t}},internal:function(e,t){if(k.isPlainObject(e))k.extend(!0,g,e);else{if(void 0===t)return g[e];g[e]=t}},debug:function(...e){!c.silent&&c.debug&&(c.performance?g.performance.log(e):(g.debug=Function.prototype.bind.call(console.info,console,c.name+":"),g.debug.apply(console,e)))},verbose:function(...e){!c.silent&&c.verbose&&c.debug&&(c.performance?g.performance.log(e):(g.verbose=Function.prototype.bind.call(console.info,console,c.name+":"),g.verbose.apply(console,e)))},error:function(...e){c.silent||(g.error=Function.prototype.bind.call(console.error,console,c.name+":"),g.error.apply(console,e))},performance:{log:function(e){var t,o;c.performance&&(o=(t=Date.now())-(p||t),p=t,b.push({Name:e[0],Arguments:e.slice(1),Element:d,"Execution Time":o})),clearTimeout(g.performance.timer),g.performance.timer=setTimeout(function(){g.performance.display()},0)},display:function(){var e=c.name+":";let o=0;p=!1,clearTimeout(g.performance.timer),k.each(b,function(e,t){o+=t["Execution Time"]}),e+=" "+o+"ms",0<b.length&&(console.groupCollapsed(e),console.table(b),console.groupEnd()),b=[]}},invoke:function(n,e=C,t=d){let i=m,s,r,o;var c;return"string"==typeof n&&void 0!==i&&(n=n.split(/[ .]/),s=n.length-1,k.each(n,function(e,t){var o=e!==s?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(k.isPlainObject(i[o])&&e!==s)i=i[o];else{if(void 0!==i[o])return r=i[o],!1;{if(!k.isPlainObject(i[t])||e===s)return void 0!==i[t]?r=i[t]:g.error(l.method,n),!1;i=i[t]}}})),"function"==typeof(c=r)&&"number"!=typeof c.nodeType?o=r.apply(t,e):void 0!==r&&(o=r),Array.isArray(y)?y.push(o):void 0!==y?y=[y,o]:void 0!==o&&(y=o),r}};x?(void 0===m&&g.initialize(),g.invoke(v)):(void 0!==m&&m.invoke("destroy"),g.initialize())}),void 0!==y?y:this},k.fn.sticky.settings={name:"Sticky",namespace:"sticky",silent:!1,debug:!1,verbose:!0,performance:!0,pushing:!1,context:!1,container:!1,scrollContext:z,offset:0,bottomOffset:0,jitter:5,setSize:!0,observeChanges:!1,onReposition:function(){},onScroll:function(){},onStick:function(){},onUnstick:function(){},onTop:function(){},onBottom:function(){},error:{visible:"Element is hidden, you must call refresh after element becomes visible. Use silent setting to suppress this warning in production.",method:"The method you called is not defined.",invalidContext:"Context specified does not exist",elementSize:"Sticky element is larger than its container, cannot create sticky."},className:{bound:"bound",fixed:"fixed",supported:"native",top:"top",bottom:"bottom"}}}(jQuery,window,document);
|
package/dist/components/tab.css
CHANGED