@fortawesome/vue-fontawesome 3.0.3 → 3.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.
- package/CHANGELOG.md +11 -1
- package/README.md +1 -0
- package/index.d.ts +3 -1
- package/index.es.js +39 -56
- package/index.js +39 -56
- package/package.json +8 -6
- package/src/components/FontAwesomeIcon.js +33 -22
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [3.0.4](https://github.com/FortAwesome/vue-fontawesome/releases/tag/3.0.4) - 2023-11-06
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Tests for Sharp Family
|
|
14
|
+
- Ability to include a title prop (github issue #[181](https://github.com/FortAwesome/vue-fontawesome/issues/181))
|
|
15
|
+
- Prettier config file
|
|
16
|
+
|
|
7
17
|
---
|
|
8
18
|
|
|
9
19
|
## [3.0.3](https://github.com/FortAwesome/vue-fontawesome/releases/tag/3.0.3) - 2023-01-24
|
|
@@ -16,7 +26,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|
|
16
26
|
|
|
17
27
|
### Added
|
|
18
28
|
|
|
19
|
-
- Missing TypeScript animations added
|
|
29
|
+
- Missing TypeScript animations added (github issue #[428](https://github.com/FortAwesome/vue-fontawesome/issues/428))
|
|
20
30
|
- Missing TypeScript sizes added (github issue #[415](https://github.com/FortAwesome/vue-fontawesome/issues/415))
|
|
21
31
|
|
|
22
32
|
---
|
package/README.md
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IconDefinition } from '@fortawesome/fontawesome-svg-core'
|
|
1
|
+
import { IconDefinition } from '@fortawesome/fontawesome-svg-core'
|
|
2
2
|
import { DefineComponent } from 'vue'
|
|
3
3
|
|
|
4
4
|
interface FontAwesomeIconProps {
|
|
@@ -7,6 +7,7 @@ interface FontAwesomeIconProps {
|
|
|
7
7
|
flip?: 'horizontal' | 'vertical' | 'both'
|
|
8
8
|
icon: object | Array<string> | string | IconDefinition
|
|
9
9
|
mask?: object | Array<string> | string
|
|
10
|
+
maskId?: object | Array<string> | string
|
|
10
11
|
listItem?: boolean
|
|
11
12
|
pull?: 'right' | 'left'
|
|
12
13
|
pulse?: boolean
|
|
@@ -17,6 +18,7 @@ interface FontAwesomeIconProps {
|
|
|
17
18
|
transform?: object | string
|
|
18
19
|
symbol?: boolean | string
|
|
19
20
|
title?: string
|
|
21
|
+
titleId?: string
|
|
20
22
|
inverse?: boolean
|
|
21
23
|
bounce?: boolean
|
|
22
24
|
shake?: boolean
|
package/index.es.js
CHANGED
|
@@ -3,17 +3,14 @@ import { h, defineComponent, computed, watch } from 'vue';
|
|
|
3
3
|
|
|
4
4
|
function ownKeys(object, enumerableOnly) {
|
|
5
5
|
var keys = Object.keys(object);
|
|
6
|
-
|
|
7
6
|
if (Object.getOwnPropertySymbols) {
|
|
8
7
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
9
8
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
10
9
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
11
10
|
})), keys.push.apply(keys, symbols);
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
return keys;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
function _objectSpread2(target) {
|
|
18
15
|
for (var i = 1; i < arguments.length; i++) {
|
|
19
16
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
@@ -23,10 +20,8 @@ function _objectSpread2(target) {
|
|
|
23
20
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
24
21
|
});
|
|
25
22
|
}
|
|
26
|
-
|
|
27
23
|
return target;
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
function _typeof(obj) {
|
|
31
26
|
"@babel/helpers - typeof";
|
|
32
27
|
|
|
@@ -36,8 +31,8 @@ function _typeof(obj) {
|
|
|
36
31
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
37
32
|
}, _typeof(obj);
|
|
38
33
|
}
|
|
39
|
-
|
|
40
34
|
function _defineProperty(obj, key, value) {
|
|
35
|
+
key = _toPropertyKey(key);
|
|
41
36
|
if (key in obj) {
|
|
42
37
|
Object.defineProperty(obj, key, {
|
|
43
38
|
value: value,
|
|
@@ -48,35 +43,26 @@ function _defineProperty(obj, key, value) {
|
|
|
48
43
|
} else {
|
|
49
44
|
obj[key] = value;
|
|
50
45
|
}
|
|
51
|
-
|
|
52
46
|
return obj;
|
|
53
47
|
}
|
|
54
|
-
|
|
55
48
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
56
49
|
if (source == null) return {};
|
|
57
50
|
var target = {};
|
|
58
51
|
var sourceKeys = Object.keys(source);
|
|
59
52
|
var key, i;
|
|
60
|
-
|
|
61
53
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
62
54
|
key = sourceKeys[i];
|
|
63
55
|
if (excluded.indexOf(key) >= 0) continue;
|
|
64
56
|
target[key] = source[key];
|
|
65
57
|
}
|
|
66
|
-
|
|
67
58
|
return target;
|
|
68
59
|
}
|
|
69
|
-
|
|
70
60
|
function _objectWithoutProperties(source, excluded) {
|
|
71
61
|
if (source == null) return {};
|
|
72
|
-
|
|
73
62
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
74
|
-
|
|
75
63
|
var key, i;
|
|
76
|
-
|
|
77
64
|
if (Object.getOwnPropertySymbols) {
|
|
78
65
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
79
|
-
|
|
80
66
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
81
67
|
key = sourceSymbolKeys[i];
|
|
82
68
|
if (excluded.indexOf(key) >= 0) continue;
|
|
@@ -84,22 +70,17 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
84
70
|
target[key] = source[key];
|
|
85
71
|
}
|
|
86
72
|
}
|
|
87
|
-
|
|
88
73
|
return target;
|
|
89
74
|
}
|
|
90
|
-
|
|
91
75
|
function _toConsumableArray(arr) {
|
|
92
76
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
93
77
|
}
|
|
94
|
-
|
|
95
78
|
function _arrayWithoutHoles(arr) {
|
|
96
79
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
97
80
|
}
|
|
98
|
-
|
|
99
81
|
function _iterableToArray(iter) {
|
|
100
82
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
101
83
|
}
|
|
102
|
-
|
|
103
84
|
function _unsupportedIterableToArray(o, minLen) {
|
|
104
85
|
if (!o) return;
|
|
105
86
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -108,18 +89,28 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
108
89
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
109
90
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
110
91
|
}
|
|
111
|
-
|
|
112
92
|
function _arrayLikeToArray(arr, len) {
|
|
113
93
|
if (len == null || len > arr.length) len = arr.length;
|
|
114
|
-
|
|
115
94
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
116
|
-
|
|
117
95
|
return arr2;
|
|
118
96
|
}
|
|
119
|
-
|
|
120
97
|
function _nonIterableSpread() {
|
|
121
98
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
122
99
|
}
|
|
100
|
+
function _toPrimitive(input, hint) {
|
|
101
|
+
if (typeof input !== "object" || input === null) return input;
|
|
102
|
+
var prim = input[Symbol.toPrimitive];
|
|
103
|
+
if (prim !== undefined) {
|
|
104
|
+
var res = prim.call(input, hint || "default");
|
|
105
|
+
if (typeof res !== "object") return res;
|
|
106
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
107
|
+
}
|
|
108
|
+
return (hint === "string" ? String : Number)(input);
|
|
109
|
+
}
|
|
110
|
+
function _toPropertyKey(arg) {
|
|
111
|
+
var key = _toPrimitive(arg, "string");
|
|
112
|
+
return typeof key === "symbol" ? key : String(key);
|
|
113
|
+
}
|
|
123
114
|
|
|
124
115
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
125
116
|
|
|
@@ -260,12 +251,12 @@ var humps$1 = {exports: {}};
|
|
|
260
251
|
var humps = humps$1.exports;
|
|
261
252
|
|
|
262
253
|
var _excluded = ["class", "style"];
|
|
254
|
+
|
|
263
255
|
/**
|
|
264
256
|
* Converts a CSS style into a plain Javascript object.
|
|
265
257
|
* @param {String} style The style to converts into a plain Javascript object.
|
|
266
258
|
* @returns {Object}
|
|
267
259
|
*/
|
|
268
|
-
|
|
269
260
|
function styleToObject(style) {
|
|
270
261
|
return style.split(';').map(function (s) {
|
|
271
262
|
return s.trim();
|
|
@@ -279,19 +270,19 @@ function styleToObject(style) {
|
|
|
279
270
|
return output;
|
|
280
271
|
}, {});
|
|
281
272
|
}
|
|
273
|
+
|
|
282
274
|
/**
|
|
283
275
|
* Converts a CSS class list into a plain Javascript object.
|
|
284
276
|
* @param {Array<String>} classes The class list to convert.
|
|
285
277
|
* @returns {Object}
|
|
286
278
|
*/
|
|
287
|
-
|
|
288
|
-
|
|
289
279
|
function classToObject(classes) {
|
|
290
280
|
return classes.split(/\s+/).reduce(function (output, className) {
|
|
291
281
|
output[className] = true;
|
|
292
282
|
return output;
|
|
293
283
|
}, {});
|
|
294
284
|
}
|
|
285
|
+
|
|
295
286
|
/**
|
|
296
287
|
* Converts a FontAwesome abstract element of an icon into a Vue VNode.
|
|
297
288
|
* @param {AbstractElement | String} abstractElement The element to convert.
|
|
@@ -299,50 +290,44 @@ function classToObject(classes) {
|
|
|
299
290
|
* @param {Object} attrs The user-defined native HTML attributes.
|
|
300
291
|
* @returns {VNode}
|
|
301
292
|
*/
|
|
302
|
-
|
|
303
|
-
|
|
304
293
|
function convert(abstractElement) {
|
|
305
294
|
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
306
295
|
var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
307
|
-
|
|
308
296
|
// If the abstract element is a string, we'll just return a string render function
|
|
309
297
|
if (typeof abstractElement === 'string') {
|
|
310
298
|
return abstractElement;
|
|
311
|
-
}
|
|
312
|
-
|
|
299
|
+
}
|
|
313
300
|
|
|
301
|
+
// Converting abstract element children into Vue VNodes
|
|
314
302
|
var children = (abstractElement.children || []).map(function (child) {
|
|
315
303
|
return convert(child);
|
|
316
|
-
});
|
|
304
|
+
});
|
|
317
305
|
|
|
306
|
+
// Converting abstract element attributes into valid Vue format
|
|
318
307
|
var mixins = Object.keys(abstractElement.attributes || {}).reduce(function (mixins, key) {
|
|
319
308
|
var value = abstractElement.attributes[key];
|
|
320
|
-
|
|
321
309
|
switch (key) {
|
|
322
310
|
case 'class':
|
|
323
311
|
mixins.class = classToObject(value);
|
|
324
312
|
break;
|
|
325
|
-
|
|
326
313
|
case 'style':
|
|
327
314
|
mixins.style = styleToObject(value);
|
|
328
315
|
break;
|
|
329
|
-
|
|
330
316
|
default:
|
|
331
317
|
mixins.attrs[key] = value;
|
|
332
318
|
}
|
|
333
|
-
|
|
334
319
|
return mixins;
|
|
335
320
|
}, {
|
|
336
321
|
attrs: {},
|
|
337
322
|
class: {},
|
|
338
323
|
style: {}
|
|
339
|
-
});
|
|
324
|
+
});
|
|
340
325
|
|
|
326
|
+
// Now, we'll return the VNode
|
|
341
327
|
attrs.class;
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
328
|
+
var _attrs$style = attrs.style,
|
|
329
|
+
aStyle = _attrs$style === void 0 ? {} : _attrs$style,
|
|
330
|
+
otherAttrs = _objectWithoutProperties(attrs, _excluded);
|
|
346
331
|
return h(abstractElement.tag, _objectSpread2(_objectSpread2(_objectSpread2({}, props), {}, {
|
|
347
332
|
class: mixins.class,
|
|
348
333
|
style: _objectSpread2(_objectSpread2({}, mixins.style), aStyle)
|
|
@@ -350,15 +335,12 @@ function convert(abstractElement) {
|
|
|
350
335
|
}
|
|
351
336
|
|
|
352
337
|
var PRODUCTION = false;
|
|
353
|
-
|
|
354
338
|
try {
|
|
355
339
|
PRODUCTION = process.env.NODE_ENV === 'production';
|
|
356
340
|
} catch (e) {}
|
|
357
|
-
|
|
358
341
|
function log () {
|
|
359
342
|
if (!PRODUCTION && console && typeof console.error === 'function') {
|
|
360
343
|
var _console;
|
|
361
|
-
|
|
362
344
|
(_console = console).error.apply(_console, arguments);
|
|
363
345
|
}
|
|
364
346
|
}
|
|
@@ -368,7 +350,6 @@ function objectWithKey(key, value) {
|
|
|
368
350
|
}
|
|
369
351
|
function classList(props) {
|
|
370
352
|
var _classes;
|
|
371
|
-
|
|
372
353
|
var classes = (_classes = {
|
|
373
354
|
'fa-spin': props.spin,
|
|
374
355
|
'fa-pulse': props.pulse,
|
|
@@ -391,26 +372,21 @@ function normalizeIconArgs(icon) {
|
|
|
391
372
|
if (icon && _typeof(icon) === 'object' && icon.prefix && icon.iconName && icon.icon) {
|
|
392
373
|
return icon;
|
|
393
374
|
}
|
|
394
|
-
|
|
395
375
|
if (parse.icon) {
|
|
396
376
|
return parse.icon(icon);
|
|
397
377
|
}
|
|
398
|
-
|
|
399
378
|
if (icon === null) {
|
|
400
379
|
return null;
|
|
401
380
|
}
|
|
402
|
-
|
|
403
381
|
if (_typeof(icon) === 'object' && icon.prefix && icon.iconName) {
|
|
404
382
|
return icon;
|
|
405
383
|
}
|
|
406
|
-
|
|
407
384
|
if (Array.isArray(icon) && icon.length === 2) {
|
|
408
385
|
return {
|
|
409
386
|
prefix: icon[0],
|
|
410
387
|
iconName: icon[1]
|
|
411
388
|
};
|
|
412
389
|
}
|
|
413
|
-
|
|
414
390
|
if (typeof icon === 'string') {
|
|
415
391
|
return {
|
|
416
392
|
prefix: 'fas',
|
|
@@ -418,7 +394,6 @@ function normalizeIconArgs(icon) {
|
|
|
418
394
|
};
|
|
419
395
|
}
|
|
420
396
|
}
|
|
421
|
-
|
|
422
397
|
var FontAwesomeIcon = defineComponent({
|
|
423
398
|
name: 'FontAwesomeIcon',
|
|
424
399
|
props: {
|
|
@@ -445,6 +420,10 @@ var FontAwesomeIcon = defineComponent({
|
|
|
445
420
|
type: [Object, Array, String],
|
|
446
421
|
default: null
|
|
447
422
|
},
|
|
423
|
+
maskId: {
|
|
424
|
+
type: String,
|
|
425
|
+
default: null
|
|
426
|
+
},
|
|
448
427
|
listItem: {
|
|
449
428
|
type: Boolean,
|
|
450
429
|
default: false
|
|
@@ -494,6 +473,10 @@ var FontAwesomeIcon = defineComponent({
|
|
|
494
473
|
type: String,
|
|
495
474
|
default: null
|
|
496
475
|
},
|
|
476
|
+
titleId: {
|
|
477
|
+
type: String,
|
|
478
|
+
default: null
|
|
479
|
+
},
|
|
497
480
|
inverse: {
|
|
498
481
|
type: Boolean,
|
|
499
482
|
default: false
|
|
@@ -548,7 +531,9 @@ var FontAwesomeIcon = defineComponent({
|
|
|
548
531
|
var renderedIcon = computed(function () {
|
|
549
532
|
return icon(icon$1.value, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, classes.value), transform.value), mask.value), {}, {
|
|
550
533
|
symbol: props.symbol,
|
|
551
|
-
title: props.title
|
|
534
|
+
title: props.title,
|
|
535
|
+
titleId: props.titleId,
|
|
536
|
+
maskId: props.maskId
|
|
552
537
|
}));
|
|
553
538
|
});
|
|
554
539
|
watch(renderedIcon, function (value) {
|
|
@@ -623,12 +608,10 @@ var FontAwesomeLayersText = defineComponent({
|
|
|
623
608
|
});
|
|
624
609
|
var abstractElement = computed(function () {
|
|
625
610
|
var _text = text(props.value.toString(), _objectSpread2(_objectSpread2({}, transform.value), classes.value)),
|
|
626
|
-
|
|
627
|
-
|
|
611
|
+
abstract = _text.abstract;
|
|
628
612
|
if (props.counter) {
|
|
629
613
|
abstract[0].attributes.class = abstract[0].attributes.class.replace('fa-layers-text', '');
|
|
630
614
|
}
|
|
631
|
-
|
|
632
615
|
return abstract[0];
|
|
633
616
|
});
|
|
634
617
|
var vnode = computed(function () {
|
package/index.js
CHANGED
|
@@ -6,17 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
function ownKeys(object, enumerableOnly) {
|
|
8
8
|
var keys = Object.keys(object);
|
|
9
|
-
|
|
10
9
|
if (Object.getOwnPropertySymbols) {
|
|
11
10
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
12
11
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
13
12
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
14
13
|
})), keys.push.apply(keys, symbols);
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
return keys;
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
function _objectSpread2(target) {
|
|
21
18
|
for (var i = 1; i < arguments.length; i++) {
|
|
22
19
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
@@ -26,10 +23,8 @@
|
|
|
26
23
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
27
24
|
});
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
return target;
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
function _typeof(obj) {
|
|
34
29
|
"@babel/helpers - typeof";
|
|
35
30
|
|
|
@@ -39,8 +34,8 @@
|
|
|
39
34
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
40
35
|
}, _typeof(obj);
|
|
41
36
|
}
|
|
42
|
-
|
|
43
37
|
function _defineProperty(obj, key, value) {
|
|
38
|
+
key = _toPropertyKey(key);
|
|
44
39
|
if (key in obj) {
|
|
45
40
|
Object.defineProperty(obj, key, {
|
|
46
41
|
value: value,
|
|
@@ -51,35 +46,26 @@
|
|
|
51
46
|
} else {
|
|
52
47
|
obj[key] = value;
|
|
53
48
|
}
|
|
54
|
-
|
|
55
49
|
return obj;
|
|
56
50
|
}
|
|
57
|
-
|
|
58
51
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
59
52
|
if (source == null) return {};
|
|
60
53
|
var target = {};
|
|
61
54
|
var sourceKeys = Object.keys(source);
|
|
62
55
|
var key, i;
|
|
63
|
-
|
|
64
56
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
65
57
|
key = sourceKeys[i];
|
|
66
58
|
if (excluded.indexOf(key) >= 0) continue;
|
|
67
59
|
target[key] = source[key];
|
|
68
60
|
}
|
|
69
|
-
|
|
70
61
|
return target;
|
|
71
62
|
}
|
|
72
|
-
|
|
73
63
|
function _objectWithoutProperties(source, excluded) {
|
|
74
64
|
if (source == null) return {};
|
|
75
|
-
|
|
76
65
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
77
|
-
|
|
78
66
|
var key, i;
|
|
79
|
-
|
|
80
67
|
if (Object.getOwnPropertySymbols) {
|
|
81
68
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
82
|
-
|
|
83
69
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
84
70
|
key = sourceSymbolKeys[i];
|
|
85
71
|
if (excluded.indexOf(key) >= 0) continue;
|
|
@@ -87,22 +73,17 @@
|
|
|
87
73
|
target[key] = source[key];
|
|
88
74
|
}
|
|
89
75
|
}
|
|
90
|
-
|
|
91
76
|
return target;
|
|
92
77
|
}
|
|
93
|
-
|
|
94
78
|
function _toConsumableArray(arr) {
|
|
95
79
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
96
80
|
}
|
|
97
|
-
|
|
98
81
|
function _arrayWithoutHoles(arr) {
|
|
99
82
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
100
83
|
}
|
|
101
|
-
|
|
102
84
|
function _iterableToArray(iter) {
|
|
103
85
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
104
86
|
}
|
|
105
|
-
|
|
106
87
|
function _unsupportedIterableToArray(o, minLen) {
|
|
107
88
|
if (!o) return;
|
|
108
89
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -111,18 +92,28 @@
|
|
|
111
92
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
112
93
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
113
94
|
}
|
|
114
|
-
|
|
115
95
|
function _arrayLikeToArray(arr, len) {
|
|
116
96
|
if (len == null || len > arr.length) len = arr.length;
|
|
117
|
-
|
|
118
97
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
119
|
-
|
|
120
98
|
return arr2;
|
|
121
99
|
}
|
|
122
|
-
|
|
123
100
|
function _nonIterableSpread() {
|
|
124
101
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
125
102
|
}
|
|
103
|
+
function _toPrimitive(input, hint) {
|
|
104
|
+
if (typeof input !== "object" || input === null) return input;
|
|
105
|
+
var prim = input[Symbol.toPrimitive];
|
|
106
|
+
if (prim !== undefined) {
|
|
107
|
+
var res = prim.call(input, hint || "default");
|
|
108
|
+
if (typeof res !== "object") return res;
|
|
109
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
110
|
+
}
|
|
111
|
+
return (hint === "string" ? String : Number)(input);
|
|
112
|
+
}
|
|
113
|
+
function _toPropertyKey(arg) {
|
|
114
|
+
var key = _toPrimitive(arg, "string");
|
|
115
|
+
return typeof key === "symbol" ? key : String(key);
|
|
116
|
+
}
|
|
126
117
|
|
|
127
118
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
128
119
|
|
|
@@ -263,12 +254,12 @@
|
|
|
263
254
|
var humps = humps$1.exports;
|
|
264
255
|
|
|
265
256
|
var _excluded = ["class", "style"];
|
|
257
|
+
|
|
266
258
|
/**
|
|
267
259
|
* Converts a CSS style into a plain Javascript object.
|
|
268
260
|
* @param {String} style The style to converts into a plain Javascript object.
|
|
269
261
|
* @returns {Object}
|
|
270
262
|
*/
|
|
271
|
-
|
|
272
263
|
function styleToObject(style) {
|
|
273
264
|
return style.split(';').map(function (s) {
|
|
274
265
|
return s.trim();
|
|
@@ -282,19 +273,19 @@
|
|
|
282
273
|
return output;
|
|
283
274
|
}, {});
|
|
284
275
|
}
|
|
276
|
+
|
|
285
277
|
/**
|
|
286
278
|
* Converts a CSS class list into a plain Javascript object.
|
|
287
279
|
* @param {Array<String>} classes The class list to convert.
|
|
288
280
|
* @returns {Object}
|
|
289
281
|
*/
|
|
290
|
-
|
|
291
|
-
|
|
292
282
|
function classToObject(classes) {
|
|
293
283
|
return classes.split(/\s+/).reduce(function (output, className) {
|
|
294
284
|
output[className] = true;
|
|
295
285
|
return output;
|
|
296
286
|
}, {});
|
|
297
287
|
}
|
|
288
|
+
|
|
298
289
|
/**
|
|
299
290
|
* Converts a FontAwesome abstract element of an icon into a Vue VNode.
|
|
300
291
|
* @param {AbstractElement | String} abstractElement The element to convert.
|
|
@@ -302,50 +293,44 @@
|
|
|
302
293
|
* @param {Object} attrs The user-defined native HTML attributes.
|
|
303
294
|
* @returns {VNode}
|
|
304
295
|
*/
|
|
305
|
-
|
|
306
|
-
|
|
307
296
|
function convert(abstractElement) {
|
|
308
297
|
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
309
298
|
var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
310
|
-
|
|
311
299
|
// If the abstract element is a string, we'll just return a string render function
|
|
312
300
|
if (typeof abstractElement === 'string') {
|
|
313
301
|
return abstractElement;
|
|
314
|
-
}
|
|
315
|
-
|
|
302
|
+
}
|
|
316
303
|
|
|
304
|
+
// Converting abstract element children into Vue VNodes
|
|
317
305
|
var children = (abstractElement.children || []).map(function (child) {
|
|
318
306
|
return convert(child);
|
|
319
|
-
});
|
|
307
|
+
});
|
|
320
308
|
|
|
309
|
+
// Converting abstract element attributes into valid Vue format
|
|
321
310
|
var mixins = Object.keys(abstractElement.attributes || {}).reduce(function (mixins, key) {
|
|
322
311
|
var value = abstractElement.attributes[key];
|
|
323
|
-
|
|
324
312
|
switch (key) {
|
|
325
313
|
case 'class':
|
|
326
314
|
mixins.class = classToObject(value);
|
|
327
315
|
break;
|
|
328
|
-
|
|
329
316
|
case 'style':
|
|
330
317
|
mixins.style = styleToObject(value);
|
|
331
318
|
break;
|
|
332
|
-
|
|
333
319
|
default:
|
|
334
320
|
mixins.attrs[key] = value;
|
|
335
321
|
}
|
|
336
|
-
|
|
337
322
|
return mixins;
|
|
338
323
|
}, {
|
|
339
324
|
attrs: {},
|
|
340
325
|
class: {},
|
|
341
326
|
style: {}
|
|
342
|
-
});
|
|
327
|
+
});
|
|
343
328
|
|
|
329
|
+
// Now, we'll return the VNode
|
|
344
330
|
attrs.class;
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
331
|
+
var _attrs$style = attrs.style,
|
|
332
|
+
aStyle = _attrs$style === void 0 ? {} : _attrs$style,
|
|
333
|
+
otherAttrs = _objectWithoutProperties(attrs, _excluded);
|
|
349
334
|
return vue.h(abstractElement.tag, _objectSpread2(_objectSpread2(_objectSpread2({}, props), {}, {
|
|
350
335
|
class: mixins.class,
|
|
351
336
|
style: _objectSpread2(_objectSpread2({}, mixins.style), aStyle)
|
|
@@ -353,15 +338,12 @@
|
|
|
353
338
|
}
|
|
354
339
|
|
|
355
340
|
var PRODUCTION = false;
|
|
356
|
-
|
|
357
341
|
try {
|
|
358
342
|
PRODUCTION = process.env.NODE_ENV === 'production';
|
|
359
343
|
} catch (e) {}
|
|
360
|
-
|
|
361
344
|
function log () {
|
|
362
345
|
if (!PRODUCTION && console && typeof console.error === 'function') {
|
|
363
346
|
var _console;
|
|
364
|
-
|
|
365
347
|
(_console = console).error.apply(_console, arguments);
|
|
366
348
|
}
|
|
367
349
|
}
|
|
@@ -371,7 +353,6 @@
|
|
|
371
353
|
}
|
|
372
354
|
function classList(props) {
|
|
373
355
|
var _classes;
|
|
374
|
-
|
|
375
356
|
var classes = (_classes = {
|
|
376
357
|
'fa-spin': props.spin,
|
|
377
358
|
'fa-pulse': props.pulse,
|
|
@@ -394,26 +375,21 @@
|
|
|
394
375
|
if (icon && _typeof(icon) === 'object' && icon.prefix && icon.iconName && icon.icon) {
|
|
395
376
|
return icon;
|
|
396
377
|
}
|
|
397
|
-
|
|
398
378
|
if (fontawesomeSvgCore.parse.icon) {
|
|
399
379
|
return fontawesomeSvgCore.parse.icon(icon);
|
|
400
380
|
}
|
|
401
|
-
|
|
402
381
|
if (icon === null) {
|
|
403
382
|
return null;
|
|
404
383
|
}
|
|
405
|
-
|
|
406
384
|
if (_typeof(icon) === 'object' && icon.prefix && icon.iconName) {
|
|
407
385
|
return icon;
|
|
408
386
|
}
|
|
409
|
-
|
|
410
387
|
if (Array.isArray(icon) && icon.length === 2) {
|
|
411
388
|
return {
|
|
412
389
|
prefix: icon[0],
|
|
413
390
|
iconName: icon[1]
|
|
414
391
|
};
|
|
415
392
|
}
|
|
416
|
-
|
|
417
393
|
if (typeof icon === 'string') {
|
|
418
394
|
return {
|
|
419
395
|
prefix: 'fas',
|
|
@@ -421,7 +397,6 @@
|
|
|
421
397
|
};
|
|
422
398
|
}
|
|
423
399
|
}
|
|
424
|
-
|
|
425
400
|
var FontAwesomeIcon = vue.defineComponent({
|
|
426
401
|
name: 'FontAwesomeIcon',
|
|
427
402
|
props: {
|
|
@@ -448,6 +423,10 @@
|
|
|
448
423
|
type: [Object, Array, String],
|
|
449
424
|
default: null
|
|
450
425
|
},
|
|
426
|
+
maskId: {
|
|
427
|
+
type: String,
|
|
428
|
+
default: null
|
|
429
|
+
},
|
|
451
430
|
listItem: {
|
|
452
431
|
type: Boolean,
|
|
453
432
|
default: false
|
|
@@ -497,6 +476,10 @@
|
|
|
497
476
|
type: String,
|
|
498
477
|
default: null
|
|
499
478
|
},
|
|
479
|
+
titleId: {
|
|
480
|
+
type: String,
|
|
481
|
+
default: null
|
|
482
|
+
},
|
|
500
483
|
inverse: {
|
|
501
484
|
type: Boolean,
|
|
502
485
|
default: false
|
|
@@ -551,7 +534,9 @@
|
|
|
551
534
|
var renderedIcon = vue.computed(function () {
|
|
552
535
|
return fontawesomeSvgCore.icon(icon.value, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, classes.value), transform.value), mask.value), {}, {
|
|
553
536
|
symbol: props.symbol,
|
|
554
|
-
title: props.title
|
|
537
|
+
title: props.title,
|
|
538
|
+
titleId: props.titleId,
|
|
539
|
+
maskId: props.maskId
|
|
555
540
|
}));
|
|
556
541
|
});
|
|
557
542
|
vue.watch(renderedIcon, function (value) {
|
|
@@ -626,12 +611,10 @@
|
|
|
626
611
|
});
|
|
627
612
|
var abstractElement = vue.computed(function () {
|
|
628
613
|
var _text = fontawesomeSvgCore.text(props.value.toString(), _objectSpread2(_objectSpread2({}, transform.value), classes.value)),
|
|
629
|
-
|
|
630
|
-
|
|
614
|
+
abstract = _text.abstract;
|
|
631
615
|
if (props.counter) {
|
|
632
616
|
abstract[0].attributes.class = abstract[0].attributes.class.replace('fa-layers-text', '');
|
|
633
617
|
}
|
|
634
|
-
|
|
635
618
|
return abstract[0];
|
|
636
619
|
});
|
|
637
620
|
var vnode = vue.computed(function () {
|
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 6",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.4",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"README.md",
|
|
@@ -67,24 +67,26 @@
|
|
|
67
67
|
"@babel/preset-env": "^7.18.2",
|
|
68
68
|
"@fortawesome/fontawesome-svg-core": "~6",
|
|
69
69
|
"@fortawesome/free-solid-svg-icons": "^6",
|
|
70
|
+
"@rollup/plugin-babel": "^5.3.1",
|
|
71
|
+
"@rollup/plugin-commonjs": "^22.0.0",
|
|
72
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
73
|
+
"@vue/test-utils": "^2.0.0-beta.2",
|
|
70
74
|
"babel-core": "^7.0.0-bridge.0",
|
|
71
75
|
"babel-jest": "^28.1.1",
|
|
72
76
|
"concurrently": "^7.2.1",
|
|
73
77
|
"cross-env": "^7.0.3",
|
|
74
78
|
"humps": "^2.0.1",
|
|
75
79
|
"husky": "^8.0.1",
|
|
80
|
+
"install": "^0.13.0",
|
|
76
81
|
"jest": "^28.1.1",
|
|
77
82
|
"jest-environment-jsdom": "^28.1.1",
|
|
78
83
|
"lint-staged": "^13.0.0",
|
|
79
84
|
"markdown-toc": "^1.2.0",
|
|
85
|
+
"npm": "^10.2.2",
|
|
86
|
+
"prettier": "^3.0.3",
|
|
80
87
|
"rollup": "^2.75.6",
|
|
81
|
-
"@rollup/plugin-babel": "^5.3.1",
|
|
82
|
-
"@rollup/plugin-commonjs": "^22.0.0",
|
|
83
|
-
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
84
|
-
"@vue/test-utils": "^2.0.0-beta.2",
|
|
85
88
|
"vue": "^3"
|
|
86
89
|
},
|
|
87
|
-
"dependencies": {},
|
|
88
90
|
"husky": {
|
|
89
91
|
"hooks": {
|
|
90
92
|
"pre-commit": "lint-staged"
|
|
@@ -4,7 +4,7 @@ import convert from '../converter'
|
|
|
4
4
|
import log from '../logger'
|
|
5
5
|
import { objectWithKey, classList } from '../utils'
|
|
6
6
|
|
|
7
|
-
function normalizeIconArgs
|
|
7
|
+
function normalizeIconArgs(icon) {
|
|
8
8
|
if (icon && typeof icon === 'object' && icon.prefix && icon.iconName && icon.icon) {
|
|
9
9
|
return icon
|
|
10
10
|
}
|
|
@@ -55,6 +55,10 @@ export default defineComponent({
|
|
|
55
55
|
type: [Object, Array, String],
|
|
56
56
|
default: null
|
|
57
57
|
},
|
|
58
|
+
maskId: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: null
|
|
61
|
+
},
|
|
58
62
|
listItem: {
|
|
59
63
|
type: Boolean,
|
|
60
64
|
default: false
|
|
@@ -98,6 +102,10 @@ export default defineComponent({
|
|
|
98
102
|
type: String,
|
|
99
103
|
default: null
|
|
100
104
|
},
|
|
105
|
+
titleId: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: null
|
|
108
|
+
},
|
|
101
109
|
inverse: {
|
|
102
110
|
type: Boolean,
|
|
103
111
|
default: false
|
|
@@ -133,35 +141,38 @@ export default defineComponent({
|
|
|
133
141
|
spinReverse: {
|
|
134
142
|
type: Boolean,
|
|
135
143
|
default: false
|
|
136
|
-
}
|
|
144
|
+
}
|
|
137
145
|
},
|
|
138
146
|
|
|
139
|
-
setup
|
|
147
|
+
setup(props, { attrs }) {
|
|
140
148
|
const icon = computed(() => normalizeIconArgs(props.icon))
|
|
141
149
|
const classes = computed(() => objectWithKey('classes', classList(props)))
|
|
142
|
-
const transform = computed(() => objectWithKey(
|
|
143
|
-
'transform',
|
|
144
|
-
(typeof props.transform === 'string')
|
|
145
|
-
? faParse.transform(props.transform)
|
|
146
|
-
: props.transform
|
|
147
|
-
))
|
|
150
|
+
const transform = computed(() => objectWithKey('transform', typeof props.transform === 'string' ? faParse.transform(props.transform) : props.transform))
|
|
148
151
|
const mask = computed(() => objectWithKey('mask', normalizeIconArgs(props.mask)))
|
|
149
152
|
|
|
150
|
-
const renderedIcon = computed(() =>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
const renderedIcon = computed(() =>
|
|
154
|
+
faIcon(icon.value, {
|
|
155
|
+
...classes.value,
|
|
156
|
+
...transform.value,
|
|
157
|
+
...mask.value,
|
|
158
|
+
symbol: props.symbol,
|
|
159
|
+
title: props.title,
|
|
160
|
+
titleId: props.titleId,
|
|
161
|
+
maskId: props.maskId
|
|
162
|
+
})
|
|
163
|
+
)
|
|
157
164
|
|
|
158
|
-
watch(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
165
|
+
watch(
|
|
166
|
+
renderedIcon,
|
|
167
|
+
(value) => {
|
|
168
|
+
if (!value) {
|
|
169
|
+
return log('Could not find one or more icon(s)', icon.value, mask.value)
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
{ immediate: true }
|
|
173
|
+
)
|
|
163
174
|
|
|
164
|
-
const vnode = computed(() => renderedIcon.value ? convert(renderedIcon.value.abstract[0], {}, attrs) : null)
|
|
175
|
+
const vnode = computed(() => (renderedIcon.value ? convert(renderedIcon.value.abstract[0], {}, attrs) : null))
|
|
165
176
|
return () => vnode.value
|
|
166
177
|
}
|
|
167
178
|
})
|