iconly 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +17 -13
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +17 -13
- package/dist/index.module.js.map +1 -1
- package/package.json +1 -1
- package/src/index.js +26 -20
package/dist/index.js
CHANGED
|
@@ -18,24 +18,28 @@ class $4fa36e821943b400$export$2e2bcd8739ae039 {
|
|
|
18
18
|
this.init().then();
|
|
19
19
|
}
|
|
20
20
|
async init() {
|
|
21
|
-
const { file: file
|
|
22
|
-
if (this.isLocalStorage && localStorage.getItem("inlineSVGrev") === revision) {
|
|
23
|
-
const data = localStorage.getItem("inlineSVGdata");
|
|
24
|
-
if (data) {
|
|
25
|
-
this.insert(data);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
21
|
+
const { file: file } = this.options;
|
|
29
22
|
if (document.querySelector("#iconset")) return;
|
|
30
|
-
|
|
23
|
+
if (this.isLocalStorage) {
|
|
24
|
+
const storedSize = localStorage.getItem("inlineSVGsize");
|
|
25
|
+
try {
|
|
26
|
+
const response = await fetch(file);
|
|
27
|
+
if (!response.ok) throw new Error("Network response was not ok");
|
|
28
|
+
const data = await response.text();
|
|
29
|
+
if (storedSize && storedSize === data.length.toString()) this.insert(localStorage.getItem("inlineSVGdata"));
|
|
30
|
+
else {
|
|
31
|
+
this.insert(data);
|
|
32
|
+
localStorage.setItem("inlineSVGdata", data);
|
|
33
|
+
localStorage.setItem("inlineSVGsize", data.length.toString());
|
|
34
|
+
}
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error("There was a problem with the network fetch operation:", error);
|
|
37
|
+
}
|
|
38
|
+
} else try {
|
|
31
39
|
const response = await fetch(file);
|
|
32
40
|
if (!response.ok) throw new Error("Network response was not ok");
|
|
33
41
|
const data = await response.text();
|
|
34
42
|
this.insert(data);
|
|
35
|
-
if (this.isLocalStorage) {
|
|
36
|
-
localStorage.setItem("inlineSVGdata", data);
|
|
37
|
-
localStorage.setItem("inlineSVGrev", revision);
|
|
38
|
-
}
|
|
39
43
|
} catch (error) {
|
|
40
44
|
console.error("There was a problem with the network fetch operation:", error);
|
|
41
45
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;AAAe;IACd,YAAY,OAAO,CAAE;QACpB,IAAI,CAAC,UAAU;YAAE,GAAG,OAAO;QAAC;QAC5B,IAAI,CAAC,iBAAiB,CAAC,CAAE,MAAM,CAAC,eAAe;QAC/C,IAAI,CAAC,OAAO,SAAS;QAErB,IAAI,CAAC,OAAO;IACb;IAEA,MAAM,OAAO;QACZ,MAAM,QAAE,IAAI,
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAe;IACd,YAAY,OAAO,CAAE;QACpB,IAAI,CAAC,UAAU;YAAE,GAAG,OAAO;QAAC;QAC5B,IAAI,CAAC,iBAAiB,CAAC,CAAE,MAAM,CAAC,eAAe;QAC/C,IAAI,CAAC,OAAO,SAAS;QAErB,IAAI,CAAC,OAAO;IACb;IAEA,MAAM,OAAO;QACZ,MAAM,QAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QAEtB,IAAI,SAAS,cAAc,aAAa;QAExC,IAAI,IAAI,CAAC,gBAAgB;YACxB,MAAM,aAAa,aAAa,QAAQ;YAExC,IAAI;gBACH,MAAM,WAAW,MAAM,MAAM;gBAE7B,IAAI,CAAC,SAAS,IAAI,MAAM,IAAI,MAAM;gBAElC,MAAM,OAAO,MAAM,SAAS;gBAE5B,IAAI,cAAc,eAAe,KAAK,OAAO,YAC5C,IAAI,CAAC,OAAO,aAAa,QAAQ;qBAC3B;oBACN,IAAI,CAAC,OAAO;oBAEZ,aAAa,QAAQ,iBAAiB;oBACtC,aAAa,QAAQ,iBAAiB,KAAK,OAAO;gBACnD;YACD,EAAE,OAAO,OAAO;gBACf,QAAQ,MAAM,yDAAyD;YACxE;QACD,OACC,IAAI;YACH,MAAM,WAAW,MAAM,MAAM;YAE7B,IAAI,CAAC,SAAS,IAAI,MAAM,IAAI,MAAM;YAElC,MAAM,OAAO,MAAM,SAAS;YAE5B,IAAI,CAAC,OAAO;QACb,EAAE,OAAO,OAAO;YACf,QAAQ,MAAM,yDAAyD;QACxE;IAEF;IAEA,OAAO,IAAI,EAAE;QACZ,IAAI,IAAI,CAAC,MACR,IAAI,CAAC,KAAK,mBAAmB,aAAa;aAE1C,SAAS,iBAAiB,oBAAoB;YAC7C,IAAI,CAAC,KAAK,mBAAmB,aAAa;QAC3C;IAEF;AACD","sources":["src/index.js"],"sourcesContent":["export default class Iconly {\r\n\tconstructor(options) {\r\n\t\tthis.options = { ...options }\r\n\t\tthis.isLocalStorage = !!(window['localStorage'])\r\n\t\tthis.body = document.body\r\n\r\n\t\tthis.init().then()\r\n\t}\r\n\r\n\tasync init() {\r\n\t\tconst { file } = this.options\r\n\r\n\t\tif (document.querySelector('#iconset')) return\r\n\r\n\t\tif (this.isLocalStorage) {\r\n\t\t\tconst storedSize = localStorage.getItem('inlineSVGsize')\r\n\r\n\t\t\ttry {\r\n\t\t\t\tconst response = await fetch(file)\r\n\r\n\t\t\t\tif (!response.ok) throw new Error('Network response was not ok')\r\n\r\n\t\t\t\tconst data = await response.text()\r\n\r\n\t\t\t\tif (storedSize && storedSize === data.length.toString()) {\r\n\t\t\t\t\tthis.insert(localStorage.getItem('inlineSVGdata'))\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.insert(data)\r\n\r\n\t\t\t\t\tlocalStorage.setItem('inlineSVGdata', data)\r\n\t\t\t\t\tlocalStorage.setItem('inlineSVGsize', data.length.toString())\r\n\t\t\t\t}\r\n\t\t\t} catch (error) {\r\n\t\t\t\tconsole.error('There was a problem with the network fetch operation:', error)\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\ttry {\r\n\t\t\t\tconst response = await fetch(file)\r\n\r\n\t\t\t\tif (!response.ok) throw new Error('Network response was not ok')\r\n\r\n\t\t\t\tconst data = await response.text()\r\n\r\n\t\t\t\tthis.insert(data)\r\n\t\t\t} catch (error) {\r\n\t\t\t\tconsole.error('There was a problem with the network fetch operation:', error)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tinsert(data) {\r\n\t\tif (this.body) {\r\n\t\t\tthis.body.insertAdjacentHTML('beforeend', data)\r\n\t\t} else {\r\n\t\t\tdocument.addEventListener('DOMContentLoaded', () => {\r\n\t\t\t\tthis.body.insertAdjacentHTML('beforeend', data)\r\n\t\t\t})\r\n\t\t}\r\n\t}\r\n}"],"names":[],"version":3,"file":"index.js.map"}
|
package/dist/index.module.js
CHANGED
|
@@ -8,24 +8,28 @@ class $cf838c15c8b009ba$export$2e2bcd8739ae039 {
|
|
|
8
8
|
this.init().then();
|
|
9
9
|
}
|
|
10
10
|
async init() {
|
|
11
|
-
const { file: file
|
|
12
|
-
if (this.isLocalStorage && localStorage.getItem("inlineSVGrev") === revision) {
|
|
13
|
-
const data = localStorage.getItem("inlineSVGdata");
|
|
14
|
-
if (data) {
|
|
15
|
-
this.insert(data);
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
11
|
+
const { file: file } = this.options;
|
|
19
12
|
if (document.querySelector("#iconset")) return;
|
|
20
|
-
|
|
13
|
+
if (this.isLocalStorage) {
|
|
14
|
+
const storedSize = localStorage.getItem("inlineSVGsize");
|
|
15
|
+
try {
|
|
16
|
+
const response = await fetch(file);
|
|
17
|
+
if (!response.ok) throw new Error("Network response was not ok");
|
|
18
|
+
const data = await response.text();
|
|
19
|
+
if (storedSize && storedSize === data.length.toString()) this.insert(localStorage.getItem("inlineSVGdata"));
|
|
20
|
+
else {
|
|
21
|
+
this.insert(data);
|
|
22
|
+
localStorage.setItem("inlineSVGdata", data);
|
|
23
|
+
localStorage.setItem("inlineSVGsize", data.length.toString());
|
|
24
|
+
}
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error("There was a problem with the network fetch operation:", error);
|
|
27
|
+
}
|
|
28
|
+
} else try {
|
|
21
29
|
const response = await fetch(file);
|
|
22
30
|
if (!response.ok) throw new Error("Network response was not ok");
|
|
23
31
|
const data = await response.text();
|
|
24
32
|
this.insert(data);
|
|
25
|
-
if (this.isLocalStorage) {
|
|
26
|
-
localStorage.setItem("inlineSVGdata", data);
|
|
27
|
-
localStorage.setItem("inlineSVGrev", revision);
|
|
28
|
-
}
|
|
29
33
|
} catch (error) {
|
|
30
34
|
console.error("There was a problem with the network fetch operation:", error);
|
|
31
35
|
}
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAe;IACd,YAAY,OAAO,CAAE;QACpB,IAAI,CAAC,UAAU;YAAE,GAAG,OAAO;QAAC;QAC5B,IAAI,CAAC,iBAAiB,CAAC,CAAE,MAAM,CAAC,eAAe;QAC/C,IAAI,CAAC,OAAO,SAAS;QAErB,IAAI,CAAC,OAAO;IACb;IAEA,MAAM,OAAO;QACZ,MAAM,QAAE,IAAI,
|
|
1
|
+
{"mappings":"AAAe;IACd,YAAY,OAAO,CAAE;QACpB,IAAI,CAAC,UAAU;YAAE,GAAG,OAAO;QAAC;QAC5B,IAAI,CAAC,iBAAiB,CAAC,CAAE,MAAM,CAAC,eAAe;QAC/C,IAAI,CAAC,OAAO,SAAS;QAErB,IAAI,CAAC,OAAO;IACb;IAEA,MAAM,OAAO;QACZ,MAAM,QAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QAEtB,IAAI,SAAS,cAAc,aAAa;QAExC,IAAI,IAAI,CAAC,gBAAgB;YACxB,MAAM,aAAa,aAAa,QAAQ;YAExC,IAAI;gBACH,MAAM,WAAW,MAAM,MAAM;gBAE7B,IAAI,CAAC,SAAS,IAAI,MAAM,IAAI,MAAM;gBAElC,MAAM,OAAO,MAAM,SAAS;gBAE5B,IAAI,cAAc,eAAe,KAAK,OAAO,YAC5C,IAAI,CAAC,OAAO,aAAa,QAAQ;qBAC3B;oBACN,IAAI,CAAC,OAAO;oBAEZ,aAAa,QAAQ,iBAAiB;oBACtC,aAAa,QAAQ,iBAAiB,KAAK,OAAO;gBACnD;YACD,EAAE,OAAO,OAAO;gBACf,QAAQ,MAAM,yDAAyD;YACxE;QACD,OACC,IAAI;YACH,MAAM,WAAW,MAAM,MAAM;YAE7B,IAAI,CAAC,SAAS,IAAI,MAAM,IAAI,MAAM;YAElC,MAAM,OAAO,MAAM,SAAS;YAE5B,IAAI,CAAC,OAAO;QACb,EAAE,OAAO,OAAO;YACf,QAAQ,MAAM,yDAAyD;QACxE;IAEF;IAEA,OAAO,IAAI,EAAE;QACZ,IAAI,IAAI,CAAC,MACR,IAAI,CAAC,KAAK,mBAAmB,aAAa;aAE1C,SAAS,iBAAiB,oBAAoB;YAC7C,IAAI,CAAC,KAAK,mBAAmB,aAAa;QAC3C;IAEF;AACD","sources":["src/index.js"],"sourcesContent":["export default class Iconly {\r\n\tconstructor(options) {\r\n\t\tthis.options = { ...options }\r\n\t\tthis.isLocalStorage = !!(window['localStorage'])\r\n\t\tthis.body = document.body\r\n\r\n\t\tthis.init().then()\r\n\t}\r\n\r\n\tasync init() {\r\n\t\tconst { file } = this.options\r\n\r\n\t\tif (document.querySelector('#iconset')) return\r\n\r\n\t\tif (this.isLocalStorage) {\r\n\t\t\tconst storedSize = localStorage.getItem('inlineSVGsize')\r\n\r\n\t\t\ttry {\r\n\t\t\t\tconst response = await fetch(file)\r\n\r\n\t\t\t\tif (!response.ok) throw new Error('Network response was not ok')\r\n\r\n\t\t\t\tconst data = await response.text()\r\n\r\n\t\t\t\tif (storedSize && storedSize === data.length.toString()) {\r\n\t\t\t\t\tthis.insert(localStorage.getItem('inlineSVGdata'))\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.insert(data)\r\n\r\n\t\t\t\t\tlocalStorage.setItem('inlineSVGdata', data)\r\n\t\t\t\t\tlocalStorage.setItem('inlineSVGsize', data.length.toString())\r\n\t\t\t\t}\r\n\t\t\t} catch (error) {\r\n\t\t\t\tconsole.error('There was a problem with the network fetch operation:', error)\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\ttry {\r\n\t\t\t\tconst response = await fetch(file)\r\n\r\n\t\t\t\tif (!response.ok) throw new Error('Network response was not ok')\r\n\r\n\t\t\t\tconst data = await response.text()\r\n\r\n\t\t\t\tthis.insert(data)\r\n\t\t\t} catch (error) {\r\n\t\t\t\tconsole.error('There was a problem with the network fetch operation:', error)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tinsert(data) {\r\n\t\tif (this.body) {\r\n\t\t\tthis.body.insertAdjacentHTML('beforeend', data)\r\n\t\t} else {\r\n\t\t\tdocument.addEventListener('DOMContentLoaded', () => {\r\n\t\t\t\tthis.body.insertAdjacentHTML('beforeend', data)\r\n\t\t\t})\r\n\t\t}\r\n\t}\r\n}"],"names":[],"version":3,"file":"index.module.js.map"}
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -8,37 +8,43 @@ export default class Iconly {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
async init() {
|
|
11
|
-
const { file
|
|
11
|
+
const { file } = this.options
|
|
12
12
|
|
|
13
|
-
if (
|
|
14
|
-
const data = localStorage.getItem('inlineSVGdata')
|
|
13
|
+
if (document.querySelector('#iconset')) return
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
if (this.isLocalStorage) {
|
|
16
|
+
const storedSize = localStorage.getItem('inlineSVGsize')
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
18
|
+
try {
|
|
19
|
+
const response = await fetch(file)
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
if (!response.ok) throw new Error('Network response was not ok')
|
|
22
|
+
|
|
23
|
+
const data = await response.text()
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
if (storedSize && storedSize === data.length.toString()) {
|
|
26
|
+
this.insert(localStorage.getItem('inlineSVGdata'))
|
|
27
|
+
} else {
|
|
28
|
+
this.insert(data)
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
localStorage.setItem('inlineSVGdata', data)
|
|
31
|
+
localStorage.setItem('inlineSVGsize', data.length.toString())
|
|
32
|
+
}
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error('There was a problem with the network fetch operation:', error)
|
|
30
35
|
}
|
|
36
|
+
} else {
|
|
37
|
+
try {
|
|
38
|
+
const response = await fetch(file)
|
|
31
39
|
|
|
32
|
-
|
|
40
|
+
if (!response.ok) throw new Error('Network response was not ok')
|
|
33
41
|
|
|
34
|
-
|
|
42
|
+
const data = await response.text()
|
|
35
43
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
this.insert(data)
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error('There was a problem with the network fetch operation:', error)
|
|
39
47
|
}
|
|
40
|
-
} catch (error) {
|
|
41
|
-
console.error('There was a problem with the network fetch operation:', error)
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
|