Release 5.0.1 (#913)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Font Awesome Pro 5.0.0 by @fontawesome - http://fontawesome.com
|
||||
* Font Awesome Pro 5.0.1 by @fontawesome - http://fontawesome.com
|
||||
* License - http://fontawesome.com/license (Commercial License)
|
||||
*/
|
||||
(function () {
|
||||
@@ -49,7 +49,7 @@ var PRODUCTION = function () {
|
||||
var oneToTen = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
var oneToTwenty = oneToTen.concat([11, 12, 13, 14, 15, 16, 17, 18, 19, 20]);
|
||||
|
||||
var ATTRIBUTES_WATCHED_FOR_MUTATION = ['data-prefix', 'data-icon', 'data-fa-transform', 'data-fa-mask'];
|
||||
var ATTRIBUTES_WATCHED_FOR_MUTATION = ['class', 'data-prefix', 'data-icon', 'data-fa-transform', 'data-fa-mask'];
|
||||
|
||||
var RESERVED_CLASSES = ['xs', 'sm', 'lg', 'fw', 'ul', 'li', 'border', 'pull-left', 'pull-right', 'spin', 'pulse', 'rotate-90', 'rotate-180', 'rotate-270', 'flip-horizontal', 'flip-vertical', 'stack', 'stack-1x', 'stack-2x', 'inverse', 'layers', 'layers-text', 'layers-counter'].concat(oneToTen.map(function (n) {
|
||||
return n + 'x';
|
||||
@@ -233,6 +233,16 @@ function toArray(obj) {
|
||||
return array;
|
||||
}
|
||||
|
||||
function classArray(node) {
|
||||
if (node.classList) {
|
||||
return toArray(node.classList);
|
||||
} else {
|
||||
return (node.getAttribute('class') || '').split(' ').filter(function (i) {
|
||||
return i;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getIconName(familyPrefix, cls) {
|
||||
var parts = cls.split('-');
|
||||
var prefix = parts[0];
|
||||
@@ -566,7 +576,7 @@ var namespace = w[NAMESPACE_IDENTIFIER];
|
||||
|
||||
var noop$2 = function noop() {};
|
||||
var p = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : { mark: noop$2, measure: noop$2 };
|
||||
var preamble = 'FA "5.0.0"';
|
||||
var preamble = 'FA "5.0.1"';
|
||||
|
||||
var begin = function begin(name) {
|
||||
p.mark(preamble + ' ' + name + ' begins');
|
||||
@@ -582,6 +592,157 @@ var end = function end(name) {
|
||||
|
||||
var perf = { begin: begin, end: end };
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Internal helper to bind a function known to have 4 arguments
|
||||
* to a given context.
|
||||
*/
|
||||
var bindInternal4 = function bindInternal4 (func, thisContext) {
|
||||
return function (a, b, c, d) {
|
||||
return func.call(thisContext, a, b, c, d);
|
||||
};
|
||||
};
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* # Reduce
|
||||
*
|
||||
* A fast object `.reduce()` implementation.
|
||||
*
|
||||
* @param {Object} subject The object to reduce over.
|
||||
* @param {Function} fn The reducer function.
|
||||
* @param {mixed} initialValue The initial value for the reducer, defaults to subject[0].
|
||||
* @param {Object} thisContext The context for the reducer.
|
||||
* @return {mixed} The final result.
|
||||
*/
|
||||
var reduce = function fastReduceObject (subject, fn, initialValue, thisContext) {
|
||||
var keys = Object.keys(subject),
|
||||
length = keys.length,
|
||||
iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
|
||||
i, key, result;
|
||||
|
||||
if (initialValue === undefined) {
|
||||
i = 1;
|
||||
result = subject[keys[0]];
|
||||
}
|
||||
else {
|
||||
i = 0;
|
||||
result = initialValue;
|
||||
}
|
||||
|
||||
for (; i < length; i++) {
|
||||
key = keys[i];
|
||||
result = iterator(result, subject[key], key, subject);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
var styles$2 = namespace.styles;
|
||||
var shims = namespace.shims;
|
||||
|
||||
|
||||
var _byUnicode = {};
|
||||
var _byLigature = {};
|
||||
var _byOldName = {};
|
||||
|
||||
var build = function build() {
|
||||
var lookup = function lookup(reducer) {
|
||||
return reduce(styles$2, function (o, style, prefix) {
|
||||
o[prefix] = reduce(style, reducer, {});
|
||||
return o;
|
||||
}, {});
|
||||
};
|
||||
|
||||
_byUnicode = lookup(function (acc, icon, iconName) {
|
||||
acc[icon[3]] = iconName;
|
||||
|
||||
return acc;
|
||||
});
|
||||
|
||||
_byLigature = lookup(function (acc, icon, iconName) {
|
||||
var ligatures = icon[2];
|
||||
|
||||
acc[iconName] = iconName;
|
||||
|
||||
ligatures.forEach(function (ligature) {
|
||||
acc[ligature] = iconName;
|
||||
});
|
||||
|
||||
return acc;
|
||||
});
|
||||
|
||||
var hasRegular = 'far' in styles$2;
|
||||
|
||||
_byOldName = reduce(shims, function (acc, shim) {
|
||||
var oldName = shim[0];
|
||||
var prefix = shim[1];
|
||||
var iconName = shim[2];
|
||||
|
||||
if (prefix === 'far' && !hasRegular) {
|
||||
prefix = 'fas';
|
||||
}
|
||||
|
||||
acc[oldName] = { prefix: prefix, iconName: iconName };
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
};
|
||||
|
||||
build();
|
||||
|
||||
function byUnicode(prefix, unicode) {
|
||||
return _byUnicode[prefix][unicode];
|
||||
}
|
||||
|
||||
function byLigature(prefix, ligature) {
|
||||
return _byLigature[prefix][ligature];
|
||||
}
|
||||
|
||||
function byOldName(name) {
|
||||
return _byOldName[name] || { prefix: null, iconName: null };
|
||||
}
|
||||
|
||||
var styles$1 = namespace.styles;
|
||||
|
||||
|
||||
var emptyCanonicalIcon = function emptyCanonicalIcon() {
|
||||
return { prefix: null, iconName: null, rest: [] };
|
||||
};
|
||||
|
||||
function getCanonicalIcon(values) {
|
||||
return values.reduce(function (acc, cls) {
|
||||
var iconName = getIconName(config.familyPrefix, cls);
|
||||
|
||||
if (styles$1[cls]) {
|
||||
acc.prefix = cls;
|
||||
} else if (iconName) {
|
||||
var shim = acc.prefix === 'fa' ? byOldName(iconName) : {};
|
||||
|
||||
acc.iconName = shim.iconName || iconName;
|
||||
acc.prefix = shim.prefix || acc.prefix;
|
||||
} else if (cls !== config.replacementClass && cls.indexOf('fa-w-') !== 0) {
|
||||
acc.rest.push(cls);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, emptyCanonicalIcon());
|
||||
}
|
||||
|
||||
function iconFromMapping(mapping, prefix, iconName) {
|
||||
if (mapping && mapping[prefix] && mapping[prefix][iconName]) {
|
||||
return {
|
||||
prefix: prefix,
|
||||
iconName: iconName,
|
||||
icon: mapping[prefix][iconName]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function toHtml(abstractNodes) {
|
||||
var tag = abstractNodes.tag,
|
||||
_abstractNodes$attrib = abstractNodes.attributes,
|
||||
@@ -603,7 +764,7 @@ function isReplaced(node) {
|
||||
var nodeClass = node.getAttribute ? node.getAttribute('class') : null;
|
||||
|
||||
if (nodeClass) {
|
||||
return ~nodeClass.toString().indexOf(config.replacementClass) || ~nodeClass.toString().indexOf('fa-layers-text');
|
||||
return !!~nodeClass.toString().indexOf(config.replacementClass) || ~nodeClass.toString().indexOf('fa-layers-text');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -626,7 +787,14 @@ var mutators = {
|
||||
var newOuterHTML = abstract.map(function (a) {
|
||||
return toHtml(a);
|
||||
}).join('\n');
|
||||
if (node.parentNode) node.outerHTML = newOuterHTML + (config.keepOriginalSource && node.tagName.toLowerCase() !== 'svg' ? '<!-- ' + node.outerHTML + ' -->' : '');
|
||||
|
||||
if (node.parentNode && node.outerHTML) {
|
||||
node.outerHTML = newOuterHTML + (config.keepOriginalSource && node.tagName.toLowerCase() !== 'svg' ? '<!-- ' + node.outerHTML + ' -->' : '');
|
||||
} else if (node.parentNode) {
|
||||
var newNode = document.createElement('span');
|
||||
node.parentNode.replaceChild(newNode, node);
|
||||
newNode.outerHTML = newOuterHTML;
|
||||
}
|
||||
},
|
||||
nest: function nest(mutation) {
|
||||
var node = mutation[0];
|
||||
@@ -634,7 +802,7 @@ var mutators = {
|
||||
|
||||
// If we already have a replaced node we do not want to continue nesting within it.
|
||||
// Short-circuit to the standard replacement
|
||||
if (~toArray(node.classList).indexOf(config.replacementClass)) {
|
||||
if (~classArray(node).indexOf(config.replacementClass)) {
|
||||
return mutators.replace(mutation);
|
||||
}
|
||||
|
||||
@@ -718,7 +886,16 @@ function observe(options) {
|
||||
}
|
||||
|
||||
if (mutationRecord.type === 'attributes' && isReplaced(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) {
|
||||
nodeCallback(mutationRecord.target);
|
||||
if (mutationRecord.attributeName === 'class') {
|
||||
var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)),
|
||||
prefix = _getCanonicalIcon.prefix,
|
||||
iconName = _getCanonicalIcon.iconName;
|
||||
|
||||
if (prefix) mutationRecord.target.setAttribute('data-prefix', prefix);
|
||||
if (iconName) mutationRecord.target.setAttribute('data-icon', iconName);
|
||||
} else {
|
||||
nodeCallback(mutationRecord.target);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -752,121 +929,6 @@ var styleParser = function (node) {
|
||||
return val;
|
||||
};
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Internal helper to bind a function known to have 4 arguments
|
||||
* to a given context.
|
||||
*/
|
||||
var bindInternal4 = function bindInternal4 (func, thisContext) {
|
||||
return function (a, b, c, d) {
|
||||
return func.call(thisContext, a, b, c, d);
|
||||
};
|
||||
};
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* # Reduce
|
||||
*
|
||||
* A fast object `.reduce()` implementation.
|
||||
*
|
||||
* @param {Object} subject The object to reduce over.
|
||||
* @param {Function} fn The reducer function.
|
||||
* @param {mixed} initialValue The initial value for the reducer, defaults to subject[0].
|
||||
* @param {Object} thisContext The context for the reducer.
|
||||
* @return {mixed} The final result.
|
||||
*/
|
||||
var reduce = function fastReduceObject (subject, fn, initialValue, thisContext) {
|
||||
var keys = Object.keys(subject),
|
||||
length = keys.length,
|
||||
iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
|
||||
i, key, result;
|
||||
|
||||
if (initialValue === undefined) {
|
||||
i = 1;
|
||||
result = subject[keys[0]];
|
||||
}
|
||||
else {
|
||||
i = 0;
|
||||
result = initialValue;
|
||||
}
|
||||
|
||||
for (; i < length; i++) {
|
||||
key = keys[i];
|
||||
result = iterator(result, subject[key], key, subject);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
var styles$1 = namespace.styles;
|
||||
var shims = namespace.shims;
|
||||
|
||||
|
||||
var _byUnicode = {};
|
||||
var _byLigature = {};
|
||||
var _byOldName = {};
|
||||
|
||||
var build = function build() {
|
||||
var lookup = function lookup(reducer) {
|
||||
return reduce(styles$1, function (o, style, prefix) {
|
||||
o[prefix] = reduce(style, reducer, {});
|
||||
return o;
|
||||
}, {});
|
||||
};
|
||||
|
||||
_byUnicode = lookup(function (acc, icon, iconName) {
|
||||
acc[icon[3]] = iconName;
|
||||
|
||||
return acc;
|
||||
});
|
||||
|
||||
_byLigature = lookup(function (acc, icon, iconName) {
|
||||
var ligatures = icon[2];
|
||||
|
||||
acc[iconName] = iconName;
|
||||
|
||||
ligatures.forEach(function (ligature) {
|
||||
acc[ligature] = iconName;
|
||||
});
|
||||
|
||||
return acc;
|
||||
});
|
||||
|
||||
var hasRegular = 'far' in styles$1;
|
||||
|
||||
_byOldName = reduce(shims, function (acc, shim) {
|
||||
var oldName = shim[0];
|
||||
var prefix = shim[1];
|
||||
var iconName = shim[2];
|
||||
|
||||
if (prefix === 'far' && !hasRegular) {
|
||||
prefix = 'fas';
|
||||
}
|
||||
|
||||
acc[oldName] = { prefix: prefix, iconName: iconName };
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
};
|
||||
|
||||
build();
|
||||
|
||||
function byUnicode(prefix, unicode) {
|
||||
return _byUnicode[prefix][unicode];
|
||||
}
|
||||
|
||||
function byLigature(prefix, ligature) {
|
||||
return _byLigature[prefix][ligature];
|
||||
}
|
||||
|
||||
function byOldName(name) {
|
||||
return _byOldName[name] || { prefix: null, iconName: null };
|
||||
}
|
||||
|
||||
function toHex(unicode) {
|
||||
var result = '';
|
||||
|
||||
@@ -878,48 +940,12 @@ function toHex(unicode) {
|
||||
return result;
|
||||
}
|
||||
|
||||
var styles$2 = namespace.styles;
|
||||
|
||||
|
||||
var emptyCanonicalIcon = function emptyCanonicalIcon() {
|
||||
return { prefix: null, iconName: null, rest: [] };
|
||||
};
|
||||
|
||||
function getCanonicalIcon(values) {
|
||||
return values.reduce(function (acc, cls) {
|
||||
var iconName = getIconName(config.familyPrefix, cls);
|
||||
|
||||
if (styles$2[cls]) {
|
||||
acc.prefix = cls;
|
||||
} else if (iconName) {
|
||||
var shim = acc.prefix === 'fa' ? byOldName(iconName) : {};
|
||||
|
||||
acc.iconName = shim.iconName || iconName;
|
||||
acc.prefix = shim.prefix || acc.prefix;
|
||||
} else if (cls !== config.replacementClass && cls.indexOf('fa-w-') !== 0) {
|
||||
acc.rest.push(cls);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, emptyCanonicalIcon());
|
||||
}
|
||||
|
||||
function iconFromMapping(mapping, prefix, iconName) {
|
||||
if (mapping && mapping[prefix] && mapping[prefix][iconName]) {
|
||||
return {
|
||||
prefix: prefix,
|
||||
iconName: iconName,
|
||||
icon: mapping[prefix][iconName]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var classParser = function (node) {
|
||||
var existingPrefix = node.getAttribute('data-prefix');
|
||||
var existingIconName = node.getAttribute('data-icon');
|
||||
var innerText = node.innerText !== undefined ? node.innerText.trim() : '';
|
||||
|
||||
var val = getCanonicalIcon(toArray(node.classList));
|
||||
var val = getCanonicalIcon(classArray(node));
|
||||
|
||||
if (existingPrefix && existingIconName) {
|
||||
val.prefix = existingPrefix;
|
||||
|
||||
Reference in New Issue
Block a user