postcss-font-family-system-ui 2.1.0 → 2.1.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/CHANGELOG.md +28 -0
- package/package.json +5 -5
- package/src/main.mjs +7 -13
- package/.esm-cache/b28e2426107bfa01.mjs +0 -44
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
#### 2.1.4 (2018-01-17)
|
|
2
|
+
|
|
3
|
+
##### Chores
|
|
4
|
+
|
|
5
|
+
* **package:** update @std/esm to version 0.19.5 (0723f986)
|
|
6
|
+
|
|
7
|
+
#### 2.1.3 (2018-01-13)
|
|
8
|
+
|
|
9
|
+
##### Chores
|
|
10
|
+
|
|
11
|
+
* **package:** update @std/esm to version 0.19.2 (dee84838)
|
|
12
|
+
|
|
13
|
+
#### 2.1.2 (2018-01-09)
|
|
14
|
+
|
|
15
|
+
##### Chores
|
|
16
|
+
|
|
17
|
+
* **package:** update @std/esm to version 0.19.1 (#35)
|
|
18
|
+
|
|
19
|
+
##### Refactors
|
|
20
|
+
|
|
21
|
+
* **main:** simplify value parsing (#36) (7d970e9c)
|
|
22
|
+
|
|
23
|
+
#### 2.1.1 (2017-11-20)
|
|
24
|
+
|
|
25
|
+
##### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **package:** add @std/esm to dependencies (15a32854)
|
|
28
|
+
|
|
1
29
|
### 2.1.0 (2017-11-20)
|
|
2
30
|
|
|
3
31
|
##### Chores
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-font-family-system-ui",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "PostCSS plugin to transform W3C CSS font-family: system-ui to a practical font-family list",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -23,15 +23,14 @@
|
|
|
23
23
|
"prepublishOnly": "npm run lint && npm run test"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"
|
|
26
|
+
"@std/esm": "^0.19.5",
|
|
27
27
|
"postcss": "^6.0.1",
|
|
28
28
|
"postcss-value-parser": "^3.3.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@std/esm": "^0.16.0",
|
|
32
31
|
"babel-preset-env": "^1.5.1",
|
|
33
32
|
"cross-env": "^5.0.0",
|
|
34
|
-
"jest": "^
|
|
33
|
+
"jest": "^22.0.4",
|
|
35
34
|
"pre-commit": "^1.2.2",
|
|
36
35
|
"standard": "^10.0.0",
|
|
37
36
|
"yaspeller-ci": "^1.0.0"
|
|
@@ -42,6 +41,7 @@
|
|
|
42
41
|
"cjs": true
|
|
43
42
|
},
|
|
44
43
|
"jest": {
|
|
45
|
-
"collectCoverage": true
|
|
44
|
+
"collectCoverage": true,
|
|
45
|
+
"testEnvironment": "node"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/src/main.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import postcss from 'postcss'
|
|
2
2
|
import valueParser from 'postcss-value-parser'
|
|
3
|
-
import { flatMap } from 'lodash'
|
|
4
3
|
|
|
5
4
|
const fontFamilySystemUIList = [
|
|
6
5
|
'system-ui',
|
|
@@ -14,24 +13,19 @@ const fontFamilySystemUIList = [
|
|
|
14
13
|
'Fira Sans',
|
|
15
14
|
'Droid Sans',
|
|
16
15
|
'Helvetica Neue'
|
|
17
|
-
]
|
|
16
|
+
].join(', ');
|
|
18
17
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return parsedFontFamilySystemUIListTree
|
|
25
|
-
}
|
|
26
|
-
return node
|
|
27
|
-
})
|
|
28
|
-
}
|
|
18
|
+
const transformFontFamilySystemUI = node => {
|
|
19
|
+
if (node.type === 'word' && node.value === 'system-ui') {
|
|
20
|
+
node.value = fontFamilySystemUIList
|
|
21
|
+
}
|
|
22
|
+
};
|
|
29
23
|
|
|
30
24
|
const transform = () => (decl) => {
|
|
31
25
|
if (decl.type === 'decl') {
|
|
32
26
|
if (decl.prop === 'font-family' || decl.prop === 'font') {
|
|
33
27
|
const tree = valueParser(decl.value)
|
|
34
|
-
tree.
|
|
28
|
+
tree.walk(transformFontFamilySystemUI)
|
|
35
29
|
decl.value = tree.toString()
|
|
36
30
|
}
|
|
37
31
|
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
let postcss;_107.w('postcss',[["default",function(v){postcss=v}]]);let valueParser;_107.w('postcss-value-parser',[["default",function(v){valueParser=v}]]);let flatMap;_107.w('lodash',[["flatMap",function(v){flatMap=v}]]);
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const fontFamilySystemUIList = [
|
|
6
|
-
'system-ui',
|
|
7
|
-
'-apple-system',
|
|
8
|
-
'BlinkMacSystemFont',
|
|
9
|
-
'Segoe UI',
|
|
10
|
-
'Roboto',
|
|
11
|
-
'Oxygen',
|
|
12
|
-
'Ubuntu',
|
|
13
|
-
'Cantarell',
|
|
14
|
-
'Fira Sans',
|
|
15
|
-
'Droid Sans',
|
|
16
|
-
'Helvetica Neue'
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
const parsedFontFamilySystemUIListTree = valueParser(fontFamilySystemUIList.join(', '))
|
|
20
|
-
|
|
21
|
-
const transformFontFamilySystemUI = (nodes) => {
|
|
22
|
-
return flatMap(nodes, node => {
|
|
23
|
-
if (node.type === 'word' && node.value === 'system-ui') {
|
|
24
|
-
return parsedFontFamilySystemUIListTree
|
|
25
|
-
}
|
|
26
|
-
return node
|
|
27
|
-
})
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const transform = () => (decl) => {
|
|
31
|
-
if (decl.type === 'decl') {
|
|
32
|
-
if (decl.prop === 'font-family' || decl.prop === 'font') {
|
|
33
|
-
const tree = valueParser(decl.value)
|
|
34
|
-
tree.nodes = transformFontFamilySystemUI(tree.nodes)
|
|
35
|
-
decl.value = tree.toString()
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
_107.d(postcss.plugin('postcss-font-family-system-ui', () => {
|
|
41
|
-
return (root) => {
|
|
42
|
-
root.walk(transform())
|
|
43
|
-
}
|
|
44
|
-
}));
|