stylelint-plugin-logical-css 1.2.0 → 1.2.1

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/README.md CHANGED
@@ -95,7 +95,9 @@ physical property or value is found, it will be flagged.
95
95
  max-width: 90ch; /* Will flag the use of "width" */
96
96
  text-align: left; /* Will flag the use of "left" */
97
97
  opacity: 1;
98
- transition: opacity 1s ease, max-width 1s ease; /* Will flag the use of 'max-width' */
98
+ transition:
99
+ opacity 1s ease,
100
+ max-width 1s ease; /* Will flag the use of 'max-width' */
99
101
  }
100
102
  ```
101
103
 
@@ -196,8 +198,6 @@ physical property or value is found, it will be flagged.
196
198
  | ---------------------------------------------- | ----------------------------------- |
197
199
  | `(-webkit-)box-orient: vertical` | `(-webkit-)box-orient: block-axis` |
198
200
  | `(-webkit-)box-orient: horizontal` | `(-webkit-)box-orient: inline-axis` |
199
- | `caption-side: top` | `caption-side: block-start` |
200
- | `caption-side: bottom` | `caption-side: block-end` |
201
201
  | `caption-side: right` | `caption-side: inline-end` |
202
202
  | `caption-side: left` | `caption-side: inline-start` |
203
203
  | `overflow-y` | `overflow-block` |
@@ -272,7 +272,11 @@ body {
272
272
  }
273
273
 
274
274
  .container {
275
- inline-size: clamp(10vw, 100%, 50vw); /* Will flag the physical use of viewport "width" */
275
+ inline-size: clamp(
276
+ 10vw,
277
+ 100%,
278
+ 50vw
279
+ ); /* Will flag the physical use of viewport "width" */
276
280
  }
277
281
  ```
278
282
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stylelint-plugin-logical-css",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A Stylelint plugin to enforce the use of logical CSS properties, values and units.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -35,6 +35,10 @@ const ruleFunction = (_, options, context) => {
35
35
  ].includes(rootProp);
36
36
  if (!isValidProp) return;
37
37
 
38
+ const isCaptionSideProperty = rootProp === 'caption-side';
39
+ const isBlockAxisCaptionSideValue =
40
+ isCaptionSideProperty && ['top', 'bottom'].includes(decl.value);
41
+
38
42
  const isTransitionProperty = rootProp === 'transition';
39
43
  const physicalTransitionProperties =
40
44
  isTransitionProperty &&
@@ -49,9 +53,10 @@ const ruleFunction = (_, options, context) => {
49
53
  const valueIsPhysical = isPhysicalValue(decl.value);
50
54
 
51
55
  if (
52
- !propIsPhysical &&
53
- !valueIsPhysical &&
54
- !physicalTransitionProperties.length
56
+ (!propIsPhysical &&
57
+ !valueIsPhysical &&
58
+ !physicalTransitionProperties.length) ||
59
+ isBlockAxisCaptionSideValue
55
60
  ) {
56
61
  return;
57
62
  }
@@ -64,6 +69,7 @@ const ruleFunction = (_, options, context) => {
64
69
  physicalPropertiesMap[rootProp],
65
70
  );
66
71
  }
72
+
67
73
  if (valueIsPhysical) {
68
74
  message = ruleMessages.unexpectedValue(
69
75
  decl.prop,
@@ -71,6 +77,7 @@ const ruleFunction = (_, options, context) => {
71
77
  physicalValuesMap[rootProp][decl.value],
72
78
  );
73
79
  }
80
+
74
81
  if (physicalTransitionProperties.length) {
75
82
  const propertyToFlag = physicalTransitionProperties[0].trim();
76
83
  message = ruleMessages.unexpectedTransitionValue(
@@ -11,10 +11,8 @@ export const physicalValuesMap = Object.freeze({
11
11
  [physicalAxis.vertical]: `${logicalAxis.block}-axis`,
12
12
  },
13
13
  [physicalProperties.captionSide]: {
14
- [physicalValues.bottom]: logicalValues.blockEnd,
15
14
  [physicalValues.left]: logicalValues.inlineStart,
16
15
  [physicalValues.right]: logicalValues.inlineEnd,
17
- [physicalValues.top]: logicalValues.blockStart,
18
16
  },
19
17
  [physicalProperties.clear]: {
20
18
  [physicalValues.left]: logicalValues.inlineStart,