@animus-ui/core 0.1.1-beta.13 → 0.1.1-beta.17
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 +32 -0
- package/dist/Animus.d.ts +5 -3
- package/dist/AnimusConfig.d.ts +1 -1
- package/dist/compatTheme.d.ts +4 -7
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2021 -1182
- package/dist/legacy/config.d.ts +2 -2
- package/dist/legacy/core.d.ts +3 -3
- package/dist/legacy/responsive.d.ts +2 -2
- package/dist/styles/createParser.d.ts +1 -1
- package/dist/styles/createPropertyStyle.d.ts +1 -1
- package/dist/styles/responsive.d.ts +1 -1
- package/dist/types/config.d.ts +4 -4
- package/package.json +2 -2
- package/tsconfig.json +1 -0
package/dist/index.js
CHANGED
|
@@ -1,1229 +1,2068 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import _styled from '@emotion/styled/base';
|
|
2
|
+
import { isArray, isObject, get, isString, isUndefined, identity, mapValues, omit, intersection, merge, pick, isEmpty, set, isNumber, keys } from 'lodash';
|
|
3
|
+
|
|
4
|
+
function ownKeys(object, enumerableOnly) {
|
|
5
|
+
var keys = Object.keys(object);
|
|
6
|
+
|
|
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
|
+
}
|
|
13
|
+
|
|
14
|
+
return keys;
|
|
15
|
+
}
|
|
16
|
+
|
|
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));
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function _typeof(obj) {
|
|
31
|
+
"@babel/helpers - typeof";
|
|
32
|
+
|
|
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 _classCallCheck(instance, Constructor) {
|
|
41
|
+
if (!(instance instanceof Constructor)) {
|
|
42
|
+
throw new TypeError("Cannot call a class as a function");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function _defineProperties(target, props) {
|
|
47
|
+
for (var i = 0; i < props.length; i++) {
|
|
48
|
+
var descriptor = props[i];
|
|
49
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
50
|
+
descriptor.configurable = true;
|
|
51
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
52
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
57
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
58
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
59
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
60
|
+
writable: false
|
|
61
|
+
});
|
|
62
|
+
return Constructor;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function _defineProperty(obj, key, value) {
|
|
66
|
+
if (key in obj) {
|
|
67
|
+
Object.defineProperty(obj, key, {
|
|
68
|
+
value: value,
|
|
69
|
+
enumerable: true,
|
|
70
|
+
configurable: true,
|
|
71
|
+
writable: true
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
obj[key] = value;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return obj;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function _inherits(subClass, superClass) {
|
|
81
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
82
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
86
|
+
constructor: {
|
|
87
|
+
value: subClass,
|
|
88
|
+
writable: true,
|
|
89
|
+
configurable: true
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(subClass, "prototype", {
|
|
93
|
+
writable: false
|
|
94
|
+
});
|
|
95
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function _getPrototypeOf(o) {
|
|
99
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
100
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
101
|
+
};
|
|
102
|
+
return _getPrototypeOf(o);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function _setPrototypeOf(o, p) {
|
|
106
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
107
|
+
o.__proto__ = p;
|
|
108
|
+
return o;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return _setPrototypeOf(o, p);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function _isNativeReflectConstruct() {
|
|
115
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
116
|
+
if (Reflect.construct.sham) return false;
|
|
117
|
+
if (typeof Proxy === "function") return true;
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
121
|
+
return true;
|
|
122
|
+
} catch (e) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
128
|
+
if (source == null) return {};
|
|
129
|
+
var target = {};
|
|
130
|
+
var sourceKeys = Object.keys(source);
|
|
131
|
+
var key, i;
|
|
132
|
+
|
|
133
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
134
|
+
key = sourceKeys[i];
|
|
135
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
136
|
+
target[key] = source[key];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return target;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function _objectWithoutProperties(source, excluded) {
|
|
143
|
+
if (source == null) return {};
|
|
144
|
+
|
|
145
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
146
|
+
|
|
147
|
+
var key, i;
|
|
148
|
+
|
|
149
|
+
if (Object.getOwnPropertySymbols) {
|
|
150
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
151
|
+
|
|
152
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
153
|
+
key = sourceSymbolKeys[i];
|
|
154
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
155
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
156
|
+
target[key] = source[key];
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return target;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function _assertThisInitialized(self) {
|
|
164
|
+
if (self === void 0) {
|
|
165
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return self;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function _possibleConstructorReturn(self, call) {
|
|
172
|
+
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
173
|
+
return call;
|
|
174
|
+
} else if (call !== void 0) {
|
|
175
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return _assertThisInitialized(self);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function _createSuper(Derived) {
|
|
182
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
183
|
+
|
|
184
|
+
return function _createSuperInternal() {
|
|
185
|
+
var Super = _getPrototypeOf(Derived),
|
|
186
|
+
result;
|
|
187
|
+
|
|
188
|
+
if (hasNativeReflectConstruct) {
|
|
189
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
190
|
+
|
|
191
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
192
|
+
} else {
|
|
193
|
+
result = Super.apply(this, arguments);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return _possibleConstructorReturn(this, result);
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function _slicedToArray(arr, i) {
|
|
201
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function _toArray(arr) {
|
|
205
|
+
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function _toConsumableArray(arr) {
|
|
209
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function _arrayWithoutHoles(arr) {
|
|
213
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function _arrayWithHoles(arr) {
|
|
217
|
+
if (Array.isArray(arr)) return arr;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function _iterableToArray(iter) {
|
|
221
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function _iterableToArrayLimit(arr, i) {
|
|
225
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
226
|
+
|
|
227
|
+
if (_i == null) return;
|
|
228
|
+
var _arr = [];
|
|
229
|
+
var _n = true;
|
|
230
|
+
var _d = false;
|
|
231
|
+
|
|
232
|
+
var _s, _e;
|
|
233
|
+
|
|
234
|
+
try {
|
|
235
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
236
|
+
_arr.push(_s.value);
|
|
237
|
+
|
|
238
|
+
if (i && _arr.length === i) break;
|
|
239
|
+
}
|
|
240
|
+
} catch (err) {
|
|
241
|
+
_d = true;
|
|
242
|
+
_e = err;
|
|
243
|
+
} finally {
|
|
244
|
+
try {
|
|
245
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
246
|
+
} finally {
|
|
247
|
+
if (_d) throw _e;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return _arr;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
255
|
+
if (!o) return;
|
|
256
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
257
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
258
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
259
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
260
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function _arrayLikeToArray(arr, len) {
|
|
264
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
265
|
+
|
|
266
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
267
|
+
|
|
268
|
+
return arr2;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function _nonIterableSpread() {
|
|
272
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function _nonIterableRest() {
|
|
276
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function _classPrivateFieldGet(receiver, privateMap) {
|
|
280
|
+
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
|
|
281
|
+
|
|
282
|
+
return _classApplyDescriptorGet(receiver, descriptor);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function _classPrivateFieldSet(receiver, privateMap, value) {
|
|
286
|
+
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
|
|
287
|
+
|
|
288
|
+
_classApplyDescriptorSet(receiver, descriptor, value);
|
|
289
|
+
|
|
290
|
+
return value;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) {
|
|
294
|
+
if (!privateMap.has(receiver)) {
|
|
295
|
+
throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
return privateMap.get(receiver);
|
|
299
|
+
}
|
|
30
300
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
301
|
+
function _classApplyDescriptorGet(receiver, descriptor) {
|
|
302
|
+
if (descriptor.get) {
|
|
303
|
+
return descriptor.get.call(receiver);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return descriptor.value;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) {
|
|
310
|
+
if (descriptor.set) {
|
|
311
|
+
descriptor.set.call(receiver, value);
|
|
312
|
+
} else {
|
|
313
|
+
if (!descriptor.writable) {
|
|
314
|
+
throw new TypeError("attempted to set read only private field");
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
descriptor.value = value;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function _checkPrivateRedeclaration(obj, privateCollection) {
|
|
322
|
+
if (privateCollection.has(obj)) {
|
|
323
|
+
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
328
|
+
_checkPrivateRedeclaration(obj, privateMap);
|
|
329
|
+
|
|
330
|
+
privateMap.set(obj, value);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
var compatTheme = {
|
|
334
|
+
breakpoints: {
|
|
335
|
+
xs: 480,
|
|
336
|
+
sm: 768,
|
|
337
|
+
md: 1024,
|
|
338
|
+
lg: 1200,
|
|
339
|
+
xl: 1440
|
|
340
|
+
},
|
|
341
|
+
spacing: [0, 4, 8, 12, 16, 24, 32, 40, 48, 64, 96],
|
|
342
|
+
fontSize: [64, 44, 34, 26, 22, 20, 18, 16, 14],
|
|
343
|
+
lineHeight: [1, 1.625, 2],
|
|
344
|
+
fontWeight: [400, 600, 700],
|
|
345
|
+
fontFamily: {
|
|
346
|
+
body: '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",sans-serif',
|
|
347
|
+
heading: '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",sans-serif',
|
|
348
|
+
monospace: 'Menlo,monospace'
|
|
349
|
+
},
|
|
350
|
+
radii: [2, 4, 6, 8],
|
|
351
|
+
borders: [1, 2, 3],
|
|
352
|
+
colors: {},
|
|
353
|
+
modes: {},
|
|
354
|
+
mode: undefined
|
|
68
355
|
};
|
|
69
356
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
357
|
+
var SHORTHAND_PROPERTIES = ['border', 'borderTop', 'borderBottom', 'borderLeft', 'borderRight', 'borderWidth', 'borderStyle', 'borderColor', 'background', 'flex', 'margin', 'padding', 'transition', 'gap', 'grid', 'gridArea', 'gridColumn', 'gridRow', 'gridTemplate', 'overflow', 'transition'];
|
|
358
|
+
var SORT = {
|
|
359
|
+
A_BEFORE_B: -1,
|
|
360
|
+
B_BEFORE_A: 1,
|
|
361
|
+
EQUAL: 1
|
|
73
362
|
};
|
|
74
363
|
|
|
75
|
-
|
|
76
|
-
|
|
364
|
+
var compare = function compare(a, b) {
|
|
365
|
+
if (a < b) return SORT.A_BEFORE_B;
|
|
366
|
+
if (b < a) return SORT.B_BEFORE_A;
|
|
367
|
+
return SORT.EQUAL;
|
|
77
368
|
};
|
|
369
|
+
/**
|
|
370
|
+
* Orders all properties by the most dependent props
|
|
371
|
+
* @param config
|
|
372
|
+
*/
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
var orderPropNames = function orderPropNames(config) {
|
|
376
|
+
return Object.keys(config).sort(function (a, b) {
|
|
377
|
+
var aConf = config[a],
|
|
378
|
+
bConf = config[b];
|
|
379
|
+
var aProp = aConf.property,
|
|
380
|
+
_aConf$properties = aConf.properties,
|
|
381
|
+
aProperties = _aConf$properties === void 0 ? [] : _aConf$properties;
|
|
382
|
+
var bProp = bConf.property,
|
|
383
|
+
_bConf$properties = bConf.properties,
|
|
384
|
+
bProperties = _bConf$properties === void 0 ? [] : _bConf$properties;
|
|
385
|
+
var aIsShorthand = SHORTHAND_PROPERTIES.includes(aProp);
|
|
386
|
+
var bIsShorthand = SHORTHAND_PROPERTIES.includes(bProp);
|
|
387
|
+
|
|
388
|
+
if (aIsShorthand && bIsShorthand) {
|
|
389
|
+
var aNum = aProperties.length;
|
|
390
|
+
var bNum = bProperties.length;
|
|
391
|
+
|
|
392
|
+
if (aProp !== bProp) {
|
|
393
|
+
return compare(SHORTHAND_PROPERTIES.indexOf(aProp), SHORTHAND_PROPERTIES.indexOf(bProp));
|
|
394
|
+
}
|
|
78
395
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
heading: 1,
|
|
92
|
-
},
|
|
93
|
-
fontWeight: [400, 600, 700],
|
|
94
|
-
fontFamily: {
|
|
95
|
-
body: 'Verdana, sans-serif',
|
|
96
|
-
heading: 'Verdana, Lato, sans-serif',
|
|
97
|
-
monospace: 'monospace',
|
|
98
|
-
},
|
|
99
|
-
radii: [2, 4, 6, 8],
|
|
100
|
-
borders: [1, 2, 3],
|
|
101
|
-
colors: {},
|
|
102
|
-
modes: {},
|
|
103
|
-
mode: undefined,
|
|
396
|
+
if (aProp === bProp) {
|
|
397
|
+
if (aNum === 0) return SORT.A_BEFORE_B;
|
|
398
|
+
if (bNum === 0) return SORT.B_BEFORE_A;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return compare(bNum, aNum);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
if (aIsShorthand) return SORT.A_BEFORE_B;
|
|
405
|
+
if (bIsShorthand) return SORT.B_BEFORE_A;
|
|
406
|
+
return SORT.EQUAL;
|
|
407
|
+
});
|
|
104
408
|
};
|
|
105
409
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
410
|
+
var lookupScaleValue = function lookupScaleValue(val, scale, theme) {
|
|
411
|
+
if (isArray(scale)) {
|
|
412
|
+
return val;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if (isObject(scale)) {
|
|
416
|
+
return get(scale, val);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
if (isString(scale)) {
|
|
420
|
+
var usedScale = get(theme, scale, get(compatTheme, scale));
|
|
421
|
+
if (!usedScale) return undefined;
|
|
422
|
+
return isArray(usedScale) ? val : get(usedScale, val);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
return undefined;
|
|
120
426
|
};
|
|
121
427
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
428
|
+
var createPropertyStyle = function createPropertyStyle(value, props, config) {
|
|
429
|
+
var _scaleValue;
|
|
430
|
+
|
|
431
|
+
var styles = {};
|
|
432
|
+
var _config$transform = config.transform,
|
|
433
|
+
transform = _config$transform === void 0 ? identity : _config$transform,
|
|
434
|
+
property = config.property,
|
|
435
|
+
_config$properties = config.properties,
|
|
436
|
+
properties = _config$properties === void 0 ? [property] : _config$properties,
|
|
437
|
+
scale = config.scale,
|
|
438
|
+
variable = config.variable;
|
|
439
|
+
var alwaysTransform = scale === undefined || isArray(scale);
|
|
440
|
+
|
|
441
|
+
if (isUndefined(value)) {
|
|
442
|
+
return styles;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
var useTransform = false;
|
|
446
|
+
var intermediateValue;
|
|
447
|
+
var scaleValue;
|
|
448
|
+
|
|
449
|
+
switch (_typeof(value)) {
|
|
450
|
+
case 'number':
|
|
451
|
+
case 'string':
|
|
452
|
+
scaleValue = lookupScaleValue(value, scale, props === null || props === void 0 ? void 0 : props.theme);
|
|
453
|
+
useTransform = scaleValue !== undefined || alwaysTransform;
|
|
454
|
+
intermediateValue = (_scaleValue = scaleValue) !== null && _scaleValue !== void 0 ? _scaleValue : value;
|
|
455
|
+
break;
|
|
456
|
+
|
|
457
|
+
case 'function':
|
|
458
|
+
if (props.theme) {
|
|
459
|
+
intermediateValue = value(props.theme);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
break;
|
|
463
|
+
|
|
464
|
+
default:
|
|
465
|
+
return styles;
|
|
466
|
+
} // for each property look up the scale value from theme if passed and apply any
|
|
467
|
+
// final transforms to the value
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
properties.forEach(function (property) {
|
|
471
|
+
var styleValue = intermediateValue;
|
|
472
|
+
|
|
473
|
+
if (useTransform && !isUndefined(styleValue)) {
|
|
474
|
+
styleValue = transform(styleValue, property, props);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
switch (_typeof(styleValue)) {
|
|
478
|
+
case 'number':
|
|
479
|
+
case 'string':
|
|
480
|
+
return styles[property] = styleValue;
|
|
481
|
+
|
|
482
|
+
case 'object':
|
|
483
|
+
return Object.assign(styles, styleValue);
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
if (variable) {
|
|
488
|
+
var styleValue = intermediateValue;
|
|
489
|
+
|
|
490
|
+
if (useTransform && !isUndefined(styleValue)) {
|
|
491
|
+
styleValue = transform(styleValue, property, props);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
if (styleValue && _typeof(styleValue) !== 'object') {
|
|
495
|
+
styles[variable] = styleValue;
|
|
496
|
+
}
|
|
497
|
+
} // return the resulting styles object
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
return styles;
|
|
173
501
|
};
|
|
174
502
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
'borderTop',
|
|
178
|
-
'borderBottom',
|
|
179
|
-
'borderLeft',
|
|
180
|
-
'borderRight',
|
|
181
|
-
'borderWidth',
|
|
182
|
-
'borderStyle',
|
|
183
|
-
'borderColor',
|
|
184
|
-
'background',
|
|
185
|
-
'flex',
|
|
186
|
-
'margin',
|
|
187
|
-
'padding',
|
|
188
|
-
'transition',
|
|
189
|
-
'gap',
|
|
190
|
-
'grid',
|
|
191
|
-
'gridArea',
|
|
192
|
-
'gridColumn',
|
|
193
|
-
'gridRow',
|
|
194
|
-
'gridTemplate',
|
|
195
|
-
'overflow',
|
|
196
|
-
'transition',
|
|
197
|
-
];
|
|
198
|
-
const SORT = {
|
|
199
|
-
A_BEFORE_B: -1,
|
|
200
|
-
B_BEFORE_A: 1,
|
|
201
|
-
EQUAL: 1,
|
|
202
|
-
};
|
|
203
|
-
const compare = (a, b) => {
|
|
204
|
-
if (a < b)
|
|
205
|
-
return SORT.A_BEFORE_B;
|
|
206
|
-
if (b < a)
|
|
207
|
-
return SORT.B_BEFORE_A;
|
|
208
|
-
return SORT.EQUAL;
|
|
209
|
-
};
|
|
210
|
-
/**
|
|
211
|
-
* Orders all properties by the most dependent props
|
|
212
|
-
* @param config
|
|
213
|
-
*/
|
|
214
|
-
const orderPropNames = (config) => Object.keys(config).sort((a, b) => {
|
|
215
|
-
const { [a]: aConf, [b]: bConf } = config;
|
|
216
|
-
const { property: aProp, properties: aProperties = [] } = aConf;
|
|
217
|
-
const { property: bProp, properties: bProperties = [] } = bConf;
|
|
218
|
-
const aIsShorthand = SHORTHAND_PROPERTIES.includes(aProp);
|
|
219
|
-
const bIsShorthand = SHORTHAND_PROPERTIES.includes(bProp);
|
|
220
|
-
if (aIsShorthand && bIsShorthand) {
|
|
221
|
-
const aNum = aProperties.length;
|
|
222
|
-
const bNum = bProperties.length;
|
|
223
|
-
if (aProp !== bProp) {
|
|
224
|
-
return compare(SHORTHAND_PROPERTIES.indexOf(aProp), SHORTHAND_PROPERTIES.indexOf(bProp));
|
|
225
|
-
}
|
|
226
|
-
if (aProp === bProp) {
|
|
227
|
-
if (aNum === 0)
|
|
228
|
-
return SORT.A_BEFORE_B;
|
|
229
|
-
if (bNum === 0)
|
|
230
|
-
return SORT.B_BEFORE_A;
|
|
231
|
-
}
|
|
232
|
-
return compare(bNum, aNum);
|
|
233
|
-
}
|
|
234
|
-
if (aIsShorthand)
|
|
235
|
-
return SORT.A_BEFORE_B;
|
|
236
|
-
if (bIsShorthand)
|
|
237
|
-
return SORT.B_BEFORE_A;
|
|
238
|
-
return SORT.EQUAL;
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
const BREAKPOINT_KEYS$1 = ['_', 'xs', 'sm', 'md', 'lg', 'xl'];
|
|
503
|
+
var _excluded$1 = ["_"];
|
|
504
|
+
var BREAKPOINT_KEYS$1 = ['_', 'xs', 'sm', 'md', 'lg', 'xl'];
|
|
242
505
|
/**
|
|
243
506
|
* Destructures the themes breakpoints into an ordered structure to traverse
|
|
244
|
-
*/
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return null;
|
|
249
|
-
const { xs, sm, md, lg, xl } = breakpoints ?? {};
|
|
250
|
-
// Ensure order for mapping
|
|
251
|
-
return {
|
|
252
|
-
map: mapValues(breakpoints, templateMediaQuery$1),
|
|
253
|
-
array: [xs, sm, md, lg, xl].map(templateMediaQuery$1),
|
|
254
|
-
};
|
|
255
|
-
};
|
|
256
|
-
const isMediaArray$1 = (val) => Array.isArray(val);
|
|
257
|
-
const isMediaMap$1 = (val) => intersection(Object.keys(val), BREAKPOINT_KEYS$1).length > 0;
|
|
258
|
-
const objectParser$1 = (value, props, config, breakpoints) => {
|
|
259
|
-
const styles = {};
|
|
260
|
-
const { _, ...rest } = value;
|
|
261
|
-
// the keyof 'base' is base styles
|
|
262
|
-
if (_)
|
|
263
|
-
Object.assign(styles, createPropertyStyle(_, props, config));
|
|
264
|
-
// Map over remaining keys and merge the corresponding breakpoint styles
|
|
265
|
-
// for that property.
|
|
266
|
-
Object.keys(breakpoints).forEach((breakpointKey) => {
|
|
267
|
-
const bpStyles = rest[breakpointKey];
|
|
268
|
-
if (typeof bpStyles === 'undefined')
|
|
269
|
-
return;
|
|
270
|
-
Object.assign(styles, {
|
|
271
|
-
[breakpoints[breakpointKey]]: createPropertyStyle(bpStyles, props, config),
|
|
272
|
-
});
|
|
273
|
-
});
|
|
274
|
-
return styles;
|
|
275
|
-
};
|
|
276
|
-
const arrayParser$1 = (value, props, config, breakpoints) => {
|
|
277
|
-
const styles = {};
|
|
278
|
-
const [_, ...rest] = value;
|
|
279
|
-
// the first index is base styles
|
|
280
|
-
if (_)
|
|
281
|
-
Object.assign(styles, createPropertyStyle(_, props, config));
|
|
282
|
-
// Map over each value in the array and merge the corresponding breakpoint styles
|
|
283
|
-
// for that property.
|
|
284
|
-
rest.forEach((val, i) => {
|
|
285
|
-
const breakpointKey = breakpoints[i];
|
|
286
|
-
if (!breakpointKey || typeof val === 'undefined')
|
|
287
|
-
return;
|
|
288
|
-
Object.assign(styles, {
|
|
289
|
-
[breakpointKey]: createPropertyStyle(val, props, config),
|
|
290
|
-
});
|
|
291
|
-
});
|
|
292
|
-
return styles;
|
|
293
|
-
};
|
|
294
|
-
const orderBreakpoints$1 = (styles, breakpoints) => {
|
|
295
|
-
const orderedStyles = omit(styles, breakpoints);
|
|
296
|
-
breakpoints.forEach((bp) => {
|
|
297
|
-
if (styles[bp]) {
|
|
298
|
-
orderedStyles[bp] = styles[bp];
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
return orderedStyles;
|
|
507
|
+
*/
|
|
508
|
+
|
|
509
|
+
var templateMediaQuery$1 = function templateMediaQuery(breakpoint) {
|
|
510
|
+
return "@media screen and (min-width: ".concat(breakpoint, "px)");
|
|
302
511
|
};
|
|
303
512
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
if (!ctx.mediaQueries) {
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
// If it is an array the order of values is smallest to largest: [_, xs, ...]
|
|
317
|
-
if (isMediaArray$1(value)) {
|
|
318
|
-
return merge(styles, arrayParser$1(value, props, property, ctx.mediaQueries.array));
|
|
319
|
-
}
|
|
320
|
-
// Check to see if value is an object matching the responsive syntax and generate the styles.
|
|
321
|
-
if (value && isMediaMap$1(value)) {
|
|
322
|
-
return merge(styles, objectParser$1(value, props, property, ctx.mediaQueries.map));
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
function createParser$1(config) {
|
|
327
|
-
const propNames = orderPropNames(config);
|
|
328
|
-
const ctx = {
|
|
329
|
-
mediaQueries: null,
|
|
330
|
-
};
|
|
331
|
-
const parser = (props, isCss = false) => {
|
|
332
|
-
const styles = {};
|
|
333
|
-
const { theme } = props;
|
|
334
|
-
// Attempt to cache the breakpoints if we have not yet or if theme has become available.
|
|
335
|
-
if (ctx.mediaQueries === null) {
|
|
336
|
-
// Save the breakpoints if we can
|
|
337
|
-
ctx.mediaQueries = createMediaQueries$1(theme?.breakpoints ?? compatTheme.breakpoints);
|
|
338
|
-
}
|
|
339
|
-
if (!isCss) {
|
|
340
|
-
// Loops over all prop names on the configured config to check for configured styles
|
|
341
|
-
propNames.forEach((prop) => {
|
|
342
|
-
const property = config[prop];
|
|
343
|
-
renderPropValue$1(styles, prop, props, property, ctx);
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
else {
|
|
347
|
-
// Loops over all prop names on the configured config to check for configured styles
|
|
348
|
-
Object.keys(props).forEach((prop) => {
|
|
349
|
-
const property = config[prop];
|
|
350
|
-
if (property) {
|
|
351
|
-
renderPropValue$1(styles, prop, props, property, ctx);
|
|
352
|
-
}
|
|
353
|
-
else if (prop !== 'theme') {
|
|
354
|
-
Object.assign(styles, { [prop]: get(props, prop) });
|
|
355
|
-
}
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
if (ctx.mediaQueries !== null)
|
|
359
|
-
return orderBreakpoints$1(styles, ctx.mediaQueries.array);
|
|
360
|
-
return styles;
|
|
361
|
-
};
|
|
362
|
-
// return the parser function with the resulting meta information for further composition
|
|
363
|
-
return Object.assign(parser, { propNames, config });
|
|
364
|
-
}
|
|
513
|
+
var createMediaQueries$1 = function createMediaQueries(breakpoints) {
|
|
514
|
+
if (breakpoints === undefined) return null;
|
|
515
|
+
|
|
516
|
+
var _ref = breakpoints !== null && breakpoints !== void 0 ? breakpoints : {},
|
|
517
|
+
xs = _ref.xs,
|
|
518
|
+
sm = _ref.sm,
|
|
519
|
+
md = _ref.md,
|
|
520
|
+
lg = _ref.lg,
|
|
521
|
+
xl = _ref.xl; // Ensure order for mapping
|
|
365
522
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
Object.entries(variants).forEach(([key, { variants: variantConfig }]) => {
|
|
378
|
-
Object.entries(variantConfig).forEach(([option, optionStyles]) => {
|
|
379
|
-
const optionId = `${key}-${option}`;
|
|
380
|
-
Object.entries(optionStyles).forEach(([key, styles]) => {
|
|
381
|
-
if (!filters.includes(key) && isObject(styles)) {
|
|
382
|
-
set(rules, [key, optionId], styles);
|
|
383
|
-
}
|
|
384
|
-
else {
|
|
385
|
-
set(rules, ['primary', optionId, key], styles);
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
});
|
|
389
|
-
});
|
|
390
|
-
Object.entries(states).forEach(([optionId, optionStyles]) => {
|
|
391
|
-
Object.entries(optionStyles).forEach(([key, styles]) => {
|
|
392
|
-
if (!filters.includes(key) && isObject(styles)) {
|
|
393
|
-
set(rules, [key, optionId], styles);
|
|
394
|
-
}
|
|
395
|
-
else {
|
|
396
|
-
set(rules, ['primary', optionId, key], styles);
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
});
|
|
400
|
-
return rules;
|
|
401
|
-
};
|
|
402
|
-
const createGetActiveStyleIds = (variants, states) => {
|
|
403
|
-
const vIds = Object.keys(variants);
|
|
404
|
-
const sIds = Object.keys(states);
|
|
405
|
-
return (props) => {
|
|
406
|
-
const activeIds = [];
|
|
407
|
-
vIds.forEach((id) => {
|
|
408
|
-
if (props[id]) {
|
|
409
|
-
activeIds.push(`${id}-${props[id]}`);
|
|
410
|
-
}
|
|
411
|
-
});
|
|
412
|
-
sIds.forEach((id) => {
|
|
413
|
-
if (props[id]) {
|
|
414
|
-
activeIds.push(id);
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
return activeIds;
|
|
418
|
-
};
|
|
419
|
-
};
|
|
420
|
-
const extractBreakpointStyles = (styles, medias) => {
|
|
421
|
-
const unscoped = {};
|
|
422
|
-
const breakpoint = {};
|
|
423
|
-
Object.entries(styles).forEach(([rule, value]) => {
|
|
424
|
-
const target = medias.includes(rule) ? breakpoint : unscoped;
|
|
425
|
-
target[rule] = value;
|
|
426
|
-
});
|
|
427
|
-
return [unscoped, breakpoint];
|
|
428
|
-
};
|
|
429
|
-
const applyOverride = (override = {}, baseResult, breakpointResult, parser, theme, media) => {
|
|
430
|
-
const [overrideStyles, overrideBreakpointStyles] = extractBreakpointStyles(parser({ ...override, theme }, true), media);
|
|
431
|
-
for (const rule in overrideStyles) {
|
|
432
|
-
baseResult[rule] = overrideStyles[rule];
|
|
433
|
-
}
|
|
434
|
-
media.forEach((mq) => {
|
|
435
|
-
const mqOverride = overrideBreakpointStyles[mq];
|
|
436
|
-
if (!mqOverride || isEmpty(mqOverride))
|
|
437
|
-
return;
|
|
438
|
-
if (!breakpointResult[mq]) {
|
|
439
|
-
breakpointResult[mq] = {};
|
|
440
|
-
}
|
|
441
|
-
const mqStyle = breakpointResult[mq];
|
|
442
|
-
for (const rule in mqOverride) {
|
|
443
|
-
mqStyle[rule] = mqOverride[rule];
|
|
444
|
-
}
|
|
445
|
-
});
|
|
446
|
-
};
|
|
447
|
-
const applyStyle = (resultStyles, config, props, ctx) => {
|
|
448
|
-
const { base } = config;
|
|
449
|
-
const { parser, getMediaSelectors, getActiveOverrides } = ctx;
|
|
450
|
-
const { theme } = props;
|
|
451
|
-
const overrides = Object.values(pick(config, getActiveOverrides(props)));
|
|
452
|
-
const media = getMediaSelectors(props);
|
|
453
|
-
const [styles, breakpointStyles] = extractBreakpointStyles(parser({ ...base, theme }, true), media);
|
|
454
|
-
for (const rule in styles) {
|
|
455
|
-
resultStyles[rule] = styles[rule];
|
|
456
|
-
}
|
|
457
|
-
overrides.forEach((override) => {
|
|
458
|
-
applyOverride(override, resultStyles, breakpointStyles, parser, theme, media);
|
|
459
|
-
});
|
|
460
|
-
media.forEach((media) => {
|
|
461
|
-
const bp = breakpointStyles[media];
|
|
462
|
-
if (!isEmpty(bp)) {
|
|
463
|
-
resultStyles[media] = bp;
|
|
464
|
-
}
|
|
465
|
-
});
|
|
466
|
-
};
|
|
467
|
-
const createStylist = (parser, base = {}, variants = {}, states = {}) => {
|
|
468
|
-
const selectorGroups = getSelectors(base, variants, states, parser.propNames);
|
|
469
|
-
const context = {
|
|
470
|
-
parser,
|
|
471
|
-
getMediaSelectors: ({ theme }) => {
|
|
472
|
-
const breakpoints = theme?.breakpoints ?? compatTheme.breakpoints;
|
|
473
|
-
return ['xs', 'sm', 'md', 'lg', 'xl'].map((key) => breakpoints[key]);
|
|
474
|
-
},
|
|
475
|
-
getActiveOverrides: createGetActiveStyleIds(variants, states),
|
|
476
|
-
};
|
|
477
|
-
return (props) => {
|
|
478
|
-
const { vars } = props;
|
|
479
|
-
const result = { ...vars };
|
|
480
|
-
Object.entries(selectorGroups).forEach(([selectorId, config = {}]) => {
|
|
481
|
-
if (selectorId === 'primary') {
|
|
482
|
-
applyStyle(result, config, props, context);
|
|
483
|
-
}
|
|
484
|
-
else {
|
|
485
|
-
result[selectorId] = {};
|
|
486
|
-
applyStyle(result[selectorId], config, props, context);
|
|
487
|
-
}
|
|
488
|
-
});
|
|
489
|
-
applyStyle(result, { base: parser(props) }, props, context);
|
|
490
|
-
return result;
|
|
491
|
-
};
|
|
523
|
+
|
|
524
|
+
return {
|
|
525
|
+
map: mapValues(breakpoints, templateMediaQuery$1),
|
|
526
|
+
array: [xs, sm, md, lg, xl].map(templateMediaQuery$1)
|
|
527
|
+
};
|
|
528
|
+
};
|
|
529
|
+
var isMediaArray$1 = function isMediaArray(val) {
|
|
530
|
+
return Array.isArray(val);
|
|
531
|
+
};
|
|
532
|
+
var isMediaMap$1 = function isMediaMap(val) {
|
|
533
|
+
return intersection(Object.keys(val), BREAKPOINT_KEYS$1).length > 0;
|
|
492
534
|
};
|
|
535
|
+
var objectParser$1 = function objectParser(value, props, config, breakpoints) {
|
|
536
|
+
var styles = {};
|
|
493
537
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
styles(config) {
|
|
564
|
-
return new AnimusWithBase(this.propRegistry, this.groupRegistry, this.parser, config);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
538
|
+
var _ = value._,
|
|
539
|
+
rest = _objectWithoutProperties(value, _excluded$1); // the keyof 'base' is base styles
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
if (_) Object.assign(styles, createPropertyStyle(_, props, config)); // Map over remaining keys and merge the corresponding breakpoint styles
|
|
543
|
+
// for that property.
|
|
544
|
+
|
|
545
|
+
Object.keys(breakpoints).forEach(function (breakpointKey) {
|
|
546
|
+
var bpStyles = rest[breakpointKey];
|
|
547
|
+
if (typeof bpStyles === 'undefined') return;
|
|
548
|
+
Object.assign(styles, _defineProperty({}, breakpoints[breakpointKey], createPropertyStyle(bpStyles, props, config)));
|
|
549
|
+
});
|
|
550
|
+
return styles;
|
|
551
|
+
};
|
|
552
|
+
var arrayParser$1 = function arrayParser(value, props, config, breakpoints) {
|
|
553
|
+
var styles = {};
|
|
554
|
+
|
|
555
|
+
var _value = _toArray(value),
|
|
556
|
+
_ = _value[0],
|
|
557
|
+
rest = _value.slice(1); // the first index is base styles
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
if (_) Object.assign(styles, createPropertyStyle(_, props, config)); // Map over each value in the array and merge the corresponding breakpoint styles
|
|
561
|
+
// for that property.
|
|
562
|
+
|
|
563
|
+
rest.forEach(function (val, i) {
|
|
564
|
+
var breakpointKey = breakpoints[i];
|
|
565
|
+
if (!breakpointKey || typeof val === 'undefined') return;
|
|
566
|
+
Object.assign(styles, _defineProperty({}, breakpointKey, createPropertyStyle(val, props, config)));
|
|
567
|
+
});
|
|
568
|
+
return styles;
|
|
569
|
+
};
|
|
570
|
+
var orderBreakpoints$1 = function orderBreakpoints(styles, breakpoints) {
|
|
571
|
+
var orderedStyles = omit(styles, breakpoints);
|
|
572
|
+
breakpoints.forEach(function (bp) {
|
|
573
|
+
if (styles[bp]) {
|
|
574
|
+
orderedStyles[bp] = styles[bp];
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
return orderedStyles;
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
var renderPropValue$1 = function renderPropValue(styles, prop, props, property, ctx) {
|
|
581
|
+
var value = get(props, prop);
|
|
582
|
+
|
|
583
|
+
switch (_typeof(value)) {
|
|
584
|
+
case 'string':
|
|
585
|
+
case 'number':
|
|
586
|
+
case 'function':
|
|
587
|
+
return Object.assign(styles, createPropertyStyle(value, props, property));
|
|
588
|
+
// handle any props configured with the responsive notation
|
|
589
|
+
|
|
590
|
+
case 'object':
|
|
591
|
+
if (!ctx.mediaQueries) {
|
|
592
|
+
return;
|
|
593
|
+
} // If it is an array the order of values is smallest to largest: [_, xs, ...]
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
if (isMediaArray$1(value)) {
|
|
597
|
+
return merge(styles, arrayParser$1(value, props, property, ctx.mediaQueries.array));
|
|
598
|
+
} // Check to see if value is an object matching the responsive syntax and generate the styles.
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
if (value && isMediaMap$1(value)) {
|
|
602
|
+
return merge(styles, objectParser$1(value, props, property, ctx.mediaQueries.map));
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
}
|
|
606
|
+
};
|
|
567
607
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
608
|
+
function createParser$1(config) {
|
|
609
|
+
var omitProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
610
|
+
var propNames = orderPropNames(config).filter(function (name) {
|
|
611
|
+
return !(omitProps !== null && omitProps !== void 0 && omitProps.includes(name));
|
|
612
|
+
});
|
|
613
|
+
var ctx = {
|
|
614
|
+
mediaQueries: null
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
var parser = function parser(props) {
|
|
618
|
+
var isCss = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
619
|
+
var styles = {};
|
|
620
|
+
var theme = props.theme; // Attempt to cache the breakpoints if we have not yet or if theme has become available.
|
|
621
|
+
|
|
622
|
+
if (ctx.mediaQueries === null) {
|
|
623
|
+
var _theme$breakpoints;
|
|
624
|
+
|
|
625
|
+
// Save the breakpoints if we can
|
|
626
|
+
ctx.mediaQueries = createMediaQueries$1((_theme$breakpoints = theme === null || theme === void 0 ? void 0 : theme.breakpoints) !== null && _theme$breakpoints !== void 0 ? _theme$breakpoints : compatTheme.breakpoints);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
if (!isCss) {
|
|
630
|
+
// Loops over all prop names on the configured config to check for configured styles
|
|
631
|
+
propNames.forEach(function (prop) {
|
|
632
|
+
var property = config[prop];
|
|
633
|
+
renderPropValue$1(styles, prop, props, property, ctx);
|
|
634
|
+
});
|
|
635
|
+
} else {
|
|
636
|
+
// Loops over all prop names on the configured config to check for configured styles
|
|
637
|
+
Object.keys(props).forEach(function (prop) {
|
|
638
|
+
var property = config[prop];
|
|
639
|
+
|
|
640
|
+
if (property) {
|
|
641
|
+
renderPropValue$1(styles, prop, props, property, ctx);
|
|
642
|
+
} else if (prop !== 'theme') {
|
|
643
|
+
Object.assign(styles, _defineProperty({}, prop, get(props, prop)));
|
|
644
|
+
}
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
if (ctx.mediaQueries !== null) return orderBreakpoints$1(styles, ctx.mediaQueries.array);
|
|
649
|
+
return styles;
|
|
650
|
+
}; // return the parser function with the resulting meta information for further composition
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
return Object.assign(parser, {
|
|
654
|
+
propNames: propNames,
|
|
655
|
+
config: config
|
|
656
|
+
});
|
|
586
657
|
}
|
|
587
658
|
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
},
|
|
697
|
-
borderRadiusTopRight: {
|
|
698
|
-
property: 'borderTopRightRadius',
|
|
699
|
-
scale: 'radii',
|
|
700
|
-
transform: numberToPx,
|
|
701
|
-
},
|
|
702
|
-
borderRadiusBottomRight: {
|
|
703
|
-
property: 'borderBottomRightRadius',
|
|
704
|
-
scale: 'radii',
|
|
705
|
-
transform: numberToPx,
|
|
706
|
-
},
|
|
707
|
-
borderRadiusBottomLeft: {
|
|
708
|
-
property: 'borderBottomLeftRadius',
|
|
709
|
-
scale: 'radii',
|
|
710
|
-
transform: numberToPx,
|
|
711
|
-
},
|
|
712
|
-
// Style
|
|
713
|
-
borderStyle: { property: 'borderStyle' },
|
|
714
|
-
borderStyleX: {
|
|
715
|
-
property: 'borderStyle',
|
|
716
|
-
properties: ['borderLeftStyle', 'borderRightStyle'],
|
|
717
|
-
},
|
|
718
|
-
borderStyleY: {
|
|
719
|
-
property: 'borderStyle',
|
|
720
|
-
properties: ['borderTopStyle', 'borderBottomStyle'],
|
|
721
|
-
},
|
|
722
|
-
borderStyleLeft: { property: 'borderLeftStyle' },
|
|
723
|
-
borderStyleRight: { property: 'borderRightStyle' },
|
|
724
|
-
borderStyleTop: { property: 'borderTopStyle' },
|
|
725
|
-
borderStyleBottom: { property: 'borderBottomStyle' },
|
|
726
|
-
};
|
|
727
|
-
const gaps = {
|
|
728
|
-
gap: { property: 'gap', scale: 'spacing' },
|
|
729
|
-
rowGap: { property: 'rowGap', scale: 'spacing' },
|
|
730
|
-
columnGap: { property: 'columnGap', scale: 'spacing' },
|
|
731
|
-
};
|
|
732
|
-
const selfAlignments = {
|
|
733
|
-
justifySelf: { property: 'justifySelf' },
|
|
734
|
-
alignSelf: { property: 'alignSelf' },
|
|
735
|
-
gridArea: { property: 'gridArea' },
|
|
736
|
-
area: { property: 'gridArea' },
|
|
737
|
-
};
|
|
738
|
-
const alignments = {
|
|
739
|
-
justifyContent: { property: 'justifyContent' },
|
|
740
|
-
justifyItems: { property: 'justifyItems' },
|
|
741
|
-
alignItems: { property: 'alignItems' },
|
|
742
|
-
alignContent: { property: 'alignContent' },
|
|
743
|
-
...selfAlignments,
|
|
744
|
-
};
|
|
745
|
-
const flexItems = {
|
|
746
|
-
flexBasis: { property: 'flexBasis' },
|
|
747
|
-
flexShrink: { property: 'flexShrink' },
|
|
748
|
-
flexGrow: { property: 'flexGrow' },
|
|
749
|
-
order: { property: 'order' },
|
|
750
|
-
};
|
|
751
|
-
const flex = {
|
|
752
|
-
flexDirection: { property: 'flexDirection' },
|
|
753
|
-
flexWrap: { property: 'flexWrap' },
|
|
754
|
-
flex: { property: 'flex' },
|
|
755
|
-
...alignments,
|
|
756
|
-
...flexItems,
|
|
757
|
-
...gaps,
|
|
758
|
-
};
|
|
759
|
-
const gridItems = {
|
|
760
|
-
gridColumn: { property: 'gridColumn' },
|
|
761
|
-
gridRow: { property: 'gridRow' },
|
|
762
|
-
gridColumnStart: { property: 'gridColumnStart' },
|
|
763
|
-
gridRowStart: { property: 'gridRowStart' },
|
|
764
|
-
gridColumnEnd: { property: 'gridColumnEnd' },
|
|
765
|
-
gridRowEnd: { property: 'gridRowEnd' },
|
|
766
|
-
};
|
|
767
|
-
const grid = {
|
|
768
|
-
gridAutoColumns: { property: 'gridAutoColumns' },
|
|
769
|
-
gridAutoRows: { property: 'gridAutoRows' },
|
|
770
|
-
gridTemplateColumns: { property: 'gridTemplateColumns' },
|
|
771
|
-
gridTemplateRows: { property: 'gridTemplateRows' },
|
|
772
|
-
gridTemplateAreas: { property: 'gridTemplateAreas' },
|
|
773
|
-
gridAutoFlow: { property: 'gridAutoFlow' },
|
|
774
|
-
flow: {
|
|
775
|
-
property: 'gridAutoFlow',
|
|
776
|
-
scale: createScale(),
|
|
777
|
-
},
|
|
778
|
-
cols: {
|
|
779
|
-
property: 'gridTemplateColumns',
|
|
780
|
-
transform: gridItemRatio,
|
|
781
|
-
scale: createScale(),
|
|
782
|
-
},
|
|
783
|
-
rows: {
|
|
784
|
-
property: 'gridTemplateRows',
|
|
785
|
-
transform: gridItemRatio,
|
|
786
|
-
scale: createScale(),
|
|
787
|
-
},
|
|
788
|
-
autoRows: {
|
|
789
|
-
property: 'gridAutoRows',
|
|
790
|
-
transform: gridItem,
|
|
791
|
-
},
|
|
792
|
-
autoCols: {
|
|
793
|
-
property: 'gridAutoColumns',
|
|
794
|
-
transform: gridItem,
|
|
795
|
-
},
|
|
796
|
-
alignAll: {
|
|
797
|
-
property: 'justifyContent',
|
|
798
|
-
properties: ['justifyContent', 'alignItems'],
|
|
799
|
-
},
|
|
800
|
-
...alignments,
|
|
801
|
-
...gridItems,
|
|
802
|
-
...gaps,
|
|
803
|
-
};
|
|
804
|
-
const background = {
|
|
805
|
-
background: { property: 'background' },
|
|
806
|
-
backgroundImage: { property: 'backgroundImage' },
|
|
807
|
-
backgroundSize: { property: 'backgroundSize' },
|
|
808
|
-
backgroundRepeat: { property: 'backgroundRepeat' },
|
|
809
|
-
backgroundPosition: { property: 'backgroundPosition' },
|
|
810
|
-
};
|
|
811
|
-
const positioning = {
|
|
812
|
-
position: { property: 'position' },
|
|
813
|
-
inset: {
|
|
814
|
-
property: 'inset',
|
|
815
|
-
properties: ['top', 'right', 'bottom', 'left'],
|
|
816
|
-
transform: size,
|
|
817
|
-
},
|
|
818
|
-
top: { property: 'top', transform: size },
|
|
819
|
-
right: { property: 'right', transform: size },
|
|
820
|
-
bottom: { property: 'bottom', transform: size },
|
|
821
|
-
left: { property: 'left', transform: size },
|
|
822
|
-
zIndex: { property: 'zIndex' },
|
|
823
|
-
opacity: { property: 'opacity' },
|
|
824
|
-
};
|
|
825
|
-
const shadows = {
|
|
826
|
-
boxShadow: { property: 'boxShadow' },
|
|
827
|
-
textShadow: { property: 'textShadow' },
|
|
828
|
-
};
|
|
829
|
-
const layout = {
|
|
830
|
-
display: { property: 'display' },
|
|
831
|
-
overflow: { property: 'overflow' },
|
|
832
|
-
overflowX: { property: 'overflowX' },
|
|
833
|
-
overflowY: { property: 'overflowY' },
|
|
834
|
-
size: {
|
|
835
|
-
property: 'width',
|
|
836
|
-
properties: ['width', 'height'],
|
|
837
|
-
transform: size,
|
|
838
|
-
},
|
|
839
|
-
width: {
|
|
840
|
-
property: 'width',
|
|
841
|
-
transform: size,
|
|
842
|
-
},
|
|
843
|
-
minWidth: { property: 'minWidth', transform: size },
|
|
844
|
-
maxWidth: { property: 'maxWidth', transform: size },
|
|
845
|
-
height: { property: 'height', transform: size },
|
|
846
|
-
minHeight: {
|
|
847
|
-
property: 'minHeight',
|
|
848
|
-
transform: size,
|
|
849
|
-
},
|
|
850
|
-
maxHeight: {
|
|
851
|
-
property: 'maxHeight',
|
|
852
|
-
transform: size,
|
|
853
|
-
},
|
|
854
|
-
verticalAlign: { property: 'verticalAlign' },
|
|
855
|
-
...selfAlignments,
|
|
856
|
-
...gridItems,
|
|
857
|
-
...flexItems,
|
|
858
|
-
};
|
|
859
|
-
const typography = {
|
|
860
|
-
fontFamily: { property: 'fontFamily', scale: 'fontFamily' },
|
|
861
|
-
fontWeight: {
|
|
862
|
-
property: 'fontWeight',
|
|
863
|
-
scale: 'fontWeight',
|
|
864
|
-
},
|
|
865
|
-
lineHeight: {
|
|
866
|
-
property: 'lineHeight',
|
|
867
|
-
scale: 'lineHeight',
|
|
868
|
-
lineHeight: 'lineHeight',
|
|
869
|
-
},
|
|
870
|
-
fontSize: {
|
|
871
|
-
property: 'fontSize',
|
|
872
|
-
scale: 'fontSize',
|
|
873
|
-
},
|
|
874
|
-
letterSpacing: { property: 'letterSpacing' },
|
|
875
|
-
textAlign: { property: 'textAlign' },
|
|
876
|
-
fontStyle: { property: 'fontStyle' },
|
|
877
|
-
textDecoration: { property: 'textDecoration' },
|
|
878
|
-
textTransform: { property: 'textTransform' },
|
|
879
|
-
whiteSpace: { property: 'whiteSpace' },
|
|
880
|
-
};
|
|
881
|
-
const margin = {
|
|
882
|
-
m: { property: 'margin', scale: 'spacing' },
|
|
883
|
-
mx: {
|
|
884
|
-
property: 'margin',
|
|
885
|
-
properties: ['marginLeft', 'marginRight'],
|
|
886
|
-
scale: 'spacing',
|
|
887
|
-
},
|
|
888
|
-
my: {
|
|
889
|
-
property: 'margin',
|
|
890
|
-
properties: ['marginTop', 'marginBottom'],
|
|
891
|
-
scale: 'spacing',
|
|
892
|
-
},
|
|
893
|
-
mt: { property: 'marginTop', scale: 'spacing' },
|
|
894
|
-
mb: { property: 'marginBottom', scale: 'spacing' },
|
|
895
|
-
mr: { property: 'marginRight', scale: 'spacing' },
|
|
896
|
-
ml: { property: 'marginLeft', scale: 'spacing' },
|
|
897
|
-
};
|
|
898
|
-
const padding = {
|
|
899
|
-
p: { property: 'padding', scale: 'spacing' },
|
|
900
|
-
px: {
|
|
901
|
-
property: 'padding',
|
|
902
|
-
properties: ['paddingLeft', 'paddingRight'],
|
|
903
|
-
scale: 'spacing',
|
|
904
|
-
},
|
|
905
|
-
py: {
|
|
906
|
-
property: 'padding',
|
|
907
|
-
properties: ['paddingTop', 'paddingBottom'],
|
|
908
|
-
scale: 'spacing',
|
|
909
|
-
},
|
|
910
|
-
pt: { property: 'paddingTop', scale: 'spacing' },
|
|
911
|
-
pb: { property: 'paddingBottom', scale: 'spacing' },
|
|
912
|
-
pr: { property: 'paddingRight', scale: 'spacing' },
|
|
913
|
-
pl: { property: 'paddingLeft', scale: 'spacing' },
|
|
914
|
-
};
|
|
915
|
-
const space = {
|
|
916
|
-
...margin,
|
|
917
|
-
...padding,
|
|
918
|
-
};
|
|
919
|
-
const mode = {
|
|
920
|
-
mode: { property: 'none', scale: 'mode' },
|
|
921
|
-
};
|
|
922
|
-
const vars = {
|
|
923
|
-
vars: { property: 'variables' },
|
|
924
|
-
};
|
|
925
|
-
const config = createAnimus()
|
|
926
|
-
.addGroup('flex', flex)
|
|
927
|
-
.addGroup('grid', grid)
|
|
928
|
-
.addGroup('mode', mode)
|
|
929
|
-
.addGroup('vars', vars)
|
|
930
|
-
.addGroup('space', space)
|
|
931
|
-
.addGroup('color', color)
|
|
932
|
-
.addGroup('layout', layout)
|
|
933
|
-
.addGroup('borders', border)
|
|
934
|
-
.addGroup('shadows', shadows)
|
|
935
|
-
.addGroup('background', background)
|
|
936
|
-
.addGroup('typography', typography)
|
|
937
|
-
.addGroup('positioning', positioning);
|
|
938
|
-
config.build();
|
|
659
|
+
var getSelectors = function getSelectors() {
|
|
660
|
+
var base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
661
|
+
var variants = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
662
|
+
var states = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
663
|
+
var filters = arguments.length > 3 ? arguments[3] : undefined;
|
|
664
|
+
var rules = {};
|
|
665
|
+
Object.entries(base).forEach(function (_ref) {
|
|
666
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
667
|
+
key = _ref2[0],
|
|
668
|
+
styles = _ref2[1];
|
|
669
|
+
|
|
670
|
+
if (!filters.includes(key) && isObject(styles)) {
|
|
671
|
+
set(rules, [key, 'base'], styles);
|
|
672
|
+
} else {
|
|
673
|
+
set(rules, ['primary', 'base', key], styles);
|
|
674
|
+
}
|
|
675
|
+
});
|
|
676
|
+
Object.entries(variants).forEach(function (_ref3) {
|
|
677
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
678
|
+
key = _ref4[0],
|
|
679
|
+
variantConfig = _ref4[1].variants;
|
|
680
|
+
|
|
681
|
+
Object.entries(variantConfig).forEach(function (_ref5) {
|
|
682
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
683
|
+
option = _ref6[0],
|
|
684
|
+
optionStyles = _ref6[1];
|
|
685
|
+
|
|
686
|
+
var optionId = "".concat(key, "-").concat(option);
|
|
687
|
+
Object.entries(optionStyles).forEach(function (_ref7) {
|
|
688
|
+
var _ref8 = _slicedToArray(_ref7, 2),
|
|
689
|
+
key = _ref8[0],
|
|
690
|
+
styles = _ref8[1];
|
|
691
|
+
|
|
692
|
+
if (!filters.includes(key) && isObject(styles)) {
|
|
693
|
+
set(rules, [key, optionId], styles);
|
|
694
|
+
} else {
|
|
695
|
+
set(rules, ['primary', optionId, key], styles);
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
});
|
|
699
|
+
});
|
|
700
|
+
Object.entries(states).forEach(function (_ref9) {
|
|
701
|
+
var _ref10 = _slicedToArray(_ref9, 2),
|
|
702
|
+
optionId = _ref10[0],
|
|
703
|
+
optionStyles = _ref10[1];
|
|
704
|
+
|
|
705
|
+
Object.entries(optionStyles).forEach(function (_ref11) {
|
|
706
|
+
var _ref12 = _slicedToArray(_ref11, 2),
|
|
707
|
+
key = _ref12[0],
|
|
708
|
+
styles = _ref12[1];
|
|
709
|
+
|
|
710
|
+
if (!filters.includes(key) && isObject(styles)) {
|
|
711
|
+
set(rules, [key, optionId], styles);
|
|
712
|
+
} else {
|
|
713
|
+
set(rules, ['primary', optionId, key], styles);
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
});
|
|
717
|
+
return rules;
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
var createGetActiveStyleIds = function createGetActiveStyleIds(variants, states) {
|
|
721
|
+
var vIds = Object.keys(variants);
|
|
722
|
+
var sIds = Object.keys(states);
|
|
723
|
+
return function (props) {
|
|
724
|
+
var activeIds = [];
|
|
725
|
+
vIds.forEach(function (id) {
|
|
726
|
+
if (props[id]) {
|
|
727
|
+
activeIds.push("".concat(id, "-").concat(props[id]));
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
sIds.forEach(function (id) {
|
|
731
|
+
if (props[id]) {
|
|
732
|
+
activeIds.push(id);
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
return activeIds;
|
|
736
|
+
};
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
var extractBreakpointStyles = function extractBreakpointStyles(styles, medias) {
|
|
740
|
+
var unscoped = {};
|
|
741
|
+
var breakpoint = {};
|
|
742
|
+
Object.entries(styles).forEach(function (_ref13) {
|
|
743
|
+
var _ref14 = _slicedToArray(_ref13, 2),
|
|
744
|
+
rule = _ref14[0],
|
|
745
|
+
value = _ref14[1];
|
|
746
|
+
|
|
747
|
+
var target = medias.includes(rule) ? breakpoint : unscoped;
|
|
748
|
+
target[rule] = value;
|
|
749
|
+
});
|
|
750
|
+
return [unscoped, breakpoint];
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
var applyOverride = function applyOverride() {
|
|
754
|
+
var override = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
755
|
+
var baseResult = arguments.length > 1 ? arguments[1] : undefined;
|
|
756
|
+
var breakpointResult = arguments.length > 2 ? arguments[2] : undefined;
|
|
757
|
+
var parser = arguments.length > 3 ? arguments[3] : undefined;
|
|
758
|
+
var theme = arguments.length > 4 ? arguments[4] : undefined;
|
|
759
|
+
var media = arguments.length > 5 ? arguments[5] : undefined;
|
|
760
|
+
|
|
761
|
+
var _extractBreakpointSty = extractBreakpointStyles(parser(_objectSpread2(_objectSpread2({}, override), {}, {
|
|
762
|
+
theme: theme
|
|
763
|
+
}), true), media),
|
|
764
|
+
_extractBreakpointSty2 = _slicedToArray(_extractBreakpointSty, 2),
|
|
765
|
+
overrideStyles = _extractBreakpointSty2[0],
|
|
766
|
+
overrideBreakpointStyles = _extractBreakpointSty2[1];
|
|
939
767
|
|
|
940
|
-
|
|
768
|
+
for (var rule in overrideStyles) {
|
|
769
|
+
baseResult[rule] = overrideStyles[rule];
|
|
770
|
+
}
|
|
941
771
|
|
|
942
|
-
|
|
772
|
+
media.forEach(function (mq) {
|
|
773
|
+
var mqOverride = overrideBreakpointStyles[mq];
|
|
774
|
+
if (!mqOverride || isEmpty(mqOverride)) return;
|
|
775
|
+
|
|
776
|
+
if (!breakpointResult[mq]) {
|
|
777
|
+
breakpointResult[mq] = {};
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
var mqStyle = breakpointResult[mq];
|
|
781
|
+
|
|
782
|
+
for (var _rule in mqOverride) {
|
|
783
|
+
mqStyle[_rule] = mqOverride[_rule];
|
|
784
|
+
}
|
|
785
|
+
});
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
var applyStyle = function applyStyle(resultStyles, config, props, ctx) {
|
|
789
|
+
var base = config.base;
|
|
790
|
+
var parser = ctx.parser,
|
|
791
|
+
getMediaSelectors = ctx.getMediaSelectors,
|
|
792
|
+
getActiveOverrides = ctx.getActiveOverrides;
|
|
793
|
+
var theme = props.theme;
|
|
794
|
+
var overrides = Object.values(pick(config, getActiveOverrides(props)));
|
|
795
|
+
var media = getMediaSelectors(props);
|
|
796
|
+
|
|
797
|
+
var _extractBreakpointSty3 = extractBreakpointStyles(parser(_objectSpread2(_objectSpread2({}, base), {}, {
|
|
798
|
+
theme: theme
|
|
799
|
+
}), true), media),
|
|
800
|
+
_extractBreakpointSty4 = _slicedToArray(_extractBreakpointSty3, 2),
|
|
801
|
+
styles = _extractBreakpointSty4[0],
|
|
802
|
+
breakpointStyles = _extractBreakpointSty4[1];
|
|
803
|
+
|
|
804
|
+
for (var rule in styles) {
|
|
805
|
+
resultStyles[rule] = styles[rule];
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
overrides.forEach(function (override) {
|
|
809
|
+
applyOverride(override, resultStyles, breakpointStyles, parser, theme, media);
|
|
810
|
+
});
|
|
811
|
+
media.forEach(function (media) {
|
|
812
|
+
var bp = breakpointStyles[media];
|
|
813
|
+
|
|
814
|
+
if (!isEmpty(bp)) {
|
|
815
|
+
resultStyles[media] = bp;
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
var createStylist = function createStylist(parser) {
|
|
821
|
+
var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
822
|
+
var variants = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
823
|
+
var states = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
824
|
+
var selectorGroups = getSelectors(base, variants, states, parser.propNames);
|
|
825
|
+
var context = {
|
|
826
|
+
parser: parser,
|
|
827
|
+
getMediaSelectors: function getMediaSelectors(_ref15) {
|
|
828
|
+
var _theme$breakpoints;
|
|
829
|
+
|
|
830
|
+
var theme = _ref15.theme;
|
|
831
|
+
var breakpoints = (_theme$breakpoints = theme === null || theme === void 0 ? void 0 : theme.breakpoints) !== null && _theme$breakpoints !== void 0 ? _theme$breakpoints : compatTheme.breakpoints;
|
|
832
|
+
return ['xs', 'sm', 'md', 'lg', 'xl'].map(function (key) {
|
|
833
|
+
return breakpoints[key];
|
|
834
|
+
});
|
|
835
|
+
},
|
|
836
|
+
getActiveOverrides: createGetActiveStyleIds(variants, states)
|
|
837
|
+
};
|
|
838
|
+
return function (props) {
|
|
839
|
+
var vars = props.vars;
|
|
840
|
+
|
|
841
|
+
var result = _objectSpread2({}, vars);
|
|
842
|
+
|
|
843
|
+
Object.entries(selectorGroups).forEach(function (_ref16) {
|
|
844
|
+
var _ref17 = _slicedToArray(_ref16, 2),
|
|
845
|
+
selectorId = _ref17[0],
|
|
846
|
+
_ref17$ = _ref17[1],
|
|
847
|
+
config = _ref17$ === void 0 ? {} : _ref17$;
|
|
848
|
+
|
|
849
|
+
if (selectorId === 'primary') {
|
|
850
|
+
applyStyle(result, config, props, context);
|
|
851
|
+
} else {
|
|
852
|
+
result[selectorId] = {};
|
|
853
|
+
applyStyle(result[selectorId], config, props, context);
|
|
854
|
+
}
|
|
855
|
+
});
|
|
856
|
+
applyStyle(result, {
|
|
857
|
+
base: parser(props)
|
|
858
|
+
}, props, context);
|
|
859
|
+
return result;
|
|
860
|
+
};
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
var AnimusWithAll = /*#__PURE__*/function () {
|
|
864
|
+
function AnimusWithAll(props, groups, parser, base, variants, states, activeGroups, custom) {
|
|
865
|
+
_classCallCheck(this, AnimusWithAll);
|
|
866
|
+
|
|
867
|
+
_defineProperty(this, "propRegistry", {});
|
|
868
|
+
|
|
869
|
+
_defineProperty(this, "groupRegistry", {});
|
|
870
|
+
|
|
871
|
+
_defineProperty(this, "parser", {});
|
|
872
|
+
|
|
873
|
+
_defineProperty(this, "baseStyles", {});
|
|
874
|
+
|
|
875
|
+
_defineProperty(this, "statesConfig", {});
|
|
876
|
+
|
|
877
|
+
_defineProperty(this, "variants", {});
|
|
878
|
+
|
|
879
|
+
_defineProperty(this, "activeGroups", {});
|
|
880
|
+
|
|
881
|
+
_defineProperty(this, "custom", {});
|
|
882
|
+
|
|
883
|
+
this.propRegistry = props;
|
|
884
|
+
this.groupRegistry = groups;
|
|
885
|
+
this.parser = parser;
|
|
886
|
+
this.baseStyles = base;
|
|
887
|
+
this.variants = variants;
|
|
888
|
+
this.statesConfig = states;
|
|
889
|
+
this.activeGroups = activeGroups;
|
|
890
|
+
this.custom = custom;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
_createClass(AnimusWithAll, [{
|
|
894
|
+
key: "asComponent",
|
|
895
|
+
value: function asComponent(component) {
|
|
896
|
+
var handler = createStylist(createParser$1(_objectSpread2(_objectSpread2({}, this.parser.config), this.custom), [].concat(_toConsumableArray(Object.keys(this.variants)), _toConsumableArray(Object.keys(this.statesConfig)))), this.baseStyles, this.variants, this.statesConfig);
|
|
897
|
+
return /*#__PURE__*/_styled(component, {
|
|
898
|
+
target: "e19x4vr0",
|
|
899
|
+
label: "AnimusWithAll"
|
|
900
|
+
})(handler, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkFuaW11cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE0QmUiLCJmaWxlIjoiQW5pbXVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xyXG5pbXBvcnQgeyBtZXJnZSB9IGZyb20gJ2xvZGFzaCc7XHJcbmltcG9ydCB7IGNyZWF0ZVBhcnNlciB9IGZyb20gJy4vc3R5bGVzL2NyZWF0ZVBhcnNlcic7XHJcbmltcG9ydCB7IGNyZWF0ZVN0eWxpc3QgfSBmcm9tICcuL3N0eWxlcy9jcmVhdGVTdHlsaXN0JztcclxuZXhwb3J0IGNsYXNzIEFuaW11c1dpdGhBbGwge1xyXG4gICAgcHJvcFJlZ2lzdHJ5ID0ge307XHJcbiAgICBncm91cFJlZ2lzdHJ5ID0ge307XHJcbiAgICBwYXJzZXIgPSB7fTtcclxuICAgIGJhc2VTdHlsZXMgPSB7fTtcclxuICAgIHN0YXRlc0NvbmZpZyA9IHt9O1xyXG4gICAgdmFyaWFudHMgPSB7fTtcclxuICAgIGFjdGl2ZUdyb3VwcyA9IHt9O1xyXG4gICAgY3VzdG9tID0ge307XHJcbiAgICBjb25zdHJ1Y3Rvcihwcm9wcywgZ3JvdXBzLCBwYXJzZXIsIGJhc2UsIHZhcmlhbnRzLCBzdGF0ZXMsIGFjdGl2ZUdyb3VwcywgY3VzdG9tKSB7XHJcbiAgICAgICAgdGhpcy5wcm9wUmVnaXN0cnkgPSBwcm9wcztcclxuICAgICAgICB0aGlzLmdyb3VwUmVnaXN0cnkgPSBncm91cHM7XHJcbiAgICAgICAgdGhpcy5wYXJzZXIgPSBwYXJzZXI7XHJcbiAgICAgICAgdGhpcy5iYXNlU3R5bGVzID0gYmFzZTtcclxuICAgICAgICB0aGlzLnZhcmlhbnRzID0gdmFyaWFudHM7XHJcbiAgICAgICAgdGhpcy5zdGF0ZXNDb25maWcgPSBzdGF0ZXM7XHJcbiAgICAgICAgdGhpcy5hY3RpdmVHcm91cHMgPSBhY3RpdmVHcm91cHM7XHJcbiAgICAgICAgdGhpcy5jdXN0b20gPSBjdXN0b207XHJcbiAgICB9XHJcbiAgICBhc0NvbXBvbmVudChjb21wb25lbnQpIHtcclxuICAgICAgICBjb25zdCBoYW5kbGVyID0gY3JlYXRlU3R5bGlzdChjcmVhdGVQYXJzZXIoeyAuLi50aGlzLnBhcnNlci5jb25maWcsIC4uLnRoaXMuY3VzdG9tIH0sIFtcclxuICAgICAgICAgICAgLi4uT2JqZWN0LmtleXModGhpcy52YXJpYW50cyksXHJcbiAgICAgICAgICAgIC4uLk9iamVjdC5rZXlzKHRoaXMuc3RhdGVzQ29uZmlnKSxcclxuICAgICAgICBdKSwgdGhpcy5iYXNlU3R5bGVzLCB0aGlzLnZhcmlhbnRzLCB0aGlzLnN0YXRlc0NvbmZpZyk7XHJcbiAgICAgICAgcmV0dXJuIHN0eWxlZChjb21wb25lbnQpKGhhbmRsZXIpO1xyXG4gICAgfVxyXG4gICAgYnVpbGQoKSB7XHJcbiAgICAgICAgY29uc3QgaGFuZGxlciA9IGNyZWF0ZVN0eWxpc3QoY3JlYXRlUGFyc2VyKHsgLi4udGhpcy5wYXJzZXIuY29uZmlnLCAuLi50aGlzLmN1c3RvbSB9LCBbXHJcbiAgICAgICAgICAgIC4uLk9iamVjdC5rZXlzKHRoaXMudmFyaWFudHMpLFxyXG4gICAgICAgICAgICAuLi5PYmplY3Qua2V5cyh0aGlzLnN0YXRlc0NvbmZpZyksXHJcbiAgICAgICAgXSksIHRoaXMuYmFzZVN0eWxlcywgdGhpcy52YXJpYW50cywgdGhpcy5zdGF0ZXNDb25maWcpO1xyXG4gICAgICAgIHJldHVybiBoYW5kbGVyO1xyXG4gICAgfVxyXG59XHJcbmNsYXNzIEFuaW11c1dpdGhTeXN0ZW0gZXh0ZW5kcyBBbmltdXNXaXRoQWxsIHtcclxuICAgIGNvbnN0cnVjdG9yKHByb3BzLCBncm91cHMsIHBhcnNlciwgYmFzZSwgdmFyaWFudHMsIHN0YXRlcywgYWN0aXZlR3JvdXBzKSB7XHJcbiAgICAgICAgc3VwZXIocHJvcHMsIGdyb3VwcywgcGFyc2VyLCBiYXNlLCB2YXJpYW50cywgc3RhdGVzLCBhY3RpdmVHcm91cHMsIHt9KTtcclxuICAgIH1cclxuICAgIHByb3BzKGNvbmZpZykge1xyXG4gICAgICAgIHJldHVybiBuZXcgQW5pbXVzV2l0aEFsbCh0aGlzLnByb3BSZWdpc3RyeSwgdGhpcy5ncm91cFJlZ2lzdHJ5LCB0aGlzLnBhcnNlciwgdGhpcy5iYXNlU3R5bGVzLCB0aGlzLnZhcmlhbnRzLCB0aGlzLnN0YXRlc0NvbmZpZywgdGhpcy5hY3RpdmVHcm91cHMsIGNvbmZpZyk7XHJcbiAgICB9XHJcbn1cclxuY2xhc3MgQW5pbXVzV2l0aFN0YXRlcyBleHRlbmRzIEFuaW11c1dpdGhTeXN0ZW0ge1xyXG4gICAgY29uc3RydWN0b3IocHJvcHMsIGdyb3VwcywgcGFyc2VyLCBiYXNlLCB2YXJpYW50cywgc3RhdGVzKSB7XHJcbiAgICAgICAgc3VwZXIocHJvcHMsIGdyb3VwcywgcGFyc2VyLCBiYXNlLCB2YXJpYW50cywgc3RhdGVzLCB7fSk7XHJcbiAgICB9XHJcbiAgICBncm91cHMoY29uZmlnKSB7XHJcbiAgICAgICAgcmV0dXJuIG5ldyBBbmltdXNXaXRoU3lzdGVtKHRoaXMucHJvcFJlZ2lzdHJ5LCB0aGlzLmdyb3VwUmVnaXN0cnksIHRoaXMucGFyc2VyLCB0aGlzLmJhc2VTdHlsZXMsIHRoaXMudmFyaWFudHMsIHRoaXMuc3RhdGVzQ29uZmlnLCBjb25maWcpO1xyXG4gICAgfVxyXG59XHJcbmNsYXNzIEFuaW11c1dpdGhWYXJpYW50cyBleHRlbmRzIEFuaW11c1dpdGhTdGF0ZXMge1xyXG4gICAgY29uc3RydWN0b3IocHJvcHMsIGdyb3VwcywgcGFyc2VyLCBiYXNlLCB2YXJpYW50cykge1xyXG4gICAgICAgIHN1cGVyKHByb3BzLCBncm91cHMsIHBhcnNlciwgYmFzZSwgdmFyaWFudHMsIHt9KTtcclxuICAgIH1cclxuICAgIHN0YXRlcyhjb25maWcpIHtcclxuICAgICAgICByZXR1cm4gbmV3IEFuaW11c1dpdGhTdGF0ZXModGhpcy5wcm9wUmVnaXN0cnksIHRoaXMuZ3JvdXBSZWdpc3RyeSwgdGhpcy5wYXJzZXIsIHRoaXMuYmFzZVN0eWxlcywgdGhpcy52YXJpYW50cywgY29uZmlnKTtcclxuICAgIH1cclxuICAgIHZhcmlhbnQob3B0aW9ucykge1xyXG4gICAgICAgIGNvbnN0IHByb3AgPSBvcHRpb25zLnByb3AgfHwgJ3ZhcmlhbnQnO1xyXG4gICAgICAgIHJldHVybiBuZXcgQW5pbXVzV2l0aFZhcmlhbnRzKHRoaXMucHJvcFJlZ2lzdHJ5LCB0aGlzLmdyb3VwUmVnaXN0cnksIHRoaXMucGFyc2VyLCB0aGlzLmJhc2VTdHlsZXMsIG1lcmdlKHRoaXMudmFyaWFudHMsIHsgW3Byb3BdOiBvcHRpb25zIH0pKTtcclxuICAgIH1cclxufVxyXG5jbGFzcyBBbmltdXNXaXRoQmFzZSBleHRlbmRzIEFuaW11c1dpdGhWYXJpYW50cyB7XHJcbiAgICBjb25zdHJ1Y3Rvcihwcm9wcywgZ3JvdXBzLCBwYXJzZXIsIGJhc2UpIHtcclxuICAgICAgICBzdXBlcihwcm9wcywgZ3JvdXBzLCBwYXJzZXIsIGJhc2UsIHt9KTtcclxuICAgIH1cclxuICAgIHZhcmlhbnQob3B0aW9ucykge1xyXG4gICAgICAgIGNvbnN0IHByb3AgPSBvcHRpb25zLnByb3AgfHwgJ3ZhcmlhbnQnO1xyXG4gICAgICAgIHJldHVybiBuZXcgQW5pbXVzV2l0aFZhcmlhbnRzKHRoaXMucHJvcFJlZ2lzdHJ5LCB0aGlzLmdyb3VwUmVnaXN0cnksIHRoaXMucGFyc2VyLCB0aGlzLmJhc2VTdHlsZXMsIG1lcmdlKHRoaXMudmFyaWFudHMsIHsgW3Byb3BdOiBvcHRpb25zIH0pKTtcclxuICAgIH1cclxufVxyXG5leHBvcnQgY2xhc3MgQW5pbXVzIGV4dGVuZHMgQW5pbXVzV2l0aEJhc2Uge1xyXG4gICAgY29uc3RydWN0b3IocHJvcHMsIGdyb3Vwcykge1xyXG4gICAgICAgIHN1cGVyKHByb3BzLCBncm91cHMsIGNyZWF0ZVBhcnNlcihwcm9wcyksIHt9KTtcclxuICAgIH1cclxuICAgIHN0eWxlcyhjb25maWcpIHtcclxuICAgICAgICByZXR1cm4gbmV3IEFuaW11c1dpdGhCYXNlKHRoaXMucHJvcFJlZ2lzdHJ5LCB0aGlzLmdyb3VwUmVnaXN0cnksIHRoaXMucGFyc2VyLCBjb25maWcpO1xyXG4gICAgfVxyXG59XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPUFuaW11cy5qcy5tYXAiXX0= */");
|
|
901
|
+
}
|
|
902
|
+
}, {
|
|
903
|
+
key: "build",
|
|
904
|
+
value: function build() {
|
|
905
|
+
var handler = createStylist(createParser$1(_objectSpread2(_objectSpread2({}, this.parser.config), this.custom), [].concat(_toConsumableArray(Object.keys(this.variants)), _toConsumableArray(Object.keys(this.statesConfig)))), this.baseStyles, this.variants, this.statesConfig);
|
|
906
|
+
return handler;
|
|
907
|
+
}
|
|
908
|
+
}]);
|
|
909
|
+
|
|
910
|
+
return AnimusWithAll;
|
|
911
|
+
}();
|
|
912
|
+
|
|
913
|
+
var AnimusWithSystem = /*#__PURE__*/function (_AnimusWithAll) {
|
|
914
|
+
_inherits(AnimusWithSystem, _AnimusWithAll);
|
|
915
|
+
|
|
916
|
+
var _super = _createSuper(AnimusWithSystem);
|
|
917
|
+
|
|
918
|
+
function AnimusWithSystem(props, groups, parser, base, variants, states, activeGroups) {
|
|
919
|
+
_classCallCheck(this, AnimusWithSystem);
|
|
920
|
+
|
|
921
|
+
return _super.call(this, props, groups, parser, base, variants, states, activeGroups, {});
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
_createClass(AnimusWithSystem, [{
|
|
925
|
+
key: "props",
|
|
926
|
+
value: function props(config) {
|
|
927
|
+
return new AnimusWithAll(this.propRegistry, this.groupRegistry, this.parser, this.baseStyles, this.variants, this.statesConfig, this.activeGroups, config);
|
|
928
|
+
}
|
|
929
|
+
}]);
|
|
930
|
+
|
|
931
|
+
return AnimusWithSystem;
|
|
932
|
+
}(AnimusWithAll);
|
|
933
|
+
|
|
934
|
+
var AnimusWithStates = /*#__PURE__*/function (_AnimusWithSystem) {
|
|
935
|
+
_inherits(AnimusWithStates, _AnimusWithSystem);
|
|
936
|
+
|
|
937
|
+
var _super2 = _createSuper(AnimusWithStates);
|
|
938
|
+
|
|
939
|
+
function AnimusWithStates(props, groups, parser, base, variants, states) {
|
|
940
|
+
_classCallCheck(this, AnimusWithStates);
|
|
941
|
+
|
|
942
|
+
return _super2.call(this, props, groups, parser, base, variants, states, {});
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
_createClass(AnimusWithStates, [{
|
|
946
|
+
key: "groups",
|
|
947
|
+
value: function groups(config) {
|
|
948
|
+
return new AnimusWithSystem(this.propRegistry, this.groupRegistry, this.parser, this.baseStyles, this.variants, this.statesConfig, config);
|
|
949
|
+
}
|
|
950
|
+
}]);
|
|
951
|
+
|
|
952
|
+
return AnimusWithStates;
|
|
953
|
+
}(AnimusWithSystem);
|
|
954
|
+
|
|
955
|
+
var AnimusWithVariants = /*#__PURE__*/function (_AnimusWithStates) {
|
|
956
|
+
_inherits(AnimusWithVariants, _AnimusWithStates);
|
|
957
|
+
|
|
958
|
+
var _super3 = _createSuper(AnimusWithVariants);
|
|
959
|
+
|
|
960
|
+
function AnimusWithVariants(props, groups, parser, base, variants) {
|
|
961
|
+
_classCallCheck(this, AnimusWithVariants);
|
|
962
|
+
|
|
963
|
+
return _super3.call(this, props, groups, parser, base, variants, {});
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
_createClass(AnimusWithVariants, [{
|
|
967
|
+
key: "states",
|
|
968
|
+
value: function states(config) {
|
|
969
|
+
return new AnimusWithStates(this.propRegistry, this.groupRegistry, this.parser, this.baseStyles, this.variants, config);
|
|
970
|
+
}
|
|
971
|
+
}, {
|
|
972
|
+
key: "variant",
|
|
973
|
+
value: function variant(options) {
|
|
974
|
+
var prop = options.prop || 'variant';
|
|
975
|
+
return new AnimusWithVariants(this.propRegistry, this.groupRegistry, this.parser, this.baseStyles, merge(this.variants, _defineProperty({}, prop, options)));
|
|
976
|
+
}
|
|
977
|
+
}]);
|
|
978
|
+
|
|
979
|
+
return AnimusWithVariants;
|
|
980
|
+
}(AnimusWithStates);
|
|
981
|
+
|
|
982
|
+
var AnimusWithBase = /*#__PURE__*/function (_AnimusWithVariants) {
|
|
983
|
+
_inherits(AnimusWithBase, _AnimusWithVariants);
|
|
984
|
+
|
|
985
|
+
var _super4 = _createSuper(AnimusWithBase);
|
|
986
|
+
|
|
987
|
+
function AnimusWithBase(props, groups, parser, base) {
|
|
988
|
+
_classCallCheck(this, AnimusWithBase);
|
|
989
|
+
|
|
990
|
+
return _super4.call(this, props, groups, parser, base, {});
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
_createClass(AnimusWithBase, [{
|
|
994
|
+
key: "variant",
|
|
995
|
+
value: function variant(options) {
|
|
996
|
+
var prop = options.prop || 'variant';
|
|
997
|
+
return new AnimusWithVariants(this.propRegistry, this.groupRegistry, this.parser, this.baseStyles, merge(this.variants, _defineProperty({}, prop, options)));
|
|
998
|
+
}
|
|
999
|
+
}]);
|
|
1000
|
+
|
|
1001
|
+
return AnimusWithBase;
|
|
1002
|
+
}(AnimusWithVariants);
|
|
1003
|
+
|
|
1004
|
+
var Animus = /*#__PURE__*/function (_AnimusWithBase) {
|
|
1005
|
+
_inherits(Animus, _AnimusWithBase);
|
|
1006
|
+
|
|
1007
|
+
var _super5 = _createSuper(Animus);
|
|
1008
|
+
|
|
1009
|
+
function Animus(props, groups) {
|
|
1010
|
+
_classCallCheck(this, Animus);
|
|
1011
|
+
|
|
1012
|
+
return _super5.call(this, props, groups, createParser$1(props), {});
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
_createClass(Animus, [{
|
|
1016
|
+
key: "styles",
|
|
1017
|
+
value: function styles(config) {
|
|
1018
|
+
return new AnimusWithBase(this.propRegistry, this.groupRegistry, this.parser, config);
|
|
1019
|
+
}
|
|
1020
|
+
}]);
|
|
1021
|
+
|
|
1022
|
+
return Animus;
|
|
1023
|
+
}(AnimusWithBase);
|
|
1024
|
+
|
|
1025
|
+
var _props = /*#__PURE__*/new WeakMap();
|
|
1026
|
+
|
|
1027
|
+
var _groups = /*#__PURE__*/new WeakMap();
|
|
1028
|
+
|
|
1029
|
+
var AnimusConfig = /*#__PURE__*/function () {
|
|
1030
|
+
function AnimusConfig(config, groups) {
|
|
1031
|
+
_classCallCheck(this, AnimusConfig);
|
|
1032
|
+
|
|
1033
|
+
_classPrivateFieldInitSpec(this, _props, {
|
|
1034
|
+
writable: true,
|
|
1035
|
+
value: {}
|
|
1036
|
+
});
|
|
1037
|
+
|
|
1038
|
+
_classPrivateFieldInitSpec(this, _groups, {
|
|
1039
|
+
writable: true,
|
|
1040
|
+
value: {}
|
|
1041
|
+
});
|
|
1042
|
+
|
|
1043
|
+
_classPrivateFieldSet(this, _props, config || {});
|
|
1044
|
+
|
|
1045
|
+
_classPrivateFieldSet(this, _groups, groups || {});
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
_createClass(AnimusConfig, [{
|
|
1049
|
+
key: "addGroup",
|
|
1050
|
+
value: function addGroup(name, config) {
|
|
1051
|
+
var newGroup = _defineProperty({}, name, Object.keys(config));
|
|
1052
|
+
|
|
1053
|
+
return new AnimusConfig(_objectSpread2(_objectSpread2({}, _classPrivateFieldGet(this, _props)), config), _objectSpread2(_objectSpread2({}, _classPrivateFieldGet(this, _groups)), newGroup));
|
|
1054
|
+
}
|
|
1055
|
+
}, {
|
|
1056
|
+
key: "build",
|
|
1057
|
+
value: function build() {
|
|
1058
|
+
var props = _classPrivateFieldGet(this, _props);
|
|
1059
|
+
|
|
1060
|
+
var groups = _classPrivateFieldGet(this, _groups);
|
|
1061
|
+
|
|
1062
|
+
return new Animus(props, groups);
|
|
1063
|
+
}
|
|
1064
|
+
}]);
|
|
1065
|
+
|
|
1066
|
+
return AnimusConfig;
|
|
1067
|
+
}();
|
|
1068
|
+
|
|
1069
|
+
var createAnimus = function createAnimus() {
|
|
1070
|
+
return new AnimusConfig();
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
var createScale = function createScale() {
|
|
1074
|
+
return [];
|
|
1075
|
+
};
|
|
1076
|
+
|
|
1077
|
+
var percentageOrAbsolute = function percentageOrAbsolute(coordinate) {
|
|
1078
|
+
if (coordinate === 0) {
|
|
1079
|
+
return coordinate;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
if (coordinate <= 1 && coordinate >= -1) {
|
|
1083
|
+
return "".concat(coordinate * 100, "%");
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
return "".concat(coordinate, "px");
|
|
1087
|
+
};
|
|
1088
|
+
var valueWithUnit = /(-?\d*\.?\d+)(%|\w*)/;
|
|
1089
|
+
var size = function size(value) {
|
|
1090
|
+
if (isNumber(value)) {
|
|
1091
|
+
return percentageOrAbsolute(value);
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
if (value.includes('calc')) {
|
|
1095
|
+
return value;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
var _ref = valueWithUnit.exec(value) || [],
|
|
1099
|
+
_ref2 = _slicedToArray(_ref, 3),
|
|
1100
|
+
match = _ref2[0],
|
|
1101
|
+
number = _ref2[1],
|
|
1102
|
+
unit = _ref2[2];
|
|
1103
|
+
|
|
1104
|
+
if (match === undefined) {
|
|
1105
|
+
return value;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
var numericValue = parseFloat(number);
|
|
1109
|
+
return !unit ? percentageOrAbsolute(numericValue) : "".concat(numericValue).concat(unit);
|
|
1110
|
+
};
|
|
1111
|
+
|
|
1112
|
+
var gridItemMap = {
|
|
1113
|
+
max: 'max-content',
|
|
1114
|
+
min: 'min-content'
|
|
1115
|
+
};
|
|
1116
|
+
var unitlessNumber = new RegExp(/^[0-9]*$/);
|
|
1117
|
+
|
|
1118
|
+
var isUnitlessNumber = function isUnitlessNumber(val) {
|
|
1119
|
+
return unitlessNumber.test(val);
|
|
1120
|
+
};
|
|
1121
|
+
|
|
1122
|
+
var gridItem = function gridItem(item) {
|
|
1123
|
+
var template = isUnitlessNumber(item) ? "".concat(item, "fr") : get(gridItemMap, item, item);
|
|
1124
|
+
return "minmax(0, ".concat(template, ")");
|
|
1125
|
+
};
|
|
1126
|
+
var repeatGridItem = function repeatGridItem(item, count) {
|
|
1127
|
+
var template = gridItem(item);
|
|
1128
|
+
return count > 1 ? "repeat(".concat(count, ", ").concat(template, ")") : template;
|
|
1129
|
+
};
|
|
1130
|
+
var parseGridRatio = function parseGridRatio(val) {
|
|
1131
|
+
var items = val.split(':');
|
|
1132
|
+
var repeated = ['', 0];
|
|
1133
|
+
var gridStyle = '';
|
|
1134
|
+
|
|
1135
|
+
for (var i = 0; i < items.length + 1; i += 1) {
|
|
1136
|
+
var _repeated;
|
|
1137
|
+
|
|
1138
|
+
var delimiter = gridStyle.length > 0 ? ' ' : '';
|
|
1139
|
+
var curr = items[i];
|
|
1140
|
+
|
|
1141
|
+
if (((_repeated = repeated) === null || _repeated === void 0 ? void 0 : _repeated[0]) !== curr) {
|
|
1142
|
+
if (repeated[0].length) gridStyle += delimiter + repeatGridItem.apply(void 0, _toConsumableArray(repeated));
|
|
1143
|
+
if (curr) repeated = [curr, 1];
|
|
1144
|
+
} else {
|
|
1145
|
+
repeated[1] += 1;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
return gridStyle;
|
|
1150
|
+
};
|
|
1151
|
+
var gridItemRatio = function gridItemRatio(val) {
|
|
1152
|
+
return isNumber(val) ? repeatGridItem('1', val) : parseGridRatio(val);
|
|
1153
|
+
};
|
|
1154
|
+
|
|
1155
|
+
var numberToTemplate = function numberToTemplate(val, template) {
|
|
1156
|
+
return typeof val === 'number' ? template(val) : val;
|
|
1157
|
+
};
|
|
1158
|
+
var numberToPx = function numberToPx(val) {
|
|
1159
|
+
return numberToTemplate(val, function (pixels) {
|
|
1160
|
+
return "".concat(pixels, "px");
|
|
1161
|
+
});
|
|
1162
|
+
};
|
|
1163
|
+
|
|
1164
|
+
var borderShorthand = function borderShorthand(val) {
|
|
1165
|
+
return numberToTemplate(val, function (width) {
|
|
1166
|
+
return "".concat(width, "px solid currentColor");
|
|
1167
|
+
});
|
|
1168
|
+
};
|
|
1169
|
+
|
|
1170
|
+
var color = {
|
|
1171
|
+
color: {
|
|
1172
|
+
property: 'color',
|
|
1173
|
+
scale: 'colors'
|
|
1174
|
+
},
|
|
1175
|
+
textColor: {
|
|
1176
|
+
property: 'color',
|
|
1177
|
+
scale: 'colors'
|
|
1178
|
+
},
|
|
1179
|
+
bg: {
|
|
1180
|
+
property: 'backgroundColor',
|
|
1181
|
+
scale: 'colors'
|
|
1182
|
+
},
|
|
1183
|
+
borderColor: {
|
|
1184
|
+
property: 'borderColor',
|
|
1185
|
+
scale: 'colors'
|
|
1186
|
+
},
|
|
1187
|
+
borderColorX: {
|
|
1188
|
+
property: 'borderColor',
|
|
1189
|
+
properties: ['borderLeftColor', 'borderRightColor'],
|
|
1190
|
+
scale: 'colors'
|
|
1191
|
+
},
|
|
1192
|
+
borderColorY: {
|
|
1193
|
+
property: 'borderColor',
|
|
1194
|
+
properties: ['borderTopColor', 'borderBottomColor'],
|
|
1195
|
+
scale: 'colors'
|
|
1196
|
+
},
|
|
1197
|
+
borderColorLeft: {
|
|
1198
|
+
property: 'borderLeftColor',
|
|
1199
|
+
scale: 'colors'
|
|
1200
|
+
},
|
|
1201
|
+
borderColorRight: {
|
|
1202
|
+
property: 'borderRightColor',
|
|
1203
|
+
scale: 'colors'
|
|
1204
|
+
},
|
|
1205
|
+
borderColorTop: {
|
|
1206
|
+
property: 'borderTopColor',
|
|
1207
|
+
scale: 'colors'
|
|
1208
|
+
},
|
|
1209
|
+
borderColorBottom: {
|
|
1210
|
+
property: 'borderBottomColor',
|
|
1211
|
+
scale: 'colors'
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1214
|
+
var border = {
|
|
1215
|
+
border: {
|
|
1216
|
+
property: 'border',
|
|
1217
|
+
scale: 'borders',
|
|
1218
|
+
transform: borderShorthand
|
|
1219
|
+
},
|
|
1220
|
+
borderX: {
|
|
1221
|
+
property: 'border',
|
|
1222
|
+
properties: ['borderLeft', 'borderRight'],
|
|
1223
|
+
scale: 'borders',
|
|
1224
|
+
transform: borderShorthand
|
|
1225
|
+
},
|
|
1226
|
+
borderY: {
|
|
1227
|
+
property: 'border',
|
|
1228
|
+
properties: ['borderTop', 'borderBottom'],
|
|
1229
|
+
scale: 'borders',
|
|
1230
|
+
transform: borderShorthand
|
|
1231
|
+
},
|
|
1232
|
+
borderTop: {
|
|
1233
|
+
property: 'borderTop',
|
|
1234
|
+
scale: 'borders',
|
|
1235
|
+
transform: borderShorthand
|
|
1236
|
+
},
|
|
1237
|
+
borderRight: {
|
|
1238
|
+
property: 'borderRight',
|
|
1239
|
+
scale: 'borders',
|
|
1240
|
+
transform: borderShorthand
|
|
1241
|
+
},
|
|
1242
|
+
borderBottom: {
|
|
1243
|
+
property: 'borderBottom',
|
|
1244
|
+
scale: 'borders',
|
|
1245
|
+
transform: borderShorthand
|
|
1246
|
+
},
|
|
1247
|
+
borderLeft: {
|
|
1248
|
+
property: 'borderLeft',
|
|
1249
|
+
scale: 'borders',
|
|
1250
|
+
transform: borderShorthand
|
|
1251
|
+
},
|
|
1252
|
+
// Width
|
|
1253
|
+
borderWidth: {
|
|
1254
|
+
property: 'borderWidth'
|
|
1255
|
+
},
|
|
1256
|
+
borderWidthX: {
|
|
1257
|
+
property: 'borderWidth',
|
|
1258
|
+
properties: ['borderLeftWidth', 'borderRightWidth']
|
|
1259
|
+
},
|
|
1260
|
+
borderWidthY: {
|
|
1261
|
+
property: 'borderWidth',
|
|
1262
|
+
properties: ['borderTopWidth', 'borderBottomWidth']
|
|
1263
|
+
},
|
|
1264
|
+
borderWidthLeft: {
|
|
1265
|
+
property: 'borderLeftWidth'
|
|
1266
|
+
},
|
|
1267
|
+
borderWidthRight: {
|
|
1268
|
+
property: 'borderRightWidth'
|
|
1269
|
+
},
|
|
1270
|
+
borderWidthTop: {
|
|
1271
|
+
property: 'borderTopWidth'
|
|
1272
|
+
},
|
|
1273
|
+
borderWidthBottom: {
|
|
1274
|
+
property: 'borderBottomWidth'
|
|
1275
|
+
},
|
|
1276
|
+
// Radius
|
|
1277
|
+
borderRadius: {
|
|
1278
|
+
property: 'borderRadius',
|
|
1279
|
+
scale: 'radii',
|
|
1280
|
+
transform: numberToPx
|
|
1281
|
+
},
|
|
1282
|
+
borderRadiusLeft: {
|
|
1283
|
+
property: 'borderRadius',
|
|
1284
|
+
properties: ['borderTopLeftRadius', 'borderBottomLeftRadius'],
|
|
1285
|
+
scale: 'radii',
|
|
1286
|
+
transform: numberToPx
|
|
1287
|
+
},
|
|
1288
|
+
borderRadiusTop: {
|
|
1289
|
+
property: 'borderRadius',
|
|
1290
|
+
properties: ['borderTopLeftRadius', 'borderTopRightRadius'],
|
|
1291
|
+
scale: 'radii',
|
|
1292
|
+
transform: numberToPx
|
|
1293
|
+
},
|
|
1294
|
+
borderRadiusBottom: {
|
|
1295
|
+
property: 'borderRadius',
|
|
1296
|
+
properties: ['borderBottomLeftRadius', 'borderBottomRightRadius'],
|
|
1297
|
+
scale: 'radii',
|
|
1298
|
+
transform: numberToPx
|
|
1299
|
+
},
|
|
1300
|
+
borderRadiusRight: {
|
|
1301
|
+
property: 'borderRadius',
|
|
1302
|
+
properties: ['borderTopRightRadius', 'borderBottomRightRadius'],
|
|
1303
|
+
scale: 'radii',
|
|
1304
|
+
transform: numberToPx
|
|
1305
|
+
},
|
|
1306
|
+
borderRadiusTopLeft: {
|
|
1307
|
+
property: 'borderTopLeftRadius',
|
|
1308
|
+
scale: 'radii',
|
|
1309
|
+
transform: numberToPx
|
|
1310
|
+
},
|
|
1311
|
+
borderRadiusTopRight: {
|
|
1312
|
+
property: 'borderTopRightRadius',
|
|
1313
|
+
scale: 'radii',
|
|
1314
|
+
transform: numberToPx
|
|
1315
|
+
},
|
|
1316
|
+
borderRadiusBottomRight: {
|
|
1317
|
+
property: 'borderBottomRightRadius',
|
|
1318
|
+
scale: 'radii',
|
|
1319
|
+
transform: numberToPx
|
|
1320
|
+
},
|
|
1321
|
+
borderRadiusBottomLeft: {
|
|
1322
|
+
property: 'borderBottomLeftRadius',
|
|
1323
|
+
scale: 'radii',
|
|
1324
|
+
transform: numberToPx
|
|
1325
|
+
},
|
|
1326
|
+
// Style
|
|
1327
|
+
borderStyle: {
|
|
1328
|
+
property: 'borderStyle'
|
|
1329
|
+
},
|
|
1330
|
+
borderStyleX: {
|
|
1331
|
+
property: 'borderStyle',
|
|
1332
|
+
properties: ['borderLeftStyle', 'borderRightStyle']
|
|
1333
|
+
},
|
|
1334
|
+
borderStyleY: {
|
|
1335
|
+
property: 'borderStyle',
|
|
1336
|
+
properties: ['borderTopStyle', 'borderBottomStyle']
|
|
1337
|
+
},
|
|
1338
|
+
borderStyleLeft: {
|
|
1339
|
+
property: 'borderLeftStyle'
|
|
1340
|
+
},
|
|
1341
|
+
borderStyleRight: {
|
|
1342
|
+
property: 'borderRightStyle'
|
|
1343
|
+
},
|
|
1344
|
+
borderStyleTop: {
|
|
1345
|
+
property: 'borderTopStyle'
|
|
1346
|
+
},
|
|
1347
|
+
borderStyleBottom: {
|
|
1348
|
+
property: 'borderBottomStyle'
|
|
1349
|
+
}
|
|
1350
|
+
};
|
|
1351
|
+
var gaps = {
|
|
1352
|
+
gap: {
|
|
1353
|
+
property: 'gap',
|
|
1354
|
+
scale: 'spacing'
|
|
1355
|
+
},
|
|
1356
|
+
rowGap: {
|
|
1357
|
+
property: 'rowGap',
|
|
1358
|
+
scale: 'spacing'
|
|
1359
|
+
},
|
|
1360
|
+
columnGap: {
|
|
1361
|
+
property: 'columnGap',
|
|
1362
|
+
scale: 'spacing'
|
|
1363
|
+
}
|
|
1364
|
+
};
|
|
1365
|
+
var selfAlignments = {
|
|
1366
|
+
justifySelf: {
|
|
1367
|
+
property: 'justifySelf'
|
|
1368
|
+
},
|
|
1369
|
+
alignSelf: {
|
|
1370
|
+
property: 'alignSelf'
|
|
1371
|
+
},
|
|
1372
|
+
gridArea: {
|
|
1373
|
+
property: 'gridArea'
|
|
1374
|
+
},
|
|
1375
|
+
area: {
|
|
1376
|
+
property: 'gridArea'
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
|
|
1380
|
+
var alignments = _objectSpread2({
|
|
1381
|
+
justifyContent: {
|
|
1382
|
+
property: 'justifyContent'
|
|
1383
|
+
},
|
|
1384
|
+
justifyItems: {
|
|
1385
|
+
property: 'justifyItems'
|
|
1386
|
+
},
|
|
1387
|
+
alignItems: {
|
|
1388
|
+
property: 'alignItems'
|
|
1389
|
+
},
|
|
1390
|
+
alignContent: {
|
|
1391
|
+
property: 'alignContent'
|
|
1392
|
+
}
|
|
1393
|
+
}, selfAlignments);
|
|
1394
|
+
|
|
1395
|
+
var flexItems = {
|
|
1396
|
+
flexBasis: {
|
|
1397
|
+
property: 'flexBasis'
|
|
1398
|
+
},
|
|
1399
|
+
flexShrink: {
|
|
1400
|
+
property: 'flexShrink'
|
|
1401
|
+
},
|
|
1402
|
+
flexGrow: {
|
|
1403
|
+
property: 'flexGrow'
|
|
1404
|
+
},
|
|
1405
|
+
order: {
|
|
1406
|
+
property: 'order'
|
|
1407
|
+
}
|
|
1408
|
+
};
|
|
1409
|
+
var flex = _objectSpread2(_objectSpread2(_objectSpread2({
|
|
1410
|
+
flexDirection: {
|
|
1411
|
+
property: 'flexDirection'
|
|
1412
|
+
},
|
|
1413
|
+
flexWrap: {
|
|
1414
|
+
property: 'flexWrap'
|
|
1415
|
+
},
|
|
1416
|
+
flex: {
|
|
1417
|
+
property: 'flex'
|
|
1418
|
+
}
|
|
1419
|
+
}, alignments), flexItems), gaps);
|
|
1420
|
+
var gridItems = {
|
|
1421
|
+
gridColumn: {
|
|
1422
|
+
property: 'gridColumn'
|
|
1423
|
+
},
|
|
1424
|
+
gridRow: {
|
|
1425
|
+
property: 'gridRow'
|
|
1426
|
+
},
|
|
1427
|
+
gridColumnStart: {
|
|
1428
|
+
property: 'gridColumnStart'
|
|
1429
|
+
},
|
|
1430
|
+
gridRowStart: {
|
|
1431
|
+
property: 'gridRowStart'
|
|
1432
|
+
},
|
|
1433
|
+
gridColumnEnd: {
|
|
1434
|
+
property: 'gridColumnEnd'
|
|
1435
|
+
},
|
|
1436
|
+
gridRowEnd: {
|
|
1437
|
+
property: 'gridRowEnd'
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1440
|
+
var grid = _objectSpread2(_objectSpread2(_objectSpread2({
|
|
1441
|
+
gridAutoColumns: {
|
|
1442
|
+
property: 'gridAutoColumns'
|
|
1443
|
+
},
|
|
1444
|
+
gridAutoRows: {
|
|
1445
|
+
property: 'gridAutoRows'
|
|
1446
|
+
},
|
|
1447
|
+
gridTemplateColumns: {
|
|
1448
|
+
property: 'gridTemplateColumns'
|
|
1449
|
+
},
|
|
1450
|
+
gridTemplateRows: {
|
|
1451
|
+
property: 'gridTemplateRows'
|
|
1452
|
+
},
|
|
1453
|
+
gridTemplateAreas: {
|
|
1454
|
+
property: 'gridTemplateAreas'
|
|
1455
|
+
},
|
|
1456
|
+
gridAutoFlow: {
|
|
1457
|
+
property: 'gridAutoFlow'
|
|
1458
|
+
},
|
|
1459
|
+
flow: {
|
|
1460
|
+
property: 'gridAutoFlow',
|
|
1461
|
+
scale: createScale()
|
|
1462
|
+
},
|
|
1463
|
+
cols: {
|
|
1464
|
+
property: 'gridTemplateColumns',
|
|
1465
|
+
transform: gridItemRatio,
|
|
1466
|
+
scale: createScale()
|
|
1467
|
+
},
|
|
1468
|
+
rows: {
|
|
1469
|
+
property: 'gridTemplateRows',
|
|
1470
|
+
transform: gridItemRatio,
|
|
1471
|
+
scale: createScale()
|
|
1472
|
+
},
|
|
1473
|
+
autoRows: {
|
|
1474
|
+
property: 'gridAutoRows',
|
|
1475
|
+
transform: gridItem
|
|
1476
|
+
},
|
|
1477
|
+
autoCols: {
|
|
1478
|
+
property: 'gridAutoColumns',
|
|
1479
|
+
transform: gridItem
|
|
1480
|
+
},
|
|
1481
|
+
alignAll: {
|
|
1482
|
+
property: 'justifyContent',
|
|
1483
|
+
properties: ['justifyContent', 'alignItems']
|
|
1484
|
+
}
|
|
1485
|
+
}, alignments), gridItems), gaps);
|
|
1486
|
+
var background = {
|
|
1487
|
+
background: {
|
|
1488
|
+
property: 'background'
|
|
1489
|
+
},
|
|
1490
|
+
backgroundImage: {
|
|
1491
|
+
property: 'backgroundImage'
|
|
1492
|
+
},
|
|
1493
|
+
backgroundSize: {
|
|
1494
|
+
property: 'backgroundSize'
|
|
1495
|
+
},
|
|
1496
|
+
backgroundRepeat: {
|
|
1497
|
+
property: 'backgroundRepeat'
|
|
1498
|
+
},
|
|
1499
|
+
backgroundPosition: {
|
|
1500
|
+
property: 'backgroundPosition'
|
|
1501
|
+
}
|
|
1502
|
+
};
|
|
1503
|
+
var positioning = {
|
|
1504
|
+
position: {
|
|
1505
|
+
property: 'position'
|
|
1506
|
+
},
|
|
1507
|
+
inset: {
|
|
1508
|
+
property: 'inset',
|
|
1509
|
+
properties: ['top', 'right', 'bottom', 'left'],
|
|
1510
|
+
transform: size
|
|
1511
|
+
},
|
|
1512
|
+
top: {
|
|
1513
|
+
property: 'top',
|
|
1514
|
+
transform: size
|
|
1515
|
+
},
|
|
1516
|
+
right: {
|
|
1517
|
+
property: 'right',
|
|
1518
|
+
transform: size
|
|
1519
|
+
},
|
|
1520
|
+
bottom: {
|
|
1521
|
+
property: 'bottom',
|
|
1522
|
+
transform: size
|
|
1523
|
+
},
|
|
1524
|
+
left: {
|
|
1525
|
+
property: 'left',
|
|
1526
|
+
transform: size
|
|
1527
|
+
},
|
|
1528
|
+
zIndex: {
|
|
1529
|
+
property: 'zIndex'
|
|
1530
|
+
},
|
|
1531
|
+
opacity: {
|
|
1532
|
+
property: 'opacity'
|
|
1533
|
+
}
|
|
1534
|
+
};
|
|
1535
|
+
var shadows = {
|
|
1536
|
+
boxShadow: {
|
|
1537
|
+
property: 'boxShadow'
|
|
1538
|
+
},
|
|
1539
|
+
textShadow: {
|
|
1540
|
+
property: 'textShadow'
|
|
1541
|
+
}
|
|
1542
|
+
};
|
|
1543
|
+
var layout = _objectSpread2(_objectSpread2(_objectSpread2({
|
|
1544
|
+
display: {
|
|
1545
|
+
property: 'display'
|
|
1546
|
+
},
|
|
1547
|
+
overflow: {
|
|
1548
|
+
property: 'overflow'
|
|
1549
|
+
},
|
|
1550
|
+
overflowX: {
|
|
1551
|
+
property: 'overflowX'
|
|
1552
|
+
},
|
|
1553
|
+
overflowY: {
|
|
1554
|
+
property: 'overflowY'
|
|
1555
|
+
},
|
|
1556
|
+
size: {
|
|
1557
|
+
property: 'width',
|
|
1558
|
+
properties: ['width', 'height'],
|
|
1559
|
+
transform: size
|
|
1560
|
+
},
|
|
1561
|
+
width: {
|
|
1562
|
+
property: 'width',
|
|
1563
|
+
transform: size
|
|
1564
|
+
},
|
|
1565
|
+
minWidth: {
|
|
1566
|
+
property: 'minWidth',
|
|
1567
|
+
transform: size
|
|
1568
|
+
},
|
|
1569
|
+
maxWidth: {
|
|
1570
|
+
property: 'maxWidth',
|
|
1571
|
+
transform: size
|
|
1572
|
+
},
|
|
1573
|
+
height: {
|
|
1574
|
+
property: 'height',
|
|
1575
|
+
transform: size
|
|
1576
|
+
},
|
|
1577
|
+
minHeight: {
|
|
1578
|
+
property: 'minHeight',
|
|
1579
|
+
transform: size
|
|
1580
|
+
},
|
|
1581
|
+
maxHeight: {
|
|
1582
|
+
property: 'maxHeight',
|
|
1583
|
+
transform: size
|
|
1584
|
+
},
|
|
1585
|
+
verticalAlign: {
|
|
1586
|
+
property: 'verticalAlign'
|
|
1587
|
+
}
|
|
1588
|
+
}, selfAlignments), gridItems), flexItems);
|
|
1589
|
+
var typography = {
|
|
1590
|
+
fontFamily: {
|
|
1591
|
+
property: 'fontFamily',
|
|
1592
|
+
scale: 'fontFamily'
|
|
1593
|
+
},
|
|
1594
|
+
fontWeight: {
|
|
1595
|
+
property: 'fontWeight',
|
|
1596
|
+
scale: 'fontWeight'
|
|
1597
|
+
},
|
|
1598
|
+
lineHeight: {
|
|
1599
|
+
property: 'lineHeight',
|
|
1600
|
+
scale: 'lineHeight',
|
|
1601
|
+
lineHeight: 'lineHeight'
|
|
1602
|
+
},
|
|
1603
|
+
fontSize: {
|
|
1604
|
+
property: 'fontSize',
|
|
1605
|
+
scale: 'fontSize'
|
|
1606
|
+
},
|
|
1607
|
+
letterSpacing: {
|
|
1608
|
+
property: 'letterSpacing'
|
|
1609
|
+
},
|
|
1610
|
+
textAlign: {
|
|
1611
|
+
property: 'textAlign'
|
|
1612
|
+
},
|
|
1613
|
+
fontStyle: {
|
|
1614
|
+
property: 'fontStyle'
|
|
1615
|
+
},
|
|
1616
|
+
textDecoration: {
|
|
1617
|
+
property: 'textDecoration'
|
|
1618
|
+
},
|
|
1619
|
+
textTransform: {
|
|
1620
|
+
property: 'textTransform'
|
|
1621
|
+
},
|
|
1622
|
+
whiteSpace: {
|
|
1623
|
+
property: 'whiteSpace'
|
|
1624
|
+
}
|
|
1625
|
+
};
|
|
1626
|
+
var margin = {
|
|
1627
|
+
m: {
|
|
1628
|
+
property: 'margin',
|
|
1629
|
+
scale: 'spacing'
|
|
1630
|
+
},
|
|
1631
|
+
mx: {
|
|
1632
|
+
property: 'margin',
|
|
1633
|
+
properties: ['marginLeft', 'marginRight'],
|
|
1634
|
+
scale: 'spacing'
|
|
1635
|
+
},
|
|
1636
|
+
my: {
|
|
1637
|
+
property: 'margin',
|
|
1638
|
+
properties: ['marginTop', 'marginBottom'],
|
|
1639
|
+
scale: 'spacing'
|
|
1640
|
+
},
|
|
1641
|
+
mt: {
|
|
1642
|
+
property: 'marginTop',
|
|
1643
|
+
scale: 'spacing'
|
|
1644
|
+
},
|
|
1645
|
+
mb: {
|
|
1646
|
+
property: 'marginBottom',
|
|
1647
|
+
scale: 'spacing'
|
|
1648
|
+
},
|
|
1649
|
+
mr: {
|
|
1650
|
+
property: 'marginRight',
|
|
1651
|
+
scale: 'spacing'
|
|
1652
|
+
},
|
|
1653
|
+
ml: {
|
|
1654
|
+
property: 'marginLeft',
|
|
1655
|
+
scale: 'spacing'
|
|
1656
|
+
}
|
|
1657
|
+
};
|
|
1658
|
+
var padding = {
|
|
1659
|
+
p: {
|
|
1660
|
+
property: 'padding',
|
|
1661
|
+
scale: 'spacing'
|
|
1662
|
+
},
|
|
1663
|
+
px: {
|
|
1664
|
+
property: 'padding',
|
|
1665
|
+
properties: ['paddingLeft', 'paddingRight'],
|
|
1666
|
+
scale: 'spacing'
|
|
1667
|
+
},
|
|
1668
|
+
py: {
|
|
1669
|
+
property: 'padding',
|
|
1670
|
+
properties: ['paddingTop', 'paddingBottom'],
|
|
1671
|
+
scale: 'spacing'
|
|
1672
|
+
},
|
|
1673
|
+
pt: {
|
|
1674
|
+
property: 'paddingTop',
|
|
1675
|
+
scale: 'spacing'
|
|
1676
|
+
},
|
|
1677
|
+
pb: {
|
|
1678
|
+
property: 'paddingBottom',
|
|
1679
|
+
scale: 'spacing'
|
|
1680
|
+
},
|
|
1681
|
+
pr: {
|
|
1682
|
+
property: 'paddingRight',
|
|
1683
|
+
scale: 'spacing'
|
|
1684
|
+
},
|
|
1685
|
+
pl: {
|
|
1686
|
+
property: 'paddingLeft',
|
|
1687
|
+
scale: 'spacing'
|
|
1688
|
+
}
|
|
1689
|
+
};
|
|
1690
|
+
var space = _objectSpread2(_objectSpread2({}, margin), padding);
|
|
1691
|
+
var mode = {
|
|
1692
|
+
mode: {
|
|
1693
|
+
property: 'none',
|
|
1694
|
+
scale: 'mode'
|
|
1695
|
+
}
|
|
1696
|
+
};
|
|
1697
|
+
var vars = {
|
|
1698
|
+
vars: {
|
|
1699
|
+
property: 'variables'
|
|
1700
|
+
}
|
|
1701
|
+
};
|
|
1702
|
+
var config = createAnimus().addGroup('flex', flex).addGroup('grid', grid).addGroup('mode', mode).addGroup('vars', vars).addGroup('space', space).addGroup('color', color).addGroup('layout', layout).addGroup('borders', border).addGroup('shadows', shadows).addGroup('background', background).addGroup('typography', typography).addGroup('positioning', positioning);
|
|
1703
|
+
config.build();
|
|
1704
|
+
|
|
1705
|
+
var _excluded = ["_"];
|
|
1706
|
+
var BREAKPOINT_KEYS = ['_', 'xs', 'sm', 'md', 'lg', 'xl'];
|
|
943
1707
|
/**
|
|
944
1708
|
* Destructures the themes breakpoints into an ordered structure to traverse
|
|
945
|
-
*/
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1709
|
+
*/
|
|
1710
|
+
|
|
1711
|
+
var templateMediaQuery = function templateMediaQuery(breakpoint) {
|
|
1712
|
+
return "@media screen and (min-width: ".concat(breakpoint, "px)");
|
|
1713
|
+
};
|
|
1714
|
+
|
|
1715
|
+
var createMediaQueries = function createMediaQueries(breakpoints) {
|
|
1716
|
+
if (breakpoints === undefined) return null;
|
|
1717
|
+
|
|
1718
|
+
var _ref = breakpoints !== null && breakpoints !== void 0 ? breakpoints : {},
|
|
1719
|
+
xs = _ref.xs,
|
|
1720
|
+
sm = _ref.sm,
|
|
1721
|
+
md = _ref.md,
|
|
1722
|
+
lg = _ref.lg,
|
|
1723
|
+
xl = _ref.xl; // Ensure order for mapping
|
|
1724
|
+
|
|
1725
|
+
|
|
1726
|
+
return {
|
|
1727
|
+
map: mapValues(breakpoints, templateMediaQuery),
|
|
1728
|
+
array: [xs, sm, md, lg, xl].map(templateMediaQuery)
|
|
1729
|
+
};
|
|
1730
|
+
};
|
|
1731
|
+
var isMediaArray = function isMediaArray(val) {
|
|
1732
|
+
return Array.isArray(val);
|
|
1733
|
+
};
|
|
1734
|
+
var isMediaMap = function isMediaMap(val) {
|
|
1735
|
+
return intersection(Object.keys(val), BREAKPOINT_KEYS).length > 0;
|
|
1736
|
+
};
|
|
1737
|
+
var objectParser = function objectParser(value, props, config, breakpoints) {
|
|
1738
|
+
var styles = {};
|
|
1739
|
+
var styleFn = config.styleFn,
|
|
1740
|
+
prop = config.prop;
|
|
1741
|
+
|
|
1742
|
+
var _ = value._,
|
|
1743
|
+
rest = _objectWithoutProperties(value, _excluded); // the keyof 'base' is base styles
|
|
1744
|
+
|
|
1745
|
+
|
|
1746
|
+
if (_) Object.assign(styles, styleFn(_, prop, props)); // Map over remaining keys and merge the corresponding breakpoint styles
|
|
1747
|
+
// for that property.
|
|
1748
|
+
|
|
1749
|
+
Object.keys(breakpoints).forEach(function (breakpointKey) {
|
|
1750
|
+
var bpStyles = rest[breakpointKey];
|
|
1751
|
+
if (typeof bpStyles === 'undefined') return;
|
|
1752
|
+
Object.assign(styles, _defineProperty({}, breakpoints[breakpointKey], styleFn(bpStyles, prop, props)));
|
|
1753
|
+
});
|
|
1754
|
+
return styles;
|
|
1755
|
+
};
|
|
1756
|
+
var arrayParser = function arrayParser(value, props, config, breakpoints) {
|
|
1757
|
+
var styles = {};
|
|
1758
|
+
var styleFn = config.styleFn,
|
|
1759
|
+
prop = config.prop;
|
|
1760
|
+
|
|
1761
|
+
var _value = _toArray(value),
|
|
1762
|
+
_ = _value[0],
|
|
1763
|
+
rest = _value.slice(1); // the first index is base styles
|
|
1764
|
+
|
|
1765
|
+
|
|
1766
|
+
if (_) Object.assign(styles, styleFn(_, prop, props)); // Map over each value in the array and merge the corresponding breakpoint styles
|
|
1767
|
+
// for that property.
|
|
1768
|
+
|
|
1769
|
+
rest.forEach(function (val, i) {
|
|
1770
|
+
var breakpointKey = breakpoints[i];
|
|
1771
|
+
if (!breakpointKey || typeof val === 'undefined') return;
|
|
1772
|
+
Object.assign(styles, _defineProperty({}, breakpointKey, styleFn(val, prop, props)));
|
|
1773
|
+
});
|
|
1774
|
+
return styles;
|
|
1775
|
+
};
|
|
1776
|
+
var orderBreakpoints = function orderBreakpoints(styles, breakpoints) {
|
|
1777
|
+
var orderedStyles = omit(styles, breakpoints);
|
|
1778
|
+
breakpoints.forEach(function (bp) {
|
|
1779
|
+
if (styles[bp]) {
|
|
1780
|
+
orderedStyles[bp] = styles[bp];
|
|
1781
|
+
}
|
|
1782
|
+
});
|
|
1783
|
+
return orderedStyles;
|
|
1005
1784
|
};
|
|
1006
1785
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1786
|
+
var renderPropValue = function renderPropValue(styles, prop, props, property, ctx) {
|
|
1787
|
+
var value = get(props, prop);
|
|
1788
|
+
|
|
1789
|
+
switch (_typeof(value)) {
|
|
1790
|
+
case 'string':
|
|
1791
|
+
case 'number':
|
|
1792
|
+
case 'function':
|
|
1793
|
+
return Object.assign(styles, property.styleFn(value, prop, props));
|
|
1794
|
+
// handle any props configured with the responsive notation
|
|
1795
|
+
|
|
1796
|
+
case 'object':
|
|
1797
|
+
if (!ctx.mediaQueries) {
|
|
1798
|
+
return;
|
|
1799
|
+
} // If it is an array the order of values is smallest to largest: [_, xs, ...]
|
|
1800
|
+
|
|
1801
|
+
|
|
1802
|
+
if (isMediaArray(value)) {
|
|
1803
|
+
return merge(styles, arrayParser(value, props, property, ctx.mediaQueries.array));
|
|
1804
|
+
} // Check to see if value is an object matching the responsive syntax and generate the styles.
|
|
1805
|
+
|
|
1806
|
+
|
|
1807
|
+
if (value && isMediaMap(value)) {
|
|
1808
|
+
return merge(styles, objectParser(value, props, property, ctx.mediaQueries.map));
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1813
|
+
|
|
1814
|
+
function createParser(config) {
|
|
1815
|
+
var propNames = orderPropNames(config);
|
|
1816
|
+
var ctx = {
|
|
1817
|
+
mediaQueries: null
|
|
1818
|
+
};
|
|
1819
|
+
|
|
1820
|
+
var parser = function parser(props) {
|
|
1821
|
+
var isCss = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1822
|
+
var styles = {};
|
|
1823
|
+
var theme = props.theme; // Attempt to cache the breakpoints if we have not yet or if theme has become available.
|
|
1824
|
+
|
|
1825
|
+
if (ctx.mediaQueries === null) {
|
|
1826
|
+
var _theme$breakpoints;
|
|
1827
|
+
|
|
1828
|
+
// Save the breakpoints if we can
|
|
1829
|
+
ctx.mediaQueries = createMediaQueries((_theme$breakpoints = theme === null || theme === void 0 ? void 0 : theme.breakpoints) !== null && _theme$breakpoints !== void 0 ? _theme$breakpoints : compatTheme.breakpoints);
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
if (!isCss) {
|
|
1833
|
+
// Loops over all prop names on the configured config to check for configured styles
|
|
1834
|
+
propNames.forEach(function (prop) {
|
|
1835
|
+
var property = config[prop];
|
|
1836
|
+
renderPropValue(styles, prop, props, property, ctx);
|
|
1837
|
+
});
|
|
1838
|
+
} else {
|
|
1839
|
+
// Loops over all prop names on the configured config to check for configured styles
|
|
1840
|
+
Object.keys(props).forEach(function (prop) {
|
|
1841
|
+
var property = config[prop];
|
|
1842
|
+
|
|
1843
|
+
if (property) {
|
|
1844
|
+
renderPropValue(styles, prop, props, property, ctx);
|
|
1845
|
+
} else if (prop !== 'theme') {
|
|
1846
|
+
Object.assign(styles, _defineProperty({}, prop, get(props, prop)));
|
|
1847
|
+
}
|
|
1848
|
+
});
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
if (ctx.mediaQueries !== null) return orderBreakpoints(styles, ctx.mediaQueries.array);
|
|
1852
|
+
return styles;
|
|
1853
|
+
}; // return the parser function with the resulting meta information for further composition
|
|
1854
|
+
|
|
1855
|
+
|
|
1856
|
+
return Object.assign(parser, {
|
|
1857
|
+
propNames: propNames,
|
|
1858
|
+
config: config
|
|
1859
|
+
});
|
|
1067
1860
|
}
|
|
1068
1861
|
|
|
1069
|
-
function
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
if (isUndefined(value)) {
|
|
1078
|
-
return styles;
|
|
1079
|
-
}
|
|
1080
|
-
let useTransform = false;
|
|
1081
|
-
let intermediateValue;
|
|
1082
|
-
let scaleValue;
|
|
1083
|
-
switch (typeof value) {
|
|
1084
|
-
case 'number':
|
|
1085
|
-
case 'string':
|
|
1086
|
-
scaleValue = lookupScaleValue(value, scale, props.theme);
|
|
1087
|
-
useTransform = scaleValue !== undefined || alwaysTransform;
|
|
1088
|
-
intermediateValue = scaleValue ?? value;
|
|
1089
|
-
break;
|
|
1090
|
-
case 'function':
|
|
1091
|
-
if (props.theme) {
|
|
1092
|
-
intermediateValue = value(props.theme);
|
|
1093
|
-
}
|
|
1094
|
-
break;
|
|
1095
|
-
default:
|
|
1096
|
-
return styles;
|
|
1097
|
-
}
|
|
1098
|
-
// for each property look up the scale value from theme if passed and apply any
|
|
1099
|
-
// final transforms to the value
|
|
1100
|
-
properties.forEach((property) => {
|
|
1101
|
-
let styleValue = intermediateValue;
|
|
1102
|
-
if (useTransform && !isUndefined(styleValue)) {
|
|
1103
|
-
styleValue = transform(styleValue, property, props);
|
|
1104
|
-
}
|
|
1105
|
-
switch (typeof styleValue) {
|
|
1106
|
-
case 'number':
|
|
1107
|
-
case 'string':
|
|
1108
|
-
return (styles[property] = styleValue);
|
|
1109
|
-
case 'object':
|
|
1110
|
-
return Object.assign(styles, styleValue);
|
|
1111
|
-
}
|
|
1112
|
-
});
|
|
1113
|
-
if (variable) {
|
|
1114
|
-
let styleValue = intermediateValue;
|
|
1115
|
-
if (useTransform && !isUndefined(styleValue)) {
|
|
1116
|
-
styleValue = transform(styleValue, property, props);
|
|
1117
|
-
}
|
|
1118
|
-
if (styleValue && typeof styleValue !== 'object') {
|
|
1119
|
-
styles[variable] = styleValue;
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
// return the resulting styles object
|
|
1123
|
-
return styles;
|
|
1124
|
-
},
|
|
1125
|
-
};
|
|
1862
|
+
function compose() {
|
|
1863
|
+
for (var _len = arguments.length, parsers = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1864
|
+
parsers[_key] = arguments[_key];
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
return createParser(parsers.reduce(function (carry, parser) {
|
|
1868
|
+
return _objectSpread2(_objectSpread2({}, carry), parser.config);
|
|
1869
|
+
}, {}));
|
|
1126
1870
|
}
|
|
1127
1871
|
|
|
1128
|
-
function
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1872
|
+
function createTransform(prop, config) {
|
|
1873
|
+
var _config$transform = config.transform,
|
|
1874
|
+
transform = _config$transform === void 0 ? identity : _config$transform,
|
|
1875
|
+
property = config.property,
|
|
1876
|
+
_config$properties = config.properties,
|
|
1877
|
+
properties = _config$properties === void 0 ? [property] : _config$properties,
|
|
1878
|
+
scale = config.scale,
|
|
1879
|
+
variable = config.variable;
|
|
1880
|
+
var alwaysTransform = scale === undefined || isArray(scale);
|
|
1881
|
+
return _objectSpread2(_objectSpread2({}, config), {}, {
|
|
1882
|
+
prop: prop,
|
|
1883
|
+
styleFn: function styleFn(value, prop, props) {
|
|
1884
|
+
var _scaleValue;
|
|
1885
|
+
|
|
1886
|
+
var styles = {};
|
|
1887
|
+
|
|
1888
|
+
if (isUndefined(value)) {
|
|
1889
|
+
return styles;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
var useTransform = false;
|
|
1893
|
+
var intermediateValue;
|
|
1894
|
+
var scaleValue;
|
|
1895
|
+
|
|
1896
|
+
switch (_typeof(value)) {
|
|
1897
|
+
case 'number':
|
|
1898
|
+
case 'string':
|
|
1899
|
+
scaleValue = lookupScaleValue(value, scale, props.theme);
|
|
1900
|
+
useTransform = scaleValue !== undefined || alwaysTransform;
|
|
1901
|
+
intermediateValue = (_scaleValue = scaleValue) !== null && _scaleValue !== void 0 ? _scaleValue : value;
|
|
1902
|
+
break;
|
|
1903
|
+
|
|
1904
|
+
case 'function':
|
|
1905
|
+
if (props.theme) {
|
|
1906
|
+
intermediateValue = value(props.theme);
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
break;
|
|
1910
|
+
|
|
1911
|
+
default:
|
|
1912
|
+
return styles;
|
|
1913
|
+
} // for each property look up the scale value from theme if passed and apply any
|
|
1914
|
+
// final transforms to the value
|
|
1915
|
+
|
|
1916
|
+
|
|
1917
|
+
properties.forEach(function (property) {
|
|
1918
|
+
var styleValue = intermediateValue;
|
|
1919
|
+
|
|
1920
|
+
if (useTransform && !isUndefined(styleValue)) {
|
|
1921
|
+
styleValue = transform(styleValue, property, props);
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
switch (_typeof(styleValue)) {
|
|
1925
|
+
case 'number':
|
|
1926
|
+
case 'string':
|
|
1927
|
+
return styles[property] = styleValue;
|
|
1928
|
+
|
|
1929
|
+
case 'object':
|
|
1930
|
+
return Object.assign(styles, styleValue);
|
|
1931
|
+
}
|
|
1932
|
+
});
|
|
1933
|
+
|
|
1934
|
+
if (variable) {
|
|
1935
|
+
var styleValue = intermediateValue;
|
|
1936
|
+
|
|
1937
|
+
if (useTransform && !isUndefined(styleValue)) {
|
|
1938
|
+
styleValue = transform(styleValue, property, props);
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
if (styleValue && _typeof(styleValue) !== 'object') {
|
|
1942
|
+
styles[variable] = styleValue;
|
|
1943
|
+
}
|
|
1944
|
+
} // return the resulting styles object
|
|
1945
|
+
|
|
1946
|
+
|
|
1947
|
+
return styles;
|
|
1948
|
+
}
|
|
1949
|
+
});
|
|
1138
1950
|
}
|
|
1139
1951
|
|
|
1140
|
-
function
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
...filteredProps,
|
|
1153
|
-
]);
|
|
1154
|
-
return ({ theme }) => {
|
|
1155
|
-
if (cache)
|
|
1156
|
-
return cache;
|
|
1157
|
-
const css = parser({ ...cssProps, theme });
|
|
1158
|
-
selectors.forEach((selector) => {
|
|
1159
|
-
const selectorConfig = cssProps[selector] ?? {};
|
|
1160
|
-
css[selector] = {
|
|
1161
|
-
...getStylePropNames(selectorConfig, filteredProps),
|
|
1162
|
-
...parser({ ...selectorConfig, theme }),
|
|
1163
|
-
};
|
|
1164
|
-
});
|
|
1165
|
-
/** Merge the static and generated css and save it to the cache */
|
|
1166
|
-
cache = {
|
|
1167
|
-
...staticCss,
|
|
1168
|
-
...css,
|
|
1169
|
-
};
|
|
1170
|
-
return cache;
|
|
1171
|
-
};
|
|
1172
|
-
};
|
|
1952
|
+
function create(config) {
|
|
1953
|
+
// Create a transform function for each of the props
|
|
1954
|
+
var transforms = {};
|
|
1955
|
+
|
|
1956
|
+
for (var prop in config) {
|
|
1957
|
+
if (typeof prop === 'string') {
|
|
1958
|
+
transforms[prop] = createTransform(prop, config[prop]);
|
|
1959
|
+
}
|
|
1960
|
+
} // Create a parser that handles all the props within the config
|
|
1961
|
+
|
|
1962
|
+
|
|
1963
|
+
return createParser(transforms);
|
|
1173
1964
|
}
|
|
1174
1965
|
|
|
1175
|
-
function
|
|
1176
|
-
|
|
1177
|
-
return (
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1966
|
+
var getStylePropNames = function getStylePropNames(props, filteredKeys) {
|
|
1967
|
+
return pick(props, keys(props).filter(function (key) {
|
|
1968
|
+
return !filteredKeys.includes(key);
|
|
1969
|
+
}));
|
|
1970
|
+
};
|
|
1971
|
+
|
|
1972
|
+
function createCss(config) {
|
|
1973
|
+
var parser = create(config);
|
|
1974
|
+
var filteredProps = parser.propNames;
|
|
1975
|
+
return function (cssProps) {
|
|
1976
|
+
var cache;
|
|
1977
|
+
var allKeys = Object.keys(cssProps);
|
|
1978
|
+
/** Any key of the CSSProps that is not a System Prop or a Static CSS Property is treated as a nested selector */
|
|
1979
|
+
|
|
1980
|
+
var selectors = allKeys.filter(function (key) {
|
|
1981
|
+
return !filteredProps.includes(key) && isObject(cssProps[key]);
|
|
1982
|
+
});
|
|
1983
|
+
/** Static CSS Properties get extracted if they match neither syntax */
|
|
1984
|
+
|
|
1985
|
+
var staticCss = getStylePropNames(cssProps, ['theme'].concat(_toConsumableArray(selectors), _toConsumableArray(filteredProps)));
|
|
1986
|
+
return function (_ref) {
|
|
1987
|
+
var theme = _ref.theme;
|
|
1988
|
+
if (cache) return cache;
|
|
1989
|
+
var css = parser(_objectSpread2(_objectSpread2({}, cssProps), {}, {
|
|
1990
|
+
theme: theme
|
|
1991
|
+
}));
|
|
1992
|
+
selectors.forEach(function (selector) {
|
|
1993
|
+
var _cssProps$selector;
|
|
1994
|
+
|
|
1995
|
+
var selectorConfig = (_cssProps$selector = cssProps[selector]) !== null && _cssProps$selector !== void 0 ? _cssProps$selector : {};
|
|
1996
|
+
css[selector] = _objectSpread2(_objectSpread2({}, getStylePropNames(selectorConfig, filteredProps)), parser(_objectSpread2(_objectSpread2({}, selectorConfig), {}, {
|
|
1997
|
+
theme: theme
|
|
1998
|
+
})));
|
|
1999
|
+
});
|
|
2000
|
+
/** Merge the static and generated css and save it to the cache */
|
|
2001
|
+
|
|
2002
|
+
cache = _objectSpread2(_objectSpread2({}, staticCss), css);
|
|
2003
|
+
return cache;
|
|
2004
|
+
};
|
|
2005
|
+
};
|
|
1193
2006
|
}
|
|
1194
2007
|
|
|
1195
|
-
function
|
|
1196
|
-
|
|
2008
|
+
function createStates(config) {
|
|
2009
|
+
var css = createCss(config);
|
|
2010
|
+
return function (states) {
|
|
2011
|
+
var orderedStates = Object.keys(states);
|
|
2012
|
+
var stateFns = {};
|
|
2013
|
+
orderedStates.forEach(function (key) {
|
|
2014
|
+
var stateKey = key;
|
|
2015
|
+
var cssProps = states[stateKey];
|
|
2016
|
+
stateFns[stateKey] = css(cssProps);
|
|
2017
|
+
});
|
|
2018
|
+
return function (props) {
|
|
2019
|
+
var styles = {};
|
|
2020
|
+
orderedStates.forEach(function (state) {
|
|
2021
|
+
merge(styles, props[state] && stateFns[state](props));
|
|
2022
|
+
});
|
|
2023
|
+
return styles;
|
|
2024
|
+
};
|
|
2025
|
+
};
|
|
1197
2026
|
}
|
|
1198
2027
|
|
|
1199
|
-
function
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
2028
|
+
function createVariant(config) {
|
|
2029
|
+
var css = createCss(config);
|
|
2030
|
+
return function (_ref) {
|
|
2031
|
+
var _ref$prop = _ref.prop,
|
|
2032
|
+
prop = _ref$prop === void 0 ? 'variant' : _ref$prop,
|
|
2033
|
+
defaultVariant = _ref.defaultVariant,
|
|
2034
|
+
_ref$base = _ref.base,
|
|
2035
|
+
base = _ref$base === void 0 ? {} : _ref$base,
|
|
2036
|
+
variants = _ref.variants;
|
|
2037
|
+
var baseFn = css(base);
|
|
2038
|
+
var variantFns = {};
|
|
2039
|
+
Object.keys(variants).forEach(function (key) {
|
|
2040
|
+
var variantKey = key;
|
|
2041
|
+
var cssProps = variants[variantKey];
|
|
2042
|
+
variantFns[variantKey] = css(cssProps);
|
|
2043
|
+
});
|
|
2044
|
+
return function (props) {
|
|
2045
|
+
var _variantFns$selected;
|
|
2046
|
+
|
|
2047
|
+
var _props$prop = props[prop],
|
|
2048
|
+
selected = _props$prop === void 0 ? defaultVariant : _props$prop;
|
|
2049
|
+
var styles = {};
|
|
2050
|
+
if (!selected) return styles;
|
|
2051
|
+
return merge(styles, baseFn(props), variantFns === null || variantFns === void 0 ? void 0 : (_variantFns$selected = variantFns[selected]) === null || _variantFns$selected === void 0 ? void 0 : _variantFns$selected.call(variantFns, props));
|
|
2052
|
+
};
|
|
2053
|
+
};
|
|
1217
2054
|
}
|
|
1218
2055
|
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
2056
|
+
var animusProps = {
|
|
2057
|
+
compose: compose,
|
|
2058
|
+
create: create,
|
|
2059
|
+
createCss: createCss,
|
|
2060
|
+
createVariant: createVariant,
|
|
2061
|
+
createStates: createStates
|
|
1225
2062
|
};
|
|
1226
2063
|
|
|
1227
|
-
|
|
2064
|
+
/** Export full builder */
|
|
2065
|
+
|
|
2066
|
+
var animus = config.build();
|
|
1228
2067
|
|
|
1229
2068
|
export { AnimusConfig, animus, animusProps, borderShorthand, compatTheme, config, createAnimus, createScale, gridItem, gridItemRatio, numberToPx, numberToTemplate, parseGridRatio, percentageOrAbsolute, repeatGridItem, size };
|