@fortawesome/vue-fontawesome
Advanced tools
Comparing version 0.0.11 to 0.0.12
166
index.js
@@ -9,9 +9,11 @@ (function (global, factory) { | ||
'use strict'; | ||
function preserveCamelCase(str) { | ||
var isLastCharLower = false; | ||
var isLastCharUpper = false; | ||
var isLastLastCharUpper = false; | ||
let isLastCharLower = false; | ||
let isLastCharUpper = false; | ||
let isLastLastCharUpper = false; | ||
for (var i = 0; i < str.length; i++) { | ||
var c = str[i]; | ||
for (let i = 0; i < str.length; i++) { | ||
const c = str[i]; | ||
@@ -42,4 +44,4 @@ if (isLastCharLower && /[a-zA-Z]/.test(c) && c.toUpperCase() === c) { | ||
str = Array.from(arguments) | ||
.map(function (x) { return x.trim(); }) | ||
.filter(function (x) { return x.length; }) | ||
.map(x => x.trim()) | ||
.filter(x => x.length) | ||
.join('-'); | ||
@@ -62,3 +64,3 @@ } else { | ||
var hasUpperCase = str !== str.toLowerCase(); | ||
const hasUpperCase = str !== str.toLowerCase(); | ||
@@ -72,31 +74,31 @@ if (hasUpperCase) { | ||
.toLowerCase() | ||
.replace(/[_.\- ]+(\w|$)/g, function (m, p1) { return p1.toUpperCase(); }); | ||
.replace(/[_.\- ]+(\w|$)/g, (m, p1) => p1.toUpperCase()); | ||
}; | ||
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 = camelcase(pair.slice(0, i)); | ||
var value = pair.slice(i + 1).trim(); | ||
acc[prop] = value; | ||
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 = camelcase(pair.slice(0, i)); | ||
var value = pair.slice(i + 1).trim(); | ||
return acc | ||
}, {}) | ||
acc[prop] = value; | ||
return acc; | ||
}, {}); | ||
} | ||
function classToObject (cls) { | ||
return cls.split(/\s+/) | ||
.reduce(function (acc, c) { | ||
acc[c] = true; | ||
return acc | ||
}, {}) | ||
function classToObject(cls) { | ||
return cls.split(/\s+/).reduce(function (acc, c) { | ||
acc[c] = true; | ||
return acc; | ||
}, {}); | ||
} | ||
function convert (h, element, props) { | ||
if ( props === void 0 ) props = {}; | ||
function convert(h, element) { | ||
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
@@ -111,6 +113,6 @@ var children = (element.children || []).map(convert.bind(null, h)); | ||
acc['class'] = classToObject(val); | ||
break | ||
break; | ||
case 'style': | ||
acc['style'] = styleToObject(val); | ||
break | ||
break; | ||
default: | ||
@@ -120,18 +122,18 @@ acc.attrs[key] = val; | ||
return acc | ||
return acc; | ||
}, { 'class': {}, style: {}, attrs: {} }); | ||
return h( | ||
element.tag, | ||
{ | ||
class: mixins.class, | ||
style: mixins.style, | ||
attrs: mixins.attrs, | ||
props: props | ||
}, | ||
children | ||
) | ||
return h(element.tag, { | ||
class: mixins.class, | ||
style: mixins.style, | ||
attrs: mixins.attrs, | ||
props: props | ||
}, children); | ||
} | ||
var icon$1 = { | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
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 obj; } | ||
var FontAwesomeIcon$1 = { | ||
name: 'FontAwesomeIcon', | ||
@@ -151,3 +153,5 @@ | ||
default: null, | ||
validator: function (value) { return ['horizontal', 'vertical', 'both'].indexOf(value) > -1; } | ||
validator: function validator(value) { | ||
return ['horizontal', 'vertical', 'both'].indexOf(value) > -1; | ||
} | ||
}, | ||
@@ -169,3 +173,5 @@ iconDefinition: { | ||
default: null, | ||
validator: function (value) { return ['right', 'left'].indexOf(value) > -1; } | ||
validator: function validator(value) { | ||
return ['right', 'left'].indexOf(value) > -1; | ||
} | ||
}, | ||
@@ -183,3 +189,5 @@ pulse: { | ||
default: null, | ||
validator: function (value) { return [90, 180, 270].indexOf(value) > -1; } | ||
validator: function validator(value) { | ||
return [90, 180, 270].indexOf(value) > -1; | ||
} | ||
}, | ||
@@ -189,3 +197,5 @@ size: { | ||
default: null, | ||
validator: function (value) { return ['lg', 'xs', 'sm', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x'].indexOf(value) > -1; } | ||
validator: function validator(value) { | ||
return ['lg', 'xs', 'sm', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x'].indexOf(value) > -1; | ||
} | ||
}, | ||
@@ -202,3 +212,3 @@ spin: { | ||
data: function data () { | ||
data: function data() { | ||
return { | ||
@@ -211,16 +221,17 @@ packNames: { | ||
} | ||
} | ||
}; | ||
}, | ||
computed: { | ||
prefix: function prefix () { | ||
return this.packNames[this.pack] || this.pack | ||
prefix: function prefix() { | ||
return this.packNames[this.pack] || this.pack; | ||
}, | ||
iconConfig: function iconConfig () { | ||
return { prefix: this.prefix, iconName: this.name } | ||
iconConfig: function iconConfig() { | ||
return { prefix: this.prefix, iconName: this.name }; | ||
}, | ||
classList: function classList() { | ||
var _classes; | ||
classList: function classList () { | ||
var classes = { | ||
var classes = (_classes = { | ||
'fa-spin': this.spin, | ||
@@ -233,37 +244,30 @@ 'fa-pulse': this.pulse, | ||
'fa-flip-vertical': this.flip === 'vertical' || this.flip === 'both' | ||
}; | ||
classes[("fa-" + (this.size))] = this.size !== null; | ||
classes[("fa-rotate-" + (this.rotation))] = this.rotation !== null; | ||
classes[("fa-pull-" + (this.pull))] = this.pull !== null; | ||
}, _defineProperty(_classes, 'fa-' + this.size, this.size !== null), _defineProperty(_classes, 'fa-rotate-' + this.rotation, this.rotation !== null), _defineProperty(_classes, 'fa-pull-' + this.pull, this.pull !== null), _classes); | ||
return Object.keys(classes) | ||
.map(function (key) { return classes[key] ? key : null; }) | ||
.filter(function (key) { return key; }) | ||
return Object.keys(classes).map(function (key) { | ||
return classes[key] ? key : null; | ||
}).filter(function (key) { | ||
return key; | ||
}); | ||
}, | ||
transformDirectives: function transformDirectives() { | ||
return typeof this.transform === 'string' ? fontawesome.parse.transform(this.transform) : this.transform; | ||
} | ||
}, | ||
transformDirectives: function transformDirectives () { | ||
return (typeof this.transform === 'string') ? fontawesome.parse.transform(this.transform) : this.transform | ||
}, | ||
render: function render(createElement) { | ||
var classes = this.classList.length > 0 ? { classes: this.classList } : {}; | ||
var transform = this.transformDirectives ? { transform: this.transformDirectives } : {}; | ||
icon: function icon () { | ||
var params = Object.assign({}, | ||
this.classList.length > 0 && {classes: this.classList}, | ||
this.transformDirectives && {transform: this.transformDirectives} | ||
); | ||
var _fontawesome$icon = fontawesome.icon(this.iconDefinition || this.iconConfig, _extends({}, classes, transform)), | ||
abstract = _fontawesome$icon.abstract; | ||
return fontawesome.icon(this.iconDefinition || this.iconConfig, params) | ||
} | ||
}, | ||
render: function render (createElement) { | ||
var ref = this.icon; | ||
var abstract = ref.abstract; | ||
var convertCurry = convert.bind(null, createElement); | ||
return convertCurry(abstract[0]) | ||
return convertCurry(abstract[0]); | ||
} | ||
}; | ||
return icon$1; | ||
return FontAwesomeIcon$1; | ||
}))); |
{ | ||
"name": "@fortawesome/vue-fontawesome", | ||
"description": "Official Vue component for Font Awesome 5", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
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
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
269005
28
578
15