@digigov/css 0.29.8 → 0.29.10-dark-beta
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/{colors/color-values.light.js → defaultTheme.js} +13 -16
- package/dist/base/index.css +3 -3
- package/dist/base.css +3 -3
- package/dist/base.js +1 -1
- package/dist/components.css +1 -1
- package/dist/components.js +1 -1
- package/dist/digigov.css +3 -3
- package/index.js +7 -5
- package/package.json +7 -4
- package/src/base/tailwind.config.js +2 -2
- package/src/components/button.css +1 -1
- package/src/components/card.css +14 -7
- package/src/components/checkboxes.css +5 -14
- package/src/components/dev-theme.css +10 -0
- package/src/components/dropdown.css +1 -1
- package/src/components/footer.css +6 -3
- package/src/components/header.css +5 -2
- package/src/components/index.css +2 -1
- package/src/components/nav.css +3 -3
- package/src/components/phase-banner.css +1 -1
- package/src/components/radios.css +9 -14
- package/src/components/svg-icons.css +2 -2
- package/src/components/table.css +15 -7
- package/src/components/typography.css +2 -2
- package/tailwind.config.js +89 -14
- package/themes.plugin.js +74 -0
- package/color-vars.plugin.js +0 -21
- package/colors/color-values.dark.js +0 -68
- package/colors/index.js +0 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/css",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.10-dark-beta",
|
|
4
4
|
"description": "Digigov CSS - Tailwind CSS Components",
|
|
5
5
|
"author": "GRNET Devs <devs@lists.grnet.gr>",
|
|
6
6
|
"license": "BSD-2-Clause",
|
|
@@ -24,16 +24,17 @@
|
|
|
24
24
|
"dist",
|
|
25
25
|
"!dist/components",
|
|
26
26
|
"index.js",
|
|
27
|
+
"defaultTheme.js",
|
|
27
28
|
"src",
|
|
28
29
|
"colors",
|
|
29
|
-
"
|
|
30
|
+
"themes.plugin.js",
|
|
30
31
|
"postcss.config.js",
|
|
31
32
|
"tailwind.config.js"
|
|
32
33
|
],
|
|
33
34
|
"publishConfig": {
|
|
34
35
|
"access": "public",
|
|
35
36
|
"branches": [
|
|
36
|
-
"
|
|
37
|
+
"main"
|
|
37
38
|
]
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
@@ -49,7 +50,9 @@
|
|
|
49
50
|
"nodemon": "2.0.7",
|
|
50
51
|
"next": "10.0.9",
|
|
51
52
|
"@digigov/postcss-banner": "0.3.18",
|
|
52
|
-
"rimraf": "3.0.2"
|
|
53
|
+
"rimraf": "3.0.2",
|
|
54
|
+
"postcss-js": "4.0.0",
|
|
55
|
+
"postcss-load-config": "3.1.4"
|
|
53
56
|
},
|
|
54
57
|
"scripts": {
|
|
55
58
|
"preutilities": "DIGIGOV_CSS_BUILD=TRUE postcss --config src/utilities src/utilities/index.css --base src --dir dist",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const plugin = require('tailwindcss/plugin')
|
|
2
2
|
const tailwindConfig = require('../../tailwind.config.js');
|
|
3
|
-
const
|
|
3
|
+
const themesPlugin = require('../../themes.plugin')
|
|
4
4
|
|
|
5
5
|
module.exports = {
|
|
6
6
|
...tailwindConfig,
|
|
@@ -9,6 +9,6 @@ module.exports = {
|
|
|
9
9
|
addComponents(require('../../dist/components'))
|
|
10
10
|
addUtilities(require('../../dist/utilities'))
|
|
11
11
|
}),
|
|
12
|
-
plugin(
|
|
12
|
+
plugin(themesPlugin)
|
|
13
13
|
],
|
|
14
14
|
}
|
package/src/components/card.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.govgr-card {
|
|
2
|
-
@apply mb-7 text-base-content;
|
|
2
|
+
@apply mb-7 text-base-content h-full;
|
|
3
3
|
}
|
|
4
4
|
.govgr-card--border {
|
|
5
5
|
@apply border-2 border-base-content p-6;
|
|
@@ -11,18 +11,20 @@
|
|
|
11
11
|
@apply border-b border-gray100 pb-4 mb-4;
|
|
12
12
|
}
|
|
13
13
|
.govgr-card__heading {
|
|
14
|
+
word-break: break-word;
|
|
14
15
|
@apply md:text-2xl text-xl font-bold;
|
|
15
16
|
}
|
|
16
17
|
.govgr-card__text {
|
|
18
|
+
word-break: break-word;
|
|
17
19
|
@apply text-base lg:text-xl text-lg;
|
|
18
20
|
}
|
|
19
21
|
.govgr-card__body {
|
|
20
|
-
@apply
|
|
22
|
+
@apply flex flex-col gap-3 md:gap-4 h-full;
|
|
21
23
|
}
|
|
22
24
|
.govgr-card__action {
|
|
23
|
-
@apply flex flex-wrap items-center gap-y-4;
|
|
25
|
+
@apply flex flex-wrap items-center gap-y-4 mt-auto;
|
|
24
26
|
.govgr-link, .govgr-btn {
|
|
25
|
-
@apply mb-0;
|
|
27
|
+
@apply mb-0 max-w-fit w-fit;
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
@media print {
|
|
@@ -39,24 +41,29 @@
|
|
|
39
41
|
.govgr-card--cta {
|
|
40
42
|
.govgr-card__body {
|
|
41
43
|
@apply pr-8 relative;
|
|
44
|
+
|
|
42
45
|
&:after {
|
|
43
46
|
content: "";
|
|
44
|
-
transition: all 0.1s ease;
|
|
47
|
+
transition: all 0.1s ease;
|
|
45
48
|
@apply w-5 h-5 bg-contain bg-no-repeat bg-center absolute right-2 top-2 z-/1;
|
|
46
|
-
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' aria-hidden='true'> <path d='M8.5,2L6.1,4.3l7.6,7.7l-7.6,7.6L8.5,22l10-10L8.5,2z' /> </svg>"
|
|
49
|
+
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' aria-hidden='true'> <path d='M8.5,2L6.1,4.3l7.6,7.7l-7.6,7.6L8.5,22l10-10L8.5,2z' /> </svg>");
|
|
47
50
|
}
|
|
51
|
+
|
|
48
52
|
&:hover {
|
|
49
53
|
&:after {
|
|
50
54
|
@apply right-1;
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
}
|
|
58
|
+
|
|
54
59
|
.govgr-card__heading {
|
|
55
60
|
@apply md:text-xl text-lg tracking-wide;
|
|
56
61
|
@apply leading-8 !important;
|
|
62
|
+
|
|
57
63
|
.govgr-link {
|
|
64
|
+
|
|
58
65
|
/* Clickable area will be at all the card with 'after' */
|
|
59
|
-
&::after {
|
|
66
|
+
&::after {
|
|
60
67
|
content: "";
|
|
61
68
|
@apply block absolute top-0 bottom-0 right-0 left-0;
|
|
62
69
|
}
|
|
@@ -19,13 +19,12 @@
|
|
|
19
19
|
-webkit-box-sizing: border-box;
|
|
20
20
|
box-sizing: border-box;
|
|
21
21
|
@apply absolute top-0 left-0 w-10 h-10
|
|
22
|
-
border-base-content border-2 bg-
|
|
22
|
+
border-solid border-base-content border-2 bg-white opacity-100;
|
|
23
23
|
}
|
|
24
24
|
&:after {
|
|
25
25
|
content: "";
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
position: absolute;
|
|
26
|
+
@apply absolute bg-transparent opacity-0 box-border
|
|
27
|
+
border-accent border-b-5 border-l-5 border-t-0 border-r-0;
|
|
29
28
|
top: 11px;
|
|
30
29
|
left: 9px;
|
|
31
30
|
width: 23px;
|
|
@@ -33,18 +32,10 @@
|
|
|
33
32
|
-webkit-transform: rotate(-45deg);
|
|
34
33
|
-ms-transform: rotate(-45deg);
|
|
35
34
|
transform: rotate(-45deg);
|
|
36
|
-
border: solid;
|
|
37
|
-
border-width: 0 0 5px 5px;
|
|
38
|
-
border-top-color: transparent;
|
|
39
|
-
opacity: 0;
|
|
40
|
-
background: transparent;
|
|
41
35
|
}
|
|
42
36
|
&:checked {
|
|
43
37
|
&:after {
|
|
44
|
-
opacity
|
|
45
|
-
}
|
|
46
|
-
&:before {
|
|
47
|
-
background-color: white;
|
|
38
|
+
@apply opacity-100;
|
|
48
39
|
}
|
|
49
40
|
}
|
|
50
41
|
&:focus {
|
|
@@ -52,7 +43,7 @@
|
|
|
52
43
|
outline-offset: 1px;
|
|
53
44
|
box-shadow: 0 0 0 4px var(--color-focus);
|
|
54
45
|
&:before {
|
|
55
|
-
border-
|
|
46
|
+
@apply border-4;
|
|
56
47
|
}
|
|
57
48
|
}
|
|
58
49
|
}
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
}
|
|
94
94
|
.govgr-header, .govgr-admin-header {
|
|
95
95
|
.govgr-dropdown__button.govgr-link {
|
|
96
|
-
@apply text-lg text-
|
|
96
|
+
@apply text-lg text-header-content focus:text-base-content print:text-gray600;
|
|
97
97
|
}
|
|
98
98
|
.govgr-dropdown {
|
|
99
99
|
@apply print:hidden;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
.govgr-footer {
|
|
2
2
|
@apply border-0 border-solid font-normal text-base py-4 md:py-8
|
|
3
3
|
border-t-4 border-secondary600 text-gray600 bg-gray50 w-full
|
|
4
|
-
print:py-2 print:bg-white print:border-t-2
|
|
5
|
-
dark:border-secondary800 dark:text-gray800;
|
|
4
|
+
print:py-2 print:bg-white print:border-t-2;
|
|
6
5
|
.govgr-section-break {
|
|
7
6
|
@apply print:hidden;
|
|
8
7
|
}
|
|
@@ -32,8 +31,12 @@
|
|
|
32
31
|
@apply mr-0;
|
|
33
32
|
}
|
|
34
33
|
}
|
|
34
|
+
.govgr-footer__government-logo-inverted {
|
|
35
|
+
@apply max-w-full h-auto w-52 min-w-52 hidden;
|
|
36
|
+
|
|
37
|
+
}
|
|
35
38
|
.govgr-footer__logo, .govgr-footer__government-logo {
|
|
36
|
-
@apply max-w-full h-auto w-52 min-w-52;
|
|
39
|
+
@apply max-w-full h-auto w-52 min-w-52 block;
|
|
37
40
|
}
|
|
38
41
|
.govgr-footer__licence-description {
|
|
39
42
|
@apply mt-6 print:mt-4;
|
|
@@ -15,9 +15,12 @@
|
|
|
15
15
|
print:gap-1;
|
|
16
16
|
}
|
|
17
17
|
.govgr-header-title {
|
|
18
|
-
@apply text-
|
|
19
|
-
w-auto align-middle hover:
|
|
18
|
+
@apply text-header-content font-bold text-2xl leading-10 tracking-wide no-underline
|
|
19
|
+
w-auto align-middle hover:no-underline
|
|
20
20
|
print:text-base-content;
|
|
21
|
+
&:hover {
|
|
22
|
+
@apply text-header-content
|
|
23
|
+
}
|
|
21
24
|
}
|
|
22
25
|
.govgr-header-title:focus {
|
|
23
26
|
text-decoration:none;
|
package/src/components/index.css
CHANGED
package/src/components/nav.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.govgr-header {
|
|
2
2
|
.govgr-burger-icon {
|
|
3
|
-
fill: var(--color-
|
|
3
|
+
fill: var(--color-header-content) ;
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
6
|
.govgr-burger-icon {
|
|
@@ -71,14 +71,14 @@
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
.govgr-horizontal-nav__item {
|
|
74
|
-
@apply p-1 text-xl
|
|
74
|
+
@apply p-1 text-xl text-base-content
|
|
75
75
|
sm:py-1 sm:px-1 sm:text-base
|
|
76
76
|
no-underline hover:underline;
|
|
77
77
|
}
|
|
78
78
|
.govgr-horizontal-nav__item:focus {
|
|
79
79
|
@apply bg-focus text-base-content outline-none;
|
|
80
80
|
box-shadow: 0 -2px var(--color-focus), 0 4px var(--color-base-content);
|
|
81
|
-
|
|
81
|
+
}
|
|
82
82
|
.govgr-horizontal-nav__item-active, .govgr-vertical-nav__item--active {
|
|
83
83
|
@apply font-semibold;
|
|
84
84
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
@apply table-cell text-base-content;
|
|
16
16
|
}
|
|
17
17
|
.govgr-header .govgr-phase-banner__text, .govgr-masthead .govgr-phase-banner__text {
|
|
18
|
-
@apply text-
|
|
18
|
+
@apply text-header-content print:text-base-content;
|
|
19
19
|
}
|
|
20
20
|
.govgr-phase-banner_header {
|
|
21
21
|
@apply bg-focus top-0 z-30
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.govgr-radios__item {
|
|
2
|
-
@apply block relative mb-4 pl-12;
|
|
2
|
+
@apply block relative mb-4 pl-12;
|
|
3
3
|
min-height: 40px;
|
|
4
4
|
}
|
|
5
5
|
.govgr-radios--inline {
|
|
@@ -13,35 +13,30 @@
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
.govgr-radios__label {
|
|
16
|
-
@apply inline-block py-1 px-2 cursor-pointer text-lg
|
|
16
|
+
@apply inline-block py-1 px-2 cursor-pointer text-lg;
|
|
17
17
|
}
|
|
18
18
|
.govgr-radios__input {
|
|
19
19
|
@apply absolute z-1 left-0.5 -top-1 m-0 rounded-3xl
|
|
20
|
-
w-10 h-10 opacity-100 cursor-pointer
|
|
20
|
+
w-10 h-10 opacity-100 cursor-pointer
|
|
21
|
+
bg-white m-0;
|
|
21
22
|
appearance: none;
|
|
22
|
-
background-color: #fff;
|
|
23
|
-
margin: 0;
|
|
24
23
|
width: 40px;
|
|
25
24
|
height: 40px;
|
|
26
25
|
border: 2px solid currentColor;
|
|
27
26
|
border-radius: 50%;
|
|
28
27
|
&::before {
|
|
29
28
|
content: "";
|
|
30
|
-
|
|
29
|
+
@apply absolute bg-white opacity-0 w-0 h-0;
|
|
31
30
|
top: 6px;
|
|
32
31
|
left: 6px;
|
|
33
|
-
width: 0;
|
|
34
|
-
height: 0;
|
|
35
32
|
border: 12px solid currentColor;
|
|
36
33
|
border-radius: 50%;
|
|
37
|
-
opacity: 0;
|
|
38
|
-
background: currentColor;
|
|
39
34
|
}
|
|
40
|
-
&:checked {
|
|
35
|
+
&:checked {
|
|
41
36
|
&::before {
|
|
42
|
-
opacity
|
|
37
|
+
@apply opacity-100;
|
|
43
38
|
}
|
|
44
|
-
}
|
|
39
|
+
}
|
|
45
40
|
&:focus {
|
|
46
41
|
outline: 3px solid transparent;
|
|
47
42
|
outline-offset: 1px;
|
|
@@ -52,4 +47,4 @@
|
|
|
52
47
|
left: 4px;
|
|
53
48
|
}
|
|
54
49
|
}
|
|
55
|
-
}
|
|
50
|
+
}
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
.govgr-header, .govgr-admin-header {
|
|
44
44
|
.govgr-link {
|
|
45
45
|
.govgr-svg-icon {
|
|
46
|
-
fill:var(--color-
|
|
46
|
+
fill:var(--color-header-content);
|
|
47
47
|
}
|
|
48
48
|
&:hover {
|
|
49
49
|
.govgr-svg-icon {
|
|
50
|
-
fill:var(--color-
|
|
50
|
+
fill:var(--color-header-content);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
&:focus {
|
package/src/components/table.css
CHANGED
|
@@ -40,17 +40,25 @@
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
.govgr-table__body {
|
|
43
|
-
@apply relative
|
|
43
|
+
@apply relative;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
@supports (-moz-appearance:none) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
.govgr-table {
|
|
48
|
+
border-collapse: unset;
|
|
49
|
+
}
|
|
50
|
+
.govgr-table--with-vertical-lines {
|
|
51
|
+
.govgr-table__header {
|
|
52
|
+
@apply border-t;
|
|
53
|
+
@apply border-r-0 !important;
|
|
54
|
+
&:last-child {
|
|
55
|
+
@apply border-r border-solid border-gray100 px-4 !important;
|
|
56
|
+
}
|
|
50
57
|
}
|
|
51
|
-
.govgr-
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
.govgr-table__cell {
|
|
59
|
+
@apply border-r-0 !important;
|
|
60
|
+
&:last-child {
|
|
61
|
+
@apply border-r border-solid border-gray100 px-4 !important;
|
|
54
62
|
}
|
|
55
63
|
}
|
|
56
64
|
}
|
|
@@ -116,10 +116,10 @@
|
|
|
116
116
|
}
|
|
117
117
|
.govgr-header {
|
|
118
118
|
.govgr-header__container > .govgr-link {
|
|
119
|
-
@apply text-
|
|
119
|
+
@apply text-header-content focus:text-link-active print:text-base-content;
|
|
120
120
|
}
|
|
121
121
|
.govgr-header__content > .govgr-link {
|
|
122
|
-
@apply text-
|
|
122
|
+
@apply text-header-content focus:text-link-active print:text-base-content;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
.govgr-link--no-underline {
|
package/tailwind.config.js
CHANGED
|
@@ -1,23 +1,98 @@
|
|
|
1
1
|
const plugin = require("tailwindcss/plugin");
|
|
2
2
|
const defaultTheme = require("tailwindcss/defaultTheme");
|
|
3
|
-
const
|
|
4
|
-
|
|
3
|
+
const themesPlugin = require("./themes.plugin");
|
|
4
|
+
|
|
5
|
+
const allColors = [
|
|
6
|
+
"transparent",
|
|
7
|
+
"current",
|
|
8
|
+
"primary",
|
|
9
|
+
"primary-focus",
|
|
10
|
+
"primary200",
|
|
11
|
+
"secondary50",
|
|
12
|
+
"secondary200",
|
|
13
|
+
"secondary",
|
|
14
|
+
"secondary-focus",
|
|
15
|
+
"secondary400",
|
|
16
|
+
"secondary600",
|
|
17
|
+
"secondary800",
|
|
18
|
+
"content-dark",
|
|
19
|
+
"content",
|
|
20
|
+
"content-secondary",
|
|
21
|
+
"accent",
|
|
22
|
+
"accent-focus",
|
|
23
|
+
"accent-content",
|
|
24
|
+
"neutral",
|
|
25
|
+
"neutral-focus",
|
|
26
|
+
"neutral-content",
|
|
27
|
+
"header-content",
|
|
28
|
+
"base100",
|
|
29
|
+
"base150",
|
|
30
|
+
"base200",
|
|
31
|
+
"base300",
|
|
32
|
+
"base300-content",
|
|
33
|
+
"base-content",
|
|
34
|
+
"base-content-secondary",
|
|
35
|
+
"base-content-invert",
|
|
36
|
+
"info",
|
|
37
|
+
"success",
|
|
38
|
+
"success-hover",
|
|
39
|
+
"warning",
|
|
40
|
+
"error",
|
|
41
|
+
"error-hover",
|
|
42
|
+
"focus",
|
|
43
|
+
"link",
|
|
44
|
+
"link-hover",
|
|
45
|
+
"link-visited",
|
|
46
|
+
"link-active",
|
|
47
|
+
"white",
|
|
48
|
+
"gray50",
|
|
49
|
+
"gray100",
|
|
50
|
+
"gray200",
|
|
51
|
+
"base-bg",
|
|
52
|
+
"gray300",
|
|
53
|
+
"gray400",
|
|
54
|
+
"gray500",
|
|
55
|
+
"gray600",
|
|
56
|
+
"gray700",
|
|
57
|
+
"gray800",
|
|
58
|
+
"gray900",
|
|
59
|
+
"black",
|
|
60
|
+
"shadow200",
|
|
61
|
+
"shadow600",
|
|
62
|
+
];
|
|
5
63
|
|
|
6
64
|
const buildOnly = !process.env["DIGIGOV_CSS_BUILD"]
|
|
7
65
|
? {
|
|
8
|
-
|
|
9
|
-
|
|
66
|
+
mode: "jit",
|
|
67
|
+
}
|
|
10
68
|
: {};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
69
|
+
|
|
70
|
+
const colorVariables = allColors.reduce((colorVars, color) => {
|
|
71
|
+
if(['transparent', 'currentColor'].includes(color)) {
|
|
72
|
+
colorVars[color] = color;
|
|
73
|
+
} else {
|
|
74
|
+
colorVars[color] = ({opacityVariable, opacityValue}) => {
|
|
75
|
+
if(opacityValue !== undefined) {
|
|
76
|
+
return `rgba(var(--color-${color}-rgb), ${opacityValue})`;
|
|
77
|
+
}
|
|
78
|
+
if(opacityVariable !== undefined) {
|
|
79
|
+
return `rgba(var(--color-${color}-rgb), var(${opacityVariable}, 1))`;
|
|
80
|
+
}
|
|
81
|
+
return `rgb(var(--color-${color}-rgb))`;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return colorVars;
|
|
14
85
|
}, {});
|
|
86
|
+
|
|
15
87
|
module.exports = {
|
|
16
88
|
...buildOnly,
|
|
17
89
|
darkMode: 'class',
|
|
90
|
+
themes: {
|
|
91
|
+
light: require.resolve('./defaultTheme'),
|
|
92
|
+
},
|
|
93
|
+
defaultTheme: 'light',
|
|
18
94
|
theme: {
|
|
19
|
-
colors:
|
|
20
|
-
themes: colors,
|
|
95
|
+
colors: colorVariables,
|
|
21
96
|
container: {
|
|
22
97
|
center: true,
|
|
23
98
|
},
|
|
@@ -32,14 +107,11 @@ module.exports = {
|
|
|
32
107
|
lg: "1024px",
|
|
33
108
|
xl: "1280px",
|
|
34
109
|
"2xl": "1280px",
|
|
35
|
-
print: {
|
|
110
|
+
print: {raw: "print"},
|
|
36
111
|
},
|
|
37
112
|
fontFamily: {
|
|
38
113
|
sans: ["Roboto", ...defaultTheme.fontFamily.sans],
|
|
39
114
|
},
|
|
40
|
-
borderColor: colorVariables,
|
|
41
|
-
backgroundColor: colorVariables,
|
|
42
|
-
textColor: colorVariables,
|
|
43
115
|
extend: {
|
|
44
116
|
height: {
|
|
45
117
|
fit: "fit-content",
|
|
@@ -47,6 +119,9 @@ module.exports = {
|
|
|
47
119
|
width: {
|
|
48
120
|
fit: "fit-content",
|
|
49
121
|
},
|
|
122
|
+
maxWidth: {
|
|
123
|
+
fit: "fit-content",
|
|
124
|
+
},
|
|
50
125
|
minWidth: {
|
|
51
126
|
10: "2.5rem",
|
|
52
127
|
32: "8rem",
|
|
@@ -90,5 +165,5 @@ module.exports = {
|
|
|
90
165
|
borderColor: ["active"],
|
|
91
166
|
},
|
|
92
167
|
},
|
|
93
|
-
plugins: [plugin(
|
|
168
|
+
plugins: [plugin(themesPlugin)],
|
|
94
169
|
};
|
package/themes.plugin.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const postcss = require('postcss');
|
|
4
|
+
const postcssrc = require('postcss-load-config');
|
|
5
|
+
const postcssJs = require('postcss-js');
|
|
6
|
+
|
|
7
|
+
function hexToRGB(hex) {
|
|
8
|
+
var r = parseInt(hex.slice(1, 3), 16),
|
|
9
|
+
g = parseInt(hex.slice(3, 5), 16),
|
|
10
|
+
b = parseInt(hex.slice(5, 7), 16);
|
|
11
|
+
|
|
12
|
+
return r + ", " + g + ", " + b;
|
|
13
|
+
}
|
|
14
|
+
let hasRun = false;
|
|
15
|
+
|
|
16
|
+
function addThemes({ addBase, addComponents, theme,config }) {
|
|
17
|
+
if(hasRun){
|
|
18
|
+
return
|
|
19
|
+
}
|
|
20
|
+
hasRun = true;
|
|
21
|
+
function extractColorVars(colorObj, colorGroup = "") {
|
|
22
|
+
return Object.keys(colorObj).reduce(
|
|
23
|
+
(vars, colorKey) => {
|
|
24
|
+
const value = colorObj[colorKey];
|
|
25
|
+
|
|
26
|
+
const newVars =
|
|
27
|
+
typeof value === "string"
|
|
28
|
+
? {
|
|
29
|
+
[`--color${colorGroup}-${colorKey}`]: value,
|
|
30
|
+
[`--color${colorGroup}-${colorKey}-rgb`]: hexToRGB(value),
|
|
31
|
+
}
|
|
32
|
+
: extractColorVars(value, `-${colorKey}`);
|
|
33
|
+
|
|
34
|
+
return { ...vars, ...newVars };
|
|
35
|
+
},
|
|
36
|
+
{ }
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
const base = {
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
const themes = config("themes");
|
|
44
|
+
const defaultTheme = config('defaultTheme');
|
|
45
|
+
for (const customTheme in themes) {
|
|
46
|
+
|
|
47
|
+
const customThemeObject = require(themes[customTheme]);
|
|
48
|
+
if (customThemeObject.overrides) {
|
|
49
|
+
if(config('mode') === 'jit'){
|
|
50
|
+
console.log('Loading theme css from source!')
|
|
51
|
+
const css = fs.readFileSync(path.resolve(path.dirname(themes[customTheme]),'overrides/index.css')).toString();
|
|
52
|
+
const ctx = { };
|
|
53
|
+
const {plugins, options} = postcssrc.sync(ctx)
|
|
54
|
+
const result = postcss(plugins)
|
|
55
|
+
.process(css, options).root;
|
|
56
|
+
const cssJs = postcssJs.objectify(result);
|
|
57
|
+
addComponents({[`.${customTheme}`]: cssJs});
|
|
58
|
+
}else{
|
|
59
|
+
customThemeObject.overrides.forEach(async(override) => {
|
|
60
|
+
const cssJs = require(path.resolve(path.dirname(themes[customTheme]),override));
|
|
61
|
+
addComponents({[`.${customTheme}`]: cssJs});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (customTheme === defaultTheme) {
|
|
66
|
+
base[`:root,:root.${customTheme},::before,::after`] = extractColorVars(customThemeObject.colors);
|
|
67
|
+
} else {
|
|
68
|
+
base[`:root.${customTheme},.${customTheme} *::before,.${customTheme} *::after`] = extractColorVars(customThemeObject.colors);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
addBase(base);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
module.exports = addThemes;
|
package/color-vars.plugin.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
function addColorVars ({ addBase, theme }) {
|
|
3
|
-
function extractColorVars(colorObj, colorGroup = '') {
|
|
4
|
-
return Object.keys(colorObj).reduce((vars, colorKey) => {
|
|
5
|
-
const value = colorObj[colorKey];
|
|
6
|
-
|
|
7
|
-
const newVars =
|
|
8
|
-
typeof value === 'string'
|
|
9
|
-
? { [`--color${colorGroup}-${colorKey}`]: value }
|
|
10
|
-
: extractColorVars(value, `-${colorKey}`);
|
|
11
|
-
|
|
12
|
-
return { ...vars, ...newVars };
|
|
13
|
-
}, {});
|
|
14
|
-
}
|
|
15
|
-
addBase({
|
|
16
|
-
':root,:root.light': extractColorVars(theme('themes').light),
|
|
17
|
-
':root.dark': extractColorVars(theme('themes').dark),
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = addColorVars;
|