From 3df522e1dafe2fe640e9fe77e41566d23b8ff900 Mon Sep 17 00:00:00 2001 From: Tarek Raafat Date: Fri, 18 Jun 2021 13:56:55 +0200 Subject: [PATCH] v10.1.5 => Resolves #229, #245 --- README.md | 6 +++--- dist/autoComplete.js | 27 ++++++--------------------- dist/autoComplete.js.gz | Bin 5553 -> 5470 bytes dist/autoComplete.min.js | 2 +- dist/autoComplete.min.js.gz | Bin 3817 -> 3758 bytes docs/demo/index.html | 4 ++-- docs/demo/js/autoComplete.js | 27 ++++++--------------------- docs/demo/js/autoComplete.js.gz | Bin 5553 -> 5470 bytes docs/demo/js/autoComplete.min.js | 2 +- docs/demo/js/autoComplete.min.js.gz | Bin 3817 -> 3758 bytes docs/index.html | 6 +++--- docs/index.md | 3 +-- docs/release-notes.md | 8 ++++++-- package.json | 2 +- src/autoComplete.js | 7 ++----- src/controllers/listController.js | 2 +- src/helpers/eventEmitter.js | 2 +- src/helpers/io.js | 4 ++-- src/services/extend.js | 13 +++++++------ src/services/init.js | 2 +- src/services/preInit.js | 24 ------------------------ src/services/start.js | 2 +- 22 files changed, 45 insertions(+), 98 deletions(-) delete mode 100644 src/services/preInit.js diff --git a/README.md b/README.md index c6d08da..be1eb5b 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ > Simple autocomplete pure vanilla Javascript library. :rocket: Live Demo **v10** -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 a better developer experience) +autoComplete.js is a simple, pure vanilla Javascript library progressively designed for speed, high versatility, and seamless integration with a wide range of projects & systems. (Made for a better developer experience) ## Features @@ -47,13 +47,13 @@ autoComplete.js is a simple pure vanilla Javascript library that's progressively `JS` ```html - + ``` `CSS` ```html - + ``` #### Package Manager diff --git a/dist/autoComplete.js b/dist/autoComplete.js index edde55f..8d151db 100644 --- a/dist/autoComplete.js +++ b/dist/autoComplete.js @@ -186,22 +186,6 @@ ctx.input = typeof ctx.selector === "string" ? document.querySelector(ctx.selector) : ctx.selector(); }); - var preInit = (function (ctx) { - var callback = function callback(mutations, observer) { - mutations.forEach(function (mutation) { - if (ctx.input) { - observer.disconnect(); - ctx.init(); - } - }); - }; - var observer = new MutationObserver(callback); - observer.observe(document, { - childList: true, - subtree: true - }); - }); - var select$1 = function select(element) { return typeof element === "string" ? document.querySelector(element) : element; }; @@ -641,9 +625,6 @@ function extend (autoComplete) { var prototype = autoComplete.prototype; - prototype.preInit = function () { - preInit(this); - }; prototype.init = function () { init(this); }; @@ -651,6 +632,11 @@ start(this); }; prototype.unInit = function () { + if (this.wrapper) { + var parentNode = this.wrapper.parentNode; + parentNode.insertBefore(this.input, this.wrapper); + parentNode.removeChild(this.wrapper); + } removeEvents(this); }; prototype.open = function () { @@ -693,8 +679,7 @@ }; configure(this); extend.call(this, autoComplete); - var run = this.observe ? preInit : init; - run(this); + init(this); } return autoComplete; diff --git a/dist/autoComplete.js.gz b/dist/autoComplete.js.gz index 8add9d61f19a8e7e28a464b9f2ed3b65d6aa819b..b885ba1b1a038afa817fb99b149f7b0b339dd1d1 100644 GIT binary patch literal 5470 zcmV-k6`|@MiwFP!000006U{tpbKFLb-~B7vJl}>ajcLir?&W5pI9^*WyUvOC*4o?$ ztxm-udo+wWqtv9|8FAJFIrx=D_-TiL5~RWf8Z8V#TUG=Od@UhV3Si zDr;GMC0^)`)DAbu<3!9Ib{as)4Lu4yb)?y*09^DETk;TrCK?cHRP=tjF1rzGSm#{7 zh%aA6C#%&=zo*%*Z(cQ4f{mX-WaS6aYATxG5J1Yj`R2L+gZa)T0uQHXLSV%>Ww`w!RkpW0?C z+y3_B?Pl3jok2$EI%;$nN5=$H&?MtD;y;H}Kc%a(>SfEs0UdmV5UuQYZ9PuKYuV*( zxdriB0pa-6QLwO>?h^BSXNW~1rQ2P%PP6T{x{dLDW=PZE8dy_-5ZHd_Ez$)|{&CyN ztau*xSqo$uE>=w|Vw7kJY#%M)=Q{xaKw#Z>X(j8+ehsY$2Z8*XU7Mr&S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v%x2N36WOmJbq-BGf^mJ1~j6EbGQ zuEE@b335)?7&|b{ps1nr68g}{7l^xBeBfrUcir>2O;pi$XtVBi*wkGu_mKnmURlhU zDS7qFB-*dT(be6o`lPWGf&%x8zS0-D-1{*N%O*AFoLyGxKS` zP(j`=RM&Xl&z`+@bUm?hB%JxQnpJH1`&q6d)3Ew2vMZN0; zN_>qdIu!67B9fyYwt-AbN94M;DT41x4Ft(%>oAYD5)Y53u#R>a6D-hriXD#g7{S8M z93@S`IhAuW&qWM>2o}^YpgQh93A8t2SKz%5xA>6< zqtDq{A=|oPcRM>s?DWM1Dguq&p=_5PF=WC!k-wV-F+t3Q$9fkJGX2Ca75=H&C*7H} zIjFfh^#deIm^B4ir@5w~=#n{BlU%fjKAO5S6%|w1Zqf30C6;@xHVGPo%K-LFX4!5Q z?V|l4PG#uK5}b-ZHQ~>9VxV==Z`Aa7im2LRo1?kz(&r6yb(+ zbpRgjrV(%KFYR9|0^nrP4(r4@+h75Lqa)L?HXU;b#Y3~1dLT~;VDLn&6XMUZFyHoL z%?D@>kvp7A%IbRm-DIWc+X#EbOt8%-UhZoti&=6l$=Y)qmANuzd|t>q=0gXD_+7|c zo!k32d%rHb*C#l8M$@&$$*wdD?;vd3-t28IyqNGjbD!o|<3Qd++n~c4=(49YUZMik zp0mj4Br*hbS{1B@zmxb++LZmj*a6+Wc?t7&k2ox!VsIGU3p~8gzT~fKy6HUeUFPfIfDcn4^<4bmP^?SLVVgh^D>em2AT_qCS{k;IGY~=CC zJCgbYzAvt2(CW|!zYx^fyUmR&vI+W5*tA)8{^K_SF{J*tCTaR#VrNZwf>Qthp|jro diff --git a/dist/autoComplete.min.js b/dist/autoComplete.min.js index 1a98b0e..ca6a951 100644 --- a/dist/autoComplete.min.js +++ b/dist/autoComplete.min.js @@ -1 +1 @@ -var t,e;t=this,e=function(){"use strict";function t(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 e(e){for(var n=1;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=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 s,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,s=t},f:function(){try{u||null==n.return||n.return()}finally{if(a)throw s}}}}(n.keys);try{for(f.s();!(l=f.n()).done;)c(l.value)}catch(t){f.e(t)}finally{f.f()}}else c()})),n.filter&&(a=n.filter(a));var c=a.slice(0,s.maxResults);e.feedback={query:t,matches:a,results:c},d("results",e)},b="aria-expanded",y="aria-activedescendant",g="aria-selected",w=function(t,n){t.feedback.selection=e({index:n},t.feedback.results[n])},O=function(t){t.isOpen||((t.wrapper||t.input).setAttribute(b,!0),t.list.removeAttribute("hidden"),t.isOpen=!0,d("open",t))},A=function(t){t.isOpen&&((t.wrapper||t.input).setAttribute(b,!1),t.input.setAttribute(y,""),t.list.setAttribute("hidden",""),t.isOpen=!1,d("close",t))},S=function(t,e){var n=e.list.getElementsByTagName(e.resultItem.tag);if(e.isOpen&&n.length){var r,o,s=e.cursor;t>=n.length&&(t=0),t<0&&(t=n.length-1),e.cursor=t,s>-1&&(n[s].removeAttribute(g),u&&(o=n[s].classList).remove.apply(o,i(u))),n[t].setAttribute(g,!0),u&&(r=n[t].classList).add.apply(r,i(u)),e.input.setAttribute(y,n[e.cursor].id),e.list.scrollTop=n[t].offsetTop-e.list.clientHeight+n[t].clientHeight+5,e.feedback.cursor=e.cursor,w(e,t),d("navigate",e)}},L=function(t){var e=t.cursor+1;S(e,t)},j=function(t){var e=t.cursor-1;S(e,t)},k=function(t,e,n){(n=n>=0?n:t.cursor)<0||(t.feedback.event=e,w(t,n),d("selection",t),A(t))};function E(t){var n=this;return new Promise((function(r,i){var o,s,u,a,c,f,p;return o=t.input,s=t.query,u=t.trigger,a=t.threshold,c=t.resultsList,f=(p=o)instanceof HTMLInputElement||p instanceof HTMLTextAreaElement?p.value:p.innerHTML,function(t,e,n){return e?e(t):t.length>=n}(f=s?s(f):f,u,a)?m(t).then((function(o){try{return t.feedback instanceof Error?r():(v(f,t),c&&function(t){var n=t.resultsList,r=t.list,i=t.resultItem,o=t.feedback;o.query;var s=o.matches,u=o.results;if(t.cursor=-1,r.innerHTML="",s.length||n.noResults){var a=document.createDocumentFragment();u.forEach((function(t,n){var r=l(i.tag,e({id:"".concat(i.id,"_").concat(n),role:"option",innerHTML:t.match,inside:a},i.class&&{class:i.class}));i.element&&i.element(r,t)})),r.append(a),n.element&&n.element(r,o),O(t)}else A(t)}(t),d.call(n))}catch(t){return i(t)}}),i):(A(t),d.call(n));function d(){return r()}}))}var T=function(t,e){for(var n in t)for(var r in t[n])e(r,n)},I=function(t){var n=t.events;t.trigger;var r=t.debounce,i=t.resultsList,o=function(t,e){var n;return function(){clearTimeout(n),n=setTimeout((function(){return t()}),e)}}((function(){return E(t)}),r),s=t.events=e({input:e({},n&&n.input)},i&&{list:n?e({},n.list):{}}),a={input:{input:function(){o()},keydown:function(e){!function(t,e){var n=t.keyCode,r=e.resultItem.selected;switch(r&&(u=r.split(" ")),n){case 40:case 38:t.preventDefault(),40===n?L(e):j(e);break;case 13:t.preventDefault(),e.cursor>=0&&k(e,t);break;case 9:e.resultsList.tabSelect&&e.cursor>=0?(t.preventDefault(),k(e,t)):A(e);break;case 27:t.preventDefault(),e.input.value="",A(e)}}(e,t)},blur:function(){A(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);if(i&&i.nodeName===n){t.preventDefault();var o=r.indexOf(i);k(e,t,o)}}(e,t)}}};T(a,(function(t,e){(i||"list"!==e)&&(s[e][t]||(s[e][t]=a[e][t]))})),T(s,(function(e,n){t[n].addEventListener(e,s[n][e])}))};function x(t){var n=this;return new Promise((function(r,i){var o,s,u,a,c,f;if(o=t.name,s=t.input,u=t.placeHolder,a=t.resultsList,c=t.data,f={role:"combobox","aria-owns":a.id,"aria-haspopup":!0,"aria-expanded":!1},l(s,e(e({"aria-controls":a.id,"aria-autocomplete":"both"},u&&{placeholder:u}),!t.wrapper&&e({},f))),t.wrapper&&(t.wrapper=l("div",e({around:s,class:o+"_wrapper"},f))),a&&(t.list=l(a.tag,e({dest:["string"==typeof a.destination?document.querySelector(a.destination):a.destination(),a.position],id:a.id,role:"listbox",hidden:"hidden"},a.class&&{class:a.class}))),c.cache)return m(t).then((function(t){try{return p.call(n)}catch(t){return i(t)}}),i);function p(){return I(t),d("init",t),r()}return p.call(n)}))}function P(t){var e=t.prototype;e.preInit=function(){a(this)},e.init=function(){x(this)},e.start=function(){E(this)},e.unInit=function(){var t;T((t=this).events,(function(e,n){t[n].removeEventListener(e,t.events[n][e])}))},e.open=function(){O(this)},e.close=function(){A(this)},e.goTo=function(t){S(t,this)},e.next=function(){L(this)},e.previous=function(){j(this)},e.select=function(t){k(this,null,t)},t.search=e.search=function(t,e,n){h(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.id,r=t.name,i=t.options,o=t.resultsList,s=t.resultItem;for(var u in i)if("object"===n(i[u]))for(var a in t[u]||(t[u]={}),i[u])t[u][a]=i[u][a];else t[u]=i[u];t.selector=t.selector||"#"+r,o.destination=o.destination||t.selector,o.id=o.id||r+"_list_"+e,s.id=s.id||r+"_result",t.input="string"==typeof t.selector?document.querySelector(t.selector):t.selector()}(this),P.call(this,t),(this.observe?a:x)(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(); +var e,t;e=this,t=function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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 s,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw s}}}}(n.keys);try{for(f.s();!(l=f.n()).done;)c(l.value)}catch(e){f.e(e)}finally{f.f()}}else c()})),n.filter&&(u=n.filter(u));var c=u.slice(0,s.maxResults);t.feedback={query:e,matches:u,results:c},p("results",t)},v="aria-expanded",y="aria-activedescendant",b="aria-selected",g=function(e,n){e.feedback.selection=t({index:n},e.feedback.results[n])},w=function(e){e.isOpen||((e.wrapper||e.input).setAttribute(v,!0),e.list.removeAttribute("hidden"),e.isOpen=!0,p("open",e))},O=function(e){e.isOpen&&((e.wrapper||e.input).setAttribute(v,!1),e.input.setAttribute(y,""),e.list.setAttribute("hidden",""),e.isOpen=!1,p("close",e))},A=function(e,t){var n=t.list.getElementsByTagName(t.resultItem.tag);if(t.isOpen&&n.length){var r,o,s=t.cursor;e>=n.length&&(e=0),e<0&&(e=n.length-1),t.cursor=e,s>-1&&(n[s].removeAttribute(b),a&&(o=n[s].classList).remove.apply(o,i(a))),n[e].setAttribute(b,!0),a&&(r=n[e].classList).add.apply(r,i(a)),t.input.setAttribute(y,n[t.cursor].id),t.list.scrollTop=n[e].offsetTop-t.list.clientHeight+n[e].clientHeight+5,t.feedback.cursor=t.cursor,g(t,e),p("navigate",t)}},S=function(e){var t=e.cursor+1;A(t,e)},j=function(e){var t=e.cursor-1;A(t,e)},k=function(e,t,n){(n=n>=0?n:e.cursor)<0||(e.feedback.event=t,g(e,n),p("selection",e),O(e))};function L(e){var n=this;return new Promise((function(r,i){var o,s,a,u,l,f,p;return o=e.input,s=e.query,a=e.trigger,u=e.threshold,l=e.resultsList,f=(p=o)instanceof HTMLInputElement||p instanceof HTMLTextAreaElement?p.value:p.innerHTML,function(e,t,n){return t?t(e):e.length>=n}(f=s?s(f):f,a,u)?h(e).then((function(o){try{return e.feedback instanceof Error?r():(m(f,e),l&&function(e){var n=e.resultsList,r=e.list,i=e.resultItem,o=e.feedback;o.query;var s=o.matches,a=o.results;if(e.cursor=-1,r.innerHTML="",s.length||n.noResults){var u=document.createDocumentFragment();a.forEach((function(e,n){var r=c(i.tag,t({id:"".concat(i.id,"_").concat(n),role:"option",innerHTML:e.match,inside:u},i.class&&{class:i.class}));i.element&&i.element(r,e)})),r.append(u),n.element&&n.element(r,o),w(e)}else O(e)}(e),d.call(n))}catch(e){return i(e)}}),i):(O(e),d.call(n));function d(){return r()}}))}var T=function(e,t){for(var n in e)for(var r in e[n])t(r,n)},E=function(e){var n=e.events;e.trigger;var r=e.debounce,i=e.resultsList,o=function(e,t){var n;return function(){clearTimeout(n),n=setTimeout((function(){return e()}),t)}}((function(){return L(e)}),r),s=e.events=t({input:t({},n&&n.input)},i&&{list:n?t({},n.list):{}}),u={input:{input:function(){o()},keydown:function(t){!function(e,t){var n=e.keyCode,r=t.resultItem.selected;switch(r&&(a=r.split(" ")),n){case 40:case 38:e.preventDefault(),40===n?S(t):j(t);break;case 13:e.preventDefault(),t.cursor>=0&&k(t,e);break;case 9:t.resultsList.tabSelect&&t.cursor>=0?(e.preventDefault(),k(t,e)):O(t);break;case 27:e.preventDefault(),t.input.value="",O(t)}}(t,e)},blur:function(){O(e)}},list:{mousedown:function(e){e.preventDefault()},click:function(t){!function(e,t){var n=t.resultItem.tag.toUpperCase(),r=Array.from(t.list.querySelectorAll(n)),i=e.target.closest(n);if(i&&i.nodeName===n){e.preventDefault();var o=r.indexOf(i);k(t,e,o)}}(t,e)}}};T(u,(function(e,t){(i||"list"!==t)&&(s[t][e]||(s[t][e]=u[t][e]))})),T(s,(function(t,n){e[n].addEventListener(t,s[n][t])}))};function x(e){var n=this;return new Promise((function(r,i){var o,s,a,u,l,f;if(o=e.name,s=e.input,a=e.placeHolder,u=e.resultsList,l=e.data,f={role:"combobox","aria-owns":u.id,"aria-haspopup":!0,"aria-expanded":!1},c(s,t(t({"aria-controls":u.id,"aria-autocomplete":"both"},a&&{placeholder:a}),!e.wrapper&&t({},f))),e.wrapper&&(e.wrapper=c("div",t({around:s,class:o+"_wrapper"},f))),u&&(e.list=c(u.tag,t({dest:["string"==typeof u.destination?document.querySelector(u.destination):u.destination(),u.position],id:u.id,role:"listbox",hidden:"hidden"},u.class&&{class:u.class}))),l.cache)return h(e).then((function(e){try{return d.call(n)}catch(e){return i(e)}}),i);function d(){return E(e),p("init",e),r()}return d.call(n)}))}function I(e){var t=e.prototype;t.init=function(){x(this)},t.start=function(){L(this)},t.unInit=function(){if(this.wrapper){var e=this.wrapper.parentNode;e.insertBefore(this.input,this.wrapper),e.removeChild(this.wrapper)}var t;T((t=this).events,(function(e,n){t[n].removeEventListener(e,t.events[n][e])}))},t.open=function(){w(this)},t.close=function(){O(this)},t.goTo=function(e){A(e,this)},t.next=function(){S(this)},t.previous=function(){j(this)},t.select=function(e){k(this,null,e)},e.search=t.search=function(e,t,n){d(e,t,n)}}return function e(t){this.options=t,this.id=e.instances=(e.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(e){var t=e.id,r=e.name,i=e.options,o=e.resultsList,s=e.resultItem;for(var a in i)if("object"===n(i[a]))for(var u in e[a]||(e[a]={}),i[a])e[a][u]=i[a][u];else e[a]=i[a];e.selector=e.selector||"#"+r,o.destination=o.destination||e.selector,o.id=o.id||r+"_list_"+t,s.id=s.id||r+"_result",e.input="string"==typeof e.selector?document.querySelector(e.selector):e.selector()}(this),I.call(this,e),x(this)}},"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(); diff --git a/dist/autoComplete.min.js.gz b/dist/autoComplete.min.js.gz index 72934e90f773a6596e89b91e7be35470ee2b8c91..278cd34d8b7c8ceb587809f5b45956fa07479e61 100644 GIT binary patch literal 3758 zcmV;f4pH$RiwFP!000006TMk&liN6Q{+?fnHeanuU`zQGyT2)+| z=a0{ajVfz5OQ+u&L(7=!>rkgU-ip$29frM3*jIDYXgRyM#814=wWy5JR>qji=D>Bf zDR~=35tDJ%)cZKAs`5FMOh>I>Ot$^$4DGSS0`7db3;8McQB_o->BG9D`o~@9-rG3G8M2F}UYz76pquS(i<0 z3I6!Ut~FS9dpQ}lS{?dL)pYCVX!cq?%_M)CJz&pwTEm=z_Y(RM#Vj+1A1X65YF1a8 zXT?k^`O0nttw71O$z;yszsdJl)J&O_(;PTxtIWEZ%VOIAMM0A&&m>O#dRri9{$K) z-9`(yLf|H0=~SK>Du7a^la^R!2OhEDFIi(KJ6rOoa5?jK(2i?AhGY)V$mwL> za1WmmWHxF4wiv*6&U8u_?@Sabldp{hTMa0MP06)a$V|61BV$ea($8OB#IjJiJ!t&* zhU@2#yyUr!5pbcF<)bx*!1k?Ga#)_>?@CT@c9s4RnjGD9(ZQ_rnqp!A!xRN4HS0)F z0OGQM`WC!Igrxxm^y#{rP^{+bD8>|^!(H(y%dtzhnONPf*?3~675vmqwY#bmD?|$w zSDD6)UsS>UT7Tk@k|Xdb3WZ(>dbTdB2+i*dPQ7Ui$HI+KTb#HKaA7L8kFbBcu|1_+ zN*pg0iHz&A_}%Jn&HRV?{1yHDVY~ir#{zUu#=i~h)o#ao4``f+!6DP117^abkdo`4AO7-z z#=p39xZ5!=v${?sqFJnPK0CN&)!DHOlw38y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rk&y;L$9;G~A-I)w4`xz6Lk!|^yxZf^ZB0;Al0k$K(u zy6@;5HjL|YjP6B8hw`a^9za%p=)5S4_}U5swun{vCX1RXVyE&;_WO1?nPO3XaN{aT z7;qt>BZurTlwwafwIlRH)T~E*zyFBV5DSzEecsZi53{jcGzb&jAnvJRL$QQ@@&oxD z4WXw6U*^*P`fp`!2)&uvaNCsS_f5p9e~)fJiicQ}kDjPX(hbKrTpj&$JQ_eE0ne|| z4I&1;ulx7@a8Xx7x$sr7U-F9|DfvgW`Y{q> diff --git a/docs/demo/index.html b/docs/demo/index.html index f0efe86..d5d5f7b 100644 --- a/docs/demo/index.html +++ b/docs/demo/index.html @@ -72,7 +72,7 @@ + href="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.1.5/dist/css/autoComplete.min.css"> @@ -150,7 +150,7 @@

mode

- + diff --git a/docs/demo/js/autoComplete.js b/docs/demo/js/autoComplete.js index edde55f..8d151db 100644 --- a/docs/demo/js/autoComplete.js +++ b/docs/demo/js/autoComplete.js @@ -186,22 +186,6 @@ ctx.input = typeof ctx.selector === "string" ? document.querySelector(ctx.selector) : ctx.selector(); }); - var preInit = (function (ctx) { - var callback = function callback(mutations, observer) { - mutations.forEach(function (mutation) { - if (ctx.input) { - observer.disconnect(); - ctx.init(); - } - }); - }; - var observer = new MutationObserver(callback); - observer.observe(document, { - childList: true, - subtree: true - }); - }); - var select$1 = function select(element) { return typeof element === "string" ? document.querySelector(element) : element; }; @@ -641,9 +625,6 @@ function extend (autoComplete) { var prototype = autoComplete.prototype; - prototype.preInit = function () { - preInit(this); - }; prototype.init = function () { init(this); }; @@ -651,6 +632,11 @@ start(this); }; prototype.unInit = function () { + if (this.wrapper) { + var parentNode = this.wrapper.parentNode; + parentNode.insertBefore(this.input, this.wrapper); + parentNode.removeChild(this.wrapper); + } removeEvents(this); }; prototype.open = function () { @@ -693,8 +679,7 @@ }; configure(this); extend.call(this, autoComplete); - var run = this.observe ? preInit : init; - run(this); + init(this); } return autoComplete; diff --git a/docs/demo/js/autoComplete.js.gz b/docs/demo/js/autoComplete.js.gz index 8add9d61f19a8e7e28a464b9f2ed3b65d6aa819b..b885ba1b1a038afa817fb99b149f7b0b339dd1d1 100644 GIT binary patch literal 5470 zcmV-k6`|@MiwFP!000006U{tpbKFLb-~B7vJl}>ajcLir?&W5pI9^*WyUvOC*4o?$ ztxm-udo+wWqtv9|8FAJFIrx=D_-TiL5~RWf8Z8V#TUG=Od@UhV3Si zDr;GMC0^)`)DAbu<3!9Ib{as)4Lu4yb)?y*09^DETk;TrCK?cHRP=tjF1rzGSm#{7 zh%aA6C#%&=zo*%*Z(cQ4f{mX-WaS6aYATxG5J1Yj`R2L+gZa)T0uQHXLSV%>Ww`w!RkpW0?C z+y3_B?Pl3jok2$EI%;$nN5=$H&?MtD;y;H}Kc%a(>SfEs0UdmV5UuQYZ9PuKYuV*( zxdriB0pa-6QLwO>?h^BSXNW~1rQ2P%PP6T{x{dLDW=PZE8dy_-5ZHd_Ez$)|{&CyN ztau*xSqo$uE>=w|Vw7kJY#%M)=Q{xaKw#Z>X(j8+ehsY$2Z8*XU7Mr&SlF}j928R2 zyQ%_3^qS}5^PRT@rTACzoXgSZ5s5J-?8!{@?M@~s(0G#NYqku)sJ{#sWCTX?n#mbT zWTuHdgXi;PRN_Kbpy87m=+?30vuapx=2CWc?)z{VHbXk@6U&1HGDch=miu&;rc=Pl zxZFlmkY*TBLULbd2!_z;hh?^u)w8v%VCqgh)h;e#9zi=jvS;N#BZD$x?wR`25{xwi z(g~0(C314nG@#S7f@Ab>E(j1hEw9?%{3UugMra+-JHiiurFm0>v)$!}5e-be%IRx% zw{6omh!G6Va0|vZO}w{Kd__jqE6^N((rR;+RbZ5wLtGjCMk%FEqo-*sE|uH7)7j4mC}qC5huotk@0L|TNQCd2kwce@SF^s;TU z+c;}m!@3b}h8_P^_UmTXzildT3knD};|rywF!r=zqp@QLShpBQ$l~1;Ox@I`j~seD zws;e>yERi-)3S5e6QA_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-ZHQ~>9VxV==Z`Aa7im2LRo1?kz(&r6yb(+ zbpRgjrV(%KFYR9|0^nrP4(r4@+h75Lqa)L?HXU;b#Y3~1dLT~;VDLn&6XMUZFyHoL z%?D@>kvp7A%IbRm-DIWc+X#EbOt8%-UhZoti&=6l$=Y)qmANuzd|t>q=0gXD_+7|c zo!k32d%rHb*C#l8M$@&$$*wdD?;vd3-t28IyqNGjbD!o|<3Qd++n~c4=(49YUZMik zp0mj4Br*hbS{1B@zmxb++LZmj*a6+Wc?t7&k2ox!VsIGU3p~8gzT~fKy6HUeUFPfIfDcn4^<4bmP^?SLVVgh^D>em2AT_qCS{k;IGY~=CC zJCgbYzAvt2(CW|!zYx^fyUmR&vI+W5*tA)8{^K_SF{J*tCTaR#VrNZwf>Qthp|jro diff --git a/docs/demo/js/autoComplete.min.js b/docs/demo/js/autoComplete.min.js index 1a98b0e..ca6a951 100644 --- a/docs/demo/js/autoComplete.min.js +++ b/docs/demo/js/autoComplete.min.js @@ -1 +1 @@ -var t,e;t=this,e=function(){"use strict";function t(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 e(e){for(var n=1;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=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 s,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,s=t},f:function(){try{u||null==n.return||n.return()}finally{if(a)throw s}}}}(n.keys);try{for(f.s();!(l=f.n()).done;)c(l.value)}catch(t){f.e(t)}finally{f.f()}}else c()})),n.filter&&(a=n.filter(a));var c=a.slice(0,s.maxResults);e.feedback={query:t,matches:a,results:c},d("results",e)},b="aria-expanded",y="aria-activedescendant",g="aria-selected",w=function(t,n){t.feedback.selection=e({index:n},t.feedback.results[n])},O=function(t){t.isOpen||((t.wrapper||t.input).setAttribute(b,!0),t.list.removeAttribute("hidden"),t.isOpen=!0,d("open",t))},A=function(t){t.isOpen&&((t.wrapper||t.input).setAttribute(b,!1),t.input.setAttribute(y,""),t.list.setAttribute("hidden",""),t.isOpen=!1,d("close",t))},S=function(t,e){var n=e.list.getElementsByTagName(e.resultItem.tag);if(e.isOpen&&n.length){var r,o,s=e.cursor;t>=n.length&&(t=0),t<0&&(t=n.length-1),e.cursor=t,s>-1&&(n[s].removeAttribute(g),u&&(o=n[s].classList).remove.apply(o,i(u))),n[t].setAttribute(g,!0),u&&(r=n[t].classList).add.apply(r,i(u)),e.input.setAttribute(y,n[e.cursor].id),e.list.scrollTop=n[t].offsetTop-e.list.clientHeight+n[t].clientHeight+5,e.feedback.cursor=e.cursor,w(e,t),d("navigate",e)}},L=function(t){var e=t.cursor+1;S(e,t)},j=function(t){var e=t.cursor-1;S(e,t)},k=function(t,e,n){(n=n>=0?n:t.cursor)<0||(t.feedback.event=e,w(t,n),d("selection",t),A(t))};function E(t){var n=this;return new Promise((function(r,i){var o,s,u,a,c,f,p;return o=t.input,s=t.query,u=t.trigger,a=t.threshold,c=t.resultsList,f=(p=o)instanceof HTMLInputElement||p instanceof HTMLTextAreaElement?p.value:p.innerHTML,function(t,e,n){return e?e(t):t.length>=n}(f=s?s(f):f,u,a)?m(t).then((function(o){try{return t.feedback instanceof Error?r():(v(f,t),c&&function(t){var n=t.resultsList,r=t.list,i=t.resultItem,o=t.feedback;o.query;var s=o.matches,u=o.results;if(t.cursor=-1,r.innerHTML="",s.length||n.noResults){var a=document.createDocumentFragment();u.forEach((function(t,n){var r=l(i.tag,e({id:"".concat(i.id,"_").concat(n),role:"option",innerHTML:t.match,inside:a},i.class&&{class:i.class}));i.element&&i.element(r,t)})),r.append(a),n.element&&n.element(r,o),O(t)}else A(t)}(t),d.call(n))}catch(t){return i(t)}}),i):(A(t),d.call(n));function d(){return r()}}))}var T=function(t,e){for(var n in t)for(var r in t[n])e(r,n)},I=function(t){var n=t.events;t.trigger;var r=t.debounce,i=t.resultsList,o=function(t,e){var n;return function(){clearTimeout(n),n=setTimeout((function(){return t()}),e)}}((function(){return E(t)}),r),s=t.events=e({input:e({},n&&n.input)},i&&{list:n?e({},n.list):{}}),a={input:{input:function(){o()},keydown:function(e){!function(t,e){var n=t.keyCode,r=e.resultItem.selected;switch(r&&(u=r.split(" ")),n){case 40:case 38:t.preventDefault(),40===n?L(e):j(e);break;case 13:t.preventDefault(),e.cursor>=0&&k(e,t);break;case 9:e.resultsList.tabSelect&&e.cursor>=0?(t.preventDefault(),k(e,t)):A(e);break;case 27:t.preventDefault(),e.input.value="",A(e)}}(e,t)},blur:function(){A(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);if(i&&i.nodeName===n){t.preventDefault();var o=r.indexOf(i);k(e,t,o)}}(e,t)}}};T(a,(function(t,e){(i||"list"!==e)&&(s[e][t]||(s[e][t]=a[e][t]))})),T(s,(function(e,n){t[n].addEventListener(e,s[n][e])}))};function x(t){var n=this;return new Promise((function(r,i){var o,s,u,a,c,f;if(o=t.name,s=t.input,u=t.placeHolder,a=t.resultsList,c=t.data,f={role:"combobox","aria-owns":a.id,"aria-haspopup":!0,"aria-expanded":!1},l(s,e(e({"aria-controls":a.id,"aria-autocomplete":"both"},u&&{placeholder:u}),!t.wrapper&&e({},f))),t.wrapper&&(t.wrapper=l("div",e({around:s,class:o+"_wrapper"},f))),a&&(t.list=l(a.tag,e({dest:["string"==typeof a.destination?document.querySelector(a.destination):a.destination(),a.position],id:a.id,role:"listbox",hidden:"hidden"},a.class&&{class:a.class}))),c.cache)return m(t).then((function(t){try{return p.call(n)}catch(t){return i(t)}}),i);function p(){return I(t),d("init",t),r()}return p.call(n)}))}function P(t){var e=t.prototype;e.preInit=function(){a(this)},e.init=function(){x(this)},e.start=function(){E(this)},e.unInit=function(){var t;T((t=this).events,(function(e,n){t[n].removeEventListener(e,t.events[n][e])}))},e.open=function(){O(this)},e.close=function(){A(this)},e.goTo=function(t){S(t,this)},e.next=function(){L(this)},e.previous=function(){j(this)},e.select=function(t){k(this,null,t)},t.search=e.search=function(t,e,n){h(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.id,r=t.name,i=t.options,o=t.resultsList,s=t.resultItem;for(var u in i)if("object"===n(i[u]))for(var a in t[u]||(t[u]={}),i[u])t[u][a]=i[u][a];else t[u]=i[u];t.selector=t.selector||"#"+r,o.destination=o.destination||t.selector,o.id=o.id||r+"_list_"+e,s.id=s.id||r+"_result",t.input="string"==typeof t.selector?document.querySelector(t.selector):t.selector()}(this),P.call(this,t),(this.observe?a:x)(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(); +var e,t;e=this,t=function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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 s,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw s}}}}(n.keys);try{for(f.s();!(l=f.n()).done;)c(l.value)}catch(e){f.e(e)}finally{f.f()}}else c()})),n.filter&&(u=n.filter(u));var c=u.slice(0,s.maxResults);t.feedback={query:e,matches:u,results:c},p("results",t)},v="aria-expanded",y="aria-activedescendant",b="aria-selected",g=function(e,n){e.feedback.selection=t({index:n},e.feedback.results[n])},w=function(e){e.isOpen||((e.wrapper||e.input).setAttribute(v,!0),e.list.removeAttribute("hidden"),e.isOpen=!0,p("open",e))},O=function(e){e.isOpen&&((e.wrapper||e.input).setAttribute(v,!1),e.input.setAttribute(y,""),e.list.setAttribute("hidden",""),e.isOpen=!1,p("close",e))},A=function(e,t){var n=t.list.getElementsByTagName(t.resultItem.tag);if(t.isOpen&&n.length){var r,o,s=t.cursor;e>=n.length&&(e=0),e<0&&(e=n.length-1),t.cursor=e,s>-1&&(n[s].removeAttribute(b),a&&(o=n[s].classList).remove.apply(o,i(a))),n[e].setAttribute(b,!0),a&&(r=n[e].classList).add.apply(r,i(a)),t.input.setAttribute(y,n[t.cursor].id),t.list.scrollTop=n[e].offsetTop-t.list.clientHeight+n[e].clientHeight+5,t.feedback.cursor=t.cursor,g(t,e),p("navigate",t)}},S=function(e){var t=e.cursor+1;A(t,e)},j=function(e){var t=e.cursor-1;A(t,e)},k=function(e,t,n){(n=n>=0?n:e.cursor)<0||(e.feedback.event=t,g(e,n),p("selection",e),O(e))};function L(e){var n=this;return new Promise((function(r,i){var o,s,a,u,l,f,p;return o=e.input,s=e.query,a=e.trigger,u=e.threshold,l=e.resultsList,f=(p=o)instanceof HTMLInputElement||p instanceof HTMLTextAreaElement?p.value:p.innerHTML,function(e,t,n){return t?t(e):e.length>=n}(f=s?s(f):f,a,u)?h(e).then((function(o){try{return e.feedback instanceof Error?r():(m(f,e),l&&function(e){var n=e.resultsList,r=e.list,i=e.resultItem,o=e.feedback;o.query;var s=o.matches,a=o.results;if(e.cursor=-1,r.innerHTML="",s.length||n.noResults){var u=document.createDocumentFragment();a.forEach((function(e,n){var r=c(i.tag,t({id:"".concat(i.id,"_").concat(n),role:"option",innerHTML:e.match,inside:u},i.class&&{class:i.class}));i.element&&i.element(r,e)})),r.append(u),n.element&&n.element(r,o),w(e)}else O(e)}(e),d.call(n))}catch(e){return i(e)}}),i):(O(e),d.call(n));function d(){return r()}}))}var T=function(e,t){for(var n in e)for(var r in e[n])t(r,n)},E=function(e){var n=e.events;e.trigger;var r=e.debounce,i=e.resultsList,o=function(e,t){var n;return function(){clearTimeout(n),n=setTimeout((function(){return e()}),t)}}((function(){return L(e)}),r),s=e.events=t({input:t({},n&&n.input)},i&&{list:n?t({},n.list):{}}),u={input:{input:function(){o()},keydown:function(t){!function(e,t){var n=e.keyCode,r=t.resultItem.selected;switch(r&&(a=r.split(" ")),n){case 40:case 38:e.preventDefault(),40===n?S(t):j(t);break;case 13:e.preventDefault(),t.cursor>=0&&k(t,e);break;case 9:t.resultsList.tabSelect&&t.cursor>=0?(e.preventDefault(),k(t,e)):O(t);break;case 27:e.preventDefault(),t.input.value="",O(t)}}(t,e)},blur:function(){O(e)}},list:{mousedown:function(e){e.preventDefault()},click:function(t){!function(e,t){var n=t.resultItem.tag.toUpperCase(),r=Array.from(t.list.querySelectorAll(n)),i=e.target.closest(n);if(i&&i.nodeName===n){e.preventDefault();var o=r.indexOf(i);k(t,e,o)}}(t,e)}}};T(u,(function(e,t){(i||"list"!==t)&&(s[t][e]||(s[t][e]=u[t][e]))})),T(s,(function(t,n){e[n].addEventListener(t,s[n][t])}))};function x(e){var n=this;return new Promise((function(r,i){var o,s,a,u,l,f;if(o=e.name,s=e.input,a=e.placeHolder,u=e.resultsList,l=e.data,f={role:"combobox","aria-owns":u.id,"aria-haspopup":!0,"aria-expanded":!1},c(s,t(t({"aria-controls":u.id,"aria-autocomplete":"both"},a&&{placeholder:a}),!e.wrapper&&t({},f))),e.wrapper&&(e.wrapper=c("div",t({around:s,class:o+"_wrapper"},f))),u&&(e.list=c(u.tag,t({dest:["string"==typeof u.destination?document.querySelector(u.destination):u.destination(),u.position],id:u.id,role:"listbox",hidden:"hidden"},u.class&&{class:u.class}))),l.cache)return h(e).then((function(e){try{return d.call(n)}catch(e){return i(e)}}),i);function d(){return E(e),p("init",e),r()}return d.call(n)}))}function I(e){var t=e.prototype;t.init=function(){x(this)},t.start=function(){L(this)},t.unInit=function(){if(this.wrapper){var e=this.wrapper.parentNode;e.insertBefore(this.input,this.wrapper),e.removeChild(this.wrapper)}var t;T((t=this).events,(function(e,n){t[n].removeEventListener(e,t.events[n][e])}))},t.open=function(){w(this)},t.close=function(){O(this)},t.goTo=function(e){A(e,this)},t.next=function(){S(this)},t.previous=function(){j(this)},t.select=function(e){k(this,null,e)},e.search=t.search=function(e,t,n){d(e,t,n)}}return function e(t){this.options=t,this.id=e.instances=(e.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(e){var t=e.id,r=e.name,i=e.options,o=e.resultsList,s=e.resultItem;for(var a in i)if("object"===n(i[a]))for(var u in e[a]||(e[a]={}),i[a])e[a][u]=i[a][u];else e[a]=i[a];e.selector=e.selector||"#"+r,o.destination=o.destination||e.selector,o.id=o.id||r+"_list_"+t,s.id=s.id||r+"_result",e.input="string"==typeof e.selector?document.querySelector(e.selector):e.selector()}(this),I.call(this,e),x(this)}},"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(); diff --git a/docs/demo/js/autoComplete.min.js.gz b/docs/demo/js/autoComplete.min.js.gz index 72934e90f773a6596e89b91e7be35470ee2b8c91..278cd34d8b7c8ceb587809f5b45956fa07479e61 100644 GIT binary patch literal 3758 zcmV;f4pH$RiwFP!000006TMk&liN6Q{+?fnHeanuU`zQGyT2)+| z=a0{ajVfz5OQ+u&L(7=!>rkgU-ip$29frM3*jIDYXgRyM#814=wWy5JR>qji=D>Bf zDR~=35tDJ%)cZKAs`5FMOh>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XYr*!wc9Z98_cg zX>Xf@6x5%J`Eo(Vk>Gh`=+n^fj9@yGsqlAyecd-4F)3Vdr$G& z1?am_FJz@>CdB2>dADjS$lc9nM2XI4K-x_csOO>WY9Ur8HBlZb*Dbi`pX zznf<6_q*>isgAf!_avf2BXv$JYNERV;C#6sel3#v=k z3$X;{K;#asocmu_J7D*5&Ccp9ga*WkTmg-)UH~mA(Z_pCbtQ)r{CxiZ26fU3#T_d0 zJE!$=ouav`8vTd}9wPb>UW!oXK`=jfbT2fr#FhRGBJ9!%m_;3B+(iTTV$18j-Z%S* zN`Yr-3Nm6C6_f$i8y|cp!iUAu<3*@Si=FnB02RxkmA2ccC1QDS(r%r!Sp)RA>ghf_ zhOlK#)O7Ijln)@5MWuXj^-*76&T8i4kG_e14Wpv41b0*EmNAcaF^~${+2UD2m8aB! z43RG2OLh6tpd=eT#;$~-Ye^4FhEVIY;dM?zIFSIULXWzxWuY|~xN$yYK;BD;5Gkx)JoRmW3vqh7^N3dUpJh}g-g@hPR`WCAUOE5ep zlLxv8_eo{g_4(8Vs%A!gZ%%!UI$zTjB;eYy|KAsq5W_AysZV~+{j>{v19!zvl%Njx zd4CeZAyhub*sgD*@AZffd;rk&y;L$9;G~A-I)w4`xz6Lk!|^yxZf^ZB0;Al0k$K(u zy6@;5HjL|YjP6B8hw`a^9za%p=)5S4_}U5swun{vCX1RXVyE&;_WO1?nPO3XaN{aT z7;qt>BZurTlwwafwIlRH)T~E*zyFBV5DSzEecsZi53{jcGzb&jAnvJRL$QQ@@&oxD z4WXw6U*^*P`fp`!2)&uvaNCsS_f5p9e~)fJiicQ}kDjPX(hbKrTpj&$JQ_eE0ne|| z4I&1;ulx7@a8Xx7x$sr7U-F9|DfvgW`Y{q> diff --git a/docs/index.html b/docs/index.html index 495d8bb..416839d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -158,7 +158,7 @@ src="//platform-api.sharethis.com/js/sharethis.js#property=5c213660c276020011d38212&product=inline-share-buttons" async="async"> + href="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.1.5/dist/css/autoComplete.min.css"> @@ -209,7 +209,7 @@ mustache: { data: ["../package.json", { minVersion: "10.1", - version: "10.1.4" + version: "10.1.5" }] } } @@ -224,7 +224,7 @@ - + \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index b789ea2..57b87b6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -32,8 +32,7 @@ ## What it is? -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. +autoComplete.js is a simple, pure vanilla Javascript library progressively designed for speed, high versatility, and seamless integration with a wide range of projects & systems. (Made for a better developer experience) ## Features diff --git a/docs/release-notes.md b/docs/release-notes.md index 597368b..59cb328 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -35,8 +35,12 @@ For more information on semantic versioning, please visit . *** -### v10.1.4 โœจ -- ๐Ÿ”ง Fixed: Unresolved dependencies when building a svelte app (Thanks ๐Ÿ‘ @sunshineplan) #243 +### v10.1.5 โœจ +- ๐Ÿงน Removed: `preInit` stage (Thanks ๐Ÿ‘ @folknor) #229 +- ๐Ÿ”ง Fixed: `unInit` to remove the `wrapper` element (Thanks ๐Ÿ‘ @deniseismo) #245 + +### v10.1.4 +- ๐Ÿ”ง Fixed: Unresolved dependencies when building a Svelte app (Thanks ๐Ÿ‘ @sunshineplan) #243 ### v10.1.3 - ๐Ÿ”ง Fixed: `mark` tag's invalid "classes" to "class" attribute (Thanks ๐Ÿ‘ @50kudos) #242 diff --git a/package.json b/package.json index 87803fd..c075039 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "10.1.4", + "version": "10.1.5", "name": "@tarekraafat/autocomplete.js", "description": "Simple autocomplete pure vanilla Javascript library.", "keywords": [ diff --git a/src/autoComplete.js b/src/autoComplete.js index 25baa2b..656209d 100644 --- a/src/autoComplete.js +++ b/src/autoComplete.js @@ -1,6 +1,5 @@ import configure from "./services/configure"; import extend from "./services/extend"; -import preInit from "./services/preInit"; import init from "./services/init"; /** @@ -66,8 +65,6 @@ export default function autoComplete(config) { configure(this); // Stage API methods extend.call(this, autoComplete); - // Set to run "preInit" if "observer" enabled else "init" - const run = this.observe ? preInit : init; - // Run autoComplete.js - run(this); + // Initialize autoComplete.js + init(this); } diff --git a/src/controllers/listController.js b/src/controllers/listController.js index c236565..26dab9c 100644 --- a/src/controllers/listController.js +++ b/src/controllers/listController.js @@ -273,7 +273,7 @@ const navigate = function (event, ctx) { case 27: event.preventDefault(); - // Clear "inputField" value + // Clear "input" value ctx.input.value = ""; close(ctx); diff --git a/src/helpers/eventEmitter.js b/src/helpers/eventEmitter.js index 8c6d5c3..05767e2 100644 --- a/src/helpers/eventEmitter.js +++ b/src/helpers/eventEmitter.js @@ -5,6 +5,6 @@ * @param {Object} ctx - autoComplete.js context */ export default (name, ctx) => { - // Dispatch event on "inputField" + // Dispatch event on "input" ctx.input.dispatchEvent(new CustomEvent(name, { bubbles: true, detail: ctx.feedback, cancelable: true })); }; diff --git a/src/helpers/io.js b/src/helpers/io.js index 55800af..5408481 100644 --- a/src/helpers/io.js +++ b/src/helpers/io.js @@ -44,7 +44,7 @@ const create = (tag, options) => { }; /** - * Get the "inputField" query value + * Get the "input" query value * * @param {Element} field - input or textarea element * @@ -59,7 +59,7 @@ const getQuery = (field) => * @param {String} value - user's raw search query value * @param {Object} diacritics - formatting on/off * - * @returns {String} - Raw "inputField" value as a string + * @returns {String} - Raw "input" value as a string */ const format = (value, diacritics) => { value = value.toString().toLowerCase(); diff --git a/src/services/extend.js b/src/services/extend.js index d597d9f..5028733 100644 --- a/src/services/extend.js +++ b/src/services/extend.js @@ -1,4 +1,3 @@ -import preInit from "./preInit"; import init from "./init"; import start from "./start"; import { removeEvents } from "../controllers/eventController"; @@ -13,11 +12,6 @@ import search from "../controllers/searchController"; export default function (autoComplete) { const { prototype } = autoComplete; - // Pre-Initialize autoComplete.js engine - prototype.preInit = function () { - preInit(this); - }; - // Initialize autoComplete.js engine prototype.init = function () { init(this); @@ -30,6 +24,13 @@ export default function (autoComplete) { // Un-Initialize autoComplete.js engine prototype.unInit = function () { + if (this.wrapper) { + const parentNode = this.wrapper.parentNode; + + parentNode.insertBefore(this.input, this.wrapper); + parentNode.removeChild(this.wrapper); + } + removeEvents(this); }; diff --git a/src/services/init.js b/src/services/init.js index 014d129..7f042c9 100644 --- a/src/services/init.js +++ b/src/services/init.js @@ -18,7 +18,7 @@ export default async function (ctx) { "aria-expanded": false, }; - // Set "inputField" attributes + // Set "input" attributes create(input, { "aria-controls": resultsList.id, "aria-autocomplete": "both", diff --git a/src/services/preInit.js b/src/services/preInit.js deleted file mode 100644 index 5bf06ce..0000000 --- a/src/services/preInit.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Pre-Initialization stage - * - * @param {Object} ctx - autoComplete.js context - */ -export default (ctx) => { - // Callback function to execute when mutations are observed - const callback = (mutations, observer) => { - mutations.forEach((mutation) => { - // Check if "inputField" added to the DOM - if (ctx.input) { - // If yes disconnect the observer - observer.disconnect(); - // Initialize autoComplete.js - ctx.init(); - } - }); - }; - // Create mutation observer instance - const observer = new MutationObserver(callback); - // Start observing the entire DOM until "inputField" is present - // The entire document will be observed for all changes - observer.observe(document, { childList: true, subtree: true }); -}; diff --git a/src/services/start.js b/src/services/start.js index f451493..8a47653 100644 --- a/src/services/start.js +++ b/src/services/start.js @@ -10,7 +10,7 @@ import { render, close } from "../controllers/listController"; export default async function (ctx) { const { input, query, trigger, threshold, resultsList } = ctx; - // Get "inputField" query value + // Get "input" query value let queryVal = getQuery(input); queryVal = query ? query(queryVal) : queryVal; // Get trigger decision