diff --git a/.circleci/config.yml b/.circleci/config.yml index 87bdc6f8..83b80ca8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,20 +1,34 @@ version: 2.1 +orbs: + node: circleci/node@4.1.0 jobs: - build: - docker: - - image: circleci/node:14.15.1 + test: + executor: + name: node/default + parameters: + os: + type: string + node-version: + type: string steps: - checkout - - restore_cache: - key: dependency-cache-{{ checksum "package.json" }} - - run: npm install - - save_cache: - key: dependency-cache-{{ checksum "package.json" }} - paths: - - node_modules - - run: - name: test - command: npm test + - node/install-packages + - run: npm test - run: name: code-coverage command: 'bash <(curl -s https://codecov.io/bash)' + +workflows: + build: + jobs: + - test: + matrix: + parameters: + os: + - docker + node-version: + - '6.17.1' + - '8.17.0' + - '10.23.1' + - '12.20.1' + - '14.15.4' diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f683b0a..db33d8b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog -### 2.2.0 +### 2.3.1 - 2021-01-17 + +- - **[Improvement]** #708 Support restored for Node 6, 8, 10 and 12. + +### 2.3.0 - 2020-11-25 - **[Feature]** #682 Multiple word search - **[Feature]** #683 Debounced keyup handler in search diff --git a/README.md b/README.md index c6ee6c30..ac96ec8e 100644 --- a/README.md +++ b/README.md @@ -45,13 +45,13 @@ bower install list.js ##### Via CDNJS ```html - + ``` ##### Via Direct Download -- [Compressed list.js](https://raw.githubusercontent.com/javve/list.js/v2.0.0/dist/list.min.js) -- [Uncompressed list.js](https://raw.githubusercontent.com/javve/list.js/v2.0.0/dist/list.js) +- [Compressed list.js](https://raw.githubusercontent.com/javve/list.js/v2.3.1/dist/list.min.js) +- [Uncompressed list.js](https://raw.githubusercontent.com/javve/list.js/v2.3.1/dist/list.js) ### Questions / How to? @@ -84,7 +84,7 @@ https://stackoverflow.com/questions/tagged/list.js ### Creator -| | Jonny Strömberg [@javve](https://twitter.com/javve) | +| | Jonny Strömberg [@javve](https://twitter.com/javve) | | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ![Image of Jonny](http://1.gravatar.com/avatar/9f8130715cb4c452f1294eafa1b36290?size=80) | I hope you like the lib. I’ve put a lot of hours into it! Feel free to follow me on [Twitter](http://twitter.com/javve) for news and [donate a coffee](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=M7ZGHV75VSD2E) for good karma ;) | diff --git a/dist/list.js b/dist/list.js index edf49993..640deceb 100644 --- a/dist/list.js +++ b/dist/list.js @@ -141,11 +141,11 @@ module.exports = function (list, options) { return false; } }; - events.bind(getByClass(list.listContainer, options.searchClass), 'keyup', function (e) { + events.bind(getByClass(list.listContainer, options.searchClass), 'keyup', list.utils.events.debounce(function (e) { var target = e.target || e.srcElement; // IE have srcElement list.search(target.value, fuzzySearch.search); - }); + }, list.searchDelay)); return function (str, columns) { list.search(str, columns, fuzzySearch.search); }; @@ -192,6 +192,7 @@ module.exports = function (id, options, values) { self.searched = false; self.filtered = false; self.searchColumns = undefined; + self.searchDelay = 0; self.handlers = { updated: [] }; @@ -756,31 +757,52 @@ module.exports = function (_list) { }; var search = { list: function list() { + // Extract quoted phrases "word1 word2" from original searchString + // searchString is converted to lowercase by List.js + var words = [], + phrase, + ss = searchString; + + while ((phrase = ss.match(/"([^"]+)"/)) !== null) { + words.push(phrase[1]); + ss = ss.substring(0, phrase.index) + ss.substring(phrase.index + phrase[0].length); + } // Get remaining space-separated words (if any) + + + ss = ss.trim(); + if (ss.length) words = words.concat(ss.split(/\s+/)); + for (var k = 0, kl = _list.items.length; k < kl; k++) { - search.item(_list.items[k]); - } - }, - item: function item(_item) { - _item.found = false; + var item = _list.items[k]; + item.found = false; + if (!words.length) continue; - for (var j = 0, jl = columns.length; j < jl; j++) { - if (search.values(_item.values(), columns[j])) { - _item.found = true; - return; - } - } - }, - values: function values(_values, column) { - if (_values.hasOwnProperty(column)) { - text = _list.utils.toString(_values[column]).toLowerCase(); + for (var i = 0, il = words.length; i < il; i++) { + var word_found = false; - if (searchString !== '' && text.search(searchString) > -1) { - return true; + for (var j = 0, jl = columns.length; j < jl; j++) { + var values = item.values(), + column = columns[j]; + + if (values.hasOwnProperty(column) && values[column] !== undefined && values[column] !== null) { + var text = typeof values[column] !== 'string' ? values[column].toString() : values[column]; + + if (text.toLowerCase().indexOf(words[i]) !== -1) { + // word found, so no need to check it against any other columns + word_found = true; + break; + } + } + } // this word not found? no need to check any other words, the item cannot match + + + if (!word_found) break; } - } - return false; + item.found = word_found; + } }, + // Removed search.item() and search.values() reset: function reset() { _list.reset.search(); @@ -819,7 +841,7 @@ module.exports = function (_list) { _list.handlers.searchStart = _list.handlers.searchStart || []; _list.handlers.searchComplete = _list.handlers.searchComplete || []; - _list.utils.events.bind(_list.utils.getByClass(_list.listContainer, _list.searchClass), 'keyup', function (e) { + _list.utils.events.bind(_list.utils.getByClass(_list.listContainer, _list.searchClass), 'keyup', _list.utils.events.debounce(function (e) { var target = e.target || e.srcElement, // IE have srcElement alreadyCleared = target.value === '' && !_list.searched; @@ -828,7 +850,7 @@ module.exports = function (_list) { // If oninput already have resetted the list, do nothing searchMethod(target.value); } - }); // Used to detect click on HTML5 clear button + }, _list.searchDelay)); // Used to detect click on HTML5 clear button _list.utils.events.bind(_list.utils.getByClass(_list.listContainer, _list.searchClass), 'input', function (e) { @@ -1372,6 +1394,7 @@ ClassList.prototype.has = ClassList.prototype.contains = function (name) { \*****************************/ /*! default exports */ /*! export bind [provided] [no usage info] [missing usage info prevents renaming] */ +/*! export debounce [provided] [no usage info] [missing usage info prevents renaming] */ /*! export unbind [provided] [no usage info] [missing usage info prevents renaming] */ /*! other exports [not provided] [no usage info] */ /*! runtime requirements: __webpack_exports__, __webpack_require__ */ @@ -1417,6 +1440,36 @@ exports.unbind = function (el, type, fn, capture) { el[i][unbind](prefix + type, fn, capture || false); } }; +/** + * Returns a function, that, as long as it continues to be invoked, will not + * be triggered. The function will be called after it stops being called for + * `wait` milliseconds. If `immediate` is true, trigger the function on the + * leading edge, instead of the trailing. + * + * @param {Function} fn + * @param {Integer} wait + * @param {Boolean} immediate + * @api public + */ + + +exports.debounce = function (fn, wait, immediate) { + var timeout; + return wait ? function () { + var context = this, + args = arguments; + + var later = function later() { + timeout = null; + if (!immediate) fn.apply(context, args); + }; + + var callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) fn.apply(context, args); + } : fn; +}; /***/ }), diff --git a/dist/list.js.map b/dist/list.js.map index 0a23bc91..0583dbe3 100644 --- a/dist/list.js.map +++ b/dist/list.js.map @@ -1 +1 @@ -{"version":3,"file":"list.js","sources":["webpack://List/./src/add-async.js","webpack://List/./src/filter.js","webpack://List/./src/fuzzy-search.js","webpack://List/./src/index.js","webpack://List/./src/item.js","webpack://List/./src/pagination.js","webpack://List/./src/parse.js","webpack://List/./src/search.js","webpack://List/./src/sort.js","webpack://List/./src/templater.js","webpack://List/./src/utils/classes.js","webpack://List/./src/utils/events.js","webpack://List/./src/utils/extend.js","webpack://List/./src/utils/fuzzy.js","webpack://List/./src/utils/get-attribute.js","webpack://List/./src/utils/get-by-class.js","webpack://List/./src/utils/index-of.js","webpack://List/./src/utils/to-array.js","webpack://List/./src/utils/to-string.js","webpack://List/./node_modules/string-natural-compare/natural-compare.js","webpack://List/webpack/bootstrap","webpack://List/webpack/startup"],"sourcesContent":["module.exports = function (list) {\n var addAsync = function (values, callback, items) {\n var valuesToAdd = values.splice(0, 50)\n items = items || []\n items = items.concat(list.add(valuesToAdd))\n if (values.length > 0) {\n setTimeout(function () {\n addAsync(values, callback, items)\n }, 1)\n } else {\n list.update()\n callback(items)\n }\n }\n return addAsync\n}\n","module.exports = function (list) {\n // Add handlers\n list.handlers.filterStart = list.handlers.filterStart || []\n list.handlers.filterComplete = list.handlers.filterComplete || []\n\n return function (filterFunction) {\n list.trigger('filterStart')\n list.i = 1 // Reset paging\n list.reset.filter()\n if (filterFunction === undefined) {\n list.filtered = false\n } else {\n list.filtered = true\n var is = list.items\n for (var i = 0, il = is.length; i < il; i++) {\n var item = is[i]\n if (filterFunction(item)) {\n item.filtered = true\n } else {\n item.filtered = false\n }\n }\n }\n list.update()\n list.trigger('filterComplete')\n return list.visibleItems\n }\n}\n","var classes = require('./utils/classes'),\n events = require('./utils/events'),\n extend = require('./utils/extend'),\n toString = require('./utils/to-string'),\n getByClass = require('./utils/get-by-class'),\n fuzzy = require('./utils/fuzzy')\n\nmodule.exports = function (list, options) {\n options = options || {}\n\n options = extend(\n {\n location: 0,\n distance: 100,\n threshold: 0.4,\n multiSearch: true,\n searchClass: 'fuzzy-search',\n },\n options\n )\n\n var fuzzySearch = {\n search: function (searchString, columns) {\n // Substract arguments from the searchString or put searchString as only argument\n var searchArguments = options.multiSearch ? searchString.replace(/ +$/, '').split(/ +/) : [searchString]\n\n for (var k = 0, kl = list.items.length; k < kl; k++) {\n fuzzySearch.item(list.items[k], columns, searchArguments)\n }\n },\n item: function (item, columns, searchArguments) {\n var found = true\n for (var i = 0; i < searchArguments.length; i++) {\n var foundArgument = false\n for (var j = 0, jl = columns.length; j < jl; j++) {\n if (fuzzySearch.values(item.values(), columns[j], searchArguments[i])) {\n foundArgument = true\n }\n }\n if (!foundArgument) {\n found = false\n }\n }\n item.found = found\n },\n values: function (values, value, searchArgument) {\n if (values.hasOwnProperty(value)) {\n var text = toString(values[value]).toLowerCase()\n\n if (fuzzy(text, searchArgument, options)) {\n return true\n }\n }\n return false\n },\n }\n\n events.bind(getByClass(list.listContainer, options.searchClass), 'keyup', function (e) {\n var target = e.target || e.srcElement // IE have srcElement\n list.search(target.value, fuzzySearch.search)\n })\n\n return function (str, columns) {\n list.search(str, columns, fuzzySearch.search)\n }\n}\n","var naturalSort = require('string-natural-compare'),\n getByClass = require('./utils/get-by-class'),\n extend = require('./utils/extend'),\n indexOf = require('./utils/index-of'),\n events = require('./utils/events'),\n toString = require('./utils/to-string'),\n classes = require('./utils/classes'),\n getAttribute = require('./utils/get-attribute'),\n toArray = require('./utils/to-array')\n\nmodule.exports = function (id, options, values) {\n var self = this,\n init,\n Item = require('./item')(self),\n addAsync = require('./add-async')(self),\n initPagination = require('./pagination')(self)\n\n init = {\n start: function () {\n self.listClass = 'list'\n self.searchClass = 'search'\n self.sortClass = 'sort'\n self.page = 10000\n self.i = 1\n self.items = []\n self.visibleItems = []\n self.matchingItems = []\n self.searched = false\n self.filtered = false\n self.searchColumns = undefined\n self.handlers = { updated: [] }\n self.valueNames = []\n self.utils = {\n getByClass: getByClass,\n extend: extend,\n indexOf: indexOf,\n events: events,\n toString: toString,\n naturalSort: naturalSort,\n classes: classes,\n getAttribute: getAttribute,\n toArray: toArray,\n }\n\n self.utils.extend(self, options)\n\n self.listContainer = typeof id === 'string' ? document.getElementById(id) : id\n if (!self.listContainer) {\n return\n }\n self.list = getByClass(self.listContainer, self.listClass, true)\n\n self.parse = require('./parse')(self)\n self.templater = require('./templater')(self)\n self.search = require('./search')(self)\n self.filter = require('./filter')(self)\n self.sort = require('./sort')(self)\n self.fuzzySearch = require('./fuzzy-search')(self, options.fuzzySearch)\n\n this.handlers()\n this.items()\n this.pagination()\n\n self.update()\n },\n handlers: function () {\n for (var handler in self.handlers) {\n if (self[handler] && self.handlers.hasOwnProperty(handler)) {\n self.on(handler, self[handler])\n }\n }\n },\n items: function () {\n self.parse(self.list)\n if (values !== undefined) {\n self.add(values)\n }\n },\n pagination: function () {\n if (options.pagination !== undefined) {\n if (options.pagination === true) {\n options.pagination = [{}]\n }\n if (options.pagination[0] === undefined) {\n options.pagination = [options.pagination]\n }\n for (var i = 0, il = options.pagination.length; i < il; i++) {\n initPagination(options.pagination[i])\n }\n }\n },\n }\n\n /*\n * Re-parse the List, use if html have changed\n */\n this.reIndex = function () {\n self.items = []\n self.visibleItems = []\n self.matchingItems = []\n self.searched = false\n self.filtered = false\n self.parse(self.list)\n }\n\n this.toJSON = function () {\n var json = []\n for (var i = 0, il = self.items.length; i < il; i++) {\n json.push(self.items[i].values())\n }\n return json\n }\n\n /*\n * Add object to list\n */\n this.add = function (values, callback) {\n if (values.length === 0) {\n return\n }\n if (callback) {\n addAsync(values.slice(0), callback)\n return\n }\n var added = [],\n notCreate = false\n if (values[0] === undefined) {\n values = [values]\n }\n for (var i = 0, il = values.length; i < il; i++) {\n var item = null\n notCreate = self.items.length > self.page ? true : false\n item = new Item(values[i], undefined, notCreate)\n self.items.push(item)\n added.push(item)\n }\n self.update()\n return added\n }\n\n this.show = function (i, page) {\n this.i = i\n this.page = page\n self.update()\n return self\n }\n\n /* Removes object from list.\n * Loops through the list and removes objects where\n * property \"valuename\" === value\n */\n this.remove = function (valueName, value, options) {\n var found = 0\n for (var i = 0, il = self.items.length; i < il; i++) {\n if (self.items[i].values()[valueName] == value) {\n self.templater.remove(self.items[i], options)\n self.items.splice(i, 1)\n il--\n i--\n found++\n }\n }\n self.update()\n return found\n }\n\n /* Gets the objects in the list which\n * property \"valueName\" === value\n */\n this.get = function (valueName, value) {\n var matchedItems = []\n for (var i = 0, il = self.items.length; i < il; i++) {\n var item = self.items[i]\n if (item.values()[valueName] == value) {\n matchedItems.push(item)\n }\n }\n return matchedItems\n }\n\n /*\n * Get size of the list\n */\n this.size = function () {\n return self.items.length\n }\n\n /*\n * Removes all items from the list\n */\n this.clear = function () {\n self.templater.clear()\n self.items = []\n return self\n }\n\n this.on = function (event, callback) {\n self.handlers[event].push(callback)\n return self\n }\n\n this.off = function (event, callback) {\n var e = self.handlers[event]\n var index = indexOf(e, callback)\n if (index > -1) {\n e.splice(index, 1)\n }\n return self\n }\n\n this.trigger = function (event) {\n var i = self.handlers[event].length\n while (i--) {\n self.handlers[event][i](self)\n }\n return self\n }\n\n this.reset = {\n filter: function () {\n var is = self.items,\n il = is.length\n while (il--) {\n is[il].filtered = false\n }\n return self\n },\n search: function () {\n var is = self.items,\n il = is.length\n while (il--) {\n is[il].found = false\n }\n return self\n },\n }\n\n this.update = function () {\n var is = self.items,\n il = is.length\n\n self.visibleItems = []\n self.matchingItems = []\n self.templater.clear()\n for (var i = 0; i < il; i++) {\n if (is[i].matching() && self.matchingItems.length + 1 >= self.i && self.visibleItems.length < self.page) {\n is[i].show()\n self.visibleItems.push(is[i])\n self.matchingItems.push(is[i])\n } else if (is[i].matching()) {\n self.matchingItems.push(is[i])\n is[i].hide()\n } else {\n is[i].hide()\n }\n }\n self.trigger('updated')\n return self\n }\n\n init.start()\n}\n","module.exports = function (list) {\n return function (initValues, element, notCreate) {\n var item = this\n\n this._values = {}\n\n this.found = false // Show if list.searched == true and this.found == true\n this.filtered = false // Show if list.filtered == true and this.filtered == true\n\n var init = function (initValues, element, notCreate) {\n if (element === undefined) {\n if (notCreate) {\n item.values(initValues, notCreate)\n } else {\n item.values(initValues)\n }\n } else {\n item.elm = element\n var values = list.templater.get(item, initValues)\n item.values(values)\n }\n }\n\n this.values = function (newValues, notCreate) {\n if (newValues !== undefined) {\n for (var name in newValues) {\n item._values[name] = newValues[name]\n }\n if (notCreate !== true) {\n list.templater.set(item, item.values())\n }\n } else {\n return item._values\n }\n }\n\n this.show = function () {\n list.templater.show(item)\n }\n\n this.hide = function () {\n list.templater.hide(item)\n }\n\n this.matching = function () {\n return (\n (list.filtered && list.searched && item.found && item.filtered) ||\n (list.filtered && !list.searched && item.filtered) ||\n (!list.filtered && list.searched && item.found) ||\n (!list.filtered && !list.searched)\n )\n }\n\n this.visible = function () {\n return item.elm && item.elm.parentNode == list.list ? true : false\n }\n\n init(initValues, element, notCreate)\n }\n}\n","var classes = require('./utils/classes'),\n events = require('./utils/events'),\n List = require('./index')\n\nmodule.exports = function (list) {\n var isHidden = false\n\n var refresh = function (pagingList, options) {\n if (list.page < 1) {\n list.listContainer.style.display = 'none'\n isHidden = true\n return\n } else if (isHidden) {\n list.listContainer.style.display = 'block'\n }\n\n var item,\n l = list.matchingItems.length,\n index = list.i,\n page = list.page,\n pages = Math.ceil(l / page),\n currentPage = Math.ceil(index / page),\n innerWindow = options.innerWindow || 2,\n left = options.left || options.outerWindow || 0,\n right = options.right || options.outerWindow || 0\n\n right = pages - right\n pagingList.clear()\n for (var i = 1; i <= pages; i++) {\n var className = currentPage === i ? 'active' : ''\n\n //console.log(i, left, right, currentPage, (currentPage - innerWindow), (currentPage + innerWindow), className);\n\n if (is.number(i, left, right, currentPage, innerWindow)) {\n item = pagingList.add({\n page: i,\n dotted: false,\n })[0]\n if (className) {\n classes(item.elm).add(className)\n }\n item.elm.firstChild.setAttribute('data-i', i)\n item.elm.firstChild.setAttribute('data-page', page)\n } else if (is.dotted(pagingList, i, left, right, currentPage, innerWindow, pagingList.size())) {\n item = pagingList.add({\n page: '...',\n dotted: true,\n })[0]\n classes(item.elm).add('disabled')\n }\n }\n }\n\n var is = {\n number: function (i, left, right, currentPage, innerWindow) {\n return this.left(i, left) || this.right(i, right) || this.innerWindow(i, currentPage, innerWindow)\n },\n left: function (i, left) {\n return i <= left\n },\n right: function (i, right) {\n return i > right\n },\n innerWindow: function (i, currentPage, innerWindow) {\n return i >= currentPage - innerWindow && i <= currentPage + innerWindow\n },\n dotted: function (pagingList, i, left, right, currentPage, innerWindow, currentPageItem) {\n return (\n this.dottedLeft(pagingList, i, left, right, currentPage, innerWindow) ||\n this.dottedRight(pagingList, i, left, right, currentPage, innerWindow, currentPageItem)\n )\n },\n dottedLeft: function (pagingList, i, left, right, currentPage, innerWindow) {\n return i == left + 1 && !this.innerWindow(i, currentPage, innerWindow) && !this.right(i, right)\n },\n dottedRight: function (pagingList, i, left, right, currentPage, innerWindow, currentPageItem) {\n if (pagingList.items[currentPageItem - 1].values().dotted) {\n return false\n } else {\n return i == right && !this.innerWindow(i, currentPage, innerWindow) && !this.right(i, right)\n }\n },\n }\n\n return function (options) {\n var pagingList = new List(list.listContainer.id, {\n listClass: options.paginationClass || 'pagination',\n item: options.item || \"
  • \",\n valueNames: ['page', 'dotted'],\n searchClass: 'pagination-search-that-is-not-supposed-to-exist',\n sortClass: 'pagination-sort-that-is-not-supposed-to-exist',\n })\n\n events.bind(pagingList.listContainer, 'click', function (e) {\n var target = e.target || e.srcElement,\n page = list.utils.getAttribute(target, 'data-page'),\n i = list.utils.getAttribute(target, 'data-i')\n if (i) {\n list.show((i - 1) * page + 1, page)\n }\n })\n\n list.on('updated', function () {\n refresh(pagingList, options)\n })\n refresh(pagingList, options)\n }\n}\n","module.exports = function (list) {\n var Item = require('./item')(list)\n\n var getChildren = function (parent) {\n var nodes = parent.childNodes,\n items = []\n for (var i = 0, il = nodes.length; i < il; i++) {\n // Only textnodes have a data attribute\n if (nodes[i].data === undefined) {\n items.push(nodes[i])\n }\n }\n return items\n }\n\n var parse = function (itemElements, valueNames) {\n for (var i = 0, il = itemElements.length; i < il; i++) {\n list.items.push(new Item(valueNames, itemElements[i]))\n }\n }\n var parseAsync = function (itemElements, valueNames) {\n var itemsToIndex = itemElements.splice(0, 50) // TODO: If < 100 items, what happens in IE etc?\n parse(itemsToIndex, valueNames)\n if (itemElements.length > 0) {\n setTimeout(function () {\n parseAsync(itemElements, valueNames)\n }, 1)\n } else {\n list.update()\n list.trigger('parseComplete')\n }\n }\n\n list.handlers.parseComplete = list.handlers.parseComplete || []\n\n return function () {\n var itemsToIndex = getChildren(list.list),\n valueNames = list.valueNames\n\n if (list.indexAsync) {\n parseAsync(itemsToIndex, valueNames)\n } else {\n parse(itemsToIndex, valueNames)\n }\n }\n}\n","module.exports = function (list) {\n var item, text, columns, searchString, customSearch\n\n var prepare = {\n resetList: function () {\n list.i = 1\n list.templater.clear()\n customSearch = undefined\n },\n setOptions: function (args) {\n if (args.length == 2 && args[1] instanceof Array) {\n columns = args[1]\n } else if (args.length == 2 && typeof args[1] == 'function') {\n columns = undefined\n customSearch = args[1]\n } else if (args.length == 3) {\n columns = args[1]\n customSearch = args[2]\n } else {\n columns = undefined\n }\n },\n setColumns: function () {\n if (list.items.length === 0) return\n if (columns === undefined) {\n columns = list.searchColumns === undefined ? prepare.toArray(list.items[0].values()) : list.searchColumns\n }\n },\n setSearchString: function (s) {\n s = list.utils.toString(s).toLowerCase()\n s = s.replace(/[-[\\]{}()*+?.,\\\\^$|#]/g, '\\\\$&') // Escape regular expression characters\n searchString = s\n },\n toArray: function (values) {\n var tmpColumn = []\n for (var name in values) {\n tmpColumn.push(name)\n }\n return tmpColumn\n },\n }\n var search = {\n list: function () {\n for (var k = 0, kl = list.items.length; k < kl; k++) {\n search.item(list.items[k])\n }\n },\n item: function (item) {\n item.found = false\n for (var j = 0, jl = columns.length; j < jl; j++) {\n if (search.values(item.values(), columns[j])) {\n item.found = true\n return\n }\n }\n },\n values: function (values, column) {\n if (values.hasOwnProperty(column)) {\n text = list.utils.toString(values[column]).toLowerCase()\n if (searchString !== '' && text.search(searchString) > -1) {\n return true\n }\n }\n return false\n },\n reset: function () {\n list.reset.search()\n list.searched = false\n },\n }\n\n var searchMethod = function (str) {\n list.trigger('searchStart')\n\n prepare.resetList()\n prepare.setSearchString(str)\n prepare.setOptions(arguments) // str, cols|searchFunction, searchFunction\n prepare.setColumns()\n\n if (searchString === '') {\n search.reset()\n } else {\n list.searched = true\n if (customSearch) {\n customSearch(searchString, columns)\n } else {\n search.list()\n }\n }\n\n list.update()\n list.trigger('searchComplete')\n return list.visibleItems\n }\n\n list.handlers.searchStart = list.handlers.searchStart || []\n list.handlers.searchComplete = list.handlers.searchComplete || []\n\n list.utils.events.bind(list.utils.getByClass(list.listContainer, list.searchClass), 'keyup', function (e) {\n var target = e.target || e.srcElement, // IE have srcElement\n alreadyCleared = target.value === '' && !list.searched\n if (!alreadyCleared) {\n // If oninput already have resetted the list, do nothing\n searchMethod(target.value)\n }\n })\n\n // Used to detect click on HTML5 clear button\n list.utils.events.bind(list.utils.getByClass(list.listContainer, list.searchClass), 'input', function (e) {\n var target = e.target || e.srcElement\n if (target.value === '') {\n searchMethod('')\n }\n })\n\n return searchMethod\n}\n","module.exports = function (list) {\n var buttons = {\n els: undefined,\n clear: function () {\n for (var i = 0, il = buttons.els.length; i < il; i++) {\n list.utils.classes(buttons.els[i]).remove('asc')\n list.utils.classes(buttons.els[i]).remove('desc')\n }\n },\n getOrder: function (btn) {\n var predefinedOrder = list.utils.getAttribute(btn, 'data-order')\n if (predefinedOrder == 'asc' || predefinedOrder == 'desc') {\n return predefinedOrder\n } else if (list.utils.classes(btn).has('desc')) {\n return 'asc'\n } else if (list.utils.classes(btn).has('asc')) {\n return 'desc'\n } else {\n return 'asc'\n }\n },\n getInSensitive: function (btn, options) {\n var insensitive = list.utils.getAttribute(btn, 'data-insensitive')\n if (insensitive === 'false') {\n options.insensitive = false\n } else {\n options.insensitive = true\n }\n },\n setOrder: function (options) {\n for (var i = 0, il = buttons.els.length; i < il; i++) {\n var btn = buttons.els[i]\n if (list.utils.getAttribute(btn, 'data-sort') !== options.valueName) {\n continue\n }\n var predefinedOrder = list.utils.getAttribute(btn, 'data-order')\n if (predefinedOrder == 'asc' || predefinedOrder == 'desc') {\n if (predefinedOrder == options.order) {\n list.utils.classes(btn).add(options.order)\n }\n } else {\n list.utils.classes(btn).add(options.order)\n }\n }\n },\n }\n\n var sort = function () {\n list.trigger('sortStart')\n var options = {}\n\n var target = arguments[0].currentTarget || arguments[0].srcElement || undefined\n\n if (target) {\n options.valueName = list.utils.getAttribute(target, 'data-sort')\n buttons.getInSensitive(target, options)\n options.order = buttons.getOrder(target)\n } else {\n options = arguments[1] || options\n options.valueName = arguments[0]\n options.order = options.order || 'asc'\n options.insensitive = typeof options.insensitive == 'undefined' ? true : options.insensitive\n }\n\n buttons.clear()\n buttons.setOrder(options)\n\n // caseInsensitive\n // alphabet\n var customSortFunction = options.sortFunction || list.sortFunction || null,\n multi = options.order === 'desc' ? -1 : 1,\n sortFunction\n\n if (customSortFunction) {\n sortFunction = function (itemA, itemB) {\n return customSortFunction(itemA, itemB, options) * multi\n }\n } else {\n sortFunction = function (itemA, itemB) {\n var sort = list.utils.naturalSort\n sort.alphabet = list.alphabet || options.alphabet || undefined\n if (!sort.alphabet && options.insensitive) {\n sort = list.utils.naturalSort.caseInsensitive\n }\n return sort(itemA.values()[options.valueName], itemB.values()[options.valueName]) * multi\n }\n }\n\n list.items.sort(sortFunction)\n list.update()\n list.trigger('sortComplete')\n }\n\n // Add handlers\n list.handlers.sortStart = list.handlers.sortStart || []\n list.handlers.sortComplete = list.handlers.sortComplete || []\n\n buttons.els = list.utils.getByClass(list.listContainer, list.sortClass)\n list.utils.events.bind(buttons.els, 'click', sort)\n list.on('searchStart', buttons.clear)\n list.on('filterStart', buttons.clear)\n\n return sort\n}\n","var Templater = function (list) {\n var createItem,\n templater = this\n\n var init = function () {\n var itemSource\n\n if (typeof list.item === 'function') {\n createItem = function (values) {\n var item = list.item(values)\n return getItemSource(item)\n }\n return\n }\n\n if (typeof list.item === 'string') {\n if (list.item.indexOf('<') === -1) {\n itemSource = document.getElementById(list.item)\n } else {\n itemSource = getItemSource(list.item)\n }\n } else {\n /* If item source does not exists, use the first item in list as\n source for new items */\n itemSource = getFirstListItem()\n }\n\n if (!itemSource) {\n throw new Error(\"The list needs to have at least one item on init otherwise you'll have to add a template.\")\n }\n\n itemSource = createCleanTemplateItem(itemSource, list.valueNames)\n\n createItem = function () {\n return itemSource.cloneNode(true)\n }\n }\n\n var createCleanTemplateItem = function (templateNode, valueNames) {\n var el = templateNode.cloneNode(true)\n el.removeAttribute('id')\n\n for (var i = 0, il = valueNames.length; i < il; i++) {\n var elm = undefined,\n valueName = valueNames[i]\n if (valueName.data) {\n for (var j = 0, jl = valueName.data.length; j < jl; j++) {\n el.setAttribute('data-' + valueName.data[j], '')\n }\n } else if (valueName.attr && valueName.name) {\n elm = list.utils.getByClass(el, valueName.name, true)\n if (elm) {\n elm.setAttribute(valueName.attr, '')\n }\n } else {\n elm = list.utils.getByClass(el, valueName, true)\n if (elm) {\n elm.innerHTML = ''\n }\n }\n }\n return el\n }\n\n var getFirstListItem = function () {\n var nodes = list.list.childNodes\n\n for (var i = 0, il = nodes.length; i < il; i++) {\n // Only textnodes have a data attribute\n if (nodes[i].data === undefined) {\n return nodes[i].cloneNode(true)\n }\n }\n return undefined\n }\n\n var getItemSource = function (itemHTML) {\n if (typeof itemHTML !== 'string') return undefined\n if (/]/g.exec(itemHTML)) {\n var tbody = document.createElement('tbody')\n tbody.innerHTML = itemHTML\n return tbody.firstElementChild\n } else if (itemHTML.indexOf('<') !== -1) {\n var div = document.createElement('div')\n div.innerHTML = itemHTML\n return div.firstElementChild\n }\n return undefined\n }\n\n var getValueName = function (name) {\n for (var i = 0, il = list.valueNames.length; i < il; i++) {\n var valueName = list.valueNames[i]\n if (valueName.data) {\n var data = valueName.data\n for (var j = 0, jl = data.length; j < jl; j++) {\n if (data[j] === name) {\n return { data: name }\n }\n }\n } else if (valueName.attr && valueName.name && valueName.name == name) {\n return valueName\n } else if (valueName === name) {\n return name\n }\n }\n }\n\n var setValue = function (item, name, value) {\n var elm = undefined,\n valueName = getValueName(name)\n if (!valueName) return\n if (valueName.data) {\n item.elm.setAttribute('data-' + valueName.data, value)\n } else if (valueName.attr && valueName.name) {\n elm = list.utils.getByClass(item.elm, valueName.name, true)\n if (elm) {\n elm.setAttribute(valueName.attr, value)\n }\n } else {\n elm = list.utils.getByClass(item.elm, valueName, true)\n if (elm) {\n elm.innerHTML = value\n }\n }\n }\n\n this.get = function (item, valueNames) {\n templater.create(item)\n var values = {}\n for (var i = 0, il = valueNames.length; i < il; i++) {\n var elm = undefined,\n valueName = valueNames[i]\n if (valueName.data) {\n for (var j = 0, jl = valueName.data.length; j < jl; j++) {\n values[valueName.data[j]] = list.utils.getAttribute(item.elm, 'data-' + valueName.data[j])\n }\n } else if (valueName.attr && valueName.name) {\n elm = list.utils.getByClass(item.elm, valueName.name, true)\n values[valueName.name] = elm ? list.utils.getAttribute(elm, valueName.attr) : ''\n } else {\n elm = list.utils.getByClass(item.elm, valueName, true)\n values[valueName] = elm ? elm.innerHTML : ''\n }\n }\n return values\n }\n\n this.set = function (item, values) {\n if (!templater.create(item)) {\n for (var v in values) {\n if (values.hasOwnProperty(v)) {\n setValue(item, v, values[v])\n }\n }\n }\n }\n\n this.create = function (item) {\n if (item.elm !== undefined) {\n return false\n }\n item.elm = createItem(item.values())\n templater.set(item, item.values())\n return true\n }\n this.remove = function (item) {\n if (item.elm.parentNode === list.list) {\n list.list.removeChild(item.elm)\n }\n }\n this.show = function (item) {\n templater.create(item)\n list.list.appendChild(item.elm)\n }\n this.hide = function (item) {\n if (item.elm !== undefined && item.elm.parentNode === list.list) {\n list.list.removeChild(item.elm)\n }\n }\n this.clear = function () {\n /* .innerHTML = ''; fucks up IE */\n if (list.list.hasChildNodes()) {\n while (list.list.childNodes.length >= 1) {\n list.list.removeChild(list.list.firstChild)\n }\n }\n }\n\n init()\n}\n\nmodule.exports = function (list) {\n return new Templater(list)\n}\n","/**\n * Module dependencies.\n */\n\nvar index = require('./index-of')\n\n/**\n * Whitespace regexp.\n */\n\nvar re = /\\s+/\n\n/**\n * toString reference.\n */\n\nvar toString = Object.prototype.toString\n\n/**\n * Wrap `el` in a `ClassList`.\n *\n * @param {Element} el\n * @return {ClassList}\n * @api public\n */\n\nmodule.exports = function (el) {\n return new ClassList(el)\n}\n\n/**\n * Initialize a new ClassList for `el`.\n *\n * @param {Element} el\n * @api private\n */\n\nfunction ClassList(el) {\n if (!el || !el.nodeType) {\n throw new Error('A DOM element reference is required')\n }\n this.el = el\n this.list = el.classList\n}\n\n/**\n * Add class `name` if not already present.\n *\n * @param {String} name\n * @return {ClassList}\n * @api public\n */\n\nClassList.prototype.add = function (name) {\n // classList\n if (this.list) {\n this.list.add(name)\n return this\n }\n\n // fallback\n var arr = this.array()\n var i = index(arr, name)\n if (!~i) arr.push(name)\n this.el.className = arr.join(' ')\n return this\n}\n\n/**\n * Remove class `name` when present, or\n * pass a regular expression to remove\n * any which match.\n *\n * @param {String|RegExp} name\n * @return {ClassList}\n * @api public\n */\n\nClassList.prototype.remove = function (name) {\n // classList\n if (this.list) {\n this.list.remove(name)\n return this\n }\n\n // fallback\n var arr = this.array()\n var i = index(arr, name)\n if (~i) arr.splice(i, 1)\n this.el.className = arr.join(' ')\n return this\n}\n\n/**\n * Toggle class `name`, can force state via `force`.\n *\n * For browsers that support classList, but do not support `force` yet,\n * the mistake will be detected and corrected.\n *\n * @param {String} name\n * @param {Boolean} force\n * @return {ClassList}\n * @api public\n */\n\nClassList.prototype.toggle = function (name, force) {\n // classList\n if (this.list) {\n if ('undefined' !== typeof force) {\n if (force !== this.list.toggle(name, force)) {\n this.list.toggle(name) // toggle again to correct\n }\n } else {\n this.list.toggle(name)\n }\n return this\n }\n\n // fallback\n if ('undefined' !== typeof force) {\n if (!force) {\n this.remove(name)\n } else {\n this.add(name)\n }\n } else {\n if (this.has(name)) {\n this.remove(name)\n } else {\n this.add(name)\n }\n }\n\n return this\n}\n\n/**\n * Return an array of classes.\n *\n * @return {Array}\n * @api public\n */\n\nClassList.prototype.array = function () {\n var className = this.el.getAttribute('class') || ''\n var str = className.replace(/^\\s+|\\s+$/g, '')\n var arr = str.split(re)\n if ('' === arr[0]) arr.shift()\n return arr\n}\n\n/**\n * Check if class `name` is present.\n *\n * @param {String} name\n * @return {ClassList}\n * @api public\n */\n\nClassList.prototype.has = ClassList.prototype.contains = function (name) {\n return this.list ? this.list.contains(name) : !!~index(this.array(), name)\n}\n","var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',\n unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',\n prefix = bind !== 'addEventListener' ? 'on' : '',\n toArray = require('./to-array')\n\n/**\n * Bind `el` event `type` to `fn`.\n *\n * @param {Element} el, NodeList, HTMLCollection or Array\n * @param {String} type\n * @param {Function} fn\n * @param {Boolean} capture\n * @api public\n */\n\nexports.bind = function(el, type, fn, capture){\n el = toArray(el);\n for ( var i = 0, il = el.length; i < il; i++ ) {\n el[i][bind](prefix + type, fn, capture || false);\n }\n}\n\n/**\n * Unbind `el` event `type`'s callback `fn`.\n *\n * @param {Element} el, NodeList, HTMLCollection or Array\n * @param {String} type\n * @param {Function} fn\n * @param {Boolean} capture\n * @api public\n */\n\nexports.unbind = function(el, type, fn, capture){\n el = toArray(el);\n for ( var i = 0, il = el.length; i < il; i++ ) {\n el[i][unbind](prefix + type, fn, capture || false);\n }\n}\n","/*\n * Source: https://github.com/segmentio/extend\n */\n\nmodule.exports = function extend(object) {\n // Takes an unlimited number of extenders.\n var args = Array.prototype.slice.call(arguments, 1)\n\n // For each extender, copy their properties on our object.\n for (var i = 0, source; (source = args[i]); i++) {\n if (!source) continue\n for (var property in source) {\n object[property] = source[property]\n }\n }\n\n return object\n}\n","module.exports = function (text, pattern, options) {\n // Aproximately where in the text is the pattern expected to be found?\n var Match_Location = options.location || 0\n\n //Determines how close the match must be to the fuzzy location (specified above). An exact letter match which is 'distance' characters away from the fuzzy location would score as a complete mismatch. A distance of '0' requires the match be at the exact location specified, a threshold of '1000' would require a perfect match to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.\n var Match_Distance = options.distance || 100\n\n // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match (of both letters and location), a threshold of '1.0' would match anything.\n var Match_Threshold = options.threshold || 0.4\n\n if (pattern === text) return true // Exact match\n if (pattern.length > 32) return false // This algorithm cannot be used\n\n // Set starting location at beginning text and initialise the alphabet.\n var loc = Match_Location,\n s = (function () {\n var q = {},\n i\n\n for (i = 0; i < pattern.length; i++) {\n q[pattern.charAt(i)] = 0\n }\n\n for (i = 0; i < pattern.length; i++) {\n q[pattern.charAt(i)] |= 1 << (pattern.length - i - 1)\n }\n\n return q\n })()\n\n // Compute and return the score for a match with e errors and x location.\n // Accesses loc and pattern through being a closure.\n\n function match_bitapScore_(e, x) {\n var accuracy = e / pattern.length,\n proximity = Math.abs(loc - x)\n\n if (!Match_Distance) {\n // Dodge divide by zero error.\n return proximity ? 1.0 : accuracy\n }\n return accuracy + proximity / Match_Distance\n }\n\n var score_threshold = Match_Threshold, // Highest score beyond which we give up.\n best_loc = text.indexOf(pattern, loc) // Is there a nearby exact match? (speedup)\n\n if (best_loc != -1) {\n score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold)\n // What about in the other direction? (speedup)\n best_loc = text.lastIndexOf(pattern, loc + pattern.length)\n\n if (best_loc != -1) {\n score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold)\n }\n }\n\n // Initialise the bit arrays.\n var matchmask = 1 << (pattern.length - 1)\n best_loc = -1\n\n var bin_min, bin_mid\n var bin_max = pattern.length + text.length\n var last_rd\n for (var d = 0; d < pattern.length; d++) {\n // Scan for the best match; each iteration allows for one more error.\n // Run a binary search to determine how far from 'loc' we can stray at this\n // error level.\n bin_min = 0\n bin_mid = bin_max\n while (bin_min < bin_mid) {\n if (match_bitapScore_(d, loc + bin_mid) <= score_threshold) {\n bin_min = bin_mid\n } else {\n bin_max = bin_mid\n }\n bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min)\n }\n // Use the result from this iteration as the maximum for the next.\n bin_max = bin_mid\n var start = Math.max(1, loc - bin_mid + 1)\n var finish = Math.min(loc + bin_mid, text.length) + pattern.length\n\n var rd = Array(finish + 2)\n rd[finish + 1] = (1 << d) - 1\n for (var j = finish; j >= start; j--) {\n // The alphabet (s) is a sparse hash, so the following line generates\n // warnings.\n var charMatch = s[text.charAt(j - 1)]\n if (d === 0) {\n // First pass: exact match.\n rd[j] = ((rd[j + 1] << 1) | 1) & charMatch\n } else {\n // Subsequent passes: fuzzy match.\n rd[j] = (((rd[j + 1] << 1) | 1) & charMatch) | (((last_rd[j + 1] | last_rd[j]) << 1) | 1) | last_rd[j + 1]\n }\n if (rd[j] & matchmask) {\n var score = match_bitapScore_(d, j - 1)\n // This match will almost certainly be better than any existing match.\n // But check anyway.\n if (score <= score_threshold) {\n // Told you so.\n score_threshold = score\n best_loc = j - 1\n if (best_loc > loc) {\n // When passing loc, don't exceed our current distance from loc.\n start = Math.max(1, 2 * loc - best_loc)\n } else {\n // Already passed loc, downhill from here on in.\n break\n }\n }\n }\n }\n // No hope for a (better) match at greater error levels.\n if (match_bitapScore_(d + 1, loc) > score_threshold) {\n break\n }\n last_rd = rd\n }\n\n return best_loc < 0 ? false : true\n}\n","/**\n * A cross-browser implementation of getAttribute.\n * Source found here: http://stackoverflow.com/a/3755343/361337 written by Vivin Paliath\n *\n * Return the value for `attr` at `element`.\n *\n * @param {Element} el\n * @param {String} attr\n * @api public\n */\n\nmodule.exports = function (el, attr) {\n var result = (el.getAttribute && el.getAttribute(attr)) || null\n if (!result) {\n var attrs = el.attributes\n var length = attrs.length\n for (var i = 0; i < length; i++) {\n if (attrs[i] !== undefined) {\n if (attrs[i].nodeName === attr) {\n result = attrs[i].nodeValue\n }\n }\n }\n }\n return result\n}\n","/**\n * A cross-browser implementation of getElementsByClass.\n * Heavily based on Dustin Diaz's function: http://dustindiaz.com/getelementsbyclass.\n *\n * Find all elements with class `className` inside `container`.\n * Use `single = true` to increase performance in older browsers\n * when only one element is needed.\n *\n * @param {String} className\n * @param {Element} container\n * @param {Boolean} single\n * @api public\n */\n\nvar getElementsByClassName = function (container, className, single) {\n if (single) {\n return container.getElementsByClassName(className)[0]\n } else {\n return container.getElementsByClassName(className)\n }\n}\n\nvar querySelector = function (container, className, single) {\n className = '.' + className\n if (single) {\n return container.querySelector(className)\n } else {\n return container.querySelectorAll(className)\n }\n}\n\nvar polyfill = function (container, className, single) {\n var classElements = [],\n tag = '*'\n\n var els = container.getElementsByTagName(tag)\n var elsLen = els.length\n var pattern = new RegExp('(^|\\\\s)' + className + '(\\\\s|$)')\n for (var i = 0, j = 0; i < elsLen; i++) {\n if (pattern.test(els[i].className)) {\n if (single) {\n return els[i]\n } else {\n classElements[j] = els[i]\n j++\n }\n }\n }\n return classElements\n}\n\nmodule.exports = (function () {\n return function (container, className, single, options) {\n options = options || {}\n if ((options.test && options.getElementsByClassName) || (!options.test && document.getElementsByClassName)) {\n return getElementsByClassName(container, className, single)\n } else if ((options.test && options.querySelector) || (!options.test && document.querySelector)) {\n return querySelector(container, className, single)\n } else {\n return polyfill(container, className, single)\n }\n }\n})()\n","var indexOf = [].indexOf\n\nmodule.exports = function(arr, obj){\n if (indexOf) return arr.indexOf(obj);\n for (var i = 0, il = arr.length; i < il; ++i) {\n if (arr[i] === obj) return i;\n }\n return -1\n}\n","/**\n * Source: https://github.com/timoxley/to-array\n *\n * Convert an array-like object into an `Array`.\n * If `collection` is already an `Array`, then will return a clone of `collection`.\n *\n * @param {Array | Mixed} collection An `Array` or array-like object to convert e.g. `arguments` or `NodeList`\n * @return {Array} Naive conversion of `collection` to a new `Array`.\n * @api public\n */\n\nmodule.exports = function toArray(collection) {\n if (typeof collection === 'undefined') return []\n if (collection === null) return [null]\n if (collection === window) return [window]\n if (typeof collection === 'string') return [collection]\n if (isArray(collection)) return collection\n if (typeof collection.length != 'number') return [collection]\n if (typeof collection === 'function' && collection instanceof Function) return [collection]\n\n var arr = [];\n for (var i = 0, il = collection.length; i < il; i++) {\n if (Object.prototype.hasOwnProperty.call(collection, i) || i in collection) {\n arr.push(collection[i])\n }\n }\n if (!arr.length) return []\n return arr\n}\n\nfunction isArray(arr) {\n return Object.prototype.toString.call(arr) === '[object Array]'\n}\n","module.exports = function (s) {\n s = s === undefined ? '' : s\n s = s === null ? '' : s\n s = s.toString()\n return s\n}\n","'use strict';\n\nvar alphabet;\nvar alphabetIndexMap;\nvar alphabetIndexMapLength = 0;\n\nfunction isNumberCode(code) {\n return code >= 48 && code <= 57;\n}\n\nfunction naturalCompare(a, b) {\n var lengthA = (a += '').length;\n var lengthB = (b += '').length;\n var aIndex = 0;\n var bIndex = 0;\n\n while (aIndex < lengthA && bIndex < lengthB) {\n var charCodeA = a.charCodeAt(aIndex);\n var charCodeB = b.charCodeAt(bIndex);\n\n if (isNumberCode(charCodeA)) {\n if (!isNumberCode(charCodeB)) {\n return charCodeA - charCodeB;\n }\n\n var numStartA = aIndex;\n var numStartB = bIndex;\n\n while (charCodeA === 48 && ++numStartA < lengthA) {\n charCodeA = a.charCodeAt(numStartA);\n }\n while (charCodeB === 48 && ++numStartB < lengthB) {\n charCodeB = b.charCodeAt(numStartB);\n }\n\n var numEndA = numStartA;\n var numEndB = numStartB;\n\n while (numEndA < lengthA && isNumberCode(a.charCodeAt(numEndA))) {\n ++numEndA;\n }\n while (numEndB < lengthB && isNumberCode(b.charCodeAt(numEndB))) {\n ++numEndB;\n }\n\n var difference = numEndA - numStartA - numEndB + numStartB; // numA length - numB length\n if (difference) {\n return difference;\n }\n\n while (numStartA < numEndA) {\n difference = a.charCodeAt(numStartA++) - b.charCodeAt(numStartB++);\n if (difference) {\n return difference;\n }\n }\n\n aIndex = numEndA;\n bIndex = numEndB;\n continue;\n }\n\n if (charCodeA !== charCodeB) {\n if (\n charCodeA < alphabetIndexMapLength &&\n charCodeB < alphabetIndexMapLength &&\n alphabetIndexMap[charCodeA] !== -1 &&\n alphabetIndexMap[charCodeB] !== -1\n ) {\n return alphabetIndexMap[charCodeA] - alphabetIndexMap[charCodeB];\n }\n\n return charCodeA - charCodeB;\n }\n\n ++aIndex;\n ++bIndex;\n }\n\n if (aIndex >= lengthA && bIndex < lengthB && lengthA >= lengthB) {\n return -1;\n }\n\n if (bIndex >= lengthB && aIndex < lengthA && lengthB >= lengthA) {\n return 1;\n }\n\n return lengthA - lengthB;\n}\n\nnaturalCompare.caseInsensitive = naturalCompare.i = function(a, b) {\n return naturalCompare(('' + a).toLowerCase(), ('' + b).toLowerCase());\n};\n\nObject.defineProperties(naturalCompare, {\n alphabet: {\n get: function() {\n return alphabet;\n },\n\n set: function(value) {\n alphabet = value;\n alphabetIndexMap = [];\n\n var i = 0;\n\n if (alphabet) {\n for (; i < alphabet.length; i++) {\n alphabetIndexMap[alphabet.charCodeAt(i)] = i;\n }\n }\n\n alphabetIndexMapLength = alphabetIndexMap.length;\n\n for (i = 0; i < alphabetIndexMapLength; i++) {\n if (alphabetIndexMap[i] === undefined) {\n alphabetIndexMap[i] = -1;\n }\n }\n },\n },\n});\n\nmodule.exports = naturalCompare;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/index.js\");\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;A;;;;;;;;;;;AChBA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;AC5BA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAMA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AALA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAjCA;AAoCA;AACA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;AClEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AASA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AAYA;AAEA;AACA;AAAA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAzEA;AA4EA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AADA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AADA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AADA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AADA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AADA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAhBA;AACA;AAkBA;AACA;AAAA;AAGA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;ACtQA;AACA;AACA;AAEA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;AC5DA;AAAA;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA;AACA;AACA;AAAA;AACA;AACA;AAGA;AACA;AACA;AACA;AAFA;AACA;AAGA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAFA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5BA;AA+BA;AACA;AACA;AACA;AACA;AACA;AACA;AALA;AAQA;AACA;AAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;AC5GA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;AC9CA;AACA;AAEA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AApCA;AAsCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AA3BA;AACA;AA6BA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;ACrHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3CA;AACA;AA6CA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAAA;AAAA;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;A;;;;;;;;;;;ACxGA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;ACnMA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;A;;;;;;;;;;;;;AClKA;AAAA;AAAA;AAAA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;ACtCA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;AClBA;AACA;AACA;AACA;AAEA;AACA;AAEA;AAEA;AACA;AAAA;AAEA;AACA;AAAA;AAAA;AAEA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAAA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AAEA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;AC3HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;A;;;;;;;;;;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAGA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;AC/DA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;A;;;;;;;;;;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;AC7HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;;A","sourceRoot":""} \ No newline at end of file +{"version":3,"file":"list.js","sources":["webpack://List/./src/add-async.js","webpack://List/./src/filter.js","webpack://List/./src/fuzzy-search.js","webpack://List/./src/index.js","webpack://List/./src/item.js","webpack://List/./src/pagination.js","webpack://List/./src/parse.js","webpack://List/./src/search.js","webpack://List/./src/sort.js","webpack://List/./src/templater.js","webpack://List/./src/utils/classes.js","webpack://List/./src/utils/events.js","webpack://List/./src/utils/extend.js","webpack://List/./src/utils/fuzzy.js","webpack://List/./src/utils/get-attribute.js","webpack://List/./src/utils/get-by-class.js","webpack://List/./src/utils/index-of.js","webpack://List/./src/utils/to-array.js","webpack://List/./src/utils/to-string.js","webpack://List/./node_modules/string-natural-compare/natural-compare.js","webpack://List/webpack/bootstrap","webpack://List/webpack/startup"],"sourcesContent":["module.exports = function (list) {\n var addAsync = function (values, callback, items) {\n var valuesToAdd = values.splice(0, 50)\n items = items || []\n items = items.concat(list.add(valuesToAdd))\n if (values.length > 0) {\n setTimeout(function () {\n addAsync(values, callback, items)\n }, 1)\n } else {\n list.update()\n callback(items)\n }\n }\n return addAsync\n}\n","module.exports = function (list) {\n // Add handlers\n list.handlers.filterStart = list.handlers.filterStart || []\n list.handlers.filterComplete = list.handlers.filterComplete || []\n\n return function (filterFunction) {\n list.trigger('filterStart')\n list.i = 1 // Reset paging\n list.reset.filter()\n if (filterFunction === undefined) {\n list.filtered = false\n } else {\n list.filtered = true\n var is = list.items\n for (var i = 0, il = is.length; i < il; i++) {\n var item = is[i]\n if (filterFunction(item)) {\n item.filtered = true\n } else {\n item.filtered = false\n }\n }\n }\n list.update()\n list.trigger('filterComplete')\n return list.visibleItems\n }\n}\n","var classes = require('./utils/classes'),\n events = require('./utils/events'),\n extend = require('./utils/extend'),\n toString = require('./utils/to-string'),\n getByClass = require('./utils/get-by-class'),\n fuzzy = require('./utils/fuzzy')\n\nmodule.exports = function (list, options) {\n options = options || {}\n\n options = extend(\n {\n location: 0,\n distance: 100,\n threshold: 0.4,\n multiSearch: true,\n searchClass: 'fuzzy-search',\n },\n options\n )\n\n var fuzzySearch = {\n search: function (searchString, columns) {\n // Substract arguments from the searchString or put searchString as only argument\n var searchArguments = options.multiSearch ? searchString.replace(/ +$/, '').split(/ +/) : [searchString]\n\n for (var k = 0, kl = list.items.length; k < kl; k++) {\n fuzzySearch.item(list.items[k], columns, searchArguments)\n }\n },\n item: function (item, columns, searchArguments) {\n var found = true\n for (var i = 0; i < searchArguments.length; i++) {\n var foundArgument = false\n for (var j = 0, jl = columns.length; j < jl; j++) {\n if (fuzzySearch.values(item.values(), columns[j], searchArguments[i])) {\n foundArgument = true\n }\n }\n if (!foundArgument) {\n found = false\n }\n }\n item.found = found\n },\n values: function (values, value, searchArgument) {\n if (values.hasOwnProperty(value)) {\n var text = toString(values[value]).toLowerCase()\n\n if (fuzzy(text, searchArgument, options)) {\n return true\n }\n }\n return false\n },\n }\n\n events.bind(\n getByClass(list.listContainer, options.searchClass),\n 'keyup',\n list.utils.events.debounce(function (e) {\n var target = e.target || e.srcElement // IE have srcElement\n list.search(target.value, fuzzySearch.search)\n }, list.searchDelay)\n )\n\n return function (str, columns) {\n list.search(str, columns, fuzzySearch.search)\n }\n}\n","var naturalSort = require('string-natural-compare'),\n getByClass = require('./utils/get-by-class'),\n extend = require('./utils/extend'),\n indexOf = require('./utils/index-of'),\n events = require('./utils/events'),\n toString = require('./utils/to-string'),\n classes = require('./utils/classes'),\n getAttribute = require('./utils/get-attribute'),\n toArray = require('./utils/to-array')\n\nmodule.exports = function (id, options, values) {\n var self = this,\n init,\n Item = require('./item')(self),\n addAsync = require('./add-async')(self),\n initPagination = require('./pagination')(self)\n\n init = {\n start: function () {\n self.listClass = 'list'\n self.searchClass = 'search'\n self.sortClass = 'sort'\n self.page = 10000\n self.i = 1\n self.items = []\n self.visibleItems = []\n self.matchingItems = []\n self.searched = false\n self.filtered = false\n self.searchColumns = undefined\n self.searchDelay = 0\n self.handlers = { updated: [] }\n self.valueNames = []\n self.utils = {\n getByClass: getByClass,\n extend: extend,\n indexOf: indexOf,\n events: events,\n toString: toString,\n naturalSort: naturalSort,\n classes: classes,\n getAttribute: getAttribute,\n toArray: toArray,\n }\n\n self.utils.extend(self, options)\n\n self.listContainer = typeof id === 'string' ? document.getElementById(id) : id\n if (!self.listContainer) {\n return\n }\n self.list = getByClass(self.listContainer, self.listClass, true)\n\n self.parse = require('./parse')(self)\n self.templater = require('./templater')(self)\n self.search = require('./search')(self)\n self.filter = require('./filter')(self)\n self.sort = require('./sort')(self)\n self.fuzzySearch = require('./fuzzy-search')(self, options.fuzzySearch)\n\n this.handlers()\n this.items()\n this.pagination()\n\n self.update()\n },\n handlers: function () {\n for (var handler in self.handlers) {\n if (self[handler] && self.handlers.hasOwnProperty(handler)) {\n self.on(handler, self[handler])\n }\n }\n },\n items: function () {\n self.parse(self.list)\n if (values !== undefined) {\n self.add(values)\n }\n },\n pagination: function () {\n if (options.pagination !== undefined) {\n if (options.pagination === true) {\n options.pagination = [{}]\n }\n if (options.pagination[0] === undefined) {\n options.pagination = [options.pagination]\n }\n for (var i = 0, il = options.pagination.length; i < il; i++) {\n initPagination(options.pagination[i])\n }\n }\n },\n }\n\n /*\n * Re-parse the List, use if html have changed\n */\n this.reIndex = function () {\n self.items = []\n self.visibleItems = []\n self.matchingItems = []\n self.searched = false\n self.filtered = false\n self.parse(self.list)\n }\n\n this.toJSON = function () {\n var json = []\n for (var i = 0, il = self.items.length; i < il; i++) {\n json.push(self.items[i].values())\n }\n return json\n }\n\n /*\n * Add object to list\n */\n this.add = function (values, callback) {\n if (values.length === 0) {\n return\n }\n if (callback) {\n addAsync(values.slice(0), callback)\n return\n }\n var added = [],\n notCreate = false\n if (values[0] === undefined) {\n values = [values]\n }\n for (var i = 0, il = values.length; i < il; i++) {\n var item = null\n notCreate = self.items.length > self.page ? true : false\n item = new Item(values[i], undefined, notCreate)\n self.items.push(item)\n added.push(item)\n }\n self.update()\n return added\n }\n\n this.show = function (i, page) {\n this.i = i\n this.page = page\n self.update()\n return self\n }\n\n /* Removes object from list.\n * Loops through the list and removes objects where\n * property \"valuename\" === value\n */\n this.remove = function (valueName, value, options) {\n var found = 0\n for (var i = 0, il = self.items.length; i < il; i++) {\n if (self.items[i].values()[valueName] == value) {\n self.templater.remove(self.items[i], options)\n self.items.splice(i, 1)\n il--\n i--\n found++\n }\n }\n self.update()\n return found\n }\n\n /* Gets the objects in the list which\n * property \"valueName\" === value\n */\n this.get = function (valueName, value) {\n var matchedItems = []\n for (var i = 0, il = self.items.length; i < il; i++) {\n var item = self.items[i]\n if (item.values()[valueName] == value) {\n matchedItems.push(item)\n }\n }\n return matchedItems\n }\n\n /*\n * Get size of the list\n */\n this.size = function () {\n return self.items.length\n }\n\n /*\n * Removes all items from the list\n */\n this.clear = function () {\n self.templater.clear()\n self.items = []\n return self\n }\n\n this.on = function (event, callback) {\n self.handlers[event].push(callback)\n return self\n }\n\n this.off = function (event, callback) {\n var e = self.handlers[event]\n var index = indexOf(e, callback)\n if (index > -1) {\n e.splice(index, 1)\n }\n return self\n }\n\n this.trigger = function (event) {\n var i = self.handlers[event].length\n while (i--) {\n self.handlers[event][i](self)\n }\n return self\n }\n\n this.reset = {\n filter: function () {\n var is = self.items,\n il = is.length\n while (il--) {\n is[il].filtered = false\n }\n return self\n },\n search: function () {\n var is = self.items,\n il = is.length\n while (il--) {\n is[il].found = false\n }\n return self\n },\n }\n\n this.update = function () {\n var is = self.items,\n il = is.length\n\n self.visibleItems = []\n self.matchingItems = []\n self.templater.clear()\n for (var i = 0; i < il; i++) {\n if (is[i].matching() && self.matchingItems.length + 1 >= self.i && self.visibleItems.length < self.page) {\n is[i].show()\n self.visibleItems.push(is[i])\n self.matchingItems.push(is[i])\n } else if (is[i].matching()) {\n self.matchingItems.push(is[i])\n is[i].hide()\n } else {\n is[i].hide()\n }\n }\n self.trigger('updated')\n return self\n }\n\n init.start()\n}\n","module.exports = function (list) {\n return function (initValues, element, notCreate) {\n var item = this\n\n this._values = {}\n\n this.found = false // Show if list.searched == true and this.found == true\n this.filtered = false // Show if list.filtered == true and this.filtered == true\n\n var init = function (initValues, element, notCreate) {\n if (element === undefined) {\n if (notCreate) {\n item.values(initValues, notCreate)\n } else {\n item.values(initValues)\n }\n } else {\n item.elm = element\n var values = list.templater.get(item, initValues)\n item.values(values)\n }\n }\n\n this.values = function (newValues, notCreate) {\n if (newValues !== undefined) {\n for (var name in newValues) {\n item._values[name] = newValues[name]\n }\n if (notCreate !== true) {\n list.templater.set(item, item.values())\n }\n } else {\n return item._values\n }\n }\n\n this.show = function () {\n list.templater.show(item)\n }\n\n this.hide = function () {\n list.templater.hide(item)\n }\n\n this.matching = function () {\n return (\n (list.filtered && list.searched && item.found && item.filtered) ||\n (list.filtered && !list.searched && item.filtered) ||\n (!list.filtered && list.searched && item.found) ||\n (!list.filtered && !list.searched)\n )\n }\n\n this.visible = function () {\n return item.elm && item.elm.parentNode == list.list ? true : false\n }\n\n init(initValues, element, notCreate)\n }\n}\n","var classes = require('./utils/classes'),\n events = require('./utils/events'),\n List = require('./index')\n\nmodule.exports = function (list) {\n var isHidden = false\n\n var refresh = function (pagingList, options) {\n if (list.page < 1) {\n list.listContainer.style.display = 'none'\n isHidden = true\n return\n } else if (isHidden) {\n list.listContainer.style.display = 'block'\n }\n\n var item,\n l = list.matchingItems.length,\n index = list.i,\n page = list.page,\n pages = Math.ceil(l / page),\n currentPage = Math.ceil(index / page),\n innerWindow = options.innerWindow || 2,\n left = options.left || options.outerWindow || 0,\n right = options.right || options.outerWindow || 0\n\n right = pages - right\n pagingList.clear()\n for (var i = 1; i <= pages; i++) {\n var className = currentPage === i ? 'active' : ''\n\n //console.log(i, left, right, currentPage, (currentPage - innerWindow), (currentPage + innerWindow), className);\n\n if (is.number(i, left, right, currentPage, innerWindow)) {\n item = pagingList.add({\n page: i,\n dotted: false,\n })[0]\n if (className) {\n classes(item.elm).add(className)\n }\n item.elm.firstChild.setAttribute('data-i', i)\n item.elm.firstChild.setAttribute('data-page', page)\n } else if (is.dotted(pagingList, i, left, right, currentPage, innerWindow, pagingList.size())) {\n item = pagingList.add({\n page: '...',\n dotted: true,\n })[0]\n classes(item.elm).add('disabled')\n }\n }\n }\n\n var is = {\n number: function (i, left, right, currentPage, innerWindow) {\n return this.left(i, left) || this.right(i, right) || this.innerWindow(i, currentPage, innerWindow)\n },\n left: function (i, left) {\n return i <= left\n },\n right: function (i, right) {\n return i > right\n },\n innerWindow: function (i, currentPage, innerWindow) {\n return i >= currentPage - innerWindow && i <= currentPage + innerWindow\n },\n dotted: function (pagingList, i, left, right, currentPage, innerWindow, currentPageItem) {\n return (\n this.dottedLeft(pagingList, i, left, right, currentPage, innerWindow) ||\n this.dottedRight(pagingList, i, left, right, currentPage, innerWindow, currentPageItem)\n )\n },\n dottedLeft: function (pagingList, i, left, right, currentPage, innerWindow) {\n return i == left + 1 && !this.innerWindow(i, currentPage, innerWindow) && !this.right(i, right)\n },\n dottedRight: function (pagingList, i, left, right, currentPage, innerWindow, currentPageItem) {\n if (pagingList.items[currentPageItem - 1].values().dotted) {\n return false\n } else {\n return i == right && !this.innerWindow(i, currentPage, innerWindow) && !this.right(i, right)\n }\n },\n }\n\n return function (options) {\n var pagingList = new List(list.listContainer.id, {\n listClass: options.paginationClass || 'pagination',\n item: options.item || \"
  • \",\n valueNames: ['page', 'dotted'],\n searchClass: 'pagination-search-that-is-not-supposed-to-exist',\n sortClass: 'pagination-sort-that-is-not-supposed-to-exist',\n })\n\n events.bind(pagingList.listContainer, 'click', function (e) {\n var target = e.target || e.srcElement,\n page = list.utils.getAttribute(target, 'data-page'),\n i = list.utils.getAttribute(target, 'data-i')\n if (i) {\n list.show((i - 1) * page + 1, page)\n }\n })\n\n list.on('updated', function () {\n refresh(pagingList, options)\n })\n refresh(pagingList, options)\n }\n}\n","module.exports = function (list) {\n var Item = require('./item')(list)\n\n var getChildren = function (parent) {\n var nodes = parent.childNodes,\n items = []\n for (var i = 0, il = nodes.length; i < il; i++) {\n // Only textnodes have a data attribute\n if (nodes[i].data === undefined) {\n items.push(nodes[i])\n }\n }\n return items\n }\n\n var parse = function (itemElements, valueNames) {\n for (var i = 0, il = itemElements.length; i < il; i++) {\n list.items.push(new Item(valueNames, itemElements[i]))\n }\n }\n var parseAsync = function (itemElements, valueNames) {\n var itemsToIndex = itemElements.splice(0, 50) // TODO: If < 100 items, what happens in IE etc?\n parse(itemsToIndex, valueNames)\n if (itemElements.length > 0) {\n setTimeout(function () {\n parseAsync(itemElements, valueNames)\n }, 1)\n } else {\n list.update()\n list.trigger('parseComplete')\n }\n }\n\n list.handlers.parseComplete = list.handlers.parseComplete || []\n\n return function () {\n var itemsToIndex = getChildren(list.list),\n valueNames = list.valueNames\n\n if (list.indexAsync) {\n parseAsync(itemsToIndex, valueNames)\n } else {\n parse(itemsToIndex, valueNames)\n }\n }\n}\n","module.exports = function (list) {\n var item, text, columns, searchString, customSearch\n\n var prepare = {\n resetList: function () {\n list.i = 1\n list.templater.clear()\n customSearch = undefined\n },\n setOptions: function (args) {\n if (args.length == 2 && args[1] instanceof Array) {\n columns = args[1]\n } else if (args.length == 2 && typeof args[1] == 'function') {\n columns = undefined\n customSearch = args[1]\n } else if (args.length == 3) {\n columns = args[1]\n customSearch = args[2]\n } else {\n columns = undefined\n }\n },\n setColumns: function () {\n if (list.items.length === 0) return\n if (columns === undefined) {\n columns = list.searchColumns === undefined ? prepare.toArray(list.items[0].values()) : list.searchColumns\n }\n },\n setSearchString: function (s) {\n s = list.utils.toString(s).toLowerCase()\n s = s.replace(/[-[\\]{}()*+?.,\\\\^$|#]/g, '\\\\$&') // Escape regular expression characters\n searchString = s\n },\n toArray: function (values) {\n var tmpColumn = []\n for (var name in values) {\n tmpColumn.push(name)\n }\n return tmpColumn\n },\n }\n var search = {\n list: function () {\n // Extract quoted phrases \"word1 word2\" from original searchString\n // searchString is converted to lowercase by List.js\n var words = [],\n phrase,\n ss = searchString\n while ((phrase = ss.match(/\"([^\"]+)\"/)) !== null) {\n words.push(phrase[1])\n ss = ss.substring(0, phrase.index) + ss.substring(phrase.index + phrase[0].length)\n }\n // Get remaining space-separated words (if any)\n ss = ss.trim()\n if (ss.length) words = words.concat(ss.split(/\\s+/))\n for (var k = 0, kl = list.items.length; k < kl; k++) {\n var item = list.items[k]\n item.found = false\n if (!words.length) continue\n for (var i = 0, il = words.length; i < il; i++) {\n var word_found = false\n for (var j = 0, jl = columns.length; j < jl; j++) {\n var values = item.values(),\n column = columns[j]\n if (values.hasOwnProperty(column) && values[column] !== undefined && values[column] !== null) {\n var text = typeof values[column] !== 'string' ? values[column].toString() : values[column]\n if (text.toLowerCase().indexOf(words[i]) !== -1) {\n // word found, so no need to check it against any other columns\n word_found = true\n break\n }\n }\n }\n // this word not found? no need to check any other words, the item cannot match\n if (!word_found) break\n }\n item.found = word_found\n }\n },\n // Removed search.item() and search.values()\n reset: function () {\n list.reset.search()\n list.searched = false\n },\n }\n\n var searchMethod = function (str) {\n list.trigger('searchStart')\n\n prepare.resetList()\n prepare.setSearchString(str)\n prepare.setOptions(arguments) // str, cols|searchFunction, searchFunction\n prepare.setColumns()\n\n if (searchString === '') {\n search.reset()\n } else {\n list.searched = true\n if (customSearch) {\n customSearch(searchString, columns)\n } else {\n search.list()\n }\n }\n\n list.update()\n list.trigger('searchComplete')\n return list.visibleItems\n }\n\n list.handlers.searchStart = list.handlers.searchStart || []\n list.handlers.searchComplete = list.handlers.searchComplete || []\n\n list.utils.events.bind(\n list.utils.getByClass(list.listContainer, list.searchClass),\n 'keyup',\n list.utils.events.debounce(function (e) {\n var target = e.target || e.srcElement, // IE have srcElement\n alreadyCleared = target.value === '' && !list.searched\n if (!alreadyCleared) {\n // If oninput already have resetted the list, do nothing\n searchMethod(target.value)\n }\n }, list.searchDelay)\n )\n\n // Used to detect click on HTML5 clear button\n list.utils.events.bind(list.utils.getByClass(list.listContainer, list.searchClass), 'input', function (e) {\n var target = e.target || e.srcElement\n if (target.value === '') {\n searchMethod('')\n }\n })\n\n return searchMethod\n}\n","module.exports = function (list) {\n var buttons = {\n els: undefined,\n clear: function () {\n for (var i = 0, il = buttons.els.length; i < il; i++) {\n list.utils.classes(buttons.els[i]).remove('asc')\n list.utils.classes(buttons.els[i]).remove('desc')\n }\n },\n getOrder: function (btn) {\n var predefinedOrder = list.utils.getAttribute(btn, 'data-order')\n if (predefinedOrder == 'asc' || predefinedOrder == 'desc') {\n return predefinedOrder\n } else if (list.utils.classes(btn).has('desc')) {\n return 'asc'\n } else if (list.utils.classes(btn).has('asc')) {\n return 'desc'\n } else {\n return 'asc'\n }\n },\n getInSensitive: function (btn, options) {\n var insensitive = list.utils.getAttribute(btn, 'data-insensitive')\n if (insensitive === 'false') {\n options.insensitive = false\n } else {\n options.insensitive = true\n }\n },\n setOrder: function (options) {\n for (var i = 0, il = buttons.els.length; i < il; i++) {\n var btn = buttons.els[i]\n if (list.utils.getAttribute(btn, 'data-sort') !== options.valueName) {\n continue\n }\n var predefinedOrder = list.utils.getAttribute(btn, 'data-order')\n if (predefinedOrder == 'asc' || predefinedOrder == 'desc') {\n if (predefinedOrder == options.order) {\n list.utils.classes(btn).add(options.order)\n }\n } else {\n list.utils.classes(btn).add(options.order)\n }\n }\n },\n }\n\n var sort = function () {\n list.trigger('sortStart')\n var options = {}\n\n var target = arguments[0].currentTarget || arguments[0].srcElement || undefined\n\n if (target) {\n options.valueName = list.utils.getAttribute(target, 'data-sort')\n buttons.getInSensitive(target, options)\n options.order = buttons.getOrder(target)\n } else {\n options = arguments[1] || options\n options.valueName = arguments[0]\n options.order = options.order || 'asc'\n options.insensitive = typeof options.insensitive == 'undefined' ? true : options.insensitive\n }\n\n buttons.clear()\n buttons.setOrder(options)\n\n // caseInsensitive\n // alphabet\n var customSortFunction = options.sortFunction || list.sortFunction || null,\n multi = options.order === 'desc' ? -1 : 1,\n sortFunction\n\n if (customSortFunction) {\n sortFunction = function (itemA, itemB) {\n return customSortFunction(itemA, itemB, options) * multi\n }\n } else {\n sortFunction = function (itemA, itemB) {\n var sort = list.utils.naturalSort\n sort.alphabet = list.alphabet || options.alphabet || undefined\n if (!sort.alphabet && options.insensitive) {\n sort = list.utils.naturalSort.caseInsensitive\n }\n return sort(itemA.values()[options.valueName], itemB.values()[options.valueName]) * multi\n }\n }\n\n list.items.sort(sortFunction)\n list.update()\n list.trigger('sortComplete')\n }\n\n // Add handlers\n list.handlers.sortStart = list.handlers.sortStart || []\n list.handlers.sortComplete = list.handlers.sortComplete || []\n\n buttons.els = list.utils.getByClass(list.listContainer, list.sortClass)\n list.utils.events.bind(buttons.els, 'click', sort)\n list.on('searchStart', buttons.clear)\n list.on('filterStart', buttons.clear)\n\n return sort\n}\n","var Templater = function (list) {\n var createItem,\n templater = this\n\n var init = function () {\n var itemSource\n\n if (typeof list.item === 'function') {\n createItem = function (values) {\n var item = list.item(values)\n return getItemSource(item)\n }\n return\n }\n\n if (typeof list.item === 'string') {\n if (list.item.indexOf('<') === -1) {\n itemSource = document.getElementById(list.item)\n } else {\n itemSource = getItemSource(list.item)\n }\n } else {\n /* If item source does not exists, use the first item in list as\n source for new items */\n itemSource = getFirstListItem()\n }\n\n if (!itemSource) {\n throw new Error(\"The list needs to have at least one item on init otherwise you'll have to add a template.\")\n }\n\n itemSource = createCleanTemplateItem(itemSource, list.valueNames)\n\n createItem = function () {\n return itemSource.cloneNode(true)\n }\n }\n\n var createCleanTemplateItem = function (templateNode, valueNames) {\n var el = templateNode.cloneNode(true)\n el.removeAttribute('id')\n\n for (var i = 0, il = valueNames.length; i < il; i++) {\n var elm = undefined,\n valueName = valueNames[i]\n if (valueName.data) {\n for (var j = 0, jl = valueName.data.length; j < jl; j++) {\n el.setAttribute('data-' + valueName.data[j], '')\n }\n } else if (valueName.attr && valueName.name) {\n elm = list.utils.getByClass(el, valueName.name, true)\n if (elm) {\n elm.setAttribute(valueName.attr, '')\n }\n } else {\n elm = list.utils.getByClass(el, valueName, true)\n if (elm) {\n elm.innerHTML = ''\n }\n }\n }\n return el\n }\n\n var getFirstListItem = function () {\n var nodes = list.list.childNodes\n\n for (var i = 0, il = nodes.length; i < il; i++) {\n // Only textnodes have a data attribute\n if (nodes[i].data === undefined) {\n return nodes[i].cloneNode(true)\n }\n }\n return undefined\n }\n\n var getItemSource = function (itemHTML) {\n if (typeof itemHTML !== 'string') return undefined\n if (/]/g.exec(itemHTML)) {\n var tbody = document.createElement('tbody')\n tbody.innerHTML = itemHTML\n return tbody.firstElementChild\n } else if (itemHTML.indexOf('<') !== -1) {\n var div = document.createElement('div')\n div.innerHTML = itemHTML\n return div.firstElementChild\n }\n return undefined\n }\n\n var getValueName = function (name) {\n for (var i = 0, il = list.valueNames.length; i < il; i++) {\n var valueName = list.valueNames[i]\n if (valueName.data) {\n var data = valueName.data\n for (var j = 0, jl = data.length; j < jl; j++) {\n if (data[j] === name) {\n return { data: name }\n }\n }\n } else if (valueName.attr && valueName.name && valueName.name == name) {\n return valueName\n } else if (valueName === name) {\n return name\n }\n }\n }\n\n var setValue = function (item, name, value) {\n var elm = undefined,\n valueName = getValueName(name)\n if (!valueName) return\n if (valueName.data) {\n item.elm.setAttribute('data-' + valueName.data, value)\n } else if (valueName.attr && valueName.name) {\n elm = list.utils.getByClass(item.elm, valueName.name, true)\n if (elm) {\n elm.setAttribute(valueName.attr, value)\n }\n } else {\n elm = list.utils.getByClass(item.elm, valueName, true)\n if (elm) {\n elm.innerHTML = value\n }\n }\n }\n\n this.get = function (item, valueNames) {\n templater.create(item)\n var values = {}\n for (var i = 0, il = valueNames.length; i < il; i++) {\n var elm = undefined,\n valueName = valueNames[i]\n if (valueName.data) {\n for (var j = 0, jl = valueName.data.length; j < jl; j++) {\n values[valueName.data[j]] = list.utils.getAttribute(item.elm, 'data-' + valueName.data[j])\n }\n } else if (valueName.attr && valueName.name) {\n elm = list.utils.getByClass(item.elm, valueName.name, true)\n values[valueName.name] = elm ? list.utils.getAttribute(elm, valueName.attr) : ''\n } else {\n elm = list.utils.getByClass(item.elm, valueName, true)\n values[valueName] = elm ? elm.innerHTML : ''\n }\n }\n return values\n }\n\n this.set = function (item, values) {\n if (!templater.create(item)) {\n for (var v in values) {\n if (values.hasOwnProperty(v)) {\n setValue(item, v, values[v])\n }\n }\n }\n }\n\n this.create = function (item) {\n if (item.elm !== undefined) {\n return false\n }\n item.elm = createItem(item.values())\n templater.set(item, item.values())\n return true\n }\n this.remove = function (item) {\n if (item.elm.parentNode === list.list) {\n list.list.removeChild(item.elm)\n }\n }\n this.show = function (item) {\n templater.create(item)\n list.list.appendChild(item.elm)\n }\n this.hide = function (item) {\n if (item.elm !== undefined && item.elm.parentNode === list.list) {\n list.list.removeChild(item.elm)\n }\n }\n this.clear = function () {\n /* .innerHTML = ''; fucks up IE */\n if (list.list.hasChildNodes()) {\n while (list.list.childNodes.length >= 1) {\n list.list.removeChild(list.list.firstChild)\n }\n }\n }\n\n init()\n}\n\nmodule.exports = function (list) {\n return new Templater(list)\n}\n","/**\n * Module dependencies.\n */\n\nvar index = require('./index-of')\n\n/**\n * Whitespace regexp.\n */\n\nvar re = /\\s+/\n\n/**\n * toString reference.\n */\n\nvar toString = Object.prototype.toString\n\n/**\n * Wrap `el` in a `ClassList`.\n *\n * @param {Element} el\n * @return {ClassList}\n * @api public\n */\n\nmodule.exports = function (el) {\n return new ClassList(el)\n}\n\n/**\n * Initialize a new ClassList for `el`.\n *\n * @param {Element} el\n * @api private\n */\n\nfunction ClassList(el) {\n if (!el || !el.nodeType) {\n throw new Error('A DOM element reference is required')\n }\n this.el = el\n this.list = el.classList\n}\n\n/**\n * Add class `name` if not already present.\n *\n * @param {String} name\n * @return {ClassList}\n * @api public\n */\n\nClassList.prototype.add = function (name) {\n // classList\n if (this.list) {\n this.list.add(name)\n return this\n }\n\n // fallback\n var arr = this.array()\n var i = index(arr, name)\n if (!~i) arr.push(name)\n this.el.className = arr.join(' ')\n return this\n}\n\n/**\n * Remove class `name` when present, or\n * pass a regular expression to remove\n * any which match.\n *\n * @param {String|RegExp} name\n * @return {ClassList}\n * @api public\n */\n\nClassList.prototype.remove = function (name) {\n // classList\n if (this.list) {\n this.list.remove(name)\n return this\n }\n\n // fallback\n var arr = this.array()\n var i = index(arr, name)\n if (~i) arr.splice(i, 1)\n this.el.className = arr.join(' ')\n return this\n}\n\n/**\n * Toggle class `name`, can force state via `force`.\n *\n * For browsers that support classList, but do not support `force` yet,\n * the mistake will be detected and corrected.\n *\n * @param {String} name\n * @param {Boolean} force\n * @return {ClassList}\n * @api public\n */\n\nClassList.prototype.toggle = function (name, force) {\n // classList\n if (this.list) {\n if ('undefined' !== typeof force) {\n if (force !== this.list.toggle(name, force)) {\n this.list.toggle(name) // toggle again to correct\n }\n } else {\n this.list.toggle(name)\n }\n return this\n }\n\n // fallback\n if ('undefined' !== typeof force) {\n if (!force) {\n this.remove(name)\n } else {\n this.add(name)\n }\n } else {\n if (this.has(name)) {\n this.remove(name)\n } else {\n this.add(name)\n }\n }\n\n return this\n}\n\n/**\n * Return an array of classes.\n *\n * @return {Array}\n * @api public\n */\n\nClassList.prototype.array = function () {\n var className = this.el.getAttribute('class') || ''\n var str = className.replace(/^\\s+|\\s+$/g, '')\n var arr = str.split(re)\n if ('' === arr[0]) arr.shift()\n return arr\n}\n\n/**\n * Check if class `name` is present.\n *\n * @param {String} name\n * @return {ClassList}\n * @api public\n */\n\nClassList.prototype.has = ClassList.prototype.contains = function (name) {\n return this.list ? this.list.contains(name) : !!~index(this.array(), name)\n}\n","var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',\n unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',\n prefix = bind !== 'addEventListener' ? 'on' : '',\n toArray = require('./to-array')\n\n/**\n * Bind `el` event `type` to `fn`.\n *\n * @param {Element} el, NodeList, HTMLCollection or Array\n * @param {String} type\n * @param {Function} fn\n * @param {Boolean} capture\n * @api public\n */\n\nexports.bind = function (el, type, fn, capture) {\n el = toArray(el)\n for (var i = 0, il = el.length; i < il; i++) {\n el[i][bind](prefix + type, fn, capture || false)\n }\n}\n\n/**\n * Unbind `el` event `type`'s callback `fn`.\n *\n * @param {Element} el, NodeList, HTMLCollection or Array\n * @param {String} type\n * @param {Function} fn\n * @param {Boolean} capture\n * @api public\n */\n\nexports.unbind = function (el, type, fn, capture) {\n el = toArray(el)\n for (var i = 0, il = el.length; i < il; i++) {\n el[i][unbind](prefix + type, fn, capture || false)\n }\n}\n\n/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * `wait` milliseconds. If `immediate` is true, trigger the function on the\n * leading edge, instead of the trailing.\n *\n * @param {Function} fn\n * @param {Integer} wait\n * @param {Boolean} immediate\n * @api public\n */\n\nexports.debounce = function (fn, wait, immediate) {\n var timeout\n return wait\n ? function () {\n var context = this,\n args = arguments\n var later = function () {\n timeout = null\n if (!immediate) fn.apply(context, args)\n }\n var callNow = immediate && !timeout\n clearTimeout(timeout)\n timeout = setTimeout(later, wait)\n if (callNow) fn.apply(context, args)\n }\n : fn\n}\n","/*\n * Source: https://github.com/segmentio/extend\n */\n\nmodule.exports = function extend(object) {\n // Takes an unlimited number of extenders.\n var args = Array.prototype.slice.call(arguments, 1)\n\n // For each extender, copy their properties on our object.\n for (var i = 0, source; (source = args[i]); i++) {\n if (!source) continue\n for (var property in source) {\n object[property] = source[property]\n }\n }\n\n return object\n}\n","module.exports = function (text, pattern, options) {\n // Aproximately where in the text is the pattern expected to be found?\n var Match_Location = options.location || 0\n\n //Determines how close the match must be to the fuzzy location (specified above). An exact letter match which is 'distance' characters away from the fuzzy location would score as a complete mismatch. A distance of '0' requires the match be at the exact location specified, a threshold of '1000' would require a perfect match to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.\n var Match_Distance = options.distance || 100\n\n // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match (of both letters and location), a threshold of '1.0' would match anything.\n var Match_Threshold = options.threshold || 0.4\n\n if (pattern === text) return true // Exact match\n if (pattern.length > 32) return false // This algorithm cannot be used\n\n // Set starting location at beginning text and initialise the alphabet.\n var loc = Match_Location,\n s = (function () {\n var q = {},\n i\n\n for (i = 0; i < pattern.length; i++) {\n q[pattern.charAt(i)] = 0\n }\n\n for (i = 0; i < pattern.length; i++) {\n q[pattern.charAt(i)] |= 1 << (pattern.length - i - 1)\n }\n\n return q\n })()\n\n // Compute and return the score for a match with e errors and x location.\n // Accesses loc and pattern through being a closure.\n\n function match_bitapScore_(e, x) {\n var accuracy = e / pattern.length,\n proximity = Math.abs(loc - x)\n\n if (!Match_Distance) {\n // Dodge divide by zero error.\n return proximity ? 1.0 : accuracy\n }\n return accuracy + proximity / Match_Distance\n }\n\n var score_threshold = Match_Threshold, // Highest score beyond which we give up.\n best_loc = text.indexOf(pattern, loc) // Is there a nearby exact match? (speedup)\n\n if (best_loc != -1) {\n score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold)\n // What about in the other direction? (speedup)\n best_loc = text.lastIndexOf(pattern, loc + pattern.length)\n\n if (best_loc != -1) {\n score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold)\n }\n }\n\n // Initialise the bit arrays.\n var matchmask = 1 << (pattern.length - 1)\n best_loc = -1\n\n var bin_min, bin_mid\n var bin_max = pattern.length + text.length\n var last_rd\n for (var d = 0; d < pattern.length; d++) {\n // Scan for the best match; each iteration allows for one more error.\n // Run a binary search to determine how far from 'loc' we can stray at this\n // error level.\n bin_min = 0\n bin_mid = bin_max\n while (bin_min < bin_mid) {\n if (match_bitapScore_(d, loc + bin_mid) <= score_threshold) {\n bin_min = bin_mid\n } else {\n bin_max = bin_mid\n }\n bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min)\n }\n // Use the result from this iteration as the maximum for the next.\n bin_max = bin_mid\n var start = Math.max(1, loc - bin_mid + 1)\n var finish = Math.min(loc + bin_mid, text.length) + pattern.length\n\n var rd = Array(finish + 2)\n rd[finish + 1] = (1 << d) - 1\n for (var j = finish; j >= start; j--) {\n // The alphabet (s) is a sparse hash, so the following line generates\n // warnings.\n var charMatch = s[text.charAt(j - 1)]\n if (d === 0) {\n // First pass: exact match.\n rd[j] = ((rd[j + 1] << 1) | 1) & charMatch\n } else {\n // Subsequent passes: fuzzy match.\n rd[j] = (((rd[j + 1] << 1) | 1) & charMatch) | (((last_rd[j + 1] | last_rd[j]) << 1) | 1) | last_rd[j + 1]\n }\n if (rd[j] & matchmask) {\n var score = match_bitapScore_(d, j - 1)\n // This match will almost certainly be better than any existing match.\n // But check anyway.\n if (score <= score_threshold) {\n // Told you so.\n score_threshold = score\n best_loc = j - 1\n if (best_loc > loc) {\n // When passing loc, don't exceed our current distance from loc.\n start = Math.max(1, 2 * loc - best_loc)\n } else {\n // Already passed loc, downhill from here on in.\n break\n }\n }\n }\n }\n // No hope for a (better) match at greater error levels.\n if (match_bitapScore_(d + 1, loc) > score_threshold) {\n break\n }\n last_rd = rd\n }\n\n return best_loc < 0 ? false : true\n}\n","/**\n * A cross-browser implementation of getAttribute.\n * Source found here: http://stackoverflow.com/a/3755343/361337 written by Vivin Paliath\n *\n * Return the value for `attr` at `element`.\n *\n * @param {Element} el\n * @param {String} attr\n * @api public\n */\n\nmodule.exports = function (el, attr) {\n var result = (el.getAttribute && el.getAttribute(attr)) || null\n if (!result) {\n var attrs = el.attributes\n var length = attrs.length\n for (var i = 0; i < length; i++) {\n if (attrs[i] !== undefined) {\n if (attrs[i].nodeName === attr) {\n result = attrs[i].nodeValue\n }\n }\n }\n }\n return result\n}\n","/**\n * A cross-browser implementation of getElementsByClass.\n * Heavily based on Dustin Diaz's function: http://dustindiaz.com/getelementsbyclass.\n *\n * Find all elements with class `className` inside `container`.\n * Use `single = true` to increase performance in older browsers\n * when only one element is needed.\n *\n * @param {String} className\n * @param {Element} container\n * @param {Boolean} single\n * @api public\n */\n\nvar getElementsByClassName = function (container, className, single) {\n if (single) {\n return container.getElementsByClassName(className)[0]\n } else {\n return container.getElementsByClassName(className)\n }\n}\n\nvar querySelector = function (container, className, single) {\n className = '.' + className\n if (single) {\n return container.querySelector(className)\n } else {\n return container.querySelectorAll(className)\n }\n}\n\nvar polyfill = function (container, className, single) {\n var classElements = [],\n tag = '*'\n\n var els = container.getElementsByTagName(tag)\n var elsLen = els.length\n var pattern = new RegExp('(^|\\\\s)' + className + '(\\\\s|$)')\n for (var i = 0, j = 0; i < elsLen; i++) {\n if (pattern.test(els[i].className)) {\n if (single) {\n return els[i]\n } else {\n classElements[j] = els[i]\n j++\n }\n }\n }\n return classElements\n}\n\nmodule.exports = (function () {\n return function (container, className, single, options) {\n options = options || {}\n if ((options.test && options.getElementsByClassName) || (!options.test && document.getElementsByClassName)) {\n return getElementsByClassName(container, className, single)\n } else if ((options.test && options.querySelector) || (!options.test && document.querySelector)) {\n return querySelector(container, className, single)\n } else {\n return polyfill(container, className, single)\n }\n }\n})()\n","var indexOf = [].indexOf\n\nmodule.exports = function(arr, obj){\n if (indexOf) return arr.indexOf(obj);\n for (var i = 0, il = arr.length; i < il; ++i) {\n if (arr[i] === obj) return i;\n }\n return -1\n}\n","/**\n * Source: https://github.com/timoxley/to-array\n *\n * Convert an array-like object into an `Array`.\n * If `collection` is already an `Array`, then will return a clone of `collection`.\n *\n * @param {Array | Mixed} collection An `Array` or array-like object to convert e.g. `arguments` or `NodeList`\n * @return {Array} Naive conversion of `collection` to a new `Array`.\n * @api public\n */\n\nmodule.exports = function toArray(collection) {\n if (typeof collection === 'undefined') return []\n if (collection === null) return [null]\n if (collection === window) return [window]\n if (typeof collection === 'string') return [collection]\n if (isArray(collection)) return collection\n if (typeof collection.length != 'number') return [collection]\n if (typeof collection === 'function' && collection instanceof Function) return [collection]\n\n var arr = [];\n for (var i = 0, il = collection.length; i < il; i++) {\n if (Object.prototype.hasOwnProperty.call(collection, i) || i in collection) {\n arr.push(collection[i])\n }\n }\n if (!arr.length) return []\n return arr\n}\n\nfunction isArray(arr) {\n return Object.prototype.toString.call(arr) === '[object Array]'\n}\n","module.exports = function (s) {\n s = s === undefined ? '' : s\n s = s === null ? '' : s\n s = s.toString()\n return s\n}\n","'use strict';\n\nvar alphabet;\nvar alphabetIndexMap;\nvar alphabetIndexMapLength = 0;\n\nfunction isNumberCode(code) {\n return code >= 48 && code <= 57;\n}\n\nfunction naturalCompare(a, b) {\n var lengthA = (a += '').length;\n var lengthB = (b += '').length;\n var aIndex = 0;\n var bIndex = 0;\n\n while (aIndex < lengthA && bIndex < lengthB) {\n var charCodeA = a.charCodeAt(aIndex);\n var charCodeB = b.charCodeAt(bIndex);\n\n if (isNumberCode(charCodeA)) {\n if (!isNumberCode(charCodeB)) {\n return charCodeA - charCodeB;\n }\n\n var numStartA = aIndex;\n var numStartB = bIndex;\n\n while (charCodeA === 48 && ++numStartA < lengthA) {\n charCodeA = a.charCodeAt(numStartA);\n }\n while (charCodeB === 48 && ++numStartB < lengthB) {\n charCodeB = b.charCodeAt(numStartB);\n }\n\n var numEndA = numStartA;\n var numEndB = numStartB;\n\n while (numEndA < lengthA && isNumberCode(a.charCodeAt(numEndA))) {\n ++numEndA;\n }\n while (numEndB < lengthB && isNumberCode(b.charCodeAt(numEndB))) {\n ++numEndB;\n }\n\n var difference = numEndA - numStartA - numEndB + numStartB; // numA length - numB length\n if (difference) {\n return difference;\n }\n\n while (numStartA < numEndA) {\n difference = a.charCodeAt(numStartA++) - b.charCodeAt(numStartB++);\n if (difference) {\n return difference;\n }\n }\n\n aIndex = numEndA;\n bIndex = numEndB;\n continue;\n }\n\n if (charCodeA !== charCodeB) {\n if (\n charCodeA < alphabetIndexMapLength &&\n charCodeB < alphabetIndexMapLength &&\n alphabetIndexMap[charCodeA] !== -1 &&\n alphabetIndexMap[charCodeB] !== -1\n ) {\n return alphabetIndexMap[charCodeA] - alphabetIndexMap[charCodeB];\n }\n\n return charCodeA - charCodeB;\n }\n\n ++aIndex;\n ++bIndex;\n }\n\n if (aIndex >= lengthA && bIndex < lengthB && lengthA >= lengthB) {\n return -1;\n }\n\n if (bIndex >= lengthB && aIndex < lengthA && lengthB >= lengthA) {\n return 1;\n }\n\n return lengthA - lengthB;\n}\n\nnaturalCompare.caseInsensitive = naturalCompare.i = function(a, b) {\n return naturalCompare(('' + a).toLowerCase(), ('' + b).toLowerCase());\n};\n\nObject.defineProperties(naturalCompare, {\n alphabet: {\n get: function() {\n return alphabet;\n },\n\n set: function(value) {\n alphabet = value;\n alphabetIndexMap = [];\n\n var i = 0;\n\n if (alphabet) {\n for (; i < alphabet.length; i++) {\n alphabetIndexMap[alphabet.charCodeAt(i)] = i;\n }\n }\n\n alphabetIndexMapLength = alphabetIndexMap.length;\n\n for (i = 0; i < alphabetIndexMapLength; i++) {\n if (alphabetIndexMap[i] === undefined) {\n alphabetIndexMap[i] = -1;\n }\n }\n },\n },\n});\n\nmodule.exports = naturalCompare;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/index.js\");\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;A;;;;;;;;;;;AChBA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;AC5BA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAMA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AALA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAjCA;AAoCA;AAIA;AACA;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;ACtEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AASA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AAYA;AAEA;AACA;AAAA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AA1EA;AA6EA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AADA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AADA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AADA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AADA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AADA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAhBA;AACA;AAkBA;AACA;AAAA;AAGA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;ACvQA;AACA;AACA;AAEA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;AC5DA;AAAA;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA;AACA;AACA;AAAA;AACA;AACA;AAGA;AACA;AACA;AACA;AAFA;AACA;AAGA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAFA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA5BA;AA+BA;AACA;AACA;AACA;AACA;AACA;AACA;AALA;AAQA;AACA;AAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;AC5GA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;AC9CA;AACA;AAEA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AApCA;AAsCA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AA1CA;AACA;AA4CA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;ACxIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3CA;AACA;AA6CA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAAA;AAAA;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;A;;;;;;;;;;;ACxGA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;ACnMA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;A;;;;;;;;;;;;;;AClKA;AAAA;AAAA;AAAA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;A;;;;;;;;;;;ACpEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;AClBA;AACA;AACA;AACA;AAEA;AACA;AAEA;AAEA;AACA;AAAA;AAEA;AACA;AAAA;AAAA;AAEA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AAAA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AAEA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;AC3HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;A;;;;;;;;;;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAGA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;AC/DA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AAAA;AACA;AACA;A;;;;;;;;;;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;;;;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;;;AC7HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;;A","sourceRoot":""} \ No newline at end of file diff --git a/dist/list.min.js b/dist/list.min.js index bcc8d465..81318815 100644 --- a/dist/list.min.js +++ b/dist/list.min.js @@ -1,2 +1,2 @@ -var List;List=function(){var t={"./src/add-async.js":function(t){t.exports=function(t){return function e(r,s,n){var i=r.splice(0,50);n=(n=n||[]).concat(t.add(i)),r.length>0?setTimeout((function(){e(r,s,n)}),1):(t.update(),s(n))}}},"./src/filter.js":function(t){t.exports=function(t){return t.handlers.filterStart=t.handlers.filterStart||[],t.handlers.filterComplete=t.handlers.filterComplete||[],function(e){if(t.trigger("filterStart"),t.i=1,t.reset.filter(),void 0===e)t.filtered=!1;else{t.filtered=!0;for(var r=t.items,s=0,n=r.length;sv.page,a=new g(t[n],void 0,s),v.items.push(a),r.push(a)}return v.update(),r}m(t.slice(0),e)}},this.show=function(t,e){return this.i=t,this.page=e,v.update(),v},this.remove=function(t,e,r){for(var s=0,n=0,i=v.items.length;n-1&&r.splice(s,1),v},this.trigger=function(t){for(var e=v.handlers[t].length;e--;)v.handlers[t][e](v);return v},this.reset={filter:function(){for(var t=v.items,e=t.length;e--;)t[e].filtered=!1;return v},search:function(){for(var t=v.items,e=t.length;e--;)t[e].found=!1;return v}},this.update=function(){var t=v.items,e=t.length;v.visibleItems=[],v.matchingItems=[],v.templater.clear();for(var r=0;r=v.i&&v.visibleItems.lengthe},innerWindow:function(t,e,r){return t>=e-r&&t<=e+r},dotted:function(t,e,r,s,n,i,a){return this.dottedLeft(t,e,r,s,n,i)||this.dottedRight(t,e,r,s,n,i,a)},dottedLeft:function(t,e,r,s,n,i){return e==r+1&&!this.innerWindow(e,n,i)&&!this.right(e,s)},dottedRight:function(t,e,r,s,n,i,a){return!t.items[a-1].values().dotted&&(e==s&&!this.innerWindow(e,n,i)&&!this.right(e,s))}};return function(e){var s=new i(t.listContainer.id,{listClass:e.paginationClass||"pagination",item:e.item||"
  • ",valueNames:["page","dotted"],searchClass:"pagination-search-that-is-not-supposed-to-exist",sortClass:"pagination-sort-that-is-not-supposed-to-exist"});n.bind(s.listContainer,"click",(function(e){var r=e.target||e.srcElement,s=t.utils.getAttribute(r,"data-page"),n=t.utils.getAttribute(r,"data-i");n&&t.show((n-1)*s+1,s)})),t.on("updated",(function(){r(s,e)})),r(s,e)}}},"./src/parse.js":function(t,e,r){t.exports=function(t){var e=r("./src/item.js")(t),s=function(r,s){for(var n=0,i=r.length;n0?setTimeout((function(){e(r,n)}),1):(t.update(),t.trigger("parseComplete"))};return t.handlers.parseComplete=t.handlers.parseComplete||[],function(){var e=function(t){for(var e=t.childNodes,r=[],s=0,n=e.length;s-1))},reset:function(){t.reset.search(),t.searched=!1}},o=function(e){return t.trigger("searchStart"),i.resetList(),i.setSearchString(e),i.setOptions(arguments),i.setColumns(),""===s?a.reset():(t.searched=!0,n?n(s,r):a.list()),t.update(),t.trigger("searchComplete"),t.visibleItems};return t.handlers.searchStart=t.handlers.searchStart||[],t.handlers.searchComplete=t.handlers.searchComplete||[],t.utils.events.bind(t.utils.getByClass(t.listContainer,t.searchClass),"keyup",(function(e){var r=e.target||e.srcElement;""===r.value&&!t.searched||o(r.value)})),t.utils.events.bind(t.utils.getByClass(t.listContainer,t.searchClass),"input",(function(t){""===(t.target||t.srcElement).value&&o("")})),o}},"./src/sort.js":function(t){t.exports=function(t){var e={els:void 0,clear:function(){for(var r=0,s=e.els.length;r]/g.exec(t)){var e=document.createElement("tbody");return e.innerHTML=t,e.firstElementChild}if(-1!==t.indexOf("<")){var r=document.createElement("div");return r.innerHTML=t,r.firstElementChild}}},a=function(e,r,s){var n=void 0,i=function(e){for(var r=0,s=t.valueNames.length;r=1;)t.list.removeChild(t.list.firstChild)},function(){var r;if("function"!=typeof t.item){if(!(r="string"==typeof t.item?-1===t.item.indexOf("<")?document.getElementById(t.item):i(t.item):n()))throw new Error("The list needs to have at least one item on init otherwise you'll have to add a template.");r=s(r,t.valueNames),e=function(){return r.cloneNode(!0)}}else e=function(e){var r=t.item(e);return i(r)}}()};t.exports=function(t){return new e(t)}},"./src/utils/classes.js":function(t,e,r){var s=r("./src/utils/index-of.js"),n=/\s+/;Object.prototype.toString;function i(t){if(!t||!t.nodeType)throw new Error("A DOM element reference is required");this.el=t,this.list=t.classList}t.exports=function(t){return new i(t)},i.prototype.add=function(t){if(this.list)return this.list.add(t),this;var e=this.array();return~s(e,t)||e.push(t),this.el.className=e.join(" "),this},i.prototype.remove=function(t){if(this.list)return this.list.remove(t),this;var e=this.array(),r=s(e,t);return~r&&e.splice(r,1),this.el.className=e.join(" "),this},i.prototype.toggle=function(t,e){return this.list?(void 0!==e?e!==this.list.toggle(t,e)&&this.list.toggle(t):this.list.toggle(t),this):(void 0!==e?e?this.add(t):this.remove(t):this.has(t)?this.remove(t):this.add(t),this)},i.prototype.array=function(){var t=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(n);return""===t[0]&&t.shift(),t},i.prototype.has=i.prototype.contains=function(t){return this.list?this.list.contains(t):!!~s(this.array(),t)}},"./src/utils/events.js":function(t,e,r){var s=window.addEventListener?"addEventListener":"attachEvent",n=window.removeEventListener?"removeEventListener":"detachEvent",i="addEventListener"!==s?"on":"",a=r("./src/utils/to-array.js");e.bind=function(t,e,r,n){for(var o=0,l=(t=a(t)).length;o32)return!1;var a=s,o=function(){var t,r={};for(t=0;t=p;b--){var j=o[t.charAt(b-1)];if(C[b]=0===m?(C[b+1]<<1|1)&j:(C[b+1]<<1|1)&j|(v[b+1]|v[b])<<1|1|v[b+1],C[b]&h){var x=l(m,b-1);if(x<=u){if(u=x,!((c=b-1)>a))break;p=Math.max(1,2*a-c)}}}if(l(m+1,a)>u)break;v=C}return!(c<0)}},"./src/utils/get-attribute.js":function(t){t.exports=function(t,e){var r=t.getAttribute&&t.getAttribute(e)||null;if(!r)for(var s=t.attributes,n=s.length,i=0;i=48&&t<=57}function i(t,e){for(var i=(t+="").length,a=(e+="").length,o=0,l=0;o=i&&l=a?-1:l>=a&&o=i?1:i-a}i.caseInsensitive=i.i=function(t,e){return i((""+t).toLowerCase(),(""+e).toLowerCase())},Object.defineProperties(i,{alphabet:{get:function(){return e},set:function(t){r=[];var n=0;if(e=t)for(;n0?setTimeout((function(){e(r,n,s)}),1):(t.update(),n(s))}}},"./src/filter.js":function(t){t.exports=function(t){return t.handlers.filterStart=t.handlers.filterStart||[],t.handlers.filterComplete=t.handlers.filterComplete||[],function(e){if(t.trigger("filterStart"),t.i=1,t.reset.filter(),void 0===e)t.filtered=!1;else{t.filtered=!0;for(var r=t.items,n=0,s=r.length;nv.page,a=new g(t[s],void 0,n),v.items.push(a),r.push(a)}return v.update(),r}m(t.slice(0),e)}},this.show=function(t,e){return this.i=t,this.page=e,v.update(),v},this.remove=function(t,e,r){for(var n=0,s=0,i=v.items.length;s-1&&r.splice(n,1),v},this.trigger=function(t){for(var e=v.handlers[t].length;e--;)v.handlers[t][e](v);return v},this.reset={filter:function(){for(var t=v.items,e=t.length;e--;)t[e].filtered=!1;return v},search:function(){for(var t=v.items,e=t.length;e--;)t[e].found=!1;return v}},this.update=function(){var t=v.items,e=t.length;v.visibleItems=[],v.matchingItems=[],v.templater.clear();for(var r=0;r=v.i&&v.visibleItems.lengthe},innerWindow:function(t,e,r){return t>=e-r&&t<=e+r},dotted:function(t,e,r,n,s,i,a){return this.dottedLeft(t,e,r,n,s,i)||this.dottedRight(t,e,r,n,s,i,a)},dottedLeft:function(t,e,r,n,s,i){return e==r+1&&!this.innerWindow(e,s,i)&&!this.right(e,n)},dottedRight:function(t,e,r,n,s,i,a){return!t.items[a-1].values().dotted&&(e==n&&!this.innerWindow(e,s,i)&&!this.right(e,n))}};return function(e){var n=new i(t.listContainer.id,{listClass:e.paginationClass||"pagination",item:e.item||"
  • ",valueNames:["page","dotted"],searchClass:"pagination-search-that-is-not-supposed-to-exist",sortClass:"pagination-sort-that-is-not-supposed-to-exist"});s.bind(n.listContainer,"click",(function(e){var r=e.target||e.srcElement,n=t.utils.getAttribute(r,"data-page"),s=t.utils.getAttribute(r,"data-i");s&&t.show((s-1)*n+1,n)})),t.on("updated",(function(){r(n,e)})),r(n,e)}}},"./src/parse.js":function(t,e,r){t.exports=function(t){var e=r("./src/item.js")(t),n=function(r,n){for(var s=0,i=r.length;s0?setTimeout((function(){e(r,s)}),1):(t.update(),t.trigger("parseComplete"))};return t.handlers.parseComplete=t.handlers.parseComplete||[],function(){var e=function(t){for(var e=t.childNodes,r=[],n=0,s=e.length;n]/g.exec(t)){var e=document.createElement("tbody");return e.innerHTML=t,e.firstElementChild}if(-1!==t.indexOf("<")){var r=document.createElement("div");return r.innerHTML=t,r.firstElementChild}}},a=function(e,r,n){var s=void 0,i=function(e){for(var r=0,n=t.valueNames.length;r=1;)t.list.removeChild(t.list.firstChild)},function(){var r;if("function"!=typeof t.item){if(!(r="string"==typeof t.item?-1===t.item.indexOf("<")?document.getElementById(t.item):i(t.item):s()))throw new Error("The list needs to have at least one item on init otherwise you'll have to add a template.");r=n(r,t.valueNames),e=function(){return r.cloneNode(!0)}}else e=function(e){var r=t.item(e);return i(r)}}()};t.exports=function(t){return new e(t)}},"./src/utils/classes.js":function(t,e,r){var n=r("./src/utils/index-of.js"),s=/\s+/;Object.prototype.toString;function i(t){if(!t||!t.nodeType)throw new Error("A DOM element reference is required");this.el=t,this.list=t.classList}t.exports=function(t){return new i(t)},i.prototype.add=function(t){if(this.list)return this.list.add(t),this;var e=this.array();return~n(e,t)||e.push(t),this.el.className=e.join(" "),this},i.prototype.remove=function(t){if(this.list)return this.list.remove(t),this;var e=this.array(),r=n(e,t);return~r&&e.splice(r,1),this.el.className=e.join(" "),this},i.prototype.toggle=function(t,e){return this.list?(void 0!==e?e!==this.list.toggle(t,e)&&this.list.toggle(t):this.list.toggle(t),this):(void 0!==e?e?this.add(t):this.remove(t):this.has(t)?this.remove(t):this.add(t),this)},i.prototype.array=function(){var t=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(s);return""===t[0]&&t.shift(),t},i.prototype.has=i.prototype.contains=function(t){return this.list?this.list.contains(t):!!~n(this.array(),t)}},"./src/utils/events.js":function(t,e,r){var n=window.addEventListener?"addEventListener":"attachEvent",s=window.removeEventListener?"removeEventListener":"detachEvent",i="addEventListener"!==n?"on":"",a=r("./src/utils/to-array.js");e.bind=function(t,e,r,s){for(var o=0,l=(t=a(t)).length;o32)return!1;var a=n,o=function(){var t,r={};for(t=0;t=p;b--){var j=o[t.charAt(b-1)];if(C[b]=0===m?(C[b+1]<<1|1)&j:(C[b+1]<<1|1)&j|(v[b+1]|v[b])<<1|1|v[b+1],C[b]&d){var x=l(m,b-1);if(x<=u){if(u=x,!((c=b-1)>a))break;p=Math.max(1,2*a-c)}}}if(l(m+1,a)>u)break;v=C}return!(c<0)}},"./src/utils/get-attribute.js":function(t){t.exports=function(t,e){var r=t.getAttribute&&t.getAttribute(e)||null;if(!r)for(var n=t.attributes,s=n.length,i=0;i=48&&t<=57}function i(t,e){for(var i=(t+="").length,a=(e+="").length,o=0,l=0;o=i&&l=a?-1:l>=a&&o=i?1:i-a}i.caseInsensitive=i.i=function(t,e){return i((""+t).toLowerCase(),(""+e).toLowerCase())},Object.defineProperties(i,{alphabet:{get:function(){return e},set:function(t){r=[];var s=0;if(e=t)for(;s 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.3.6) - mini_portile2 (2.4.0) + mini_portile2 (2.5.0) minima (2.5.1) jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) minitest (5.14.2) multipart-post (2.1.1) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) + nokogiri (1.11.1) + mini_portile2 (~> 2.5.0) + racc (~> 1.4) octokit (4.19.0) faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (3.1.1) + racc (1.5.2) rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) diff --git a/docs/_data/pkg.json b/docs/_data/pkg.json index ddf8dadb..f09bd26e 100644 --- a/docs/_data/pkg.json +++ b/docs/_data/pkg.json @@ -1,6 +1,6 @@ { "name": "list.js", - "version": "2.1.0", + "version": "2.3.1", "description": "The perfect library for lists. Supports search, sort, filters and flexibility. Built to be invisible and work on existing HTML", "keywords": [ "list", @@ -37,7 +37,7 @@ }, "main": "src/index", "engines": { - "node": "^14.15.1" + "node": "^6.0 || ^8.0 || ^10.0 || ^12.0 || >=14" }, "scripts": { "test": "npx jest", diff --git a/docs/api.html b/docs/api.html index ee045f4a..6359a826 100755 --- a/docs/api.html +++ b/docs/api.html @@ -211,7 +211,7 @@

    Methods

    • -

      add(values, callback)
      +

      add(values, prepend=false, callback)
      Adds one or more items to the list.

      listObj.add({ name: "Jonny", city: "Stockholm" });
      @@ -224,7 +224,8 @@ 

      Methods

      If callback is set then items are added to the list in a asynchronous way, and the callback is called when all items are added. This is especially useful when adding very many items (200+ or something), or if you just like the - asynchronous coding style.

      + asynchronous coding style. The prepend option can be used to + prepend items (default is append).

      listObj.add(arrayWithManyManyItems, function(items) {
       console.log('All ' + items.length + ' were added!');
      diff --git a/docs/assets/javascripts/list.min.js b/docs/assets/javascripts/list.min.js
      index bcc8d465..81318815 100644
      --- a/docs/assets/javascripts/list.min.js
      +++ b/docs/assets/javascripts/list.min.js
      @@ -1,2 +1,2 @@
      -var List;List=function(){var t={"./src/add-async.js":function(t){t.exports=function(t){return function e(r,s,n){var i=r.splice(0,50);n=(n=n||[]).concat(t.add(i)),r.length>0?setTimeout((function(){e(r,s,n)}),1):(t.update(),s(n))}}},"./src/filter.js":function(t){t.exports=function(t){return t.handlers.filterStart=t.handlers.filterStart||[],t.handlers.filterComplete=t.handlers.filterComplete||[],function(e){if(t.trigger("filterStart"),t.i=1,t.reset.filter(),void 0===e)t.filtered=!1;else{t.filtered=!0;for(var r=t.items,s=0,n=r.length;sv.page,a=new g(t[n],void 0,s),v.items.push(a),r.push(a)}return v.update(),r}m(t.slice(0),e)}},this.show=function(t,e){return this.i=t,this.page=e,v.update(),v},this.remove=function(t,e,r){for(var s=0,n=0,i=v.items.length;n-1&&r.splice(s,1),v},this.trigger=function(t){for(var e=v.handlers[t].length;e--;)v.handlers[t][e](v);return v},this.reset={filter:function(){for(var t=v.items,e=t.length;e--;)t[e].filtered=!1;return v},search:function(){for(var t=v.items,e=t.length;e--;)t[e].found=!1;return v}},this.update=function(){var t=v.items,e=t.length;v.visibleItems=[],v.matchingItems=[],v.templater.clear();for(var r=0;r=v.i&&v.visibleItems.lengthe},innerWindow:function(t,e,r){return t>=e-r&&t<=e+r},dotted:function(t,e,r,s,n,i,a){return this.dottedLeft(t,e,r,s,n,i)||this.dottedRight(t,e,r,s,n,i,a)},dottedLeft:function(t,e,r,s,n,i){return e==r+1&&!this.innerWindow(e,n,i)&&!this.right(e,s)},dottedRight:function(t,e,r,s,n,i,a){return!t.items[a-1].values().dotted&&(e==s&&!this.innerWindow(e,n,i)&&!this.right(e,s))}};return function(e){var s=new i(t.listContainer.id,{listClass:e.paginationClass||"pagination",item:e.item||"
    • ",valueNames:["page","dotted"],searchClass:"pagination-search-that-is-not-supposed-to-exist",sortClass:"pagination-sort-that-is-not-supposed-to-exist"});n.bind(s.listContainer,"click",(function(e){var r=e.target||e.srcElement,s=t.utils.getAttribute(r,"data-page"),n=t.utils.getAttribute(r,"data-i");n&&t.show((n-1)*s+1,s)})),t.on("updated",(function(){r(s,e)})),r(s,e)}}},"./src/parse.js":function(t,e,r){t.exports=function(t){var e=r("./src/item.js")(t),s=function(r,s){for(var n=0,i=r.length;n0?setTimeout((function(){e(r,n)}),1):(t.update(),t.trigger("parseComplete"))};return t.handlers.parseComplete=t.handlers.parseComplete||[],function(){var e=function(t){for(var e=t.childNodes,r=[],s=0,n=e.length;s-1))},reset:function(){t.reset.search(),t.searched=!1}},o=function(e){return t.trigger("searchStart"),i.resetList(),i.setSearchString(e),i.setOptions(arguments),i.setColumns(),""===s?a.reset():(t.searched=!0,n?n(s,r):a.list()),t.update(),t.trigger("searchComplete"),t.visibleItems};return t.handlers.searchStart=t.handlers.searchStart||[],t.handlers.searchComplete=t.handlers.searchComplete||[],t.utils.events.bind(t.utils.getByClass(t.listContainer,t.searchClass),"keyup",(function(e){var r=e.target||e.srcElement;""===r.value&&!t.searched||o(r.value)})),t.utils.events.bind(t.utils.getByClass(t.listContainer,t.searchClass),"input",(function(t){""===(t.target||t.srcElement).value&&o("")})),o}},"./src/sort.js":function(t){t.exports=function(t){var e={els:void 0,clear:function(){for(var r=0,s=e.els.length;r]/g.exec(t)){var e=document.createElement("tbody");return e.innerHTML=t,e.firstElementChild}if(-1!==t.indexOf("<")){var r=document.createElement("div");return r.innerHTML=t,r.firstElementChild}}},a=function(e,r,s){var n=void 0,i=function(e){for(var r=0,s=t.valueNames.length;r=1;)t.list.removeChild(t.list.firstChild)},function(){var r;if("function"!=typeof t.item){if(!(r="string"==typeof t.item?-1===t.item.indexOf("<")?document.getElementById(t.item):i(t.item):n()))throw new Error("The list needs to have at least one item on init otherwise you'll have to add a template.");r=s(r,t.valueNames),e=function(){return r.cloneNode(!0)}}else e=function(e){var r=t.item(e);return i(r)}}()};t.exports=function(t){return new e(t)}},"./src/utils/classes.js":function(t,e,r){var s=r("./src/utils/index-of.js"),n=/\s+/;Object.prototype.toString;function i(t){if(!t||!t.nodeType)throw new Error("A DOM element reference is required");this.el=t,this.list=t.classList}t.exports=function(t){return new i(t)},i.prototype.add=function(t){if(this.list)return this.list.add(t),this;var e=this.array();return~s(e,t)||e.push(t),this.el.className=e.join(" "),this},i.prototype.remove=function(t){if(this.list)return this.list.remove(t),this;var e=this.array(),r=s(e,t);return~r&&e.splice(r,1),this.el.className=e.join(" "),this},i.prototype.toggle=function(t,e){return this.list?(void 0!==e?e!==this.list.toggle(t,e)&&this.list.toggle(t):this.list.toggle(t),this):(void 0!==e?e?this.add(t):this.remove(t):this.has(t)?this.remove(t):this.add(t),this)},i.prototype.array=function(){var t=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(n);return""===t[0]&&t.shift(),t},i.prototype.has=i.prototype.contains=function(t){return this.list?this.list.contains(t):!!~s(this.array(),t)}},"./src/utils/events.js":function(t,e,r){var s=window.addEventListener?"addEventListener":"attachEvent",n=window.removeEventListener?"removeEventListener":"detachEvent",i="addEventListener"!==s?"on":"",a=r("./src/utils/to-array.js");e.bind=function(t,e,r,n){for(var o=0,l=(t=a(t)).length;o32)return!1;var a=s,o=function(){var t,r={};for(t=0;t=p;b--){var j=o[t.charAt(b-1)];if(C[b]=0===m?(C[b+1]<<1|1)&j:(C[b+1]<<1|1)&j|(v[b+1]|v[b])<<1|1|v[b+1],C[b]&h){var x=l(m,b-1);if(x<=u){if(u=x,!((c=b-1)>a))break;p=Math.max(1,2*a-c)}}}if(l(m+1,a)>u)break;v=C}return!(c<0)}},"./src/utils/get-attribute.js":function(t){t.exports=function(t,e){var r=t.getAttribute&&t.getAttribute(e)||null;if(!r)for(var s=t.attributes,n=s.length,i=0;i=48&&t<=57}function i(t,e){for(var i=(t+="").length,a=(e+="").length,o=0,l=0;o=i&&l=a?-1:l>=a&&o=i?1:i-a}i.caseInsensitive=i.i=function(t,e){return i((""+t).toLowerCase(),(""+e).toLowerCase())},Object.defineProperties(i,{alphabet:{get:function(){return e},set:function(t){r=[];var n=0;if(e=t)for(;n0?setTimeout((function(){e(r,n,s)}),1):(t.update(),n(s))}}},"./src/filter.js":function(t){t.exports=function(t){return t.handlers.filterStart=t.handlers.filterStart||[],t.handlers.filterComplete=t.handlers.filterComplete||[],function(e){if(t.trigger("filterStart"),t.i=1,t.reset.filter(),void 0===e)t.filtered=!1;else{t.filtered=!0;for(var r=t.items,n=0,s=r.length;nv.page,a=new g(t[s],void 0,n),v.items.push(a),r.push(a)}return v.update(),r}m(t.slice(0),e)}},this.show=function(t,e){return this.i=t,this.page=e,v.update(),v},this.remove=function(t,e,r){for(var n=0,s=0,i=v.items.length;s-1&&r.splice(n,1),v},this.trigger=function(t){for(var e=v.handlers[t].length;e--;)v.handlers[t][e](v);return v},this.reset={filter:function(){for(var t=v.items,e=t.length;e--;)t[e].filtered=!1;return v},search:function(){for(var t=v.items,e=t.length;e--;)t[e].found=!1;return v}},this.update=function(){var t=v.items,e=t.length;v.visibleItems=[],v.matchingItems=[],v.templater.clear();for(var r=0;r=v.i&&v.visibleItems.lengthe},innerWindow:function(t,e,r){return t>=e-r&&t<=e+r},dotted:function(t,e,r,n,s,i,a){return this.dottedLeft(t,e,r,n,s,i)||this.dottedRight(t,e,r,n,s,i,a)},dottedLeft:function(t,e,r,n,s,i){return e==r+1&&!this.innerWindow(e,s,i)&&!this.right(e,n)},dottedRight:function(t,e,r,n,s,i,a){return!t.items[a-1].values().dotted&&(e==n&&!this.innerWindow(e,s,i)&&!this.right(e,n))}};return function(e){var n=new i(t.listContainer.id,{listClass:e.paginationClass||"pagination",item:e.item||"
    • ",valueNames:["page","dotted"],searchClass:"pagination-search-that-is-not-supposed-to-exist",sortClass:"pagination-sort-that-is-not-supposed-to-exist"});s.bind(n.listContainer,"click",(function(e){var r=e.target||e.srcElement,n=t.utils.getAttribute(r,"data-page"),s=t.utils.getAttribute(r,"data-i");s&&t.show((s-1)*n+1,n)})),t.on("updated",(function(){r(n,e)})),r(n,e)}}},"./src/parse.js":function(t,e,r){t.exports=function(t){var e=r("./src/item.js")(t),n=function(r,n){for(var s=0,i=r.length;s0?setTimeout((function(){e(r,s)}),1):(t.update(),t.trigger("parseComplete"))};return t.handlers.parseComplete=t.handlers.parseComplete||[],function(){var e=function(t){for(var e=t.childNodes,r=[],n=0,s=e.length;n]/g.exec(t)){var e=document.createElement("tbody");return e.innerHTML=t,e.firstElementChild}if(-1!==t.indexOf("<")){var r=document.createElement("div");return r.innerHTML=t,r.firstElementChild}}},a=function(e,r,n){var s=void 0,i=function(e){for(var r=0,n=t.valueNames.length;r=1;)t.list.removeChild(t.list.firstChild)},function(){var r;if("function"!=typeof t.item){if(!(r="string"==typeof t.item?-1===t.item.indexOf("<")?document.getElementById(t.item):i(t.item):s()))throw new Error("The list needs to have at least one item on init otherwise you'll have to add a template.");r=n(r,t.valueNames),e=function(){return r.cloneNode(!0)}}else e=function(e){var r=t.item(e);return i(r)}}()};t.exports=function(t){return new e(t)}},"./src/utils/classes.js":function(t,e,r){var n=r("./src/utils/index-of.js"),s=/\s+/;Object.prototype.toString;function i(t){if(!t||!t.nodeType)throw new Error("A DOM element reference is required");this.el=t,this.list=t.classList}t.exports=function(t){return new i(t)},i.prototype.add=function(t){if(this.list)return this.list.add(t),this;var e=this.array();return~n(e,t)||e.push(t),this.el.className=e.join(" "),this},i.prototype.remove=function(t){if(this.list)return this.list.remove(t),this;var e=this.array(),r=n(e,t);return~r&&e.splice(r,1),this.el.className=e.join(" "),this},i.prototype.toggle=function(t,e){return this.list?(void 0!==e?e!==this.list.toggle(t,e)&&this.list.toggle(t):this.list.toggle(t),this):(void 0!==e?e?this.add(t):this.remove(t):this.has(t)?this.remove(t):this.add(t),this)},i.prototype.array=function(){var t=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(s);return""===t[0]&&t.shift(),t},i.prototype.has=i.prototype.contains=function(t){return this.list?this.list.contains(t):!!~n(this.array(),t)}},"./src/utils/events.js":function(t,e,r){var n=window.addEventListener?"addEventListener":"attachEvent",s=window.removeEventListener?"removeEventListener":"detachEvent",i="addEventListener"!==n?"on":"",a=r("./src/utils/to-array.js");e.bind=function(t,e,r,s){for(var o=0,l=(t=a(t)).length;o32)return!1;var a=n,o=function(){var t,r={};for(t=0;t=p;b--){var j=o[t.charAt(b-1)];if(C[b]=0===m?(C[b+1]<<1|1)&j:(C[b+1]<<1|1)&j|(v[b+1]|v[b])<<1|1|v[b+1],C[b]&d){var x=l(m,b-1);if(x<=u){if(u=x,!((c=b-1)>a))break;p=Math.max(1,2*a-c)}}}if(l(m+1,a)>u)break;v=C}return!(c<0)}},"./src/utils/get-attribute.js":function(t){t.exports=function(t,e){var r=t.getAttribute&&t.getAttribute(e)||null;if(!r)for(var n=t.attributes,s=n.length,i=0;i=48&&t<=57}function i(t,e){for(var i=(t+="").length,a=(e+="").length,o=0,l=0;o=i&&l=a?-1:l>=a&&o=i?1:i-a}i.caseInsensitive=i.i=function(t,e){return i((""+t).toLowerCase(),(""+e).toLowerCase())},Object.defineProperties(i,{alphabet:{get:function(){return e},set:function(t){r=[];var s=0;if(e=t)for(;sFeatures
    • Sort Read more ›
    • Filter Read more ›
    • Simple templating system that adds possibility to add, edit, remove items Read more ›
    • -
    • Plugins "Read more ›
    • +
    • Plugins Read more ›
    • Support for Chrome, Safari, Firefox, IE9+
    diff --git a/package-lock.json b/package-lock.json index fe1950dc..0a2d2923 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "list.js", - "version": "2.1.0", + "version": "2.3.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -3693,8 +3693,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", - "dev": true, - "optional": true + "dev": true }, "har-schema": { "version": "2.0.0", @@ -4042,7 +4041,6 @@ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", "dev": true, - "optional": true, "requires": { "is-docker": "^2.0.0" } @@ -5002,6 +5000,15 @@ "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", "dev": true }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -5192,11 +5199,10 @@ "dev": true }, "node-notifier": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-8.0.0.tgz", - "integrity": "sha512-46z7DUmcjoYdaWyXouuFNNfUo6eFa94t23c53c+lG/9Cvauk4a98rAUp9672X5dxGdQmLpPzTxzu8f/OeEPaFA==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-8.0.1.tgz", + "integrity": "sha512-BvEXF+UmsnAfYfoapKM9nGxnP+Wn7P91YfXmrKnfcYCx6VBeoN5Ez5Ogck6I8Bi5k4RlpqRYaw75pAwzX9OphA==", "dev": true, - "optional": true, "requires": { "growly": "^1.3.0", "is-wsl": "^2.2.0", @@ -5207,18 +5213,19 @@ }, "dependencies": { "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", "dev": true, - "optional": true + "requires": { + "lru-cache": "^6.0.0" + } }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, - "optional": true, "requires": { "isexe": "^2.0.0" } @@ -6215,8 +6222,7 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", - "dev": true, - "optional": true + "dev": true }, "signal-exit": { "version": "3.0.2", @@ -6915,8 +6921,7 @@ "version": "8.3.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.1.tgz", "integrity": "sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg==", - "dev": true, - "optional": true + "dev": true }, "v8-compile-cache": { "version": "2.2.0", @@ -7270,6 +7275,12 @@ "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", "dev": true }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "yargs": { "version": "15.4.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", diff --git a/package.json b/package.json index ddf8dadb..f09bd26e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "list.js", - "version": "2.1.0", + "version": "2.3.1", "description": "The perfect library for lists. Supports search, sort, filters and flexibility. Built to be invisible and work on existing HTML", "keywords": [ "list", @@ -37,7 +37,7 @@ }, "main": "src/index", "engines": { - "node": "^14.15.1" + "node": "^6.0 || ^8.0 || ^10.0 || ^12.0 || >=14" }, "scripts": { "test": "npx jest", diff --git a/src/index.js b/src/index.js index c314855b..ebe38d6c 100755 --- a/src/index.js +++ b/src/index.js @@ -115,7 +115,7 @@ module.exports = function (id, options, values) { /* * Add object to list */ - this.add = function (values, callback) { + this.add = function (values, prepend=false, callback) { if (values.length === 0) { return } @@ -132,8 +132,14 @@ module.exports = function (id, options, values) { var item = null notCreate = self.items.length > self.page ? true : false item = new Item(values[i], undefined, notCreate) - self.items.push(item) - added.push(item) + if (prepend == true) { + self.items.unshift(item) + added.unshift(item) + } else { + self.items.push(item) + added.push(item) + } + } self.update() return added