winduum 0.1.18 → 0.2.0-beta.10

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.
Files changed (103) hide show
  1. package/dist/main-rgb.css +1 -0
  2. package/dist/main.css +5 -1
  3. package/dist/tailwind.css +5 -1
  4. package/package.json +25 -21
  5. package/src/base/config.css +0 -10
  6. package/src/base/default.css +23 -10
  7. package/src/base/icons.css +0 -3
  8. package/src/base/index.css +2 -0
  9. package/src/base/keyframes.css +0 -118
  10. package/src/base/reset.css +24 -17
  11. package/src/base/tailwind/utilities.css +3 -3
  12. package/src/base/theme/dark-rgb.css +4 -0
  13. package/src/base/theme/dark.css +7 -7
  14. package/src/base/theme/default-rgb.css +13 -0
  15. package/src/base/theme/default.css +22 -14
  16. package/src/components/dialog.css +2 -2
  17. package/src/components/field.css +3 -3
  18. package/src/libraries/dialog-rgb.css +3 -0
  19. package/src/libraries/dialog.css +2 -2
  20. package/src/libraries/dialog.js +7 -9
  21. package/src/libraries/ripple-rgb.css +3 -0
  22. package/src/libraries/ripple.css +2 -2
  23. package/src/libraries/ripple.js +1 -3
  24. package/src/main-rgb.css +11 -0
  25. package/src/main.css +1 -1
  26. package/src/main.js +1 -0
  27. package/src/ui/badge/bordered-rgb.css +3 -0
  28. package/src/ui/badge/bordered.css +8 -0
  29. package/src/ui/badge/circle.css +5 -0
  30. package/src/ui/badge/default-rgb.css +9 -0
  31. package/src/ui/badge/default.css +40 -0
  32. package/src/ui/badge/index.css +7 -0
  33. package/src/ui/badge/lg.css +3 -0
  34. package/src/ui/badge/muted.css +3 -0
  35. package/src/ui/badge/sm.css +4 -0
  36. package/src/ui/badge/square.css +4 -0
  37. package/src/ui/badge.css +1 -109
  38. package/src/ui/btn/bordered-rgb.css +3 -0
  39. package/src/ui/btn/bordered.css +8 -0
  40. package/src/ui/btn/circle.css +5 -0
  41. package/src/ui/btn/default-rgb.css +9 -0
  42. package/src/ui/btn/default.css +107 -0
  43. package/src/ui/btn/gradient-bordered-rgb.css +13 -0
  44. package/src/ui/btn/gradient-bordered.css +28 -0
  45. package/src/ui/btn/gradient.css +10 -0
  46. package/src/ui/btn/hover-fill.css +8 -0
  47. package/src/ui/btn/index.css +13 -0
  48. package/src/ui/btn/lg.css +4 -0
  49. package/src/ui/btn/loading.css +27 -0
  50. package/src/ui/btn/muted.css +4 -0
  51. package/src/ui/btn/raised.css +8 -0
  52. package/src/ui/btn/sm.css +4 -0
  53. package/src/ui/btn/square.css +4 -0
  54. package/src/ui/btn/wide.css +4 -0
  55. package/src/ui/btn.css +1 -234
  56. package/src/ui/check-rgb.css +31 -0
  57. package/src/ui/check.css +130 -0
  58. package/src/ui/control/default-rgb.css +24 -0
  59. package/src/ui/control/default.css +94 -0
  60. package/src/ui/control/floating-focus.css +8 -0
  61. package/src/ui/control/floating.css +31 -0
  62. package/src/ui/control/icon.css +66 -0
  63. package/src/ui/control/index.css +5 -0
  64. package/src/ui/control/select.css +28 -0
  65. package/src/ui/control.css +1 -0
  66. package/src/ui/group.css +34 -0
  67. package/src/ui/heading/default.css +12 -0
  68. package/src/ui/heading/index.css +3 -0
  69. package/src/ui/heading/lg.css +3 -0
  70. package/src/ui/heading/sm.css +4 -0
  71. package/src/ui/heading.css +1 -21
  72. package/src/ui/image.css +4 -4
  73. package/src/ui/{+.css → index.css} +4 -5
  74. package/src/ui/info.css +1 -1
  75. package/src/ui/label.css +1 -1
  76. package/src/ui/link/default.css +36 -0
  77. package/src/ui/link/index.css +2 -0
  78. package/src/ui/link/underlined.css +50 -0
  79. package/src/ui/link.css +1 -45
  80. package/src/ui/notice-rgb.css +6 -0
  81. package/src/ui/notice.css +9 -22
  82. package/src/ui/progress/default-rgb.css +3 -0
  83. package/src/ui/progress/default.css +39 -0
  84. package/src/ui/progress/index.css +3 -0
  85. package/src/ui/progress/lg.css +3 -0
  86. package/src/ui/progress/sm.css +3 -0
  87. package/src/ui/progress.css +1 -50
  88. package/src/ui/switch-rgb.css +11 -0
  89. package/src/ui/switch.css +23 -28
  90. package/src/ui/text-rgb.css +13 -0
  91. package/src/ui/text.css +15 -15
  92. package/src/ui/title/default.css +12 -0
  93. package/src/ui/title/index.css +3 -0
  94. package/src/ui/title/lg.css +3 -0
  95. package/src/ui/title/sm.css +3 -0
  96. package/src/ui/title.css +1 -20
  97. package/tailwind.config.cjs +1 -1
  98. package/utils/tailwind.cjs +54 -28
  99. package/utils/tailwind.js +48 -24
  100. package/src/ui/checkbox.css +0 -106
  101. package/src/ui/input.css +0 -226
  102. package/src/ui/radio.css +0 -4
  103. package/src/ui/select.css +0 -27
package/src/ui/notice.css CHANGED
@@ -1,11 +1,13 @@
1
- :where(.ui-notice) {
1
+ .ui-notice {
2
2
  --color-current: var(--color-accent);
3
- --ui-notice-bg: rgb(var(--color-accent));
3
+ --ui-notice-bg: var(--color-accent);
4
4
  --ui-notice-py: 1.25rem;
5
5
  --ui-notice-px: 1.5rem;
6
6
  --ui-notice-font-size: 0.875rem;
7
7
  --ui-notice-border-radius: var(--rounded);
8
- --ui-notice-outline-opacity: 0.1;
8
+ --ui-notice-outline-width: 1px;
9
+ --ui-notice-outline-offset: calc(var(--ui-notice-outline-width) * -1);
10
+ --ui-notice-outline-opacity: 10%;
9
11
  --ui-notice-gap: 1.25rem;
10
12
 
11
13
  position: relative;
@@ -14,28 +16,13 @@
14
16
  padding: var(--ui-notice-py) var(--ui-notice-px);
15
17
  font-size: var(--ui-notice-font-size);
16
18
  border-radius: var(--ui-notice-border-radius);
17
- color: rgb(var(--color-current));
19
+ background-color: color-mix(in sRGB, var(--ui-notice-bg) 10%, transparent);
20
+ outline: var(--ui-notice-outline-width) solid color-mix(in sRGB, var(--ui-notice-bg) var(--ui-notice-outline-opacity), transparent);
21
+ outline-offset: var(--ui-notice-outline-offset);
22
+ color: var(--color-current);
18
23
  gap: var(--ui-notice-gap);
19
24
 
20
25
  & :where(hr) {
21
26
  --tw-border-opacity: 0.2;
22
27
  }
23
-
24
- &::before, &::after {
25
- position: absolute;
26
- inset: 0;
27
- border-radius: var(--ui-notice-border-radius);
28
- z-index: -1;
29
- content: "";
30
- }
31
-
32
- &::before {
33
- background-color: var(--ui-notice-bg);
34
- opacity: var(--ui-notice-outline-opacity);
35
- }
36
-
37
- &::after {
38
- box-shadow: inset 0 0 0 1px var(--ui-notice-bg);
39
- opacity: var(--ui-notice-outline-opacity);
40
- }
41
28
  }
@@ -0,0 +1,3 @@
1
+ .ui-progress {
2
+ --ui-progress-bg: rgb(var(--color-accent-rgb) / var(--ui-progress-bg-opacity));
3
+ }
@@ -0,0 +1,39 @@
1
+ .ui-progress {
2
+ --ui-progress-height: 1rem;
3
+ --ui-progress-border-radius: var(--rounded-full);
4
+ --ui-progress-bg: color-mix(in sRGB, var(--color-accent) var(--ui-progress-bg-opacity), var(--color-body));
5
+ --ui-progress-bg-opacity: 10%;
6
+
7
+ appearance: none;
8
+ height: var(--ui-progress-height);
9
+ border-radius: var(--ui-progress-border-radius);
10
+ background-color: var(--ui-progress-bg);
11
+ width: 100%;
12
+
13
+ &::-webkit-progress-bar {
14
+ background-color: transparent;
15
+ }
16
+
17
+ &::-webkit-progress-value {
18
+ background-color: var(--color-accent);
19
+ border-radius: var(--ui-progress-border-radius);
20
+ }
21
+
22
+ &::-moz-progress-bar {
23
+ background-color: var(--color-accent);
24
+ border-radius: var(--ui-progress-border-radius);
25
+ }
26
+
27
+ &:indeterminate {
28
+ animation: 1.5s linear 0s forwards infinite move-indeterminate;
29
+ background-image: linear-gradient(to right, var(--color-accent) 30%, var(--ui-progress-bg) 30%);
30
+ background-position: top left;
31
+ background-repeat: no-repeat;
32
+ background-size: 150% 150%;
33
+ border-radius: var(--ui-progress-border-radius);
34
+
35
+ &::-moz-progress-bar {
36
+ background-color: transparent;
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,3 @@
1
+ @import "default.css";
2
+ @import "sm.css";
3
+ @import "lg.css";
@@ -0,0 +1,3 @@
1
+ .ui-progress:where(.lg) {
2
+ --ui-progress-height: 1.5rem;
3
+ }
@@ -0,0 +1,3 @@
1
+ .ui-progress:where(.sm) {
2
+ --ui-progress-height: 0.5rem;
3
+ }
@@ -1,50 +1 @@
1
- :where(.ui-progress) {
2
- --ui-progress-height: 1rem;
3
- --ui-progress-border-radius: var(--rounded-full);
4
- --ui-progress-bg: var(--color-background-200);
5
- --ui-progress-bg-opacity: 1;
6
-
7
- appearance: none;
8
- box-shadow: none;
9
- border: 0;
10
- height: var(--ui-progress-height);
11
- border-radius: var(--ui-progress-border-radius);
12
- background-color: rgb(var(--ui-progress-bg) / var(--ui-progress-bg-opacity));
13
- color: rgb(var(--color-accent));
14
- width: 100%;
15
-
16
- &:where(.is-sm) {
17
- --ui-progress-height: 0.5rem;
18
- }
19
-
20
- &:where(.is-lg) {
21
- --ui-progress-height: 1.5rem;
22
- }
23
-
24
- &::-webkit-progress-bar {
25
- background-color: transparent;
26
- }
27
-
28
- &::-webkit-progress-value {
29
- background-color: currentColor;
30
- border-radius: var(--ui-progress-border-radius);
31
- }
32
-
33
- &::-moz-progress-bar {
34
- background-color: currentColor;
35
- border-radius: var(--ui-progress-border-radius);
36
- }
37
-
38
- &:indeterminate {
39
- animation: 1.5s linear 0s forwards infinite move-indeterminate;
40
- background-image: linear-gradient(to right, currentColor 30%, rgb(var(--ui-progress-bg) / var(--ui-progress-bg-opacity)) 30%);
41
- background-position: top left;
42
- background-repeat: no-repeat;
43
- background-size: 150% 150%;
44
- border-radius: var(--ui-progress-border-radius);
45
-
46
- &::-moz-progress-bar {
47
- background-color: transparent;
48
- }
49
- }
50
- }
1
+ @import "progress/index.css";
@@ -0,0 +1,11 @@
1
+ .ui-switch {
2
+ & :where(input) {
3
+ &:focus {
4
+ outline-color: rgb(var(--color-current-rgb) / var(--ui-switch-outline-opacity));
5
+ }
6
+
7
+ &:checked {
8
+ --color-current-rgb: var(--color-accent-rgb);
9
+ }
10
+ }
11
+ }
package/src/ui/switch.css CHANGED
@@ -1,15 +1,15 @@
1
- :where(.ui-switch) {
1
+ .ui-switch {
2
2
  --ui-switch-width: 3rem;
3
3
  --ui-switch-height: 1.5rem;
4
4
  --ui-switch-padding: 0.375rem;
5
- --ui-switch-bg-raw: var(--color-dark);
6
- --ui-switch-radius: 999px;
7
- --ui-switch-validity-font-size: 0.875rem;
8
- --ui-switch-validity-offset: 0.375rem;
9
- --ui-switch-box-shadow: none;
5
+ --ui-switch-bg: var(--color-dark);
6
+ --ui-switch-radius: var(--rounded-full);
7
+ --ui-switch-outline-width: 3px;
8
+ --ui-switch-outline-offset: 0;
9
+ --ui-switch-outline-opacity: 20%;
10
10
 
11
- .dark & {
12
- --ui-switch-bg-raw: var(--color-background-300);
11
+ :where(.dark) & {
12
+ --ui-switch-bg: var(--color-body-tertiary);
13
13
  }
14
14
 
15
15
  display: flex;
@@ -17,12 +17,12 @@
17
17
  flex-wrap: wrap;
18
18
  width: max-content;
19
19
 
20
- &:where(.is-sm) {
20
+ &:where(.sm) {
21
21
  --ui-switch-width: 2.5rem;
22
22
  --ui-switch-height: 1.25rem;
23
23
  }
24
24
 
25
- &:where(.is-lg) {
25
+ &:where(.lg) {
26
26
  --ui-switch-width: 4rem;
27
27
  --ui-switch-height: 2rem;
28
28
  }
@@ -33,18 +33,21 @@
33
33
  display: block;
34
34
  position: relative;
35
35
  border-radius: var(--ui-switch-radius);
36
- background-color: rgb(var(--ui-switch-bg-raw));
37
- transition: var(--transition-background), var(--transition-shadow);
36
+ background-color: var(--ui-switch-bg);
37
+ transition:
38
+ var(--transition-background),
39
+ outline-color var(--transition-duration),
40
+ outline-offset var(--transition-duration);
38
41
  cursor: pointer;
39
42
  appearance: none;
40
- outline: none;
43
+ outline: var(--ui-switch-outline-width) solid transparent;
44
+ outline-offset: 0;
41
45
  color: inherit;
42
- box-shadow: var(--ui-switch-box-shadow);
43
46
 
44
47
  &::before {
45
48
  width: calc(var(--ui-switch-height) - var(--ui-switch-padding));
46
49
  height: calc(var(--ui-switch-height) - var(--ui-switch-padding));
47
- background-color: rgb(var(--color-light));
50
+ background-color: var(--color-light);
48
51
  border-radius: var(--ui-switch-radius);
49
52
  position: absolute;
50
53
  left: var(--ui-switch-height);
@@ -62,24 +65,16 @@
62
65
  }
63
66
 
64
67
  &:focus {
65
- --ui-switch-box-shadow:
66
- 0 0 0 0 rgb(var(--color-current)),
67
- 0 0 0 3px rgb(var(--color-current) / 0.2),
68
- 0 1px 2px 0 rgb(var(--color-current) / 0.05);
68
+ outline-color: color-mix(in sRGB, var(--color-current) var(--ui-switch-outline-opacity), transparent);
69
+ outline-offset: var(--ui-switch-outline-offset);
69
70
  }
70
71
 
71
72
  &:checked {
72
- background-color: rgb(var(--color-accent));
73
-
74
- &:focus {
75
- --ui-switch-box-shadow:
76
- 0 0 0 0 rgb(var(--color-current)),
77
- 0 0 0 3px rgb(var(--color-accent) / 0.2),
78
- 0 1px 2px 0 rgb(var(--color-current) / 0.05);
79
- }
73
+ --color-current: var(--color-accent);
74
+ --ui-switch-bg: var(--color-accent);
80
75
 
81
76
  &::before {
82
- background-color: rgb(var(--color-light));
77
+ background-color: var(--color-light);
83
78
  left: 100%;
84
79
  }
85
80
  }
@@ -0,0 +1,13 @@
1
+ .ui-text {
2
+ & :where(table) {
3
+ & :where(thead) {
4
+ border-bottom: 1px solid rgb(var(--color-current-rgb) / 7.5%);
5
+ }
6
+
7
+ & :where(tbody tr) {
8
+ &:nth-of-type(even) {
9
+ background-color: rgb(var(--color-current-rgb) / 5%);
10
+ }
11
+ }
12
+ }
13
+ }
package/src/ui/text.css CHANGED
@@ -1,4 +1,4 @@
1
- :where(.ui-text) {
1
+ .ui-text {
2
2
  --ui-text-size: 0.875rem;
3
3
  --ui-text-size-line: 0.75rem;
4
4
  --ui-text-weight: var(--font-normal);
@@ -11,23 +11,23 @@
11
11
  font-size: var(--ui-text-size);
12
12
  line-height: calc(var(--ui-text-size) + var(--ui-text-size-line));
13
13
 
14
- &:where(.is-lg) {
14
+ &:where(.lg) {
15
15
  --ui-text-size: 1.125rem;
16
16
  }
17
17
 
18
18
  & :where(a) {
19
19
  text-decoration: underline;
20
20
  transition: var(--transition-color);
21
- color: rgb(var(--color-accent));
21
+ color: var(--color-accent);
22
22
 
23
23
  &:hover {
24
24
  @media (hover: hover) and (pointer: fine) {
25
- color: rgb(var(--color-accent) / 0.7);
25
+ color: color-mix(in sRGB, var(--color-accent) 70%, transparent);
26
26
  }
27
27
  }
28
28
 
29
29
  &:focus-visible {
30
- color: rgb(var(--color-accent) / 0.7);
30
+ color: color-mix(in sRGB, var(--color-accent) 70%, transparent);
31
31
  }
32
32
  }
33
33
 
@@ -117,12 +117,12 @@
117
117
 
118
118
  & :where(thead) {
119
119
  font-weight: var(--ui-text-weight-bold);
120
- border-bottom: 1px solid rgb(var(--color-current) / 0.075);
120
+ border-bottom: 1px solid color-mix(in sRGB, var(--color-current) 7.5%, transparent);
121
121
  }
122
122
 
123
123
  & :where(tbody tr) {
124
124
  &:nth-of-type(even) {
125
- background-color: rgb(var(--color-current) / 0.05);
125
+ background-color: color-mix(in sRGB, var(--color-current) 5%, transparent);
126
126
  }
127
127
  }
128
128
  }
@@ -137,7 +137,7 @@
137
137
  }
138
138
 
139
139
  & :where(blockquote) {
140
- border-left: 0.3125rem solid rgb(var(--color-accent) / 1);
140
+ border-left: 0.3125rem solid var(--color-accent);
141
141
  padding: 0.5rem 1.25rem;
142
142
  margin: 1rem 0;
143
143
  font-size: inherit;
@@ -148,12 +148,12 @@
148
148
  border-radius: var(--rounded-xs);
149
149
  padding: 0.25rem 0.375rem;
150
150
  font-size: 0.85em;
151
- color: rgb(var(--color-accent));
151
+ color: var(--color-accent);
152
152
  font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
153
- background-color: rgb(27 31 35 / 0.05);
153
+ background-color: rgb(27 31 35 / 5%);
154
154
 
155
- .dark & {
156
- background-color: rgb(var(--color-background-200));
155
+ :where(.dark) & {
156
+ background-color: var(--color-body-secondary);
157
157
  }
158
158
  }
159
159
 
@@ -173,7 +173,7 @@
173
173
  }
174
174
 
175
175
  &::marker {
176
- color: rgb(var(--color-accent));
176
+ color: var(--color-accent);
177
177
  font-weight: var(--ui-text-weight-bold);
178
178
  }
179
179
  }
@@ -198,8 +198,8 @@
198
198
  height: 0.375rem;
199
199
  position: absolute;
200
200
  content: "";
201
- border: 1px solid rgb(var(--color-accent));
202
- background-color: rgb(var(--color-accent));
201
+ border: 1px solid var(--color-accent);
202
+ background-color: var(--color-accent);
203
203
  left: 0;
204
204
  top: 0.6875rem;
205
205
  text-indent: 0;
@@ -0,0 +1,12 @@
1
+ .ui-title {
2
+ --ui-title-font-family: var(--font-secondary);
3
+ --ui-title-font-weight: var(--font-semibold);
4
+ --ui-title-font-size: 0.875rem;
5
+ --ui-title-line-height: calc(var(--ui-heading-font-size) + var(--ui-heading-line-height-ratio));
6
+ --ui-title-line-height-ratio: 0.375rem;
7
+
8
+ font-family: var(--ui-title-font-family);
9
+ font-size: var(--ui-title-font-size);
10
+ line-height: var(--ui-title-line-height);
11
+ font-weight: var(--ui-title-font-weight);
12
+ }
@@ -0,0 +1,3 @@
1
+ @import "default.css";
2
+ @import "sm.css";
3
+ @import "lg.css";
@@ -0,0 +1,3 @@
1
+ .ui-title:where(.lg) {
2
+ --ui-title-font-size: 1.125rem;
3
+ }
@@ -0,0 +1,3 @@
1
+ .ui-title:where(.sm) {
2
+ --ui-title-font-size: 0.75rem;
3
+ }
package/src/ui/title.css CHANGED
@@ -1,20 +1 @@
1
- :where(.ui-title) {
2
- --ui-title-font-family: var(--font-secondary);
3
- --ui-title-font-weight: var(--font-semibold);
4
- --ui-title-font-size: 0.875rem;
5
- --ui-title-line-height: calc(var(--ui-heading-font-size) + var(--ui-heading-line-height-ratio));
6
- --ui-title-line-height-ratio: 0.375rem;
7
-
8
- font-family: var(--ui-title-font-family);
9
- font-size: var(--ui-title-font-size);
10
- line-height: var(--ui-title-line-height);
11
- font-weight: var(--ui-title-font-weight);
12
-
13
- &:where(.is-sm) {
14
- --ui-title-font-size: 0.75rem;
15
- }
16
-
17
- &:where(.is-lg) {
18
- --ui-title-font-size: 1.125rem;
19
- }
20
- }
1
+ @import "title/index.css";
@@ -5,6 +5,6 @@ module.exports = {
5
5
  './playground/**/*.{js,html,vue}'
6
6
  ],
7
7
  plugins: [
8
- require('winduum')()
8
+ require('./utils/tailwind.cjs')()
9
9
  ],
10
10
  }
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
3
4
 
4
5
  var plugin = require('tailwindcss/plugin');
5
6
  var twColors = require('tailwindcss/colors');
@@ -7,30 +8,32 @@ var lodash = require('lodash');
7
8
 
8
9
  const defaultConfig = {
9
10
  colors: [
10
- 'background', 'default', 'light', 'dark', 'primary', 'secondary',
11
- 'warning', 'error', 'info', 'success', 'accent', `current`
11
+ 'light', 'dark', 'primary',
12
+ 'warning', 'error', 'info', 'success', 'accent', 'current',
13
+ 'base', 'base-primary', 'base-secondary', 'base-tertiary',
14
+ 'body', 'body-primary', 'body-secondary', 'body-tertiary'
12
15
  ],
13
16
  fontFamily: ['primary', 'secondary'],
14
17
  fontWeight: ['light', 'normal', 'medium', 'semibold', 'bold', 'extrabold'],
15
18
  zIndex: [10, 20, 30, 40, 50, 60],
16
19
  spacing: ['xs', 'sm', 'base', 'md', 'lg', 'xl', '2xl', '3xl', 'section'],
17
20
  borderRadius: ['xs', 'sm', 'base', 'md', 'lg', 'xl', '2xl', '3xl', 'full'],
18
- animations: ['fade-in', 'fade-out', 'ripple'],
21
+ animations: ['fade-in', 'fade-out', 'fade-in-down', 'fade-out-up', 'ripple', 'spin', 'move-indeterminate'],
19
22
  screens: {
20
- 'xs': '22.5em',
21
- 'sm': '26em',
22
- 'md': '48em',
23
- 'lg': '60em',
24
- 'xl': '76em',
23
+ xs: '22.5em',
24
+ sm: '26em',
25
+ md: '48em',
26
+ lg: '60em',
27
+ xl: '76em',
25
28
  '2xl': '82em',
26
29
  '3xl': '88em',
27
30
  '4xl': '100em',
28
- 'xxl': '126em',
31
+ xxl: '126em',
29
32
  '2xxl': '158em'
30
33
  }
31
34
  };
32
35
 
33
- const hexToRgb = hex => hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(m, r, g, b) => '#' + r + r + g + g + b + b)
36
+ const hexToRgb = hex => hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, (m, r, g, b) => '#' + r + r + g + g + b + b)
34
37
  .substring(1).match(/.{2}/g)
35
38
  .map(x => parseInt(x, 16));
36
39
 
@@ -42,9 +45,9 @@ const getTailwindColors = (twColors) => {
42
45
  return
43
46
  }
44
47
 
45
- if (typeof twColors[color] === "object") {
48
+ if (typeof twColors[color] === 'object') {
46
49
  Object.keys(twColors[color]).forEach(variant => {
47
- accentColors.push([`${color.replace(/[A-Z]/g, m => "-" + m.toLowerCase())}-${variant}`, twColors[color][variant]]);
50
+ accentColors.push([`${color.replace(/[A-Z]/g, m => '-' + m.toLowerCase())}-${variant}`, twColors[color][variant]]);
48
51
  });
49
52
  } else {
50
53
  accentColors.push([color, twColors[color]]);
@@ -56,11 +59,19 @@ const getTailwindColors = (twColors) => {
56
59
 
57
60
  const tailwindColors = (colors = []) => {
58
61
  colors.forEach(name => {
62
+ colors[name + '-rgb'] = ({ opacityValue }) => {
63
+ if (opacityValue === undefined) {
64
+ return `rgb(var(--color-${name}-rgb))`
65
+ }
66
+ return `rgb(var(--color-${name}-rgb) / ${opacityValue})`
67
+ };
68
+
59
69
  colors[name] = ({ opacityValue }) => {
60
70
  if (opacityValue === undefined) {
61
- return `rgb(var(--color-${name}))`
71
+ return `var(--color-${name})`
62
72
  }
63
- return `rgb(var(--color-${name}) / ${opacityValue})`
73
+
74
+ return `color-mix(in sRGB, var(--color-${name}) calc(${opacityValue} * 100%), transparent)`
64
75
  };
65
76
  });
66
77
 
@@ -75,11 +86,15 @@ const tailwindColorsAccent = (colors = []) => {
75
86
  const rgb = hexToRgb(color[1]);
76
87
 
77
88
  result[`.accent-${color[0]}`] = {
78
- '--color-accent': `${rgb[0]} ${rgb[1]} ${rgb[2]}`
89
+ '--color-accent-rgb': `${rgb[0]} ${rgb[1]} ${rgb[2]}`,
90
+ '--color-accent': `rgb(${rgb[0]} ${rgb[1]} ${rgb[2]})`,
91
+ '--color-accent-current': `var(--color-${color}-current, var(--color-light))`
79
92
  };
80
93
  } else {
81
94
  result[`.accent-${color}`] = {
82
- '--color-accent': `var(--color-${color})`
95
+ '--color-accent-rgb': `var(--color-${color}-rgb)`,
96
+ '--color-accent': `var(--color-${color})`,
97
+ '--color-accent-current': `var(--color-${color}-current, var(--color-light))`
83
98
  };
84
99
  }
85
100
  });
@@ -130,10 +145,21 @@ const tailwindAnimations = (values) => {
130
145
  const createPlugin = (userConfig = {}) => {
131
146
  userConfig = lodash.merge(defaultConfig, userConfig);
132
147
 
133
- return plugin(({addUtilities}) => {
148
+ return plugin(({ addUtilities, theme, variants, e }) => {
134
149
  addUtilities(Object.assign(tailwindColorsAccent(getTailwindColors(twColors)), tailwindColorsAccent(userConfig.colors)));
135
150
  addUtilities(Object.assign(tailwindColorsCurrent(getTailwindColors(twColors)), tailwindColorsCurrent(userConfig.colors)));
136
151
  addUtilities(tailwindAnimations(userConfig.animations));
152
+ addUtilities([
153
+ Object.entries(theme('spacing')).map(([key, value]) => {
154
+ return {
155
+ [`.${e(`sq-${key}`)}`]: {
156
+ '--sq': `${value}`,
157
+ width: 'var(--sq)',
158
+ height: 'var(--sq)'
159
+ }
160
+ }
161
+ })
162
+ ], variants('sq'));
137
163
  }, {
138
164
  corePlugins: {
139
165
  preflight: false,
@@ -153,18 +179,18 @@ const createPlugin = (userConfig = {}) => {
153
179
  DEFAULT: 'var(--rounded)'
154
180
  }),
155
181
  screens: userConfig.screens
156
- },
182
+ }
157
183
  }
158
184
  })
159
185
  };
160
186
 
161
- module.exports.createPlugin = createPlugin;
162
- module.exports = createPlugin;
163
- module.exports.defaultConfig = defaultConfig;
164
- module.exports.getTailwindColors = getTailwindColors;
165
- module.exports.hexToRgb = hexToRgb;
166
- module.exports.tailwindAnimations = tailwindAnimations;
167
- module.exports.tailwindColors = tailwindColors;
168
- module.exports.tailwindColorsAccent = tailwindColorsAccent;
169
- module.exports.tailwindColorsCurrent = tailwindColorsCurrent;
170
- module.exports.tailwindVariables = tailwindVariables;
187
+ exports.createPlugin = createPlugin;
188
+ exports.default = createPlugin;
189
+ exports.defaultConfig = defaultConfig;
190
+ exports.getTailwindColors = getTailwindColors;
191
+ exports.hexToRgb = hexToRgb;
192
+ exports.tailwindAnimations = tailwindAnimations;
193
+ exports.tailwindColors = tailwindColors;
194
+ exports.tailwindColorsAccent = tailwindColorsAccent;
195
+ exports.tailwindColorsCurrent = tailwindColorsCurrent;
196
+ exports.tailwindVariables = tailwindVariables;