rw-elements-tools 1.3.2 → 1.3.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rw-elements-tools",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Build tools for RapidWeaver Elements packs - generates properties.json and hooks.js files",
5
5
  "author": "Elements Platform",
6
6
  "license": "MIT",
@@ -1,3 +1,16 @@
1
+ const getOrderClasses = (orderByBreakpoint = {}, orderCustomByBreakpoint = {}) => {
2
+ return Object.entries(orderByBreakpoint)
3
+ .map(([breakpoint, value]) => {
4
+ const prefix = breakpoint === "base" ? "" : `${breakpoint}:`;
5
+ const orderValue = value === "order-custom"
6
+ ? orderCustomByBreakpoint[breakpoint]
7
+ : value;
8
+ return orderValue ? `${prefix}${orderValue}` : null;
9
+ })
10
+ .filter(Boolean)
11
+ .join(" ");
12
+ };
13
+
1
14
  const globalActAsGridOrFlexItem = (app) => {
2
15
  const {
3
16
  globalGridOrFlexDisplayAs: displayAs,
@@ -21,10 +34,13 @@ const globalActAsGridOrFlexItem = (app) => {
21
34
  // General
22
35
  globalGridOrFlexItemAlignSelf: alignSelf,
23
36
  globalGridOrFlexItemJustifySelf: justifySelf,
24
- globalGridOrFlexItemOrder: order,
25
- globalGridOrFlexItemOrderCustom: orderCustom
26
37
  } = app.props;
27
38
 
39
+ const {
40
+ globalGridOrFlexItemOrder: orderByBreakpoint,
41
+ globalGridOrFlexItemOrderCustom: orderCustomByBreakpoint,
42
+ } = app.responsiveProps;
43
+
28
44
  if (displayAs == "default") {
29
45
  return false;
30
46
  }
@@ -40,7 +56,7 @@ const globalActAsGridOrFlexItem = (app) => {
40
56
  shrink,
41
57
  grow,
42
58
  basis == "custom" ? basisCustom : basis,
43
- order == "custom" ? orderCustom : order
59
+ getOrderClasses(orderByBreakpoint, orderCustomByBreakpoint)
44
60
  ] : [])
45
61
  );
46
62
  }
@@ -56,7 +72,7 @@ const globalActAsGridOrFlexItem = (app) => {
56
72
  rowEnd !== "row-end-auto" ? rowEnd : undefined,
57
73
  alignSelf,
58
74
  justifySelf,
59
- order == "custom" ? orderCustom : order
75
+ getOrderClasses(orderByBreakpoint, orderCustomByBreakpoint)
60
76
  ] : [])
61
77
  );
62
78
  }