postcss-enumerates-in-line 0.4.0 → 1.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 CHANGED
@@ -5,27 +5,9 @@
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
- ## 更新点: v0.4.0
8
+ ## 更新点: v1.1.0
9
9
 
10
- 1. 色設定
11
-
12
- - CSSプロパティ値に色設定を行う`color[[...]]`関数を追加
13
- - プラグインのオプションに色テーマを追加する`appendUserColors(...)`を追加
14
- - プラグインオプション`prependDefaultColor`の初期設定を`false`に変更
15
-
16
- 2. ショートハンド設定
17
-
18
- - プラグインのオプションにユーザー定義ショートハンドを拡張する`appendShorthand(...)`を追加
19
-
20
- 3. CSSプロパティ
21
-
22
- - 条件付きCSSプロパティ`attr(<attributes>)!`を追加
23
-
24
-
25
- ## 実装予定
26
-
27
- - サンプルプログラムの更新
28
- - メジャーアップデート
10
+ - `color[[...]]`で引数がなかった場合、`#0000`へ変換するよう処理を変更
29
11
 
30
12
 
31
13
  ---
@@ -86,8 +68,7 @@
86
68
  ## 目次
87
69
 
88
70
  - [PostCSS Enumerates in Line](#postcss-enumerates-in-line)
89
- - [更新点: v0.4.0](#更新点-v040)
90
- - [実装予定](#実装予定)
71
+ - [更新点: v1.1.0](#更新点-v110)
91
72
  - [目次](#目次)
92
73
  - [CSSでの記述方法](#cssでの記述方法)
93
74
  - [条件付き書式](#条件付き書式)
@@ -588,6 +569,8 @@ h1 {
588
569
  >
589
570
  > 未定義の色テーマや濃度レベルを指定した場合、エラーとして扱われ無視されます。
590
571
 
572
+ > また引数が何も指定されず`color[[]]`とだけ指定された場合、エラー処理として`#0000`へと変換します。
573
+
591
574
  この関数を使うことで、透過率が設定できる他、色テーマをプラグインのオプションである`appendUserColors(...)`でユーザー独自の定義を追加できる上に、`prependDefaultColor`を初期値の`false`以外にするとCSS変数として色情報が`:root`ブロックに出力されることでCSSファイルサイズが大きくなるなど、様々なデメリットが解消されるでしょう。
592
575
 
593
576
 
@@ -781,6 +764,8 @@ PostCSS処理の配列の中に、`enumSpreader({})`関数を差し込みます
781
764
 
782
765
  この関数は初期設定のまま利用する場合は空のオブジェクトを指定します。
783
766
 
767
+ > サンプルプログラムではユーザー定義のショートハンドを追加する設定を行っています。
768
+
784
769
  動作を変更したい場合は引数にオプション設定を加えます。
785
770
 
786
771
  設定内容は[オプション引数](#オプション引数)を参照してください。
@@ -895,6 +880,8 @@ PostCSS処理の配列の中に、`enumSpreader({})`関数を差し込みます
895
880
 
896
881
  この関数は初期設定のまま利用する場合は空のオブジェクトを指定します。
897
882
 
883
+ > サンプルプログラムではユーザー定義のショートハンドを追加する設定を行っています。
884
+
898
885
  動作を変更したい場合は引数にオプション設定を加えます。
899
886
 
900
887
  設定内容は[オプション引数](#オプション引数)を参照してください。
@@ -1079,6 +1066,8 @@ h1 {
1079
1066
 
1080
1067
  ただし構文上の制約から、最低1種類は引数として指定してください。
1081
1068
 
1069
+ 引数がなく`color[[]]`と記述してしまった場合、エラー処理として`#0000`へと変換されます。
1070
+
1082
1071
  > 1. 色テーマ名
1083
1072
  >
1084
1073
  > デフォルトカラーまたは`appendUserColor(...)`で登録したもの。
package/README_EN.md CHANGED
@@ -5,28 +5,9 @@
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 v0.4.0
8
+ ## Revision: in v1.1.0
9
9
 
10
- 1. Color settings
11
-
12
- - Added a function `color[[...]]` for value of CSS property which designate a color.
13
- - Added a plugin's option `appendUserColors(...)` for extending user color themes.
14
- - Changed a plugin's option `prependDefaultColor` that default value turn to `false`.
15
-
16
- 2. Shorthand settings
17
-
18
- - Added a plugin's option `appendShorthand(...)` for extending user shorthands which is used about CSS property name.
19
-
20
- 3. CSS property
21
-
22
- - Added conditional CSS property name about below.
23
- + `attr(<attributes>)`
24
-
25
-
26
- ## Maybe add functions
27
-
28
- - Update sample programs.
29
- - Upgrade major version to v1.
10
+ - When `color[[...]]` didn't lead any arguments, this package transform it to `#0000`.
30
11
 
31
12
 
32
13
  ---
@@ -86,8 +67,7 @@ I think primary usage is [gulp] and [gulp-postcss]. However it also works on JS-
86
67
  ## Indexes
87
68
 
88
69
  - [PostCSS Enumerates in Line](#postcss-enumerates-in-line)
89
- - [Revision: in v0.4.0](#revision-in-v040)
90
- - [Maybe add functions](#maybe-add-functions)
70
+ - [Revision: in v1.1.0](#revision-in-v110)
91
71
  - [Indexes](#indexes)
92
72
  - [Method of writing in CSS files.](#method-of-writing-in-css-files)
93
73
  - [Conditional CSS property](#conditional-css-property)
@@ -583,6 +563,8 @@ This function-like syntax takes 4 kind arguments in maximum.
583
563
  > 3. `100%`
584
564
  > 4. `hsl`
585
565
 
566
+ > And also if `color[[...]]` leads no arguments like a `color[[]]`, this package transform it to `#0000` as error handling.
567
+
586
568
  You will eliminate some problems as below if use this function.
587
569
  - Can apply opacity.
588
570
  - And that also apply to user defined color theme which added by `appendUserColors(...)` in package option.
@@ -781,6 +763,8 @@ You will designate a blank object at a function of this package, if want to use
781
763
 
782
764
  Or not want, might add option settings in the object.
783
765
 
766
+ > In sample program, there is a optional setting about appending user defined shorthands.
767
+
784
768
  The detail of settings to know, refer to [Arguments of option settings](#arguments-of-option-settings).
785
769
 
786
770
 
@@ -894,6 +878,8 @@ You will designate a blank object at a function of this package, if want to use
894
878
 
895
879
  Or not want, might add option settings in the object.
896
880
 
881
+ > In sample program, there is a optional setting about appending user defined shorthands.
882
+
897
883
  The detail of settings to know, refer to [Arguments of option settings](#arguments-of-option-settings).
898
884
 
899
885
 
@@ -1080,6 +1066,8 @@ Every kinds are optional arguments, so there are omittable.
1080
1066
 
1081
1067
  But, by and for syntax restriction, you need to designate arguments at least 1 kind and up.
1082
1068
 
1069
+ And also if there are no arguments like a `color[[]]`, this package transform it to `#0000` as error handling.
1070
+
1083
1071
  > 1. Color theme
1084
1072
  >
1085
1073
  > The name of default color theme, or that registered in `appendUserColor(...)` option.
package/index.mjs CHANGED
@@ -482,6 +482,7 @@ const replaceCssPropertyValueWBracket = value => value.replace(/\^/g, ' ')
482
482
  .replace(/\[\[([^}]+)\]\]/g,(_,expr)=>`[[${expr.replace(/([+\*/]|(?<=[0-9a-zA-Z\)])[-%](?=[0-9a-zA-Z\(]))/g,' $1 ')}]]`)
483
483
  .replace('[[', '(')
484
484
  .replace(']]', ')')
485
+ .replace('color()', '#0000')
485
486
  .replace(/ +/g, ' ')
486
487
 
487
488
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "postcss-enumerates-in-line",
3
3
  "type": "module",
4
- "version": "0.4.0",
4
+ "version": "1.1.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/hadukinei/postcss-enumerates-in-line"
@@ -49,6 +49,12 @@ const task_css = done => {
49
49
  enumSpreader({
50
50
  //prependDefaultColor: 'rgb',
51
51
  //prependDefaultStyle: false,
52
+ appendShorthand: [
53
+ ['gtc', ['grid-template-columns']],
54
+ ['fd', ['text-decoration']],
55
+ ['fdc', ['text-decoration-color']],
56
+ ['fdo', ['text-underline-offset']],
57
+ ],
52
58
  }),
53
59
  autoprefixer(),
54
60
  csso(),
@@ -16,7 +16,7 @@
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": "^0.0.9",
19
+ "postcss-enumerates-in-line": "^0.4.0",
20
20
  "sass": "^1.96.0"
21
21
  }
22
22
  },
@@ -2884,9 +2884,9 @@
2884
2884
  }
2885
2885
  },
2886
2886
  "node_modules/postcss-enumerates-in-line": {
2887
- "version": "0.0.9",
2888
- "resolved": "https://registry.npmjs.org/postcss-enumerates-in-line/-/postcss-enumerates-in-line-0.0.9.tgz",
2889
- "integrity": "sha512-cADG6Zp9AWPbDuet6P5zOGyjM9VYIbOTqacy+fcoNjvBzjAtxMF0yYa/KHyXn8A3ErPUXmuSgxPCNlqXwtDHPA==",
2887
+ "version": "0.4.0",
2888
+ "resolved": "https://registry.npmjs.org/postcss-enumerates-in-line/-/postcss-enumerates-in-line-0.4.0.tgz",
2889
+ "integrity": "sha512-wyR1ocUyRkBIfsRxu1e7OZ+bBCGlx5RSSFoz94Iq0KviGpG9+ACCSIFiGS9AfMBdSo0YQQAC2QZdv7QzcCUZmw==",
2890
2890
  "license": "ISC",
2891
2891
  "dependencies": {
2892
2892
  "postcss": "^8.5.6"
@@ -20,7 +20,7 @@
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": "^0.0.9",
23
+ "postcss-enumerates-in-line": "^0.4.0",
24
24
  "sass": "^1.96.0"
25
25
  }
26
26
  }
@@ -35,12 +35,13 @@
35
35
 
36
36
  &--item {
37
37
  &::before {
38
- @enums display:inline content:"\0bb\020" ct:var(--color-base-600);
38
+ @enums display:inline content:"\0bb\020" ct:color[[base,600]];
39
39
  }
40
40
 
41
41
  &--anchor {
42
- @enums text-decoration:var(--color-magenta-300)^underline^dotted^2px text-underline-offset:4px transition:text-decoration-color^0.25s^ease,color^0.25s^ease
43
- hover!ct:var(--color-magenta-500) hover!text-decoration-color:#fff0;
42
+ @enums fd:color[[magenta,300]]^underline^dotted^2px fdo:4px
43
+ transition:text-decoration-color^0.25s^ease,color^0.25s^ease
44
+ hover!ct:color[[magenta,500]] hover!fdc:color[[white,999,0%]];
44
45
  }
45
46
  }
46
47
  }
@@ -60,19 +61,21 @@
60
61
  }
61
62
 
62
63
  .c-projects {
63
- @enums display:grid grid-template-columns:repeat(auto-fit,minmax(260px,1fr)) gap:1rem^1.5rem m8:0.375rem;
64
+ @enums display:grid gtc:repeat(auto-fit,minmax(260px,1fr)) gap:1rem^1.5rem m8:0.375rem;
64
65
 
65
66
  &--item {
66
- @enums display:grid gap:0.5rem px:1rem py:0.5rem bw:1px bc:var(--color-base-400) br:0.75rem transition:transform^0.25s^ease,box-shadow^0.25s^ease,border-color^0.25s^ease,background-color^0.25s^ease
67
- hover!transform:translateY(-0.25rem) hover!box-shadow:0^0.5rem^1rem^#0004 hover!bc:var(--color-magenta-300) hover!cb:var(--color-magenta-50);
67
+ @enums display:grid gap:0.5rem px:1rem py:0.5rem bw:1px bc:color[[base,400]] br:0.75rem
68
+ transition:transform^0.25s^ease,box-shadow^0.25s^ease,border-color^0.25s^ease,background-color^0.25s^ease
69
+ hover!transform:translateY(-0.25rem) hover!box-shadow:0^0.5rem^1rem^color[[black,999,25%]] hover!bc:color[[magenta,300]] hover!cb:color[[magenta,50]];
68
70
 
69
71
  &--description {
70
72
  @enums fs:0.95em;
71
73
  }
72
74
 
73
75
  &--anchor {
74
- @enums text-decoration:var(--color-magenta-300)^underline^dotted^2px text-underline-offset:4px transition:text-decoration-color^0.25s^ease,color^0.25s^ease
75
- hover!ct:var(--color-magenta-500) hover!text-decoration-color:#fff0;
76
+ @enums fd:color[[magenta,300]]^underline^dotted^2px fdo:4px
77
+ transition:text-decoration-color^0.25s^ease,color^0.25s^ease
78
+ hover!ct:color[[magenta,500]] hover!fdc:color[[white,999,0%]];
76
79
  }
77
80
  }
78
81
  }
@@ -84,12 +87,13 @@
84
87
  @enums display:grid gap:1rem;
85
88
 
86
89
  &--input {
87
- @enums px:0.5rem py:0.375rem br:0.5rem cb:var(--color-base-50) ct:var(--color-base-950) fs:1rem;
90
+ @enums px:0.5rem py:0.375rem br:0.5rem cb:color[[base,50]] ct:color[[base,950]] fs:1rem;
88
91
  }
89
92
 
90
93
  &--button {
91
- @enums py:0.5rem br:0.5rem cb:var(--color-magenta-300) ct:var(--color-base-950) fs:1rem cursor:pointer transition:background-color^0.25s^ease,color^0.25s^ease
92
- hover!cb:#fff hover!ct:var(--color-magenta-500);
94
+ @enums py:0.5rem br:0.5rem cb:color[[magenta,300]] ct:color[[base,950]] fs:1rem cursor:pointer
95
+ transition:background-color^0.25s^ease,color^0.25s^ease
96
+ hover!cb:color[[white,999]] hover!ct:color[[magenta,500]];
93
97
  }
94
98
  }
95
99
  }
@@ -40,6 +40,12 @@ const task = async () => {
40
40
  enumSpreader({
41
41
  //prependDefaultColor: 'rgb',
42
42
  //prependDefaultStyle: false,
43
+ appendShorthand: [
44
+ ['gtc', ['grid-template-columns']],
45
+ ['fd', ['text-decoration']],
46
+ ['fdc', ['text-decoration-color']],
47
+ ['fdo', ['text-underline-offset']],
48
+ ],
43
49
  }),
44
50
  autoprefixer(),
45
51
  csso(),
@@ -14,7 +14,7 @@
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": "^0.0.9",
17
+ "postcss-enumerates-in-line": "^0.4.0",
18
18
  "sass": "^1.96.0"
19
19
  }
20
20
  },
@@ -903,9 +903,9 @@
903
903
  }
904
904
  },
905
905
  "node_modules/postcss-enumerates-in-line": {
906
- "version": "0.0.9",
907
- "resolved": "https://registry.npmjs.org/postcss-enumerates-in-line/-/postcss-enumerates-in-line-0.0.9.tgz",
908
- "integrity": "sha512-cADG6Zp9AWPbDuet6P5zOGyjM9VYIbOTqacy+fcoNjvBzjAtxMF0yYa/KHyXn8A3ErPUXmuSgxPCNlqXwtDHPA==",
906
+ "version": "0.4.0",
907
+ "resolved": "https://registry.npmjs.org/postcss-enumerates-in-line/-/postcss-enumerates-in-line-0.4.0.tgz",
908
+ "integrity": "sha512-wyR1ocUyRkBIfsRxu1e7OZ+bBCGlx5RSSFoz94Iq0KviGpG9+ACCSIFiGS9AfMBdSo0YQQAC2QZdv7QzcCUZmw==",
909
909
  "license": "ISC",
910
910
  "dependencies": {
911
911
  "postcss": "^8.5.6"
@@ -21,7 +21,7 @@
21
21
  "npm-run-all2": "^8.0.4",
22
22
  "postcss": "^8.5.6",
23
23
  "postcss-csso": "^6.0.1",
24
- "postcss-enumerates-in-line": "^0.0.9",
24
+ "postcss-enumerates-in-line": "^0.4.0",
25
25
  "sass": "^1.96.0"
26
26
  }
27
27
  }
@@ -35,12 +35,13 @@
35
35
 
36
36
  &--item {
37
37
  &::before {
38
- @enums display:inline content:"\0bb\020" ct:var(--color-base-600);
38
+ @enums display:inline content:"\0bb\020" ct:color[[base,600]];
39
39
  }
40
40
 
41
41
  &--anchor {
42
- @enums text-decoration:var(--color-magenta-300)^underline^dotted^2px text-underline-offset:4px transition:text-decoration-color^0.25s^ease,color^0.25s^ease
43
- hover!ct:var(--color-magenta-500) hover!text-decoration-color:#fff0;
42
+ @enums fd:color[[magenta,300]]^underline^dotted^2px fdo:4px
43
+ transition:text-decoration-color^0.25s^ease,color^0.25s^ease
44
+ hover!ct:color[[magenta,500]] hover!fdc:color[[white,999,0%]];
44
45
  }
45
46
  }
46
47
  }
@@ -60,19 +61,21 @@
60
61
  }
61
62
 
62
63
  .c-projects {
63
- @enums display:grid grid-template-columns:repeat(auto-fit,minmax(260px,1fr)) gap:1rem^1.5rem m8:0.375rem;
64
+ @enums display:grid gtc:repeat(auto-fit,minmax(260px,1fr)) gap:1rem^1.5rem m8:0.375rem;
64
65
 
65
66
  &--item {
66
- @enums display:grid gap:0.5rem px:1rem py:0.5rem bw:1px bc:var(--color-base-400) br:0.75rem transition:transform^0.25s^ease,box-shadow^0.25s^ease,border-color^0.25s^ease,background-color^0.25s^ease
67
- hover!transform:translateY(-0.25rem) hover!box-shadow:0^0.5rem^1rem^#0004 hover!bc:var(--color-magenta-300) hover!cb:var(--color-magenta-50);
67
+ @enums display:grid gap:0.5rem px:1rem py:0.5rem bw:1px bc:color[[base,400]] br:0.75rem
68
+ transition:transform^0.25s^ease,box-shadow^0.25s^ease,border-color^0.25s^ease,background-color^0.25s^ease
69
+ hover!transform:translateY(-0.25rem) hover!box-shadow:0^0.5rem^1rem^color[[black,999,25%]] hover!bc:color[[magenta,300]] hover!cb:color[[magenta,50]];
68
70
 
69
71
  &--description {
70
72
  @enums fs:0.95em;
71
73
  }
72
74
 
73
75
  &--anchor {
74
- @enums text-decoration:var(--color-magenta-300)^underline^dotted^2px text-underline-offset:4px transition:text-decoration-color^0.25s^ease,color^0.25s^ease
75
- hover!ct:var(--color-magenta-500) hover!text-decoration-color:#fff0;
76
+ @enums fd:color[[magenta,300]]^underline^dotted^2px fdo:4px
77
+ transition:text-decoration-color^0.25s^ease,color^0.25s^ease
78
+ hover!ct:color[[magenta,500]] hover!fdc:color[[white,999,0%]];
76
79
  }
77
80
  }
78
81
  }
@@ -84,12 +87,13 @@
84
87
  @enums display:grid gap:1rem;
85
88
 
86
89
  &--input {
87
- @enums px:0.5rem py:0.375rem br:0.5rem cb:var(--color-base-50) ct:var(--color-base-950) fs:1rem;
90
+ @enums px:0.5rem py:0.375rem br:0.5rem cb:color[[base,50]] ct:color[[base,950]] fs:1rem;
88
91
  }
89
92
 
90
93
  &--button {
91
- @enums py:0.5rem br:0.5rem cb:var(--color-magenta-300) ct:var(--color-base-950) fs:1rem cursor:pointer transition:background-color^0.25s^ease,color^0.25s^ease
92
- hover!cb:#fff hover!ct:var(--color-magenta-500);
94
+ @enums py:0.5rem br:0.5rem cb:color[[magenta,300]] ct:color[[base,950]] fs:1rem cursor:pointer
95
+ transition:background-color^0.25s^ease,color^0.25s^ease
96
+ hover!cb:color[[white,999]] hover!ct:color[[magenta,500]];
93
97
  }
94
98
  }
95
99
  }