diff --git a/last-icon.min.js b/last-icon.min.js
index bae0e77..edf0b3a 100644
--- a/last-icon.min.js
+++ b/last-icon.min.js
@@ -1,2 +1,2 @@
-(()=>{var n="https://cdn.jsdelivr.net/",i={debug:!1,lazy:!0,replaceName:{},aliases:{bs:"bootstrap",bx:"boxicons",cs:"cssgg",gg:"cssgg",tb:"tabler",fa:"fontawesome",st:"supertiny",mi:"material",em:"emojicc",fl:"flags",in:"iconoir",eo:"eos",ft:"feather",ip:"iconpark",ph:"phosphor",ms:"symbols",lu:"lucide"},fonts:[],viewboxes:{boxicons:24,symbols:48},defaultTypes:{boxicons:"solid",fontawesome:"solid",material:"baseline",flags:"4x3",eos:"solid",phosphor:"regular",symbols:"outlined"},prefixes:{boxicons:{solid:"bxs",regular:"bx",logos:"bxl"},fontawesome:{solid:"fas",regular:"far",light:"fal",duotone:"fad",brands:"fab"}},defaultSet:"tabler",defaultStroke:2,paths:{bootstrap:n+"npm/bootstrap-icons@1/icons/{icon}.svg",boxicons:n+"npm/boxicons@2/svg/{type}/{prefix}-{icon}.svg",cssgg:n+"npm/css.gg@2/icons/svg/{icon}.svg",tabler:n+"npm/@tabler/icons@1/icons/{icon}.svg",fontawesome:n+"npm/@fortawesome/fontawesome-free@5/svgs/{type}/{icon}.svg",bytesize:n+"npm/bytesize-icons@1/dist/icons/{icon}.svg",supertiny:n+"npm/super-tiny-icons/images/svg/{icon}.svg",material:n+"npm/@material-icons/svg@1/svg/{icon}/{type}.svg",flags:n+"npm/flag-svg-collection@1/flags/{type}/{icon}.svg",emojicc:n+"npm/emoji-cc@1/svg/{icon}.svg",iconoir:n+"gh/lucaburgio/iconoir/icons/{icon}.svg",eos:n+"gh/lekoala/eos-icons-mirror/{type}/{icon}.svg",feather:n+"npm/feather-icons@4/dist/icons/{icon}.svg",iconpark:n+"gh/bytedance/IconPark/source/{type}/{icon}.svg",phosphor:n+"gh/phosphor-icons/phosphor-icons@1/assets/{type}/{icon}-{type}.svg",symbols:n+"npm/@material-symbols/svg-400@0.2.13/{type}/{icon}.svg",lucide:n+"npm/lucide-static/icons/{icon}.svg"},fixFill:["material","boxicons","fontawesome","eos","phosphor","symbols"],fixStroke:["iconpark"],fixViewbox:["boxicons","symbols"],strokeSet:["tabler","iconpark"],opticalFont:["symbols"]},a={},f={material:{class:"material-icons-{type}",types:{baseline:"",twotone:"two-tone",outline:"outlined"}},symbols:{class:"material-symbols-{type}"},boxicons:{class:"bx {prefix}-{icon}"},bootstrap:{class:"bi-{icon}"},fontawesome:{class:"{prefix} fa-{icon}"},iconoir:{class:"iconoir-{icon}"},eos:{class:"eos-icons-{type}",types:{solid:""}},phosphor:{class:"ph-{icon}-{type}",types:{solid:""}}},u=new window.IntersectionObserver((s,e)=>{s.forEach(async t=>{t.isIntersecting&&(e.unobserve(t.target),t.target.init())})});function g(s,e,t,r){let o=i.prefixes[t]&&i.prefixes[t][r]||null;return s=s.replace("{icon}",e),r?s=s.replaceAll("{type}",r):s=s.replace("-{type}",""),o&&(s=s.replace("{prefix}",o)),s}function c(s){!i.debug||console.log("[l-i] "+s)}function b(s,e,t){let r=i.paths[e],o=e+"-"+s;return t&&(o+="-"+t),r?(r=g(r,s,e,t),r&&a[o]?(c("Fetching "+o+" from cache"),a[o]):(c("Fetching "+o+" from url "+r),a[o]=fetch(r).then(function(l){if(l.ok)return l.text();throw Error(l.status)}),a[o])):new Promise(()=>{console.error(`Icon set ${e} does not exists`)})}function d(s,e,t,r){if(i.replaceName[e]&&(e=i.replaceName[e]),i.fonts.includes(t)){c("Using font for "+e);let o=f[t].class,l=o.includes("{icon}"),p=r;f[t].types&&r in f[t].types&&(p=f[t].types[r]),o=g(o,e,t,p),l?s.innerHTML='':s.innerHTML=''+e+"",s.stroke&&i.opticalFont.includes(s.set)&&s.style.setProperty("--weight",s.stroke*100);return}b(e,t,r).then(o=>{if(o.includes("class=")&&(o=o.replace(/ class="([a-z- ]*)"/g,"")),(s.stroke||i.fixStroke.includes(s.set))&&(o=o.replace(/stroke-width="([0-9]*)"/g,'stroke-width="'+s.stroke+'"')),i.fixFill.includes(s.set)&&(o=o.replace(/(/,'$1 fill="currentColor">')),i.fixViewbox.includes(s.set)&&!o.includes("viewBox")){let l=i.viewboxes[t]||24;o=o.replace(/(/,'$1 viewBox="0 0 '+l+" "+l+'">')}s.defaultHTML&&(o=o.replace("",s.defaultHTML+"")),s.innerHTML=o}).catch(o=>{s.innerHTML="\u26A0\uFE0F",console.error(`Failed to load icon ${e} (error ${o})`)})}var h=class extends HTMLElement{static configure(e={}){for(let t in e)Array.isArray(e[t])?i[t]=i[t].concat(e[t]):typeof e[t]=="object"?i[t]=Object.assign(i[t],e[t]):i[t]=e[t];return c("configuring options"),i}get type(){return this.getAttribute("type")||i.defaultTypes[this.set]}get set(){let e=this.getAttribute("set")||i.defaultSet;return i.aliases[e]??e}get stroke(){let e=this.getAttribute("stroke");return!e&&i.strokeSet.includes(this.set)&&(e=i.defaultStroke),e}static get observedAttributes(){return["name","stroke","size","set","type"]}connectedCallback(){setTimeout(()=>{i.lazy?u.observe(this):this.init()})}init(){this.defaultHTML=this.innerHTML,this.loadIcon()}loadIcon(){let e=this.getAttribute("name");!e||(this.innerHTML="",this.hasAttribute("size")&&this.setSize(this.getAttribute("size")),e&&d(this,e,this.set,this.type))}setSize(e){this.style.setProperty("--size",e+"px"),i.opticalFont.includes(this.set)&&this.style.setProperty("--opsz",e)}attributeChangedCallback(e,t,r){typeof this.defaultHTML=="string"&&(c("Attr "+e+" changed from "+t+" to "+r),e==="size"?this.setSize(r):r&&(c("attribute changed"),this.loadIcon()))}};customElements.define("l-i",h);})();
+(()=>{var n="https://cdn.jsdelivr.net/",o={debug:!1,lazy:!0,replaceName:{},aliases:{bs:"bootstrap",bx:"boxicons",cs:"cssgg",gg:"cssgg",tb:"tabler",fa:"fontawesome",st:"supertiny",mi:"material",em:"emojicc",fl:"flags",in:"iconoir",eo:"eos",ft:"feather",ip:"iconpark",ph:"phosphor",ms:"symbols",lu:"lucide"},fonts:[],viewboxes:{boxicons:24,symbols:48},defaultTypes:{boxicons:"solid",fontawesome:"solid",material:"baseline",flags:"4x3",eos:"solid",phosphor:"regular",symbols:"outlined"},prefixes:{boxicons:{solid:"bxs",regular:"bx",logos:"bxl"},fontawesome:{solid:"fas",regular:"far",light:"fal",duotone:"fad",brands:"fab"}},defaultSet:"tabler",defaultStroke:2,paths:{bootstrap:n+"npm/bootstrap-icons@1/icons/{icon}.svg",boxicons:n+"npm/boxicons@2/svg/{type}/{prefix}-{icon}.svg",cssgg:n+"npm/css.gg@2/icons/svg/{icon}.svg",tabler:n+"npm/@tabler/icons@1/icons/{icon}.svg",fontawesome:n+"npm/@fortawesome/fontawesome-free@5/svgs/{type}/{icon}.svg",bytesize:n+"npm/bytesize-icons@1/dist/icons/{icon}.svg",supertiny:n+"npm/super-tiny-icons/images/svg/{icon}.svg",material:n+"npm/@material-icons/svg@1/svg/{icon}/{type}.svg",flags:n+"npm/flag-svg-collection@1/flags/{type}/{icon}.svg",emojicc:n+"npm/emoji-cc@1/svg/{icon}.svg",iconoir:n+"gh/lucaburgio/iconoir/icons/{icon}.svg",eos:n+"gh/lekoala/eos-icons-mirror/{type}/{icon}.svg",feather:n+"npm/feather-icons@4/dist/icons/{icon}.svg",iconpark:n+"gh/bytedance/IconPark/source/{type}/{icon}.svg",phosphor:n+"gh/phosphor-icons/phosphor-icons@1/assets/{type}/{icon}-{type}.svg",symbols:n+"npm/@material-symbols/svg-400@0.2.13/{type}/{icon}.svg",lucide:n+"npm/lucide-static/icons/{icon}.svg"},fixFill:["material","boxicons","fontawesome","eos","phosphor","symbols"],fixStroke:["iconpark"],fixViewbox:["boxicons","symbols"],strokeSet:["tabler","iconpark"],opticalFont:["symbols"]},a={},f={material:{class:"material-icons-{type}",types:{baseline:"",twotone:"two-tone",outline:"outlined"}},symbols:{class:"material-symbols-{type}"},boxicons:{class:"bx {prefix}-{icon}"},bootstrap:{class:"bi-{icon}"},fontawesome:{class:"{prefix} fa-{icon}"},iconoir:{class:"iconoir-{icon}"},eos:{class:"eos-icons-{type}",types:{solid:""}},phosphor:{class:"ph-{icon}-{type}",types:{solid:""}}},u=new window.IntersectionObserver((s,e)=>{s.forEach(async t=>{t.isIntersecting&&(e.unobserve(t.target),t.target.init())})});function g(s,e,t,r){let i=o.prefixes[t]&&o.prefixes[t][r]||null;return s=s.replace("{icon}",e),r?s=s.replaceAll("{type}",r):s=s.replace("-{type}",""),i&&(s=s.replace("{prefix}",i)),s}function c(s){!o.debug||console.log("[l-i] "+s)}function b(s,e,t){let r=o.paths[e],i=e+"-"+s;return t&&(i+="-"+t),r?(r=g(r,s,e,t),r&&a[i]?(c("Fetching "+i+" from cache"),a[i]):(c("Fetching "+i+" from url "+r),a[i]=fetch(r).then(function(l){if(l.ok)return l.text();throw Error(l.status)}),a[i])):new Promise(()=>{console.error(`Icon set ${e} does not exists`)})}function d(s,e,t,r){if(o.replaceName[e]&&(e=o.replaceName[e]),o.fonts.includes(t)){c("Using font for "+e);let i=f[t].class,l=i.includes("{icon}"),p=r;f[t].types&&r in f[t].types&&(p=f[t].types[r]),i=g(i,e,t,p),l?s.innerHTML='':s.innerHTML=''+e+"",s.stroke&&o.opticalFont.includes(s.set)&&s.style.setProperty("--weight",s.stroke*100);return}b(e,t,r).then(i=>{if(i.includes("class=")&&(i=i.replace(/ class="([a-z- ]*)"/g,"")),(s.stroke||o.fixStroke.includes(s.set))&&(i=i.replace(/stroke-width="([0-9]*)"/g,'stroke-width="'+s.stroke+'"')),o.fixFill.includes(s.set)&&(i=i.replace(/(/,'$1 fill="currentColor">')),o.fixViewbox.includes(s.set)&&!i.includes("viewBox")){let l=o.viewboxes[t]||24;i=i.replace(/(/,'$1 viewBox="0 0 '+l+" "+l+'">')}s.defaultHTML&&(i=i.replace("",s.defaultHTML+"")),s.innerHTML=i}).catch(i=>{s.innerHTML="\u26A0\uFE0F",console.error(`Failed to load icon ${e} (error ${i})`)})}function m(s){let e=s.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}var h=class extends HTMLElement{static configure(e={}){for(let t in e)Array.isArray(e[t])?o[t]=o[t].concat(e[t]):typeof e[t]=="object"?o[t]=Object.assign(o[t],e[t]):o[t]=e[t];return c("configuring options"),o}get type(){return this.getAttribute("type")||o.defaultTypes[this.set]}get set(){let e=this.getAttribute("set")||o.defaultSet;return o.aliases[e]??e}get stroke(){let e=this.getAttribute("stroke");return!e&&o.strokeSet.includes(this.set)&&(e=o.defaultStroke),e}static get observedAttributes(){return["name","stroke","size","set","type"]}connectedCallback(){setTimeout(()=>{o.lazy&&!m(this)?u.observe(this):this.init()})}init(){this.defaultHTML=this.innerHTML,this.loadIcon()}loadIcon(){let e=this.getAttribute("name");!e||(this.innerHTML="",this.hasAttribute("size")&&this.setSize(this.getAttribute("size")),e&&d(this,e,this.set,this.type))}setSize(e){this.style.setProperty("--size",e+"px"),o.opticalFont.includes(this.set)&&this.style.setProperty("--opsz",e)}attributeChangedCallback(e,t,r){typeof this.defaultHTML=="string"&&(c("Attr "+e+" changed from "+t+" to "+r),e==="size"?this.setSize(r):r&&(c("attribute changed"),this.loadIcon()))}};customElements.define("l-i",h);})();
//# sourceMappingURL=last-icon.min.js.map
diff --git a/last-icon.min.js.map b/last-icon.min.js.map
index 054a51f..2899d60 100644
--- a/last-icon.min.js.map
+++ b/last-icon.min.js.map
@@ -1,7 +1,7 @@
{
"version": 3,
"sources": ["last-icon.js"],
- "sourcesContent": ["const JSDELIVR = \"https://cdn.jsdelivr.net/\";\r\n\r\n/**\r\n * @typedef Options\r\n * @property {Boolean} debug Should we output messages to console\r\n * @property {Boolean} lazy Load icons lazily\r\n * @property {Object} replaceName Transparently replace icons with other values\r\n * @property {Object} aliases Icon sets aliases for ease of use\r\n * @property {Array} fonts Icon sets using font icons rather than svg\r\n * @property {Object} viewboxes View box values if not set in icon set\r\n * @property {Object} prefixes Types prefixes in each icon set\r\n * @property {Object} defaultTypes Default types for each icon set\r\n * @property {String} defaultSet Default icon set\r\n * @property {Number} defaultStroke Default stroke used\r\n * @property {Object} paths Svg loading paths\r\n * @property {Array} fixFill Fix fill for these sets\r\n * @property {Array} fixStroke Fix stroke for these sets\r\n * @property {Array} fixViewbox Fix viewbox for these sets\r\n */\r\nconst options = {\r\n debug: false,\r\n lazy: true,\r\n replaceName: {},\r\n aliases: {\r\n bs: \"bootstrap\",\r\n bx: \"boxicons\",\r\n cs: \"cssgg\",\r\n gg: \"cssgg\",\r\n tb: \"tabler\",\r\n fa: \"fontawesome\",\r\n st: \"supertiny\",\r\n mi: \"material\",\r\n em: \"emojicc\",\r\n fl: \"flags\",\r\n in: \"iconoir\",\r\n eo: \"eos\",\r\n ft: \"feather\",\r\n ip: \"iconpark\",\r\n ph: \"phosphor\",\r\n ms: \"symbols\",\r\n lu: \"lucide\",\r\n },\r\n fonts: [],\r\n viewboxes: {\r\n boxicons: 24,\r\n symbols: 48,\r\n },\r\n defaultTypes: {\r\n boxicons: \"solid\",\r\n fontawesome: \"solid\",\r\n material: \"baseline\",\r\n flags: \"4x3\",\r\n eos: \"solid\",\r\n phosphor: \"regular\",\r\n symbols: \"outlined\",\r\n },\r\n prefixes: {\r\n boxicons: {\r\n solid: \"bxs\",\r\n regular: \"bx\",\r\n logos: \"bxl\",\r\n },\r\n fontawesome: {\r\n solid: \"fas\",\r\n regular: \"far\",\r\n light: \"fal\",\r\n duotone: \"fad\",\r\n brands: \"fab\",\r\n },\r\n },\r\n defaultSet: \"tabler\",\r\n defaultStroke: 2,\r\n paths: {\r\n bootstrap: JSDELIVR + \"npm/bootstrap-icons@1/icons/{icon}.svg\",\r\n // type: solid, regular, logos\r\n boxicons: JSDELIVR + \"npm/boxicons@2/svg/{type}/{prefix}-{icon}.svg\",\r\n cssgg: JSDELIVR + \"npm/css.gg@2/icons/svg/{icon}.svg\",\r\n tabler: JSDELIVR + \"npm/@tabler/icons@1/icons/{icon}.svg\",\r\n // type: solid, regular, brands, light, duotone\r\n fontawesome: JSDELIVR + \"npm/@fortawesome/fontawesome-free@5/svgs/{type}/{icon}.svg\",\r\n bytesize: JSDELIVR + \"npm/bytesize-icons@1/dist/icons/{icon}.svg\",\r\n supertiny: JSDELIVR + \"npm/super-tiny-icons/images/svg/{icon}.svg\",\r\n // type: baseline, outline, round, sharp, twotone\r\n material: JSDELIVR + \"npm/@material-icons/svg@1/svg/{icon}/{type}.svg\",\r\n // type : 4x3 or 1x1\r\n flags: JSDELIVR + \"npm/flag-svg-collection@1/flags/{type}/{icon}.svg\",\r\n emojicc: JSDELIVR + \"npm/emoji-cc@1/svg/{icon}.svg\",\r\n iconoir: JSDELIVR + \"gh/lucaburgio/iconoir/icons/{icon}.svg\",\r\n // type: solid, outlined, animated\r\n eos: JSDELIVR + \"gh/lekoala/eos-icons-mirror/{type}/{icon}.svg\",\r\n feather: JSDELIVR + \"npm/feather-icons@4/dist/icons/{icon}.svg\",\r\n // type: 33 types ! see website\r\n iconpark: JSDELIVR + \"gh/bytedance/IconPark/source/{type}/{icon}.svg\",\r\n // type: bold, duotone, fill, light, regular, thin\r\n phosphor: JSDELIVR + \"gh/phosphor-icons/phosphor-icons@1/assets/{type}/{icon}-{type}.svg\",\r\n // type: outlined, rounded, sharp\r\n symbols: JSDELIVR + \"npm/@material-symbols/svg-400@0.2.13/{type}/{icon}.svg\",\r\n lucide: JSDELIVR + \"npm/lucide-static/icons/{icon}.svg\"\r\n },\r\n fixFill: [\"material\", \"boxicons\", \"fontawesome\", \"eos\", \"phosphor\", \"symbols\"],\r\n fixStroke: [\"iconpark\"],\r\n fixViewbox: [\"boxicons\", \"symbols\"],\r\n strokeSet: [\"tabler\", \"iconpark\"],\r\n opticalFont: [\"symbols\"],\r\n};\r\n\r\nconst CACHE = {};\r\nconst FONT_ICONS = {\r\n material: {\r\n class: \"material-icons-{type}\",\r\n types: {\r\n baseline: \"\",\r\n twotone: \"two-tone\",\r\n outline: \"outlined\",\r\n },\r\n },\r\n symbols: {\r\n class: \"material-symbols-{type}\",\r\n },\r\n boxicons: {\r\n class: \"bx {prefix}-{icon}\",\r\n },\r\n bootstrap: {\r\n class: \"bi-{icon}\",\r\n },\r\n fontawesome: {\r\n class: \"{prefix} fa-{icon}\",\r\n },\r\n iconoir: {\r\n class: \"iconoir-{icon}\",\r\n },\r\n eos: {\r\n class: \"eos-icons-{type}\",\r\n types: {\r\n solid: \"\",\r\n },\r\n },\r\n // Note: duotone not supported yet\r\n phosphor: {\r\n class: \"ph-{icon}-{type}\",\r\n types: {\r\n solid: \"\",\r\n },\r\n },\r\n};\r\n\r\n/**\r\n * @var {IntersectionObserver}\r\n */\r\nconst observer = new window.IntersectionObserver((entries, observerRef) => {\r\n entries.forEach(async (entry) => {\r\n if (entry.isIntersecting) {\r\n observerRef.unobserve(entry.target);\r\n entry.target.init();\r\n }\r\n });\r\n});\r\n\r\n/**\r\n * @param {string} value\r\n * @param {string} iconName\r\n * @param {string} iconSet\r\n * @param {string} iconType\r\n * @return {string}\r\n */\r\nfunction replacePlaceholders(value, iconName, iconSet, iconType) {\r\n let iconPrefix = (options.prefixes[iconSet] && options.prefixes[iconSet][iconType]) || null;\r\n value = value.replace(\"{icon}\", iconName);\r\n if (iconType) {\r\n value = value.replaceAll(\"{type}\", iconType);\r\n } else {\r\n // Maybe we want to remove the type like in material icons\r\n value = value.replace(\"-{type}\", \"\");\r\n }\r\n if (iconPrefix) {\r\n value = value.replace(\"{prefix}\", iconPrefix);\r\n }\r\n return value;\r\n}\r\n\r\nfunction log(message) {\r\n if (!options.debug) {\r\n return;\r\n }\r\n console.log(\"[l-i] \" + message);\r\n}\r\n\r\n/**\r\n * @param {string} iconName\r\n * @param {string} iconSet\r\n * @param {string} iconType\r\n * @return {Promise}\r\n */\r\nfunction getIconSvg(iconName, iconSet, iconType) {\r\n let iconUrl = options.paths[iconSet];\r\n let cacheKey = iconSet + \"-\" + iconName;\r\n if (iconType) {\r\n cacheKey += \"-\" + iconType;\r\n }\r\n if (!iconUrl) {\r\n return new Promise(() => {\r\n console.error(`Icon set ${iconSet} does not exists`);\r\n });\r\n }\r\n\r\n iconUrl = replacePlaceholders(iconUrl, iconName, iconSet, iconType);\r\n\r\n // If we have it in cache\r\n if (iconUrl && CACHE[cacheKey]) {\r\n log(\"Fetching \" + cacheKey + \" from cache\");\r\n return CACHE[cacheKey];\r\n }\r\n\r\n // Or resolve\r\n log(\"Fetching \" + cacheKey + \" from url \" + iconUrl);\r\n CACHE[cacheKey] = fetch(iconUrl).then(function (response) {\r\n if (response.ok) {\r\n return response.text();\r\n }\r\n throw Error(response.status);\r\n });\r\n return CACHE[cacheKey];\r\n}\r\n\r\n/**\r\n * @param {LastIcon} inst\r\n * @param {string} iconName\r\n * @param {string} iconSet\r\n * @param {string} iconType\r\n */\r\nfunction refreshIcon(inst, iconName, iconSet, iconType) {\r\n // Replace name\r\n if (options.replaceName[iconName]) {\r\n iconName = options.replaceName[iconName];\r\n }\r\n\r\n // Use font\r\n if (options.fonts.includes(iconSet)) {\r\n log(\"Using font for \" + iconName);\r\n let iconClass = FONT_ICONS[iconSet][\"class\"];\r\n let nameAsClass = iconClass.includes(\"{icon}\");\r\n let fontType = iconType;\r\n if (FONT_ICONS[iconSet][\"types\"] && iconType in FONT_ICONS[iconSet][\"types\"]) {\r\n fontType = FONT_ICONS[iconSet][\"types\"][iconType];\r\n }\r\n iconClass = replacePlaceholders(iconClass, iconName, iconSet, fontType);\r\n if (nameAsClass) {\r\n inst.innerHTML = '';\r\n } else {\r\n inst.innerHTML = '' + iconName + \"\";\r\n }\r\n if (inst.stroke && options.opticalFont.includes(inst.set)) {\r\n inst.style.setProperty(\"--weight\", inst.stroke * 100);\r\n }\r\n return; // Return early\r\n }\r\n\r\n getIconSvg(iconName, iconSet, iconType)\r\n .then((iconData) => {\r\n // Strip class attribute as it may be affected by css\r\n if (iconData.includes(\"class=\")) {\r\n iconData = iconData.replace(/ class=\"([a-z- ]*)\"/g, \"\");\r\n }\r\n // Add and/or fix stroke\r\n if (inst.stroke || options.fixStroke.includes(inst.set)) {\r\n iconData = iconData.replace(/stroke-width=\"([0-9]*)\"/g, 'stroke-width=\"' + inst.stroke + '\"');\r\n }\r\n // Fix fill to currentColor\r\n if (options.fixFill.includes(inst.set)) {\r\n iconData = iconData.replace(/(/, '$1 fill=\"currentColor\">');\r\n }\r\n // Fix viewbox if missing to allow easy sizing\r\n if (options.fixViewbox.includes(inst.set) && !iconData.includes(\"viewBox\")) {\r\n const size = options.viewboxes[iconSet] || 24;\r\n iconData = iconData.replace(/(/, '$1 viewBox=\"0 0 ' + size + \" \" + size + '\">');\r\n }\r\n // If we have some html, pass it along (useful for svg anim)\r\n if (inst.defaultHTML) {\r\n iconData = iconData.replace(\"\", inst.defaultHTML + \"\");\r\n }\r\n inst.innerHTML = iconData;\r\n })\r\n .catch((error) => {\r\n inst.innerHTML = \"\u26A0\uFE0F\";\r\n console.error(`Failed to load icon ${iconName} (error ${error})`);\r\n });\r\n}\r\n\r\nclass LastIcon extends HTMLElement {\r\n /**\r\n * @param {object} opts\r\n * @returns {Options} The updated option object\r\n */\r\n static configure(opts = {}) {\r\n for (const k in opts) {\r\n // Check first for isArray because typeof array is also object\r\n if (Array.isArray(opts[k])) {\r\n options[k] = options[k].concat(opts[k]);\r\n } else if (typeof opts[k] === \"object\") {\r\n options[k] = Object.assign(options[k], opts[k]);\r\n } else {\r\n options[k] = opts[k];\r\n }\r\n }\r\n // Log after we had the opportunity to change debug flag\r\n log(\"configuring options\");\r\n return options;\r\n }\r\n\r\n get type() {\r\n return this.getAttribute(\"type\") || options.defaultTypes[this.set];\r\n }\r\n\r\n get set() {\r\n let v = this.getAttribute(\"set\") || options.defaultSet;\r\n return options.aliases[v] ?? v;\r\n }\r\n\r\n get stroke() {\r\n let v = this.getAttribute(\"stroke\");\r\n if (!v && options.strokeSet.includes(this.set)) {\r\n v = options.defaultStroke;\r\n }\r\n return v;\r\n }\r\n\r\n static get observedAttributes() {\r\n return [\"name\", \"stroke\", \"size\", \"set\", \"type\"];\r\n }\r\n\r\n connectedCallback() {\r\n // innerHTML is not available because not parsed yet\r\n setTimeout(() => {\r\n // Do this is setTimeout to allow whenDefined to kick in before\r\n // otherwise it cannot be configured\r\n if (options.lazy) {\r\n // observer will call init when element is visible\r\n observer.observe(this);\r\n } else {\r\n // init directly\r\n this.init();\r\n }\r\n });\r\n }\r\n\r\n init() {\r\n // Store default content as we will inject it back later\r\n this.defaultHTML = this.innerHTML;\r\n this.loadIcon();\r\n }\r\n\r\n loadIcon() {\r\n const name = this.getAttribute(\"name\");\r\n if (!name) {\r\n return;\r\n }\r\n\r\n // Clear icon\r\n this.innerHTML = \"\";\r\n // Useful for customizing size in css\r\n if (this.hasAttribute(\"size\")) {\r\n this.setSize(this.getAttribute(\"size\"));\r\n }\r\n if (name) {\r\n refreshIcon(this, name, this.set, this.type);\r\n }\r\n }\r\n\r\n setSize(size) {\r\n this.style.setProperty(\"--size\", size + \"px\");\r\n if (options.opticalFont.includes(this.set)) {\r\n this.style.setProperty(\"--opsz\", size);\r\n }\r\n }\r\n\r\n attributeChangedCallback(attr, oldVal, newVal) {\r\n // Wait until properly loaded for the first time\r\n if (typeof this.defaultHTML !== \"string\") {\r\n return;\r\n }\r\n log(\"Attr \" + attr + \" changed from \" + oldVal + \" to \" + newVal);\r\n if (attr === \"size\") {\r\n this.setSize(newVal);\r\n } else if (newVal) {\r\n log(\"attribute changed\");\r\n this.loadIcon();\r\n }\r\n }\r\n}\r\n\r\ncustomElements.define(\"l-i\", LastIcon);\r\n"],
- "mappings": "MAAA,GAAM,GAAW,4BAmBX,EAAU,CACd,MAAO,GACP,KAAM,GACN,YAAa,CAAC,EACd,QAAS,CACP,GAAI,YACJ,GAAI,WACJ,GAAI,QACJ,GAAI,QACJ,GAAI,SACJ,GAAI,cACJ,GAAI,YACJ,GAAI,WACJ,GAAI,UACJ,GAAI,QACJ,GAAI,UACJ,GAAI,MACJ,GAAI,UACJ,GAAI,WACJ,GAAI,WACJ,GAAI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,eAAe,OAAO,MAAO,CAAQ",
+ "sourcesContent": ["const JSDELIVR = \"https://cdn.jsdelivr.net/\";\r\n\r\n/**\r\n * @typedef Options\r\n * @property {Boolean} debug Should we output messages to console\r\n * @property {Boolean} lazy Load icons lazily\r\n * @property {Object} replaceName Transparently replace icons with other values\r\n * @property {Object} aliases Icon sets aliases for ease of use\r\n * @property {Array} fonts Icon sets using font icons rather than svg\r\n * @property {Object} viewboxes View box values if not set in icon set\r\n * @property {Object} prefixes Types prefixes in each icon set\r\n * @property {Object} defaultTypes Default types for each icon set\r\n * @property {String} defaultSet Default icon set\r\n * @property {Number} defaultStroke Default stroke used\r\n * @property {Object} paths Svg loading paths\r\n * @property {Array} fixFill Fix fill for these sets\r\n * @property {Array} fixStroke Fix stroke for these sets\r\n * @property {Array} fixViewbox Fix viewbox for these sets\r\n */\r\nconst options = {\r\n debug: false,\r\n lazy: true,\r\n replaceName: {},\r\n aliases: {\r\n bs: \"bootstrap\",\r\n bx: \"boxicons\",\r\n cs: \"cssgg\",\r\n gg: \"cssgg\",\r\n tb: \"tabler\",\r\n fa: \"fontawesome\",\r\n st: \"supertiny\",\r\n mi: \"material\",\r\n em: \"emojicc\",\r\n fl: \"flags\",\r\n in: \"iconoir\",\r\n eo: \"eos\",\r\n ft: \"feather\",\r\n ip: \"iconpark\",\r\n ph: \"phosphor\",\r\n ms: \"symbols\",\r\n lu: \"lucide\",\r\n },\r\n fonts: [],\r\n viewboxes: {\r\n boxicons: 24,\r\n symbols: 48,\r\n },\r\n defaultTypes: {\r\n boxicons: \"solid\",\r\n fontawesome: \"solid\",\r\n material: \"baseline\",\r\n flags: \"4x3\",\r\n eos: \"solid\",\r\n phosphor: \"regular\",\r\n symbols: \"outlined\",\r\n },\r\n prefixes: {\r\n boxicons: {\r\n solid: \"bxs\",\r\n regular: \"bx\",\r\n logos: \"bxl\",\r\n },\r\n fontawesome: {\r\n solid: \"fas\",\r\n regular: \"far\",\r\n light: \"fal\",\r\n duotone: \"fad\",\r\n brands: \"fab\",\r\n },\r\n },\r\n defaultSet: \"tabler\",\r\n defaultStroke: 2,\r\n paths: {\r\n bootstrap: JSDELIVR + \"npm/bootstrap-icons@1/icons/{icon}.svg\",\r\n // type: solid, regular, logos\r\n boxicons: JSDELIVR + \"npm/boxicons@2/svg/{type}/{prefix}-{icon}.svg\",\r\n cssgg: JSDELIVR + \"npm/css.gg@2/icons/svg/{icon}.svg\",\r\n tabler: JSDELIVR + \"npm/@tabler/icons@1/icons/{icon}.svg\",\r\n // type: solid, regular, brands, light, duotone\r\n fontawesome: JSDELIVR + \"npm/@fortawesome/fontawesome-free@5/svgs/{type}/{icon}.svg\",\r\n bytesize: JSDELIVR + \"npm/bytesize-icons@1/dist/icons/{icon}.svg\",\r\n supertiny: JSDELIVR + \"npm/super-tiny-icons/images/svg/{icon}.svg\",\r\n // type: baseline, outline, round, sharp, twotone\r\n material: JSDELIVR + \"npm/@material-icons/svg@1/svg/{icon}/{type}.svg\",\r\n // type : 4x3 or 1x1\r\n flags: JSDELIVR + \"npm/flag-svg-collection@1/flags/{type}/{icon}.svg\",\r\n emojicc: JSDELIVR + \"npm/emoji-cc@1/svg/{icon}.svg\",\r\n iconoir: JSDELIVR + \"gh/lucaburgio/iconoir/icons/{icon}.svg\",\r\n // type: solid, outlined, animated\r\n eos: JSDELIVR + \"gh/lekoala/eos-icons-mirror/{type}/{icon}.svg\",\r\n feather: JSDELIVR + \"npm/feather-icons@4/dist/icons/{icon}.svg\",\r\n // type: 33 types ! see website\r\n iconpark: JSDELIVR + \"gh/bytedance/IconPark/source/{type}/{icon}.svg\",\r\n // type: bold, duotone, fill, light, regular, thin\r\n phosphor: JSDELIVR + \"gh/phosphor-icons/phosphor-icons@1/assets/{type}/{icon}-{type}.svg\",\r\n // type: outlined, rounded, sharp\r\n symbols: JSDELIVR + \"npm/@material-symbols/svg-400@0.2.13/{type}/{icon}.svg\",\r\n lucide: JSDELIVR + \"npm/lucide-static/icons/{icon}.svg\"\r\n },\r\n fixFill: [\"material\", \"boxicons\", \"fontawesome\", \"eos\", \"phosphor\", \"symbols\"],\r\n fixStroke: [\"iconpark\"],\r\n fixViewbox: [\"boxicons\", \"symbols\"],\r\n strokeSet: [\"tabler\", \"iconpark\"],\r\n opticalFont: [\"symbols\"],\r\n};\r\n\r\nconst CACHE = {};\r\nconst FONT_ICONS = {\r\n material: {\r\n class: \"material-icons-{type}\",\r\n types: {\r\n baseline: \"\",\r\n twotone: \"two-tone\",\r\n outline: \"outlined\",\r\n },\r\n },\r\n symbols: {\r\n class: \"material-symbols-{type}\",\r\n },\r\n boxicons: {\r\n class: \"bx {prefix}-{icon}\",\r\n },\r\n bootstrap: {\r\n class: \"bi-{icon}\",\r\n },\r\n fontawesome: {\r\n class: \"{prefix} fa-{icon}\",\r\n },\r\n iconoir: {\r\n class: \"iconoir-{icon}\",\r\n },\r\n eos: {\r\n class: \"eos-icons-{type}\",\r\n types: {\r\n solid: \"\",\r\n },\r\n },\r\n // Note: duotone not supported yet\r\n phosphor: {\r\n class: \"ph-{icon}-{type}\",\r\n types: {\r\n solid: \"\",\r\n },\r\n },\r\n};\r\n\r\n/**\r\n * @var {IntersectionObserver}\r\n */\r\nconst observer = new window.IntersectionObserver((entries, observerRef) => {\r\n entries.forEach(async (entry) => {\r\n if (entry.isIntersecting) {\r\n observerRef.unobserve(entry.target);\r\n entry.target.init();\r\n }\r\n });\r\n});\r\n\r\n/**\r\n * @param {string} value\r\n * @param {string} iconName\r\n * @param {string} iconSet\r\n * @param {string} iconType\r\n * @return {string}\r\n */\r\nfunction replacePlaceholders(value, iconName, iconSet, iconType) {\r\n let iconPrefix = (options.prefixes[iconSet] && options.prefixes[iconSet][iconType]) || null;\r\n value = value.replace(\"{icon}\", iconName);\r\n if (iconType) {\r\n value = value.replaceAll(\"{type}\", iconType);\r\n } else {\r\n // Maybe we want to remove the type like in material icons\r\n value = value.replace(\"-{type}\", \"\");\r\n }\r\n if (iconPrefix) {\r\n value = value.replace(\"{prefix}\", iconPrefix);\r\n }\r\n return value;\r\n}\r\n\r\nfunction log(message) {\r\n if (!options.debug) {\r\n return;\r\n }\r\n console.log(\"[l-i] \" + message);\r\n}\r\n\r\n/**\r\n * @param {string} iconName\r\n * @param {string} iconSet\r\n * @param {string} iconType\r\n * @return {Promise}\r\n */\r\nfunction getIconSvg(iconName, iconSet, iconType) {\r\n let iconUrl = options.paths[iconSet];\r\n let cacheKey = iconSet + \"-\" + iconName;\r\n if (iconType) {\r\n cacheKey += \"-\" + iconType;\r\n }\r\n if (!iconUrl) {\r\n return new Promise(() => {\r\n console.error(`Icon set ${iconSet} does not exists`);\r\n });\r\n }\r\n\r\n iconUrl = replacePlaceholders(iconUrl, iconName, iconSet, iconType);\r\n\r\n // If we have it in cache\r\n if (iconUrl && CACHE[cacheKey]) {\r\n log(\"Fetching \" + cacheKey + \" from cache\");\r\n return CACHE[cacheKey];\r\n }\r\n\r\n // Or resolve\r\n log(\"Fetching \" + cacheKey + \" from url \" + iconUrl);\r\n CACHE[cacheKey] = fetch(iconUrl).then(function (response) {\r\n if (response.ok) {\r\n return response.text();\r\n }\r\n throw Error(response.status);\r\n });\r\n return CACHE[cacheKey];\r\n}\r\n\r\n/**\r\n * @param {LastIcon} inst\r\n * @param {string} iconName\r\n * @param {string} iconSet\r\n * @param {string} iconType\r\n */\r\nfunction refreshIcon(inst, iconName, iconSet, iconType) {\r\n // Replace name\r\n if (options.replaceName[iconName]) {\r\n iconName = options.replaceName[iconName];\r\n }\r\n\r\n // Use font\r\n if (options.fonts.includes(iconSet)) {\r\n log(\"Using font for \" + iconName);\r\n let iconClass = FONT_ICONS[iconSet][\"class\"];\r\n let nameAsClass = iconClass.includes(\"{icon}\");\r\n let fontType = iconType;\r\n if (FONT_ICONS[iconSet][\"types\"] && iconType in FONT_ICONS[iconSet][\"types\"]) {\r\n fontType = FONT_ICONS[iconSet][\"types\"][iconType];\r\n }\r\n iconClass = replacePlaceholders(iconClass, iconName, iconSet, fontType);\r\n if (nameAsClass) {\r\n inst.innerHTML = '';\r\n } else {\r\n inst.innerHTML = '' + iconName + \"\";\r\n }\r\n if (inst.stroke && options.opticalFont.includes(inst.set)) {\r\n inst.style.setProperty(\"--weight\", inst.stroke * 100);\r\n }\r\n return; // Return early\r\n }\r\n\r\n getIconSvg(iconName, iconSet, iconType)\r\n .then((iconData) => {\r\n // Strip class attribute as it may be affected by css\r\n if (iconData.includes(\"class=\")) {\r\n iconData = iconData.replace(/ class=\"([a-z- ]*)\"/g, \"\");\r\n }\r\n // Add and/or fix stroke\r\n if (inst.stroke || options.fixStroke.includes(inst.set)) {\r\n iconData = iconData.replace(/stroke-width=\"([0-9]*)\"/g, 'stroke-width=\"' + inst.stroke + '\"');\r\n }\r\n // Fix fill to currentColor\r\n if (options.fixFill.includes(inst.set)) {\r\n iconData = iconData.replace(/(/, '$1 fill=\"currentColor\">');\r\n }\r\n // Fix viewbox if missing to allow easy sizing\r\n if (options.fixViewbox.includes(inst.set) && !iconData.includes(\"viewBox\")) {\r\n const size = options.viewboxes[iconSet] || 24;\r\n iconData = iconData.replace(/(/, '$1 viewBox=\"0 0 ' + size + \" \" + size + '\">');\r\n }\r\n // If we have some html, pass it along (useful for svg anim)\r\n if (inst.defaultHTML) {\r\n iconData = iconData.replace(\"\", inst.defaultHTML + \"\");\r\n }\r\n inst.innerHTML = iconData;\r\n })\r\n .catch((error) => {\r\n inst.innerHTML = \"\u26A0\uFE0F\";\r\n console.error(`Failed to load icon ${iconName} (error ${error})`);\r\n });\r\n}\r\n\r\n/**\r\n * @param {HTMLElement} element \r\n * @returns {Boolean}\r\n */\r\nfunction isInViewport(element) {\r\n const rect = element.getBoundingClientRect();\r\n return (\r\n rect.top >= 0 &&\r\n rect.left >= 0 &&\r\n rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&\r\n rect.right <= (window.innerWidth || document.documentElement.clientWidth)\r\n );\r\n}\r\n\r\nclass LastIcon extends HTMLElement {\r\n /**\r\n * @param {object} opts\r\n * @returns {Options} The updated option object\r\n */\r\n static configure(opts = {}) {\r\n for (const k in opts) {\r\n // Check first for isArray because typeof array is also object\r\n if (Array.isArray(opts[k])) {\r\n options[k] = options[k].concat(opts[k]);\r\n } else if (typeof opts[k] === \"object\") {\r\n options[k] = Object.assign(options[k], opts[k]);\r\n } else {\r\n options[k] = opts[k];\r\n }\r\n }\r\n // Log after we had the opportunity to change debug flag\r\n log(\"configuring options\");\r\n return options;\r\n }\r\n\r\n get type() {\r\n return this.getAttribute(\"type\") || options.defaultTypes[this.set];\r\n }\r\n\r\n get set() {\r\n let v = this.getAttribute(\"set\") || options.defaultSet;\r\n return options.aliases[v] ?? v;\r\n }\r\n\r\n get stroke() {\r\n let v = this.getAttribute(\"stroke\");\r\n if (!v && options.strokeSet.includes(this.set)) {\r\n v = options.defaultStroke;\r\n }\r\n return v;\r\n }\r\n\r\n static get observedAttributes() {\r\n return [\"name\", \"stroke\", \"size\", \"set\", \"type\"];\r\n }\r\n\r\n connectedCallback() {\r\n // innerHTML is not available because not parsed yet\r\n // setTimeout also allows whenDefined to kick in before init\r\n setTimeout(() => {\r\n if (options.lazy && !isInViewport(this)) {\r\n // observer will call init when element is visible\r\n observer.observe(this);\r\n } else {\r\n // init directly\r\n this.init();\r\n }\r\n });\r\n }\r\n\r\n init() {\r\n // Store default content as we will inject it back later\r\n this.defaultHTML = this.innerHTML;\r\n this.loadIcon();\r\n }\r\n\r\n loadIcon() {\r\n const name = this.getAttribute(\"name\");\r\n if (!name) {\r\n return;\r\n }\r\n\r\n // Clear icon\r\n this.innerHTML = \"\";\r\n // Useful for customizing size in css\r\n if (this.hasAttribute(\"size\")) {\r\n this.setSize(this.getAttribute(\"size\"));\r\n }\r\n if (name) {\r\n refreshIcon(this, name, this.set, this.type);\r\n }\r\n }\r\n\r\n setSize(size) {\r\n this.style.setProperty(\"--size\", size + \"px\");\r\n if (options.opticalFont.includes(this.set)) {\r\n this.style.setProperty(\"--opsz\", size);\r\n }\r\n }\r\n\r\n attributeChangedCallback(attr, oldVal, newVal) {\r\n // Wait until properly loaded for the first time\r\n if (typeof this.defaultHTML !== \"string\") {\r\n return;\r\n }\r\n log(\"Attr \" + attr + \" changed from \" + oldVal + \" to \" + newVal);\r\n if (attr === \"size\") {\r\n this.setSize(newVal);\r\n } else if (newVal) {\r\n log(\"attribute changed\");\r\n this.loadIcon();\r\n }\r\n }\r\n}\r\n\r\ncustomElements.define(\"l-i\", LastIcon);\r\n"],
+ "mappings": "MAAA,GAAM,GAAW,4BAmBX,EAAU,CACd,MAAO,GACP,KAAM,GACN,YAAa,CAAC,EACd,QAAS,CACP,GAAI,YACJ,GAAI,WACJ,GAAI,QACJ,GAAI,QACJ,GAAI,SACJ,GAAI,cACJ,GAAI,YACJ,GAAI,WACJ,GAAI,UACJ,GAAI,QACJ,GAAI,UACJ,GAAI,MACJ,GAAI,UACJ,GAAI,WACJ,GAAI,WACJ,GAAI,UACJ,GAAI,QACN,EACA,MAAO,CAAC,EACR,UAAW,CACT,SAAU,GACV,QAAS,EACX,EACA,aAAc,CACZ,SAAU,QACV,YAAa,QACb,SAAU,WACV,MAAO,MACP,IAAK,QACL,SAAU,UACV,QAAS,UACX,EACA,SAAU,CACR,SAAU,CACR,MAAO,MACP,QAAS,KACT,MAAO,KACT,EACA,YAAa,CACX,MAAO,MACP,QAAS,MACT,MAAO,MACP,QAAS,MACT,OAAQ,KACV,CACF,EACA,WAAY,SACZ,cAAe,EACf,MAAO,CACL,UAAW,EAAW,yCAEtB,SAAU,EAAW,gDACrB,MAAO,EAAW,oCAClB,OAAQ,EAAW,uCAEnB,YAAa,EAAW,6DACxB,SAAU,EAAW,6CACrB,UAAW,EAAW,6CAEtB,SAAU,EAAW,kDAErB,MAAO,EAAW,oDAClB,QAAS,EAAW,gCACpB,QAAS,EAAW,yCAEpB,IAAK,EAAW,gDAChB,QAAS,EAAW,4CAEpB,SAAU,EAAW,iDAErB,SAAU,EAAW,qEAErB,QAAS,EAAW,yDACpB,OAAQ,EAAW,oCACrB,EACA,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CAEA,mBAAoB,CAGlB,WAAW,IAAM,CACf,AAAI,EAAQ,MAAQ,CAAC,EAAa,IAAI,EAEpC,EAAS,QAAQ,IAAI,EAGrB,KAAK,KAAK,CAEd,CAAC,CACH,CAEA,MAAO,CAEL,KAAK,YAAc,KAAK,UACxB,KAAK,SAAS,CAChB,CAEA,UAAW,CACT,GAAM,GAAO,KAAK,aAAa,MAAM,EACrC,AAAI,CAAC,GAKL,MAAK,UAAY,GAEb,KAAK,aAAa,MAAM,GAC1B,KAAK,QAAQ,KAAK,aAAa,MAAM,CAAC,EAEpC,GACF,EAAY,KAAM,EAAM,KAAK,IAAK,KAAK,IAAI,EAE/C,CAEA,QAAQ,EAAM,CACZ,KAAK,MAAM,YAAY,SAAU,EAAO,IAAI,EACxC,EAAQ,YAAY,SAAS,KAAK,GAAG,GACvC,KAAK,MAAM,YAAY,SAAU,CAAI,CAEzC,CAEA,yBAAyB,EAAM,EAAQ,EAAQ,CAE7C,AAAI,MAAO,MAAK,aAAgB,UAGhC,GAAI,QAAU,EAAO,iBAAmB,EAAS,OAAS,CAAM,EAChE,AAAI,IAAS,OACX,KAAK,QAAQ,CAAM,EACV,GACT,GAAI,mBAAmB,EACvB,KAAK,SAAS,GAElB,CACF,EAEA,eAAe,OAAO,MAAO,CAAQ",
"names": []
}
diff --git a/package.json b/package.json
index c6729df..e59bd26 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "last-icon",
- "version": "2.0.1",
+ "version": "2.0.2",
"description": "One custom icon element to rule them all",
"main": "last-icon.js",
"scripts": {