@fortawesome/vue-fontawesome 2.0.0 → 2.0.4

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.
@@ -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
@@ -0,0 +1,2 @@
1
+ @fortawesome:registry=https://npm.fontawesome.com/
2
+ //npm.fontawesome.com/:_authToken=${FONTAWESOME_NPM_AUTH_TOKEN}
package/CHANGELOG.md CHANGED
@@ -5,6 +5,39 @@ 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.4](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.4) - 2021-10-15
14
+
15
+ ### Fixed
16
+ * Relax the peer dependency for @fortawesome/fontawesome-svg-core
17
+
18
+ ---
19
+
20
+ ## [2.0.3](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.3) - 2021-10-15
21
+
22
+ ### Fixed
23
+ * Skip parse.icon if the icon is imported directly from an icon package
24
+
25
+ ---
26
+
27
+ ## [2.0.2](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.2) - 2020-12-17
28
+
29
+ ### Fixed
30
+ * Bumping version to fix a failed release for 2.0.1
31
+
32
+ ---
33
+
34
+ ## [2.0.1](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.1) - 2020-12-17
35
+
36
+ ### Added
37
+ * Support for the new parse.icon function from the Font Awesome version 6 @fortawesome/fontawesome-svg-core
38
+
39
+ ---
40
+
8
41
  ## [2.0.0](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.0) - 2020-09-01
9
42
 
10
43
  This release marks the official major release of the component as preparation
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 pack`
21
- 1. `CLOUDSMITH_API_KEY=API_TOKEN cloudsmith upload npm fortawesome/fontawesome-pro ./fortawesome-vue-fontawesome-VERSION.tgz`
20
+ 1. `npm publish --registry https://npm.fontawesome.com`
22
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
@@ -21,11 +21,9 @@
21
21
  <!-- toc -->
22
22
 
23
23
  - [Introduction](#introduction)
24
- * [CodeSandbox Starter Sample 🚀](#codesandbox-starter-sample-%F0%9F%9A%80)
25
24
  * [Upgrading Font Awesome?](#upgrading-font-awesome)
26
25
  * [Get started](#get-started)
27
26
  * [Learn about our new SVG implementation](#learn-about-our-new-svg-implementation)
28
- * [Going from 0.0.x to 0.1.0](#going-from-00x-to-010)
29
27
  - [Installation](#installation)
30
28
  - [Add more styles or Pro icons](#add-more-styles-or-pro-icons)
31
29
  - [Usage](#usage)
@@ -70,10 +68,6 @@
70
68
 
71
69
  Hey there! We're glad you're here...
72
70
 
73
- ### CodeSandbox Starter Sample 🚀
74
-
75
- 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).
76
-
77
71
  ### Upgrading Font Awesome?
78
72
 
79
73
  If you've used Font Awesome in the past (version 4 or older) there are some
@@ -113,13 +107,13 @@ $ yarn add @fortawesome/free-solid-svg-icons
113
107
  **Using Vue 2.x**
114
108
 
115
109
  ```
116
- $ npm i --save @fortawesome/vue-fontawesome@2
110
+ $ npm i --save @fortawesome/vue-fontawesome@latest
117
111
  ```
118
112
 
119
113
  **Using Vue 3.x**
120
114
 
121
115
  ```
122
- $ npm i --save @fortawesome/vue-fontawesome@3
116
+ $ npm i --save @fortawesome/vue-fontawesome@prerelease
123
117
  ```
124
118
 
125
119
  ## Add more styles or Pro icons
@@ -867,6 +861,7 @@ The Font Awesome team:
867
861
  | <img src="https://github.com/robmadole.png?size=72" /> | Rob Madole | [@robmadole](https://github.com/robmadole) |
868
862
  | <img src="https://github.com/mlwilkerson.png?size=72" /> | Mike Wilkerson | [@mlwilkerson](https://github.com/mlwilkerson) |
869
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) |
870
865
 
871
866
  ## Releasing this project
872
867
 
@@ -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.17.0",
5091
- "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz",
5092
- "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==",
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": "^3.0.0",
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": {
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": "2.0.0",
4
+ "version": "2.0.4",
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": "jest",
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": {
@@ -36,11 +39,12 @@
36
39
  ]
37
40
  },
38
41
  "peerDependencies": {
39
- "@fortawesome/fontawesome-svg-core": ">= 1.2.0 < 1.3",
42
+ "@fortawesome/fontawesome-svg-core": "~1",
40
43
  "vue": "~2"
41
44
  },
42
45
  "devDependencies": {
43
- "@fortawesome/fontawesome-svg-core": "^1.2.0",
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
@@ -21,3 +21,15 @@ export const faCircle = {
21
21
  "..."
22
22
  ]
23
23
  }
24
+
25
+ export const faSpartan = {
26
+ prefix: 'fat',
27
+ iconName: 'spartan',
28
+ icon: [
29
+ 640,
30
+ 512,
31
+ [],
32
+ "f100",
33
+ "..."
34
+ ]
35
+ }
@@ -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 { faCoffee, faCircle } from '../__fixtures__/icons'
5
- import { compileAndMount, mountFromProps } from '../__fixtures__/helpers'
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