@tarekraafat/autocomplete.js 10.2.10 → 10.2.11
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/README.md
CHANGED
|
@@ -51,13 +51,13 @@ autoComplete.js is a simple, pure vanilla Javascript library progressively desig
|
|
|
51
51
|
`JS`
|
|
52
52
|
|
|
53
53
|
```html
|
|
54
|
-
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.
|
|
54
|
+
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.11/dist/autoComplete.min.js"></script>
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
`CSS`
|
|
58
58
|
|
|
59
59
|
```html
|
|
60
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.
|
|
60
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.11/dist/css/autoComplete.min.css">
|
|
61
61
|
```
|
|
62
62
|
#### Package Manager
|
|
63
63
|
|
package/dist/autoComplete.js
CHANGED
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
if (data.cache && data.store) return $return();
|
|
248
248
|
return new Promise(function ($return, $error) {
|
|
249
249
|
if (typeof data.src === "function") {
|
|
250
|
-
return data.src(query).then($return, $error);
|
|
250
|
+
return Promise.resolve(data.src(query)).then($return, $error);
|
|
251
251
|
}
|
|
252
252
|
return $return(data.src);
|
|
253
253
|
}).then(function ($await_4) {
|
package/dist/autoComplete.js.gz
CHANGED
|
Binary file
|
package/dist/autoComplete.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t,e;t=this,e=function(){"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function e(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function r(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?n(Object(i),!0).forEach((function(n){e(t,n,i[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function i(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||s(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 o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function s(e,n){if(e){if("string"==typeof e)return t(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}var u=function(t){return"string"==typeof t?document.querySelector(t):t()},a=function(t,e){var n="string"==typeof t?document.createElement(t):t;for(var r in e){var i=e[r];if("inside"===r)i.append(n);else if("dest"===r)u(i[0]).insertAdjacentElement(i[1],n);else if("around"===r){var o=i;o.parentNode.insertBefore(n,o),n.append(o),null!=o.getAttribute("autofocus")&&o.focus()}else r in n?n[r]=i:n.setAttribute(r,i)}return n},c=function(t,e){return t=String(t).toLowerCase(),e?t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").normalize("NFC"):t},l=function(t,e){return a("mark",r({innerHTML:t},"string"==typeof e&&{class:e})).outerHTML},f=function(t,e){e.input.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:e.feedback,cancelable:!0}))},p=function(t,e,n){var r=n||{},i=r.mode,o=r.diacritics,s=r.highlight,u=c(e,o);if(e=String(e),t=c(t,o),"loose"===i){var a=(t=t.replace(/ /g,"")).length,f=0,p=Array.from(e).map((function(e,n){return f<a&&u[n]===t[f]&&(e=s?l(e,s):e,f++),e})).join("");if(f===a)return p}else{var d=u.indexOf(t);if(~d)return t=e.substring(d,d+t.length),d=s?e.replace(t,l(t,s)):e}},d=function(t,e){return new Promise((function(n,r){var i;return(i=t.data).cache&&i.store?n():new Promise((function(t,n){return"function"==typeof i.src?i.src(e).then(t,n):t(i.src)})).then((function(e){try{return t.feedback=i.store=e,f("response",t),n()}catch(t){return r(t)}}),r)}))},h=function(t,e){var n=e.data,r=e.searchEngine,i=[];n.store.forEach((function(o,u){var a=function(n){var s=n?o[n]:o,u="function"==typeof r?r(t,s):p(t,s,{mode:r,diacritics:e.diacritics,highlight:e.resultItem.highlight});if(u){var a={match:u,value:o};n&&(a.key=n),i.push(a)}};if(n.keys){var c,l=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=s(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return u=t.done,t},e:function(t){a=!0,o=t},f:function(){try{u||null==n.return||n.return()}finally{if(a)throw o}}}}(n.keys);try{for(l.s();!(c=l.n()).done;)a(c.value)}catch(t){l.e(t)}finally{l.f()}}else a()})),n.filter&&(i=n.filter(i));var o=i.slice(0,e.resultsList.maxResults);e.feedback={query:t,matches:i,results:o},f("results",e)},m="aria-expanded",v="aria-activedescendant",b="aria-selected",y=function(t,e){t.feedback.selection=r({index:e},t.feedback.results[e])},g=function(t){t.isOpen||((t.wrapper||t.input).setAttribute(m,!0),t.list.removeAttribute("hidden"),t.isOpen=!0,f("open",t))},w=function(t){t.isOpen&&((t.wrapper||t.input).setAttribute(m,!1),t.input.setAttribute(v,""),t.list.setAttribute("hidden",""),t.isOpen=!1,f("close",t))},O=function(t,e){var n=e.resultItem,r=e.list.getElementsByTagName(n.tag),o=!!n.selected&&n.selected.split(" ");if(e.isOpen&&r.length){var s,u,a=e.cursor;t>=r.length&&(t=0),t<0&&(t=r.length-1),e.cursor=t,a>-1&&(r[a].removeAttribute(b),o&&(u=r[a].classList).remove.apply(u,i(o))),r[t].setAttribute(b,!0),o&&(s=r[t].classList).add.apply(s,i(o)),e.input.setAttribute(v,r[e.cursor].id),e.list.scrollTop=r[t].offsetTop-e.list.clientHeight+r[t].clientHeight+5,e.feedback.cursor=e.cursor,y(e,t),f("navigate",e)}},A=function(t){O(t.cursor+1,t)},S=function(t){O(t.cursor-1,t)},j=function(t,e,n){(n=n>=0?n:t.cursor)<0||(t.feedback.event=e,y(t,n),f("selection",t),w(t))};function k(t,e){var n=this;return new Promise((function(i,o){var s,u;return s=e||((u=t.input)instanceof HTMLInputElement||u instanceof HTMLTextAreaElement?u.value:u.innerHTML),function(t,e,n){return e?e(t):t.length>=n}(s=t.query?t.query(s):s,t.trigger,t.threshold)?d(t,s).then((function(e){try{return t.feedback instanceof Error?i():(h(s,t),t.resultsList&&function(t){var e=t.resultsList,n=t.list,i=t.resultItem,o=t.feedback,s=o.matches,u=o.results;if(t.cursor=-1,n.innerHTML="",s.length||e.noResults){var c=new DocumentFragment;u.forEach((function(t,e){var n=a(i.tag,r({id:"".concat(i.id,"_").concat(e),role:"option",innerHTML:t.match,inside:c},i.class&&{class:i.class}));i.element&&i.element(n,t)})),n.append(c),e.element&&e.element(n,o),g(t)}else w(t)}(t),c.call(n))}catch(t){return o(t)}}),o):(w(t),c.call(n));function c(){return i()}}))}var L=function(t,e){for(var n in t)for(var r in t[n])e(n,r)},T=function(t){var e,n,i,o=t.events,s=(e=function(){return k(t)},n=t.debounce,function(){clearTimeout(i),i=setTimeout((function(){return e()}),n)}),u=t.events=r({input:r({},o&&o.input)},t.resultsList&&{list:o?r({},o.list):{}}),a={input:{input:function(){s()},keydown:function(e){!function(t,e){switch(t.keyCode){case 40:case 38:t.preventDefault(),40===t.keyCode?A(e):S(e);break;case 13:e.submit||t.preventDefault(),e.cursor>=0&&j(e,t);break;case 9:e.resultsList.tabSelect&&e.cursor>=0&&j(e,t);break;case 27:e.input.value="",f("clear",e),w(e)}}(e,t)},blur:function(){w(t)}},list:{mousedown:function(t){t.preventDefault()},click:function(e){!function(t,e){var n=e.resultItem.tag.toUpperCase(),r=Array.from(e.list.querySelectorAll(n)),i=t.target.closest(n);i&&i.nodeName===n&&j(e,t,r.indexOf(i))}(e,t)}}};L(a,(function(e,n){(t.resultsList||"input"===n)&&(u[e][n]||(u[e][n]=a[e][n]))})),L(u,(function(e,n){t[e].addEventListener(n,u[e][n])}))};function E(t){var e=this;return new Promise((function(n,i){var o,s,u;if(o=t.placeHolder,u={role:"combobox","aria-owns":(s=t.resultsList).id,"aria-haspopup":!0,"aria-expanded":!1},a(t.input,r(r({"aria-controls":s.id,"aria-autocomplete":"both"},o&&{placeholder:o}),!t.wrapper&&r({},u))),t.wrapper&&(t.wrapper=a("div",r({around:t.input,class:t.name+"_wrapper"},u))),s&&(t.list=a(s.tag,r({dest:[s.destination,s.position],id:s.id,role:"listbox",hidden:"hidden"},s.class&&{class:s.class}))),T(t),t.data.cache)return d(t).then((function(t){try{return c.call(e)}catch(t){return i(t)}}),i);function c(){return f("init",t),n()}return c.call(e)}))}function P(t){var e=t.prototype;e.init=function(){E(this)},e.start=function(t){k(this,t)},e.unInit=function(){if(this.wrapper){var t=this.wrapper.parentNode;t.insertBefore(this.input,this.wrapper),t.removeChild(this.wrapper)}var e;L((e=this).events,(function(t,n){e[t].removeEventListener(n,e.events[t][n])}))},e.open=function(){g(this)},e.close=function(){w(this)},e.goTo=function(t){O(t,this)},e.next=function(){A(this)},e.previous=function(){S(this)},e.select=function(t){j(this,null,t)},e.search=function(t,e,n){return p(t,e,n)}}return function t(e){this.options=e,this.id=t.instances=(t.instances||0)+1,this.name="autoComplete",this.wrapper=1,this.threshold=1,this.debounce=0,this.resultsList={position:"afterend",tag:"ul",maxResults:5},this.resultItem={tag:"li"},function(t){var e=t.name,n=t.options,r=t.resultsList,i=t.resultItem;for(var s in n)if("object"===o(n[s]))for(var a in t[s]||(t[s]={}),n[s])t[s][a]=n[s][a];else t[s]=n[s];t.selector=t.selector||"#"+e,r.destination=r.destination||t.selector,r.id=r.id||e+"_list_"+t.id,i.id=i.id||e+"_result",t.input=u(t.selector)}(this),P.call(this,t),E(this)}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).autoComplete=e();
|
|
1
|
+
var t,e;t=this,e=function(){"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function e(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function r(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?n(Object(i),!0).forEach((function(n){e(t,n,i[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function i(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||s(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 o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function s(e,n){if(e){if("string"==typeof e)return t(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}var u=function(t){return"string"==typeof t?document.querySelector(t):t()},a=function(t,e){var n="string"==typeof t?document.createElement(t):t;for(var r in e){var i=e[r];if("inside"===r)i.append(n);else if("dest"===r)u(i[0]).insertAdjacentElement(i[1],n);else if("around"===r){var o=i;o.parentNode.insertBefore(n,o),n.append(o),null!=o.getAttribute("autofocus")&&o.focus()}else r in n?n[r]=i:n.setAttribute(r,i)}return n},c=function(t,e){return t=String(t).toLowerCase(),e?t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").normalize("NFC"):t},l=function(t,e){return a("mark",r({innerHTML:t},"string"==typeof e&&{class:e})).outerHTML},f=function(t,e){e.input.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:e.feedback,cancelable:!0}))},p=function(t,e,n){var r=n||{},i=r.mode,o=r.diacritics,s=r.highlight,u=c(e,o);if(e=String(e),t=c(t,o),"loose"===i){var a=(t=t.replace(/ /g,"")).length,f=0,p=Array.from(e).map((function(e,n){return f<a&&u[n]===t[f]&&(e=s?l(e,s):e,f++),e})).join("");if(f===a)return p}else{var d=u.indexOf(t);if(~d)return t=e.substring(d,d+t.length),d=s?e.replace(t,l(t,s)):e}},d=function(t,e){return new Promise((function(n,r){var i;return(i=t.data).cache&&i.store?n():new Promise((function(t,n){return"function"==typeof i.src?Promise.resolve(i.src(e)).then(t,n):t(i.src)})).then((function(e){try{return t.feedback=i.store=e,f("response",t),n()}catch(t){return r(t)}}),r)}))},h=function(t,e){var n=e.data,r=e.searchEngine,i=[];n.store.forEach((function(o,u){var a=function(n){var s=n?o[n]:o,u="function"==typeof r?r(t,s):p(t,s,{mode:r,diacritics:e.diacritics,highlight:e.resultItem.highlight});if(u){var a={match:u,value:o};n&&(a.key=n),i.push(a)}};if(n.keys){var c,l=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=s(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return u=t.done,t},e:function(t){a=!0,o=t},f:function(){try{u||null==n.return||n.return()}finally{if(a)throw o}}}}(n.keys);try{for(l.s();!(c=l.n()).done;)a(c.value)}catch(t){l.e(t)}finally{l.f()}}else a()})),n.filter&&(i=n.filter(i));var o=i.slice(0,e.resultsList.maxResults);e.feedback={query:t,matches:i,results:o},f("results",e)},m="aria-expanded",v="aria-activedescendant",b="aria-selected",y=function(t,e){t.feedback.selection=r({index:e},t.feedback.results[e])},g=function(t){t.isOpen||((t.wrapper||t.input).setAttribute(m,!0),t.list.removeAttribute("hidden"),t.isOpen=!0,f("open",t))},w=function(t){t.isOpen&&((t.wrapper||t.input).setAttribute(m,!1),t.input.setAttribute(v,""),t.list.setAttribute("hidden",""),t.isOpen=!1,f("close",t))},O=function(t,e){var n=e.resultItem,r=e.list.getElementsByTagName(n.tag),o=!!n.selected&&n.selected.split(" ");if(e.isOpen&&r.length){var s,u,a=e.cursor;t>=r.length&&(t=0),t<0&&(t=r.length-1),e.cursor=t,a>-1&&(r[a].removeAttribute(b),o&&(u=r[a].classList).remove.apply(u,i(o))),r[t].setAttribute(b,!0),o&&(s=r[t].classList).add.apply(s,i(o)),e.input.setAttribute(v,r[e.cursor].id),e.list.scrollTop=r[t].offsetTop-e.list.clientHeight+r[t].clientHeight+5,e.feedback.cursor=e.cursor,y(e,t),f("navigate",e)}},A=function(t){O(t.cursor+1,t)},S=function(t){O(t.cursor-1,t)},j=function(t,e,n){(n=n>=0?n:t.cursor)<0||(t.feedback.event=e,y(t,n),f("selection",t),w(t))};function k(t,e){var n=this;return new Promise((function(i,o){var s,u;return s=e||((u=t.input)instanceof HTMLInputElement||u instanceof HTMLTextAreaElement?u.value:u.innerHTML),function(t,e,n){return e?e(t):t.length>=n}(s=t.query?t.query(s):s,t.trigger,t.threshold)?d(t,s).then((function(e){try{return t.feedback instanceof Error?i():(h(s,t),t.resultsList&&function(t){var e=t.resultsList,n=t.list,i=t.resultItem,o=t.feedback,s=o.matches,u=o.results;if(t.cursor=-1,n.innerHTML="",s.length||e.noResults){var c=new DocumentFragment;u.forEach((function(t,e){var n=a(i.tag,r({id:"".concat(i.id,"_").concat(e),role:"option",innerHTML:t.match,inside:c},i.class&&{class:i.class}));i.element&&i.element(n,t)})),n.append(c),e.element&&e.element(n,o),g(t)}else w(t)}(t),c.call(n))}catch(t){return o(t)}}),o):(w(t),c.call(n));function c(){return i()}}))}var L=function(t,e){for(var n in t)for(var r in t[n])e(n,r)},T=function(t){var e,n,i,o=t.events,s=(e=function(){return k(t)},n=t.debounce,function(){clearTimeout(i),i=setTimeout((function(){return e()}),n)}),u=t.events=r({input:r({},o&&o.input)},t.resultsList&&{list:o?r({},o.list):{}}),a={input:{input:function(){s()},keydown:function(e){!function(t,e){switch(t.keyCode){case 40:case 38:t.preventDefault(),40===t.keyCode?A(e):S(e);break;case 13:e.submit||t.preventDefault(),e.cursor>=0&&j(e,t);break;case 9:e.resultsList.tabSelect&&e.cursor>=0&&j(e,t);break;case 27:e.input.value="",f("clear",e),w(e)}}(e,t)},blur:function(){w(t)}},list:{mousedown:function(t){t.preventDefault()},click:function(e){!function(t,e){var n=e.resultItem.tag.toUpperCase(),r=Array.from(e.list.querySelectorAll(n)),i=t.target.closest(n);i&&i.nodeName===n&&j(e,t,r.indexOf(i))}(e,t)}}};L(a,(function(e,n){(t.resultsList||"input"===n)&&(u[e][n]||(u[e][n]=a[e][n]))})),L(u,(function(e,n){t[e].addEventListener(n,u[e][n])}))};function E(t){var e=this;return new Promise((function(n,i){var o,s,u;if(o=t.placeHolder,u={role:"combobox","aria-owns":(s=t.resultsList).id,"aria-haspopup":!0,"aria-expanded":!1},a(t.input,r(r({"aria-controls":s.id,"aria-autocomplete":"both"},o&&{placeholder:o}),!t.wrapper&&r({},u))),t.wrapper&&(t.wrapper=a("div",r({around:t.input,class:t.name+"_wrapper"},u))),s&&(t.list=a(s.tag,r({dest:[s.destination,s.position],id:s.id,role:"listbox",hidden:"hidden"},s.class&&{class:s.class}))),T(t),t.data.cache)return d(t).then((function(t){try{return c.call(e)}catch(t){return i(t)}}),i);function c(){return f("init",t),n()}return c.call(e)}))}function P(t){var e=t.prototype;e.init=function(){E(this)},e.start=function(t){k(this,t)},e.unInit=function(){if(this.wrapper){var t=this.wrapper.parentNode;t.insertBefore(this.input,this.wrapper),t.removeChild(this.wrapper)}var e;L((e=this).events,(function(t,n){e[t].removeEventListener(n,e.events[t][n])}))},e.open=function(){g(this)},e.close=function(){w(this)},e.goTo=function(t){O(t,this)},e.next=function(){A(this)},e.previous=function(){S(this)},e.select=function(t){j(this,null,t)},e.search=function(t,e,n){return p(t,e,n)}}return function t(e){this.options=e,this.id=t.instances=(t.instances||0)+1,this.name="autoComplete",this.wrapper=1,this.threshold=1,this.debounce=0,this.resultsList={position:"afterend",tag:"ul",maxResults:5},this.resultItem={tag:"li"},function(t){var e=t.name,n=t.options,r=t.resultsList,i=t.resultItem;for(var s in n)if("object"===o(n[s]))for(var a in t[s]||(t[s]={}),n[s])t[s][a]=n[s][a];else t[s]=n[s];t.selector=t.selector||"#"+e,r.destination=r.destination||t.selector,r.id=r.id||e+"_list_"+t.id,i.id=i.id||e+"_result",t.input=u(t.selector)}(this),P.call(this,t),E(this)}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).autoComplete=e();
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "10.2.
|
|
2
|
+
"version": "10.2.11",
|
|
3
3
|
"name": "@tarekraafat/autocomplete.js",
|
|
4
4
|
"description": "Simple autocomplete pure vanilla Javascript library. Zero dependencies. Designed for speed, high versatility, and seamless integration.",
|
|
5
5
|
"keywords": [
|
|
@@ -72,12 +72,14 @@
|
|
|
72
72
|
"rollup-plugin-livereload": "^2.0.5",
|
|
73
73
|
"rollup-plugin-nodent": "^0.2.2",
|
|
74
74
|
"rollup-plugin-serve": "^3.0.0",
|
|
75
|
-
"rollup-plugin-sizes": "^1.1.0"
|
|
75
|
+
"rollup-plugin-sizes": "^1.1.0",
|
|
76
|
+
"playwright": "1.62.1"
|
|
76
77
|
},
|
|
77
78
|
"scripts": {
|
|
78
79
|
"dev": "NODE_ENV=development rollup -c -w",
|
|
79
80
|
"build": "NODE_ENV=production rollup -c --bundleConfigAsCjs",
|
|
80
|
-
"docs": "jsdoc -c jsdocs.json"
|
|
81
|
+
"docs": "jsdoc -c jsdocs.json",
|
|
82
|
+
"test": "node --test tests/*.test.cjs"
|
|
81
83
|
},
|
|
82
84
|
"license": "Apache-2.0",
|
|
83
85
|
"contributors": [
|
|
@@ -11,7 +11,7 @@ const getData = async (ctx, query) => {
|
|
|
11
11
|
|
|
12
12
|
if (data.cache && data.store) return;
|
|
13
13
|
|
|
14
|
-
ctx.feedback = data.store = typeof data.src === "function" ? await data.src(query) : data.src;
|
|
14
|
+
ctx.feedback = data.store = typeof data.src === "function" ? await Promise.resolve(data.src(query)) : data.src;
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @emit {response} event on data request
|