@fortawesome/fontawesome-svg-core
Advanced tools
Comparing version 1.2.8 to 1.2.9
924
index.es.js
@@ -1,5 +0,115 @@ | ||
/*! | ||
* Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com | ||
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) | ||
*/ | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
} | ||
function _defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
} | ||
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; | ||
} | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var ownKeys = Object.keys(source); | ||
if (typeof Object.getOwnPropertySymbols === 'function') { | ||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
})); | ||
} | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); | ||
} | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"] != null) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
} | ||
var noop = function noop() {}; | ||
@@ -9,4 +119,7 @@ | ||
var _DOCUMENT = {}; | ||
var _MUTATION_OBSERVER$1 = null; | ||
var _PERFORMANCE = { mark: noop, measure: noop }; | ||
var _MUTATION_OBSERVER = null; | ||
var _PERFORMANCE = { | ||
mark: noop, | ||
measure: noop | ||
}; | ||
@@ -16,15 +129,15 @@ try { | ||
if (typeof document !== 'undefined') _DOCUMENT = document; | ||
if (typeof MutationObserver !== 'undefined') _MUTATION_OBSERVER$1 = MutationObserver; | ||
if (typeof MutationObserver !== 'undefined') _MUTATION_OBSERVER = MutationObserver; | ||
if (typeof performance !== 'undefined') _PERFORMANCE = performance; | ||
} catch (e) {} | ||
var _ref = _WINDOW.navigator || {}; | ||
var _ref$userAgent = _ref.userAgent; | ||
var userAgent = _ref$userAgent === undefined ? '' : _ref$userAgent; | ||
var _ref = _WINDOW.navigator || {}, | ||
_ref$userAgent = _ref.userAgent, | ||
userAgent = _ref$userAgent === void 0 ? '' : _ref$userAgent; | ||
var WINDOW = _WINDOW; | ||
var DOCUMENT = _DOCUMENT; | ||
var MUTATION_OBSERVER = _MUTATION_OBSERVER$1; | ||
var MUTATION_OBSERVER = _MUTATION_OBSERVER; | ||
var PERFORMANCE = _PERFORMANCE; | ||
var IS_BROWSER = !!WINDOW.document; | ||
var IS_DOM = !!DOCUMENT.documentElement && !!DOCUMENT.head && typeof DOCUMENT.addEventListener === 'function' && typeof DOCUMENT.createElement === 'function'; | ||
@@ -50,104 +163,11 @@ var IS_IE = ~userAgent.indexOf('MSIE') || ~userAgent.indexOf('Trident/'); | ||
}(); | ||
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 = ['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'; | ||
return "".concat(n, "x"); | ||
})).concat(oneToTwenty.map(function (n) { | ||
return 'w-' + n; | ||
return "w-".concat(n); | ||
})); | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
var createClass = function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
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; | ||
}; | ||
var slicedToArray = function () { | ||
function sliceIterator(arr, i) { | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"]) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
return function (arr, i) { | ||
if (Array.isArray(arr)) { | ||
return arr; | ||
} else if (Symbol.iterator in Object(arr)) { | ||
return sliceIterator(arr, i); | ||
} else { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
} | ||
}; | ||
}(); | ||
var toConsumableArray = function (arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} else { | ||
return Array.from(arr); | ||
} | ||
}; | ||
var initial = WINDOW.FontAwesomeConfig || {}; | ||
@@ -175,5 +195,4 @@ | ||
var attrs = [['data-family-prefix', 'familyPrefix'], ['data-replacement-class', 'replacementClass'], ['data-auto-replace-svg', 'autoReplaceSvg'], ['data-auto-add-css', 'autoAddCss'], ['data-auto-a11y', 'autoA11y'], ['data-search-pseudo-elements', 'searchPseudoElements'], ['data-observe-mutations', 'observeMutations'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']]; | ||
attrs.forEach(function (_ref) { | ||
var _ref2 = slicedToArray(_ref, 2), | ||
var _ref2 = _slicedToArray(_ref, 2), | ||
attr = _ref2[0], | ||
@@ -190,3 +209,3 @@ key = _ref2[1]; | ||
var _default = _extends({ | ||
var _default = _objectSpread({ | ||
familyPrefix: DEFAULT_FAMILY_PREFIX, | ||
@@ -206,3 +225,3 @@ replacementClass: DEFAULT_REPLACEMENT_CLASS, | ||
var config = _extends({}, _default); | ||
var config = _objectSpread({}, _default); | ||
@@ -212,3 +231,2 @@ WINDOW.FontAwesomeConfig = config; | ||
var w = WINDOW || {}; | ||
if (!w[NAMESPACE_IDENTIFIER]) w[NAMESPACE_IDENTIFIER] = {}; | ||
@@ -218,6 +236,6 @@ if (!w[NAMESPACE_IDENTIFIER].styles) w[NAMESPACE_IDENTIFIER].styles = {}; | ||
if (!w[NAMESPACE_IDENTIFIER].shims) w[NAMESPACE_IDENTIFIER].shims = []; | ||
var namespace = w[NAMESPACE_IDENTIFIER]; | ||
var functions = []; | ||
var listener = function listener() { | ||
@@ -235,13 +253,11 @@ DOCUMENT.removeEventListener('DOMContentLoaded', listener); | ||
loaded = (DOCUMENT.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(DOCUMENT.readyState); | ||
if (!loaded) DOCUMENT.addEventListener('DOMContentLoaded', listener); | ||
} | ||
var domready = function (fn) { | ||
function domready (fn) { | ||
if (!IS_DOM) return; | ||
loaded ? setTimeout(fn, 0) : functions.push(fn); | ||
}; | ||
} | ||
var d = UNITS_IN_GRID; | ||
var meaninglessTransform = { | ||
@@ -259,5 +275,2 @@ size: 16, | ||
} | ||
function insertCss(css) { | ||
@@ -271,3 +284,2 @@ if (!css || !IS_DOM) { | ||
style.innerHTML = css; | ||
var headChildren = DOCUMENT.head.childNodes; | ||
@@ -279,2 +291,3 @@ var beforeChild = null; | ||
var tagName = (child.tagName || '').toUpperCase(); | ||
if (['STYLE', 'LINK'].indexOf(tagName) > -1) { | ||
@@ -286,17 +299,15 @@ beforeChild = child; | ||
DOCUMENT.head.insertBefore(style, beforeChild); | ||
return css; | ||
} | ||
var idPool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | ||
function nextUniqueId() { | ||
var size = 12; | ||
var id = ''; | ||
while (size-- > 0) { | ||
id += idPool[Math.random() * 62 | 0]; | ||
} | ||
return id; | ||
} | ||
function toArray(obj) { | ||
@@ -311,3 +322,2 @@ var array = []; | ||
} | ||
function classArray(node) { | ||
@@ -322,3 +332,2 @@ if (node.classList) { | ||
} | ||
function getIconName(familyPrefix, cls) { | ||
@@ -335,23 +344,18 @@ var parts = cls.split('-'); | ||
} | ||
function htmlEscape(str) { | ||
return ('' + str).replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>'); | ||
return "".concat(str).replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>'); | ||
} | ||
function joinAttributes(attributes) { | ||
return Object.keys(attributes || {}).reduce(function (acc, attributeName) { | ||
return acc + (attributeName + '="' + htmlEscape(attributes[attributeName]) + '" '); | ||
return acc + "".concat(attributeName, "=\"").concat(htmlEscape(attributes[attributeName]), "\" "); | ||
}, '').trim(); | ||
} | ||
function joinStyles(styles) { | ||
return Object.keys(styles || {}).reduce(function (acc, styleName) { | ||
return acc + (styleName + ': ' + styles[styleName] + ';'); | ||
return acc + "".concat(styleName, ": ").concat(styles[styleName], ";"); | ||
}, ''); | ||
} | ||
function transformIsMeaningful(transform) { | ||
return transform.size !== meaninglessTransform.size || transform.x !== meaninglessTransform.x || transform.y !== meaninglessTransform.y || transform.rotate !== meaninglessTransform.rotate || transform.flipX || transform.flipY; | ||
} | ||
function transformForSvg(_ref) { | ||
@@ -361,14 +365,13 @@ var transform = _ref.transform, | ||
iconWidth = _ref.iconWidth; | ||
var outer = { | ||
transform: 'translate(' + containerWidth / 2 + ' 256)' | ||
transform: "translate(".concat(containerWidth / 2, " 256)") | ||
}; | ||
var innerTranslate = 'translate(' + transform.x * 32 + ', ' + transform.y * 32 + ') '; | ||
var innerScale = 'scale(' + transform.size / 16 * (transform.flipX ? -1 : 1) + ', ' + transform.size / 16 * (transform.flipY ? -1 : 1) + ') '; | ||
var innerRotate = 'rotate(' + transform.rotate + ' 0 0)'; | ||
var innerTranslate = "translate(".concat(transform.x * 32, ", ").concat(transform.y * 32, ") "); | ||
var innerScale = "scale(".concat(transform.size / 16 * (transform.flipX ? -1 : 1), ", ").concat(transform.size / 16 * (transform.flipY ? -1 : 1), ") "); | ||
var innerRotate = "rotate(".concat(transform.rotate, " 0 0)"); | ||
var inner = { | ||
transform: innerTranslate + ' ' + innerScale + ' ' + innerRotate | ||
transform: "".concat(innerTranslate, " ").concat(innerScale, " ").concat(innerRotate) | ||
}; | ||
var path = { | ||
transform: 'translate(' + iconWidth / 2 * -1 + ' -256)' | ||
transform: "translate(".concat(iconWidth / 2 * -1, " -256)") | ||
}; | ||
@@ -381,25 +384,22 @@ return { | ||
} | ||
function transformForCss(_ref2) { | ||
var transform = _ref2.transform, | ||
_ref2$width = _ref2.width, | ||
width = _ref2$width === undefined ? UNITS_IN_GRID : _ref2$width, | ||
width = _ref2$width === void 0 ? UNITS_IN_GRID : _ref2$width, | ||
_ref2$height = _ref2.height, | ||
height = _ref2$height === undefined ? UNITS_IN_GRID : _ref2$height, | ||
height = _ref2$height === void 0 ? UNITS_IN_GRID : _ref2$height, | ||
_ref2$startCentered = _ref2.startCentered, | ||
startCentered = _ref2$startCentered === undefined ? false : _ref2$startCentered; | ||
startCentered = _ref2$startCentered === void 0 ? false : _ref2$startCentered; | ||
var val = ''; | ||
if (startCentered && IS_IE) { | ||
val += 'translate(' + (transform.x / d - width / 2) + 'em, ' + (transform.y / d - height / 2) + 'em) '; | ||
val += "translate(".concat(transform.x / d - width / 2, "em, ").concat(transform.y / d - height / 2, "em) "); | ||
} else if (startCentered) { | ||
val += 'translate(calc(-50% + ' + transform.x / d + 'em), calc(-50% + ' + transform.y / d + 'em)) '; | ||
val += "translate(calc(-50% + ".concat(transform.x / d, "em), calc(-50% + ").concat(transform.y / d, "em)) "); | ||
} else { | ||
val += 'translate(' + transform.x / d + 'em, ' + transform.y / d + 'em) '; | ||
val += "translate(".concat(transform.x / d, "em, ").concat(transform.y / d, "em) "); | ||
} | ||
val += 'scale(' + transform.size / d * (transform.flipX ? -1 : 1) + ', ' + transform.size / d * (transform.flipY ? -1 : 1) + ') '; | ||
val += 'rotate(' + transform.rotate + 'deg) '; | ||
val += "scale(".concat(transform.size / d * (transform.flipX ? -1 : 1), ", ").concat(transform.size / d * (transform.flipY ? -1 : 1), ") "); | ||
val += "rotate(".concat(transform.rotate, "deg) "); | ||
return val; | ||
@@ -414,4 +414,3 @@ } | ||
}; | ||
var makeIconMasking = function (_ref) { | ||
function makeIconMasking (_ref) { | ||
var children = _ref.children, | ||
@@ -426,9 +425,10 @@ attributes = _ref.attributes, | ||
maskPath = mask.icon; | ||
var trans = transformForSvg({ transform: transform, containerWidth: maskWidth, iconWidth: mainWidth }); | ||
var trans = transformForSvg({ | ||
transform: transform, | ||
containerWidth: maskWidth, | ||
iconWidth: mainWidth | ||
}); | ||
var maskRect = { | ||
tag: 'rect', | ||
attributes: _extends({}, ALL_SPACE, { | ||
attributes: _objectSpread({}, ALL_SPACE, { | ||
fill: 'white' | ||
@@ -439,15 +439,20 @@ }) | ||
tag: 'g', | ||
attributes: _extends({}, trans.inner), | ||
children: [{ tag: 'path', attributes: _extends({}, mainPath.attributes, trans.path, { fill: 'black' }) }] | ||
attributes: _objectSpread({}, trans.inner), | ||
children: [{ | ||
tag: 'path', | ||
attributes: _objectSpread({}, mainPath.attributes, trans.path, { | ||
fill: 'black' | ||
}) | ||
}] | ||
}; | ||
var maskOuterGroup = { | ||
tag: 'g', | ||
attributes: _extends({}, trans.outer), | ||
attributes: _objectSpread({}, trans.outer), | ||
children: [maskInnerGroup] | ||
}; | ||
var maskId = 'mask-' + nextUniqueId(); | ||
var clipId = 'clip-' + nextUniqueId(); | ||
var maskId = "mask-".concat(nextUniqueId()); | ||
var clipId = "clip-".concat(nextUniqueId()); | ||
var maskTag = { | ||
tag: 'mask', | ||
attributes: _extends({}, ALL_SPACE, { | ||
attributes: _objectSpread({}, ALL_SPACE, { | ||
id: maskId, | ||
@@ -461,7 +466,18 @@ maskUnits: 'userSpaceOnUse', | ||
tag: 'defs', | ||
children: [{ tag: 'clipPath', attributes: { id: clipId }, children: [maskPath] }, maskTag] | ||
children: [{ | ||
tag: 'clipPath', | ||
attributes: { | ||
id: clipId | ||
}, | ||
children: [maskPath] | ||
}, maskTag] | ||
}; | ||
children.push(defs, { tag: 'rect', attributes: _extends({ fill: 'currentColor', 'clip-path': 'url(#' + clipId + ')', mask: 'url(#' + maskId + ')' }, ALL_SPACE) }); | ||
children.push(defs, { | ||
tag: 'rect', | ||
attributes: _objectSpread({ | ||
fill: 'currentColor', | ||
'clip-path': "url(#".concat(clipId, ")"), | ||
mask: "url(#".concat(maskId, ")") | ||
}, ALL_SPACE) | ||
}); | ||
return { | ||
@@ -471,5 +487,5 @@ children: children, | ||
}; | ||
}; | ||
} | ||
var makeIconStandard = function (_ref) { | ||
function makeIconStandard (_ref) { | ||
var children = _ref.children, | ||
@@ -480,3 +496,2 @@ attributes = _ref.attributes, | ||
styles = _ref.styles; | ||
var styleString = joinStyles(styles); | ||
@@ -489,13 +504,17 @@ | ||
if (transformIsMeaningful(transform)) { | ||
var trans = transformForSvg({ transform: transform, containerWidth: main.width, iconWidth: main.width }); | ||
var trans = transformForSvg({ | ||
transform: transform, | ||
containerWidth: main.width, | ||
iconWidth: main.width | ||
}); | ||
children.push({ | ||
tag: 'g', | ||
attributes: _extends({}, trans.outer), | ||
attributes: _objectSpread({}, trans.outer), | ||
children: [{ | ||
tag: 'g', | ||
attributes: _extends({}, trans.inner), | ||
attributes: _objectSpread({}, trans.inner), | ||
children: [{ | ||
tag: main.icon.tag, | ||
children: main.icon.children, | ||
attributes: _extends({}, main.icon.attributes, trans.path) | ||
attributes: _objectSpread({}, main.icon.attributes, trans.path) | ||
}] | ||
@@ -512,5 +531,5 @@ }] | ||
}; | ||
}; | ||
} | ||
var asIcon = function (_ref) { | ||
function asIcon (_ref) { | ||
var children = _ref.children, | ||
@@ -526,3 +545,2 @@ main = _ref.main, | ||
height = main.height; | ||
var offset = { | ||
@@ -532,4 +550,4 @@ x: width / height / 2, | ||
}; | ||
attributes['style'] = joinStyles(_extends({}, styles, { | ||
'transform-origin': offset.x + transform.x / 16 + 'em ' + (offset.y + transform.y / 16) + 'em' | ||
attributes['style'] = joinStyles(_objectSpread({}, styles, { | ||
'transform-origin': "".concat(offset.x + transform.x / 16, "em ").concat(offset.y + transform.y / 16, "em") | ||
})); | ||
@@ -543,5 +561,5 @@ } | ||
}]; | ||
}; | ||
} | ||
var asSymbol = function (_ref) { | ||
function asSymbol (_ref) { | ||
var prefix = _ref.prefix, | ||
@@ -552,5 +570,3 @@ iconName = _ref.iconName, | ||
symbol = _ref.symbol; | ||
var id = symbol === true ? prefix + '-' + config.familyPrefix + '-' + iconName : symbol; | ||
var id = symbol === true ? "".concat(prefix, "-").concat(config.familyPrefix, "-").concat(iconName) : symbol; | ||
return [{ | ||
@@ -563,7 +579,9 @@ tag: 'svg', | ||
tag: 'symbol', | ||
attributes: _extends({}, attributes, { id: id }), | ||
attributes: _objectSpread({}, attributes, { | ||
id: id | ||
}), | ||
children: children | ||
}] | ||
}]; | ||
}; | ||
} | ||
@@ -581,3 +599,3 @@ function makeInlineSvgAbstract(params) { | ||
_params$watchable = params.watchable, | ||
watchable = _params$watchable === undefined ? false : _params$watchable; | ||
watchable = _params$watchable === void 0 ? false : _params$watchable; | ||
@@ -588,10 +606,9 @@ var _ref = mask.found ? mask : main, | ||
var widthClass = 'fa-w-' + Math.ceil(width / height * 16); | ||
var attrClass = [config.replacementClass, iconName ? config.familyPrefix + '-' + iconName : '', widthClass].filter(function (c) { | ||
var widthClass = "fa-w-".concat(Math.ceil(width / height * 16)); | ||
var attrClass = [config.replacementClass, iconName ? "".concat(config.familyPrefix, "-").concat(iconName) : '', widthClass].filter(function (c) { | ||
return extra.classes.indexOf(c) === -1; | ||
}).concat(extra.classes).join(' '); | ||
var content = { | ||
children: [], | ||
attributes: _extends({}, extra.attributes, { | ||
attributes: _objectSpread({}, extra.attributes, { | ||
'data-prefix': prefix, | ||
@@ -602,3 +619,3 @@ 'data-icon': iconName, | ||
'xmlns': 'http://www.w3.org/2000/svg', | ||
'viewBox': '0 0 ' + width + ' ' + height | ||
'viewBox': "0 0 ".concat(width, " ").concat(height) | ||
}) | ||
@@ -611,5 +628,11 @@ }; | ||
if (title) content.children.push({ tag: 'title', attributes: { id: content.attributes['aria-labelledby'] || 'title-' + nextUniqueId() }, children: [title] }); | ||
if (title) content.children.push({ | ||
tag: 'title', | ||
attributes: { | ||
id: content.attributes['aria-labelledby'] || "title-".concat(nextUniqueId()) | ||
}, | ||
children: [title] | ||
}); | ||
var args = _extends({}, content, { | ||
var args = _objectSpread({}, content, { | ||
prefix: prefix, | ||
@@ -637,3 +660,2 @@ iconName: iconName, | ||
} | ||
function makeLayersTextAbstract(params) { | ||
@@ -647,6 +669,7 @@ var content = params.content, | ||
_params$watchable2 = params.watchable, | ||
watchable = _params$watchable2 === undefined ? false : _params$watchable2; | ||
watchable = _params$watchable2 === void 0 ? false : _params$watchable2; | ||
var attributes = _extends({}, extra.attributes, title ? { 'title': title } : {}, { | ||
var attributes = _objectSpread({}, extra.attributes, title ? { | ||
'title': title | ||
} : {}, { | ||
'class': extra.classes.join(' ') | ||
@@ -659,6 +682,11 @@ }); | ||
var styles = _extends({}, extra.styles); | ||
var styles = _objectSpread({}, extra.styles); | ||
if (transformIsMeaningful(transform)) { | ||
styles['transform'] = transformForCss({ transform: transform, startCentered: true, width: width, height: height }); | ||
styles['transform'] = transformForCss({ | ||
transform: transform, | ||
startCentered: true, | ||
width: width, | ||
height: height | ||
}); | ||
styles['-webkit-transform'] = styles['transform']; | ||
@@ -674,3 +702,2 @@ } | ||
var val = []; | ||
val.push({ | ||
@@ -683,3 +710,9 @@ tag: 'span', | ||
if (title) { | ||
val.push({ tag: 'span', attributes: { class: 'sr-only' }, children: [title] }); | ||
val.push({ | ||
tag: 'span', | ||
attributes: { | ||
class: 'sr-only' | ||
}, | ||
children: [title] | ||
}); | ||
} | ||
@@ -689,3 +722,2 @@ | ||
} | ||
function makeLayersCounterAbstract(params) { | ||
@@ -696,4 +728,5 @@ var content = params.content, | ||
var attributes = _extends({}, extra.attributes, title ? { 'title': title } : {}, { | ||
var attributes = _objectSpread({}, extra.attributes, title ? { | ||
'title': title | ||
} : {}, { | ||
'class': extra.classes.join(' ') | ||
@@ -709,3 +742,2 @@ }); | ||
var val = []; | ||
val.push({ | ||
@@ -718,3 +750,9 @@ tag: 'span', | ||
if (title) { | ||
val.push({ tag: 'span', attributes: { class: 'sr-only' }, children: [title] }); | ||
val.push({ | ||
tag: 'span', | ||
attributes: { | ||
class: 'sr-only' | ||
}, | ||
children: [title] | ||
}); | ||
} | ||
@@ -725,8 +763,12 @@ | ||
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.5.0"'; | ||
var noop$1 = function noop() {}; | ||
var p = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : { | ||
mark: noop$1, | ||
measure: noop$1 | ||
}; | ||
var preamble = "FA \"5.6.0\""; | ||
var begin = function begin(name) { | ||
p.mark(preamble + ' ' + name + ' begins'); | ||
p.mark("".concat(preamble, " ").concat(name, " begins")); | ||
return function () { | ||
@@ -738,10 +780,11 @@ return end(name); | ||
var end = function end(name) { | ||
p.mark(preamble + ' ' + name + ' ends'); | ||
p.measure(preamble + ' ' + name, preamble + ' ' + name + ' begins', preamble + ' ' + name + ' ends'); | ||
p.mark("".concat(preamble, " ").concat(name, " ends")); | ||
p.measure("".concat(preamble, " ").concat(name), "".concat(preamble, " ").concat(name, " begins"), "".concat(preamble, " ").concat(name, " ends")); | ||
}; | ||
var perf = { begin: begin, end: end }; | ||
var perf = { | ||
begin: begin, | ||
end: end | ||
}; | ||
'use strict'; | ||
/** | ||
@@ -757,6 +800,2 @@ * Internal helper to bind a function known to have 4 arguments | ||
'use strict'; | ||
/** | ||
@@ -796,13 +835,10 @@ * # Reduce | ||
var styles$2 = namespace.styles; | ||
var shims = namespace.shims; | ||
var styles = namespace.styles, | ||
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) { | ||
return reduce(styles, function (o, style, prefix) { | ||
o[prefix] = reduce(style, reducer, {}); | ||
@@ -815,20 +851,13 @@ return o; | ||
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; | ||
var hasRegular = 'far' in styles; | ||
_byOldName = reduce(shims, function (acc, shim) { | ||
@@ -843,29 +872,31 @@ var oldName = shim[0]; | ||
acc[oldName] = { prefix: prefix, iconName: iconName }; | ||
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 }; | ||
return _byOldName[name] || { | ||
prefix: null, | ||
iconName: null | ||
}; | ||
} | ||
var styles$1 = namespace.styles; | ||
var emptyCanonicalIcon = function emptyCanonicalIcon() { | ||
return { prefix: null, iconName: null, rest: [] }; | ||
return { | ||
prefix: null, | ||
iconName: null, | ||
rest: [] | ||
}; | ||
}; | ||
function getCanonicalIcon(values) { | ||
@@ -879,3 +910,2 @@ return values.reduce(function (acc, cls) { | ||
var shim = acc.prefix === 'fa' ? byOldName(iconName) : {}; | ||
acc.iconName = shim.iconName || iconName; | ||
@@ -890,3 +920,2 @@ acc.prefix = shim.prefix || acc.prefix; | ||
} | ||
function iconFromMapping(mapping, prefix, iconName) { | ||
@@ -905,19 +934,17 @@ if (mapping && mapping[prefix] && mapping[prefix][iconName]) { | ||
_abstractNodes$attrib = abstractNodes.attributes, | ||
attributes = _abstractNodes$attrib === undefined ? {} : _abstractNodes$attrib, | ||
attributes = _abstractNodes$attrib === void 0 ? {} : _abstractNodes$attrib, | ||
_abstractNodes$childr = abstractNodes.children, | ||
children = _abstractNodes$childr === undefined ? [] : _abstractNodes$childr; | ||
children = _abstractNodes$childr === void 0 ? [] : _abstractNodes$childr; | ||
if (typeof abstractNodes === 'string') { | ||
return htmlEscape(abstractNodes); | ||
} else { | ||
return '<' + tag + ' ' + joinAttributes(attributes) + '>' + children.map(toHtml).join('') + '</' + tag + '>'; | ||
return "<".concat(tag, " ").concat(joinAttributes(attributes), ">").concat(children.map(toHtml).join(''), "</").concat(tag, ">"); | ||
} | ||
} | ||
var noop$1 = function noop() {}; | ||
var noop$2 = function noop() {}; | ||
function isWatched(node) { | ||
var i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null; | ||
return typeof i2svg === 'string'; | ||
@@ -932,3 +959,2 @@ } | ||
var mutator = mutators[config.autoReplaceSvg]; | ||
return mutator || mutators.replace; | ||
@@ -946,3 +972,3 @@ } | ||
if (node.parentNode && node.outerHTML) { | ||
node.outerHTML = newOuterHTML + (config.keepOriginalSource && node.tagName.toLowerCase() !== 'svg' ? '<!-- ' + node.outerHTML + ' -->' : ''); | ||
node.outerHTML = newOuterHTML + (config.keepOriginalSource && node.tagName.toLowerCase() !== 'svg' ? "<!-- ".concat(node.outerHTML, " -->") : ''); | ||
} else if (node.parentNode) { | ||
@@ -956,6 +982,5 @@ var newNode = document.createElement('span'); | ||
var node = mutation[0]; | ||
var abstract = mutation[1]; | ||
var abstract = mutation[1]; // If we already have a replaced node we do not want to continue nesting within it. | ||
// Short-circuit to the standard replacement | ||
// If we already have a replaced node we do not want to continue nesting within it. | ||
// Short-circuit to the standard replacement | ||
if (~classArray(node).indexOf(config.replacementClass)) { | ||
@@ -965,6 +990,4 @@ return mutators.replace(mutation); | ||
var forSvg = new RegExp(config.familyPrefix + '-.*'); | ||
var forSvg = new RegExp("".concat(config.familyPrefix, "-.*")); | ||
delete abstract[0].attributes.style; | ||
var splitClasses = abstract[0].attributes.class.split(' ').reduce(function (acc, cls) { | ||
@@ -978,6 +1001,7 @@ if (cls === config.replacementClass || cls.match(forSvg)) { | ||
return acc; | ||
}, { toNode: [], toSvg: [] }); | ||
}, { | ||
toNode: [], | ||
toSvg: [] | ||
}); | ||
abstract[0].attributes.class = splitClasses.toSvg.join(' '); | ||
var newInnerHTML = abstract.map(function (a) { | ||
@@ -991,5 +1015,4 @@ return toHtml(a); | ||
}; | ||
function perform(mutations, callback) { | ||
var callbackFunction = typeof callback === 'function' ? callback : noop$1; | ||
var callbackFunction = typeof callback === 'function' ? callback : noop$2; | ||
@@ -1006,7 +1029,4 @@ if (mutations.length === 0) { | ||
var mark = perf.begin('mutate'); | ||
mutations.map(mutator); | ||
mark(); | ||
callbackFunction(); | ||
@@ -1016,5 +1036,3 @@ }); | ||
} | ||
var disabled = false; | ||
function disableObservation(operation) { | ||
@@ -1025,5 +1043,3 @@ disabled = true; | ||
} | ||
var mo = null; | ||
function observe(options) { | ||
@@ -1042,8 +1058,5 @@ if (!MUTATION_OBSERVER) { | ||
_options$observeMutat = options.observeMutationsRoot, | ||
observeMutationsRoot = _options$observeMutat === undefined ? DOCUMENT.body : _options$observeMutat; | ||
observeMutationsRoot = _options$observeMutat === void 0 ? DOCUMENT.body : _options$observeMutat; | ||
mo = new MUTATION_OBSERVER(function (objects) { | ||
if (disabled) return; | ||
toArray(objects).forEach(function (mutationRecord) { | ||
@@ -1076,19 +1089,17 @@ if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) { | ||
}); | ||
if (!IS_DOM) return; | ||
mo.observe(observeMutationsRoot, { | ||
childList: true, attributes: true, characterData: true, subtree: true | ||
childList: true, | ||
attributes: true, | ||
characterData: true, | ||
subtree: true | ||
}); | ||
} | ||
function disconnect() { | ||
if (!mo) return; | ||
mo.disconnect(); | ||
} | ||
var styleParser = function (node) { | ||
function styleParser (node) { | ||
var style = node.getAttribute('style'); | ||
var val = []; | ||
@@ -1111,3 +1122,3 @@ | ||
return val; | ||
}; | ||
} | ||
@@ -1125,7 +1136,6 @@ function toHex(unicode) { | ||
var classParser = function (node) { | ||
function classParser (node) { | ||
var existingPrefix = node.getAttribute('data-prefix'); | ||
var existingIconName = node.getAttribute('data-icon'); | ||
var innerText = node.innerText !== undefined ? node.innerText.trim() : ''; | ||
var val = getCanonicalIcon(classArray(node)); | ||
@@ -1145,3 +1155,3 @@ | ||
return val; | ||
}; | ||
} | ||
@@ -1186,17 +1196,23 @@ var parseTransformString = function parseTransformString(transformString) { | ||
break; | ||
case 'shrink': | ||
acc.size = acc.size - rest; | ||
break; | ||
case 'left': | ||
acc.x = acc.x - rest; | ||
break; | ||
case 'right': | ||
acc.x = acc.x + rest; | ||
break; | ||
case 'up': | ||
acc.y = acc.y - rest; | ||
break; | ||
case 'down': | ||
acc.y = acc.y + rest; | ||
break; | ||
case 'rotate': | ||
@@ -1211,14 +1227,12 @@ acc.rotate = acc.rotate + rest; | ||
}; | ||
var transformParser = function (node) { | ||
function transformParser (node) { | ||
return parseTransformString(node.getAttribute('data-fa-transform')); | ||
}; | ||
} | ||
var symbolParser = function (node) { | ||
function symbolParser (node) { | ||
var symbol = node.getAttribute('data-fa-symbol'); | ||
return symbol === null ? false : symbol === '' ? true : symbol; | ||
}; | ||
} | ||
var attributesParser = function (node) { | ||
function attributesParser (node) { | ||
var extraAttributes = toArray(node.attributes).reduce(function (acc, attr) { | ||
@@ -1228,5 +1242,5 @@ if (acc.name !== 'class' && acc.name !== 'style') { | ||
} | ||
return acc; | ||
}, {}); | ||
var title = node.getAttribute('title'); | ||
@@ -1236,3 +1250,3 @@ | ||
if (title) { | ||
extraAttributes['aria-labelledby'] = config.replacementClass + '-title-' + nextUniqueId(); | ||
extraAttributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(nextUniqueId()); | ||
} else { | ||
@@ -1244,5 +1258,5 @@ extraAttributes['aria-hidden'] = 'true'; | ||
return extraAttributes; | ||
}; | ||
} | ||
var maskParser = function (node) { | ||
function maskParser (node) { | ||
var mask = node.getAttribute('data-fa-mask'); | ||
@@ -1257,3 +1271,3 @@ | ||
} | ||
}; | ||
} | ||
@@ -1267,5 +1281,8 @@ var blankMeta = { | ||
mask: null, | ||
extra: { classes: [], styles: {}, attributes: {} } | ||
extra: { | ||
classes: [], | ||
styles: {}, | ||
attributes: {} | ||
} | ||
}; | ||
function parseMeta(node) { | ||
@@ -1282,3 +1299,2 @@ var _classParser = classParser(node), | ||
var mask = maskParser(node); | ||
return { | ||
@@ -1304,7 +1320,8 @@ iconName: iconName, | ||
} | ||
MissingIcon.prototype = Object.create(Error.prototype); | ||
MissingIcon.prototype.constructor = MissingIcon; | ||
var FILL = { fill: 'currentColor' }; | ||
var FILL = { | ||
fill: 'currentColor' | ||
}; | ||
var ANIMATION_BASE = { | ||
@@ -1317,12 +1334,14 @@ attributeType: 'XML', | ||
tag: 'path', | ||
attributes: _extends({}, FILL, { | ||
attributes: _objectSpread({}, FILL, { | ||
d: 'M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z' | ||
}) | ||
}; | ||
var OPACITY_ANIMATE = _extends({}, ANIMATION_BASE, { | ||
var OPACITY_ANIMATE = _objectSpread({}, ANIMATION_BASE, { | ||
attributeName: 'opacity' | ||
}); | ||
var DOT = { | ||
tag: 'circle', | ||
attributes: _extends({}, FILL, { | ||
attributes: _objectSpread({}, FILL, { | ||
cx: '256', | ||
@@ -1332,25 +1351,47 @@ cy: '364', | ||
}), | ||
children: [{ tag: 'animate', attributes: _extends({}, ANIMATION_BASE, { attributeName: 'r', values: '28;14;28;28;14;28;' }) }, { tag: 'animate', attributes: _extends({}, OPACITY_ANIMATE, { values: '1;0;1;1;0;1;' }) }] | ||
children: [{ | ||
tag: 'animate', | ||
attributes: _objectSpread({}, ANIMATION_BASE, { | ||
attributeName: 'r', | ||
values: '28;14;28;28;14;28;' | ||
}) | ||
}, { | ||
tag: 'animate', | ||
attributes: _objectSpread({}, OPACITY_ANIMATE, { | ||
values: '1;0;1;1;0;1;' | ||
}) | ||
}] | ||
}; | ||
var QUESTION = { | ||
tag: 'path', | ||
attributes: _extends({}, FILL, { | ||
attributes: _objectSpread({}, FILL, { | ||
opacity: '1', | ||
d: 'M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z' | ||
}), | ||
children: [{ tag: 'animate', attributes: _extends({}, OPACITY_ANIMATE, { values: '1;0;0;0;0;1;' }) }] | ||
children: [{ | ||
tag: 'animate', | ||
attributes: _objectSpread({}, OPACITY_ANIMATE, { | ||
values: '1;0;0;0;0;1;' | ||
}) | ||
}] | ||
}; | ||
var EXCLAMATION = { | ||
tag: 'path', | ||
attributes: _extends({}, FILL, { | ||
attributes: _objectSpread({}, FILL, { | ||
opacity: '0', | ||
d: 'M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z' | ||
}), | ||
children: [{ tag: 'animate', attributes: _extends({}, OPACITY_ANIMATE, { values: '0;0;1;1;0;0;' }) }] | ||
children: [{ | ||
tag: 'animate', | ||
attributes: _objectSpread({}, OPACITY_ANIMATE, { | ||
values: '0;0;1;1;0;0;' | ||
}) | ||
}] | ||
}; | ||
var missing = { | ||
tag: 'g', | ||
children: [RING, DOT, QUESTION, EXCLAMATION] | ||
}; | ||
var missing = { tag: 'g', children: [RING, DOT, QUESTION, EXCLAMATION] }; | ||
var styles = namespace.styles; | ||
var styles$2 = namespace.styles; | ||
var LAYERS_TEXT_CLASSNAME = 'fa-layers-text'; | ||
@@ -1378,8 +1419,7 @@ var FONT_FAMILY_PATTERN = /Font Awesome 5 (Solid|Regular|Light|Brands|Free|Pro)/; | ||
if (iconName && prefix && styles[prefix] && styles[prefix][iconName]) { | ||
var icon = styles[prefix][iconName]; | ||
if (iconName && prefix && styles$2[prefix] && styles$2[prefix][iconName]) { | ||
var icon = styles$2[prefix][iconName]; | ||
var width = icon[0]; | ||
var height = icon[1]; | ||
var vectorData = icon.slice(4); | ||
val = { | ||
@@ -1389,6 +1429,12 @@ found: true, | ||
height: height, | ||
icon: { tag: 'path', attributes: { fill: 'currentColor', d: vectorData[0] } } | ||
icon: { | ||
tag: 'path', | ||
attributes: { | ||
fill: 'currentColor', | ||
d: vectorData[0] | ||
} | ||
} | ||
}; | ||
} else if (iconName && prefix && !config.showMissingIcons) { | ||
throw new MissingIcon('Icon is missing for prefix ' + prefix + ' with icon name ' + iconName); | ||
throw new MissingIcon("Icon is missing for prefix ".concat(prefix, " with icon name ").concat(iconName)); | ||
} | ||
@@ -1407,4 +1453,2 @@ | ||
extra = nodeMeta.extra; | ||
return [node, makeInlineSvgAbstract({ | ||
@@ -1430,4 +1474,2 @@ icons: { | ||
extra = nodeMeta.extra; | ||
var width = null; | ||
@@ -1470,5 +1512,3 @@ var height = null; | ||
if (!IS_DOM) return; | ||
var end = perf.begin('searchPseudoElements'); | ||
disableObservation(function () { | ||
@@ -1483,3 +1523,2 @@ toArray(root.querySelectorAll('*')).filter(function (n) { | ||
})[0]; | ||
var styles = WINDOW.getComputedStyle(node, pos); | ||
@@ -1497,5 +1536,5 @@ var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN); | ||
var prefix = ~['Light', 'Regular', 'Solid', 'Brands'].indexOf(fontFamily[1]) ? STYLE_TO_PREFIX[fontFamily[1]] : FONT_WEIGHT_TO_PREFIX[fontWeight]; | ||
var iconName = byUnicode(prefix, toHex(content.length === 3 ? content.substr(1, 1) : content)); | ||
// Only convert the pseudo element in this :before/:after position into an icon if we haven't | ||
var iconName = byUnicode(prefix, toHex(content.length === 3 ? content.substr(1, 1) : content)); // Only convert the pseudo element in this :before/:after position into an icon if we haven't | ||
// already done so with the same prefix and iconName | ||
if (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconName) { | ||
@@ -1508,5 +1547,4 @@ if (alreadyProcessedPseudoElement) { | ||
var extra = blankMeta.extra; | ||
extra.attributes[DATA_FA_PSEUDO_ELEMENT] = pos; | ||
var abstract = makeInlineSvgAbstract(_extends({}, blankMeta, { | ||
var abstract = makeInlineSvgAbstract(_objectSpread({}, blankMeta, { | ||
icons: { | ||
@@ -1521,3 +1559,2 @@ main: findIcon(iconName, prefix), | ||
})); | ||
var element = DOCUMENT.createElement('svg'); | ||
@@ -1539,21 +1576,20 @@ | ||
}); | ||
end(); | ||
} | ||
function onTree(root) { | ||
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
if (!IS_DOM) return; | ||
var htmlClassList = DOCUMENT.documentElement.classList; | ||
var htmlClassList = DOCUMENT.documentElement.classList; | ||
var hclAdd = function hclAdd(suffix) { | ||
return htmlClassList.add(HTML_CLASS_I2SVG_BASE_CLASS + '-' + suffix); | ||
return htmlClassList.add("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix)); | ||
}; | ||
var hclRemove = function hclRemove(suffix) { | ||
return htmlClassList.remove(HTML_CLASS_I2SVG_BASE_CLASS + '-' + suffix); | ||
return htmlClassList.remove("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix)); | ||
}; | ||
var prefixes = Object.keys(styles); | ||
var prefixesDomQuery = ['.' + LAYERS_TEXT_CLASSNAME + ':not([' + DATA_FA_I2SVG + '])'].concat(prefixes.map(function (p) { | ||
return '.' + p + ':not([' + DATA_FA_I2SVG + '])'; | ||
var prefixes = Object.keys(styles$2); | ||
var prefixesDomQuery = [".".concat(LAYERS_TEXT_CLASSNAME, ":not([").concat(DATA_FA_I2SVG, "])")].concat(prefixes.map(function (p) { | ||
return ".".concat(p, ":not([").concat(DATA_FA_I2SVG, "])"); | ||
})).join(', '); | ||
@@ -1575,3 +1611,2 @@ | ||
var mark = perf.begin('onTree'); | ||
var mutations = candidates.reduce(function (acc, node) { | ||
@@ -1594,5 +1629,3 @@ try { | ||
}, []); | ||
mark(); | ||
perform(mutations, function () { | ||
@@ -1602,10 +1635,7 @@ hclAdd('active'); | ||
hclRemove('pending'); | ||
if (typeof callback === 'function') callback(); | ||
}); | ||
} | ||
function onNode(node) { | ||
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
var mutation = generateMutation(node); | ||
@@ -1618,5 +1648,5 @@ | ||
var baseStyles = "svg:not(:root).svg-inline--fa {\n overflow: visible; }\n\n.svg-inline--fa {\n display: inline-block;\n font-size: inherit;\n height: 1em;\n overflow: visible;\n vertical-align: -.125em; }\n .svg-inline--fa.fa-lg {\n vertical-align: -.225em; }\n .svg-inline--fa.fa-w-1 {\n width: 0.0625em; }\n .svg-inline--fa.fa-w-2 {\n width: 0.125em; }\n .svg-inline--fa.fa-w-3 {\n width: 0.1875em; }\n .svg-inline--fa.fa-w-4 {\n width: 0.25em; }\n .svg-inline--fa.fa-w-5 {\n width: 0.3125em; }\n .svg-inline--fa.fa-w-6 {\n width: 0.375em; }\n .svg-inline--fa.fa-w-7 {\n width: 0.4375em; }\n .svg-inline--fa.fa-w-8 {\n width: 0.5em; }\n .svg-inline--fa.fa-w-9 {\n width: 0.5625em; }\n .svg-inline--fa.fa-w-10 {\n width: 0.625em; }\n .svg-inline--fa.fa-w-11 {\n width: 0.6875em; }\n .svg-inline--fa.fa-w-12 {\n width: 0.75em; }\n .svg-inline--fa.fa-w-13 {\n width: 0.8125em; }\n .svg-inline--fa.fa-w-14 {\n width: 0.875em; }\n .svg-inline--fa.fa-w-15 {\n width: 0.9375em; }\n .svg-inline--fa.fa-w-16 {\n width: 1em; }\n .svg-inline--fa.fa-w-17 {\n width: 1.0625em; }\n .svg-inline--fa.fa-w-18 {\n width: 1.125em; }\n .svg-inline--fa.fa-w-19 {\n width: 1.1875em; }\n .svg-inline--fa.fa-w-20 {\n width: 1.25em; }\n .svg-inline--fa.fa-pull-left {\n margin-right: .3em;\n width: auto; }\n .svg-inline--fa.fa-pull-right {\n margin-left: .3em;\n width: auto; }\n .svg-inline--fa.fa-border {\n height: 1.5em; }\n .svg-inline--fa.fa-li {\n width: 2em; }\n .svg-inline--fa.fa-fw {\n width: 1.25em; }\n\n.fa-layers svg.svg-inline--fa {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0; }\n\n.fa-layers {\n display: inline-block;\n height: 1em;\n position: relative;\n text-align: center;\n vertical-align: -.125em;\n width: 1em; }\n .fa-layers svg.svg-inline--fa {\n -webkit-transform-origin: center center;\n transform-origin: center center; }\n\n.fa-layers-text, .fa-layers-counter {\n display: inline-block;\n position: absolute;\n text-align: center; }\n\n.fa-layers-text {\n left: 50%;\n top: 50%;\n -webkit-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n -webkit-transform-origin: center center;\n transform-origin: center center; }\n\n.fa-layers-counter {\n background-color: #ff253a;\n border-radius: 1em;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n color: #fff;\n height: 1.5em;\n line-height: 1;\n max-width: 5em;\n min-width: 1.5em;\n overflow: hidden;\n padding: .25em;\n right: 0;\n text-overflow: ellipsis;\n top: 0;\n -webkit-transform: scale(0.25);\n transform: scale(0.25);\n -webkit-transform-origin: top right;\n transform-origin: top right; }\n\n.fa-layers-bottom-right {\n bottom: 0;\n right: 0;\n top: auto;\n -webkit-transform: scale(0.25);\n transform: scale(0.25);\n -webkit-transform-origin: bottom right;\n transform-origin: bottom right; }\n\n.fa-layers-bottom-left {\n bottom: 0;\n left: 0;\n right: auto;\n top: auto;\n -webkit-transform: scale(0.25);\n transform: scale(0.25);\n -webkit-transform-origin: bottom left;\n transform-origin: bottom left; }\n\n.fa-layers-top-right {\n right: 0;\n top: 0;\n -webkit-transform: scale(0.25);\n transform: scale(0.25);\n -webkit-transform-origin: top right;\n transform-origin: top right; }\n\n.fa-layers-top-left {\n left: 0;\n right: auto;\n top: 0;\n -webkit-transform: scale(0.25);\n transform: scale(0.25);\n -webkit-transform-origin: top left;\n transform-origin: top left; }\n\n.fa-lg {\n font-size: 1.33333em;\n line-height: 0.75em;\n vertical-align: -.0667em; }\n\n.fa-xs {\n font-size: .75em; }\n\n.fa-sm {\n font-size: .875em; }\n\n.fa-1x {\n font-size: 1em; }\n\n.fa-2x {\n font-size: 2em; }\n\n.fa-3x {\n font-size: 3em; }\n\n.fa-4x {\n font-size: 4em; }\n\n.fa-5x {\n font-size: 5em; }\n\n.fa-6x {\n font-size: 6em; }\n\n.fa-7x {\n font-size: 7em; }\n\n.fa-8x {\n font-size: 8em; }\n\n.fa-9x {\n font-size: 9em; }\n\n.fa-10x {\n font-size: 10em; }\n\n.fa-fw {\n text-align: center;\n width: 1.25em; }\n\n.fa-ul {\n list-style-type: none;\n margin-left: 2.5em;\n padding-left: 0; }\n .fa-ul > li {\n position: relative; }\n\n.fa-li {\n left: -2em;\n position: absolute;\n text-align: center;\n width: 2em;\n line-height: inherit; }\n\n.fa-border {\n border: solid 0.08em #eee;\n border-radius: .1em;\n padding: .2em .25em .15em; }\n\n.fa-pull-left {\n float: left; }\n\n.fa-pull-right {\n float: right; }\n\n.fa.fa-pull-left,\n.fas.fa-pull-left,\n.far.fa-pull-left,\n.fal.fa-pull-left,\n.fab.fa-pull-left {\n margin-right: .3em; }\n\n.fa.fa-pull-right,\n.fas.fa-pull-right,\n.far.fa-pull-right,\n.fal.fa-pull-right,\n.fab.fa-pull-right {\n margin-left: .3em; }\n\n.fa-spin {\n -webkit-animation: fa-spin 2s infinite linear;\n animation: fa-spin 2s infinite linear; }\n\n.fa-pulse {\n -webkit-animation: fa-spin 1s infinite steps(8);\n animation: fa-spin 1s infinite steps(8); }\n\n@-webkit-keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n@keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg); } }\n\n.fa-rotate-90 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)\";\n -webkit-transform: rotate(90deg);\n transform: rotate(90deg); }\n\n.fa-rotate-180 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)\";\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg); }\n\n.fa-rotate-270 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)\";\n -webkit-transform: rotate(270deg);\n transform: rotate(270deg); }\n\n.fa-flip-horizontal {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)\";\n -webkit-transform: scale(-1, 1);\n transform: scale(-1, 1); }\n\n.fa-flip-vertical {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)\";\n -webkit-transform: scale(1, -1);\n transform: scale(1, -1); }\n\n.fa-flip-horizontal.fa-flip-vertical {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)\";\n -webkit-transform: scale(-1, -1);\n transform: scale(-1, -1); }\n\n:root .fa-rotate-90,\n:root .fa-rotate-180,\n:root .fa-rotate-270,\n:root .fa-flip-horizontal,\n:root .fa-flip-vertical {\n -webkit-filter: none;\n filter: none; }\n\n.fa-stack {\n display: inline-block;\n height: 2em;\n position: relative;\n width: 2.5em; }\n\n.fa-stack-1x,\n.fa-stack-2x {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0; }\n\n.svg-inline--fa.fa-stack-1x {\n height: 1em;\n width: 1.25em; }\n\n.svg-inline--fa.fa-stack-2x {\n height: 2em;\n width: 2.5em; }\n\n.fa-inverse {\n color: #fff; }\n\n.sr-only {\n border: 0;\n clip: rect(0, 0, 0, 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n width: 1px; }\n\n.sr-only-focusable:active, .sr-only-focusable:focus {\n clip: auto;\n height: auto;\n margin: 0;\n overflow: visible;\n position: static;\n width: auto; }\n"; | ||
var baseStyles = "svg:not(:root).svg-inline--fa {\n overflow: visible;\n}\n\n.svg-inline--fa {\n display: inline-block;\n font-size: inherit;\n height: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n}\n.svg-inline--fa.fa-lg {\n vertical-align: -0.225em;\n}\n.svg-inline--fa.fa-w-1 {\n width: 0.0625em;\n}\n.svg-inline--fa.fa-w-2 {\n width: 0.125em;\n}\n.svg-inline--fa.fa-w-3 {\n width: 0.1875em;\n}\n.svg-inline--fa.fa-w-4 {\n width: 0.25em;\n}\n.svg-inline--fa.fa-w-5 {\n width: 0.3125em;\n}\n.svg-inline--fa.fa-w-6 {\n width: 0.375em;\n}\n.svg-inline--fa.fa-w-7 {\n width: 0.4375em;\n}\n.svg-inline--fa.fa-w-8 {\n width: 0.5em;\n}\n.svg-inline--fa.fa-w-9 {\n width: 0.5625em;\n}\n.svg-inline--fa.fa-w-10 {\n width: 0.625em;\n}\n.svg-inline--fa.fa-w-11 {\n width: 0.6875em;\n}\n.svg-inline--fa.fa-w-12 {\n width: 0.75em;\n}\n.svg-inline--fa.fa-w-13 {\n width: 0.8125em;\n}\n.svg-inline--fa.fa-w-14 {\n width: 0.875em;\n}\n.svg-inline--fa.fa-w-15 {\n width: 0.9375em;\n}\n.svg-inline--fa.fa-w-16 {\n width: 1em;\n}\n.svg-inline--fa.fa-w-17 {\n width: 1.0625em;\n}\n.svg-inline--fa.fa-w-18 {\n width: 1.125em;\n}\n.svg-inline--fa.fa-w-19 {\n width: 1.1875em;\n}\n.svg-inline--fa.fa-w-20 {\n width: 1.25em;\n}\n.svg-inline--fa.fa-pull-left {\n margin-right: 0.3em;\n width: auto;\n}\n.svg-inline--fa.fa-pull-right {\n margin-left: 0.3em;\n width: auto;\n}\n.svg-inline--fa.fa-border {\n height: 1.5em;\n}\n.svg-inline--fa.fa-li {\n width: 2em;\n}\n.svg-inline--fa.fa-fw {\n width: 1.25em;\n}\n\n.fa-layers svg.svg-inline--fa {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.fa-layers {\n display: inline-block;\n height: 1em;\n position: relative;\n text-align: center;\n vertical-align: -0.125em;\n width: 1em;\n}\n.fa-layers svg.svg-inline--fa {\n -webkit-transform-origin: center center;\n transform-origin: center center;\n}\n\n.fa-layers-counter, .fa-layers-text {\n display: inline-block;\n position: absolute;\n text-align: center;\n}\n\n.fa-layers-text {\n left: 50%;\n top: 50%;\n -webkit-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n -webkit-transform-origin: center center;\n transform-origin: center center;\n}\n\n.fa-layers-counter {\n background-color: #ff253a;\n border-radius: 1em;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n color: #fff;\n height: 1.5em;\n line-height: 1;\n max-width: 5em;\n min-width: 1.5em;\n overflow: hidden;\n padding: 0.25em;\n right: 0;\n text-overflow: ellipsis;\n top: 0;\n -webkit-transform: scale(0.25);\n transform: scale(0.25);\n -webkit-transform-origin: top right;\n transform-origin: top right;\n}\n\n.fa-layers-bottom-right {\n bottom: 0;\n right: 0;\n top: auto;\n -webkit-transform: scale(0.25);\n transform: scale(0.25);\n -webkit-transform-origin: bottom right;\n transform-origin: bottom right;\n}\n\n.fa-layers-bottom-left {\n bottom: 0;\n left: 0;\n right: auto;\n top: auto;\n -webkit-transform: scale(0.25);\n transform: scale(0.25);\n -webkit-transform-origin: bottom left;\n transform-origin: bottom left;\n}\n\n.fa-layers-top-right {\n right: 0;\n top: 0;\n -webkit-transform: scale(0.25);\n transform: scale(0.25);\n -webkit-transform-origin: top right;\n transform-origin: top right;\n}\n\n.fa-layers-top-left {\n left: 0;\n right: auto;\n top: 0;\n -webkit-transform: scale(0.25);\n transform: scale(0.25);\n -webkit-transform-origin: top left;\n transform-origin: top left;\n}\n\n.fa-lg {\n font-size: 1.3333333333em;\n line-height: 0.75em;\n vertical-align: -0.0667em;\n}\n\n.fa-xs {\n font-size: 0.75em;\n}\n\n.fa-sm {\n font-size: 0.875em;\n}\n\n.fa-1x {\n font-size: 1em;\n}\n\n.fa-2x {\n font-size: 2em;\n}\n\n.fa-3x {\n font-size: 3em;\n}\n\n.fa-4x {\n font-size: 4em;\n}\n\n.fa-5x {\n font-size: 5em;\n}\n\n.fa-6x {\n font-size: 6em;\n}\n\n.fa-7x {\n font-size: 7em;\n}\n\n.fa-8x {\n font-size: 8em;\n}\n\n.fa-9x {\n font-size: 9em;\n}\n\n.fa-10x {\n font-size: 10em;\n}\n\n.fa-fw {\n text-align: center;\n width: 1.25em;\n}\n\n.fa-ul {\n list-style-type: none;\n margin-left: 2.5em;\n padding-left: 0;\n}\n.fa-ul > li {\n position: relative;\n}\n\n.fa-li {\n left: -2em;\n position: absolute;\n text-align: center;\n width: 2em;\n line-height: inherit;\n}\n\n.fa-border {\n border: solid 0.08em #eee;\n border-radius: 0.1em;\n padding: 0.2em 0.25em 0.15em;\n}\n\n.fa-pull-left {\n float: left;\n}\n\n.fa-pull-right {\n float: right;\n}\n\n.fa.fa-pull-left,\n.fas.fa-pull-left,\n.far.fa-pull-left,\n.fal.fa-pull-left,\n.fab.fa-pull-left {\n margin-right: 0.3em;\n}\n.fa.fa-pull-right,\n.fas.fa-pull-right,\n.far.fa-pull-right,\n.fal.fa-pull-right,\n.fab.fa-pull-right {\n margin-left: 0.3em;\n}\n\n.fa-spin {\n -webkit-animation: fa-spin 2s infinite linear;\n animation: fa-spin 2s infinite linear;\n}\n\n.fa-pulse {\n -webkit-animation: fa-spin 1s infinite steps(8);\n animation: fa-spin 1s infinite steps(8);\n}\n\n@-webkit-keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n.fa-rotate-90 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)\";\n -webkit-transform: rotate(90deg);\n transform: rotate(90deg);\n}\n\n.fa-rotate-180 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)\";\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n}\n\n.fa-rotate-270 {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)\";\n -webkit-transform: rotate(270deg);\n transform: rotate(270deg);\n}\n\n.fa-flip-horizontal {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)\";\n -webkit-transform: scale(-1, 1);\n transform: scale(-1, 1);\n}\n\n.fa-flip-vertical {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)\";\n -webkit-transform: scale(1, -1);\n transform: scale(1, -1);\n}\n\n.fa-flip-horizontal.fa-flip-vertical {\n -ms-filter: \"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)\";\n -webkit-transform: scale(-1, -1);\n transform: scale(-1, -1);\n}\n\n:root .fa-rotate-90,\n:root .fa-rotate-180,\n:root .fa-rotate-270,\n:root .fa-flip-horizontal,\n:root .fa-flip-vertical {\n -webkit-filter: none;\n filter: none;\n}\n\n.fa-stack {\n display: inline-block;\n height: 2em;\n position: relative;\n width: 2.5em;\n}\n\n.fa-stack-1x,\n.fa-stack-2x {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.svg-inline--fa.fa-stack-1x {\n height: 1em;\n width: 1.25em;\n}\n.svg-inline--fa.fa-stack-2x {\n height: 2em;\n width: 2.5em;\n}\n\n.fa-inverse {\n color: #fff;\n}\n\n.sr-only {\n border: 0;\n clip: rect(0, 0, 0, 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n width: 1px;\n}\n\n.sr-only-focusable:active, .sr-only-focusable:focus {\n clip: auto;\n height: auto;\n margin: 0;\n overflow: visible;\n position: static;\n width: auto;\n}"; | ||
var css = function () { | ||
function css () { | ||
var dfp = DEFAULT_FAMILY_PREFIX; | ||
@@ -1629,10 +1659,9 @@ var drc = DEFAULT_REPLACEMENT_CLASS; | ||
if (fp !== dfp || rc !== drc) { | ||
var dPatt = new RegExp('\\.' + dfp + '\\-', 'g'); | ||
var rPatt = new RegExp('\\.' + drc, 'g'); | ||
s = s.replace(dPatt, '.' + fp + '-').replace(rPatt, '.' + rc); | ||
var dPatt = new RegExp("\\.".concat(dfp, "\\-"), 'g'); | ||
var rPatt = new RegExp("\\.".concat(drc), 'g'); | ||
s = s.replace(dPatt, ".".concat(fp, "-")).replace(rPatt, ".".concat(rc)); | ||
} | ||
return s; | ||
}; | ||
} | ||
@@ -1649,2 +1678,3 @@ function define(prefix, icons) { | ||
} | ||
return acc; | ||
@@ -1656,5 +1686,4 @@ }, {}); | ||
} else { | ||
namespace.styles[prefix] = _extends({}, namespace.styles[prefix] || {}, normalized); | ||
namespace.styles[prefix] = _objectSpread({}, namespace.styles[prefix] || {}, normalized); | ||
} | ||
/** | ||
@@ -1666,2 +1695,4 @@ * Font Awesome 4 used the prefix of `fa` for all icons. With the introduction | ||
*/ | ||
if (prefix === 'fas') { | ||
@@ -1672,5 +1703,7 @@ define('fa', icons); | ||
var Library = function () { | ||
var Library = | ||
/*#__PURE__*/ | ||
function () { | ||
function Library() { | ||
classCallCheck(this, Library); | ||
_classCallCheck(this, Library); | ||
@@ -1680,8 +1713,8 @@ this.definitions = {}; | ||
createClass(Library, [{ | ||
key: 'add', | ||
_createClass(Library, [{ | ||
key: "add", | ||
value: function add() { | ||
var _this = this; | ||
for (var _len = arguments.length, definitions = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, definitions = new Array(_len), _key = 0; _key < _len; _key++) { | ||
definitions[_key] = arguments[_key]; | ||
@@ -1691,5 +1724,4 @@ } | ||
var additions = definitions.reduce(this._pullDefinitions, {}); | ||
Object.keys(additions).forEach(function (key) { | ||
_this.definitions[key] = _extends({}, _this.definitions[key] || {}, additions[key]); | ||
_this.definitions[key] = _objectSpread({}, _this.definitions[key] || {}, additions[key]); | ||
define(key, additions[key]); | ||
@@ -1700,3 +1732,3 @@ build(); | ||
}, { | ||
key: 'reset', | ||
key: "reset", | ||
value: function reset() { | ||
@@ -1706,6 +1738,7 @@ this.definitions = {}; | ||
}, { | ||
key: '_pullDefinitions', | ||
key: "_pullDefinitions", | ||
value: function _pullDefinitions(additions, definition) { | ||
var normalized = definition.prefix && definition.iconName && definition.icon ? { 0: definition } : definition; | ||
var normalized = definition.prefix && definition.iconName && definition.icon ? { | ||
0: definition | ||
} : definition; | ||
Object.keys(normalized).map(function (key) { | ||
@@ -1716,12 +1749,9 @@ var _normalized$key = normalized[key], | ||
icon = _normalized$key.icon; | ||
if (!additions[prefix]) additions[prefix] = {}; | ||
additions[prefix][iconName] = icon; | ||
}); | ||
return additions; | ||
} | ||
}]); | ||
return Library; | ||
@@ -1734,3 +1764,2 @@ }(); | ||
var vectorData = icon.slice(4); | ||
return { | ||
@@ -1740,3 +1769,9 @@ found: true, | ||
height: height, | ||
icon: { tag: 'path', attributes: { fill: 'currentColor', d: vectorData[0] } } | ||
icon: { | ||
tag: 'path', | ||
attributes: { | ||
fill: 'currentColor', | ||
d: vectorData[0] | ||
} | ||
} | ||
}; | ||
@@ -1748,2 +1783,3 @@ } | ||
insertCss(css()); | ||
_cssInserted = true; | ||
@@ -1757,3 +1793,2 @@ } | ||
}); | ||
Object.defineProperty(val, 'html', { | ||
@@ -1766,7 +1801,5 @@ get: function get() { | ||
}); | ||
Object.defineProperty(val, 'node', { | ||
get: function get() { | ||
if (!IS_DOM) return; | ||
var container = DOCUMENT.createElement('div'); | ||
@@ -1777,3 +1810,2 @@ container.innerHTML = val.html; | ||
}); | ||
return val; | ||
@@ -1784,8 +1816,5 @@ } | ||
var _params$prefix = params.prefix, | ||
prefix = _params$prefix === undefined ? 'fa' : _params$prefix, | ||
prefix = _params$prefix === void 0 ? 'fa' : _params$prefix, | ||
iconName = params.iconName; | ||
if (!iconName) return; | ||
return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName); | ||
@@ -1797,8 +1826,5 @@ } | ||
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var iconDefinition = (maybeIconDefinition || {}).icon ? maybeIconDefinition : findIconDefinition(maybeIconDefinition || {}); | ||
var mask = params.mask; | ||
if (mask) { | ||
@@ -1808,3 +1834,5 @@ mask = (mask || {}).icon ? mask : findIconDefinition(mask || {}); | ||
return next(iconDefinition, _extends({}, params, { mask: mask })); | ||
return next(iconDefinition, _objectSpread({}, params, { | ||
mask: mask | ||
})); | ||
}; | ||
@@ -1814,12 +1842,8 @@ } | ||
var library = new Library(); | ||
var noAuto = function noAuto() { | ||
config.autoReplaceSvg = false; | ||
config.observeMutations = false; | ||
disconnect(); | ||
}; | ||
var _cssInserted = false; | ||
var dom = { | ||
@@ -1831,9 +1855,7 @@ i2svg: function i2svg() { | ||
ensureCss(); | ||
var _params$node = params.node, | ||
node = _params$node === undefined ? DOCUMENT : _params$node, | ||
node = _params$node === void 0 ? DOCUMENT : _params$node, | ||
_params$callback = params.callback, | ||
callback = _params$callback === undefined ? function () {} : _params$callback; | ||
callback = _params$callback === void 0 ? function () {} : _params$callback; | ||
if (config.searchPseudoElements) { | ||
@@ -1846,12 +1868,10 @@ searchPseudoElements(node); | ||
}, | ||
css: css, | ||
insertCss: function insertCss$$1() { | ||
if (!_cssInserted) { | ||
insertCss(css()); | ||
_cssInserted = true; | ||
} | ||
}, | ||
watch: function watch() { | ||
@@ -1862,3 +1882,2 @@ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
if (config.autoReplaceSvg === false) { | ||
@@ -1869,3 +1888,2 @@ config.autoReplaceSvg = true; | ||
config.observeMutations = true; | ||
domready(function () { | ||
@@ -1875,3 +1893,2 @@ autoReplace({ | ||
}); | ||
observe({ | ||
@@ -1886,3 +1903,2 @@ treeCallback: onTree, | ||
}; | ||
var parse = { | ||
@@ -1893,29 +1909,25 @@ transform: function transform(transformString) { | ||
}; | ||
var icon = resolveIcons(function (iconDefinition) { | ||
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var _params$transform = params.transform, | ||
transform = _params$transform === undefined ? meaninglessTransform : _params$transform, | ||
transform = _params$transform === void 0 ? meaninglessTransform : _params$transform, | ||
_params$symbol = params.symbol, | ||
symbol = _params$symbol === undefined ? false : _params$symbol, | ||
symbol = _params$symbol === void 0 ? false : _params$symbol, | ||
_params$mask = params.mask, | ||
mask = _params$mask === undefined ? null : _params$mask, | ||
mask = _params$mask === void 0 ? null : _params$mask, | ||
_params$title = params.title, | ||
title = _params$title === undefined ? null : _params$title, | ||
title = _params$title === void 0 ? null : _params$title, | ||
_params$classes = params.classes, | ||
classes = _params$classes === undefined ? [] : _params$classes, | ||
classes = _params$classes === void 0 ? [] : _params$classes, | ||
_params$attributes = params.attributes, | ||
attributes = _params$attributes === undefined ? {} : _params$attributes, | ||
attributes = _params$attributes === void 0 ? {} : _params$attributes, | ||
_params$styles = params.styles, | ||
styles = _params$styles === undefined ? {} : _params$styles; | ||
styles = _params$styles === void 0 ? {} : _params$styles; | ||
if (!iconDefinition) return; | ||
var prefix = iconDefinition.prefix, | ||
iconName = iconDefinition.iconName, | ||
icon = iconDefinition.icon; | ||
return apiObject(_extends({ type: 'icon' }, iconDefinition), function () { | ||
return apiObject(_objectSpread({ | ||
type: 'icon' | ||
}, iconDefinition), function () { | ||
ensureCss(); | ||
@@ -1925,3 +1937,3 @@ | ||
if (title) { | ||
attributes['aria-labelledby'] = config.replacementClass + '-title-' + nextUniqueId(); | ||
attributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(nextUniqueId()); | ||
} else { | ||
@@ -1935,7 +1947,12 @@ attributes['aria-hidden'] = 'true'; | ||
main: prepIcon(icon), | ||
mask: mask ? prepIcon(mask.icon) : { found: false, width: null, height: null, icon: {} } | ||
mask: mask ? prepIcon(mask.icon) : { | ||
found: false, | ||
width: null, | ||
height: null, | ||
icon: {} | ||
} | ||
}, | ||
prefix: prefix, | ||
iconName: iconName, | ||
transform: _extends({}, meaninglessTransform, transform), | ||
transform: _objectSpread({}, meaninglessTransform, transform), | ||
symbol: symbol, | ||
@@ -1951,23 +1968,22 @@ title: title, | ||
}); | ||
var text = function text(content) { | ||
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var _params$transform2 = params.transform, | ||
transform = _params$transform2 === undefined ? meaninglessTransform : _params$transform2, | ||
transform = _params$transform2 === void 0 ? meaninglessTransform : _params$transform2, | ||
_params$title2 = params.title, | ||
title = _params$title2 === undefined ? null : _params$title2, | ||
title = _params$title2 === void 0 ? null : _params$title2, | ||
_params$classes2 = params.classes, | ||
classes = _params$classes2 === undefined ? [] : _params$classes2, | ||
classes = _params$classes2 === void 0 ? [] : _params$classes2, | ||
_params$attributes2 = params.attributes, | ||
attributes = _params$attributes2 === undefined ? {} : _params$attributes2, | ||
attributes = _params$attributes2 === void 0 ? {} : _params$attributes2, | ||
_params$styles2 = params.styles, | ||
styles = _params$styles2 === undefined ? {} : _params$styles2; | ||
return apiObject({ type: 'text', content: content }, function () { | ||
styles = _params$styles2 === void 0 ? {} : _params$styles2; | ||
return apiObject({ | ||
type: 'text', | ||
content: content | ||
}, function () { | ||
ensureCss(); | ||
return makeLayersTextAbstract({ | ||
content: content, | ||
transform: _extends({}, meaninglessTransform, transform), | ||
transform: _objectSpread({}, meaninglessTransform, transform), | ||
title: title, | ||
@@ -1977,3 +1993,3 @@ extra: { | ||
styles: styles, | ||
classes: [config.familyPrefix + '-layers-text'].concat(toConsumableArray(classes)) | ||
classes: ["".concat(config.familyPrefix, "-layers-text")].concat(_toConsumableArray(classes)) | ||
} | ||
@@ -1983,18 +1999,17 @@ }); | ||
}; | ||
var counter = function counter(content) { | ||
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var _params$title3 = params.title, | ||
title = _params$title3 === undefined ? null : _params$title3, | ||
title = _params$title3 === void 0 ? null : _params$title3, | ||
_params$classes3 = params.classes, | ||
classes = _params$classes3 === undefined ? [] : _params$classes3, | ||
classes = _params$classes3 === void 0 ? [] : _params$classes3, | ||
_params$attributes3 = params.attributes, | ||
attributes = _params$attributes3 === undefined ? {} : _params$attributes3, | ||
attributes = _params$attributes3 === void 0 ? {} : _params$attributes3, | ||
_params$styles3 = params.styles, | ||
styles = _params$styles3 === undefined ? {} : _params$styles3; | ||
return apiObject({ type: 'counter', content: content }, function () { | ||
styles = _params$styles3 === void 0 ? {} : _params$styles3; | ||
return apiObject({ | ||
type: 'counter', | ||
content: content | ||
}, function () { | ||
ensureCss(); | ||
return makeLayersCounterAbstract({ | ||
@@ -2006,3 +2021,3 @@ content: content.toString(), | ||
styles: styles, | ||
classes: [config.familyPrefix + '-layers-counter'].concat(toConsumableArray(classes)) | ||
classes: ["".concat(config.familyPrefix, "-layers-counter")].concat(_toConsumableArray(classes)) | ||
} | ||
@@ -2012,9 +2027,8 @@ }); | ||
}; | ||
var layer = function layer(assembler) { | ||
return apiObject({ type: 'layer' }, function () { | ||
return apiObject({ | ||
type: 'layer' | ||
}, function () { | ||
ensureCss(); | ||
var children = []; | ||
assembler(function (args) { | ||
@@ -2025,6 +2039,7 @@ Array.isArray(args) ? args.map(function (a) { | ||
}); | ||
return [{ | ||
tag: 'span', | ||
attributes: { class: config.familyPrefix + '-layers' }, | ||
attributes: { | ||
class: "".concat(config.familyPrefix, "-layers") | ||
}, | ||
children: children | ||
@@ -2034,3 +2049,2 @@ }]; | ||
}; | ||
var api = { | ||
@@ -2053,8 +2067,8 @@ noAuto: noAuto, | ||
var _params$autoReplaceSv = params.autoReplaceSvgRoot, | ||
autoReplaceSvgRoot = _params$autoReplaceSv === undefined ? DOCUMENT : _params$autoReplaceSv; | ||
if (Object.keys(namespace.styles).length > 0 && IS_DOM && config.autoReplaceSvg) api.dom.i2svg({ node: autoReplaceSvgRoot }); | ||
autoReplaceSvgRoot = _params$autoReplaceSv === void 0 ? DOCUMENT : _params$autoReplaceSv; | ||
if (Object.keys(namespace.styles).length > 0 && IS_DOM && config.autoReplaceSvg) api.dom.i2svg({ | ||
node: autoReplaceSvgRoot | ||
}); | ||
}; | ||
export { icon, noAuto, config, toHtml, layer, text, counter, library, dom, parse, findIconDefinition }; |
@@ -50,5 +50,5 @@ { | ||
"dependencies": { | ||
"@fortawesome/fontawesome-common-types": "^0.2.8" | ||
"@fortawesome/fontawesome-common-types": "^0.2.9" | ||
}, | ||
"version": "1.2.8", | ||
"version": "1.2.9", | ||
"name": "@fortawesome/fontawesome-svg-core", | ||
@@ -55,0 +55,0 @@ "main": "index.js", |
@@ -21,5 +21,5 @@ # @fortawesome/fontawesome-svg-core - SVG with JavaScript version | ||
Get started [here](https://fontawesome.com/get-started/svg-with-js). Continue your journey [here](https://fontawesome.com/how-to-use/svg-with-js). | ||
Get started [here](https://fontawesome.com/how-to-use/on-the-web/setup/getting-started). Continue your journey [here](https://fontawesome.com/how-to-use/on-the-web/advanced). | ||
Or go straight to the [API documentation](https://fontawesome.com/how-to-use/font-awesome-api). | ||
Or go straight to the [API documentation](https://fontawesome.com/how-to-use/with-the-api). | ||
@@ -26,0 +26,0 @@ ## Issues and support |
Sorry, the diff of this file is too big to display
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
144698
3926