@flodesk/grain 10.9.4 → 10.9.6
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/es/components/box2.js +40 -42
- package/es/styles/utilities.js +7 -5
- package/es/utilities/attributes.js +29 -24
- package/es/utilities/helpers.js +0 -186
- package/es/utilities/style-config.js +102 -43
- package/package.json +1 -1
package/es/components/box2.js
CHANGED
|
@@ -30,22 +30,11 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
30
30
|
import React, { forwardRef } from 'react';
|
|
31
31
|
import { types } from '../types';
|
|
32
32
|
import PropTypes from 'prop-types';
|
|
33
|
-
import {
|
|
33
|
+
import { generateStyleAttributes, generateClassNameAttributes } from '../utilities';
|
|
34
34
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
35
|
-
var dimensionProps = styleConfig.dimensionProps,
|
|
36
|
-
colorProps = styleConfig.colorProps,
|
|
37
|
-
zIndexProps = styleConfig.zIndexProps,
|
|
38
|
-
aspectRatioProps = styleConfig.aspectRatioProps,
|
|
39
|
-
flexProps = styleConfig.flexProps,
|
|
40
|
-
spaceProps = styleConfig.spaceProps,
|
|
41
|
-
shadowProps = styleConfig.shadowProps,
|
|
42
|
-
radiusProps = styleConfig.radiusProps,
|
|
43
|
-
orderProps = styleConfig.orderProps,
|
|
44
|
-
positionProps = styleConfig.positionProps,
|
|
45
|
-
overflowProps = styleConfig.overflowProps,
|
|
46
|
-
transitionProps = styleConfig.transitionProps,
|
|
47
|
-
cursorProps = styleConfig.cursorProps;
|
|
48
35
|
export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
36
|
+
var _generateClassNameAtt;
|
|
37
|
+
|
|
49
38
|
var all = _ref.all,
|
|
50
39
|
color = _ref.color,
|
|
51
40
|
colorHover = _ref.colorHover,
|
|
@@ -101,21 +90,44 @@ export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
101
90
|
style = _ref.style,
|
|
102
91
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
103
92
|
|
|
104
|
-
var
|
|
105
|
-
all: all,
|
|
106
|
-
color: color,
|
|
107
|
-
colorHover: colorHover,
|
|
108
|
-
backgroundColor: backgroundColor,
|
|
109
|
-
backgroundColorHover: backgroundColorHover,
|
|
110
|
-
borderColorHover: borderColorHover,
|
|
111
|
-
borderSide: borderSide,
|
|
93
|
+
var styles = _objectSpread({}, generateStyleAttributes({
|
|
112
94
|
width: width,
|
|
113
95
|
minWidth: minWidth,
|
|
114
96
|
maxWidth: maxWidth,
|
|
115
97
|
height: height,
|
|
116
98
|
minHeight: minHeight,
|
|
117
99
|
maxHeight: maxHeight,
|
|
100
|
+
color: color,
|
|
101
|
+
colorHover: colorHover,
|
|
102
|
+
backgroundColor: backgroundColor,
|
|
103
|
+
backgroundColorHover: backgroundColorHover,
|
|
104
|
+
padding: padding,
|
|
105
|
+
paddingTop: paddingTop,
|
|
106
|
+
paddingBottom: paddingBottom,
|
|
107
|
+
paddingLeft: paddingLeft,
|
|
108
|
+
paddingRight: paddingRight,
|
|
109
|
+
paddingX: paddingX,
|
|
110
|
+
paddingY: paddingY,
|
|
111
|
+
margin: margin,
|
|
112
|
+
marginTop: marginTop,
|
|
113
|
+
marginBottom: marginBottom,
|
|
114
|
+
marginLeft: marginLeft,
|
|
115
|
+
marginRight: marginRight,
|
|
116
|
+
marginX: marginX,
|
|
117
|
+
marginY: marginY,
|
|
118
|
+
shadow: shadow,
|
|
119
|
+
shadowHover: shadowHover,
|
|
118
120
|
radius: radius,
|
|
121
|
+
order: order,
|
|
122
|
+
zIndex: zIndex,
|
|
123
|
+
transition: transition,
|
|
124
|
+
transitionHover: transitionHover,
|
|
125
|
+
aspectRatio: aspectRatio,
|
|
126
|
+
flex: flex
|
|
127
|
+
}));
|
|
128
|
+
|
|
129
|
+
var propClassName = className ? className : '';
|
|
130
|
+
var classNames = [generateClassNameAttributes((_generateClassNameAtt = {
|
|
119
131
|
padding: padding,
|
|
120
132
|
paddingTop: paddingTop,
|
|
121
133
|
paddingBottom: paddingBottom,
|
|
@@ -135,28 +147,14 @@ export var Box2 = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
135
147
|
bottom: bottom,
|
|
136
148
|
left: left,
|
|
137
149
|
right: right,
|
|
150
|
+
color: color,
|
|
151
|
+
colorHover: colorHover,
|
|
152
|
+
backgroundColor: backgroundColor,
|
|
153
|
+
backgroundColorHover: backgroundColorHover,
|
|
138
154
|
shadow: shadow,
|
|
139
155
|
shadowHover: shadowHover,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
overflowY: overflowY,
|
|
143
|
-
aspectRatio: aspectRatio,
|
|
144
|
-
zIndex: zIndex,
|
|
145
|
-
tag: tag,
|
|
146
|
-
opacity: opacity,
|
|
147
|
-
opacityHover: opacityHover,
|
|
148
|
-
order: order,
|
|
149
|
-
alignSelf: alignSelf,
|
|
150
|
-
flex: flex,
|
|
151
|
-
transition: transition,
|
|
152
|
-
transitionHover: transitionHover,
|
|
153
|
-
cursor: cursor
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
var styles = _objectSpread({}, generateStyleAttributes([dimensionProps, colorProps, spaceProps, shadowProps, radiusProps, orderProps, zIndexProps, transitionProps, aspectRatioProps, flexProps], allProps));
|
|
157
|
-
|
|
158
|
-
var propClassName = className ? className : '';
|
|
159
|
-
var classNames = [generateClassNameAttributes([spaceProps, colorProps, shadowProps, radiusProps, positionProps, overflowProps, transitionProps, cursorProps], allProps), propClassName].join(' ').replace(/\s+/g, ' ').trim();
|
|
156
|
+
radius: radius
|
|
157
|
+
}, _defineProperty(_generateClassNameAtt, "position", position), _defineProperty(_generateClassNameAtt, "overflow", overflow), _defineProperty(_generateClassNameAtt, "transition", transition), _defineProperty(_generateClassNameAtt, "transitionHover", transitionHover), _defineProperty(_generateClassNameAtt, "cursor", cursor), _generateClassNameAtt)), propClassName].join(' ').replace(/\s+/g, ' ').trim();
|
|
160
158
|
var Tag = tag;
|
|
161
159
|
return ___EmotionJSX(Tag, _extends({
|
|
162
160
|
ref: ref,
|
package/es/styles/utilities.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import "core-js/modules/es.object.to-string.js";
|
|
2
2
|
import "core-js/modules/web.dom-collections.for-each.js";
|
|
3
3
|
import "core-js/modules/es.array.concat.js";
|
|
4
|
-
import {
|
|
4
|
+
import { styleConfig } from '../utilities';
|
|
5
|
+
import { propNameToShort } from '../utilities/style-config';
|
|
5
6
|
|
|
6
7
|
var generateUtilityClasses = function generateUtilityClasses(propertySets) {
|
|
7
8
|
var css = '';
|
|
@@ -13,11 +14,11 @@ var generateUtilityClasses = function generateUtilityClasses(propertySets) {
|
|
|
13
14
|
var hasHover = prop.modifier === 'hover';
|
|
14
15
|
|
|
15
16
|
if (!hasHover) {
|
|
16
|
-
css += "\n .".concat(
|
|
17
|
+
css += "\n .".concat(propNameToShort(prop.propName), "-").concat(variable, " {\n ").concat(property, ": ").concat(cssValue, "\n }");
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
if (hasHover) {
|
|
20
|
-
css += "\n .".concat(
|
|
21
|
+
css += "\n .".concat(propNameToShort(prop.propName), "-").concat(variable, ":hover {\n ").concat(property, ": ").concat(cssValue, "\n }");
|
|
21
22
|
}
|
|
22
23
|
});
|
|
23
24
|
});
|
|
@@ -30,7 +31,8 @@ var generateStyleClasses = function generateStyleClasses(propertySets) {
|
|
|
30
31
|
propertySets.forEach(function (set) {
|
|
31
32
|
set.props.forEach(function (prop) {
|
|
32
33
|
var property = prop.property;
|
|
33
|
-
var
|
|
34
|
+
var propName = prop.propName;
|
|
35
|
+
var cssVar = "--".concat(propNameToShort(propName));
|
|
34
36
|
var hasHover = prop.modifier === 'hover';
|
|
35
37
|
|
|
36
38
|
if (!hasHover) {
|
|
@@ -38,7 +40,7 @@ var generateStyleClasses = function generateStyleClasses(propertySets) {
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
if (hasHover) {
|
|
41
|
-
css += "\n [style*=\"".concat(cssVar, "
|
|
43
|
+
css += "\n [style*=\"".concat(cssVar, "\"]:hover {\n ").concat(property, ": var(").concat(cssVar, ")\n }");
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
if (set.isResponsive) {
|
|
@@ -1,50 +1,55 @@
|
|
|
1
|
+
import "core-js/modules/es.object.values.js";
|
|
1
2
|
import "core-js/modules/es.object.to-string.js";
|
|
2
3
|
import "core-js/modules/web.dom-collections.for-each.js";
|
|
4
|
+
import "core-js/modules/es.object.keys.js";
|
|
3
5
|
import "core-js/modules/es.array.concat.js";
|
|
4
|
-
import { isObject
|
|
5
|
-
|
|
6
|
+
import { isObject } from './helpers';
|
|
7
|
+
import { propNameToShort, styleConfig } from './style-config';
|
|
8
|
+
export var generateStyleAttributes = function generateStyleAttributes(props) {
|
|
6
9
|
var styles = {};
|
|
7
|
-
|
|
10
|
+
var styleConfigValues = Object.values(styleConfig);
|
|
11
|
+
styleConfigValues.forEach(function (propsSet) {
|
|
8
12
|
propsSet.props.forEach(function (_ref) {
|
|
9
13
|
var propName = _ref.propName;
|
|
10
|
-
var value =
|
|
14
|
+
var value = props[propName];
|
|
11
15
|
var hasVariable = propsSet.variableChecker ? propsSet.variableChecker(value) : false;
|
|
12
16
|
var hasTransformer = propsSet.valueTransformer ? true : false;
|
|
13
17
|
if (hasVariable) return;
|
|
14
18
|
if (!value) return;
|
|
15
19
|
var cssValue = hasTransformer ? propsSet.valueTransformer(value) : value;
|
|
16
|
-
var propNameShort =
|
|
20
|
+
var propNameShort = propNameToShort(propName);
|
|
17
21
|
|
|
18
22
|
if (!isObject(value)) {
|
|
19
23
|
styles["--".concat(propNameShort)] = cssValue;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (isObject(value)) {
|
|
24
|
+
} else {
|
|
23
25
|
var def = value.default,
|
|
24
26
|
mobile = value.mobile,
|
|
25
27
|
tablet = value.tablet;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
styles["--".concat(propNameShort, "-def")] = defaultValueCss;
|
|
30
|
-
styles["--".concat(propNameShort, "-mob")] = mobileValueCss;
|
|
31
|
-
styles["--".concat(propNameShort, "-tab")] = tabletValueCss;
|
|
28
|
+
styles["--".concat(propNameShort, "-def")] = hasTransformer ? propsSet.valueTransformer(def) : def;
|
|
29
|
+
styles["--".concat(propNameShort, "-mob")] = hasTransformer ? propsSet.valueTransformer(mobile) : mobile;
|
|
30
|
+
styles["--".concat(propNameShort, "-tab")] = hasTransformer ? propsSet.valueTransformer(tablet) : tablet;
|
|
32
31
|
}
|
|
33
32
|
});
|
|
34
33
|
});
|
|
35
34
|
return styles;
|
|
36
35
|
};
|
|
37
|
-
export var generateClassNameAttributes = function generateClassNameAttributes(
|
|
36
|
+
export var generateClassNameAttributes = function generateClassNameAttributes(props) {
|
|
38
37
|
var classNames = [];
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
var propKeys = Object.keys(props);
|
|
39
|
+
var styleConfigValues = Object.values(styleConfig);
|
|
40
|
+
propKeys.forEach(function (prop) {
|
|
41
|
+
styleConfigValues.forEach(function (styleConfigItem) {
|
|
42
|
+
styleConfigItem.props.forEach(function (propItem) {
|
|
43
|
+
if (propItem.propName === prop) {
|
|
44
|
+
var propName = propItem.propName;
|
|
45
|
+
var value = props[propName];
|
|
46
|
+
var hasVariable = styleConfigItem.variableChecker ? styleConfigItem.variableChecker(value) : false;
|
|
47
|
+
if (!hasVariable) return;
|
|
48
|
+
if (!value) return;
|
|
49
|
+
var className = "".concat(propNameToShort(propName), "-").concat(value);
|
|
50
|
+
classNames.push(className);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
48
53
|
});
|
|
49
54
|
});
|
|
50
55
|
return classNames.join(' ');
|
package/es/utilities/helpers.js
CHANGED
|
@@ -3,7 +3,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3
3
|
import "core-js/modules/es.array.concat.js";
|
|
4
4
|
import "core-js/modules/es.object.to-string.js";
|
|
5
5
|
import "core-js/modules/web.dom-collections.for-each.js";
|
|
6
|
-
import "core-js/modules/es.array.find.js";
|
|
7
6
|
import "core-js/modules/es.symbol.js";
|
|
8
7
|
import "core-js/modules/es.symbol.description.js";
|
|
9
8
|
import "core-js/modules/es.symbol.iterator.js";
|
|
@@ -45,189 +44,4 @@ export var mergeRefs = function mergeRefs(refs) {
|
|
|
45
44
|
}
|
|
46
45
|
});
|
|
47
46
|
};
|
|
48
|
-
};
|
|
49
|
-
var shortHandProps = [{
|
|
50
|
-
propName: 'padding',
|
|
51
|
-
property: 'padding',
|
|
52
|
-
value: 'p'
|
|
53
|
-
}, {
|
|
54
|
-
propName: 'paddingTop',
|
|
55
|
-
property: 'padding-top',
|
|
56
|
-
value: 'pt'
|
|
57
|
-
}, {
|
|
58
|
-
propName: 'paddingBottom',
|
|
59
|
-
property: 'padding-bottom',
|
|
60
|
-
value: 'pb'
|
|
61
|
-
}, {
|
|
62
|
-
propName: 'paddingLeft',
|
|
63
|
-
property: 'padding-left',
|
|
64
|
-
value: 'pl'
|
|
65
|
-
}, {
|
|
66
|
-
propName: 'paddingRight',
|
|
67
|
-
property: 'padding-right',
|
|
68
|
-
value: 'pr'
|
|
69
|
-
}, {
|
|
70
|
-
propName: 'paddingX',
|
|
71
|
-
property: 'padding-inline',
|
|
72
|
-
value: 'px'
|
|
73
|
-
}, {
|
|
74
|
-
propName: 'paddingY',
|
|
75
|
-
property: 'padding-block',
|
|
76
|
-
value: 'py'
|
|
77
|
-
}, {
|
|
78
|
-
propName: 'margin',
|
|
79
|
-
property: 'margin',
|
|
80
|
-
value: 'm'
|
|
81
|
-
}, {
|
|
82
|
-
propName: 'marginTop',
|
|
83
|
-
property: 'margin-top',
|
|
84
|
-
value: 'mt'
|
|
85
|
-
}, {
|
|
86
|
-
propName: 'marginBottom',
|
|
87
|
-
property: 'margin-bottom',
|
|
88
|
-
value: 'mb'
|
|
89
|
-
}, {
|
|
90
|
-
propName: 'marginLeft',
|
|
91
|
-
property: 'margin-left',
|
|
92
|
-
value: 'ml'
|
|
93
|
-
}, {
|
|
94
|
-
propName: 'marginRight',
|
|
95
|
-
property: 'margin-right',
|
|
96
|
-
value: 'mr'
|
|
97
|
-
}, {
|
|
98
|
-
propName: 'marginX',
|
|
99
|
-
property: 'margin-inline',
|
|
100
|
-
value: 'mx'
|
|
101
|
-
}, {
|
|
102
|
-
propName: 'marginY',
|
|
103
|
-
property: 'margin-block',
|
|
104
|
-
value: 'my'
|
|
105
|
-
}, {
|
|
106
|
-
propName: 'top',
|
|
107
|
-
property: 'top',
|
|
108
|
-
value: 't'
|
|
109
|
-
}, {
|
|
110
|
-
propName: 'bottom',
|
|
111
|
-
property: 'bottom',
|
|
112
|
-
value: 'b'
|
|
113
|
-
}, {
|
|
114
|
-
propName: 'left',
|
|
115
|
-
property: 'left',
|
|
116
|
-
value: 'l'
|
|
117
|
-
}, {
|
|
118
|
-
propName: 'right',
|
|
119
|
-
property: 'right',
|
|
120
|
-
value: 'r'
|
|
121
|
-
}, {
|
|
122
|
-
propName: 'width',
|
|
123
|
-
property: 'width',
|
|
124
|
-
value: 'w'
|
|
125
|
-
}, {
|
|
126
|
-
propName: 'height',
|
|
127
|
-
property: 'height',
|
|
128
|
-
value: 'h'
|
|
129
|
-
}, {
|
|
130
|
-
propName: 'minWidth',
|
|
131
|
-
property: 'min-width',
|
|
132
|
-
value: 'min-w'
|
|
133
|
-
}, {
|
|
134
|
-
propName: 'maxWidth',
|
|
135
|
-
property: 'max-width',
|
|
136
|
-
value: 'max-w'
|
|
137
|
-
}, {
|
|
138
|
-
propName: 'minHeight',
|
|
139
|
-
property: 'min-height',
|
|
140
|
-
value: 'min-h'
|
|
141
|
-
}, {
|
|
142
|
-
propName: 'maxHeight',
|
|
143
|
-
property: 'max-height',
|
|
144
|
-
value: 'max-h'
|
|
145
|
-
}, {
|
|
146
|
-
propName: 'color',
|
|
147
|
-
property: 'color',
|
|
148
|
-
value: 'c'
|
|
149
|
-
}, {
|
|
150
|
-
propName: 'colorHover',
|
|
151
|
-
property: 'color',
|
|
152
|
-
value: 'c-hover'
|
|
153
|
-
}, {
|
|
154
|
-
propName: 'backgroundColor',
|
|
155
|
-
property: 'background-color',
|
|
156
|
-
value: 'bgc'
|
|
157
|
-
}, {
|
|
158
|
-
propName: 'backgroundColorHover',
|
|
159
|
-
property: 'background-color',
|
|
160
|
-
value: 'bgc-hover'
|
|
161
|
-
}, {
|
|
162
|
-
propName: 'shadow',
|
|
163
|
-
property: 'box-shadow',
|
|
164
|
-
value: 'sh'
|
|
165
|
-
}, {
|
|
166
|
-
propName: 'shadowHover',
|
|
167
|
-
property: 'box-shadow',
|
|
168
|
-
value: 'sh-hover'
|
|
169
|
-
}, {
|
|
170
|
-
propName: 'radius',
|
|
171
|
-
property: 'border-radius',
|
|
172
|
-
value: 'rad'
|
|
173
|
-
}, {
|
|
174
|
-
propName: 'order',
|
|
175
|
-
property: 'order',
|
|
176
|
-
value: 'ord'
|
|
177
|
-
}, {
|
|
178
|
-
propName: 'position',
|
|
179
|
-
property: 'position',
|
|
180
|
-
value: 'pos'
|
|
181
|
-
}, {
|
|
182
|
-
propName: 'overflow',
|
|
183
|
-
property: 'overflow',
|
|
184
|
-
value: 'ovf'
|
|
185
|
-
}, {
|
|
186
|
-
propName: 'overflowX',
|
|
187
|
-
property: 'overflow-x',
|
|
188
|
-
value: 'ovf-x'
|
|
189
|
-
}, {
|
|
190
|
-
propName: 'overflowY',
|
|
191
|
-
property: 'overflow-y',
|
|
192
|
-
value: 'ovf-y'
|
|
193
|
-
}, {
|
|
194
|
-
propName: 'zIndex',
|
|
195
|
-
property: 'z-index',
|
|
196
|
-
value: 'z'
|
|
197
|
-
}, {
|
|
198
|
-
propName: 'transition',
|
|
199
|
-
property: 'transition',
|
|
200
|
-
value: 'tr'
|
|
201
|
-
}, {
|
|
202
|
-
propName: 'transitionHover',
|
|
203
|
-
property: 'transition',
|
|
204
|
-
value: 'tr-hover'
|
|
205
|
-
}, {
|
|
206
|
-
propName: 'cursor',
|
|
207
|
-
property: 'cursor',
|
|
208
|
-
value: 'cur'
|
|
209
|
-
}, {
|
|
210
|
-
propName: 'aspectRatio',
|
|
211
|
-
property: 'aspect-ratio',
|
|
212
|
-
value: 'ar'
|
|
213
|
-
}, {
|
|
214
|
-
propName: 'flex',
|
|
215
|
-
property: 'flex',
|
|
216
|
-
value: 'flex'
|
|
217
|
-
}];
|
|
218
|
-
export var propertyToShorthand = function propertyToShorthand(property) {
|
|
219
|
-
var _shortHandProps$find;
|
|
220
|
-
|
|
221
|
-
return (_shortHandProps$find = shortHandProps.find(function (_ref) {
|
|
222
|
-
var prop = _ref.property;
|
|
223
|
-
return prop === property;
|
|
224
|
-
})) === null || _shortHandProps$find === void 0 ? void 0 : _shortHandProps$find.value;
|
|
225
|
-
};
|
|
226
|
-
export var propNameToShorthand = function propNameToShorthand(propName) {
|
|
227
|
-
var _shortHandProps$find2;
|
|
228
|
-
|
|
229
|
-
return (_shortHandProps$find2 = shortHandProps.find(function (_ref2) {
|
|
230
|
-
var prop = _ref2.propName;
|
|
231
|
-
return prop === propName;
|
|
232
|
-
})) === null || _shortHandProps$find2 === void 0 ? void 0 : _shortHandProps$find2.value;
|
|
233
47
|
};
|
|
@@ -2,9 +2,11 @@ import "core-js/modules/es.array.concat.js";
|
|
|
2
2
|
import "core-js/modules/es.object.keys.js";
|
|
3
3
|
import "core-js/modules/es.array.includes.js";
|
|
4
4
|
import "core-js/modules/es.string.includes.js";
|
|
5
|
+
import "core-js/modules/es.array.find.js";
|
|
6
|
+
import "core-js/modules/es.object.to-string.js";
|
|
7
|
+
import "core-js/modules/es.object.values.js";
|
|
5
8
|
import "core-js/modules/es.symbol.js";
|
|
6
9
|
import "core-js/modules/es.symbol.description.js";
|
|
7
|
-
import "core-js/modules/es.object.to-string.js";
|
|
8
10
|
import "core-js/modules/es.symbol.iterator.js";
|
|
9
11
|
import "core-js/modules/es.array.iterator.js";
|
|
10
12
|
import "core-js/modules/es.string.iterator.js";
|
|
@@ -38,58 +40,76 @@ export var styleConfig = {
|
|
|
38
40
|
spaceProps: {
|
|
39
41
|
props: [{
|
|
40
42
|
propName: 'padding',
|
|
41
|
-
property: 'padding'
|
|
43
|
+
property: 'padding',
|
|
44
|
+
short: 'p'
|
|
42
45
|
}, {
|
|
43
46
|
propName: 'paddingTop',
|
|
44
|
-
property: 'padding-top'
|
|
47
|
+
property: 'padding-top',
|
|
48
|
+
short: 'pt'
|
|
45
49
|
}, {
|
|
46
50
|
propName: 'paddingBottom',
|
|
47
|
-
property: 'padding-bottom'
|
|
51
|
+
property: 'padding-bottom',
|
|
52
|
+
short: 'pb'
|
|
48
53
|
}, {
|
|
49
54
|
propName: 'paddingLeft',
|
|
50
|
-
property: 'padding-left'
|
|
55
|
+
property: 'padding-left',
|
|
56
|
+
short: 'pl'
|
|
51
57
|
}, {
|
|
52
58
|
propName: 'paddingRight',
|
|
53
|
-
property: 'padding-right'
|
|
59
|
+
property: 'padding-right',
|
|
60
|
+
short: 'pr'
|
|
54
61
|
}, {
|
|
55
62
|
propName: 'paddingX',
|
|
56
|
-
property: 'padding-inline'
|
|
63
|
+
property: 'padding-inline',
|
|
64
|
+
short: 'px'
|
|
57
65
|
}, {
|
|
58
66
|
propName: 'paddingY',
|
|
59
|
-
property: 'padding-block'
|
|
67
|
+
property: 'padding-block',
|
|
68
|
+
short: 'py'
|
|
60
69
|
}, {
|
|
61
70
|
propName: 'margin',
|
|
62
|
-
property: 'margin'
|
|
71
|
+
property: 'margin',
|
|
72
|
+
short: 'm'
|
|
63
73
|
}, {
|
|
64
74
|
propName: 'marginTop',
|
|
65
|
-
property: 'margin-top'
|
|
75
|
+
property: 'margin-top',
|
|
76
|
+
short: 'mt'
|
|
66
77
|
}, {
|
|
67
78
|
propName: 'marginBottom',
|
|
68
|
-
property: 'margin-bottom'
|
|
79
|
+
property: 'margin-bottom',
|
|
80
|
+
short: 'mb'
|
|
69
81
|
}, {
|
|
70
82
|
propName: 'marginLeft',
|
|
71
|
-
property: 'margin-left'
|
|
83
|
+
property: 'margin-left',
|
|
84
|
+
short: 'ml'
|
|
72
85
|
}, {
|
|
73
86
|
propName: 'marginRight',
|
|
74
|
-
property: 'margin-right'
|
|
87
|
+
property: 'margin-right',
|
|
88
|
+
short: 'mr'
|
|
75
89
|
}, {
|
|
76
90
|
propName: 'marginX',
|
|
77
|
-
property: 'margin-inline'
|
|
91
|
+
property: 'margin-inline',
|
|
92
|
+
short: 'mx'
|
|
78
93
|
}, {
|
|
79
94
|
propName: 'marginY',
|
|
80
|
-
property: 'margin-block'
|
|
95
|
+
property: 'margin-block',
|
|
96
|
+
short: 'my'
|
|
81
97
|
}, {
|
|
82
98
|
propName: 'top',
|
|
83
|
-
property: 'top'
|
|
99
|
+
property: 'top',
|
|
100
|
+
short: 't'
|
|
84
101
|
}, {
|
|
85
102
|
propName: 'bottom',
|
|
86
|
-
property: 'bottom'
|
|
103
|
+
property: 'bottom',
|
|
104
|
+
short: 'b'
|
|
87
105
|
}, {
|
|
88
106
|
propName: 'left',
|
|
89
|
-
property: 'left'
|
|
107
|
+
property: 'left',
|
|
108
|
+
short: 'l'
|
|
90
109
|
}, {
|
|
91
110
|
propName: 'right',
|
|
92
|
-
property: 'right'
|
|
111
|
+
property: 'right',
|
|
112
|
+
short: 'r'
|
|
93
113
|
}],
|
|
94
114
|
valueTransformer: getSpace,
|
|
95
115
|
variableChecker: isSpaceVar,
|
|
@@ -99,22 +119,28 @@ export var styleConfig = {
|
|
|
99
119
|
dimensionProps: {
|
|
100
120
|
props: [{
|
|
101
121
|
propName: 'width',
|
|
102
|
-
property: 'width'
|
|
122
|
+
property: 'width',
|
|
123
|
+
short: 'w'
|
|
103
124
|
}, {
|
|
104
125
|
propName: 'minWidth',
|
|
105
|
-
property: 'height'
|
|
126
|
+
property: 'height',
|
|
127
|
+
short: 'min-w'
|
|
106
128
|
}, {
|
|
107
129
|
propName: 'maxWidth',
|
|
108
|
-
property: 'min-width'
|
|
130
|
+
property: 'min-width',
|
|
131
|
+
short: 'max-w'
|
|
109
132
|
}, {
|
|
110
133
|
propName: 'height',
|
|
111
|
-
property: 'max-width'
|
|
134
|
+
property: 'max-width',
|
|
135
|
+
short: 'h'
|
|
112
136
|
}, {
|
|
113
137
|
propName: 'minHeight',
|
|
114
|
-
property: 'min-height'
|
|
138
|
+
property: 'min-height',
|
|
139
|
+
short: 'min-h'
|
|
115
140
|
}, {
|
|
116
141
|
propName: 'maxHeight',
|
|
117
|
-
property: 'max-height'
|
|
142
|
+
property: 'max-height',
|
|
143
|
+
short: 'max-h'
|
|
118
144
|
}],
|
|
119
145
|
valueTransformer: getDimension,
|
|
120
146
|
isResponsive: true
|
|
@@ -122,18 +148,22 @@ export var styleConfig = {
|
|
|
122
148
|
colorProps: {
|
|
123
149
|
props: [{
|
|
124
150
|
propName: 'color',
|
|
125
|
-
property: 'color'
|
|
151
|
+
property: 'color',
|
|
152
|
+
short: 'c'
|
|
126
153
|
}, {
|
|
127
154
|
propName: 'colorHover',
|
|
128
155
|
property: 'color',
|
|
129
|
-
modifier: 'hover'
|
|
156
|
+
modifier: 'hover',
|
|
157
|
+
short: 'c-hover'
|
|
130
158
|
}, {
|
|
131
159
|
propName: 'backgroundColor',
|
|
132
|
-
property: 'background-color'
|
|
160
|
+
property: 'background-color',
|
|
161
|
+
short: 'bgc'
|
|
133
162
|
}, {
|
|
134
163
|
propName: 'backgroundColorHover',
|
|
135
164
|
property: 'background-color',
|
|
136
|
-
modifier: 'hover'
|
|
165
|
+
modifier: 'hover',
|
|
166
|
+
short: 'bgc-hover'
|
|
137
167
|
}],
|
|
138
168
|
valueTransformer: getColor,
|
|
139
169
|
variableChecker: isColorVar,
|
|
@@ -142,11 +172,13 @@ export var styleConfig = {
|
|
|
142
172
|
shadowProps: {
|
|
143
173
|
props: [{
|
|
144
174
|
propName: 'shadow',
|
|
145
|
-
property: 'box-shadow'
|
|
175
|
+
property: 'box-shadow',
|
|
176
|
+
short: 'sh'
|
|
146
177
|
}, {
|
|
147
178
|
propName: 'shadowHover',
|
|
148
179
|
property: 'box-shadow',
|
|
149
|
-
modifier: 'hover'
|
|
180
|
+
modifier: 'hover',
|
|
181
|
+
short: 'sh-hover'
|
|
150
182
|
}],
|
|
151
183
|
valueTransformer: getShadow,
|
|
152
184
|
variableChecker: isShadowVar,
|
|
@@ -155,7 +187,8 @@ export var styleConfig = {
|
|
|
155
187
|
radiusProps: {
|
|
156
188
|
props: [{
|
|
157
189
|
propName: 'radius',
|
|
158
|
-
property: 'border-radius'
|
|
190
|
+
property: 'border-radius',
|
|
191
|
+
short: 'rad'
|
|
159
192
|
}],
|
|
160
193
|
valueTransformer: getRadius,
|
|
161
194
|
variableChecker: isRadiusVar,
|
|
@@ -164,26 +197,30 @@ export var styleConfig = {
|
|
|
164
197
|
orderProps: {
|
|
165
198
|
props: [{
|
|
166
199
|
propName: 'order',
|
|
167
|
-
property: 'order'
|
|
200
|
+
property: 'order',
|
|
201
|
+
short: 'ord'
|
|
168
202
|
}]
|
|
169
203
|
},
|
|
170
204
|
flexProps: {
|
|
171
205
|
props: [{
|
|
172
206
|
propName: 'flex',
|
|
173
|
-
property: 'flex'
|
|
207
|
+
property: 'flex',
|
|
208
|
+
short: 'flex'
|
|
174
209
|
}],
|
|
175
210
|
isResponsive: true
|
|
176
211
|
},
|
|
177
212
|
zIndexProps: {
|
|
178
213
|
props: [{
|
|
179
214
|
propName: 'zIndex',
|
|
180
|
-
property: 'z-index'
|
|
215
|
+
property: 'z-index',
|
|
216
|
+
short: 'z'
|
|
181
217
|
}]
|
|
182
218
|
},
|
|
183
219
|
positionProps: {
|
|
184
220
|
props: [{
|
|
185
221
|
propName: 'position',
|
|
186
|
-
property: 'position'
|
|
222
|
+
property: 'position',
|
|
223
|
+
short: 'pos'
|
|
187
224
|
}],
|
|
188
225
|
variableChecker: function variableChecker(value) {
|
|
189
226
|
return positions.includes(value);
|
|
@@ -193,13 +230,16 @@ export var styleConfig = {
|
|
|
193
230
|
overflowProps: {
|
|
194
231
|
props: [{
|
|
195
232
|
propName: 'overflow',
|
|
196
|
-
property: 'overflow'
|
|
233
|
+
property: 'overflow',
|
|
234
|
+
short: 'ovf'
|
|
197
235
|
}, {
|
|
198
236
|
propName: 'overflowX',
|
|
199
|
-
property: 'overflow-x'
|
|
237
|
+
property: 'overflow-x',
|
|
238
|
+
short: 'ovf-x'
|
|
200
239
|
}, {
|
|
201
240
|
propName: 'overflowY',
|
|
202
|
-
property: 'overflow-y'
|
|
241
|
+
property: 'overflow-y',
|
|
242
|
+
short: 'ovf-y'
|
|
203
243
|
}],
|
|
204
244
|
variableChecker: function variableChecker(value) {
|
|
205
245
|
return overflows.includes(value);
|
|
@@ -209,11 +249,13 @@ export var styleConfig = {
|
|
|
209
249
|
transitionProps: {
|
|
210
250
|
props: [{
|
|
211
251
|
propName: 'transition',
|
|
212
|
-
property: 'transition'
|
|
252
|
+
property: 'transition',
|
|
253
|
+
short: 'tr'
|
|
213
254
|
}, {
|
|
214
255
|
propName: 'transitionHover',
|
|
215
256
|
property: 'transition',
|
|
216
|
-
modifier: 'hover'
|
|
257
|
+
modifier: 'hover',
|
|
258
|
+
short: 'tr-hover'
|
|
217
259
|
}],
|
|
218
260
|
valueTransformer: getTransition,
|
|
219
261
|
variableChecker: isTrasitionVar,
|
|
@@ -222,7 +264,8 @@ export var styleConfig = {
|
|
|
222
264
|
cursorProps: {
|
|
223
265
|
props: [{
|
|
224
266
|
propName: 'cursor',
|
|
225
|
-
property: 'cursor'
|
|
267
|
+
property: 'cursor',
|
|
268
|
+
short: 'cur'
|
|
226
269
|
}],
|
|
227
270
|
variableChecker: function variableChecker(value) {
|
|
228
271
|
return cursors.includes(value);
|
|
@@ -232,7 +275,23 @@ export var styleConfig = {
|
|
|
232
275
|
aspectRatioProps: {
|
|
233
276
|
props: [{
|
|
234
277
|
propName: 'aspectRatio',
|
|
235
|
-
property: 'aspect-ratio'
|
|
278
|
+
property: 'aspect-ratio',
|
|
279
|
+
short: 'ar'
|
|
236
280
|
}]
|
|
237
281
|
}
|
|
282
|
+
};
|
|
283
|
+
export var propNameToShort = function propNameToShort(propName) {
|
|
284
|
+
var _prop$props$find;
|
|
285
|
+
|
|
286
|
+
var prop = Object.values(styleConfig).find(function (_ref) {
|
|
287
|
+
var props = _ref.props;
|
|
288
|
+
return props.find(function (_ref2) {
|
|
289
|
+
var prop = _ref2.propName;
|
|
290
|
+
return prop === propName;
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
return prop === null || prop === void 0 ? void 0 : (_prop$props$find = prop.props.find(function (_ref3) {
|
|
294
|
+
var prop = _ref3.propName;
|
|
295
|
+
return prop === propName;
|
|
296
|
+
})) === null || _prop$props$find === void 0 ? void 0 : _prop$props$find.short;
|
|
238
297
|
};
|