@blockle/blocks-core 0.21.5 → 0.21.7

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.
@@ -8,21 +8,19 @@ function defineProperties({
8
8
  const result = {};
9
9
  for (const property in properties) {
10
10
  const values = properties[property];
11
- result[property] = {
11
+ const propertyResult = {
12
12
  values: {}
13
13
  };
14
- const ref = result[property];
15
- if (!ref || !ref.values) {
16
- throw new Error(`Invalid property definition for ${property}`);
17
- }
18
14
  if (Array.isArray(values)) {
19
15
  for (const value of values) {
20
16
  const defaultClass = css.style({
21
17
  [property]: value
22
18
  });
23
- ref.values[value] = {
24
- defaultClass,
25
- conditions: conditions == null ? void 0 : conditions.map((condition, i) => {
19
+ const propResult = {
20
+ defaultClass
21
+ };
22
+ if (conditions) {
23
+ propResult.conditions = conditions.map((condition, i) => {
26
24
  if (i === 0 && Object.keys(condition).length === 0) {
27
25
  return defaultClass;
28
26
  }
@@ -38,21 +36,22 @@ function defineProperties({
38
36
  throw new Error(
39
37
  `Invalid condition for ${property}: ${JSON.stringify(condition)}`
40
38
  );
41
- })
42
- };
43
- if (!conditions && "conditions" in ref.values) {
44
- delete ref.values.conditions;
39
+ });
45
40
  }
41
+ propertyResult.values[value] = propResult;
46
42
  }
43
+ result[property] = propertyResult;
47
44
  continue;
48
45
  }
49
46
  for (const value in values) {
50
47
  const defaultClass = css.style({
51
48
  [property]: values[value]
52
49
  });
53
- ref.values[value] = {
54
- defaultClass,
55
- conditions: conditions == null ? void 0 : conditions.map((condition, i) => {
50
+ const propResult = {
51
+ defaultClass
52
+ };
53
+ if (conditions) {
54
+ propResult.conditions = conditions.map((condition, i) => {
56
55
  if (i === 0 && Object.keys(condition).length === 0) {
57
56
  return defaultClass;
58
57
  }
@@ -60,7 +59,7 @@ function defineProperties({
60
59
  return css.style({
61
60
  "@media": {
62
61
  [condition["@media"]]: {
63
- [property]: value
62
+ [property]: values[value]
64
63
  }
65
64
  }
66
65
  });
@@ -68,12 +67,11 @@ function defineProperties({
68
67
  throw new Error(
69
68
  `Invalid condition for ${property}: ${JSON.stringify(condition)}`
70
69
  );
71
- })
72
- };
73
- if (!conditions && "conditions" in ref.values) {
74
- delete ref.values.conditions;
70
+ });
75
71
  }
72
+ propertyResult.values[value] = propResult;
76
73
  }
74
+ result[property] = propertyResult;
77
75
  }
78
76
  return result;
79
77
  }
@@ -6,21 +6,19 @@ function defineProperties({
6
6
  const result = {};
7
7
  for (const property in properties) {
8
8
  const values = properties[property];
9
- result[property] = {
9
+ const propertyResult = {
10
10
  values: {}
11
11
  };
12
- const ref = result[property];
13
- if (!ref || !ref.values) {
14
- throw new Error(`Invalid property definition for ${property}`);
15
- }
16
12
  if (Array.isArray(values)) {
17
13
  for (const value of values) {
18
14
  const defaultClass = style({
19
15
  [property]: value
20
16
  });
21
- ref.values[value] = {
22
- defaultClass,
23
- conditions: conditions == null ? void 0 : conditions.map((condition, i) => {
17
+ const propResult = {
18
+ defaultClass
19
+ };
20
+ if (conditions) {
21
+ propResult.conditions = conditions.map((condition, i) => {
24
22
  if (i === 0 && Object.keys(condition).length === 0) {
25
23
  return defaultClass;
26
24
  }
@@ -36,21 +34,22 @@ function defineProperties({
36
34
  throw new Error(
37
35
  `Invalid condition for ${property}: ${JSON.stringify(condition)}`
38
36
  );
39
- })
40
- };
41
- if (!conditions && "conditions" in ref.values) {
42
- delete ref.values.conditions;
37
+ });
43
38
  }
39
+ propertyResult.values[value] = propResult;
44
40
  }
41
+ result[property] = propertyResult;
45
42
  continue;
46
43
  }
47
44
  for (const value in values) {
48
45
  const defaultClass = style({
49
46
  [property]: values[value]
50
47
  });
51
- ref.values[value] = {
52
- defaultClass,
53
- conditions: conditions == null ? void 0 : conditions.map((condition, i) => {
48
+ const propResult = {
49
+ defaultClass
50
+ };
51
+ if (conditions) {
52
+ propResult.conditions = conditions.map((condition, i) => {
54
53
  if (i === 0 && Object.keys(condition).length === 0) {
55
54
  return defaultClass;
56
55
  }
@@ -58,7 +57,7 @@ function defineProperties({
58
57
  return style({
59
58
  "@media": {
60
59
  [condition["@media"]]: {
61
- [property]: value
60
+ [property]: values[value]
62
61
  }
63
62
  }
64
63
  });
@@ -66,12 +65,11 @@ function defineProperties({
66
65
  throw new Error(
67
66
  `Invalid condition for ${property}: ${JSON.stringify(condition)}`
68
67
  );
69
- })
70
- };
71
- if (!conditions && "conditions" in ref.values) {
72
- delete ref.values.conditions;
68
+ });
73
69
  }
70
+ propertyResult.values[value] = propResult;
74
71
  }
72
+ result[property] = propertyResult;
75
73
  }
76
74
  return result;
77
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockle/blocks-core",
3
- "version": "0.21.5",
3
+ "version": "0.21.7",
4
4
  "description": "Core for Blocks",
5
5
  "type": "module",
6
6
  "sideEffects": false,