stylelint-plugin-logical-css 0.0.5 → 0.1.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.
- package/README.md +94 -5
- package/package.json +15 -1
- package/src/index.js +2 -2
- package/src/rules/use-logical-properties-and-values/base.js +4 -4
- package/src/rules/use-logical-properties-and-values/index.js +9 -9
- package/src/rules/use-logical-units/base.js +4 -4
- package/src/rules/use-logical-units/index.js +6 -6
- package/src/utils/isPhysicalProperty.js +1 -1
- package/src/utils/isPhysicalUnit.js +2 -2
- package/src/utils/isPhysicalValue.js +1 -1
- package/src/utils/logical.js +78 -76
- package/src/utils/physical.js +65 -63
- package/src/utils/physicalPropertiesMap.js +6 -2
- package/src/utils/physicalUnitsMap.js +2 -2
- package/src/utils/physicalValuesMap.js +2 -2
package/README.md
CHANGED
|
@@ -1,11 +1,100 @@
|
|
|
1
1
|
# Stylelint Plugin Logical CSS
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
|
+

|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Stylelint Plugin Logical CSS aims to enforce the use of logical CSS properties,
|
|
7
|
+
values and units. The plugin provides two rules. But first, let's get set up.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
> [Read more about Logical CSS on MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties)
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
## Getting Started
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
> Before getting started with the plugin, you must first have
|
|
14
|
+
> [Stylelint](https://stylelint.io/) version 14.0.0 or greater installed
|
|
15
|
+
|
|
16
|
+
To get started using the plugin, it must first be installed.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm i stylelint-plugin-logical-css --save-dev
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
yarn add stylelint-plugin-logical-css --dev
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
With the plugin installed, the rule(s) can now be added to the project's
|
|
27
|
+
Stylelint configuration.
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"plugins": ["stylelint-plugin-logical-css"],
|
|
32
|
+
"rules": {
|
|
33
|
+
"plugin/use-logical-properties-and-values": [
|
|
34
|
+
true,
|
|
35
|
+
{ "severity": "warning" }
|
|
36
|
+
],
|
|
37
|
+
"plugin/use-logical-units": [true, { "severity": "warning" }]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Rules
|
|
43
|
+
|
|
44
|
+
Let's explore each rule to better understand what it does, and does not, allow.
|
|
45
|
+
|
|
46
|
+
### `plugin/use-logical-properties-and-values`
|
|
47
|
+
|
|
48
|
+
> ➟
|
|
49
|
+
> [Learn more about the properties and values supported by this rule](./src/rules/use-logical-properties-and-values)
|
|
50
|
+
|
|
51
|
+
This rule is responsible for checking both CSS properties and values. When a
|
|
52
|
+
physical property or value is found, it will be flagged.
|
|
53
|
+
|
|
54
|
+
#### Not Allowed
|
|
55
|
+
|
|
56
|
+
```css
|
|
57
|
+
.heading {
|
|
58
|
+
max-width: 90ch; /* Will flag the use of "width" */
|
|
59
|
+
text-align: left; /* Will flag the use of "left" */
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### Allowed
|
|
64
|
+
|
|
65
|
+
```css
|
|
66
|
+
.heading {
|
|
67
|
+
max-inline-size: 90ch;
|
|
68
|
+
text-align: start;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### `plugin/use-logical-units`
|
|
73
|
+
|
|
74
|
+
> ➟
|
|
75
|
+
> [Learn more about the properties and values supported by this rule](./src/rules/use-logical-units)
|
|
76
|
+
|
|
77
|
+
> Read about current
|
|
78
|
+
> [browser support for logical viewport units](https://caniuse.com/mdn-css_types_length_viewport_percentage_units_dynamic).
|
|
79
|
+
|
|
80
|
+
This rule is responsible for checking that logical CSS units are used.
|
|
81
|
+
Specifically, viewport units like `vw` and `vh` which stand for viewport width
|
|
82
|
+
and viewport height respectively will not reflect different writing modes and
|
|
83
|
+
directions. Instead, this rule will enforce the logical equivalents, `vi` and
|
|
84
|
+
`vb`.
|
|
85
|
+
|
|
86
|
+
#### Not Allowed
|
|
87
|
+
|
|
88
|
+
```css
|
|
89
|
+
body {
|
|
90
|
+
max-block-size: 100vh; /* Will flag the physical use of viewport "height" */
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### Allowed
|
|
95
|
+
|
|
96
|
+
```css
|
|
97
|
+
body {
|
|
98
|
+
max-block-size: 100vb;
|
|
99
|
+
}
|
|
100
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stylelint-plugin-logical-css",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
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
|
"files": [
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"!**/**/*.test.js"
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
|
+
"prepare": "husky install",
|
|
11
12
|
"test": "jest"
|
|
12
13
|
},
|
|
13
14
|
"repository": {
|
|
@@ -35,9 +36,22 @@
|
|
|
35
36
|
"stylelint": "^14.0.0 || ^15.0.0"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
39
|
+
"@commitlint/cli": "^17.4.4",
|
|
40
|
+
"@commitlint/config-conventional": "^17.4.4",
|
|
41
|
+
"eslint": "^8.35.0",
|
|
42
|
+
"husky": "^8.0.0",
|
|
38
43
|
"jest": "^29.4.3",
|
|
39
44
|
"jest-cli": "^29.4.3",
|
|
40
45
|
"jest-preset-stylelint": "^6.1.0",
|
|
46
|
+
"lint-staged": "^13.1.2",
|
|
47
|
+
"prettier": "^2.8.4",
|
|
48
|
+
"prettier-eslint": "^15.0.1",
|
|
41
49
|
"stylelint": "^15.2.0"
|
|
50
|
+
},
|
|
51
|
+
"lint-staged": {
|
|
52
|
+
"**/*.{js|md}": [
|
|
53
|
+
"eslint",
|
|
54
|
+
"prettier --write"
|
|
55
|
+
]
|
|
42
56
|
}
|
|
43
57
|
}
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const useLogicalPropertiesAndValues = require(
|
|
2
|
-
const useLogicalUnits = require(
|
|
1
|
+
const useLogicalPropertiesAndValues = require('./rules/use-logical-properties-and-values');
|
|
2
|
+
const useLogicalUnits = require('./rules/use-logical-units');
|
|
3
3
|
|
|
4
4
|
module.exports = [useLogicalPropertiesAndValues, useLogicalUnits];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
const stylelint = require(
|
|
3
|
+
const stylelint = require('stylelint');
|
|
4
4
|
|
|
5
|
-
const ruleName =
|
|
5
|
+
const ruleName = 'plugin/use-logical-properties-and-values';
|
|
6
6
|
|
|
7
7
|
const ruleMessages = stylelint.utils.ruleMessages(ruleName, {
|
|
8
8
|
unexpectedProp(physicalProperty, logicalProperty) {
|
|
@@ -14,7 +14,7 @@ const ruleMessages = stylelint.utils.ruleMessages(ruleName, {
|
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
const ruleMeta = {
|
|
17
|
-
url:
|
|
17
|
+
url: 'https://github.com/yuschick/stylelint-plugin-logical-css',
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
module.exports = {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
const stylelint = require(
|
|
3
|
+
const stylelint = require('stylelint');
|
|
4
4
|
|
|
5
|
-
const { ruleName, ruleMessages, ruleMeta } = require(
|
|
6
|
-
const { isPhysicalProperty } = require(
|
|
7
|
-
const { isPhysicalValue } = require(
|
|
8
|
-
const { physicalPropertiesMap } = require(
|
|
9
|
-
const { physicalValuesMap } = require(
|
|
5
|
+
const { ruleName, ruleMessages, ruleMeta } = require('./base');
|
|
6
|
+
const { isPhysicalProperty } = require('../../utils/isPhysicalProperty');
|
|
7
|
+
const { isPhysicalValue } = require('../../utils/isPhysicalValue');
|
|
8
|
+
const { physicalPropertiesMap } = require('../../utils/physicalPropertiesMap');
|
|
9
|
+
const { physicalValuesMap } = require('../../utils/physicalValuesMap');
|
|
10
10
|
|
|
11
11
|
const ruleFunction = () => {
|
|
12
12
|
return (root, result) => {
|
|
@@ -25,12 +25,12 @@ const ruleFunction = () => {
|
|
|
25
25
|
const message = propIsPhysical
|
|
26
26
|
? ruleMessages.unexpectedProp(
|
|
27
27
|
decl.prop,
|
|
28
|
-
physicalPropertiesMap[decl.prop]
|
|
28
|
+
physicalPropertiesMap[decl.prop],
|
|
29
29
|
)
|
|
30
30
|
: ruleMessages.unexpectedValue(
|
|
31
31
|
decl.prop,
|
|
32
32
|
decl.value,
|
|
33
|
-
physicalValuesMap[decl.prop][decl.value]
|
|
33
|
+
physicalValuesMap[decl.prop][decl.value],
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
stylelint.utils.report({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
const stylelint = require(
|
|
3
|
+
const stylelint = require('stylelint');
|
|
4
4
|
|
|
5
|
-
const ruleName =
|
|
5
|
+
const ruleName = 'plugin/use-logical-units';
|
|
6
6
|
|
|
7
7
|
const ruleMessages = stylelint.utils.ruleMessages(ruleName, {
|
|
8
8
|
unexpectedUnit(physicalUnit, logicalUnit) {
|
|
@@ -11,7 +11,7 @@ const ruleMessages = stylelint.utils.ruleMessages(ruleName, {
|
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
const ruleMeta = {
|
|
14
|
-
url:
|
|
14
|
+
url: 'https://github.com/yuschick/stylelint-plugin-logical-css',
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
module.exports = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
const stylelint = require(
|
|
3
|
+
const stylelint = require('stylelint');
|
|
4
4
|
|
|
5
|
-
const { ruleName, ruleMessages, ruleMeta } = require(
|
|
6
|
-
const { getValueUnit, isPhysicalUnit } = require(
|
|
7
|
-
const { physicalUnitsMap } = require(
|
|
5
|
+
const { ruleName, ruleMessages, ruleMeta } = require('./base');
|
|
6
|
+
const { getValueUnit, isPhysicalUnit } = require('../../utils/isPhysicalUnit');
|
|
7
|
+
const { physicalUnitsMap } = require('../../utils/physicalUnitsMap');
|
|
8
8
|
|
|
9
9
|
const ruleFunction = () => {
|
|
10
10
|
return (root, result) => {
|
|
@@ -22,7 +22,7 @@ const ruleFunction = () => {
|
|
|
22
22
|
const physicalUnit = getValueUnit(decl.value);
|
|
23
23
|
const message = ruleMessages.unexpectedUnit(
|
|
24
24
|
physicalUnit,
|
|
25
|
-
physicalUnitsMap[physicalUnit]
|
|
25
|
+
physicalUnitsMap[physicalUnit],
|
|
26
26
|
);
|
|
27
27
|
|
|
28
28
|
stylelint.utils.report({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { physicalUnits } = require(
|
|
1
|
+
const { physicalUnits } = require('./physical');
|
|
2
2
|
|
|
3
3
|
const expression = /(\d+\s?)(dvh|dvw|lvh|lvw|svh|svw|vh|vw|)(\s+|$)/;
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ function getValueUnit(value) {
|
|
|
8
8
|
if (!match) return false;
|
|
9
9
|
|
|
10
10
|
const matchedUnit = match.find((item) =>
|
|
11
|
-
Object.values(physicalUnits).includes(item)
|
|
11
|
+
Object.values(physicalUnits).includes(item),
|
|
12
12
|
);
|
|
13
13
|
|
|
14
14
|
return matchedUnit;
|
package/src/utils/logical.js
CHANGED
|
@@ -1,92 +1,94 @@
|
|
|
1
1
|
const logicalAxis = Object.freeze({
|
|
2
|
-
block:
|
|
3
|
-
inline:
|
|
2
|
+
block: 'block',
|
|
3
|
+
inline: 'inline',
|
|
4
4
|
});
|
|
5
5
|
|
|
6
6
|
const logicalInlinePoints = Object.freeze({
|
|
7
|
-
end:
|
|
8
|
-
start:
|
|
7
|
+
end: 'end',
|
|
8
|
+
start: 'start',
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const logicalProperties = Object.freeze({
|
|
12
|
-
blockSize:
|
|
13
|
-
borderBlock:
|
|
14
|
-
borderBlockColor:
|
|
15
|
-
borderBlockEnd:
|
|
16
|
-
borderBlockEndColor:
|
|
17
|
-
borderBlockEndStyle:
|
|
18
|
-
borderBlockEndWidth:
|
|
19
|
-
borderBlockStart:
|
|
20
|
-
borderBlockStartColor:
|
|
21
|
-
borderBlockStartStyle:
|
|
22
|
-
borderBlockStartWidth:
|
|
23
|
-
borderBlockStyle:
|
|
24
|
-
borderBlockWidth:
|
|
25
|
-
borderColor:
|
|
26
|
-
borderEndEndRadius:
|
|
27
|
-
borderEndStartRadius:
|
|
28
|
-
borderInline:
|
|
29
|
-
borderInlineColor:
|
|
30
|
-
borderInlineEnd:
|
|
31
|
-
borderInlineEndColor:
|
|
32
|
-
borderInlineEndStyle:
|
|
33
|
-
borderInlineEndWidth:
|
|
34
|
-
borderInlineStart:
|
|
35
|
-
borderInlineStartColor:
|
|
36
|
-
borderInlineStartStyle:
|
|
37
|
-
borderInlineStartWidth:
|
|
38
|
-
borderInlineStyle:
|
|
39
|
-
borderInlineWidth:
|
|
40
|
-
borderStartEndRadius:
|
|
41
|
-
borderStartStartRadius:
|
|
42
|
-
borderStyle:
|
|
43
|
-
borderWidth:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
12
|
+
blockSize: 'block-size',
|
|
13
|
+
borderBlock: 'border-block',
|
|
14
|
+
borderBlockColor: 'border-block-color',
|
|
15
|
+
borderBlockEnd: 'border-block-end',
|
|
16
|
+
borderBlockEndColor: 'border-block-end-color',
|
|
17
|
+
borderBlockEndStyle: 'border-block-end-style',
|
|
18
|
+
borderBlockEndWidth: 'border-block-end-width',
|
|
19
|
+
borderBlockStart: 'border-block-start',
|
|
20
|
+
borderBlockStartColor: 'border-block-start-color',
|
|
21
|
+
borderBlockStartStyle: 'border-block-start-style',
|
|
22
|
+
borderBlockStartWidth: 'border-block-start-width',
|
|
23
|
+
borderBlockStyle: 'border-block-style',
|
|
24
|
+
borderBlockWidth: 'border-block-width',
|
|
25
|
+
borderColor: 'border-color',
|
|
26
|
+
borderEndEndRadius: 'border-end-end-radius',
|
|
27
|
+
borderEndStartRadius: 'border-end-start-radius',
|
|
28
|
+
borderInline: 'border-inline',
|
|
29
|
+
borderInlineColor: 'border-inline-color',
|
|
30
|
+
borderInlineEnd: 'border-inline-end',
|
|
31
|
+
borderInlineEndColor: 'border-inline-end-color',
|
|
32
|
+
borderInlineEndStyle: 'border-inline-end-style',
|
|
33
|
+
borderInlineEndWidth: 'border-inline-end-width',
|
|
34
|
+
borderInlineStart: 'border-inline-start',
|
|
35
|
+
borderInlineStartColor: 'border-inline-start-color',
|
|
36
|
+
borderInlineStartStyle: 'border-inline-start-style',
|
|
37
|
+
borderInlineStartWidth: 'border-inline-start-width',
|
|
38
|
+
borderInlineStyle: 'border-inline-style',
|
|
39
|
+
borderInlineWidth: 'border-inline-width',
|
|
40
|
+
borderStartEndRadius: 'border-start-end-radius',
|
|
41
|
+
borderStartStartRadius: 'border-start-start-radius',
|
|
42
|
+
borderStyle: 'border-style',
|
|
43
|
+
borderWidth: 'border-width',
|
|
44
|
+
containIntrinsicBlockSize: 'contain-intrinsic-block-size',
|
|
45
|
+
containIntrinsicInlineSize: 'contain-intrinsic-inline-size',
|
|
46
|
+
inlineSize: 'inline-size',
|
|
47
|
+
inset: 'inset',
|
|
48
|
+
insetBlock: 'inset-block',
|
|
49
|
+
insetBlockEnd: 'inset-block-end',
|
|
50
|
+
insetBlockStart: 'inset-block-start',
|
|
51
|
+
insetInline: 'inset-inline',
|
|
52
|
+
insetInlineEnd: 'inset-inline-end',
|
|
53
|
+
insetInlineStart: 'inset-inline-start',
|
|
54
|
+
marginBlock: 'margin-block',
|
|
55
|
+
marginBlockEnd: 'margin-block-end',
|
|
56
|
+
marginBlockStart: 'margin-block-start',
|
|
57
|
+
marginInline: 'margin-inline',
|
|
58
|
+
marginInlineEnd: 'margin-inline-end',
|
|
59
|
+
marginInlineStart: 'margin-inline-start',
|
|
60
|
+
maxBlockSize: 'max-block-size',
|
|
61
|
+
maxInlineSize: 'max-inline-size',
|
|
62
|
+
minBlockSize: 'min-block-size',
|
|
63
|
+
minInlineSize: 'min-inline-size',
|
|
64
|
+
overflowBlock: 'overflow-block',
|
|
65
|
+
overflowInline: 'overflow-inline',
|
|
66
|
+
overscrollBehaviorBlock: 'overscroll-behavior-block',
|
|
67
|
+
overscrollBehaviorInline: 'overscroll-behavior-inline',
|
|
68
|
+
paddingBlock: 'padding-block',
|
|
69
|
+
paddingBlockEnd: 'padding-block-end',
|
|
70
|
+
paddingBlockStart: 'padding-block-start',
|
|
71
|
+
paddingInline: 'padding-inline',
|
|
72
|
+
paddingInlineEnd: 'padding-inline-end',
|
|
73
|
+
paddingInlineStart: 'padding-inline-start',
|
|
72
74
|
});
|
|
73
75
|
|
|
74
76
|
const logicalUnits = Object.freeze({
|
|
75
|
-
dvb:
|
|
76
|
-
dvi:
|
|
77
|
-
lvb:
|
|
78
|
-
lvi:
|
|
79
|
-
svb:
|
|
80
|
-
svi:
|
|
81
|
-
vb:
|
|
82
|
-
vi:
|
|
77
|
+
dvb: 'dvb',
|
|
78
|
+
dvi: 'dvi',
|
|
79
|
+
lvb: 'lvb',
|
|
80
|
+
lvi: 'lvi',
|
|
81
|
+
svb: 'svb',
|
|
82
|
+
svi: 'svi',
|
|
83
|
+
vb: 'vb',
|
|
84
|
+
vi: 'vi',
|
|
83
85
|
});
|
|
84
86
|
|
|
85
87
|
const logicalValues = Object.freeze({
|
|
86
|
-
blockEnd:
|
|
87
|
-
blockStart:
|
|
88
|
-
inlineEnd:
|
|
89
|
-
inlineStart:
|
|
88
|
+
blockEnd: 'block-end',
|
|
89
|
+
blockStart: 'block-start',
|
|
90
|
+
inlineEnd: 'inline-end',
|
|
91
|
+
inlineStart: 'inline-start',
|
|
90
92
|
});
|
|
91
93
|
|
|
92
94
|
module.exports = {
|
package/src/utils/physical.js
CHANGED
|
@@ -1,76 +1,78 @@
|
|
|
1
1
|
const physicalAxis = Object.freeze({
|
|
2
|
-
horizontal:
|
|
3
|
-
vertical:
|
|
4
|
-
x:
|
|
5
|
-
y:
|
|
2
|
+
horizontal: 'horizontal',
|
|
3
|
+
vertical: 'vertical',
|
|
4
|
+
x: 'x',
|
|
5
|
+
y: 'y',
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
const physicalProperties = Object.freeze({
|
|
9
|
-
borderBottom:
|
|
10
|
-
borderBottomColor:
|
|
11
|
-
borderBottomLeftRadius:
|
|
12
|
-
borderBottomRightRadius:
|
|
13
|
-
borderBottomStyle:
|
|
14
|
-
borderBottomWidth:
|
|
15
|
-
borderLeft:
|
|
16
|
-
borderLeftColor:
|
|
17
|
-
borderLeftStyle:
|
|
18
|
-
borderLeftWidth:
|
|
19
|
-
borderRight:
|
|
20
|
-
borderRightColor:
|
|
21
|
-
borderRightStyle:
|
|
22
|
-
borderRightWidth:
|
|
23
|
-
borderTop:
|
|
24
|
-
borderTopColor:
|
|
25
|
-
borderTopLeftRadius:
|
|
26
|
-
borderTopRightRadius:
|
|
27
|
-
borderTopStyle:
|
|
28
|
-
borderTopWidth:
|
|
29
|
-
bottom:
|
|
30
|
-
captionSide:
|
|
31
|
-
clear:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
9
|
+
borderBottom: 'border-bottom',
|
|
10
|
+
borderBottomColor: 'border-bottom-color',
|
|
11
|
+
borderBottomLeftRadius: 'border-bottom-left-radius',
|
|
12
|
+
borderBottomRightRadius: 'border-bottom-right-radius',
|
|
13
|
+
borderBottomStyle: 'border-bottom-style',
|
|
14
|
+
borderBottomWidth: 'border-bottom-width',
|
|
15
|
+
borderLeft: 'border-left',
|
|
16
|
+
borderLeftColor: 'border-left-color',
|
|
17
|
+
borderLeftStyle: 'border-left-style',
|
|
18
|
+
borderLeftWidth: 'border-left-width',
|
|
19
|
+
borderRight: 'border-right',
|
|
20
|
+
borderRightColor: 'border-right-color',
|
|
21
|
+
borderRightStyle: 'border-right-style',
|
|
22
|
+
borderRightWidth: 'border-right-width',
|
|
23
|
+
borderTop: 'border-top',
|
|
24
|
+
borderTopColor: 'border-top-color',
|
|
25
|
+
borderTopLeftRadius: 'border-top-left-radius',
|
|
26
|
+
borderTopRightRadius: 'border-top-right-radius',
|
|
27
|
+
borderTopStyle: 'border-top-style',
|
|
28
|
+
borderTopWidth: 'border-top-width',
|
|
29
|
+
bottom: 'bottom',
|
|
30
|
+
captionSide: 'caption-side',
|
|
31
|
+
clear: 'clear',
|
|
32
|
+
containIntrinsicHeight: 'contain-intrinsic-height',
|
|
33
|
+
containIntrinsicWidth: 'contain-intrinsic-width',
|
|
34
|
+
float: 'float',
|
|
35
|
+
height: 'height',
|
|
36
|
+
left: 'left',
|
|
37
|
+
marginBottom: 'margin-bottom',
|
|
38
|
+
marginLeft: 'margin-left',
|
|
39
|
+
marginRight: 'margin-right',
|
|
40
|
+
marginTop: 'margin-top',
|
|
41
|
+
maxHeight: 'max-height',
|
|
42
|
+
maxWidth: 'max-width',
|
|
43
|
+
minHeight: 'min-height',
|
|
44
|
+
minWidth: 'min-width',
|
|
45
|
+
overflowX: 'overflow-x',
|
|
46
|
+
overflowY: 'overflow-y',
|
|
47
|
+
overscrollBehaviorX: 'overscroll-behavior-x',
|
|
48
|
+
overscrollBehaviorY: 'overscroll-behavior-y',
|
|
49
|
+
paddingBottom: 'padding-bottom',
|
|
50
|
+
paddingLeft: 'padding-left',
|
|
51
|
+
paddingRight: 'padding-right',
|
|
52
|
+
paddingTop: 'padding-top',
|
|
53
|
+
resize: 'resize',
|
|
54
|
+
right: 'right',
|
|
55
|
+
textAlign: 'text-align',
|
|
56
|
+
top: 'top',
|
|
57
|
+
width: 'width',
|
|
56
58
|
});
|
|
57
59
|
|
|
58
60
|
const physicalUnits = Object.freeze({
|
|
59
|
-
dvh:
|
|
60
|
-
dvw:
|
|
61
|
-
lvh:
|
|
62
|
-
lvw:
|
|
63
|
-
svh:
|
|
64
|
-
svw:
|
|
65
|
-
vh:
|
|
66
|
-
vw:
|
|
61
|
+
dvh: 'dvh',
|
|
62
|
+
dvw: 'dvw',
|
|
63
|
+
lvh: 'lvh',
|
|
64
|
+
lvw: 'lvw',
|
|
65
|
+
svh: 'svh',
|
|
66
|
+
svw: 'svw',
|
|
67
|
+
vh: 'vh',
|
|
68
|
+
vw: 'vw',
|
|
67
69
|
});
|
|
68
70
|
|
|
69
71
|
const physicalValues = Object.freeze({
|
|
70
|
-
bottom:
|
|
71
|
-
left:
|
|
72
|
-
right:
|
|
73
|
-
top:
|
|
72
|
+
bottom: 'bottom',
|
|
73
|
+
left: 'left',
|
|
74
|
+
right: 'right',
|
|
75
|
+
top: 'top',
|
|
74
76
|
});
|
|
75
77
|
|
|
76
78
|
module.exports = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const { logicalProperties } = require(
|
|
2
|
-
const { physicalProperties } = require(
|
|
1
|
+
const { logicalProperties } = require('./logical');
|
|
2
|
+
const { physicalProperties } = require('./physical');
|
|
3
3
|
|
|
4
4
|
const physicalPropertiesMap = Object.freeze({
|
|
5
5
|
[physicalProperties.borderBottom]: logicalProperties.borderBlockEnd,
|
|
@@ -30,6 +30,10 @@ const physicalPropertiesMap = Object.freeze({
|
|
|
30
30
|
[physicalProperties.borderTopStyle]: logicalProperties.borderBlockStartStyle,
|
|
31
31
|
[physicalProperties.borderTopWidth]: logicalProperties.borderBlockStartWidth,
|
|
32
32
|
[physicalProperties.bottom]: logicalProperties.insetBlockEnd,
|
|
33
|
+
[physicalProperties.containIntrinsicHeight]:
|
|
34
|
+
logicalProperties.containIntrinsicBlockSize,
|
|
35
|
+
[physicalProperties.containIntrinsicWidth]:
|
|
36
|
+
logicalProperties.containIntrinsicInlineSize,
|
|
33
37
|
[physicalProperties.height]: logicalProperties.blockSize,
|
|
34
38
|
[physicalProperties.left]: logicalProperties.insetInlineStart,
|
|
35
39
|
[physicalProperties.marginBottom]: logicalProperties.marginBlockEnd,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const { logicalUnits } = require(
|
|
2
|
-
const { physicalUnits } = require(
|
|
1
|
+
const { logicalUnits } = require('./logical');
|
|
2
|
+
const { physicalUnits } = require('./physical');
|
|
3
3
|
|
|
4
4
|
const physicalUnitsMap = Object.freeze({
|
|
5
5
|
[physicalUnits.dvh]: logicalUnits.dvb,
|
|
@@ -2,12 +2,12 @@ const {
|
|
|
2
2
|
logicalAxis,
|
|
3
3
|
logicalInlinePoints,
|
|
4
4
|
logicalValues,
|
|
5
|
-
} = require(
|
|
5
|
+
} = require('./logical');
|
|
6
6
|
const {
|
|
7
7
|
physicalAxis,
|
|
8
8
|
physicalProperties,
|
|
9
9
|
physicalValues,
|
|
10
|
-
} = require(
|
|
10
|
+
} = require('./physical');
|
|
11
11
|
|
|
12
12
|
const physicalValuesMap = Object.freeze({
|
|
13
13
|
[physicalProperties.captionSide]: {
|