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(j,F,q){"use strict";function D(e){return"function"==typeof e&&"number"!=typeof e.nodeType}F=void 0!==F&&F.Math===Math?F:globalThis,j.fn.search=function(...e){let S=j(this),x=Date.now(),C=[],A=e[0],w="string"==typeof A,T=e.slice(1),k;return S.each(function(){let f=j.isPlainObject(A)?j.extend(!0,{},j.fn.search.settings,A):j.extend({},j.fn.search.settings),g=f.className,u=f.metadata,i=f.regExp,l=f.fields,h=f.selector,v=f.error;var e=f.namespace;let n="."+e,t=e+"-module",p=j(this),m=p.find(h.prompt),s=p.find(h.searchButton),r=p.find(h.results),a=p.find(h.result),o=void p.find(h.category),d=this,c=p.data(t),y=!1,b=!1,R;R={initialize:function(){R.verbose("Initializing module"),R.get.settings(),R.determine.searchFields(),R.bind.events(),R.set.type(),R.create.results(),R.instantiate()},instantiate:function(){R.verbose("Storing instance of module",R),c=R,p.data(t,R)},destroy:function(){R.verbose("Destroying instance"),p.off(n).removeData(t)},refresh:function(){R.debug("Refreshing selector cache"),m=p.find(h.prompt),s=p.find(h.searchButton),o=p.find(h.category),r=p.find(h.results),a=p.find(h.result)},refreshResults:function(){r=p.find(h.results),a=p.find(h.result)},bind:{events:function(){R.verbose("Binding events to search"),f.automatic&&(p.on(R.get.inputEvent()+n,h.prompt,R.event.input),m.attr("autocomplete",R.is.chrome()?"fomantic-search":"off")),p.on("focus"+n,h.prompt,R.event.focus).on("blur"+n,h.prompt,R.event.blur).on("keydown"+n,h.prompt,R.handleKeyboard).on("click"+n,h.searchButton,R.query).on("mousedown"+n,h.results,R.event.result.mousedown).on("mouseup"+n,h.results,R.event.result.mouseup).on("click"+n,h.result,R.event.result.click).on("click"+n,h.remove,R.event.remove.click)}},determine:{searchFields:function(){A&&void 0!==A.searchFields&&(f.searchFields=Array.isArray(A.searchFields)?A.searchFields:[A.searchFields])}},event:{input:function(){f.searchDelay?(clearTimeout(R.timer),R.timer=setTimeout(function(){R.is.focused()&&R.query()},f.searchDelay)):R.query()},focus:function(){R.set.focus(),f.searchOnFocus&&R.has.minimumCharacters()&&R.query(function(){R.can.show()&&R.showResults()})},blur:function(e){var t=q.activeElement===this;function s(){R.cancel.query(),R.remove.focus(),R.timer=setTimeout(function(){R.hideResults()},f.hideDelay)}t||(b=!1,R.resultsClicked?(R.debug("Determining if user action caused search to close"),p.one("click.close"+n,h.results,function(e){R.is.inMessage(e)||y?m.trigger("focus"):(y=!1,R.is.animating()||R.is.hidden()||s())})):(R.debug("Input blurred without user action, closing results"),s()))},remove:{click:function(){R.clear.value(),m.trigger("focus")}},result:{mousedown:function(){R.resultsClicked=!0},mouseup:function(){R.resultsClicked=!1},click:function(e){R.debug("Search result selected");let t=j(this),s=t.find(h.title).eq(0),i=t.is("a[href]")?t:j();var n=i.attr("href")||!1,r=i.attr("target")||!1,a=0<s.length&&s.text(),o=R.get.results(),c=t.data(u.result)||R.get.result(a,o),l=R.get.value();if(D(f.onSelect)&&!1===f.onSelect.call(d,c,o))return R.debug("Custom onSelect callback cancelled default select action"),void(y=!0);R.hideResults(),a&&R.get.value()===l&&R.set.value(a),n&&(e.preventDefault(),R.verbose("Opening search link found in result",i),"_blank"===r||e.ctrlKey?F.open(n):F.location.href=n)}}},ensureVisible:function(e){var t,s,i;0!==e.length&&(e=(t=e.position().top)+e.outerHeight(!0),s=r.scrollTop(),i=r.height(),t<0?r.scrollTop(s+t):i<e&&r.scrollTop(s+(e-i)))},handleKeyboard:function(e){let t=p.find(h.result),s=p.find(h.category);var i=t.filter("."+g.active),n=t.index(i),r=t.length,i=0<i.length,a=e.which;let o=13,c=27,l=38,u=40,d;if(a===c&&(R.is.visible()?R.hideResults():(R.verbose("Escape key pressed, blurring search field"),m.trigger("blur")),e.stopPropagation(),b=!0),R.is.visible())if(a===o){if(R.verbose("Enter key pressed, selecting active result"),0<t.filter("."+g.active).length)return R.event.result.click.call(t.filter("."+g.active),e),e.preventDefault(),!1}else a===l&&i?(R.verbose("Up key pressed, changing active result"),d=n-1<0?n:n-1,s.removeClass(g.active),t.removeClass(g.active).eq(d).addClass(g.active).closest(s).addClass(g.active),R.ensureVisible(t.eq(d)),e.preventDefault()):a===u&&(R.verbose("Down key pressed, changing active result"),d=r<=n+1?n:n+1,s.removeClass(g.active),t.removeClass(g.active).eq(d).addClass(g.active).closest(s).addClass(g.active),R.ensureVisible(t.eq(d)),e.preventDefault());else a===o&&(R.verbose("Enter key pressed, executing query"),R.query(),R.set.buttonPressed(),m.one("keyup",R.remove.buttonFocus))},setup:{api:function(i,n){var e={debug:f.debug,on:!1,cache:f.cache,action:"search",urlData:{query:i}},t={onSuccess:function(e,t,s){R.parse.response.call(d,e,i),n(),f.apiSettings&&"function"==typeof f.apiSettings.onSuccess&&f.apiSettings.onSuccess.call(this,e,t,s)},onFailure:function(e,t,s){R.displayMessage(v.serverError),n(),f.apiSettings&&"function"==typeof f.apiSettings.onFailure&&f.apiSettings.onFailure.call(this,e,t,s)},onAbort:function(e,t,s){f.apiSettings&&"function"==typeof f.apiSettings.onAbort&&f.apiSettings.onAbort.call(this,e,t,s)},onError:function(e,t,s){R.error(),f.apiSettings&&"function"==typeof f.apiSettings.onError&&f.apiSettings.onError.call(this,e,t,s)}};j.extend(!0,e,f.apiSettings,t),R.verbose("Setting up API request",e),p.api(e)}},can:{useAPI:function(){return void 0!==j.fn.api},show:function(){return R.is.focused()&&!R.is.visible()&&!R.is.empty()},transition:function(){return f.transition&&void 0!==j.fn.transition}},is:{animating:function(){return r.hasClass(g.animating)},chrome:function(){return!!F.chrome&&!F.StyleMedia},hidden:function(){return r.hasClass(g.hidden)},inMessage:function(t){if(t.target){let e=j(t.target);return q.documentElement.contains(t.target)&&0<e.closest(h.message).length}},empty:function(){return""===r.html()},visible:function(){return 0<r.filter(":visible").length},focused:function(){return 0<m.filter(":focus").length}},get:{settings:function(){j.isPlainObject(A)&&A.searchFullText&&(f.fullTextSearch=A.searchFullText,R.error(f.error.oldSearchSyntax,d))},inputEvent:function(){var e=m[0];return void 0!==e&&void 0!==e.oninput?"input":void 0!==e&&void 0!==e.onpropertychange?"propertychange":"keyup"},value:function(){return m.val()},results:function(){return p.data(u.results)},result:function(s,e){let i=!1;return s=void 0!==s?s:R.get.value(),e=void 0!==e?e:R.get.results(),"category"===f.type?(R.debug("Finding result that matches",s),j.each(e,function(e,t){if(Array.isArray(t.results)&&(i=R.search.object(s,t.results)[0]))return!1})):(R.debug("Finding result in results object",s),i=R.search.object(s,e)[0]),i||!1}},select:{firstResult:function(){R.verbose("Selecting first result"),a.first().addClass(g.active)}},set:{focus:function(){p.addClass(g.focus)},loading:function(){p.addClass(g.loading)},value:function(e){R.verbose("Setting search input value",e),m.val(e)},type:function(e=f.type){g[e]&&p.addClass(g[e])},buttonPressed:function(){s.addClass(g.pressed)}},remove:{loading:function(){p.removeClass(g.loading)},focus:function(){p.removeClass(g.focus)},buttonPressed:function(){s.removeClass(g.pressed)},diacritics:function(e){return f.ignoreDiacritics?e.normalize("NFD").replace(/[\u0300-\u036F]/g,""):e}},query:function(e=function(){}){e=D(e)?e:function(){};var t=R.get.value(),s=R.read.cache(t);R.has.minimumCharacters()?(s?(R.debug("Reading result from cache",t),R.save.results(s.results),f.onResults.call(d,s.results,!0),R.addResults(s.html),R.inject.id(s.results),e()):(R.debug("Querying for",t),j.isPlainObject(f.source)||Array.isArray(f.source)?(R.search.local(t),e()):R.can.useAPI()?R.search.remote(t,e):(R.error(v.source),e())),f.onSearchQuery.call(d,t)):R.hideResults()},search:{local:function(e){let t=R.search.object(e,f.source);var s;R.set.loading(),R.save.results(t),R.debug("Returned full local search results",t),0<f.maxResults&&(R.debug("Using specified max results",t),t=t.slice(0,f.maxResults)),"category"===f.type&&(t=R.create.categoryResults(t)),s=R.generateResults({results:t}),R.remove.loading(),R.addResults(s),R.inject.id(t),R.write.cache(e,{html:s,results:t})},remote:function(e,t){t=D(t)?t:function(){},p.api("is loading")&&p.api("abort"),R.setup.api(e,t),p.api("query")},object:function(r,e=f.source,t=f.searchFields){r=R.remove.diacritics(String(r));let a=[],o=[],c=[];var s=r.replace(i.escape,"\\$&");function l(e,t){var s=!a.includes(t),i=!c.includes(t),n=!o.includes(t);s&&i&&n&&e.push(t)}let u=new RegExp(i.beginsWith+s,f.ignoreSearchCase?"i":"");if(Array.isArray(t)||(t=[t]),void 0===e||!1===e)return R.error(v.source),[];let d=t.length-1;return j.each(e,function(e,i){let n=[];j.each(t,function(t,s){if("string"==typeof i[s]||"number"==typeof i[s]){let e;if(e="string"==typeof i[s]?R.remove.diacritics(i[s]):i[s].toString(),e=j("<div/>",{html:e}).text().trim(),"all"===f.fullTextSearch){if(n.push(e),t<d)return!0;e=n.join(" ")}"all"!==f.fullTextSearch&&-1!==e.search(u)?l(a,i):"exact"===f.fullTextSearch&&R.exactSearch(r,e)||"some"===f.fullTextSearch&&R.wordSearch(r,e)||"all"===f.fullTextSearch&&R.wordSearch(r,e,!0)?l(o,i):!0===f.fullTextSearch&&R.fuzzySearch(r,e)&&l(c,i)}})}),[...a,...o,...c]}},exactSearch:function(e,t){return f.ignoreSearchCase&&(e=e.toLowerCase(),t=t.toLowerCase()),t.includes(e)},wordSearch:function(e,t,s){let i=!1;for(const n of e.split(/\s+/))if(!(i=R.exactSearch(n,t))&&s||i&&!s)break;return i},fuzzySearch:function(i,n){var r=n.length,e=i.length;if("string"!=typeof i)return!1;if(f.ignoreSearchCase&&(i=i.toLowerCase(),n=n.toLowerCase()),r<e)return!1;if(e===r)return i===n;for(let t=0,s=0;t<e;t++){let e=!1;for(var a=i.codePointAt(t);s<r;)if(n.codePointAt(s++)===a){e=!0;break}if(!e)return!1}return!0},parse:{response:function(t,e){if(Array.isArray(t)){let e={};e[l.results]=t,t=e}var s=R.generateResults(t);R.verbose("Parsing server response",t),void 0!==t&&void 0!==e&&void 0!==t[l.results]&&(R.addResults(s),R.inject.id(t[l.results]),R.write.cache(e,{html:s,results:t[l.results]}),R.save.results(t[l.results]))}},cancel:{query:function(){R.can.useAPI()&&p.api("abort")}},has:{minimumCharacters:function(){return R.get.value().length>=f.minCharacters},results:function(){return 0!==r.length&&""!==r.html()}},clear:{cache:function(e){let t=p.data(u.cache);e?t&&t[e]&&(R.debug("Removing value from cache",e),delete t[e],p.data(u.cache,t)):(R.debug("Clearing cache",e),p.removeData(u.cache))},value:function(){R.set.value("")}},read:{cache:function(e){var t=p.data(u.cache);return!!f.cache&&(R.verbose("Checking cache for generated html for query",e),"object"==typeof t&&void 0!==t[e]&&t[e])}},create:{categoryResults:function(e){let s={};return j.each(e,function(e,t){t.category&&(void 0===s[t.category]?(R.verbose("Creating new category of results",t.category),s[t.category]={name:t.category,results:[t]}):s[t.category].results.push(t))}),s},id:function(e,t){e+=1;let s;return void 0!==t?(t=String.fromCodePoint(97+t),s=t+e,R.verbose("Creating category result id",s)):(s=e,R.verbose("Creating result id",s)),s},results:function(){0===r.length&&(r=j("<div />").addClass(g.results).appendTo(p))}},inject:{result:function(e,t,s){R.verbose("Injecting result into results");let i=(void 0!==s?r.children().eq(s).children(h.results).first():r).children(h.result).eq(t);R.verbose("Injecting results metadata",i),i.data(u.result,e)},id:function(e){R.debug("Injecting unique ids into results");let s=0,i=0;return"category"===f.type?j.each(e,function(e,t){0<t.results.length&&(i=0,j.each(t.results,function(e,t){void 0===t.id&&(t.id=R.create.id(i,s)),R.inject.result(t,i,s),i++}),s++)}):j.each(e,function(e,t){void 0===t.id&&(t.id=R.create.id(i)),R.inject.result(t,i),i++}),e}},save:{results:function(e){R.verbose("Saving current search results to metadata",e),p.data(u.results,e)}},write:{cache:function(e,t){let s=void 0!==p.data(u.cache)?p.data(u.cache):{};f.cache&&(R.verbose("Writing generated html to cache",e,t),s[e]=t,p.data(u.cache,s))}},addResults:function(e){if(D(f.onResultsAdd)&&!1===f.onResultsAdd.call(r,e))return R.debug("onResultsAdd callback cancelled default action"),!1;e?(r.html(e),R.refreshResults(),f.selectFirstResult&&R.select.firstResult(),R.showResults()):R.hideResults(function(){r.empty()})},showResults:function(e){e=D(e)?e:function(){},b||!R.is.visible()&&R.has.results()&&(R.can.transition()?(R.debug("Showing results with css animations"),r.transition({animation:f.transition+" in",debug:f.debug,verbose:f.verbose,silent:f.silent,duration:f.duration,onShow:function(){var e=p.find(h.result).eq(0);R.ensureVisible(e)},onComplete:function(){e()},queue:!0})):(R.debug("Showing results with javascript"),r.stop().fadeIn(f.duration,f.easing)),f.onResultsOpen.call(r))},hideResults:function(e){e=D(e)?e:function(){},R.is.visible()&&(R.can.transition()?(R.debug("Hiding results with css animations"),r.transition({animation:f.transition+" out",debug:f.debug,verbose:f.verbose,silent:f.silent,duration:f.duration,onComplete:function(){e()},queue:!0})):(R.debug("Hiding results with javascript"),r.stop().fadeOut(f.duration,f.easing)),f.onResultsClose.call(r))},generateResults:function(a){R.debug("Generating html from response",a);let e=f.templates[f.type];var s=j.isPlainObject(a[l.results])&&!j.isEmptyObject(a[l.results]),i=Array.isArray(a[l.results])&&0<a[l.results].length;let t="";if(s||i){if(0<f.maxResults&&(s?"standard"===f.type&&R.error(v.maxResults):a[l.results]=a[l.results].slice(0,f.maxResults)),f.highlightMatches){i=a[l.results],s=f.ignoreSearchCase?"i":"";let t=[...R.get.value()];var o=f.ignoreDiacritics?"[̀-ͯ]?":"",c="(?![^<]*>)";let n=new RegExp(c+"("+t.join(o+")(.*?)"+c+"(")+o+")",s),r=function(...e){return(e=e.slice(1,2*t.length).map(function(e,t){return 1&t?e:"<mark>"+e+"</mark>"})).join("")};j.each(i,function(s,i){j.each(f.searchFields,function(e,t){if("string"==typeof i[t]||"number"==typeof i[t]){let e="string"==typeof i[t]?i[t]:i[t].toString();e=(e=f.ignoreDiacritics?e.normalize("NFD"):e).replace(/<\/?mark>/g,""),a[l.results][s][t]=e.replace(n,r)}})})}D(e)?t=e(a,f):R.error(v.noTemplate,!1)}else f.showNoResults&&(t=R.displayMessage(v.noResults,"empty",v.noResultsHeader));return f.onResults.call(d,a),t},displayMessage:function(e,t="standard",s=!1){return R.debug("Displaying message",e,t,s),R.addResults(f.templates.message(e,t,s)),f.templates.message(e,t,s)},setting:function(e,t){if(j.isPlainObject(e))j.extend(!0,f,e);else{if(void 0===t)return f[e];f[e]=t}},internal:function(e,t){if(j.isPlainObject(e))j.extend(!0,R,e);else{if(void 0===t)return R[e];R[e]=t}},debug:function(...e){!f.silent&&f.debug&&(f.performance?R.performance.log(e):(R.debug=Function.prototype.bind.call(console.info,console,f.name+":"),R.debug.apply(console,e)))},verbose:function(...e){!f.silent&&f.verbose&&f.debug&&(f.performance?R.performance.log(e):(R.verbose=Function.prototype.bind.call(console.info,console,f.name+":"),R.verbose.apply(console,e)))},error:function(...e){f.silent||(R.error=Function.prototype.bind.call(console.error,console,f.name+":"),R.error.apply(console,e))},performance:{log:function(e){var t,s;f.performance&&(s=(t=Date.now())-(x||t),x=t,C.push({Name:e[0],Arguments:e.slice(1),Element:d,"Execution Time":s})),clearTimeout(R.performance.timer),R.performance.timer=setTimeout(function(){R.performance.display()},500)},display:function(){let e=f.name+":",s=0;x=!1,clearTimeout(R.performance.timer),j.each(C,function(e,t){s+=t["Execution Time"]}),e+=" "+s+"ms",1<S.length&&(e+=" ("+S.length+")"),0<C.length&&(console.groupCollapsed(e),console.table(C),console.groupEnd()),C=[]}},invoke:function(i,e=T,t=d){let n=c,r,a,s;return"string"==typeof i&&void 0!==n&&(i=i.split(/[ .]/),r=i.length-1,j.each(i,function(e,t){var s=e!==r?t+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(j.isPlainObject(n[s])&&e!==r)n=n[s];else{if(void 0!==n[s])return a=n[s],!1;{if(!j.isPlainObject(n[t])||e===r)return void 0!==n[t]?a=n[t]:R.error(v.method,i),!1;n=n[t]}}})),D(a)?s=a.apply(t,e):void 0!==a&&(s=a),Array.isArray(k)?k.push(s):void 0!==k?k=[k,s]:void 0!==s&&(k=s),a}},w?(void 0===c&&R.initialize(),R.invoke(A)):(void 0!==c&&c.invoke("destroy"),R.initialize())}),void 0!==k?k:this},j.fn.search.settings={name:"Search",namespace:"search",silent:!1,debug:!1,verbose:!1,performance:!0,type:"standard",minCharacters:1,selectFirstResult:!1,apiSettings:!1,source:!1,searchOnFocus:!0,searchFields:["id","title","description"],displayField:"",fullTextSearch:"exact",highlightMatches:!1,ignoreDiacritics:!1,ignoreSearchCase:!0,automatic:!0,hideDelay:0,searchDelay:200,maxResults:7,cache:!0,showNoResults:!0,preserveHTML:!1,transition:"scale",duration:200,easing:"easeOutExpo",onSelect:!1,onResultsAdd:!1,onSearchQuery:function(e){},onResults:function(e,t){},onResultsOpen:function(){},onResultsClose:function(){},className:{animating:"animating",active:"active",category:"category",empty:"empty",focus:"focus",hidden:"hidden",loading:"loading",results:"results",pressed:"down"},error:{source:"Cannot search. No source used, and Fomantic API module was not included",noResultsHeader:"No Results",noResults:"Your search returned no results",noTemplate:"A valid template name was not specified.",oldSearchSyntax:"searchFullText setting has been renamed fullTextSearch for consistency, please adjust your settings.",serverError:"There was an issue querying the server.",maxResults:"Results must be an array to use maxResults setting",method:"The method you called is not defined."},metadata:{cache:"cache",results:"results",result:"result"},regExp:{escape:/[$()*+./?[\\\]^{|}-]/g,beginsWith:"(?:\\s|^)"},fields:{categories:"results",categoryName:"name",categoryResults:"results",description:"description",image:"image",alt:"alt",price:"price",results:"results",title:"title",url:"url",id:"id",class:"class",action:"action",actionText:"text",actionURL:"url"},selector:{prompt:".prompt",remove:"> .icon.input > .remove.icon",searchButton:".search.button",results:".results",message:".results > .message",category:".category",result:".result",title:".title, .name"},templates:{escape:function(e,t){if(void 0!==t&&t.preserveHTML)return e;const s={'"':""","&":"&","'":"'","<":"<",">":">"};return e=(e=String(e).replace(/["&'<>]/g,e=>s[e])).replace(/<(\/)*mark>/g,"<$1mark>")},message:function(e,t,s){let i="";return void 0!==e&&void 0!==t&&(i+='<div class="message '+t+'">',s&&(i+='<div class="header">'+s+"</div>"),i=i+' <div class="description">'+e+"</div></div>"),i},category:function(e,s){let i="",n=s.fields,r=s.templates.escape;return void 0!==e[n.categoryResults]&&(j.each(e[n.categoryResults],function(e,t){void 0!==t[n.results]&&0<t.results.length&&(i+='<div class="category">',void 0!==t[n.categoryName]&&(i+='<div class="name">'+r(t[n.categoryName],s)+"</div>"),i+='<div class="results">',j.each(t.results,function(e,t){i=(i=(i+=t[n.url]?'<a href="'+t[n.url].replaceAll('"',"")+'" ':"<div ")+(void 0!==t[n.id]?' id="'+t[n.id].replaceAll('"',"")+'" ':""))+(void 0!==t[n.class]?' class="result '+t[n.class].replaceAll('"',"")+'">':' class="result">'),void 0!==t[n.image]&&(i+='<div class="image"> <img src="'+t[n.image].replaceAll('"',"")+'"'+(t[n.alt]?' alt="'+t[n.alt].replaceAll('"',"")+'"':"")+"></div>"),i+='<div class="content">',void 0!==t[n.price]&&(i+='<div class="price">'+r(t[n.price],s)+"</div>"),void 0!==t[n.title]&&(i+='<div class="title">'+r(t[n.title],s)+"</div>"),void 0!==t[n.description]&&(i+='<div class="description">'+r(t[n.description],s)+"</div>"),i=(i+="</div>")+(t[n.url]?"</a>":"</div>")}),i+="</div></div>")}),e[n.action]&&(i+=!1===n.actionURL?'<div class="action">'+r(e[n.action][n.actionText],s)+"</div>":'<a href="'+e[n.action][n.actionURL].replaceAll('"',"")+'" class="action">'+r(e[n.action][n.actionText],s)+"</a>"),i)},standard:function(e,s){let i="",n=s.fields,r=s.templates.escape;return void 0!==e[n.results]&&(j.each(e[n.results],function(e,t){i=(i=(i+=t[n.url]?'<a href="'+t[n.url].replaceAll('"',"")+'" ':"<div ")+(void 0!==t[n.id]?'id="'+t[n.id].replaceAll('"',"")+'" ':""))+(void 0!==t[n.class]?'class="result '+t[n.class].replaceAll('"',"")+'">':'class="result">'),void 0!==t[n.image]&&(i+='<div class="image"> <img src="'+t[n.image].replaceAll('"',"")+'"'+(t[n.alt]?' alt="'+t[n.alt].replaceAll('"',"")+'"':"")+"></div>"),i+='<div class="content">',void 0!==t[n.price]&&(i+='<div class="price">'+r(t[n.price],s)+"</div>"),void 0!==t[n.title]&&(i+='<div class="title">'+r(t[n.title],s)+"</div>"),void 0!==t[n.description]&&(i+='<div class="description">'+r(t[n.description],s)+"</div>"),i=(i+="</div>")+(t[n.url]?"</a>":"</div>")}),e[n.action]&&(i+=!1===n.actionURL?'<div class="action">'+r(e[n.action][n.actionText],s)+"</div>":'<a href="'+e[n.action][n.actionURL].replaceAll('"',"")+'" class="action">'+r(e[n.action][n.actionText],s)+"</a>"),i)}}},j.extend(j.easing,{easeOutExpo:function(e){return 1===e?1:1-2**(-10*e)}})}(jQuery,window,document);
|
|
11
|
+
!function(j,F,q){"use strict";function D(e){return"function"==typeof e&&"number"!=typeof e.nodeType}F=void 0!==F&&F.Math===Math?F:globalThis,j.fn.search=function(...e){const l=j(this);let x=Date.now(),C=[];const A=e[0],w="string"==typeof A,T=e.slice(1);let k;return l.each(function(){const f=j.isPlainObject(A)?j.extend(!0,{},j.fn.search.settings,A):j.extend({},j.fn.search.settings),g=f.className,u=f.metadata,n=f.regExp,d=f.fields,h=f.selector,p=f.error;var e=f.namespace;const i="."+e,t=e+"-module",v=j(this);let m=v.find(h.prompt),s=v.find(h.searchButton),r=v.find(h.results),a=v.find(h.result),o=void v.find(h.category);const y=this;let c=v.data(t),b=!1,R=!1;const S={initialize:function(){S.verbose("Initializing module"),S.get.settings(),S.determine.searchFields(),S.bind.events(),S.set.type(),S.create.results(),S.instantiate()},instantiate:function(){S.verbose("Storing instance of module",S),c=S,v.data(t,S)},destroy:function(){S.verbose("Destroying instance"),v.off(i).removeData(t)},refresh:function(){S.debug("Refreshing selector cache"),m=v.find(h.prompt),s=v.find(h.searchButton),o=v.find(h.category),r=v.find(h.results),a=v.find(h.result)},refreshResults:function(){r=v.find(h.results),a=v.find(h.result)},bind:{events:function(){S.verbose("Binding events to search"),f.automatic&&(v.on(S.get.inputEvent()+i,h.prompt,S.event.input),m.attr("autocomplete",S.is.chrome()?"fomantic-search":"off")),v.on("focus"+i,h.prompt,S.event.focus).on("blur"+i,h.prompt,S.event.blur).on("keydown"+i,h.prompt,S.handleKeyboard).on("click"+i,h.searchButton,S.query).on("mousedown"+i,h.results,S.event.result.mousedown).on("mouseup"+i,h.results,S.event.result.mouseup).on("click"+i,h.result,S.event.result.click).on("click"+i,h.remove,S.event.remove.click)}},determine:{searchFields:function(){A&&void 0!==A.searchFields&&(f.searchFields=Array.isArray(A.searchFields)?A.searchFields:[A.searchFields])}},event:{input:function(){f.searchDelay?(clearTimeout(S.timer),S.timer=setTimeout(function(){S.is.focused()&&S.query()},f.searchDelay)):S.query()},focus:function(){S.set.focus(),f.searchOnFocus&&S.has.minimumCharacters()&&S.query(function(){S.can.show()&&S.showResults()})},blur:function(e){var t=q.activeElement===this;function s(){S.cancel.query(),S.remove.focus(),S.timer=setTimeout(function(){S.hideResults()},f.hideDelay)}t||(R=!1,S.resultsClicked?(S.debug("Determining if user action caused search to close"),v.one("click.close"+i,h.results,function(e){S.is.inMessage(e)||b?m.trigger("focus"):(b=!1,S.is.animating()||S.is.hidden()||s())})):(S.debug("Input blurred without user action, closing results"),s()))},remove:{click:function(){S.clear.value(),m.trigger("focus")}},result:{mousedown:function(){S.resultsClicked=!0},mouseup:function(){S.resultsClicked=!1},click:function(e){S.debug("Search result selected");const t=j(this),s=t.find(h.title).eq(0),n=t.is("a[href]")?t:j();var i=n.attr("href")||!1,r=n.attr("target")||!1,a=0<s.length&&s.text(),o=S.get.results(),c=t.data(u.result)||S.get.result(a,o),l=S.get.value();if(D(f.onSelect)&&!1===f.onSelect.call(y,c,o))return S.debug("Custom onSelect callback cancelled default select action"),void(b=!0);S.hideResults(),a&&S.get.value()===l&&S.set.value(a),i&&(e.preventDefault(),S.verbose("Opening search link found in result",n),"_blank"===r||e.ctrlKey?F.open(i):F.location.href=i)}}},ensureVisible:function(e){var t,s,n;0!==e.length&&(e=(t=e.position().top)+e.outerHeight(!0),s=r.scrollTop(),n=r.height(),t<0?r.scrollTop(s+t):n<e&&r.scrollTop(s+(e-n)))},handleKeyboard:function(e){const t=v.find(h.result),s=v.find(h.category);var n=t.filter("."+g.active),i=t.index(n),r=t.length,n=0<n.length,a=e.which;const o=13,c=27,l=38,u=40;let d;if(a===c&&(S.is.visible()?S.hideResults():(S.verbose("Escape key pressed, blurring search field"),m.trigger("blur")),e.stopPropagation(),R=!0),S.is.visible())if(a===o){if(S.verbose("Enter key pressed, selecting active result"),0<t.filter("."+g.active).length)return S.event.result.click.call(t.filter("."+g.active),e),e.preventDefault(),!1}else a===l&&n?(S.verbose("Up key pressed, changing active result"),d=i-1<0?i:i-1,s.removeClass(g.active),t.removeClass(g.active).eq(d).addClass(g.active).closest(s).addClass(g.active),S.ensureVisible(t.eq(d)),e.preventDefault()):a===u&&(S.verbose("Down key pressed, changing active result"),d=r<=i+1?i:i+1,s.removeClass(g.active),t.removeClass(g.active).eq(d).addClass(g.active).closest(s).addClass(g.active),S.ensureVisible(t.eq(d)),e.preventDefault());else a===o&&(S.verbose("Enter key pressed, executing query"),S.query(),S.set.buttonPressed(),m.one("keyup",S.remove.buttonFocus))},setup:{api:function(n,i){var e={debug:f.debug,on:!1,cache:f.cache,action:"search",urlData:{query:n}},t={onSuccess:function(e,t,s){S.parse.response.call(y,e,n),i(),f.apiSettings&&"function"==typeof f.apiSettings.onSuccess&&f.apiSettings.onSuccess.call(this,e,t,s)},onFailure:function(e,t,s){S.displayMessage(p.serverError),i(),f.apiSettings&&"function"==typeof f.apiSettings.onFailure&&f.apiSettings.onFailure.call(this,e,t,s)},onAbort:function(e,t,s){f.apiSettings&&"function"==typeof f.apiSettings.onAbort&&f.apiSettings.onAbort.call(this,e,t,s)},onError:function(e,t,s){S.error(),f.apiSettings&&"function"==typeof f.apiSettings.onError&&f.apiSettings.onError.call(this,e,t,s)}};j.extend(!0,e,f.apiSettings,t),S.verbose("Setting up API request",e),v.api(e)}},can:{useAPI:function(){return void 0!==j.fn.api},show:function(){return S.is.focused()&&!S.is.visible()&&!S.is.empty()},transition:function(){return f.transition&&void 0!==j.fn.transition}},is:{animating:function(){return r.hasClass(g.animating)},chrome:function(){return!!F.chrome&&!F.StyleMedia},hidden:function(){return r.hasClass(g.hidden)},inMessage:function(e){if(e.target){const t=j(e.target);return q.documentElement.contains(e.target)&&0<t.closest(h.message).length}},empty:function(){return""===r.html()},visible:function(){return 0<r.filter(":visible").length},focused:function(){return 0<m.filter(":focus").length}},get:{settings:function(){j.isPlainObject(A)&&A.searchFullText&&(f.fullTextSearch=A.searchFullText,S.error(f.error.oldSearchSyntax,y))},inputEvent:function(){var e=m[0];return void 0!==e&&void 0!==e.oninput?"input":void 0!==e&&void 0!==e.onpropertychange?"propertychange":"keyup"},value:function(){return m.val()},results:function(){return v.data(u.results)},result:function(s=S.get.value(),e=S.get.results()){let n=!1;return"category"===f.type?(S.debug("Finding result that matches",s),j.each(e,function(e,t){if(Array.isArray(t.results)&&(n=S.search.object(s,t.results)[0]))return!1})):(S.debug("Finding result in results object",s),n=S.search.object(s,e)[0]),n||!1}},select:{firstResult:function(){S.verbose("Selecting first result"),a.first().addClass(g.active)}},set:{focus:function(){v.addClass(g.focus)},loading:function(){v.addClass(g.loading)},value:function(e){S.verbose("Setting search input value",e),m.val(e)},type:function(e=f.type){g[e]&&v.addClass(g[e])},buttonPressed:function(){s.addClass(g.pressed)}},remove:{loading:function(){v.removeClass(g.loading)},focus:function(){v.removeClass(g.focus)},buttonPressed:function(){s.removeClass(g.pressed)},diacritics:function(e){return f.ignoreDiacritics?e.normalize("NFD").replace(/[\u0300-\u036F]/g,""):e}},query:function(e=function(){}){e=D(e)?e:function(){};var t=S.get.value(),s=S.read.cache(t);S.has.minimumCharacters()?(s?(S.debug("Reading result from cache",t),S.save.results(s.results),f.onResults.call(y,s.results,!0),S.addResults(s.html),S.inject.id(s.results),e()):(S.debug("Querying for",t),j.isPlainObject(f.source)||Array.isArray(f.source)?(S.search.local(t),e()):S.can.useAPI()?S.search.remote(t,e):(S.error(p.source),e())),f.onSearchQuery.call(y,t)):S.hideResults()},search:{local:function(e){let t=S.search.object(e,f.source);S.set.loading(),S.save.results(t),S.debug("Returned full local search results",t),0<f.maxResults&&(S.debug("Using specified max results",t),t=t.slice(0,f.maxResults)),"category"===f.type&&(t=S.create.categoryResults(t));var s=S.generateResults({results:t});S.remove.loading(),S.addResults(s),S.inject.id(t),S.write.cache(e,{html:s,results:t})},remote:function(e,t){t=D(t)?t:function(){},v.api("is loading")&&v.api("abort"),S.setup.api(e,t),v.api("query")},object:function(r,e=f.source,t=f.searchFields){r=S.remove.diacritics(String(r));const a=[],o=[],c=[];var s=r.replace(n.escape,"\\$&");function l(e,t){var s=!a.includes(t),n=!c.includes(t),i=!o.includes(t);s&&n&&i&&e.push(t)}const u=new RegExp(n.beginsWith+s,f.ignoreSearchCase?"i":"");if(Array.isArray(t)||(t=[t]),void 0===e||!1===e)return S.error(p.source),[];const d=t.length-1;return j.each(e,function(e,n){const i=[];j.each(t,function(t,s){if("string"==typeof n[s]||"number"==typeof n[s]){let e;if(e="string"==typeof n[s]?S.remove.diacritics(n[s]):n[s].toString(),e=j("<div/>",{html:e}).text().trim(),"all"===f.fullTextSearch){if(i.push(e),t<d)return!0;e=i.join(" ")}"all"!==f.fullTextSearch&&-1!==e.search(u)?l(a,n):"exact"===f.fullTextSearch&&S.exactSearch(r,e)||"some"===f.fullTextSearch&&S.wordSearch(r,e)||"all"===f.fullTextSearch&&S.wordSearch(r,e,!0)?l(o,n):!0===f.fullTextSearch&&S.fuzzySearch(r,e)&&l(c,n)}})}),[...a,...o,...c]}},exactSearch:function(e,t){return f.ignoreSearchCase&&(e=e.toLowerCase(),t=t.toLowerCase()),t.includes(e)},wordSearch:function(e,t,s){let n=!1;for(const i of e.split(/\s+/))if(!(n=S.exactSearch(i,t))&&s||n&&!s)break;return n},fuzzySearch:function(n,i){var r=i.length,e=n.length;if("string"!=typeof n)return!1;if(f.ignoreSearchCase&&(n=n.toLowerCase(),i=i.toLowerCase()),r<e)return!1;if(e===r)return n===i;for(let t=0,s=0;t<e;t++){let e=!1;for(var a=n.codePointAt(t);s<r;)if(i.codePointAt(s++)===a){e=!0;break}if(!e)return!1}return!0},parse:{response:function(e,t){if(Array.isArray(e)){const n={};n[d.results]=e,e=n}var s=S.generateResults(e);S.verbose("Parsing server response",e),void 0!==e&&void 0!==t&&void 0!==e[d.results]&&(S.addResults(s),S.inject.id(e[d.results]),S.write.cache(t,{html:s,results:e[d.results]}),S.save.results(e[d.results]))}},cancel:{query:function(){S.can.useAPI()&&v.api("abort")}},has:{minimumCharacters:function(){return S.get.value().length>=f.minCharacters},results:function(){return 0!==r.length&&""!==r.html()}},clear:{cache:function(e){const t=v.data(u.cache);e?t&&t[e]&&(S.debug("Removing value from cache",e),delete t[e],v.data(u.cache,t)):(S.debug("Clearing cache",e),v.removeData(u.cache))},value:function(){S.set.value("")}},read:{cache:function(e){var t=v.data(u.cache);return!!f.cache&&(S.verbose("Checking cache for generated html for query",e),"object"==typeof t&&void 0!==t[e]&&t[e])}},create:{categoryResults:function(e){const s={};return j.each(e,function(e,t){t.category&&(void 0===s[t.category]?(S.verbose("Creating new category of results",t.category),s[t.category]={name:t.category,results:[t]}):s[t.category].results.push(t))}),s},id:function(e,t){e+=1;let s;return void 0!==t?(t=String.fromCodePoint(97+t),s=t+e,S.verbose("Creating category result id",s)):(s=e,S.verbose("Creating result id",s)),s},results:function(){0===r.length&&(r=j("<div />").addClass(g.results).appendTo(v))}},inject:{result:function(e,t,s){S.verbose("Injecting result into results");const n=(void 0!==s?r.children().eq(s).children(h.results).first():r).children(h.result).eq(t);S.verbose("Injecting results metadata",n),n.data(u.result,e)},id:function(e){S.debug("Injecting unique ids into results");let s=0,n=0;return"category"===f.type?j.each(e,function(e,t){0<t.results.length&&(n=0,j.each(t.results,function(e,t){void 0===t.id&&(t.id=S.create.id(n,s)),S.inject.result(t,n,s),n++}),s++)}):j.each(e,function(e,t){void 0===t.id&&(t.id=S.create.id(n)),S.inject.result(t,n),n++}),e}},save:{results:function(e){S.verbose("Saving current search results to metadata",e),v.data(u.results,e)}},write:{cache:function(e,t){const s=void 0!==v.data(u.cache)?v.data(u.cache):{};f.cache&&(S.verbose("Writing generated html to cache",e,t),s[e]=t,v.data(u.cache,s))}},addResults:function(e){if(D(f.onResultsAdd)&&!1===f.onResultsAdd.call(r,e))return S.debug("onResultsAdd callback cancelled default action"),!1;e?(r.html(e),S.refreshResults(),f.selectFirstResult&&S.select.firstResult(),S.showResults()):S.hideResults(function(){r.empty()})},showResults:function(e){e=D(e)?e:function(){},R||!S.is.visible()&&S.has.results()&&(S.can.transition()?(S.debug("Showing results with css animations"),r.transition({animation:f.transition+" in",debug:f.debug,verbose:f.verbose,silent:f.silent,duration:f.duration,onShow:function(){var e=v.find(h.result).eq(0);S.ensureVisible(e)},onComplete:function(){e()},queue:!0})):(S.debug("Showing results with javascript"),r.stop().fadeIn(f.duration,f.easing)),f.onResultsOpen.call(r))},hideResults:function(e){e=D(e)?e:function(){},S.is.visible()&&(S.can.transition()?(S.debug("Hiding results with css animations"),r.transition({animation:f.transition+" out",debug:f.debug,verbose:f.verbose,silent:f.silent,duration:f.duration,onComplete:function(){e()},queue:!0})):(S.debug("Hiding results with javascript"),r.stop().fadeOut(f.duration,f.easing)),f.onResultsClose.call(r))},generateResults:function(i){S.debug("Generating html from response",i);const e=f.templates[f.type];var t=j.isPlainObject(i[d.results])&&!j.isEmptyObject(i[d.results]),s=Array.isArray(i[d.results])&&0<i[d.results].length;let n="";if(t||s){if(0<f.maxResults&&(t?"standard"===f.type&&S.error(p.maxResults):i[d.results]=i[d.results].slice(0,f.maxResults)),f.highlightMatches){s=i[d.results],t=f.ignoreSearchCase?"i":"";const o=[...S.get.value()];var r=f.ignoreDiacritics?"[̀-ͯ]?":"",a="(?![^<]*>)";const c=new RegExp(a+"("+o.join(r+")(.*?)"+a+"(")+r+")",t),l=function(...e){return(e=e.slice(1,2*o.length).map(function(e,t){return 1&t?e:"<mark>"+e+"</mark>"})).join("")};j.each(s,function(s,n){j.each(f.searchFields,function(e,t){if("string"==typeof n[t]||"number"==typeof n[t]){let e="string"==typeof n[t]?n[t]:n[t].toString();e=(e=f.ignoreDiacritics?e.normalize("NFD"):e).replace(/<\/?mark>/g,""),i[d.results][s][t]=e.replace(c,l)}})})}D(e)?n=e(i,f):S.error(p.noTemplate,!1)}else f.showNoResults&&(n=S.displayMessage(p.noResults,"empty",p.noResultsHeader));return f.onResults.call(y,i),n},displayMessage:function(e,t="standard",s=!1){return S.debug("Displaying message",e,t,s),S.addResults(f.templates.message(e,t,s)),f.templates.message(e,t,s)},setting:function(e,t){if(j.isPlainObject(e))j.extend(!0,f,e);else{if(void 0===t)return f[e];f[e]=t}},internal:function(e,t){if(j.isPlainObject(e))j.extend(!0,S,e);else{if(void 0===t)return S[e];S[e]=t}},debug:function(...e){!f.silent&&f.debug&&(f.performance?S.performance.log(e):(S.debug=Function.prototype.bind.call(console.info,console,f.name+":"),S.debug.apply(console,e)))},verbose:function(...e){!f.silent&&f.verbose&&f.debug&&(f.performance?S.performance.log(e):(S.verbose=Function.prototype.bind.call(console.info,console,f.name+":"),S.verbose.apply(console,e)))},error:function(...e){f.silent||(S.error=Function.prototype.bind.call(console.error,console,f.name+":"),S.error.apply(console,e))},performance:{log:function(e){var t,s;f.performance&&(s=(t=Date.now())-(x||t),x=t,C.push({Name:e[0],Arguments:e.slice(1),Element:y,"Execution Time":s})),clearTimeout(S.performance.timer),S.performance.timer=setTimeout(function(){S.performance.display()},500)},display:function(){let e=f.name+":",s=0;x=!1,clearTimeout(S.performance.timer),j.each(C,function(e,t){s+=t["Execution Time"]}),e+=" "+s+"ms",1<l.length&&(e+=" ("+l.length+")"),0<C.length&&(console.groupCollapsed(e),console.table(C),console.groupEnd()),C=[]}},invoke:function(n,e=T,t=y){let i=c,r,a,s;return"string"==typeof n&&void 0!==i&&(n=n.split(/[ .]/),r=n.length-1,j.each(n,function(e,t){var s=e!==r?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(j.isPlainObject(i[s])&&e!==r)i=i[s];else{if(void 0!==i[s])return a=i[s],!1;{if(!j.isPlainObject(i[t])||e===r)return void 0!==i[t]?a=i[t]:S.error(p.method,n),!1;i=i[t]}}})),D(a)?s=a.apply(t,e):void 0!==a&&(s=a),Array.isArray(k)?k.push(s):void 0!==k?k=[k,s]:void 0!==s&&(k=s),a}};w?(void 0===c&&S.initialize(),S.invoke(A)):(void 0!==c&&c.invoke("destroy"),S.initialize())}),void 0!==k?k:this},j.fn.search.settings={name:"Search",namespace:"search",silent:!1,debug:!1,verbose:!1,performance:!0,type:"standard",minCharacters:1,selectFirstResult:!1,apiSettings:!1,source:!1,searchOnFocus:!0,searchFields:["id","title","description"],displayField:"",fullTextSearch:"exact",highlightMatches:!1,ignoreDiacritics:!1,ignoreSearchCase:!0,automatic:!0,hideDelay:0,searchDelay:200,maxResults:7,cache:!0,showNoResults:!0,preserveHTML:!1,transition:"scale",duration:200,easing:"easeOutExpo",onSelect:!1,onResultsAdd:!1,onSearchQuery:function(e){},onResults:function(e,t){},onResultsOpen:function(){},onResultsClose:function(){},className:{animating:"animating",active:"active",category:"category",empty:"empty",focus:"focus",hidden:"hidden",loading:"loading",results:"results",pressed:"down"},error:{source:"Cannot search. No source used, and Fomantic API module was not included",noResultsHeader:"No Results",noResults:"Your search returned no results",noTemplate:"A valid template name was not specified.",oldSearchSyntax:"searchFullText setting has been renamed fullTextSearch for consistency, please adjust your settings.",serverError:"There was an issue querying the server.",maxResults:"Results must be an array to use maxResults setting",method:"The method you called is not defined."},metadata:{cache:"cache",results:"results",result:"result"},regExp:{escape:/[$()*+./?[\\\]^{|}-]/g,beginsWith:"(?:\\s|^)"},fields:{categories:"results",categoryName:"name",categoryResults:"results",description:"description",image:"image",alt:"alt",price:"price",results:"results",title:"title",url:"url",id:"id",class:"class",action:"action",actionText:"text",actionURL:"url"},selector:{prompt:".prompt",remove:"> .icon.input > .remove.icon",searchButton:".search.button",results:".results",message:".results > .message",category:".category",result:".result",title:".title, .name"},templates:{escape:function(e,t){if(void 0!==t&&t.preserveHTML)return e;const s={'"':""","&":"&","'":"'","<":"<",">":">"};return e=(e=String(e).replace(/["&'<>]/g,e=>s[e])).replace(/<(\/)*mark>/g,"<$1mark>")},message:function(e,t,s){let n="";return void 0!==e&&void 0!==t&&(n+='<div class="message '+t+'">',s&&(n+='<div class="header">'+s+"</div>"),n=n+' <div class="description">'+e+"</div></div>"),n},category:function(e,s){let n="";const i=s.fields,r=s.templates.escape;return void 0!==e[i.categoryResults]&&(j.each(e[i.categoryResults],function(e,t){void 0!==t[i.results]&&0<t.results.length&&(n+='<div class="category">',void 0!==t[i.categoryName]&&(n+='<div class="name">'+r(t[i.categoryName],s)+"</div>"),n+='<div class="results">',j.each(t.results,function(e,t){n=(n=(n+=t[i.url]?'<a href="'+t[i.url].replaceAll('"',"")+'" ':"<div ")+(void 0!==t[i.id]?' id="'+t[i.id].replaceAll('"',"")+'" ':""))+(void 0!==t[i.class]?' class="result '+t[i.class].replaceAll('"',"")+'">':' class="result">'),void 0!==t[i.image]&&(n+='<div class="image"> <img src="'+t[i.image].replaceAll('"',"")+'"'+(t[i.alt]?' alt="'+t[i.alt].replaceAll('"',"")+'"':"")+"></div>"),n+='<div class="content">',void 0!==t[i.price]&&(n+='<div class="price">'+r(t[i.price],s)+"</div>"),void 0!==t[i.title]&&(n+='<div class="title">'+r(t[i.title],s)+"</div>"),void 0!==t[i.description]&&(n+='<div class="description">'+r(t[i.description],s)+"</div>"),n=(n+="</div>")+(t[i.url]?"</a>":"</div>")}),n+="</div></div>")}),e[i.action]&&(n+=!1===i.actionURL?'<div class="action">'+r(e[i.action][i.actionText],s)+"</div>":'<a href="'+e[i.action][i.actionURL].replaceAll('"',"")+'" class="action">'+r(e[i.action][i.actionText],s)+"</a>"),n)},standard:function(e,s){let n="";const i=s.fields,r=s.templates.escape;return void 0!==e[i.results]&&(j.each(e[i.results],function(e,t){n=(n=(n+=t[i.url]?'<a href="'+t[i.url].replaceAll('"',"")+'" ':"<div ")+(void 0!==t[i.id]?'id="'+t[i.id].replaceAll('"',"")+'" ':""))+(void 0!==t[i.class]?'class="result '+t[i.class].replaceAll('"',"")+'">':'class="result">'),void 0!==t[i.image]&&(n+='<div class="image"> <img src="'+t[i.image].replaceAll('"',"")+'"'+(t[i.alt]?' alt="'+t[i.alt].replaceAll('"',"")+'"':"")+"></div>"),n+='<div class="content">',void 0!==t[i.price]&&(n+='<div class="price">'+r(t[i.price],s)+"</div>"),void 0!==t[i.title]&&(n+='<div class="title">'+r(t[i.title],s)+"</div>"),void 0!==t[i.description]&&(n+='<div class="description">'+r(t[i.description],s)+"</div>"),n=(n+="</div>")+(t[i.url]?"</a>":"</div>")}),e[i.action]&&(n+=!1===i.actionURL?'<div class="action">'+r(e[i.action][i.actionText],s)+"</div>":'<a href="'+e[i.action][i.actionURL].replaceAll('"',"")+'" class="action">'+r(e[i.action][i.actionText],s)+"</a>"),n)}}},j.extend(j.easing,{easeOutExpo:function(e){return 1===e?1:1-2**(-10*e)}})}(jQuery,window,document);
|
package/dist/components/shape.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
|
2
|
+
* # Fomantic-UI 2.10.0-beta.64+bcb9c73 - Shape
|
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
|
4
4
|
*
|
|
5
5
|
*
|
|
@@ -20,31 +20,31 @@
|
|
|
20
20
|
: globalThis;
|
|
21
21
|
|
|
22
22
|
$.fn.shape = function (...args) {
|
|
23
|
-
|
|
23
|
+
const $allModules = $(this);
|
|
24
24
|
|
|
25
25
|
let time = Date.now();
|
|
26
26
|
let performance = [];
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
const parameters = args[0];
|
|
29
|
+
const methodInvoked = typeof parameters === 'string';
|
|
30
|
+
const queryArguments = args.slice(1);
|
|
31
31
|
|
|
32
32
|
let returnedValue;
|
|
33
33
|
|
|
34
34
|
$allModules.each(function () {
|
|
35
|
-
|
|
35
|
+
const settings = $.isPlainObject(parameters)
|
|
36
36
|
? $.extend(true, {}, $.fn.shape.settings, parameters)
|
|
37
37
|
: $.extend({}, $.fn.shape.settings);
|
|
38
38
|
|
|
39
39
|
// internal aliases
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
const namespace = settings.namespace;
|
|
41
|
+
const selector = settings.selector;
|
|
42
|
+
const error = settings.error;
|
|
43
|
+
const className = settings.className;
|
|
44
44
|
|
|
45
45
|
// define namespaces for modules
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const eventNamespace = '.' + namespace;
|
|
47
|
+
const moduleNamespace = 'module-' + namespace;
|
|
48
48
|
|
|
49
49
|
// selector cache
|
|
50
50
|
let $module = $(this);
|
|
@@ -57,11 +57,10 @@
|
|
|
57
57
|
let $nextSide;
|
|
58
58
|
|
|
59
59
|
// standard module
|
|
60
|
-
|
|
60
|
+
const element = this;
|
|
61
61
|
let instance = $module.data(moduleNamespace);
|
|
62
|
-
let module;
|
|
63
62
|
|
|
64
|
-
module = {
|
|
63
|
+
const module = {
|
|
65
64
|
|
|
66
65
|
initialize: function () {
|
|
67
66
|
module.verbose('Initializing module for', element);
|
|
@@ -92,8 +91,8 @@
|
|
|
92
91
|
|
|
93
92
|
repaint: function () {
|
|
94
93
|
module.verbose('Forcing repaint event');
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
const shape = $sides[0] || document.createElement('div');
|
|
95
|
+
const fakeAssignment = shape.offsetWidth;
|
|
97
96
|
},
|
|
98
97
|
|
|
99
98
|
animate: function (propertyObject, callback) {
|
|
@@ -191,9 +190,9 @@
|
|
|
191
190
|
},
|
|
192
191
|
|
|
193
192
|
currentStageSize: function () {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
193
|
+
const $activeSide = $side.filter('.' + className.active);
|
|
194
|
+
const width = $activeSide.outerWidth(true);
|
|
195
|
+
const height = $activeSide.outerHeight(true);
|
|
197
196
|
$module
|
|
198
197
|
.css({
|
|
199
198
|
width: width,
|
|
@@ -202,20 +201,20 @@
|
|
|
202
201
|
},
|
|
203
202
|
|
|
204
203
|
stageSize: function () {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
204
|
+
const $clone = $module.clone().addClass(className.loading);
|
|
205
|
+
const $side = $clone.find('>' + selector.sides + '>' + selector.side);
|
|
206
|
+
const $activeSide = $side.filter('.' + className.active);
|
|
207
|
+
const $nextSide = nextIndex
|
|
209
208
|
? $side.eq(nextIndex)
|
|
210
209
|
: ($activeSide.next(selector.side).length > 0
|
|
211
210
|
? $activeSide.next(selector.side)
|
|
212
211
|
: $side.first());
|
|
213
|
-
|
|
212
|
+
const newWidth = settings.width === 'next'
|
|
214
213
|
? $nextSide.outerWidth(true)
|
|
215
214
|
: (settings.width === 'initial'
|
|
216
215
|
? $module.width()
|
|
217
216
|
: settings.width);
|
|
218
|
-
|
|
217
|
+
const newHeight = settings.height === 'next'
|
|
219
218
|
? $nextSide.outerHeight(true)
|
|
220
219
|
: (settings.height === 'initial'
|
|
221
220
|
? $module.height()
|
|
@@ -268,7 +267,7 @@
|
|
|
268
267
|
|
|
269
268
|
return;
|
|
270
269
|
}
|
|
271
|
-
|
|
270
|
+
const transform = module.get.transform[type]();
|
|
272
271
|
if (!module.is.animating()) {
|
|
273
272
|
module.debug('Flipping ' + type, $nextSide);
|
|
274
273
|
module.set.stageSize();
|
|
@@ -309,8 +308,8 @@
|
|
|
309
308
|
|
|
310
309
|
transform: {
|
|
311
310
|
up: function () {
|
|
312
|
-
|
|
313
|
-
|
|
311
|
+
const translateZ = $activeSide.outerHeight(true) / 2;
|
|
312
|
+
const translateY = $nextSide.outerHeight(true) - translateZ;
|
|
314
313
|
|
|
315
314
|
return {
|
|
316
315
|
transform: 'translateY(' + translateY + 'px) translateZ(-' + translateZ + 'px) rotateX(-90deg)',
|
|
@@ -318,7 +317,7 @@
|
|
|
318
317
|
},
|
|
319
318
|
|
|
320
319
|
down: function () {
|
|
321
|
-
|
|
320
|
+
const translate = {
|
|
322
321
|
z: $activeSide.outerHeight(true) / 2,
|
|
323
322
|
};
|
|
324
323
|
|
|
@@ -328,8 +327,8 @@
|
|
|
328
327
|
},
|
|
329
328
|
|
|
330
329
|
left: function () {
|
|
331
|
-
|
|
332
|
-
|
|
330
|
+
const translateZ = $activeSide.outerWidth(true) / 2;
|
|
331
|
+
const translateX = $nextSide.outerWidth(true) - translateZ;
|
|
333
332
|
|
|
334
333
|
return {
|
|
335
334
|
transform: 'translateX(' + translateX + 'px) translateZ(-' + translateZ + 'px) rotateY(90deg)',
|
|
@@ -337,7 +336,7 @@
|
|
|
337
336
|
},
|
|
338
337
|
|
|
339
338
|
right: function () {
|
|
340
|
-
|
|
339
|
+
const translate = {
|
|
341
340
|
z: $activeSide.outerWidth(true) / 2,
|
|
342
341
|
};
|
|
343
342
|
|
|
@@ -347,7 +346,7 @@
|
|
|
347
346
|
},
|
|
348
347
|
|
|
349
348
|
over: function () {
|
|
350
|
-
|
|
349
|
+
const translate = {
|
|
351
350
|
x: -(($activeSide.outerWidth(true) - $nextSide.outerWidth(true)) / 2),
|
|
352
351
|
};
|
|
353
352
|
|
|
@@ -357,7 +356,7 @@
|
|
|
357
356
|
},
|
|
358
357
|
|
|
359
358
|
back: function () {
|
|
360
|
-
|
|
359
|
+
const translate = {
|
|
361
360
|
x: -(($activeSide.outerWidth(true) - $nextSide.outerWidth(true)) / 2),
|
|
362
361
|
};
|
|
363
362
|
|
|
@@ -378,7 +377,7 @@
|
|
|
378
377
|
stage: {
|
|
379
378
|
|
|
380
379
|
above: function () {
|
|
381
|
-
|
|
380
|
+
const box = {
|
|
382
381
|
origin: ($activeSide.outerHeight(true) - $nextSide.outerHeight(true)) / 2,
|
|
383
382
|
depth: {
|
|
384
383
|
active: $nextSide.outerHeight(true) / 2,
|
|
@@ -399,7 +398,7 @@
|
|
|
399
398
|
},
|
|
400
399
|
|
|
401
400
|
below: function () {
|
|
402
|
-
|
|
401
|
+
const box = {
|
|
403
402
|
origin: ($activeSide.outerHeight(true) - $nextSide.outerHeight(true)) / 2,
|
|
404
403
|
depth: {
|
|
405
404
|
active: $nextSide.outerHeight(true) / 2,
|
|
@@ -420,11 +419,11 @@
|
|
|
420
419
|
},
|
|
421
420
|
|
|
422
421
|
left: function () {
|
|
423
|
-
|
|
422
|
+
const height = {
|
|
424
423
|
active: $activeSide.outerWidth(true),
|
|
425
424
|
next: $nextSide.outerWidth(true),
|
|
426
425
|
};
|
|
427
|
-
|
|
426
|
+
const box = {
|
|
428
427
|
origin: (height.active - height.next) / 2,
|
|
429
428
|
depth: {
|
|
430
429
|
active: height.next / 2,
|
|
@@ -445,11 +444,11 @@
|
|
|
445
444
|
},
|
|
446
445
|
|
|
447
446
|
right: function () {
|
|
448
|
-
|
|
447
|
+
const height = {
|
|
449
448
|
active: $activeSide.outerWidth(true),
|
|
450
449
|
next: $nextSide.outerWidth(true),
|
|
451
450
|
};
|
|
452
|
-
|
|
451
|
+
const box = {
|
|
453
452
|
origin: (height.active - height.next) / 2,
|
|
454
453
|
depth: {
|
|
455
454
|
active: height.next / 2,
|
|
@@ -470,11 +469,11 @@
|
|
|
470
469
|
},
|
|
471
470
|
|
|
472
471
|
behind: function () {
|
|
473
|
-
|
|
472
|
+
const height = {
|
|
474
473
|
active: $activeSide.outerWidth(true),
|
|
475
474
|
next: $nextSide.outerWidth(true),
|
|
476
475
|
};
|
|
477
|
-
|
|
476
|
+
const box = {
|
|
478
477
|
origin: (height.active - height.next) / 2,
|
|
479
478
|
depth: {
|
|
480
479
|
active: height.next / 2,
|
|
@@ -594,7 +593,7 @@
|
|
|
594
593
|
query = query.split(/[ .]/);
|
|
595
594
|
maxDepth = query.length - 1;
|
|
596
595
|
$.each(query, function (depth, value) {
|
|
597
|
-
|
|
596
|
+
const camelCaseValue = depth !== maxDepth
|
|
598
597
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
599
598
|
: query;
|
|
600
599
|
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
@@ -637,7 +636,7 @@
|
|
|
637
636
|
if (instance === undefined) {
|
|
638
637
|
module.initialize();
|
|
639
638
|
}
|
|
640
|
-
|
|
639
|
+
const $inputs = $module.find('input');
|
|
641
640
|
if ($inputs.length > 0) {
|
|
642
641
|
$inputs.trigger('blur');
|
|
643
642
|
setTimeout(function () {
|
|
@@ -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(
|
|
11
|
+
!function(W,e,Y){"use strict";e=void 0!==e&&e.Math===Math?e:globalThis,W.fn.shape=function(...e){const v=W(this);let b=Date.now(),x=[];const y=e[0],C="string"==typeof y,S=e.slice(1);let w;return v.each(function(){const r=W.isPlainObject(y)?W.extend(!0,{},W.fn.shape.settings,y):W.extend({},W.fn.shape.settings);var e=r.namespace;const s=r.selector,d=r.error,l=r.className,t="."+e,i="module-"+e;let c=W(this),n=c.find(">"+s.sides),o=n.find(">"+s.side),u=!1,a,f;const g=this;let h=c.data(i);const p={initialize:function(){p.verbose("Initializing module for",g),p.set.defaultSide(),p.instantiate()},instantiate:function(){p.verbose("Storing instance of module",p),h=p,c.data(i,h)},destroy:function(){p.verbose("Destroying previous module for",g),c.removeData(i).off(t)},refresh:function(){p.verbose("Refreshing selector cache for",g),c=W(g),n=W(this).find(s.sides),o=W(this).find(s.side)},repaint:function(){p.verbose("Forcing repaint event");(n[0]||Y.createElement("div")).offsetWidth},animate:function(e,t){p.verbose("Animating box with properties",e),t=t||function(e){p.verbose("Executing animation callback"),void 0!==e&&e.stopPropagation(),p.reset(),p.set.active()},r.onBeforeChange.call(f[0]),p.verbose("Starting CSS animation"),c.addClass(l.animating),n.css(e).one("transitionend",t),p.set.duration(r.duration),requestAnimationFrame(function(){c.addClass(l.animating),a.addClass(l.hidden)})},queue:function(e){p.debug("Queueing animation of",e),n.one("transitionend",function(){p.debug("Executing queued animation"),setTimeout(function(){c.shape(e)},0)})},reset:function(){p.verbose("Animating states reset"),c.removeClass(l.animating).attr("style","").removeAttr("style"),n.attr("style","").removeAttr("style"),o.attr("style","").removeAttr("style").removeClass(l.hidden),f.removeClass(l.animating).attr("style","").removeAttr("style")},is:{complete:function(){return o.filter("."+l.active)[0]===f[0]},animating:function(){return c.hasClass(l.animating)},hidden:function(){return 0<c.closest(":hidden").length}},set:{defaultSide:function(){a=o.filter("."+l.active),f=0<a.next(s.side).length?a.next(s.side):o.first(),u=!1,p.verbose("Active side set to",a),p.verbose("Next side set to",f)},duration:function(e=r.duration){e="number"==typeof e?e+"ms":e,p.verbose("Setting animation duration",e),!r.duration&&0!==r.duration||n.add(o).css({"transition-duration":e})},currentStageSize:function(){const e=o.filter("."+l.active);var t=e.outerWidth(!0),i=e.outerHeight(!0);c.css({width:t,height:i})},stageSize:function(){const e=c.clone().addClass(l.loading),t=e.find(">"+s.sides+">"+s.side),i=t.filter("."+l.active),n=u?t.eq(u):0<i.next(s.side).length?i.next(s.side):t.first();var o="next"===r.width?n.outerWidth(!0):"initial"===r.width?c.width():r.width,a="next"===r.height?n.outerHeight(!0):"initial"===r.height?c.height():r.height;i.removeClass(l.active),n.addClass(l.active),e.insertAfter(c),e.remove(),"auto"!==r.width&&(c.css("width",o+r.jitter),p.verbose("Specifying width during animation",o)),"auto"!==r.height&&(c.css("height",a+r.jitter),p.verbose("Specifying height during animation",a))},nextSide:function(e){u=e,f=o.filter(e),u=o.index(f),0===f.length&&(p.set.defaultSide(),p.error(d.side)),p.verbose("Next side manually set to",f)},active:function(){p.verbose("Setting new side to active",f),o.removeClass(l.active),f.addClass(l.active),r.onChange.call(f[0]),p.set.defaultSide()}},flip:{to:function(e,t){var i;p.is.hidden()?p.debug("Module not visible",f):!p.is.complete()||p.is.animating()||r.allowRepeats?(i=p.get.transform[e](),p.is.animating()?p.queue("flip "+e):(p.debug("Flipping "+e,f),p.set.stageSize(),p.stage[t](),p.animate(i))):p.debug("Side already visible",f)},up:function(){p.flip.to("up","above")},down:function(){p.flip.to("down","below")},left:function(){p.flip.to("left","left")},right:function(){p.flip.to("right","right")},over:function(){p.flip.to("over","behind")},back:function(){p.flip.to("back","behind")}},get:{transform:{up:function(){var e=a.outerHeight(!0)/2;return{transform:"translateY("+(f.outerHeight(!0)-e)+"px) translateZ(-"+e+"px) rotateX(-90deg)"}},down:function(){const e=a.outerHeight(!0)/2;return{transform:"translateY(-"+e+"px) translateZ(-"+e+"px) rotateX(90deg)"}},left:function(){var e=a.outerWidth(!0)/2;return{transform:"translateX("+(f.outerWidth(!0)-e)+"px) translateZ(-"+e+"px) rotateY(90deg)"}},right:function(){const e=a.outerWidth(!0)/2;return{transform:"translateX(-"+e+"px) translateZ(-"+e+"px) rotateY(-90deg)"}},over:function(){const e=-(a.outerWidth(!0)-f.outerWidth(!0))/2;return{transform:"translateX("+e+"px) rotateY(180deg)"}},back:function(){const e=-(a.outerWidth(!0)-f.outerWidth(!0))/2;return{transform:"translateX("+e+"px) rotateY(-180deg)"}}},nextSide:function(){return 0<a.next(s.side).length?a.next(s.side):o.first()}},stage:{above:function(){var e={origin:(a.outerHeight(!0)-f.outerHeight(!0))/2,depth:{active:f.outerHeight(!0)/2,next:a.outerHeight(!0)/2}};p.verbose("Setting the initial animation position as above",f,e),a.css({transform:"rotateX(0deg)"}),f.addClass(l.animating).css({top:e.origin+"px",transform:"rotateX(90deg) translateZ("+e.depth.next+"px) translateY(-"+e.depth.active+"px)"})},below:function(){var e={origin:(a.outerHeight(!0)-f.outerHeight(!0))/2,depth:{active:f.outerHeight(!0)/2,next:a.outerHeight(!0)/2}};p.verbose("Setting the initial animation position as below",f,e),a.css({transform:"rotateX(0deg)"}),f.addClass(l.animating).css({top:e.origin+"px",transform:"rotateX(-90deg) translateZ("+e.depth.next+"px) translateY("+e.depth.active+"px)"})},left:function(){const e=a.outerWidth(!0),t=f.outerWidth(!0);var i={origin:(e-t)/2,depth:{active:t/2,next:e/2}};p.verbose("Setting the initial animation position as left",f,i),a.css({transform:"rotateY(0deg)"}),f.addClass(l.animating).css({left:i.origin+"px",transform:"rotateY(-90deg) translateZ("+i.depth.next+"px) translateX(-"+i.depth.active+"px)"})},right:function(){const e=a.outerWidth(!0),t=f.outerWidth(!0);var i={origin:(e-t)/2,depth:{active:t/2,next:e/2}};p.verbose("Setting the initial animation position as right",f,i),a.css({transform:"rotateY(0deg)"}),f.addClass(l.animating).css({left:i.origin+"px",transform:"rotateY(90deg) translateZ("+i.depth.next+"px) translateX("+i.depth.active+"px)"})},behind:function(){const e=a.outerWidth(!0),t=f.outerWidth(!0);var i={origin:(e-t)/2,depth:{active:t/2,next:e/2}};p.verbose("Setting the initial animation position as behind",f,i),a.css({transform:"rotateY(0deg)"}),f.addClass(l.animating).css({left:i.origin+"px",transform:"rotateY(-180deg)"})}},setting:function(e,t){if(p.debug("Changing setting",e,t),W.isPlainObject(e))W.extend(!0,r,e);else{if(void 0===t)return r[e];W.isPlainObject(r[e])?W.extend(!0,r[e],t):r[e]=t}},internal:function(e,t){if(W.isPlainObject(e))W.extend(!0,p,e);else{if(void 0===t)return p[e];p[e]=t}},debug:function(...e){!r.silent&&r.debug&&(r.performance?p.performance.log(e):(p.debug=Function.prototype.bind.call(console.info,console,r.name+":"),p.debug.apply(console,e)))},verbose:function(...e){!r.silent&&r.verbose&&r.debug&&(r.performance?p.performance.log(e):(p.verbose=Function.prototype.bind.call(console.info,console,r.name+":"),p.verbose.apply(console,e)))},error:function(...e){r.silent||(p.error=Function.prototype.bind.call(console.error,console,r.name+":"),p.error.apply(console,e))},performance:{log:function(e){var t,i;r.performance&&(i=(t=Date.now())-(b||t),b=t,x.push({Name:e[0],Arguments:e.slice(1),Element:g,"Execution Time":i})),clearTimeout(p.performance.timer),p.performance.timer=setTimeout(function(){p.performance.display()},500)},display:function(){let e=r.name+":",i=0;b=!1,clearTimeout(p.performance.timer),W.each(x,function(e,t){i+=t["Execution Time"]}),e+=" "+i+"ms",1<v.length&&(e+=" ("+v.length+")"),0<x.length&&(console.groupCollapsed(e),console.table(x),console.groupEnd()),x=[]}},invoke:function(n,e=S,t=g){let o=h,a,r,i;var s;return"string"==typeof n&&void 0!==o&&(n=n.split(/[ .]/),a=n.length-1,W.each(n,function(e,t){var i=e!==a?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(W.isPlainObject(o[i])&&e!==a)o=o[i];else{if(void 0!==o[i])return r=o[i],!1;{if(!W.isPlainObject(o[t])||e===a)return void 0!==o[t]?r=o[t]:p.error(d.method,n),!1;o=o[t]}}})),"function"==typeof(s=r)&&"number"!=typeof s.nodeType?i=r.apply(t,e):void 0!==r&&(i=r),Array.isArray(w)?w.push(i):void 0!==w?w=[w,i]:void 0!==i&&(w=i),r}};if(C){void 0===h&&p.initialize();const m=c.find("input");0<m.length?(m.trigger("blur"),setTimeout(function(){p.invoke(y)},150)):p.invoke(y)}else void 0!==h&&h.invoke("destroy"),p.initialize()}),void 0!==w?w:this},W.fn.shape.settings={name:"Shape",silent:!1,debug:!1,verbose:!1,jitter:0,performance:!0,namespace:"shape",width:"initial",height:"initial",onBeforeChange:function(){},onChange:function(){},allowRepeats:!1,duration:!1,error:{side:"You tried to switch to a side that does not exist.",method:"The method you called is not defined"},className:{animating:"animating",hidden:"hidden",loading:"loading",active:"active"},selector:{sides:".sides",side:".side"}}}(jQuery,window,document);
|