@fortawesome/fontawesome
Advanced tools
Comparing version 1.2.0-2 to 1.2.0-3
/*! | ||
* Font Awesome Free 5.0.4 by @fontawesome - http://fontawesome.com | ||
* License - http://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) | ||
* Font Awesome Free 5.0.6 by @fontawesome - https://fontawesome.com | ||
* License - https://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) | ||
*/ | ||
@@ -35,3 +35,3 @@ var noop = function noop() {}; | ||
var DEFAULT_REPLACEMENT_CLASS = 'svg-inline--fa'; | ||
var DATA_FA_PROCESSED = 'data-fa-processed'; | ||
var DATA_FA_I2SVG = 'data-fa-i2svg'; | ||
var DATA_FA_PSEUDO_ELEMENT = 'data-fa-pseudo-element'; | ||
@@ -83,16 +83,3 @@ var HTML_CLASS_I2SVG_BASE_CLASS = 'fontawesome-i2svg'; | ||
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; | ||
} | ||
return obj; | ||
}; | ||
@@ -511,4 +498,2 @@ var _extends = Object.assign || function (target) { | ||
function makeInlineSvgAbstract(params) { | ||
var _babelHelpers$extends; | ||
var _params$icons = params.icons, | ||
@@ -522,3 +507,5 @@ main = _params$icons.main, | ||
title = params.title, | ||
extra = params.extra; | ||
extra = params.extra, | ||
_params$watchable = params.watchable, | ||
watchable = _params$watchable === undefined ? false : _params$watchable; | ||
@@ -530,9 +517,22 @@ var _ref = mask.found ? mask : main, | ||
var widthClass = 'fa-w-' + Math.ceil(width / height * 16); | ||
var attrClass = [config$1.replacementClass, iconName ? config$1.familyPrefix + '-' + iconName : '', widthClass].concat(extra.classes).join(' '); | ||
var attrClass = [config$1.replacementClass, iconName ? config$1.familyPrefix + '-' + iconName : '', widthClass].filter(function (c) { | ||
return !extra.classes.includes(c); | ||
}).concat(extra.classes).join(' '); | ||
var content = { | ||
children: [], | ||
attributes: _extends({}, extra.attributes, (_babelHelpers$extends = {}, defineProperty(_babelHelpers$extends, DATA_FA_PROCESSED, ''), defineProperty(_babelHelpers$extends, 'data-prefix', prefix), defineProperty(_babelHelpers$extends, 'data-icon', iconName), defineProperty(_babelHelpers$extends, 'class', attrClass), defineProperty(_babelHelpers$extends, 'role', 'img'), defineProperty(_babelHelpers$extends, 'xmlns', 'http://www.w3.org/2000/svg'), defineProperty(_babelHelpers$extends, 'viewBox', '0 0 ' + width + ' ' + height), _babelHelpers$extends)) | ||
attributes: _extends({}, extra.attributes, { | ||
'data-prefix': prefix, | ||
'data-icon': iconName, | ||
'class': attrClass, | ||
'role': 'img', | ||
'xmlns': 'http://www.w3.org/2000/svg', | ||
'viewBox': '0 0 ' + width + ' ' + height | ||
}) | ||
}; | ||
if (watchable) { | ||
content.attributes[DATA_FA_I2SVG] = ''; | ||
} | ||
if (title) content.children.push({ tag: 'title', attributes: { id: content.attributes['aria-labelledby'] || 'title-' + nextUniqueId() }, children: [title] }); | ||
@@ -565,4 +565,2 @@ | ||
function makeLayersTextAbstract(params) { | ||
var _babelHelpers$extends2; | ||
var content = params.content, | ||
@@ -573,7 +571,15 @@ width = params.width, | ||
title = params.title, | ||
extra = params.extra; | ||
extra = params.extra, | ||
_params$watchable2 = params.watchable, | ||
watchable = _params$watchable2 === undefined ? false : _params$watchable2; | ||
var attributes = _extends({}, extra.attributes, title ? { 'title': title } : {}, (_babelHelpers$extends2 = {}, defineProperty(_babelHelpers$extends2, DATA_FA_PROCESSED, ''), defineProperty(_babelHelpers$extends2, 'class', extra.classes.join(' ')), _babelHelpers$extends2)); | ||
var attributes = _extends({}, extra.attributes, title ? { 'title': title } : {}, { | ||
'class': extra.classes.join(' ') | ||
}); | ||
if (watchable) { | ||
attributes[DATA_FA_I2SVG] = ''; | ||
} | ||
var styles = _extends({}, extra.styles); | ||
@@ -609,3 +615,3 @@ | ||
var p = config$1.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : { mark: noop$2, measure: noop$2 }; | ||
var preamble = 'FA "5.0.4"'; | ||
var preamble = 'FA "5.0.6"'; | ||
@@ -794,10 +800,6 @@ var begin = function begin(name) { | ||
function isReplaced(node) { | ||
var nodeClass = node.getAttribute ? node.getAttribute('class') : null; | ||
function isWatched(node) { | ||
var i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null; | ||
if (nodeClass) { | ||
return !!~nodeClass.toString().indexOf(config$1.replacementClass) || ~nodeClass.toString().indexOf('fa-layers-text'); | ||
} else { | ||
return false; | ||
} | ||
return typeof i2svg === 'string'; | ||
} | ||
@@ -861,3 +863,3 @@ | ||
node.setAttribute('class', splitClasses.toNode.join(' ')); | ||
node.setAttribute(DATA_FA_PROCESSED, ''); | ||
node.setAttribute(DATA_FA_I2SVG, ''); | ||
node.innerHTML = newInnerHTML; | ||
@@ -898,2 +900,4 @@ } | ||
var mo = null; | ||
function observe(options) { | ||
@@ -906,7 +910,8 @@ if (!MUTATION_OBSERVER) return; | ||
var mo = new MUTATION_OBSERVER(function (objects) { | ||
mo = new MUTATION_OBSERVER(function (objects) { | ||
if (disabled) return; | ||
toArray(objects).forEach(function (mutationRecord) { | ||
if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isReplaced(mutationRecord.addedNodes[0])) { | ||
if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) { | ||
if (config$1.searchPseudoElements) { | ||
@@ -923,3 +928,3 @@ pseudoElementsCallback(mutationRecord.target); | ||
if (mutationRecord.type === 'attributes' && isReplaced(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) { | ||
if (mutationRecord.type === 'attributes' && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) { | ||
if (mutationRecord.attributeName === 'class') { | ||
@@ -946,2 +951,8 @@ var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)), | ||
function disconnect() { | ||
if (!mo) return; | ||
mo.disconnect(); | ||
} | ||
var styleParser = function (node) { | ||
@@ -1245,3 +1256,4 @@ var style = node.getAttribute('style'); | ||
title: title, | ||
extra: extra | ||
extra: extra, | ||
watchable: true | ||
})]; | ||
@@ -1276,3 +1288,4 @@ } | ||
title: title, | ||
extra: extra | ||
extra: extra, | ||
watchable: true | ||
})]; | ||
@@ -1354,4 +1367,4 @@ } | ||
var prefixes = Object.keys(styles); | ||
var prefixesDomQuery = ['.' + LAYERS_TEXT_CLASSNAME + ':not([' + DATA_FA_PROCESSED + '])'].concat(prefixes.map(function (p) { | ||
return '.' + p + ':not([' + DATA_FA_PROCESSED + '])'; | ||
var prefixesDomQuery = ['.' + LAYERS_TEXT_CLASSNAME + ':not([' + DATA_FA_I2SVG + '])'].concat(prefixes.map(function (p) { | ||
return '.' + p + ':not([' + DATA_FA_I2SVG + '])'; | ||
})).join(', '); | ||
@@ -1595,4 +1608,6 @@ | ||
var library = new Library(); | ||
var noAuto = function noAuto() { | ||
return auto(false); | ||
auto(false); | ||
disconnect(); | ||
}; | ||
@@ -1599,0 +1614,0 @@ |
99
index.js
/*! | ||
* Font Awesome Free 5.0.4 by @fontawesome - http://fontawesome.com | ||
* License - http://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) | ||
* Font Awesome Free 5.0.6 by @fontawesome - https://fontawesome.com | ||
* License - https://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) | ||
*/ | ||
@@ -41,3 +41,3 @@ (function (global, factory) { | ||
var DEFAULT_REPLACEMENT_CLASS = 'svg-inline--fa'; | ||
var DATA_FA_PROCESSED = 'data-fa-processed'; | ||
var DATA_FA_I2SVG = 'data-fa-i2svg'; | ||
var DATA_FA_PSEUDO_ELEMENT = 'data-fa-pseudo-element'; | ||
@@ -89,16 +89,3 @@ var HTML_CLASS_I2SVG_BASE_CLASS = 'fontawesome-i2svg'; | ||
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; | ||
} | ||
return obj; | ||
}; | ||
@@ -517,4 +504,2 @@ var _extends = Object.assign || function (target) { | ||
function makeInlineSvgAbstract(params) { | ||
var _babelHelpers$extends; | ||
var _params$icons = params.icons, | ||
@@ -528,3 +513,5 @@ main = _params$icons.main, | ||
title = params.title, | ||
extra = params.extra; | ||
extra = params.extra, | ||
_params$watchable = params.watchable, | ||
watchable = _params$watchable === undefined ? false : _params$watchable; | ||
@@ -536,9 +523,22 @@ var _ref = mask.found ? mask : main, | ||
var widthClass = 'fa-w-' + Math.ceil(width / height * 16); | ||
var attrClass = [config$1.replacementClass, iconName ? config$1.familyPrefix + '-' + iconName : '', widthClass].concat(extra.classes).join(' '); | ||
var attrClass = [config$1.replacementClass, iconName ? config$1.familyPrefix + '-' + iconName : '', widthClass].filter(function (c) { | ||
return !extra.classes.includes(c); | ||
}).concat(extra.classes).join(' '); | ||
var content = { | ||
children: [], | ||
attributes: _extends({}, extra.attributes, (_babelHelpers$extends = {}, defineProperty(_babelHelpers$extends, DATA_FA_PROCESSED, ''), defineProperty(_babelHelpers$extends, 'data-prefix', prefix), defineProperty(_babelHelpers$extends, 'data-icon', iconName), defineProperty(_babelHelpers$extends, 'class', attrClass), defineProperty(_babelHelpers$extends, 'role', 'img'), defineProperty(_babelHelpers$extends, 'xmlns', 'http://www.w3.org/2000/svg'), defineProperty(_babelHelpers$extends, 'viewBox', '0 0 ' + width + ' ' + height), _babelHelpers$extends)) | ||
attributes: _extends({}, extra.attributes, { | ||
'data-prefix': prefix, | ||
'data-icon': iconName, | ||
'class': attrClass, | ||
'role': 'img', | ||
'xmlns': 'http://www.w3.org/2000/svg', | ||
'viewBox': '0 0 ' + width + ' ' + height | ||
}) | ||
}; | ||
if (watchable) { | ||
content.attributes[DATA_FA_I2SVG] = ''; | ||
} | ||
if (title) content.children.push({ tag: 'title', attributes: { id: content.attributes['aria-labelledby'] || 'title-' + nextUniqueId() }, children: [title] }); | ||
@@ -571,4 +571,2 @@ | ||
function makeLayersTextAbstract(params) { | ||
var _babelHelpers$extends2; | ||
var content = params.content, | ||
@@ -579,7 +577,15 @@ width = params.width, | ||
title = params.title, | ||
extra = params.extra; | ||
extra = params.extra, | ||
_params$watchable2 = params.watchable, | ||
watchable = _params$watchable2 === undefined ? false : _params$watchable2; | ||
var attributes = _extends({}, extra.attributes, title ? { 'title': title } : {}, (_babelHelpers$extends2 = {}, defineProperty(_babelHelpers$extends2, DATA_FA_PROCESSED, ''), defineProperty(_babelHelpers$extends2, 'class', extra.classes.join(' ')), _babelHelpers$extends2)); | ||
var attributes = _extends({}, extra.attributes, title ? { 'title': title } : {}, { | ||
'class': extra.classes.join(' ') | ||
}); | ||
if (watchable) { | ||
attributes[DATA_FA_I2SVG] = ''; | ||
} | ||
var styles = _extends({}, extra.styles); | ||
@@ -615,3 +621,3 @@ | ||
var p = config$1.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : { mark: noop$2, measure: noop$2 }; | ||
var preamble = 'FA "5.0.4"'; | ||
var preamble = 'FA "5.0.6"'; | ||
@@ -800,10 +806,6 @@ var begin = function begin(name) { | ||
function isReplaced(node) { | ||
var nodeClass = node.getAttribute ? node.getAttribute('class') : null; | ||
function isWatched(node) { | ||
var i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null; | ||
if (nodeClass) { | ||
return !!~nodeClass.toString().indexOf(config$1.replacementClass) || ~nodeClass.toString().indexOf('fa-layers-text'); | ||
} else { | ||
return false; | ||
} | ||
return typeof i2svg === 'string'; | ||
} | ||
@@ -867,3 +869,3 @@ | ||
node.setAttribute('class', splitClasses.toNode.join(' ')); | ||
node.setAttribute(DATA_FA_PROCESSED, ''); | ||
node.setAttribute(DATA_FA_I2SVG, ''); | ||
node.innerHTML = newInnerHTML; | ||
@@ -904,2 +906,4 @@ } | ||
var mo = null; | ||
function observe(options) { | ||
@@ -912,7 +916,8 @@ if (!MUTATION_OBSERVER) return; | ||
var mo = new MUTATION_OBSERVER(function (objects) { | ||
mo = new MUTATION_OBSERVER(function (objects) { | ||
if (disabled) return; | ||
toArray(objects).forEach(function (mutationRecord) { | ||
if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isReplaced(mutationRecord.addedNodes[0])) { | ||
if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) { | ||
if (config$1.searchPseudoElements) { | ||
@@ -929,3 +934,3 @@ pseudoElementsCallback(mutationRecord.target); | ||
if (mutationRecord.type === 'attributes' && isReplaced(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) { | ||
if (mutationRecord.type === 'attributes' && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) { | ||
if (mutationRecord.attributeName === 'class') { | ||
@@ -952,2 +957,8 @@ var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)), | ||
function disconnect() { | ||
if (!mo) return; | ||
mo.disconnect(); | ||
} | ||
var styleParser = function (node) { | ||
@@ -1251,3 +1262,4 @@ var style = node.getAttribute('style'); | ||
title: title, | ||
extra: extra | ||
extra: extra, | ||
watchable: true | ||
})]; | ||
@@ -1282,3 +1294,4 @@ } | ||
title: title, | ||
extra: extra | ||
extra: extra, | ||
watchable: true | ||
})]; | ||
@@ -1360,4 +1373,4 @@ } | ||
var prefixes = Object.keys(styles); | ||
var prefixesDomQuery = ['.' + LAYERS_TEXT_CLASSNAME + ':not([' + DATA_FA_PROCESSED + '])'].concat(prefixes.map(function (p) { | ||
return '.' + p + ':not([' + DATA_FA_PROCESSED + '])'; | ||
var prefixesDomQuery = ['.' + LAYERS_TEXT_CLASSNAME + ':not([' + DATA_FA_I2SVG + '])'].concat(prefixes.map(function (p) { | ||
return '.' + p + ':not([' + DATA_FA_I2SVG + '])'; | ||
})).join(', '); | ||
@@ -1601,4 +1614,6 @@ | ||
var library = new Library(); | ||
var noAuto = function noAuto() { | ||
return auto(false); | ||
auto(false); | ||
disconnect(); | ||
}; | ||
@@ -1605,0 +1620,0 @@ |
@@ -50,5 +50,5 @@ { | ||
"dependencies": { | ||
"@fortawesome/fontawesome-common-types": "^0.1.2-1" | ||
"@fortawesome/fontawesome-common-types": "^0.1.2" | ||
}, | ||
"version": "1.2.0-2", | ||
"version": "1.2.0-3", | ||
"name": "@fortawesome/fontawesome", | ||
@@ -55,0 +55,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
3380
127278