@flodesk/grain 10.10.9 → 10.10.10

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.
@@ -27,6 +27,7 @@ import "core-js/modules/es.array.from.js";
27
27
  import "core-js/modules/es.regexp.exec.js";
28
28
  import { styleConfig } from '../utilities';
29
29
  import { propNameToShort } from '../utilities/style-config';
30
+ import { breakpoints, deviceShort } from '../variables';
30
31
 
31
32
  var generateUtilityClassDeclarations = function generateUtilityClassDeclarations(propertySets) {
32
33
  var css = '';
@@ -46,11 +47,6 @@ var generateUtilityClassDeclarations = function generateUtilityClassDeclarations
46
47
  return css;
47
48
  };
48
49
 
49
- var breakpoints = {
50
- tab: 1169,
51
- mob: 767
52
- };
53
-
54
50
  var generateStyleClassDeclarations = function generateStyleClassDeclarations(propertySets) {
55
51
  var css = '';
56
52
  propertySets.forEach(function (set) {
@@ -64,12 +60,14 @@ var generateStyleClassDeclarations = function generateStyleClassDeclarations(pro
64
60
  if (hasHover) css += "[style*=\"".concat(cssVar, ":\"]:hover ").concat(declaration);
65
61
 
66
62
  if (set.isResponsive) {
67
- css += "\n [style*=\"".concat(cssVar, "-def\"] {").concat(property, ": var(").concat(cssVar, "-def)}\n ");
63
+ var device = deviceShort.default;
64
+ css += "\n [style*=\"".concat(cssVar, "-").concat(device, "\"] {").concat(property, ": var(").concat(cssVar, "-").concat(device, ")}\n ");
68
65
  Object.entries(breakpoints).forEach(function (_ref) {
69
66
  var _ref2 = _slicedToArray(_ref, 2),
70
- device = _ref2[0],
67
+ deviceName = _ref2[0],
71
68
  screenSize = _ref2[1];
72
69
 
70
+ var device = deviceShort[deviceName];
73
71
  css += "\n @media (max-width: ".concat(screenSize, "px) {\n [style*=\"").concat(cssVar, "-").concat(device, "\"] {").concat(property, ": var(").concat(cssVar, "-").concat(device, ")}\n }\n ");
74
72
  });
75
73
  }
@@ -1,10 +1,15 @@
1
1
  import "core-js/modules/es.object.values.js";
2
2
  import "core-js/modules/es.object.to-string.js";
3
3
  import "core-js/modules/web.dom-collections.for-each.js";
4
- import "core-js/modules/es.object.keys.js";
5
4
  import "core-js/modules/es.array.concat.js";
5
+ import "core-js/modules/es.object.keys.js";
6
+ import { breakpoints, deviceShort } from '../variables';
6
7
  import { isObject } from './helpers';
7
8
  import { propNameToShort, styleConfig } from './style-config';
9
+ var mediaQueries = {
10
+ tablet: "@media (max-width: ".concat(breakpoints.tablet, "px)"),
11
+ mobile: "@media (max-width: ".concat(breakpoints.mobile, "px)")
12
+ };
8
13
  export var generateStyleAttributes = function generateStyleAttributes(props) {
9
14
  var styles = {};
10
15
  var styleConfigValues = Object.values(styleConfig);
@@ -24,10 +29,15 @@ export var generateStyleAttributes = function generateStyleAttributes(props) {
24
29
  } else {
25
30
  var def = value.default,
26
31
  mobile = value.mobile,
27
- tablet = value.tablet;
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
+ tablet = value.tablet; // accept fixed string media queries to help migration
33
+
34
+ var mobileMediaValue = value[mediaQueries.mobile];
35
+ var tabletMediaValue = value[mediaQueries.tablet];
36
+ var mob = mobileMediaValue || mobile;
37
+ var tab = tabletMediaValue || tablet;
38
+ styles["--".concat(propNameShort, "-").concat(deviceShort.default)] = hasTransformer ? propsSet.valueTransformer(def) : def;
39
+ styles["--".concat(propNameShort, "-").concat(deviceShort.mobile)] = hasTransformer ? propsSet.valueTransformer(mob) : mob;
40
+ styles["--".concat(propNameShort, "-").concat(deviceShort.tablet)] = hasTransformer ? propsSet.valueTransformer(tab) : tab;
31
41
  }
32
42
  });
33
43
  });
@@ -0,0 +1,9 @@
1
+ export var breakpoints = {
2
+ tablet: 1169,
3
+ mobile: 767
4
+ };
5
+ export var deviceShort = {
6
+ default: 'def',
7
+ mobile: 'mob',
8
+ tablet: 'tab'
9
+ };
@@ -1,2 +1,3 @@
1
1
  export * from './vars';
2
- export * from './colors';
2
+ export * from './colors';
3
+ export * from './breakpoints';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flodesk/grain",
3
- "version": "10.10.9",
3
+ "version": "10.10.10",
4
4
  "description": "Flodesk design system",
5
5
  "module": "es/index.js",
6
6
  "author": "Flodesk",