@fortawesome/vue-fontawesome
Advanced tools
Comparing version 2.0.6 to 2.0.7
@@ -13,2 +13,10 @@ # Change Log | ||
## [2.0.7](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.7) - 20222-06-07 | ||
### Fixed | ||
* Animations for bounce, shake, beat and beat-fade | ||
* Flip animation when used by itself | ||
--- | ||
## [2.0.6](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.6) - 2021-10-18 | ||
@@ -15,0 +23,0 @@ |
513
index.es.js
import { parse, icon, config, text } from '@fortawesome/fontawesome-svg-core'; | ||
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
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; | ||
} | ||
var humps = createCommonjsModule(function (module) { | ||
(function(global) { | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
var _processKeys = function(convert, obj, options) { | ||
if(!_isObject(obj) || _isDate(obj) || _isRegExp(obj) || _isBoolean(obj) || _isFunction(obj)) { | ||
return obj; | ||
} | ||
return target; | ||
} | ||
var output, | ||
i = 0, | ||
l = 0; | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
if(_isArray(obj)) { | ||
output = []; | ||
for(l=obj.length; i<l; i++) { | ||
output.push(_processKeys(convert, obj[i], options)); | ||
} | ||
} | ||
else { | ||
output = {}; | ||
for(var key in obj) { | ||
if(Object.prototype.hasOwnProperty.call(obj, key)) { | ||
output[convert(key, options)] = _processKeys(convert, obj[key], options); | ||
} | ||
} | ||
} | ||
return output; | ||
}; | ||
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}, _typeof(obj); | ||
} | ||
// String conversion methods | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
var separateWords = function(string, options) { | ||
options = options || {}; | ||
var separator = options.separator || '_'; | ||
var split = options.split || /(?=[A-Z])/; | ||
return obj; | ||
} | ||
return string.split(split).join(separator); | ||
}; | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
var camelize = function(string) { | ||
if (_isNumerical(string)) { | ||
return string; | ||
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; | ||
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | ||
target[key] = source[key]; | ||
} | ||
string = string.replace(/[\-_\s]+(.)?/g, function(match, chr) { | ||
return chr ? chr.toUpperCase() : ''; | ||
}); | ||
// Ensure 1st char is always lowercase | ||
return string.substr(0, 1).toLowerCase() + string.substr(1); | ||
}; | ||
} | ||
var pascalize = function(string) { | ||
var camelized = camelize(string); | ||
// Ensure 1st char is always uppercase | ||
return camelized.substr(0, 1).toUpperCase() + camelized.substr(1); | ||
}; | ||
return target; | ||
} | ||
var decamelize = function(string, options) { | ||
return separateWords(string, options).toLowerCase(); | ||
}; | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
// Utilities | ||
// Taken from Underscore.js | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
var toString = Object.prototype.toString; | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
var _isFunction = function(obj) { | ||
return typeof(obj) === 'function'; | ||
}; | ||
var _isObject = function(obj) { | ||
return obj === Object(obj); | ||
}; | ||
var _isArray = function(obj) { | ||
return toString.call(obj) == '[object Array]'; | ||
}; | ||
var _isDate = function(obj) { | ||
return toString.call(obj) == '[object Date]'; | ||
}; | ||
var _isRegExp = function(obj) { | ||
return toString.call(obj) == '[object RegExp]'; | ||
}; | ||
var _isBoolean = function(obj) { | ||
return toString.call(obj) == '[object Boolean]'; | ||
}; | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
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); | ||
} | ||
// Performant way to determine if obj coerces to a number | ||
var _isNumerical = function(obj) { | ||
obj = obj - 0; | ||
return obj === obj; | ||
}; | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
// Sets up function which handles processing keys | ||
// allowing the convert function to be modified by a callback | ||
var _processor = function(convert, options) { | ||
var callback = options && 'process' in options ? options.process : options; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
if(typeof(callback) !== 'function') { | ||
return convert; | ||
} | ||
return arr2; | ||
} | ||
return function(string, options) { | ||
return callback(string, convert, options); | ||
} | ||
}; | ||
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."); | ||
} | ||
var humps = { | ||
camelize: camelize, | ||
decamelize: decamelize, | ||
pascalize: pascalize, | ||
depascalize: decamelize, | ||
camelizeKeys: function(object, options) { | ||
return _processKeys(_processor(camelize, options), object); | ||
}, | ||
decamelizeKeys: function(object, options) { | ||
return _processKeys(_processor(decamelize, options), object, options); | ||
}, | ||
pascalizeKeys: function(object, options) { | ||
return _processKeys(_processor(pascalize, options), object); | ||
}, | ||
depascalizeKeys: function () { | ||
return this.decamelizeKeys.apply(this, arguments); | ||
} | ||
}; | ||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
if (typeof undefined === 'function' && undefined.amd) { | ||
undefined(humps); | ||
} else if ('object' !== 'undefined' && module.exports) { | ||
module.exports = humps; | ||
} else { | ||
global.humps = humps; | ||
} | ||
var humps$1 = {exports: {}}; | ||
})(commonjsGlobal); | ||
}); | ||
(function (module) { | ||
(function(global) { | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
var _processKeys = function(convert, obj, options) { | ||
if(!_isObject(obj) || _isDate(obj) || _isRegExp(obj) || _isBoolean(obj) || _isFunction(obj)) { | ||
return obj; | ||
} | ||
var defineProperty = function (obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
var output, | ||
i = 0, | ||
l = 0; | ||
return obj; | ||
}; | ||
if(_isArray(obj)) { | ||
output = []; | ||
for(l=obj.length; i<l; i++) { | ||
output.push(_processKeys(convert, obj[i], options)); | ||
} | ||
} | ||
else { | ||
output = {}; | ||
for(var key in obj) { | ||
if(Object.prototype.hasOwnProperty.call(obj, key)) { | ||
output[convert(key, options)] = _processKeys(convert, obj[key], options); | ||
} | ||
} | ||
} | ||
return output; | ||
}; | ||
var _extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
// String conversion methods | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
var separateWords = function(string, options) { | ||
options = options || {}; | ||
var separator = options.separator || '_'; | ||
var split = options.split || /(?=[A-Z])/; | ||
return target; | ||
}; | ||
return string.split(split).join(separator); | ||
}; | ||
var objectWithoutProperties = function (obj, keys) { | ||
var target = {}; | ||
var camelize = function(string) { | ||
if (_isNumerical(string)) { | ||
return string; | ||
} | ||
string = string.replace(/[\-_\s]+(.)?/g, function(match, chr) { | ||
return chr ? chr.toUpperCase() : ''; | ||
}); | ||
// Ensure 1st char is always lowercase | ||
return string.substr(0, 1).toLowerCase() + string.substr(1); | ||
}; | ||
for (var i in obj) { | ||
if (keys.indexOf(i) >= 0) continue; | ||
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; | ||
target[i] = obj[i]; | ||
} | ||
var pascalize = function(string) { | ||
var camelized = camelize(string); | ||
// Ensure 1st char is always uppercase | ||
return camelized.substr(0, 1).toUpperCase() + camelized.substr(1); | ||
}; | ||
return target; | ||
}; | ||
var decamelize = function(string, options) { | ||
return separateWords(string, options).toLowerCase(); | ||
}; | ||
var toConsumableArray = function (arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
// Utilities | ||
// Taken from Underscore.js | ||
return arr2; | ||
} else { | ||
return Array.from(arr); | ||
} | ||
}; | ||
var toString = Object.prototype.toString; | ||
var _isFunction = function(obj) { | ||
return typeof(obj) === 'function'; | ||
}; | ||
var _isObject = function(obj) { | ||
return obj === Object(obj); | ||
}; | ||
var _isArray = function(obj) { | ||
return toString.call(obj) == '[object Array]'; | ||
}; | ||
var _isDate = function(obj) { | ||
return toString.call(obj) == '[object Date]'; | ||
}; | ||
var _isRegExp = function(obj) { | ||
return toString.call(obj) == '[object RegExp]'; | ||
}; | ||
var _isBoolean = function(obj) { | ||
return toString.call(obj) == '[object Boolean]'; | ||
}; | ||
// Performant way to determine if obj coerces to a number | ||
var _isNumerical = function(obj) { | ||
obj = obj - 0; | ||
return obj === obj; | ||
}; | ||
// Sets up function which handles processing keys | ||
// allowing the convert function to be modified by a callback | ||
var _processor = function(convert, options) { | ||
var callback = options && 'process' in options ? options.process : options; | ||
if(typeof(callback) !== 'function') { | ||
return convert; | ||
} | ||
return function(string, options) { | ||
return callback(string, convert, options); | ||
} | ||
}; | ||
var humps = { | ||
camelize: camelize, | ||
decamelize: decamelize, | ||
pascalize: pascalize, | ||
depascalize: decamelize, | ||
camelizeKeys: function(object, options) { | ||
return _processKeys(_processor(camelize, options), object); | ||
}, | ||
decamelizeKeys: function(object, options) { | ||
return _processKeys(_processor(decamelize, options), object, options); | ||
}, | ||
pascalizeKeys: function(object, options) { | ||
return _processKeys(_processor(pascalize, options), object); | ||
}, | ||
depascalizeKeys: function () { | ||
return this.decamelizeKeys.apply(this, arguments); | ||
} | ||
}; | ||
if (module.exports) { | ||
module.exports = humps; | ||
} else { | ||
global.humps = humps; | ||
} | ||
})(commonjsGlobal); | ||
} (humps$1)); | ||
var humps = humps$1.exports; | ||
var _excluded = ["class", "style", "attrs"]; | ||
function styleToObject(style) { | ||
@@ -209,5 +272,3 @@ return style.split(';').map(function (s) { | ||
var value = pair.slice(i + 1).trim(); | ||
acc[prop] = value; | ||
return acc; | ||
@@ -220,3 +281,2 @@ }, {}); | ||
acc[c] = true; | ||
return acc; | ||
@@ -227,3 +287,3 @@ }, {}); | ||
function combineClassObjects() { | ||
for (var _len = arguments.length, objs = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, objs = new Array(_len), _key = 0; _key < _len; _key++) { | ||
objs[_key] = arguments[_key]; | ||
@@ -246,5 +306,3 @@ } | ||
var data = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
var children = (element.children || []).map(convert.bind(null, h)); | ||
var mixins = Object.keys(element.attributes || {}).reduce(function (acc, key) { | ||
@@ -257,5 +315,7 @@ var val = element.attributes[key]; | ||
break; | ||
case 'style': | ||
acc['style'] = styleToObject(val); | ||
break; | ||
default: | ||
@@ -266,21 +326,24 @@ acc.attrs[key] = val; | ||
return acc; | ||
}, { 'class': {}, style: {}, attrs: {} }); | ||
}, { | ||
'class': {}, | ||
style: {}, | ||
attrs: {} | ||
}); | ||
var _data$class = data.class, | ||
dClass = _data$class === undefined ? {} : _data$class, | ||
dClass = _data$class === void 0 ? {} : _data$class, | ||
_data$style = data.style, | ||
dStyle = _data$style === undefined ? {} : _data$style, | ||
dStyle = _data$style === void 0 ? {} : _data$style, | ||
_data$attrs = data.attrs, | ||
dAttrs = _data$attrs === undefined ? {} : _data$attrs, | ||
remainingData = objectWithoutProperties(data, ['class', 'style', 'attrs']); | ||
dAttrs = _data$attrs === void 0 ? {} : _data$attrs, | ||
remainingData = _objectWithoutProperties(data, _excluded); | ||
if (typeof element === 'string') { | ||
return element; | ||
} else { | ||
return h(element.tag, _extends({ | ||
return h(element.tag, _objectSpread2(_objectSpread2({ | ||
class: combineClassObjects(mixins.class, dClass), | ||
style: _extends({}, mixins.style, dStyle), | ||
attrs: _extends({}, mixins.attrs, dAttrs) | ||
}, remainingData, { | ||
style: _objectSpread2(_objectSpread2({}, mixins.style), dStyle), | ||
attrs: _objectSpread2(_objectSpread2({}, mixins.attrs), dAttrs) | ||
}, remainingData), {}, { | ||
props: props | ||
@@ -306,5 +369,4 @@ }), children); | ||
function objectWithKey(key, value) { | ||
return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? defineProperty({}, key, value) : {}; | ||
return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? _defineProperty({}, key, value) : {}; | ||
} | ||
function classList(props) { | ||
@@ -325,6 +387,6 @@ var _classes; | ||
'fa-inverse': props.inverse, | ||
'fa-flip': props.flip === true, | ||
'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both', | ||
'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both' | ||
}, 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); | ||
}, _defineProperty(_classes, "fa-".concat(props.size), props.size !== null), _defineProperty(_classes, "fa-rotate-".concat(props.rotation), props.rotation !== null), _defineProperty(_classes, "fa-pull-".concat(props.pull), props.pull !== null), _defineProperty(_classes, 'fa-swap-opacity', props.swapOpacity), _defineProperty(_classes, 'fa-bounce', props.bounce), _defineProperty(_classes, 'fa-shake', props.shake), _defineProperty(_classes, 'fa-beat-fade', props.beatFade), _classes); | ||
return Object.keys(classes).map(function (key) { | ||
@@ -336,34 +398,38 @@ return classes[key] ? key : null; | ||
} | ||
function addStaticClass(to, what) { | ||
var val = (to || '').length === 0 ? [] : [to]; | ||
return val.concat(what).join(' '); | ||
} | ||
function normalizeIconArgs(icon$$1) { | ||
function normalizeIconArgs(icon) { | ||
// this has everything that it needs to be rendered which means it was probably imported | ||
// directly from an icon svg package | ||
if (icon$$1 && (typeof icon$$1 === 'undefined' ? 'undefined' : _typeof(icon$$1)) === 'object' && icon$$1.prefix && icon$$1.iconName && icon$$1.icon) { | ||
return icon$$1; | ||
if (icon && _typeof(icon) === 'object' && icon.prefix && icon.iconName && icon.icon) { | ||
return icon; | ||
} | ||
if (parse.icon) { | ||
return parse.icon(icon$$1); | ||
return parse.icon(icon); | ||
} | ||
if (icon$$1 === null) { | ||
if (icon === null) { | ||
return null; | ||
} | ||
if ((typeof icon$$1 === 'undefined' ? 'undefined' : _typeof(icon$$1)) === 'object' && icon$$1.prefix && icon$$1.iconName) { | ||
return icon$$1; | ||
if (_typeof(icon) === 'object' && icon.prefix && icon.iconName) { | ||
return icon; | ||
} | ||
if (Array.isArray(icon$$1) && icon$$1.length === 2) { | ||
return { prefix: icon$$1[0], iconName: icon$$1[1] }; | ||
if (Array.isArray(icon) && icon.length === 2) { | ||
return { | ||
prefix: icon[0], | ||
iconName: icon[1] | ||
}; | ||
} | ||
if (typeof icon$$1 === 'string') { | ||
return { prefix: 'fas', iconName: icon$$1 }; | ||
if (typeof icon === 'string') { | ||
return { | ||
prefix: 'fas', | ||
iconName: icon | ||
}; | ||
} | ||
@@ -374,5 +440,3 @@ } | ||
name: 'FontAwesomeIcon', | ||
functional: true, | ||
props: { | ||
@@ -400,6 +464,6 @@ beat: { | ||
flip: { | ||
type: String, | ||
default: null, | ||
type: [Boolean, String], | ||
default: false, | ||
validator: function validator(value) { | ||
return ['horizontal', 'vertical', 'both'].indexOf(value) > -1; | ||
return [true, false, 'horizontal', 'vertical', 'both'].indexOf(value) > -1; | ||
} | ||
@@ -475,5 +539,16 @@ }, | ||
default: false | ||
}, | ||
bounce: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
shake: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
beatFade: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}, | ||
render: function render(createElement, context) { | ||
@@ -485,17 +560,17 @@ var props = context.props; | ||
title = props.title; | ||
var icon$$1 = normalizeIconArgs(iconArgs); | ||
var icon$1 = normalizeIconArgs(iconArgs); | ||
var classes = objectWithKey('classes', classList(props)); | ||
var transform = objectWithKey('transform', typeof props.transform === 'string' ? parse.transform(props.transform) : props.transform); | ||
var mask = objectWithKey('mask', normalizeIconArgs(maskArgs)); | ||
var renderedIcon = icon(icon$$1, _extends({}, classes, transform, mask, { symbol: symbol, title: title })); | ||
var renderedIcon = icon(icon$1, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, classes), transform), mask), {}, { | ||
symbol: symbol, | ||
title: title | ||
})); | ||
if (!renderedIcon) { | ||
return log('Could not find one or more icon(s)', icon$$1, mask); | ||
return log('Could not find one or more icon(s)', icon$1, mask); | ||
} | ||
var abstract = renderedIcon.abstract; | ||
var convertCurry = convert.bind(null, createElement); | ||
return convertCurry(abstract[0], {}, context.data); | ||
@@ -507,5 +582,3 @@ } | ||
name: 'FontAwesomeLayers', | ||
functional: true, | ||
props: { | ||
@@ -517,11 +590,7 @@ fixedWidth: { | ||
}, | ||
render: function render(createElement, context) { | ||
var familyPrefix = config.familyPrefix; | ||
var staticClass = context.data.staticClass; | ||
var classes = [familyPrefix + '-layers'].concat(toConsumableArray(context.props.fixedWidth ? [familyPrefix + '-fw'] : [])); | ||
return createElement('div', _extends({}, context.data, { | ||
var classes = ["".concat(familyPrefix, "-layers")].concat(_toConsumableArray(context.props.fixedWidth ? ["".concat(familyPrefix, "-fw")] : [])); | ||
return createElement('div', _objectSpread2(_objectSpread2({}, context.data), {}, { | ||
staticClass: addStaticClass(staticClass, classes) | ||
@@ -534,5 +603,3 @@ }), context.children); | ||
name: 'FontAwesomeLayersText', | ||
functional: true, | ||
props: { | ||
@@ -559,17 +626,10 @@ value: { | ||
}, | ||
render: function render(createElement, context) { | ||
var familyPrefix = config.familyPrefix; | ||
var props = context.props; | ||
var classes = objectWithKey('classes', [].concat(toConsumableArray(props.counter ? [familyPrefix + '-layers-counter'] : []), toConsumableArray(props.position ? [familyPrefix + '-layers-' + props.position] : []))); | ||
var classes = objectWithKey('classes', [].concat(_toConsumableArray(props.counter ? ["".concat(familyPrefix, "-layers-counter")] : []), _toConsumableArray(props.position ? ["".concat(familyPrefix, "-layers-").concat(props.position)] : []))); | ||
var transform = objectWithKey('transform', typeof props.transform === 'string' ? parse.transform(props.transform) : props.transform); | ||
var renderedText = text(props.value.toString(), _extends({}, transform, classes)); | ||
var renderedText = text(props.value.toString(), _objectSpread2(_objectSpread2({}, transform), classes)); | ||
var abstract = renderedText.abstract; | ||
if (props.counter) { | ||
@@ -580,3 +640,2 @@ abstract[0].attributes.class = abstract[0].attributes.class.replace('fa-layers-text', ''); | ||
var convertCurry = convert.bind(null, createElement); | ||
return convertCurry(abstract[0], {}, context.data); | ||
@@ -583,0 +642,0 @@ } |
1045
index.js
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@fortawesome/fontawesome-svg-core')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@fortawesome/fontawesome-svg-core'], factory) : | ||
(factory((global['vue-fontawesome'] = {}),global.FontAwesome)); | ||
}(this, (function (exports,fontawesomeSvgCore) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@fortawesome/fontawesome-svg-core')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@fortawesome/fontawesome-svg-core'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["vue-fontawesome"] = {}, global.FontAwesome)); | ||
})(this, (function (exports, fontawesomeSvgCore) { 'use strict'; | ||
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
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); | ||
} | ||
var humps = createCommonjsModule(function (module) { | ||
(function(global) { | ||
return keys; | ||
} | ||
var _processKeys = function(convert, obj, options) { | ||
if(!_isObject(obj) || _isDate(obj) || _isRegExp(obj) || _isBoolean(obj) || _isFunction(obj)) { | ||
return obj; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
var output, | ||
i = 0, | ||
l = 0; | ||
return target; | ||
} | ||
if(_isArray(obj)) { | ||
output = []; | ||
for(l=obj.length; i<l; i++) { | ||
output.push(_processKeys(convert, obj[i], options)); | ||
} | ||
} | ||
else { | ||
output = {}; | ||
for(var key in obj) { | ||
if(Object.prototype.hasOwnProperty.call(obj, key)) { | ||
output[convert(key, options)] = _processKeys(convert, obj[key], options); | ||
} | ||
} | ||
} | ||
return output; | ||
}; | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
// String conversion methods | ||
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}, _typeof(obj); | ||
} | ||
var separateWords = function(string, options) { | ||
options = options || {}; | ||
var separator = options.separator || '_'; | ||
var split = options.split || /(?=[A-Z])/; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return string.split(split).join(separator); | ||
}; | ||
return obj; | ||
} | ||
var camelize = function(string) { | ||
if (_isNumerical(string)) { | ||
return string; | ||
} | ||
string = string.replace(/[\-_\s]+(.)?/g, function(match, chr) { | ||
return chr ? chr.toUpperCase() : ''; | ||
}); | ||
// Ensure 1st char is always lowercase | ||
return string.substr(0, 1).toLowerCase() + string.substr(1); | ||
}; | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
var pascalize = function(string) { | ||
var camelized = camelize(string); | ||
// Ensure 1st char is always uppercase | ||
return camelized.substr(0, 1).toUpperCase() + camelized.substr(1); | ||
}; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
var decamelize = function(string, options) { | ||
return separateWords(string, options).toLowerCase(); | ||
}; | ||
return target; | ||
} | ||
// Utilities | ||
// Taken from Underscore.js | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var toString = Object.prototype.toString; | ||
var target = _objectWithoutPropertiesLoose(source, excluded); | ||
var _isFunction = function(obj) { | ||
return typeof(obj) === 'function'; | ||
}; | ||
var _isObject = function(obj) { | ||
return obj === Object(obj); | ||
}; | ||
var _isArray = function(obj) { | ||
return toString.call(obj) == '[object Array]'; | ||
}; | ||
var _isDate = function(obj) { | ||
return toString.call(obj) == '[object Date]'; | ||
}; | ||
var _isRegExp = function(obj) { | ||
return toString.call(obj) == '[object RegExp]'; | ||
}; | ||
var _isBoolean = function(obj) { | ||
return toString.call(obj) == '[object Boolean]'; | ||
}; | ||
var key, i; | ||
// Performant way to determine if obj coerces to a number | ||
var _isNumerical = function(obj) { | ||
obj = obj - 0; | ||
return obj === obj; | ||
}; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
// Sets up function which handles processing keys | ||
// allowing the convert function to be modified by a callback | ||
var _processor = function(convert, options) { | ||
var callback = options && 'process' in options ? options.process : options; | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
key = sourceSymbolKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | ||
target[key] = source[key]; | ||
} | ||
} | ||
if(typeof(callback) !== 'function') { | ||
return convert; | ||
} | ||
return target; | ||
} | ||
return function(string, options) { | ||
return callback(string, convert, options); | ||
} | ||
}; | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
var humps = { | ||
camelize: camelize, | ||
decamelize: decamelize, | ||
pascalize: pascalize, | ||
depascalize: decamelize, | ||
camelizeKeys: function(object, options) { | ||
return _processKeys(_processor(camelize, options), object); | ||
}, | ||
decamelizeKeys: function(object, options) { | ||
return _processKeys(_processor(decamelize, options), object, options); | ||
}, | ||
pascalizeKeys: function(object, options) { | ||
return _processKeys(_processor(pascalize, options), object); | ||
}, | ||
depascalizeKeys: function () { | ||
return this.decamelizeKeys.apply(this, arguments); | ||
} | ||
}; | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
if (typeof undefined === 'function' && undefined.amd) { | ||
undefined(humps); | ||
} else if ('object' !== 'undefined' && module.exports) { | ||
module.exports = humps; | ||
} else { | ||
global.humps = humps; | ||
} | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
})(commonjsGlobal); | ||
}); | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
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); | ||
} | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
var defineProperty = function (obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return obj; | ||
}; | ||
return arr2; | ||
} | ||
var _extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
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."); | ||
} | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
return target; | ||
}; | ||
var humps$1 = {exports: {}}; | ||
var objectWithoutProperties = function (obj, keys) { | ||
var target = {}; | ||
(function (module) { | ||
(function(global) { | ||
for (var i in obj) { | ||
if (keys.indexOf(i) >= 0) continue; | ||
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; | ||
target[i] = obj[i]; | ||
} | ||
var _processKeys = function(convert, obj, options) { | ||
if(!_isObject(obj) || _isDate(obj) || _isRegExp(obj) || _isBoolean(obj) || _isFunction(obj)) { | ||
return obj; | ||
} | ||
return target; | ||
}; | ||
var output, | ||
i = 0, | ||
l = 0; | ||
var toConsumableArray = function (arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
if(_isArray(obj)) { | ||
output = []; | ||
for(l=obj.length; i<l; i++) { | ||
output.push(_processKeys(convert, obj[i], options)); | ||
} | ||
} | ||
else { | ||
output = {}; | ||
for(var key in obj) { | ||
if(Object.prototype.hasOwnProperty.call(obj, key)) { | ||
output[convert(key, options)] = _processKeys(convert, obj[key], options); | ||
} | ||
} | ||
} | ||
return output; | ||
}; | ||
return arr2; | ||
} else { | ||
return Array.from(arr); | ||
} | ||
}; | ||
// String conversion methods | ||
function styleToObject(style) { | ||
return style.split(';').map(function (s) { | ||
return s.trim(); | ||
}).filter(function (s) { | ||
return s; | ||
}).reduce(function (acc, pair) { | ||
var i = pair.indexOf(':'); | ||
var prop = humps.camelize(pair.slice(0, i)); | ||
var value = pair.slice(i + 1).trim(); | ||
var separateWords = function(string, options) { | ||
options = options || {}; | ||
var separator = options.separator || '_'; | ||
var split = options.split || /(?=[A-Z])/; | ||
acc[prop] = value; | ||
return string.split(split).join(separator); | ||
}; | ||
return acc; | ||
}, {}); | ||
} | ||
var camelize = function(string) { | ||
if (_isNumerical(string)) { | ||
return string; | ||
} | ||
string = string.replace(/[\-_\s]+(.)?/g, function(match, chr) { | ||
return chr ? chr.toUpperCase() : ''; | ||
}); | ||
// Ensure 1st char is always lowercase | ||
return string.substr(0, 1).toLowerCase() + string.substr(1); | ||
}; | ||
function classToObject(cls) { | ||
return cls.split(/\s+/).reduce(function (acc, c) { | ||
acc[c] = true; | ||
var pascalize = function(string) { | ||
var camelized = camelize(string); | ||
// Ensure 1st char is always uppercase | ||
return camelized.substr(0, 1).toUpperCase() + camelized.substr(1); | ||
}; | ||
return acc; | ||
}, {}); | ||
} | ||
var decamelize = function(string, options) { | ||
return separateWords(string, options).toLowerCase(); | ||
}; | ||
function combineClassObjects() { | ||
for (var _len = arguments.length, objs = Array(_len), _key = 0; _key < _len; _key++) { | ||
objs[_key] = arguments[_key]; | ||
} | ||
// Utilities | ||
// Taken from Underscore.js | ||
return objs.reduce(function (acc, obj) { | ||
if (Array.isArray(obj)) { | ||
acc = acc.concat(obj); | ||
} else { | ||
acc.push(obj); | ||
} | ||
var toString = Object.prototype.toString; | ||
return acc; | ||
}, []); | ||
} | ||
var _isFunction = function(obj) { | ||
return typeof(obj) === 'function'; | ||
}; | ||
var _isObject = function(obj) { | ||
return obj === Object(obj); | ||
}; | ||
var _isArray = function(obj) { | ||
return toString.call(obj) == '[object Array]'; | ||
}; | ||
var _isDate = function(obj) { | ||
return toString.call(obj) == '[object Date]'; | ||
}; | ||
var _isRegExp = function(obj) { | ||
return toString.call(obj) == '[object RegExp]'; | ||
}; | ||
var _isBoolean = function(obj) { | ||
return toString.call(obj) == '[object Boolean]'; | ||
}; | ||
function convert(h, element) { | ||
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var data = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
// Performant way to determine if obj coerces to a number | ||
var _isNumerical = function(obj) { | ||
obj = obj - 0; | ||
return obj === obj; | ||
}; | ||
var children = (element.children || []).map(convert.bind(null, h)); | ||
// Sets up function which handles processing keys | ||
// allowing the convert function to be modified by a callback | ||
var _processor = function(convert, options) { | ||
var callback = options && 'process' in options ? options.process : options; | ||
var mixins = Object.keys(element.attributes || {}).reduce(function (acc, key) { | ||
var val = element.attributes[key]; | ||
if(typeof(callback) !== 'function') { | ||
return convert; | ||
} | ||
switch (key) { | ||
case 'class': | ||
acc['class'] = classToObject(val); | ||
break; | ||
case 'style': | ||
acc['style'] = styleToObject(val); | ||
break; | ||
default: | ||
acc.attrs[key] = val; | ||
} | ||
return function(string, options) { | ||
return callback(string, convert, options); | ||
} | ||
}; | ||
return acc; | ||
}, { 'class': {}, style: {}, attrs: {} }); | ||
var humps = { | ||
camelize: camelize, | ||
decamelize: decamelize, | ||
pascalize: pascalize, | ||
depascalize: decamelize, | ||
camelizeKeys: function(object, options) { | ||
return _processKeys(_processor(camelize, options), object); | ||
}, | ||
decamelizeKeys: function(object, options) { | ||
return _processKeys(_processor(decamelize, options), object, options); | ||
}, | ||
pascalizeKeys: function(object, options) { | ||
return _processKeys(_processor(pascalize, options), object); | ||
}, | ||
depascalizeKeys: function () { | ||
return this.decamelizeKeys.apply(this, arguments); | ||
} | ||
}; | ||
var _data$class = data.class, | ||
dClass = _data$class === undefined ? {} : _data$class, | ||
_data$style = data.style, | ||
dStyle = _data$style === undefined ? {} : _data$style, | ||
_data$attrs = data.attrs, | ||
dAttrs = _data$attrs === undefined ? {} : _data$attrs, | ||
remainingData = objectWithoutProperties(data, ['class', 'style', 'attrs']); | ||
if (module.exports) { | ||
module.exports = humps; | ||
} else { | ||
global.humps = humps; | ||
} | ||
})(commonjsGlobal); | ||
} (humps$1)); | ||
if (typeof element === 'string') { | ||
return element; | ||
} else { | ||
return h(element.tag, _extends({ | ||
class: combineClassObjects(mixins.class, dClass), | ||
style: _extends({}, mixins.style, dStyle), | ||
attrs: _extends({}, mixins.attrs, dAttrs) | ||
}, remainingData, { | ||
props: props | ||
}), children); | ||
} | ||
} | ||
var humps = humps$1.exports; | ||
var PRODUCTION = false; | ||
var _excluded = ["class", "style", "attrs"]; | ||
try { | ||
PRODUCTION = process.env.NODE_ENV === 'production'; | ||
} catch (e) {} | ||
function styleToObject(style) { | ||
return style.split(';').map(function (s) { | ||
return s.trim(); | ||
}).filter(function (s) { | ||
return s; | ||
}).reduce(function (acc, pair) { | ||
var i = pair.indexOf(':'); | ||
var prop = humps.camelize(pair.slice(0, i)); | ||
var value = pair.slice(i + 1).trim(); | ||
acc[prop] = value; | ||
return acc; | ||
}, {}); | ||
} | ||
function log () { | ||
if (!PRODUCTION && console && typeof console.error === 'function') { | ||
var _console; | ||
function classToObject(cls) { | ||
return cls.split(/\s+/).reduce(function (acc, c) { | ||
acc[c] = true; | ||
return acc; | ||
}, {}); | ||
} | ||
(_console = console).error.apply(_console, arguments); | ||
} | ||
} | ||
function combineClassObjects() { | ||
for (var _len = arguments.length, objs = new Array(_len), _key = 0; _key < _len; _key++) { | ||
objs[_key] = arguments[_key]; | ||
} | ||
function objectWithKey(key, value) { | ||
return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? defineProperty({}, key, value) : {}; | ||
} | ||
return objs.reduce(function (acc, obj) { | ||
if (Array.isArray(obj)) { | ||
acc = acc.concat(obj); | ||
} else { | ||
acc.push(obj); | ||
} | ||
function classList(props) { | ||
var _classes; | ||
return acc; | ||
}, []); | ||
} | ||
var classes = (_classes = { | ||
'fa-spin': props.spin, | ||
'fa-spin-pulse': props.spinPulse, | ||
'fa-spin-reverse': props.spinReverse, | ||
'fa-pulse': props.pulse, | ||
'fa-beat': props.beat, | ||
'fa-fade': props.fade, | ||
'fa-flash': props.flash, | ||
'fa-fw': props.fixedWidth, | ||
'fa-border': props.border, | ||
'fa-li': props.listItem, | ||
'fa-inverse': props.inverse, | ||
'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both', | ||
'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both' | ||
}, 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); | ||
function convert(h, element) { | ||
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var data = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
var children = (element.children || []).map(convert.bind(null, h)); | ||
var mixins = Object.keys(element.attributes || {}).reduce(function (acc, key) { | ||
var val = element.attributes[key]; | ||
return Object.keys(classes).map(function (key) { | ||
return classes[key] ? key : null; | ||
}).filter(function (key) { | ||
return key; | ||
}); | ||
} | ||
switch (key) { | ||
case 'class': | ||
acc['class'] = classToObject(val); | ||
break; | ||
function addStaticClass(to, what) { | ||
var val = (to || '').length === 0 ? [] : [to]; | ||
case 'style': | ||
acc['style'] = styleToObject(val); | ||
break; | ||
return val.concat(what).join(' '); | ||
} | ||
default: | ||
acc.attrs[key] = val; | ||
} | ||
function normalizeIconArgs(icon) { | ||
// this has everything that it needs to be rendered which means it was probably imported | ||
// directly from an icon svg package | ||
if (icon && (typeof icon === 'undefined' ? 'undefined' : _typeof(icon)) === 'object' && icon.prefix && icon.iconName && icon.icon) { | ||
return icon; | ||
} | ||
return acc; | ||
}, { | ||
'class': {}, | ||
style: {}, | ||
attrs: {} | ||
}); | ||
if (fontawesomeSvgCore.parse.icon) { | ||
return fontawesomeSvgCore.parse.icon(icon); | ||
} | ||
var _data$class = data.class, | ||
dClass = _data$class === void 0 ? {} : _data$class, | ||
_data$style = data.style, | ||
dStyle = _data$style === void 0 ? {} : _data$style, | ||
_data$attrs = data.attrs, | ||
dAttrs = _data$attrs === void 0 ? {} : _data$attrs, | ||
remainingData = _objectWithoutProperties(data, _excluded); | ||
if (icon === null) { | ||
return null; | ||
} | ||
if (typeof element === 'string') { | ||
return element; | ||
} else { | ||
return h(element.tag, _objectSpread2(_objectSpread2({ | ||
class: combineClassObjects(mixins.class, dClass), | ||
style: _objectSpread2(_objectSpread2({}, mixins.style), dStyle), | ||
attrs: _objectSpread2(_objectSpread2({}, mixins.attrs), dAttrs) | ||
}, remainingData), {}, { | ||
props: props | ||
}), children); | ||
} | ||
} | ||
if ((typeof icon === 'undefined' ? 'undefined' : _typeof(icon)) === 'object' && icon.prefix && icon.iconName) { | ||
return icon; | ||
} | ||
var PRODUCTION = false; | ||
if (Array.isArray(icon) && icon.length === 2) { | ||
return { prefix: icon[0], iconName: icon[1] }; | ||
} | ||
try { | ||
PRODUCTION = process.env.NODE_ENV === 'production'; | ||
} catch (e) {} | ||
if (typeof icon === 'string') { | ||
return { prefix: 'fas', iconName: icon }; | ||
} | ||
} | ||
function log () { | ||
if (!PRODUCTION && console && typeof console.error === 'function') { | ||
var _console; | ||
var FontAwesomeIcon = { | ||
name: 'FontAwesomeIcon', | ||
(_console = console).error.apply(_console, arguments); | ||
} | ||
} | ||
functional: true, | ||
function objectWithKey(key, value) { | ||
return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? _defineProperty({}, key, value) : {}; | ||
} | ||
function classList(props) { | ||
var _classes; | ||
props: { | ||
beat: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
border: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
fade: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
fixedWidth: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
flash: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
flip: { | ||
type: String, | ||
default: null, | ||
validator: function validator(value) { | ||
return ['horizontal', 'vertical', 'both'].indexOf(value) > -1; | ||
} | ||
}, | ||
icon: { | ||
type: [Object, Array, String], | ||
required: true | ||
}, | ||
mask: { | ||
type: [Object, Array, String], | ||
default: null | ||
}, | ||
listItem: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
pull: { | ||
type: String, | ||
default: null, | ||
validator: function validator(value) { | ||
return ['right', 'left'].indexOf(value) > -1; | ||
} | ||
}, | ||
pulse: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
rotation: { | ||
type: [String, Number], | ||
default: null, | ||
validator: function validator(value) { | ||
return [90, 180, 270].indexOf(parseInt(value, 10)) > -1; | ||
} | ||
}, | ||
swapOpacity: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
size: { | ||
type: String, | ||
default: null, | ||
validator: function validator(value) { | ||
return ['2xs', 'xs', 'sm', 'lg', 'xl', '2xl', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x'].indexOf(value) > -1; | ||
} | ||
}, | ||
spin: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
spinPulse: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
spinReverse: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
transform: { | ||
type: [String, Object], | ||
default: null | ||
}, | ||
symbol: { | ||
type: [Boolean, String], | ||
default: false | ||
}, | ||
title: { | ||
type: String, | ||
default: null | ||
}, | ||
inverse: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}, | ||
var classes = (_classes = { | ||
'fa-spin': props.spin, | ||
'fa-spin-pulse': props.spinPulse, | ||
'fa-spin-reverse': props.spinReverse, | ||
'fa-pulse': props.pulse, | ||
'fa-beat': props.beat, | ||
'fa-fade': props.fade, | ||
'fa-flash': props.flash, | ||
'fa-fw': props.fixedWidth, | ||
'fa-border': props.border, | ||
'fa-li': props.listItem, | ||
'fa-inverse': props.inverse, | ||
'fa-flip': props.flip === true, | ||
'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both', | ||
'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both' | ||
}, _defineProperty(_classes, "fa-".concat(props.size), props.size !== null), _defineProperty(_classes, "fa-rotate-".concat(props.rotation), props.rotation !== null), _defineProperty(_classes, "fa-pull-".concat(props.pull), props.pull !== null), _defineProperty(_classes, 'fa-swap-opacity', props.swapOpacity), _defineProperty(_classes, 'fa-bounce', props.bounce), _defineProperty(_classes, 'fa-shake', props.shake), _defineProperty(_classes, 'fa-beat-fade', props.beatFade), _classes); | ||
return Object.keys(classes).map(function (key) { | ||
return classes[key] ? key : null; | ||
}).filter(function (key) { | ||
return key; | ||
}); | ||
} | ||
function addStaticClass(to, what) { | ||
var val = (to || '').length === 0 ? [] : [to]; | ||
return val.concat(what).join(' '); | ||
} | ||
render: function render(createElement, context) { | ||
var props = context.props; | ||
var iconArgs = props.icon, | ||
maskArgs = props.mask, | ||
symbol = props.symbol, | ||
title = props.title; | ||
function normalizeIconArgs(icon) { | ||
// this has everything that it needs to be rendered which means it was probably imported | ||
// directly from an icon svg package | ||
if (icon && _typeof(icon) === 'object' && icon.prefix && icon.iconName && icon.icon) { | ||
return icon; | ||
} | ||
var icon = normalizeIconArgs(iconArgs); | ||
var classes = objectWithKey('classes', classList(props)); | ||
var transform = objectWithKey('transform', typeof props.transform === 'string' ? fontawesomeSvgCore.parse.transform(props.transform) : props.transform); | ||
var mask = objectWithKey('mask', normalizeIconArgs(maskArgs)); | ||
var renderedIcon = fontawesomeSvgCore.icon(icon, _extends({}, classes, transform, mask, { symbol: symbol, title: title })); | ||
if (fontawesomeSvgCore.parse.icon) { | ||
return fontawesomeSvgCore.parse.icon(icon); | ||
} | ||
if (!renderedIcon) { | ||
return log('Could not find one or more icon(s)', icon, mask); | ||
} | ||
if (icon === null) { | ||
return null; | ||
} | ||
var abstract = renderedIcon.abstract; | ||
if (_typeof(icon) === 'object' && icon.prefix && icon.iconName) { | ||
return icon; | ||
} | ||
var convertCurry = convert.bind(null, createElement); | ||
if (Array.isArray(icon) && icon.length === 2) { | ||
return { | ||
prefix: icon[0], | ||
iconName: icon[1] | ||
}; | ||
} | ||
return convertCurry(abstract[0], {}, context.data); | ||
} | ||
}; | ||
if (typeof icon === 'string') { | ||
return { | ||
prefix: 'fas', | ||
iconName: icon | ||
}; | ||
} | ||
} | ||
var FontAwesomeLayers = { | ||
name: 'FontAwesomeLayers', | ||
var FontAwesomeIcon = { | ||
name: 'FontAwesomeIcon', | ||
functional: true, | ||
props: { | ||
beat: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
border: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
fade: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
fixedWidth: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
flash: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
flip: { | ||
type: [Boolean, String], | ||
default: false, | ||
validator: function validator(value) { | ||
return [true, false, 'horizontal', 'vertical', 'both'].indexOf(value) > -1; | ||
} | ||
}, | ||
icon: { | ||
type: [Object, Array, String], | ||
required: true | ||
}, | ||
mask: { | ||
type: [Object, Array, String], | ||
default: null | ||
}, | ||
listItem: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
pull: { | ||
type: String, | ||
default: null, | ||
validator: function validator(value) { | ||
return ['right', 'left'].indexOf(value) > -1; | ||
} | ||
}, | ||
pulse: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
rotation: { | ||
type: [String, Number], | ||
default: null, | ||
validator: function validator(value) { | ||
return [90, 180, 270].indexOf(parseInt(value, 10)) > -1; | ||
} | ||
}, | ||
swapOpacity: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
size: { | ||
type: String, | ||
default: null, | ||
validator: function validator(value) { | ||
return ['2xs', 'xs', 'sm', 'lg', 'xl', '2xl', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x'].indexOf(value) > -1; | ||
} | ||
}, | ||
spin: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
spinPulse: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
spinReverse: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
transform: { | ||
type: [String, Object], | ||
default: null | ||
}, | ||
symbol: { | ||
type: [Boolean, String], | ||
default: false | ||
}, | ||
title: { | ||
type: String, | ||
default: null | ||
}, | ||
inverse: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
bounce: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
shake: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
beatFade: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}, | ||
render: function render(createElement, context) { | ||
var props = context.props; | ||
var iconArgs = props.icon, | ||
maskArgs = props.mask, | ||
symbol = props.symbol, | ||
title = props.title; | ||
var icon = normalizeIconArgs(iconArgs); | ||
var classes = objectWithKey('classes', classList(props)); | ||
var transform = objectWithKey('transform', typeof props.transform === 'string' ? fontawesomeSvgCore.parse.transform(props.transform) : props.transform); | ||
var mask = objectWithKey('mask', normalizeIconArgs(maskArgs)); | ||
var renderedIcon = fontawesomeSvgCore.icon(icon, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, classes), transform), mask), {}, { | ||
symbol: symbol, | ||
title: title | ||
})); | ||
functional: true, | ||
if (!renderedIcon) { | ||
return log('Could not find one or more icon(s)', icon, mask); | ||
} | ||
props: { | ||
fixedWidth: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}, | ||
var abstract = renderedIcon.abstract; | ||
var convertCurry = convert.bind(null, createElement); | ||
return convertCurry(abstract[0], {}, context.data); | ||
} | ||
}; | ||
render: function render(createElement, context) { | ||
var familyPrefix = fontawesomeSvgCore.config.familyPrefix; | ||
var staticClass = context.data.staticClass; | ||
var FontAwesomeLayers = { | ||
name: 'FontAwesomeLayers', | ||
functional: true, | ||
props: { | ||
fixedWidth: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}, | ||
render: function render(createElement, context) { | ||
var familyPrefix = fontawesomeSvgCore.config.familyPrefix; | ||
var staticClass = context.data.staticClass; | ||
var classes = ["".concat(familyPrefix, "-layers")].concat(_toConsumableArray(context.props.fixedWidth ? ["".concat(familyPrefix, "-fw")] : [])); | ||
return createElement('div', _objectSpread2(_objectSpread2({}, context.data), {}, { | ||
staticClass: addStaticClass(staticClass, classes) | ||
}), context.children); | ||
} | ||
}; | ||
var FontAwesomeLayersText = { | ||
name: 'FontAwesomeLayersText', | ||
functional: true, | ||
props: { | ||
value: { | ||
type: [String, Number], | ||
default: '' | ||
}, | ||
transform: { | ||
type: [String, Object], | ||
default: null | ||
}, | ||
counter: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
position: { | ||
type: String, | ||
default: null, | ||
validator: function validator(value) { | ||
return ['bottom-left', 'bottom-right', 'top-left', 'top-right'].indexOf(value) > -1; | ||
} | ||
} | ||
}, | ||
render: function render(createElement, context) { | ||
var familyPrefix = fontawesomeSvgCore.config.familyPrefix; | ||
var props = context.props; | ||
var classes = objectWithKey('classes', [].concat(_toConsumableArray(props.counter ? ["".concat(familyPrefix, "-layers-counter")] : []), _toConsumableArray(props.position ? ["".concat(familyPrefix, "-layers-").concat(props.position)] : []))); | ||
var transform = objectWithKey('transform', typeof props.transform === 'string' ? fontawesomeSvgCore.parse.transform(props.transform) : props.transform); | ||
var renderedText = fontawesomeSvgCore.text(props.value.toString(), _objectSpread2(_objectSpread2({}, transform), classes)); | ||
var abstract = renderedText.abstract; | ||
var classes = [familyPrefix + '-layers'].concat(toConsumableArray(context.props.fixedWidth ? [familyPrefix + '-fw'] : [])); | ||
if (props.counter) { | ||
abstract[0].attributes.class = abstract[0].attributes.class.replace('fa-layers-text', ''); | ||
} | ||
return createElement('div', _extends({}, context.data, { | ||
staticClass: addStaticClass(staticClass, classes) | ||
}), context.children); | ||
} | ||
}; | ||
var convertCurry = convert.bind(null, createElement); | ||
return convertCurry(abstract[0], {}, context.data); | ||
} | ||
}; | ||
var FontAwesomeLayersText = { | ||
name: 'FontAwesomeLayersText', | ||
exports.FontAwesomeIcon = FontAwesomeIcon; | ||
exports.FontAwesomeLayers = FontAwesomeLayers; | ||
exports.FontAwesomeLayersText = FontAwesomeLayersText; | ||
functional: true, | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
props: { | ||
value: { | ||
type: [String, Number], | ||
default: '' | ||
}, | ||
transform: { | ||
type: [String, Object], | ||
default: null | ||
}, | ||
counter: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
position: { | ||
type: String, | ||
default: null, | ||
validator: function validator(value) { | ||
return ['bottom-left', 'bottom-right', 'top-left', 'top-right'].indexOf(value) > -1; | ||
} | ||
} | ||
}, | ||
render: function render(createElement, context) { | ||
var familyPrefix = fontawesomeSvgCore.config.familyPrefix; | ||
var props = context.props; | ||
var classes = objectWithKey('classes', [].concat(toConsumableArray(props.counter ? [familyPrefix + '-layers-counter'] : []), toConsumableArray(props.position ? [familyPrefix + '-layers-' + props.position] : []))); | ||
var transform = objectWithKey('transform', typeof props.transform === 'string' ? fontawesomeSvgCore.parse.transform(props.transform) : props.transform); | ||
var renderedText = fontawesomeSvgCore.text(props.value.toString(), _extends({}, transform, classes)); | ||
var abstract = renderedText.abstract; | ||
if (props.counter) { | ||
abstract[0].attributes.class = abstract[0].attributes.class.replace('fa-layers-text', ''); | ||
} | ||
var convertCurry = convert.bind(null, createElement); | ||
return convertCurry(abstract[0], {}, context.data); | ||
} | ||
}; | ||
exports.FontAwesomeIcon = FontAwesomeIcon; | ||
exports.FontAwesomeLayers = FontAwesomeLayers; | ||
exports.FontAwesomeLayersText = FontAwesomeLayersText; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
})); |
{ | ||
"name": "@fortawesome/vue-fontawesome", | ||
"description": "Official Vue component for Font Awesome 5", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"main": "index.js", | ||
"files": [ | ||
"README.md", | ||
"LICENSE.txt", | ||
"UPGRADING.md", | ||
"CHANGELOG.md", | ||
"index.d.ts", | ||
"index.es.js", | ||
"index.js", | ||
"src/components/**.js", | ||
"src/**.js" | ||
], | ||
"jest": { | ||
"verbose": true | ||
}, | ||
"module": "index.es.js", | ||
@@ -29,6 +43,5 @@ "jsnext:main": "index.es.js", | ||
"dist": "cross-env NODE_ENV=production npm run build", | ||
"test": "npm run test.latest && npm run test.next", | ||
"test.latest": "npm --no-save install @fortawesome/fontawesome-svg-core@latest @fortawesome/free-solid-svg-icons@latest && jest --silent", | ||
"test.next": "npm --no-save install @fortawesome/fontawesome-svg-core@next @fortawesome/free-solid-svg-icons@next && jest --silent", | ||
"test.next.proregistry": "npm --userconfig .npmrc.proregistry --registry https://npm.fontawesome.com install --no-save @fortawesome/fontawesome-svg-core@next @fortawesome/free-solid-svg-icons@next && jest --silent", | ||
"test": "npm run test.5 && npm run test.6", | ||
"test.5": "npm --no-save install @fortawesome/fontawesome-svg-core@1.2.x @fortawesome/free-solid-svg-icons@5.x && jest --silent", | ||
"test.6": "npm --no-save install @fortawesome/fontawesome-svg-core@6.x @fortawesome/free-solid-svg-icons@6.x && jest --silent", | ||
"prepack": "npm run dist" | ||
@@ -43,27 +56,31 @@ }, | ||
"peerDependencies": { | ||
"@fortawesome/fontawesome-svg-core": "~1 || >=1.3.0-beta1", | ||
"@fortawesome/fontawesome-svg-core": "~1 || ~6", | ||
"vue": "~2" | ||
}, | ||
"devDependencies": { | ||
"@fortawesome/fontawesome-svg-core": "^1.2.32", | ||
"@fortawesome/free-solid-svg-icons": "^5.15.1", | ||
"babel-core": "^6.26.0", | ||
"babel-jest": "^23.6.0", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-stage-3": "^6.24.1", | ||
"concurrently": "^4.1.0", | ||
"cross-env": "^5.1.1", | ||
"@babel/core": "^7.18.2", | ||
"@babel/plugin-external-helpers": "^7.17.12", | ||
"@babel/plugin-proposal-class-properties": "^7.17.12", | ||
"@babel/plugin-proposal-json-strings": "^7.17.12", | ||
"@babel/plugin-syntax-dynamic-import": "^7.8.3", | ||
"@babel/plugin-syntax-import-meta": "^7.10.4", | ||
"@babel/preset-env": "^7.18.2", | ||
"@fortawesome/fontawesome-svg-core": "~6", | ||
"@fortawesome/free-solid-svg-icons": "^6", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"babel-jest": "^28.1.1", | ||
"concurrently": "^7.2.1", | ||
"cross-env": "^7.0.3", | ||
"humps": "^2.0.1", | ||
"husky": "^1.1.2", | ||
"jest": "^23.6.0", | ||
"lint-staged": "^8.1.0", | ||
"husky": "^8.0.1", | ||
"jest": "^28.1.1", | ||
"jest-environment-jsdom": "^28.1.1", | ||
"lint-staged": "^13.0.0", | ||
"markdown-toc": "^1.2.0", | ||
"rollup": "^0.57.1", | ||
"rollup-plugin-babel": "^3.0.2", | ||
"rollup-plugin-commonjs": "^9.1.0", | ||
"rollup-plugin-node-resolve": "^3.0.0", | ||
"rollup": "^2.75.6", | ||
"@rollup/plugin-babel": "^5.3.1", | ||
"@rollup/plugin-commonjs": "^22.0.0", | ||
"@rollup/plugin-node-resolve": "^13.3.0", | ||
"vue": "^2.4.4" | ||
}, | ||
"dependencies": {}, | ||
"husky": { | ||
@@ -70,0 +87,0 @@ "hooks": { |
@@ -223,3 +223,3 @@ <a href="https://fontawesome.com"> | ||
import { library } from '@fortawesome/fontawesome-svg-core' | ||
# Note we are using the Pro style here | ||
// Note we are using the Pro style here | ||
import { faUserSecret } from '@fortawesome/pro-regular-svg-icons' | ||
@@ -238,3 +238,3 @@ | ||
import { library } from '@fortawesome/fontawesome-svg-core' | ||
# Note we are using the Pro style here | ||
// Note we are using the Pro style here | ||
import { faUserSecret } from '@fortawesome/pro-light-svg-icons' | ||
@@ -253,3 +253,3 @@ | ||
import { library } from '@fortawesome/fontawesome-svg-core' | ||
# Note we are using the Pro style here | ||
// Note we are using the Pro style here | ||
import { faUserSecret } from '@fortawesome/pro-duotone-svg-icons' | ||
@@ -310,4 +310,4 @@ | ||
<font-awesome-icon :icon="['fas', 'spinner']" /> # Same as above | ||
<font-awesome-icon :icon="['fas', 'align-left']" /> # Same as above | ||
<font-awesome-icon :icon="['fas', 'spinner']" /> // Same as above | ||
<font-awesome-icon :icon="['fas', 'align-left']" /> // Same as above | ||
``` | ||
@@ -328,3 +328,3 @@ | ||
```javascript | ||
<font-awesome-icon icon="address-card" /> # import { faAddressCard } from '@fortawesome/free-solid-svg-icons' | ||
<font-awesome-icon icon="address-card" /> // import { faAddressCard } from '@fortawesome/free-solid-svg-icons' | ||
``` | ||
@@ -331,0 +331,0 @@ |
@@ -61,5 +61,5 @@ import { parse as faParse, icon as faIcon } from '@fortawesome/fontawesome-svg-core' | ||
flip: { | ||
type: String, | ||
default: null, | ||
validator: (value) => ['horizontal', 'vertical', 'both'].indexOf(value) > -1 | ||
type: [Boolean, String], | ||
default: false, | ||
validator: (value) => [true, false, 'horizontal', 'vertical', 'both'].indexOf(value) > -1 | ||
}, | ||
@@ -128,2 +128,14 @@ icon: { | ||
default: false | ||
}, | ||
bounce: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
shake: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
beatFade: { | ||
type: Boolean, | ||
default: false | ||
} | ||
@@ -130,0 +142,0 @@ }, |
@@ -18,2 +18,3 @@ export function objectWithKey (key, value) { | ||
'fa-inverse': props.inverse, | ||
'fa-flip': props.flip === true, | ||
'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both', | ||
@@ -24,3 +25,6 @@ 'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both', | ||
[`fa-pull-${props.pull}`]: props.pull !== null, | ||
'fa-swap-opacity': props.swapOpacity | ||
'fa-swap-opacity': props.swapOpacity, | ||
'fa-bounce': props.bounce, | ||
'fa-shake': props.shake, | ||
'fa-beat-fade': props.beatFade | ||
} | ||
@@ -27,0 +31,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
2
85978
24
15
1439