postcss-enumerates-in-line 1.1.0 → 1.2.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 +21 -7
- package/README_EN.md +20 -6
- package/index.mjs +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,9 +5,20 @@
|
|
|
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.2.0
|
|
9
9
|
|
|
10
|
-
-
|
|
10
|
+
- 以下の引用符に関する正規表現の不具合を修正
|
|
11
|
+
+ `data(name="value")!`
|
|
12
|
+
+ `aria(name="value")!`
|
|
13
|
+
+ `attr(name="value")!`
|
|
14
|
+
|
|
15
|
+
> `data(name='value')!`のように`'`で囲んでいる場合も含みます。
|
|
16
|
+
|
|
17
|
+
- `mq(...)!`の`width`と`height`において、説明の抜けていた設定方法を加筆
|
|
18
|
+
+ `mq(width=-1000px)`: `max-width: 1000px`と同等 ~~(記述済み)~~
|
|
19
|
+
+ `mq(width=1000px-2000px)`: `min-width: 1000px and max-width: 2000px`と同等 ~~(記述済み)~~
|
|
20
|
+
+ `mq(width=1000px-)`: `min-width: 1000px`と同等 ~~(記述済み)~~
|
|
21
|
+
+ `mq(width=1000px)`: `width: 1000px`と同等 **(説明漏れ)**
|
|
11
22
|
|
|
12
23
|
|
|
13
24
|
---
|
|
@@ -68,7 +79,7 @@
|
|
|
68
79
|
## 目次
|
|
69
80
|
|
|
70
81
|
- [PostCSS Enumerates in Line](#postcss-enumerates-in-line)
|
|
71
|
-
- [更新点: v1.
|
|
82
|
+
- [更新点: v1.2.0](#更新点-v120)
|
|
72
83
|
- [目次](#目次)
|
|
73
84
|
- [CSSでの記述方法](#cssでの記述方法)
|
|
74
85
|
- [条件付き書式](#条件付き書式)
|
|
@@ -275,20 +286,22 @@ body {
|
|
|
275
286
|
}
|
|
276
287
|
```
|
|
277
288
|
|
|
278
|
-
> `width`に指定可能な条件値は、`-<length>`・`<length>-<length>`・`<length
|
|
289
|
+
> `width`に指定可能な条件値は、`-<length>`・`<length>-<length>`・`<length>-`・`<length>`の4種類です。
|
|
279
290
|
>
|
|
280
291
|
> `<length>`に指定可能なのは`px`・`rem`・`vw`など長さに関わる値です。
|
|
281
292
|
>
|
|
282
293
|
> + 1つのみある`<length>`の前に`-`を付けた場合、`<length>`以下のメディアクエリを意味します(適用されるメディア特性は`max-width`)
|
|
283
294
|
> + 2つの`<length>`を`-`で接続した場合、その区間以内であるメディアクエリを意味します(適用されるメディア特性は`min-width`と`max-width`)
|
|
284
295
|
> + 1つのみある`<length>`の後ろに`-`を付けた場合、`<length>`以上のメディアクエリを意味します(適用されるメディア特性は`min-width`)
|
|
296
|
+
> + `<length>`が1つのみあって`-`がない場合、ビューポートサイズが`<length>`とまったく等しい状態を意味します(適用されるメディア特性は`width`)
|
|
285
297
|
|
|
286
298
|
```scss
|
|
287
299
|
body {
|
|
288
300
|
@enums
|
|
289
301
|
mq(width:-480px)!m2:1rem
|
|
290
302
|
mq(width:640px-1024px)!mx:1rem
|
|
291
|
-
mq(width:1280px)!m8:1rem
|
|
303
|
+
mq(width:1280px-)!m8:1rem
|
|
304
|
+
mq(width:540px)!m4:1rem
|
|
292
305
|
;
|
|
293
306
|
}
|
|
294
307
|
```
|
|
@@ -302,7 +315,8 @@ body {
|
|
|
302
315
|
@enums
|
|
303
316
|
mq(height:-480px)!m2:1rem
|
|
304
317
|
mq(height:640px-1024px)!mx:1rem
|
|
305
|
-
mq(height:1280px)!m8:1rem
|
|
318
|
+
mq(height:1280px-)!m8:1rem
|
|
319
|
+
mq(height:540px)!m4:1rem
|
|
306
320
|
;
|
|
307
321
|
}
|
|
308
322
|
```
|
|
@@ -311,7 +325,7 @@ body {
|
|
|
311
325
|
>
|
|
312
326
|
> `@media (aspect-ratio: 16/9)`のような除算記号(`/`)を使った表記はできません。
|
|
313
327
|
>
|
|
314
|
-
> `width`・`height`に似た表記が可能で、`-<number>`・`<number>-<number>`・`<number
|
|
328
|
+
> `width`・`height`に似た表記が可能で、`-<number>`・`<number>-<number>`・`<number>-`・`<number>`の4種類が実際に指定可能な条件値です。
|
|
315
329
|
>
|
|
316
330
|
> + 1つのみある`<number>`の前に`-`を付けた場合、`<number>`以下のメディアクエリを意味します(適用されるメディア特性は`max-aspect-ratio`)
|
|
317
331
|
> + 2つの`<number>`を`-`で接続した場合、その区間以内であるメディアクエリを意味します(適用されるメディア特性は`min-aspect-ratio`と`max-aspect-ratio`)
|
package/README_EN.md
CHANGED
|
@@ -5,9 +5,20 @@
|
|
|
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.2.0
|
|
9
9
|
|
|
10
|
-
-
|
|
10
|
+
- fix regex problems of quote character (`'`, `"`) in below.
|
|
11
|
+
+ `data(name="value")!`
|
|
12
|
+
+ `aria(name="value")!`
|
|
13
|
+
+ `attr(name="value")!`
|
|
14
|
+
|
|
15
|
+
> `data(name='value')!` etc. too.
|
|
16
|
+
|
|
17
|
+
- Touch up a documents adding about `width` and `height` in `mq(...)!`.
|
|
18
|
+
+ `mq(width=-1000px)`: As equal as `max-width: 1000px` ~~(Already wrote)~~
|
|
19
|
+
+ `mq(width=1000px-2000px)`: As equal as `min-width: 1000px and max-width: 2000px` ~~(Already wrote)~~
|
|
20
|
+
+ `mq(width=1000px-)`: As equal as `min-width: 1000px` ~~(Already wrote)~~
|
|
21
|
+
+ `mq(width=1000px)`: As equal as `width: 1000px` **(Missing explanation)**
|
|
11
22
|
|
|
12
23
|
|
|
13
24
|
---
|
|
@@ -67,7 +78,7 @@ I think primary usage is [gulp] and [gulp-postcss]. However it also works on JS-
|
|
|
67
78
|
## Indexes
|
|
68
79
|
|
|
69
80
|
- [PostCSS Enumerates in Line](#postcss-enumerates-in-line)
|
|
70
|
-
- [Revision: in v1.
|
|
81
|
+
- [Revision: in v1.2.0](#revision-in-v120)
|
|
71
82
|
- [Indexes](#indexes)
|
|
72
83
|
- [Method of writing in CSS files.](#method-of-writing-in-css-files)
|
|
73
84
|
- [Conditional CSS property](#conditional-css-property)
|
|
@@ -275,20 +286,22 @@ body {
|
|
|
275
286
|
}
|
|
276
287
|
```
|
|
277
288
|
|
|
278
|
-
> In `width` case; there are
|
|
289
|
+
> In `width` case; there are 4 type of designatable value. `-<length>`, `<length>-<length>`, `<length>-`, and `<length>`.
|
|
279
290
|
>
|
|
280
291
|
> You will be able to designate to `<length>` as these numeric values, that is related to length which tied with CSS sizing units; `px`, `rem`, `vw`, etc.
|
|
281
292
|
>
|
|
282
293
|
> + In `-<length>` case (the syntax is `<length>` with `-` prefix) -- this plugin recognize it as "This media query is smaller than `<length>`". (Applied media feature is `max-width`.)
|
|
283
294
|
> + In `<length>-<length>` case (the syntax is `-` sandwiching by 2 `<length>`) -- this plugin recognize it as "This media query still is range of between first `<length>` and second `<length>`". (Applied media feature are `min-width` and `max-width`.)
|
|
284
295
|
> + In `<length>-` case (the syntax is `<length>` with `-` postfix) -- this plugin recognize it as "This media query is larger than `<length>`". (Applied media feature is `min-width`.)
|
|
296
|
+
> + In `<length>` case (the syntax only is `<length>` and without any `-`) -- this plugin recognize it as "This viewport size is as just equal as `<length>`". (Applied media feature is `width`.)
|
|
285
297
|
|
|
286
298
|
```scss
|
|
287
299
|
body {
|
|
288
300
|
@enums
|
|
289
301
|
mq(width:-480px)!m2:1rem
|
|
290
302
|
mq(width:640px-1024px)!mx:1rem
|
|
291
|
-
mq(width:1280px)!m8:1rem
|
|
303
|
+
mq(width:1280px-)!m8:1rem
|
|
304
|
+
mq(width:540px)!m4:1rem
|
|
292
305
|
;
|
|
293
306
|
}
|
|
294
307
|
```
|
|
@@ -302,7 +315,8 @@ body {
|
|
|
302
315
|
@enums
|
|
303
316
|
mq(height:-480px)!m2:1rem
|
|
304
317
|
mq(height:640px-1024px)!mx:1rem
|
|
305
|
-
mq(height:1280px)!m8:1rem
|
|
318
|
+
mq(height:1280px-)!m8:1rem
|
|
319
|
+
mq(height:540px)!m4:1rem
|
|
306
320
|
;
|
|
307
321
|
}
|
|
308
322
|
```
|
package/index.mjs
CHANGED
|
@@ -271,9 +271,9 @@ export const enumSpreader = (options = {}) => {
|
|
|
271
271
|
if(/data\(.+?\)!/.test(param[i])) {
|
|
272
272
|
setting.isData = []
|
|
273
273
|
;(!!param[i].match(/data\((.+?)\)!/)[1] ? param[i].match(/data\((.+?)\)!/)[1] : '').split(',').forEach(q => {
|
|
274
|
-
let v1 = q.match(/^([A-Za-z\d_](?:[A-Za-z\d_\-]*[A-Za-z\d_])?)([\~\|\^\$\*]?=)[
|
|
274
|
+
let v1 = q.match(/^([A-Za-z\d_](?:[A-Za-z\d_\-]*[A-Za-z\d_])?)([\~\|\^\$\*]?=)(?:(?=["])["](.*)["]|(?=['])['](.*)['])$/)
|
|
275
275
|
if(!!v1) {
|
|
276
|
-
setting.isData.push(`[data-${v1[1]}${v1[2]}"${v1[3].replace('\%','%25').replace('\"','%22').replace('\'','%27').replace('\`','%60').replace('\\','%5D')}"]`)
|
|
276
|
+
setting.isData.push(`[data-${v1[1]}${v1[2]}"${(v1[3]||v1[4]).replace('\%','%25').replace('\"','%22').replace('\'','%27').replace('\`','%60').replace('\\','%5D')}"]`)
|
|
277
277
|
} else {
|
|
278
278
|
let v2 = q.match(/^([A-Za-z\d_](?:[A-Za-z\d_\-]*[A-Za-z\d_])?)$/)
|
|
279
279
|
if(!!v2) {
|
|
@@ -288,9 +288,9 @@ export const enumSpreader = (options = {}) => {
|
|
|
288
288
|
if(/aria\(.+?\)!/.test(param[i])) {
|
|
289
289
|
setting.isAria = []
|
|
290
290
|
;(!!param[i].match(/aria\((.+?)\)!/)[1] ? param[i].match(/aria\((.+?)\)!/)[1] : '').split(',').forEach(q => {
|
|
291
|
-
let v = q.match(/^([a-z]+)=[
|
|
291
|
+
let v = q.match(/^([a-z]+)=(?:(?=["])["](.*)["]|(?=['])['](.*)['])$/)
|
|
292
292
|
if(!!v) {
|
|
293
|
-
setting.isAria.push(`[aria-${v[1]}="${v[2].replace('\%','%25').replace('\"','%22').replace('\'','%27').replace('\`','%60').replace('\\','%5D')}"]`)
|
|
293
|
+
setting.isAria.push(`[aria-${v[1]}="${(v[2]||v[3]).replace('\%','%25').replace('\"','%22').replace('\'','%27').replace('\`','%60').replace('\\','%5D')}"]`)
|
|
294
294
|
}
|
|
295
295
|
})
|
|
296
296
|
setting.isAria = setting.isAria.join('')
|
|
@@ -300,9 +300,9 @@ export const enumSpreader = (options = {}) => {
|
|
|
300
300
|
if(/attr\(.+?\)!/.test(param[i])) {
|
|
301
301
|
setting.isAttr = []
|
|
302
302
|
;(!!param[i].match(/attr\((.+?)\)!/)[1] ? param[i].match(/attr\((.+?)\)!/)[1] : '').split(',').forEach(q => {
|
|
303
|
-
let v1 = q.match(/^([A-Za-z\d_](?:[A-Za-z\d_\-]*[A-Za-z\d_])?)([\~\|\^\$\*]?=)[
|
|
303
|
+
let v1 = q.match(/^([A-Za-z\d_](?:[A-Za-z\d_\-]*[A-Za-z\d_])?)([\~\|\^\$\*]?=)(?:(?=["])["](.*)["]|(?=['])['](.*)['])$/)
|
|
304
304
|
if(!!v1) {
|
|
305
|
-
setting.isAttr.push(`[${v1[1]}${v1[2]}"${v1[3].replace('\%','%25').replace('\"','%22').replace('\'','%27').replace('\`','%60').replace('\\','%5D')}"]`)
|
|
305
|
+
setting.isAttr.push(`[${v1[1]}${v1[2]}"${(v1[3]||v1[4]).replace('\%','%25').replace('\"','%22').replace('\'','%27').replace('\`','%60').replace('\\','%5D')}"]`)
|
|
306
306
|
} else {
|
|
307
307
|
let v2 = q.match(/^([A-Za-z\d_](?:[A-Za-z\d_\-]*[A-Za-z\d_])?)$/)
|
|
308
308
|
if(!!v2) {
|