@fortawesome/vue-fontawesome 0.1.10 → 2.0.3
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/.github/workflows/ci.yml +3 -1
- package/.npmrc.proregistry +2 -0
- package/CHANGELOG.md +49 -0
- package/DEVELOPMENT.md +22 -3
- package/README.md +31 -24
- package/examples/vue-cli-webpack/package-lock.json +24 -22
- package/index.es.js +10 -1
- package/index.js +10 -1
- package/package.json +7 -3
- package/src/components/FontAwesomeIcon.js +10 -2
- package/src/components/__fixtures__/helpers.js +11 -0
- package/src/components/__fixtures__/icons.js +12 -0
- package/src/components/__tests__/FontAwesomeIcon.test.js +73 -3
package/.github/workflows/ci.yml
CHANGED
|
@@ -21,9 +21,11 @@ jobs:
|
|
|
21
21
|
run: |
|
|
22
22
|
npm install
|
|
23
23
|
npm run build
|
|
24
|
-
npm run test
|
|
24
|
+
npm run test.latest
|
|
25
|
+
npm run test.next.proregistry
|
|
25
26
|
env:
|
|
26
27
|
CI: true
|
|
28
|
+
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
|
|
27
29
|
- name: dist
|
|
28
30
|
run: |
|
|
29
31
|
npm run dist
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,55 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
- [Vue 3.x compatible version of this component](https://github.com/FortAwesome/vue-fontawesome/tree/3.x)
|
|
9
|
+
- [CHANGELOG for version 3.x](https://github.com/FortAwesome/vue-fontawesome/blob/3.x/CHANGELOG.md)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## [2.0.3](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.3) - 2021-10-15
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
* Skip parse.icon if the icon is imported directly from an icon package
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## [2.0.2](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.2) - 2020-12-17
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
* Bumping version to fix a failed release for 2.0.1
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## [2.0.1](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.1) - 2020-12-17
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
* Support for the new parse.icon function from the Font Awesome version 6 @fortawesome/fontawesome-svg-core
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## [2.0.0](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.0) - 2020-09-01
|
|
35
|
+
|
|
36
|
+
This release marks the official major release of the component as preparation
|
|
37
|
+
for supporting two different versions of Vue.
|
|
38
|
+
|
|
39
|
+
### What is the difference between 0.1.10 and 2.0.0?
|
|
40
|
+
|
|
41
|
+
There is no difference. We've jumped the version to 2.0.0 so you know which
|
|
42
|
+
version of vue-fontawesome you should install based on what version of Vue you
|
|
43
|
+
are using.
|
|
44
|
+
|
|
45
|
+
### What version should you install?
|
|
46
|
+
|
|
47
|
+
| | Vue | vue-fontawesome |
|
|
48
|
+
| ------- |-----|-----------------|
|
|
49
|
+
| Version | 2.x | 2.x or 0.1.x |
|
|
50
|
+
| Version | 3.x | 3.x |
|
|
51
|
+
|
|
52
|
+
While you can still use 0.1 with Vue 2.x, we recommend upgrade to the 2.x
|
|
53
|
+
release. The 0.1 release line will not be getting any further updates.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
8
57
|
## [0.1.10](https://github.com/FortAwesome/vue-fontawesome/releases/tag/0.1.10) - 2020-06-15
|
|
9
58
|
|
|
10
59
|
### Fixed
|
package/DEVELOPMENT.md
CHANGED
|
@@ -17,9 +17,28 @@ test | Execute unit tests
|
|
|
17
17
|
1. Update `README.md` and `package.json`; adding any contributors
|
|
18
18
|
1. Update the `CHANGELOG.md`
|
|
19
19
|
1. `npm publish`
|
|
20
|
-
1. `npm
|
|
21
|
-
1. `
|
|
22
|
-
1. `git add index.js index.es.js`
|
|
20
|
+
1. `npm publish --registry https://npm.fontawesome.com`
|
|
21
|
+
1. `git add .`
|
|
23
22
|
1. `git commit -a -m 'Release VERSION'`
|
|
24
23
|
1. `git push`
|
|
25
24
|
1. Create a [new release](https://github.com/FortAwesome/vue-fontawesome/releases/new) with CHANGELOG details
|
|
25
|
+
|
|
26
|
+
## Authenticating with the npm.fontawesome.com registry
|
|
27
|
+
|
|
28
|
+
Contributors with authorization to publish to npm.fontawesome.com will receive an invite
|
|
29
|
+
from a Font Awesome project owner.
|
|
30
|
+
|
|
31
|
+
1. Respond to the invite in your email
|
|
32
|
+
1. Let the owner know when you've setup your account
|
|
33
|
+
1. Owner will add you to the team
|
|
34
|
+
|
|
35
|
+
You can then run:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
npm login --registry https://npm.fontawesome.com
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- The username is the "slug" for your Cloudsmith account. For example mine is "rob-madole".
|
|
42
|
+
- Enter the password that you setup just a few minutes ago.
|
|
43
|
+
- It says the your email is PUBLIC. Pretty sure that's false since the auth is through Cloudsmith.
|
|
44
|
+
- This doesn't overwrite your standard login, just adds to your `~/.npmrc`
|
package/README.md
CHANGED
|
@@ -9,14 +9,21 @@
|
|
|
9
9
|
|
|
10
10
|
> Font Awesome 5 Vue component using SVG with JS
|
|
11
11
|
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
**Vue 3 is just around the corner!**
|
|
15
|
+
|
|
16
|
+
**If you have been using 0.1.x of vue-fontawesome, you can safely upgrade to
|
|
17
|
+
2.x. We have some upgrading information in the [CHANGELOG](./CHANGELOG.md)**
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
12
21
|
<!-- toc -->
|
|
13
22
|
|
|
14
23
|
- [Introduction](#introduction)
|
|
15
|
-
* [CodeSandbox Starter Sample 🚀](#codesandbox-starter-sample-%F0%9F%9A%80)
|
|
16
24
|
* [Upgrading Font Awesome?](#upgrading-font-awesome)
|
|
17
25
|
* [Get started](#get-started)
|
|
18
26
|
* [Learn about our new SVG implementation](#learn-about-our-new-svg-implementation)
|
|
19
|
-
* [Going from 0.0.x to 0.1.0](#going-from-00x-to-010)
|
|
20
27
|
- [Installation](#installation)
|
|
21
28
|
- [Add more styles or Pro icons](#add-more-styles-or-pro-icons)
|
|
22
29
|
- [Usage](#usage)
|
|
@@ -61,10 +68,6 @@
|
|
|
61
68
|
|
|
62
69
|
Hey there! We're glad you're here...
|
|
63
70
|
|
|
64
|
-
### CodeSandbox Starter Sample 🚀
|
|
65
|
-
|
|
66
|
-
Here's a [CodeSandbox Starter Sample](https://codesandbox.io/s/github/FortAwesome/vue-fontawesome/tree/master/examples/vue-cli-webpack) on how to display Solid, Regular, and Brand icons [using the Icon Library](https://github.com/FortAwesome/vue-fontawesome#usage).
|
|
67
|
-
|
|
68
71
|
### Upgrading Font Awesome?
|
|
69
72
|
|
|
70
73
|
If you've used Font Awesome in the past (version 4 or older) there are some
|
|
@@ -86,18 +89,31 @@ the web fonts implementation that was used in version 4 and older of Font Awesom
|
|
|
86
89
|
|
|
87
90
|
> https://fontawesome.com/how-to-use/on-the-web/advanced/svg-javascript-core
|
|
88
91
|
|
|
89
|
-
### Going from 0.0.x to 0.1.0
|
|
90
|
-
|
|
91
|
-
See [UPGRADING.md](./UPGRADING.md).
|
|
92
|
-
|
|
93
|
-
You might also be interested in the larger umbrella project [UPGRADING.md](https://github.com/FortAwesome/Font-Awesome/blob/master/UPGRADING.md)
|
|
94
|
-
|
|
95
92
|
## Installation
|
|
96
93
|
|
|
94
|
+
Install the core package and icon content.
|
|
95
|
+
|
|
97
96
|
```
|
|
98
97
|
$ npm i --save @fortawesome/fontawesome-svg-core
|
|
99
98
|
$ npm i --save @fortawesome/free-solid-svg-icons
|
|
100
|
-
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Or with Yarn:
|
|
102
|
+
```
|
|
103
|
+
$ yarn add @fortawesome/fontawesome-svg-core
|
|
104
|
+
$ yarn add @fortawesome/free-solid-svg-icons
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Using Vue 2.x**
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
$ npm i --save @fortawesome/vue-fontawesome@latest
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Using Vue 3.x**
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
$ npm i --save @fortawesome/vue-fontawesome@prerelease
|
|
101
117
|
```
|
|
102
118
|
|
|
103
119
|
## Add more styles or Pro icons
|
|
@@ -121,16 +137,6 @@ $ npm i --save @fortawesome/pro-light-svg-icons
|
|
|
121
137
|
$ npm i --save @fortawesome/pro-duotone-svg-icons
|
|
122
138
|
```
|
|
123
139
|
|
|
124
|
-
**Duotone icons are currently in pre-release and are coming soon to this component.**
|
|
125
|
-
|
|
126
|
-
Or with Yarn:
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
$ yarn add @fortawesome/fontawesome-svg-core
|
|
130
|
-
$ yarn add @fortawesome/free-solid-svg-icons
|
|
131
|
-
$ yarn add @fortawesome/vue-fontawesome
|
|
132
|
-
```
|
|
133
|
-
|
|
134
140
|
## Usage
|
|
135
141
|
|
|
136
142
|
### Recommended
|
|
@@ -541,7 +547,7 @@ Spin and pulse [animation](https://fontawesome.com/how-to-use/on-the-web/styling
|
|
|
541
547
|
|
|
542
548
|
### Advanced
|
|
543
549
|
|
|
544
|
-
[Power Transforms](
|
|
550
|
+
[Power Transforms](https://fontawesome.com/how-to-use/on-the-web/styling/power-transforms):
|
|
545
551
|
|
|
546
552
|
```html
|
|
547
553
|
<font-awesome-icon icon="spinner" transform="shrink-6 left-4" />
|
|
@@ -855,6 +861,7 @@ The Font Awesome team:
|
|
|
855
861
|
| <img src="https://github.com/robmadole.png?size=72" /> | Rob Madole | [@robmadole](https://github.com/robmadole) |
|
|
856
862
|
| <img src="https://github.com/mlwilkerson.png?size=72" /> | Mike Wilkerson | [@mlwilkerson](https://github.com/mlwilkerson) |
|
|
857
863
|
| <img src="https://github.com/talbs.png?size=72" /> | Brian Talbot | [@talbs](https://github.com/talbs) |
|
|
864
|
+
| <img src="https://github.com/jasonlundien.png?size=72" /> | Jason Lundien | [@jasonlundien](https://github.com/jasonlundien) |
|
|
858
865
|
|
|
859
866
|
## Releasing this project
|
|
860
867
|
|
|
@@ -204,9 +204,9 @@
|
|
|
204
204
|
}
|
|
205
205
|
},
|
|
206
206
|
"@fortawesome/vue-fontawesome": {
|
|
207
|
-
"version": "0.1.
|
|
208
|
-
"resolved": "https://registry.npmjs.org/@fortawesome/vue-fontawesome/-/vue-fontawesome-0.1.
|
|
209
|
-
"integrity": "sha512-
|
|
207
|
+
"version": "0.1.9",
|
|
208
|
+
"resolved": "https://registry.npmjs.org/@fortawesome/vue-fontawesome/-/vue-fontawesome-0.1.9.tgz",
|
|
209
|
+
"integrity": "sha512-h/emhmZz+DfB2zOGLWawNwXq82UYhn9waTfUjLLmeaIqtnIyNt6kYlpQT/vzJjLZRDRvY2IEJAh1di5qKpKVpA=="
|
|
210
210
|
},
|
|
211
211
|
"accepts": {
|
|
212
212
|
"version": "1.3.5",
|
|
@@ -3064,9 +3064,9 @@
|
|
|
3064
3064
|
"dev": true
|
|
3065
3065
|
},
|
|
3066
3066
|
"elliptic": {
|
|
3067
|
-
"version": "6.
|
|
3068
|
-
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.
|
|
3069
|
-
"integrity": "sha512-
|
|
3067
|
+
"version": "6.5.3",
|
|
3068
|
+
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
|
|
3069
|
+
"integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
|
|
3070
3070
|
"dev": true,
|
|
3071
3071
|
"requires": {
|
|
3072
3072
|
"bn.js": "^4.4.0",
|
|
@@ -3603,12 +3603,6 @@
|
|
|
3603
3603
|
"es5-ext": "~0.10.14"
|
|
3604
3604
|
}
|
|
3605
3605
|
},
|
|
3606
|
-
"eventemitter3": {
|
|
3607
|
-
"version": "3.1.2",
|
|
3608
|
-
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz",
|
|
3609
|
-
"integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==",
|
|
3610
|
-
"dev": true
|
|
3611
|
-
},
|
|
3612
3606
|
"events": {
|
|
3613
3607
|
"version": "1.1.1",
|
|
3614
3608
|
"resolved": "http://registry.npmjs.org/events/-/events-1.1.1.tgz",
|
|
@@ -5087,14 +5081,22 @@
|
|
|
5087
5081
|
"dev": true
|
|
5088
5082
|
},
|
|
5089
5083
|
"http-proxy": {
|
|
5090
|
-
"version": "1.
|
|
5091
|
-
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.
|
|
5092
|
-
"integrity": "sha512-
|
|
5084
|
+
"version": "1.18.1",
|
|
5085
|
+
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
|
|
5086
|
+
"integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
|
|
5093
5087
|
"dev": true,
|
|
5094
5088
|
"requires": {
|
|
5095
|
-
"eventemitter3": "^
|
|
5089
|
+
"eventemitter3": "^4.0.0",
|
|
5096
5090
|
"follow-redirects": "^1.0.0",
|
|
5097
5091
|
"requires-port": "^1.0.0"
|
|
5092
|
+
},
|
|
5093
|
+
"dependencies": {
|
|
5094
|
+
"eventemitter3": {
|
|
5095
|
+
"version": "4.0.7",
|
|
5096
|
+
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
|
5097
|
+
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
|
|
5098
|
+
"dev": true
|
|
5099
|
+
}
|
|
5098
5100
|
}
|
|
5099
5101
|
},
|
|
5100
5102
|
"http-proxy-middleware": {
|
|
@@ -5823,9 +5825,9 @@
|
|
|
5823
5825
|
}
|
|
5824
5826
|
},
|
|
5825
5827
|
"lodash": {
|
|
5826
|
-
"version": "4.17.
|
|
5827
|
-
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.
|
|
5828
|
-
"integrity": "sha512-
|
|
5828
|
+
"version": "4.17.19",
|
|
5829
|
+
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
|
|
5830
|
+
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==",
|
|
5829
5831
|
"dev": true
|
|
5830
5832
|
},
|
|
5831
5833
|
"lodash.camelcase": {
|
|
@@ -11405,9 +11407,9 @@
|
|
|
11405
11407
|
}
|
|
11406
11408
|
},
|
|
11407
11409
|
"websocket-extensions": {
|
|
11408
|
-
"version": "0.1.
|
|
11409
|
-
"resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.
|
|
11410
|
-
"integrity": "sha512-
|
|
11410
|
+
"version": "0.1.4",
|
|
11411
|
+
"resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz",
|
|
11412
|
+
"integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==",
|
|
11411
11413
|
"dev": true
|
|
11412
11414
|
},
|
|
11413
11415
|
"whet.extend": {
|
package/index.es.js
CHANGED
|
@@ -328,6 +328,16 @@ function addStaticClass(to, what) {
|
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
function normalizeIconArgs(icon$$1) {
|
|
331
|
+
// this has everything that it needs to be rendered which means it was probably imported
|
|
332
|
+
// directly from an icon svg package
|
|
333
|
+
if (icon$$1 && (typeof icon$$1 === 'undefined' ? 'undefined' : _typeof(icon$$1)) === 'object' && icon$$1.prefix && icon$$1.iconName && icon$$1.icon) {
|
|
334
|
+
return icon$$1;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (parse.icon) {
|
|
338
|
+
return parse.icon(icon$$1);
|
|
339
|
+
}
|
|
340
|
+
|
|
331
341
|
if (icon$$1 === null) {
|
|
332
342
|
return null;
|
|
333
343
|
}
|
|
@@ -440,7 +450,6 @@ var FontAwesomeIcon = {
|
|
|
440
450
|
var classes = objectWithKey('classes', classList(props));
|
|
441
451
|
var transform = objectWithKey('transform', typeof props.transform === 'string' ? parse.transform(props.transform) : props.transform);
|
|
442
452
|
var mask = objectWithKey('mask', normalizeIconArgs(maskArgs));
|
|
443
|
-
|
|
444
453
|
var renderedIcon = icon(icon$$1, _extends({}, classes, transform, mask, { symbol: symbol, title: title }));
|
|
445
454
|
|
|
446
455
|
if (!renderedIcon) {
|
package/index.js
CHANGED
|
@@ -332,6 +332,16 @@
|
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
function normalizeIconArgs(icon) {
|
|
335
|
+
// this has everything that it needs to be rendered which means it was probably imported
|
|
336
|
+
// directly from an icon svg package
|
|
337
|
+
if (icon && (typeof icon === 'undefined' ? 'undefined' : _typeof(icon)) === 'object' && icon.prefix && icon.iconName && icon.icon) {
|
|
338
|
+
return icon;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (fontawesomeSvgCore.parse.icon) {
|
|
342
|
+
return fontawesomeSvgCore.parse.icon(icon);
|
|
343
|
+
}
|
|
344
|
+
|
|
335
345
|
if (icon === null) {
|
|
336
346
|
return null;
|
|
337
347
|
}
|
|
@@ -444,7 +454,6 @@
|
|
|
444
454
|
var classes = objectWithKey('classes', classList(props));
|
|
445
455
|
var transform = objectWithKey('transform', typeof props.transform === 'string' ? fontawesomeSvgCore.parse.transform(props.transform) : props.transform);
|
|
446
456
|
var mask = objectWithKey('mask', normalizeIconArgs(maskArgs));
|
|
447
|
-
|
|
448
457
|
var renderedIcon = fontawesomeSvgCore.icon(icon, _extends({}, classes, transform, mask, { symbol: symbol, title: title }));
|
|
449
458
|
|
|
450
459
|
if (!renderedIcon) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fortawesome/vue-fontawesome",
|
|
3
3
|
"description": "Official Vue component for Font Awesome 5",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "2.0.3",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.es.js",
|
|
7
7
|
"jsnext:main": "index.es.js",
|
|
@@ -26,7 +26,10 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "rollup -c rollup.config.js",
|
|
28
28
|
"dist": "cross-env NODE_ENV=production npm run build",
|
|
29
|
-
"test": "
|
|
29
|
+
"test": "npm run test.latest && npm run test.next",
|
|
30
|
+
"test.latest": "npm --no-save install @fortawesome/fontawesome-svg-core@latest @fortawesome/free-solid-svg-icons@latest && jest --silent",
|
|
31
|
+
"test.next": "npm --no-save install @fortawesome/fontawesome-svg-core@next @fortawesome/free-solid-svg-icons@next && jest --silent",
|
|
32
|
+
"test.next.proregistry": "npm --userconfig .npmrc.proregistry --registry https://npm.fontawesome.com install --no-save @fortawesome/fontawesome-svg-core@next @fortawesome/free-solid-svg-icons@next && jest --silent",
|
|
30
33
|
"prepack": "npm run dist"
|
|
31
34
|
},
|
|
32
35
|
"lint-staged": {
|
|
@@ -40,7 +43,8 @@
|
|
|
40
43
|
"vue": "~2"
|
|
41
44
|
},
|
|
42
45
|
"devDependencies": {
|
|
43
|
-
"@fortawesome/fontawesome-svg-core": "^1.2.
|
|
46
|
+
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
|
47
|
+
"@fortawesome/free-solid-svg-icons": "^5.15.1",
|
|
44
48
|
"babel-core": "^6.26.0",
|
|
45
49
|
"babel-jest": "^23.6.0",
|
|
46
50
|
"babel-plugin-external-helpers": "^6.22.0",
|
|
@@ -4,6 +4,16 @@ import log from '../logger'
|
|
|
4
4
|
import { objectWithKey, classList } from '../utils'
|
|
5
5
|
|
|
6
6
|
function normalizeIconArgs (icon) {
|
|
7
|
+
// this has everything that it needs to be rendered which means it was probably imported
|
|
8
|
+
// directly from an icon svg package
|
|
9
|
+
if (icon && typeof icon === 'object' && icon.prefix && icon.iconName && icon.icon) {
|
|
10
|
+
return icon
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (faParse.icon) {
|
|
14
|
+
return faParse.icon(icon)
|
|
15
|
+
}
|
|
16
|
+
|
|
7
17
|
if (icon === null) {
|
|
8
18
|
return null
|
|
9
19
|
}
|
|
@@ -99,13 +109,11 @@ export default {
|
|
|
99
109
|
|
|
100
110
|
render (createElement, context) {
|
|
101
111
|
const { props } = context
|
|
102
|
-
|
|
103
112
|
const { icon: iconArgs, mask: maskArgs, symbol, title } = props
|
|
104
113
|
const icon = normalizeIconArgs(iconArgs)
|
|
105
114
|
const classes = objectWithKey('classes', classList(props))
|
|
106
115
|
const transform = objectWithKey('transform', (typeof props.transform === 'string') ? faParse.transform(props.transform) : props.transform)
|
|
107
116
|
const mask = objectWithKey('mask', normalizeIconArgs(maskArgs))
|
|
108
|
-
|
|
109
117
|
const renderedIcon = faIcon(
|
|
110
118
|
icon,
|
|
111
119
|
{ ...classes, ...transform, ...mask, symbol, title }
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Vue from 'vue/dist/vue'
|
|
2
2
|
import FontAwesomeIcon from '../FontAwesomeIcon'
|
|
3
|
+
import { parse } from '@fortawesome/fontawesome-svg-core'
|
|
3
4
|
|
|
4
5
|
export function compileAndMount (str, params = {}) {
|
|
5
6
|
const res = Vue.compile(str)
|
|
@@ -27,3 +28,13 @@ export function mountFromProps (propsData = {}) {
|
|
|
27
28
|
|
|
28
29
|
return vm
|
|
29
30
|
}
|
|
31
|
+
|
|
32
|
+
export function coreHasFeature (feature) {
|
|
33
|
+
if (feature === REFERENCE_ICON_BY_STYLE || feature === ICON_ALIASES || feature === REFERENCE_ICON_USING_STRING) {
|
|
34
|
+
return parse.icon
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const REFERENCE_ICON_BY_STYLE = 0x00
|
|
39
|
+
export const ICON_ALIASES = 0x01
|
|
40
|
+
export const REFERENCE_ICON_USING_STRING = 0x02
|
|
@@ -1,14 +1,78 @@
|
|
|
1
1
|
import Vue from 'vue/dist/vue'
|
|
2
2
|
import FontAwesomeIcon from '../FontAwesomeIcon'
|
|
3
3
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { faClose, faUser } from '@fortawesome/free-solid-svg-icons'
|
|
5
|
+
import { faCoffee, faCircle, faSpartan } from '../__fixtures__/icons'
|
|
6
|
+
import { coreHasFeature, REFERENCE_ICON_USING_STRING, REFERENCE_ICON_BY_STYLE, ICON_ALIASES, compileAndMount, mountFromProps } from '../__fixtures__/helpers'
|
|
6
7
|
|
|
7
8
|
beforeEach(() => {
|
|
8
|
-
library.add(faCoffee, faCircle)
|
|
9
|
+
library.add(faCoffee, faCircle, faSpartan)
|
|
9
10
|
Vue.component('font-awesome-icon', FontAwesomeIcon)
|
|
10
11
|
})
|
|
11
12
|
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
library.reset()
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
test('using a FAT icon with array format', () => {
|
|
18
|
+
const vm = mountFromProps({ icon: ['fat', 'spartan'] })
|
|
19
|
+
|
|
20
|
+
expect(vm.$el.tagName).toBe('svg')
|
|
21
|
+
expect(vm.$el.classList.contains('fa-spartan')).toBeTruthy()
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
if(coreHasFeature(ICON_ALIASES)) {
|
|
25
|
+
test('find a free-solid-svg-icon with array format', () => {
|
|
26
|
+
library.reset()
|
|
27
|
+
library.add(faClose)
|
|
28
|
+
const vm = mountFromProps({ icon: ['fas', 'xmark'] })
|
|
29
|
+
|
|
30
|
+
expect(vm.$el.tagName).toBe('svg')
|
|
31
|
+
expect(vm.$el.classList.contains('fa-xmark')).toBeTruthy()
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('find a free-solid-svg-icon that is an alias', () => {
|
|
35
|
+
library.reset()
|
|
36
|
+
library.add(faClose)
|
|
37
|
+
const vm = mountFromProps({ icon: ['fas', 'close'] })
|
|
38
|
+
|
|
39
|
+
expect(vm.$el.tagName).toBe('svg')
|
|
40
|
+
expect(vm.$el.classList.contains('fa-close')).toBeTruthy()
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if(coreHasFeature(REFERENCE_ICON_USING_STRING)) {
|
|
45
|
+
test('find an icon using string format', () => {
|
|
46
|
+
const vm = mountFromProps({ icon: 'fa-coffee' })
|
|
47
|
+
|
|
48
|
+
expect(vm.$el.tagName).toBe('svg')
|
|
49
|
+
expect(vm.$el.classList.contains('fa-coffee')).toBeTruthy()
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
test('find an icon using string format with style', () => {
|
|
53
|
+
const vm = mountFromProps({ icon: 'fa-solid fa-coffee' })
|
|
54
|
+
|
|
55
|
+
expect(vm.$el.tagName).toBe('svg')
|
|
56
|
+
expect(vm.$el.classList.contains('fa-coffee')).toBeTruthy()
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (coreHasFeature(REFERENCE_ICON_BY_STYLE)) {
|
|
61
|
+
test('find a THIN icon with array format', () => {
|
|
62
|
+
const vm = mountFromProps({ icon: ['thin', 'spartan'] })
|
|
63
|
+
|
|
64
|
+
expect(vm.$el.tagName).toBe('svg')
|
|
65
|
+
expect(vm.$el.classList.contains('fa-spartan')).toBeTruthy()
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
test('find a FA-THIN icon with array format', () => {
|
|
69
|
+
const vm = mountFromProps({ icon: ['fa-thin', 'spartan'] })
|
|
70
|
+
|
|
71
|
+
expect(vm.$el.tagName).toBe('svg')
|
|
72
|
+
expect(vm.$el.classList.contains('fa-spartan')).toBeTruthy()
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
|
|
12
76
|
test('using array format', () => {
|
|
13
77
|
const vm = mountFromProps({ icon: ['fas', 'coffee'] })
|
|
14
78
|
|
|
@@ -23,6 +87,12 @@ test('using string format', () => {
|
|
|
23
87
|
expect(vm.$el.classList.contains('fa-coffee')).toBeTruthy()
|
|
24
88
|
})
|
|
25
89
|
|
|
90
|
+
test.only('using imported object from svg icons package', () => {
|
|
91
|
+
const vm = mountFromProps({ icon: faUser })
|
|
92
|
+
|
|
93
|
+
expect(vm.$el.tagName).toBe('svg')
|
|
94
|
+
})
|
|
95
|
+
|
|
26
96
|
test('missing icon', () => {
|
|
27
97
|
const vm = mountFromProps({ icon: ['fas', 'noicon'] })
|
|
28
98
|
|