diff --git a/CHANGELOG.md b/CHANGELOG.md index e61d0b9f..6b5401a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,21 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p --- +## [3.0.3](https://github.com/FortAwesome/vue-fontawesome/releases/tag/3.0.3) - 2023-01-24 + +### Changed + +- NPM download `@fortawesome/vue-fontawesome-latest` is now set to Vue 3; to download the Vue 2 package you will have to use `@fortawesome/vue-fontawesome-latest-2`, which is described in our [Vue setup docs](https://fontawesome.com/docs/web/use-with/vue/#_3-add-the-vue-component) +- CI workflow updated for testing +- README.md and package.json updated for new contributor + +### Added + +- Missing TypeScript animations added (github issue #[428](https://github.com/FortAwesome/vue-fontawesome/issues/428)) +- Missing TypeScript sizes added (github issue #[415](https://github.com/FortAwesome/vue-fontawesome/issues/415)) + +--- + ## [3.0.2](https://github.com/FortAwesome/vue-fontawesome/releases/tag/3.0.2) - 2022-11-07 ### Changed diff --git a/README.md b/README.md index 67b3c555..b525fef5 100644 --- a/README.md +++ b/README.md @@ -34,12 +34,12 @@ To find the Vue setup, go to our [Web docs](https://fontawesome.com/docs/web) an Review the following docs before diving in: -* [CONTRIBUTING.md](CONTRIBUTING.md) -* [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) +- [CONTRIBUTING.md](CONTRIBUTING.md) +- [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) And then: -* Check the existing [issues](https://github.com/FortAwesome/vue-fontawesome/issues) and see if you can help! +- Check the existing [issues](https://github.com/FortAwesome/vue-fontawesome/issues) and see if you can help! ## Contributors diff --git a/index.es.js b/index.es.js index f94b9442..30fa3825 100644 --- a/index.es.js +++ b/index.es.js @@ -3,14 +3,17 @@ import { h, defineComponent, computed, watch } from 'vue'; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } + return keys; } + function _objectSpread2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; @@ -20,8 +23,10 @@ function _objectSpread2(target) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } + return target; } + function _typeof(obj) { "@babel/helpers - typeof"; @@ -31,6 +36,7 @@ function _typeof(obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { @@ -42,26 +48,35 @@ function _defineProperty(obj, key, value) { } else { obj[key] = value; } + return obj; } + function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; + for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } + return target; } + function _objectWithoutProperties(source, excluded) { if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; @@ -69,17 +84,22 @@ function _objectWithoutProperties(source, excluded) { target[key] = source[key]; } } + return target; } + function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); @@ -88,11 +108,15 @@ function _unsupportedIterableToArray(o, minLen) { if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; } + function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } @@ -236,12 +260,12 @@ var humps$1 = {exports: {}}; var humps = humps$1.exports; var _excluded = ["class", "style"]; - /** * Converts a CSS style into a plain Javascript object. * @param {String} style The style to converts into a plain Javascript object. * @returns {Object} */ + function styleToObject(style) { return style.split(';').map(function (s) { return s.trim(); @@ -255,19 +279,19 @@ function styleToObject(style) { return output; }, {}); } - /** * Converts a CSS class list into a plain Javascript object. * @param {Array} classes The class list to convert. * @returns {Object} */ + + function classToObject(classes) { return classes.split(/\s+/).reduce(function (output, className) { output[className] = true; return output; }, {}); } - /** * Converts a FontAwesome abstract element of an icon into a Vue VNode. * @param {AbstractElement | String} abstractElement The element to convert. @@ -275,44 +299,50 @@ function classToObject(classes) { * @param {Object} attrs The user-defined native HTML attributes. * @returns {VNode} */ + + function convert(abstractElement) { var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + // If the abstract element is a string, we'll just return a string render function if (typeof abstractElement === 'string') { return abstractElement; - } + } // Converting abstract element children into Vue VNodes + - // Converting abstract element children into Vue VNodes var children = (abstractElement.children || []).map(function (child) { return convert(child); - }); + }); // Converting abstract element attributes into valid Vue format - // Converting abstract element attributes into valid Vue format var mixins = Object.keys(abstractElement.attributes || {}).reduce(function (mixins, key) { var value = abstractElement.attributes[key]; + switch (key) { case 'class': mixins.class = classToObject(value); break; + case 'style': mixins.style = styleToObject(value); break; + default: mixins.attrs[key] = value; } + return mixins; }, { attrs: {}, class: {}, style: {} - }); + }); // Now, we'll return the VNode - // Now, we'll return the VNode attrs.class; - var _attrs$style = attrs.style, - aStyle = _attrs$style === void 0 ? {} : _attrs$style, - otherAttrs = _objectWithoutProperties(attrs, _excluded); + var _attrs$style = attrs.style, + aStyle = _attrs$style === void 0 ? {} : _attrs$style, + otherAttrs = _objectWithoutProperties(attrs, _excluded); + return h(abstractElement.tag, _objectSpread2(_objectSpread2(_objectSpread2({}, props), {}, { class: mixins.class, style: _objectSpread2(_objectSpread2({}, mixins.style), aStyle) @@ -320,12 +350,15 @@ function convert(abstractElement) { } var PRODUCTION = false; + try { PRODUCTION = process.env.NODE_ENV === 'production'; } catch (e) {} + function log () { if (!PRODUCTION && console && typeof console.error === 'function') { var _console; + (_console = console).error.apply(_console, arguments); } } @@ -335,6 +368,7 @@ function objectWithKey(key, value) { } function classList(props) { var _classes; + var classes = (_classes = { 'fa-spin': props.spin, 'fa-pulse': props.pulse, @@ -357,21 +391,26 @@ function normalizeIconArgs(icon) { if (icon && _typeof(icon) === 'object' && icon.prefix && icon.iconName && icon.icon) { return icon; } + if (parse.icon) { return parse.icon(icon); } + if (icon === null) { return null; } + if (_typeof(icon) === 'object' && icon.prefix && icon.iconName) { return icon; } + if (Array.isArray(icon) && icon.length === 2) { return { prefix: icon[0], iconName: icon[1] }; } + if (typeof icon === 'string') { return { prefix: 'fas', @@ -379,6 +418,7 @@ function normalizeIconArgs(icon) { }; } } + var FontAwesomeIcon = defineComponent({ name: 'FontAwesomeIcon', props: { @@ -583,10 +623,12 @@ var FontAwesomeLayersText = defineComponent({ }); var abstractElement = computed(function () { var _text = text(props.value.toString(), _objectSpread2(_objectSpread2({}, transform.value), classes.value)), - abstract = _text.abstract; + abstract = _text.abstract; + if (props.counter) { abstract[0].attributes.class = abstract[0].attributes.class.replace('fa-layers-text', ''); } + return abstract[0]; }); var vnode = computed(function () { diff --git a/index.js b/index.js index 0d70b6c6..34356587 100644 --- a/index.js +++ b/index.js @@ -6,14 +6,17 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } + return keys; } + function _objectSpread2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; @@ -23,8 +26,10 @@ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } + return target; } + function _typeof(obj) { "@babel/helpers - typeof"; @@ -34,6 +39,7 @@ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { @@ -45,26 +51,35 @@ } else { obj[key] = value; } + return obj; } + function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; + for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } + return target; } + function _objectWithoutProperties(source, excluded) { if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; @@ -72,17 +87,22 @@ target[key] = source[key]; } } + return target; } + function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); @@ -91,11 +111,15 @@ if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; } + function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } @@ -239,12 +263,12 @@ var humps = humps$1.exports; var _excluded = ["class", "style"]; - /** * Converts a CSS style into a plain Javascript object. * @param {String} style The style to converts into a plain Javascript object. * @returns {Object} */ + function styleToObject(style) { return style.split(';').map(function (s) { return s.trim(); @@ -258,19 +282,19 @@ return output; }, {}); } - /** * Converts a CSS class list into a plain Javascript object. * @param {Array} classes The class list to convert. * @returns {Object} */ + + function classToObject(classes) { return classes.split(/\s+/).reduce(function (output, className) { output[className] = true; return output; }, {}); } - /** * Converts a FontAwesome abstract element of an icon into a Vue VNode. * @param {AbstractElement | String} abstractElement The element to convert. @@ -278,44 +302,50 @@ * @param {Object} attrs The user-defined native HTML attributes. * @returns {VNode} */ + + function convert(abstractElement) { var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + // If the abstract element is a string, we'll just return a string render function if (typeof abstractElement === 'string') { return abstractElement; - } + } // Converting abstract element children into Vue VNodes + - // Converting abstract element children into Vue VNodes var children = (abstractElement.children || []).map(function (child) { return convert(child); - }); + }); // Converting abstract element attributes into valid Vue format - // Converting abstract element attributes into valid Vue format var mixins = Object.keys(abstractElement.attributes || {}).reduce(function (mixins, key) { var value = abstractElement.attributes[key]; + switch (key) { case 'class': mixins.class = classToObject(value); break; + case 'style': mixins.style = styleToObject(value); break; + default: mixins.attrs[key] = value; } + return mixins; }, { attrs: {}, class: {}, style: {} - }); + }); // Now, we'll return the VNode - // Now, we'll return the VNode attrs.class; - var _attrs$style = attrs.style, - aStyle = _attrs$style === void 0 ? {} : _attrs$style, - otherAttrs = _objectWithoutProperties(attrs, _excluded); + var _attrs$style = attrs.style, + aStyle = _attrs$style === void 0 ? {} : _attrs$style, + otherAttrs = _objectWithoutProperties(attrs, _excluded); + return vue.h(abstractElement.tag, _objectSpread2(_objectSpread2(_objectSpread2({}, props), {}, { class: mixins.class, style: _objectSpread2(_objectSpread2({}, mixins.style), aStyle) @@ -323,12 +353,15 @@ } var PRODUCTION = false; + try { PRODUCTION = process.env.NODE_ENV === 'production'; } catch (e) {} + function log () { if (!PRODUCTION && console && typeof console.error === 'function') { var _console; + (_console = console).error.apply(_console, arguments); } } @@ -338,6 +371,7 @@ } function classList(props) { var _classes; + var classes = (_classes = { 'fa-spin': props.spin, 'fa-pulse': props.pulse, @@ -360,21 +394,26 @@ if (icon && _typeof(icon) === 'object' && icon.prefix && icon.iconName && icon.icon) { return icon; } + if (fontawesomeSvgCore.parse.icon) { return fontawesomeSvgCore.parse.icon(icon); } + if (icon === null) { return null; } + if (_typeof(icon) === 'object' && icon.prefix && icon.iconName) { return icon; } + if (Array.isArray(icon) && icon.length === 2) { return { prefix: icon[0], iconName: icon[1] }; } + if (typeof icon === 'string') { return { prefix: 'fas', @@ -382,6 +421,7 @@ }; } } + var FontAwesomeIcon = vue.defineComponent({ name: 'FontAwesomeIcon', props: { @@ -586,10 +626,12 @@ }); var abstractElement = vue.computed(function () { var _text = fontawesomeSvgCore.text(props.value.toString(), _objectSpread2(_objectSpread2({}, transform.value), classes.value)), - abstract = _text.abstract; + abstract = _text.abstract; + if (props.counter) { abstract[0].attributes.class = abstract[0].attributes.class.replace('fa-layers-text', ''); } + return abstract[0]; }); var vnode = vue.computed(function () { diff --git a/package.json b/package.json index c3028b5c..ab047cca 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@fortawesome/vue-fontawesome", "description": "Official Vue component for Font Awesome 6", - "version": "3.0.2", + "version": "3.0.3", "main": "index.js", "files": [ "README.md", @@ -37,7 +37,8 @@ "Tyranteon ", "Vinicius Rangel ", "Okke Tijhuis ", - "Aaron Parker " + "Aaron Parker ", + "Brandon Mork " ], "license": "MIT", "scripts": {