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

mobius1-selectr

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobius1-selectr - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

2

bower.json
{
"name": "mobius1-selectr",
"version": "2.1.0",
"version": "2.1.1",
"ignore": [

@@ -5,0 +5,0 @@ ".gitattributes",

/*!
* Selectr 2.1.0
* Selectr 2.1.1
* http://mobius.ovh/docs/selectr

@@ -7,2 +7,2 @@ *

*/
!function(a,b){var c="Selectr";"function"==typeof define&&define.amd?define([],b(c)):"object"==typeof exports?module.exports=b(c):a[c]=b(c)}(this,function(a){"use strict";function u(a,b){if(null===a)throw new Error("Selectr requires an element to work.");if(this.el=a,"string"==typeof this.el&&(this.el=document.querySelector(a)),null===this.el)throw new Error("The element you passed to Selectr can not be found.");if("select"!==this.el.nodeName.toLowerCase())throw new Error("The element you passed to Selectr is not a HTMLSelectElement.");if(!this.el.options.length&&!b.data&&!b.taggable)throw new Error("You don't have any options in your select!");this.originalType=this.el.type,this.render(b)}var b={extend:function(a,b){b=b||{};var c;for(c in a)b.hasOwnProperty(c)||(b[c]=a[c]);return b},each:function(a,b,c){if("[object Object]"===Object.prototype.toString.call(a))for(var d in a)Object.prototype.hasOwnProperty.call(a,d)&&b.call(c,d,a[d],a);else for(var e=0,f=a.length;e<f;e++)b.call(c,e,a[e],a)},createElement:function(a,b){var c=document,d=c.createElement(a);if(b&&"object"==typeof b){var e;for(e in b)if("html"===e)d.innerHTML=b[e];else if("text"===e){var f=c.createTextNode(b[e]);d.appendChild(f)}else d.setAttribute(e,b[e])}return d},hasClass:function(a,b){return a.classList?a.classList.contains(b):!!a.className&&!!a.className.match(new RegExp("(\\s|^)"+b+"(\\s|$)"))},addClass:function(a,c){b.hasClass(a,c)||(a.classList?a.classList.add(c):a.className=a.className.trim()+" "+c)},removeClass:function(a,c){b.hasClass(a,c)&&(a.classList?a.classList.remove(c):a.className=a.className.replace(new RegExp("(^|\\s)"+c.split(" ").join("|")+"(\\s|$)","gi")," "))},closest:function(a,c){return a&&a!==document.body&&(c(a)?a:b.closest(a.parentNode,c))},on:function(a,b,c,d){a.addEventListener(b,c,d||!1)},off:function(a,b,c){a.removeEventListener(b,c)},isObject:function(a){return"[object Object]"===Object.prototype.toString.call(a)},isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},isInt:function(a){return!isNaN(a)&&function(a){return(a||0)===a}(parseFloat(a))},debounce:function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)},h=c&&!d;clearTimeout(d),d=setTimeout(g,b),h&&a.apply(e,f)}},getBoundingRect:function(a){var b=window,c=document,d=c.body,e=a.getBoundingClientRect(),f=void 0!==b.pageXOffset?b.pageXOffset:(c.documentElement||d.parentNode||d).scrollLeft,g=void 0!==b.pageYOffset?b.pageYOffset:(c.documentElement||d.parentNode||d).scrollTop;return{bottom:e.bottom+g,height:e.height,left:e.left+f,right:e.right+f,top:e.top+g,width:e.width}},preventDefault:function(a){if(a=a||window.event,a.preventDefault)return a.preventDefault()},includes:function(a,b){return a.indexOf(b)>-1}},c=function(){var a=this.settings,c=this.el.options;if(a.selectedValue){var d=a.selectedValue.toString();b.each(c,function(a,c){b.includes(d,c.value)&&(c.defaultSelected=!0)})}!c[0].defaultSelected&&c[0].selected&&(this.el.selectedIndex=-1)},d=function(){var a=this.settings.width;a&&(b.isInt(a)?a+="px":"auto"===a?a="100%":b.includes(this.settings.width,"%")&&(a=this.settings.width),this.width=a)},e=function(){var a=this,e=a.settings;if(b.addClass(a.el,"hidden-input"),e.data){a.pageIndex=1;var h=e.pagination?e.data.slice(0,e.pagination):e.data,i=!1;b.each(h,function(b,c){var d=c.hasOwnProperty("selected")&&c.selected===!0,e=new Option(c.text,c.value,d,d);c.disabled&&(e.disabled=!0),0===b&&d&&(i=!0),a.el.add(e)}),i||(this.el.selectedIndex=-1),e.pagination&&(this.pages=e.data.map(function(a,b){return b%e.pagination===0?e.data.slice(b,b+e.pagination):null}).filter(function(a){return a}))}c.call(a),a.customOption=e.hasOwnProperty("renderOption")&&"function"==typeof e.renderOption,a.customSelected=e.hasOwnProperty("renderSelection")&&"function"==typeof e.renderSelection,a.container=b.createElement("div",{class:"selectr-container"}),e.customClass&&b.addClass(a.container,e.customClass),d.call(a),this.container.style.width=this.width,a.selected=b.createElement("div",{class:"selectr-selected"}),a.label=b.createElement(a.el.multiple?"ul":"span",{class:"selectr-label"});var j=b.createElement("div",{class:"selectr-options-container"});if(a.optsOptions=b.createElement("ul",{class:"selectr-options"}),a.notice=b.createElement("div",{class:"selectr-notice"}),a.el.multiple&&(b.addClass(a.label,"selectr-tags"),b.addClass(a.container,"multiple"),this.tags=[],this.selectedValues=[],this.selectedIndexes=[]),a.selected.appendChild(a.label),e.clearable&&(a.selectClear=b.createElement("button",{class:"selectr-clear",type:"button"}),a.selected.appendChild(a.selectClear)),e.taggable){var k=b.createElement("li",{class:"input-tag"});a.input=b.createElement("input",{class:"selectr-tag-input",placeholder:"Enter a tag..."}),k.appendChild(a.input),a.label.appendChild(k),b.addClass(a.container,"taggable"),this.tagSeperators=[","],a.settings.tagSeperators&&(this.tagSeperators=this.tagSeperators.concat(a.settings.tagSeperators))}if(e.searchable&&(a.input=b.createElement("input",{class:"selectr-input"}),a.inputClear=b.createElement("button",{class:"selectr-clear",type:"button"}),a.inputContainer=b.createElement("div",{class:"selectr-input-container"}),a.inputContainer.appendChild(a.input),a.inputContainer.appendChild(a.inputClear),j.appendChild(a.inputContainer)),a.hasOptGroups){var l=0;b.addClass(a.optsOptions,"optgroups")}var m=0;b.each(a.el.children,function(c,d){if("OPTGROUP"===d.nodeName){var g=b.createElement("ul",{class:"selectr-optgroup"});g.appendChild(b.createElement("li",{class:"selectr-optgroup--label",text:d.label})),a.optsOptions.appendChild(g),d.children&&b.each(d.children,function(b,c){e.pagination&&e.data&&l>=e.pagination||(f.call(a,l,c,g),l++)})}else{if(e.pagination&&e.data&&m>=e.pagination)return;f.call(a,m,d),m++}}),b.addClass(a.list[a.activeIdx],"active"),j.appendChild(a.notice),j.appendChild(a.optsOptions),a.container.appendChild(a.selected),a.container.appendChild(j);var n=e.placeholder||a.el.getAttribute("placeholder")||"Choose...";a.placeEl=b.createElement("div",{class:"selectr-placeholder",html:n}),a.selected.appendChild(a.placeEl),a.el.parentNode.insertBefore(a.container,a.el),a.container.appendChild(a.el),g.call(this)},f=function(a,c,d){if("OPTION"===c.nodeName&&c.value){var e=this.customOption?this.settings.renderOption(c):c.textContent.trim(),f=b.createElement("li",{class:"selectr-option",html:e});f.idx=a,this.items.push(f),c.defaultSelected&&h.call(this,a,!0),c.disabled&&(f.disabled=!0,b.addClass(f,"disabled")),d?d.appendChild(f):this.optsOptions.appendChild(f),c.disabled||this.list.push(f)}},g=function(){var a=this;this.events={},this.events.keyup=n.bind(a),this.events.navigate=o.bind(a),this.events.dismiss=q.bind(a),a.requiresPagination=a.settings.data&&a.settings.data.length>a.settings.pagination,b.on(a.container,"click",function(c){c=c||window.event;var d=c.target,e=b.closest(d,function(b){return b&&b==a.selected});if(d!==a.input){if(a.settings.clearable&&d===a.selectClear)return void a.clear();if(b.hasClass(d,"selectr-tag-remove")&&j.call(a,d.parentNode.idx),d!==a.label&&d!==a.placeEl||(d=a.placeEl.parentNode),(e||d===a.selected)&&a.toggle(),b.hasClass(d,"selectr-option")){var f=a.items.indexOf(d);h.call(a,f)}b.preventDefault(c)}}),b.on(a.optsOptions,"mousedown",function(a){b.preventDefault(a)}),a.settings.searchable&&b.on(a.inputClear,"click",function(b){m.call(a)}),b.on(document,"click",this.events.dismiss),b.on(document,"keydown",this.events.navigate),b.on(document,"keyup",this.events.keyup),a.update=b.debounce(function(){a.opened&&a.close(),this.width&&(this.container.style.width=this.width)},50),b.on(window,"resize",a.update),b.on(window,"scroll",a.update),a.requiresPagination&&(a.paginateItems=b.debounce(function(){p.call(a)},50),b.on(a.optsOptions,"scroll",a.paginateItems))},h=function(a,c){var d=this,e=d.items[a],f=d.el.options[a];if(!f.disabled){if(c)return void i.call(d,a);b.hasClass(e,"selected")?j.call(d,a):i.call(d,a),d.opened&&!d.el.multiple&&d.close()}},i=function(a){var c=this.el.options[a];if(this.el.multiple){if(b.includes(this.selectedIndexes,a))return!1;var d=this.settings.maxSelections;if(d&&this.tags.length==d)return this.setMessage("A maximum of "+d+" items can be selected.",!0),!1;this.selectedValues.push(c.value),this.selectedIndexes.push(a),k.call(this,a)}else this.label.innerHTML=this.customSelected?this.settings.renderSelection(c):c.textContent,this.selectedValue=c.value,this.selectedIndex=a,b.each(this.el.options,function(c,d){var e=this.items[c];c!==a&&(e&&b.removeClass(e,"selected"),d.defaultSelected=!1)},this);b.addClass(this.items[a],"selected"),b.addClass(this.container,"has-selected"),c.defaultSelected=!0,this.emit("selectr.select",c),this.emit("selectr.change",c)},j=function(a){var c=this.el.options[a];if(b.removeClass(this.items[a],"selected"),this.el.multiple){var d=this.selectedIndexes.indexOf(a);this.selectedIndexes.splice(d,1);var e=this.selectedValues.indexOf(c.value);this.selectedValues.splice(e,1),l.call(this,a),this.tags.length||b.removeClass(this.container,"has-selected")}else this.label.innerHTML="",this.selectedValue=null,this.el.selectedIndex=-1,b.removeClass(this.container,"has-selected");c.defaultSelected=!1,this.emit("selectr.deselect",c),this.emit("selectr.change",c)},k=function(a){var c=this,d=document.createDocumentFragment(),e=c.el.options[a],f=c.customSelected?c.settings.renderSelection(e):e.textContent,g=b.createElement("li",{class:"selectr-tag",html:f}),h=b.createElement("button",{class:"selectr-tag-remove",type:"button"});if(g.appendChild(h),g.idx=a,g.tag=e.value,c.tags.push(g),c.settings.sortSelected){var i=c.tags.slice();i.sort(function(a,b){var f,g,d=[],e=[];for(c.settings.sortSelected===!0?(f=a.tag,g=b.tag):"text"===c.settings.sortSelected&&(f=a.textContent,g=b.textContent),f.replace(/(\d+)|(\D+)/g,function(a,b,c){d.push([b||1/0,c||""])}),g.replace(/(\d+)|(\D+)/g,function(a,b,c){e.push([b||1/0,c||""])});d.length&&e.length;){var h=d.shift(),i=e.shift(),j=h[0]-i[0]||h[1].localeCompare(i[1]);if(j)return j}return d.length-e.length}),b.each(i,function(a,b){d.appendChild(b)}),c.label.innerHTML=""}else d.appendChild(g);c.settings.taggable?c.label.insertBefore(d,c.input.parentNode):c.label.appendChild(d)},l=function(a){var c=!1;if(b.each(this.tags,function(b,d){d.idx===a&&(c=d)}),c){this.label.removeChild(c);var d=this.tags.indexOf(c);this.tags.splice(d,1)}},m=function(){var a=this;(a.settings.searchable||a.settings.taggable)&&(a.input.value=null,a.searching=!1,a.settings.searchable&&b.removeClass(a.inputContainer,"active"),b.hasClass(a.container,"notice")&&(b.removeClass(a.container,"notice"),b.addClass(a.container,"open"),a.input.focus()),b.each(a.list,function(c,d){b.removeClass(d,"match"),b.removeClass(d,"excluded"),a.customOption||(d.innerHTML=d.textContent)}))},n=function(a){var c=this;if(a.target==c.input&&(c.input=a.target,c.search(c.input.value,!0)),c.navigating&&13!=a.keyCode&&(c.navigating=!1),c.input.value.length){var d=c.input.value.trim();if(13===a.which||b.includes(c.tagSeperators,a.key)){b.each(c.tagSeperators,function(a,b){d=d.replace(b,"")});var e=c.addOption({value:d,text:d,selected:!0});e?(c.close(),m.call(c)):(c.input.value="",c.setMessage("That tag is already in use."))}}},o=function(a){a=a||window.event;var c=this,d=a.which,e=[13,38,40];if(c.opened&&b.includes(e,d)){b.preventDefault(a);var g,f=this.searching?this.searchItems:this.list;if(f.length){switch(d){case 13:if(c.settings.taggable&&c.input===document.activeElement)return;var i=c.optsOptions.querySelector(".active"),j=c.items.indexOf(i);return void h.call(c,j);case 38:g=1,c.activeIdx>0&&c.activeIdx--;break;case 40:g=-1,c.activeIdx<f.length-1&&c.activeIdx++}this.navigating=!0;var o,q,k=f[c.activeIdx],l=b.getBoundingRect(k),m=c.optsOptions.scrollTop,n=c.optsRect.top;if(g>1){var r=l.top;o=n,q=m+(r-o),0===c.activeIdx?c.optsOptions.scrollTop=0:r-o<0&&(c.optsOptions.scrollTop=q)}else{var s=l.top+l.height;o=n+c.optsRect.height,q=m+s-o,0===c.activeIdx?c.optsOptions.scrollTop=0:s>o&&(c.optsOptions.scrollTop=q),c.requiresPagination&&p.call(c)}b.removeClass(c.optsOptions.querySelector(".active"),"active"),b.addClass(f[c.activeIdx],"active")}}},p=function(){var a=this,c=a.optsOptions,d=c.scrollTop,e=c.scrollHeight,g=c.offsetHeight,h=d>=e-g;if(h&&a.pageIndex<a.pages.length){var i=document.createDocumentFragment(),j=document.createDocumentFragment();b.each(a.pages[a.pageIndex],function(c,d){var e=b.createElement("option",{value:d.value,text:d.text});i.appendChild(e),f.call(a,c,e,j)}),a.el.appendChild(i),c.appendChild(j),a.pageIndex++,a.emit("selectr.paginate",{items:a.items.length,total:a.settings.data.length,page:a.pageIndex,pages:a.pages.length})}},q=function(a){var b=a.target;this.container.contains(b)||!this.opened&&!this.container.classList.contains("notice")||this.close()},r=function(a,b,c){var d=new RegExp(a,"i").exec(c);return!!d&&b.textContent.replace(d[0],"<span>"+d[0]+"</span>")},s=function(){};s.prototype={on:function(a,b){this._events=this._events||{},this._events[a]=this._events[a]||[],this._events[a].push(b)},off:function(a,b){this._events=this._events||{},a in this._events!=!1&&this._events[a].splice(this._events[a].indexOf(b),1)},emit:function(a){if(this._events=this._events||{},a in this._events!=!1)for(var b=0;b<this._events[a].length;b++)this._events[a][b].apply(this,Array.prototype.slice.call(arguments,1))}},s.mixin=function(a){for(var b=["on","off","emit"],c=0;c<b.length;c++)"function"==typeof a?a.prototype[b[c]]=s.prototype[b[c]]:a[b[c]]=s.prototype[b[c]];return a};var t={width:"auto",searchable:!0,clearable:!1,sortSelected:!1};return u.prototype.render=function(a){if(!this.rendered){this.settings=b.extend(t,a),(this.settings.multiple||this.settings.taggable)&&(this.el.multiple=!0),this.settings.taggable&&(this.settings.searchable=!1),this.hasOptGroups=!1,this.el.getElementsByTagName("optgroup").length&&(this.hasOptGroups=!0),this.items=[],this.list=[],this.activeIdx=0,this.navigating=!1,this.elRect=this.el.getBoundingClientRect(),s.mixin(this),e.call(this),this.update(),this.rendered=!0;var c=this;setTimeout(function(){c.emit("selectr.init")},20)}},u.prototype.destroy=function(){if(this.rendered){if(this.emit("selectr.destroy"),this.settings.data)for(;this.el.hasChildNodes();)this.el.removeChild(this.el.lastChild);"select-one"===this.originalType&&(this.el.multiple=!1),b.removeClass(this.el,"hidden-input"),b.off(document,"click",this.events.dismiss),b.off(document,"keydown",this.events.navigate),b.off(document,"keyup",this.events.keyup),b.off(window,"resize",this.update),b.off(window,"scroll",this.update),this.container.parentNode.replaceChild(this.el,this.container),this.rendered=!1}},u.prototype.setValue=function(a){var c=this,d=b.isArray(a);d||(a=a.toString().trim()),!c.el.multiple&&d||b.each(this.el.options,function(e,f){(d&&b.includes(a.toString(),f.value)||f.value===a)&&h.call(c,e)})},u.prototype.getValue=function(a,c){var e,d=this;if(d.el.multiple)a?d.selectedIndexes.length&&(e={},e.values=[],b.each(d.selectedIndexes,function(a,b){var c=d.el.options[b];e.values[a]={value:c.value,text:c.textContent}})):e=d.selectedValues.slice();else if(a){var f=d.el.options[d.selectedIndex];e={value:f.value,text:f.textContent}}else e=d.selectedValue;return a&&c&&(e=JSON.stringify(e)),e},u.prototype.addOption=function(a){var c=this;if(a&&b.isObject(a)&&a.value){var d=c.settings.data?c.settings.data:c.el.options,e=!1;if(b.each(d,function(b,c){c.value.toLowerCase()===a.value.toLowerCase()&&(e=!0)}),e){if(!c.settings.taggable)throw new Error("That value is already in use.");return!1}var g=b.createElement("option",a);return c.settings.data&&c.settings.data.push({value:a.value,text:a.text}),a.selected&&(g.defaultSelected=!0),g.innerHTML=c.customOption?c.settings.renderOption(g):g.textContent,c.settings.pagination||(c.el.add(g),f.call(c,c.el.options.length-1,g)),g}return!1},u.prototype.search=function(a,c){a=a.trim();var d=this;if(!d.navigating){if(b.hasClass(d.container,"notice")||d.settings.searchable&&(a.length>0?b.addClass(d.inputContainer,"active"):b.removeClass(d.inputContainer,"active")),d.searching=!0,d.searchItems=[],d.searchQuery=a,b.each(d.items,function(e,f){var g=f.textContent.trim(),h=b.includes(g.toLowerCase(),a.toLowerCase());f.disabled||!h?(b.addClass(f,"excluded"),b.removeClass(f,"match")):(d.searchItems.push(f),c&&(d.customOption||(f.innerHTML=r(a,f,g)),b.addClass(f,"match"),b.removeClass(f,"excluded")))}),c)d.searchItems.length||d.settings.taggable?d.open():(d.setMessage("No results."),d.input.focus());else if(d.searchItems.length){var e={};return e.values=[],b.each(d.searchItems,function(a,b){var c=d.el.options[b.idx];e.values[a]={value:c.value,text:c.textContent}}),e}d.emit("selectr.search",a,d.searchItems)}},u.prototype.toggle=function(){if(!this.disabled){var a=b.hasClass(this.container,"open");a?this.close():this.open()}},u.prototype.open=function(){var a=this;b.addClass(a.container,"open"),a.optsRect=b.getBoundingRect(a.optsOptions);var c=window.innerHeight,d=a.optsOptions.scrollHeight,e=a.elRect.top+a.elRect.height+a.optsRect.height>c;d<=a.optsRect.height&&a.requiresPagination&&p.call(a),e?(b.addClass(a.container,"inverted"),this.isInverted=!0):(b.removeClass(a.container,"inverted"),this.isInverted=!1),b.removeClass(a.container,"notice"),a.settings.searchable&&!a.settings.taggable&&setTimeout(function(){a.input.focus()},10),a.optsRect=b.getBoundingRect(a.optsOptions),this.opened||a.emit("selectr.open"),a.opened=!0},u.prototype.close=function(){var a=b.hasClass(this.container,"notice");this.settings.searchable&&!a&&(this.input.blur(),this.searching=!1),a&&(b.removeClass(this.container,"notice"),this.notice.textContent=""),b.removeClass(this.container,"open"),m.call(this),this.opened&&this.emit("selectr.close"),this.opened=!1},u.prototype.reset=function(a){this.clear(),c.call(this),b.each(this.el.options,function(a,b){b.defaultSelected&&h.call(this,a)},this),this.emit("selectr.reset")},u.prototype.clear=function(a){if(this.el.multiple){var c=this.selectedIndexes.slice();b.each(c,function(a,b){j.call(this,b)},this)}else j.call(this,this.selectedIndex);this.emit("selectr.clear")},u.prototype.serialise=function(a){var c=[];return b.each(this.el.options,function(a,b){var d={value:b.value,text:b.textContent};b.defaultSelected&&(d.selected=!0),b.disabled&&(d.disabled=!0),c[a]=d}),a?JSON.stringify(c):c},u.prototype.serialize=function(a){return this.serialise(a)},u.prototype.setMessage=function(a,c){c&&this.close(),b.addClass(this.container,"notice"),this.notice.textContent=a},u});
!function(a,b){var c="Selectr";"function"==typeof define&&define.amd?define([],b(c)):"object"==typeof exports?module.exports=b(c):a[c]=b(c)}(this,function(a){"use strict";function u(a,b){if(null===a)throw new Error("Selectr requires an element to work.");if(this.el=a,"string"==typeof this.el&&(this.el=document.querySelector(a)),null===this.el)throw new Error("The element you passed to Selectr can not be found.");if("select"!==this.el.nodeName.toLowerCase())throw new Error("The element you passed to Selectr is not a HTMLSelectElement.");if(!this.el.options.length&&!b.data&&!b.taggable)throw new Error("You don't have any options in your select!");this.originalType=this.el.type,this.render(b)}var b={extend:function(a,b){b=b||{};var c;for(c in a)b.hasOwnProperty(c)||(b[c]=a[c]);return b},each:function(a,b,c){if("[object Object]"===Object.prototype.toString.call(a))for(var d in a)Object.prototype.hasOwnProperty.call(a,d)&&b.call(c,d,a[d],a);else for(var e=0,f=a.length;e<f;e++)b.call(c,e,a[e],a)},createElement:function(a,b){var c=document,d=c.createElement(a);if(b&&"object"==typeof b){var e;for(e in b)if("html"===e)d.innerHTML=b[e];else if("text"===e){var f=c.createTextNode(b[e]);d.appendChild(f)}else d.setAttribute(e,b[e])}return d},hasClass:function(a,b){return a.classList?a.classList.contains(b):!!a.className&&!!a.className.match(new RegExp("(\\s|^)"+b+"(\\s|$)"))},addClass:function(a,c){b.hasClass(a,c)||(a.classList?a.classList.add(c):a.className=a.className.trim()+" "+c)},removeClass:function(a,c){b.hasClass(a,c)&&(a.classList?a.classList.remove(c):a.className=a.className.replace(new RegExp("(^|\\s)"+c.split(" ").join("|")+"(\\s|$)","gi")," "))},closest:function(a,c){return a&&a!==document.body&&(c(a)?a:b.closest(a.parentNode,c))},on:function(a,b,c,d){a.addEventListener(b,c,d||!1)},off:function(a,b,c){a.removeEventListener(b,c)},isObject:function(a){return"[object Object]"===Object.prototype.toString.call(a)},isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},isInt:function(a){return!isNaN(a)&&function(a){return(a||0)===a}(parseFloat(a))},debounce:function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)},h=c&&!d;clearTimeout(d),d=setTimeout(g,b),h&&a.apply(e,f)}},getBoundingRect:function(a){var b=window,c=document,d=c.body,e=a.getBoundingClientRect(),f=void 0!==b.pageXOffset?b.pageXOffset:(c.documentElement||d.parentNode||d).scrollLeft,g=void 0!==b.pageYOffset?b.pageYOffset:(c.documentElement||d.parentNode||d).scrollTop;return{bottom:e.bottom+g,height:e.height,left:e.left+f,right:e.right+f,top:e.top+g,width:e.width}},preventDefault:function(a){if(a=a||window.event,a.preventDefault)return a.preventDefault()},includes:function(a,b){return a.indexOf(b)>-1}},c=function(){var a=this.settings,c=this.el.options;if(a.selectedValue){var d=a.selectedValue.toString();b.each(c,function(a,c){b.includes(d,c.value)&&(c.defaultSelected=!0)})}!c[0].defaultSelected&&c[0].selected&&(this.el.selectedIndex=-1)},d=function(){var a=this.settings.width;a&&(b.isInt(a)?a+="px":"auto"===a?a="100%":b.includes(this.settings.width,"%")&&(a=this.settings.width),this.width=a)},e=function(){var a=this,e=a.settings;if(b.addClass(a.el,"hidden-input"),e.data){a.pageIndex=1;var h=e.pagination?e.data.slice(0,e.pagination):e.data,i=!1;b.each(h,function(b,c){var d=c.hasOwnProperty("selected")&&c.selected===!0,e=new Option(c.text,c.value,d,d);c.disabled&&(e.disabled=!0),0===b&&d&&(i=!0),a.el.add(e)}),i||(this.el.selectedIndex=-1),e.pagination&&(this.pages=e.data.map(function(a,b){return b%e.pagination===0?e.data.slice(b,b+e.pagination):null}).filter(function(a){return a}))}c.call(a),a.customOption=e.hasOwnProperty("renderOption")&&"function"==typeof e.renderOption,a.customSelected=e.hasOwnProperty("renderSelection")&&"function"==typeof e.renderSelection,a.container=b.createElement("div",{class:"selectr-container"}),e.customClass&&b.addClass(a.container,e.customClass),d.call(a),this.container.style.width=this.width,a.selected=b.createElement("div",{class:"selectr-selected",tabIndex:a.el.tabIndex}),a.el.tabIndex=-1,a.label=b.createElement(a.el.multiple?"ul":"span",{class:"selectr-label"});var j=b.createElement("div",{class:"selectr-options-container"});if(a.optsOptions=b.createElement("ul",{class:"selectr-options"}),a.notice=b.createElement("div",{class:"selectr-notice"}),a.el.multiple&&(b.addClass(a.label,"selectr-tags"),b.addClass(a.container,"multiple"),this.tags=[],this.selectedValues=[],this.selectedIndexes=[]),a.selected.appendChild(a.label),(a.el.multiple&&e.clearable||!a.el.multiple&&e.allowDeselect)&&(a.selectClear=b.createElement("button",{class:"selectr-clear",type:"button"}),a.selected.appendChild(a.selectClear)),e.taggable){var k=b.createElement("li",{class:"input-tag"});a.input=b.createElement("input",{class:"selectr-tag-input",placeholder:"Enter a tag...",tagIndex:0}),k.appendChild(a.input),a.label.appendChild(k),b.addClass(a.container,"taggable"),this.tagSeperators=[","],a.settings.tagSeperators&&(this.tagSeperators=this.tagSeperators.concat(a.settings.tagSeperators))}if(e.searchable&&(a.input=b.createElement("input",{class:"selectr-input",tagIndex:-1}),a.inputClear=b.createElement("button",{class:"selectr-clear",type:"button"}),a.inputContainer=b.createElement("div",{class:"selectr-input-container"}),a.inputContainer.appendChild(a.input),a.inputContainer.appendChild(a.inputClear),j.appendChild(a.inputContainer)),a.hasOptGroups){var l=0;b.addClass(a.optsOptions,"optgroups")}var m=0;b.each(a.el.children,function(c,d){if("OPTGROUP"===d.nodeName){var g=b.createElement("ul",{class:"selectr-optgroup"});g.appendChild(b.createElement("li",{class:"selectr-optgroup--label",text:d.label})),a.optsOptions.appendChild(g),d.children&&b.each(d.children,function(b,c){e.pagination&&e.data&&l>=e.pagination||(f.call(a,l,c,g),l++)})}else{if(e.pagination&&e.data&&m>=e.pagination)return;f.call(a,m,d),m++}}),b.addClass(a.list[a.activeIdx],"active"),j.appendChild(a.notice),j.appendChild(a.optsOptions),a.container.appendChild(a.selected),a.container.appendChild(j);var n=e.placeholder||a.el.getAttribute("placeholder")||"Choose...";a.placeEl=b.createElement("div",{class:"selectr-placeholder",html:n}),a.selected.appendChild(a.placeEl),a.el.parentNode.insertBefore(a.container,a.el),a.container.appendChild(a.el),g.call(this)},f=function(a,c,d){if("OPTION"===c.nodeName&&c.value){var e=this.customOption?this.settings.renderOption(c):c.textContent.trim(),f=b.createElement("li",{class:"selectr-option",html:e});f.idx=a,this.items.push(f),c.defaultSelected&&h.call(this,a,!0),c.disabled&&(f.disabled=!0,b.addClass(f,"disabled")),d?d.appendChild(f):this.optsOptions.appendChild(f),c.disabled||this.list.push(f)}},g=function(){var a=this;this.events={},this.events.keyup=n.bind(a),this.events.navigate=o.bind(a),this.events.dismiss=q.bind(a),a.requiresPagination=a.settings.data&&a.settings.data.length>a.settings.pagination,b.on(a.container,"click",function(c){c=c||window.event;var d=c.target,e=b.closest(d,function(b){return b&&b==a.selected});if(d!==a.input){if(a.settings.clearable&&d===a.selectClear)return void a.clear();if(b.hasClass(d,"selectr-tag-remove")&&j.call(a,d.parentNode.idx),d!==a.label&&d!==a.placeEl||(d=a.placeEl.parentNode),(e||d===a.selected)&&a.toggle(),b.hasClass(d,"selectr-option")){var f=a.items.indexOf(d);h.call(a,f)}b.preventDefault(c)}}),b.on(a.optsOptions,"mousedown",function(a){b.preventDefault(a)}),a.settings.searchable&&b.on(a.inputClear,"click",function(b){m.call(a)}),b.on(document,"click",this.events.dismiss),b.on(document,"keydown",this.events.navigate),b.on(document,"keyup",this.events.keyup),a.update=b.debounce(function(){a.opened&&a.close(),this.width&&(this.container.style.width=this.width)},50),b.on(window,"resize",a.update),b.on(window,"scroll",a.update),a.requiresPagination&&(a.paginateItems=b.debounce(function(){p.call(a)},50),b.on(a.optsOptions,"scroll",a.paginateItems))},h=function(a,c){var d=this,e=d.items[a],f=d.el.options[a];if(!f.disabled){if(c)return void i.call(d,a);b.hasClass(e,"selected")?j.call(d,a):i.call(d,a),d.opened&&!d.el.multiple&&d.close()}},i=function(a){var c=this.el.options[a];if(this.el.multiple){if(b.includes(this.selectedIndexes,a))return!1;var d=this.settings.maxSelections;if(d&&this.tags.length==d)return this.setMessage("A maximum of "+d+" items can be selected.",!0),!1;this.selectedValues.push(c.value),this.selectedIndexes.push(a),k.call(this,a)}else this.label.innerHTML=this.customSelected?this.settings.renderSelection(c):c.textContent,this.selectedValue=c.value,this.selectedIndex=a,b.each(this.el.options,function(c,d){var e=this.items[c];c!==a&&(e&&b.removeClass(e,"selected"),d.defaultSelected=!1)},this);b.addClass(this.items[a],"selected"),b.addClass(this.container,"has-selected"),c.defaultSelected=!0,this.emit("selectr.select",c),this.emit("selectr.change",c)},j=function(a){var c=this.el.options[a];if(this.el.multiple){var d=this.selectedIndexes.indexOf(a);this.selectedIndexes.splice(d,1);var e=this.selectedValues.indexOf(c.value);this.selectedValues.splice(e,1),l.call(this,a),this.tags.length||b.removeClass(this.container,"has-selected")}else{if(!this.settings.allowDeselect)return!1;this.label.innerHTML="",this.selectedValue=null,this.el.selectedIndex=-1,b.removeClass(this.container,"has-selected")}b.removeClass(this.items[a],"selected"),c.defaultSelected=!1,this.emit("selectr.deselect",c),this.emit("selectr.change",c)},k=function(a){var c=this,d=document.createDocumentFragment(),e=c.el.options[a],f=c.customSelected?c.settings.renderSelection(e):e.textContent,g=b.createElement("li",{class:"selectr-tag",html:f}),h=b.createElement("button",{class:"selectr-tag-remove",type:"button"});if(g.appendChild(h),g.idx=a,g.tag=e.value,c.tags.push(g),c.settings.sortSelected){var i=c.tags.slice();i.sort(function(a,b){var f,g,d=[],e=[];for(c.settings.sortSelected===!0?(f=a.tag,g=b.tag):"text"===c.settings.sortSelected&&(f=a.textContent,g=b.textContent),f.replace(/(\d+)|(\D+)/g,function(a,b,c){d.push([b||1/0,c||""])}),g.replace(/(\d+)|(\D+)/g,function(a,b,c){e.push([b||1/0,c||""])});d.length&&e.length;){var h=d.shift(),i=e.shift(),j=h[0]-i[0]||h[1].localeCompare(i[1]);if(j)return j}return d.length-e.length}),b.each(i,function(a,b){d.appendChild(b)}),c.label.innerHTML=""}else d.appendChild(g);c.settings.taggable?c.label.insertBefore(d,c.input.parentNode):c.label.appendChild(d)},l=function(a){var c=!1;if(b.each(this.tags,function(b,d){d.idx===a&&(c=d)}),c){this.label.removeChild(c);var d=this.tags.indexOf(c);this.tags.splice(d,1)}},m=function(){var a=this;(a.settings.searchable||a.settings.taggable)&&(a.input.value=null,a.searching=!1,a.settings.searchable&&b.removeClass(a.inputContainer,"active"),b.hasClass(a.container,"notice")&&(b.removeClass(a.container,"notice"),b.addClass(a.container,"open"),a.input.focus()),b.each(a.list,function(c,d){b.removeClass(d,"match"),b.removeClass(d,"excluded"),a.customOption||(d.innerHTML=d.textContent)}))},n=function(a){var c=this;if(a.target===c.input)return c.search(c.input.value,!0),!1;if(c.navigating&&13!==a.keyCode&&(c.navigating=!1),c.input&&c.input.value.length){var d=c.input.value.trim();if(13===a.which||b.includes(c.tagSeperators,a.key)){b.each(c.tagSeperators,function(a,b){d=d.replace(b,"")});var e=c.addOption({value:d,text:d,selected:!0});e?(c.close(),m.call(c)):(c.input.value="",c.setMessage("That tag is already in use."))}}},o=function(a){a=a||window.event;var c=this,d=a.which,e=[13,38,40];if(c.opened&&b.includes(e,d)){b.preventDefault(a);var g,f=this.searching?this.searchItems:this.list;if(f.length){switch(d){case 13:if(c.settings.taggable&&c.input===document.activeElement)return;var i=c.optsOptions.querySelector(".active"),j=c.items.indexOf(i);return void h.call(c,j);case 38:g=1,c.activeIdx>0&&c.activeIdx--;break;case 40:g=-1,c.activeIdx<f.length-1&&c.activeIdx++}this.navigating=!0;var o,q,k=f[c.activeIdx],l=b.getBoundingRect(k),m=c.optsOptions.scrollTop,n=c.optsRect.top;if(g>1){var r=l.top;o=n,q=m+(r-o),0===c.activeIdx?c.optsOptions.scrollTop=0:r-o<0&&(c.optsOptions.scrollTop=q)}else{var s=l.top+l.height;o=n+c.optsRect.height,q=m+s-o,0===c.activeIdx?c.optsOptions.scrollTop=0:s>o&&(c.optsOptions.scrollTop=q),c.requiresPagination&&p.call(c)}b.removeClass(c.optsOptions.querySelector(".active"),"active"),b.addClass(f[c.activeIdx],"active")}}},p=function(){var a=this,c=a.optsOptions,d=c.scrollTop,e=c.scrollHeight,g=c.offsetHeight,h=d>=e-g;if(h&&a.pageIndex<a.pages.length){var i=document.createDocumentFragment(),j=document.createDocumentFragment();b.each(a.pages[a.pageIndex],function(c,d){var e=b.createElement("option",{value:d.value,text:d.text});i.appendChild(e),f.call(a,c,e,j)}),a.el.appendChild(i),c.appendChild(j),a.pageIndex++,a.emit("selectr.paginate",{items:a.items.length,total:a.settings.data.length,page:a.pageIndex,pages:a.pages.length})}},q=function(a){var b=a.target;this.container.contains(b)||!this.opened&&!this.container.classList.contains("notice")||this.close()},r=function(a,b,c){var d=new RegExp(a,"i").exec(c);return!!d&&b.textContent.replace(d[0],"<span>"+d[0]+"</span>")},s=function(){};s.prototype={on:function(a,b){this._events=this._events||{},this._events[a]=this._events[a]||[],this._events[a].push(b)},off:function(a,b){this._events=this._events||{},a in this._events!=!1&&this._events[a].splice(this._events[a].indexOf(b),1)},emit:function(a){if(this._events=this._events||{},a in this._events!=!1)for(var b=0;b<this._events[a].length;b++)this._events[a][b].apply(this,Array.prototype.slice.call(arguments,1))}},s.mixin=function(a){for(var b=["on","off","emit"],c=0;c<b.length;c++)"function"==typeof a?a.prototype[b[c]]=s.prototype[b[c]]:a[b[c]]=s.prototype[b[c]];return a};var t={width:"auto",searchable:!0,clearable:!1,sortSelected:!1,allowDeselect:!1};return u.prototype.render=function(a){if(!this.rendered){this.settings=b.extend(t,a),(this.settings.multiple||this.settings.taggable)&&(this.el.multiple=!0),this.settings.taggable&&(this.settings.searchable=!1),this.hasOptGroups=!1,this.el.getElementsByTagName("optgroup").length&&(this.hasOptGroups=!0),this.items=[],this.list=[],this.activeIdx=0,this.navigating=!1,this.elRect=this.el.getBoundingClientRect(),s.mixin(this),e.call(this),this.update(),this.rendered=!0;var c=this;setTimeout(function(){c.emit("selectr.init")},20)}},u.prototype.destroy=function(){if(this.rendered){if(this.emit("selectr.destroy"),this.settings.data)for(;this.el.hasChildNodes();)this.el.removeChild(this.el.lastChild);"select-one"===this.originalType&&(this.el.multiple=!1),b.removeClass(this.el,"hidden-input"),b.off(document,"click",this.events.dismiss),b.off(document,"keydown",this.events.navigate),b.off(document,"keyup",this.events.keyup),b.off(window,"resize",this.update),b.off(window,"scroll",this.update),this.container.parentNode.replaceChild(this.el,this.container),this.rendered=!1}},u.prototype.setValue=function(a){var c=this,d=b.isArray(a);d||(a=a.toString().trim()),!c.el.multiple&&d||b.each(this.el.options,function(e,f){(d&&b.includes(a.toString(),f.value)||f.value===a)&&h.call(c,e)})},u.prototype.getValue=function(a,c){var e,d=this;if(d.el.multiple)a?d.selectedIndexes.length&&(e={},e.values=[],b.each(d.selectedIndexes,function(a,b){var c=d.el.options[b];e.values[a]={value:c.value,text:c.textContent}})):e=d.selectedValues.slice();else if(a){var f=d.el.options[d.selectedIndex];e={value:f.value,text:f.textContent}}else e=d.selectedValue;return a&&c&&(e=JSON.stringify(e)),e},u.prototype.addOption=function(a){var c=this;if(a&&b.isObject(a)&&a.value){var d=c.settings.data?c.settings.data:c.el.options,e=!1;if(b.each(d,function(b,c){c.value.toLowerCase()===a.value.toLowerCase()&&(e=!0)}),e){if(!c.settings.taggable)throw new Error("That value is already in use.");return!1}var g=b.createElement("option",a);return c.settings.data&&c.settings.data.push({value:a.value,text:a.text}),a.selected&&(g.defaultSelected=!0),g.innerHTML=c.customOption?c.settings.renderOption(g):g.textContent,c.settings.pagination||(c.el.add(g),f.call(c,c.el.options.length-1,g)),g}return!1},u.prototype.search=function(a,c){a=a.trim();var d=this;if(!d.navigating){if(b.hasClass(d.container,"notice")||d.settings.searchable&&(a.length>0?b.addClass(d.inputContainer,"active"):b.removeClass(d.inputContainer,"active")),d.searching=!0,d.searchItems=[],d.searchQuery=a,b.each(d.items,function(e,f){var g=f.textContent.trim(),h=b.includes(g.toLowerCase(),a.toLowerCase());f.disabled||!h?(b.addClass(f,"excluded"),b.removeClass(f,"match")):(d.searchItems.push(f),c&&(d.customOption||(f.innerHTML=r(a,f,g)),b.addClass(f,"match"),b.removeClass(f,"excluded")))}),c)d.searchItems.length||d.settings.taggable?d.open():(d.setMessage("No results."),d.input.focus());else if(d.searchItems.length){var e={};return e.values=[],b.each(d.searchItems,function(a,b){var c=d.el.options[b.idx];e.values[a]={value:c.value,text:c.textContent}}),e}d.emit("selectr.search",a,d.searchItems)}},u.prototype.toggle=function(){if(!this.disabled){var a=b.hasClass(this.container,"open");a?this.close():this.open()}},u.prototype.open=function(){var a=this;b.addClass(a.container,"open"),a.optsRect=b.getBoundingRect(a.optsOptions);var c=window.innerHeight,d=a.optsOptions.scrollHeight,e=a.elRect.top+a.elRect.height+a.optsRect.height>c;d<=a.optsRect.height&&a.requiresPagination&&p.call(a),e?(b.addClass(a.container,"inverted"),this.isInverted=!0):(b.removeClass(a.container,"inverted"),this.isInverted=!1),b.removeClass(a.container,"notice"),a.settings.searchable&&!a.settings.taggable&&setTimeout(function(){a.input.focus(),a.input.tabIndex=0},10),a.optsRect=b.getBoundingRect(a.optsOptions),this.opened||a.emit("selectr.open"),a.opened=!0},u.prototype.close=function(){var a=b.hasClass(this.container,"notice");this.settings.searchable&&!a&&(this.input.blur(),this.input.tabIndex=-1,this.searching=!1),a&&(b.removeClass(this.container,"notice"),this.notice.textContent=""),b.removeClass(this.container,"open"),m.call(this),this.opened&&this.emit("selectr.close"),this.opened=!1},u.prototype.reset=function(a){this.clear(),c.call(this),b.each(this.el.options,function(a,b){b.defaultSelected&&h.call(this,a)},this),this.emit("selectr.reset")},u.prototype.clear=function(a){if(this.el.multiple){var c=this.selectedIndexes.slice();b.each(c,function(a,b){j.call(this,b)},this)}else j.call(this,this.selectedIndex);this.emit("selectr.clear")},u.prototype.serialise=function(a){var c=[];return b.each(this.el.options,function(a,b){var d={value:b.value,text:b.textContent};b.defaultSelected&&(d.selected=!0),b.disabled&&(d.disabled=!0),c[a]=d}),a?JSON.stringify(c):c},u.prototype.serialize=function(a){return this.serialise(a)},u.prototype.setMessage=function(a,c){c&&this.close(),b.addClass(this.container,"notice"),this.notice.textContent=a},u});
{
"name": "mobius1-selectr",
"version": "2.1.0",
"version": "2.1.1",
"description": "A lightweight dependency-free javascript select box replacement.",

@@ -5,0 +5,0 @@ "main": "dist/selectr.min.js",

@@ -35,3 +35,3 @@ # Selectr [![Build Status](https://travis-ci.org/Mobius1/Selectr.svg?branch=master)](https://travis-ci.org/Mobius1/Selectr) [![npm version](https://badge.fury.io/js/mobius1-selectr.svg)](https://badge.fury.io/js/mobius1-selectr) [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/Mobius1/Selectr/blob/master/LICENSE)

```html
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/selectr/latest/selectr.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/selectr/2.1.0/selectr.min.css">
```

@@ -42,3 +42,3 @@

```html
<script type="text/javascript" src="https://cdn.jsdelivr.net/selectr/latest/selectr.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/selectr/2.1.0/selectr.min.js"></script>
```

@@ -95,4 +95,10 @@

### v.2.1.0
### v2.1.1
* new option `allowDeselect` (see [docs](http://mobius.ovh/docs/selectr/pages/options))
* tabIndex enabled on th main container
* tabIndex disabled on search input when closed
### v2.1.0
* New tagging feature (see [docs](http://mobius.ovh/docs/selectr/pages/options))

@@ -114,3 +120,3 @@

### v.2.0.0
### v2.0.0
* Complete rewrite

@@ -117,0 +123,0 @@ * New options added

/*!
* Selectr 2.1.0
* Selectr 2.1.1
* http://mobius.ovh/docs/selectr

@@ -222,5 +222,9 @@ *

_.selected = util.createElement("div", {
class: "selectr-selected"
class: "selectr-selected",
tabIndex: _.el.tabIndex // enable tabIndex (#9)
});
// We don't want to focus on the native select box
_.el.tabIndex = -1;
_.label = util.createElement(_.el.multiple ? "ul" : "span", {

@@ -259,3 +263,3 @@ class: "selectr-label"

if ( o.clearable ) {
if ( _.el.multiple && o.clearable || !_.el.multiple && o.allowDeselect ) {
_.selectClear = util.createElement("button", {

@@ -273,3 +277,4 @@ class: "selectr-clear",

class: "selectr-tag-input",
placeholder: 'Enter a tag...'
placeholder: 'Enter a tag...',
tagIndex: 0
});

@@ -289,3 +294,4 @@

_.input = util.createElement("input", {
class: "selectr-input"
class: "selectr-input",
tagIndex: -1
});

@@ -557,4 +563,2 @@ _.inputClear = util.createElement("button", {

util.removeClass(this.items[index], "selected");
if ( this.el.multiple ) {

@@ -573,2 +577,6 @@ var selIndex = this.selectedIndexes.indexOf(index);

} else {
if ( !this.settings.allowDeselect ) {
return false;
}
this.label.innerHTML = "";

@@ -582,2 +590,4 @@ this.selectedValue = null;

util.removeClass(this.items[index], "selected");
option.defaultSelected = false;

@@ -705,11 +715,11 @@

var _ = this;
if ( e.target == _.input ) {
_.input = e.target;
if ( e.target === _.input ) {
_.search(_.input.value, true);
return false;
}
if (_.navigating && e.keyCode != 13) {
if (_.navigating && e.keyCode !== 13) {
_.navigating = false;
}
if ( _.input.value.length ) {
if ( _.input && _.input.value.length ) {
var value = _.input.value.trim();

@@ -899,3 +909,4 @@

clearable: false,
sortSelected: false
sortSelected: false,
allowDeselect: false
};

@@ -1257,2 +1268,4 @@

_.input.focus();
// Allow tab focus
_.input.tabIndex = 0;
}, 10);

@@ -1278,2 +1291,4 @@ }

this.input.blur();
// Disable tab focus
this.input.tabIndex = -1;
this.searching = false;

@@ -1280,0 +1295,0 @@ }

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc