@algolia/autocomplete-plugin-recent-searches 1.19.2 → 1.19.3
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @algolia/autocomplete-plugin-recent-searches 1.19.
|
|
1
|
+
/*! @algolia/autocomplete-plugin-recent-searches 1.19.3 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! @algolia/autocomplete-plugin-recent-searches 1.19.
|
|
1
|
+
/*! @algolia/autocomplete-plugin-recent-searches 1.19.3 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
|
|
2
2
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/autocomplete-plugin-recent-searches"]={})}(this,(function(e){"use strict";function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?t(Object(o),!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function n(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function i(e){var t=e.item,n=e.query;return r(r({},t),{},{_highlightResult:{label:{value:n?t.label.replace(new RegExp(n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"gi"),(function(e){return"__aa-highlight__".concat(e,"__/aa-highlight__")})):t.label}}})}var c="AUTOCOMPLETE_RECENT_SEARCHES",u="__AUTOCOMPLETE_RECENT_SEARCHES_PLUGIN_TEST_KEY__",l={removeSearchTitle:"Remove this search",fillQueryTitle:function(e){return'Fill query with "'.concat(e,'"')}};function s(e){var t=e.key;return function(){try{return localStorage.setItem(u,""),localStorage.removeItem(u),!0}catch(e){return!1}}()?{setItem:function(e){return window.localStorage.setItem(t,JSON.stringify(e))},getItem:function(){var e=window.localStorage.getItem(t);return e?JSON.parse(e):[]}}:{setItem:function(){},getItem:function(){return[]}}}function f(e){var t=e.key,r=e.limit,n=e.search,a=s({key:t});return{onAdd:function(e){a.setItem([e].concat(o(a.getItem())))},onRemove:function(e){a.setItem(a.getItem().filter((function(t){return t.id!==e})))},getAll:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return n({query:e,items:a.getItem(),limit:r}).slice(0,r)}}}function m(e){var t=e.onRemove,r=e.onTapAhead,n=e.translations;return{item:function(e){var o=e.item,a=e.createElement,i=e.components;return a("div",{className:"aa-ItemWrapper"},a("div",{className:"aa-ItemContent"},a("div",{className:"aa-ItemIcon aa-ItemIcon--noBorder"},a("svg",{viewBox:"0 0 24 24",fill:"currentColor"},a("path",{d:"M12.516 6.984v5.25l4.5 2.672-0.75 1.266-5.25-3.188v-6h1.5zM12 20.016q3.281 0 5.648-2.367t2.367-5.648-2.367-5.648-5.648-2.367-5.648 2.367-2.367 5.648 2.367 5.648 5.648 2.367zM12 2.016q4.125 0 7.055 2.93t2.93 7.055-2.93 7.055-7.055 2.93-7.055-2.93-2.93-7.055 2.93-7.055 7.055-2.93z"}))),a("div",{className:"aa-ItemContentBody"},a("div",{className:"aa-ItemContentTitle"},a(i.ReverseHighlight,{hit:o,attribute:"label"}),o.category&&a("span",{className:"aa-ItemContentSubtitle aa-ItemContentSubtitle--inline"},a("span",{className:"aa-ItemContentSubtitleIcon"})," in"," ",a("span",{className:"aa-ItemContentSubtitleCategory"},o.category))))),a("div",{className:"aa-ItemActions"},a("button",{type:"button",className:"aa-ItemActionButton",title:n.removeSearchTitle,onClick:function(e){e.preventDefault(),e.stopPropagation(),t(o.id)}},a("svg",{viewBox:"0 0 24 24",fill:"currentColor"},a("path",{d:"M18 7v13c0 0.276-0.111 0.525-0.293 0.707s-0.431 0.293-0.707 0.293h-10c-0.276 0-0.525-0.111-0.707-0.293s-0.293-0.431-0.293-0.707v-13zM17 5v-1c0-0.828-0.337-1.58-0.879-2.121s-1.293-0.879-2.121-0.879h-4c-0.828 0-1.58 0.337-2.121 0.879s-0.879 1.293-0.879 2.121v1h-4c-0.552 0-1 0.448-1 1s0.448 1 1 1h1v13c0 0.828 0.337 1.58 0.879 2.121s1.293 0.879 2.121 0.879h10c0.828 0 1.58-0.337 2.121-0.879s0.879-1.293 0.879-2.121v-13h1c0.552 0 1-0.448 1-1s-0.448-1-1-1zM9 5v-1c0-0.276 0.111-0.525 0.293-0.707s0.431-0.293 0.707-0.293h4c0.276 0 0.525 0.111 0.707 0.293s0.293 0.431 0.293 0.707v1zM9 11v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1zM13 11v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1z"}))),a("button",{type:"button",className:"aa-ItemActionButton",title:n.fillQueryTitle(o.label),onClick:function(e){e.preventDefault(),e.stopPropagation(),r(o)}},a("svg",{viewBox:"0 0 24 24",fill:"currentColor"},a("path",{d:"M8 17v-7.586l8.293 8.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-8.293-8.293h7.586c0.552 0 1-0.448 1-1s-0.448-1-1-1h-10c-0.552 0-1 0.448-1 1v10c0 0.552 0.448 1 1 1s1-0.448 1-1z"})))))}}}function g(e){return function(t){(0,t.onSelect)((function(t){var r=t.item,n=t.state,o=t.source,a=o.getItemInputValue({item:r,state:n});if("querySuggestionsPlugin"===o.sourceId&&a){var i={id:a,label:a,category:r.__autocomplete_qsCategory};e.addItem(i)}}))}}function v(e){var t=function(e){return r(r({transformSource:function(e){return e.source}},e),{},{translations:r(r({},l),e.translations)})}(e),n=t.storage,a=t.transformSource,i=t.subscribe,c=t.translations,u=function(e){return{addItem:function(t){e.onRemove(t.id),e.onAdd(t)},removeItem:function(t){e.onRemove(t)},getAll:function(t){return e.getAll(t)}}}(n),s={current:[]};return{name:"aa.recentSearchesPlugin",subscribe:null!=i?i:g(u),onSubmit:function(e){var t=e.state.query;if(t){var r={id:t,label:t};u.addItem(r)}},getSources:function(e){var t=e.query,r=e.setQuery,n=e.refresh,o=e.state;function i(e){u.removeItem(e),n()}function l(e){r(e.label),n()}return s.current=u.getAll(t),Promise.resolve(s.current).then((function(e){return 0===e.length?[]:[a({source:{sourceId:"recentSearchesPlugin",getItemInputValue:function(e){return e.item.label},getItems:function(){return e},templates:m({onRemove:i,onTapAhead:l,translations:c})},onRemove:i,onTapAhead:l,state:o})]}))},data:r(r({},u),{},{getAlgoliaSearchParams:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Array.isArray(s.current)?r(r({},n),{},{facetFilters:[].concat(o(null!==(e=n.facetFilters)&&void 0!==e?e:[]),o(s.current.map((function(e){return["objectID:-".concat(e.label)]})))),hitsPerPage:Math.max(1,(null!==(t=n.hitsPerPage)&&void 0!==t?t:10)-s.current.length)}):n}}),__autocomplete_pluginOptions:e}}function p(e){var t=e.query,r=e.items,n=e.limit;return t?r.filter((function(e){return e.label.toLowerCase().includes(t.toLowerCase())})).slice(0,n).map((function(e){return i({item:e,query:t})})):r.slice(0,n).map((function(e){return i({item:e,query:t})}))}function h(e){return r(r({limit:5,search:p,transformSource:function(e){return e.source}},e),{},{translations:r(r({},l),e.translations)})}e.addHighlightedAttribute=i,e.createLocalStorage=f,e.createLocalStorageRecentSearchesPlugin=function(e){var t=h(e),n=t.key,o=t.limit,a=t.transformSource,i=t.search,u=t.subscribe,l=t.translations;return r(r({},v({transformSource:a,storage:f({key:[c,n].join(":"),limit:o,search:i}),subscribe:u,translations:l})),{},{name:"aa.localStorageRecentSearchesPlugin",__autocomplete_pluginOptions:e})},e.createRecentSearchesPlugin=v,e.getTemplates=m,e.search=p,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
3
3
|
//# sourceMappingURL=index.production.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@algolia/autocomplete-plugin-recent-searches",
|
|
3
3
|
"description": "A plugin to add recent searches to Algolia Autocomplete.",
|
|
4
|
-
"version": "1.19.
|
|
4
|
+
"version": "1.19.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/algolia/autocomplete",
|
|
7
7
|
"repository": "algolia/autocomplete",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"watch": "watch \"yarn on:change\" --ignoreDirectoryPattern \"/dist/\""
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@algolia/autocomplete-core": "1.19.
|
|
35
|
-
"@algolia/autocomplete-js": "1.19.
|
|
36
|
-
"@algolia/autocomplete-preset-algolia": "1.19.
|
|
37
|
-
"@algolia/autocomplete-shared": "1.19.
|
|
34
|
+
"@algolia/autocomplete-core": "1.19.3",
|
|
35
|
+
"@algolia/autocomplete-js": "1.19.3",
|
|
36
|
+
"@algolia/autocomplete-preset-algolia": "1.19.3",
|
|
37
|
+
"@algolia/autocomplete-shared": "1.19.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@algolia/client-search": "4.16.0"
|