playbook_ui 2.9.2 → 2.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/pb.logo.svg +28 -0
  3. data/app/helpers/playbook/pb_doc_helper.rb +9 -12
  4. data/app/helpers/playbook/pb_kit_helper.rb +12 -30
  5. data/app/pb_kits/playbook/_playbook.scss +50 -0
  6. data/app/pb_kits/playbook/index.js +10 -9
  7. data/app/pb_kits/playbook/kits/pb_contact.js +4 -0
  8. data/app/pb_kits/playbook/kits/pb_person.js +4 -0
  9. data/app/pb_kits/playbook/kits/pb_person_contact.js +4 -0
  10. data/app/pb_kits/playbook/packs/application.js +3 -3
  11. data/app/pb_kits/playbook/packs/examples.js +85 -127
  12. data/app/pb_kits/playbook/packs/kits.js +36 -36
  13. data/app/pb_kits/playbook/packs/main.scss +1 -1
  14. data/app/pb_kits/playbook/packs/site_styles/_site-style.scss +7 -0
  15. data/app/pb_kits/playbook/pb_bar_graph/barGraphSettings.js +1 -1
  16. data/app/pb_kits/playbook/pb_button/_button.jsx +48 -49
  17. data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +8 -2
  18. data/app/pb_kits/playbook/pb_card/_card.html.erb +2 -2
  19. data/app/pb_kits/playbook/pb_card/child_kits/_card_body.html.erb +1 -1
  20. data/app/pb_kits/playbook/pb_contact/_contact.html.erb +6 -0
  21. data/app/pb_kits/playbook/pb_contact/_contact.jsx +72 -0
  22. data/app/pb_kits/playbook/{pb_phone/_phone.scss → pb_contact/_contact.scss} +0 -0
  23. data/app/pb_kits/playbook/pb_contact/contact.rb +78 -0
  24. data/app/pb_kits/playbook/pb_contact/docs/_contact_default.html.erb +18 -0
  25. data/app/pb_kits/playbook/pb_contact/docs/_contact_default.jsx +26 -0
  26. data/app/pb_kits/playbook/pb_contact/docs/example.yml +8 -0
  27. data/app/pb_kits/playbook/pb_contact/docs/index.js +1 -0
  28. data/app/pb_kits/playbook/pb_dashboard/commonSettings.js +16 -13
  29. data/app/pb_kits/playbook/pb_hashtag/_hashtag.html.erb +2 -2
  30. data/app/pb_kits/playbook/pb_hashtag/hashtag.rb +20 -59
  31. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.html.erb +3 -3
  32. data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +18 -61
  33. data/app/pb_kits/playbook/pb_input/_input.html.erb +1 -1
  34. data/app/pb_kits/playbook/pb_input/_input.jsx +2 -2
  35. data/app/pb_kits/playbook/pb_input/_input.scss +1 -1
  36. data/app/pb_kits/playbook/pb_input/input.rb +10 -79
  37. data/app/pb_kits/playbook/pb_line_graph/lineGraphSettings.js +1 -1
  38. data/app/pb_kits/playbook/{pb_owner/_owner.html.erb → pb_person/_person.html.erb} +1 -1
  39. data/app/pb_kits/playbook/pb_person/_person.jsx +36 -0
  40. data/app/pb_kits/playbook/{pb_owner/_owner.scss → pb_person/_person.scss} +2 -2
  41. data/app/pb_kits/playbook/pb_person/docs/_person_default.html.erb +1 -0
  42. data/app/pb_kits/playbook/pb_person/docs/_person_default.jsx +13 -0
  43. data/app/pb_kits/playbook/pb_person/docs/example.yml +9 -0
  44. data/app/pb_kits/playbook/pb_person/docs/index.js +1 -0
  45. data/app/pb_kits/playbook/{pb_owner/owner.rb → pb_person/person.rb} +18 -14
  46. data/app/pb_kits/playbook/pb_person_contact/_person_contact.html.erb +12 -0
  47. data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +49 -0
  48. data/app/pb_kits/playbook/{pb_owner_phone/_owner_phone.scss → pb_person_contact/_person_contact.scss} +3 -3
  49. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_default.html.erb +21 -0
  50. data/app/pb_kits/playbook/pb_person_contact/docs/_person_contact_default.jsx +34 -0
  51. data/app/pb_kits/playbook/pb_person_contact/docs/example.yml +8 -0
  52. data/app/pb_kits/playbook/pb_person_contact/docs/index.js +1 -0
  53. data/app/pb_kits/playbook/pb_person_contact/person_contact.rb +55 -0
  54. data/app/pb_kits/playbook/props.rb +4 -4
  55. data/app/pb_kits/playbook/props/base.rb +7 -3
  56. data/app/pb_kits/playbook/props/number.rb +11 -0
  57. data/app/pb_kits/playbook/props/proc.rb +11 -0
  58. data/app/pb_kits/playbook/tokens/_colors.scss +12 -8
  59. data/app/views/layouts/playbook/_nav.html.slim +2 -2
  60. data/app/views/playbook/pages/principles.html.slim +0 -2
  61. data/fonts/fontawesome.min.js +5 -0
  62. data/fonts/regular.min.js +5 -0
  63. data/lib/generators/kit/kit_generator.rb +2 -2
  64. data/lib/playbook/version.rb +1 -1
  65. metadata +35 -32
  66. data/app/pb_kits/playbook/kits/pb_owner.js +0 -4
  67. data/app/pb_kits/playbook/kits/pb_owner_phone.js +0 -4
  68. data/app/pb_kits/playbook/kits/pb_phone.js +0 -4
  69. data/app/pb_kits/playbook/packs/site_styles/_kit_style_index.scss +0 -50
  70. data/app/pb_kits/playbook/pb_owner/_owner.jsx +0 -21
  71. data/app/pb_kits/playbook/pb_owner/docs/_owner_default.html.erb +0 -1
  72. data/app/pb_kits/playbook/pb_owner/docs/_owner_default.jsx +0 -10
  73. data/app/pb_kits/playbook/pb_owner/docs/example.yml +0 -9
  74. data/app/pb_kits/playbook/pb_owner/docs/index.js +0 -1
  75. data/app/pb_kits/playbook/pb_owner_phone/_owner_phone.html.erb +0 -7
  76. data/app/pb_kits/playbook/pb_owner_phone/_owner_phone.jsx +0 -21
  77. data/app/pb_kits/playbook/pb_owner_phone/docs/_owner_phone_default.html.erb +0 -6
  78. data/app/pb_kits/playbook/pb_owner_phone/docs/_owner_phone_default.jsx +0 -10
  79. data/app/pb_kits/playbook/pb_owner_phone/docs/example.yml +0 -9
  80. data/app/pb_kits/playbook/pb_owner_phone/docs/index.js +0 -1
  81. data/app/pb_kits/playbook/pb_owner_phone/owner_phone.rb +0 -62
  82. data/app/pb_kits/playbook/pb_phone/_phone.html.erb +0 -6
  83. data/app/pb_kits/playbook/pb_phone/_phone.jsx +0 -21
  84. data/app/pb_kits/playbook/pb_phone/docs/_phone_default.html.erb +0 -4
  85. data/app/pb_kits/playbook/pb_phone/docs/_phone_default.jsx +0 -10
  86. data/app/pb_kits/playbook/pb_phone/docs/example.yml +0 -9
  87. data/app/pb_kits/playbook/pb_phone/docs/index.js +0 -1
  88. data/app/pb_kits/playbook/pb_phone/phone.rb +0 -70
  89. data/fonts/fontawesome.js +0 -1978
  90. data/fonts/regular.js +0 -1217
@@ -1,6 +0,0 @@
1
- <%= content_tag(:div,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname("pb_phone_kit")) do %>
5
- <span><%= object.value %></span>
6
- <% end %>
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from "prop-types";
3
-
4
- const propTypes = {
5
- className: PropTypes.string,
6
- id: PropTypes.string
7
- };
8
-
9
- class Phone extends React.Component {
10
- render() {
11
- return (
12
- <div className="pb_phone">
13
- <span>PHONE CONTENT</span>
14
- </div>
15
- )
16
- }
17
- }
18
-
19
- Phone.propTypes = propTypes;
20
-
21
- export default Phone;
@@ -1,4 +0,0 @@
1
- <%= pb_rails("phone", props: {
2
- icon: "mobile-android",
3
- number: 3491859988
4
- }) %>
@@ -1,10 +0,0 @@
1
- import React from "react"
2
- import {Phone} from "../../"
3
-
4
- function PhoneDefault() {
5
- return (
6
- <h1>{`Coming Soon...`}</h1>
7
- )
8
- }
9
-
10
- export default PhoneDefault
@@ -1,9 +0,0 @@
1
- examples:
2
-
3
- rails:
4
- - phone_default: Default
5
-
6
-
7
- react:
8
- - phone_default: Default
9
-
@@ -1 +0,0 @@
1
- export {default as PhoneDefault} from './_phone_default.jsx';
@@ -1,70 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "action_view"
4
-
5
- module Playbook
6
- module PbPhone
7
- class Phone < Playbook::PbKit::Base
8
- include ActionView::Helpers::NumberHelper
9
-
10
- PROPS = %i[configured_classname
11
- configured_data
12
- configured_id
13
- configured_icon
14
- configured_number].freeze
15
-
16
- def initialize(classname: default_configuration,
17
- data: default_configuration,
18
- id: default_configuration,
19
- icon: default_configuration,
20
- number: default_configuration)
21
- self.configured_classname = classname
22
- self.configured_data = data
23
- self.configured_id = id
24
- self.configured_icon = icon
25
- self.configured_number = number
26
- end
27
-
28
- def icon
29
- # TODO: Strict options and automaticlly pass the correct icon name
30
- if is_set? configured_icon
31
- icon_props = { icon: configured_icon, fixed_width: true }
32
- pb_icon = Playbook::PbIcon::Icon.new(icon_props)
33
- ApplicationController.renderer.render(partial: pb_icon, as: :object)
34
- else
35
- ""
36
- end
37
- end
38
-
39
- def number
40
- if is_set? configured_number
41
- return number_to_phone(formatted_number, area_code: true) if formatted_number
42
- end
43
- end
44
-
45
- def formatted_number
46
- configured_number.to_s.gsub(/\D/, "")
47
- end
48
-
49
- def value
50
- pb_body = Playbook::PbBody::Body.new(color: "light") do
51
- icon + number
52
- end
53
- ApplicationController.renderer.render(partial: pb_body, as: :object)
54
- end
55
-
56
- def to_partial_path
57
- "pb_phone/phone"
58
- end
59
-
60
- private
61
-
62
- DEFAULT = Object.new
63
- private_constant :DEFAULT
64
- def default_configuration
65
- DEFAULT
66
- end
67
- attr_accessor(*PROPS)
68
- end
69
- end
70
- end
data/fonts/fontawesome.js DELETED
@@ -1,1978 +0,0 @@
1
- /*!
2
- * Font Awesome Pro 5.2.0 by @fontawesome - https://fontawesome.com
3
- * License - https://fontawesome.com/license (Commercial License)
4
- */
5
- (function () {
6
- 'use strict';
7
-
8
- var noop = function noop() {};
9
-
10
- var _WINDOW = {};
11
- var _DOCUMENT = {};
12
- var _MUTATION_OBSERVER$1 = null;
13
- var _PERFORMANCE = { mark: noop, measure: noop };
14
-
15
- try {
16
- if (typeof window !== 'undefined') _WINDOW = window;
17
- if (typeof document !== 'undefined') _DOCUMENT = document;
18
- if (typeof MutationObserver !== 'undefined') _MUTATION_OBSERVER$1 = MutationObserver;
19
- if (typeof performance !== 'undefined') _PERFORMANCE = performance;
20
- } catch (e) {}
21
-
22
- var _ref = _WINDOW.navigator || {};
23
- var _ref$userAgent = _ref.userAgent;
24
- var userAgent = _ref$userAgent === undefined ? '' : _ref$userAgent;
25
-
26
- var WINDOW = _WINDOW;
27
- var DOCUMENT = _DOCUMENT;
28
- var MUTATION_OBSERVER = _MUTATION_OBSERVER$1;
29
- var PERFORMANCE = _PERFORMANCE;
30
- var IS_BROWSER = !!WINDOW.document;
31
- var IS_DOM = !!DOCUMENT.documentElement && !!DOCUMENT.head && typeof DOCUMENT.addEventListener === 'function' && typeof DOCUMENT.createElement === 'function';
32
- var IS_IE = ~userAgent.indexOf('MSIE') || ~userAgent.indexOf('Trident/');
33
-
34
- var NAMESPACE_IDENTIFIER = '___FONT_AWESOME___';
35
- var UNITS_IN_GRID = 16;
36
- var DEFAULT_FAMILY_PREFIX = 'fa';
37
- var DEFAULT_REPLACEMENT_CLASS = 'svg-inline--fa';
38
- var DATA_FA_I2SVG = 'data-fa-i2svg';
39
- var DATA_FA_PSEUDO_ELEMENT = 'data-fa-pseudo-element';
40
- var DATA_PREFIX = 'data-prefix';
41
- var DATA_ICON = 'data-icon';
42
- var HTML_CLASS_I2SVG_BASE_CLASS = 'fontawesome-i2svg';
43
- var TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS = ['HTML', 'HEAD', 'STYLE', 'SCRIPT'];
44
- var PRODUCTION = function () {
45
- try {
46
- return "production" === 'production';
47
- } catch (e) {
48
- return false;
49
- }
50
- }();
51
-
52
- var oneToTen = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
53
- var oneToTwenty = oneToTen.concat([11, 12, 13, 14, 15, 16, 17, 18, 19, 20]);
54
-
55
- var ATTRIBUTES_WATCHED_FOR_MUTATION = ['class', 'data-prefix', 'data-icon', 'data-fa-transform', 'data-fa-mask'];
56
-
57
- var RESERVED_CLASSES = ['xs', 'sm', 'lg', 'fw', 'ul', 'li', 'border', 'pull-left', 'pull-right', 'spin', 'pulse', 'rotate-90', 'rotate-180', 'rotate-270', 'flip-horizontal', 'flip-vertical', 'stack', 'stack-1x', 'stack-2x', 'inverse', 'layers', 'layers-text', 'layers-counter'].concat(oneToTen.map(function (n) {
58
- return n + 'x';
59
- })).concat(oneToTwenty.map(function (n) {
60
- return 'w-' + n;
61
- }));
62
-
63
- var classCallCheck = function (instance, Constructor) {
64
- if (!(instance instanceof Constructor)) {
65
- throw new TypeError("Cannot call a class as a function");
66
- }
67
- };
68
-
69
- var createClass = function () {
70
- function defineProperties(target, props) {
71
- for (var i = 0; i < props.length; i++) {
72
- var descriptor = props[i];
73
- descriptor.enumerable = descriptor.enumerable || false;
74
- descriptor.configurable = true;
75
- if ("value" in descriptor) descriptor.writable = true;
76
- Object.defineProperty(target, descriptor.key, descriptor);
77
- }
78
- }
79
-
80
- return function (Constructor, protoProps, staticProps) {
81
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
82
- if (staticProps) defineProperties(Constructor, staticProps);
83
- return Constructor;
84
- };
85
- }();
86
-
87
-
88
-
89
- var _extends = Object.assign || function (target) {
90
- for (var i = 1; i < arguments.length; i++) {
91
- var source = arguments[i];
92
-
93
- for (var key in source) {
94
- if (Object.prototype.hasOwnProperty.call(source, key)) {
95
- target[key] = source[key];
96
- }
97
- }
98
- }
99
-
100
- return target;
101
- };
102
-
103
-
104
-
105
- var slicedToArray = function () {
106
- function sliceIterator(arr, i) {
107
- var _arr = [];
108
- var _n = true;
109
- var _d = false;
110
- var _e = undefined;
111
-
112
- try {
113
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
114
- _arr.push(_s.value);
115
-
116
- if (i && _arr.length === i) break;
117
- }
118
- } catch (err) {
119
- _d = true;
120
- _e = err;
121
- } finally {
122
- try {
123
- if (!_n && _i["return"]) _i["return"]();
124
- } finally {
125
- if (_d) throw _e;
126
- }
127
- }
128
-
129
- return _arr;
130
- }
131
-
132
- return function (arr, i) {
133
- if (Array.isArray(arr)) {
134
- return arr;
135
- } else if (Symbol.iterator in Object(arr)) {
136
- return sliceIterator(arr, i);
137
- } else {
138
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
139
- }
140
- };
141
- }();
142
-
143
- var toConsumableArray = function (arr) {
144
- if (Array.isArray(arr)) {
145
- for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
146
-
147
- return arr2;
148
- } else {
149
- return Array.from(arr);
150
- }
151
- };
152
-
153
- var initial = WINDOW.FontAwesomeConfig || {};
154
-
155
- function getAttrConfig(attr) {
156
- var element = DOCUMENT.querySelector('script[' + attr + ']');
157
-
158
- if (element) {
159
- return element.getAttribute(attr);
160
- }
161
- }
162
-
163
- function coerce(val) {
164
- // Getting an empty string will occur if the attribute is set on the HTML tag but without a value
165
- // We'll assume that this is an indication that it should be toggled to true
166
- // For example <script data-search-pseudo-elements src="..."></script>
167
- if (val === '') return true;
168
- if (val === 'false') return false;
169
- if (val === 'true') return true;
170
- return val;
171
- }
172
-
173
- if (DOCUMENT && typeof DOCUMENT.querySelector === 'function') {
174
- var attrs = [['data-family-prefix', 'familyPrefix'], ['data-replacement-class', 'replacementClass'], ['data-auto-replace-svg', 'autoReplaceSvg'], ['data-auto-add-css', 'autoAddCss'], ['data-auto-a11y', 'autoA11y'], ['data-search-pseudo-elements', 'searchPseudoElements'], ['data-observe-mutations', 'observeMutations'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']];
175
-
176
- attrs.forEach(function (_ref) {
177
- var _ref2 = slicedToArray(_ref, 2),
178
- attr = _ref2[0],
179
- key = _ref2[1];
180
-
181
- var val = coerce(getAttrConfig(attr));
182
-
183
- if (val !== undefined && val !== null) {
184
- initial[key] = val;
185
- }
186
- });
187
- }
188
-
189
- var _default = _extends({
190
- familyPrefix: DEFAULT_FAMILY_PREFIX,
191
- replacementClass: DEFAULT_REPLACEMENT_CLASS,
192
- autoReplaceSvg: true,
193
- autoAddCss: true,
194
- autoA11y: true,
195
- searchPseudoElements: false,
196
- observeMutations: true,
197
- keepOriginalSource: true,
198
- measurePerformance: false,
199
- showMissingIcons: true
200
- }, initial);
201
-
202
- if (!_default.autoReplaceSvg) _default.observeMutations = false;
203
-
204
- var config = _extends({}, _default);
205
-
206
- WINDOW.FontAwesomeConfig = config;
207
-
208
- var w = WINDOW || {};
209
-
210
- if (!w[NAMESPACE_IDENTIFIER]) w[NAMESPACE_IDENTIFIER] = {};
211
- if (!w[NAMESPACE_IDENTIFIER].styles) w[NAMESPACE_IDENTIFIER].styles = {};
212
- if (!w[NAMESPACE_IDENTIFIER].hooks) w[NAMESPACE_IDENTIFIER].hooks = {};
213
- if (!w[NAMESPACE_IDENTIFIER].shims) w[NAMESPACE_IDENTIFIER].shims = [];
214
-
215
- var namespace = w[NAMESPACE_IDENTIFIER];
216
-
217
- var functions = [];
218
- var listener = function listener() {
219
- DOCUMENT.removeEventListener('DOMContentLoaded', listener);
220
- loaded = 1;
221
- functions.map(function (fn) {
222
- return fn();
223
- });
224
- };
225
-
226
- var loaded = false;
227
-
228
- if (IS_DOM) {
229
- loaded = (DOCUMENT.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(DOCUMENT.readyState);
230
-
231
- if (!loaded) DOCUMENT.addEventListener('DOMContentLoaded', listener);
232
- }
233
-
234
- var domready = function (fn) {
235
- if (!IS_DOM) return;
236
- loaded ? setTimeout(fn, 0) : functions.push(fn);
237
- };
238
-
239
- var d = UNITS_IN_GRID;
240
-
241
- var meaninglessTransform = {
242
- size: 16,
243
- x: 0,
244
- y: 0,
245
- rotate: 0,
246
- flipX: false,
247
- flipY: false
248
- };
249
-
250
- function isReserved(name) {
251
- return ~RESERVED_CLASSES.indexOf(name);
252
- }
253
-
254
- function bunker(fn) {
255
- try {
256
- fn();
257
- } catch (e) {
258
- if (!PRODUCTION) {
259
- throw e;
260
- }
261
- }
262
- }
263
-
264
- function insertCss(css) {
265
- if (!css || !IS_DOM) {
266
- return;
267
- }
268
-
269
- var style = DOCUMENT.createElement('style');
270
- style.setAttribute('type', 'text/css');
271
- style.innerHTML = css;
272
-
273
- var headChildren = DOCUMENT.head.childNodes;
274
- var beforeChild = null;
275
-
276
- for (var i = headChildren.length - 1; i > -1; i--) {
277
- var child = headChildren[i];
278
- var tagName = (child.tagName || '').toUpperCase();
279
- if (['STYLE', 'LINK'].indexOf(tagName) > -1) {
280
- beforeChild = child;
281
- }
282
- }
283
-
284
- DOCUMENT.head.insertBefore(style, beforeChild);
285
-
286
- return css;
287
- }
288
-
289
- var _uniqueId = 0;
290
-
291
- function nextUniqueId() {
292
- _uniqueId++;
293
-
294
- return _uniqueId;
295
- }
296
-
297
- function toArray(obj) {
298
- var array = [];
299
-
300
- for (var i = (obj || []).length >>> 0; i--;) {
301
- array[i] = obj[i];
302
- }
303
-
304
- return array;
305
- }
306
-
307
- function classArray(node) {
308
- if (node.classList) {
309
- return toArray(node.classList);
310
- } else {
311
- return (node.getAttribute('class') || '').split(' ').filter(function (i) {
312
- return i;
313
- });
314
- }
315
- }
316
-
317
- function getIconName(familyPrefix, cls) {
318
- var parts = cls.split('-');
319
- var prefix = parts[0];
320
- var iconName = parts.slice(1).join('-');
321
-
322
- if (prefix === familyPrefix && iconName !== '' && !isReserved(iconName)) {
323
- return iconName;
324
- } else {
325
- return null;
326
- }
327
- }
328
-
329
- function htmlEscape(str) {
330
- return ('' + str).replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
331
- }
332
-
333
- function joinAttributes(attributes) {
334
- return Object.keys(attributes || {}).reduce(function (acc, attributeName) {
335
- return acc + (attributeName + '="' + htmlEscape(attributes[attributeName]) + '" ');
336
- }, '').trim();
337
- }
338
-
339
- function joinStyles(styles) {
340
- return Object.keys(styles || {}).reduce(function (acc, styleName) {
341
- return acc + (styleName + ': ' + styles[styleName] + ';');
342
- }, '');
343
- }
344
-
345
- function transformIsMeaningful(transform) {
346
- return transform.size !== meaninglessTransform.size || transform.x !== meaninglessTransform.x || transform.y !== meaninglessTransform.y || transform.rotate !== meaninglessTransform.rotate || transform.flipX || transform.flipY;
347
- }
348
-
349
- function transformForSvg(_ref) {
350
- var transform = _ref.transform,
351
- containerWidth = _ref.containerWidth,
352
- iconWidth = _ref.iconWidth;
353
-
354
- var outer = {
355
- transform: 'translate(' + containerWidth / 2 + ' 256)'
356
- };
357
- var innerTranslate = 'translate(' + transform.x * 32 + ', ' + transform.y * 32 + ') ';
358
- var innerScale = 'scale(' + transform.size / 16 * (transform.flipX ? -1 : 1) + ', ' + transform.size / 16 * (transform.flipY ? -1 : 1) + ') ';
359
- var innerRotate = 'rotate(' + transform.rotate + ' 0 0)';
360
- var inner = {
361
- transform: innerTranslate + ' ' + innerScale + ' ' + innerRotate
362
- };
363
- var path = {
364
- transform: 'translate(' + iconWidth / 2 * -1 + ' -256)'
365
- };
366
- return {
367
- outer: outer,
368
- inner: inner,
369
- path: path
370
- };
371
- }
372
-
373
- function transformForCss(_ref2) {
374
- var transform = _ref2.transform,
375
- _ref2$width = _ref2.width,
376
- width = _ref2$width === undefined ? UNITS_IN_GRID : _ref2$width,
377
- _ref2$height = _ref2.height,
378
- height = _ref2$height === undefined ? UNITS_IN_GRID : _ref2$height,
379
- _ref2$startCentered = _ref2.startCentered,
380
- startCentered = _ref2$startCentered === undefined ? false : _ref2$startCentered;
381
-
382
- var val = '';
383
-
384
- if (startCentered && IS_IE) {
385
- val += 'translate(' + (transform.x / d - width / 2) + 'em, ' + (transform.y / d - height / 2) + 'em) ';
386
- } else if (startCentered) {
387
- val += 'translate(calc(-50% + ' + transform.x / d + 'em), calc(-50% + ' + transform.y / d + 'em)) ';
388
- } else {
389
- val += 'translate(' + transform.x / d + 'em, ' + transform.y / d + 'em) ';
390
- }
391
-
392
- val += 'scale(' + transform.size / d * (transform.flipX ? -1 : 1) + ', ' + transform.size / d * (transform.flipY ? -1 : 1) + ') ';
393
- val += 'rotate(' + transform.rotate + 'deg) ';
394
-
395
- return val;
396
- }
397
-
398
- var ALL_SPACE = {
399
- x: 0,
400
- y: 0,
401
- width: '100%',
402
- height: '100%'
403
- };
404
-
405
- var makeIconMasking = function (_ref) {
406
- var children = _ref.children,
407
- attributes = _ref.attributes,
408
- main = _ref.main,
409
- mask = _ref.mask,
410
- transform = _ref.transform;
411
- var mainWidth = main.width,
412
- mainPath = main.icon;
413
- var maskWidth = mask.width,
414
- maskPath = mask.icon;
415
-
416
-
417
- var trans = transformForSvg({ transform: transform, containerWidth: maskWidth, iconWidth: mainWidth });
418
-
419
- var maskRect = {
420
- tag: 'rect',
421
- attributes: _extends({}, ALL_SPACE, {
422
- fill: 'white'
423
- })
424
- };
425
- var maskInnerGroup = {
426
- tag: 'g',
427
- attributes: _extends({}, trans.inner),
428
- children: [{ tag: 'path', attributes: _extends({}, mainPath.attributes, trans.path, { fill: 'black' }) }]
429
- };
430
- var maskOuterGroup = {
431
- tag: 'g',
432
- attributes: _extends({}, trans.outer),
433
- children: [maskInnerGroup]
434
- };
435
- var maskId = 'mask-' + nextUniqueId();
436
- var clipId = 'clip-' + nextUniqueId();
437
- var maskTag = {
438
- tag: 'mask',
439
- attributes: _extends({}, ALL_SPACE, {
440
- id: maskId,
441
- maskUnits: 'userSpaceOnUse',
442
- maskContentUnits: 'userSpaceOnUse'
443
- }),
444
- children: [maskRect, maskOuterGroup]
445
- };
446
- var defs = {
447
- tag: 'defs',
448
- children: [{ tag: 'clipPath', attributes: { id: clipId }, children: [maskPath] }, maskTag]
449
- };
450
-
451
- children.push(defs, { tag: 'rect', attributes: _extends({ fill: 'currentColor', 'clip-path': 'url(#' + clipId + ')', mask: 'url(#' + maskId + ')' }, ALL_SPACE) });
452
-
453
- return {
454
- children: children,
455
- attributes: attributes
456
- };
457
- };
458
-
459
- var makeIconStandard = function (_ref) {
460
- var children = _ref.children,
461
- attributes = _ref.attributes,
462
- main = _ref.main,
463
- transform = _ref.transform,
464
- styles = _ref.styles;
465
-
466
- var styleString = joinStyles(styles);
467
-
468
- if (styleString.length > 0) {
469
- attributes['style'] = styleString;
470
- }
471
-
472
- if (transformIsMeaningful(transform)) {
473
- var trans = transformForSvg({ transform: transform, containerWidth: main.width, iconWidth: main.width });
474
- children.push({
475
- tag: 'g',
476
- attributes: _extends({}, trans.outer),
477
- children: [{
478
- tag: 'g',
479
- attributes: _extends({}, trans.inner),
480
- children: [{
481
- tag: main.icon.tag,
482
- children: main.icon.children,
483
- attributes: _extends({}, main.icon.attributes, trans.path)
484
- }]
485
- }]
486
- });
487
- } else {
488
- children.push(main.icon);
489
- }
490
-
491
- return {
492
- children: children,
493
- attributes: attributes
494
- };
495
- };
496
-
497
- var asIcon = function (_ref) {
498
- var children = _ref.children,
499
- main = _ref.main,
500
- mask = _ref.mask,
501
- attributes = _ref.attributes,
502
- styles = _ref.styles,
503
- transform = _ref.transform;
504
-
505
- if (transformIsMeaningful(transform) && main.found && !mask.found) {
506
- var width = main.width,
507
- height = main.height;
508
-
509
- var offset = {
510
- x: width / height / 2,
511
- y: 0.5
512
- };
513
- attributes['style'] = joinStyles(_extends({}, styles, {
514
- 'transform-origin': offset.x + transform.x / 16 + 'em ' + (offset.y + transform.y / 16) + 'em'
515
- }));
516
- }
517
-
518
- return [{
519
- tag: 'svg',
520
- attributes: attributes,
521
- children: children
522
- }];
523
- };
524
-
525
- var asSymbol = function (_ref) {
526
- var prefix = _ref.prefix,
527
- iconName = _ref.iconName,
528
- children = _ref.children,
529
- attributes = _ref.attributes,
530
- symbol = _ref.symbol;
531
-
532
- var id = symbol === true ? prefix + '-' + config.familyPrefix + '-' + iconName : symbol;
533
-
534
- return [{
535
- tag: 'svg',
536
- attributes: {
537
- style: 'display: none;'
538
- },
539
- children: [{
540
- tag: 'symbol',
541
- attributes: _extends({}, attributes, { id: id }),
542
- children: children
543
- }]
544
- }];
545
- };
546
-
547
- function makeInlineSvgAbstract(params) {
548
- var _params$icons = params.icons,
549
- main = _params$icons.main,
550
- mask = _params$icons.mask,
551
- prefix = params.prefix,
552
- iconName = params.iconName,
553
- transform = params.transform,
554
- symbol = params.symbol,
555
- title = params.title,
556
- extra = params.extra,
557
- _params$watchable = params.watchable,
558
- watchable = _params$watchable === undefined ? false : _params$watchable;
559
-
560
- var _ref = mask.found ? mask : main,
561
- width = _ref.width,
562
- height = _ref.height;
563
-
564
- var widthClass = 'fa-w-' + Math.ceil(width / height * 16);
565
- var attrClass = [config.replacementClass, iconName ? config.familyPrefix + '-' + iconName : '', widthClass].filter(function (c) {
566
- return extra.classes.indexOf(c) === -1;
567
- }).concat(extra.classes).join(' ');
568
-
569
- var content = {
570
- children: [],
571
- attributes: _extends({}, extra.attributes, {
572
- 'data-prefix': prefix,
573
- 'data-icon': iconName,
574
- 'class': attrClass,
575
- 'role': 'img',
576
- 'xmlns': 'http://www.w3.org/2000/svg',
577
- 'viewBox': '0 0 ' + width + ' ' + height
578
- })
579
- };
580
-
581
- if (watchable) {
582
- content.attributes[DATA_FA_I2SVG] = '';
583
- }
584
-
585
- if (title) content.children.push({ tag: 'title', attributes: { id: content.attributes['aria-labelledby'] || 'title-' + nextUniqueId() }, children: [title] });
586
-
587
- var args = _extends({}, content, {
588
- prefix: prefix,
589
- iconName: iconName,
590
- main: main,
591
- mask: mask,
592
- transform: transform,
593
- symbol: symbol,
594
- styles: extra.styles
595
- });
596
-
597
- var _ref2 = mask.found && main.found ? makeIconMasking(args) : makeIconStandard(args),
598
- children = _ref2.children,
599
- attributes = _ref2.attributes;
600
-
601
- args.children = children;
602
- args.attributes = attributes;
603
-
604
- if (symbol) {
605
- return asSymbol(args);
606
- } else {
607
- return asIcon(args);
608
- }
609
- }
610
-
611
- function makeLayersTextAbstract(params) {
612
- var content = params.content,
613
- width = params.width,
614
- height = params.height,
615
- transform = params.transform,
616
- title = params.title,
617
- extra = params.extra,
618
- _params$watchable2 = params.watchable,
619
- watchable = _params$watchable2 === undefined ? false : _params$watchable2;
620
-
621
-
622
- var attributes = _extends({}, extra.attributes, title ? { 'title': title } : {}, {
623
- 'class': extra.classes.join(' ')
624
- });
625
-
626
- if (watchable) {
627
- attributes[DATA_FA_I2SVG] = '';
628
- }
629
-
630
- var styles = _extends({}, extra.styles);
631
-
632
- if (transformIsMeaningful(transform)) {
633
- styles['transform'] = transformForCss({ transform: transform, startCentered: true, width: width, height: height });
634
- styles['-webkit-transform'] = styles['transform'];
635
- }
636
-
637
- var styleString = joinStyles(styles);
638
-
639
- if (styleString.length > 0) {
640
- attributes['style'] = styleString;
641
- }
642
-
643
- var val = [];
644
-
645
- val.push({
646
- tag: 'span',
647
- attributes: attributes,
648
- children: [content]
649
- });
650
-
651
- if (title) {
652
- val.push({ tag: 'span', attributes: { class: 'sr-only' }, children: [title] });
653
- }
654
-
655
- return val;
656
- }
657
-
658
- function makeLayersCounterAbstract(params) {
659
- var content = params.content,
660
- title = params.title,
661
- extra = params.extra;
662
-
663
-
664
- var attributes = _extends({}, extra.attributes, title ? { 'title': title } : {}, {
665
- 'class': extra.classes.join(' ')
666
- });
667
-
668
- var styleString = joinStyles(extra.styles);
669
-
670
- if (styleString.length > 0) {
671
- attributes['style'] = styleString;
672
- }
673
-
674
- var val = [];
675
-
676
- val.push({
677
- tag: 'span',
678
- attributes: attributes,
679
- children: [content]
680
- });
681
-
682
- if (title) {
683
- val.push({ tag: 'span', attributes: { class: 'sr-only' }, children: [title] });
684
- }
685
-
686
- return val;
687
- }
688
-
689
- var noop$2 = function noop() {};
690
- var p = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : { mark: noop$2, measure: noop$2 };
691
- var preamble = 'FA "5.2.0"';
692
-
693
- var begin = function begin(name) {
694
- p.mark(preamble + ' ' + name + ' begins');
695
- return function () {
696
- return end(name);
697
- };
698
- };
699
-
700
- var end = function end(name) {
701
- p.mark(preamble + ' ' + name + ' ends');
702
- p.measure(preamble + ' ' + name, preamble + ' ' + name + ' begins', preamble + ' ' + name + ' ends');
703
- };
704
-
705
- var perf = { begin: begin, end: end };
706
-
707
- 'use strict';
708
-
709
- /**
710
- * Internal helper to bind a function known to have 4 arguments
711
- * to a given context.
712
- */
713
- var bindInternal4 = function bindInternal4 (func, thisContext) {
714
- return function (a, b, c, d) {
715
- return func.call(thisContext, a, b, c, d);
716
- };
717
- };
718
-
719
- 'use strict';
720
-
721
-
722
-
723
- /**
724
- * # Reduce
725
- *
726
- * A fast object `.reduce()` implementation.
727
- *
728
- * @param {Object} subject The object to reduce over.
729
- * @param {Function} fn The reducer function.
730
- * @param {mixed} initialValue The initial value for the reducer, defaults to subject[0].
731
- * @param {Object} thisContext The context for the reducer.
732
- * @return {mixed} The final result.
733
- */
734
- var reduce = function fastReduceObject (subject, fn, initialValue, thisContext) {
735
- var keys = Object.keys(subject),
736
- length = keys.length,
737
- iterator = thisContext !== undefined ? bindInternal4(fn, thisContext) : fn,
738
- i, key, result;
739
-
740
- if (initialValue === undefined) {
741
- i = 1;
742
- result = subject[keys[0]];
743
- }
744
- else {
745
- i = 0;
746
- result = initialValue;
747
- }
748
-
749
- for (; i < length; i++) {
750
- key = keys[i];
751
- result = iterator(result, subject[key], key, subject);
752
- }
753
-
754
- return result;
755
- };
756
-
757
- var styles$2 = namespace.styles;
758
- var shims = namespace.shims;
759
-
760
-
761
- var _byUnicode = {};
762
- var _byLigature = {};
763
- var _byOldName = {};
764
-
765
- var build = function build() {
766
- var lookup = function lookup(reducer) {
767
- return reduce(styles$2, function (o, style, prefix) {
768
- o[prefix] = reduce(style, reducer, {});
769
- return o;
770
- }, {});
771
- };
772
-
773
- _byUnicode = lookup(function (acc, icon, iconName) {
774
- acc[icon[3]] = iconName;
775
-
776
- return acc;
777
- });
778
-
779
- _byLigature = lookup(function (acc, icon, iconName) {
780
- var ligatures = icon[2];
781
-
782
- acc[iconName] = iconName;
783
-
784
- ligatures.forEach(function (ligature) {
785
- acc[ligature] = iconName;
786
- });
787
-
788
- return acc;
789
- });
790
-
791
- var hasRegular = 'far' in styles$2;
792
-
793
- _byOldName = reduce(shims, function (acc, shim) {
794
- var oldName = shim[0];
795
- var prefix = shim[1];
796
- var iconName = shim[2];
797
-
798
- if (prefix === 'far' && !hasRegular) {
799
- prefix = 'fas';
800
- }
801
-
802
- acc[oldName] = { prefix: prefix, iconName: iconName };
803
-
804
- return acc;
805
- }, {});
806
- };
807
-
808
- build();
809
-
810
- function byUnicode(prefix, unicode) {
811
- return _byUnicode[prefix][unicode];
812
- }
813
-
814
- function byLigature(prefix, ligature) {
815
- return _byLigature[prefix][ligature];
816
- }
817
-
818
- function byOldName(name) {
819
- return _byOldName[name] || { prefix: null, iconName: null };
820
- }
821
-
822
- var styles$1 = namespace.styles;
823
-
824
-
825
- var emptyCanonicalIcon = function emptyCanonicalIcon() {
826
- return { prefix: null, iconName: null, rest: [] };
827
- };
828
-
829
- function getCanonicalIcon(values) {
830
- return values.reduce(function (acc, cls) {
831
- var iconName = getIconName(config.familyPrefix, cls);
832
-
833
- if (styles$1[cls]) {
834
- acc.prefix = cls;
835
- } else if (iconName) {
836
- var shim = acc.prefix === 'fa' ? byOldName(iconName) : {};
837
-
838
- acc.iconName = shim.iconName || iconName;
839
- acc.prefix = shim.prefix || acc.prefix;
840
- } else if (cls !== config.replacementClass && cls.indexOf('fa-w-') !== 0) {
841
- acc.rest.push(cls);
842
- }
843
-
844
- return acc;
845
- }, emptyCanonicalIcon());
846
- }
847
-
848
- function iconFromMapping(mapping, prefix, iconName) {
849
- if (mapping && mapping[prefix] && mapping[prefix][iconName]) {
850
- return {
851
- prefix: prefix,
852
- iconName: iconName,
853
- icon: mapping[prefix][iconName]
854
- };
855
- }
856
- }
857
-
858
- function toHtml(abstractNodes) {
859
- var tag = abstractNodes.tag,
860
- _abstractNodes$attrib = abstractNodes.attributes,
861
- attributes = _abstractNodes$attrib === undefined ? {} : _abstractNodes$attrib,
862
- _abstractNodes$childr = abstractNodes.children,
863
- children = _abstractNodes$childr === undefined ? [] : _abstractNodes$childr;
864
-
865
-
866
- if (typeof abstractNodes === 'string') {
867
- return htmlEscape(abstractNodes);
868
- } else {
869
- return '<' + tag + ' ' + joinAttributes(attributes) + '>' + children.map(toHtml).join('') + '</' + tag + '>';
870
- }
871
- }
872
-
873
- var noop$1 = function noop() {};
874
-
875
- function isWatched(node) {
876
- var i2svg = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null;
877
-
878
- return typeof i2svg === 'string';
879
- }
880
-
881
- function getMutator() {
882
- if (config.autoReplaceSvg === true) {
883
- return mutators.replace;
884
- }
885
-
886
- var mutator = mutators[config.autoReplaceSvg];
887
-
888
- return mutator || mutators.replace;
889
- }
890
-
891
- var mutators = {
892
- replace: function replace(mutation) {
893
- var node = mutation[0];
894
- var abstract = mutation[1];
895
- var newOuterHTML = abstract.map(function (a) {
896
- return toHtml(a);
897
- }).join('\n');
898
-
899
- if (node.parentNode && node.outerHTML) {
900
- node.outerHTML = newOuterHTML + (config.keepOriginalSource && node.tagName.toLowerCase() !== 'svg' ? '<!-- ' + node.outerHTML + ' -->' : '');
901
- } else if (node.parentNode) {
902
- var newNode = document.createElement('span');
903
- node.parentNode.replaceChild(newNode, node);
904
- newNode.outerHTML = newOuterHTML;
905
- }
906
- },
907
- nest: function nest(mutation) {
908
- var node = mutation[0];
909
- var abstract = mutation[1];
910
-
911
- // If we already have a replaced node we do not want to continue nesting within it.
912
- // Short-circuit to the standard replacement
913
- if (~classArray(node).indexOf(config.replacementClass)) {
914
- return mutators.replace(mutation);
915
- }
916
-
917
- var forSvg = new RegExp(config.familyPrefix + '-.*');
918
-
919
- delete abstract[0].attributes.style;
920
-
921
- var splitClasses = abstract[0].attributes.class.split(' ').reduce(function (acc, cls) {
922
- if (cls === config.replacementClass || cls.match(forSvg)) {
923
- acc.toSvg.push(cls);
924
- } else {
925
- acc.toNode.push(cls);
926
- }
927
-
928
- return acc;
929
- }, { toNode: [], toSvg: [] });
930
-
931
- abstract[0].attributes.class = splitClasses.toSvg.join(' ');
932
-
933
- var newInnerHTML = abstract.map(function (a) {
934
- return toHtml(a);
935
- }).join('\n');
936
- node.setAttribute('class', splitClasses.toNode.join(' '));
937
- node.setAttribute(DATA_FA_I2SVG, '');
938
- node.innerHTML = newInnerHTML;
939
- }
940
- };
941
-
942
- function perform(mutations, callback) {
943
- var callbackFunction = typeof callback === 'function' ? callback : noop$1;
944
-
945
- if (mutations.length === 0) {
946
- callbackFunction();
947
- } else {
948
- var frame = WINDOW.requestAnimationFrame || function (op) {
949
- return op();
950
- };
951
-
952
- frame(function () {
953
- var mutator = getMutator();
954
- var mark = perf.begin('mutate');
955
-
956
- mutations.map(mutator);
957
-
958
- mark();
959
-
960
- callbackFunction();
961
- });
962
- }
963
- }
964
-
965
- var disabled = false;
966
-
967
- function disableObservation(operation) {
968
- disabled = true;
969
- operation();
970
- disabled = false;
971
- }
972
-
973
- var mo = null;
974
-
975
- function observe(options) {
976
- if (!MUTATION_OBSERVER) {
977
- return;
978
- }
979
-
980
- if (!config.observeMutations) {
981
- return;
982
- }
983
-
984
- var treeCallback = options.treeCallback,
985
- nodeCallback = options.nodeCallback,
986
- pseudoElementsCallback = options.pseudoElementsCallback,
987
- _options$observeMutat = options.observeMutationsRoot,
988
- observeMutationsRoot = _options$observeMutat === undefined ? DOCUMENT.body : _options$observeMutat;
989
-
990
-
991
- mo = new MUTATION_OBSERVER(function (objects) {
992
- if (disabled) return;
993
-
994
- toArray(objects).forEach(function (mutationRecord) {
995
- if (mutationRecord.type === 'childList' && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) {
996
- if (config.searchPseudoElements) {
997
- pseudoElementsCallback(mutationRecord.target);
998
- }
999
-
1000
- treeCallback(mutationRecord.target);
1001
- }
1002
-
1003
- if (mutationRecord.type === 'attributes' && mutationRecord.target.parentNode && config.searchPseudoElements) {
1004
- pseudoElementsCallback(mutationRecord.target.parentNode);
1005
- }
1006
-
1007
- if (mutationRecord.type === 'attributes' && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) {
1008
- if (mutationRecord.attributeName === 'class') {
1009
- var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)),
1010
- prefix = _getCanonicalIcon.prefix,
1011
- iconName = _getCanonicalIcon.iconName;
1012
-
1013
- if (prefix) mutationRecord.target.setAttribute('data-prefix', prefix);
1014
- if (iconName) mutationRecord.target.setAttribute('data-icon', iconName);
1015
- } else {
1016
- nodeCallback(mutationRecord.target);
1017
- }
1018
- }
1019
- });
1020
- });
1021
-
1022
- if (!IS_DOM) return;
1023
-
1024
- mo.observe(observeMutationsRoot, {
1025
- childList: true, attributes: true, characterData: true, subtree: true
1026
- });
1027
- }
1028
-
1029
- function disconnect() {
1030
- if (!mo) return;
1031
-
1032
- mo.disconnect();
1033
- }
1034
-
1035
- var styleParser = function (node) {
1036
- var style = node.getAttribute('style');
1037
-
1038
- var val = [];
1039
-
1040
- if (style) {
1041
- val = style.split(';').reduce(function (acc, style) {
1042
- var styles = style.split(':');
1043
- var prop = styles[0];
1044
- var value = styles.slice(1);
1045
-
1046
- if (prop && value.length > 0) {
1047
- acc[prop] = value.join(':').trim();
1048
- }
1049
-
1050
- return acc;
1051
- }, {});
1052
- }
1053
-
1054
- return val;
1055
- };
1056
-
1057
- function toHex(unicode) {
1058
- var result = '';
1059
-
1060
- for (var i = 0; i < unicode.length; i++) {
1061
- var hex = unicode.charCodeAt(i).toString(16);
1062
- result += ('000' + hex).slice(-4);
1063
- }
1064
-
1065
- return result;
1066
- }
1067
-
1068
- var classParser = function (node) {
1069
- var existingPrefix = node.getAttribute('data-prefix');
1070
- var existingIconName = node.getAttribute('data-icon');
1071
- var innerText = node.innerText !== undefined ? node.innerText.trim() : '';
1072
-
1073
- var val = getCanonicalIcon(classArray(node));
1074
-
1075
- if (existingPrefix && existingIconName) {
1076
- val.prefix = existingPrefix;
1077
- val.iconName = existingIconName;
1078
- }
1079
-
1080
- if (val.prefix && innerText.length > 1) {
1081
- val.iconName = byLigature(val.prefix, node.innerText);
1082
- } else if (val.prefix && innerText.length === 1) {
1083
- val.iconName = byUnicode(val.prefix, toHex(node.innerText));
1084
- }
1085
-
1086
- return val;
1087
- };
1088
-
1089
- var parseTransformString = function parseTransformString(transformString) {
1090
- var transform = {
1091
- size: 16,
1092
- x: 0,
1093
- y: 0,
1094
- flipX: false,
1095
- flipY: false,
1096
- rotate: 0
1097
- };
1098
-
1099
- if (!transformString) {
1100
- return transform;
1101
- } else {
1102
- return transformString.toLowerCase().split(' ').reduce(function (acc, n) {
1103
- var parts = n.toLowerCase().split('-');
1104
- var first = parts[0];
1105
- var rest = parts.slice(1).join('-');
1106
-
1107
- if (first && rest === 'h') {
1108
- acc.flipX = true;
1109
- return acc;
1110
- }
1111
-
1112
- if (first && rest === 'v') {
1113
- acc.flipY = true;
1114
- return acc;
1115
- }
1116
-
1117
- rest = parseFloat(rest);
1118
-
1119
- if (isNaN(rest)) {
1120
- return acc;
1121
- }
1122
-
1123
- switch (first) {
1124
- case 'grow':
1125
- acc.size = acc.size + rest;
1126
- break;
1127
- case 'shrink':
1128
- acc.size = acc.size - rest;
1129
- break;
1130
- case 'left':
1131
- acc.x = acc.x - rest;
1132
- break;
1133
- case 'right':
1134
- acc.x = acc.x + rest;
1135
- break;
1136
- case 'up':
1137
- acc.y = acc.y - rest;
1138
- break;
1139
- case 'down':
1140
- acc.y = acc.y + rest;
1141
- break;
1142
- case 'rotate':
1143
- acc.rotate = acc.rotate + rest;
1144
- break;
1145
- }
1146
-
1147
- return acc;
1148
- }, transform);
1149
- }
1150
- };
1151
-
1152
- var transformParser = function (node) {
1153
- return parseTransformString(node.getAttribute('data-fa-transform'));
1154
- };
1155
-
1156
- var symbolParser = function (node) {
1157
- var symbol = node.getAttribute('data-fa-symbol');
1158
-
1159
- return symbol === null ? false : symbol === '' ? true : symbol;
1160
- };
1161
-
1162
- var attributesParser = function (node) {
1163
- var extraAttributes = toArray(node.attributes).reduce(function (acc, attr) {
1164
- if (acc.name !== 'class' && acc.name !== 'style') {
1165
- acc[attr.name] = attr.value;
1166
- }
1167
- return acc;
1168
- }, {});
1169
-
1170
- var title = node.getAttribute('title');
1171
-
1172
- if (config.autoA11y) {
1173
- if (title) {
1174
- extraAttributes['aria-labelledby'] = config.replacementClass + '-title-' + nextUniqueId();
1175
- } else {
1176
- extraAttributes['aria-hidden'] = 'true';
1177
- }
1178
- }
1179
-
1180
- return extraAttributes;
1181
- };
1182
-
1183
- var maskParser = function (node) {
1184
- var mask = node.getAttribute('data-fa-mask');
1185
-
1186
- if (!mask) {
1187
- return emptyCanonicalIcon();
1188
- } else {
1189
- return getCanonicalIcon(mask.split(' ').map(function (i) {
1190
- return i.trim();
1191
- }));
1192
- }
1193
- };
1194
-
1195
- var blankMeta = {
1196
- iconName: null,
1197
- title: null,
1198
- prefix: null,
1199
- transform: meaninglessTransform,
1200
- symbol: false,
1201
- mask: null,
1202
- extra: { classes: [], styles: {}, attributes: {} }
1203
- };
1204
-
1205
- function parseMeta(node) {
1206
- var _classParser = classParser(node),
1207
- iconName = _classParser.iconName,
1208
- prefix = _classParser.prefix,
1209
- extraClasses = _classParser.rest;
1210
-
1211
- var extraStyles = styleParser(node);
1212
- var transform = transformParser(node);
1213
- var symbol = symbolParser(node);
1214
- var extraAttributes = attributesParser(node);
1215
- var mask = maskParser(node);
1216
-
1217
- return {
1218
- iconName: iconName,
1219
- title: node.getAttribute('title'),
1220
- prefix: prefix,
1221
- transform: transform,
1222
- symbol: symbol,
1223
- mask: mask,
1224
- extra: {
1225
- classes: extraClasses,
1226
- styles: extraStyles,
1227
- attributes: extraAttributes
1228
- }
1229
- };
1230
- }
1231
-
1232
- function MissingIcon(error) {
1233
- this.name = 'MissingIcon';
1234
- this.message = error || 'Icon unavailable';
1235
- this.stack = new Error().stack;
1236
- }
1237
-
1238
- MissingIcon.prototype = Object.create(Error.prototype);
1239
- MissingIcon.prototype.constructor = MissingIcon;
1240
-
1241
- var FILL = { fill: 'currentColor' };
1242
- var ANIMATION_BASE = {
1243
- attributeType: 'XML',
1244
- repeatCount: 'indefinite',
1245
- dur: '2s'
1246
- };
1247
- var RING = {
1248
- tag: 'path',
1249
- attributes: _extends({}, FILL, {
1250
- 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'
1251
- })
1252
- };
1253
- var OPACITY_ANIMATE = _extends({}, ANIMATION_BASE, {
1254
- attributeName: 'opacity'
1255
- });
1256
- var DOT = {
1257
- tag: 'circle',
1258
- attributes: _extends({}, FILL, {
1259
- cx: '256',
1260
- cy: '364',
1261
- r: '28'
1262
- }),
1263
- children: [{ tag: 'animate', attributes: _extends({}, ANIMATION_BASE, { attributeName: 'r', values: '28;14;28;28;14;28;' }) }, { tag: 'animate', attributes: _extends({}, OPACITY_ANIMATE, { values: '1;0;1;1;0;1;' }) }]
1264
- };
1265
- var QUESTION = {
1266
- tag: 'path',
1267
- attributes: _extends({}, FILL, {
1268
- opacity: '1',
1269
- 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'
1270
- }),
1271
- children: [{ tag: 'animate', attributes: _extends({}, OPACITY_ANIMATE, { values: '1;0;0;0;0;1;' }) }]
1272
- };
1273
- var EXCLAMATION = {
1274
- tag: 'path',
1275
- attributes: _extends({}, FILL, {
1276
- opacity: '0',
1277
- 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'
1278
- }),
1279
- children: [{ tag: 'animate', attributes: _extends({}, OPACITY_ANIMATE, { values: '0;0;1;1;0;0;' }) }]
1280
- };
1281
-
1282
- var missing = { tag: 'g', children: [RING, DOT, QUESTION, EXCLAMATION] };
1283
-
1284
- var styles = namespace.styles;
1285
-
1286
- var LAYERS_TEXT_CLASSNAME = 'fa-layers-text';
1287
- var FONT_FAMILY_PATTERN = /Font Awesome 5 (Solid|Regular|Light|Brands|Free|Pro)/;
1288
- var STYLE_TO_PREFIX = {
1289
- 'Solid': 'fas',
1290
- 'Regular': 'far',
1291
- 'Light': 'fal',
1292
- 'Brands': 'fab'
1293
- };
1294
- var FONT_WEIGHT_TO_PREFIX = {
1295
- '900': 'fas',
1296
- '400': 'far',
1297
- '300': 'fal'
1298
- };
1299
-
1300
- function findIcon(iconName, prefix) {
1301
- var val = {
1302
- found: false,
1303
- width: 512,
1304
- height: 512,
1305
- icon: missing
1306
- };
1307
-
1308
- if (iconName && prefix && styles[prefix] && styles[prefix][iconName]) {
1309
- var icon = styles[prefix][iconName];
1310
- var width = icon[0];
1311
- var height = icon[1];
1312
- var vectorData = icon.slice(4);
1313
-
1314
- val = {
1315
- found: true,
1316
- width: width,
1317
- height: height,
1318
- icon: { tag: 'path', attributes: { fill: 'currentColor', d: vectorData[0] } }
1319
- };
1320
- } else if (iconName && prefix && !config.showMissingIcons) {
1321
- throw new MissingIcon('Icon is missing for prefix ' + prefix + ' with icon name ' + iconName);
1322
- }
1323
-
1324
- return val;
1325
- }
1326
-
1327
- function generateSvgReplacementMutation(node, nodeMeta) {
1328
- var iconName = nodeMeta.iconName,
1329
- title = nodeMeta.title,
1330
- prefix = nodeMeta.prefix,
1331
- transform = nodeMeta.transform,
1332
- symbol = nodeMeta.symbol,
1333
- mask = nodeMeta.mask,
1334
- extra = nodeMeta.extra;
1335
-
1336
-
1337
- return [node, makeInlineSvgAbstract({
1338
- icons: {
1339
- main: findIcon(iconName, prefix),
1340
- mask: findIcon(mask.iconName, mask.prefix)
1341
- },
1342
- prefix: prefix,
1343
- iconName: iconName,
1344
- transform: transform,
1345
- symbol: symbol,
1346
- mask: mask,
1347
- title: title,
1348
- extra: extra,
1349
- watchable: true
1350
- })];
1351
- }
1352
-
1353
- function generateLayersText(node, nodeMeta) {
1354
- var title = nodeMeta.title,
1355
- transform = nodeMeta.transform,
1356
- extra = nodeMeta.extra;
1357
-
1358
-
1359
- var width = null;
1360
- var height = null;
1361
-
1362
- if (IS_IE) {
1363
- var computedFontSize = parseInt(getComputedStyle(node).fontSize, 10);
1364
- var boundingClientRect = node.getBoundingClientRect();
1365
- width = boundingClientRect.width / computedFontSize;
1366
- height = boundingClientRect.height / computedFontSize;
1367
- }
1368
-
1369
- if (config.autoA11y && !title) {
1370
- extra.attributes['aria-hidden'] = 'true';
1371
- }
1372
-
1373
- return [node, makeLayersTextAbstract({
1374
- content: node.innerHTML,
1375
- width: width,
1376
- height: height,
1377
- transform: transform,
1378
- title: title,
1379
- extra: extra,
1380
- watchable: true
1381
- })];
1382
- }
1383
-
1384
- function generateMutation(node) {
1385
- var nodeMeta = parseMeta(node);
1386
-
1387
- if (~nodeMeta.extra.classes.indexOf(LAYERS_TEXT_CLASSNAME)) {
1388
- return generateLayersText(node, nodeMeta);
1389
- } else {
1390
- return generateSvgReplacementMutation(node, nodeMeta);
1391
- }
1392
- }
1393
-
1394
- function searchPseudoElements(root) {
1395
- if (!IS_DOM) return;
1396
-
1397
- var end = perf.begin('searchPseudoElements');
1398
-
1399
- disableObservation(function () {
1400
- toArray(root.querySelectorAll('*')).filter(function (n) {
1401
- return n.parentNode !== document.head && !~TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS.indexOf(n.tagName.toUpperCase()) && !n.getAttribute(DATA_FA_PSEUDO_ELEMENT) && (!n.parentNode || n.parentNode.tagName !== 'svg');
1402
- }).forEach(function (node) {
1403
- [':before', ':after'].forEach(function (pos) {
1404
- var children = toArray(node.children);
1405
- var alreadyProcessedPseudoElement = children.filter(function (c) {
1406
- return c.getAttribute(DATA_FA_PSEUDO_ELEMENT) === pos;
1407
- })[0];
1408
-
1409
- var styles = WINDOW.getComputedStyle(node, pos);
1410
- var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);
1411
- var fontWeight = styles.getPropertyValue('font-weight');
1412
-
1413
- if (alreadyProcessedPseudoElement && !fontFamily) {
1414
- // If we've already processed it but the current computed style does not result in a font-family,
1415
- // that probably means that a class name that was previously present to make the icon has been
1416
- // removed. So we now should delete the icon.
1417
- node.removeChild(alreadyProcessedPseudoElement);
1418
- } else if (fontFamily) {
1419
- var content = styles.getPropertyValue('content');
1420
- var prefix = ~['Light', 'Regular', 'Solid', 'Brands'].indexOf(fontFamily[1]) ? STYLE_TO_PREFIX[fontFamily[1]] : FONT_WEIGHT_TO_PREFIX[fontWeight];
1421
- var iconName = byUnicode(prefix, toHex(content.length === 3 ? content.substr(1, 1) : content));
1422
- // Only convert the pseudo element in this :before/:after position into an icon if we haven't
1423
- // already done so with the same prefix and iconName
1424
- if (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconName) {
1425
- if (alreadyProcessedPseudoElement) {
1426
- // Delete the old one, since we're replacing it with a new one
1427
- node.removeChild(alreadyProcessedPseudoElement);
1428
- }
1429
-
1430
- var extra = blankMeta.extra;
1431
-
1432
- extra.attributes[DATA_FA_PSEUDO_ELEMENT] = pos;
1433
- var abstract = makeInlineSvgAbstract(_extends({}, blankMeta, {
1434
- icons: {
1435
- main: findIcon(iconName, prefix),
1436
- mask: emptyCanonicalIcon()
1437
- },
1438
- prefix: prefix,
1439
- iconName: iconName,
1440
- extra: extra,
1441
- watchable: true
1442
- }));
1443
-
1444
- var element = DOCUMENT.createElement('svg');
1445
-
1446
- if (pos === ':before') {
1447
- node.insertBefore(element, node.firstChild);
1448
- } else {
1449
- node.appendChild(element);
1450
- }
1451
-
1452
- element.outerHTML = abstract.map(function (a) {
1453
- return toHtml(a);
1454
- }).join('\n');
1455
- }
1456
- }
1457
- });
1458
- });
1459
- });
1460
-
1461
- end();
1462
- }
1463
-
1464
- function onTree(root) {
1465
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1466
-
1467
- if (!IS_DOM) return;
1468
-
1469
- var htmlClassList = DOCUMENT.documentElement.classList;
1470
- var hclAdd = function hclAdd(suffix) {
1471
- return htmlClassList.add(HTML_CLASS_I2SVG_BASE_CLASS + '-' + suffix);
1472
- };
1473
- var hclRemove = function hclRemove(suffix) {
1474
- return htmlClassList.remove(HTML_CLASS_I2SVG_BASE_CLASS + '-' + suffix);
1475
- };
1476
- var prefixes = Object.keys(styles);
1477
- var prefixesDomQuery = ['.' + LAYERS_TEXT_CLASSNAME + ':not([' + DATA_FA_I2SVG + '])'].concat(prefixes.map(function (p) {
1478
- return '.' + p + ':not([' + DATA_FA_I2SVG + '])';
1479
- })).join(', ');
1480
-
1481
- if (prefixesDomQuery.length === 0) {
1482
- return;
1483
- }
1484
-
1485
- var candidates = toArray(root.querySelectorAll(prefixesDomQuery));
1486
-
1487
- if (candidates.length > 0) {
1488
- hclAdd('pending');
1489
- hclRemove('complete');
1490
- } else {
1491
- return;
1492
- }
1493
-
1494
- var mark = perf.begin('onTree');
1495
-
1496
- var mutations = candidates.reduce(function (acc, node) {
1497
- try {
1498
- var mutation = generateMutation(node);
1499
-
1500
- if (mutation) {
1501
- acc.push(mutation);
1502
- }
1503
- } catch (e) {
1504
- if (!PRODUCTION) {
1505
- if (e instanceof MissingIcon) {
1506
- console.error(e);
1507
- }
1508
- }
1509
- }
1510
-
1511
- return acc;
1512
- }, []);
1513
-
1514
- mark();
1515
-
1516
- perform(mutations, function () {
1517
- hclAdd('active');
1518
- hclAdd('complete');
1519
- hclRemove('pending');
1520
-
1521
- if (typeof callback === 'function') callback();
1522
- });
1523
- }
1524
-
1525
- function onNode(node) {
1526
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1527
-
1528
- var mutation = generateMutation(node);
1529
-
1530
- if (mutation) {
1531
- perform([mutation], callback);
1532
- }
1533
- }
1534
-
1535
- 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.33333em;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-horizontal.fa-flip-vertical{-webkit-transform:scale(-1,-1);transform:scale(-1,-1)}: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:2em}.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:1em}.svg-inline--fa.fa-stack-2x{height:2em;width:2em}.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}";
1536
-
1537
- var css = function () {
1538
- var dfp = DEFAULT_FAMILY_PREFIX;
1539
- var drc = DEFAULT_REPLACEMENT_CLASS;
1540
- var fp = config.familyPrefix;
1541
- var rc = config.replacementClass;
1542
- var s = baseStyles;
1543
-
1544
- if (fp !== dfp || rc !== drc) {
1545
- var dPatt = new RegExp('\\.' + dfp + '\\-', 'g');
1546
- var rPatt = new RegExp('\\.' + drc, 'g');
1547
-
1548
- s = s.replace(dPatt, '.' + fp + '-').replace(rPatt, '.' + rc);
1549
- }
1550
-
1551
- return s;
1552
- };
1553
-
1554
- function define(prefix, icons) {
1555
- var normalized = Object.keys(icons).reduce(function (acc, iconName) {
1556
- var icon = icons[iconName];
1557
- var expanded = !!icon.icon;
1558
-
1559
- if (expanded) {
1560
- acc[icon.iconName] = icon.icon;
1561
- } else {
1562
- acc[iconName] = icon;
1563
- }
1564
- return acc;
1565
- }, {});
1566
-
1567
- if (typeof namespace.hooks.addPack === 'function') {
1568
- namespace.hooks.addPack(prefix, normalized);
1569
- } else {
1570
- namespace.styles[prefix] = _extends({}, namespace.styles[prefix] || {}, normalized);
1571
- }
1572
-
1573
- /**
1574
- * Font Awesome 4 used the prefix of `fa` for all icons. With the introduction
1575
- * of new styles we needed to differentiate between them. Prefix `fa` is now an alias
1576
- * for `fas` so we'll easy the upgrade process for our users by automatically defining
1577
- * this as well.
1578
- */
1579
- if (prefix === 'fas') {
1580
- define('fa', icons);
1581
- }
1582
- }
1583
-
1584
- var Library = function () {
1585
- function Library() {
1586
- classCallCheck(this, Library);
1587
-
1588
- this.definitions = {};
1589
- }
1590
-
1591
- createClass(Library, [{
1592
- key: 'add',
1593
- value: function add() {
1594
- var _this = this;
1595
-
1596
- for (var _len = arguments.length, definitions = Array(_len), _key = 0; _key < _len; _key++) {
1597
- definitions[_key] = arguments[_key];
1598
- }
1599
-
1600
- var additions = definitions.reduce(this._pullDefinitions, {});
1601
-
1602
- Object.keys(additions).forEach(function (key) {
1603
- _this.definitions[key] = _extends({}, _this.definitions[key] || {}, additions[key]);
1604
- define(key, additions[key]);
1605
- build();
1606
- });
1607
- }
1608
- }, {
1609
- key: 'reset',
1610
- value: function reset() {
1611
- this.definitions = {};
1612
- }
1613
- }, {
1614
- key: '_pullDefinitions',
1615
- value: function _pullDefinitions(additions, definition) {
1616
- var normalized = definition.prefix && definition.iconName && definition.icon ? { 0: definition } : definition;
1617
-
1618
- Object.keys(normalized).map(function (key) {
1619
- var _normalized$key = normalized[key],
1620
- prefix = _normalized$key.prefix,
1621
- iconName = _normalized$key.iconName,
1622
- icon = _normalized$key.icon;
1623
-
1624
-
1625
- if (!additions[prefix]) additions[prefix] = {};
1626
-
1627
- additions[prefix][iconName] = icon;
1628
- });
1629
-
1630
- return additions;
1631
- }
1632
- }]);
1633
- return Library;
1634
- }();
1635
-
1636
- function prepIcon(icon) {
1637
- var width = icon[0];
1638
- var height = icon[1];
1639
- var vectorData = icon.slice(4);
1640
-
1641
- return {
1642
- found: true,
1643
- width: width,
1644
- height: height,
1645
- icon: { tag: 'path', attributes: { fill: 'currentColor', d: vectorData[0] } }
1646
- };
1647
- }
1648
-
1649
- function ensureCss() {
1650
- if (config.autoAddCss && !_cssInserted) {
1651
- insertCss(css());
1652
- _cssInserted = true;
1653
- }
1654
- }
1655
-
1656
- function apiObject(val, abstractCreator) {
1657
- Object.defineProperty(val, 'abstract', {
1658
- get: abstractCreator
1659
- });
1660
-
1661
- Object.defineProperty(val, 'html', {
1662
- get: function get() {
1663
- return val.abstract.map(function (a) {
1664
- return toHtml(a);
1665
- });
1666
- }
1667
- });
1668
-
1669
- Object.defineProperty(val, 'node', {
1670
- get: function get() {
1671
- if (!IS_DOM) return;
1672
-
1673
- var container = DOCUMENT.createElement('div');
1674
- container.innerHTML = val.html;
1675
- return container.children;
1676
- }
1677
- });
1678
-
1679
- return val;
1680
- }
1681
-
1682
- function findIconDefinition(params) {
1683
- var _params$prefix = params.prefix,
1684
- prefix = _params$prefix === undefined ? 'fa' : _params$prefix,
1685
- iconName = params.iconName;
1686
-
1687
-
1688
- if (!iconName) return;
1689
-
1690
- return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
1691
- }
1692
-
1693
- function resolveIcons(next) {
1694
- return function (maybeIconDefinition) {
1695
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1696
-
1697
- var iconDefinition = (maybeIconDefinition || {}).icon ? maybeIconDefinition : findIconDefinition(maybeIconDefinition || {});
1698
-
1699
- var mask = params.mask;
1700
-
1701
-
1702
- if (mask) {
1703
- mask = (mask || {}).icon ? mask : findIconDefinition(mask || {});
1704
- }
1705
-
1706
- return next(iconDefinition, _extends({}, params, { mask: mask }));
1707
- };
1708
- }
1709
-
1710
- var library = new Library();
1711
-
1712
- var noAuto = function noAuto() {
1713
- config.autoReplaceSvg = false;
1714
- config.observeMutations = false;
1715
-
1716
- disconnect();
1717
- };
1718
-
1719
- var _cssInserted = false;
1720
-
1721
- var dom = {
1722
- i2svg: function i2svg() {
1723
- var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1724
-
1725
- if (IS_DOM) {
1726
- ensureCss();
1727
-
1728
- var _params$node = params.node,
1729
- node = _params$node === undefined ? DOCUMENT : _params$node,
1730
- _params$callback = params.callback,
1731
- callback = _params$callback === undefined ? function () {} : _params$callback;
1732
-
1733
-
1734
- if (config.searchPseudoElements) {
1735
- searchPseudoElements(node);
1736
- }
1737
-
1738
- onTree(node, callback);
1739
- }
1740
- },
1741
-
1742
- css: css,
1743
-
1744
- insertCss: function insertCss$$1() {
1745
- if (!_cssInserted) {
1746
- insertCss(css());
1747
- _cssInserted = true;
1748
- }
1749
- },
1750
-
1751
- watch: function watch() {
1752
- var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1753
- var autoReplaceSvgRoot = params.autoReplaceSvgRoot,
1754
- observeMutationsRoot = params.observeMutationsRoot;
1755
-
1756
-
1757
- if (config.autoReplaceSvg === false) {
1758
- config.autoReplaceSvg = true;
1759
- }
1760
-
1761
- config.observeMutations = true;
1762
-
1763
- domready(function () {
1764
- autoReplace({
1765
- autoReplaceSvgRoot: autoReplaceSvgRoot
1766
- });
1767
-
1768
- observe({
1769
- treeCallback: onTree,
1770
- nodeCallback: onNode,
1771
- pseudoElementsCallback: searchPseudoElements,
1772
- observeMutationsRoot: observeMutationsRoot
1773
- });
1774
- });
1775
- }
1776
- };
1777
-
1778
- var parse = {
1779
- transform: function transform(transformString) {
1780
- return parseTransformString(transformString);
1781
- }
1782
- };
1783
-
1784
- var icon = resolveIcons(function (iconDefinition) {
1785
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1786
- var _params$transform = params.transform,
1787
- transform = _params$transform === undefined ? meaninglessTransform : _params$transform,
1788
- _params$symbol = params.symbol,
1789
- symbol = _params$symbol === undefined ? false : _params$symbol,
1790
- _params$mask = params.mask,
1791
- mask = _params$mask === undefined ? null : _params$mask,
1792
- _params$title = params.title,
1793
- title = _params$title === undefined ? null : _params$title,
1794
- _params$classes = params.classes,
1795
- classes = _params$classes === undefined ? [] : _params$classes,
1796
- _params$attributes = params.attributes,
1797
- attributes = _params$attributes === undefined ? {} : _params$attributes,
1798
- _params$styles = params.styles,
1799
- styles = _params$styles === undefined ? {} : _params$styles;
1800
-
1801
-
1802
- if (!iconDefinition) return;
1803
-
1804
- var prefix = iconDefinition.prefix,
1805
- iconName = iconDefinition.iconName,
1806
- icon = iconDefinition.icon;
1807
-
1808
-
1809
- return apiObject(_extends({ type: 'icon' }, iconDefinition), function () {
1810
- ensureCss();
1811
-
1812
- if (config.autoA11y) {
1813
- if (title) {
1814
- attributes['aria-labelledby'] = config.replacementClass + '-title-' + nextUniqueId();
1815
- } else {
1816
- attributes['aria-hidden'] = 'true';
1817
- }
1818
- }
1819
-
1820
- return makeInlineSvgAbstract({
1821
- icons: {
1822
- main: prepIcon(icon),
1823
- mask: mask ? prepIcon(mask.icon) : { found: false, width: null, height: null, icon: {} }
1824
- },
1825
- prefix: prefix,
1826
- iconName: iconName,
1827
- transform: _extends({}, meaninglessTransform, transform),
1828
- symbol: symbol,
1829
- title: title,
1830
- extra: {
1831
- attributes: attributes,
1832
- styles: styles,
1833
- classes: classes
1834
- }
1835
- });
1836
- });
1837
- });
1838
-
1839
- var text = function text(content) {
1840
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1841
- var _params$transform2 = params.transform,
1842
- transform = _params$transform2 === undefined ? meaninglessTransform : _params$transform2,
1843
- _params$title2 = params.title,
1844
- title = _params$title2 === undefined ? null : _params$title2,
1845
- _params$classes2 = params.classes,
1846
- classes = _params$classes2 === undefined ? [] : _params$classes2,
1847
- _params$attributes2 = params.attributes,
1848
- attributes = _params$attributes2 === undefined ? {} : _params$attributes2,
1849
- _params$styles2 = params.styles,
1850
- styles = _params$styles2 === undefined ? {} : _params$styles2;
1851
-
1852
-
1853
- return apiObject({ type: 'text', content: content }, function () {
1854
- ensureCss();
1855
-
1856
- return makeLayersTextAbstract({
1857
- content: content,
1858
- transform: _extends({}, meaninglessTransform, transform),
1859
- title: title,
1860
- extra: {
1861
- attributes: attributes,
1862
- styles: styles,
1863
- classes: [config.familyPrefix + '-layers-text'].concat(toConsumableArray(classes))
1864
- }
1865
- });
1866
- });
1867
- };
1868
-
1869
- var counter = function counter(content) {
1870
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1871
- var _params$title3 = params.title,
1872
- title = _params$title3 === undefined ? null : _params$title3,
1873
- _params$classes3 = params.classes,
1874
- classes = _params$classes3 === undefined ? [] : _params$classes3,
1875
- _params$attributes3 = params.attributes,
1876
- attributes = _params$attributes3 === undefined ? {} : _params$attributes3,
1877
- _params$styles3 = params.styles,
1878
- styles = _params$styles3 === undefined ? {} : _params$styles3;
1879
-
1880
-
1881
- return apiObject({ type: 'counter', content: content }, function () {
1882
- ensureCss();
1883
-
1884
- return makeLayersCounterAbstract({
1885
- content: content.toString(),
1886
- title: title,
1887
- extra: {
1888
- attributes: attributes,
1889
- styles: styles,
1890
- classes: [config.familyPrefix + '-layers-counter'].concat(toConsumableArray(classes))
1891
- }
1892
- });
1893
- });
1894
- };
1895
-
1896
- var layer = function layer(assembler) {
1897
- return apiObject({ type: 'layer' }, function () {
1898
- ensureCss();
1899
-
1900
- var children = [];
1901
-
1902
- assembler(function (args) {
1903
- Array.isArray(args) ? args.map(function (a) {
1904
- children = children.concat(a.abstract);
1905
- }) : children = children.concat(args.abstract);
1906
- });
1907
-
1908
- return [{
1909
- tag: 'span',
1910
- attributes: { class: config.familyPrefix + '-layers' },
1911
- children: children
1912
- }];
1913
- });
1914
- };
1915
-
1916
- var api = {
1917
- noAuto: noAuto,
1918
- config: config,
1919
- dom: dom,
1920
- library: library,
1921
- parse: parse,
1922
- findIconDefinition: findIconDefinition,
1923
- icon: icon,
1924
- text: text,
1925
- counter: counter,
1926
- layer: layer,
1927
- toHtml: toHtml
1928
- };
1929
-
1930
- var autoReplace = function autoReplace() {
1931
- var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1932
- var _params$autoReplaceSv = params.autoReplaceSvgRoot,
1933
- autoReplaceSvgRoot = _params$autoReplaceSv === undefined ? DOCUMENT : _params$autoReplaceSv;
1934
-
1935
-
1936
- if (Object.keys(namespace.styles).length > 0 && IS_DOM && config.autoReplaceSvg) api.dom.i2svg({ node: autoReplaceSvgRoot });
1937
- };
1938
-
1939
- function bootstrap() {
1940
- if (IS_BROWSER) {
1941
- if (!WINDOW.FontAwesome) {
1942
- WINDOW.FontAwesome = api;
1943
- }
1944
-
1945
- domready(function () {
1946
- autoReplace();
1947
-
1948
- observe({
1949
- treeCallback: onTree,
1950
- nodeCallback: onNode,
1951
- pseudoElementsCallback: searchPseudoElements
1952
- });
1953
- });
1954
- }
1955
-
1956
- namespace.hooks = _extends({}, namespace.hooks, {
1957
-
1958
- addPack: function addPack(prefix, icons) {
1959
- namespace.styles[prefix] = _extends({}, namespace.styles[prefix] || {}, icons);
1960
-
1961
- build();
1962
- autoReplace();
1963
- },
1964
-
1965
- addShims: function addShims(shims) {
1966
- var _namespace$shims;
1967
-
1968
- (_namespace$shims = namespace.shims).push.apply(_namespace$shims, toConsumableArray(shims));
1969
-
1970
- build();
1971
- autoReplace();
1972
- }
1973
- });
1974
- }
1975
-
1976
- bunker(bootstrap);
1977
-
1978
- }());