Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tarekraafat/autocomplete.js

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tarekraafat/autocomplete.js - npm Package Compare versions

Comparing version 9.0.0 to 9.0.1

10

dist/js/autoComplete.js

@@ -165,3 +165,2 @@ (function (global, factory) {

list.setAttribute("role", "listbox");
list.setAttribute("tabindex", "-1");
if (config.resultsList.container) config.resultsList.container(list);

@@ -191,5 +190,5 @@ var destination = "string" === typeof config.resultsList.destination ? document.querySelector(config.resultsList.destination) : config.resultsList.destination();

var closeList = function closeList(config, element) {
var closeList = function closeList(config) {
var list = document.getElementById(config.resultsList.idName);
if (list && element !== config.inputField) {
if (list) {
list.remove();

@@ -283,3 +282,2 @@ config.inputField.removeAttribute("aria-activedescendant");

break;
case 9:
case 40:

@@ -538,4 +536,4 @@ update(event, list, true);

eventEmitter(this.inputField, dataFeedback, "open");
document.addEventListener("click", function (event) {
return closeList(_this, event.target);
document.addEventListener("focusout", function () {
return closeList(_this);
});

@@ -542,0 +540,0 @@ }

2

dist/js/autoComplete.min.js

@@ -1,1 +0,1 @@

var e,t;e=this,t=function(){"use strict";function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function i(e){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?n(Object(r),!0).forEach((function(n){t(e,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function s(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,s=function(){};return{s:s,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:s}}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,a=!0,l=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw o}}}}var o=function(e,t,n){e.dispatchEvent(new CustomEvent(n,{bubbles:!0,detail:t,cancelable:!0}))},a=function(e,t){var n=document.getElementById(e.resultsList.idName);n&&t!==e.inputField&&(n.remove(),e.inputField.removeAttribute("aria-activedescendant"),e.inputField.setAttribute("aria-expanded",!1),o(e.inputField,null,"close"))},l=function(e,t,n){var r=document.getElementById(e.resultsList.idName);if(r?r.innerHTML="":r=function(e){var t=document.createElement(e.resultsList.element);return t.setAttribute("id",e.resultsList.idName),t.setAttribute("class",e.resultsList.className),t.setAttribute("role","listbox"),t.setAttribute("tabindex","-1"),e.resultsList.container&&e.resultsList.container(t),("string"==typeof e.resultsList.destination?document.querySelector(e.resultsList.destination):e.resultsList.destination()).insertAdjacentElement(e.resultsList.position,t),t}(e),e.inputField.setAttribute("aria-expanded",!0),n.length)for(var s=function(s){var o=t.results[s],a=function(e,t,n){var i=document.createElement(n.resultItem.element);return i.setAttribute("id","".concat(n.resultItem.idName,"_").concat(t)),i.setAttribute("class",n.resultItem.className),i.setAttribute("role","option"),i.innerHTML=e.match,n.resultItem.content&&n.resultItem.content(e,i),i}(o,s,e);a.addEventListener("click",(function(r){var a={event:r,matches:n,input:t.input,query:t.query,results:t.results,selection:i(i({},o),{},{index:s})};e.onSelection&&e.onSelection(a)})),r.appendChild(a)},o=0;o<t.results.length;o++)s(o);else e.resultsList.noResults?e.resultsList.noResults(r,t.query):r.remove()},u="keydown",c=function(e,t){var n=-1,r=function(r,a,l){r.preventDefault(),l?n++:n--,s(a),e.inputField.setAttribute("aria-activedescendant",a[n].id),o(r.srcElement,i(i({event:r},t),{},{selection:t.results[n]}),"navigate")},s=function(t){if(!t)return!1;!function(t){for(var n=0;n<t.length;n++)t[n].removeAttribute("aria-selected"),e.resultItem.selected.className&&t[n].classList.remove(e.resultItem.selected.className)}(t),n>=t.length&&(n=0),n<0&&(n=t.length-1),t[n].setAttribute("aria-selected","true"),e.resultItem.selected.className&&t[n].classList.add(e.resultItem.selected.className)},l=e.resultsList.navigation||function(t){var i=document.getElementById(e.resultsList.idName);if(i)switch(i=i.getElementsByTagName(e.resultItem.element),t.keyCode){case 27:e.inputField.value="",a(e);break;case 9:case 40:r(t,i,!0);break;case 38:r(t,i,!1);break;case 13:t.preventDefault(),n>-1&&(i[n].click(),a(e))}else e.inputField.removeEventListener(u,l)};e.inputField.autoCompleteNavigate&&e.inputField.removeEventListener(u,e.inputField.autoCompleteNavigate),e.inputField.autoCompleteNavigate=l,e.inputField.addEventListener(u,l)},d=function(e,t){for(var n=[],i=function(i){var r=e.data.store[i],o=function(s){var o=(s?r[s]:r).toString();if(o){var a="function"==typeof e.searchEngine?e.searchEngine(t,o):function(e,t,n){var i=n.diacritics?t.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").normalize("NFC"):t.toLowerCase();if("loose"===n.searchEngine){e=e.replace(/ /g,"");for(var r=[],s=0,o=0;o<i.length;o++){var a=t[o];s<e.length&&i[o]===e[s]&&(a=n.resultItem.highlight.render?'<span class="'.concat(n.resultItem.highlight.className,'">').concat(a,"</span>"):a,s++),r.push(a)}if(s===e.length)return r.join("")}else if(i.includes(e)){var l=new RegExp(e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i");return e=l.exec(t),n.resultItem.highlight.render?t.replace(e,'<span class="'.concat(n.resultItem.highlight.className,'">').concat(e,"</span>")):t}}(t,o,e);a&&s?n.push({key:s,index:i,match:a,value:r}):a&&!s&&n.push({index:i,match:a,value:r})}};if(e.data.key){var a,l=s(e.data.key);try{for(l.s();!(a=l.n()).done;)o(a.value)}catch(e){l.e(e)}finally{l.f()}}else o()},r=0;r<e.data.store.length;r++)i(r);return n};return function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=e.selector,i=void 0===n?"#autoComplete":n,r=e.placeHolder,s=e.observer,o=void 0!==s&&s,a=e.data,l=a.src,u=a.key,c=a.cache,d=void 0!==c&&c,h=a.store,f=a.results,m=e.query,p=e.trigger,v=(p=void 0===p?{}:p).event,g=void 0===v?["input"]:v,b=p.condition,y=void 0!==b&&b,L=e.threshold,F=void 0===L?1:L,N=e.debounce,E=void 0===N?0:N,k=e.diacritics,w=void 0!==k&&k,A=e.searchEngine,I=void 0===A?"strict":A,O=e.feedback,C=e.resultsList,j=(C=void 0===C?{}:C).render,x=void 0===j||j,S=C.container,P=void 0!==S&&S,T=C.destination,q=C.position,H=void 0===q?"afterend":q,D=C.element,R=void 0===D?"ul":D,M=C.idName,_=void 0===M?"autoComplete_list":M,z=C.className,B=void 0===z?"autoComplete_list":z,$=C.maxResults,U=void 0===$?5:$,G=C.navigation,J=void 0!==G&&G,K=C.noResults,Q=e.resultItem,V=(Q=void 0===Q?{}:Q).content,W=void 0!==V&&V,X=Q.element,Y=void 0===X?"li":X,Z=Q.idName,ee=Q.className,te=void 0===ee?"autoComplete_result":ee,ne=Q.highlight,ie=(ne=void 0===ne?{}:ne).render,re=void 0!==ie&&ie,se=ne.className,oe=void 0===se?"autoComplete_highlighted":se,ae=Q.selected,le=(ae=void 0===ae?{}:ae).className,ue=void 0===le?"autoComplete_selected":le,ce=e.onSelection;this.selector=i,this.observer=o,this.placeHolder=r,this.data={src:l,key:u,cache:d,store:h,results:f},this.query=m,this.trigger={event:g,condition:y},this.threshold=F,this.debounce=E,this.diacritics=w,this.searchEngine=I,this.feedback=O,this.resultsList={render:x,container:P,destination:T||this.selector,position:H,element:R,idName:_,className:B,maxResults:U,navigation:J,noResults:K},this.resultItem={content:W,element:Y,idName:Z,className:te,highlight:{render:re,className:oe},selected:{className:ue}},this.onSelection=ce,this.inputField="string"==typeof this.selector?document.querySelector(this.selector):this.selector(),this.observer?this.preInit():this.init()}var n,i,r;return n=t,(i=[{key:"start",value:function(e,t){var n=this,i=this.data.results?this.data.results(d(this,t)):d(this,t),r={input:e,query:t,matches:i,results:i.slice(0,this.resultsList.maxResults)};if(o(this.inputField,r,"results"),!this.resultsList.render)return this.feedback(r);l(this,r,i),c(this,r),o(this.inputField,r,"open"),document.addEventListener("click",(function(e){return a(n,e.target)}))}},{key:"dataStore",value:function(){var e=this;return new Promise((function(t,n){return e.data.cache&&e.data.store?t(null):new Promise((function(t,n){return"function"==typeof e.data.src?e.data.src().then(t,n):t(e.data.src)})).then((function(i){try{return e.data.store=i,o(e.inputField,e.data.store,"fetch"),t()}catch(e){return n(e)}}),n)}))}},{key:"compose",value:function(e){var t=this;return new Promise((function(n,i){var r,s,o,l,u;return o=t.inputField,r=o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement?o.value.toLowerCase():o.innerHTML.toLowerCase(),l=r,s=(u=t).query&&u.query.manipulate?u.query.manipulate(l):u.diacritics?l.normalize("NFD").replace(/[\u0300-\u036f]/g,"").normalize("NFC"):l,function(e,t,n){return e.trigger.condition?e.trigger.condition(t,n):n.length>=e.threshold&&n.replace(/ /g,"").length}(t,e,s)?t.dataStore().then((function(e){try{return t.start(r,s),c.call(t)}catch(e){return i(e)}}),i):(a(t),c.call(t));function c(){return n()}}))}},{key:"init",value:function(){var e,t,n,i,r=this;(e=this).inputField.setAttribute("role","combobox"),e.inputField.setAttribute("aria-haspopup",!0),e.inputField.setAttribute("aria-expanded",!1),e.inputField.setAttribute("aria-controls",e.resultsList.idName),e.inputField.setAttribute("aria-autocomplete","both"),this.placeHolder&&this.inputField.setAttribute("placeholder",this.placeHolder),this.hook=(t=function(e){r.compose(e)},n=this.debounce,function(){var e=this,r=arguments;clearTimeout(i),i=setTimeout((function(){return t.apply(e,r)}),n)}),this.trigger.event.forEach((function(e){r.inputField.removeEventListener(e,r.hook),r.inputField.addEventListener(e,r.hook)})),o(this.inputField,null,"init")}},{key:"preInit",value:function(){var e=this;new MutationObserver((function(t,n){var i,r=s(t);try{for(r.s();!(i=r.n()).done;)i.value,e.inputField&&(n.disconnect(),e.init())}catch(e){r.e(e)}finally{r.f()}})).observe(document,{childList:!0,subtree:!0})}},{key:"unInit",value:function(){this.inputField.removeEventListener("input",this.hook),o(this.inputField,null,"unInit")}}])&&e(n.prototype,i),r&&e(n,r),t}()},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).autoComplete=t();
var e,t;e=this,t=function(){"use strict";function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function i(e){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?n(Object(r),!0).forEach((function(n){t(e,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function s(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,s=function(){};return{s:s,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:s}}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,a=!0,l=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw o}}}}var o=function(e,t,n){e.dispatchEvent(new CustomEvent(n,{bubbles:!0,detail:t,cancelable:!0}))},a=function(e){var t=document.getElementById(e.resultsList.idName);t&&(t.remove(),e.inputField.removeAttribute("aria-activedescendant"),e.inputField.setAttribute("aria-expanded",!1),o(e.inputField,null,"close"))},l=function(e,t,n){var r=document.getElementById(e.resultsList.idName);if(r?r.innerHTML="":r=function(e){var t=document.createElement(e.resultsList.element);return t.setAttribute("id",e.resultsList.idName),t.setAttribute("class",e.resultsList.className),t.setAttribute("role","listbox"),e.resultsList.container&&e.resultsList.container(t),("string"==typeof e.resultsList.destination?document.querySelector(e.resultsList.destination):e.resultsList.destination()).insertAdjacentElement(e.resultsList.position,t),t}(e),e.inputField.setAttribute("aria-expanded",!0),n.length)for(var s=function(s){var o=t.results[s],a=function(e,t,n){var i=document.createElement(n.resultItem.element);return i.setAttribute("id","".concat(n.resultItem.idName,"_").concat(t)),i.setAttribute("class",n.resultItem.className),i.setAttribute("role","option"),i.innerHTML=e.match,n.resultItem.content&&n.resultItem.content(e,i),i}(o,s,e);a.addEventListener("click",(function(r){var a={event:r,matches:n,input:t.input,query:t.query,results:t.results,selection:i(i({},o),{},{index:s})};e.onSelection&&e.onSelection(a)})),r.appendChild(a)},o=0;o<t.results.length;o++)s(o);else e.resultsList.noResults?e.resultsList.noResults(r,t.query):r.remove()},u="keydown",c=function(e,t){var n=-1,r=function(r,a,l){r.preventDefault(),l?n++:n--,s(a),e.inputField.setAttribute("aria-activedescendant",a[n].id),o(r.srcElement,i(i({event:r},t),{},{selection:t.results[n]}),"navigate")},s=function(t){if(!t)return!1;!function(t){for(var n=0;n<t.length;n++)t[n].removeAttribute("aria-selected"),e.resultItem.selected.className&&t[n].classList.remove(e.resultItem.selected.className)}(t),n>=t.length&&(n=0),n<0&&(n=t.length-1),t[n].setAttribute("aria-selected","true"),e.resultItem.selected.className&&t[n].classList.add(e.resultItem.selected.className)},l=e.resultsList.navigation||function(t){var i=document.getElementById(e.resultsList.idName);if(i)switch(i=i.getElementsByTagName(e.resultItem.element),t.keyCode){case 27:e.inputField.value="",a(e);break;case 40:r(t,i,!0);break;case 38:r(t,i,!1);break;case 13:t.preventDefault(),n>-1&&(i[n].click(),a(e))}else e.inputField.removeEventListener(u,l)};e.inputField.autoCompleteNavigate&&e.inputField.removeEventListener(u,e.inputField.autoCompleteNavigate),e.inputField.autoCompleteNavigate=l,e.inputField.addEventListener(u,l)},d=function(e,t){for(var n=[],i=function(i){var r=e.data.store[i],o=function(s){var o=(s?r[s]:r).toString();if(o){var a="function"==typeof e.searchEngine?e.searchEngine(t,o):function(e,t,n){var i=n.diacritics?t.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").normalize("NFC"):t.toLowerCase();if("loose"===n.searchEngine){e=e.replace(/ /g,"");for(var r=[],s=0,o=0;o<i.length;o++){var a=t[o];s<e.length&&i[o]===e[s]&&(a=n.resultItem.highlight.render?'<span class="'.concat(n.resultItem.highlight.className,'">').concat(a,"</span>"):a,s++),r.push(a)}if(s===e.length)return r.join("")}else if(i.includes(e)){var l=new RegExp(e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i");return e=l.exec(t),n.resultItem.highlight.render?t.replace(e,'<span class="'.concat(n.resultItem.highlight.className,'">').concat(e,"</span>")):t}}(t,o,e);a&&s?n.push({key:s,index:i,match:a,value:r}):a&&!s&&n.push({index:i,match:a,value:r})}};if(e.data.key){var a,l=s(e.data.key);try{for(l.s();!(a=l.n()).done;)o(a.value)}catch(e){l.e(e)}finally{l.f()}}else o()},r=0;r<e.data.store.length;r++)i(r);return n};return function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=e.selector,i=void 0===n?"#autoComplete":n,r=e.placeHolder,s=e.observer,o=void 0!==s&&s,a=e.data,l=a.src,u=a.key,c=a.cache,d=void 0!==c&&c,h=a.store,f=a.results,m=e.query,v=e.trigger,p=(v=void 0===v?{}:v).event,g=void 0===p?["input"]:p,b=v.condition,y=void 0!==b&&b,L=e.threshold,N=void 0===L?1:L,F=e.debounce,E=void 0===F?0:F,k=e.diacritics,w=void 0!==k&&k,I=e.searchEngine,A=void 0===I?"strict":I,O=e.feedback,C=e.resultsList,j=(C=void 0===C?{}:C).render,x=void 0===j||j,S=C.container,P=void 0!==S&&S,T=C.destination,q=C.position,H=void 0===q?"afterend":q,D=C.element,R=void 0===D?"ul":D,M=C.idName,_=void 0===M?"autoComplete_list":M,z=C.className,B=void 0===z?"autoComplete_list":z,$=C.maxResults,U=void 0===$?5:$,G=C.navigation,J=void 0!==G&&G,K=C.noResults,Q=e.resultItem,V=(Q=void 0===Q?{}:Q).content,W=void 0!==V&&V,X=Q.element,Y=void 0===X?"li":X,Z=Q.idName,ee=Q.className,te=void 0===ee?"autoComplete_result":ee,ne=Q.highlight,ie=(ne=void 0===ne?{}:ne).render,re=void 0!==ie&&ie,se=ne.className,oe=void 0===se?"autoComplete_highlighted":se,ae=Q.selected,le=(ae=void 0===ae?{}:ae).className,ue=void 0===le?"autoComplete_selected":le,ce=e.onSelection;this.selector=i,this.observer=o,this.placeHolder=r,this.data={src:l,key:u,cache:d,store:h,results:f},this.query=m,this.trigger={event:g,condition:y},this.threshold=N,this.debounce=E,this.diacritics=w,this.searchEngine=A,this.feedback=O,this.resultsList={render:x,container:P,destination:T||this.selector,position:H,element:R,idName:_,className:B,maxResults:U,navigation:J,noResults:K},this.resultItem={content:W,element:Y,idName:Z,className:te,highlight:{render:re,className:oe},selected:{className:ue}},this.onSelection=ce,this.inputField="string"==typeof this.selector?document.querySelector(this.selector):this.selector(),this.observer?this.preInit():this.init()}var n,i,r;return n=t,(i=[{key:"start",value:function(e,t){var n=this,i=this.data.results?this.data.results(d(this,t)):d(this,t),r={input:e,query:t,matches:i,results:i.slice(0,this.resultsList.maxResults)};if(o(this.inputField,r,"results"),!this.resultsList.render)return this.feedback(r);l(this,r,i),c(this,r),o(this.inputField,r,"open"),document.addEventListener("focusout",(function(){return a(n)}))}},{key:"dataStore",value:function(){var e=this;return new Promise((function(t,n){return e.data.cache&&e.data.store?t(null):new Promise((function(t,n){return"function"==typeof e.data.src?e.data.src().then(t,n):t(e.data.src)})).then((function(i){try{return e.data.store=i,o(e.inputField,e.data.store,"fetch"),t()}catch(e){return n(e)}}),n)}))}},{key:"compose",value:function(e){var t=this;return new Promise((function(n,i){var r,s,o,l,u;return o=t.inputField,r=o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement?o.value.toLowerCase():o.innerHTML.toLowerCase(),l=r,s=(u=t).query&&u.query.manipulate?u.query.manipulate(l):u.diacritics?l.normalize("NFD").replace(/[\u0300-\u036f]/g,"").normalize("NFC"):l,function(e,t,n){return e.trigger.condition?e.trigger.condition(t,n):n.length>=e.threshold&&n.replace(/ /g,"").length}(t,e,s)?t.dataStore().then((function(e){try{return t.start(r,s),c.call(t)}catch(e){return i(e)}}),i):(a(t),c.call(t));function c(){return n()}}))}},{key:"init",value:function(){var e,t,n,i,r=this;(e=this).inputField.setAttribute("role","combobox"),e.inputField.setAttribute("aria-haspopup",!0),e.inputField.setAttribute("aria-expanded",!1),e.inputField.setAttribute("aria-controls",e.resultsList.idName),e.inputField.setAttribute("aria-autocomplete","both"),this.placeHolder&&this.inputField.setAttribute("placeholder",this.placeHolder),this.hook=(t=function(e){r.compose(e)},n=this.debounce,function(){var e=this,r=arguments;clearTimeout(i),i=setTimeout((function(){return t.apply(e,r)}),n)}),this.trigger.event.forEach((function(e){r.inputField.removeEventListener(e,r.hook),r.inputField.addEventListener(e,r.hook)})),o(this.inputField,null,"init")}},{key:"preInit",value:function(){var e=this;new MutationObserver((function(t,n){var i,r=s(t);try{for(r.s();!(i=r.n()).done;)i.value,e.inputField&&(n.disconnect(),e.init())}catch(e){r.e(e)}finally{r.f()}})).observe(document,{childList:!0,subtree:!0})}},{key:"unInit",value:function(){this.inputField.removeEventListener("input",this.hook),o(this.inputField,null,"unInit")}}])&&e(n.prototype,i),r&&e(n,r),t}()},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).autoComplete=t();
{
"name": "@tarekraafat/autocomplete.js",
"version": "9.0.0",
"version": "9.0.1",
"description": "Simple autocomplete pure vanilla Javascript library.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -24,5 +24,5 @@ # autoComplete.js :sparkles:

> Simple autocomplete pure vanilla Javascript library. <a href="https://tarekraafat.github.io/autoComplete.js/demo/" target="\_blank">:rocket: Live Demo</a> **v9.0**
> Simple autocomplete pure vanilla Javascript library. :rocket: <a href="https://tarekraafat.github.io/autoComplete.js/demo/" target="\_blank">Live Demo</a> **v9.0**
autoComplete.js is a simple pure vanilla Javascript library that's progressively designed for speed, high versatility and seamless integration with a wide range of projects & systems, made for users and developers in mind.
autoComplete.js is a simple pure vanilla Javascript library that's progressively designed for speed, high versatility and seamless integration with a wide range of projects & systems. <sub><sup>(Made for a better developer experience)</sub></pub>

@@ -37,31 +37,25 @@ ## Features

- Versatile
- Hackable & highly customizable
- Hackable & Highly Customizable
- Well Documented
## [![autoComplete.js Code Example](./docs/img/autoComplete.init.png "autoComplete.js Code Example")](https://codepen.io/tarekraafat/pen/rQopdW?editors=0010)
[![autoComplete.js Code Example](./docs/img/autoComplete.init.png "autoComplete.js Code Example")](https://codepen.io/tarekraafat/pen/rQopdW?editors=0010)
## Get Started
## Getting Started
### Clone:
- Clone autoComplete.js to your local machine
```shell
git clone https://github.com/TarekRaafat/autoComplete.js.git
```
### Installation:
- <a href="https://www.jsdelivr.com/package/gh/TarekRaafat/autoComplete.js"><img src="https://www.jsdelivr.com/img/logo@2x.png" alt="jsDelivr" width="100px"></a> CDN
#### CDN
`CSS`
`JS`
```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@9.0.0/dist/css/autoComplete.min.css">
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@9.0.1/dist/js/autoComplete.min.js"></script>
```
`JS`
`CSS`
```html
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@9.0.0/dist/js/autoComplete.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@9.0.1/dist/css/autoComplete.min.css">
```
#### Package Manager

@@ -84,7 +78,7 @@ - <a href="https://www.npmjs.com/package/@tarekraafat/autocomplete.js">npm</a> install `(Node Package Manager)`

- For more details check out **autoComplete.js** <a href="https://tarekraafat.github.io/autoComplete.js/">**docs** :notebook_with_decorative_cover:</a>
- For usage & configuration details check out **autoComplete.js** <a href="https://tarekraafat.github.io/autoComplete.js/">**docs** :notebook_with_decorative_cover:</a>
<!-- * * * -->
## Third-Party Plugins:
## Community Plugins:

@@ -97,14 +91,14 @@ - [Contao autoComplete.js Bundle](https://github.com/heimrichhannot/contao-autocompletejs-bundle) by [@heimrichhannot](https://github.com/heimrichhannot)

For general questions about autoComplete.js, tweet at [@TarekRaafat].
Technical questions and support, please post your question on Stack Overflow using the below tag
For technical questions, you should post a question on [Stack Overflow] and tag
it with [autoComplete.js][so tag].
- Stack Overflow [autoCompletejs][stackOverflow]
<!-- section links -->
[stack overflow]: https://stackoverflow.com/
General questions or new ideas for `autoComplete.js` please start a discussion on Github using the below link
[@tarekraafat]: https://twitter.com/TarekRaafat
- Github [Discussions]
[so tag]: https://stackoverflow.com/questions/tagged/autoComplete.js
<!-- section links -->
[Discussions]: https://github.com/TarekRaafat/autoComplete.js/discussions
[stackoverflow]: https://stackoverflow.com/questions/tagged/autoCompletejs

@@ -118,7 +112,5 @@ * * *

- Email: tarek.m.raafat@gmail.com
- Website: <http://www.tarekraafat.com/>
- Github: <https://github.com/TarekRaafat/>
- Website: [tarekraafat.com](http://www.tarekraafat.com/)
- Github: [github.com/TarekRaafat](https://github.com/TarekRaafat/)
Distributed under the Apache 2.0 license. See `Apache 2.0` for more information.
* * *

@@ -128,2 +120,4 @@

Apache 2.0 © [Tarek Raafat](http://www.tarekraafat.com)
Released under the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0).
© 2021 [Tarek Raafat](http://www.tarekraafat.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc