postcss-enumerates-in-line 1.3.0 → 1.5.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 +26 -6
- package/README_EN.md +26 -5
- package/index.d.ts +5 -0
- package/index.mjs +8 -1
- package/package.json +1 -1
- package/test/gulp/gulpfile.mjs +1 -0
- package/test/gulp/package-lock.json +14 -24
- package/test/gulp/package.json +3 -3
- package/test/postcss/build-css.mjs +1 -0
- package/test/postcss/package-lock.json +8 -8
- package/test/postcss/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
|[<img width="24" height="24" align="left" src="README.img/1f1ef-1f1f5.png" alt="🇯🇵"> 日本語](README.md)|[<img width="24" height="24" align="left" src="README.img/1f1fa-1f1f8.png" alt="🇺🇸"> English](README_EN.md)|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
## 更新点: v1.
|
|
8
|
+
## 更新点: v1.5.0
|
|
9
9
|
|
|
10
|
-
-
|
|
10
|
+
- ダークモードに対応するクラス名を変更可能にするオプション引数「darkClassName」を追加
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## 概要
|
|
14
14
|
|
|
15
15
|
この[PostCSS]プラグインは、複数のCSSプロパティを1つの行にまとめ上げて記述できるようにします。
|
|
16
16
|
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
&--description {
|
|
29
|
-
@enums fs:0.85em;
|
|
29
|
+
@enums fs:0.85em hover!ct:color[[red,400]];
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
具体的には上のような書式を取ります。(言語は[SCSS])
|
|
35
35
|
|
|
36
|
-
> `@
|
|
36
|
+
> `@enums`で始まるat-rulesの一種であり、`@apply`と記述方法は全く同じです。
|
|
37
37
|
>
|
|
38
38
|
> `my`は`margin-top` & `margin-bottom`の、`ff`は`font-family`の、`fs`は`font-size`のショートハンドです。
|
|
39
39
|
> 何がショートハンドとして定義されているかは[プロパティ名のショートハンド](#プロパティ名のショートハンド)を参照してください。
|
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
## 目次
|
|
70
70
|
|
|
71
71
|
- [PostCSS Enumerates in Line](#postcss-enumerates-in-line)
|
|
72
|
-
- [更新点: v1.
|
|
72
|
+
- [更新点: v1.5.0](#更新点-v150)
|
|
73
|
+
- [概要](#概要)
|
|
73
74
|
- [目次](#目次)
|
|
74
75
|
- [CSSでの記述方法](#cssでの記述方法)
|
|
75
76
|
- [条件付き書式](#条件付き書式)
|
|
@@ -110,6 +111,7 @@
|
|
|
110
111
|
- [appendUserColor](#appendusercolor)
|
|
111
112
|
- [color\[\[...\]\]関数](#color関数)
|
|
112
113
|
- [prependDefaultColorオプション](#prependdefaultcolorオプション)
|
|
114
|
+
- [darkClassName](#darkclassname)
|
|
113
115
|
|
|
114
116
|
<div class="x--hr"></div>
|
|
115
117
|
|
|
@@ -195,6 +197,9 @@ h1[data-state="succeed"][data-target-href^="https://"] {
|
|
|
195
197
|
|
|
196
198
|
条件付き書式`dark!`を使うと、`root:`(html要素)に`dark`クラスが存在するかどうかで判定できるようになります。
|
|
197
199
|
|
|
200
|
+
初期状態でのクラス名は`dark`ですが、オプション引数「darkClassName」で任意の文字列に変更することができます。
|
|
201
|
+
|
|
202
|
+
|
|
198
203
|
```scss
|
|
199
204
|
/* 🚧Before */
|
|
200
205
|
h1 {
|
|
@@ -1256,3 +1261,18 @@ h1 {
|
|
|
1256
1261
|
しかしアルファ値の設定ができなかったり、あるいは大量に出力されるCSS変数のためCSSファイルのサイズが肥大化したりする点はデメリットです。
|
|
1257
1262
|
|
|
1258
1263
|
状況に応じて使い分けてください。
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
### darkClassName
|
|
1267
|
+
|
|
1268
|
+
ダークモードに対応するクラス名の変更。
|
|
1269
|
+
|
|
1270
|
+
初期値: 'dark' (string)
|
|
1271
|
+
|
|
1272
|
+
何も指定しなかった場合は初期値の`dark`が適用されるため、`:root.dark`がダークモード判定としてCSSファイルに出力されます。
|
|
1273
|
+
|
|
1274
|
+
```javascript
|
|
1275
|
+
darkClassName: 'is-dark',
|
|
1276
|
+
```
|
|
1277
|
+
|
|
1278
|
+
上記のように設定変更すると`:root.is-dark`がダークモード判定に使われるようになります。
|
package/README_EN.md
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
|[<img width="24" height="24" align="left" src="README.img/1f1ef-1f1f5.png" alt="🇯🇵"> 日本語](README.md)|[<img width="24" height="24" align="left" src="README.img/1f1fa-1f1f8.png" alt="🇺🇸"> English](README_EN.md)|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
## Revision: in v1.
|
|
8
|
+
## Revision: in v1.5.0
|
|
9
9
|
|
|
10
|
-
- Added
|
|
10
|
+
- Added optional argument `darkClassName` which work changeable a classname corresponding with dark mode.
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## Overview
|
|
14
14
|
|
|
15
15
|
This [PostCSS] plugin extend to multiple CSSes from shrinked it which described in 1 line like `@apply` syntax of [Tailwind CSS].
|
|
16
16
|
|
|
@@ -24,7 +24,7 @@ This [PostCSS] plugin extend to multiple CSSes from shrinked it which described
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
&--description {
|
|
27
|
-
@enums fs:0.85em;
|
|
27
|
+
@enums fs:0.85em hover!ct:color[[red,400]];
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
```
|
|
@@ -68,7 +68,8 @@ I think primary usage is [gulp] and [gulp-postcss]. However it also works on JS-
|
|
|
68
68
|
## Indexes
|
|
69
69
|
|
|
70
70
|
- [PostCSS Enumerates in Line](#postcss-enumerates-in-line)
|
|
71
|
-
- [Revision: in v1.
|
|
71
|
+
- [Revision: in v1.5.0](#revision-in-v150)
|
|
72
|
+
- [Overview](#overview)
|
|
72
73
|
- [Indexes](#indexes)
|
|
73
74
|
- [Method of writing in CSS files.](#method-of-writing-in-css-files)
|
|
74
75
|
- [Conditional CSS property](#conditional-css-property)
|
|
@@ -109,6 +110,7 @@ I think primary usage is [gulp] and [gulp-postcss]. However it also works on JS-
|
|
|
109
110
|
- [appendUserColor](#appendusercolor)
|
|
110
111
|
- [color\[\[...\]\] function](#color-function)
|
|
111
112
|
- [prependDefaultColor option](#prependdefaultcolor-option)
|
|
113
|
+
- [darkClassName](#darkclassname)
|
|
112
114
|
|
|
113
115
|
<div class="x--hr"></div>
|
|
114
116
|
|
|
@@ -195,6 +197,10 @@ h1[data-state="succeed"][data-target-href^="https://"] {
|
|
|
195
197
|
|
|
196
198
|
Using `dark!` case that of conditional syntax, this plugin behave to judge whether does `root:` (html element) have a `dark` class?
|
|
197
199
|
|
|
200
|
+
In the default settings, this package apply a classname `dark` against `:root`.
|
|
201
|
+
However you can designate an arbitrary string to it by optional argument `darkClassName`.
|
|
202
|
+
|
|
203
|
+
|
|
198
204
|
```scss
|
|
199
205
|
/* 🚧Before */
|
|
200
206
|
h1 {
|
|
@@ -1273,3 +1279,18 @@ However, there are disadvantages.
|
|
|
1273
1279
|
- Huge CSS variables for CSS color settings will be outputted in CSS files.It maybe impacts to page loading speed.
|
|
1274
1280
|
|
|
1275
1281
|
Please use them according to wanted situation.
|
|
1282
|
+
|
|
1283
|
+
|
|
1284
|
+
### darkClassName
|
|
1285
|
+
|
|
1286
|
+
Designate to change a classname corresponding with dark mode.
|
|
1287
|
+
|
|
1288
|
+
Default value: 'dark' (string)
|
|
1289
|
+
|
|
1290
|
+
This package output `:root.dark` as dark mode condition into CSS files, when you designate nothing; because it applied a default value `dark`.
|
|
1291
|
+
|
|
1292
|
+
```javascript
|
|
1293
|
+
darkClassName: 'is-dark',
|
|
1294
|
+
```
|
|
1295
|
+
|
|
1296
|
+
However you designate as above (set a value as `is-dark`), it would be changed to `:root.is-dark` as dark mode condition and outputted so.
|
package/index.d.ts
CHANGED
|
@@ -28,6 +28,11 @@ interface EnumsEnumeratesInLineOptions extends object {
|
|
|
28
28
|
* @param {Object{<string>,<string>[]}[]} appendShorthand - Append user shorthand settings to default shorthand.
|
|
29
29
|
*/
|
|
30
30
|
appendShorthand?: []
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {string} darkClassName - Designate a classname for dark mode
|
|
34
|
+
*/
|
|
35
|
+
darkClassName?: '',
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
interface UserColor extends object {
|
package/index.mjs
CHANGED
|
@@ -16,6 +16,7 @@ import postcss from 'postcss'
|
|
|
16
16
|
const pluginName = 'PostCSS Enumerates in Line'
|
|
17
17
|
|
|
18
18
|
const defaultOptions = {
|
|
19
|
+
darkClassName: 'dark',
|
|
19
20
|
prependDefaultColor: false,
|
|
20
21
|
prependDefaultStyle: true,
|
|
21
22
|
appendUserColor: [],
|
|
@@ -27,6 +28,7 @@ let defaultStyle = [
|
|
|
27
28
|
'::placeholder { opacity: 1; }',
|
|
28
29
|
'::spelling-error { text-decoration: none; }',
|
|
29
30
|
':root { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: 16px; font-weight: 400; line-height: 1.5; tab-size: 4; }',
|
|
31
|
+
'@supports (padding: max(0px)) { body { padding: max(0px, env(safe-area-inset-top)) max(0px, env(safe-area-inset-right)) max(0px, env(safe-area-inset-bottom)) max(0px, env(safe-area-inset-left)); } }',
|
|
30
32
|
'q::before, q::after { display: none; }',
|
|
31
33
|
'h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; }',
|
|
32
34
|
'hr { height: 0; border-top-width: 1px; color: inherit; }',
|
|
@@ -126,6 +128,7 @@ export const enumSpreader = (options = {}) => {
|
|
|
126
128
|
prependDefaultStyle,
|
|
127
129
|
appendUserColor,
|
|
128
130
|
appendShorthand,
|
|
131
|
+
darkClassName,
|
|
129
132
|
} = {...defaultOptions, ...options}
|
|
130
133
|
|
|
131
134
|
if(prependDefaultColor === false) {
|
|
@@ -144,6 +147,10 @@ export const enumSpreader = (options = {}) => {
|
|
|
144
147
|
prependDefaultStyle = false
|
|
145
148
|
}
|
|
146
149
|
|
|
150
|
+
if(!darkClassName) {
|
|
151
|
+
darkClassName = 'dark'
|
|
152
|
+
}
|
|
153
|
+
|
|
147
154
|
appendUserColors(appendUserColor)
|
|
148
155
|
appendUserShorthands(appendShorthand)
|
|
149
156
|
|
|
@@ -331,7 +338,7 @@ export const enumSpreader = (options = {}) => {
|
|
|
331
338
|
}
|
|
332
339
|
|
|
333
340
|
for(let j = 0, m = setting.prop.length; j < m; j ++) {
|
|
334
|
-
const css = `${setting.isMq !== '' ? '@media screen and ' + setting.isMq + ' { ' : ''}${setting.isDark ?
|
|
341
|
+
const css = `${setting.isMq !== '' ? '@media screen and ' + setting.isMq + ' { ' : ''}${setting.isDark ? `:root.${darkClassName} ` : ''}${setting.isPHover}${rule.selector}${setting.isData}${setting.isAria}${setting.isAttr}${setting.isHover ? ':hover' : ''}{${setting.prop[j]}: ${setting.value}}${setting.isMq !== '' ? ' }' : ''}`
|
|
335
342
|
rule.after(css)
|
|
336
343
|
}
|
|
337
344
|
} else if(/^([\d\-a-z]+):([^!\s]+)(!)?$/.test(param[i])) {
|
package/package.json
CHANGED
package/test/gulp/gulpfile.mjs
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"autoprefixer": "^10.4.
|
|
12
|
+
"autoprefixer": "^10.4.23",
|
|
13
13
|
"browser-sync": "^3.0.4",
|
|
14
14
|
"gulp": "^5.0.1",
|
|
15
15
|
"gulp-plumber": "^1.2.1",
|
|
16
16
|
"gulp-postcss": "^10.0.0",
|
|
17
17
|
"gulp-sass": "^6.0.1",
|
|
18
18
|
"postcss-csso": "^6.0.1",
|
|
19
|
-
"postcss-enumerates-in-line": "^
|
|
20
|
-
"sass": "^1.
|
|
19
|
+
"postcss-enumerates-in-line": "^1.3.0",
|
|
20
|
+
"sass": "^1.97.2"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"node_modules/@gulpjs/messages": {
|
|
@@ -567,9 +567,9 @@
|
|
|
567
567
|
}
|
|
568
568
|
},
|
|
569
569
|
"node_modules/autoprefixer": {
|
|
570
|
-
"version": "10.4.
|
|
571
|
-
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.
|
|
572
|
-
"integrity": "sha512-
|
|
570
|
+
"version": "10.4.23",
|
|
571
|
+
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.23.tgz",
|
|
572
|
+
"integrity": "sha512-YYTXSFulfwytnjAPlw8QHncHJmlvFKtczb8InXaAx9Q0LbfDnfEYDE55omerIJKihhmU61Ft+cAOSzQVaBUmeA==",
|
|
573
573
|
"funding": [
|
|
574
574
|
{
|
|
575
575
|
"type": "opencollective",
|
|
@@ -586,10 +586,9 @@
|
|
|
586
586
|
],
|
|
587
587
|
"license": "MIT",
|
|
588
588
|
"dependencies": {
|
|
589
|
-
"browserslist": "^4.
|
|
590
|
-
"caniuse-lite": "^1.0.
|
|
589
|
+
"browserslist": "^4.28.1",
|
|
590
|
+
"caniuse-lite": "^1.0.30001760",
|
|
591
591
|
"fraction.js": "^5.3.4",
|
|
592
|
-
"normalize-range": "^0.1.2",
|
|
593
592
|
"picocolors": "^1.1.1",
|
|
594
593
|
"postcss-value-parser": "^4.2.0"
|
|
595
594
|
},
|
|
@@ -2637,15 +2636,6 @@
|
|
|
2637
2636
|
"node": ">=0.10.0"
|
|
2638
2637
|
}
|
|
2639
2638
|
},
|
|
2640
|
-
"node_modules/normalize-range": {
|
|
2641
|
-
"version": "0.1.2",
|
|
2642
|
-
"resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz",
|
|
2643
|
-
"integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==",
|
|
2644
|
-
"license": "MIT",
|
|
2645
|
-
"engines": {
|
|
2646
|
-
"node": ">=0.10.0"
|
|
2647
|
-
}
|
|
2648
|
-
},
|
|
2649
2639
|
"node_modules/now-and-later": {
|
|
2650
2640
|
"version": "3.0.0",
|
|
2651
2641
|
"resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-3.0.0.tgz",
|
|
@@ -2884,9 +2874,9 @@
|
|
|
2884
2874
|
}
|
|
2885
2875
|
},
|
|
2886
2876
|
"node_modules/postcss-enumerates-in-line": {
|
|
2887
|
-
"version": "
|
|
2888
|
-
"resolved": "https://registry.npmjs.org/postcss-enumerates-in-line/-/postcss-enumerates-in-line-
|
|
2889
|
-
"integrity": "sha512-
|
|
2877
|
+
"version": "1.3.0",
|
|
2878
|
+
"resolved": "https://registry.npmjs.org/postcss-enumerates-in-line/-/postcss-enumerates-in-line-1.3.0.tgz",
|
|
2879
|
+
"integrity": "sha512-ryMxBUI/Mg2fxhhEmhokbh/phyovH1fpGdooHLzzJEhVg58nzLjSpsphCNvEIURMM3bCpV7k5GXqJP6KXWU4nA==",
|
|
2890
2880
|
"license": "ISC",
|
|
2891
2881
|
"dependencies": {
|
|
2892
2882
|
"postcss": "^8.5.6"
|
|
@@ -3156,9 +3146,9 @@
|
|
|
3156
3146
|
"license": "MIT"
|
|
3157
3147
|
},
|
|
3158
3148
|
"node_modules/sass": {
|
|
3159
|
-
"version": "1.
|
|
3160
|
-
"resolved": "https://registry.npmjs.org/sass/-/sass-1.
|
|
3161
|
-
"integrity": "sha512-
|
|
3149
|
+
"version": "1.97.2",
|
|
3150
|
+
"resolved": "https://registry.npmjs.org/sass/-/sass-1.97.2.tgz",
|
|
3151
|
+
"integrity": "sha512-y5LWb0IlbO4e97Zr7c3mlpabcbBtS+ieiZ9iwDooShpFKWXf62zz5pEPdwrLYm+Bxn1fnbwFGzHuCLSA9tBmrw==",
|
|
3162
3152
|
"license": "MIT",
|
|
3163
3153
|
"dependencies": {
|
|
3164
3154
|
"chokidar": "^4.0.0",
|
package/test/gulp/package.json
CHANGED
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"license": "ISC",
|
|
14
14
|
"type": "module",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"autoprefixer": "^10.4.
|
|
16
|
+
"autoprefixer": "^10.4.23",
|
|
17
17
|
"browser-sync": "^3.0.4",
|
|
18
18
|
"gulp": "^5.0.1",
|
|
19
19
|
"gulp-plumber": "^1.2.1",
|
|
20
20
|
"gulp-postcss": "^10.0.0",
|
|
21
21
|
"gulp-sass": "^6.0.1",
|
|
22
22
|
"postcss-csso": "^6.0.1",
|
|
23
|
-
"postcss-enumerates-in-line": "^
|
|
24
|
-
"sass": "^1.
|
|
23
|
+
"postcss-enumerates-in-line": "^1.3.0",
|
|
24
|
+
"sass": "^1.97.2"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"npm-run-all2": "^8.0.4",
|
|
15
15
|
"postcss": "^8.5.6",
|
|
16
16
|
"postcss-csso": "^6.0.1",
|
|
17
|
-
"postcss-enumerates-in-line": "^
|
|
18
|
-
"sass": "^1.
|
|
17
|
+
"postcss-enumerates-in-line": "^1.3.0",
|
|
18
|
+
"sass": "^1.97.2"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"node_modules/@isaacs/balanced-match": {
|
|
@@ -903,9 +903,9 @@
|
|
|
903
903
|
}
|
|
904
904
|
},
|
|
905
905
|
"node_modules/postcss-enumerates-in-line": {
|
|
906
|
-
"version": "
|
|
907
|
-
"resolved": "https://registry.npmjs.org/postcss-enumerates-in-line/-/postcss-enumerates-in-line-
|
|
908
|
-
"integrity": "sha512-
|
|
906
|
+
"version": "1.3.0",
|
|
907
|
+
"resolved": "https://registry.npmjs.org/postcss-enumerates-in-line/-/postcss-enumerates-in-line-1.3.0.tgz",
|
|
908
|
+
"integrity": "sha512-ryMxBUI/Mg2fxhhEmhokbh/phyovH1fpGdooHLzzJEhVg58nzLjSpsphCNvEIURMM3bCpV7k5GXqJP6KXWU4nA==",
|
|
909
909
|
"license": "ISC",
|
|
910
910
|
"dependencies": {
|
|
911
911
|
"postcss": "^8.5.6"
|
|
@@ -944,9 +944,9 @@
|
|
|
944
944
|
}
|
|
945
945
|
},
|
|
946
946
|
"node_modules/sass": {
|
|
947
|
-
"version": "1.
|
|
948
|
-
"resolved": "https://registry.npmjs.org/sass/-/sass-1.
|
|
949
|
-
"integrity": "sha512-
|
|
947
|
+
"version": "1.97.2",
|
|
948
|
+
"resolved": "https://registry.npmjs.org/sass/-/sass-1.97.2.tgz",
|
|
949
|
+
"integrity": "sha512-y5LWb0IlbO4e97Zr7c3mlpabcbBtS+ieiZ9iwDooShpFKWXf62zz5pEPdwrLYm+Bxn1fnbwFGzHuCLSA9tBmrw==",
|
|
950
950
|
"license": "MIT",
|
|
951
951
|
"dependencies": {
|
|
952
952
|
"chokidar": "^4.0.0",
|