@hiscovega/grisso 1.0.5 → 1.0.7
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 +149 -53
- package/dist/grisso.css +1 -1
- package/lib/build.d.ts +2 -0
- package/lib/build.js +15 -2
- package/lib/cli.js +67 -1
- package/lib/defaults.js +8 -0
- package/lib/generators.d.ts +7 -7
- package/lib/generators.js +46 -6
- package/lib/partials/backgrounds.js +8 -8
- package/lib/partials/borders.js +19 -19
- package/lib/partials/effects.js +4 -4
- package/lib/partials/flex-and-grid.js +46 -46
- package/lib/partials/icons.js +2 -2
- package/lib/partials/layout.js +23 -23
- package/lib/partials/sizing.js +9 -9
- package/lib/partials/spacing.js +15 -15
- package/lib/partials/typography.js +17 -17
- package/lib/purge.js +1 -1
- package/lib/resolve-config.d.ts +0 -1
- package/lib/resolve-config.js +5 -2
- package/lib/tokens.d.ts +14 -0
- package/lib/tokens.js +133 -0
- package/lib/types.d.ts +5 -0
- package/package.json +2 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { complexClass, simpleClass } from "../generators.js";
|
|
2
2
|
import { omit } from "../utils.js";
|
|
3
3
|
export default function flexAndGrid(config) {
|
|
4
|
-
const { columns, breakpoints, spacing } = config;
|
|
4
|
+
const { columns, breakpoints, states, spacing } = config;
|
|
5
5
|
let css = "";
|
|
6
6
|
// flex-direction
|
|
7
7
|
const direction = {
|
|
@@ -10,14 +10,14 @@ export default function flexAndGrid(config) {
|
|
|
10
10
|
col: "column",
|
|
11
11
|
"col-reverse": "column-reverse",
|
|
12
12
|
};
|
|
13
|
-
css += complexClass("flex-", "flex-direction", direction, breakpoints);
|
|
13
|
+
css += complexClass("flex-", "flex-direction", direction, breakpoints, states);
|
|
14
14
|
// flex-wrap
|
|
15
15
|
const wrap = {
|
|
16
16
|
wrap: "wrap",
|
|
17
17
|
"wrap-reverse": "wrap-reverse",
|
|
18
18
|
nowrap: "nowrap",
|
|
19
19
|
};
|
|
20
|
-
css += complexClass("flex-", "flex-wrap", wrap, breakpoints);
|
|
20
|
+
css += complexClass("flex-", "flex-wrap", wrap, breakpoints, states);
|
|
21
21
|
// flex (shorthand)
|
|
22
22
|
const flex = {
|
|
23
23
|
"1": "1 1 0",
|
|
@@ -25,20 +25,20 @@ export default function flexAndGrid(config) {
|
|
|
25
25
|
initial: "0 1 auto",
|
|
26
26
|
none: "none",
|
|
27
27
|
};
|
|
28
|
-
css += complexClass("flex-", "flex", flex, breakpoints);
|
|
28
|
+
css += complexClass("flex-", "flex", flex, breakpoints, states);
|
|
29
29
|
// flex-grow
|
|
30
|
-
css += simpleClass("grow", "flex-grow", "1", breakpoints);
|
|
31
|
-
css += simpleClass("grow-0", "flex-grow", "0", breakpoints);
|
|
30
|
+
css += simpleClass("grow", "flex-grow", "1", breakpoints, states);
|
|
31
|
+
css += simpleClass("grow-0", "flex-grow", "0", breakpoints, states);
|
|
32
32
|
// flex-shrink
|
|
33
|
-
css += simpleClass("shrink", "flex-shrink", "1", breakpoints);
|
|
34
|
-
css += simpleClass("shrink-0", "flex-shrink", "0", breakpoints);
|
|
33
|
+
css += simpleClass("shrink", "flex-shrink", "1", breakpoints, states);
|
|
34
|
+
css += simpleClass("shrink-0", "flex-shrink", "0", breakpoints, states);
|
|
35
35
|
// order
|
|
36
36
|
for (let i = 1; i <= columns; i++) {
|
|
37
|
-
css += simpleClass(`order-${i}`, "order", String(i), breakpoints);
|
|
37
|
+
css += simpleClass(`order-${i}`, "order", String(i), breakpoints, states);
|
|
38
38
|
}
|
|
39
|
-
css += simpleClass("order-first", "order", "-9999", breakpoints);
|
|
40
|
-
css += simpleClass("order-last", "order", "9999", breakpoints);
|
|
41
|
-
css += simpleClass("order-none", "order", "0", breakpoints);
|
|
39
|
+
css += simpleClass("order-first", "order", "-9999", breakpoints, states);
|
|
40
|
+
css += simpleClass("order-last", "order", "9999", breakpoints, states);
|
|
41
|
+
css += simpleClass("order-none", "order", "0", breakpoints, states);
|
|
42
42
|
// justify-items
|
|
43
43
|
const justifyItems = {
|
|
44
44
|
start: "start",
|
|
@@ -46,7 +46,7 @@ export default function flexAndGrid(config) {
|
|
|
46
46
|
center: "center",
|
|
47
47
|
stretch: "stretch",
|
|
48
48
|
};
|
|
49
|
-
css += complexClass("justify-items-", "justify-items", justifyItems, breakpoints);
|
|
49
|
+
css += complexClass("justify-items-", "justify-items", justifyItems, breakpoints, states);
|
|
50
50
|
// justify-content
|
|
51
51
|
const justifyContent = {
|
|
52
52
|
normal: "normal",
|
|
@@ -58,7 +58,7 @@ export default function flexAndGrid(config) {
|
|
|
58
58
|
evenly: "space-evenly",
|
|
59
59
|
stretch: "stretch",
|
|
60
60
|
};
|
|
61
|
-
css += complexClass("justify-", "justify-content", justifyContent, breakpoints);
|
|
61
|
+
css += complexClass("justify-", "justify-content", justifyContent, breakpoints, states);
|
|
62
62
|
// align-items
|
|
63
63
|
const alignItems = {
|
|
64
64
|
start: "flex-start",
|
|
@@ -67,7 +67,7 @@ export default function flexAndGrid(config) {
|
|
|
67
67
|
baseline: "baseline",
|
|
68
68
|
stretch: "stretch",
|
|
69
69
|
};
|
|
70
|
-
css += complexClass("items-", "align-items", alignItems, breakpoints);
|
|
70
|
+
css += complexClass("items-", "align-items", alignItems, breakpoints, states);
|
|
71
71
|
// align-content
|
|
72
72
|
const alignContent = {
|
|
73
73
|
normal: "normal",
|
|
@@ -80,7 +80,7 @@ export default function flexAndGrid(config) {
|
|
|
80
80
|
baseline: "baseline",
|
|
81
81
|
stretch: "stretch",
|
|
82
82
|
};
|
|
83
|
-
css += complexClass("content-", "align-content", alignContent, breakpoints);
|
|
83
|
+
css += complexClass("content-", "align-content", alignContent, breakpoints, states);
|
|
84
84
|
// align-self
|
|
85
85
|
const alignSelf = {
|
|
86
86
|
auto: "normal",
|
|
@@ -90,7 +90,7 @@ export default function flexAndGrid(config) {
|
|
|
90
90
|
baseline: "baseline",
|
|
91
91
|
stretch: "stretch",
|
|
92
92
|
};
|
|
93
|
-
css += complexClass("self-", "align-self", alignSelf, breakpoints);
|
|
93
|
+
css += complexClass("self-", "align-self", alignSelf, breakpoints, states);
|
|
94
94
|
// justify-self
|
|
95
95
|
const justifySelf = {
|
|
96
96
|
auto: "auto",
|
|
@@ -99,38 +99,38 @@ export default function flexAndGrid(config) {
|
|
|
99
99
|
center: "center",
|
|
100
100
|
stretch: "stretch",
|
|
101
101
|
};
|
|
102
|
-
css += complexClass("justify-self-", "justify-self", justifySelf, breakpoints);
|
|
102
|
+
css += complexClass("justify-self-", "justify-self", justifySelf, breakpoints, states);
|
|
103
103
|
// grid-template-columns
|
|
104
104
|
for (let i = 1; i <= columns; i++) {
|
|
105
|
-
css += simpleClass(`grid-cols-${i}`, "grid-template-columns", `repeat(${i}, minmax(0, 1fr))`, breakpoints);
|
|
105
|
+
css += simpleClass(`grid-cols-${i}`, "grid-template-columns", `repeat(${i}, minmax(0, 1fr))`, breakpoints, states);
|
|
106
106
|
}
|
|
107
|
-
css += simpleClass("grid-cols-none", "grid-template-columns", "none", breakpoints);
|
|
107
|
+
css += simpleClass("grid-cols-none", "grid-template-columns", "none", breakpoints, states);
|
|
108
108
|
// grid-column start/end
|
|
109
|
-
css += simpleClass("col-auto", "grid-column", "auto", breakpoints);
|
|
109
|
+
css += simpleClass("col-auto", "grid-column", "auto", breakpoints, states);
|
|
110
110
|
for (let i = 1; i <= columns; i++) {
|
|
111
|
-
css += simpleClass(`col-span-${i}`, "grid-column", `span ${i} / span ${i}`, breakpoints);
|
|
112
|
-
css += simpleClass(`col-start-${i}`, "grid-column-start", String(i), breakpoints);
|
|
113
|
-
css += simpleClass(`col-end-${i}`, "grid-column-end", String(i), breakpoints);
|
|
111
|
+
css += simpleClass(`col-span-${i}`, "grid-column", `span ${i} / span ${i}`, breakpoints, states);
|
|
112
|
+
css += simpleClass(`col-start-${i}`, "grid-column-start", String(i), breakpoints, states);
|
|
113
|
+
css += simpleClass(`col-end-${i}`, "grid-column-end", String(i), breakpoints, states);
|
|
114
114
|
}
|
|
115
|
-
css += simpleClass("col-end-13", "grid-column-end", "13", breakpoints);
|
|
116
|
-
css += simpleClass("col-span-full", "grid-column", "1 / -1", breakpoints);
|
|
117
|
-
css += simpleClass("col-start-auto", "grid-column-start", "auto", breakpoints);
|
|
118
|
-
css += simpleClass("col-end-auto", "grid-column-end", "auto", breakpoints);
|
|
115
|
+
css += simpleClass("col-end-13", "grid-column-end", "13", breakpoints, states);
|
|
116
|
+
css += simpleClass("col-span-full", "grid-column", "1 / -1", breakpoints, states);
|
|
117
|
+
css += simpleClass("col-start-auto", "grid-column-start", "auto", breakpoints, states);
|
|
118
|
+
css += simpleClass("col-end-auto", "grid-column-end", "auto", breakpoints, states);
|
|
119
119
|
// grid-template-rows
|
|
120
120
|
for (let i = 1; i <= columns; i++) {
|
|
121
|
-
css += simpleClass(`grid-rows-${i}`, "grid-template-rows", `repeat(${i}, minmax(0, 1fr))`, breakpoints);
|
|
121
|
+
css += simpleClass(`grid-rows-${i}`, "grid-template-rows", `repeat(${i}, minmax(0, 1fr))`, breakpoints, states);
|
|
122
122
|
}
|
|
123
|
-
css += simpleClass("grid-rows-none", "grid-template-rows", "none", breakpoints);
|
|
123
|
+
css += simpleClass("grid-rows-none", "grid-template-rows", "none", breakpoints, states);
|
|
124
124
|
// grid-row start/end
|
|
125
|
-
css += simpleClass("row-auto", "grid-row", "auto", breakpoints);
|
|
125
|
+
css += simpleClass("row-auto", "grid-row", "auto", breakpoints, states);
|
|
126
126
|
for (let i = 1; i <= columns; i++) {
|
|
127
|
-
css += simpleClass(`row-span-${i}`, "grid-row", `span ${i} / span ${i}`, breakpoints);
|
|
128
|
-
css += simpleClass(`row-start-${i}`, "grid-row-start", String(i), breakpoints);
|
|
129
|
-
css += simpleClass(`row-end-${i}`, "grid-row-end", String(i), breakpoints);
|
|
127
|
+
css += simpleClass(`row-span-${i}`, "grid-row", `span ${i} / span ${i}`, breakpoints, states);
|
|
128
|
+
css += simpleClass(`row-start-${i}`, "grid-row-start", String(i), breakpoints, states);
|
|
129
|
+
css += simpleClass(`row-end-${i}`, "grid-row-end", String(i), breakpoints, states);
|
|
130
130
|
}
|
|
131
|
-
css += simpleClass("row-span-full", "grid-row", "1 / -1", breakpoints);
|
|
132
|
-
css += simpleClass("row-start-auto", "grid-row-start", "auto", breakpoints);
|
|
133
|
-
css += simpleClass("row-end-auto", "grid-row-end", "auto", breakpoints);
|
|
131
|
+
css += simpleClass("row-span-full", "grid-row", "1 / -1", breakpoints, states);
|
|
132
|
+
css += simpleClass("row-start-auto", "grid-row-start", "auto", breakpoints, states);
|
|
133
|
+
css += simpleClass("row-end-auto", "grid-row-end", "auto", breakpoints, states);
|
|
134
134
|
// grid-auto-flow
|
|
135
135
|
const autoFlow = {
|
|
136
136
|
row: "row",
|
|
@@ -139,7 +139,7 @@ export default function flexAndGrid(config) {
|
|
|
139
139
|
"row-dense": "row dense",
|
|
140
140
|
"col-dense": "column dense",
|
|
141
141
|
};
|
|
142
|
-
css += complexClass("grid-flow-", "grid-auto-flow", autoFlow, breakpoints);
|
|
142
|
+
css += complexClass("grid-flow-", "grid-auto-flow", autoFlow, breakpoints, states);
|
|
143
143
|
// grid-auto-columns
|
|
144
144
|
const autoColumns = {
|
|
145
145
|
auto: "auto",
|
|
@@ -147,7 +147,7 @@ export default function flexAndGrid(config) {
|
|
|
147
147
|
max: "max-content",
|
|
148
148
|
fr: "minmax(0, 1fr)",
|
|
149
149
|
};
|
|
150
|
-
css += complexClass("auto-cols-", "grid-auto-columns", autoColumns, breakpoints);
|
|
150
|
+
css += complexClass("auto-cols-", "grid-auto-columns", autoColumns, breakpoints, states);
|
|
151
151
|
// grid-auto-rows
|
|
152
152
|
const autoRows = {
|
|
153
153
|
auto: "auto",
|
|
@@ -155,12 +155,12 @@ export default function flexAndGrid(config) {
|
|
|
155
155
|
max: "max-content",
|
|
156
156
|
fr: "minmax(0, 1fr)",
|
|
157
157
|
};
|
|
158
|
-
css += complexClass("auto-rows-", "grid-auto-rows", autoRows, breakpoints);
|
|
158
|
+
css += complexClass("auto-rows-", "grid-auto-rows", autoRows, breakpoints, states);
|
|
159
159
|
// gap
|
|
160
160
|
const gap = omit(spacing, "auto");
|
|
161
|
-
css += complexClass("gap-", "gap", gap, breakpoints);
|
|
162
|
-
css += complexClass("gap-x-", "column-gap", gap, breakpoints);
|
|
163
|
-
css += complexClass("gap-y-", "row-gap", gap, breakpoints);
|
|
161
|
+
css += complexClass("gap-", "gap", gap, breakpoints, states);
|
|
162
|
+
css += complexClass("gap-x-", "column-gap", gap, breakpoints, states);
|
|
163
|
+
css += complexClass("gap-y-", "row-gap", gap, breakpoints, states);
|
|
164
164
|
// place-content
|
|
165
165
|
const placeContent = {
|
|
166
166
|
center: "center",
|
|
@@ -172,7 +172,7 @@ export default function flexAndGrid(config) {
|
|
|
172
172
|
baseline: "baseline",
|
|
173
173
|
stretch: "stretch",
|
|
174
174
|
};
|
|
175
|
-
css += complexClass("place-content-", "place-content", placeContent, breakpoints);
|
|
175
|
+
css += complexClass("place-content-", "place-content", placeContent, breakpoints, states);
|
|
176
176
|
// place-items
|
|
177
177
|
const placeItems = {
|
|
178
178
|
start: "start",
|
|
@@ -181,7 +181,7 @@ export default function flexAndGrid(config) {
|
|
|
181
181
|
baseline: "baseline",
|
|
182
182
|
stretch: "stretch",
|
|
183
183
|
};
|
|
184
|
-
css += complexClass("place-items-", "place-items", placeItems, breakpoints);
|
|
184
|
+
css += complexClass("place-items-", "place-items", placeItems, breakpoints, states);
|
|
185
185
|
// place-self
|
|
186
186
|
const placeSelf = {
|
|
187
187
|
auto: "auto",
|
|
@@ -190,6 +190,6 @@ export default function flexAndGrid(config) {
|
|
|
190
190
|
center: "center",
|
|
191
191
|
stretch: "stretch",
|
|
192
192
|
};
|
|
193
|
-
css += complexClass("place-self-", "place-self", placeSelf, breakpoints);
|
|
193
|
+
css += complexClass("place-self-", "place-self", placeSelf, breakpoints, states);
|
|
194
194
|
return css;
|
|
195
195
|
}
|
package/lib/partials/icons.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { complexClass } from "../generators.js";
|
|
2
2
|
export default function icons(config) {
|
|
3
|
-
const { breakpoints, iconColors } = config;
|
|
4
|
-
return complexClass("icon-", "color", iconColors, breakpoints);
|
|
3
|
+
const { breakpoints, states, iconColors } = config;
|
|
4
|
+
return complexClass("icon-", "color", iconColors, breakpoints, states);
|
|
5
5
|
}
|
package/lib/partials/layout.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { complexClass, customClass, simpleClass } from "../generators.js";
|
|
2
2
|
export default function layout(config) {
|
|
3
|
-
const { columns, breakpoints, spacing } = config;
|
|
3
|
+
const { columns, breakpoints, states, spacing } = config;
|
|
4
4
|
let css = "";
|
|
5
5
|
// display
|
|
6
6
|
const display = {
|
|
@@ -26,10 +26,10 @@ export default function layout(config) {
|
|
|
26
26
|
"list-item": "list-item",
|
|
27
27
|
hidden: "none",
|
|
28
28
|
};
|
|
29
|
-
css += complexClass("", "display", display, breakpoints);
|
|
29
|
+
css += complexClass("", "display", display, breakpoints, states);
|
|
30
30
|
// columns (numeric)
|
|
31
31
|
for (let i = 1; i <= columns; i++) {
|
|
32
|
-
css += simpleClass(`columns-${i}`, "columns", String(i), breakpoints);
|
|
32
|
+
css += simpleClass(`columns-${i}`, "columns", String(i), breakpoints, states);
|
|
33
33
|
}
|
|
34
34
|
// float
|
|
35
35
|
const float = {
|
|
@@ -37,7 +37,7 @@ export default function layout(config) {
|
|
|
37
37
|
right: "right",
|
|
38
38
|
none: "none",
|
|
39
39
|
};
|
|
40
|
-
css += complexClass("float-", "float", float, breakpoints);
|
|
40
|
+
css += complexClass("float-", "float", float, breakpoints, states);
|
|
41
41
|
// clear
|
|
42
42
|
const clear = {
|
|
43
43
|
left: "left",
|
|
@@ -45,7 +45,7 @@ export default function layout(config) {
|
|
|
45
45
|
both: "both",
|
|
46
46
|
none: "none",
|
|
47
47
|
};
|
|
48
|
-
css += complexClass("clear-", "clear", clear, breakpoints);
|
|
48
|
+
css += complexClass("clear-", "clear", clear, breakpoints, states);
|
|
49
49
|
// object-fit
|
|
50
50
|
const objectFit = {
|
|
51
51
|
contain: "contain",
|
|
@@ -54,7 +54,7 @@ export default function layout(config) {
|
|
|
54
54
|
none: "none",
|
|
55
55
|
"scale-down": "scale-down",
|
|
56
56
|
};
|
|
57
|
-
css += complexClass("object-", "object-fit", objectFit, breakpoints);
|
|
57
|
+
css += complexClass("object-", "object-fit", objectFit, breakpoints, states);
|
|
58
58
|
// object-position
|
|
59
59
|
const objectPosition = {
|
|
60
60
|
bottom: "bottom",
|
|
@@ -67,7 +67,7 @@ export default function layout(config) {
|
|
|
67
67
|
"right-top": "right top",
|
|
68
68
|
top: "top",
|
|
69
69
|
};
|
|
70
|
-
css += complexClass("object-", "object-position", objectPosition, breakpoints);
|
|
70
|
+
css += complexClass("object-", "object-position", objectPosition, breakpoints, states);
|
|
71
71
|
// overflow
|
|
72
72
|
const overflow = {
|
|
73
73
|
auto: "auto",
|
|
@@ -76,9 +76,9 @@ export default function layout(config) {
|
|
|
76
76
|
visible: "visible",
|
|
77
77
|
scroll: "scroll",
|
|
78
78
|
};
|
|
79
|
-
css += complexClass("overflow-", "overflow", overflow, breakpoints);
|
|
80
|
-
css += complexClass("overflow-x-", "overflow-x", overflow, breakpoints);
|
|
81
|
-
css += complexClass("overflow-y-", "overflow-y", overflow, breakpoints);
|
|
79
|
+
css += complexClass("overflow-", "overflow", overflow, breakpoints, states);
|
|
80
|
+
css += complexClass("overflow-x-", "overflow-x", overflow, breakpoints, states);
|
|
81
|
+
css += complexClass("overflow-y-", "overflow-y", overflow, breakpoints, states);
|
|
82
82
|
// position
|
|
83
83
|
const position = {
|
|
84
84
|
static: "static",
|
|
@@ -87,11 +87,11 @@ export default function layout(config) {
|
|
|
87
87
|
relative: "relative",
|
|
88
88
|
sticky: "sticky",
|
|
89
89
|
};
|
|
90
|
-
css += complexClass("", "position", position, breakpoints);
|
|
90
|
+
css += complexClass("", "position", position, breakpoints, states);
|
|
91
91
|
// visibility
|
|
92
|
-
css += simpleClass("visible", "visibility", "visible", breakpoints);
|
|
93
|
-
css += simpleClass("invisible", "visibility", "hidden", breakpoints);
|
|
94
|
-
css += simpleClass("collapse", "visibility", "collapse", breakpoints);
|
|
92
|
+
css += simpleClass("visible", "visibility", "visible", breakpoints, states);
|
|
93
|
+
css += simpleClass("invisible", "visibility", "hidden", breakpoints, states);
|
|
94
|
+
css += simpleClass("collapse", "visibility", "collapse", breakpoints, states);
|
|
95
95
|
// z-index
|
|
96
96
|
const zIndex = {
|
|
97
97
|
auto: "auto",
|
|
@@ -109,22 +109,22 @@ export default function layout(config) {
|
|
|
109
109
|
"40": "-40",
|
|
110
110
|
"50": "-50",
|
|
111
111
|
};
|
|
112
|
-
css += complexClass("z-", "z-index", zIndex, breakpoints);
|
|
113
|
-
css += complexClass("-z-", "z-index", zIndexNeg, breakpoints);
|
|
112
|
+
css += complexClass("z-", "z-index", zIndex, breakpoints, states);
|
|
113
|
+
css += complexClass("-z-", "z-index", zIndexNeg, breakpoints, states);
|
|
114
114
|
// top/right/bottom/left
|
|
115
|
-
css += complexClass("top-", "top", spacing, breakpoints);
|
|
116
|
-
css += complexClass("right-", "right", spacing, breakpoints);
|
|
117
|
-
css += complexClass("bottom-", "bottom", spacing, breakpoints);
|
|
118
|
-
css += complexClass("left-", "left", spacing, breakpoints);
|
|
115
|
+
css += complexClass("top-", "top", spacing, breakpoints, states);
|
|
116
|
+
css += complexClass("right-", "right", spacing, breakpoints, states);
|
|
117
|
+
css += complexClass("bottom-", "bottom", spacing, breakpoints, states);
|
|
118
|
+
css += complexClass("left-", "left", spacing, breakpoints, states);
|
|
119
119
|
// inset (top + right + bottom + left)
|
|
120
|
-
css += complexClass("inset-", "inset", spacing, breakpoints);
|
|
120
|
+
css += complexClass("inset-", "inset", spacing, breakpoints, states);
|
|
121
121
|
// inset-x (left + right)
|
|
122
122
|
for (const [key, value] of Object.entries(spacing)) {
|
|
123
|
-
css += customClass(`inset-x-${key}`, { left: value, right: value }, breakpoints);
|
|
123
|
+
css += customClass(`inset-x-${key}`, { left: value, right: value }, breakpoints, undefined, states);
|
|
124
124
|
}
|
|
125
125
|
// inset-y (top + bottom)
|
|
126
126
|
for (const [key, value] of Object.entries(spacing)) {
|
|
127
|
-
css += customClass(`inset-y-${key}`, { top: value, bottom: value }, breakpoints);
|
|
127
|
+
css += customClass(`inset-y-${key}`, { top: value, bottom: value }, breakpoints, undefined, states);
|
|
128
128
|
}
|
|
129
129
|
return css;
|
|
130
130
|
}
|
package/lib/partials/sizing.js
CHANGED
|
@@ -29,7 +29,7 @@ const fractions = [
|
|
|
29
29
|
[11, 12],
|
|
30
30
|
];
|
|
31
31
|
export default function sizing(config) {
|
|
32
|
-
const { breakpoints } = config;
|
|
32
|
+
const { breakpoints, states } = config;
|
|
33
33
|
let css = "";
|
|
34
34
|
// width
|
|
35
35
|
const width = {
|
|
@@ -41,12 +41,12 @@ export default function sizing(config) {
|
|
|
41
41
|
max: "max-content",
|
|
42
42
|
fit: "fit-content",
|
|
43
43
|
};
|
|
44
|
-
css += complexClass("w-", "width", width, breakpoints);
|
|
44
|
+
css += complexClass("w-", "width", width, breakpoints, states);
|
|
45
45
|
for (const [n, d] of fractions) {
|
|
46
|
-
css += simpleClass(`w-${n}/${d}`, "width", fractionPercent(n, d), breakpoints);
|
|
46
|
+
css += simpleClass(`w-${n}/${d}`, "width", fractionPercent(n, d), breakpoints, states);
|
|
47
47
|
}
|
|
48
|
-
css += complexClass("min-w-", "min-width", width, breakpoints);
|
|
49
|
-
css += complexClass("max-w-", "max-width", width, breakpoints);
|
|
48
|
+
css += complexClass("min-w-", "min-width", width, breakpoints, states);
|
|
49
|
+
css += complexClass("max-w-", "max-width", width, breakpoints, states);
|
|
50
50
|
// height
|
|
51
51
|
const height = {
|
|
52
52
|
auto: "auto",
|
|
@@ -57,11 +57,11 @@ export default function sizing(config) {
|
|
|
57
57
|
max: "max-content",
|
|
58
58
|
fit: "fit-content",
|
|
59
59
|
};
|
|
60
|
-
css += complexClass("h-", "height", height, breakpoints);
|
|
60
|
+
css += complexClass("h-", "height", height, breakpoints, states);
|
|
61
61
|
for (const [n, d] of fractions) {
|
|
62
|
-
css += simpleClass(`h-${n}/${d}`, "height", fractionPercent(n, d), breakpoints);
|
|
62
|
+
css += simpleClass(`h-${n}/${d}`, "height", fractionPercent(n, d), breakpoints, states);
|
|
63
63
|
}
|
|
64
|
-
css += complexClass("min-h-", "min-height", height, breakpoints);
|
|
65
|
-
css += complexClass("max-h-", "max-height", height, breakpoints);
|
|
64
|
+
css += complexClass("min-h-", "min-height", height, breakpoints, states);
|
|
65
|
+
css += complexClass("max-h-", "max-height", height, breakpoints, states);
|
|
66
66
|
return css;
|
|
67
67
|
}
|
package/lib/partials/spacing.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { complexClass } from "../generators.js";
|
|
2
2
|
import { omit } from "../utils.js";
|
|
3
3
|
export default function spacingPartial(config) {
|
|
4
|
-
const { breakpoints, spacing } = config;
|
|
4
|
+
const { breakpoints, states, spacing } = config;
|
|
5
5
|
let css = "";
|
|
6
6
|
// margin (incluye "auto")
|
|
7
|
-
css += complexClass("m-", "margin", spacing, breakpoints);
|
|
8
|
-
css += complexClass("mt-", "margin-top", spacing, breakpoints);
|
|
9
|
-
css += complexClass("mr-", "margin-right", spacing, breakpoints);
|
|
10
|
-
css += complexClass("mb-", "margin-bottom", spacing, breakpoints);
|
|
11
|
-
css += complexClass("ml-", "margin-left", spacing, breakpoints);
|
|
12
|
-
css += complexClass("mx-", "margin-inline", spacing, breakpoints);
|
|
13
|
-
css += complexClass("my-", "margin-block", spacing, breakpoints);
|
|
7
|
+
css += complexClass("m-", "margin", spacing, breakpoints, states);
|
|
8
|
+
css += complexClass("mt-", "margin-top", spacing, breakpoints, states);
|
|
9
|
+
css += complexClass("mr-", "margin-right", spacing, breakpoints, states);
|
|
10
|
+
css += complexClass("mb-", "margin-bottom", spacing, breakpoints, states);
|
|
11
|
+
css += complexClass("ml-", "margin-left", spacing, breakpoints, states);
|
|
12
|
+
css += complexClass("mx-", "margin-inline", spacing, breakpoints, states);
|
|
13
|
+
css += complexClass("my-", "margin-block", spacing, breakpoints, states);
|
|
14
14
|
// padding (sin "auto")
|
|
15
15
|
const padding = omit(spacing, "auto");
|
|
16
|
-
css += complexClass("p-", "padding", padding, breakpoints);
|
|
17
|
-
css += complexClass("pt-", "padding-top", padding, breakpoints);
|
|
18
|
-
css += complexClass("pr-", "padding-right", padding, breakpoints);
|
|
19
|
-
css += complexClass("pb-", "padding-bottom", padding, breakpoints);
|
|
20
|
-
css += complexClass("pl-", "padding-left", padding, breakpoints);
|
|
21
|
-
css += complexClass("px-", "padding-inline", padding, breakpoints);
|
|
22
|
-
css += complexClass("py-", "padding-block", padding, breakpoints);
|
|
16
|
+
css += complexClass("p-", "padding", padding, breakpoints, states);
|
|
17
|
+
css += complexClass("pt-", "padding-top", padding, breakpoints, states);
|
|
18
|
+
css += complexClass("pr-", "padding-right", padding, breakpoints, states);
|
|
19
|
+
css += complexClass("pb-", "padding-bottom", padding, breakpoints, states);
|
|
20
|
+
css += complexClass("pl-", "padding-left", padding, breakpoints, states);
|
|
21
|
+
css += complexClass("px-", "padding-inline", padding, breakpoints, states);
|
|
22
|
+
css += complexClass("py-", "padding-block", padding, breakpoints, states);
|
|
23
23
|
return css;
|
|
24
24
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { complexClass, customClass, simpleClass } from "../generators.js";
|
|
2
2
|
import { omit } from "../utils.js";
|
|
3
3
|
export default function typography(config) {
|
|
4
|
-
const { breakpoints, foregroundColors, spacing } = config;
|
|
4
|
+
const { breakpoints, states, foregroundColors, spacing } = config;
|
|
5
5
|
let css = "";
|
|
6
6
|
// text-color
|
|
7
|
-
css += complexClass("text-", "color", foregroundColors, breakpoints);
|
|
7
|
+
css += complexClass("text-", "color", foregroundColors, breakpoints, states);
|
|
8
8
|
// text-align
|
|
9
9
|
const textAlign = {
|
|
10
10
|
left: "left",
|
|
@@ -14,7 +14,7 @@ export default function typography(config) {
|
|
|
14
14
|
start: "start",
|
|
15
15
|
end: "end",
|
|
16
16
|
};
|
|
17
|
-
css += complexClass("text-", "text-align", textAlign, breakpoints);
|
|
17
|
+
css += complexClass("text-", "text-align", textAlign, breakpoints, states);
|
|
18
18
|
// text-transform
|
|
19
19
|
const textTransform = {
|
|
20
20
|
uppercase: "uppercase",
|
|
@@ -22,18 +22,18 @@ export default function typography(config) {
|
|
|
22
22
|
capitalize: "capitalize",
|
|
23
23
|
"normal-case": "none",
|
|
24
24
|
};
|
|
25
|
-
css += complexClass("", "text-transform", textTransform, breakpoints);
|
|
25
|
+
css += complexClass("", "text-transform", textTransform, breakpoints, states);
|
|
26
26
|
// text-overflow
|
|
27
27
|
const textOverflow = {
|
|
28
28
|
ellipsis: "ellipsis",
|
|
29
29
|
clip: "clip",
|
|
30
30
|
};
|
|
31
|
-
css += complexClass("text-", "text-overflow", textOverflow, breakpoints);
|
|
31
|
+
css += complexClass("text-", "text-overflow", textOverflow, breakpoints, states);
|
|
32
32
|
css += customClass("truncate", {
|
|
33
33
|
overflow: "hidden",
|
|
34
34
|
"text-overflow": "ellipsis",
|
|
35
35
|
"white-space": "nowrap",
|
|
36
|
-
}, breakpoints);
|
|
36
|
+
}, breakpoints, undefined, states);
|
|
37
37
|
// vertical-align
|
|
38
38
|
const verticalAlign = {
|
|
39
39
|
baseline: "baseline",
|
|
@@ -45,7 +45,7 @@ export default function typography(config) {
|
|
|
45
45
|
sub: "sub",
|
|
46
46
|
super: "super",
|
|
47
47
|
};
|
|
48
|
-
css += complexClass("align-", "vertical-align", verticalAlign, breakpoints);
|
|
48
|
+
css += complexClass("align-", "vertical-align", verticalAlign, breakpoints, states);
|
|
49
49
|
// white-space
|
|
50
50
|
const whiteSpace = {
|
|
51
51
|
normal: "normal",
|
|
@@ -55,30 +55,30 @@ export default function typography(config) {
|
|
|
55
55
|
"pre-wrap": "pre-wrap",
|
|
56
56
|
"break-spaces": "break-spaces",
|
|
57
57
|
};
|
|
58
|
-
css += complexClass("whitespace-", "white-space", whiteSpace, breakpoints);
|
|
58
|
+
css += complexClass("whitespace-", "white-space", whiteSpace, breakpoints, states);
|
|
59
59
|
// word-break
|
|
60
60
|
const wordBreak = {
|
|
61
61
|
all: "break-all",
|
|
62
62
|
keep: "keep-all",
|
|
63
63
|
};
|
|
64
|
-
css += complexClass("break-", "word-break", wordBreak, breakpoints);
|
|
65
|
-
css += simpleClass("break-words", "overflow-wrap", "break-word", breakpoints);
|
|
66
|
-
css += customClass("break-normal", { "overflow-wrap": "normal", "word-break": "normal" }, breakpoints);
|
|
64
|
+
css += complexClass("break-", "word-break", wordBreak, breakpoints, states);
|
|
65
|
+
css += simpleClass("break-words", "overflow-wrap", "break-word", breakpoints, states);
|
|
66
|
+
css += customClass("break-normal", { "overflow-wrap": "normal", "word-break": "normal" }, breakpoints, undefined, states);
|
|
67
67
|
// font-smoothing
|
|
68
68
|
css += customClass("antialiased", {
|
|
69
69
|
"-webkit-font-smoothing": "antialiased",
|
|
70
70
|
"-moz-osx-font-smoothing": "grayscale",
|
|
71
|
-
}, breakpoints);
|
|
71
|
+
}, breakpoints, undefined, states);
|
|
72
72
|
css += customClass("subpixel-antialiased", {
|
|
73
73
|
"-webkit-font-smoothing": "auto",
|
|
74
74
|
"-moz-osx-font-smoothing": "auto",
|
|
75
|
-
}, breakpoints);
|
|
75
|
+
}, breakpoints, undefined, states);
|
|
76
76
|
// font-style
|
|
77
77
|
const fontStyle = {
|
|
78
78
|
italic: "italic",
|
|
79
79
|
"not-italic": "normal",
|
|
80
80
|
};
|
|
81
|
-
css += complexClass("", "font-style", fontStyle, breakpoints);
|
|
81
|
+
css += complexClass("", "font-style", fontStyle, breakpoints, states);
|
|
82
82
|
// font-weight
|
|
83
83
|
const fontWeight = {
|
|
84
84
|
thin: "100",
|
|
@@ -91,7 +91,7 @@ export default function typography(config) {
|
|
|
91
91
|
extrabold: "800",
|
|
92
92
|
black: "900",
|
|
93
93
|
};
|
|
94
|
-
css += complexClass("font-", "font-weight", fontWeight, breakpoints);
|
|
94
|
+
css += complexClass("font-", "font-weight", fontWeight, breakpoints, states);
|
|
95
95
|
// letter-spacing
|
|
96
96
|
const letterSpacing = {
|
|
97
97
|
tighter: "-0.05em",
|
|
@@ -101,7 +101,7 @@ export default function typography(config) {
|
|
|
101
101
|
wider: "0.05em",
|
|
102
102
|
widest: "0.1em",
|
|
103
103
|
};
|
|
104
|
-
css += complexClass("tracking-", "letter-spacing", letterSpacing, breakpoints);
|
|
104
|
+
css += complexClass("tracking-", "letter-spacing", letterSpacing, breakpoints, states);
|
|
105
105
|
// line-height
|
|
106
106
|
const lineHeight = omit(spacing, "auto", "zero");
|
|
107
107
|
const extendedLineHeight = {
|
|
@@ -113,6 +113,6 @@ export default function typography(config) {
|
|
|
113
113
|
relaxed: "1.625",
|
|
114
114
|
loose: "2",
|
|
115
115
|
};
|
|
116
|
-
css += complexClass("leading-", "line-height", extendedLineHeight, breakpoints);
|
|
116
|
+
css += complexClass("leading-", "line-height", extendedLineHeight, breakpoints, states);
|
|
117
117
|
return css;
|
|
118
118
|
}
|
package/lib/purge.js
CHANGED
package/lib/resolve-config.d.ts
CHANGED
package/lib/resolve-config.js
CHANGED
|
@@ -3,7 +3,6 @@ import { pathToFileURL } from "node:url";
|
|
|
3
3
|
import defaults from "./defaults.js";
|
|
4
4
|
/**
|
|
5
5
|
* Resuelve la configuración de Grisso.
|
|
6
|
-
* Patrón Tailwind v3:
|
|
7
6
|
* - Top-level keys reemplazan los defaults completamente
|
|
8
7
|
* - `extend` mergea superficialmente con defaults
|
|
9
8
|
*/
|
|
@@ -36,7 +35,11 @@ export async function resolveConfig(configPath) {
|
|
|
36
35
|
if (extend && typeof extend === "object" && !Array.isArray(extend)) {
|
|
37
36
|
for (const [key, value] of Object.entries(extend)) {
|
|
38
37
|
const current = config[key];
|
|
39
|
-
if (key in config &&
|
|
38
|
+
if (key in config && Array.isArray(current) && Array.isArray(value)) {
|
|
39
|
+
// Arrays se concatenan (e.g. safelist)
|
|
40
|
+
config[key] = [...current, ...value];
|
|
41
|
+
}
|
|
42
|
+
else if (key in config &&
|
|
40
43
|
typeof current === "object" &&
|
|
41
44
|
current !== null &&
|
|
42
45
|
!Array.isArray(current)) {
|
package/lib/tokens.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface TokensOptions {
|
|
2
|
+
/** Ruta a grisso.config.mjs del consumidor */
|
|
3
|
+
config?: string;
|
|
4
|
+
/** Formato de salida: CSS scaffold o JSON (default: "css") */
|
|
5
|
+
format?: "css" | "json";
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Extrae tokens de la config resuelta y genera un scaffold CSS o JSON.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const css = await extractTokens();
|
|
12
|
+
* const json = await extractTokens({ format: "json" });
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractTokens(options?: TokensOptions): Promise<string>;
|