@animus-ui/core 0.1.1-beta.10 → 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 +1,2068 @@
1
- import{isNumber as r,get as e,isArray as t,isObject as o,isString as s,isUndefined as i,identity as p,mapValues as a,omit as n,intersection as d,merge as c,pick as l,isEmpty as u,set as g,keys as y}from"lodash";import m from"@emotion/styled";const f=()=>[],b=r=>0===r?r:r<=1&&r>=-1?100*r+"%":`${r}px`,h=/(-?\d*\.?\d+)(%|\w*)/,R=e=>{if(r(e))return b(e);if(e.includes("calc"))return e;const[t,o,s]=h.exec(e)||[];if(void 0===t)return e;const i=parseFloat(o);return s?`${i}${s}`:b(i)},x={max:"max-content",min:"min-content"},w=new RegExp(/^[0-9]*$/),S=r=>{var t;return`minmax(0, ${t=r,w.test(t)?`${r}fr`:e(x,r,r)})`},v=(r,e)=>{const t=S(r);return e>1?`repeat(${e}, ${t})`:t},j=r=>{const e=r.split(":");let t=["",0],o="";for(let r=0;r<e.length+1;r+=1){const s=o.length>0?" ":"",i=e[r];t?.[0]!==i?(t[0].length&&(o+=s+v(...t)),i&&(t=[i,1])):t[1]+=1}return o},C=e=>r(e)?v("1",e):j(e),O=(r,e)=>"number"==typeof r?e(r):r,T=r=>O(r,(r=>`${r}px`)),k=r=>O(r,(r=>`${r}px solid currentColor`)),E={spacing:[0,4,8,12,16,24,32,40,48,64,96],fontSize:[64,44,34,26,22,20,18,16,14],lineHeight:{body:1.5,heading:1},fontWeight:[400,600,700],fontFamily:{body:"Verdana, sans-serif",heading:"Verdana, Lato, sans-serif",monospace:"monospace"},radii:[2,4,6,8],borders:[1,2,3],colors:{},modes:{},mode:void 0},W=(r,i,p)=>{if(t(i))return r;if(o(i))return e(i,r);if(s(i)){const o=e(p,i,e(E,i));if(!o)return;return t(o)?r:e(o,r)}},B=(r,e,o)=>{const s={},{transform:a=p,property:n,properties:d=[n],scale:c,variable:l}=o,u=void 0===c||t(c);if(i(r))return s;let g,y,m=!1;switch(typeof r){case"number":case"string":y=W(r,c,e?.theme),m=void 0!==y||u,g=y??r;break;case"function":e.theme&&(g=r(e.theme));break;default:return s}if(d.forEach((r=>{let t=g;switch(m&&!i(t)&&(t=a(t,r,e)),typeof t){case"number":case"string":return s[r]=t;case"object":return Object.assign(s,t)}})),l){let r=g;m&&!i(r)&&(r=a(r,n,e)),r&&"object"!=typeof r&&(s[l]=r)}return s},L=["border","borderTop","borderBottom","borderLeft","borderRight","borderWidth","borderStyle","borderColor","background","flex","margin","padding","transition","gap","grid","gridArea","gridColumn","gridRow","gridTemplate","overflow","transition"],A=-1,G=1,Q=1,$=(r,e)=>r<e?A:e<r?G:Q,F=r=>Object.keys(r).sort(((e,t)=>{const{[e]:o,[t]:s}=r,{property:i,properties:p=[]}=o,{property:a,properties:n=[]}=s,d=L.includes(i),c=L.includes(a);if(d&&c){const r=p.length,e=n.length;if(i!==a)return $(L.indexOf(i),L.indexOf(a));if(i===a){if(0===r)return A;if(0===e)return G}return $(e,r)}return d?A:c?G:Q})),H=["_","xs","sm","md","lg","xl"],z=r=>`@media screen and (min-width: ${r}px)`,I={xs:480,sm:768,md:1024,lg:1200,xl:1440},X=(r,t,o,s,i)=>{const p=e(o,t);switch(typeof p){case"string":case"number":case"function":return Object.assign(r,B(p,o,s));case"object":if(!i.mediaQueries)return;if(a=p,Array.isArray(a))return c(r,((r,e,t,o)=>{const s={},[i,...p]=r;return i&&Object.assign(s,B(i,e,t)),p.forEach(((r,i)=>{const p=o[i];p&&void 0!==r&&Object.assign(s,{[p]:B(r,e,t)})})),s})(p,o,s,i.mediaQueries.array));if(p&&(r=>d(Object.keys(r),H).length>0)(p))return c(r,((r,e,t,o)=>{const s={},{_:i,...p}=r;return i&&Object.assign(s,B(i,e,t)),Object.keys(o).forEach((r=>{const i=p[r];void 0!==i&&Object.assign(s,{[o[r]]:B(i,e,t)})})),s})(p,o,s,i.mediaQueries.map))}var a};function Y(r){const t=F(r),o={mediaQueries:null};return Object.assign(((s,i=!1)=>{const p={},{theme:d}=s;return null===o.mediaQueries&&(o.mediaQueries=(r=>{if(void 0===r)return null;const{xs:e,sm:t,md:o,lg:s,xl:i}=r??{};return{map:a(r,z),array:[e,t,o,s,i].map(z)}})(d?.breakpoints??I)),i?Object.keys(s).forEach((t=>{const i=r[t];i?X(p,t,s,i,o):"theme"!==t&&Object.assign(p,{[t]:e(s,t)})})):t.forEach((e=>{const t=r[e];X(p,e,s,t,o)})),null!==o.mediaQueries?((r,e)=>{const t=n(r,e);return e.forEach((e=>{r[e]&&(t[e]=r[e])})),t})(p,o.mediaQueries.array):p}),{propNames:t,config:r})}const D=(r,e)=>{const t=Object.keys(r),o=Object.keys(e);return r=>{const e=[];return t.forEach((t=>{r[t]&&e.push(`${t}-${r[t]}`)})),o.forEach((t=>{r[t]&&e.push(t)})),e}},N=(r,e)=>{const t={},o={};return Object.entries(r).forEach((([r,s])=>{(e.includes(r)?o:t)[r]=s})),[t,o]},V=(r,e,t,o)=>{const{base:s}=e,{parser:i,getMediaSelectors:p,getActiveOverrides:a}=o,{theme:n}=t,d=Object.values(l(e,a(t))),c=p(t),[g,y]=N(i({...s,theme:n},!0),c);for(const e in g)r[e]=g[e];d.forEach((e=>{((r={},e,t,o,s,i)=>{const[p,a]=N(o({...r,theme:s},!0),i);for(const r in p)e[r]=p[r];i.forEach((r=>{const e=a[r];if(!e||u(e))return;t[r]||(t[r]={});const o=t[r];for(const r in e)o[r]=e[r]}))})(e,r,y,i,n,c)})),c.forEach((e=>{const t=y[e];u(t)||(r[e]=t)}))},_=(r,e={},t={},s={})=>{const i=((r={},e={},t={},s)=>{const i={};return Object.entries(r).forEach((([r,e])=>{!s.includes(r)&&o(e)?g(i,[r,"base"],e):g(i,["primary","base",r],e)})),Object.entries(e).forEach((([r,{variants:e}])=>{Object.entries(e).forEach((([e,t])=>{const p=`${r}-${e}`;Object.entries(t).forEach((([r,e])=>{!s.includes(r)&&o(e)?g(i,[r,p],e):g(i,["primary",p,r],e)}))}))})),Object.entries(t).forEach((([r,e])=>{Object.entries(e).forEach((([e,t])=>{!s.includes(e)&&o(t)?g(i,[e,r],t):g(i,["primary",r,e],t)}))})),i})(e,t,s,r.propNames),p={parser:r,getMediaSelectors:({theme:r})=>{const e=r?.breakpoints??I;return["xs","sm","md","lg","xl"].map((r=>e[r]))},getActiveOverrides:D(t,s)};return e=>{const{vars:t}=e,o={...t};return Object.entries(i).forEach((([r,t={}])=>{"primary"===r?V(o,t,e,p):(o[r]={},V(o[r],t,e,p))})),V(o,{base:r(e)},e,p),o}};class M{propRegistry={};groupRegistry={};parser={};baseStyles={};statesConfig={};variants={};activeGroups={};custom={};constructor(r,e,t,o,s,i,p,a){this.propRegistry=r,this.groupRegistry=e,this.parser=t,this.baseStyles=o,this.variants=s,this.statesConfig=i,this.activeGroups=p,this.custom=a}asComponent(r){const e=_(Y({...this.parser.config,...this.custom}),this.baseStyles,this.variants,this.statesConfig);return m(r)(e)}build(){return _(Y({...this.parser.config,...this.custom}),this.baseStyles,this.variants,this.statesConfig)}}class P extends M{constructor(r,e,t,o,s,i,p){super(r,e,t,o,s,i,p,{})}props(r){return new M(this.propRegistry,this.groupRegistry,this.parser,this.baseStyles,this.variants,this.statesConfig,this.activeGroups,r)}}class q extends P{constructor(r,e,t,o,s,i){super(r,e,t,o,s,i,{})}groups(r){return new P(this.propRegistry,this.groupRegistry,this.parser,this.baseStyles,this.variants,this.statesConfig,r)}}class J extends q{constructor(r,e,t,o,s){super(r,e,t,o,s,{})}states(r){return new q(this.propRegistry,this.groupRegistry,this.parser,this.baseStyles,this.variants,r)}variant(r){const e=r.prop||"variant";return new J(this.propRegistry,this.groupRegistry,this.parser,this.baseStyles,c(this.variants,{[e]:r}))}}class K extends J{constructor(r,e,t,o){super(r,e,t,o,{})}variant(r){const e=r.prop||"variant";return new J(this.propRegistry,this.groupRegistry,this.parser,this.baseStyles,c(this.variants,{[e]:r}))}}class U extends K{constructor(r,e){super(r,e,Y(r),{})}styles(r){return new K(this.propRegistry,this.groupRegistry,this.parser,r)}}class Z{#r={};#e={};constructor(r,e){this.#r=r||{},this.#e=e||{}}addGroup(r,e){const t={[r]:Object.keys(e)};return new Z({...this.#r,...e},{...this.#e,...t})}build(){const r=this.#r,e=this.#e;return new U(r,e)}}const rr=()=>new Z,er={border:{property:"border",scale:"borders",transform:k},borderX:{property:"border",properties:["borderLeft","borderRight"],scale:"borders",transform:k},borderY:{property:"border",properties:["borderTop","borderBottom"],scale:"borders",transform:k},borderTop:{property:"borderTop",scale:"borders",transform:k},borderRight:{property:"borderRight",scale:"borders",transform:k},borderBottom:{property:"borderBottom",scale:"borders",transform:k},borderLeft:{property:"borderLeft",scale:"borders",transform:k},borderWidth:{property:"borderWidth"},borderWidthX:{property:"borderWidth",properties:["borderLeftWidth","borderRightWidth"]},borderWidthY:{property:"borderWidth",properties:["borderTopWidth","borderBottomWidth"]},borderWidthLeft:{property:"borderLeftWidth"},borderWidthRight:{property:"borderRightWidth"},borderWidthTop:{property:"borderTopWidth"},borderWidthBottom:{property:"borderBottomWidth"},borderRadius:{property:"borderRadius",scale:"radii",transform:T},borderRadiusLeft:{property:"borderRadius",properties:["borderTopLeftRadius","borderBottomLeftRadius"],scale:"radii",transform:T},borderRadiusTop:{property:"borderRadius",properties:["borderTopLeftRadius","borderTopRightRadius"],scale:"radii",transform:T},borderRadiusBottom:{property:"borderRadius",properties:["borderBottomLeftRadius","borderBottomRightRadius"],scale:"radii",transform:T},borderRadiusRight:{property:"borderRadius",properties:["borderTopRightRadius","borderBottomRightRadius"],scale:"radii",transform:T},borderRadiusTopLeft:{property:"borderTopLeftRadius",scale:"radii",transform:T},borderRadiusTopRight:{property:"borderTopRightRadius",scale:"radii",transform:T},borderRadiusBottomRight:{property:"borderBottomRightRadius",scale:"radii",transform:T},borderRadiusBottomLeft:{property:"borderBottomLeftRadius",scale:"radii",transform:T},borderStyle:{property:"borderStyle"},borderStyleX:{property:"borderStyle",properties:["borderLeftStyle","borderRightStyle"]},borderStyleY:{property:"borderStyle",properties:["borderTopStyle","borderBottomStyle"]},borderStyleLeft:{property:"borderLeftStyle"},borderStyleRight:{property:"borderRightStyle"},borderStyleTop:{property:"borderTopStyle"},borderStyleBottom:{property:"borderBottomStyle"}},tr={gap:{property:"gap",scale:"spacing"},rowGap:{property:"rowGap",scale:"spacing"},columnGap:{property:"columnGap",scale:"spacing"}},or={justifySelf:{property:"justifySelf"},alignSelf:{property:"alignSelf"},gridArea:{property:"gridArea"},area:{property:"gridArea"}},sr={justifyContent:{property:"justifyContent"},justifyItems:{property:"justifyItems"},alignItems:{property:"alignItems"},alignContent:{property:"alignContent"},...or},ir={flexBasis:{property:"flexBasis"},flexShrink:{property:"flexShrink"},flexGrow:{property:"flexGrow"},order:{property:"order"}},pr={flexDirection:{property:"flexDirection"},flexWrap:{property:"flexWrap"},flex:{property:"flex"},...sr,...ir,...tr},ar={gridColumn:{property:"gridColumn"},gridRow:{property:"gridRow"},gridColumnStart:{property:"gridColumnStart"},gridRowStart:{property:"gridRowStart"},gridColumnEnd:{property:"gridColumnEnd"},gridRowEnd:{property:"gridRowEnd"}},nr={gridAutoColumns:{property:"gridAutoColumns"},gridAutoRows:{property:"gridAutoRows"},gridTemplateColumns:{property:"gridTemplateColumns"},gridTemplateRows:{property:"gridTemplateRows"},gridTemplateAreas:{property:"gridTemplateAreas"},gridAutoFlow:{property:"gridAutoFlow"},flow:{property:"gridAutoFlow",scale:[]},cols:{property:"gridTemplateColumns",transform:C,scale:[]},rows:{property:"gridTemplateRows",transform:C,scale:[]},autoRows:{property:"gridAutoRows",transform:S},autoCols:{property:"gridAutoColumns",transform:S},alignAll:{property:"justifyContent",properties:["justifyContent","alignItems"]},...sr,...ar,...tr},dr={position:{property:"position"},inset:{property:"inset",properties:["top","right","bottom","left"],transform:R},top:{property:"top",transform:R},right:{property:"right",transform:R},bottom:{property:"bottom",transform:R},left:{property:"left",transform:R},zIndex:{property:"zIndex"},opacity:{property:"opacity"}},cr={display:{property:"display"},overflow:{property:"overflow"},overflowX:{property:"overflowX"},overflowY:{property:"overflowY"},size:{property:"width",properties:["width","height"],transform:R},width:{property:"width",transform:R},minWidth:{property:"minWidth",transform:R},maxWidth:{property:"maxWidth",transform:R},height:{property:"height",transform:R},minHeight:{property:"minHeight",transform:R},maxHeight:{property:"maxHeight",transform:R},verticalAlign:{property:"verticalAlign"},...or,...ar,...ir},lr={m:{property:"margin",scale:"spacing"},mx:{property:"margin",properties:["marginLeft","marginRight"],scale:"spacing"},my:{property:"margin",properties:["marginTop","marginBottom"],scale:"spacing"},mt:{property:"marginTop",scale:"spacing"},mb:{property:"marginBottom",scale:"spacing"},mr:{property:"marginRight",scale:"spacing"},ml:{property:"marginLeft",scale:"spacing"},p:{property:"padding",scale:"spacing"},px:{property:"padding",properties:["paddingLeft","paddingRight"],scale:"spacing"},py:{property:"padding",properties:["paddingTop","paddingBottom"],scale:"spacing"},pt:{property:"paddingTop",scale:"spacing"},pb:{property:"paddingBottom",scale:"spacing"},pr:{property:"paddingRight",scale:"spacing"},pl:{property:"paddingLeft",scale:"spacing"}},ur=rr().addGroup("flex",pr).addGroup("grid",nr).addGroup("mode",{mode:{property:"none",scale:"mode"}}).addGroup("vars",{vars:{property:"variables"}}).addGroup("space",lr).addGroup("color",{color:{property:"color",scale:"colors"},textColor:{property:"color",scale:"colors"},bg:{property:"backgroundColor",scale:"colors"},borderColor:{property:"borderColor",scale:"colors"},borderColorX:{property:"borderColor",properties:["borderLeftColor","borderRightColor"],scale:"colors"},borderColorY:{property:"borderColor",properties:["borderTopColor","borderBottomColor"],scale:"colors"},borderColorLeft:{property:"borderLeftColor",scale:"colors"},borderColorRight:{property:"borderRightColor",scale:"colors"},borderColorTop:{property:"borderTopColor",scale:"colors"},borderColorBottom:{property:"borderBottomColor",scale:"colors"}}).addGroup("layout",cr).addGroup("borders",er).addGroup("shadows",{boxShadow:{property:"boxShadow"},textShadow:{property:"textShadow"}}).addGroup("background",{background:{property:"background"},backgroundImage:{property:"backgroundImage"},backgroundSize:{property:"backgroundSize"},backgroundRepeat:{property:"backgroundRepeat"},backgroundPosition:{property:"backgroundPosition"}}).addGroup("typography",{fontFamily:{property:"fontFamily",scale:"fontFamily"},fontWeight:{property:"fontWeight",scale:"fontWeight"},lineHeight:{property:"lineHeight",scale:"lineHeight",lineHeight:"lineHeight"},fontSize:{property:"fontSize",scale:"fontSize"},letterSpacing:{property:"letterSpacing"},textAlign:{property:"textAlign"},fontStyle:{property:"fontStyle"},textDecoration:{property:"textDecoration"},textTransform:{property:"textTransform"},whiteSpace:{property:"whiteSpace"}}).addGroup("positioning",dr);ur.build();const gr=(r,e)=>l(r,y(r).filter((r=>!e.includes(r)))),yr=["_","xs","sm","md","lg","xl"],mr=r=>`@media screen and (min-width: ${r}px)`,fr={xs:480,sm:768,md:1024,lg:1200,xl:1440},br=(r,t,o,s,i)=>{const p=e(o,t);switch(typeof p){case"string":case"number":case"function":return Object.assign(r,s.styleFn(p,t,o));case"object":if(!i.mediaQueries)return;if(a=p,Array.isArray(a))return c(r,((r,e,t,o)=>{const s={},{styleFn:i,prop:p}=t,[a,...n]=r;return a&&Object.assign(s,i(a,p,e)),n.forEach(((r,t)=>{const a=o[t];a&&void 0!==r&&Object.assign(s,{[a]:i(r,p,e)})})),s})(p,o,s,i.mediaQueries.array));if(p&&(r=>d(Object.keys(r),yr).length>0)(p))return c(r,((r,e,t,o)=>{const s={},{styleFn:i,prop:p}=t,{_:a,...n}=r;return a&&Object.assign(s,i(a,p,e)),Object.keys(o).forEach((r=>{const t=n[r];void 0!==t&&Object.assign(s,{[o[r]]:i(t,p,e)})})),s})(p,o,s,i.mediaQueries.map))}var a};function hr(r){const t=F(r),o={mediaQueries:null};return Object.assign(((s,i=!1)=>{const p={},{theme:d}=s;return null===o.mediaQueries&&(o.mediaQueries=(r=>{if(void 0===r)return null;const{xs:e,sm:t,md:o,lg:s,xl:i}=r??{};return{map:a(r,mr),array:[e,t,o,s,i].map(mr)}})(d?.breakpoints??fr)),i?Object.keys(s).forEach((t=>{const i=r[t];i?br(p,t,s,i,o):"theme"!==t&&Object.assign(p,{[t]:e(s,t)})})):t.forEach((e=>{const t=r[e];br(p,e,s,t,o)})),null!==o.mediaQueries?((r,e)=>{const t=n(r,e);return e.forEach((e=>{r[e]&&(t[e]=r[e])})),t})(p,o.mediaQueries.array):p}),{propNames:t,config:r})}function Rr(r,e){const{transform:o=p,property:s,properties:a=[s],scale:n,variable:d}=e,c=void 0===n||t(n);return{...e,prop:r,styleFn:(r,e,t)=>{const p={};if(i(r))return p;let l,u,g=!1;switch(typeof r){case"number":case"string":u=W(r,n,t.theme),g=void 0!==u||c,l=u??r;break;case"function":t.theme&&(l=r(t.theme));break;default:return p}if(a.forEach((r=>{let e=l;switch(g&&!i(e)&&(e=o(e,r,t)),typeof e){case"number":case"string":return p[r]=e;case"object":return Object.assign(p,e)}})),d){let r=l;g&&!i(r)&&(r=o(r,s,t)),r&&"object"!=typeof r&&(p[d]=r)}return p}}}function xr(r){const e={};for(const t in r)"string"==typeof t&&(e[t]=Rr(t,r[t]));return hr(e)}function wr(r){const e=xr(r),t=e.propNames;return r=>{let s;const i=Object.keys(r).filter((e=>!t.includes(e)&&o(r[e]))),p=gr(r,["theme",...i,...t]);return({theme:o})=>{if(s)return s;const a=e({...r,theme:o});return i.forEach((s=>{const i=r[s]??{};a[s]={...gr(i,t),...e({...i,theme:o})}})),s={...p,...a},s}}}const Sr={compose:function(...r){return hr(r.reduce(((r,e)=>({...r,...e.config})),{}))},create:xr,createCss:wr,createVariant:function(r){const e=wr(r);return({prop:r="variant",defaultVariant:t,base:o={},variants:s})=>{const i=e(o),p={};return Object.keys(s).forEach((r=>{const t=r,o=s[t];p[t]=e(o)})),e=>{const{[r]:o=t}=e,s={};return o?c(s,i(e),p?.[o]?.(e)):s}}},createStates:function(r){const e=wr(r);return r=>{const t=Object.keys(r),o={};return t.forEach((t=>{const s=t,i=r[s];o[s]=e(i)})),r=>{const e={};return t.forEach((t=>{c(e,r[t]&&o[t](r))})),e}}}},vr=ur.build();export{Z as AnimusConfig,vr as animus,Sr as animusProps,k as borderShorthand,E as compatTheme,ur as config,rr as createAnimus,f as createScale,S as gridItem,C as gridItemRatio,T as numberToPx,O as numberToTemplate,j as parseGridRatio,b as percentageOrAbsolute,v as repeatGridItem,R as size};
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/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 [];
335
+ };
336
+
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");
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];
363
+
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'
375
+ };
376
+ var unitlessNumber = new RegExp(/^[0-9]*$/);
377
+
378
+ var isUnitlessNumber = function isUnitlessNumber(val) {
379
+ return unitlessNumber.test(val);
380
+ };
381
+
382
+ var gridItem = function gridItem(item) {
383
+ var template = isUnitlessNumber(item) ? "".concat(item, "fr") : get(gridItemMap, item, item);
384
+ return "minmax(0, ".concat(template, ")");
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;
503
+
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;
548
+ };
549
+
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
555
+ };
556
+
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
+ };
562
+ /**
563
+ * Orders all properties by the most dependent props
564
+ * @param config
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'];
605
+ /**
606
+ * Destructures the themes breakpoints into an ordered structure to traverse
607
+ */
608
+
609
+ var templateMediaQuery$1 = function templateMediaQuery(breakpoint) {
610
+ return "@media screen and (min-width: ".concat(breakpoint, "px)");
611
+ };
612
+
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
+
623
+
624
+ return {
625
+ map: mapValues(breakpoints, templateMediaQuery$1),
626
+ array: [xs, sm, md, lg, xl].map(templateMediaQuery$1)
627
+ };
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.
699
+
700
+
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
+ });
754
+ }
755
+
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);
1703
+ config.build();
1704
+
1705
+ var getStylePropNames = function getStylePropNames(props, filteredKeys) {
1706
+ return pick(props, keys(props).filter(function (key) {
1707
+ return !filteredKeys.includes(key);
1708
+ }));
1709
+ };
1710
+
1711
+ var _excluded = ["_"];
1712
+ var BREAKPOINT_KEYS = ['_', 'xs', 'sm', 'md', 'lg', 'xl'];
1713
+ /**
1714
+ * Destructures the themes breakpoints into an ordered structure to traverse
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;
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.
1830
+
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
+ });
1866
+ }
1867
+
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
+ });
1946
+ }
1947
+
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);
1960
+ }
1961
+
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
+ };
1996
+ }
1997
+
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
+ };
2024
+ }
2025
+
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
+ }, {}));
2034
+ }
2035
+
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
+ };
2054
+ }
2055
+
2056
+ var animusProps = {
2057
+ compose: compose,
2058
+ create: create,
2059
+ createCss: createCss,
2060
+ createVariant: createVariant,
2061
+ createStates: createStates
2062
+ };
2063
+
2064
+ /** Export full builder */
2065
+
2066
+ var animus = config.build();
2067
+
2068
+ export { AnimusConfig, animus, animusProps, borderShorthand, compatTheme, config, createAnimus, createScale, gridItem, gridItemRatio, numberToPx, numberToTemplate, parseGridRatio, percentageOrAbsolute, repeatGridItem, size };