@fortawesome/vue-fontawesome
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -14,3 +14,3 @@ { | ||
"@fortawesome/fontawesome-free-solid": "0.0.12", | ||
"@fortawesome/vue-fontawesome": "^0.0.9", | ||
"@fortawesome/vue-fontawesome": "0.0.10", | ||
"vue": "^2.3.3", | ||
@@ -17,0 +17,0 @@ "vue-template-compiler": "^2.4.2" |
166
index.js
@@ -9,11 +9,9 @@ (function (global, factory) { | ||
'use strict'; | ||
function preserveCamelCase(str) { | ||
let isLastCharLower = false; | ||
let isLastCharUpper = false; | ||
let isLastLastCharUpper = false; | ||
var isLastCharLower = false; | ||
var isLastCharUpper = false; | ||
var isLastLastCharUpper = false; | ||
for (let i = 0; i < str.length; i++) { | ||
const c = str[i]; | ||
for (var i = 0; i < str.length; i++) { | ||
var c = str[i]; | ||
@@ -44,4 +42,4 @@ if (isLastCharLower && /[a-zA-Z]/.test(c) && c.toUpperCase() === c) { | ||
str = Array.from(arguments) | ||
.map(x => x.trim()) | ||
.filter(x => x.length) | ||
.map(function (x) { return x.trim(); }) | ||
.filter(function (x) { return x.length; }) | ||
.join('-'); | ||
@@ -64,3 +62,3 @@ } else { | ||
const hasUpperCase = str !== str.toLowerCase(); | ||
var hasUpperCase = str !== str.toLowerCase(); | ||
@@ -74,31 +72,31 @@ if (hasUpperCase) { | ||
.toLowerCase() | ||
.replace(/[_.\- ]+(\w|$)/g, (m, p1) => p1.toUpperCase()); | ||
.replace(/[_.\- ]+(\w|$)/g, function (m, p1) { return 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(); | ||
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; | ||
acc[prop] = value; | ||
return acc; | ||
}, {}); | ||
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) { | ||
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
function convert (h, element, props) { | ||
if ( props === void 0 ) props = {}; | ||
@@ -113,6 +111,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: | ||
@@ -122,18 +120,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 _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 = { | ||
var icon$1 = { | ||
name: 'FontAwesomeIcon', | ||
@@ -153,5 +151,3 @@ | ||
default: null, | ||
validator: function validator(value) { | ||
return ['horizontal', 'vertical', 'both'].indexOf(value) > -1; | ||
} | ||
validator: function (value) { return ['horizontal', 'vertical', 'both'].indexOf(value) > -1; } | ||
}, | ||
@@ -173,5 +169,3 @@ iconDefinition: { | ||
default: null, | ||
validator: function validator(value) { | ||
return ['right', 'left'].indexOf(value) > -1; | ||
} | ||
validator: function (value) { return ['right', 'left'].indexOf(value) > -1; } | ||
}, | ||
@@ -189,5 +183,3 @@ pulse: { | ||
default: null, | ||
validator: function validator(value) { | ||
return [90, 180, 270].indexOf(value) > -1; | ||
} | ||
validator: function (value) { return [90, 180, 270].indexOf(value) > -1; } | ||
}, | ||
@@ -197,5 +189,3 @@ size: { | ||
default: null, | ||
validator: function validator(value) { | ||
return ['lg', 'xs', 'sm', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x'].indexOf(value) > -1; | ||
} | ||
validator: function (value) { return ['lg', 'xs', 'sm', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x'].indexOf(value) > -1; } | ||
}, | ||
@@ -212,3 +202,3 @@ spin: { | ||
data: function data() { | ||
data: function data () { | ||
return { | ||
@@ -221,17 +211,16 @@ 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; | ||
var classes = (_classes = { | ||
classList: function classList () { | ||
var classes = { | ||
'fa-spin': this.spin, | ||
@@ -244,30 +233,37 @@ 'fa-pulse': this.pulse, | ||
'fa-flip-vertical': this.flip === 'vertical' || this.flip === 'both' | ||
}, _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); | ||
}; | ||
classes[("fa-" + (this.size))] = this.size !== null; | ||
classes[("fa-rotate-" + (this.rotation))] = this.rotation !== null; | ||
classes[("fa-pull-" + (this.pull))] = this.pull !== null; | ||
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 | ||
}, | ||
icon: function icon () { | ||
var params = Object.assign({}, | ||
this.classList.length > 0 && {classes: this.classList}, | ||
this.transformDirectives && {transform: this.transformDirectives} | ||
); | ||
return fontawesome.icon(this.iconDefinition || this.iconConfig, params) | ||
} | ||
}, | ||
render: function render(createElement) { | ||
var classes = this.classList.length > 0 ? { classes: this.classList } : {}; | ||
var transform = this.transformDirectives ? { transform: this.transformDirectives } : {}; | ||
var _fontawesome$icon = fontawesome.icon(this.iconDefinition || this.iconConfig, _extends({}, classes, transform)), | ||
abstract = _fontawesome$icon.abstract; | ||
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 FontAwesomeIcon$1; | ||
return icon$1; | ||
}))); |
{ | ||
"name": "@fortawesome/vue-fontawesome", | ||
"description": "Official Vue component for Font Awesome 5", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"main": "index.js", | ||
@@ -43,3 +43,3 @@ "contributors": [ | ||
"peerDependencies": { | ||
"@fortawesome/fontawesome": "^0.0.13", | ||
"@fortawesome/fontawesome": ">=0.0.13", | ||
"vue": "^2.4.2" | ||
@@ -46,0 +46,0 @@ }, |
Sorry, the diff of this file is not supported yet
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
268232
27
576