@flodesk/grain 3.1.1 → 3.1.2
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/index.js +2 -1
- package/es/utilities/helpers.js +4 -2
- package/es/utilities/index.js +3 -21
- package/es/utilities/responsive.js +3 -4
- package/es/utilities/styles.js +6 -6
- package/package.json +1 -1
package/es/index.js
CHANGED
package/es/utilities/helpers.js
CHANGED
|
@@ -8,10 +8,12 @@ import "core-js/modules/es.symbol.iterator.js";
|
|
|
8
8
|
import "core-js/modules/es.array.iterator.js";
|
|
9
9
|
import "core-js/modules/es.string.iterator.js";
|
|
10
10
|
import "core-js/modules/web.dom-collections.iterator.js";
|
|
11
|
-
import { grnPrefix } from '../variables';
|
|
11
|
+
import { grnPrefix, varInfo } from '../variables';
|
|
12
12
|
export var isBrowser = typeof window !== 'undefined';
|
|
13
13
|
export var getCssVarCore = function getCssVarCore(type, value) {
|
|
14
|
-
|
|
14
|
+
var typeInfo = varInfo[type];
|
|
15
|
+
var prefix = typeInfo ? typeInfo.prefix : type;
|
|
16
|
+
return "".concat(grnPrefix).concat(prefix, "-").concat(value);
|
|
15
17
|
};
|
|
16
18
|
export var getCssVar = function getCssVar(type, value) {
|
|
17
19
|
return "var(".concat(getCssVarCore(type, value), ")");
|
package/es/utilities/index.js
CHANGED
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export { getColor } from './styles';
|
|
5
|
-
export { getShadow } from './styles';
|
|
6
|
-
export { getTextSize } from './responsive';
|
|
7
|
-
export { getResponsiveTextSize } from './responsive';
|
|
8
|
-
export { getWeight } from './styles';
|
|
9
|
-
export { getRadius } from './styles';
|
|
10
|
-
export { getTransition } from './styles';
|
|
11
|
-
export { getResponsiveSpace } from './responsive';
|
|
12
|
-
export { getIconSize } from './styles';
|
|
13
|
-
export { getBorder } from './styles';
|
|
14
|
-
export { isBrowser } from './helpers';
|
|
15
|
-
export { getCssVarCore } from './helpers';
|
|
16
|
-
export { getCssVar } from './helpers';
|
|
17
|
-
export { u } from './helpers';
|
|
18
|
-
export { isNumber } from './helpers';
|
|
19
|
-
export { isString } from './helpers';
|
|
20
|
-
export { isArray } from './helpers';
|
|
21
|
-
export { isObject } from './helpers';
|
|
1
|
+
export * from './helpers';
|
|
2
|
+
export * from './responsive';
|
|
3
|
+
export * from './styles';
|
|
@@ -41,8 +41,7 @@ export var getMediaCss = function getMediaCss(mediaQuery, property, value) {
|
|
|
41
41
|
export var mapObjToMedia = function mapObjToMedia(property, obj, type) {
|
|
42
42
|
var checkValueInVars = function checkValueInVars(value) {
|
|
43
43
|
if (type && value in vars[type]) {
|
|
44
|
-
|
|
45
|
-
return getCssVar(varPrefix, value);
|
|
44
|
+
return getCssVar(varInfo[type].name, value);
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
return value;
|
|
@@ -65,7 +64,7 @@ export var getDimension = function getDimension(dimension) {
|
|
|
65
64
|
};
|
|
66
65
|
export var getSpace = function getSpace(space) {
|
|
67
66
|
if (space in vars.spaces) {
|
|
68
|
-
return getCssVar(varInfo.spaces.
|
|
67
|
+
return getCssVar(varInfo.spaces.name, space);
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
if (space === 0) return space;
|
|
@@ -92,7 +91,7 @@ export var getResponsiveSpace = function getResponsiveSpace(property, space) {
|
|
|
92
91
|
};
|
|
93
92
|
export var getTextSize = function getTextSize(size) {
|
|
94
93
|
if (size in vars.texts) {
|
|
95
|
-
return getCssVar(varInfo.texts.
|
|
94
|
+
return getCssVar(varInfo.texts.name, size);
|
|
96
95
|
}
|
|
97
96
|
|
|
98
97
|
if (isString(size)) return size;
|
package/es/utilities/styles.js
CHANGED
|
@@ -24,26 +24,26 @@ var allColors = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, vars
|
|
|
24
24
|
|
|
25
25
|
export var getColor = function getColor(color) {
|
|
26
26
|
if (color in allColors) {
|
|
27
|
-
return getCssVar(varInfo.colors.
|
|
27
|
+
return getCssVar(varInfo.colors.name, color);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
return color;
|
|
31
31
|
};
|
|
32
32
|
export var getShadow = function getShadow(shadow) {
|
|
33
33
|
if (shadow in vars.shadows) {
|
|
34
|
-
return getCssVar(varInfo.shadows.
|
|
34
|
+
return getCssVar(varInfo.shadows.name, shadow);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
return shadow;
|
|
38
38
|
};
|
|
39
39
|
export var getWeight = function getWeight(weight) {
|
|
40
40
|
if (weight in vars.weights) {
|
|
41
|
-
return getCssVar(varInfo.weights.
|
|
41
|
+
return getCssVar(varInfo.weights.name, weight);
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
export var getRadius = function getRadius(radius) {
|
|
45
45
|
if (radius in vars.radii) {
|
|
46
|
-
return getCssVar(varInfo.radii.
|
|
46
|
+
return getCssVar(varInfo.radii.name, radius);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
if (radius === 0) return radius;
|
|
@@ -52,12 +52,12 @@ export var getRadius = function getRadius(radius) {
|
|
|
52
52
|
};
|
|
53
53
|
export var getTransition = function getTransition(transition) {
|
|
54
54
|
if (transition in vars.transitions) {
|
|
55
|
-
return getCssVar(varInfo.transitions.
|
|
55
|
+
return getCssVar(varInfo.transitions.name, transition);
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
export var getIconSize = function getIconSize(size) {
|
|
59
59
|
if (size in vars.icons) {
|
|
60
|
-
return getCssVar(varInfo.icons.
|
|
60
|
+
return getCssVar(varInfo.icons.name, size);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
return getDimension(size);
|