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