@fortawesome/vue-fontawesome 3.0.0-5 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +6 -6
  3. package/index.d.ts +1 -1
  4. package/index.es.js +319 -222
  5. package/index.js +651 -554
  6. package/package.json +43 -21
  7. package/src/components/FontAwesomeIcon.js +45 -5
  8. package/src/utils.js +10 -1
  9. package/.babelrc +0 -3
  10. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -24
  11. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  12. package/.github/workflows/ci.yml +0 -29
  13. package/.tool-versions +0 -2
  14. package/CODE_OF_CONDUCT.md +0 -74
  15. package/CONTRIBUTING.md +0 -57
  16. package/DEVELOPMENT.md +0 -46
  17. package/bin/dev +0 -3
  18. package/bin/setup +0 -8
  19. package/examples/vue-awesome-example/.browserslistrc +0 -3
  20. package/examples/vue-awesome-example/.editorconfig +0 -7
  21. package/examples/vue-awesome-example/.eslintrc.js +0 -18
  22. package/examples/vue-awesome-example/babel.config.js +0 -5
  23. package/examples/vue-awesome-example/package-lock.json +0 -20468
  24. package/examples/vue-awesome-example/package.json +0 -38
  25. package/examples/vue-awesome-example/public/favicon.ico +0 -0
  26. package/examples/vue-awesome-example/public/index.html +0 -18
  27. package/examples/vue-awesome-example/src/App.vue +0 -74
  28. package/examples/vue-awesome-example/src/main.ts +0 -19
  29. package/examples/vue-awesome-example/src/shims-vue.d.ts +0 -5
  30. package/examples/vue-awesome-example/tsconfig.json +0 -39
  31. package/examples/vue-awesome-example/vue.config.js +0 -3
  32. package/rollup.config.js +0 -55
  33. package/src/components/__fixtures__/helpers.js +0 -10
  34. package/src/components/__fixtures__/icons.js +0 -23
  35. package/src/components/__tests__/FontAwesomeIcon.test.js +0 -299
  36. package/src/components/__tests__/FontAwesomeLayers.test.js +0 -83
  37. package/src/components/__tests__/FontAwesomeLayersText.test.js +0 -94
package/index.js CHANGED
@@ -1,555 +1,652 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@fortawesome/fontawesome-svg-core')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'vue', '@fortawesome/fontawesome-svg-core'], factory) :
4
- (factory((global['vue-fontawesome'] = {}),global.vue,global.FontAwesome));
5
- }(this, (function (exports,vue,fontawesomeSvgCore) { 'use strict';
6
-
7
- var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8
-
9
- function createCommonjsModule(fn, module) {
10
- return module = { exports: {} }, fn(module, module.exports), module.exports;
11
- }
12
-
13
- var humps = createCommonjsModule(function (module) {
14
- (function(global) {
15
-
16
- var _processKeys = function(convert, obj, options) {
17
- if(!_isObject(obj) || _isDate(obj) || _isRegExp(obj) || _isBoolean(obj) || _isFunction(obj)) {
18
- return obj;
19
- }
20
-
21
- var output,
22
- i = 0,
23
- l = 0;
24
-
25
- if(_isArray(obj)) {
26
- output = [];
27
- for(l=obj.length; i<l; i++) {
28
- output.push(_processKeys(convert, obj[i], options));
29
- }
30
- }
31
- else {
32
- output = {};
33
- for(var key in obj) {
34
- if(Object.prototype.hasOwnProperty.call(obj, key)) {
35
- output[convert(key, options)] = _processKeys(convert, obj[key], options);
36
- }
37
- }
38
- }
39
- return output;
40
- };
41
-
42
- // String conversion methods
43
-
44
- var separateWords = function(string, options) {
45
- options = options || {};
46
- var separator = options.separator || '_';
47
- var split = options.split || /(?=[A-Z])/;
48
-
49
- return string.split(split).join(separator);
50
- };
51
-
52
- var camelize = function(string) {
53
- if (_isNumerical(string)) {
54
- return string;
55
- }
56
- string = string.replace(/[\-_\s]+(.)?/g, function(match, chr) {
57
- return chr ? chr.toUpperCase() : '';
58
- });
59
- // Ensure 1st char is always lowercase
60
- return string.substr(0, 1).toLowerCase() + string.substr(1);
61
- };
62
-
63
- var pascalize = function(string) {
64
- var camelized = camelize(string);
65
- // Ensure 1st char is always uppercase
66
- return camelized.substr(0, 1).toUpperCase() + camelized.substr(1);
67
- };
68
-
69
- var decamelize = function(string, options) {
70
- return separateWords(string, options).toLowerCase();
71
- };
72
-
73
- // Utilities
74
- // Taken from Underscore.js
75
-
76
- var toString = Object.prototype.toString;
77
-
78
- var _isFunction = function(obj) {
79
- return typeof(obj) === 'function';
80
- };
81
- var _isObject = function(obj) {
82
- return obj === Object(obj);
83
- };
84
- var _isArray = function(obj) {
85
- return toString.call(obj) == '[object Array]';
86
- };
87
- var _isDate = function(obj) {
88
- return toString.call(obj) == '[object Date]';
89
- };
90
- var _isRegExp = function(obj) {
91
- return toString.call(obj) == '[object RegExp]';
92
- };
93
- var _isBoolean = function(obj) {
94
- return toString.call(obj) == '[object Boolean]';
95
- };
96
-
97
- // Performant way to determine if obj coerces to a number
98
- var _isNumerical = function(obj) {
99
- obj = obj - 0;
100
- return obj === obj;
101
- };
102
-
103
- // Sets up function which handles processing keys
104
- // allowing the convert function to be modified by a callback
105
- var _processor = function(convert, options) {
106
- var callback = options && 'process' in options ? options.process : options;
107
-
108
- if(typeof(callback) !== 'function') {
109
- return convert;
110
- }
111
-
112
- return function(string, options) {
113
- return callback(string, convert, options);
114
- }
115
- };
116
-
117
- var humps = {
118
- camelize: camelize,
119
- decamelize: decamelize,
120
- pascalize: pascalize,
121
- depascalize: decamelize,
122
- camelizeKeys: function(object, options) {
123
- return _processKeys(_processor(camelize, options), object);
124
- },
125
- decamelizeKeys: function(object, options) {
126
- return _processKeys(_processor(decamelize, options), object, options);
127
- },
128
- pascalizeKeys: function(object, options) {
129
- return _processKeys(_processor(pascalize, options), object);
130
- },
131
- depascalizeKeys: function () {
132
- return this.decamelizeKeys.apply(this, arguments);
133
- }
134
- };
135
-
136
- if (typeof undefined === 'function' && undefined.amd) {
137
- undefined(humps);
138
- } else if ('object' !== 'undefined' && module.exports) {
139
- module.exports = humps;
140
- } else {
141
- global.humps = humps;
142
- }
143
-
144
- })(commonjsGlobal);
145
- });
146
-
147
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
148
- return typeof obj;
149
- } : function (obj) {
150
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
151
- };
152
-
153
- var defineProperty = function (obj, key, value) {
154
- if (key in obj) {
155
- Object.defineProperty(obj, key, {
156
- value: value,
157
- enumerable: true,
158
- configurable: true,
159
- writable: true
160
- });
161
- } else {
162
- obj[key] = value;
163
- }
164
-
165
- return obj;
166
- };
167
-
168
- var _extends = Object.assign || function (target) {
169
- for (var i = 1; i < arguments.length; i++) {
170
- var source = arguments[i];
171
-
172
- for (var key in source) {
173
- if (Object.prototype.hasOwnProperty.call(source, key)) {
174
- target[key] = source[key];
175
- }
176
- }
177
- }
178
-
179
- return target;
180
- };
181
-
182
- var objectWithoutProperties = function (obj, keys) {
183
- var target = {};
184
-
185
- for (var i in obj) {
186
- if (keys.indexOf(i) >= 0) continue;
187
- if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
188
- target[i] = obj[i];
189
- }
190
-
191
- return target;
192
- };
193
-
194
- var toConsumableArray = function (arr) {
195
- if (Array.isArray(arr)) {
196
- for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
197
-
198
- return arr2;
199
- } else {
200
- return Array.from(arr);
201
- }
202
- };
203
-
204
- /**
205
- * Converts a CSS style into a plain Javascript object.
206
- * @param {String} style The style to converts into a plain Javascript object.
207
- * @returns {Object}
208
- */
209
- function styleToObject(style) {
210
- return style.split(';').map(function (s) {
211
- return s.trim();
212
- }).filter(function (s) {
213
- return s;
214
- }).reduce(function (output, pair) {
215
- var idx = pair.indexOf(':');
216
- var prop = humps.camelize(pair.slice(0, idx));
217
- var value = pair.slice(idx + 1).trim();
218
-
219
- output[prop] = value;
220
- return output;
221
- }, {});
222
- }
223
-
224
- /**
225
- * Converts a CSS class list into a plain Javascript object.
226
- * @param {Array<String>} classes The class list to convert.
227
- * @returns {Object}
228
- */
229
- function classToObject(classes) {
230
- return classes.split(/\s+/).reduce(function (output, className) {
231
- output[className] = true;
232
- return output;
233
- }, {});
234
- }
235
-
236
- /**
237
- * Converts a FontAwesome abstract element of an icon into a Vue VNode.
238
- * @param {AbstractElement | String} abstractElement The element to convert.
239
- * @param {Object} props The user-defined props.
240
- * @param {Object} attrs The user-defined native HTML attributes.
241
- * @returns {VNode}
242
- */
243
- function convert(abstractElement) {
244
- var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
245
- var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
246
-
247
- // If the abstract element is a string, we'll just return a string render function
248
- if (typeof abstractElement === 'string') {
249
- return abstractElement;
250
- }
251
-
252
- // Converting abstract element children into Vue VNodes
253
- var children = (abstractElement.children || []).map(function (child) {
254
- return convert(child);
255
- });
256
-
257
- // Converting abstract element attributes into valid Vue format
258
- var mixins = Object.keys(abstractElement.attributes || {}).reduce(function (mixins, key) {
259
- var value = abstractElement.attributes[key];
260
-
261
- switch (key) {
262
- case 'class':
263
- mixins.class = classToObject(value);
264
- break;
265
- case 'style':
266
- mixins.style = styleToObject(value);
267
- break;
268
- default:
269
- mixins.attrs[key] = value;
270
- }
271
-
272
- return mixins;
273
- }, {
274
- attrs: {},
275
- class: {},
276
- style: {}
277
- });
278
-
279
- // Now, we'll return the VNode
280
-
281
- var _attrs$class = attrs.class,
282
- _attrs$style = attrs.style,
283
- aStyle = _attrs$style === undefined ? {} : _attrs$style,
284
- otherAttrs = objectWithoutProperties(attrs, ['class', 'style']);
285
-
286
- return vue.h(abstractElement.tag, _extends({}, props, {
287
- class: mixins.class,
288
- style: _extends({}, mixins.style, aStyle)
289
- }, mixins.attrs, otherAttrs), children);
290
- }
291
-
292
- var PRODUCTION = false;
293
-
294
- try {
295
- PRODUCTION = process.env.NODE_ENV === 'production';
296
- } catch (e) {}
297
-
298
- function log () {
299
- if (!PRODUCTION && console && typeof console.error === 'function') {
300
- var _console;
301
-
302
- (_console = console).error.apply(_console, arguments);
303
- }
304
- }
305
-
306
- function objectWithKey(key, value) {
307
- return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? defineProperty({}, key, value) : {};
308
- }
309
-
310
- function classList(props) {
311
- var _classes;
312
-
313
- var classes = (_classes = {
314
- 'fa-spin': props.spin,
315
- 'fa-pulse': props.pulse,
316
- 'fa-fw': props.fixedWidth,
317
- 'fa-border': props.border,
318
- 'fa-li': props.listItem,
319
- 'fa-inverse': props.inverse,
320
- 'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both',
321
- 'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both'
322
- }, defineProperty(_classes, 'fa-' + props.size, props.size !== null), defineProperty(_classes, 'fa-rotate-' + props.rotation, props.rotation !== null), defineProperty(_classes, 'fa-pull-' + props.pull, props.pull !== null), defineProperty(_classes, 'fa-swap-opacity', props.swapOpacity), _classes);
323
-
324
- return Object.keys(classes).map(function (key) {
325
- return classes[key] ? key : null;
326
- }).filter(function (key) {
327
- return key;
328
- });
329
- }
330
-
331
- function normalizeIconArgs(icon) {
332
- if (icon === null) {
333
- return null;
334
- }
335
-
336
- if ((typeof icon === 'undefined' ? 'undefined' : _typeof(icon)) === 'object' && icon.prefix && icon.iconName) {
337
- return icon;
338
- }
339
-
340
- if (Array.isArray(icon) && icon.length === 2) {
341
- return { prefix: icon[0], iconName: icon[1] };
342
- }
343
-
344
- if (typeof icon === 'string') {
345
- return { prefix: 'fas', iconName: icon };
346
- }
347
- }
348
-
349
- var FontAwesomeIcon = vue.defineComponent({
350
- name: 'FontAwesomeIcon',
351
-
352
- props: {
353
- border: {
354
- type: Boolean,
355
- default: false
356
- },
357
- fixedWidth: {
358
- type: Boolean,
359
- default: false
360
- },
361
- flip: {
362
- type: String,
363
- default: null,
364
- validator: function validator(value) {
365
- return ['horizontal', 'vertical', 'both'].indexOf(value) > -1;
366
- }
367
- },
368
- icon: {
369
- type: [Object, Array, String],
370
- required: true
371
- },
372
- mask: {
373
- type: [Object, Array, String],
374
- default: null
375
- },
376
- listItem: {
377
- type: Boolean,
378
- default: false
379
- },
380
- pull: {
381
- type: String,
382
- default: null,
383
- validator: function validator(value) {
384
- return ['right', 'left'].indexOf(value) > -1;
385
- }
386
- },
387
- pulse: {
388
- type: Boolean,
389
- default: false
390
- },
391
- rotation: {
392
- type: [String, Number],
393
- default: null,
394
- validator: function validator(value) {
395
- return [90, 180, 270].indexOf(Number.parseInt(value, 10)) > -1;
396
- }
397
- },
398
- swapOpacity: {
399
- type: Boolean,
400
- default: false
401
- },
402
- size: {
403
- type: String,
404
- default: null,
405
- validator: function validator(value) {
406
- return ['lg', 'xs', 'sm', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x'].indexOf(value) > -1;
407
- }
408
- },
409
- spin: {
410
- type: Boolean,
411
- default: false
412
- },
413
- transform: {
414
- type: [String, Object],
415
- default: null
416
- },
417
- symbol: {
418
- type: [Boolean, String],
419
- default: false
420
- },
421
- title: {
422
- type: String,
423
- default: null
424
- },
425
- inverse: {
426
- type: Boolean,
427
- default: false
428
- }
429
- },
430
-
431
- setup: function setup(props, _ref) {
432
- var attrs = _ref.attrs;
433
-
434
- var icon = vue.computed(function () {
435
- return normalizeIconArgs(props.icon);
436
- });
437
- var classes = vue.computed(function () {
438
- return objectWithKey('classes', classList(props));
439
- });
440
- var transform = vue.computed(function () {
441
- return objectWithKey('transform', typeof props.transform === 'string' ? fontawesomeSvgCore.parse.transform(props.transform) : props.transform);
442
- });
443
- var mask = vue.computed(function () {
444
- return objectWithKey('mask', normalizeIconArgs(props.mask));
445
- });
446
-
447
- var renderedIcon = vue.computed(function () {
448
- return fontawesomeSvgCore.icon(icon.value, _extends({}, classes.value, transform.value, mask.value, {
449
- symbol: props.symbol,
450
- title: props.title
451
- }));
452
- });
453
-
454
- vue.watch(renderedIcon, function (value) {
455
- if (!value) {
456
- return log('Could not find one or more icon(s)', icon.value, mask.value);
457
- }
458
- }, { immediate: true });
459
-
460
- var vnode = vue.computed(function () {
461
- return renderedIcon.value ? convert(renderedIcon.value.abstract[0], {}, attrs) : null;
462
- });
463
- return function () {
464
- return vnode.value;
465
- };
466
- }
467
- });
468
-
469
- var FontAwesomeLayers = vue.defineComponent({
470
- name: 'FontAwesomeLayers',
471
-
472
- props: {
473
- fixedWidth: {
474
- type: Boolean,
475
- default: false
476
- }
477
- },
478
-
479
- setup: function setup(props, _ref) {
480
- var slots = _ref.slots;
481
- var familyPrefix = fontawesomeSvgCore.config.familyPrefix;
482
-
483
-
484
- var className = vue.computed(function () {
485
- return [familyPrefix + '-layers'].concat(toConsumableArray(props.fixedWidth ? [familyPrefix + '-fw'] : []));
486
- });
487
-
488
- return function () {
489
- return vue.h('div', { class: className.value }, slots.default ? slots.default() : []);
490
- };
491
- }
492
- });
493
-
494
- var FontAwesomeLayersText = vue.defineComponent({
495
- name: 'FontAwesomeLayersText',
496
-
497
- props: {
498
- value: {
499
- type: [String, Number],
500
- default: ''
501
- },
502
- transform: {
503
- type: [String, Object],
504
- default: null
505
- },
506
- counter: {
507
- type: Boolean,
508
- default: false
509
- },
510
- position: {
511
- type: String,
512
- default: null,
513
- validator: function validator(value) {
514
- return ['bottom-left', 'bottom-right', 'top-left', 'top-right'].indexOf(value) > -1;
515
- }
516
- }
517
- },
518
-
519
- setup: function setup(props, _ref) {
520
- var attrs = _ref.attrs;
521
- var familyPrefix = fontawesomeSvgCore.config.familyPrefix;
522
-
523
-
524
- var classes = vue.computed(function () {
525
- return objectWithKey('classes', [].concat(toConsumableArray(props.counter ? [familyPrefix + '-layers-counter'] : []), toConsumableArray(props.position ? [familyPrefix + '-layers-' + props.position] : [])));
526
- });
527
- var transform = vue.computed(function () {
528
- return objectWithKey('transform', typeof props.transform === 'string' ? fontawesomeSvgCore.parse.transform(props.transform) : props.transform);
529
- });
530
- var abstractElement = vue.computed(function () {
531
- var _text = fontawesomeSvgCore.text(props.value.toString(), _extends({}, transform.value, classes.value)),
532
- abstract = _text.abstract;
533
-
534
- if (props.counter) {
535
- abstract[0].attributes.class = abstract[0].attributes.class.replace('fa-layers-text', '');
536
- }
537
- return abstract[0];
538
- });
539
-
540
- var vnode = vue.computed(function () {
541
- return convert(abstractElement.value, {}, attrs);
542
- });
543
- return function () {
544
- return vnode.value;
545
- };
546
- }
547
- });
548
-
549
- exports.FontAwesomeIcon = FontAwesomeIcon;
550
- exports.FontAwesomeLayers = FontAwesomeLayers;
551
- exports.FontAwesomeLayersText = FontAwesomeLayersText;
552
-
553
- Object.defineProperty(exports, '__esModule', { value: true });
554
-
555
- })));
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@fortawesome/fontawesome-svg-core'), require('vue')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@fortawesome/fontawesome-svg-core', 'vue'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["vue-fontawesome"] = {}, global.FontAwesome, global.vue));
5
+ })(this, (function (exports, fontawesomeSvgCore, vue) { 'use strict';
6
+
7
+ function ownKeys(object, enumerableOnly) {
8
+ var keys = Object.keys(object);
9
+
10
+ if (Object.getOwnPropertySymbols) {
11
+ var symbols = Object.getOwnPropertySymbols(object);
12
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
13
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
14
+ })), keys.push.apply(keys, symbols);
15
+ }
16
+
17
+ return keys;
18
+ }
19
+
20
+ function _objectSpread2(target) {
21
+ for (var i = 1; i < arguments.length; i++) {
22
+ var source = null != arguments[i] ? arguments[i] : {};
23
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
24
+ _defineProperty(target, key, source[key]);
25
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
26
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
27
+ });
28
+ }
29
+
30
+ return target;
31
+ }
32
+
33
+ function _typeof(obj) {
34
+ "@babel/helpers - typeof";
35
+
36
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
37
+ return typeof obj;
38
+ } : function (obj) {
39
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
40
+ }, _typeof(obj);
41
+ }
42
+
43
+ function _defineProperty(obj, key, value) {
44
+ if (key in obj) {
45
+ Object.defineProperty(obj, key, {
46
+ value: value,
47
+ enumerable: true,
48
+ configurable: true,
49
+ writable: true
50
+ });
51
+ } else {
52
+ obj[key] = value;
53
+ }
54
+
55
+ return obj;
56
+ }
57
+
58
+ function _objectWithoutPropertiesLoose(source, excluded) {
59
+ if (source == null) return {};
60
+ var target = {};
61
+ var sourceKeys = Object.keys(source);
62
+ var key, i;
63
+
64
+ for (i = 0; i < sourceKeys.length; i++) {
65
+ key = sourceKeys[i];
66
+ if (excluded.indexOf(key) >= 0) continue;
67
+ target[key] = source[key];
68
+ }
69
+
70
+ return target;
71
+ }
72
+
73
+ function _objectWithoutProperties(source, excluded) {
74
+ if (source == null) return {};
75
+
76
+ var target = _objectWithoutPropertiesLoose(source, excluded);
77
+
78
+ var key, i;
79
+
80
+ if (Object.getOwnPropertySymbols) {
81
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
82
+
83
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
84
+ key = sourceSymbolKeys[i];
85
+ if (excluded.indexOf(key) >= 0) continue;
86
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
87
+ target[key] = source[key];
88
+ }
89
+ }
90
+
91
+ return target;
92
+ }
93
+
94
+ function _toConsumableArray(arr) {
95
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
96
+ }
97
+
98
+ function _arrayWithoutHoles(arr) {
99
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
100
+ }
101
+
102
+ function _iterableToArray(iter) {
103
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
104
+ }
105
+
106
+ function _unsupportedIterableToArray(o, minLen) {
107
+ if (!o) return;
108
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
109
+ var n = Object.prototype.toString.call(o).slice(8, -1);
110
+ if (n === "Object" && o.constructor) n = o.constructor.name;
111
+ if (n === "Map" || n === "Set") return Array.from(o);
112
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
113
+ }
114
+
115
+ function _arrayLikeToArray(arr, len) {
116
+ if (len == null || len > arr.length) len = arr.length;
117
+
118
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
119
+
120
+ return arr2;
121
+ }
122
+
123
+ function _nonIterableSpread() {
124
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
125
+ }
126
+
127
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
128
+
129
+ var humps$1 = {exports: {}};
130
+
131
+ (function (module) {
132
+ (function(global) {
133
+
134
+ var _processKeys = function(convert, obj, options) {
135
+ if(!_isObject(obj) || _isDate(obj) || _isRegExp(obj) || _isBoolean(obj) || _isFunction(obj)) {
136
+ return obj;
137
+ }
138
+
139
+ var output,
140
+ i = 0,
141
+ l = 0;
142
+
143
+ if(_isArray(obj)) {
144
+ output = [];
145
+ for(l=obj.length; i<l; i++) {
146
+ output.push(_processKeys(convert, obj[i], options));
147
+ }
148
+ }
149
+ else {
150
+ output = {};
151
+ for(var key in obj) {
152
+ if(Object.prototype.hasOwnProperty.call(obj, key)) {
153
+ output[convert(key, options)] = _processKeys(convert, obj[key], options);
154
+ }
155
+ }
156
+ }
157
+ return output;
158
+ };
159
+
160
+ // String conversion methods
161
+
162
+ var separateWords = function(string, options) {
163
+ options = options || {};
164
+ var separator = options.separator || '_';
165
+ var split = options.split || /(?=[A-Z])/;
166
+
167
+ return string.split(split).join(separator);
168
+ };
169
+
170
+ var camelize = function(string) {
171
+ if (_isNumerical(string)) {
172
+ return string;
173
+ }
174
+ string = string.replace(/[\-_\s]+(.)?/g, function(match, chr) {
175
+ return chr ? chr.toUpperCase() : '';
176
+ });
177
+ // Ensure 1st char is always lowercase
178
+ return string.substr(0, 1).toLowerCase() + string.substr(1);
179
+ };
180
+
181
+ var pascalize = function(string) {
182
+ var camelized = camelize(string);
183
+ // Ensure 1st char is always uppercase
184
+ return camelized.substr(0, 1).toUpperCase() + camelized.substr(1);
185
+ };
186
+
187
+ var decamelize = function(string, options) {
188
+ return separateWords(string, options).toLowerCase();
189
+ };
190
+
191
+ // Utilities
192
+ // Taken from Underscore.js
193
+
194
+ var toString = Object.prototype.toString;
195
+
196
+ var _isFunction = function(obj) {
197
+ return typeof(obj) === 'function';
198
+ };
199
+ var _isObject = function(obj) {
200
+ return obj === Object(obj);
201
+ };
202
+ var _isArray = function(obj) {
203
+ return toString.call(obj) == '[object Array]';
204
+ };
205
+ var _isDate = function(obj) {
206
+ return toString.call(obj) == '[object Date]';
207
+ };
208
+ var _isRegExp = function(obj) {
209
+ return toString.call(obj) == '[object RegExp]';
210
+ };
211
+ var _isBoolean = function(obj) {
212
+ return toString.call(obj) == '[object Boolean]';
213
+ };
214
+
215
+ // Performant way to determine if obj coerces to a number
216
+ var _isNumerical = function(obj) {
217
+ obj = obj - 0;
218
+ return obj === obj;
219
+ };
220
+
221
+ // Sets up function which handles processing keys
222
+ // allowing the convert function to be modified by a callback
223
+ var _processor = function(convert, options) {
224
+ var callback = options && 'process' in options ? options.process : options;
225
+
226
+ if(typeof(callback) !== 'function') {
227
+ return convert;
228
+ }
229
+
230
+ return function(string, options) {
231
+ return callback(string, convert, options);
232
+ }
233
+ };
234
+
235
+ var humps = {
236
+ camelize: camelize,
237
+ decamelize: decamelize,
238
+ pascalize: pascalize,
239
+ depascalize: decamelize,
240
+ camelizeKeys: function(object, options) {
241
+ return _processKeys(_processor(camelize, options), object);
242
+ },
243
+ decamelizeKeys: function(object, options) {
244
+ return _processKeys(_processor(decamelize, options), object, options);
245
+ },
246
+ pascalizeKeys: function(object, options) {
247
+ return _processKeys(_processor(pascalize, options), object);
248
+ },
249
+ depascalizeKeys: function () {
250
+ return this.decamelizeKeys.apply(this, arguments);
251
+ }
252
+ };
253
+
254
+ if (module.exports) {
255
+ module.exports = humps;
256
+ } else {
257
+ global.humps = humps;
258
+ }
259
+
260
+ })(commonjsGlobal);
261
+ } (humps$1));
262
+
263
+ var humps = humps$1.exports;
264
+
265
+ var _excluded = ["class", "style"];
266
+ /**
267
+ * Converts a CSS style into a plain Javascript object.
268
+ * @param {String} style The style to converts into a plain Javascript object.
269
+ * @returns {Object}
270
+ */
271
+
272
+ function styleToObject(style) {
273
+ return style.split(';').map(function (s) {
274
+ return s.trim();
275
+ }).filter(function (s) {
276
+ return s;
277
+ }).reduce(function (output, pair) {
278
+ var idx = pair.indexOf(':');
279
+ var prop = humps.camelize(pair.slice(0, idx));
280
+ var value = pair.slice(idx + 1).trim();
281
+ output[prop] = value;
282
+ return output;
283
+ }, {});
284
+ }
285
+ /**
286
+ * Converts a CSS class list into a plain Javascript object.
287
+ * @param {Array<String>} classes The class list to convert.
288
+ * @returns {Object}
289
+ */
290
+
291
+
292
+ function classToObject(classes) {
293
+ return classes.split(/\s+/).reduce(function (output, className) {
294
+ output[className] = true;
295
+ return output;
296
+ }, {});
297
+ }
298
+ /**
299
+ * Converts a FontAwesome abstract element of an icon into a Vue VNode.
300
+ * @param {AbstractElement | String} abstractElement The element to convert.
301
+ * @param {Object} props The user-defined props.
302
+ * @param {Object} attrs The user-defined native HTML attributes.
303
+ * @returns {VNode}
304
+ */
305
+
306
+
307
+ function convert(abstractElement) {
308
+ var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
309
+ var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
310
+
311
+ // If the abstract element is a string, we'll just return a string render function
312
+ if (typeof abstractElement === 'string') {
313
+ return abstractElement;
314
+ } // Converting abstract element children into Vue VNodes
315
+
316
+
317
+ var children = (abstractElement.children || []).map(function (child) {
318
+ return convert(child);
319
+ }); // Converting abstract element attributes into valid Vue format
320
+
321
+ var mixins = Object.keys(abstractElement.attributes || {}).reduce(function (mixins, key) {
322
+ var value = abstractElement.attributes[key];
323
+
324
+ switch (key) {
325
+ case 'class':
326
+ mixins.class = classToObject(value);
327
+ break;
328
+
329
+ case 'style':
330
+ mixins.style = styleToObject(value);
331
+ break;
332
+
333
+ default:
334
+ mixins.attrs[key] = value;
335
+ }
336
+
337
+ return mixins;
338
+ }, {
339
+ attrs: {},
340
+ class: {},
341
+ style: {}
342
+ }); // Now, we'll return the VNode
343
+
344
+ attrs.class;
345
+ var _attrs$style = attrs.style,
346
+ aStyle = _attrs$style === void 0 ? {} : _attrs$style,
347
+ otherAttrs = _objectWithoutProperties(attrs, _excluded);
348
+
349
+ return vue.h(abstractElement.tag, _objectSpread2(_objectSpread2(_objectSpread2({}, props), {}, {
350
+ class: mixins.class,
351
+ style: _objectSpread2(_objectSpread2({}, mixins.style), aStyle)
352
+ }, mixins.attrs), otherAttrs), children);
353
+ }
354
+
355
+ var PRODUCTION = false;
356
+
357
+ try {
358
+ PRODUCTION = process.env.NODE_ENV === 'production';
359
+ } catch (e) {}
360
+
361
+ function log () {
362
+ if (!PRODUCTION && console && typeof console.error === 'function') {
363
+ var _console;
364
+
365
+ (_console = console).error.apply(_console, arguments);
366
+ }
367
+ }
368
+
369
+ function objectWithKey(key, value) {
370
+ return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? _defineProperty({}, key, value) : {};
371
+ }
372
+ function classList(props) {
373
+ var _classes;
374
+
375
+ var classes = (_classes = {
376
+ 'fa-spin': props.spin,
377
+ 'fa-pulse': props.pulse,
378
+ 'fa-fw': props.fixedWidth,
379
+ 'fa-border': props.border,
380
+ 'fa-li': props.listItem,
381
+ 'fa-inverse': props.inverse,
382
+ 'fa-flip': props.flip === true,
383
+ 'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both',
384
+ 'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both'
385
+ }, _defineProperty(_classes, "fa-".concat(props.size), props.size !== null), _defineProperty(_classes, "fa-rotate-".concat(props.rotation), props.rotation !== null), _defineProperty(_classes, "fa-pull-".concat(props.pull), props.pull !== null), _defineProperty(_classes, 'fa-swap-opacity', props.swapOpacity), _defineProperty(_classes, 'fa-bounce', props.bounce), _defineProperty(_classes, 'fa-shake', props.shake), _defineProperty(_classes, 'fa-beat', props.beat), _defineProperty(_classes, 'fa-fade', props.fade), _defineProperty(_classes, 'fa-beat-fade', props.beatFade), _defineProperty(_classes, 'fa-flash', props.flash), _defineProperty(_classes, 'fa-spin-pulse', props.spinPulse), _defineProperty(_classes, 'fa-spin-reverse', props.spinReverse), _classes);
386
+ return Object.keys(classes).map(function (key) {
387
+ return classes[key] ? key : null;
388
+ }).filter(function (key) {
389
+ return key;
390
+ });
391
+ }
392
+
393
+ function normalizeIconArgs(icon) {
394
+ if (icon && _typeof(icon) === 'object' && icon.prefix && icon.iconName && icon.icon) {
395
+ return icon;
396
+ }
397
+
398
+ if (fontawesomeSvgCore.parse.icon) {
399
+ return fontawesomeSvgCore.parse.icon(icon);
400
+ }
401
+
402
+ if (icon === null) {
403
+ return null;
404
+ }
405
+
406
+ if (_typeof(icon) === 'object' && icon.prefix && icon.iconName) {
407
+ return icon;
408
+ }
409
+
410
+ if (Array.isArray(icon) && icon.length === 2) {
411
+ return {
412
+ prefix: icon[0],
413
+ iconName: icon[1]
414
+ };
415
+ }
416
+
417
+ if (typeof icon === 'string') {
418
+ return {
419
+ prefix: 'fas',
420
+ iconName: icon
421
+ };
422
+ }
423
+ }
424
+
425
+ var FontAwesomeIcon = vue.defineComponent({
426
+ name: 'FontAwesomeIcon',
427
+ props: {
428
+ border: {
429
+ type: Boolean,
430
+ default: false
431
+ },
432
+ fixedWidth: {
433
+ type: Boolean,
434
+ default: false
435
+ },
436
+ flip: {
437
+ type: [Boolean, String],
438
+ default: false,
439
+ validator: function validator(value) {
440
+ return [true, false, 'horizontal', 'vertical', 'both'].indexOf(value) > -1;
441
+ }
442
+ },
443
+ icon: {
444
+ type: [Object, Array, String],
445
+ required: true
446
+ },
447
+ mask: {
448
+ type: [Object, Array, String],
449
+ default: null
450
+ },
451
+ listItem: {
452
+ type: Boolean,
453
+ default: false
454
+ },
455
+ pull: {
456
+ type: String,
457
+ default: null,
458
+ validator: function validator(value) {
459
+ return ['right', 'left'].indexOf(value) > -1;
460
+ }
461
+ },
462
+ pulse: {
463
+ type: Boolean,
464
+ default: false
465
+ },
466
+ rotation: {
467
+ type: [String, Number],
468
+ default: null,
469
+ validator: function validator(value) {
470
+ return [90, 180, 270].indexOf(Number.parseInt(value, 10)) > -1;
471
+ }
472
+ },
473
+ swapOpacity: {
474
+ type: Boolean,
475
+ default: false
476
+ },
477
+ size: {
478
+ type: String,
479
+ default: null,
480
+ validator: function validator(value) {
481
+ return ['2xs', 'xs', 'sm', 'lg', 'xl', '2xl', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x'].indexOf(value) > -1;
482
+ }
483
+ },
484
+ spin: {
485
+ type: Boolean,
486
+ default: false
487
+ },
488
+ transform: {
489
+ type: [String, Object],
490
+ default: null
491
+ },
492
+ symbol: {
493
+ type: [Boolean, String],
494
+ default: false
495
+ },
496
+ title: {
497
+ type: String,
498
+ default: null
499
+ },
500
+ inverse: {
501
+ type: Boolean,
502
+ default: false
503
+ },
504
+ bounce: {
505
+ type: Boolean,
506
+ default: false
507
+ },
508
+ shake: {
509
+ type: Boolean,
510
+ default: false
511
+ },
512
+ beat: {
513
+ type: Boolean,
514
+ default: false
515
+ },
516
+ fade: {
517
+ type: Boolean,
518
+ default: false
519
+ },
520
+ beatFade: {
521
+ type: Boolean,
522
+ default: false
523
+ },
524
+ flash: {
525
+ type: Boolean,
526
+ default: false
527
+ },
528
+ spinPulse: {
529
+ type: Boolean,
530
+ default: false
531
+ },
532
+ spinReverse: {
533
+ type: Boolean,
534
+ default: false
535
+ }
536
+ },
537
+ setup: function setup(props, _ref) {
538
+ var attrs = _ref.attrs;
539
+ var icon = vue.computed(function () {
540
+ return normalizeIconArgs(props.icon);
541
+ });
542
+ var classes = vue.computed(function () {
543
+ return objectWithKey('classes', classList(props));
544
+ });
545
+ var transform = vue.computed(function () {
546
+ return objectWithKey('transform', typeof props.transform === 'string' ? fontawesomeSvgCore.parse.transform(props.transform) : props.transform);
547
+ });
548
+ var mask = vue.computed(function () {
549
+ return objectWithKey('mask', normalizeIconArgs(props.mask));
550
+ });
551
+ var renderedIcon = vue.computed(function () {
552
+ return fontawesomeSvgCore.icon(icon.value, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, classes.value), transform.value), mask.value), {}, {
553
+ symbol: props.symbol,
554
+ title: props.title
555
+ }));
556
+ });
557
+ vue.watch(renderedIcon, function (value) {
558
+ if (!value) {
559
+ return log('Could not find one or more icon(s)', icon.value, mask.value);
560
+ }
561
+ }, {
562
+ immediate: true
563
+ });
564
+ var vnode = vue.computed(function () {
565
+ return renderedIcon.value ? convert(renderedIcon.value.abstract[0], {}, attrs) : null;
566
+ });
567
+ return function () {
568
+ return vnode.value;
569
+ };
570
+ }
571
+ });
572
+
573
+ var FontAwesomeLayers = vue.defineComponent({
574
+ name: 'FontAwesomeLayers',
575
+ props: {
576
+ fixedWidth: {
577
+ type: Boolean,
578
+ default: false
579
+ }
580
+ },
581
+ setup: function setup(props, _ref) {
582
+ var slots = _ref.slots;
583
+ var familyPrefix = fontawesomeSvgCore.config.familyPrefix;
584
+ var className = vue.computed(function () {
585
+ return ["".concat(familyPrefix, "-layers")].concat(_toConsumableArray(props.fixedWidth ? ["".concat(familyPrefix, "-fw")] : []));
586
+ });
587
+ return function () {
588
+ return vue.h('div', {
589
+ class: className.value
590
+ }, slots.default ? slots.default() : []);
591
+ };
592
+ }
593
+ });
594
+
595
+ var FontAwesomeLayersText = vue.defineComponent({
596
+ name: 'FontAwesomeLayersText',
597
+ props: {
598
+ value: {
599
+ type: [String, Number],
600
+ default: ''
601
+ },
602
+ transform: {
603
+ type: [String, Object],
604
+ default: null
605
+ },
606
+ counter: {
607
+ type: Boolean,
608
+ default: false
609
+ },
610
+ position: {
611
+ type: String,
612
+ default: null,
613
+ validator: function validator(value) {
614
+ return ['bottom-left', 'bottom-right', 'top-left', 'top-right'].indexOf(value) > -1;
615
+ }
616
+ }
617
+ },
618
+ setup: function setup(props, _ref) {
619
+ var attrs = _ref.attrs;
620
+ var familyPrefix = fontawesomeSvgCore.config.familyPrefix;
621
+ var classes = vue.computed(function () {
622
+ return objectWithKey('classes', [].concat(_toConsumableArray(props.counter ? ["".concat(familyPrefix, "-layers-counter")] : []), _toConsumableArray(props.position ? ["".concat(familyPrefix, "-layers-").concat(props.position)] : [])));
623
+ });
624
+ var transform = vue.computed(function () {
625
+ return objectWithKey('transform', typeof props.transform === 'string' ? fontawesomeSvgCore.parse.transform(props.transform) : props.transform);
626
+ });
627
+ var abstractElement = vue.computed(function () {
628
+ var _text = fontawesomeSvgCore.text(props.value.toString(), _objectSpread2(_objectSpread2({}, transform.value), classes.value)),
629
+ abstract = _text.abstract;
630
+
631
+ if (props.counter) {
632
+ abstract[0].attributes.class = abstract[0].attributes.class.replace('fa-layers-text', '');
633
+ }
634
+
635
+ return abstract[0];
636
+ });
637
+ var vnode = vue.computed(function () {
638
+ return convert(abstractElement.value, {}, attrs);
639
+ });
640
+ return function () {
641
+ return vnode.value;
642
+ };
643
+ }
644
+ });
645
+
646
+ exports.FontAwesomeIcon = FontAwesomeIcon;
647
+ exports.FontAwesomeLayers = FontAwesomeLayers;
648
+ exports.FontAwesomeLayersText = FontAwesomeLayersText;
649
+
650
+ Object.defineProperty(exports, '__esModule', { value: true });
651
+
652
+ }));