693 |
steven |
1 |
/*!
|
|
|
2 |
* Font Awesome Free 5.10.2 by @fontawesome - https://fontawesome.com
|
|
|
3 |
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
|
4 |
*/
|
|
|
5 |
(function () {
|
|
|
6 |
'use strict';
|
|
|
7 |
|
|
|
8 |
function _typeof(obj) {
|
|
|
9 |
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
|
10 |
_typeof = function (obj) {
|
|
|
11 |
return typeof obj;
|
|
|
12 |
};
|
|
|
13 |
} else {
|
|
|
14 |
_typeof = function (obj) {
|
|
|
15 |
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
|
16 |
};
|
|
|
17 |
}
|
|
|
18 |
|
|
|
19 |
return _typeof(obj);
|
|
|
20 |
}
|
|
|
21 |
|
|
|
22 |
function _classCallCheck(instance, Constructor) {
|
|
|
23 |
if (!(instance instanceof Constructor)) {
|
|
|
24 |
throw new TypeError("Cannot call a class as a function");
|
|
|
25 |
}
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
function _defineProperties(target, props) {
|
|
|
29 |
for (var i = 0; i < props.length; i++) {
|
|
|
30 |
var descriptor = props[i];
|
|
|
31 |
descriptor.enumerable = descriptor.enumerable || false;
|
|
|
32 |
descriptor.configurable = true;
|
|
|
33 |
if ("value" in descriptor) descriptor.writable = true;
|
|
|
34 |
Object.defineProperty(target, descriptor.key, descriptor);
|
|
|
35 |
}
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
function _createClass(Constructor, protoProps, staticProps) {
|
|
|
39 |
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
|
40 |
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
|
41 |
return Constructor;
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
function _defineProperty(obj, key, value) {
|
|
|
45 |
if (key in obj) {
|
|
|
46 |
Object.defineProperty(obj, key, {
|
|
|
47 |
value: value,
|
|
|
48 |
enumerable: true,
|
|
|
49 |
configurable: true,
|
|
|
50 |
writable: true
|
|
|
51 |
});
|
|
|
52 |
} else {
|
|
|
53 |
obj[key] = value;
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
return obj;
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
function _objectSpread(target) {
|
|
|
60 |
for (var i = 1; i < arguments.length; i++) {
|
|
|
61 |
var source = arguments[i] != null ? arguments[i] : {};
|
|
|
62 |
var ownKeys = Object.keys(source);
|
|
|
63 |
|
|
|
64 |
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
|
65 |
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
|
66 |
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
|
67 |
}));
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
ownKeys.forEach(function (key) {
|
|
|
71 |
_defineProperty(target, key, source[key]);
|
|
|
72 |
});
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
return target;
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
function _slicedToArray(arr, i) {
|
|
|
79 |
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
function _toConsumableArray(arr) {
|
|
|
83 |
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
function _arrayWithoutHoles(arr) {
|
|
|
87 |
if (Array.isArray(arr)) {
|
|
|
88 |
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
|
89 |
|
|
|
90 |
return arr2;
|
|
|
91 |
}
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
function _arrayWithHoles(arr) {
|
|
|
95 |
if (Array.isArray(arr)) return arr;
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
function _iterableToArray(iter) {
|
|
|
99 |
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
function _iterableToArrayLimit(arr, i) {
|
|
|
103 |
var _arr = [];
|
|
|
104 |
var _n = true;
|
|
|
105 |
var _d = false;
|
|
|
106 |
var _e = undefined;
|
|
|
107 |
|
|
|
108 |
try {
|
|
|
109 |
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
|
110 |
_arr.push(_s.value);
|
|
|
111 |
|
|
|
112 |
if (i && _arr.length === i) break;
|
|
|
113 |
}
|
|
|
114 |
} catch (err) {
|
|
|
115 |
_d = true;
|
|
|
116 |
_e = err;
|
|
|
117 |
} finally {
|
|
|
118 |
try {
|
|
|
119 |
if (!_n && _i["return"] != null) _i["return"]();
|
|
|
120 |
} finally {
|
|
|
121 |
if (_d) throw _e;
|
|
|
122 |
}
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
return _arr;
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
function _nonIterableSpread() {
|
|
|
129 |
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
function _nonIterableRest() {
|
|
|
133 |
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
|
134 |
}
|
|
|
135 |
|
|
|
136 |
var noop = function noop() {};
|
|
|
137 |
|
|
|
138 |
var _WINDOW = {};
|
|
|
139 |
var _DOCUMENT = {};
|
|
|
140 |
var _MUTATION_OBSERVER = null;
|
|
|
141 |
var _PERFORMANCE = {
|
|
|
142 |
mark: noop,
|
|
|
143 |
measure: noop
|
|
|
144 |
};
|
|
|
145 |
|
|
|
146 |
try {
|
|
|
147 |
if (typeof window !== 'undefined') _WINDOW = window;
|
|
|
148 |
if (typeof document !== 'undefined') _DOCUMENT = document;
|
|
|
149 |
if (typeof MutationObserver !== 'undefined') _MUTATION_OBSERVER = MutationObserver;
|
|
|
150 |
if (typeof performance !== 'undefined') _PERFORMANCE = performance;
|
|
|
151 |
} catch (e) {}
|
|
|
152 |
|
|
|
153 |
var _ref = _WINDOW.navigator || {},
|
|
|
154 |
_ref$userAgent = _ref.userAgent,
|
|
|
155 |
userAgent = _ref$userAgent === void 0 ? '' : _ref$userAgent;
|
|
|
156 |
|
|
|
157 |
var WINDOW = _WINDOW;
|
|
|
158 |
var DOCUMENT = _DOCUMENT;
|
|
|
159 |
var MUTATION_OBSERVER = _MUTATION_OBSERVER;
|
|
|
160 |
var PERFORMANCE = _PERFORMANCE;
|
|
|
161 |
var IS_BROWSER = !!WINDOW.document;
|
|
|
162 |
var IS_DOM = !!DOCUMENT.documentElement && !!DOCUMENT.head && typeof DOCUMENT.addEventListener === 'function' && typeof DOCUMENT.createElement === 'function';
|
|
|
163 |
var IS_IE = ~userAgent.indexOf('MSIE') || ~userAgent.indexOf('Trident/');
|
|
|
164 |
|
|
|
165 |
var NAMESPACE_IDENTIFIER = '___FONT_AWESOME___';
|
|
|
166 |
var UNITS_IN_GRID = 16;
|
|
|
167 |
var DEFAULT_FAMILY_PREFIX = 'fa';
|
|
|
168 |
var DEFAULT_REPLACEMENT_CLASS = 'svg-inline--fa';
|
|
|
169 |
var DATA_FA_I2SVG = 'data-fa-i2svg';
|
|
|
170 |
var DATA_FA_PSEUDO_ELEMENT = 'data-fa-pseudo-element';
|
|
|
171 |
var DATA_FA_PSEUDO_ELEMENT_PENDING = 'data-fa-pseudo-element-pending';
|
|
|
172 |
var DATA_PREFIX = 'data-prefix';
|
|
|
173 |
var DATA_ICON = 'data-icon';
|
|
|
174 |
var HTML_CLASS_I2SVG_BASE_CLASS = 'fontawesome-i2svg';
|
|
|
175 |
var MUTATION_APPROACH_ASYNC = 'async';
|
|
|
176 |
var TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS = ['HTML', 'HEAD', 'STYLE', 'SCRIPT'];
|
|
|
177 |
var PRODUCTION = function () {
|
|
|
178 |
try {
|
|
|
179 |
return "production" === 'production';
|
|
|
180 |
} catch (e) {
|
|
|
181 |
return false;
|
|
|
182 |
}
|
|
|
183 |
}();
|
|
|
184 |
var PREFIX_TO_STYLE = {
|
|
|
185 |
'fas': 'solid',
|
|
|
186 |
'far': 'regular',
|
|
|
187 |
'fal': 'light',
|
|
|
188 |
'fad': 'duotone',
|
|
|
189 |
'fab': 'brands',
|
|
|
190 |
'fa': 'solid'
|
|
|
191 |
};
|
|
|
192 |
var STYLE_TO_PREFIX = {
|
|
|
193 |
'solid': 'fas',
|
|
|
194 |
'regular': 'far',
|
|
|
195 |
'light': 'fal',
|
|
|
196 |
'duotone': 'fad',
|
|
|
197 |
'brands': 'fab'
|
|
|
198 |
};
|
|
|
199 |
var LAYERS_TEXT_CLASSNAME = 'fa-layers-text';
|
|
|
200 |
var FONT_FAMILY_PATTERN = /Font Awesome 5 (Solid|Regular|Light|Duotone|Brands|Free|Pro)/;
|
|
|
201 |
var FONT_WEIGHT_TO_PREFIX = {
|
|
|
202 |
'900': 'fas',
|
|
|
203 |
'400': 'far',
|
|
|
204 |
'normal': 'far',
|
|
|
205 |
'300': 'fal'
|
|
|
206 |
};
|
|
|
207 |
var oneToTen = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
|
208 |
var oneToTwenty = oneToTen.concat([11, 12, 13, 14, 15, 16, 17, 18, 19, 20]);
|
|
|
209 |
var ATTRIBUTES_WATCHED_FOR_MUTATION = ['class', 'data-prefix', 'data-icon', 'data-fa-transform', 'data-fa-mask'];
|
|
|
210 |
var DUOTONE_CLASSES = {
|
|
|
211 |
GROUP: 'group',
|
|
|
212 |
SWAP_OPACITY: 'swap-opacity',
|
|
|
213 |
PRIMARY: 'primary',
|
|
|
214 |
SECONDARY: 'secondary'
|
|
|
215 |
};
|
|
|
216 |
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', 'flip-both', 'stack', 'stack-1x', 'stack-2x', 'inverse', 'layers', 'layers-text', 'layers-counter', DUOTONE_CLASSES.GROUP, DUOTONE_CLASSES.SWAP_OPACITY, DUOTONE_CLASSES.PRIMARY, DUOTONE_CLASSES.SECONDARY].concat(oneToTen.map(function (n) {
|
|
|
217 |
return "".concat(n, "x");
|
|
|
218 |
})).concat(oneToTwenty.map(function (n) {
|
|
|
219 |
return "w-".concat(n);
|
|
|
220 |
}));
|
|
|
221 |
|
|
|
222 |
var initial = WINDOW.FontAwesomeConfig || {};
|
|
|
223 |
|
|
|
224 |
function getAttrConfig(attr) {
|
|
|
225 |
var element = DOCUMENT.querySelector('script[' + attr + ']');
|
|
|
226 |
|
|
|
227 |
if (element) {
|
|
|
228 |
return element.getAttribute(attr);
|
|
|
229 |
}
|
|
|
230 |
}
|
|
|
231 |
|
|
|
232 |
function coerce(val) {
|
|
|
233 |
// Getting an empty string will occur if the attribute is set on the HTML tag but without a value
|
|
|
234 |
// We'll assume that this is an indication that it should be toggled to true
|
|
|
235 |
// For example <script data-search-pseudo-elements src="..."></script>
|
|
|
236 |
if (val === '') return true;
|
|
|
237 |
if (val === 'false') return false;
|
|
|
238 |
if (val === 'true') return true;
|
|
|
239 |
return val;
|
|
|
240 |
}
|
|
|
241 |
|
|
|
242 |
if (DOCUMENT && typeof DOCUMENT.querySelector === 'function') {
|
|
|
243 |
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-mutate-approach', 'mutateApproach'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']];
|
|
|
244 |
attrs.forEach(function (_ref) {
|
|
|
245 |
var _ref2 = _slicedToArray(_ref, 2),
|
|
|
246 |
attr = _ref2[0],
|
|
|
247 |
key = _ref2[1];
|
|
|
248 |
|
|
|
249 |
var val = coerce(getAttrConfig(attr));
|
|
|
250 |
|
|
|
251 |
if (val !== undefined && val !== null) {
|
|
|
252 |
initial[key] = val;
|
|
|
253 |
}
|
|
|
254 |
});
|
|
|
255 |
}
|
|
|
256 |
|
|
|
257 |
var _default = {
|
|
|
258 |
familyPrefix: DEFAULT_FAMILY_PREFIX,
|
|
|
259 |
replacementClass: DEFAULT_REPLACEMENT_CLASS,
|
|
|
260 |
autoReplaceSvg: true,
|
|
|
261 |
autoAddCss: true,
|
|
|
262 |
autoA11y: true,
|
|
|
263 |
searchPseudoElements: false,
|
|
|
264 |
observeMutations: true,
|
|
|
265 |
mutateApproach: 'async',
|
|
|
266 |
keepOriginalSource: true,
|
|
|
267 |
measurePerformance: false,
|
|
|
268 |
showMissingIcons: true
|
|
|
269 |
};
|
|
|
270 |
|
|
|
271 |
var _config = _objectSpread({}, _default, initial);
|
|
|
272 |
|
|
|
273 |
if (!_config.autoReplaceSvg) _config.observeMutations = false;
|
|
|
274 |
|
|
|
275 |
var config = _objectSpread({}, _config);
|
|
|
276 |
|
|
|
277 |
WINDOW.FontAwesomeConfig = config;
|
|
|
278 |
|
|
|
279 |
var w = WINDOW || {};
|
|
|
280 |
if (!w[NAMESPACE_IDENTIFIER]) w[NAMESPACE_IDENTIFIER] = {};
|
|
|
281 |
if (!w[NAMESPACE_IDENTIFIER].styles) w[NAMESPACE_IDENTIFIER].styles = {};
|
|
|
282 |
if (!w[NAMESPACE_IDENTIFIER].hooks) w[NAMESPACE_IDENTIFIER].hooks = {};
|
|
|
283 |
if (!w[NAMESPACE_IDENTIFIER].shims) w[NAMESPACE_IDENTIFIER].shims = [];
|
|
|
284 |
var namespace = w[NAMESPACE_IDENTIFIER];
|
|
|
285 |
|
|
|
286 |
var functions = [];
|
|
|
287 |
|
|
|
288 |
var listener = function listener() {
|
|
|
289 |
DOCUMENT.removeEventListener('DOMContentLoaded', listener);
|
|
|
290 |
loaded = 1;
|
|
|
291 |
functions.map(function (fn) {
|
|
|
292 |
return fn();
|
|
|
293 |
});
|
|
|
294 |
};
|
|
|
295 |
|
|
|
296 |
var loaded = false;
|
|
|
297 |
|
|
|
298 |
if (IS_DOM) {
|
|
|
299 |
loaded = (DOCUMENT.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(DOCUMENT.readyState);
|
|
|
300 |
if (!loaded) DOCUMENT.addEventListener('DOMContentLoaded', listener);
|
|
|
301 |
}
|
|
|
302 |
|
|
|
303 |
function domready (fn) {
|
|
|
304 |
if (!IS_DOM) return;
|
|
|
305 |
loaded ? setTimeout(fn, 0) : functions.push(fn);
|
|
|
306 |
}
|
|
|
307 |
|
|
|
308 |
var PENDING = 'pending';
|
|
|
309 |
var SETTLED = 'settled';
|
|
|
310 |
var FULFILLED = 'fulfilled';
|
|
|
311 |
var REJECTED = 'rejected';
|
|
|
312 |
|
|
|
313 |
var NOOP = function NOOP() {};
|
|
|
314 |
|
|
|
315 |
var isNode = typeof global !== 'undefined' && typeof global.process !== 'undefined' && typeof global.process.emit === 'function';
|
|
|
316 |
var asyncSetTimer = typeof setImmediate === 'undefined' ? setTimeout : setImmediate;
|
|
|
317 |
var asyncQueue = [];
|
|
|
318 |
var asyncTimer;
|
|
|
319 |
|
|
|
320 |
function asyncFlush() {
|
|
|
321 |
// run promise callbacks
|
|
|
322 |
for (var i = 0; i < asyncQueue.length; i++) {
|
|
|
323 |
asyncQueue[i][0](asyncQueue[i][1]);
|
|
|
324 |
} // reset async asyncQueue
|
|
|
325 |
|
|
|
326 |
|
|
|
327 |
asyncQueue = [];
|
|
|
328 |
asyncTimer = false;
|
|
|
329 |
}
|
|
|
330 |
|
|
|
331 |
function asyncCall(callback, arg) {
|
|
|
332 |
asyncQueue.push([callback, arg]);
|
|
|
333 |
|
|
|
334 |
if (!asyncTimer) {
|
|
|
335 |
asyncTimer = true;
|
|
|
336 |
asyncSetTimer(asyncFlush, 0);
|
|
|
337 |
}
|
|
|
338 |
}
|
|
|
339 |
|
|
|
340 |
function invokeResolver(resolver, promise) {
|
|
|
341 |
function resolvePromise(value) {
|
|
|
342 |
resolve(promise, value);
|
|
|
343 |
}
|
|
|
344 |
|
|
|
345 |
function rejectPromise(reason) {
|
|
|
346 |
reject(promise, reason);
|
|
|
347 |
}
|
|
|
348 |
|
|
|
349 |
try {
|
|
|
350 |
resolver(resolvePromise, rejectPromise);
|
|
|
351 |
} catch (e) {
|
|
|
352 |
rejectPromise(e);
|
|
|
353 |
}
|
|
|
354 |
}
|
|
|
355 |
|
|
|
356 |
function invokeCallback(subscriber) {
|
|
|
357 |
var owner = subscriber.owner;
|
|
|
358 |
var settled = owner._state;
|
|
|
359 |
var value = owner._data;
|
|
|
360 |
var callback = subscriber[settled];
|
|
|
361 |
var promise = subscriber.then;
|
|
|
362 |
|
|
|
363 |
if (typeof callback === 'function') {
|
|
|
364 |
settled = FULFILLED;
|
|
|
365 |
|
|
|
366 |
try {
|
|
|
367 |
value = callback(value);
|
|
|
368 |
} catch (e) {
|
|
|
369 |
reject(promise, e);
|
|
|
370 |
}
|
|
|
371 |
}
|
|
|
372 |
|
|
|
373 |
if (!handleThenable(promise, value)) {
|
|
|
374 |
if (settled === FULFILLED) {
|
|
|
375 |
resolve(promise, value);
|
|
|
376 |
}
|
|
|
377 |
|
|
|
378 |
if (settled === REJECTED) {
|
|
|
379 |
reject(promise, value);
|
|
|
380 |
}
|
|
|
381 |
}
|
|
|
382 |
}
|
|
|
383 |
|
|
|
384 |
function handleThenable(promise, value) {
|
|
|
385 |
var resolved;
|
|
|
386 |
|
|
|
387 |
try {
|
|
|
388 |
if (promise === value) {
|
|
|
389 |
throw new TypeError('A promises callback cannot return that same promise.');
|
|
|
390 |
}
|
|
|
391 |
|
|
|
392 |
if (value && (typeof value === 'function' || _typeof(value) === 'object')) {
|
|
|
393 |
// then should be retrieved only once
|
|
|
394 |
var then = value.then;
|
|
|
395 |
|
|
|
396 |
if (typeof then === 'function') {
|
|
|
397 |
then.call(value, function (val) {
|
|
|
398 |
if (!resolved) {
|
|
|
399 |
resolved = true;
|
|
|
400 |
|
|
|
401 |
if (value === val) {
|
|
|
402 |
fulfill(promise, val);
|
|
|
403 |
} else {
|
|
|
404 |
resolve(promise, val);
|
|
|
405 |
}
|
|
|
406 |
}
|
|
|
407 |
}, function (reason) {
|
|
|
408 |
if (!resolved) {
|
|
|
409 |
resolved = true;
|
|
|
410 |
reject(promise, reason);
|
|
|
411 |
}
|
|
|
412 |
});
|
|
|
413 |
return true;
|
|
|
414 |
}
|
|
|
415 |
}
|
|
|
416 |
} catch (e) {
|
|
|
417 |
if (!resolved) {
|
|
|
418 |
reject(promise, e);
|
|
|
419 |
}
|
|
|
420 |
|
|
|
421 |
return true;
|
|
|
422 |
}
|
|
|
423 |
|
|
|
424 |
return false;
|
|
|
425 |
}
|
|
|
426 |
|
|
|
427 |
function resolve(promise, value) {
|
|
|
428 |
if (promise === value || !handleThenable(promise, value)) {
|
|
|
429 |
fulfill(promise, value);
|
|
|
430 |
}
|
|
|
431 |
}
|
|
|
432 |
|
|
|
433 |
function fulfill(promise, value) {
|
|
|
434 |
if (promise._state === PENDING) {
|
|
|
435 |
promise._state = SETTLED;
|
|
|
436 |
promise._data = value;
|
|
|
437 |
asyncCall(publishFulfillment, promise);
|
|
|
438 |
}
|
|
|
439 |
}
|
|
|
440 |
|
|
|
441 |
function reject(promise, reason) {
|
|
|
442 |
if (promise._state === PENDING) {
|
|
|
443 |
promise._state = SETTLED;
|
|
|
444 |
promise._data = reason;
|
|
|
445 |
asyncCall(publishRejection, promise);
|
|
|
446 |
}
|
|
|
447 |
}
|
|
|
448 |
|
|
|
449 |
function publish(promise) {
|
|
|
450 |
promise._then = promise._then.forEach(invokeCallback);
|
|
|
451 |
}
|
|
|
452 |
|
|
|
453 |
function publishFulfillment(promise) {
|
|
|
454 |
promise._state = FULFILLED;
|
|
|
455 |
publish(promise);
|
|
|
456 |
}
|
|
|
457 |
|
|
|
458 |
function publishRejection(promise) {
|
|
|
459 |
promise._state = REJECTED;
|
|
|
460 |
publish(promise);
|
|
|
461 |
|
|
|
462 |
if (!promise._handled && isNode) {
|
|
|
463 |
global.process.emit('unhandledRejection', promise._data, promise);
|
|
|
464 |
}
|
|
|
465 |
}
|
|
|
466 |
|
|
|
467 |
function notifyRejectionHandled(promise) {
|
|
|
468 |
global.process.emit('rejectionHandled', promise);
|
|
|
469 |
}
|
|
|
470 |
/**
|
|
|
471 |
* @class
|
|
|
472 |
*/
|
|
|
473 |
|
|
|
474 |
|
|
|
475 |
function P(resolver) {
|
|
|
476 |
if (typeof resolver !== 'function') {
|
|
|
477 |
throw new TypeError('Promise resolver ' + resolver + ' is not a function');
|
|
|
478 |
}
|
|
|
479 |
|
|
|
480 |
if (this instanceof P === false) {
|
|
|
481 |
throw new TypeError('Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.');
|
|
|
482 |
}
|
|
|
483 |
|
|
|
484 |
this._then = [];
|
|
|
485 |
invokeResolver(resolver, this);
|
|
|
486 |
}
|
|
|
487 |
|
|
|
488 |
P.prototype = {
|
|
|
489 |
constructor: P,
|
|
|
490 |
_state: PENDING,
|
|
|
491 |
_then: null,
|
|
|
492 |
_data: undefined,
|
|
|
493 |
_handled: false,
|
|
|
494 |
then: function then(onFulfillment, onRejection) {
|
|
|
495 |
var subscriber = {
|
|
|
496 |
owner: this,
|
|
|
497 |
then: new this.constructor(NOOP),
|
|
|
498 |
fulfilled: onFulfillment,
|
|
|
499 |
rejected: onRejection
|
|
|
500 |
};
|
|
|
501 |
|
|
|
502 |
if ((onRejection || onFulfillment) && !this._handled) {
|
|
|
503 |
this._handled = true;
|
|
|
504 |
|
|
|
505 |
if (this._state === REJECTED && isNode) {
|
|
|
506 |
asyncCall(notifyRejectionHandled, this);
|
|
|
507 |
}
|
|
|
508 |
}
|
|
|
509 |
|
|
|
510 |
if (this._state === FULFILLED || this._state === REJECTED) {
|
|
|
511 |
// already resolved, call callback async
|
|
|
512 |
asyncCall(invokeCallback, subscriber);
|
|
|
513 |
} else {
|
|
|
514 |
// subscribe
|
|
|
515 |
this._then.push(subscriber);
|
|
|
516 |
}
|
|
|
517 |
|
|
|
518 |
return subscriber.then;
|
|
|
519 |
},
|
|
|
520 |
catch: function _catch(onRejection) {
|
|
|
521 |
return this.then(null, onRejection);
|
|
|
522 |
}
|
|
|
523 |
};
|
|
|
524 |
|
|
|
525 |
P.all = function (promises) {
|
|
|
526 |
if (!Array.isArray(promises)) {
|
|
|
527 |
throw new TypeError('You must pass an array to Promise.all().');
|
|
|
528 |
}
|
|
|
529 |
|
|
|
530 |
return new P(function (resolve, reject) {
|
|
|
531 |
var results = [];
|
|
|
532 |
var remaining = 0;
|
|
|
533 |
|
|
|
534 |
function resolver(index) {
|
|
|
535 |
remaining++;
|
|
|
536 |
return function (value) {
|
|
|
537 |
results[index] = value;
|
|
|
538 |
|
|
|
539 |
if (! --remaining) {
|
|
|
540 |
resolve(results);
|
|
|
541 |
}
|
|
|
542 |
};
|
|
|
543 |
}
|
|
|
544 |
|
|
|
545 |
for (var i = 0, promise; i < promises.length; i++) {
|
|
|
546 |
promise = promises[i];
|
|
|
547 |
|
|
|
548 |
if (promise && typeof promise.then === 'function') {
|
|
|
549 |
promise.then(resolver(i), reject);
|
|
|
550 |
} else {
|
|
|
551 |
results[i] = promise;
|
|
|
552 |
}
|
|
|
553 |
}
|
|
|
554 |
|
|
|
555 |
if (!remaining) {
|
|
|
556 |
resolve(results);
|
|
|
557 |
}
|
|
|
558 |
});
|
|
|
559 |
};
|
|
|
560 |
|
|
|
561 |
P.race = function (promises) {
|
|
|
562 |
if (!Array.isArray(promises)) {
|
|
|
563 |
throw new TypeError('You must pass an array to Promise.race().');
|
|
|
564 |
}
|
|
|
565 |
|
|
|
566 |
return new P(function (resolve, reject) {
|
|
|
567 |
for (var i = 0, promise; i < promises.length; i++) {
|
|
|
568 |
promise = promises[i];
|
|
|
569 |
|
|
|
570 |
if (promise && typeof promise.then === 'function') {
|
|
|
571 |
promise.then(resolve, reject);
|
|
|
572 |
} else {
|
|
|
573 |
resolve(promise);
|
|
|
574 |
}
|
|
|
575 |
}
|
|
|
576 |
});
|
|
|
577 |
};
|
|
|
578 |
|
|
|
579 |
P.resolve = function (value) {
|
|
|
580 |
if (value && _typeof(value) === 'object' && value.constructor === P) {
|
|
|
581 |
return value;
|
|
|
582 |
}
|
|
|
583 |
|
|
|
584 |
return new P(function (resolve) {
|
|
|
585 |
resolve(value);
|
|
|
586 |
});
|
|
|
587 |
};
|
|
|
588 |
|
|
|
589 |
P.reject = function (reason) {
|
|
|
590 |
return new P(function (resolve, reject) {
|
|
|
591 |
reject(reason);
|
|
|
592 |
});
|
|
|
593 |
};
|
|
|
594 |
|
|
|
595 |
var picked = typeof Promise === 'function' ? Promise : P;
|
|
|
596 |
|
|
|
597 |
var d = UNITS_IN_GRID;
|
|
|
598 |
var meaninglessTransform = {
|
|
|
599 |
size: 16,
|
|
|
600 |
x: 0,
|
|
|
601 |
y: 0,
|
|
|
602 |
rotate: 0,
|
|
|
603 |
flipX: false,
|
|
|
604 |
flipY: false
|
|
|
605 |
};
|
|
|
606 |
|
|
|
607 |
function isReserved(name) {
|
|
|
608 |
return ~RESERVED_CLASSES.indexOf(name);
|
|
|
609 |
}
|
|
|
610 |
|
|
|
611 |
function bunker(fn) {
|
|
|
612 |
try {
|
|
|
613 |
fn();
|
|
|
614 |
} catch (e) {
|
|
|
615 |
if (!PRODUCTION) {
|
|
|
616 |
throw e;
|
|
|
617 |
}
|
|
|
618 |
}
|
|
|
619 |
}
|
|
|
620 |
function insertCss(css) {
|
|
|
621 |
if (!css || !IS_DOM) {
|
|
|
622 |
return;
|
|
|
623 |
}
|
|
|
624 |
|
|
|
625 |
var style = DOCUMENT.createElement('style');
|
|
|
626 |
style.setAttribute('type', 'text/css');
|
|
|
627 |
style.innerHTML = css;
|
|
|
628 |
var headChildren = DOCUMENT.head.childNodes;
|
|
|
629 |
var beforeChild = null;
|
|
|
630 |
|
|
|
631 |
for (var i = headChildren.length - 1; i > -1; i--) {
|
|
|
632 |
var child = headChildren[i];
|
|
|
633 |
var tagName = (child.tagName || '').toUpperCase();
|
|
|
634 |
|
|
|
635 |
if (['STYLE', 'LINK'].indexOf(tagName) > -1) {
|
|
|
636 |
beforeChild = child;
|
|
|
637 |
}
|
|
|
638 |
}
|
|
|
639 |
|
|
|
640 |
DOCUMENT.head.insertBefore(style, beforeChild);
|
|
|
641 |
return css;
|
|
|
642 |
}
|
|
|
643 |
var idPool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
|
644 |
function nextUniqueId() {
|
|
|
645 |
var size = 12;
|
|
|
646 |
var id = '';
|
|
|
647 |
|
|
|
648 |
while (size-- > 0) {
|
|
|
649 |
id += idPool[Math.random() * 62 | 0];
|
|
|
650 |
}
|
|
|
651 |
|
|
|
652 |
return id;
|
|
|
653 |
}
|
|
|
654 |
function toArray(obj) {
|
|
|
655 |
var array = [];
|
|
|
656 |
|
|
|
657 |
for (var i = (obj || []).length >>> 0; i--;) {
|
|
|
658 |
array[i] = obj[i];
|
|
|
659 |
}
|
|
|
660 |
|
|
|
661 |
return array;
|
|
|
662 |
}
|
|
|
663 |
function classArray(node) {
|
|
|
664 |
if (node.classList) {
|
|
|
665 |
return toArray(node.classList);
|
|
|
666 |
} else {
|
|
|
667 |
return (node.getAttribute('class') || '').split(' ').filter(function (i) {
|
|
|
668 |
return i;
|
|
|
669 |
});
|
|
|
670 |
}
|
|
|
671 |
}
|
|
|
672 |
function getIconName(familyPrefix, cls) {
|
|
|
673 |
var parts = cls.split('-');
|
|
|
674 |
var prefix = parts[0];
|
|
|
675 |
var iconName = parts.slice(1).join('-');
|
|
|
676 |
|
|
|
677 |
if (prefix === familyPrefix && iconName !== '' && !isReserved(iconName)) {
|
|
|
678 |
return iconName;
|
|
|
679 |
} else {
|
|
|
680 |
return null;
|
|
|
681 |
}
|
|
|
682 |
}
|
|
|
683 |
function htmlEscape(str) {
|
|
|
684 |
return "".concat(str).replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>');
|
|
|
685 |
}
|
|
|
686 |
function joinAttributes(attributes) {
|
|
|
687 |
return Object.keys(attributes || {}).reduce(function (acc, attributeName) {
|
|
|
688 |
return acc + "".concat(attributeName, "=\"").concat(htmlEscape(attributes[attributeName]), "\" ");
|
|
|
689 |
}, '').trim();
|
|
|
690 |
}
|
|
|
691 |
function joinStyles(styles) {
|
|
|
692 |
return Object.keys(styles || {}).reduce(function (acc, styleName) {
|
|
|
693 |
return acc + "".concat(styleName, ": ").concat(styles[styleName], ";");
|
|
|
694 |
}, '');
|
|
|
695 |
}
|
|
|
696 |
function transformIsMeaningful(transform) {
|
|
|
697 |
return transform.size !== meaninglessTransform.size || transform.x !== meaninglessTransform.x || transform.y !== meaninglessTransform.y || transform.rotate !== meaninglessTransform.rotate || transform.flipX || transform.flipY;
|
|
|
698 |
}
|
|
|
699 |
function transformForSvg(_ref) {
|
|
|
700 |
var transform = _ref.transform,
|
|
|
701 |
containerWidth = _ref.containerWidth,
|
|
|
702 |
iconWidth = _ref.iconWidth;
|
|
|
703 |
var outer = {
|
|
|
704 |
transform: "translate(".concat(containerWidth / 2, " 256)")
|
|
|
705 |
};
|
|
|
706 |
var innerTranslate = "translate(".concat(transform.x * 32, ", ").concat(transform.y * 32, ") ");
|
|
|
707 |
var innerScale = "scale(".concat(transform.size / 16 * (transform.flipX ? -1 : 1), ", ").concat(transform.size / 16 * (transform.flipY ? -1 : 1), ") ");
|
|
|
708 |
var innerRotate = "rotate(".concat(transform.rotate, " 0 0)");
|
|
|
709 |
var inner = {
|
|
|
710 |
transform: "".concat(innerTranslate, " ").concat(innerScale, " ").concat(innerRotate)
|
|
|
711 |
};
|
|
|
712 |
var path = {
|
|
|
713 |
transform: "translate(".concat(iconWidth / 2 * -1, " -256)")
|
|
|
714 |
};
|
|
|
715 |
return {
|
|
|
716 |
outer: outer,
|
|
|
717 |
inner: inner,
|
|
|
718 |
path: path
|
|
|
719 |
};
|
|
|
720 |
}
|
|
|
721 |
function transformForCss(_ref2) {
|
|
|
722 |
var transform = _ref2.transform,
|
|
|
723 |
_ref2$width = _ref2.width,
|
|
|
724 |
width = _ref2$width === void 0 ? UNITS_IN_GRID : _ref2$width,
|
|
|
725 |
_ref2$height = _ref2.height,
|
|
|
726 |
height = _ref2$height === void 0 ? UNITS_IN_GRID : _ref2$height,
|
|
|
727 |
_ref2$startCentered = _ref2.startCentered,
|
|
|
728 |
startCentered = _ref2$startCentered === void 0 ? false : _ref2$startCentered;
|
|
|
729 |
var val = '';
|
|
|
730 |
|
|
|
731 |
if (startCentered && IS_IE) {
|
|
|
732 |
val += "translate(".concat(transform.x / d - width / 2, "em, ").concat(transform.y / d - height / 2, "em) ");
|
|
|
733 |
} else if (startCentered) {
|
|
|
734 |
val += "translate(calc(-50% + ".concat(transform.x / d, "em), calc(-50% + ").concat(transform.y / d, "em)) ");
|
|
|
735 |
} else {
|
|
|
736 |
val += "translate(".concat(transform.x / d, "em, ").concat(transform.y / d, "em) ");
|
|
|
737 |
}
|
|
|
738 |
|
|
|
739 |
val += "scale(".concat(transform.size / d * (transform.flipX ? -1 : 1), ", ").concat(transform.size / d * (transform.flipY ? -1 : 1), ") ");
|
|
|
740 |
val += "rotate(".concat(transform.rotate, "deg) ");
|
|
|
741 |
return val;
|
|
|
742 |
}
|
|
|
743 |
|
|
|
744 |
var ALL_SPACE = {
|
|
|
745 |
x: 0,
|
|
|
746 |
y: 0,
|
|
|
747 |
width: '100%',
|
|
|
748 |
height: '100%'
|
|
|
749 |
};
|
|
|
750 |
|
|
|
751 |
function fillBlack(abstract) {
|
|
|
752 |
var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
|
753 |
|
|
|
754 |
if (abstract.attributes && (abstract.attributes.fill || force)) {
|
|
|
755 |
abstract.attributes.fill = 'black';
|
|
|
756 |
}
|
|
|
757 |
|
|
|
758 |
return abstract;
|
|
|
759 |
}
|
|
|
760 |
|
|
|
761 |
function deGroup(abstract) {
|
|
|
762 |
if (abstract.tag === 'g') {
|
|
|
763 |
return abstract.children;
|
|
|
764 |
} else {
|
|
|
765 |
return [abstract];
|
|
|
766 |
}
|
|
|
767 |
}
|
|
|
768 |
|
|
|
769 |
function makeIconMasking (_ref) {
|
|
|
770 |
var children = _ref.children,
|
|
|
771 |
attributes = _ref.attributes,
|
|
|
772 |
main = _ref.main,
|
|
|
773 |
mask = _ref.mask,
|
|
|
774 |
transform = _ref.transform;
|
|
|
775 |
var mainWidth = main.width,
|
|
|
776 |
mainPath = main.icon;
|
|
|
777 |
var maskWidth = mask.width,
|
|
|
778 |
maskPath = mask.icon;
|
|
|
779 |
var trans = transformForSvg({
|
|
|
780 |
transform: transform,
|
|
|
781 |
containerWidth: maskWidth,
|
|
|
782 |
iconWidth: mainWidth
|
|
|
783 |
});
|
|
|
784 |
var maskRect = {
|
|
|
785 |
tag: 'rect',
|
|
|
786 |
attributes: _objectSpread({}, ALL_SPACE, {
|
|
|
787 |
fill: 'white'
|
|
|
788 |
})
|
|
|
789 |
};
|
|
|
790 |
var maskInnerGroupChildrenMixin = mainPath.children ? {
|
|
|
791 |
children: mainPath.children.map(fillBlack)
|
|
|
792 |
} : {};
|
|
|
793 |
var maskInnerGroup = {
|
|
|
794 |
tag: 'g',
|
|
|
795 |
attributes: _objectSpread({}, trans.inner),
|
|
|
796 |
children: [fillBlack(_objectSpread({
|
|
|
797 |
tag: mainPath.tag,
|
|
|
798 |
attributes: _objectSpread({}, mainPath.attributes, trans.path)
|
|
|
799 |
}, maskInnerGroupChildrenMixin))]
|
|
|
800 |
};
|
|
|
801 |
var maskOuterGroup = {
|
|
|
802 |
tag: 'g',
|
|
|
803 |
attributes: _objectSpread({}, trans.outer),
|
|
|
804 |
children: [maskInnerGroup]
|
|
|
805 |
};
|
|
|
806 |
var maskId = "mask-".concat(nextUniqueId());
|
|
|
807 |
var clipId = "clip-".concat(nextUniqueId());
|
|
|
808 |
var maskTag = {
|
|
|
809 |
tag: 'mask',
|
|
|
810 |
attributes: _objectSpread({}, ALL_SPACE, {
|
|
|
811 |
id: maskId,
|
|
|
812 |
maskUnits: 'userSpaceOnUse',
|
|
|
813 |
maskContentUnits: 'userSpaceOnUse'
|
|
|
814 |
}),
|
|
|
815 |
children: [maskRect, maskOuterGroup]
|
|
|
816 |
};
|
|
|
817 |
var defs = {
|
|
|
818 |
tag: 'defs',
|
|
|
819 |
children: [{
|
|
|
820 |
tag: 'clipPath',
|
|
|
821 |
attributes: {
|
|
|
822 |
id: clipId
|
|
|
823 |
},
|
|
|
824 |
children: deGroup(maskPath)
|
|
|
825 |
}, maskTag]
|
|
|
826 |
};
|
|
|
827 |
children.push(defs, {
|
|
|
828 |
tag: 'rect',
|
|
|
829 |
attributes: _objectSpread({
|
|
|
830 |
fill: 'currentColor',
|
|
|
831 |
'clip-path': "url(#".concat(clipId, ")"),
|
|
|
832 |
mask: "url(#".concat(maskId, ")")
|
|
|
833 |
}, ALL_SPACE)
|
|
|
834 |
});
|
|
|
835 |
return {
|
|
|
836 |
children: children,
|
|
|
837 |
attributes: attributes
|
|
|
838 |
};
|
|
|
839 |
}
|
|
|
840 |
|
|
|
841 |
function makeIconStandard (_ref) {
|
|
|
842 |
var children = _ref.children,
|
|
|
843 |
attributes = _ref.attributes,
|
|
|
844 |
main = _ref.main,
|
|
|
845 |
transform = _ref.transform,
|
|
|
846 |
styles = _ref.styles;
|
|
|
847 |
var styleString = joinStyles(styles);
|
|
|
848 |
|
|
|
849 |
if (styleString.length > 0) {
|
|
|
850 |
attributes['style'] = styleString;
|
|
|
851 |
}
|
|
|
852 |
|
|
|
853 |
if (transformIsMeaningful(transform)) {
|
|
|
854 |
var trans = transformForSvg({
|
|
|
855 |
transform: transform,
|
|
|
856 |
containerWidth: main.width,
|
|
|
857 |
iconWidth: main.width
|
|
|
858 |
});
|
|
|
859 |
children.push({
|
|
|
860 |
tag: 'g',
|
|
|
861 |
attributes: _objectSpread({}, trans.outer),
|
|
|
862 |
children: [{
|
|
|
863 |
tag: 'g',
|
|
|
864 |
attributes: _objectSpread({}, trans.inner),
|
|
|
865 |
children: [{
|
|
|
866 |
tag: main.icon.tag,
|
|
|
867 |
children: main.icon.children,
|
|
|
868 |
attributes: _objectSpread({}, main.icon.attributes, trans.path)
|
|
|
869 |
}]
|
|
|
870 |
}]
|
|
|
871 |
});
|
|
|
872 |
} else {
|
|
|
873 |
children.push(main.icon);
|
|
|
874 |
}
|
|
|
875 |
|
|
|
876 |
return {
|
|
|
877 |
children: children,
|
|
|
878 |
attributes: attributes
|
|
|
879 |
};
|
|
|
880 |
}
|
|
|
881 |
|
|
|
882 |
function asIcon (_ref) {
|
|
|
883 |
var children = _ref.children,
|
|
|
884 |
main = _ref.main,
|
|
|
885 |
mask = _ref.mask,
|
|
|
886 |
attributes = _ref.attributes,
|
|
|
887 |
styles = _ref.styles,
|
|
|
888 |
transform = _ref.transform;
|
|
|
889 |
|
|
|
890 |
if (transformIsMeaningful(transform) && main.found && !mask.found) {
|
|
|
891 |
var width = main.width,
|
|
|
892 |
height = main.height;
|
|
|
893 |
var offset = {
|
|
|
894 |
x: width / height / 2,
|
|
|
895 |
y: 0.5
|
|
|
896 |
};
|
|
|
897 |
attributes['style'] = joinStyles(_objectSpread({}, styles, {
|
|
|
898 |
'transform-origin': "".concat(offset.x + transform.x / 16, "em ").concat(offset.y + transform.y / 16, "em")
|
|
|
899 |
}));
|
|
|
900 |
}
|
|
|
901 |
|
|
|
902 |
return [{
|
|
|
903 |
tag: 'svg',
|
|
|
904 |
attributes: attributes,
|
|
|
905 |
children: children
|
|
|
906 |
}];
|
|
|
907 |
}
|
|
|
908 |
|
|
|
909 |
function asSymbol (_ref) {
|
|
|
910 |
var prefix = _ref.prefix,
|
|
|
911 |
iconName = _ref.iconName,
|
|
|
912 |
children = _ref.children,
|
|
|
913 |
attributes = _ref.attributes,
|
|
|
914 |
symbol = _ref.symbol;
|
|
|
915 |
var id = symbol === true ? "".concat(prefix, "-").concat(config.familyPrefix, "-").concat(iconName) : symbol;
|
|
|
916 |
return [{
|
|
|
917 |
tag: 'svg',
|
|
|
918 |
attributes: {
|
|
|
919 |
style: 'display: none;'
|
|
|
920 |
},
|
|
|
921 |
children: [{
|
|
|
922 |
tag: 'symbol',
|
|
|
923 |
attributes: _objectSpread({}, attributes, {
|
|
|
924 |
id: id
|
|
|
925 |
}),
|
|
|
926 |
children: children
|
|
|
927 |
}]
|
|
|
928 |
}];
|
|
|
929 |
}
|
|
|
930 |
|
|
|
931 |
function makeInlineSvgAbstract(params) {
|
|
|
932 |
var _params$icons = params.icons,
|
|
|
933 |
main = _params$icons.main,
|
|
|
934 |
mask = _params$icons.mask,
|
|
|
935 |
prefix = params.prefix,
|
|
|
936 |
iconName = params.iconName,
|
|
|
937 |
transform = params.transform,
|
|
|
938 |
symbol = params.symbol,
|
|
|
939 |
title = params.title,
|
|
|
940 |
extra = params.extra,
|
|
|
941 |
_params$watchable = params.watchable,
|
|
|
942 |
watchable = _params$watchable === void 0 ? false : _params$watchable;
|
|
|
943 |
|
|
|
944 |
var _ref = mask.found ? mask : main,
|
|
|
945 |
width = _ref.width,
|
|
|
946 |
height = _ref.height;
|
|
|
947 |
|
|
|
948 |
var widthClass = "fa-w-".concat(Math.ceil(width / height * 16));
|
|
|
949 |
var attrClass = [config.replacementClass, iconName ? "".concat(config.familyPrefix, "-").concat(iconName) : '', widthClass].filter(function (c) {
|
|
|
950 |
return extra.classes.indexOf(c) === -1;
|
|
|
951 |
}).concat(extra.classes).join(' ');
|
|
|
952 |
var content = {
|
|
|
953 |
children: [],
|
|
|
954 |
attributes: _objectSpread({}, extra.attributes, {
|
|
|
955 |
'data-prefix': prefix,
|
|
|
956 |
'data-icon': iconName,
|
|
|
957 |
'class': attrClass,
|
|
|
958 |
'role': extra.attributes.role || 'img',
|
|
|
959 |
'xmlns': 'http://www.w3.org/2000/svg',
|
|
|
960 |
'viewBox': "0 0 ".concat(width, " ").concat(height)
|
|
|
961 |
})
|
|
|
962 |
};
|
|
|
963 |
|
|
|
964 |
if (watchable) {
|
|
|
965 |
content.attributes[DATA_FA_I2SVG] = '';
|
|
|
966 |
}
|
|
|
967 |
|
|
|
968 |
if (title) content.children.push({
|
|
|
969 |
tag: 'title',
|
|
|
970 |
attributes: {
|
|
|
971 |
id: content.attributes['aria-labelledby'] || "title-".concat(nextUniqueId())
|
|
|
972 |
},
|
|
|
973 |
children: [title]
|
|
|
974 |
});
|
|
|
975 |
|
|
|
976 |
var args = _objectSpread({}, content, {
|
|
|
977 |
prefix: prefix,
|
|
|
978 |
iconName: iconName,
|
|
|
979 |
main: main,
|
|
|
980 |
mask: mask,
|
|
|
981 |
transform: transform,
|
|
|
982 |
symbol: symbol,
|
|
|
983 |
styles: extra.styles
|
|
|
984 |
});
|
|
|
985 |
|
|
|
986 |
var _ref2 = mask.found && main.found ? makeIconMasking(args) : makeIconStandard(args),
|
|
|
987 |
children = _ref2.children,
|
|
|
988 |
attributes = _ref2.attributes;
|
|
|
989 |
|
|
|
990 |
args.children = children;
|
|
|
991 |
args.attributes = attributes;
|
|
|
992 |
|
|
|
993 |
if (symbol) {
|
|
|
994 |
return asSymbol(args);
|
|
|
995 |
} else {
|
|
|
996 |
return asIcon(args);
|
|
|
997 |
}
|
|
|
998 |
}
|
|
|
999 |
function makeLayersTextAbstract(params) {
|
|
|
1000 |
var content = params.content,
|
|
|
1001 |
width = params.width,
|
|
|
1002 |
height = params.height,
|
|
|
1003 |
transform = params.transform,
|
|
|
1004 |
title = params.title,
|
|
|
1005 |
extra = params.extra,
|
|
|
1006 |
_params$watchable2 = params.watchable,
|
|
|
1007 |
watchable = _params$watchable2 === void 0 ? false : _params$watchable2;
|
|
|
1008 |
|
|
|
1009 |
var attributes = _objectSpread({}, extra.attributes, title ? {
|
|
|
1010 |
'title': title
|
|
|
1011 |
} : {}, {
|
|
|
1012 |
'class': extra.classes.join(' ')
|
|
|
1013 |
});
|
|
|
1014 |
|
|
|
1015 |
if (watchable) {
|
|
|
1016 |
attributes[DATA_FA_I2SVG] = '';
|
|
|
1017 |
}
|
|
|
1018 |
|
|
|
1019 |
var styles = _objectSpread({}, extra.styles);
|
|
|
1020 |
|
|
|
1021 |
if (transformIsMeaningful(transform)) {
|
|
|
1022 |
styles['transform'] = transformForCss({
|
|
|
1023 |
transform: transform,
|
|
|
1024 |
startCentered: true,
|
|
|
1025 |
width: width,
|
|
|
1026 |
height: height
|
|
|
1027 |
});
|
|
|
1028 |
styles['-webkit-transform'] = styles['transform'];
|
|
|
1029 |
}
|
|
|
1030 |
|
|
|
1031 |
var styleString = joinStyles(styles);
|
|
|
1032 |
|
|
|
1033 |
if (styleString.length > 0) {
|
|
|
1034 |
attributes['style'] = styleString;
|
|
|
1035 |
}
|
|
|
1036 |
|
|
|
1037 |
var val = [];
|
|
|
1038 |
val.push({
|
|
|
1039 |
tag: 'span',
|
|
|
1040 |
attributes: attributes,
|
|
|
1041 |
children: [content]
|
|
|
1042 |
});
|
|
|
1043 |
|
|
|
1044 |
if (title) {
|
|
|
1045 |
val.push({
|
|
|
1046 |
tag: 'span',
|
|
|
1047 |
attributes: {
|
|
|
1048 |
class: 'sr-only'
|
|
|
1049 |
},
|
|
|
1050 |
children: [title]
|
|
|
1051 |
});
|
|
|
1052 |
}
|
|
|
1053 |
|
|
|
1054 |
return val;
|
|
|
1055 |
}
|
|
|
1056 |
function makeLayersCounterAbstract(params) {
|
|
|
1057 |
var content = params.content,
|
|
|
1058 |
title = params.title,
|
|
|
1059 |
extra = params.extra;
|
|
|
1060 |
|
|
|
1061 |
var attributes = _objectSpread({}, extra.attributes, title ? {
|
|
|
1062 |
'title': title
|
|
|
1063 |
} : {}, {
|
|
|
1064 |
'class': extra.classes.join(' ')
|
|
|
1065 |
});
|
|
|
1066 |
|
|
|
1067 |
var styleString = joinStyles(extra.styles);
|
|
|
1068 |
|
|
|
1069 |
if (styleString.length > 0) {
|
|
|
1070 |
attributes['style'] = styleString;
|
|
|
1071 |
}
|
|
|
1072 |
|
|
|
1073 |
var val = [];
|
|
|
1074 |
val.push({
|
|
|
1075 |
tag: 'span',
|
|
|
1076 |
attributes: attributes,
|
|
|
1077 |
children: [content]
|
|
|
1078 |
});
|
|
|
1079 |
|
|
|
1080 |
if (title) {
|
|
|
1081 |
val.push({
|
|
|
1082 |
tag: 'span',
|
|
|
1083 |
attributes: {
|
|
|
1084 |
class: 'sr-only'
|
|
|
1085 |
},
|
|
|
1086 |
children: [title]
|
|
|
1087 |
});
|
|
|
1088 |
}
|
|
|
1089 |
|
|
|
1090 |
return val;
|
|
|
1091 |
}
|
|
|
1092 |
|
|
|
1093 |
var noop$1 = function noop() {};
|
|
|
1094 |
|
|
|
1095 |
var p = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : {
|
|
|
1096 |
mark: noop$1,
|
|
|
1097 |
measure: noop$1
|
|
|
1098 |
};
|
|
|
1099 |
var preamble = "FA \"5.10.2\"";
|
|
|
1100 |
|
|
|
1101 |
var begin = function begin(name) {
|
|
|
1102 |
p.mark("".concat(preamble, " ").concat(name, " begins"));
|
|
|
1103 |
return function () {
|
|
|
1104 |
return end(name);
|
|
|
1105 |
};
|
|
|
1106 |
};
|
|
|
1107 |
|
|
|
1108 |
var end = function end(name) {
|
|
|
1109 |
p.mark("".concat(preamble, " ").concat(name, " ends"));
|
|
|
1110 |
p.measure("".concat(preamble, " ").concat(name), "".concat(preamble, " ").concat(name, " begins"), "".concat(preamble, " ").concat(name, " ends"));
|
|
|
1111 |
};
|
|
|
1112 |
|
|
|
1113 |
var perf = {
|
|
|
1114 |
begin: begin,
|
|
|
1115 |
end: end
|
|
|
1116 |
};
|
|
|
1117 |
|
|
|
1118 |
/**
|
|
|
1119 |
* Internal helper to bind a function known to have 4 arguments
|
|
|
1120 |
* to a given context.
|
|
|
1121 |
*/
|
|
|
1122 |
|
|
|
1123 |
var bindInternal4 = function bindInternal4(func, thisContext) {
|
|
|
1124 |
return function (a, b, c, d) {
|
|
|
1125 |
return func.call(thisContext, a, b, c, d);
|
|
|
1126 |
};
|
|
|
1127 |
};
|
|
|
1128 |
|
|
|
1129 |
/**
|
|
|
1130 |
* # Reduce
|
|
|
1131 |
*
|
|
|
1132 |
* A fast object `.reduce()` implementation.
|
|
|
1133 |
*
|
|
|
1134 |
* @param {Object} subject The object to reduce over.
|
|
|
1135 |
* @param {Function} fn The reducer function.
|
|
|
1136 |
* @param {mixed} initialValue The initial value for the reducer, defaults to subject[0].
|
|
|
1137 |
* @param {Object} thisContext The context for the reducer.
|
|
|
1138 |
* @return {mixed} The final result.
|
|
|
1139 |
*/
|
|
|
1140 |
|
|
|
1141 |
|
|
|
1142 |
var reduce = function fastReduceObject(subject, fn, initialValue, thisContext) {
|
|
|
1143 |
var keys = Object.keys(subject),
|
|
|
1144 |
length = keys.length,
|
|
|
1145 |
iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
|
|
|
1146 |
i,
|
|
|
1147 |
key,
|
|
|
1148 |
result;
|
|
|
1149 |
|
|
|
1150 |
if (initialValue === undefined) {
|
|
|
1151 |
i = 1;
|
|
|
1152 |
result = subject[keys[0]];
|
|
|
1153 |
} else {
|
|
|
1154 |
i = 0;
|
|
|
1155 |
result = initialValue;
|
|
|
1156 |
}
|
|
|
1157 |
|
|
|
1158 |
for (; i < length; i++) {
|
|
|
1159 |
key = keys[i];
|
|
|
1160 |
result = iterator(result, subject[key], key, subject);
|
|
|
1161 |
}
|
|
|
1162 |
|
|
|
1163 |
return result;
|
|
|
1164 |
};
|
|
|
1165 |
|
|
|
1166 |
function toHex(unicode) {
|
|
|
1167 |
var result = '';
|
|
|
1168 |
|
|
|
1169 |
for (var i = 0; i < unicode.length; i++) {
|
|
|
1170 |
var hex = unicode.charCodeAt(i).toString(16);
|
|
|
1171 |
result += ('000' + hex).slice(-4);
|
|
|
1172 |
}
|
|
|
1173 |
|
|
|
1174 |
return result;
|
|
|
1175 |
}
|
|
|
1176 |
|
|
|
1177 |
function defineIcons(prefix, icons) {
|
|
|
1178 |
var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
|
1179 |
var _params$skipHooks = params.skipHooks,
|
|
|
1180 |
skipHooks = _params$skipHooks === void 0 ? false : _params$skipHooks;
|
|
|
1181 |
var normalized = Object.keys(icons).reduce(function (acc, iconName) {
|
|
|
1182 |
var icon = icons[iconName];
|
|
|
1183 |
var expanded = !!icon.icon;
|
|
|
1184 |
|
|
|
1185 |
if (expanded) {
|
|
|
1186 |
acc[icon.iconName] = icon.icon;
|
|
|
1187 |
} else {
|
|
|
1188 |
acc[iconName] = icon;
|
|
|
1189 |
}
|
|
|
1190 |
|
|
|
1191 |
return acc;
|
|
|
1192 |
}, {});
|
|
|
1193 |
|
|
|
1194 |
if (typeof namespace.hooks.addPack === 'function' && !skipHooks) {
|
|
|
1195 |
namespace.hooks.addPack(prefix, normalized);
|
|
|
1196 |
} else {
|
|
|
1197 |
namespace.styles[prefix] = _objectSpread({}, namespace.styles[prefix] || {}, normalized);
|
|
|
1198 |
}
|
|
|
1199 |
/**
|
|
|
1200 |
* Font Awesome 4 used the prefix of `fa` for all icons. With the introduction
|
|
|
1201 |
* of new styles we needed to differentiate between them. Prefix `fa` is now an alias
|
|
|
1202 |
* for `fas` so we'll easy the upgrade process for our users by automatically defining
|
|
|
1203 |
* this as well.
|
|
|
1204 |
*/
|
|
|
1205 |
|
|
|
1206 |
|
|
|
1207 |
if (prefix === 'fas') {
|
|
|
1208 |
defineIcons('fa', icons);
|
|
|
1209 |
}
|
|
|
1210 |
}
|
|
|
1211 |
|
|
|
1212 |
var styles = namespace.styles,
|
|
|
1213 |
shims = namespace.shims;
|
|
|
1214 |
var _byUnicode = {};
|
|
|
1215 |
var _byLigature = {};
|
|
|
1216 |
var _byOldName = {};
|
|
|
1217 |
var build = function build() {
|
|
|
1218 |
var lookup = function lookup(reducer) {
|
|
|
1219 |
return reduce(styles, function (o, style, prefix) {
|
|
|
1220 |
o[prefix] = reduce(style, reducer, {});
|
|
|
1221 |
return o;
|
|
|
1222 |
}, {});
|
|
|
1223 |
};
|
|
|
1224 |
|
|
|
1225 |
_byUnicode = lookup(function (acc, icon, iconName) {
|
|
|
1226 |
if (icon[3]) {
|
|
|
1227 |
acc[icon[3]] = iconName;
|
|
|
1228 |
}
|
|
|
1229 |
|
|
|
1230 |
return acc;
|
|
|
1231 |
});
|
|
|
1232 |
_byLigature = lookup(function (acc, icon, iconName) {
|
|
|
1233 |
var ligatures = icon[2];
|
|
|
1234 |
acc[iconName] = iconName;
|
|
|
1235 |
ligatures.forEach(function (ligature) {
|
|
|
1236 |
acc[ligature] = iconName;
|
|
|
1237 |
});
|
|
|
1238 |
return acc;
|
|
|
1239 |
});
|
|
|
1240 |
var hasRegular = 'far' in styles;
|
|
|
1241 |
_byOldName = reduce(shims, function (acc, shim) {
|
|
|
1242 |
var oldName = shim[0];
|
|
|
1243 |
var prefix = shim[1];
|
|
|
1244 |
var iconName = shim[2];
|
|
|
1245 |
|
|
|
1246 |
if (prefix === 'far' && !hasRegular) {
|
|
|
1247 |
prefix = 'fas';
|
|
|
1248 |
}
|
|
|
1249 |
|
|
|
1250 |
acc[oldName] = {
|
|
|
1251 |
prefix: prefix,
|
|
|
1252 |
iconName: iconName
|
|
|
1253 |
};
|
|
|
1254 |
return acc;
|
|
|
1255 |
}, {});
|
|
|
1256 |
};
|
|
|
1257 |
build();
|
|
|
1258 |
function byUnicode(prefix, unicode) {
|
|
|
1259 |
return (_byUnicode[prefix] || {})[unicode];
|
|
|
1260 |
}
|
|
|
1261 |
function byLigature(prefix, ligature) {
|
|
|
1262 |
return (_byLigature[prefix] || {})[ligature];
|
|
|
1263 |
}
|
|
|
1264 |
function byOldName(name) {
|
|
|
1265 |
return _byOldName[name] || {
|
|
|
1266 |
prefix: null,
|
|
|
1267 |
iconName: null
|
|
|
1268 |
};
|
|
|
1269 |
}
|
|
|
1270 |
|
|
|
1271 |
var styles$1 = namespace.styles;
|
|
|
1272 |
var emptyCanonicalIcon = function emptyCanonicalIcon() {
|
|
|
1273 |
return {
|
|
|
1274 |
prefix: null,
|
|
|
1275 |
iconName: null,
|
|
|
1276 |
rest: []
|
|
|
1277 |
};
|
|
|
1278 |
};
|
|
|
1279 |
function getCanonicalIcon(values) {
|
|
|
1280 |
return values.reduce(function (acc, cls) {
|
|
|
1281 |
var iconName = getIconName(config.familyPrefix, cls);
|
|
|
1282 |
|
|
|
1283 |
if (styles$1[cls]) {
|
|
|
1284 |
acc.prefix = cls;
|
|
|
1285 |
} else if (config.autoFetchSvg && ['fas', 'far', 'fal', 'fad', 'fab', 'fa'].indexOf(cls) > -1) {
|
|
|
1286 |
acc.prefix = cls;
|
|
|
1287 |
} else if (iconName) {
|
|
|
1288 |
var shim = acc.prefix === 'fa' ? byOldName(iconName) : {};
|
|
|
1289 |
acc.iconName = shim.iconName || iconName;
|
|
|
1290 |
acc.prefix = shim.prefix || acc.prefix;
|
|
|
1291 |
} else if (cls !== config.replacementClass && cls.indexOf('fa-w-') !== 0) {
|
|
|
1292 |
acc.rest.push(cls);
|
|
|
1293 |
}
|
|
|
1294 |
|
|
|
1295 |
return acc;
|
|
|
1296 |
}, emptyCanonicalIcon());
|
|
|
1297 |
}
|
|
|
1298 |
function iconFromMapping(mapping, prefix, iconName) {
|
|
|
1299 |
if (mapping && mapping[prefix] && mapping[prefix][iconName]) {
|
|
|
1300 |
return {
|
|
|
1301 |
prefix: prefix,
|
|
|
1302 |
iconName: iconName,
|
|
|
1303 |
icon: mapping[prefix][iconName]
|
|
|
1304 |
};
|
|
|
1305 |
}
|
|
|
1306 |
}
|
|
|
1307 |
|
|
|
1308 |
function toHtml(abstractNodes) {
|
|
|
1309 |
var tag = abstractNodes.tag,
|
|
|
1310 |
_abstractNodes$attrib = abstractNodes.attributes,
|
|
|
1311 |
attributes = _abstractNodes$attrib === void 0 ? {} : _abstractNodes$attrib,
|
|
|
1312 |
_abstractNodes$childr = abstractNodes.children,
|
|
|
1313 |
children = _abstractNodes$childr === void 0 ? [] : _abstractNodes$childr;
|
|
|
1314 |
|
|
|
1315 |
if (typeof abstractNodes === 'string') {
|
|
|
1316 |
return htmlEscape(abstractNodes);
|
|
|
1317 |
} else {
|
|
|
1318 |
return "<".concat(tag, " ").concat(joinAttributes(attributes), ">").concat(children.map(toHtml).join(''), "</").concat(tag, ">");
|
|
|
1319 |
}
|
|
|
1320 |
}
|
|
|
1321 |
|
|
|
1322 |
var noop$2 = function noop() {};
|
|
|
1323 |
|
|
|
1324 |
function isWatched(node) {
|
|
|
1325 |
var i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null;
|
|
|
1326 |
return typeof i2svg === 'string';
|
|
|
1327 |
}
|
|
|
1328 |
|
|
|
1329 |
function getMutator() {
|
|
|
1330 |
if (config.autoReplaceSvg === true) {
|
|
|
1331 |
return mutators.replace;
|
|
|
1332 |
}
|
|
|
1333 |
|
|
|
1334 |
var mutator = mutators[config.autoReplaceSvg];
|
|
|
1335 |
return mutator || mutators.replace;
|
|
|
1336 |
}
|
|
|
1337 |
|
|
|
1338 |
var mutators = {
|
|
|
1339 |
replace: function replace(mutation) {
|
|
|
1340 |
var node = mutation[0];
|
|
|
1341 |
var abstract = mutation[1];
|
|
|
1342 |
var newOuterHTML = abstract.map(function (a) {
|
|
|
1343 |
return toHtml(a);
|
|
|
1344 |
}).join('\n');
|
|
|
1345 |
|
|
|
1346 |
if (node.parentNode && node.outerHTML) {
|
|
|
1347 |
node.outerHTML = newOuterHTML + (config.keepOriginalSource && node.tagName.toLowerCase() !== 'svg' ? "<!-- ".concat(node.outerHTML, " -->") : '');
|
|
|
1348 |
} else if (node.parentNode) {
|
|
|
1349 |
var newNode = document.createElement('span');
|
|
|
1350 |
node.parentNode.replaceChild(newNode, node);
|
|
|
1351 |
newNode.outerHTML = newOuterHTML;
|
|
|
1352 |
}
|
|
|
1353 |
},
|
|
|
1354 |
nest: function nest(mutation) {
|
|
|
1355 |
var node = mutation[0];
|
|
|
1356 |
var abstract = mutation[1]; // If we already have a replaced node we do not want to continue nesting within it.
|
|
|
1357 |
// Short-circuit to the standard replacement
|
|
|
1358 |
|
|
|
1359 |
if (~classArray(node).indexOf(config.replacementClass)) {
|
|
|
1360 |
return mutators.replace(mutation);
|
|
|
1361 |
}
|
|
|
1362 |
|
|
|
1363 |
var forSvg = new RegExp("".concat(config.familyPrefix, "-.*"));
|
|
|
1364 |
delete abstract[0].attributes.style;
|
|
|
1365 |
var splitClasses = abstract[0].attributes.class.split(' ').reduce(function (acc, cls) {
|
|
|
1366 |
if (cls === config.replacementClass || cls.match(forSvg)) {
|
|
|
1367 |
acc.toSvg.push(cls);
|
|
|
1368 |
} else {
|
|
|
1369 |
acc.toNode.push(cls);
|
|
|
1370 |
}
|
|
|
1371 |
|
|
|
1372 |
return acc;
|
|
|
1373 |
}, {
|
|
|
1374 |
toNode: [],
|
|
|
1375 |
toSvg: []
|
|
|
1376 |
});
|
|
|
1377 |
abstract[0].attributes.class = splitClasses.toSvg.join(' ');
|
|
|
1378 |
var newInnerHTML = abstract.map(function (a) {
|
|
|
1379 |
return toHtml(a);
|
|
|
1380 |
}).join('\n');
|
|
|
1381 |
node.setAttribute('class', splitClasses.toNode.join(' '));
|
|
|
1382 |
node.setAttribute(DATA_FA_I2SVG, '');
|
|
|
1383 |
node.innerHTML = newInnerHTML;
|
|
|
1384 |
}
|
|
|
1385 |
};
|
|
|
1386 |
|
|
|
1387 |
function performOperationSync(op) {
|
|
|
1388 |
op();
|
|
|
1389 |
}
|
|
|
1390 |
|
|
|
1391 |
function perform(mutations, callback) {
|
|
|
1392 |
var callbackFunction = typeof callback === 'function' ? callback : noop$2;
|
|
|
1393 |
|
|
|
1394 |
if (mutations.length === 0) {
|
|
|
1395 |
callbackFunction();
|
|
|
1396 |
} else {
|
|
|
1397 |
var frame = performOperationSync;
|
|
|
1398 |
|
|
|
1399 |
if (config.mutateApproach === MUTATION_APPROACH_ASYNC) {
|
|
|
1400 |
frame = WINDOW.requestAnimationFrame || performOperationSync;
|
|
|
1401 |
}
|
|
|
1402 |
|
|
|
1403 |
frame(function () {
|
|
|
1404 |
var mutator = getMutator();
|
|
|
1405 |
var mark = perf.begin('mutate');
|
|
|
1406 |
mutations.map(mutator);
|
|
|
1407 |
mark();
|
|
|
1408 |
callbackFunction();
|
|
|
1409 |
});
|
|
|
1410 |
}
|
|
|
1411 |
}
|
|
|
1412 |
var disabled = false;
|
|
|
1413 |
function disableObservation() {
|
|
|
1414 |
disabled = true;
|
|
|
1415 |
}
|
|
|
1416 |
function enableObservation() {
|
|
|
1417 |
disabled = false;
|
|
|
1418 |
}
|
|
|
1419 |
var mo = null;
|
|
|
1420 |
function observe(options) {
|
|
|
1421 |
if (!MUTATION_OBSERVER) {
|
|
|
1422 |
return;
|
|
|
1423 |
}
|
|
|
1424 |
|
|
|
1425 |
if (!config.observeMutations) {
|
|
|
1426 |
return;
|
|
|
1427 |
}
|
|
|
1428 |
|
|
|
1429 |
var treeCallback = options.treeCallback,
|
|
|
1430 |
nodeCallback = options.nodeCallback,
|
|
|
1431 |
pseudoElementsCallback = options.pseudoElementsCallback,
|
|
|
1432 |
_options$observeMutat = options.observeMutationsRoot,
|
|
|
1433 |
observeMutationsRoot = _options$observeMutat === void 0 ? DOCUMENT : _options$observeMutat;
|
|
|
1434 |
mo = new MUTATION_OBSERVER(function (objects) {
|
|
|
1435 |
if (disabled) return;
|
|
|
1436 |
toArray(objects).forEach(function (mutationRecord) {
|
|
|
1437 |
if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) {
|
|
|
1438 |
if (config.searchPseudoElements) {
|
|
|
1439 |
pseudoElementsCallback(mutationRecord.target);
|
|
|
1440 |
}
|
|
|
1441 |
|
|
|
1442 |
treeCallback(mutationRecord.target);
|
|
|
1443 |
}
|
|
|
1444 |
|
|
|
1445 |
if (mutationRecord.type === 'attributes' && mutationRecord.target.parentNode && config.searchPseudoElements) {
|
|
|
1446 |
pseudoElementsCallback(mutationRecord.target.parentNode);
|
|
|
1447 |
}
|
|
|
1448 |
|
|
|
1449 |
if (mutationRecord.type === 'attributes' && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) {
|
|
|
1450 |
if (mutationRecord.attributeName === 'class') {
|
|
|
1451 |
var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)),
|
|
|
1452 |
prefix = _getCanonicalIcon.prefix,
|
|
|
1453 |
iconName = _getCanonicalIcon.iconName;
|
|
|
1454 |
|
|
|
1455 |
if (prefix) mutationRecord.target.setAttribute('data-prefix', prefix);
|
|
|
1456 |
if (iconName) mutationRecord.target.setAttribute('data-icon', iconName);
|
|
|
1457 |
} else {
|
|
|
1458 |
nodeCallback(mutationRecord.target);
|
|
|
1459 |
}
|
|
|
1460 |
}
|
|
|
1461 |
});
|
|
|
1462 |
});
|
|
|
1463 |
if (!IS_DOM) return;
|
|
|
1464 |
mo.observe(observeMutationsRoot, {
|
|
|
1465 |
childList: true,
|
|
|
1466 |
attributes: true,
|
|
|
1467 |
characterData: true,
|
|
|
1468 |
subtree: true
|
|
|
1469 |
});
|
|
|
1470 |
}
|
|
|
1471 |
function disconnect() {
|
|
|
1472 |
if (!mo) return;
|
|
|
1473 |
mo.disconnect();
|
|
|
1474 |
}
|
|
|
1475 |
|
|
|
1476 |
function styleParser (node) {
|
|
|
1477 |
var style = node.getAttribute('style');
|
|
|
1478 |
var val = [];
|
|
|
1479 |
|
|
|
1480 |
if (style) {
|
|
|
1481 |
val = style.split(';').reduce(function (acc, style) {
|
|
|
1482 |
var styles = style.split(':');
|
|
|
1483 |
var prop = styles[0];
|
|
|
1484 |
var value = styles.slice(1);
|
|
|
1485 |
|
|
|
1486 |
if (prop && value.length > 0) {
|
|
|
1487 |
acc[prop] = value.join(':').trim();
|
|
|
1488 |
}
|
|
|
1489 |
|
|
|
1490 |
return acc;
|
|
|
1491 |
}, {});
|
|
|
1492 |
}
|
|
|
1493 |
|
|
|
1494 |
return val;
|
|
|
1495 |
}
|
|
|
1496 |
|
|
|
1497 |
function classParser (node) {
|
|
|
1498 |
var existingPrefix = node.getAttribute('data-prefix');
|
|
|
1499 |
var existingIconName = node.getAttribute('data-icon');
|
|
|
1500 |
var innerText = node.innerText !== undefined ? node.innerText.trim() : '';
|
|
|
1501 |
var val = getCanonicalIcon(classArray(node));
|
|
|
1502 |
|
|
|
1503 |
if (existingPrefix && existingIconName) {
|
|
|
1504 |
val.prefix = existingPrefix;
|
|
|
1505 |
val.iconName = existingIconName;
|
|
|
1506 |
}
|
|
|
1507 |
|
|
|
1508 |
if (val.prefix && innerText.length > 1) {
|
|
|
1509 |
val.iconName = byLigature(val.prefix, node.innerText);
|
|
|
1510 |
} else if (val.prefix && innerText.length === 1) {
|
|
|
1511 |
val.iconName = byUnicode(val.prefix, toHex(node.innerText));
|
|
|
1512 |
}
|
|
|
1513 |
|
|
|
1514 |
return val;
|
|
|
1515 |
}
|
|
|
1516 |
|
|
|
1517 |
var parseTransformString = function parseTransformString(transformString) {
|
|
|
1518 |
var transform = {
|
|
|
1519 |
size: 16,
|
|
|
1520 |
x: 0,
|
|
|
1521 |
y: 0,
|
|
|
1522 |
flipX: false,
|
|
|
1523 |
flipY: false,
|
|
|
1524 |
rotate: 0
|
|
|
1525 |
};
|
|
|
1526 |
|
|
|
1527 |
if (!transformString) {
|
|
|
1528 |
return transform;
|
|
|
1529 |
} else {
|
|
|
1530 |
return transformString.toLowerCase().split(' ').reduce(function (acc, n) {
|
|
|
1531 |
var parts = n.toLowerCase().split('-');
|
|
|
1532 |
var first = parts[0];
|
|
|
1533 |
var rest = parts.slice(1).join('-');
|
|
|
1534 |
|
|
|
1535 |
if (first && rest === 'h') {
|
|
|
1536 |
acc.flipX = true;
|
|
|
1537 |
return acc;
|
|
|
1538 |
}
|
|
|
1539 |
|
|
|
1540 |
if (first && rest === 'v') {
|
|
|
1541 |
acc.flipY = true;
|
|
|
1542 |
return acc;
|
|
|
1543 |
}
|
|
|
1544 |
|
|
|
1545 |
rest = parseFloat(rest);
|
|
|
1546 |
|
|
|
1547 |
if (isNaN(rest)) {
|
|
|
1548 |
return acc;
|
|
|
1549 |
}
|
|
|
1550 |
|
|
|
1551 |
switch (first) {
|
|
|
1552 |
case 'grow':
|
|
|
1553 |
acc.size = acc.size + rest;
|
|
|
1554 |
break;
|
|
|
1555 |
|
|
|
1556 |
case 'shrink':
|
|
|
1557 |
acc.size = acc.size - rest;
|
|
|
1558 |
break;
|
|
|
1559 |
|
|
|
1560 |
case 'left':
|
|
|
1561 |
acc.x = acc.x - rest;
|
|
|
1562 |
break;
|
|
|
1563 |
|
|
|
1564 |
case 'right':
|
|
|
1565 |
acc.x = acc.x + rest;
|
|
|
1566 |
break;
|
|
|
1567 |
|
|
|
1568 |
case 'up':
|
|
|
1569 |
acc.y = acc.y - rest;
|
|
|
1570 |
break;
|
|
|
1571 |
|
|
|
1572 |
case 'down':
|
|
|
1573 |
acc.y = acc.y + rest;
|
|
|
1574 |
break;
|
|
|
1575 |
|
|
|
1576 |
case 'rotate':
|
|
|
1577 |
acc.rotate = acc.rotate + rest;
|
|
|
1578 |
break;
|
|
|
1579 |
}
|
|
|
1580 |
|
|
|
1581 |
return acc;
|
|
|
1582 |
}, transform);
|
|
|
1583 |
}
|
|
|
1584 |
};
|
|
|
1585 |
function transformParser (node) {
|
|
|
1586 |
return parseTransformString(node.getAttribute('data-fa-transform'));
|
|
|
1587 |
}
|
|
|
1588 |
|
|
|
1589 |
function symbolParser (node) {
|
|
|
1590 |
var symbol = node.getAttribute('data-fa-symbol');
|
|
|
1591 |
return symbol === null ? false : symbol === '' ? true : symbol;
|
|
|
1592 |
}
|
|
|
1593 |
|
|
|
1594 |
function attributesParser (node) {
|
|
|
1595 |
var extraAttributes = toArray(node.attributes).reduce(function (acc, attr) {
|
|
|
1596 |
if (acc.name !== 'class' && acc.name !== 'style') {
|
|
|
1597 |
acc[attr.name] = attr.value;
|
|
|
1598 |
}
|
|
|
1599 |
|
|
|
1600 |
return acc;
|
|
|
1601 |
}, {});
|
|
|
1602 |
var title = node.getAttribute('title');
|
|
|
1603 |
|
|
|
1604 |
if (config.autoA11y) {
|
|
|
1605 |
if (title) {
|
|
|
1606 |
extraAttributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(nextUniqueId());
|
|
|
1607 |
} else {
|
|
|
1608 |
extraAttributes['aria-hidden'] = 'true';
|
|
|
1609 |
extraAttributes['focusable'] = 'false';
|
|
|
1610 |
}
|
|
|
1611 |
}
|
|
|
1612 |
|
|
|
1613 |
return extraAttributes;
|
|
|
1614 |
}
|
|
|
1615 |
|
|
|
1616 |
function maskParser (node) {
|
|
|
1617 |
var mask = node.getAttribute('data-fa-mask');
|
|
|
1618 |
|
|
|
1619 |
if (!mask) {
|
|
|
1620 |
return emptyCanonicalIcon();
|
|
|
1621 |
} else {
|
|
|
1622 |
return getCanonicalIcon(mask.split(' ').map(function (i) {
|
|
|
1623 |
return i.trim();
|
|
|
1624 |
}));
|
|
|
1625 |
}
|
|
|
1626 |
}
|
|
|
1627 |
|
|
|
1628 |
function blankMeta() {
|
|
|
1629 |
return {
|
|
|
1630 |
iconName: null,
|
|
|
1631 |
title: null,
|
|
|
1632 |
prefix: null,
|
|
|
1633 |
transform: meaninglessTransform,
|
|
|
1634 |
symbol: false,
|
|
|
1635 |
mask: null,
|
|
|
1636 |
extra: {
|
|
|
1637 |
classes: [],
|
|
|
1638 |
styles: {},
|
|
|
1639 |
attributes: {}
|
|
|
1640 |
}
|
|
|
1641 |
};
|
|
|
1642 |
}
|
|
|
1643 |
function parseMeta(node) {
|
|
|
1644 |
var _classParser = classParser(node),
|
|
|
1645 |
iconName = _classParser.iconName,
|
|
|
1646 |
prefix = _classParser.prefix,
|
|
|
1647 |
extraClasses = _classParser.rest;
|
|
|
1648 |
|
|
|
1649 |
var extraStyles = styleParser(node);
|
|
|
1650 |
var transform = transformParser(node);
|
|
|
1651 |
var symbol = symbolParser(node);
|
|
|
1652 |
var extraAttributes = attributesParser(node);
|
|
|
1653 |
var mask = maskParser(node);
|
|
|
1654 |
return {
|
|
|
1655 |
iconName: iconName,
|
|
|
1656 |
title: node.getAttribute('title'),
|
|
|
1657 |
prefix: prefix,
|
|
|
1658 |
transform: transform,
|
|
|
1659 |
symbol: symbol,
|
|
|
1660 |
mask: mask,
|
|
|
1661 |
extra: {
|
|
|
1662 |
classes: extraClasses,
|
|
|
1663 |
styles: extraStyles,
|
|
|
1664 |
attributes: extraAttributes
|
|
|
1665 |
}
|
|
|
1666 |
};
|
|
|
1667 |
}
|
|
|
1668 |
|
|
|
1669 |
function MissingIcon(error) {
|
|
|
1670 |
this.name = 'MissingIcon';
|
|
|
1671 |
this.message = error || 'Icon unavailable';
|
|
|
1672 |
this.stack = new Error().stack;
|
|
|
1673 |
}
|
|
|
1674 |
MissingIcon.prototype = Object.create(Error.prototype);
|
|
|
1675 |
MissingIcon.prototype.constructor = MissingIcon;
|
|
|
1676 |
|
|
|
1677 |
var FILL = {
|
|
|
1678 |
fill: 'currentColor'
|
|
|
1679 |
};
|
|
|
1680 |
var ANIMATION_BASE = {
|
|
|
1681 |
attributeType: 'XML',
|
|
|
1682 |
repeatCount: 'indefinite',
|
|
|
1683 |
dur: '2s'
|
|
|
1684 |
};
|
|
|
1685 |
var RING = {
|
|
|
1686 |
tag: 'path',
|
|
|
1687 |
attributes: _objectSpread({}, FILL, {
|
|
|
1688 |
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'
|
|
|
1689 |
})
|
|
|
1690 |
};
|
|
|
1691 |
|
|
|
1692 |
var OPACITY_ANIMATE = _objectSpread({}, ANIMATION_BASE, {
|
|
|
1693 |
attributeName: 'opacity'
|
|
|
1694 |
});
|
|
|
1695 |
|
|
|
1696 |
var DOT = {
|
|
|
1697 |
tag: 'circle',
|
|
|
1698 |
attributes: _objectSpread({}, FILL, {
|
|
|
1699 |
cx: '256',
|
|
|
1700 |
cy: '364',
|
|
|
1701 |
r: '28'
|
|
|
1702 |
}),
|
|
|
1703 |
children: [{
|
|
|
1704 |
tag: 'animate',
|
|
|
1705 |
attributes: _objectSpread({}, ANIMATION_BASE, {
|
|
|
1706 |
attributeName: 'r',
|
|
|
1707 |
values: '28;14;28;28;14;28;'
|
|
|
1708 |
})
|
|
|
1709 |
}, {
|
|
|
1710 |
tag: 'animate',
|
|
|
1711 |
attributes: _objectSpread({}, OPACITY_ANIMATE, {
|
|
|
1712 |
values: '1;0;1;1;0;1;'
|
|
|
1713 |
})
|
|
|
1714 |
}]
|
|
|
1715 |
};
|
|
|
1716 |
var QUESTION = {
|
|
|
1717 |
tag: 'path',
|
|
|
1718 |
attributes: _objectSpread({}, FILL, {
|
|
|
1719 |
opacity: '1',
|
|
|
1720 |
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'
|
|
|
1721 |
}),
|
|
|
1722 |
children: [{
|
|
|
1723 |
tag: 'animate',
|
|
|
1724 |
attributes: _objectSpread({}, OPACITY_ANIMATE, {
|
|
|
1725 |
values: '1;0;0;0;0;1;'
|
|
|
1726 |
})
|
|
|
1727 |
}]
|
|
|
1728 |
};
|
|
|
1729 |
var EXCLAMATION = {
|
|
|
1730 |
tag: 'path',
|
|
|
1731 |
attributes: _objectSpread({}, FILL, {
|
|
|
1732 |
opacity: '0',
|
|
|
1733 |
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'
|
|
|
1734 |
}),
|
|
|
1735 |
children: [{
|
|
|
1736 |
tag: 'animate',
|
|
|
1737 |
attributes: _objectSpread({}, OPACITY_ANIMATE, {
|
|
|
1738 |
values: '0;0;1;1;0;0;'
|
|
|
1739 |
})
|
|
|
1740 |
}]
|
|
|
1741 |
};
|
|
|
1742 |
var missing = {
|
|
|
1743 |
tag: 'g',
|
|
|
1744 |
children: [RING, DOT, QUESTION, EXCLAMATION]
|
|
|
1745 |
};
|
|
|
1746 |
|
|
|
1747 |
var styles$2 = namespace.styles;
|
|
|
1748 |
function asFoundIcon(icon) {
|
|
|
1749 |
var width = icon[0];
|
|
|
1750 |
var height = icon[1];
|
|
|
1751 |
|
|
|
1752 |
var _icon$slice = icon.slice(4),
|
|
|
1753 |
_icon$slice2 = _slicedToArray(_icon$slice, 1),
|
|
|
1754 |
vectorData = _icon$slice2[0];
|
|
|
1755 |
|
|
|
1756 |
var element = null;
|
|
|
1757 |
|
|
|
1758 |
if (Array.isArray(vectorData)) {
|
|
|
1759 |
element = {
|
|
|
1760 |
tag: 'g',
|
|
|
1761 |
attributes: {
|
|
|
1762 |
class: "".concat(config.familyPrefix, "-").concat(DUOTONE_CLASSES.GROUP)
|
|
|
1763 |
},
|
|
|
1764 |
children: [{
|
|
|
1765 |
tag: 'path',
|
|
|
1766 |
attributes: {
|
|
|
1767 |
class: "".concat(config.familyPrefix, "-").concat(DUOTONE_CLASSES.SECONDARY),
|
|
|
1768 |
fill: 'currentColor',
|
|
|
1769 |
d: vectorData[0]
|
|
|
1770 |
}
|
|
|
1771 |
}, {
|
|
|
1772 |
tag: 'path',
|
|
|
1773 |
attributes: {
|
|
|
1774 |
class: "".concat(config.familyPrefix, "-").concat(DUOTONE_CLASSES.PRIMARY),
|
|
|
1775 |
fill: 'currentColor',
|
|
|
1776 |
d: vectorData[1]
|
|
|
1777 |
}
|
|
|
1778 |
}]
|
|
|
1779 |
};
|
|
|
1780 |
} else {
|
|
|
1781 |
element = {
|
|
|
1782 |
tag: 'path',
|
|
|
1783 |
attributes: {
|
|
|
1784 |
fill: 'currentColor',
|
|
|
1785 |
d: vectorData
|
|
|
1786 |
}
|
|
|
1787 |
};
|
|
|
1788 |
}
|
|
|
1789 |
|
|
|
1790 |
return {
|
|
|
1791 |
found: true,
|
|
|
1792 |
width: width,
|
|
|
1793 |
height: height,
|
|
|
1794 |
icon: element
|
|
|
1795 |
};
|
|
|
1796 |
}
|
|
|
1797 |
function findIcon(iconName, prefix) {
|
|
|
1798 |
return new picked(function (resolve, reject) {
|
|
|
1799 |
var val = {
|
|
|
1800 |
found: false,
|
|
|
1801 |
width: 512,
|
|
|
1802 |
height: 512,
|
|
|
1803 |
icon: missing
|
|
|
1804 |
};
|
|
|
1805 |
|
|
|
1806 |
if (iconName && prefix && styles$2[prefix] && styles$2[prefix][iconName]) {
|
|
|
1807 |
var icon = styles$2[prefix][iconName];
|
|
|
1808 |
return resolve(asFoundIcon(icon));
|
|
|
1809 |
}
|
|
|
1810 |
|
|
|
1811 |
if (iconName && prefix && !config.showMissingIcons) {
|
|
|
1812 |
reject(new MissingIcon("Icon is missing for prefix ".concat(prefix, " with icon name ").concat(iconName)));
|
|
|
1813 |
} else {
|
|
|
1814 |
resolve(val);
|
|
|
1815 |
}
|
|
|
1816 |
});
|
|
|
1817 |
}
|
|
|
1818 |
|
|
|
1819 |
var styles$3 = namespace.styles;
|
|
|
1820 |
|
|
|
1821 |
function generateSvgReplacementMutation(node, nodeMeta) {
|
|
|
1822 |
var iconName = nodeMeta.iconName,
|
|
|
1823 |
title = nodeMeta.title,
|
|
|
1824 |
prefix = nodeMeta.prefix,
|
|
|
1825 |
transform = nodeMeta.transform,
|
|
|
1826 |
symbol = nodeMeta.symbol,
|
|
|
1827 |
mask = nodeMeta.mask,
|
|
|
1828 |
extra = nodeMeta.extra;
|
|
|
1829 |
return new picked(function (resolve, reject) {
|
|
|
1830 |
picked.all([findIcon(iconName, prefix), findIcon(mask.iconName, mask.prefix)]).then(function (_ref) {
|
|
|
1831 |
var _ref2 = _slicedToArray(_ref, 2),
|
|
|
1832 |
main = _ref2[0],
|
|
|
1833 |
mask = _ref2[1];
|
|
|
1834 |
|
|
|
1835 |
resolve([node, makeInlineSvgAbstract({
|
|
|
1836 |
icons: {
|
|
|
1837 |
main: main,
|
|
|
1838 |
mask: mask
|
|
|
1839 |
},
|
|
|
1840 |
prefix: prefix,
|
|
|
1841 |
iconName: iconName,
|
|
|
1842 |
transform: transform,
|
|
|
1843 |
symbol: symbol,
|
|
|
1844 |
mask: mask,
|
|
|
1845 |
title: title,
|
|
|
1846 |
extra: extra,
|
|
|
1847 |
watchable: true
|
|
|
1848 |
})]);
|
|
|
1849 |
});
|
|
|
1850 |
});
|
|
|
1851 |
}
|
|
|
1852 |
|
|
|
1853 |
function generateLayersText(node, nodeMeta) {
|
|
|
1854 |
var title = nodeMeta.title,
|
|
|
1855 |
transform = nodeMeta.transform,
|
|
|
1856 |
extra = nodeMeta.extra;
|
|
|
1857 |
var width = null;
|
|
|
1858 |
var height = null;
|
|
|
1859 |
|
|
|
1860 |
if (IS_IE) {
|
|
|
1861 |
var computedFontSize = parseInt(getComputedStyle(node).fontSize, 10);
|
|
|
1862 |
var boundingClientRect = node.getBoundingClientRect();
|
|
|
1863 |
width = boundingClientRect.width / computedFontSize;
|
|
|
1864 |
height = boundingClientRect.height / computedFontSize;
|
|
|
1865 |
}
|
|
|
1866 |
|
|
|
1867 |
if (config.autoA11y && !title) {
|
|
|
1868 |
extra.attributes['aria-hidden'] = 'true';
|
|
|
1869 |
}
|
|
|
1870 |
|
|
|
1871 |
return picked.resolve([node, makeLayersTextAbstract({
|
|
|
1872 |
content: node.innerHTML,
|
|
|
1873 |
width: width,
|
|
|
1874 |
height: height,
|
|
|
1875 |
transform: transform,
|
|
|
1876 |
title: title,
|
|
|
1877 |
extra: extra,
|
|
|
1878 |
watchable: true
|
|
|
1879 |
})]);
|
|
|
1880 |
}
|
|
|
1881 |
|
|
|
1882 |
function generateMutation(node) {
|
|
|
1883 |
var nodeMeta = parseMeta(node);
|
|
|
1884 |
|
|
|
1885 |
if (~nodeMeta.extra.classes.indexOf(LAYERS_TEXT_CLASSNAME)) {
|
|
|
1886 |
return generateLayersText(node, nodeMeta);
|
|
|
1887 |
} else {
|
|
|
1888 |
return generateSvgReplacementMutation(node, nodeMeta);
|
|
|
1889 |
}
|
|
|
1890 |
}
|
|
|
1891 |
|
|
|
1892 |
function onTree(root) {
|
|
|
1893 |
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
|
1894 |
if (!IS_DOM) return;
|
|
|
1895 |
var htmlClassList = DOCUMENT.documentElement.classList;
|
|
|
1896 |
|
|
|
1897 |
var hclAdd = function hclAdd(suffix) {
|
|
|
1898 |
return htmlClassList.add("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
|
|
|
1899 |
};
|
|
|
1900 |
|
|
|
1901 |
var hclRemove = function hclRemove(suffix) {
|
|
|
1902 |
return htmlClassList.remove("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
|
|
|
1903 |
};
|
|
|
1904 |
|
|
|
1905 |
var prefixes = config.autoFetchSvg ? Object.keys(PREFIX_TO_STYLE) : Object.keys(styles$3);
|
|
|
1906 |
var prefixesDomQuery = [".".concat(LAYERS_TEXT_CLASSNAME, ":not([").concat(DATA_FA_I2SVG, "])")].concat(prefixes.map(function (p) {
|
|
|
1907 |
return ".".concat(p, ":not([").concat(DATA_FA_I2SVG, "])");
|
|
|
1908 |
})).join(', ');
|
|
|
1909 |
|
|
|
1910 |
if (prefixesDomQuery.length === 0) {
|
|
|
1911 |
return;
|
|
|
1912 |
}
|
|
|
1913 |
|
|
|
1914 |
var candidates = [];
|
|
|
1915 |
|
|
|
1916 |
try {
|
|
|
1917 |
candidates = toArray(root.querySelectorAll(prefixesDomQuery));
|
|
|
1918 |
} catch (e) {// noop
|
|
|
1919 |
}
|
|
|
1920 |
|
|
|
1921 |
if (candidates.length > 0) {
|
|
|
1922 |
hclAdd('pending');
|
|
|
1923 |
hclRemove('complete');
|
|
|
1924 |
} else {
|
|
|
1925 |
return;
|
|
|
1926 |
}
|
|
|
1927 |
|
|
|
1928 |
var mark = perf.begin('onTree');
|
|
|
1929 |
var mutations = candidates.reduce(function (acc, node) {
|
|
|
1930 |
try {
|
|
|
1931 |
var mutation = generateMutation(node);
|
|
|
1932 |
|
|
|
1933 |
if (mutation) {
|
|
|
1934 |
acc.push(mutation);
|
|
|
1935 |
}
|
|
|
1936 |
} catch (e) {
|
|
|
1937 |
if (!PRODUCTION) {
|
|
|
1938 |
if (e instanceof MissingIcon) {
|
|
|
1939 |
console.error(e);
|
|
|
1940 |
}
|
|
|
1941 |
}
|
|
|
1942 |
}
|
|
|
1943 |
|
|
|
1944 |
return acc;
|
|
|
1945 |
}, []);
|
|
|
1946 |
return new picked(function (resolve, reject) {
|
|
|
1947 |
picked.all(mutations).then(function (resolvedMutations) {
|
|
|
1948 |
perform(resolvedMutations, function () {
|
|
|
1949 |
hclAdd('active');
|
|
|
1950 |
hclAdd('complete');
|
|
|
1951 |
hclRemove('pending');
|
|
|
1952 |
if (typeof callback === 'function') callback();
|
|
|
1953 |
mark();
|
|
|
1954 |
resolve();
|
|
|
1955 |
});
|
|
|
1956 |
}).catch(function () {
|
|
|
1957 |
mark();
|
|
|
1958 |
reject();
|
|
|
1959 |
});
|
|
|
1960 |
});
|
|
|
1961 |
}
|
|
|
1962 |
function onNode(node) {
|
|
|
1963 |
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
|
1964 |
generateMutation(node).then(function (mutation) {
|
|
|
1965 |
if (mutation) {
|
|
|
1966 |
perform([mutation], callback);
|
|
|
1967 |
}
|
|
|
1968 |
});
|
|
|
1969 |
}
|
|
|
1970 |
|
|
|
1971 |
function replaceForPosition(node, position) {
|
|
|
1972 |
var pendingAttribute = "".concat(DATA_FA_PSEUDO_ELEMENT_PENDING).concat(position.replace(':', '-'));
|
|
|
1973 |
return new picked(function (resolve, reject) {
|
|
|
1974 |
if (node.getAttribute(pendingAttribute) !== null) {
|
|
|
1975 |
// This node is already being processed
|
|
|
1976 |
return resolve();
|
|
|
1977 |
}
|
|
|
1978 |
|
|
|
1979 |
var children = toArray(node.children);
|
|
|
1980 |
var alreadyProcessedPseudoElement = children.filter(function (c) {
|
|
|
1981 |
return c.getAttribute(DATA_FA_PSEUDO_ELEMENT) === position;
|
|
|
1982 |
})[0];
|
|
|
1983 |
var styles = WINDOW.getComputedStyle(node, position);
|
|
|
1984 |
var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);
|
|
|
1985 |
var fontWeight = styles.getPropertyValue('font-weight');
|
|
|
1986 |
|
|
|
1987 |
if (alreadyProcessedPseudoElement && !fontFamily) {
|
|
|
1988 |
// If we've already processed it but the current computed style does not result in a font-family,
|
|
|
1989 |
// that probably means that a class name that was previously present to make the icon has been
|
|
|
1990 |
// removed. So we now should delete the icon.
|
|
|
1991 |
node.removeChild(alreadyProcessedPseudoElement);
|
|
|
1992 |
return resolve();
|
|
|
1993 |
} else if (fontFamily) {
|
|
|
1994 |
var content = styles.getPropertyValue('content');
|
|
|
1995 |
var prefix = ~['Solid', 'Regular', 'Light', 'Duotone', 'Brands'].indexOf(fontFamily[1]) ? STYLE_TO_PREFIX[fontFamily[1].toLowerCase()] : FONT_WEIGHT_TO_PREFIX[fontWeight];
|
|
|
1996 |
var hexValue = toHex(content.length === 3 ? content.substr(1, 1) : content);
|
|
|
1997 |
var iconName = byUnicode(prefix, hexValue);
|
|
|
1998 |
var iconIdentifier = iconName; // Only convert the pseudo element in this :before/:after position into an icon if we haven't
|
|
|
1999 |
// already done so with the same prefix and iconName
|
|
|
2000 |
|
|
|
2001 |
if (iconName && (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconIdentifier)) {
|
|
|
2002 |
node.setAttribute(pendingAttribute, iconIdentifier);
|
|
|
2003 |
|
|
|
2004 |
if (alreadyProcessedPseudoElement) {
|
|
|
2005 |
// Delete the old one, since we're replacing it with a new one
|
|
|
2006 |
node.removeChild(alreadyProcessedPseudoElement);
|
|
|
2007 |
}
|
|
|
2008 |
|
|
|
2009 |
var meta = blankMeta();
|
|
|
2010 |
var extra = meta.extra;
|
|
|
2011 |
extra.attributes[DATA_FA_PSEUDO_ELEMENT] = position;
|
|
|
2012 |
findIcon(iconName, prefix).then(function (main) {
|
|
|
2013 |
var abstract = makeInlineSvgAbstract(_objectSpread({}, meta, {
|
|
|
2014 |
icons: {
|
|
|
2015 |
main: main,
|
|
|
2016 |
mask: emptyCanonicalIcon()
|
|
|
2017 |
},
|
|
|
2018 |
prefix: prefix,
|
|
|
2019 |
iconName: iconIdentifier,
|
|
|
2020 |
extra: extra,
|
|
|
2021 |
watchable: true
|
|
|
2022 |
}));
|
|
|
2023 |
var element = DOCUMENT.createElement('svg');
|
|
|
2024 |
|
|
|
2025 |
if (position === ':before') {
|
|
|
2026 |
node.insertBefore(element, node.firstChild);
|
|
|
2027 |
} else {
|
|
|
2028 |
node.appendChild(element);
|
|
|
2029 |
}
|
|
|
2030 |
|
|
|
2031 |
element.outerHTML = abstract.map(function (a) {
|
|
|
2032 |
return toHtml(a);
|
|
|
2033 |
}).join('\n');
|
|
|
2034 |
node.removeAttribute(pendingAttribute);
|
|
|
2035 |
resolve();
|
|
|
2036 |
}).catch(reject);
|
|
|
2037 |
} else {
|
|
|
2038 |
resolve();
|
|
|
2039 |
}
|
|
|
2040 |
} else {
|
|
|
2041 |
resolve();
|
|
|
2042 |
}
|
|
|
2043 |
});
|
|
|
2044 |
}
|
|
|
2045 |
|
|
|
2046 |
function replace(node) {
|
|
|
2047 |
return picked.all([replaceForPosition(node, ':before'), replaceForPosition(node, ':after')]);
|
|
|
2048 |
}
|
|
|
2049 |
|
|
|
2050 |
function processable(node) {
|
|
|
2051 |
return node.parentNode !== document.head && !~TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS.indexOf(node.tagName.toUpperCase()) && !node.getAttribute(DATA_FA_PSEUDO_ELEMENT) && (!node.parentNode || node.parentNode.tagName !== 'svg');
|
|
|
2052 |
}
|
|
|
2053 |
|
|
|
2054 |
function searchPseudoElements (root) {
|
|
|
2055 |
if (!IS_DOM) return;
|
|
|
2056 |
return new picked(function (resolve, reject) {
|
|
|
2057 |
var operations = toArray(root.querySelectorAll('*')).filter(processable).map(replace);
|
|
|
2058 |
var end = perf.begin('searchPseudoElements');
|
|
|
2059 |
disableObservation();
|
|
|
2060 |
picked.all(operations).then(function () {
|
|
|
2061 |
end();
|
|
|
2062 |
enableObservation();
|
|
|
2063 |
resolve();
|
|
|
2064 |
}).catch(function () {
|
|
|
2065 |
end();
|
|
|
2066 |
enableObservation();
|
|
|
2067 |
reject();
|
|
|
2068 |
});
|
|
|
2069 |
});
|
|
|
2070 |
}
|
|
|
2071 |
|
|
|
2072 |
var baseStyles = "svg:not(:root).svg-inline--fa{overflow:visible}.svg-inline--fa{display:inline-block;font-size:inherit;height:1em;overflow:visible;vertical-align:-.125em}.svg-inline--fa.fa-lg{vertical-align:-.225em}.svg-inline--fa.fa-w-1{width:.0625em}.svg-inline--fa.fa-w-2{width:.125em}.svg-inline--fa.fa-w-3{width:.1875em}.svg-inline--fa.fa-w-4{width:.25em}.svg-inline--fa.fa-w-5{width:.3125em}.svg-inline--fa.fa-w-6{width:.375em}.svg-inline--fa.fa-w-7{width:.4375em}.svg-inline--fa.fa-w-8{width:.5em}.svg-inline--fa.fa-w-9{width:.5625em}.svg-inline--fa.fa-w-10{width:.625em}.svg-inline--fa.fa-w-11{width:.6875em}.svg-inline--fa.fa-w-12{width:.75em}.svg-inline--fa.fa-w-13{width:.8125em}.svg-inline--fa.fa-w-14{width:.875em}.svg-inline--fa.fa-w-15{width:.9375em}.svg-inline--fa.fa-w-16{width:1em}.svg-inline--fa.fa-w-17{width:1.0625em}.svg-inline--fa.fa-w-18{width:1.125em}.svg-inline--fa.fa-w-19{width:1.1875em}.svg-inline--fa.fa-w-20{width:1.25em}.svg-inline--fa.fa-pull-left{margin-right:.3em;width:auto}.svg-inline--fa.fa-pull-right{margin-left:.3em;width:auto}.svg-inline--fa.fa-border{height:1.5em}.svg-inline--fa.fa-li{width:2em}.svg-inline--fa.fa-fw{width:1.25em}.fa-layers svg.svg-inline--fa{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.fa-layers{display:inline-block;height:1em;position:relative;text-align:center;vertical-align:-.125em;width:1em}.fa-layers svg.svg-inline--fa{-webkit-transform-origin:center center;transform-origin:center center}.fa-layers-counter,.fa-layers-text{display:inline-block;position:absolute;text-align:center}.fa-layers-text{left:50%;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);-webkit-transform-origin:center center;transform-origin:center center}.fa-layers-counter{background-color:#ff253a;border-radius:1em;-webkit-box-sizing:border-box;box-sizing:border-box;color:#fff;height:1.5em;line-height:1;max-width:5em;min-width:1.5em;overflow:hidden;padding:.25em;right:0;text-overflow:ellipsis;top:0;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:top right;transform-origin:top right}.fa-layers-bottom-right{bottom:0;right:0;top:auto;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:bottom right;transform-origin:bottom right}.fa-layers-bottom-left{bottom:0;left:0;right:auto;top:auto;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:bottom left;transform-origin:bottom left}.fa-layers-top-right{right:0;top:0;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:top right;transform-origin:top right}.fa-layers-top-left{left:0;right:auto;top:0;-webkit-transform:scale(.25);transform:scale(.25);-webkit-transform-origin:top left;transform-origin:top left}.fa-lg{font-size:1.3333333333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:solid .08em #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.fa-rotate-90{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-webkit-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{-webkit-transform:scale(1,-1);transform:scale(1,-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1,-1);transform:scale(-1,-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-rotate-90{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;position:relative;width:2.5em}.fa-stack-1x,.fa-stack-2x{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.svg-inline--fa.fa-stack-1x{height:1em;width:1.25em}.svg-inline--fa.fa-stack-2x{height:2em;width:2.5em}.fa-inverse{color:#fff}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}.svg-inline--fa .fa-primary{fill:var(--fa-primary-color,currentColor);opacity:1;opacity:var(--fa-primary-opacity,1)}.svg-inline--fa .fa-secondary{fill:var(--fa-secondary-color,currentColor);opacity:.4;opacity:var(--fa-secondary-opacity,.4)}.svg-inline--fa.fa-swap-opacity .fa-primary{opacity:.4;opacity:var(--fa-secondary-opacity,.4)}.svg-inline--fa.fa-swap-opacity .fa-secondary{opacity:1;opacity:var(--fa-primary-opacity,1)}.svg-inline--fa mask .fa-primary,.svg-inline--fa mask .fa-secondary{fill:#000}.fad.fa-inverse{color:#fff}";
|
|
|
2073 |
|
|
|
2074 |
function css () {
|
|
|
2075 |
var dfp = DEFAULT_FAMILY_PREFIX;
|
|
|
2076 |
var drc = DEFAULT_REPLACEMENT_CLASS;
|
|
|
2077 |
var fp = config.familyPrefix;
|
|
|
2078 |
var rc = config.replacementClass;
|
|
|
2079 |
var s = baseStyles;
|
|
|
2080 |
|
|
|
2081 |
if (fp !== dfp || rc !== drc) {
|
|
|
2082 |
var dPatt = new RegExp("\\.".concat(dfp, "\\-"), 'g');
|
|
|
2083 |
var customPropPatt = new RegExp("\\--".concat(dfp, "\\-"), 'g');
|
|
|
2084 |
var rPatt = new RegExp("\\.".concat(drc), 'g');
|
|
|
2085 |
s = s.replace(dPatt, ".".concat(fp, "-")).replace(customPropPatt, "--".concat(fp, "-")).replace(rPatt, ".".concat(rc));
|
|
|
2086 |
}
|
|
|
2087 |
|
|
|
2088 |
return s;
|
|
|
2089 |
}
|
|
|
2090 |
|
|
|
2091 |
var Library =
|
|
|
2092 |
/*#__PURE__*/
|
|
|
2093 |
function () {
|
|
|
2094 |
function Library() {
|
|
|
2095 |
_classCallCheck(this, Library);
|
|
|
2096 |
|
|
|
2097 |
this.definitions = {};
|
|
|
2098 |
}
|
|
|
2099 |
|
|
|
2100 |
_createClass(Library, [{
|
|
|
2101 |
key: "add",
|
|
|
2102 |
value: function add() {
|
|
|
2103 |
var _this = this;
|
|
|
2104 |
|
|
|
2105 |
for (var _len = arguments.length, definitions = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
|
2106 |
definitions[_key] = arguments[_key];
|
|
|
2107 |
}
|
|
|
2108 |
|
|
|
2109 |
var additions = definitions.reduce(this._pullDefinitions, {});
|
|
|
2110 |
Object.keys(additions).forEach(function (key) {
|
|
|
2111 |
_this.definitions[key] = _objectSpread({}, _this.definitions[key] || {}, additions[key]);
|
|
|
2112 |
defineIcons(key, additions[key]);
|
|
|
2113 |
build();
|
|
|
2114 |
});
|
|
|
2115 |
}
|
|
|
2116 |
}, {
|
|
|
2117 |
key: "reset",
|
|
|
2118 |
value: function reset() {
|
|
|
2119 |
this.definitions = {};
|
|
|
2120 |
}
|
|
|
2121 |
}, {
|
|
|
2122 |
key: "_pullDefinitions",
|
|
|
2123 |
value: function _pullDefinitions(additions, definition) {
|
|
|
2124 |
var normalized = definition.prefix && definition.iconName && definition.icon ? {
|
|
|
2125 |
0: definition
|
|
|
2126 |
} : definition;
|
|
|
2127 |
Object.keys(normalized).map(function (key) {
|
|
|
2128 |
var _normalized$key = normalized[key],
|
|
|
2129 |
prefix = _normalized$key.prefix,
|
|
|
2130 |
iconName = _normalized$key.iconName,
|
|
|
2131 |
icon = _normalized$key.icon;
|
|
|
2132 |
if (!additions[prefix]) additions[prefix] = {};
|
|
|
2133 |
additions[prefix][iconName] = icon;
|
|
|
2134 |
});
|
|
|
2135 |
return additions;
|
|
|
2136 |
}
|
|
|
2137 |
}]);
|
|
|
2138 |
|
|
|
2139 |
return Library;
|
|
|
2140 |
}();
|
|
|
2141 |
|
|
|
2142 |
function ensureCss() {
|
|
|
2143 |
if (config.autoAddCss && !_cssInserted) {
|
|
|
2144 |
insertCss(css());
|
|
|
2145 |
|
|
|
2146 |
_cssInserted = true;
|
|
|
2147 |
}
|
|
|
2148 |
}
|
|
|
2149 |
|
|
|
2150 |
function apiObject(val, abstractCreator) {
|
|
|
2151 |
Object.defineProperty(val, 'abstract', {
|
|
|
2152 |
get: abstractCreator
|
|
|
2153 |
});
|
|
|
2154 |
Object.defineProperty(val, 'html', {
|
|
|
2155 |
get: function get() {
|
|
|
2156 |
return val.abstract.map(function (a) {
|
|
|
2157 |
return toHtml(a);
|
|
|
2158 |
});
|
|
|
2159 |
}
|
|
|
2160 |
});
|
|
|
2161 |
Object.defineProperty(val, 'node', {
|
|
|
2162 |
get: function get() {
|
|
|
2163 |
if (!IS_DOM) return;
|
|
|
2164 |
var container = DOCUMENT.createElement('div');
|
|
|
2165 |
container.innerHTML = val.html;
|
|
|
2166 |
return container.children;
|
|
|
2167 |
}
|
|
|
2168 |
});
|
|
|
2169 |
return val;
|
|
|
2170 |
}
|
|
|
2171 |
|
|
|
2172 |
function findIconDefinition(iconLookup) {
|
|
|
2173 |
var _iconLookup$prefix = iconLookup.prefix,
|
|
|
2174 |
prefix = _iconLookup$prefix === void 0 ? 'fa' : _iconLookup$prefix,
|
|
|
2175 |
iconName = iconLookup.iconName;
|
|
|
2176 |
if (!iconName) return;
|
|
|
2177 |
return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
|
|
|
2178 |
}
|
|
|
2179 |
|
|
|
2180 |
function resolveIcons(next) {
|
|
|
2181 |
return function (maybeIconDefinition) {
|
|
|
2182 |
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
2183 |
var iconDefinition = (maybeIconDefinition || {}).icon ? maybeIconDefinition : findIconDefinition(maybeIconDefinition || {});
|
|
|
2184 |
var mask = params.mask;
|
|
|
2185 |
|
|
|
2186 |
if (mask) {
|
|
|
2187 |
mask = (mask || {}).icon ? mask : findIconDefinition(mask || {});
|
|
|
2188 |
}
|
|
|
2189 |
|
|
|
2190 |
return next(iconDefinition, _objectSpread({}, params, {
|
|
|
2191 |
mask: mask
|
|
|
2192 |
}));
|
|
|
2193 |
};
|
|
|
2194 |
}
|
|
|
2195 |
|
|
|
2196 |
var library = new Library();
|
|
|
2197 |
var noAuto = function noAuto() {
|
|
|
2198 |
config.autoReplaceSvg = false;
|
|
|
2199 |
config.observeMutations = false;
|
|
|
2200 |
disconnect();
|
|
|
2201 |
};
|
|
|
2202 |
var _cssInserted = false;
|
|
|
2203 |
var dom = {
|
|
|
2204 |
i2svg: function i2svg() {
|
|
|
2205 |
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
|
2206 |
|
|
|
2207 |
if (IS_DOM) {
|
|
|
2208 |
ensureCss();
|
|
|
2209 |
var _params$node = params.node,
|
|
|
2210 |
node = _params$node === void 0 ? DOCUMENT : _params$node,
|
|
|
2211 |
_params$callback = params.callback,
|
|
|
2212 |
callback = _params$callback === void 0 ? function () {} : _params$callback;
|
|
|
2213 |
|
|
|
2214 |
if (config.searchPseudoElements) {
|
|
|
2215 |
searchPseudoElements(node);
|
|
|
2216 |
}
|
|
|
2217 |
|
|
|
2218 |
return onTree(node, callback);
|
|
|
2219 |
} else {
|
|
|
2220 |
return picked.reject('Operation requires a DOM of some kind.');
|
|
|
2221 |
}
|
|
|
2222 |
},
|
|
|
2223 |
css: css,
|
|
|
2224 |
insertCss: function insertCss$$1() {
|
|
|
2225 |
if (!_cssInserted) {
|
|
|
2226 |
insertCss(css());
|
|
|
2227 |
|
|
|
2228 |
_cssInserted = true;
|
|
|
2229 |
}
|
|
|
2230 |
},
|
|
|
2231 |
watch: function watch() {
|
|
|
2232 |
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
|
2233 |
var autoReplaceSvgRoot = params.autoReplaceSvgRoot,
|
|
|
2234 |
observeMutationsRoot = params.observeMutationsRoot;
|
|
|
2235 |
|
|
|
2236 |
if (config.autoReplaceSvg === false) {
|
|
|
2237 |
config.autoReplaceSvg = true;
|
|
|
2238 |
}
|
|
|
2239 |
|
|
|
2240 |
config.observeMutations = true;
|
|
|
2241 |
domready(function () {
|
|
|
2242 |
autoReplace({
|
|
|
2243 |
autoReplaceSvgRoot: autoReplaceSvgRoot
|
|
|
2244 |
});
|
|
|
2245 |
observe({
|
|
|
2246 |
treeCallback: onTree,
|
|
|
2247 |
nodeCallback: onNode,
|
|
|
2248 |
pseudoElementsCallback: searchPseudoElements,
|
|
|
2249 |
observeMutationsRoot: observeMutationsRoot
|
|
|
2250 |
});
|
|
|
2251 |
});
|
|
|
2252 |
}
|
|
|
2253 |
};
|
|
|
2254 |
var parse = {
|
|
|
2255 |
transform: function transform(transformString) {
|
|
|
2256 |
return parseTransformString(transformString);
|
|
|
2257 |
}
|
|
|
2258 |
};
|
|
|
2259 |
var icon = resolveIcons(function (iconDefinition) {
|
|
|
2260 |
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
2261 |
var _params$transform = params.transform,
|
|
|
2262 |
transform = _params$transform === void 0 ? meaninglessTransform : _params$transform,
|
|
|
2263 |
_params$symbol = params.symbol,
|
|
|
2264 |
symbol = _params$symbol === void 0 ? false : _params$symbol,
|
|
|
2265 |
_params$mask = params.mask,
|
|
|
2266 |
mask = _params$mask === void 0 ? null : _params$mask,
|
|
|
2267 |
_params$title = params.title,
|
|
|
2268 |
title = _params$title === void 0 ? null : _params$title,
|
|
|
2269 |
_params$classes = params.classes,
|
|
|
2270 |
classes = _params$classes === void 0 ? [] : _params$classes,
|
|
|
2271 |
_params$attributes = params.attributes,
|
|
|
2272 |
attributes = _params$attributes === void 0 ? {} : _params$attributes,
|
|
|
2273 |
_params$styles = params.styles,
|
|
|
2274 |
styles = _params$styles === void 0 ? {} : _params$styles;
|
|
|
2275 |
if (!iconDefinition) return;
|
|
|
2276 |
var prefix = iconDefinition.prefix,
|
|
|
2277 |
iconName = iconDefinition.iconName,
|
|
|
2278 |
icon = iconDefinition.icon;
|
|
|
2279 |
return apiObject(_objectSpread({
|
|
|
2280 |
type: 'icon'
|
|
|
2281 |
}, iconDefinition), function () {
|
|
|
2282 |
ensureCss();
|
|
|
2283 |
|
|
|
2284 |
if (config.autoA11y) {
|
|
|
2285 |
if (title) {
|
|
|
2286 |
attributes['aria-labelledby'] = "".concat(config.replacementClass, "-title-").concat(nextUniqueId());
|
|
|
2287 |
} else {
|
|
|
2288 |
attributes['aria-hidden'] = 'true';
|
|
|
2289 |
attributes['focusable'] = 'false';
|
|
|
2290 |
}
|
|
|
2291 |
}
|
|
|
2292 |
|
|
|
2293 |
return makeInlineSvgAbstract({
|
|
|
2294 |
icons: {
|
|
|
2295 |
main: asFoundIcon(icon),
|
|
|
2296 |
mask: mask ? asFoundIcon(mask.icon) : {
|
|
|
2297 |
found: false,
|
|
|
2298 |
width: null,
|
|
|
2299 |
height: null,
|
|
|
2300 |
icon: {}
|
|
|
2301 |
}
|
|
|
2302 |
},
|
|
|
2303 |
prefix: prefix,
|
|
|
2304 |
iconName: iconName,
|
|
|
2305 |
transform: _objectSpread({}, meaninglessTransform, transform),
|
|
|
2306 |
symbol: symbol,
|
|
|
2307 |
title: title,
|
|
|
2308 |
extra: {
|
|
|
2309 |
attributes: attributes,
|
|
|
2310 |
styles: styles,
|
|
|
2311 |
classes: classes
|
|
|
2312 |
}
|
|
|
2313 |
});
|
|
|
2314 |
});
|
|
|
2315 |
});
|
|
|
2316 |
var text = function text(content) {
|
|
|
2317 |
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
2318 |
var _params$transform2 = params.transform,
|
|
|
2319 |
transform = _params$transform2 === void 0 ? meaninglessTransform : _params$transform2,
|
|
|
2320 |
_params$title2 = params.title,
|
|
|
2321 |
title = _params$title2 === void 0 ? null : _params$title2,
|
|
|
2322 |
_params$classes2 = params.classes,
|
|
|
2323 |
classes = _params$classes2 === void 0 ? [] : _params$classes2,
|
|
|
2324 |
_params$attributes2 = params.attributes,
|
|
|
2325 |
attributes = _params$attributes2 === void 0 ? {} : _params$attributes2,
|
|
|
2326 |
_params$styles2 = params.styles,
|
|
|
2327 |
styles = _params$styles2 === void 0 ? {} : _params$styles2;
|
|
|
2328 |
return apiObject({
|
|
|
2329 |
type: 'text',
|
|
|
2330 |
content: content
|
|
|
2331 |
}, function () {
|
|
|
2332 |
ensureCss();
|
|
|
2333 |
return makeLayersTextAbstract({
|
|
|
2334 |
content: content,
|
|
|
2335 |
transform: _objectSpread({}, meaninglessTransform, transform),
|
|
|
2336 |
title: title,
|
|
|
2337 |
extra: {
|
|
|
2338 |
attributes: attributes,
|
|
|
2339 |
styles: styles,
|
|
|
2340 |
classes: ["".concat(config.familyPrefix, "-layers-text")].concat(_toConsumableArray(classes))
|
|
|
2341 |
}
|
|
|
2342 |
});
|
|
|
2343 |
});
|
|
|
2344 |
};
|
|
|
2345 |
var counter = function counter(content) {
|
|
|
2346 |
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
2347 |
var _params$title3 = params.title,
|
|
|
2348 |
title = _params$title3 === void 0 ? null : _params$title3,
|
|
|
2349 |
_params$classes3 = params.classes,
|
|
|
2350 |
classes = _params$classes3 === void 0 ? [] : _params$classes3,
|
|
|
2351 |
_params$attributes3 = params.attributes,
|
|
|
2352 |
attributes = _params$attributes3 === void 0 ? {} : _params$attributes3,
|
|
|
2353 |
_params$styles3 = params.styles,
|
|
|
2354 |
styles = _params$styles3 === void 0 ? {} : _params$styles3;
|
|
|
2355 |
return apiObject({
|
|
|
2356 |
type: 'counter',
|
|
|
2357 |
content: content
|
|
|
2358 |
}, function () {
|
|
|
2359 |
ensureCss();
|
|
|
2360 |
return makeLayersCounterAbstract({
|
|
|
2361 |
content: content.toString(),
|
|
|
2362 |
title: title,
|
|
|
2363 |
extra: {
|
|
|
2364 |
attributes: attributes,
|
|
|
2365 |
styles: styles,
|
|
|
2366 |
classes: ["".concat(config.familyPrefix, "-layers-counter")].concat(_toConsumableArray(classes))
|
|
|
2367 |
}
|
|
|
2368 |
});
|
|
|
2369 |
});
|
|
|
2370 |
};
|
|
|
2371 |
var layer = function layer(assembler) {
|
|
|
2372 |
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
2373 |
var _params$classes4 = params.classes,
|
|
|
2374 |
classes = _params$classes4 === void 0 ? [] : _params$classes4;
|
|
|
2375 |
return apiObject({
|
|
|
2376 |
type: 'layer'
|
|
|
2377 |
}, function () {
|
|
|
2378 |
ensureCss();
|
|
|
2379 |
var children = [];
|
|
|
2380 |
assembler(function (args) {
|
|
|
2381 |
Array.isArray(args) ? args.map(function (a) {
|
|
|
2382 |
children = children.concat(a.abstract);
|
|
|
2383 |
}) : children = children.concat(args.abstract);
|
|
|
2384 |
});
|
|
|
2385 |
return [{
|
|
|
2386 |
tag: 'span',
|
|
|
2387 |
attributes: {
|
|
|
2388 |
class: ["".concat(config.familyPrefix, "-layers")].concat(_toConsumableArray(classes)).join(' ')
|
|
|
2389 |
},
|
|
|
2390 |
children: children
|
|
|
2391 |
}];
|
|
|
2392 |
});
|
|
|
2393 |
};
|
|
|
2394 |
var api = {
|
|
|
2395 |
noAuto: noAuto,
|
|
|
2396 |
config: config,
|
|
|
2397 |
dom: dom,
|
|
|
2398 |
library: library,
|
|
|
2399 |
parse: parse,
|
|
|
2400 |
findIconDefinition: findIconDefinition,
|
|
|
2401 |
icon: icon,
|
|
|
2402 |
text: text,
|
|
|
2403 |
counter: counter,
|
|
|
2404 |
layer: layer,
|
|
|
2405 |
toHtml: toHtml
|
|
|
2406 |
};
|
|
|
2407 |
|
|
|
2408 |
var autoReplace = function autoReplace() {
|
|
|
2409 |
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
|
2410 |
var _params$autoReplaceSv = params.autoReplaceSvgRoot,
|
|
|
2411 |
autoReplaceSvgRoot = _params$autoReplaceSv === void 0 ? DOCUMENT : _params$autoReplaceSv;
|
|
|
2412 |
if ((Object.keys(namespace.styles).length > 0 || config.autoFetchSvg) && IS_DOM && config.autoReplaceSvg) api.dom.i2svg({
|
|
|
2413 |
node: autoReplaceSvgRoot
|
|
|
2414 |
});
|
|
|
2415 |
};
|
|
|
2416 |
|
|
|
2417 |
function bootstrap() {
|
|
|
2418 |
if (IS_BROWSER) {
|
|
|
2419 |
if (!WINDOW.FontAwesome) {
|
|
|
2420 |
WINDOW.FontAwesome = api;
|
|
|
2421 |
}
|
|
|
2422 |
|
|
|
2423 |
domready(function () {
|
|
|
2424 |
autoReplace();
|
|
|
2425 |
observe({
|
|
|
2426 |
treeCallback: onTree,
|
|
|
2427 |
nodeCallback: onNode,
|
|
|
2428 |
pseudoElementsCallback: searchPseudoElements
|
|
|
2429 |
});
|
|
|
2430 |
});
|
|
|
2431 |
}
|
|
|
2432 |
|
|
|
2433 |
namespace.hooks = _objectSpread({}, namespace.hooks, {
|
|
|
2434 |
addPack: function addPack(prefix, icons) {
|
|
|
2435 |
namespace.styles[prefix] = _objectSpread({}, namespace.styles[prefix] || {}, icons);
|
|
|
2436 |
build();
|
|
|
2437 |
autoReplace();
|
|
|
2438 |
},
|
|
|
2439 |
addShims: function addShims(shims) {
|
|
|
2440 |
var _namespace$shims;
|
|
|
2441 |
|
|
|
2442 |
(_namespace$shims = namespace.shims).push.apply(_namespace$shims, _toConsumableArray(shims));
|
|
|
2443 |
|
|
|
2444 |
build();
|
|
|
2445 |
autoReplace();
|
|
|
2446 |
}
|
|
|
2447 |
});
|
|
|
2448 |
}
|
|
|
2449 |
|
|
|
2450 |
bunker(bootstrap);
|
|
|
2451 |
|
|
|
2452 |
}());
|