@animus-ui/core 0.1.1-beta.13 → 0.1.1-beta.14

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/dist/index.js CHANGED
@@ -1,1229 +1,2068 @@
1
1
  import { isNumber, get, isArray, isObject, isString, isUndefined, identity, mapValues, omit, intersection, merge, pick, isEmpty, set, keys } from 'lodash';
2
- import styled from '@emotion/styled';
3
-
4
- const createScale = () => [];
5
-
6
- const percentageOrAbsolute = (coordinate) => {
7
- if (coordinate === 0) {
8
- return coordinate;
9
- }
10
- if (coordinate <= 1 && coordinate >= -1) {
11
- return `${coordinate * 100}%`;
12
- }
13
- return `${coordinate}px`;
14
- };
15
- const valueWithUnit = /(-?\d*\.?\d+)(%|\w*)/;
16
- const size = (value) => {
17
- if (isNumber(value)) {
18
- return percentageOrAbsolute(value);
19
- }
20
- if (value.includes('calc')) {
21
- return value;
22
- }
23
- const [match, number, unit] = valueWithUnit.exec(value) || [];
24
- if (match === undefined) {
25
- return value;
26
- }
27
- const numericValue = parseFloat(number);
28
- return !unit ? percentageOrAbsolute(numericValue) : `${numericValue}${unit}`;
2
+ import _styled from '@emotion/styled/base';
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
+ }
300
+
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 createScale = function createScale() {
334
+ return [];
29
335
  };
30
336
 
31
- const gridItemMap = {
32
- max: 'max-content',
33
- min: 'min-content',
34
- };
35
- const unitlessNumber = new RegExp(/^[0-9]*$/);
36
- const isUnitlessNumber = (val) => unitlessNumber.test(val);
37
- const gridItem = (item) => {
38
- const template = isUnitlessNumber(item)
39
- ? `${item}fr`
40
- : get(gridItemMap, item, item);
41
- return `minmax(0, ${template})`;
42
- };
43
- const repeatGridItem = (item, count) => {
44
- const template = gridItem(item);
45
- return count > 1 ? `repeat(${count}, ${template})` : template;
46
- };
47
- const parseGridRatio = (val) => {
48
- const items = val.split(':');
49
- let repeated = ['', 0];
50
- let gridStyle = '';
51
- for (let i = 0; i < items.length + 1; i += 1) {
52
- const delimiter = gridStyle.length > 0 ? ' ' : '';
53
- const curr = items[i];
54
- if (repeated?.[0] !== curr) {
55
- if (repeated[0].length)
56
- gridStyle += delimiter + repeatGridItem(...repeated);
57
- if (curr)
58
- repeated = [curr, 1];
59
- }
60
- else {
61
- repeated[1] += 1;
62
- }
63
- }
64
- return gridStyle;
65
- };
66
- const gridItemRatio = (val) => {
67
- return isNumber(val) ? repeatGridItem('1', val) : parseGridRatio(val);
337
+ var percentageOrAbsolute = function percentageOrAbsolute(coordinate) {
338
+ if (coordinate === 0) {
339
+ return coordinate;
340
+ }
341
+
342
+ if (coordinate <= 1 && coordinate >= -1) {
343
+ return "".concat(coordinate * 100, "%");
344
+ }
345
+
346
+ return "".concat(coordinate, "px");
68
347
  };
348
+ var valueWithUnit = /(-?\d*\.?\d+)(%|\w*)/;
349
+ var size = function size(value) {
350
+ if (isNumber(value)) {
351
+ return percentageOrAbsolute(value);
352
+ }
353
+
354
+ if (value.includes('calc')) {
355
+ return value;
356
+ }
357
+
358
+ var _ref = valueWithUnit.exec(value) || [],
359
+ _ref2 = _slicedToArray(_ref, 3),
360
+ match = _ref2[0],
361
+ number = _ref2[1],
362
+ unit = _ref2[2];
69
363
 
70
- const numberToTemplate = (val, template) => (typeof val === 'number' ? template(val) : val);
71
- const numberToPx = (val) => {
72
- return numberToTemplate(val, (pixels) => `${pixels}px`);
364
+ if (match === undefined) {
365
+ return value;
366
+ }
367
+
368
+ var numericValue = parseFloat(number);
369
+ return !unit ? percentageOrAbsolute(numericValue) : "".concat(numericValue).concat(unit);
370
+ };
371
+
372
+ var gridItemMap = {
373
+ max: 'max-content',
374
+ min: 'min-content'
73
375
  };
376
+ var unitlessNumber = new RegExp(/^[0-9]*$/);
74
377
 
75
- const borderShorthand = (val) => {
76
- return numberToTemplate(val, (width) => `${width}px solid currentColor`);
378
+ var isUnitlessNumber = function isUnitlessNumber(val) {
379
+ return unitlessNumber.test(val);
77
380
  };
78
381
 
79
- const compatTheme = {
80
- breakpoints: {
81
- xs: 480,
82
- sm: 768,
83
- md: 1024,
84
- lg: 1200,
85
- xl: 1440,
86
- },
87
- spacing: [0, 4, 8, 12, 16, 24, 32, 40, 48, 64, 96],
88
- fontSize: [64, 44, 34, 26, 22, 20, 18, 16, 14],
89
- lineHeight: {
90
- body: 1.5,
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,
382
+ var gridItem = function gridItem(item) {
383
+ var template = isUnitlessNumber(item) ? "".concat(item, "fr") : get(gridItemMap, item, item);
384
+ return "minmax(0, ".concat(template, ")");
104
385
  };
386
+ var repeatGridItem = function repeatGridItem(item, count) {
387
+ var template = gridItem(item);
388
+ return count > 1 ? "repeat(".concat(count, ", ").concat(template, ")") : template;
389
+ };
390
+ var parseGridRatio = function parseGridRatio(val) {
391
+ var items = val.split(':');
392
+ var repeated = ['', 0];
393
+ var gridStyle = '';
394
+
395
+ for (var i = 0; i < items.length + 1; i += 1) {
396
+ var _repeated;
397
+
398
+ var delimiter = gridStyle.length > 0 ? ' ' : '';
399
+ var curr = items[i];
400
+
401
+ if (((_repeated = repeated) === null || _repeated === void 0 ? void 0 : _repeated[0]) !== curr) {
402
+ if (repeated[0].length) gridStyle += delimiter + repeatGridItem.apply(void 0, _toConsumableArray(repeated));
403
+ if (curr) repeated = [curr, 1];
404
+ } else {
405
+ repeated[1] += 1;
406
+ }
407
+ }
408
+
409
+ return gridStyle;
410
+ };
411
+ var gridItemRatio = function gridItemRatio(val) {
412
+ return isNumber(val) ? repeatGridItem('1', val) : parseGridRatio(val);
413
+ };
414
+
415
+ var numberToTemplate = function numberToTemplate(val, template) {
416
+ return typeof val === 'number' ? template(val) : val;
417
+ };
418
+ var numberToPx = function numberToPx(val) {
419
+ return numberToTemplate(val, function (pixels) {
420
+ return "".concat(pixels, "px");
421
+ });
422
+ };
423
+
424
+ var borderShorthand = function borderShorthand(val) {
425
+ return numberToTemplate(val, function (width) {
426
+ return "".concat(width, "px solid currentColor");
427
+ });
428
+ };
429
+
430
+ var compatTheme = {
431
+ breakpoints: {
432
+ xs: 480,
433
+ sm: 768,
434
+ md: 1024,
435
+ lg: 1200,
436
+ xl: 1440
437
+ },
438
+ spacing: [0, 4, 8, 12, 16, 24, 32, 40, 48, 64, 96],
439
+ fontSize: [64, 44, 34, 26, 22, 20, 18, 16, 14],
440
+ lineHeight: {
441
+ body: 1.5,
442
+ heading: 1
443
+ },
444
+ fontWeight: [400, 600, 700],
445
+ fontFamily: {
446
+ body: 'Verdana, sans-serif',
447
+ heading: 'Verdana, Lato, sans-serif',
448
+ monospace: 'monospace'
449
+ },
450
+ radii: [2, 4, 6, 8],
451
+ borders: [1, 2, 3],
452
+ colors: {},
453
+ modes: {},
454
+ mode: undefined
455
+ };
456
+
457
+ var lookupScaleValue = function lookupScaleValue(val, scale, theme) {
458
+ if (isArray(scale)) {
459
+ return val;
460
+ }
461
+
462
+ if (isObject(scale)) {
463
+ return get(scale, val);
464
+ }
465
+
466
+ if (isString(scale)) {
467
+ var usedScale = get(theme, scale, get(compatTheme, scale));
468
+ if (!usedScale) return undefined;
469
+ return isArray(usedScale) ? val : get(usedScale, val);
470
+ }
471
+
472
+ return undefined;
473
+ };
474
+
475
+ var createPropertyStyle = function createPropertyStyle(value, props, config) {
476
+ var _scaleValue;
477
+
478
+ var styles = {};
479
+ var _config$transform = config.transform,
480
+ transform = _config$transform === void 0 ? identity : _config$transform,
481
+ property = config.property,
482
+ _config$properties = config.properties,
483
+ properties = _config$properties === void 0 ? [property] : _config$properties,
484
+ scale = config.scale,
485
+ variable = config.variable;
486
+ var alwaysTransform = scale === undefined || isArray(scale);
487
+
488
+ if (isUndefined(value)) {
489
+ return styles;
490
+ }
491
+
492
+ var useTransform = false;
493
+ var intermediateValue;
494
+ var scaleValue;
495
+
496
+ switch (_typeof(value)) {
497
+ case 'number':
498
+ case 'string':
499
+ scaleValue = lookupScaleValue(value, scale, props === null || props === void 0 ? void 0 : props.theme);
500
+ useTransform = scaleValue !== undefined || alwaysTransform;
501
+ intermediateValue = (_scaleValue = scaleValue) !== null && _scaleValue !== void 0 ? _scaleValue : value;
502
+ break;
105
503
 
106
- const lookupScaleValue = (val, scale, theme) => {
107
- if (isArray(scale)) {
108
- return val;
109
- }
110
- if (isObject(scale)) {
111
- return get(scale, val);
112
- }
113
- if (isString(scale)) {
114
- const usedScale = get(theme, scale, get(compatTheme, scale));
115
- if (!usedScale)
116
- return undefined;
117
- return isArray(usedScale) ? val : get(usedScale, val);
118
- }
119
- return undefined;
504
+ case 'function':
505
+ if (props.theme) {
506
+ intermediateValue = value(props.theme);
507
+ }
508
+
509
+ break;
510
+
511
+ default:
512
+ return styles;
513
+ } // for each property look up the scale value from theme if passed and apply any
514
+ // final transforms to the value
515
+
516
+
517
+ properties.forEach(function (property) {
518
+ var styleValue = intermediateValue;
519
+
520
+ if (useTransform && !isUndefined(styleValue)) {
521
+ styleValue = transform(styleValue, property, props);
522
+ }
523
+
524
+ switch (_typeof(styleValue)) {
525
+ case 'number':
526
+ case 'string':
527
+ return styles[property] = styleValue;
528
+
529
+ case 'object':
530
+ return Object.assign(styles, styleValue);
531
+ }
532
+ });
533
+
534
+ if (variable) {
535
+ var styleValue = intermediateValue;
536
+
537
+ if (useTransform && !isUndefined(styleValue)) {
538
+ styleValue = transform(styleValue, property, props);
539
+ }
540
+
541
+ if (styleValue && _typeof(styleValue) !== 'object') {
542
+ styles[variable] = styleValue;
543
+ }
544
+ } // return the resulting styles object
545
+
546
+
547
+ return styles;
120
548
  };
121
549
 
122
- const createPropertyStyle = (value, props, config) => {
123
- const styles = {};
124
- const { transform = identity, property, properties = [property], scale, variable, } = config;
125
- const alwaysTransform = scale === undefined || isArray(scale);
126
- if (isUndefined(value)) {
127
- return styles;
128
- }
129
- let useTransform = false;
130
- let intermediateValue;
131
- let scaleValue;
132
- switch (typeof value) {
133
- case 'number':
134
- case 'string':
135
- scaleValue = lookupScaleValue(value, scale, props?.theme);
136
- useTransform = scaleValue !== undefined || alwaysTransform;
137
- intermediateValue = scaleValue ?? value;
138
- break;
139
- case 'function':
140
- if (props.theme) {
141
- intermediateValue = value(props.theme);
142
- }
143
- break;
144
- default:
145
- return styles;
146
- }
147
- // for each property look up the scale value from theme if passed and apply any
148
- // final transforms to the value
149
- properties.forEach((property) => {
150
- let styleValue = intermediateValue;
151
- if (useTransform && !isUndefined(styleValue)) {
152
- styleValue = transform(styleValue, property, props);
153
- }
154
- switch (typeof styleValue) {
155
- case 'number':
156
- case 'string':
157
- return (styles[property] = styleValue);
158
- case 'object':
159
- return Object.assign(styles, styleValue);
160
- }
161
- });
162
- if (variable) {
163
- let styleValue = intermediateValue;
164
- if (useTransform && !isUndefined(styleValue)) {
165
- styleValue = transform(styleValue, property, props);
166
- }
167
- if (styleValue && typeof styleValue !== 'object') {
168
- styles[variable] = styleValue;
169
- }
170
- }
171
- // return the resulting styles object
172
- return styles;
550
+ var SHORTHAND_PROPERTIES = ['border', 'borderTop', 'borderBottom', 'borderLeft', 'borderRight', 'borderWidth', 'borderStyle', 'borderColor', 'background', 'flex', 'margin', 'padding', 'transition', 'gap', 'grid', 'gridArea', 'gridColumn', 'gridRow', 'gridTemplate', 'overflow', 'transition'];
551
+ var SORT = {
552
+ A_BEFORE_B: -1,
553
+ B_BEFORE_A: 1,
554
+ EQUAL: 1
173
555
  };
174
556
 
175
- const SHORTHAND_PROPERTIES = [
176
- 'border',
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
- };
557
+ var compare = function compare(a, b) {
558
+ if (a < b) return SORT.A_BEFORE_B;
559
+ if (b < a) return SORT.B_BEFORE_A;
560
+ return SORT.EQUAL;
561
+ };
210
562
  /**
211
563
  * Orders all properties by the most dependent props
212
564
  * @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'];
565
+ */
566
+
567
+
568
+ var orderPropNames = function orderPropNames(config) {
569
+ return Object.keys(config).sort(function (a, b) {
570
+ var aConf = config[a],
571
+ bConf = config[b];
572
+ var aProp = aConf.property,
573
+ _aConf$properties = aConf.properties,
574
+ aProperties = _aConf$properties === void 0 ? [] : _aConf$properties;
575
+ var bProp = bConf.property,
576
+ _bConf$properties = bConf.properties,
577
+ bProperties = _bConf$properties === void 0 ? [] : _bConf$properties;
578
+ var aIsShorthand = SHORTHAND_PROPERTIES.includes(aProp);
579
+ var bIsShorthand = SHORTHAND_PROPERTIES.includes(bProp);
580
+
581
+ if (aIsShorthand && bIsShorthand) {
582
+ var aNum = aProperties.length;
583
+ var bNum = bProperties.length;
584
+
585
+ if (aProp !== bProp) {
586
+ return compare(SHORTHAND_PROPERTIES.indexOf(aProp), SHORTHAND_PROPERTIES.indexOf(bProp));
587
+ }
588
+
589
+ if (aProp === bProp) {
590
+ if (aNum === 0) return SORT.A_BEFORE_B;
591
+ if (bNum === 0) return SORT.B_BEFORE_A;
592
+ }
593
+
594
+ return compare(bNum, aNum);
595
+ }
596
+
597
+ if (aIsShorthand) return SORT.A_BEFORE_B;
598
+ if (bIsShorthand) return SORT.B_BEFORE_A;
599
+ return SORT.EQUAL;
600
+ });
601
+ };
602
+
603
+ var _excluded$1 = ["_"];
604
+ var BREAKPOINT_KEYS$1 = ['_', 'xs', 'sm', 'md', 'lg', 'xl'];
242
605
  /**
243
606
  * Destructures the themes breakpoints into an ordered structure to traverse
244
- */
245
- const templateMediaQuery$1 = (breakpoint) => `@media screen and (min-width: ${breakpoint}px)`;
246
- const createMediaQueries$1 = (breakpoints) => {
247
- if (breakpoints === undefined)
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;
607
+ */
608
+
609
+ var templateMediaQuery$1 = function templateMediaQuery(breakpoint) {
610
+ return "@media screen and (min-width: ".concat(breakpoint, "px)");
302
611
  };
303
612
 
304
- const renderPropValue$1 = (styles, prop, props, property, ctx) => {
305
- const value = get(props, prop);
306
- switch (typeof value) {
307
- case 'string':
308
- case 'number':
309
- case 'function':
310
- return Object.assign(styles, createPropertyStyle(value, props, property));
311
- // handle any props configured with the responsive notation
312
- case 'object':
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
- }
613
+ var createMediaQueries$1 = function createMediaQueries(breakpoints) {
614
+ if (breakpoints === undefined) return null;
615
+
616
+ var _ref = breakpoints !== null && breakpoints !== void 0 ? breakpoints : {},
617
+ xs = _ref.xs,
618
+ sm = _ref.sm,
619
+ md = _ref.md,
620
+ lg = _ref.lg,
621
+ xl = _ref.xl; // Ensure order for mapping
622
+
365
623
 
366
- /* eslint-disable guard-for-in */
367
- const getSelectors = (base = {}, variants = {}, states = {}, filters) => {
368
- const rules = {};
369
- Object.entries(base).forEach(([key, styles]) => {
370
- if (!filters.includes(key) && isObject(styles)) {
371
- set(rules, [key, 'base'], styles);
372
- }
373
- else {
374
- set(rules, ['primary', 'base', key], styles);
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
- };
624
+ return {
625
+ map: mapValues(breakpoints, templateMediaQuery$1),
626
+ array: [xs, sm, md, lg, xl].map(templateMediaQuery$1)
627
+ };
492
628
  };
629
+ var isMediaArray$1 = function isMediaArray(val) {
630
+ return Array.isArray(val);
631
+ };
632
+ var isMediaMap$1 = function isMediaMap(val) {
633
+ return intersection(Object.keys(val), BREAKPOINT_KEYS$1).length > 0;
634
+ };
635
+ var objectParser$1 = function objectParser(value, props, config, breakpoints) {
636
+ var styles = {};
637
+
638
+ var _ = value._,
639
+ rest = _objectWithoutProperties(value, _excluded$1); // the keyof 'base' is base styles
640
+
641
+
642
+ if (_) Object.assign(styles, createPropertyStyle(_, props, config)); // Map over remaining keys and merge the corresponding breakpoint styles
643
+ // for that property.
644
+
645
+ Object.keys(breakpoints).forEach(function (breakpointKey) {
646
+ var bpStyles = rest[breakpointKey];
647
+ if (typeof bpStyles === 'undefined') return;
648
+ Object.assign(styles, _defineProperty({}, breakpoints[breakpointKey], createPropertyStyle(bpStyles, props, config)));
649
+ });
650
+ return styles;
651
+ };
652
+ var arrayParser$1 = function arrayParser(value, props, config, breakpoints) {
653
+ var styles = {};
654
+
655
+ var _value = _toArray(value),
656
+ _ = _value[0],
657
+ rest = _value.slice(1); // the first index is base styles
658
+
659
+
660
+ if (_) Object.assign(styles, createPropertyStyle(_, props, config)); // Map over each value in the array and merge the corresponding breakpoint styles
661
+ // for that property.
662
+
663
+ rest.forEach(function (val, i) {
664
+ var breakpointKey = breakpoints[i];
665
+ if (!breakpointKey || typeof val === 'undefined') return;
666
+ Object.assign(styles, _defineProperty({}, breakpointKey, createPropertyStyle(val, props, config)));
667
+ });
668
+ return styles;
669
+ };
670
+ var orderBreakpoints$1 = function orderBreakpoints(styles, breakpoints) {
671
+ var orderedStyles = omit(styles, breakpoints);
672
+ breakpoints.forEach(function (bp) {
673
+ if (styles[bp]) {
674
+ orderedStyles[bp] = styles[bp];
675
+ }
676
+ });
677
+ return orderedStyles;
678
+ };
679
+
680
+ var renderPropValue$1 = function renderPropValue(styles, prop, props, property, ctx) {
681
+ var value = get(props, prop);
682
+
683
+ switch (_typeof(value)) {
684
+ case 'string':
685
+ case 'number':
686
+ case 'function':
687
+ return Object.assign(styles, createPropertyStyle(value, props, property));
688
+ // handle any props configured with the responsive notation
689
+
690
+ case 'object':
691
+ if (!ctx.mediaQueries) {
692
+ return;
693
+ } // If it is an array the order of values is smallest to largest: [_, xs, ...]
694
+
695
+
696
+ if (isMediaArray$1(value)) {
697
+ return merge(styles, arrayParser$1(value, props, property, ctx.mediaQueries.array));
698
+ } // Check to see if value is an object matching the responsive syntax and generate the styles.
493
699
 
494
- class AnimusWithAll {
495
- propRegistry = {};
496
- groupRegistry = {};
497
- parser = {};
498
- baseStyles = {};
499
- statesConfig = {};
500
- variants = {};
501
- activeGroups = {};
502
- custom = {};
503
- constructor(props, groups, parser, base, variants, states, activeGroups, custom) {
504
- this.propRegistry = props;
505
- this.groupRegistry = groups;
506
- this.parser = parser;
507
- this.baseStyles = base;
508
- this.variants = variants;
509
- this.statesConfig = states;
510
- this.activeGroups = activeGroups;
511
- this.custom = custom;
512
- }
513
- asComponent(component) {
514
- const handler = createStylist(createParser$1({ ...this.parser.config, ...this.custom }), this.baseStyles, this.variants, this.statesConfig);
515
- return styled(component)(handler);
516
- }
517
- build() {
518
- const handler = createStylist(createParser$1({ ...this.parser.config, ...this.custom }), this.baseStyles, this.variants, this.statesConfig);
519
- return handler;
520
- }
521
- }
522
- class AnimusWithSystem extends AnimusWithAll {
523
- constructor(props, groups, parser, base, variants, states, activeGroups) {
524
- super(props, groups, parser, base, variants, states, activeGroups, {});
525
- }
526
- props(config) {
527
- return new AnimusWithAll(this.propRegistry, this.groupRegistry, this.parser, this.baseStyles, this.variants, this.statesConfig, this.activeGroups, config);
528
- }
529
- }
530
- class AnimusWithStates extends AnimusWithSystem {
531
- constructor(props, groups, parser, base, variants, states) {
532
- super(props, groups, parser, base, variants, states, {});
533
- }
534
- groups(config) {
535
- return new AnimusWithSystem(this.propRegistry, this.groupRegistry, this.parser, this.baseStyles, this.variants, this.statesConfig, config);
536
- }
537
- }
538
- class AnimusWithVariants extends AnimusWithStates {
539
- constructor(props, groups, parser, base, variants) {
540
- super(props, groups, parser, base, variants, {});
541
- }
542
- states(config) {
543
- return new AnimusWithStates(this.propRegistry, this.groupRegistry, this.parser, this.baseStyles, this.variants, config);
544
- }
545
- variant(options) {
546
- const prop = options.prop || 'variant';
547
- return new AnimusWithVariants(this.propRegistry, this.groupRegistry, this.parser, this.baseStyles, merge(this.variants, { [prop]: options }));
548
- }
549
- }
550
- class AnimusWithBase extends AnimusWithVariants {
551
- constructor(props, groups, parser, base) {
552
- super(props, groups, parser, base, {});
553
- }
554
- variant(options) {
555
- const prop = options.prop || 'variant';
556
- return new AnimusWithVariants(this.propRegistry, this.groupRegistry, this.parser, this.baseStyles, merge(this.variants, { [prop]: options }));
557
- }
558
- }
559
- class Animus extends AnimusWithBase {
560
- constructor(props, groups) {
561
- super(props, groups, createParser$1(props), {});
562
- }
563
- styles(config) {
564
- return new AnimusWithBase(this.propRegistry, this.groupRegistry, this.parser, config);
565
- }
566
- }
567
700
 
568
- class AnimusConfig {
569
- #props = {};
570
- #groups = {};
571
- constructor(config, groups) {
572
- this.#props = config || {};
573
- this.#groups = groups || {};
574
- }
575
- addGroup(name, config) {
576
- const newGroup = {
577
- [name]: Object.keys(config),
578
- };
579
- return new AnimusConfig({ ...this.#props, ...config }, { ...this.#groups, ...newGroup });
580
- }
581
- build() {
582
- const props = this.#props;
583
- const groups = this.#groups;
584
- return new Animus(props, groups);
585
- }
701
+ if (value && isMediaMap$1(value)) {
702
+ return merge(styles, objectParser$1(value, props, property, ctx.mediaQueries.map));
703
+ }
704
+
705
+ }
706
+ };
707
+
708
+ function createParser$1(config) {
709
+ var propNames = orderPropNames(config);
710
+ var ctx = {
711
+ mediaQueries: null
712
+ };
713
+
714
+ var parser = function parser(props) {
715
+ var isCss = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
716
+ var styles = {};
717
+ var theme = props.theme; // Attempt to cache the breakpoints if we have not yet or if theme has become available.
718
+
719
+ if (ctx.mediaQueries === null) {
720
+ var _theme$breakpoints;
721
+
722
+ // Save the breakpoints if we can
723
+ ctx.mediaQueries = createMediaQueries$1((_theme$breakpoints = theme === null || theme === void 0 ? void 0 : theme.breakpoints) !== null && _theme$breakpoints !== void 0 ? _theme$breakpoints : compatTheme.breakpoints);
724
+ }
725
+
726
+ if (!isCss) {
727
+ // Loops over all prop names on the configured config to check for configured styles
728
+ propNames.forEach(function (prop) {
729
+ var property = config[prop];
730
+ renderPropValue$1(styles, prop, props, property, ctx);
731
+ });
732
+ } else {
733
+ // Loops over all prop names on the configured config to check for configured styles
734
+ Object.keys(props).forEach(function (prop) {
735
+ var property = config[prop];
736
+
737
+ if (property) {
738
+ renderPropValue$1(styles, prop, props, property, ctx);
739
+ } else if (prop !== 'theme') {
740
+ Object.assign(styles, _defineProperty({}, prop, get(props, prop)));
741
+ }
742
+ });
743
+ }
744
+
745
+ if (ctx.mediaQueries !== null) return orderBreakpoints$1(styles, ctx.mediaQueries.array);
746
+ return styles;
747
+ }; // return the parser function with the resulting meta information for further composition
748
+
749
+
750
+ return Object.assign(parser, {
751
+ propNames: propNames,
752
+ config: config
753
+ });
586
754
  }
587
755
 
588
- const createAnimus = () => new AnimusConfig();
589
-
590
- const color = {
591
- color: { property: 'color', scale: 'colors' },
592
- textColor: { property: 'color', scale: 'colors' },
593
- bg: { property: 'backgroundColor', scale: 'colors' },
594
- borderColor: { property: 'borderColor', scale: 'colors' },
595
- borderColorX: {
596
- property: 'borderColor',
597
- properties: ['borderLeftColor', 'borderRightColor'],
598
- scale: 'colors',
599
- },
600
- borderColorY: {
601
- property: 'borderColor',
602
- properties: ['borderTopColor', 'borderBottomColor'],
603
- scale: 'colors',
604
- },
605
- borderColorLeft: { property: 'borderLeftColor', scale: 'colors' },
606
- borderColorRight: { property: 'borderRightColor', scale: 'colors' },
607
- borderColorTop: { property: 'borderTopColor', scale: 'colors' },
608
- borderColorBottom: { property: 'borderBottomColor', scale: 'colors' },
609
- };
610
- const border = {
611
- border: {
612
- property: 'border',
613
- scale: 'borders',
614
- transform: borderShorthand,
615
- },
616
- borderX: {
617
- property: 'border',
618
- properties: ['borderLeft', 'borderRight'],
619
- scale: 'borders',
620
- transform: borderShorthand,
621
- },
622
- borderY: {
623
- property: 'border',
624
- properties: ['borderTop', 'borderBottom'],
625
- scale: 'borders',
626
- transform: borderShorthand,
627
- },
628
- borderTop: {
629
- property: 'borderTop',
630
- scale: 'borders',
631
- transform: borderShorthand,
632
- },
633
- borderRight: {
634
- property: 'borderRight',
635
- scale: 'borders',
636
- transform: borderShorthand,
637
- },
638
- borderBottom: {
639
- property: 'borderBottom',
640
- scale: 'borders',
641
- transform: borderShorthand,
642
- },
643
- borderLeft: {
644
- property: 'borderLeft',
645
- scale: 'borders',
646
- transform: borderShorthand,
647
- },
648
- // Width
649
- borderWidth: { property: 'borderWidth' },
650
- borderWidthX: {
651
- property: 'borderWidth',
652
- properties: ['borderLeftWidth', 'borderRightWidth'],
653
- },
654
- borderWidthY: {
655
- property: 'borderWidth',
656
- properties: ['borderTopWidth', 'borderBottomWidth'],
657
- },
658
- borderWidthLeft: { property: 'borderLeftWidth' },
659
- borderWidthRight: { property: 'borderRightWidth' },
660
- borderWidthTop: { property: 'borderTopWidth' },
661
- borderWidthBottom: { property: 'borderBottomWidth' },
662
- // Radius
663
- borderRadius: {
664
- property: 'borderRadius',
665
- scale: 'radii',
666
- transform: numberToPx,
667
- },
668
- borderRadiusLeft: {
669
- property: 'borderRadius',
670
- properties: ['borderTopLeftRadius', 'borderBottomLeftRadius'],
671
- scale: 'radii',
672
- transform: numberToPx,
673
- },
674
- borderRadiusTop: {
675
- property: 'borderRadius',
676
- properties: ['borderTopLeftRadius', 'borderTopRightRadius'],
677
- scale: 'radii',
678
- transform: numberToPx,
679
- },
680
- borderRadiusBottom: {
681
- property: 'borderRadius',
682
- properties: ['borderBottomLeftRadius', 'borderBottomRightRadius'],
683
- scale: 'radii',
684
- transform: numberToPx,
685
- },
686
- borderRadiusRight: {
687
- property: 'borderRadius',
688
- properties: ['borderTopRightRadius', 'borderBottomRightRadius'],
689
- scale: 'radii',
690
- transform: numberToPx,
691
- },
692
- borderRadiusTopLeft: {
693
- property: 'borderTopLeftRadius',
694
- scale: 'radii',
695
- transform: numberToPx,
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);
756
+ var getSelectors = function getSelectors() {
757
+ var base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
758
+ var variants = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
759
+ var states = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
760
+ var filters = arguments.length > 3 ? arguments[3] : undefined;
761
+ var rules = {};
762
+ Object.entries(base).forEach(function (_ref) {
763
+ var _ref2 = _slicedToArray(_ref, 2),
764
+ key = _ref2[0],
765
+ styles = _ref2[1];
766
+
767
+ if (!filters.includes(key) && isObject(styles)) {
768
+ set(rules, [key, 'base'], styles);
769
+ } else {
770
+ set(rules, ['primary', 'base', key], styles);
771
+ }
772
+ });
773
+ Object.entries(variants).forEach(function (_ref3) {
774
+ var _ref4 = _slicedToArray(_ref3, 2),
775
+ key = _ref4[0],
776
+ variantConfig = _ref4[1].variants;
777
+
778
+ Object.entries(variantConfig).forEach(function (_ref5) {
779
+ var _ref6 = _slicedToArray(_ref5, 2),
780
+ option = _ref6[0],
781
+ optionStyles = _ref6[1];
782
+
783
+ var optionId = "".concat(key, "-").concat(option);
784
+ Object.entries(optionStyles).forEach(function (_ref7) {
785
+ var _ref8 = _slicedToArray(_ref7, 2),
786
+ key = _ref8[0],
787
+ styles = _ref8[1];
788
+
789
+ if (!filters.includes(key) && isObject(styles)) {
790
+ set(rules, [key, optionId], styles);
791
+ } else {
792
+ set(rules, ['primary', optionId, key], styles);
793
+ }
794
+ });
795
+ });
796
+ });
797
+ Object.entries(states).forEach(function (_ref9) {
798
+ var _ref10 = _slicedToArray(_ref9, 2),
799
+ optionId = _ref10[0],
800
+ optionStyles = _ref10[1];
801
+
802
+ Object.entries(optionStyles).forEach(function (_ref11) {
803
+ var _ref12 = _slicedToArray(_ref11, 2),
804
+ key = _ref12[0],
805
+ styles = _ref12[1];
806
+
807
+ if (!filters.includes(key) && isObject(styles)) {
808
+ set(rules, [key, optionId], styles);
809
+ } else {
810
+ set(rules, ['primary', optionId, key], styles);
811
+ }
812
+ });
813
+ });
814
+ return rules;
815
+ };
816
+
817
+ var createGetActiveStyleIds = function createGetActiveStyleIds(variants, states) {
818
+ var vIds = Object.keys(variants);
819
+ var sIds = Object.keys(states);
820
+ return function (props) {
821
+ var activeIds = [];
822
+ vIds.forEach(function (id) {
823
+ if (props[id]) {
824
+ activeIds.push("".concat(id, "-").concat(props[id]));
825
+ }
826
+ });
827
+ sIds.forEach(function (id) {
828
+ if (props[id]) {
829
+ activeIds.push(id);
830
+ }
831
+ });
832
+ return activeIds;
833
+ };
834
+ };
835
+
836
+ var extractBreakpointStyles = function extractBreakpointStyles(styles, medias) {
837
+ var unscoped = {};
838
+ var breakpoint = {};
839
+ Object.entries(styles).forEach(function (_ref13) {
840
+ var _ref14 = _slicedToArray(_ref13, 2),
841
+ rule = _ref14[0],
842
+ value = _ref14[1];
843
+
844
+ var target = medias.includes(rule) ? breakpoint : unscoped;
845
+ target[rule] = value;
846
+ });
847
+ return [unscoped, breakpoint];
848
+ };
849
+
850
+ var applyOverride = function applyOverride() {
851
+ var override = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
852
+ var baseResult = arguments.length > 1 ? arguments[1] : undefined;
853
+ var breakpointResult = arguments.length > 2 ? arguments[2] : undefined;
854
+ var parser = arguments.length > 3 ? arguments[3] : undefined;
855
+ var theme = arguments.length > 4 ? arguments[4] : undefined;
856
+ var media = arguments.length > 5 ? arguments[5] : undefined;
857
+
858
+ var _extractBreakpointSty = extractBreakpointStyles(parser(_objectSpread2(_objectSpread2({}, override), {}, {
859
+ theme: theme
860
+ }), true), media),
861
+ _extractBreakpointSty2 = _slicedToArray(_extractBreakpointSty, 2),
862
+ overrideStyles = _extractBreakpointSty2[0],
863
+ overrideBreakpointStyles = _extractBreakpointSty2[1];
864
+
865
+ for (var rule in overrideStyles) {
866
+ baseResult[rule] = overrideStyles[rule];
867
+ }
868
+
869
+ media.forEach(function (mq) {
870
+ var mqOverride = overrideBreakpointStyles[mq];
871
+ if (!mqOverride || isEmpty(mqOverride)) return;
872
+
873
+ if (!breakpointResult[mq]) {
874
+ breakpointResult[mq] = {};
875
+ }
876
+
877
+ var mqStyle = breakpointResult[mq];
878
+
879
+ for (var _rule in mqOverride) {
880
+ mqStyle[_rule] = mqOverride[_rule];
881
+ }
882
+ });
883
+ };
884
+
885
+ var applyStyle = function applyStyle(resultStyles, config, props, ctx) {
886
+ var base = config.base;
887
+ var parser = ctx.parser,
888
+ getMediaSelectors = ctx.getMediaSelectors,
889
+ getActiveOverrides = ctx.getActiveOverrides;
890
+ var theme = props.theme;
891
+ var overrides = Object.values(pick(config, getActiveOverrides(props)));
892
+ var media = getMediaSelectors(props);
893
+
894
+ var _extractBreakpointSty3 = extractBreakpointStyles(parser(_objectSpread2(_objectSpread2({}, base), {}, {
895
+ theme: theme
896
+ }), true), media),
897
+ _extractBreakpointSty4 = _slicedToArray(_extractBreakpointSty3, 2),
898
+ styles = _extractBreakpointSty4[0],
899
+ breakpointStyles = _extractBreakpointSty4[1];
900
+
901
+ for (var rule in styles) {
902
+ resultStyles[rule] = styles[rule];
903
+ }
904
+
905
+ overrides.forEach(function (override) {
906
+ applyOverride(override, resultStyles, breakpointStyles, parser, theme, media);
907
+ });
908
+ media.forEach(function (media) {
909
+ var bp = breakpointStyles[media];
910
+
911
+ if (!isEmpty(bp)) {
912
+ resultStyles[media] = bp;
913
+ }
914
+ });
915
+ };
916
+
917
+ var createStylist = function createStylist(parser) {
918
+ var base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
919
+ var variants = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
920
+ var states = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
921
+ var selectorGroups = getSelectors(base, variants, states, parser.propNames);
922
+ var context = {
923
+ parser: parser,
924
+ getMediaSelectors: function getMediaSelectors(_ref15) {
925
+ var _theme$breakpoints;
926
+
927
+ var theme = _ref15.theme;
928
+ var breakpoints = (_theme$breakpoints = theme === null || theme === void 0 ? void 0 : theme.breakpoints) !== null && _theme$breakpoints !== void 0 ? _theme$breakpoints : compatTheme.breakpoints;
929
+ return ['xs', 'sm', 'md', 'lg', 'xl'].map(function (key) {
930
+ return breakpoints[key];
931
+ });
932
+ },
933
+ getActiveOverrides: createGetActiveStyleIds(variants, states)
934
+ };
935
+ return function (props) {
936
+ var vars = props.vars;
937
+
938
+ var result = _objectSpread2({}, vars);
939
+
940
+ Object.entries(selectorGroups).forEach(function (_ref16) {
941
+ var _ref17 = _slicedToArray(_ref16, 2),
942
+ selectorId = _ref17[0],
943
+ _ref17$ = _ref17[1],
944
+ config = _ref17$ === void 0 ? {} : _ref17$;
945
+
946
+ if (selectorId === 'primary') {
947
+ applyStyle(result, config, props, context);
948
+ } else {
949
+ result[selectorId] = {};
950
+ applyStyle(result[selectorId], config, props, context);
951
+ }
952
+ });
953
+ applyStyle(result, {
954
+ base: parser(props)
955
+ }, props, context);
956
+ return result;
957
+ };
958
+ };
959
+
960
+ var AnimusWithAll = /*#__PURE__*/function () {
961
+ function AnimusWithAll(props, groups, parser, base, variants, states, activeGroups, custom) {
962
+ _classCallCheck(this, AnimusWithAll);
963
+
964
+ _defineProperty(this, "propRegistry", {});
965
+
966
+ _defineProperty(this, "groupRegistry", {});
967
+
968
+ _defineProperty(this, "parser", {});
969
+
970
+ _defineProperty(this, "baseStyles", {});
971
+
972
+ _defineProperty(this, "statesConfig", {});
973
+
974
+ _defineProperty(this, "variants", {});
975
+
976
+ _defineProperty(this, "activeGroups", {});
977
+
978
+ _defineProperty(this, "custom", {});
979
+
980
+ this.propRegistry = props;
981
+ this.groupRegistry = groups;
982
+ this.parser = parser;
983
+ this.baseStyles = base;
984
+ this.variants = variants;
985
+ this.statesConfig = states;
986
+ this.activeGroups = activeGroups;
987
+ this.custom = custom;
988
+ }
989
+
990
+ _createClass(AnimusWithAll, [{
991
+ key: "asComponent",
992
+ value: function asComponent(component) {
993
+ var handler = createStylist(createParser$1(_objectSpread2(_objectSpread2({}, this.parser.config), this.custom)), this.baseStyles, this.variants, this.statesConfig);
994
+ return /*#__PURE__*/_styled(component, {
995
+ target: "e19x4vr0",
996
+ label: "AnimusWithAll"
997
+ })(handler, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkFuaW11cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF5QmUiLCJmaWxlIjoiQW5pbXVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgbWVyZ2UgfSBmcm9tICdsb2Rhc2gnO1xyXG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmltcG9ydCB7IGNyZWF0ZVBhcnNlciB9IGZyb20gJy4vc3R5bGVzL2NyZWF0ZVBhcnNlcic7XHJcbmltcG9ydCB7IGNyZWF0ZVN0eWxpc3QgfSBmcm9tICcuL3N0eWxlcy9jcmVhdGVTdHlsaXN0JztcclxuZXhwb3J0IGNsYXNzIEFuaW11c1dpdGhBbGwge1xyXG4gICAgcHJvcFJlZ2lzdHJ5ID0ge307XHJcbiAgICBncm91cFJlZ2lzdHJ5ID0ge307XHJcbiAgICBwYXJzZXIgPSB7fTtcclxuICAgIGJhc2VTdHlsZXMgPSB7fTtcclxuICAgIHN0YXRlc0NvbmZpZyA9IHt9O1xyXG4gICAgdmFyaWFudHMgPSB7fTtcclxuICAgIGFjdGl2ZUdyb3VwcyA9IHt9O1xyXG4gICAgY3VzdG9tID0ge307XHJcbiAgICBjb25zdHJ1Y3Rvcihwcm9wcywgZ3JvdXBzLCBwYXJzZXIsIGJhc2UsIHZhcmlhbnRzLCBzdGF0ZXMsIGFjdGl2ZUdyb3VwcywgY3VzdG9tKSB7XHJcbiAgICAgICAgdGhpcy5wcm9wUmVnaXN0cnkgPSBwcm9wcztcclxuICAgICAgICB0aGlzLmdyb3VwUmVnaXN0cnkgPSBncm91cHM7XHJcbiAgICAgICAgdGhpcy5wYXJzZXIgPSBwYXJzZXI7XHJcbiAgICAgICAgdGhpcy5iYXNlU3R5bGVzID0gYmFzZTtcclxuICAgICAgICB0aGlzLnZhcmlhbnRzID0gdmFyaWFudHM7XHJcbiAgICAgICAgdGhpcy5zdGF0ZXNDb25maWcgPSBzdGF0ZXM7XHJcbiAgICAgICAgdGhpcy5hY3RpdmVHcm91cHMgPSBhY3RpdmVHcm91cHM7XHJcbiAgICAgICAgdGhpcy5jdXN0b20gPSBjdXN0b207XHJcbiAgICB9XHJcbiAgICBhc0NvbXBvbmVudChjb21wb25lbnQpIHtcclxuICAgICAgICBjb25zdCBoYW5kbGVyID0gY3JlYXRlU3R5bGlzdChjcmVhdGVQYXJzZXIoeyAuLi50aGlzLnBhcnNlci5jb25maWcsIC4uLnRoaXMuY3VzdG9tIH0pLCB0aGlzLmJhc2VTdHlsZXMsIHRoaXMudmFyaWFudHMsIHRoaXMuc3RhdGVzQ29uZmlnKTtcclxuICAgICAgICByZXR1cm4gc3R5bGVkKGNvbXBvbmVudCkoaGFuZGxlcik7XHJcbiAgICB9XHJcbiAgICBidWlsZCgpIHtcclxuICAgICAgICBjb25zdCBoYW5kbGVyID0gY3JlYXRlU3R5bGlzdChjcmVhdGVQYXJzZXIoeyAuLi50aGlzLnBhcnNlci5jb25maWcsIC4uLnRoaXMuY3VzdG9tIH0pLCB0aGlzLmJhc2VTdHlsZXMsIHRoaXMudmFyaWFudHMsIHRoaXMuc3RhdGVzQ29uZmlnKTtcclxuICAgICAgICByZXR1cm4gaGFuZGxlcjtcclxuICAgIH1cclxufVxyXG5jbGFzcyBBbmltdXNXaXRoU3lzdGVtIGV4dGVuZHMgQW5pbXVzV2l0aEFsbCB7XHJcbiAgICBjb25zdHJ1Y3Rvcihwcm9wcywgZ3JvdXBzLCBwYXJzZXIsIGJhc2UsIHZhcmlhbnRzLCBzdGF0ZXMsIGFjdGl2ZUdyb3Vwcykge1xyXG4gICAgICAgIHN1cGVyKHByb3BzLCBncm91cHMsIHBhcnNlciwgYmFzZSwgdmFyaWFudHMsIHN0YXRlcywgYWN0aXZlR3JvdXBzLCB7fSk7XHJcbiAgICB9XHJcbiAgICBwcm9wcyhjb25maWcpIHtcclxuICAgICAgICByZXR1cm4gbmV3IEFuaW11c1dpdGhBbGwodGhpcy5wcm9wUmVnaXN0cnksIHRoaXMuZ3JvdXBSZWdpc3RyeSwgdGhpcy5wYXJzZXIsIHRoaXMuYmFzZVN0eWxlcywgdGhpcy52YXJpYW50cywgdGhpcy5zdGF0ZXNDb25maWcsIHRoaXMuYWN0aXZlR3JvdXBzLCBjb25maWcpO1xyXG4gICAgfVxyXG59XHJcbmNsYXNzIEFuaW11c1dpdGhTdGF0ZXMgZXh0ZW5kcyBBbmltdXNXaXRoU3lzdGVtIHtcclxuICAgIGNvbnN0cnVjdG9yKHByb3BzLCBncm91cHMsIHBhcnNlciwgYmFzZSwgdmFyaWFudHMsIHN0YXRlcykge1xyXG4gICAgICAgIHN1cGVyKHByb3BzLCBncm91cHMsIHBhcnNlciwgYmFzZSwgdmFyaWFudHMsIHN0YXRlcywge30pO1xyXG4gICAgfVxyXG4gICAgZ3JvdXBzKGNvbmZpZykge1xyXG4gICAgICAgIHJldHVybiBuZXcgQW5pbXVzV2l0aFN5c3RlbSh0aGlzLnByb3BSZWdpc3RyeSwgdGhpcy5ncm91cFJlZ2lzdHJ5LCB0aGlzLnBhcnNlciwgdGhpcy5iYXNlU3R5bGVzLCB0aGlzLnZhcmlhbnRzLCB0aGlzLnN0YXRlc0NvbmZpZywgY29uZmlnKTtcclxuICAgIH1cclxufVxyXG5jbGFzcyBBbmltdXNXaXRoVmFyaWFudHMgZXh0ZW5kcyBBbmltdXNXaXRoU3RhdGVzIHtcclxuICAgIGNvbnN0cnVjdG9yKHByb3BzLCBncm91cHMsIHBhcnNlciwgYmFzZSwgdmFyaWFudHMpIHtcclxuICAgICAgICBzdXBlcihwcm9wcywgZ3JvdXBzLCBwYXJzZXIsIGJhc2UsIHZhcmlhbnRzLCB7fSk7XHJcbiAgICB9XHJcbiAgICBzdGF0ZXMoY29uZmlnKSB7XHJcbiAgICAgICAgcmV0dXJuIG5ldyBBbmltdXNXaXRoU3RhdGVzKHRoaXMucHJvcFJlZ2lzdHJ5LCB0aGlzLmdyb3VwUmVnaXN0cnksIHRoaXMucGFyc2VyLCB0aGlzLmJhc2VTdHlsZXMsIHRoaXMudmFyaWFudHMsIGNvbmZpZyk7XHJcbiAgICB9XHJcbiAgICB2YXJpYW50KG9wdGlvbnMpIHtcclxuICAgICAgICBjb25zdCBwcm9wID0gb3B0aW9ucy5wcm9wIHx8ICd2YXJpYW50JztcclxuICAgICAgICByZXR1cm4gbmV3IEFuaW11c1dpdGhWYXJpYW50cyh0aGlzLnByb3BSZWdpc3RyeSwgdGhpcy5ncm91cFJlZ2lzdHJ5LCB0aGlzLnBhcnNlciwgdGhpcy5iYXNlU3R5bGVzLCBtZXJnZSh0aGlzLnZhcmlhbnRzLCB7IFtwcm9wXTogb3B0aW9ucyB9KSk7XHJcbiAgICB9XHJcbn1cclxuY2xhc3MgQW5pbXVzV2l0aEJhc2UgZXh0ZW5kcyBBbmltdXNXaXRoVmFyaWFudHMge1xyXG4gICAgY29uc3RydWN0b3IocHJvcHMsIGdyb3VwcywgcGFyc2VyLCBiYXNlKSB7XHJcbiAgICAgICAgc3VwZXIocHJvcHMsIGdyb3VwcywgcGFyc2VyLCBiYXNlLCB7fSk7XHJcbiAgICB9XHJcbiAgICB2YXJpYW50KG9wdGlvbnMpIHtcclxuICAgICAgICBjb25zdCBwcm9wID0gb3B0aW9ucy5wcm9wIHx8ICd2YXJpYW50JztcclxuICAgICAgICByZXR1cm4gbmV3IEFuaW11c1dpdGhWYXJpYW50cyh0aGlzLnByb3BSZWdpc3RyeSwgdGhpcy5ncm91cFJlZ2lzdHJ5LCB0aGlzLnBhcnNlciwgdGhpcy5iYXNlU3R5bGVzLCBtZXJnZSh0aGlzLnZhcmlhbnRzLCB7IFtwcm9wXTogb3B0aW9ucyB9KSk7XHJcbiAgICB9XHJcbn1cclxuZXhwb3J0IGNsYXNzIEFuaW11cyBleHRlbmRzIEFuaW11c1dpdGhCYXNlIHtcclxuICAgIGNvbnN0cnVjdG9yKHByb3BzLCBncm91cHMpIHtcclxuICAgICAgICBzdXBlcihwcm9wcywgZ3JvdXBzLCBjcmVhdGVQYXJzZXIocHJvcHMpLCB7fSk7XHJcbiAgICB9XHJcbiAgICBzdHlsZXMoY29uZmlnKSB7XHJcbiAgICAgICAgcmV0dXJuIG5ldyBBbmltdXNXaXRoQmFzZSh0aGlzLnByb3BSZWdpc3RyeSwgdGhpcy5ncm91cFJlZ2lzdHJ5LCB0aGlzLnBhcnNlciwgY29uZmlnKTtcclxuICAgIH1cclxufVxyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1BbmltdXMuanMubWFwIl19 */");
998
+ }
999
+ }, {
1000
+ key: "build",
1001
+ value: function build() {
1002
+ var handler = createStylist(createParser$1(_objectSpread2(_objectSpread2({}, this.parser.config), this.custom)), this.baseStyles, this.variants, this.statesConfig);
1003
+ return handler;
1004
+ }
1005
+ }]);
1006
+
1007
+ return AnimusWithAll;
1008
+ }();
1009
+
1010
+ var AnimusWithSystem = /*#__PURE__*/function (_AnimusWithAll) {
1011
+ _inherits(AnimusWithSystem, _AnimusWithAll);
1012
+
1013
+ var _super = _createSuper(AnimusWithSystem);
1014
+
1015
+ function AnimusWithSystem(props, groups, parser, base, variants, states, activeGroups) {
1016
+ _classCallCheck(this, AnimusWithSystem);
1017
+
1018
+ return _super.call(this, props, groups, parser, base, variants, states, activeGroups, {});
1019
+ }
1020
+
1021
+ _createClass(AnimusWithSystem, [{
1022
+ key: "props",
1023
+ value: function props(config) {
1024
+ return new AnimusWithAll(this.propRegistry, this.groupRegistry, this.parser, this.baseStyles, this.variants, this.statesConfig, this.activeGroups, config);
1025
+ }
1026
+ }]);
1027
+
1028
+ return AnimusWithSystem;
1029
+ }(AnimusWithAll);
1030
+
1031
+ var AnimusWithStates = /*#__PURE__*/function (_AnimusWithSystem) {
1032
+ _inherits(AnimusWithStates, _AnimusWithSystem);
1033
+
1034
+ var _super2 = _createSuper(AnimusWithStates);
1035
+
1036
+ function AnimusWithStates(props, groups, parser, base, variants, states) {
1037
+ _classCallCheck(this, AnimusWithStates);
1038
+
1039
+ return _super2.call(this, props, groups, parser, base, variants, states, {});
1040
+ }
1041
+
1042
+ _createClass(AnimusWithStates, [{
1043
+ key: "groups",
1044
+ value: function groups(config) {
1045
+ return new AnimusWithSystem(this.propRegistry, this.groupRegistry, this.parser, this.baseStyles, this.variants, this.statesConfig, config);
1046
+ }
1047
+ }]);
1048
+
1049
+ return AnimusWithStates;
1050
+ }(AnimusWithSystem);
1051
+
1052
+ var AnimusWithVariants = /*#__PURE__*/function (_AnimusWithStates) {
1053
+ _inherits(AnimusWithVariants, _AnimusWithStates);
1054
+
1055
+ var _super3 = _createSuper(AnimusWithVariants);
1056
+
1057
+ function AnimusWithVariants(props, groups, parser, base, variants) {
1058
+ _classCallCheck(this, AnimusWithVariants);
1059
+
1060
+ return _super3.call(this, props, groups, parser, base, variants, {});
1061
+ }
1062
+
1063
+ _createClass(AnimusWithVariants, [{
1064
+ key: "states",
1065
+ value: function states(config) {
1066
+ return new AnimusWithStates(this.propRegistry, this.groupRegistry, this.parser, this.baseStyles, this.variants, config);
1067
+ }
1068
+ }, {
1069
+ key: "variant",
1070
+ value: function variant(options) {
1071
+ var prop = options.prop || 'variant';
1072
+ return new AnimusWithVariants(this.propRegistry, this.groupRegistry, this.parser, this.baseStyles, merge(this.variants, _defineProperty({}, prop, options)));
1073
+ }
1074
+ }]);
1075
+
1076
+ return AnimusWithVariants;
1077
+ }(AnimusWithStates);
1078
+
1079
+ var AnimusWithBase = /*#__PURE__*/function (_AnimusWithVariants) {
1080
+ _inherits(AnimusWithBase, _AnimusWithVariants);
1081
+
1082
+ var _super4 = _createSuper(AnimusWithBase);
1083
+
1084
+ function AnimusWithBase(props, groups, parser, base) {
1085
+ _classCallCheck(this, AnimusWithBase);
1086
+
1087
+ return _super4.call(this, props, groups, parser, base, {});
1088
+ }
1089
+
1090
+ _createClass(AnimusWithBase, [{
1091
+ key: "variant",
1092
+ value: function variant(options) {
1093
+ var prop = options.prop || 'variant';
1094
+ return new AnimusWithVariants(this.propRegistry, this.groupRegistry, this.parser, this.baseStyles, merge(this.variants, _defineProperty({}, prop, options)));
1095
+ }
1096
+ }]);
1097
+
1098
+ return AnimusWithBase;
1099
+ }(AnimusWithVariants);
1100
+
1101
+ var Animus = /*#__PURE__*/function (_AnimusWithBase) {
1102
+ _inherits(Animus, _AnimusWithBase);
1103
+
1104
+ var _super5 = _createSuper(Animus);
1105
+
1106
+ function Animus(props, groups) {
1107
+ _classCallCheck(this, Animus);
1108
+
1109
+ return _super5.call(this, props, groups, createParser$1(props), {});
1110
+ }
1111
+
1112
+ _createClass(Animus, [{
1113
+ key: "styles",
1114
+ value: function styles(config) {
1115
+ return new AnimusWithBase(this.propRegistry, this.groupRegistry, this.parser, config);
1116
+ }
1117
+ }]);
1118
+
1119
+ return Animus;
1120
+ }(AnimusWithBase);
1121
+
1122
+ var _props = /*#__PURE__*/new WeakMap();
1123
+
1124
+ var _groups = /*#__PURE__*/new WeakMap();
1125
+
1126
+ var AnimusConfig = /*#__PURE__*/function () {
1127
+ function AnimusConfig(config, groups) {
1128
+ _classCallCheck(this, AnimusConfig);
1129
+
1130
+ _classPrivateFieldInitSpec(this, _props, {
1131
+ writable: true,
1132
+ value: {}
1133
+ });
1134
+
1135
+ _classPrivateFieldInitSpec(this, _groups, {
1136
+ writable: true,
1137
+ value: {}
1138
+ });
1139
+
1140
+ _classPrivateFieldSet(this, _props, config || {});
1141
+
1142
+ _classPrivateFieldSet(this, _groups, groups || {});
1143
+ }
1144
+
1145
+ _createClass(AnimusConfig, [{
1146
+ key: "addGroup",
1147
+ value: function addGroup(name, config) {
1148
+ var newGroup = _defineProperty({}, name, Object.keys(config));
1149
+
1150
+ return new AnimusConfig(_objectSpread2(_objectSpread2({}, _classPrivateFieldGet(this, _props)), config), _objectSpread2(_objectSpread2({}, _classPrivateFieldGet(this, _groups)), newGroup));
1151
+ }
1152
+ }, {
1153
+ key: "build",
1154
+ value: function build() {
1155
+ var props = _classPrivateFieldGet(this, _props);
1156
+
1157
+ var groups = _classPrivateFieldGet(this, _groups);
1158
+
1159
+ return new Animus(props, groups);
1160
+ }
1161
+ }]);
1162
+
1163
+ return AnimusConfig;
1164
+ }();
1165
+
1166
+ var createAnimus = function createAnimus() {
1167
+ return new AnimusConfig();
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);
938
1703
  config.build();
939
1704
 
940
- const getStylePropNames = (props, filteredKeys) => pick(props, keys(props).filter((key) => !filteredKeys.includes(key)));
1705
+ var getStylePropNames = function getStylePropNames(props, filteredKeys) {
1706
+ return pick(props, keys(props).filter(function (key) {
1707
+ return !filteredKeys.includes(key);
1708
+ }));
1709
+ };
941
1710
 
942
- const BREAKPOINT_KEYS = ['_', 'xs', 'sm', 'md', 'lg', 'xl'];
1711
+ var _excluded = ["_"];
1712
+ var BREAKPOINT_KEYS = ['_', 'xs', 'sm', 'md', 'lg', 'xl'];
943
1713
  /**
944
1714
  * Destructures the themes breakpoints into an ordered structure to traverse
945
- */
946
- const templateMediaQuery = (breakpoint) => `@media screen and (min-width: ${breakpoint}px)`;
947
- const createMediaQueries = (breakpoints) => {
948
- if (breakpoints === undefined)
949
- return null;
950
- const { xs, sm, md, lg, xl } = breakpoints ?? {};
951
- // Ensure order for mapping
952
- return {
953
- map: mapValues(breakpoints, templateMediaQuery),
954
- array: [xs, sm, md, lg, xl].map(templateMediaQuery),
955
- };
956
- };
957
- const isMediaArray = (val) => Array.isArray(val);
958
- const isMediaMap = (val) => intersection(Object.keys(val), BREAKPOINT_KEYS).length > 0;
959
- const objectParser = (value, props, config, breakpoints) => {
960
- const styles = {};
961
- const { styleFn, prop } = config;
962
- const { _, ...rest } = value;
963
- // the keyof 'base' is base styles
964
- if (_)
965
- Object.assign(styles, styleFn(_, prop, props));
966
- // Map over remaining keys and merge the corresponding breakpoint styles
967
- // for that property.
968
- Object.keys(breakpoints).forEach((breakpointKey) => {
969
- const bpStyles = rest[breakpointKey];
970
- if (typeof bpStyles === 'undefined')
971
- return;
972
- Object.assign(styles, {
973
- [breakpoints[breakpointKey]]: styleFn(bpStyles, prop, props),
974
- });
975
- });
976
- return styles;
977
- };
978
- const arrayParser = (value, props, config, breakpoints) => {
979
- const styles = {};
980
- const { styleFn, prop } = config;
981
- const [_, ...rest] = value;
982
- // the first index is base styles
983
- if (_)
984
- Object.assign(styles, styleFn(_, prop, props));
985
- // Map over each value in the array and merge the corresponding breakpoint styles
986
- // for that property.
987
- rest.forEach((val, i) => {
988
- const breakpointKey = breakpoints[i];
989
- if (!breakpointKey || typeof val === 'undefined')
990
- return;
991
- Object.assign(styles, {
992
- [breakpointKey]: styleFn(val, prop, props),
993
- });
994
- });
995
- return styles;
996
- };
997
- const orderBreakpoints = (styles, breakpoints) => {
998
- const orderedStyles = omit(styles, breakpoints);
999
- breakpoints.forEach((bp) => {
1000
- if (styles[bp]) {
1001
- orderedStyles[bp] = styles[bp];
1002
- }
1003
- });
1004
- return orderedStyles;
1715
+ */
1716
+
1717
+ var templateMediaQuery = function templateMediaQuery(breakpoint) {
1718
+ return "@media screen and (min-width: ".concat(breakpoint, "px)");
1719
+ };
1720
+
1721
+ var createMediaQueries = function createMediaQueries(breakpoints) {
1722
+ if (breakpoints === undefined) return null;
1723
+
1724
+ var _ref = breakpoints !== null && breakpoints !== void 0 ? breakpoints : {},
1725
+ xs = _ref.xs,
1726
+ sm = _ref.sm,
1727
+ md = _ref.md,
1728
+ lg = _ref.lg,
1729
+ xl = _ref.xl; // Ensure order for mapping
1730
+
1731
+
1732
+ return {
1733
+ map: mapValues(breakpoints, templateMediaQuery),
1734
+ array: [xs, sm, md, lg, xl].map(templateMediaQuery)
1735
+ };
1736
+ };
1737
+ var isMediaArray = function isMediaArray(val) {
1738
+ return Array.isArray(val);
1739
+ };
1740
+ var isMediaMap = function isMediaMap(val) {
1741
+ return intersection(Object.keys(val), BREAKPOINT_KEYS).length > 0;
1742
+ };
1743
+ var objectParser = function objectParser(value, props, config, breakpoints) {
1744
+ var styles = {};
1745
+ var styleFn = config.styleFn,
1746
+ prop = config.prop;
1747
+
1748
+ var _ = value._,
1749
+ rest = _objectWithoutProperties(value, _excluded); // the keyof 'base' is base styles
1750
+
1751
+
1752
+ if (_) Object.assign(styles, styleFn(_, prop, props)); // Map over remaining keys and merge the corresponding breakpoint styles
1753
+ // for that property.
1754
+
1755
+ Object.keys(breakpoints).forEach(function (breakpointKey) {
1756
+ var bpStyles = rest[breakpointKey];
1757
+ if (typeof bpStyles === 'undefined') return;
1758
+ Object.assign(styles, _defineProperty({}, breakpoints[breakpointKey], styleFn(bpStyles, prop, props)));
1759
+ });
1760
+ return styles;
1761
+ };
1762
+ var arrayParser = function arrayParser(value, props, config, breakpoints) {
1763
+ var styles = {};
1764
+ var styleFn = config.styleFn,
1765
+ prop = config.prop;
1766
+
1767
+ var _value = _toArray(value),
1768
+ _ = _value[0],
1769
+ rest = _value.slice(1); // the first index is base styles
1770
+
1771
+
1772
+ if (_) Object.assign(styles, styleFn(_, prop, props)); // Map over each value in the array and merge the corresponding breakpoint styles
1773
+ // for that property.
1774
+
1775
+ rest.forEach(function (val, i) {
1776
+ var breakpointKey = breakpoints[i];
1777
+ if (!breakpointKey || typeof val === 'undefined') return;
1778
+ Object.assign(styles, _defineProperty({}, breakpointKey, styleFn(val, prop, props)));
1779
+ });
1780
+ return styles;
1005
1781
  };
1782
+ var orderBreakpoints = function orderBreakpoints(styles, breakpoints) {
1783
+ var orderedStyles = omit(styles, breakpoints);
1784
+ breakpoints.forEach(function (bp) {
1785
+ if (styles[bp]) {
1786
+ orderedStyles[bp] = styles[bp];
1787
+ }
1788
+ });
1789
+ return orderedStyles;
1790
+ };
1791
+
1792
+ var renderPropValue = function renderPropValue(styles, prop, props, property, ctx) {
1793
+ var value = get(props, prop);
1794
+
1795
+ switch (_typeof(value)) {
1796
+ case 'string':
1797
+ case 'number':
1798
+ case 'function':
1799
+ return Object.assign(styles, property.styleFn(value, prop, props));
1800
+ // handle any props configured with the responsive notation
1801
+
1802
+ case 'object':
1803
+ if (!ctx.mediaQueries) {
1804
+ return;
1805
+ } // If it is an array the order of values is smallest to largest: [_, xs, ...]
1806
+
1807
+
1808
+ if (isMediaArray(value)) {
1809
+ return merge(styles, arrayParser(value, props, property, ctx.mediaQueries.array));
1810
+ } // Check to see if value is an object matching the responsive syntax and generate the styles.
1811
+
1812
+
1813
+ if (value && isMediaMap(value)) {
1814
+ return merge(styles, objectParser(value, props, property, ctx.mediaQueries.map));
1815
+ }
1816
+
1817
+ }
1818
+ };
1819
+
1820
+ function createParser(config) {
1821
+ var propNames = orderPropNames(config);
1822
+ var ctx = {
1823
+ mediaQueries: null
1824
+ };
1825
+
1826
+ var parser = function parser(props) {
1827
+ var isCss = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1828
+ var styles = {};
1829
+ var theme = props.theme; // Attempt to cache the breakpoints if we have not yet or if theme has become available.
1006
1830
 
1007
- const renderPropValue = (styles, prop, props, property, ctx) => {
1008
- const value = get(props, prop);
1009
- switch (typeof value) {
1010
- case 'string':
1011
- case 'number':
1012
- case 'function':
1013
- return Object.assign(styles, property.styleFn(value, prop, props));
1014
- // handle any props configured with the responsive notation
1015
- case 'object':
1016
- if (!ctx.mediaQueries) {
1017
- return;
1018
- }
1019
- // If it is an array the order of values is smallest to largest: [_, xs, ...]
1020
- if (isMediaArray(value)) {
1021
- return merge(styles, arrayParser(value, props, property, ctx.mediaQueries.array));
1022
- }
1023
- // Check to see if value is an object matching the responsive syntax and generate the styles.
1024
- if (value && isMediaMap(value)) {
1025
- return merge(styles, objectParser(value, props, property, ctx.mediaQueries.map));
1026
- }
1027
- }
1028
- };
1029
- function createParser(config) {
1030
- const propNames = orderPropNames(config);
1031
- const ctx = {
1032
- mediaQueries: null,
1033
- };
1034
- const parser = (props, isCss = false) => {
1035
- const styles = {};
1036
- const { theme } = props;
1037
- // Attempt to cache the breakpoints if we have not yet or if theme has become available.
1038
- if (ctx.mediaQueries === null) {
1039
- // Save the breakpoints if we can
1040
- ctx.mediaQueries = createMediaQueries(theme?.breakpoints ?? compatTheme.breakpoints);
1041
- }
1042
- if (!isCss) {
1043
- // Loops over all prop names on the configured config to check for configured styles
1044
- propNames.forEach((prop) => {
1045
- const property = config[prop];
1046
- renderPropValue(styles, prop, props, property, ctx);
1047
- });
1048
- }
1049
- else {
1050
- // Loops over all prop names on the configured config to check for configured styles
1051
- Object.keys(props).forEach((prop) => {
1052
- const property = config[prop];
1053
- if (property) {
1054
- renderPropValue(styles, prop, props, property, ctx);
1055
- }
1056
- else if (prop !== 'theme') {
1057
- Object.assign(styles, { [prop]: get(props, prop) });
1058
- }
1059
- });
1060
- }
1061
- if (ctx.mediaQueries !== null)
1062
- return orderBreakpoints(styles, ctx.mediaQueries.array);
1063
- return styles;
1064
- };
1065
- // return the parser function with the resulting meta information for further composition
1066
- return Object.assign(parser, { propNames, config });
1831
+ if (ctx.mediaQueries === null) {
1832
+ var _theme$breakpoints;
1833
+
1834
+ // Save the breakpoints if we can
1835
+ ctx.mediaQueries = createMediaQueries((_theme$breakpoints = theme === null || theme === void 0 ? void 0 : theme.breakpoints) !== null && _theme$breakpoints !== void 0 ? _theme$breakpoints : compatTheme.breakpoints);
1836
+ }
1837
+
1838
+ if (!isCss) {
1839
+ // Loops over all prop names on the configured config to check for configured styles
1840
+ propNames.forEach(function (prop) {
1841
+ var property = config[prop];
1842
+ renderPropValue(styles, prop, props, property, ctx);
1843
+ });
1844
+ } else {
1845
+ // Loops over all prop names on the configured config to check for configured styles
1846
+ Object.keys(props).forEach(function (prop) {
1847
+ var property = config[prop];
1848
+
1849
+ if (property) {
1850
+ renderPropValue(styles, prop, props, property, ctx);
1851
+ } else if (prop !== 'theme') {
1852
+ Object.assign(styles, _defineProperty({}, prop, get(props, prop)));
1853
+ }
1854
+ });
1855
+ }
1856
+
1857
+ if (ctx.mediaQueries !== null) return orderBreakpoints(styles, ctx.mediaQueries.array);
1858
+ return styles;
1859
+ }; // return the parser function with the resulting meta information for further composition
1860
+
1861
+
1862
+ return Object.assign(parser, {
1863
+ propNames: propNames,
1864
+ config: config
1865
+ });
1067
1866
  }
1068
1867
 
1069
- function createTransform(prop, config) {
1070
- const { transform = identity, property, properties = [property], scale, variable, } = config;
1071
- const alwaysTransform = scale === undefined || isArray(scale);
1072
- return {
1073
- ...config,
1074
- prop,
1075
- styleFn: (value, prop, props) => {
1076
- const styles = {};
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
- };
1868
+ function createTransform(prop, config) {
1869
+ var _config$transform = config.transform,
1870
+ transform = _config$transform === void 0 ? identity : _config$transform,
1871
+ property = config.property,
1872
+ _config$properties = config.properties,
1873
+ properties = _config$properties === void 0 ? [property] : _config$properties,
1874
+ scale = config.scale,
1875
+ variable = config.variable;
1876
+ var alwaysTransform = scale === undefined || isArray(scale);
1877
+ return _objectSpread2(_objectSpread2({}, config), {}, {
1878
+ prop: prop,
1879
+ styleFn: function styleFn(value, prop, props) {
1880
+ var _scaleValue;
1881
+
1882
+ var styles = {};
1883
+
1884
+ if (isUndefined(value)) {
1885
+ return styles;
1886
+ }
1887
+
1888
+ var useTransform = false;
1889
+ var intermediateValue;
1890
+ var scaleValue;
1891
+
1892
+ switch (_typeof(value)) {
1893
+ case 'number':
1894
+ case 'string':
1895
+ scaleValue = lookupScaleValue(value, scale, props.theme);
1896
+ useTransform = scaleValue !== undefined || alwaysTransform;
1897
+ intermediateValue = (_scaleValue = scaleValue) !== null && _scaleValue !== void 0 ? _scaleValue : value;
1898
+ break;
1899
+
1900
+ case 'function':
1901
+ if (props.theme) {
1902
+ intermediateValue = value(props.theme);
1903
+ }
1904
+
1905
+ break;
1906
+
1907
+ default:
1908
+ return styles;
1909
+ } // for each property look up the scale value from theme if passed and apply any
1910
+ // final transforms to the value
1911
+
1912
+
1913
+ properties.forEach(function (property) {
1914
+ var styleValue = intermediateValue;
1915
+
1916
+ if (useTransform && !isUndefined(styleValue)) {
1917
+ styleValue = transform(styleValue, property, props);
1918
+ }
1919
+
1920
+ switch (_typeof(styleValue)) {
1921
+ case 'number':
1922
+ case 'string':
1923
+ return styles[property] = styleValue;
1924
+
1925
+ case 'object':
1926
+ return Object.assign(styles, styleValue);
1927
+ }
1928
+ });
1929
+
1930
+ if (variable) {
1931
+ var styleValue = intermediateValue;
1932
+
1933
+ if (useTransform && !isUndefined(styleValue)) {
1934
+ styleValue = transform(styleValue, property, props);
1935
+ }
1936
+
1937
+ if (styleValue && _typeof(styleValue) !== 'object') {
1938
+ styles[variable] = styleValue;
1939
+ }
1940
+ } // return the resulting styles object
1941
+
1942
+
1943
+ return styles;
1944
+ }
1945
+ });
1126
1946
  }
1127
1947
 
1128
- function create(config) {
1129
- // Create a transform function for each of the props
1130
- const transforms = {};
1131
- for (const prop in config) {
1132
- if (typeof prop === 'string') {
1133
- transforms[prop] = createTransform(prop, config[prop]);
1134
- }
1135
- }
1136
- // Create a parser that handles all the props within the config
1137
- return createParser(transforms);
1948
+ function create(config) {
1949
+ // Create a transform function for each of the props
1950
+ var transforms = {};
1951
+
1952
+ for (var prop in config) {
1953
+ if (typeof prop === 'string') {
1954
+ transforms[prop] = createTransform(prop, config[prop]);
1955
+ }
1956
+ } // Create a parser that handles all the props within the config
1957
+
1958
+
1959
+ return createParser(transforms);
1138
1960
  }
1139
1961
 
1140
- function createCss(config) {
1141
- const parser = create(config);
1142
- const filteredProps = parser.propNames;
1143
- return (cssProps) => {
1144
- let cache;
1145
- const allKeys = Object.keys(cssProps);
1146
- /** Any key of the CSSProps that is not a System Prop or a Static CSS Property is treated as a nested selector */
1147
- const selectors = allKeys.filter((key) => !filteredProps.includes(key) && isObject(cssProps[key]));
1148
- /** Static CSS Properties get extracted if they match neither syntax */
1149
- const staticCss = getStylePropNames(cssProps, [
1150
- 'theme',
1151
- ...selectors,
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
- };
1962
+ function createCss(config) {
1963
+ var parser = create(config);
1964
+ var filteredProps = parser.propNames;
1965
+ return function (cssProps) {
1966
+ var cache;
1967
+ var allKeys = Object.keys(cssProps);
1968
+ /** Any key of the CSSProps that is not a System Prop or a Static CSS Property is treated as a nested selector */
1969
+
1970
+ var selectors = allKeys.filter(function (key) {
1971
+ return !filteredProps.includes(key) && isObject(cssProps[key]);
1972
+ });
1973
+ /** Static CSS Properties get extracted if they match neither syntax */
1974
+
1975
+ var staticCss = getStylePropNames(cssProps, ['theme'].concat(_toConsumableArray(selectors), _toConsumableArray(filteredProps)));
1976
+ return function (_ref) {
1977
+ var theme = _ref.theme;
1978
+ if (cache) return cache;
1979
+ var css = parser(_objectSpread2(_objectSpread2({}, cssProps), {}, {
1980
+ theme: theme
1981
+ }));
1982
+ selectors.forEach(function (selector) {
1983
+ var _cssProps$selector;
1984
+
1985
+ var selectorConfig = (_cssProps$selector = cssProps[selector]) !== null && _cssProps$selector !== void 0 ? _cssProps$selector : {};
1986
+ css[selector] = _objectSpread2(_objectSpread2({}, getStylePropNames(selectorConfig, filteredProps)), parser(_objectSpread2(_objectSpread2({}, selectorConfig), {}, {
1987
+ theme: theme
1988
+ })));
1989
+ });
1990
+ /** Merge the static and generated css and save it to the cache */
1991
+
1992
+ cache = _objectSpread2(_objectSpread2({}, staticCss), css);
1993
+ return cache;
1994
+ };
1995
+ };
1173
1996
  }
1174
1997
 
1175
- function createVariant(config) {
1176
- const css = createCss(config);
1177
- return ({ prop = 'variant', defaultVariant, base = {}, variants }) => {
1178
- const baseFn = css(base);
1179
- const variantFns = {};
1180
- Object.keys(variants).forEach((key) => {
1181
- const variantKey = key;
1182
- const cssProps = variants[variantKey];
1183
- variantFns[variantKey] = css(cssProps);
1184
- });
1185
- return (props) => {
1186
- const { [prop]: selected = defaultVariant } = props;
1187
- const styles = {};
1188
- if (!selected)
1189
- return styles;
1190
- return merge(styles, baseFn(props), variantFns?.[selected]?.(props));
1191
- };
1192
- };
1998
+ function createVariant(config) {
1999
+ var css = createCss(config);
2000
+ return function (_ref) {
2001
+ var _ref$prop = _ref.prop,
2002
+ prop = _ref$prop === void 0 ? 'variant' : _ref$prop,
2003
+ defaultVariant = _ref.defaultVariant,
2004
+ _ref$base = _ref.base,
2005
+ base = _ref$base === void 0 ? {} : _ref$base,
2006
+ variants = _ref.variants;
2007
+ var baseFn = css(base);
2008
+ var variantFns = {};
2009
+ Object.keys(variants).forEach(function (key) {
2010
+ var variantKey = key;
2011
+ var cssProps = variants[variantKey];
2012
+ variantFns[variantKey] = css(cssProps);
2013
+ });
2014
+ return function (props) {
2015
+ var _variantFns$selected;
2016
+
2017
+ var _props$prop = props[prop],
2018
+ selected = _props$prop === void 0 ? defaultVariant : _props$prop;
2019
+ var styles = {};
2020
+ if (!selected) return styles;
2021
+ 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));
2022
+ };
2023
+ };
1193
2024
  }
1194
2025
 
1195
- function compose(...parsers) {
1196
- return createParser(parsers.reduce((carry, parser) => ({ ...carry, ...parser.config }), {}));
2026
+ function compose() {
2027
+ for (var _len = arguments.length, parsers = new Array(_len), _key = 0; _key < _len; _key++) {
2028
+ parsers[_key] = arguments[_key];
2029
+ }
2030
+
2031
+ return createParser(parsers.reduce(function (carry, parser) {
2032
+ return _objectSpread2(_objectSpread2({}, carry), parser.config);
2033
+ }, {}));
1197
2034
  }
1198
2035
 
1199
- function createStates(config) {
1200
- const css = createCss(config);
1201
- return (states) => {
1202
- const orderedStates = Object.keys(states);
1203
- const stateFns = {};
1204
- orderedStates.forEach((key) => {
1205
- const stateKey = key;
1206
- const cssProps = states[stateKey];
1207
- stateFns[stateKey] = css(cssProps);
1208
- });
1209
- return (props) => {
1210
- const styles = {};
1211
- orderedStates.forEach((state) => {
1212
- merge(styles, props[state] && stateFns[state](props));
1213
- });
1214
- return styles;
1215
- };
1216
- };
2036
+ function createStates(config) {
2037
+ var css = createCss(config);
2038
+ return function (states) {
2039
+ var orderedStates = Object.keys(states);
2040
+ var stateFns = {};
2041
+ orderedStates.forEach(function (key) {
2042
+ var stateKey = key;
2043
+ var cssProps = states[stateKey];
2044
+ stateFns[stateKey] = css(cssProps);
2045
+ });
2046
+ return function (props) {
2047
+ var styles = {};
2048
+ orderedStates.forEach(function (state) {
2049
+ merge(styles, props[state] && stateFns[state](props));
2050
+ });
2051
+ return styles;
2052
+ };
2053
+ };
1217
2054
  }
1218
2055
 
1219
- const animusProps = {
1220
- compose,
1221
- create,
1222
- createCss,
1223
- createVariant,
1224
- createStates,
2056
+ var animusProps = {
2057
+ compose: compose,
2058
+ create: create,
2059
+ createCss: createCss,
2060
+ createVariant: createVariant,
2061
+ createStates: createStates
1225
2062
  };
1226
2063
 
1227
- const animus = config.build();
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 };