postcss-font-family-system-ui 2.1.4 → 3.0.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/CHANGELOG.md +22 -2
- package/LICENSE.md +108 -0
- package/README.md +124 -39
- package/index.bundle.js +32 -0
- package/index.js +39 -0
- package/package.json +86 -35
- package/.npmignore +0 -57
- package/LICENSE +0 -21
- package/src/index.js +0 -3
- package/src/main.mjs +0 -38
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# Changes to postcss-font-family-system-ui
|
|
2
|
+
|
|
3
|
+
## 3.0.0 (2018-01-20)
|
|
4
|
+
|
|
5
|
+
##### Breaking Changes
|
|
6
|
+
|
|
7
|
+
* **main:** removes `Fira Sans` as Firefox OS is dead
|
|
8
|
+
- if you relies on the 2.x behavior, you can use the newly introduced `family` option
|
|
9
|
+
```js
|
|
10
|
+
postcssSystemUiFont({
|
|
11
|
+
family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI','Roboto','Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue'
|
|
12
|
+
})
|
|
13
|
+
```
|
|
14
|
+
##### Refactors
|
|
15
|
+
|
|
16
|
+
* **package:** es6 + rollup + babel - postcss-value-parser
|
|
17
|
+
|
|
18
|
+
##### New Features
|
|
19
|
+
|
|
20
|
+
* **main:** adds `family` option to specify polyfill font-family stack
|
|
21
|
+
|
|
1
22
|
#### 2.1.4 (2018-01-17)
|
|
2
23
|
|
|
3
24
|
##### Chores
|
|
@@ -65,7 +86,7 @@
|
|
|
65
86
|
##### Chores
|
|
66
87
|
|
|
67
88
|
* **package:**
|
|
68
|
-
* update nyc to
|
|
89
|
+
* update nyc to latest version (32b6c515)
|
|
69
90
|
* upgrade dependencies (5a6924da)
|
|
70
91
|
* update standard to version 10.0.0 (f9e3996d)
|
|
71
92
|
* update cross-env to version 4.0.0 (7c079fc9)
|
|
@@ -122,4 +143,3 @@
|
|
|
122
143
|
|
|
123
144
|
* **readme:** add basic readme (17b4eb5b)
|
|
124
145
|
* **main:** initial release (1c75288b)
|
|
125
|
-
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# CC0 1.0 Universal
|
|
2
|
+
|
|
3
|
+
## Statement of Purpose
|
|
4
|
+
|
|
5
|
+
The laws of most jurisdictions throughout the world automatically confer
|
|
6
|
+
exclusive Copyright and Related Rights (defined below) upon the creator and
|
|
7
|
+
subsequent owner(s) (each and all, an “owner”) of an original work of
|
|
8
|
+
authorship and/or a database (each, a “Work”).
|
|
9
|
+
|
|
10
|
+
Certain owners wish to permanently relinquish those rights to a Work for the
|
|
11
|
+
purpose of contributing to a commons of creative, cultural and scientific works
|
|
12
|
+
(“Commons”) that the public can reliably and without fear of later claims of
|
|
13
|
+
infringement build upon, modify, incorporate in other works, reuse and
|
|
14
|
+
redistribute as freely as possible in any form whatsoever and for any purposes,
|
|
15
|
+
including without limitation commercial purposes. These owners may contribute
|
|
16
|
+
to the Commons to promote the ideal of a free culture and the further
|
|
17
|
+
production of creative, cultural and scientific works, or to gain reputation or
|
|
18
|
+
greater distribution for their Work in part through the use and efforts of
|
|
19
|
+
others.
|
|
20
|
+
|
|
21
|
+
For these and/or other purposes and motivations, and without any expectation of
|
|
22
|
+
additional consideration or compensation, the person associating CC0 with a
|
|
23
|
+
Work (the “Affirmer”), to the extent that he or she is an owner of Copyright
|
|
24
|
+
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
|
|
25
|
+
publicly distribute the Work under its terms, with knowledge of his or her
|
|
26
|
+
Copyright and Related Rights in the Work and the meaning and intended legal
|
|
27
|
+
effect of CC0 on those rights.
|
|
28
|
+
|
|
29
|
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
30
|
+
protected by copyright and related or neighboring rights (“Copyright and
|
|
31
|
+
Related Rights”). Copyright and Related Rights include, but are not limited
|
|
32
|
+
to, the following:
|
|
33
|
+
1. the right to reproduce, adapt, distribute, perform, display, communicate,
|
|
34
|
+
and translate a Work;
|
|
35
|
+
2. moral rights retained by the original author(s) and/or performer(s);
|
|
36
|
+
3. publicity and privacy rights pertaining to a person’s image or likeness
|
|
37
|
+
depicted in a Work;
|
|
38
|
+
4. rights protecting against unfair competition in regards to a Work,
|
|
39
|
+
subject to the limitations in paragraph 4(i), below;
|
|
40
|
+
5. rights protecting the extraction, dissemination, use and reuse of data in
|
|
41
|
+
a Work;
|
|
42
|
+
6. database rights (such as those arising under Directive 96/9/EC of the
|
|
43
|
+
European Parliament and of the Council of 11 March 1996 on the legal
|
|
44
|
+
protection of databases, and under any national implementation thereof,
|
|
45
|
+
including any amended or successor version of such directive); and
|
|
46
|
+
7. other similar, equivalent or corresponding rights throughout the world
|
|
47
|
+
based on applicable law or treaty, and any national implementations
|
|
48
|
+
thereof.
|
|
49
|
+
|
|
50
|
+
2. Waiver. To the greatest extent permitted by, but not in contravention of,
|
|
51
|
+
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
|
|
52
|
+
unconditionally waives, abandons, and surrenders all of Affirmer’s Copyright
|
|
53
|
+
and Related Rights and associated claims and causes of action, whether now
|
|
54
|
+
known or unknown (including existing as well as future claims and causes of
|
|
55
|
+
action), in the Work (i) in all territories worldwide, (ii) for the maximum
|
|
56
|
+
duration provided by applicable law or treaty (including future time
|
|
57
|
+
extensions), (iii) in any current or future medium and for any number of
|
|
58
|
+
copies, and (iv) for any purpose whatsoever, including without limitation
|
|
59
|
+
commercial, advertising or promotional purposes (the “Waiver”). Affirmer
|
|
60
|
+
makes the Waiver for the benefit of each member of the public at large and
|
|
61
|
+
to the detriment of Affirmer’s heirs and successors, fully intending that
|
|
62
|
+
such Waiver shall not be subject to revocation, rescission, cancellation,
|
|
63
|
+
termination, or any other legal or equitable action to disrupt the quiet
|
|
64
|
+
enjoyment of the Work by the public as contemplated by Affirmer’s express
|
|
65
|
+
Statement of Purpose.
|
|
66
|
+
|
|
67
|
+
3. Public License Fallback. Should any part of the Waiver for any reason be
|
|
68
|
+
judged legally invalid or ineffective under applicable law, then the Waiver
|
|
69
|
+
shall be preserved to the maximum extent permitted taking into account
|
|
70
|
+
Affirmer’s express Statement of Purpose. In addition, to the extent the
|
|
71
|
+
Waiver is so judged Affirmer hereby grants to each affected person a
|
|
72
|
+
royalty-free, non transferable, non sublicensable, non exclusive,
|
|
73
|
+
irrevocable and unconditional license to exercise Affirmer’s Copyright and
|
|
74
|
+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
75
|
+
maximum duration provided by applicable law or treaty (including future time
|
|
76
|
+
extensions), (iii) in any current or future medium and for any number of
|
|
77
|
+
copies, and (iv) for any purpose whatsoever, including without limitation
|
|
78
|
+
commercial, advertising or promotional purposes (the “License”). The License
|
|
79
|
+
shall be deemed effective as of the date CC0 was applied by Affirmer to the
|
|
80
|
+
Work. Should any part of the License for any reason be judged legally
|
|
81
|
+
invalid or ineffective under applicable law, such partial invalidity or
|
|
82
|
+
ineffectiveness shall not invalidate the remainder of the License, and in
|
|
83
|
+
such case Affirmer hereby affirms that he or she will not (i) exercise any
|
|
84
|
+
of his or her remaining Copyright and Related Rights in the Work or (ii)
|
|
85
|
+
assert any associated claims and causes of action with respect to the Work,
|
|
86
|
+
in either case contrary to Affirmer’s express Statement of Purpose.
|
|
87
|
+
|
|
88
|
+
4. Limitations and Disclaimers.
|
|
89
|
+
1. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
90
|
+
surrendered, licensed or otherwise affected by this document.
|
|
91
|
+
2. Affirmer offers the Work as-is and makes no representations or warranties
|
|
92
|
+
of any kind concerning the Work, express, implied, statutory or
|
|
93
|
+
otherwise, including without limitation warranties of title,
|
|
94
|
+
merchantability, fitness for a particular purpose, non infringement, or
|
|
95
|
+
the absence of latent or other defects, accuracy, or the present or
|
|
96
|
+
absence of errors, whether or not discoverable, all to the greatest
|
|
97
|
+
extent permissible under applicable law.
|
|
98
|
+
3. Affirmer disclaims responsibility for clearing rights of other persons
|
|
99
|
+
that may apply to the Work or any use thereof, including without
|
|
100
|
+
limitation any person’s Copyright and Related Rights in the Work.
|
|
101
|
+
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
102
|
+
consents, permissions or other rights required for any use of the Work.
|
|
103
|
+
4. Affirmer understands and acknowledges that Creative Commons is not a
|
|
104
|
+
party to this document and has no duty or obligation with respect to this
|
|
105
|
+
CC0 or use of the Work.
|
|
106
|
+
|
|
107
|
+
For more information, please see
|
|
108
|
+
http://creativecommons.org/publicdomain/zero/1.0/.
|
package/README.md
CHANGED
|
@@ -1,61 +1,146 @@
|
|
|
1
|
-
# postcss-font-family-system-ui
|
|
1
|
+
# postcss-font-family-system-ui [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss]
|
|
2
2
|
|
|
3
|
-
[![CSS Standard
|
|
4
|
-
[![
|
|
5
|
-
[![Build Status]
|
|
6
|
-
[![
|
|
7
|
-
[![Greenkeeper
|
|
3
|
+
[![CSS Standard][css-img]][css-url]
|
|
4
|
+
[![NPM Version][npm-img]][npm-url]
|
|
5
|
+
[![Linux Build Status][cli-img]][cli-url]
|
|
6
|
+
[![Windows Build Status][win-img]][win-url]
|
|
7
|
+
[![Greenkeeper][gkp-img]][gkp-url]
|
|
8
|
+
[![Gitter Chat][git-img]][git-url]
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
[postcss-font-family-system-ui] lets you use `system-ui` in CSS, following the
|
|
11
|
+
[CSS Fonts Module Level 4] specification.
|
|
12
|
+
|
|
13
|
+
```css
|
|
14
|
+
body {
|
|
15
|
+
font: 100%/1.5 system-ui;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* becomes */
|
|
19
|
+
|
|
20
|
+
body {
|
|
21
|
+
font: 100%/1.5 system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue;
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Add [postcss-font-family-system-ui] to your build tool:
|
|
10
28
|
|
|
11
|
-
## Installation
|
|
12
29
|
```bash
|
|
13
|
-
|
|
30
|
+
npm install postcss-font-family-system-ui --save-dev
|
|
14
31
|
```
|
|
15
32
|
|
|
16
|
-
|
|
33
|
+
#### Node
|
|
17
34
|
|
|
18
|
-
|
|
19
|
-
| ------- | ----------------------------- |
|
|
20
|
-
| 5.x | 1.x |
|
|
21
|
-
| 6.x | 2.x |
|
|
35
|
+
Use [postcss-font-family-system-ui] to process your CSS:
|
|
22
36
|
|
|
23
|
-
## Usage
|
|
24
37
|
```js
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
38
|
+
import postcssSystemUiFont from 'postcss-font-family-system-ui';
|
|
39
|
+
|
|
40
|
+
postcssSystemUiFont.process(YOUR_CSS);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### PostCSS
|
|
28
44
|
|
|
29
|
-
|
|
30
|
-
const css = fs.readFileSync('input.css', 'utf8')
|
|
45
|
+
Add [PostCSS] to your build tool:
|
|
31
46
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
.use(fontFamilySystemUI())
|
|
35
|
-
.process(css)
|
|
36
|
-
.css
|
|
47
|
+
```bash
|
|
48
|
+
npm install postcss --save-dev
|
|
37
49
|
```
|
|
38
50
|
|
|
39
|
-
|
|
51
|
+
Use [postcss-font-family-system-ui] as a plugin:
|
|
40
52
|
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
53
|
+
```js
|
|
54
|
+
import postcss from 'gulp-postcss';
|
|
55
|
+
import postcssSystemUiFont from 'postcss-font-family-system-ui';
|
|
45
56
|
|
|
57
|
+
postcss([
|
|
58
|
+
postcssSystemUiFont(/* options */)
|
|
59
|
+
]).process(YOUR_CSS);
|
|
46
60
|
```
|
|
47
61
|
|
|
48
|
-
|
|
62
|
+
#### Gulp
|
|
49
63
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
Add [Gulp PostCSS] to your build tool:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install gulp-postcss --save-dev
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Use [postcss-font-family-system-ui] in your Gulpfile:
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
import postcss from 'gulp-postcss';
|
|
74
|
+
import postcssSystemUiFont from 'postcss-font-family-system-ui';
|
|
75
|
+
|
|
76
|
+
gulp.task('css', () => gulp.src('./src/*.css').pipe(
|
|
77
|
+
postcss([
|
|
78
|
+
postcssSystemUiFont(/* options */)
|
|
79
|
+
])
|
|
80
|
+
).pipe(
|
|
81
|
+
gulp.dest('.')
|
|
82
|
+
));
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### Grunt
|
|
86
|
+
|
|
87
|
+
Add [Grunt PostCSS] to your build tool:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npm install grunt-postcss --save-dev
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Use [postcss-font-family-system-ui] in your Gruntfile:
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
import postcssSystemUiFont from 'postcss-font-family-system-ui';
|
|
97
|
+
|
|
98
|
+
grunt.loadNpmTasks('grunt-postcss');
|
|
99
|
+
|
|
100
|
+
grunt.initConfig({
|
|
101
|
+
postcss: {
|
|
102
|
+
options: {
|
|
103
|
+
use: [
|
|
104
|
+
postcssSystemUiFont(/* options */)
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
dist: {
|
|
108
|
+
src: '*.css'
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
54
112
|
```
|
|
55
113
|
|
|
56
|
-
|
|
114
|
+
## Options
|
|
57
115
|
|
|
58
|
-
|
|
116
|
+
### family
|
|
117
|
+
|
|
118
|
+
The `family` option defines the fallback families used to polyfill `system-ui`.
|
|
119
|
+
It accepts an array or a comma-separated string.
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
import postcssSystemUiFont from 'postcss-font-family-system-ui';
|
|
123
|
+
|
|
124
|
+
postcssSystemUiFont({
|
|
125
|
+
family: 'system-ui, Segoe UI, Roboto, Helvetica Neue' // use less fallbacks
|
|
126
|
+
});
|
|
127
|
+
```
|
|
59
128
|
|
|
60
|
-
|
|
61
|
-
|
|
129
|
+
[css-url]: https://jonathantneal.github.io/css-db/#css-fonts-system-ui-def
|
|
130
|
+
[css-img]: https://jonathantneal.github.io/css-db/badge/css-fonts-system-ui-def.svg
|
|
131
|
+
[npm-url]: https://www.npmjs.com/package/postcss-font-family-system-ui
|
|
132
|
+
[npm-img]: https://img.shields.io/npm/v/postcss-font-family-system-ui.svg
|
|
133
|
+
[cli-url]: https://travis-ci.org/JLHwung/postcss-font-family-system-ui
|
|
134
|
+
[cli-img]: https://img.shields.io/travis/JLHwung/postcss-font-family-system-ui.svg
|
|
135
|
+
[win-url]: https://ci.appveyor.com/project/JLHwung/postcss-font-family-system-ui
|
|
136
|
+
[win-img]: https://img.shields.io/appveyor/ci/JLHwung/postcss-font-family-system-ui.svg
|
|
137
|
+
[gkp-url]: https://greenkeeper.io/
|
|
138
|
+
[gkp-img]: https://badges.greenkeeper.io/JLHwung/postcss-font-family-system-ui.svg
|
|
139
|
+
[git-url]: https://gitter.im/postcss/postcss
|
|
140
|
+
[git-img]: https://img.shields.io/badge/chat-gitter-blue.svg
|
|
141
|
+
|
|
142
|
+
[CSS Fonts Module Level 4]: https://drafts.csswg.org/css-fonts-4/#system-ui-def
|
|
143
|
+
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
|
|
144
|
+
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
|
|
145
|
+
[postcss-font-family-system-ui]: https://github.com/JLHwung/postcss-font-family-system-ui
|
|
146
|
+
[PostCSS]: https://github.com/postcss/postcss
|
package/index.bundle.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
4
|
+
|
|
5
|
+
var postcss = _interopDefault(require('postcss'));
|
|
6
|
+
|
|
7
|
+
// tooling
|
|
8
|
+
// plugin
|
|
9
|
+
var index = postcss.plugin('postcss-system-ui-font', function (opts) {
|
|
10
|
+
var familyOpt = Object(opts).family;
|
|
11
|
+
|
|
12
|
+
var systemUiFamily = typeof familyOpt === 'string' ? familyOpt.trim().split(/\s*,\s*/) : familyOpt || ['system-ui', '-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Droid Sans', 'Helvetica Neue'];
|
|
13
|
+
|
|
14
|
+
// system-ui and fallbacks match
|
|
15
|
+
var whitespace = '[\\f\\n\\r\\x09\\x20]';
|
|
16
|
+
var systemUiMatch = new RegExp(`(^|,|${whitespace}+)(?:system-ui${whitespace}*)(?:,${whitespace}*(?:${systemUiFamily.join('|')})${whitespace}*)?(,|$)`, 'i');
|
|
17
|
+
|
|
18
|
+
// system-ui fallback replacement
|
|
19
|
+
var systemUiReplace = `$1${systemUiFamily.join(', ')}$2`;
|
|
20
|
+
|
|
21
|
+
return function (root) {
|
|
22
|
+
// update font declarations to polyfill system-ui usage
|
|
23
|
+
root.walkDecls(fontPropertyMatch, function (decl) {
|
|
24
|
+
decl.value = decl.value.replace(systemUiMatch, systemUiReplace);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// font and font family property match
|
|
30
|
+
var fontPropertyMatch = /^font(-family)?$/i;
|
|
31
|
+
|
|
32
|
+
module.exports = index;
|
package/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// tooling
|
|
2
|
+
import postcss from 'postcss';
|
|
3
|
+
|
|
4
|
+
// plugin
|
|
5
|
+
export default postcss.plugin('postcss-system-ui-font', opts => {
|
|
6
|
+
const familyOpt = Object(opts).family;
|
|
7
|
+
|
|
8
|
+
const systemUiFamily = typeof familyOpt === 'string'
|
|
9
|
+
? familyOpt.trim().split(/\s*,\s*/)
|
|
10
|
+
: familyOpt || [
|
|
11
|
+
'system-ui',
|
|
12
|
+
'-apple-system',
|
|
13
|
+
'BlinkMacSystemFont',
|
|
14
|
+
'Segoe UI',
|
|
15
|
+
'Roboto',
|
|
16
|
+
'Oxygen',
|
|
17
|
+
'Ubuntu',
|
|
18
|
+
'Cantarell',
|
|
19
|
+
'Droid Sans',
|
|
20
|
+
'Helvetica Neue'
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
// system-ui and fallbacks match
|
|
24
|
+
const whitespace = '[\\f\\n\\r\\x09\\x20]';
|
|
25
|
+
const systemUiMatch = new RegExp(`(^|,|${whitespace}+)(?:system-ui${whitespace}*)(?:,${whitespace}*(?:${systemUiFamily.join('|')})${whitespace}*)?(,|$)`, 'i');
|
|
26
|
+
|
|
27
|
+
// system-ui fallback replacement
|
|
28
|
+
const systemUiReplace = `$1${systemUiFamily.join(', ')}$2`;
|
|
29
|
+
|
|
30
|
+
return root => {
|
|
31
|
+
// update font declarations to polyfill system-ui usage
|
|
32
|
+
root.walkDecls(fontPropertyMatch, decl => {
|
|
33
|
+
decl.value = decl.value.replace(systemUiMatch, systemUiReplace);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// font and font family property match
|
|
39
|
+
const fontPropertyMatch = /^font(-family)?$/i;
|
package/package.json
CHANGED
|
@@ -1,47 +1,98 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-font-family-system-ui",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"keywords": [
|
|
6
|
-
"css",
|
|
7
|
-
"postcss",
|
|
8
|
-
"postcss-plugin",
|
|
9
|
-
"font-family",
|
|
10
|
-
"system-ui"
|
|
11
|
-
],
|
|
12
|
-
"main": "src/index.js",
|
|
13
|
-
"module": "src/main.mjs",
|
|
14
|
-
"jsnext:main": "src/main.mjs",
|
|
15
|
-
"repository": "https://github.com/JLHwung/postcss-font-family-system-ui.git",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Use the system-ui font family in CSS",
|
|
16
5
|
"author": "Junliang Huang <i@jhuang.me>",
|
|
17
|
-
"
|
|
6
|
+
"contributors": [
|
|
7
|
+
"Junliang Huang <i@jhuang.me>",
|
|
8
|
+
"Jonathan Neal <jonathantneal@hotmail.com>"
|
|
9
|
+
],
|
|
10
|
+
"license": "CC0-1.0",
|
|
11
|
+
"repository": "JLHwung/postcss-font-family-system-ui",
|
|
12
|
+
"homepage": "https://github.com/JLHwung/postcss-font-family-system-ui#readme",
|
|
13
|
+
"bugs": "https://github.com/JLHwung/postcss-font-family-system-ui/issues",
|
|
14
|
+
"main": "index.bundle.js",
|
|
15
|
+
"module": "index.js",
|
|
16
|
+
"files": [
|
|
17
|
+
"index.js",
|
|
18
|
+
"index.bundle.js"
|
|
19
|
+
],
|
|
18
20
|
"scripts": {
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
21
|
+
"prepublishOnly": "npm test",
|
|
22
|
+
"pretest": "rollup -c .rollup.js --silent",
|
|
23
|
+
"test": "echo 'Running tests...'; npm run test:ec && npm run test:spelling && npm run test:js && npm run test:tape",
|
|
24
|
+
"test:ec": "echint --ignore index.bundle.js test",
|
|
25
|
+
"test:js": "eslint *.js --cache --ignore-path .gitignore --quiet",
|
|
26
|
+
"test:spelling": "yaspeller-ci -c package.json --lang en --ignore-uppercase --ignore-roman-numerals --ignore-urls *.md",
|
|
27
|
+
"test:tape": "postcss-tape"
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=4.0.0"
|
|
24
31
|
},
|
|
25
32
|
"dependencies": {
|
|
26
|
-
"
|
|
27
|
-
"postcss": "^6.0.1",
|
|
28
|
-
"postcss-value-parser": "^3.3.0"
|
|
33
|
+
"postcss": "^6.0"
|
|
29
34
|
},
|
|
30
35
|
"devDependencies": {
|
|
31
|
-
"babel-
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
+
"babel-core": "^6.26",
|
|
37
|
+
"babel-eslint": "^8.2",
|
|
38
|
+
"babel-preset-env": "^1.6",
|
|
39
|
+
"echint": "^4.0",
|
|
40
|
+
"eslint": "^4.15",
|
|
41
|
+
"eslint-config-dev": "2.0",
|
|
42
|
+
"postcss-tape": "2.2",
|
|
43
|
+
"pre-commit": "^1.2",
|
|
44
|
+
"rollup": "^0.54",
|
|
45
|
+
"rollup-plugin-babel": "^3.0",
|
|
36
46
|
"yaspeller-ci": "^1.0.0"
|
|
37
47
|
},
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"cjs": true
|
|
48
|
+
"eslintConfig": {
|
|
49
|
+
"extends": "dev",
|
|
50
|
+
"parser": "babel-eslint"
|
|
42
51
|
},
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
52
|
+
"keywords": [
|
|
53
|
+
"postcss",
|
|
54
|
+
"css",
|
|
55
|
+
"postcss-plugin",
|
|
56
|
+
"ua",
|
|
57
|
+
"user",
|
|
58
|
+
"agent",
|
|
59
|
+
"platform",
|
|
60
|
+
"system",
|
|
61
|
+
"ui",
|
|
62
|
+
"default",
|
|
63
|
+
"font",
|
|
64
|
+
"font-family",
|
|
65
|
+
"family",
|
|
66
|
+
"face",
|
|
67
|
+
"type",
|
|
68
|
+
"typeface"
|
|
69
|
+
],
|
|
70
|
+
"dictionary": [
|
|
71
|
+
"Affirmer",
|
|
72
|
+
"babili",
|
|
73
|
+
"babelrc",
|
|
74
|
+
"devDependencies",
|
|
75
|
+
"env",
|
|
76
|
+
"es6",
|
|
77
|
+
"esm",
|
|
78
|
+
"Gulpfile",
|
|
79
|
+
"greenkeeper",
|
|
80
|
+
"Gruntfile",
|
|
81
|
+
"istanbul",
|
|
82
|
+
"js",
|
|
83
|
+
"lockfile",
|
|
84
|
+
"npm",
|
|
85
|
+
"nyc",
|
|
86
|
+
"postcss",
|
|
87
|
+
"PostCSS",
|
|
88
|
+
"polyfill",
|
|
89
|
+
"Refactors",
|
|
90
|
+
"rollup",
|
|
91
|
+
"std",
|
|
92
|
+
"sublicensable",
|
|
93
|
+
"travis",
|
|
94
|
+
"ui",
|
|
95
|
+
"yaspeller",
|
|
96
|
+
"^[A-f0-9]{8}$"
|
|
97
|
+
]
|
|
47
98
|
}
|
package/.npmignore
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# Logs
|
|
2
|
-
logs
|
|
3
|
-
*.log
|
|
4
|
-
npm-debug.log*
|
|
5
|
-
|
|
6
|
-
# Runtime data
|
|
7
|
-
pids
|
|
8
|
-
*.pid
|
|
9
|
-
*.seed
|
|
10
|
-
|
|
11
|
-
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
12
|
-
lib-cov
|
|
13
|
-
|
|
14
|
-
# Coverage directory used by tools like istanbul
|
|
15
|
-
coverage
|
|
16
|
-
|
|
17
|
-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
18
|
-
.grunt
|
|
19
|
-
|
|
20
|
-
# node-waf configuration
|
|
21
|
-
.lock-wscript
|
|
22
|
-
|
|
23
|
-
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
|
24
|
-
build/Release
|
|
25
|
-
|
|
26
|
-
# Dependency directories
|
|
27
|
-
node_modules
|
|
28
|
-
jspm_packages
|
|
29
|
-
|
|
30
|
-
# Optional npm cache directory
|
|
31
|
-
.npm
|
|
32
|
-
|
|
33
|
-
# Optional REPL history
|
|
34
|
-
.node_repl_history
|
|
35
|
-
|
|
36
|
-
# IntelliJ IDEA
|
|
37
|
-
.idea
|
|
38
|
-
|
|
39
|
-
/test/
|
|
40
|
-
|
|
41
|
-
# appveyor config
|
|
42
|
-
/appveyor.yml
|
|
43
|
-
|
|
44
|
-
# yarn lockfile
|
|
45
|
-
yarn.lock
|
|
46
|
-
|
|
47
|
-
# yaspeller dictionary
|
|
48
|
-
.yaspellerrc
|
|
49
|
-
|
|
50
|
-
# babel config
|
|
51
|
-
.babelrc
|
|
52
|
-
|
|
53
|
-
# travis config
|
|
54
|
-
.travis.yml
|
|
55
|
-
|
|
56
|
-
# editor config
|
|
57
|
-
.editorconfig
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2017 Junliang Huang
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/src/index.js
DELETED
package/src/main.mjs
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import postcss from 'postcss'
|
|
2
|
-
import valueParser from 'postcss-value-parser'
|
|
3
|
-
|
|
4
|
-
const fontFamilySystemUIList = [
|
|
5
|
-
'system-ui',
|
|
6
|
-
'-apple-system',
|
|
7
|
-
'BlinkMacSystemFont',
|
|
8
|
-
'Segoe UI',
|
|
9
|
-
'Roboto',
|
|
10
|
-
'Oxygen',
|
|
11
|
-
'Ubuntu',
|
|
12
|
-
'Cantarell',
|
|
13
|
-
'Fira Sans',
|
|
14
|
-
'Droid Sans',
|
|
15
|
-
'Helvetica Neue'
|
|
16
|
-
].join(', ');
|
|
17
|
-
|
|
18
|
-
const transformFontFamilySystemUI = node => {
|
|
19
|
-
if (node.type === 'word' && node.value === 'system-ui') {
|
|
20
|
-
node.value = fontFamilySystemUIList
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const transform = () => (decl) => {
|
|
25
|
-
if (decl.type === 'decl') {
|
|
26
|
-
if (decl.prop === 'font-family' || decl.prop === 'font') {
|
|
27
|
-
const tree = valueParser(decl.value)
|
|
28
|
-
tree.walk(transformFontFamilySystemUI)
|
|
29
|
-
decl.value = tree.toString()
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default postcss.plugin('postcss-font-family-system-ui', () => {
|
|
35
|
-
return (root) => {
|
|
36
|
-
root.walk(transform())
|
|
37
|
-
}
|
|
38
|
-
})
|