@animus-ui/core 0.1.1-beta.2 → 0.1.1-beta.20

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