winduum 0.2.2 → 0.2.3-next.1
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/dist/main-rgb.css +1 -1
- package/dist/main.css +1 -1
- package/dist/tailwind.css +1 -1
- package/package.json +5 -5
- package/src/base/config.css +37 -17
- package/src/base/default.css +8 -2
- package/src/base/theme/dark-rgb.css +1 -1
- package/src/base/theme/dark.css +1 -6
- package/src/base/theme/default-rgb.css +10 -5
- package/src/base/theme/default.css +16 -15
- package/src/components/dialog.css +1 -1
- package/src/ui/badge/default-rgb.css +3 -3
- package/src/ui/badge/default.css +4 -4
- package/src/ui/btn/default-rgb.css +3 -3
- package/src/ui/btn/default.css +6 -6
- package/src/ui/btn/gradient-bordered-rgb.css +1 -1
- package/src/ui/btn/gradient-bordered.css +1 -1
- package/src/ui/btn/loading.css +1 -1
- package/src/ui/btn/raised.css +1 -1
- package/src/ui/check-rgb.css +2 -3
- package/src/ui/check.css +3 -4
- package/src/ui/control/default-rgb.css +2 -2
- package/src/ui/control/default.css +3 -3
- package/src/ui/control/floating-focus.css +2 -0
- package/src/ui/control/floating.css +0 -1
- package/src/ui/image.css +1 -1
- package/src/ui/link/default.css +3 -2
- package/src/ui/link/underlined.css +2 -1
- package/src/ui/notice.css +1 -2
- package/src/ui/switch-rgb.css +1 -1
- package/src/ui/switch.css +2 -2
- package/src/ui/text-rgb.css +2 -2
- package/src/ui/text.css +8 -8
- package/tailwind.config.cjs +1 -1
- package/utils/tailwind.cjs +106 -46
- package/utils/tailwind.js +104 -44
package/src/ui/btn/loading.css
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
width: var(--ui-btn-loading-width);
|
|
15
15
|
height: var(--ui-btn-loading-width);
|
|
16
16
|
content: "";
|
|
17
|
-
border: var(--ui-btn-loading-border-width) solid var(--color-current);
|
|
17
|
+
border: var(--ui-btn-loading-border-width) solid var(--color-body-current);
|
|
18
18
|
border-right-color: transparent;
|
|
19
19
|
border-radius: 50%;
|
|
20
20
|
animation: spin 0.45s infinite linear;
|
package/src/ui/btn/raised.css
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
--ui-btn-border-width: 2px;
|
|
3
3
|
--ui-btn-border-opacity: calc(var(--tw-border-opacity, 0.85) * 100%);
|
|
4
4
|
|
|
5
|
-
border: var(--ui-btn-border-width) solid color-mix(in sRGB, var(--color-accent) var(--ui-btn-border-opacity), var(--color-current));
|
|
5
|
+
border: var(--ui-btn-border-width) solid color-mix(in sRGB, var(--color-accent) var(--ui-btn-border-opacity), var(--color-body-current));
|
|
6
6
|
padding-left: calc(var(--ui-btn-px) - var(--ui-btn-border-width));
|
|
7
7
|
padding-right: calc(var(--ui-btn-px) - var(--ui-btn-border-width));
|
|
8
8
|
}
|
package/src/ui/check-rgb.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.ui-check {
|
|
2
2
|
--ui-check-bg: var(--color-body-rgb);
|
|
3
|
-
--ui-check-border-color: var(--color-current-rgb);
|
|
3
|
+
--ui-check-border-color: var(--color-body-current-rgb);
|
|
4
4
|
--ui-check-checked-bg: var(--color-accent-rgb);
|
|
5
5
|
|
|
6
6
|
& :where(input) {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
&:disabled {
|
|
17
|
-
--ui-check-bg: var(--color-current-rgb);
|
|
17
|
+
--ui-check-bg: var(--color-body-current-rgb);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
&:checked {
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
&.invalid, .validated & :where(input):invalid {
|
|
26
|
-
--color-current-rgb: var(--color-error-rgb);
|
|
27
26
|
--ui-check-bg: var(--color-error-rgb);
|
|
28
27
|
--ui-check-border-color: var(--color-error-rgb);
|
|
29
28
|
--ui-check-checked-bg: var(--color-error-rgb);
|
package/src/ui/check.css
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
--ui-check-width: 1.375rem;
|
|
3
3
|
--ui-check-font-size: 0.875rem;
|
|
4
4
|
--ui-check-gap: 0.625rem;
|
|
5
|
-
--ui-check-bg:
|
|
5
|
+
--ui-check-bg: transparent;
|
|
6
6
|
--ui-check-bg-mix: transparent;
|
|
7
7
|
--ui-check-bg-opacity: calc(var(--tw-bg-opacity, 0.1) * 100%);
|
|
8
|
-
--ui-check-border-color: var(--color-current);
|
|
8
|
+
--ui-check-border-color: var(--color-body-current);
|
|
9
9
|
--ui-check-border-mix: transparent;
|
|
10
10
|
--ui-check-border-opacity: calc(var(--tw-border-opacity, 0.2) * 100%);
|
|
11
11
|
--ui-check-border-width: 1px;
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
|
|
103
103
|
&:disabled {
|
|
104
104
|
--ui-check-bg-opacity: 15%;
|
|
105
|
-
--ui-check-bg: var(--color-current);
|
|
105
|
+
--ui-check-bg: var(--color-body-current);
|
|
106
106
|
|
|
107
107
|
cursor: not-allowed;
|
|
108
108
|
opacity: var(--ui-check-disabled-opacity);
|
|
@@ -121,7 +121,6 @@
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
&.invalid, .validated & :where(input):invalid {
|
|
124
|
-
--color-current: var(--color-error);
|
|
125
124
|
--ui-check-bg: var(--color-error);
|
|
126
125
|
--ui-check-border-color: var(--color-error);
|
|
127
126
|
--ui-check-checked-bg: var(--color-error);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.ui-control {
|
|
2
|
-
--ui-control-border-color: var(--color-current-rgb);
|
|
2
|
+
--ui-control-border-color: var(--color-body-current-rgb);
|
|
3
3
|
|
|
4
4
|
& :where(input, textarea, select) {
|
|
5
5
|
border: var(--ui-control-border-width) solid rgb(var(--ui-control-border-color) / var(--ui-control-border-opacity));
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
&:disabled {
|
|
14
|
-
background-color: rgb(var(--color-
|
|
14
|
+
background-color: rgb(var(--color-main-rgb) / var(--ui-control-disabled-opacity));
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
--ui-control-px: 0.875rem;
|
|
8
8
|
--ui-control-pl: var(--ui-control-px);
|
|
9
9
|
--ui-control-pr: var(--ui-control-px);
|
|
10
|
-
--ui-control-bg:
|
|
10
|
+
--ui-control-bg: transparent;
|
|
11
11
|
--ui-control-color: currentColor;
|
|
12
12
|
--ui-control-placeholder-color: currentColor;
|
|
13
13
|
--ui-control-placeholder-opacity: 0.5;
|
|
14
14
|
--ui-control-font-size: 0.875rem;
|
|
15
15
|
--ui-control-font-weight: var(--font-medium);
|
|
16
16
|
--ui-control-border-width: 1px;
|
|
17
|
-
--ui-control-border-color: var(--color-current);
|
|
17
|
+
--ui-control-border-color: var(--color-body-current);
|
|
18
18
|
--ui-control-border-mix: transparent;
|
|
19
19
|
--ui-control-border-opacity: 15%;
|
|
20
20
|
--ui-control-border-radius: var(--rounded);
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
|
|
60
60
|
&:disabled {
|
|
61
61
|
cursor: not-allowed;
|
|
62
|
-
background-color: color-mix(in sRGB, var(--color-
|
|
62
|
+
background-color: color-mix(in sRGB, var(--color-body-current) var(--ui-control-disabled-opacity), var(--ui-control-bg));
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
&:required ~ label {
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
--ui-control-floating-label-focus-transform: translateY(-0.6875rem) scale(0.8);
|
|
5
5
|
--ui-control-floating-label-focus-opacity: 50%;
|
|
6
6
|
--ui-control-floating-label-transition-duration: 0.4s;
|
|
7
|
-
--ui-control-placeholder-color: transparent;
|
|
8
7
|
|
|
9
8
|
& :where(label) {
|
|
10
9
|
grid-area: input;
|
package/src/ui/image.css
CHANGED
package/src/ui/link/default.css
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
.ui-link {
|
|
2
|
-
--color-accent: var(--color-current);
|
|
2
|
+
--color-accent: var(--color-body-current);
|
|
3
3
|
--ui-link-font-size: 0.875rem;
|
|
4
4
|
--ui-link-font-weight: var(--font-medium);
|
|
5
5
|
--ui-link-letter-spacing: 0;
|
|
6
6
|
--ui-link-hover-color: var(--color-accent);
|
|
7
7
|
--ui-link-hover-opacity: 0.75;
|
|
8
|
-
--ui-link-active-opacity:
|
|
8
|
+
--ui-link-active-opacity: 1;
|
|
9
9
|
--ui-link-gap: 0.5rem;
|
|
10
10
|
|
|
11
11
|
font-size: var(--ui-link-font-size);
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
&:focus-visible {
|
|
29
29
|
color: var(--ui-link-hover-color);
|
|
30
|
+
opacity: var(--ui-link-hover-opacity);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
&:active {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
.ui-link:where([class*="underlined"]) {
|
|
2
2
|
--ui-link-hover-opacity: 1;
|
|
3
|
+
--ui-link-active-opacity: 0.75;
|
|
3
4
|
--ui-link-underline-color: currentColor;
|
|
4
5
|
--ui-link-underline-width: 1px;
|
|
5
6
|
--ui-link-underline-opacity: 0;
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
--ui-link-underline-transform: none;
|
|
11
12
|
--ui-link-underline-color: var(--color-accent);
|
|
12
13
|
--ui-link-hover-opacity: 0.75;
|
|
13
|
-
--ui-link-active-opacity:
|
|
14
|
+
--ui-link-active-opacity: 1;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
&::after, & span::after {
|
package/src/ui/notice.css
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
.ui-notice {
|
|
2
|
-
--color-current: var(--color-accent);
|
|
3
2
|
--ui-notice-bg: var(--color-accent);
|
|
4
3
|
--ui-notice-py: 1.25rem;
|
|
5
4
|
--ui-notice-px: 1.5rem;
|
|
@@ -19,7 +18,7 @@
|
|
|
19
18
|
background-color: color-mix(in sRGB, var(--ui-notice-bg) 10%, transparent);
|
|
20
19
|
outline: var(--ui-notice-outline-width) solid color-mix(in sRGB, var(--ui-notice-bg) var(--ui-notice-outline-opacity), transparent);
|
|
21
20
|
outline-offset: var(--ui-notice-outline-offset);
|
|
22
|
-
color: var(--color-
|
|
21
|
+
color: var(--color-accent);
|
|
23
22
|
gap: var(--ui-notice-gap);
|
|
24
23
|
|
|
25
24
|
& :where(hr) {
|
package/src/ui/switch-rgb.css
CHANGED
package/src/ui/switch.css
CHANGED
|
@@ -65,12 +65,12 @@
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
&:focus {
|
|
68
|
-
outline-color: color-mix(in sRGB, var(--color-current) var(--ui-switch-outline-opacity), transparent);
|
|
68
|
+
outline-color: color-mix(in sRGB, var(--color-body-current) var(--ui-switch-outline-opacity), transparent);
|
|
69
69
|
outline-offset: var(--ui-switch-outline-offset);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
&:checked {
|
|
73
|
-
--color-current: var(--color-accent);
|
|
73
|
+
--color-body-current: var(--color-accent);
|
|
74
74
|
--ui-switch-bg: var(--color-accent);
|
|
75
75
|
|
|
76
76
|
&::before {
|
package/src/ui/text-rgb.css
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
.ui-text {
|
|
2
2
|
& :where(table) {
|
|
3
3
|
& :where(thead) {
|
|
4
|
-
border-bottom: 1px solid rgb(var(--color-current-rgb) / 7.5%);
|
|
4
|
+
border-bottom: 1px solid rgb(var(--color-body-current-rgb) / 7.5%);
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
& :where(tbody tr) {
|
|
8
8
|
&:nth-of-type(even) {
|
|
9
|
-
background-color: rgb(var(--color-current-rgb) / 5%);
|
|
9
|
+
background-color: rgb(var(--color-body-current-rgb) / 5%);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
}
|
package/src/ui/text.css
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
--ui-text-size-line: 0.75rem;
|
|
4
4
|
--ui-text-weight: var(--font-normal);
|
|
5
5
|
--ui-text-weight-bold: var(--font-semibold);
|
|
6
|
-
--ui-text-content-my:
|
|
7
|
-
--ui-text-content-my-sm: 1rem;
|
|
6
|
+
--ui-text-content-my: 1rem;
|
|
8
7
|
--ui-text-content-my-lg: 2rem;
|
|
9
8
|
|
|
10
9
|
font-weight: var(--ui-text-weight);
|
|
@@ -13,6 +12,7 @@
|
|
|
13
12
|
|
|
14
13
|
&:where(.lg) {
|
|
15
14
|
--ui-text-size: 1.125rem;
|
|
15
|
+
--ui-text-size-line: 1rem;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
& :where(a) {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
line-height: inherit;
|
|
60
60
|
|
|
61
61
|
&:not(:only-child) {
|
|
62
|
-
margin: var(--ui-text-content-my
|
|
62
|
+
margin: var(--ui-text-content-my) 0;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
&:last-child {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
&:empty {
|
|
70
|
-
line-height: var(--ui-text-content-my
|
|
70
|
+
line-height: var(--ui-text-content-my);
|
|
71
71
|
margin: 0;
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
font-family: var(--font-secondary);
|
|
88
88
|
font-size: var(--ui-text-heading-size, 1rem);
|
|
89
89
|
line-height: calc(var(--ui-text-heading-size) + 0.5rem);
|
|
90
|
-
margin: var(--ui-text-content-my) 0 var(--ui-text-content-my
|
|
90
|
+
margin: var(--ui-text-content-my-lg) 0 var(--ui-text-content-my);
|
|
91
91
|
|
|
92
92
|
&:first-child {
|
|
93
93
|
margin-top: 0;
|
|
@@ -117,12 +117,12 @@
|
|
|
117
117
|
|
|
118
118
|
& :where(thead) {
|
|
119
119
|
font-weight: var(--ui-text-weight-bold);
|
|
120
|
-
border-bottom: 1px solid color-mix(in sRGB, var(--color-current) 7.5%, transparent);
|
|
120
|
+
border-bottom: 1px solid color-mix(in sRGB, var(--color-body-current) 7.5%, transparent);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
& :where(tbody tr) {
|
|
124
124
|
&:nth-of-type(even) {
|
|
125
|
-
background-color: color-mix(in sRGB, var(--color-current) 5%, transparent);
|
|
125
|
+
background-color: color-mix(in sRGB, var(--color-body-current) 5%, transparent);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
}
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
|
|
146
146
|
& :where(code) {
|
|
147
147
|
margin: 0 0.25rem;
|
|
148
|
-
border-radius: var(--rounded-
|
|
148
|
+
border-radius: var(--rounded-sm);
|
|
149
149
|
padding: 0.25rem 0.375rem;
|
|
150
150
|
font-size: 0.85em;
|
|
151
151
|
color: var(--color-accent);
|
package/tailwind.config.cjs
CHANGED
package/utils/tailwind.cjs
CHANGED
|
@@ -3,21 +3,57 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var plugin = require('tailwindcss/plugin');
|
|
6
|
+
var flattenColorPalette = require('tailwindcss/src/util/flattenColorPalette');
|
|
7
|
+
var toColorValue = require('tailwindcss/src/util/toColorValue');
|
|
8
|
+
var color = require('tailwindcss/src/util/color');
|
|
6
9
|
var twColors = require('tailwindcss/colors');
|
|
7
10
|
var lodash = require('lodash');
|
|
8
11
|
|
|
12
|
+
function withAlphaVariable ({ color: color$1, property, variable }) {
|
|
13
|
+
const properties = [].concat(property);
|
|
14
|
+
if (typeof color$1 === 'function') {
|
|
15
|
+
return {
|
|
16
|
+
...Object.fromEntries(
|
|
17
|
+
properties.map((p) => {
|
|
18
|
+
return [p, color$1({ opacityVariable: variable, opacityValue: `var(${variable}, 1)` })]
|
|
19
|
+
})
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const parsed = color.parseColor(color$1);
|
|
25
|
+
|
|
26
|
+
if (parsed === null) {
|
|
27
|
+
return Object.fromEntries(properties.map((p) => [p, color$1]))
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (parsed.alpha !== undefined) {
|
|
31
|
+
// Has an alpha value, return color as-is
|
|
32
|
+
return Object.fromEntries(properties.map((p) => [p, color$1]))
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
...Object.fromEntries(
|
|
37
|
+
properties.map((p) => {
|
|
38
|
+
return [p, color.formatColor({ ...parsed, alpha: `var(${variable}, 1)` })]
|
|
39
|
+
})
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
9
44
|
const defaultConfig = {
|
|
10
45
|
colors: [
|
|
11
|
-
'
|
|
12
|
-
'warning', 'error', 'info', 'success', '
|
|
13
|
-
'
|
|
46
|
+
'primary', 'accent',
|
|
47
|
+
'warning', 'error', 'info', 'success', 'light', 'dark',
|
|
48
|
+
'main', 'main-primary', 'main-secondary', 'main-tertiary',
|
|
14
49
|
'body', 'body-primary', 'body-secondary', 'body-tertiary'
|
|
15
50
|
],
|
|
16
51
|
fontFamily: ['primary', 'secondary'],
|
|
17
52
|
fontWeight: ['light', 'normal', 'medium', 'semibold', 'bold', 'extrabold'],
|
|
18
53
|
zIndex: [10, 20, 30, 40, 50, 60],
|
|
19
|
-
|
|
20
|
-
|
|
54
|
+
fontSize: ['xs', 'sm', 'base', 'md', 'lg', 'xl', '2xl', '3xl', '3xl', '4xl', '5xl', '6xl', '7xl', '7xl', '8xl', '9xl'],
|
|
55
|
+
spacing: ['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', 'section'],
|
|
56
|
+
borderRadius: ['xs', 'sm', 'base', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', 'full'],
|
|
21
57
|
animations: ['fade-in', 'fade-out', 'fade-in-down', 'fade-out-up', 'ripple', 'spin', 'move-indeterminate'],
|
|
22
58
|
screens: {
|
|
23
59
|
xs: '22.5em',
|
|
@@ -30,6 +66,9 @@ const defaultConfig = {
|
|
|
30
66
|
'4xl': '100em',
|
|
31
67
|
xxl: '126em',
|
|
32
68
|
'2xxl': '158em'
|
|
69
|
+
},
|
|
70
|
+
settings: {
|
|
71
|
+
rgbFallback: true
|
|
33
72
|
}
|
|
34
73
|
};
|
|
35
74
|
|
|
@@ -59,20 +98,11 @@ const getTailwindColors = (twColors) => {
|
|
|
59
98
|
|
|
60
99
|
const tailwindColors = (colors = []) => {
|
|
61
100
|
colors.forEach(name => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
return `rgb(var(--color-${name}-rgb) / ${opacityValue})`
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
colors[name] = ({ opacityValue }) => {
|
|
70
|
-
if (opacityValue === undefined) {
|
|
71
|
-
return `var(--color-${name})`
|
|
72
|
-
}
|
|
101
|
+
if (defaultConfig.settings.rgbFallback) {
|
|
102
|
+
colors[name + '-rgb'] = `rgb(var(--color-${name}-rgb) / <alpha-value>)`;
|
|
103
|
+
}
|
|
73
104
|
|
|
74
|
-
|
|
75
|
-
};
|
|
105
|
+
colors[name] = `color-mix(in sRGB, var(--color-${name}) calc(<alpha-value> * 100%), transparent)`;
|
|
76
106
|
});
|
|
77
107
|
|
|
78
108
|
return colors
|
|
@@ -85,46 +115,42 @@ const tailwindColorsAccent = (colors = []) => {
|
|
|
85
115
|
if (Array.isArray(color)) {
|
|
86
116
|
const rgb = hexToRgb(color[1]);
|
|
87
117
|
|
|
88
|
-
result[`.accent-${color[0]}`] =
|
|
89
|
-
|
|
118
|
+
result[`.accent-${color[0]}`] = Object.assign(defaultConfig.settings.rgbFallback
|
|
119
|
+
? {
|
|
120
|
+
'--color-accent-rgb': `${rgb[0]} ${rgb[1]} ${rgb[2]}`,
|
|
121
|
+
'--color-accent-current-rgb': `var(--color-${color}-current-rgb, var(--color-light-rgb))`
|
|
122
|
+
}
|
|
123
|
+
: {}, {
|
|
90
124
|
'--color-accent': `rgb(${rgb[0]} ${rgb[1]} ${rgb[2]})`,
|
|
91
125
|
'--color-accent-current': `var(--color-${color}-current, var(--color-light))`
|
|
92
|
-
};
|
|
126
|
+
});
|
|
93
127
|
} else {
|
|
94
|
-
result[`.accent-${color}`] =
|
|
95
|
-
|
|
128
|
+
result[`.accent-${color}`] = Object.assign(defaultConfig.settings.rgbFallback
|
|
129
|
+
? {
|
|
130
|
+
'--color-accent-rgb': `var(--color-${color}-rgb)`,
|
|
131
|
+
'--color-accent-current-rgb': `var(--color-${color}-current-rgb, var(--color-light-rgb))`
|
|
132
|
+
}
|
|
133
|
+
: {}, {
|
|
96
134
|
'--color-accent': `var(--color-${color})`,
|
|
97
135
|
'--color-accent-current': `var(--color-${color}-current, var(--color-light))`
|
|
98
|
-
};
|
|
136
|
+
});
|
|
99
137
|
}
|
|
100
138
|
});
|
|
101
139
|
|
|
102
140
|
return result
|
|
103
141
|
};
|
|
104
142
|
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
colors.forEach(color => {
|
|
109
|
-
if (Array.isArray(color)) {
|
|
110
|
-
const rgb = hexToRgb(color[1]);
|
|
111
|
-
|
|
112
|
-
result[`.text-${color[0]}`] = {
|
|
113
|
-
'--color-current': `${rgb[0]} ${rgb[1]} ${rgb[2]}`
|
|
114
|
-
};
|
|
115
|
-
} else {
|
|
116
|
-
result[`.text-${color}`] = {
|
|
117
|
-
'--color-current': `var(--color-${color})`
|
|
118
|
-
};
|
|
119
|
-
}
|
|
143
|
+
const tailwindVariables = (type, variables = [], values = {}) => {
|
|
144
|
+
variables.forEach(name => {
|
|
145
|
+
values[name] = `var(--${type}-${name})`;
|
|
120
146
|
});
|
|
121
147
|
|
|
122
|
-
return
|
|
148
|
+
return values
|
|
123
149
|
};
|
|
124
150
|
|
|
125
|
-
const
|
|
151
|
+
const tailwindVariablesFont = (type, variables = [], values = {}) => {
|
|
126
152
|
variables.forEach(name => {
|
|
127
|
-
values[name] = `var(--${type}-${name})
|
|
153
|
+
values[name] = [`var(--${type}-${name})`, `calc(var(--${type}-${name}) + 0.5rem)`];
|
|
128
154
|
});
|
|
129
155
|
|
|
130
156
|
return values
|
|
@@ -145,9 +171,41 @@ const tailwindAnimations = (values) => {
|
|
|
145
171
|
const createPlugin = (userConfig = {}) => {
|
|
146
172
|
userConfig = lodash.merge(defaultConfig, userConfig);
|
|
147
173
|
|
|
148
|
-
return plugin(({ addUtilities, theme, variants, e }) => {
|
|
174
|
+
return plugin(({ addUtilities, matchUtilities, theme, variants, e, corePlugins }) => {
|
|
149
175
|
addUtilities(Object.assign(tailwindColorsAccent(getTailwindColors(twColors)), tailwindColorsAccent(userConfig.colors)));
|
|
150
|
-
|
|
176
|
+
matchUtilities(
|
|
177
|
+
{
|
|
178
|
+
text: (value, extra) => {
|
|
179
|
+
const matchValue = toColorValue(value).match(/var\((.*?)\)/);
|
|
180
|
+
const fallbackRgb = matchValue && matchValue[0].includes('-rgb');
|
|
181
|
+
|
|
182
|
+
const colorProperties = {};
|
|
183
|
+
|
|
184
|
+
if (fallbackRgb) {
|
|
185
|
+
colorProperties['--color-body-current-rgb'] = matchValue[0];
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (!corePlugins('textOpacity')) {
|
|
189
|
+
return {
|
|
190
|
+
...colorProperties,
|
|
191
|
+
'--color-body-current': toColorValue(value),
|
|
192
|
+
color: toColorValue(value)
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return {
|
|
197
|
+
...colorProperties,
|
|
198
|
+
'--color-body-current': toColorValue(value),
|
|
199
|
+
...withAlphaVariable({
|
|
200
|
+
color: value,
|
|
201
|
+
property: 'color',
|
|
202
|
+
variable: '--tw-text-opacity'
|
|
203
|
+
})
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
{ values: flattenColorPalette(theme('textColor')), type: ['color', 'any'] }
|
|
208
|
+
);
|
|
151
209
|
addUtilities(tailwindAnimations(userConfig.animations));
|
|
152
210
|
addUtilities([
|
|
153
211
|
Object.entries(theme('spacing')).map(([key, value]) => {
|
|
@@ -162,11 +220,13 @@ const createPlugin = (userConfig = {}) => {
|
|
|
162
220
|
}, {
|
|
163
221
|
corePlugins: {
|
|
164
222
|
preflight: false,
|
|
165
|
-
container: false
|
|
223
|
+
container: false,
|
|
224
|
+
textColor: false
|
|
166
225
|
},
|
|
167
226
|
theme: {
|
|
168
227
|
extend: {
|
|
169
228
|
colors: tailwindColors(userConfig.colors),
|
|
229
|
+
fontSize: tailwindVariablesFont('text', userConfig.fontSize),
|
|
170
230
|
fontFamily: tailwindVariables('font', userConfig.fontFamily),
|
|
171
231
|
fontWeight: tailwindVariables('font', userConfig.fontWeight),
|
|
172
232
|
zIndex: tailwindVariables('z', userConfig.zIndex, {
|
|
@@ -191,5 +251,5 @@ exports.hexToRgb = hexToRgb;
|
|
|
191
251
|
exports.tailwindAnimations = tailwindAnimations;
|
|
192
252
|
exports.tailwindColors = tailwindColors;
|
|
193
253
|
exports.tailwindColorsAccent = tailwindColorsAccent;
|
|
194
|
-
exports.tailwindColorsCurrent = tailwindColorsCurrent;
|
|
195
254
|
exports.tailwindVariables = tailwindVariables;
|
|
255
|
+
exports.tailwindVariablesFont = tailwindVariablesFont;
|