@digigov/css 1.0.0-266e80f3 → 1.0.0-3bfc7d37
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/base/index.css +1 -3
- package/dist/base.js +1 -1
- package/dist/components.js +1 -1
- package/dist/digigov.css +3 -5
- package/dist/utilities/index.css +1 -1
- package/dist/utilities.js +1 -1
- package/index.js +1 -1
- package/package.json +7 -7
- package/postcss.config.js +15 -14
- package/src/base/index.css +3 -0
- package/src/base/postcss.config.js +23 -22
- package/src/base/tailwind.config.js +19 -15
- package/src/components/card.css +13 -1
- package/src/components/footer.css +1 -0
- package/src/components/nav.css +1 -1
- package/src/components/postcss.config.js +15 -16
- package/src/components/stepnav.css +11 -0
- package/src/components/tailwind.config.js +12 -6
- package/src/components/task-list.css +8 -0
- package/src/components/timeline.css +14 -6
- package/src/components/typography.css +13 -1
- package/src/fonts.css +1 -1
- package/src/index.css +0 -2
- package/src/utilities/index.css +1 -1
- package/src/utilities/postcss.config.js +15 -16
- package/src/utilities/tailwind.config.js +10 -1
- package/src/utilities/utilities.css +10 -10
- package/tailwind.config.js +18 -27
- package/themes.plugin.js +94 -99
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/** @type {import('postcss-load-config').Config} */
|
|
2
|
+
const config = {
|
|
2
3
|
plugins: [
|
|
3
|
-
require(
|
|
4
|
-
require(
|
|
5
|
-
require(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}),
|
|
10
|
-
require('autoprefixer'),
|
|
11
|
-
require('cssnano')({
|
|
12
|
-
"preset": [
|
|
4
|
+
require("postcss-import"),
|
|
5
|
+
require("tailwindcss/nesting"),
|
|
6
|
+
require("tailwindcss")("./src/utilities/tailwind.config.js"),
|
|
7
|
+
require("autoprefixer"),
|
|
8
|
+
require("cssnano")({
|
|
9
|
+
preset: [
|
|
13
10
|
"default",
|
|
14
11
|
{
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
]
|
|
12
|
+
mergeRules: false,
|
|
13
|
+
},
|
|
14
|
+
],
|
|
18
15
|
}),
|
|
19
|
-
]
|
|
20
|
-
}
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
module.exports = config;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
const tailwindConfig = require("../../tailwind.config");
|
|
2
|
+
|
|
3
|
+
/** @type {import('tailwindcss').Config} */
|
|
4
|
+
module.exports = {
|
|
5
|
+
...tailwindConfig,
|
|
6
|
+
content: {
|
|
7
|
+
files: ["./*.css"],
|
|
8
|
+
relative: true,
|
|
9
|
+
},
|
|
10
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
@layer utilities {
|
|
3
3
|
.govgr-m-0 {
|
|
4
4
|
@apply m-0 !important;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
.govgr-m-1 {
|
|
7
7
|
@apply m-1 !important;
|
|
8
8
|
}
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
.govgr-mt-0 {
|
|
43
43
|
@apply mt-0 !important;
|
|
44
|
-
}
|
|
44
|
+
}
|
|
45
45
|
.govgr-mt-1 {
|
|
46
46
|
@apply mt-1 !important;
|
|
47
47
|
}
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
}
|
|
81
81
|
.govgr-mb-0 {
|
|
82
82
|
@apply mb-0 !important;
|
|
83
|
-
}
|
|
83
|
+
}
|
|
84
84
|
.govgr-mb-1 {
|
|
85
85
|
@apply mb-1 !important;
|
|
86
86
|
}
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
}
|
|
120
120
|
.govgr-ml-0 {
|
|
121
121
|
@apply ml-0 !important;
|
|
122
|
-
}
|
|
122
|
+
}
|
|
123
123
|
.govgr-ml-1 {
|
|
124
124
|
@apply ml-1 !important;
|
|
125
125
|
}
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
}
|
|
159
159
|
.govgr-mr-0 {
|
|
160
160
|
@apply mr-0 !important;
|
|
161
|
-
}
|
|
161
|
+
}
|
|
162
162
|
.govgr-mr-1 {
|
|
163
163
|
@apply mr-1 !important;
|
|
164
164
|
}
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
}
|
|
198
198
|
.govgr-p-0 {
|
|
199
199
|
@apply p-0 !important;
|
|
200
|
-
}
|
|
200
|
+
}
|
|
201
201
|
.govgr-p-1 {
|
|
202
202
|
@apply p-1 !important;
|
|
203
203
|
}
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
}
|
|
237
237
|
.govgr-pt-0 {
|
|
238
238
|
@apply pt-0 !important;
|
|
239
|
-
}
|
|
239
|
+
}
|
|
240
240
|
.govgr-pt-1 {
|
|
241
241
|
@apply pt-1 !important;
|
|
242
242
|
}
|
|
@@ -275,7 +275,7 @@
|
|
|
275
275
|
}
|
|
276
276
|
.govgr-pb-0 {
|
|
277
277
|
@apply pb-0 !important;
|
|
278
|
-
}
|
|
278
|
+
}
|
|
279
279
|
.govgr-pb-1 {
|
|
280
280
|
@apply pb-1 !important;
|
|
281
281
|
}
|
|
@@ -314,7 +314,7 @@
|
|
|
314
314
|
}
|
|
315
315
|
.govgr-pl-0 {
|
|
316
316
|
@apply pl-0 !important;
|
|
317
|
-
}
|
|
317
|
+
}
|
|
318
318
|
.govgr-pl-1 {
|
|
319
319
|
@apply pl-1 !important;
|
|
320
320
|
}
|
|
@@ -353,7 +353,7 @@
|
|
|
353
353
|
}
|
|
354
354
|
.govgr-pr-0 {
|
|
355
355
|
@apply pr-0 !important;
|
|
356
|
-
}
|
|
356
|
+
}
|
|
357
357
|
.govgr-pr-1 {
|
|
358
358
|
@apply pr-1 !important;
|
|
359
359
|
}
|
package/tailwind.config.js
CHANGED
|
@@ -64,14 +64,8 @@ const allColors = [
|
|
|
64
64
|
"shadow600",
|
|
65
65
|
];
|
|
66
66
|
|
|
67
|
-
const buildOnly = !process.env["DIGIGOV_CSS_BUILD"]
|
|
68
|
-
? {
|
|
69
|
-
mode: "jit",
|
|
70
|
-
}
|
|
71
|
-
: {};
|
|
72
|
-
|
|
73
67
|
const colorVariables = allColors.reduce((colorVars, color) => {
|
|
74
|
-
if ([
|
|
68
|
+
if (["transparent", "currentColor"].includes(color)) {
|
|
75
69
|
colorVars[color] = color;
|
|
76
70
|
} else {
|
|
77
71
|
colorVars[color] = ({ opacityVariable, opacityValue }) => {
|
|
@@ -87,13 +81,17 @@ const colorVariables = allColors.reduce((colorVars, color) => {
|
|
|
87
81
|
return colorVars;
|
|
88
82
|
}, {});
|
|
89
83
|
|
|
84
|
+
/** @type {import('tailwindcss').Config} */
|
|
90
85
|
module.exports = {
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
darkMode: "class",
|
|
87
|
+
content: {
|
|
88
|
+
files: ["./src/*.css"],
|
|
89
|
+
relative: true,
|
|
90
|
+
},
|
|
93
91
|
themes: {
|
|
94
|
-
light: require.resolve(
|
|
92
|
+
light: require.resolve("./defaultTheme"),
|
|
95
93
|
},
|
|
96
|
-
defaultTheme:
|
|
94
|
+
defaultTheme: "light",
|
|
97
95
|
theme: {
|
|
98
96
|
colors: colorVariables,
|
|
99
97
|
container: {
|
|
@@ -111,11 +109,11 @@ module.exports = {
|
|
|
111
109
|
xl: "1280px",
|
|
112
110
|
"2xl": "1280px",
|
|
113
111
|
print: { raw: "print" },
|
|
114
|
-
xsOnly: {
|
|
115
|
-
smOnly: {
|
|
116
|
-
mdOnly: {
|
|
117
|
-
lgOnly: {
|
|
118
|
-
xlOnly: {
|
|
112
|
+
xsOnly: { min: "0px", max: "639.98px" },
|
|
113
|
+
smOnly: { min: "640px", max: "767.98px" },
|
|
114
|
+
mdOnly: { min: "768px", max: "1023.98px" },
|
|
115
|
+
lgOnly: { min: "1024px", max: "1279.98px" },
|
|
116
|
+
xlOnly: { min: "1280px", max: "1535.98px" },
|
|
119
117
|
},
|
|
120
118
|
fontFamily: {
|
|
121
119
|
sans: ["Roboto", ...defaultTheme.fontFamily.sans],
|
|
@@ -126,8 +124,8 @@ module.exports = {
|
|
|
126
124
|
},
|
|
127
125
|
width: {
|
|
128
126
|
fit: "fit-content",
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
"2xl": "42rem",
|
|
128
|
+
"4xl": "56rem",
|
|
131
129
|
},
|
|
132
130
|
maxWidth: {
|
|
133
131
|
fit: "fit-content",
|
|
@@ -171,15 +169,8 @@ module.exports = {
|
|
|
171
169
|
borderColor: {
|
|
172
170
|
// TODO: fix this invalid value in the future
|
|
173
171
|
// Read more: https://gitlab.grnet.gr/devs/digigov/digigov-sdk/-/merge_requests/818
|
|
174
|
-
DEFAULT:
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
variants: {
|
|
179
|
-
extend: {
|
|
180
|
-
textDecoration: ["active"],
|
|
181
|
-
backgroundColor: ["active"],
|
|
182
|
-
borderColor: ["active"],
|
|
172
|
+
DEFAULT: "reset",
|
|
173
|
+
},
|
|
183
174
|
},
|
|
184
175
|
},
|
|
185
176
|
plugins: [plugin(themesPlugin)],
|
package/themes.plugin.js
CHANGED
|
@@ -13,85 +13,13 @@ const mediaQueriesMapping = {
|
|
|
13
13
|
print: "@media print",
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
function hexToRGB(hex) {
|
|
17
|
-
var r = parseInt(hex.slice(1, 3), 16),
|
|
18
|
-
g = parseInt(hex.slice(3, 5), 16),
|
|
19
|
-
b = parseInt(hex.slice(5, 7), 16);
|
|
20
|
-
|
|
21
|
-
return r + ", " + g + ", " + b;
|
|
22
|
-
}
|
|
23
16
|
let hasRun = false;
|
|
24
17
|
|
|
25
|
-
function addThemes({ addBase,
|
|
18
|
+
module.exports = function addThemes({ addBase, config }) {
|
|
26
19
|
if (hasRun) {
|
|
27
20
|
return;
|
|
28
21
|
}
|
|
29
22
|
hasRun = true;
|
|
30
|
-
function extractColorVars(colorObj, colorGroup = "") {
|
|
31
|
-
return Object.keys(colorObj).reduce((vars, colorKey) => {
|
|
32
|
-
const value = colorObj[colorKey];
|
|
33
|
-
const colorName =
|
|
34
|
-
colorKey == "default"
|
|
35
|
-
? `--color${colorGroup}`
|
|
36
|
-
: `--color${colorGroup}-${colorKey}`;
|
|
37
|
-
const newVars =
|
|
38
|
-
typeof value === "string"
|
|
39
|
-
? {
|
|
40
|
-
[colorName]: value,
|
|
41
|
-
[`${colorName}-rgb`]: hexToRGB(value),
|
|
42
|
-
}
|
|
43
|
-
: extractColorVars(value, `-${colorKey}`);
|
|
44
|
-
return { ...vars, ...newVars };
|
|
45
|
-
}, {});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function extractMediaQueriesFromComponentVars(componentObj, customTheme) {
|
|
49
|
-
let mediaObj = {};
|
|
50
|
-
Object.keys(componentObj).forEach((componentClass) => {
|
|
51
|
-
Object.keys(componentObj[componentClass]).forEach((componentAttr) => {
|
|
52
|
-
Object.keys(componentObj[componentClass][componentAttr]).forEach(
|
|
53
|
-
(componentMedia) => {
|
|
54
|
-
const newAttrKey = `--${componentClass}-${componentAttr}`;
|
|
55
|
-
const newAttrValue =
|
|
56
|
-
componentObj[componentClass][componentAttr][componentMedia];
|
|
57
|
-
const newAttr = { [newAttrKey]: newAttrValue };
|
|
58
|
-
const newClass = `.${prefix}-${componentClass}`;
|
|
59
|
-
const newMedia = mediaQueriesMapping[componentMedia];
|
|
60
|
-
const newTheme =
|
|
61
|
-
customTheme === defaultTheme ? "" : `.${customTheme}`;
|
|
62
|
-
|
|
63
|
-
if (mediaObj[newMedia]) {
|
|
64
|
-
if (mediaObj[newMedia][newTheme][newClass]) {
|
|
65
|
-
mediaObj[newMedia][newTheme][newClass][newAttrKey] =
|
|
66
|
-
newAttrValue;
|
|
67
|
-
} else {
|
|
68
|
-
mediaObj[newMedia][newTheme][newClass] = newAttr;
|
|
69
|
-
}
|
|
70
|
-
} else {
|
|
71
|
-
mediaObj[newMedia] = { [newTheme]: { [newClass]: newAttr } };
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
return mediaObj;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function extractGlobalVars(globalVarsObj) {
|
|
81
|
-
return Object.keys(globalVarsObj).reduce((vars, varKey) => {
|
|
82
|
-
const value = globalVarsObj[varKey];
|
|
83
|
-
vars[`--${varKey}`] = value;
|
|
84
|
-
return vars;
|
|
85
|
-
}, {});
|
|
86
|
-
}
|
|
87
|
-
function extractVars(themeObj) {
|
|
88
|
-
const colorVars = extractColorVars(themeObj.colors);
|
|
89
|
-
const globalVars =
|
|
90
|
-
themeObj.variables && themeObj.variables.globals
|
|
91
|
-
? extractGlobalVars(themeObj.variables.globals)
|
|
92
|
-
: {};
|
|
93
|
-
return { ...colorVars, ...globalVars };
|
|
94
|
-
}
|
|
95
23
|
|
|
96
24
|
let base = {};
|
|
97
25
|
const themes = config("themes");
|
|
@@ -99,44 +27,35 @@ function addThemes({ addBase, addComponents, theme, config }) {
|
|
|
99
27
|
for (const customTheme in themes) {
|
|
100
28
|
const customThemeObject = require(themes[customTheme]);
|
|
101
29
|
if (customThemeObject.overrides) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
.
|
|
106
|
-
path.resolve(
|
|
107
|
-
path.dirname(themes[customTheme]),
|
|
108
|
-
"overrides/index.css"
|
|
109
|
-
)
|
|
110
|
-
)
|
|
111
|
-
.toString();
|
|
112
|
-
const ctx = {};
|
|
113
|
-
const { plugins, options } = postcssrc.sync(ctx);
|
|
114
|
-
const result = postcss(plugins).process(css, options).root;
|
|
115
|
-
const cssJs = postcssJs.objectify(result);
|
|
116
|
-
base[`.${customTheme}`] = cssJs;
|
|
117
|
-
} else {
|
|
118
|
-
customThemeObject.overrides.forEach((override) => {
|
|
119
|
-
const cssJs = require(path.resolve(
|
|
30
|
+
console.log("Loading theme css from source...");
|
|
31
|
+
const css = fs
|
|
32
|
+
.readFileSync(
|
|
33
|
+
path.resolve(
|
|
120
34
|
path.dirname(themes[customTheme]),
|
|
121
|
-
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
35
|
+
"overrides/index.css",
|
|
36
|
+
),
|
|
37
|
+
)
|
|
38
|
+
.toString();
|
|
39
|
+
const ctx = {};
|
|
40
|
+
const { plugins, options } = postcssrc.sync(ctx);
|
|
41
|
+
const result = postcss(plugins).process(css, options).result.root;
|
|
42
|
+
const cssJs = postcssJs.objectify(result);
|
|
43
|
+
base[`.${customTheme}`] = cssJs;
|
|
126
44
|
}
|
|
127
45
|
if (customTheme === defaultTheme) {
|
|
128
46
|
base[`:root,:root.${customTheme},::before,::after`] =
|
|
129
47
|
extractVars(customThemeObject);
|
|
130
48
|
} else {
|
|
131
49
|
base[
|
|
132
|
-
`:root.${customTheme},.${customTheme} *::before,.${customTheme} *::after`
|
|
50
|
+
`:root.${customTheme},.${customTheme},.${customTheme} *::before,.${customTheme} *::after`
|
|
133
51
|
] = extractVars(customThemeObject);
|
|
134
52
|
}
|
|
135
53
|
|
|
136
54
|
if (customThemeObject.variables && customThemeObject.variables.components) {
|
|
137
55
|
const extractedVariables = extractMediaQueriesFromComponentVars(
|
|
138
56
|
customThemeObject.variables.components,
|
|
139
|
-
customTheme
|
|
57
|
+
customTheme,
|
|
58
|
+
defaultTheme,
|
|
140
59
|
);
|
|
141
60
|
Object.keys(extractedVariables).forEach((key) => {
|
|
142
61
|
if (base[key]) {
|
|
@@ -148,6 +67,82 @@ function addThemes({ addBase, addComponents, theme, config }) {
|
|
|
148
67
|
}
|
|
149
68
|
}
|
|
150
69
|
addBase(base);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
function extractVars(themeObj) {
|
|
73
|
+
const colorVars = extractColorVars(themeObj.colors);
|
|
74
|
+
const globalVars =
|
|
75
|
+
themeObj.variables && themeObj.variables.globals
|
|
76
|
+
? extractGlobalVars(themeObj.variables.globals)
|
|
77
|
+
: {};
|
|
78
|
+
return { ...colorVars, ...globalVars };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function extractColorVars(colorObj, colorGroup = "") {
|
|
82
|
+
return Object.keys(colorObj).reduce((vars, colorKey) => {
|
|
83
|
+
const value = colorObj[colorKey];
|
|
84
|
+
const colorName =
|
|
85
|
+
colorKey == "default"
|
|
86
|
+
? `--color${colorGroup}`
|
|
87
|
+
: `--color${colorGroup}-${colorKey}`;
|
|
88
|
+
const newVars =
|
|
89
|
+
typeof value === "string"
|
|
90
|
+
? {
|
|
91
|
+
[colorName]: value,
|
|
92
|
+
[`${colorName}-rgb`]: hexToRGB(value),
|
|
93
|
+
}
|
|
94
|
+
: extractColorVars(value, `-${colorKey}`);
|
|
95
|
+
return { ...vars, ...newVars };
|
|
96
|
+
}, {});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function extractGlobalVars(globalVarsObj) {
|
|
100
|
+
return Object.keys(globalVarsObj).reduce((vars, varKey) => {
|
|
101
|
+
const value = globalVarsObj[varKey];
|
|
102
|
+
vars[`--${varKey}`] = value;
|
|
103
|
+
return vars;
|
|
104
|
+
}, {});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function hexToRGB(hex) {
|
|
108
|
+
const r = parseInt(hex.slice(1, 3), 16),
|
|
109
|
+
g = parseInt(hex.slice(3, 5), 16),
|
|
110
|
+
b = parseInt(hex.slice(5, 7), 16);
|
|
111
|
+
|
|
112
|
+
return r + ", " + g + ", " + b;
|
|
151
113
|
}
|
|
152
114
|
|
|
153
|
-
|
|
115
|
+
function extractMediaQueriesFromComponentVars(
|
|
116
|
+
componentObj,
|
|
117
|
+
customTheme,
|
|
118
|
+
defaultTheme,
|
|
119
|
+
) {
|
|
120
|
+
let mediaObj = {};
|
|
121
|
+
Object.keys(componentObj).forEach((componentClass) => {
|
|
122
|
+
Object.keys(componentObj[componentClass]).forEach((componentAttr) => {
|
|
123
|
+
Object.keys(componentObj[componentClass][componentAttr]).forEach(
|
|
124
|
+
(componentMedia) => {
|
|
125
|
+
const newAttrKey = `--${componentClass}-${componentAttr}`;
|
|
126
|
+
const newAttrValue =
|
|
127
|
+
componentObj[componentClass][componentAttr][componentMedia];
|
|
128
|
+
const newAttr = { [newAttrKey]: newAttrValue };
|
|
129
|
+
const newClass = `.${prefix}-${componentClass}`;
|
|
130
|
+
const newMedia = mediaQueriesMapping[componentMedia];
|
|
131
|
+
const newTheme =
|
|
132
|
+
customTheme === defaultTheme ? "" : `.${customTheme}`;
|
|
133
|
+
|
|
134
|
+
if (mediaObj[newMedia]) {
|
|
135
|
+
if (mediaObj[newMedia][newTheme][newClass]) {
|
|
136
|
+
mediaObj[newMedia][newTheme][newClass][newAttrKey] = newAttrValue;
|
|
137
|
+
} else {
|
|
138
|
+
mediaObj[newMedia][newTheme][newClass] = newAttr;
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
mediaObj[newMedia] = { [newTheme]: { [newClass]: newAttr } };
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
return mediaObj;
|
|
148
|
+
}
|