@fortawesome/vue-fontawesome 3.0.8 → 3.1.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/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@ 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.1.0](https://github.com/FortAwesome/vue-fontawesome/releases/tag/3.1.0) - 2025-07-22
8
+
9
+ ### Changed
10
+
11
+ - Font Awesome Pro+ icons are now available with an active Pro+ subscription.
12
+
13
+ - Added `widthAuto` prop
14
+
15
+ - Added `rotateBy` prop
16
+
17
+ - Deprecated `fa-fw` prop
18
+
19
+ ---
20
+
7
21
  ## [3.0.8](https://github.com/FortAwesome/vue-fontawesome/releases/tag/3.0.8) - 2024-05-21
8
22
 
9
23
  ### Changed
package/index.d.ts CHANGED
@@ -12,6 +12,7 @@ interface FontAwesomeIconProps {
12
12
  pull?: 'right' | 'left'
13
13
  pulse?: boolean
14
14
  rotation?: 90 | 180 | 270 | '90' | '180' | '270'
15
+ rotateBy?: boolean
15
16
  swapOpacity?: boolean
16
17
  size?: '2xs' | 'xs' | 'sm' | 'lg' | 'xl' | '2xl' | '1x' | '2x' | '3x' | '4x' | '5x' | '6x' | '7x' | '8x' | '9x' | '10x'
17
18
  spin?: boolean
@@ -27,6 +28,7 @@ interface FontAwesomeIconProps {
27
28
  beatFade?: boolean
28
29
  spinPulse?: boolean
29
30
  spinReverse?: boolean
31
+ widthAuto?: boolean
30
32
  }
31
33
 
32
34
  interface FontAwesomeLayersProps {
package/index.es.js CHANGED
@@ -1,6 +1,61 @@
1
- import { parse, icon, config, text } from '@fortawesome/fontawesome-svg-core';
2
1
  import { h, defineComponent, computed, watch } from 'vue';
2
+ import { parse, icon, config, text } from '@fortawesome/fontawesome-svg-core';
3
3
 
4
+ function _arrayLikeToArray(r, a) {
5
+ (null == a || a > r.length) && (a = r.length);
6
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
7
+ return n;
8
+ }
9
+ function _arrayWithHoles(r) {
10
+ if (Array.isArray(r)) return r;
11
+ }
12
+ function _arrayWithoutHoles(r) {
13
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
14
+ }
15
+ function _defineProperty(e, r, t) {
16
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
17
+ value: t,
18
+ enumerable: !0,
19
+ configurable: !0,
20
+ writable: !0
21
+ }) : e[r] = t, e;
22
+ }
23
+ function _iterableToArray(r) {
24
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
25
+ }
26
+ function _iterableToArrayLimit(r, l) {
27
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
28
+ if (null != t) {
29
+ var e,
30
+ n,
31
+ i,
32
+ u,
33
+ a = [],
34
+ f = !0,
35
+ o = !1;
36
+ try {
37
+ if (i = (t = t.call(r)).next, 0 === l) {
38
+ if (Object(t) !== t) return;
39
+ f = !1;
40
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
41
+ } catch (r) {
42
+ o = !0, n = r;
43
+ } finally {
44
+ try {
45
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
46
+ } finally {
47
+ if (o) throw n;
48
+ }
49
+ }
50
+ return a;
51
+ }
52
+ }
53
+ function _nonIterableRest() {
54
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
55
+ }
56
+ function _nonIterableSpread() {
57
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
58
+ }
4
59
  function ownKeys(e, r) {
5
60
  var t = Object.keys(e);
6
61
  if (Object.getOwnPropertySymbols) {
@@ -22,6 +77,32 @@ function _objectSpread2(e) {
22
77
  }
23
78
  return e;
24
79
  }
80
+ function _objectWithoutProperties(e, t) {
81
+ if (null == e) return {};
82
+ var o,
83
+ r,
84
+ i = _objectWithoutPropertiesLoose(e, t);
85
+ if (Object.getOwnPropertySymbols) {
86
+ var n = Object.getOwnPropertySymbols(e);
87
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
88
+ }
89
+ return i;
90
+ }
91
+ function _objectWithoutPropertiesLoose(r, e) {
92
+ if (null == r) return {};
93
+ var t = {};
94
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
95
+ if (-1 !== e.indexOf(n)) continue;
96
+ t[n] = r[n];
97
+ }
98
+ return t;
99
+ }
100
+ function _slicedToArray(r, e) {
101
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
102
+ }
103
+ function _toConsumableArray(r) {
104
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
105
+ }
25
106
  function _toPrimitive(t, r) {
26
107
  if ("object" != typeof t || !t) return t;
27
108
  var e = t[Symbol.toPrimitive];
@@ -45,70 +126,67 @@ function _typeof(o) {
45
126
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
46
127
  }, _typeof(o);
47
128
  }
48
- function _defineProperty(obj, key, value) {
49
- key = _toPropertyKey(key);
50
- if (key in obj) {
51
- Object.defineProperty(obj, key, {
52
- value: value,
53
- enumerable: true,
54
- configurable: true,
55
- writable: true
56
- });
57
- } else {
58
- obj[key] = value;
59
- }
60
- return obj;
61
- }
62
- function _objectWithoutPropertiesLoose(source, excluded) {
63
- if (source == null) return {};
64
- var target = {};
65
- for (var key in source) {
66
- if (Object.prototype.hasOwnProperty.call(source, key)) {
67
- if (excluded.indexOf(key) >= 0) continue;
68
- target[key] = source[key];
69
- }
129
+ function _unsupportedIterableToArray(r, a) {
130
+ if (r) {
131
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
132
+ var t = {}.toString.call(r).slice(8, -1);
133
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
70
134
  }
71
- return target;
72
- }
73
- function _objectWithoutProperties(source, excluded) {
74
- if (source == null) return {};
75
- var target = _objectWithoutPropertiesLoose(source, excluded);
76
- var key, i;
77
- if (Object.getOwnPropertySymbols) {
78
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
79
- for (i = 0; i < sourceSymbolKeys.length; i++) {
80
- key = sourceSymbolKeys[i];
81
- if (excluded.indexOf(key) >= 0) continue;
82
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
83
- target[key] = source[key];
84
- }
85
- }
86
- return target;
87
- }
88
- function _toConsumableArray(arr) {
89
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
90
- }
91
- function _arrayWithoutHoles(arr) {
92
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
93
135
  }
94
- function _iterableToArray(iter) {
95
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
96
- }
97
- function _unsupportedIterableToArray(o, minLen) {
98
- if (!o) return;
99
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
100
- var n = Object.prototype.toString.call(o).slice(8, -1);
101
- if (n === "Object" && o.constructor) n = o.constructor.name;
102
- if (n === "Map" || n === "Set") return Array.from(o);
103
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
136
+
137
+ var ICON_PACKS_STARTING_VERSION = '7.0.0';
138
+ var svgCorePackageJson = require('@fortawesome/fontawesome-svg-core/package.json');
139
+ var SVG_CORE_VERSION = svgCorePackageJson.version;
140
+ function objectWithKey(key, value) {
141
+ return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? _defineProperty({}, key, value) : {};
104
142
  }
105
- function _arrayLikeToArray(arr, len) {
106
- if (len == null || len > arr.length) len = arr.length;
107
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
108
- return arr2;
143
+ function classList(props) {
144
+ var _classes;
145
+ var classes = (_classes = {
146
+ 'fa-spin': props.spin,
147
+ 'fa-pulse': props.pulse,
148
+ // the fixedWidth property has been deprecated as of version 7.0.0
149
+ 'fa-fw': props.fixedWidth,
150
+ 'fa-border': props.border,
151
+ 'fa-li': props.listItem,
152
+ 'fa-inverse': props.inverse,
153
+ 'fa-flip': props.flip === true,
154
+ 'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both',
155
+ 'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both'
156
+ }, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_classes, "fa-".concat(props.size), props.size !== null), "fa-rotate-".concat(props.rotation), props.rotation !== null), 'fa-rotate-by', props.rotateBy), "fa-pull-".concat(props.pull), props.pull !== null), 'fa-swap-opacity', props.swapOpacity), 'fa-bounce', props.bounce), 'fa-shake', props.shake), 'fa-beat', props.beat), 'fa-fade', props.fade), 'fa-beat-fade', props.beatFade), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_classes, 'fa-flash', props.flash), 'fa-spin-pulse', props.spinPulse), 'fa-spin-reverse', props.spinReverse), 'fa-width-auto', props.widthAuto));
157
+ return Object.keys(classes).map(function (key) {
158
+ return classes[key] ? key : null;
159
+ }).filter(function (key) {
160
+ return key;
161
+ });
109
162
  }
110
- function _nonIterableSpread() {
111
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
163
+
164
+ // check if verion1 is less than version2
165
+ function versionCheckLt(version1, version2) {
166
+ var _version1$split = version1.split('-'),
167
+ _version1$split2 = _slicedToArray(_version1$split, 2),
168
+ v1Base = _version1$split2[0],
169
+ v1PreRelease = _version1$split2[1];
170
+ var _version2$split = version2.split('-'),
171
+ _version2$split2 = _slicedToArray(_version2$split, 2),
172
+ v2Base = _version2$split2[0],
173
+ v2PreRelease = _version2$split2[1];
174
+ var v1Parts = v1Base.split('.').map(Number);
175
+ var v2Parts = v2Base.split('.').map(Number);
176
+
177
+ // Compare version numbers first
178
+ for (var i = 0; i < Math.max(v1Parts.length, v2Parts.length); i++) {
179
+ var v1Part = v1Parts[i] || 0;
180
+ var v2Part = v2Parts[i] || 0;
181
+ if (v1Part < v2Part) return true;
182
+ if (v1Part > v2Part) return false;
183
+ }
184
+
185
+ // If version numbers are equal, compare pre-release identifiers
186
+ // A version with a pre-release identifier is less than one without
187
+ if (v1PreRelease && !v2PreRelease) return true;
188
+ if (!v1PreRelease && v2PreRelease) return false;
189
+ return false;
112
190
  }
113
191
 
114
192
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -344,29 +422,6 @@ function log () {
344
422
  }
345
423
  }
346
424
 
347
- function objectWithKey(key, value) {
348
- return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? _defineProperty({}, key, value) : {};
349
- }
350
- function classList(props) {
351
- var _classes;
352
- var classes = (_classes = {
353
- 'fa-spin': props.spin,
354
- 'fa-pulse': props.pulse,
355
- 'fa-fw': props.fixedWidth,
356
- 'fa-border': props.border,
357
- 'fa-li': props.listItem,
358
- 'fa-inverse': props.inverse,
359
- 'fa-flip': props.flip === true,
360
- 'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both',
361
- 'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both'
362
- }, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_classes, "fa-".concat(props.size), props.size !== null), "fa-rotate-".concat(props.rotation), props.rotation !== null), "fa-pull-".concat(props.pull), props.pull !== null), 'fa-swap-opacity', props.swapOpacity), 'fa-bounce', props.bounce), 'fa-shake', props.shake), 'fa-beat', props.beat), 'fa-fade', props.fade), 'fa-beat-fade', props.beatFade), 'fa-flash', props.flash), _defineProperty(_defineProperty(_classes, 'fa-spin-pulse', props.spinPulse), 'fa-spin-reverse', props.spinReverse));
363
- return Object.keys(classes).map(function (key) {
364
- return classes[key] ? key : null;
365
- }).filter(function (key) {
366
- return key;
367
- });
368
- }
369
-
370
425
  function normalizeIconArgs(icon) {
371
426
  if (icon && _typeof(icon) === 'object' && icon.prefix && icon.iconName && icon.icon) {
372
427
  return icon;
@@ -400,6 +455,7 @@ var FontAwesomeIcon = defineComponent({
400
455
  type: Boolean,
401
456
  default: false
402
457
  },
458
+ // the fixedWidth property has been deprecated as of version 7
403
459
  fixedWidth: {
404
460
  type: Boolean,
405
461
  default: false
@@ -445,6 +501,11 @@ var FontAwesomeIcon = defineComponent({
445
501
  return [90, 180, 270].indexOf(Number.parseInt(value, 10)) > -1;
446
502
  }
447
503
  },
504
+ // the rotateBy property is only supported in version 7.0.0 and later
505
+ rotateBy: {
506
+ type: Boolean,
507
+ default: false
508
+ },
448
509
  swapOpacity: {
449
510
  type: Boolean,
450
511
  default: false
@@ -511,6 +572,11 @@ var FontAwesomeIcon = defineComponent({
511
572
  spinReverse: {
512
573
  type: Boolean,
513
574
  default: false
575
+ },
576
+ // the widthAuto property is only supported in version 7.0.0 and later
577
+ widthAuto: {
578
+ type: Boolean,
579
+ default: false
514
580
  }
515
581
  },
516
582
  setup: function setup(props, _ref) {
@@ -528,12 +594,16 @@ var FontAwesomeIcon = defineComponent({
528
594
  return objectWithKey('mask', normalizeIconArgs(props.mask));
529
595
  });
530
596
  var renderedIcon = computed(function () {
531
- return icon(icon$1.value, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, classes.value), transform.value), mask.value), {}, {
597
+ var iconProps = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, classes.value), transform.value), mask.value), {}, {
532
598
  symbol: props.symbol,
533
- title: props.title,
534
- titleId: props.titleId,
535
599
  maskId: props.maskId
536
- }));
600
+ });
601
+ if (versionCheckLt(SVG_CORE_VERSION, ICON_PACKS_STARTING_VERSION)) {
602
+ // the title attribute will only apply to versions prior to version 7.0.0
603
+ iconProps.title = props.title;
604
+ iconProps.titleId = props.titleId;
605
+ }
606
+ return icon(icon$1.value, iconProps);
537
607
  });
538
608
  watch(renderedIcon, function (value) {
539
609
  if (!value) {
@@ -563,7 +633,7 @@ var FontAwesomeLayers = defineComponent({
563
633
  var slots = _ref.slots;
564
634
  var familyPrefix = config.familyPrefix;
565
635
  var className = computed(function () {
566
- return ["".concat(familyPrefix, "-layers")].concat(_toConsumableArray(props.fixedWidth ? ["".concat(familyPrefix, "-fw")] : []));
636
+ return ["".concat(familyPrefix, "-layers")].concat(_toConsumableArray(versionCheckLt(SVG_CORE_VERSION, ICON_PACKS_STARTING_VERSION) && props.fixedWidth ? ["".concat(familyPrefix, "-fw")] : []));
567
637
  });
568
638
  return function () {
569
639
  return h('div', {
package/index.js CHANGED
@@ -1,9 +1,64 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@fortawesome/fontawesome-svg-core'), require('vue')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@fortawesome/fontawesome-svg-core', 'vue'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["vue-fontawesome"] = {}, global.FontAwesome, global.vue));
5
- })(this, (function (exports, fontawesomeSvgCore, vue) { 'use strict';
6
-
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@fortawesome/fontawesome-svg-core')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', '@fortawesome/fontawesome-svg-core'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["vue-fontawesome"] = {}, global.vue, global.FontAwesome));
5
+ })(this, (function (exports, vue, fontawesomeSvgCore) { 'use strict';
6
+
7
+ function _arrayLikeToArray(r, a) {
8
+ (null == a || a > r.length) && (a = r.length);
9
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
10
+ return n;
11
+ }
12
+ function _arrayWithHoles(r) {
13
+ if (Array.isArray(r)) return r;
14
+ }
15
+ function _arrayWithoutHoles(r) {
16
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
17
+ }
18
+ function _defineProperty(e, r, t) {
19
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
20
+ value: t,
21
+ enumerable: !0,
22
+ configurable: !0,
23
+ writable: !0
24
+ }) : e[r] = t, e;
25
+ }
26
+ function _iterableToArray(r) {
27
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
28
+ }
29
+ function _iterableToArrayLimit(r, l) {
30
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
31
+ if (null != t) {
32
+ var e,
33
+ n,
34
+ i,
35
+ u,
36
+ a = [],
37
+ f = !0,
38
+ o = !1;
39
+ try {
40
+ if (i = (t = t.call(r)).next, 0 === l) {
41
+ if (Object(t) !== t) return;
42
+ f = !1;
43
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
44
+ } catch (r) {
45
+ o = !0, n = r;
46
+ } finally {
47
+ try {
48
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
49
+ } finally {
50
+ if (o) throw n;
51
+ }
52
+ }
53
+ return a;
54
+ }
55
+ }
56
+ function _nonIterableRest() {
57
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
58
+ }
59
+ function _nonIterableSpread() {
60
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
61
+ }
7
62
  function ownKeys(e, r) {
8
63
  var t = Object.keys(e);
9
64
  if (Object.getOwnPropertySymbols) {
@@ -25,6 +80,32 @@
25
80
  }
26
81
  return e;
27
82
  }
83
+ function _objectWithoutProperties(e, t) {
84
+ if (null == e) return {};
85
+ var o,
86
+ r,
87
+ i = _objectWithoutPropertiesLoose(e, t);
88
+ if (Object.getOwnPropertySymbols) {
89
+ var n = Object.getOwnPropertySymbols(e);
90
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
91
+ }
92
+ return i;
93
+ }
94
+ function _objectWithoutPropertiesLoose(r, e) {
95
+ if (null == r) return {};
96
+ var t = {};
97
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
98
+ if (-1 !== e.indexOf(n)) continue;
99
+ t[n] = r[n];
100
+ }
101
+ return t;
102
+ }
103
+ function _slicedToArray(r, e) {
104
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
105
+ }
106
+ function _toConsumableArray(r) {
107
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
108
+ }
28
109
  function _toPrimitive(t, r) {
29
110
  if ("object" != typeof t || !t) return t;
30
111
  var e = t[Symbol.toPrimitive];
@@ -48,70 +129,67 @@
48
129
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
49
130
  }, _typeof(o);
50
131
  }
51
- function _defineProperty(obj, key, value) {
52
- key = _toPropertyKey(key);
53
- if (key in obj) {
54
- Object.defineProperty(obj, key, {
55
- value: value,
56
- enumerable: true,
57
- configurable: true,
58
- writable: true
59
- });
60
- } else {
61
- obj[key] = value;
62
- }
63
- return obj;
64
- }
65
- function _objectWithoutPropertiesLoose(source, excluded) {
66
- if (source == null) return {};
67
- var target = {};
68
- for (var key in source) {
69
- if (Object.prototype.hasOwnProperty.call(source, key)) {
70
- if (excluded.indexOf(key) >= 0) continue;
71
- target[key] = source[key];
72
- }
132
+ function _unsupportedIterableToArray(r, a) {
133
+ if (r) {
134
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
135
+ var t = {}.toString.call(r).slice(8, -1);
136
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
73
137
  }
74
- return target;
75
- }
76
- function _objectWithoutProperties(source, excluded) {
77
- if (source == null) return {};
78
- var target = _objectWithoutPropertiesLoose(source, excluded);
79
- var key, i;
80
- if (Object.getOwnPropertySymbols) {
81
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
82
- for (i = 0; i < sourceSymbolKeys.length; i++) {
83
- key = sourceSymbolKeys[i];
84
- if (excluded.indexOf(key) >= 0) continue;
85
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
86
- target[key] = source[key];
87
- }
88
- }
89
- return target;
90
- }
91
- function _toConsumableArray(arr) {
92
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
93
- }
94
- function _arrayWithoutHoles(arr) {
95
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
96
- }
97
- function _iterableToArray(iter) {
98
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
99
138
  }
100
- function _unsupportedIterableToArray(o, minLen) {
101
- if (!o) return;
102
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
103
- var n = Object.prototype.toString.call(o).slice(8, -1);
104
- if (n === "Object" && o.constructor) n = o.constructor.name;
105
- if (n === "Map" || n === "Set") return Array.from(o);
106
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
139
+
140
+ var ICON_PACKS_STARTING_VERSION = '7.0.0';
141
+ var svgCorePackageJson = require('@fortawesome/fontawesome-svg-core/package.json');
142
+ var SVG_CORE_VERSION = svgCorePackageJson.version;
143
+ function objectWithKey(key, value) {
144
+ return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? _defineProperty({}, key, value) : {};
107
145
  }
108
- function _arrayLikeToArray(arr, len) {
109
- if (len == null || len > arr.length) len = arr.length;
110
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
111
- return arr2;
146
+ function classList(props) {
147
+ var _classes;
148
+ var classes = (_classes = {
149
+ 'fa-spin': props.spin,
150
+ 'fa-pulse': props.pulse,
151
+ // the fixedWidth property has been deprecated as of version 7.0.0
152
+ 'fa-fw': props.fixedWidth,
153
+ 'fa-border': props.border,
154
+ 'fa-li': props.listItem,
155
+ 'fa-inverse': props.inverse,
156
+ 'fa-flip': props.flip === true,
157
+ 'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both',
158
+ 'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both'
159
+ }, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_classes, "fa-".concat(props.size), props.size !== null), "fa-rotate-".concat(props.rotation), props.rotation !== null), 'fa-rotate-by', props.rotateBy), "fa-pull-".concat(props.pull), props.pull !== null), 'fa-swap-opacity', props.swapOpacity), 'fa-bounce', props.bounce), 'fa-shake', props.shake), 'fa-beat', props.beat), 'fa-fade', props.fade), 'fa-beat-fade', props.beatFade), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_classes, 'fa-flash', props.flash), 'fa-spin-pulse', props.spinPulse), 'fa-spin-reverse', props.spinReverse), 'fa-width-auto', props.widthAuto));
160
+ return Object.keys(classes).map(function (key) {
161
+ return classes[key] ? key : null;
162
+ }).filter(function (key) {
163
+ return key;
164
+ });
112
165
  }
113
- function _nonIterableSpread() {
114
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
166
+
167
+ // check if verion1 is less than version2
168
+ function versionCheckLt(version1, version2) {
169
+ var _version1$split = version1.split('-'),
170
+ _version1$split2 = _slicedToArray(_version1$split, 2),
171
+ v1Base = _version1$split2[0],
172
+ v1PreRelease = _version1$split2[1];
173
+ var _version2$split = version2.split('-'),
174
+ _version2$split2 = _slicedToArray(_version2$split, 2),
175
+ v2Base = _version2$split2[0],
176
+ v2PreRelease = _version2$split2[1];
177
+ var v1Parts = v1Base.split('.').map(Number);
178
+ var v2Parts = v2Base.split('.').map(Number);
179
+
180
+ // Compare version numbers first
181
+ for (var i = 0; i < Math.max(v1Parts.length, v2Parts.length); i++) {
182
+ var v1Part = v1Parts[i] || 0;
183
+ var v2Part = v2Parts[i] || 0;
184
+ if (v1Part < v2Part) return true;
185
+ if (v1Part > v2Part) return false;
186
+ }
187
+
188
+ // If version numbers are equal, compare pre-release identifiers
189
+ // A version with a pre-release identifier is less than one without
190
+ if (v1PreRelease && !v2PreRelease) return true;
191
+ if (!v1PreRelease && v2PreRelease) return false;
192
+ return false;
115
193
  }
116
194
 
117
195
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -347,29 +425,6 @@
347
425
  }
348
426
  }
349
427
 
350
- function objectWithKey(key, value) {
351
- return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? _defineProperty({}, key, value) : {};
352
- }
353
- function classList(props) {
354
- var _classes;
355
- var classes = (_classes = {
356
- 'fa-spin': props.spin,
357
- 'fa-pulse': props.pulse,
358
- 'fa-fw': props.fixedWidth,
359
- 'fa-border': props.border,
360
- 'fa-li': props.listItem,
361
- 'fa-inverse': props.inverse,
362
- 'fa-flip': props.flip === true,
363
- 'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both',
364
- 'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both'
365
- }, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_classes, "fa-".concat(props.size), props.size !== null), "fa-rotate-".concat(props.rotation), props.rotation !== null), "fa-pull-".concat(props.pull), props.pull !== null), 'fa-swap-opacity', props.swapOpacity), 'fa-bounce', props.bounce), 'fa-shake', props.shake), 'fa-beat', props.beat), 'fa-fade', props.fade), 'fa-beat-fade', props.beatFade), 'fa-flash', props.flash), _defineProperty(_defineProperty(_classes, 'fa-spin-pulse', props.spinPulse), 'fa-spin-reverse', props.spinReverse));
366
- return Object.keys(classes).map(function (key) {
367
- return classes[key] ? key : null;
368
- }).filter(function (key) {
369
- return key;
370
- });
371
- }
372
-
373
428
  function normalizeIconArgs(icon) {
374
429
  if (icon && _typeof(icon) === 'object' && icon.prefix && icon.iconName && icon.icon) {
375
430
  return icon;
@@ -403,6 +458,7 @@
403
458
  type: Boolean,
404
459
  default: false
405
460
  },
461
+ // the fixedWidth property has been deprecated as of version 7
406
462
  fixedWidth: {
407
463
  type: Boolean,
408
464
  default: false
@@ -448,6 +504,11 @@
448
504
  return [90, 180, 270].indexOf(Number.parseInt(value, 10)) > -1;
449
505
  }
450
506
  },
507
+ // the rotateBy property is only supported in version 7.0.0 and later
508
+ rotateBy: {
509
+ type: Boolean,
510
+ default: false
511
+ },
451
512
  swapOpacity: {
452
513
  type: Boolean,
453
514
  default: false
@@ -514,6 +575,11 @@
514
575
  spinReverse: {
515
576
  type: Boolean,
516
577
  default: false
578
+ },
579
+ // the widthAuto property is only supported in version 7.0.0 and later
580
+ widthAuto: {
581
+ type: Boolean,
582
+ default: false
517
583
  }
518
584
  },
519
585
  setup: function setup(props, _ref) {
@@ -531,12 +597,16 @@
531
597
  return objectWithKey('mask', normalizeIconArgs(props.mask));
532
598
  });
533
599
  var renderedIcon = vue.computed(function () {
534
- return fontawesomeSvgCore.icon(icon.value, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, classes.value), transform.value), mask.value), {}, {
600
+ var iconProps = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, classes.value), transform.value), mask.value), {}, {
535
601
  symbol: props.symbol,
536
- title: props.title,
537
- titleId: props.titleId,
538
602
  maskId: props.maskId
539
- }));
603
+ });
604
+ if (versionCheckLt(SVG_CORE_VERSION, ICON_PACKS_STARTING_VERSION)) {
605
+ // the title attribute will only apply to versions prior to version 7.0.0
606
+ iconProps.title = props.title;
607
+ iconProps.titleId = props.titleId;
608
+ }
609
+ return fontawesomeSvgCore.icon(icon.value, iconProps);
540
610
  });
541
611
  vue.watch(renderedIcon, function (value) {
542
612
  if (!value) {
@@ -566,7 +636,7 @@
566
636
  var slots = _ref.slots;
567
637
  var familyPrefix = fontawesomeSvgCore.config.familyPrefix;
568
638
  var className = vue.computed(function () {
569
- return ["".concat(familyPrefix, "-layers")].concat(_toConsumableArray(props.fixedWidth ? ["".concat(familyPrefix, "-fw")] : []));
639
+ return ["".concat(familyPrefix, "-layers")].concat(_toConsumableArray(versionCheckLt(SVG_CORE_VERSION, ICON_PACKS_STARTING_VERSION) && props.fixedWidth ? ["".concat(familyPrefix, "-fw")] : []));
570
640
  });
571
641
  return function () {
572
642
  return vue.h('div', {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fortawesome/vue-fontawesome",
3
- "description": "Official Vue component for Font Awesome 6",
4
- "version": "3.0.8",
3
+ "description": "Official Vue component for Font Awesome 7",
4
+ "version": "3.1.0",
5
5
  "main": "index.js",
6
6
  "files": [
7
7
  "README.md",
@@ -65,7 +65,7 @@
65
65
  ]
66
66
  },
67
67
  "peerDependencies": {
68
- "@fortawesome/fontawesome-svg-core": "~1 || ~6",
68
+ "@fortawesome/fontawesome-svg-core": "~1 || ~6 || ~7",
69
69
  "vue": ">= 3.0.0 < 4"
70
70
  },
71
71
  "devDependencies": {
@@ -76,12 +76,13 @@
76
76
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
77
77
  "@babel/plugin-syntax-import-meta": "^7.10.4",
78
78
  "@babel/preset-env": "^7.18.2",
79
- "@fortawesome/fontawesome-svg-core": "~6",
80
- "@fortawesome/free-solid-svg-icons": "^6",
79
+ "@fortawesome/fontawesome-svg-core": "^7.0.0",
80
+ "@fortawesome/free-brands-svg-icons": "^7.0.0",
81
+ "@fortawesome/free-solid-svg-icons": "^7.0.0",
81
82
  "@rollup/plugin-babel": "^5.3.1",
82
83
  "@rollup/plugin-commonjs": "^22.0.0",
83
84
  "@rollup/plugin-node-resolve": "^13.3.0",
84
- "@vue/test-utils": "^2.0.0-beta.2",
85
+ "@vue/test-utils": "^2.4.6",
85
86
  "babel-core": "^7.0.0-bridge.0",
86
87
  "babel-jest": "^28.1.1",
87
88
  "concurrently": "^7.2.1",
@@ -96,11 +97,12 @@
96
97
  "npm": "^10.2.2",
97
98
  "prettier": "^3.0.3",
98
99
  "rollup": "^2.75.6",
99
- "vue": "^3"
100
+ "vue": "^3.0.0"
100
101
  },
101
102
  "husky": {
102
103
  "hooks": {
103
104
  "pre-commit": "lint-staged"
104
105
  }
105
- }
106
+ },
107
+ "dependencies": {}
106
108
  }
@@ -1,8 +1,10 @@
1
- import { parse as faParse, icon as faIcon } from '@fortawesome/fontawesome-svg-core'
2
- import { defineComponent, computed, watch } from 'vue'
1
+ import { classList, objectWithKey } from '../utils'
2
+ import { computed, defineComponent, watch } from 'vue'
3
+ import { ICON_PACKS_STARTING_VERSION, SVG_CORE_VERSION, versionCheckLt } from '../utils'
4
+ import { icon as faIcon, parse as faParse } from '@fortawesome/fontawesome-svg-core'
5
+
3
6
  import convert from '../converter'
4
7
  import log from '../logger'
5
- import { objectWithKey, classList } from '../utils'
6
8
 
7
9
  function normalizeIconArgs(icon) {
8
10
  if (icon && typeof icon === 'object' && icon.prefix && icon.iconName && icon.icon) {
@@ -38,6 +40,7 @@ export default defineComponent({
38
40
  type: Boolean,
39
41
  default: false
40
42
  },
43
+ // the fixedWidth property has been deprecated as of version 7
41
44
  fixedWidth: {
42
45
  type: Boolean,
43
46
  default: false
@@ -77,6 +80,11 @@ export default defineComponent({
77
80
  default: null,
78
81
  validator: (value) => [90, 180, 270].indexOf(Number.parseInt(value, 10)) > -1
79
82
  },
83
+ // the rotateBy property is only supported in version 7.0.0 and later
84
+ rotateBy: {
85
+ type: Boolean,
86
+ default: false
87
+ },
80
88
  swapOpacity: {
81
89
  type: Boolean,
82
90
  default: false
@@ -141,6 +149,11 @@ export default defineComponent({
141
149
  spinReverse: {
142
150
  type: Boolean,
143
151
  default: false
152
+ },
153
+ // the widthAuto property is only supported in version 7.0.0 and later
154
+ widthAuto: {
155
+ type: Boolean,
156
+ default: false
144
157
  }
145
158
  },
146
159
 
@@ -150,17 +163,23 @@ export default defineComponent({
150
163
  const transform = computed(() => objectWithKey('transform', typeof props.transform === 'string' ? faParse.transform(props.transform) : props.transform))
151
164
  const mask = computed(() => objectWithKey('mask', normalizeIconArgs(props.mask)))
152
165
 
153
- const renderedIcon = computed(() =>
154
- faIcon(icon.value, {
166
+ const renderedIcon = computed(() => {
167
+ const iconProps = {
155
168
  ...classes.value,
156
169
  ...transform.value,
157
170
  ...mask.value,
158
171
  symbol: props.symbol,
159
- title: props.title,
160
- titleId: props.titleId,
161
172
  maskId: props.maskId
162
- })
163
- )
173
+ }
174
+
175
+ if (versionCheckLt(SVG_CORE_VERSION, ICON_PACKS_STARTING_VERSION)) {
176
+ // the title attribute will only apply to versions prior to version 7.0.0
177
+ iconProps.title = props.title
178
+ iconProps.titleId = props.titleId
179
+ }
180
+
181
+ return faIcon(icon.value, iconProps)
182
+ })
164
183
 
165
184
  watch(
166
185
  renderedIcon,
@@ -1,5 +1,6 @@
1
+ import { computed, defineComponent, h } from 'vue'
1
2
  import { config } from '@fortawesome/fontawesome-svg-core'
2
- import { defineComponent, h, computed } from 'vue'
3
+ import { ICON_PACKS_STARTING_VERSION, SVG_CORE_VERSION, versionCheckLt } from '../utils'
3
4
 
4
5
  export default defineComponent({
5
6
  name: 'FontAwesomeLayers',
@@ -11,12 +12,12 @@ export default defineComponent({
11
12
  }
12
13
  },
13
14
 
14
- setup (props, { slots }) {
15
+ setup(props, { slots }) {
15
16
  const { familyPrefix } = config
16
17
 
17
18
  const className = computed(() => [
18
19
  `${familyPrefix}-layers`,
19
- ...(props.fixedWidth ? [`${familyPrefix}-fw`] : [])
20
+ ...(versionCheckLt(SVG_CORE_VERSION, ICON_PACKS_STARTING_VERSION) && props.fixedWidth ? [`${familyPrefix}-fw`] : [])
20
21
  ])
21
22
 
22
23
  return () => h('div', { class: className.value }, slots.default ? slots.default() : [])
@@ -23,18 +23,19 @@ export default defineComponent({
23
23
  type: String,
24
24
  default: null,
25
25
  validator: (value) => ['bottom-left', 'bottom-right', 'top-left', 'top-right'].indexOf(value) > -1
26
- },
26
+ }
27
27
  },
28
28
 
29
- setup (props, { attrs }) {
29
+ setup(props, { attrs }) {
30
30
  const { familyPrefix } = config
31
31
 
32
- const classes = computed(() => objectWithKey('classes', [
33
- ...(props.counter ? [`${familyPrefix}-layers-counter`] : []),
34
- ...(props.position ? [`${familyPrefix}-layers-${props.position}`] : [])
35
- ]))
36
- const transform = computed(() => objectWithKey('transform',
37
- typeof props.transform === 'string' ? parse.transform(props.transform) : props.transform))
32
+ const classes = computed(() =>
33
+ objectWithKey('classes', [
34
+ ...(props.counter ? [`${familyPrefix}-layers-counter`] : []),
35
+ ...(props.position ? [`${familyPrefix}-layers-${props.position}`] : [])
36
+ ])
37
+ )
38
+ const transform = computed(() => objectWithKey('transform', typeof props.transform === 'string' ? parse.transform(props.transform) : props.transform))
38
39
  const abstractElement = computed(() => {
39
40
  const { abstract } = text(props.value.toString(), { ...transform.value, ...classes.value })
40
41
  if (props.counter) {
package/src/utils.js CHANGED
@@ -1,11 +1,18 @@
1
- export function objectWithKey (key, value) {
2
- return ((Array.isArray(value) && value.length > 0) || (!Array.isArray(value) && value)) ? {[key]: value} : {}
1
+ export const ICON_PACKS_STARTING_VERSION = '7.0.0'
2
+
3
+ const svgCorePackageJson = require('@fortawesome/fontawesome-svg-core/package.json')
4
+
5
+ export const SVG_CORE_VERSION = svgCorePackageJson.version
6
+
7
+ export function objectWithKey(key, value) {
8
+ return (Array.isArray(value) && value.length > 0) || (!Array.isArray(value) && value) ? { [key]: value } : {}
3
9
  }
4
10
 
5
- export function classList (props) {
11
+ export function classList(props) {
6
12
  let classes = {
7
13
  'fa-spin': props.spin,
8
14
  'fa-pulse': props.pulse,
15
+ // the fixedWidth property has been deprecated as of version 7.0.0
9
16
  'fa-fw': props.fixedWidth,
10
17
  'fa-border': props.border,
11
18
  'fa-li': props.listItem,
@@ -15,6 +22,7 @@ export function classList (props) {
15
22
  'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both',
16
23
  [`fa-${props.size}`]: props.size !== null,
17
24
  [`fa-rotate-${props.rotation}`]: props.rotation !== null,
25
+ 'fa-rotate-by': props.rotateBy,
18
26
  [`fa-pull-${props.pull}`]: props.pull !== null,
19
27
  'fa-swap-opacity': props.swapOpacity,
20
28
  'fa-bounce': props.bounce,
@@ -24,12 +32,14 @@ export function classList (props) {
24
32
  'fa-beat-fade': props.beatFade,
25
33
  'fa-flash': props.flash,
26
34
  'fa-spin-pulse': props.spinPulse,
27
- 'fa-spin-reverse': props.spinReverse
35
+ 'fa-spin-reverse': props.spinReverse,
36
+ // the widthAuto property is only supported in version 7.0.0 and later
37
+ 'fa-width-auto': props.widthAuto
28
38
  }
29
39
 
30
40
  return Object.keys(classes)
31
- .map(key => classes[key] ? key : null)
32
- .filter(key => key)
41
+ .map((key) => (classes[key] ? key : null))
42
+ .filter((key) => key)
33
43
  }
34
44
 
35
45
  export function addStaticClass(to, what) {
@@ -37,3 +47,73 @@ export function addStaticClass(to, what) {
37
47
 
38
48
  return val.concat(what).join(' ')
39
49
  }
50
+
51
+ // check if verion1 is less than version2
52
+ export function versionCheckLt(version1, version2) {
53
+ const [v1Base, v1PreRelease] = version1.split('-')
54
+ const [v2Base, v2PreRelease] = version2.split('-')
55
+
56
+ const v1Parts = v1Base.split('.').map(Number)
57
+ const v2Parts = v2Base.split('.').map(Number)
58
+
59
+ // Compare version numbers first
60
+ for (let i = 0; i < Math.max(v1Parts.length, v2Parts.length); i++) {
61
+ const v1Part = v1Parts[i] || 0
62
+ const v2Part = v2Parts[i] || 0
63
+
64
+ if (v1Part < v2Part) return true
65
+ if (v1Part > v2Part) return false
66
+ }
67
+
68
+ // If version numbers are equal, compare pre-release identifiers
69
+ // A version with a pre-release identifier is less than one without
70
+ if (v1PreRelease && !v2PreRelease) return true
71
+ if (!v1PreRelease && v2PreRelease) return false
72
+
73
+ return false
74
+ }
75
+
76
+ // check if verion1 is greater than or equal to version2
77
+ export function versionCheckGte(version1, version2) {
78
+ const [v1Base, v1PreRelease] = version1.split('-')
79
+ const [v2Base, v2PreRelease] = version2.split('-')
80
+
81
+ const v1Parts = v1Base.split('.')
82
+ const v2Parts = v2Base.split('.')
83
+
84
+ // Compare version numbers first
85
+ for (let i = 0; i < Math.max(v1Parts.length, v2Parts.length); i++) {
86
+ const v1Part = v1Parts[i] || '0'
87
+ const v2Part = v2Parts[i] || '0'
88
+
89
+ // Compare numeric values
90
+ const v1Num = parseInt(v1Part, 10)
91
+ const v2Num = parseInt(v2Part, 10)
92
+
93
+ if (v1Num !== v2Num) {
94
+ return v1Num > v2Num
95
+ }
96
+ }
97
+
98
+ // If numeric values are equal, look for any remaining parts
99
+ // that would make one version greater than the other
100
+ for (let i = 0; i < Math.max(v1Parts.length, v2Parts.length); i++) {
101
+ const v1Part = v1Parts[i] || '0'
102
+ const v2Part = v2Parts[i] || '0'
103
+
104
+ if (v1Part !== v2Part) {
105
+ // When numeric values are equal but strings differ,
106
+ // the one without leading zeros is greater
107
+ if (v1Part.length !== v2Part.length) {
108
+ return v1Part.length < v2Part.length
109
+ }
110
+ }
111
+ }
112
+
113
+ // If version numbers are equal, compare pre-release identifiers
114
+ // A version with a pre-release identifier is less than one without
115
+ if (v1PreRelease && !v2PreRelease) return false
116
+ if (!v1PreRelease && v2PreRelease) return true
117
+
118
+ return true
119
+ }