@flodesk/grain 2.20.4 → 2.21.0
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.
|
@@ -26,31 +26,31 @@ import "core-js/modules/es.array.from.js";
|
|
|
26
26
|
import "core-js/modules/es.regexp.exec.js";
|
|
27
27
|
import { getCssVar, isNumber, isString, u, isObject } from '.';
|
|
28
28
|
import { vars, varInfo } from '../variables';
|
|
29
|
-
export var getMediaCss = function getMediaCss(
|
|
29
|
+
export var getMediaCss = function getMediaCss(mediaQuery, property, value) {
|
|
30
30
|
var getValue = function getValue(val) {
|
|
31
31
|
if (val === 0) return val;
|
|
32
32
|
if (isNumber(val)) return u(val);
|
|
33
33
|
if (isString(val)) return val;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
if (
|
|
36
|
+
if (mediaQuery === 'default') {
|
|
37
37
|
return "".concat(property, ": ").concat(getValue(value), ";");
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
return "\n
|
|
40
|
+
return "\n ".concat(mediaQuery, " {\n ").concat(property, ": ").concat(getValue(value), ";\n }\n ");
|
|
41
41
|
};
|
|
42
42
|
export var mapObjToMedia = function mapObjToMedia(property, obj, type) {
|
|
43
43
|
var varPrefix = varInfo[type].prefix;
|
|
44
44
|
var declarations = Object.entries(obj).map(function (_ref) {
|
|
45
45
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
46
|
-
|
|
46
|
+
mediaQuery = _ref2[0],
|
|
47
47
|
value = _ref2[1];
|
|
48
48
|
|
|
49
49
|
if (value in vars[type]) {
|
|
50
|
-
return getMediaCss(
|
|
50
|
+
return getMediaCss(mediaQuery, property, getCssVar(varPrefix, value));
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
return getMediaCss(
|
|
53
|
+
return getMediaCss(mediaQuery, property, value);
|
|
54
54
|
}); // reverse array to make sure max-widths correctly override
|
|
55
55
|
|
|
56
56
|
declarations.reverse().join('');
|