@fortawesome/vue-fontawesome 0.1.6 → 0.1.10

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.
@@ -15,7 +15,7 @@
15
15
  "@fortawesome/free-brands-svg-icons": "^5.4.2",
16
16
  "@fortawesome/free-regular-svg-icons": "^5.4.2",
17
17
  "@fortawesome/free-solid-svg-icons": "^5.4.2",
18
- "@fortawesome/vue-fontawesome": "^0.1.2",
18
+ "@fortawesome/vue-fontawesome": "^0.1.9",
19
19
  "vue": "^2.5.2"
20
20
  },
21
21
  "devDependencies": {
@@ -61,8 +61,8 @@
61
61
  "vue-style-loader": "^3.0.1",
62
62
  "vue-template-compiler": "^2.5.2",
63
63
  "webpack": "^3.6.0",
64
- "webpack-bundle-analyzer": "^2.9.0",
65
- "webpack-dev-server": "^2.9.1",
64
+ "webpack-bundle-analyzer": "^3.3.2",
65
+ "webpack-dev-server": "^3.1.11",
66
66
  "webpack-merge": "^4.1.0"
67
67
  },
68
68
  "engines": {
@@ -23,12 +23,21 @@
23
23
  <li class="pv3 ph2 ma0 link grow">
24
24
  <font-awesome-icon :icon="queen" size="4x" />
25
25
  </li>
26
+ <li class="pv3 ph2 ma0 link grow">
27
+ <font-awesome-icon :icon="queen" size="4x" inverse/>
28
+ </li>
26
29
  <li class="pv3 ph2 ma0 link grow">
27
30
  <font-awesome-layers full-width class="fa-4x">
28
31
  <font-awesome-icon :icon="['fas', 'archive']"/>
29
32
  <font-awesome-layers-text class="red8" transform="down-3 shrink-14" value="SECRET" />
30
33
  </font-awesome-layers>
31
34
  </li>
35
+ <li class="pv3 ph2 ma0 link grow">
36
+ <font-awesome-layers full-width class="fa-4x">
37
+ <font-awesome-icon :icon="['fas', 'envelope']"/>
38
+ <font-awesome-layers-text class="red8" value="1" position="top-right" />
39
+ </font-awesome-layers>
40
+ </li>
32
41
  </ul>
33
42
  </div>
34
43
  </main>
package/index.d.ts CHANGED
@@ -1,10 +1,8 @@
1
- declare module '@fortawesome/vue-fontawesome' {
2
- import { FunctionalComponentOptions } from 'vue'
3
- import { PropsDefinition } from 'vue/types/options'
4
- interface FontAwesomeIconProps { }
5
- interface FontAwesomeLayersProps { }
6
- interface FontAwesomeLayersTextProps { }
7
- export const FontAwesomeIcon: FunctionalComponentOptions<FontAwesomeIconProps, PropsDefinition<FontAwesomeIconProps>>
8
- export const FontAwesomeLayers: FunctionalComponentOptions<FontAwesomeLayersProps, PropsDefinition<FontAwesomeLayersProps>>
9
- export const FontAwesomeLayersText: FunctionalComponentOptions<FontAwesomeLayersTextProps, PropsDefinition<FontAwesomeLayersTextProps>>
10
- }
1
+ import { FunctionalComponentOptions, VueConstructor } from 'vue'
2
+ import { PropsDefinition } from 'vue/types/options'
3
+ interface FontAwesomeIconProps { }
4
+ interface FontAwesomeLayersProps { }
5
+ interface FontAwesomeLayersTextProps { }
6
+ export const FontAwesomeIcon: FunctionalComponentOptions<FontAwesomeIconProps, PropsDefinition<FontAwesomeIconProps>> & VueConstructor
7
+ export const FontAwesomeLayers: FunctionalComponentOptions<FontAwesomeLayersProps, PropsDefinition<FontAwesomeLayersProps>>
8
+ export const FontAwesomeLayersText: FunctionalComponentOptions<FontAwesomeLayersTextProps, PropsDefinition<FontAwesomeLayersTextProps>>
package/index.es.js CHANGED
@@ -309,9 +309,10 @@ function classList(props) {
309
309
  'fa-fw': props.fixedWidth,
310
310
  'fa-border': props.border,
311
311
  'fa-li': props.listItem,
312
+ 'fa-inverse': props.inverse,
312
313
  'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both',
313
314
  'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both'
314
- }, defineProperty(_classes, 'fa-' + props.size, props.size !== null), defineProperty(_classes, 'fa-rotate-' + props.rotation, props.rotation !== null), defineProperty(_classes, 'fa-pull-' + props.pull, props.pull !== null), _classes);
315
+ }, defineProperty(_classes, 'fa-' + props.size, props.size !== null), defineProperty(_classes, 'fa-rotate-' + props.rotation, props.rotation !== null), defineProperty(_classes, 'fa-pull-' + props.pull, props.pull !== null), defineProperty(_classes, 'fa-swap-opacity', props.swapOpacity), _classes);
315
316
 
316
317
  return Object.keys(classes).map(function (key) {
317
318
  return classes[key] ? key : null;
@@ -395,6 +396,10 @@ var FontAwesomeIcon = {
395
396
  return [90, 180, 270].indexOf(parseInt(value, 10)) > -1;
396
397
  }
397
398
  },
399
+ swapOpacity: {
400
+ type: Boolean,
401
+ default: false
402
+ },
398
403
  size: {
399
404
  type: String,
400
405
  default: null,
@@ -417,6 +422,10 @@ var FontAwesomeIcon = {
417
422
  title: {
418
423
  type: String,
419
424
  default: null
425
+ },
426
+ inverse: {
427
+ type: Boolean,
428
+ default: false
420
429
  }
421
430
  },
422
431
 
@@ -484,19 +493,38 @@ var FontAwesomeLayersText = {
484
493
  transform: {
485
494
  type: [String, Object],
486
495
  default: null
496
+ },
497
+ counter: {
498
+ type: Boolean,
499
+ default: false
500
+ },
501
+ position: {
502
+ type: String,
503
+ default: null,
504
+ validator: function validator(value) {
505
+ return ['bottom-left', 'bottom-right', 'top-left', 'top-right'].indexOf(value) > -1;
506
+ }
487
507
  }
488
508
  },
489
509
 
490
510
  render: function render(createElement, context) {
511
+ var familyPrefix = config.familyPrefix;
491
512
  var props = context.props;
492
513
 
514
+
515
+ var classes = objectWithKey('classes', [].concat(toConsumableArray(props.counter ? [familyPrefix + '-layers-counter'] : []), toConsumableArray(props.position ? [familyPrefix + '-layers-' + props.position] : [])));
516
+
493
517
  var transform = objectWithKey('transform', typeof props.transform === 'string' ? parse.transform(props.transform) : props.transform);
494
518
 
495
- var renderedText = text(props.value.toString(), _extends({}, transform));
519
+ var renderedText = text(props.value.toString(), _extends({}, transform, classes));
496
520
 
497
521
  var abstract = renderedText.abstract;
498
522
 
499
523
 
524
+ if (props.counter) {
525
+ abstract[0].attributes.class = abstract[0].attributes.class.replace('fa-layers-text', '');
526
+ }
527
+
500
528
  var convertCurry = convert.bind(null, createElement);
501
529
 
502
530
  return convertCurry(abstract[0], {}, context.data);
package/index.js CHANGED
@@ -313,9 +313,10 @@
313
313
  'fa-fw': props.fixedWidth,
314
314
  'fa-border': props.border,
315
315
  'fa-li': props.listItem,
316
+ 'fa-inverse': props.inverse,
316
317
  'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both',
317
318
  'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both'
318
- }, defineProperty(_classes, 'fa-' + props.size, props.size !== null), defineProperty(_classes, 'fa-rotate-' + props.rotation, props.rotation !== null), defineProperty(_classes, 'fa-pull-' + props.pull, props.pull !== null), _classes);
319
+ }, defineProperty(_classes, 'fa-' + props.size, props.size !== null), defineProperty(_classes, 'fa-rotate-' + props.rotation, props.rotation !== null), defineProperty(_classes, 'fa-pull-' + props.pull, props.pull !== null), defineProperty(_classes, 'fa-swap-opacity', props.swapOpacity), _classes);
319
320
 
320
321
  return Object.keys(classes).map(function (key) {
321
322
  return classes[key] ? key : null;
@@ -399,6 +400,10 @@
399
400
  return [90, 180, 270].indexOf(parseInt(value, 10)) > -1;
400
401
  }
401
402
  },
403
+ swapOpacity: {
404
+ type: Boolean,
405
+ default: false
406
+ },
402
407
  size: {
403
408
  type: String,
404
409
  default: null,
@@ -421,6 +426,10 @@
421
426
  title: {
422
427
  type: String,
423
428
  default: null
429
+ },
430
+ inverse: {
431
+ type: Boolean,
432
+ default: false
424
433
  }
425
434
  },
426
435
 
@@ -488,19 +497,38 @@
488
497
  transform: {
489
498
  type: [String, Object],
490
499
  default: null
500
+ },
501
+ counter: {
502
+ type: Boolean,
503
+ default: false
504
+ },
505
+ position: {
506
+ type: String,
507
+ default: null,
508
+ validator: function validator(value) {
509
+ return ['bottom-left', 'bottom-right', 'top-left', 'top-right'].indexOf(value) > -1;
510
+ }
491
511
  }
492
512
  },
493
513
 
494
514
  render: function render(createElement, context) {
515
+ var familyPrefix = fontawesomeSvgCore.config.familyPrefix;
495
516
  var props = context.props;
496
517
 
518
+
519
+ var classes = objectWithKey('classes', [].concat(toConsumableArray(props.counter ? [familyPrefix + '-layers-counter'] : []), toConsumableArray(props.position ? [familyPrefix + '-layers-' + props.position] : [])));
520
+
497
521
  var transform = objectWithKey('transform', typeof props.transform === 'string' ? fontawesomeSvgCore.parse.transform(props.transform) : props.transform);
498
522
 
499
- var renderedText = fontawesomeSvgCore.text(props.value.toString(), _extends({}, transform));
523
+ var renderedText = fontawesomeSvgCore.text(props.value.toString(), _extends({}, transform, classes));
500
524
 
501
525
  var abstract = renderedText.abstract;
502
526
 
503
527
 
528
+ if (props.counter) {
529
+ abstract[0].attributes.class = abstract[0].attributes.class.replace('fa-layers-text', '');
530
+ }
531
+
504
532
  var convertCurry = convert.bind(null, createElement);
505
533
 
506
534
  return convertCurry(abstract[0], {}, context.data);
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.1.6",
4
+ "version": "0.1.10",
5
5
  "main": "index.js",
6
6
  "module": "index.es.js",
7
7
  "jsnext:main": "index.es.js",
@@ -17,7 +17,10 @@
17
17
  "SirLamer <github.com/SirLamer>",
18
18
  "Liu Xinyu <github.com/meteorlxy>",
19
19
  "Xaver Schulz <github.com/schulz3000>",
20
- "Yannick Ihmels <github.com/ihmels>"
20
+ "Yannick Ihmels <github.com/ihmels>",
21
+ "btaens <github.com/btaens>",
22
+ "David Driscoll <github.com/david-driscoll>",
23
+ "Tyranteon <github.com/tyranteon>"
21
24
  ],
22
25
  "license": "MIT",
23
26
  "scripts": {
@@ -66,6 +66,10 @@ export default {
66
66
  default: null,
67
67
  validator: (value) => [90, 180, 270].indexOf(parseInt(value, 10)) > -1
68
68
  },
69
+ swapOpacity: {
70
+ type: Boolean,
71
+ default: false
72
+ },
69
73
  size: {
70
74
  type: String,
71
75
  default: null,
@@ -86,6 +90,10 @@ export default {
86
90
  title: {
87
91
  type: String,
88
92
  default: null
93
+ },
94
+ inverse: {
95
+ type: Boolean,
96
+ default: false
89
97
  }
90
98
  },
91
99
 
@@ -1,4 +1,4 @@
1
- import { parse, text } from '@fortawesome/fontawesome-svg-core'
1
+ import { config, parse, text } from '@fortawesome/fontawesome-svg-core'
2
2
  import convert from '../converter'
3
3
  import { objectWithKey } from '../utils'
4
4
 
@@ -15,17 +15,37 @@ export default {
15
15
  transform: {
16
16
  type: [String, Object],
17
17
  default: null
18
- }
18
+ },
19
+ counter: {
20
+ type: Boolean,
21
+ default: false
22
+ },
23
+ position: {
24
+ type: String,
25
+ default: null,
26
+ validator: (value) => ['bottom-left', 'bottom-right', 'top-left', 'top-right'].indexOf(value) > -1
27
+ },
19
28
  },
20
29
 
21
30
  render (createElement, context) {
31
+ const { familyPrefix } = config
22
32
  const { props } = context
33
+
34
+ const classes = objectWithKey('classes', [
35
+ ...(props.counter ? [`${familyPrefix}-layers-counter`] : []),
36
+ ...(props.position ? [`${familyPrefix}-layers-${props.position}`] : [])
37
+ ]);
38
+
23
39
  const transform = objectWithKey('transform', (typeof props.transform === 'string') ? parse.transform(props.transform) : props.transform)
24
40
 
25
- const renderedText = text(props.value.toString(), { ...transform })
41
+ const renderedText = text(props.value.toString(), { ...transform, ...classes })
26
42
 
27
43
  const { abstract } = renderedText
28
44
 
45
+ if (props.counter) {
46
+ abstract[0].attributes.class = abstract[0].attributes.class.replace('fa-layers-text', '')
47
+ }
48
+
29
49
  const convertCurry = convert.bind(null, createElement)
30
50
 
31
51
  return convertCurry(abstract[0], {}, context.data)
@@ -173,6 +173,12 @@ describe('using rotation', () => {
173
173
  })
174
174
  })
175
175
 
176
+ test('swap opacity', () => {
177
+ const vm = mountFromProps({ icon: faCoffee, swapOpacity: true })
178
+
179
+ expect(vm.$el.classList.contains('fa-swap-opacity')).toBeTruthy()
180
+ })
181
+
176
182
  test('using size', () => {
177
183
  ['lg', 'xs', 'sm', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x'].forEach(size => {
178
184
  const vm = mountFromProps({ icon: faCoffee, size: size })
@@ -187,6 +193,12 @@ test('using spin', () => {
187
193
  expect(vm.$el.classList.contains('fa-spin')).toBeTruthy()
188
194
  })
189
195
 
196
+ test('using inverse', () => {
197
+ const vm = mountFromProps({ icon: faCoffee, inverse: true })
198
+
199
+ expect(vm.$el.classList.contains('fa-inverse')).toBeTruthy()
200
+ })
201
+
190
202
  describe('using transform', () => {
191
203
  test('string', () => {
192
204
  const vm = mountFromProps({ icon: faCoffee, transform: 'grow-40 left-4 rotate-15' })
@@ -20,10 +20,10 @@ test('simple text', () => {
20
20
  })
21
21
 
22
22
  test('accept number for value', () => {
23
- const vm = compileAndMount('<font-awesome-layers-text :value="42" />')
23
+ const vm = compileAndMount('<font-awesome-layers-text :value="42" />')
24
24
 
25
- expect(vm.$el.getAttribute('class')).toBe('fa-layers-text')
26
- expect(vm.$el.innerHTML).toBe('42')
25
+ expect(vm.$el.getAttribute('class')).toBe('fa-layers-text')
26
+ expect(vm.$el.innerHTML).toBe('42')
27
27
  })
28
28
 
29
29
  describe('transform', () => {
@@ -34,3 +34,19 @@ describe('transform', () => {
34
34
  expect(vm.$el)
35
35
  })
36
36
  })
37
+
38
+ describe('counter', () => {
39
+ test('simple', () => {
40
+ const vm = compileAndMount('<font-awesome-layers-text :value="42" :counter="true" />')
41
+
42
+ expect(vm.$el.getAttribute('class')).toBe('fa-layers-counter')
43
+ expect(vm.$el.getAttribute('class')).not.toBe('fa-layers-text')
44
+ expect(vm.$el.innerHTML).toBe('42')
45
+ })
46
+
47
+ test('position', () => {
48
+ const vm = compileAndMount('<font-awesome-layers-text value="42" counter position="bottom-right" />')
49
+
50
+ expect(vm.$el.getAttribute('class')).toBe('fa-layers-counter fa-layers-bottom-right')
51
+ })
52
+ })
package/src/utils.js CHANGED
@@ -9,11 +9,13 @@ export function classList (props) {
9
9
  'fa-fw': props.fixedWidth,
10
10
  'fa-border': props.border,
11
11
  'fa-li': props.listItem,
12
+ 'fa-inverse': props.inverse,
12
13
  'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both',
13
14
  'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both',
14
15
  [`fa-${props.size}`]: props.size !== null,
15
16
  [`fa-rotate-${props.rotation}`]: props.rotation !== null,
16
- [`fa-pull-${props.pull}`]: props.pull !== null
17
+ [`fa-pull-${props.pull}`]: props.pull !== null,
18
+ 'fa-swap-opacity': props.swapOpacity
17
19
  }
18
20
 
19
21
  return Object.keys(classes)
@@ -1,13 +0,0 @@
1
- ### Describe the problem
2
-
3
- <!--- What happened? What are you seeing? How did you arrive here? -->
4
-
5
- ### What did you expect?
6
-
7
- <!--- How would you like this to work instead? -->
8
-
9
- ### Reproducible test case
10
-
11
- <!--- Insert a URL to your test case on StackBlitz.com -->
12
-
13
- <!--- Describe any details about the test case that we need to know like "whatever you do, don't click the red button" -->
@@ -1,25 +0,0 @@
1
- ### Describe the problem you'd like to see solved or task you'd like to see made easier
2
-
3
- <!--- What steps or tasks are you trying to complete along the way? -->
4
-
5
- ### Is this in relation to an existing part of vue-fontawesome or something new?
6
-
7
- <!--- If so, what part of Font Awesome? -->
8
-
9
- ### What is 1 thing that we can do when building this feature that will guarantee that it is awesome?
10
-
11
- <!--- e.g. make the API super-convenient -->
12
-
13
- ### Why would other vue-fontawesome users care about this?
14
-
15
- <!--- e.g. because everyone wants icons that fly -->
16
-
17
- ### On a scale of 1 (sometime in the future) to 10 (absolutely right now), how soon would you recommend we make this feature?
18
-
19
- <!--- e.g. 5 - "while we're young" -->
20
-
21
- ### Feature request checklist
22
-
23
- - [ ] This is a single feature (i.e. not a re-write of all of Font Awesome)
24
- - [ ] The title starts with "Feature request: " and is followed by a clear feature name (Ex: `Feature request: moar cowbell`)
25
- - [ ] I have [searched for existing issues](https://github.com/FortAwesome/vue-fontawesome/issues) and to the best of my knowledge this is not a duplicate
package/.travis.yml DELETED
@@ -1,3 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - 8