iconly 0.0.2 → 1.0.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/README.md +2 -6
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +2 -1
- package/dist/index.module.js.map +1 -1
- package/package.json +2 -2
- package/src/index.js +6 -0
package/README.md
CHANGED
|
@@ -7,19 +7,15 @@
|
|
|
7
7
|
[](https://github.com/ux-ui-pro/iconly)
|
|
8
8
|
[](https://www.npmjs.org/package/iconly)
|
|
9
9
|
|
|
10
|
-
<sup
|
|
10
|
+
<sup>500B gzipped</sup>
|
|
11
11
|
<h3><a href="https://codepen.io/ux-ui/pen/zYmyqWR">Demo</a></h3>
|
|
12
12
|
|
|
13
13
|
</div>
|
|
14
14
|
<br>
|
|
15
15
|
|
|
16
16
|
### Installation
|
|
17
|
-
```javascript
|
|
18
|
-
$ yarn add iconly
|
|
19
17
|
```
|
|
20
|
-
|
|
21
|
-
```javascript
|
|
22
|
-
$ npm i iconly
|
|
18
|
+
$ yarn add iconly
|
|
23
19
|
```
|
|
24
20
|
|
|
25
21
|
<br>
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ class $4fa36e821943b400$export$2e2bcd8739ae039 {
|
|
|
18
18
|
this.init().then();
|
|
19
19
|
}
|
|
20
20
|
async init() {
|
|
21
|
-
const { file: file
|
|
21
|
+
const { file: file, revision: revision } = this.options;
|
|
22
22
|
if (this.isLocalStorage && localStorage.getItem("inlineSVGrev") === revision) {
|
|
23
23
|
const data = localStorage.getItem("inlineSVGdata");
|
|
24
24
|
if (data) {
|
|
@@ -26,6 +26,7 @@ class $4fa36e821943b400$export$2e2bcd8739ae039 {
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
+
if (document.querySelector("#iconset")) return;
|
|
29
30
|
try {
|
|
30
31
|
const response = await fetch(file);
|
|
31
32
|
if (!response.ok) throw new Error("Network response was not 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":["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, revision } = this.options\r\n\r\n\t\tif (this.isLocalStorage && localStorage.getItem('inlineSVGrev') === revision) {\r\n\t\t\tconst data = localStorage.getItem('inlineSVGdata')\r\n\r\n\t\t\tif (data) {\r\n\t\t\t\tthis.insert(data)\r\n\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (document.querySelector('#iconset')) return\r\n\r\n\t\ttry {\r\n\t\t\tconst response = await fetch(file)\r\n\r\n\t\t\tif (!response.ok) {\r\n\t\t\t\tthrow new Error('Network response was not ok')\r\n\t\t\t}\r\n\r\n\t\t\tconst data = await response.text()\r\n\r\n\t\t\tthis.insert(data)\r\n\r\n\t\t\tif (this.isLocalStorage) {\r\n\t\t\t\tlocalStorage.setItem('inlineSVGdata', data)\r\n\t\t\t\tlocalStorage.setItem('inlineSVGrev', revision)\r\n\t\t\t}\r\n\t\t} catch (error) {\r\n\t\t\tconsole.error('There was a problem with the network fetch operation:', error)\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,7 +8,7 @@ class $cf838c15c8b009ba$export$2e2bcd8739ae039 {
|
|
|
8
8
|
this.init().then();
|
|
9
9
|
}
|
|
10
10
|
async init() {
|
|
11
|
-
const { file: file
|
|
11
|
+
const { file: file, revision: revision } = this.options;
|
|
12
12
|
if (this.isLocalStorage && localStorage.getItem("inlineSVGrev") === revision) {
|
|
13
13
|
const data = localStorage.getItem("inlineSVGdata");
|
|
14
14
|
if (data) {
|
|
@@ -16,6 +16,7 @@ class $cf838c15c8b009ba$export$2e2bcd8739ae039 {
|
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
+
if (document.querySelector("#iconset")) return;
|
|
19
20
|
try {
|
|
20
21
|
const response = await fetch(file);
|
|
21
22
|
if (!response.ok) throw new Error("Network response was not ok");
|
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;
|
|
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,YAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAEhC,IAAI,IAAI,CAAC,kBAAkB,aAAa,QAAQ,oBAAoB,UAAU;YAC7E,MAAM,OAAO,aAAa,QAAQ;YAElC,IAAI,MAAM;gBACT,IAAI,CAAC,OAAO;gBAEZ;YACD;QACD;QAEA,IAAI,SAAS,cAAc,aAAa;QAExC,IAAI;YACH,MAAM,WAAW,MAAM,MAAM;YAE7B,IAAI,CAAC,SAAS,IACb,MAAM,IAAI,MAAM;YAGjB,MAAM,OAAO,MAAM,SAAS;YAE5B,IAAI,CAAC,OAAO;YAEZ,IAAI,IAAI,CAAC,gBAAgB;gBACxB,aAAa,QAAQ,iBAAiB;gBACtC,aAAa,QAAQ,gBAAgB;YACtC;QACD,EAAE,OAAO,OAAO;YACf,QAAQ,MAAM,yDAAyD;QACxE;IACD;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, revision } = this.options\r\n\r\n\t\tif (this.isLocalStorage && localStorage.getItem('inlineSVGrev') === revision) {\r\n\t\t\tconst data = localStorage.getItem('inlineSVGdata')\r\n\r\n\t\t\tif (data) {\r\n\t\t\t\tthis.insert(data)\r\n\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (document.querySelector('#iconset')) return\r\n\r\n\t\ttry {\r\n\t\t\tconst response = await fetch(file)\r\n\r\n\t\t\tif (!response.ok) {\r\n\t\t\t\tthrow new Error('Network response was not ok')\r\n\t\t\t}\r\n\r\n\t\t\tconst data = await response.text()\r\n\r\n\t\t\tthis.insert(data)\r\n\r\n\t\t\tif (this.isLocalStorage) {\r\n\t\t\t\tlocalStorage.setItem('inlineSVGdata', data)\r\n\t\t\t\tlocalStorage.setItem('inlineSVGrev', revision)\r\n\t\t\t}\r\n\t\t} catch (error) {\r\n\t\t\tconsole.error('There was a problem with the network fetch operation:', error)\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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iconly",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "SVG Sprite",
|
|
5
5
|
"author": "ux-ui.pro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"clean": "rm -rf dist .parcel-cache"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"parcel": "~2.9.
|
|
23
|
+
"parcel": "~2.9.3"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"svg",
|
package/src/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export default class Iconly {
|
|
|
3
3
|
this.options = { ...options }
|
|
4
4
|
this.isLocalStorage = !!(window['localStorage'])
|
|
5
5
|
this.body = document.body
|
|
6
|
+
|
|
6
7
|
this.init().then()
|
|
7
8
|
}
|
|
8
9
|
|
|
@@ -11,12 +12,16 @@ export default class Iconly {
|
|
|
11
12
|
|
|
12
13
|
if (this.isLocalStorage && localStorage.getItem('inlineSVGrev') === revision) {
|
|
13
14
|
const data = localStorage.getItem('inlineSVGdata')
|
|
15
|
+
|
|
14
16
|
if (data) {
|
|
15
17
|
this.insert(data)
|
|
18
|
+
|
|
16
19
|
return
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
|
|
23
|
+
if (document.querySelector('#iconset')) return
|
|
24
|
+
|
|
20
25
|
try {
|
|
21
26
|
const response = await fetch(file)
|
|
22
27
|
|
|
@@ -25,6 +30,7 @@ export default class Iconly {
|
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
const data = await response.text()
|
|
33
|
+
|
|
28
34
|
this.insert(data)
|
|
29
35
|
|
|
30
36
|
if (this.isLocalStorage) {
|