forked from LeaVerou/awesomplete
-
Notifications
You must be signed in to change notification settings - Fork 1
/
awesomplete.min.js.map
1 lines (1 loc) · 27.5 KB
/
awesomplete.min.js.map
1
{"version":3,"sources":["awesomplete.js"],"names":["Suggestion","data","o","Array","isArray","label","value","this","configure","instance","properties","i","initial","attrValue","input","getAttribute","toLowerCase","parseInt","Function","$","expr","con","document","querySelector","$$","slice","call","querySelectorAll","init","forEach","_","me","count","isOpened","setAttribute","options","minChars","maxItems","autoFirst","DATA","filter","FILTER_CONTAINS","sort","SORT_BYLENGTH","container","CONTAINER","item","ITEM","replace","REPLACE","listContainer","tabSelect","listLabel","index","ul","create","hidden","inside","role","id","aria-label","status","className","aria-live","aria-atomic","textContent","_events","evaluate","bind","blur","close","reason","keydown","evt","c","keyCode","opened","selected","preventDefault","select","undefined","form","submit","mousedown","click","li","target","test","nodeName","parentNode","button","window","scroll","boundingRect","getBoundingClientRect","style","top","height","left","minWidth","width","hasAttribute","list","removeAttribute","all","push","prototype","_list","indexOf","split","children","items","apply","el","disabled","text","trim","activeElement","fire","open","position","transitionProperty","goto","destroy","unbind","removeChild","insertBefore","indexOfAwesomplete","splice","next","length","previous","pos","lis","scrollTop","offsetTop","clientHeight","suggestions","origin","originalEvent","siblingIndex","suggestion","innerHTML","map","appendChild","RegExp","regExpEscape","FILTER_STARTSWITH","a","b","around","item_id","aria-selected","Object","defineProperty","String","get","toString","valueOf","tag","element","createElement","val","ref","focus","event","callback","addEventListener","removeEventListener","type","createEvent","initEvent","j","dispatchEvent","s","previousElementSibling","self","Awesomplete","Document","readyState","module","exports"],"mappings":";CAOA,WAmbE,QAASA,GAAWC,GAClB,GAAIC,GAAIC,MAAMC,QAAQH,IAChBI,MAAOJ,EAAK,GAAIK,MAAOL,EAAK,IACd,gBAATA,IAAqB,SAAWA,IAAQ,SAAWA,GAC1DA,GACEI,MAAOJ,EAAMK,MAAOL,EAE1BM,MAAKF,MAAQH,EAAEG,OAASH,EAAEI,MAC1BC,KAAKD,MAAQ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AAEyH,aAAe,SAAU3B,GAEzB,IAAK,GAAItG,GAAI,EAAIsG,EAAKA,EAAG8D,uBAAyBpK,KAClD,MAAOA,IAYW,mBAATqK,QACTA,KAAKC,YAAcnJ,GAIG,mBAAboJ,YAEmB,YAAxB5J,SAAS6J,WACXvJ,IAGAN,SAASiJ,iBAAiB,mBAAoB3I,IAIlDE,EAAEX,EAAIA,EACNW,EAAEN,GAAKA,EAGe,gBAAX4J,SAAuBA,OAAOC,UACvCD,OAAOC,QAAUvJ","file":"awesomplete.min.js","sourcesContent":["/**\n * Simple, lightweight, usable local autocomplete library for modern browsers\n * Because there weren’t enough autocomplete scripts in the world? Because I’m completely insane and have NIH syndrome? Probably both. :P\n * @author Lea Verou http://leaverou.github.io/awesomplete\n * MIT license\n */\n\n(function () {\n var _ = function (input, o) {\n var me = this;\n\n // Keep track of number of instances for unique IDs\n _.count = (_.count || 0) + 1;\n this.count = _.count;\n\n // Setup\n\n this.isOpened = false;\n\n this.input = $(input);\n this.input.setAttribute(\"autocomplete\", \"off\");\n this.input.setAttribute(\"aria-expanded\", \"false\");\n this.input.setAttribute(\"aria-owns\", \"awesomplete_list_\" + this.count);\n this.input.setAttribute(\"role\", \"combobox\");\n\n // store constructor options in case we need to distinguish\n // between default and customized behavior later on\n this.options = o = o || {};\n\n configure(\n this,\n {\n minChars: 2,\n maxItems: 10,\n autoFirst: false,\n data: _.DATA,\n filter: _.FILTER_CONTAINS,\n sort: o.sort === false ? false : _.SORT_BYLENGTH,\n container: _.CONTAINER,\n item: _.ITEM,\n replace: _.REPLACE,\n listContainer: _.CONTAINER,\n tabSelect: false,\n listLabel: \"Results List\",\n },\n o\n );\n\n this.index = -1;\n\n // Create necessary elements\n\n this.container = this.container(input);\n\n this.ul = $.create(\"ul\", {\n hidden: \"hidden\",\n inside:\n me.listContainer === _.CONTAINER ? me.container : me.listContainer,\n role: \"listbox\",\n id: \"awesomplete_list_\" + this.count,\n \"aria-label\": this.listLabel,\n });\n\n this.status = $.create(\"span\", {\n className: \"visually-hidden\",\n role: \"status\",\n \"aria-live\": \"assertive\",\n \"aria-atomic\": true,\n inside: this.container,\n textContent:\n this.minChars != 0\n ? \"Type \" + this.minChars + \" or more characters for results.\"\n : \"Begin typing for results.\",\n });\n\n // Bind events\n\n this._events = {\n input: {\n input: this.evaluate.bind(this),\n blur: this.close.bind(this, { reason: \"blur\" }),\n keydown: function (evt) {\n var c = evt.keyCode;\n\n // If the dropdown `ul` is in view, then act on keydown for the following keys:\n // Enter / Esc / Up / Down\n if (me.opened) {\n if (c === 13 && me.selected) {\n // Enter\n evt.preventDefault();\n me.select(undefined, undefined, evt);\n } else if (c === 9 && me.selected && me.tabSelect) {\n evt.preventDefault();\n me.select(undefined, undefined, evt);\n } else if (c === 27) {\n // Esc\n me.close({ reason: \"esc\" });\n } else if (c === 38 || c === 40) {\n // Down/Up arrow\n evt.preventDefault();\n me[c === 38 ? \"previous\" : \"next\"]();\n }\n }\n },\n },\n form: {\n submit: this.close.bind(this, { reason: \"submit\" }),\n },\n ul: {\n // Prevent the default mousedowm, which ensures the input is not blurred.\n // The actual selection will happen on click. This also ensures dragging the\n // cursor away from the list item will cancel the selection\n mousedown: function (evt) {\n evt.preventDefault();\n },\n // The click event is fired even if the corresponding mousedown event has called preventDefault\n click: function (evt) {\n var li = evt.target;\n\n if (li !== this) {\n while (li && !/li/i.test(li.nodeName)) {\n li = li.parentNode;\n }\n\n if (li && evt.button === 0) {\n // Only select on left click\n evt.preventDefault();\n me.select(li, evt.target, evt);\n }\n }\n },\n },\n window: {\n scroll: function () {\n var boundingRect = me.container.getBoundingClientRect();\n me.ul.style.top = boundingRect.top + boundingRect.height + \"px\";\n me.ul.style.left = boundingRect.left + \"px\";\n me.ul.style.minWidth = boundingRect.width + \"px\";\n },\n },\n };\n\n $.bind(this.input, this._events.input);\n $.bind(this.input.form, this._events.form);\n $.bind(this.ul, this._events.ul);\n if (this.listContainer !== _.CONTAINER) {\n $.bind(window, this._events.window);\n }\n\n if (this.input.hasAttribute(\"list\")) {\n this.list = \"#\" + this.input.getAttribute(\"list\");\n this.input.removeAttribute(\"list\");\n } else {\n this.list = this.input.getAttribute(\"data-list\") || o.list || [];\n }\n\n _.all.push(this);\n };\n\n _.prototype = {\n set list(list) {\n if (Array.isArray(list)) {\n this._list = list;\n } else if (typeof list === \"string\" && list.indexOf(\",\") > -1) {\n this._list = list.split(/\\s*,\\s*/);\n } else {\n // Element or CSS selector\n list = $(list);\n\n if (list && list.children) {\n var items = [];\n slice.apply(list.children).forEach(function (el) {\n if (!el.disabled) {\n var text = el.textContent.trim();\n var value = el.value || text;\n var label = el.label || text;\n if (value !== \"\") {\n items.push({ label: label, value: value });\n }\n }\n });\n this._list = items;\n }\n }\n\n if (document.activeElement === this.input) {\n this.evaluate();\n }\n },\n\n get selected() {\n return this.index > -1;\n },\n\n get opened() {\n return this.isOpened;\n },\n\n close: function (o) {\n if (!this.opened) {\n return;\n }\n\n this.input.setAttribute(\"aria-expanded\", \"false\");\n this.ul.setAttribute(\"hidden\", \"\");\n this.isOpened = false;\n this.index = -1;\n\n this.status.setAttribute(\"hidden\", \"\");\n\n $.fire(this.input, \"awesomplete-close\", o || {});\n },\n\n open: function () {\n if (this.listContainer !== _.CONTAINER) {\n // In case the suggestion list is out of the container,\n // get the bounding information of the container to set the position of the suggestion list below\n var boundingRect = this.container.getBoundingClientRect();\n this.ul.style.top = boundingRect.top + boundingRect.height + \"px\";\n this.ul.style.left = boundingRect.left + \"px\";\n this.ul.style.position = \"fixed\";\n this.ul.style.transitionProperty = \"height, width, transform\";\n this.ul.style.minWidth = boundingRect.width + \"px\";\n this.ul.className = \"awesomplete-suggestion-list\";\n }\n this.input.setAttribute(\"aria-expanded\", \"true\");\n this.ul.removeAttribute(\"hidden\");\n this.isOpened = true;\n\n this.status.removeAttribute(\"hidden\");\n\n if (this.autoFirst && this.index === -1) {\n this.goto(0);\n }\n\n $.fire(this.input, \"awesomplete-open\");\n },\n\n destroy: function () {\n //remove events from the input and its form\n $.unbind(this.input, this._events.input);\n $.unbind(this.input.form, this._events.form);\n if (this.listContainer !== _.CONTAINER) {\n $.unbind(window, this._events.window);\n }\n\n // cleanup container if it was created by Awesomplete but leave it alone otherwise\n if (!this.options.container) {\n //move the input out of the awesomplete container and remove the container and its children\n var parentNode = this.container.parentNode;\n if (this.listContainer !== _.CONTAINER) {\n var ulParentNode = this.ul.parentNode;\n ulParentNode.removeChild(this.ul);\n } else {\n parentNode.insertBefore(this.input, this.container);\n parentNode.removeChild(this.container);\n }\n }\n\n //remove autocomplete and aria-autocomplete attributes\n this.input.removeAttribute(\"autocomplete\");\n this.input.removeAttribute(\"aria-autocomplete\");\n\n //remove this awesomeplete instance from the global array of instances\n var indexOfAwesomplete = _.all.indexOf(this);\n\n if (indexOfAwesomplete !== -1) {\n _.all.splice(indexOfAwesomplete, 1);\n }\n },\n\n next: function () {\n var count = this.ul.children.length;\n this.goto(this.index < count - 1 ? this.index + 1 : count ? 0 : -1);\n },\n\n previous: function () {\n var count = this.ul.children.length;\n var pos = this.index - 1;\n\n this.goto(this.selected && pos !== -1 ? pos : count - 1);\n },\n\n // Should not be used, highlights specific item without any checks!\n goto: function (i) {\n var lis = this.ul.children;\n\n if (this.selected) {\n lis[this.index].setAttribute(\"aria-selected\", \"false\");\n }\n\n this.index = i;\n\n if (i > -1 && lis.length > 0) {\n lis[i].setAttribute(\"aria-selected\", \"true\");\n\n this.status.textContent =\n lis[i].textContent + \", list item \" + (i + 1) + \" of \" + lis.length;\n\n this.input.setAttribute(\n \"aria-activedescendant\",\n this.ul.id + \"_item_\" + this.index\n );\n\n // scroll to highlighted element in case parent's height is fixed\n this.ul.scrollTop =\n lis[i].offsetTop - this.ul.clientHeight + lis[i].clientHeight;\n\n $.fire(this.input, \"awesomplete-highlight\", {\n text: this.suggestions[this.index],\n });\n }\n },\n\n select: function (selected, origin, originalEvent) {\n if (selected) {\n this.index = $.siblingIndex(selected);\n } else {\n selected = this.ul.children[this.index];\n }\n\n if (selected) {\n var suggestion = this.suggestions[this.index];\n\n var allowed = $.fire(this.input, \"awesomplete-select\", {\n text: suggestion,\n origin: origin || selected,\n originalEvent: originalEvent,\n });\n\n if (allowed) {\n this.replace(suggestion);\n this.close({ reason: \"select\" });\n $.fire(this.input, \"awesomplete-selectcomplete\", {\n text: suggestion,\n originalEvent: originalEvent,\n });\n }\n }\n },\n\n evaluate: function () {\n var me = this;\n var value = this.input.value;\n\n if (\n value.length >= this.minChars &&\n this._list &&\n this._list.length > 0\n ) {\n this.index = -1;\n // Populate list with options that match\n this.ul.innerHTML = \"\";\n\n this.suggestions = this._list\n .map(function (item) {\n return new Suggestion(me.data(item, value));\n })\n .filter(function (item) {\n return me.filter(item, value);\n });\n\n if (this.sort !== false) {\n this.suggestions = this.suggestions.sort(this.sort);\n }\n\n this.suggestions = this.suggestions.slice(0, this.maxItems);\n\n this.suggestions.forEach(function (text, index) {\n me.ul.appendChild(me.item(text, value, index));\n });\n\n if (this.ul.children.length === 0) {\n this.status.textContent = \"No results found\";\n\n this.close({ reason: \"nomatches\" });\n } else {\n this.open();\n\n this.status.textContent = this.ul.children.length + \" results found\";\n }\n } else {\n this.close({ reason: \"nomatches\" });\n\n this.status.textContent = \"No results found\";\n }\n },\n };\n\n // Static methods/properties\n\n _.all = [];\n\n _.FILTER_CONTAINS = function (text, input) {\n return RegExp($.regExpEscape(input.trim()), \"i\").test(text);\n };\n\n _.FILTER_STARTSWITH = function (text, input) {\n return RegExp(\"^\" + $.regExpEscape(input.trim()), \"i\").test(text);\n };\n\n _.SORT_BYLENGTH = function (a, b) {\n if (a.length !== b.length) {\n return a.length - b.length;\n }\n\n return a < b ? -1 : 1;\n };\n\n _.CONTAINER = function (input) {\n return $.create(\"div\", {\n className: \"awesomplete\",\n around: input,\n });\n };\n\n _.ITEM = function (text, input, item_id) {\n var html =\n input.trim() === \"\"\n ? text\n : text.replace(\n RegExp($.regExpEscape(input.trim()), \"gi\"),\n \"<mark>$&</mark>\"\n );\n return $.create(\"li\", {\n innerHTML: html,\n role: \"option\",\n \"aria-selected\": \"false\",\n id: \"awesomplete_list_\" + this.count + \"_item_\" + item_id,\n });\n };\n\n _.REPLACE = function (text) {\n this.input.value = text.value;\n };\n\n _.DATA = function (item /*, input*/) {\n return item;\n };\n\n // Private functions\n\n function Suggestion(data) {\n var o = Array.isArray(data)\n ? { label: data[0], value: data[1] }\n : typeof data === \"object\" && \"label\" in data && \"value\" in data\n ? data\n : { label: data, value: data };\n\n this.label = o.label || o.value;\n this.value = o.value;\n }\n Object.defineProperty(\n (Suggestion.prototype = Object.create(String.prototype)),\n \"length\",\n {\n get: function () {\n return this.label.length;\n },\n }\n );\n Suggestion.prototype.toString = Suggestion.prototype.valueOf = function () {\n return \"\" + this.label;\n };\n\n function configure(instance, properties, o) {\n for (var i in properties) {\n var initial = properties[i],\n attrValue = instance.input.getAttribute(\"data-\" + i.toLowerCase());\n\n if (typeof initial === \"number\") {\n instance[i] = parseInt(attrValue);\n } else if (initial === false) {\n // Boolean options must be false by default anyway\n instance[i] = attrValue !== null;\n } else if (initial instanceof Function) {\n instance[i] = null;\n } else {\n instance[i] = attrValue;\n }\n\n if (!instance[i] && instance[i] !== 0) {\n instance[i] = i in o ? o[i] : initial;\n }\n }\n }\n\n // Helpers\n\n var slice = Array.prototype.slice;\n\n function $(expr, con) {\n return typeof expr === \"string\"\n ? (con || document).querySelector(expr)\n : expr || null;\n }\n\n function $$(expr, con) {\n return slice.call((con || document).querySelectorAll(expr));\n }\n\n $.create = function (tag, o) {\n var element = document.createElement(tag);\n\n for (var i in o) {\n var val = o[i];\n\n if (i === \"inside\") {\n $(val).appendChild(element);\n } else if (i === \"around\") {\n var ref = $(val);\n ref.parentNode.insertBefore(element, ref);\n element.appendChild(ref);\n\n if (ref.getAttribute(\"autofocus\") != null) {\n ref.focus();\n }\n } else if (i in element) {\n element[i] = val;\n } else {\n element.setAttribute(i, val);\n }\n }\n\n return element;\n };\n\n $.bind = function (element, o) {\n if (element) {\n for (var event in o) {\n var callback = o[event];\n\n event.split(/\\s+/).forEach(function (event) {\n element.addEventListener(event, callback);\n });\n }\n }\n };\n\n $.unbind = function (element, o) {\n if (element) {\n for (var event in o) {\n var callback = o[event];\n\n event.split(/\\s+/).forEach(function (event) {\n element.removeEventListener(event, callback);\n });\n }\n }\n };\n\n $.fire = function (target, type, properties) {\n var evt = document.createEvent(\"HTMLEvents\");\n\n evt.initEvent(type, true, true);\n\n for (var j in properties) {\n evt[j] = properties[j];\n }\n\n return target.dispatchEvent(evt);\n };\n\n $.regExpEscape = function (s) {\n return s.replace(/[-\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n };\n\n $.siblingIndex = function (el) {\n /* eslint-disable no-cond-assign */\n for (var i = 0; (el = el.previousElementSibling); i++);\n return i;\n };\n\n // Initialization\n\n function init() {\n $$(\"input.awesomplete\").forEach(function (input) {\n new _(input);\n });\n }\n\n // Make sure to export Awesomplete on self when in a browser\n if (typeof self !== \"undefined\") {\n self.Awesomplete = _;\n }\n\n // Are we in a browser? Check for Document constructor\n if (typeof Document !== \"undefined\") {\n // DOM already loaded?\n if (document.readyState !== \"loading\") {\n init();\n } else {\n // Wait for it\n document.addEventListener(\"DOMContentLoaded\", init);\n }\n }\n\n _.$ = $;\n _.$$ = $$;\n\n // Expose Awesomplete as a CJS module\n if (typeof module === \"object\" && module.exports) {\n module.exports = _;\n }\n\n return _;\n})();\n"]}