@unocss/preset-mini 0.25.0 → 0.26.2
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/chunks/default.cjs +42 -6
- package/dist/chunks/default.mjs +39 -7
- package/dist/chunks/default2.cjs +88 -85
- package/dist/chunks/default2.mjs +90 -86
- package/dist/chunks/utilities.cjs +42 -12
- package/dist/chunks/utilities.mjs +42 -13
- package/dist/{colors-0db1b382.d.ts → colors-ce2fecb8.d.ts} +1 -1
- package/dist/colors.d.ts +2 -2
- package/dist/{default-3eaf5bb0.d.ts → default-e6d1b2e8.d.ts} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/rules.cjs +0 -1
- package/dist/rules.d.ts +7 -14
- package/dist/rules.mjs +1 -1
- package/dist/theme.cjs +4 -0
- package/dist/theme.d.ts +34 -6
- package/dist/theme.mjs +1 -1
- package/dist/{types-ef1d7462.d.ts → types-f7b2c653.d.ts} +10 -0
- package/dist/{utilities-43c87ad4.d.ts → utilities-820bcff8.d.ts} +13 -13
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.ts +10 -4
- package/dist/utils.mjs +1 -1
- package/dist/variants.d.ts +4 -4
- package/package.json +2 -2
package/dist/chunks/default.cjs
CHANGED
|
@@ -72,11 +72,11 @@ const textStrokeWidth = {
|
|
|
72
72
|
};
|
|
73
73
|
const textShadow = {
|
|
74
74
|
DEFAULT: ["0 0 1px rgba(0,0,0,0.2)", "0 0 1px rgba(1,0,5,0.1)"],
|
|
75
|
+
none: "0 0 #0000",
|
|
75
76
|
sm: "1px 1px 3px rgba(36,37,47,0.25)",
|
|
76
77
|
md: ["0 1px 2px rgba(30,29,39,0.19)", "1px 2px 4px rgba(54,64,147,0.18)"],
|
|
77
78
|
lg: ["3px 3px 6px rgba(0,0,0,0.26)", "0 0 5px rgba(15,3,86,0.22)"],
|
|
78
|
-
xl: ["1px 1px 3px rgba(0,0,0,0.29)", "2px 4px 7px rgba(73,64,125,0.35)"]
|
|
79
|
-
none: "0 0 #0000"
|
|
79
|
+
xl: ["1px 1px 3px rgba(0,0,0,0.29)", "2px 4px 7px rgba(73,64,125,0.35)"]
|
|
80
80
|
};
|
|
81
81
|
const lineHeight = {
|
|
82
82
|
none: "1",
|
|
@@ -104,9 +104,33 @@ const breakpoints = {
|
|
|
104
104
|
"2xl": "1536px"
|
|
105
105
|
};
|
|
106
106
|
const verticalBreakpoints = { ...breakpoints };
|
|
107
|
+
const lineWidth = {
|
|
108
|
+
DEFAULT: "1px",
|
|
109
|
+
none: "0px"
|
|
110
|
+
};
|
|
111
|
+
const spacing = {
|
|
112
|
+
"DEFAULT": "1rem",
|
|
113
|
+
"none": "0rem",
|
|
114
|
+
"xs": "0.75rem",
|
|
115
|
+
"sm": "0.875rem",
|
|
116
|
+
"lg": "1.125rem",
|
|
117
|
+
"xl": "1.25rem",
|
|
118
|
+
"2xl": "1.5rem",
|
|
119
|
+
"3xl": "1.875rem",
|
|
120
|
+
"4xl": "2.25rem",
|
|
121
|
+
"5xl": "3rem",
|
|
122
|
+
"6xl": "3.75rem",
|
|
123
|
+
"7xl": "4.5rem",
|
|
124
|
+
"8xl": "6rem",
|
|
125
|
+
"9xl": "8rem"
|
|
126
|
+
};
|
|
127
|
+
const duration = {
|
|
128
|
+
DEFAULT: "150ms",
|
|
129
|
+
none: "0ms"
|
|
130
|
+
};
|
|
107
131
|
const borderRadius = {
|
|
108
132
|
"DEFAULT": "0.25rem",
|
|
109
|
-
"none": "
|
|
133
|
+
"none": "0rem",
|
|
110
134
|
"sm": "0.125rem",
|
|
111
135
|
"md": "0.375rem",
|
|
112
136
|
"lg": "0.5rem",
|
|
@@ -117,13 +141,13 @@ const borderRadius = {
|
|
|
117
141
|
};
|
|
118
142
|
const boxShadow = {
|
|
119
143
|
"DEFAULT": ["var(--un-shadow-inset) 0 1px 3px 0 rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 1px 2px -1px rgba(0,0,0,0.1)"],
|
|
144
|
+
"none": "0 0 #0000",
|
|
120
145
|
"sm": "var(--un-shadow-inset) 0 1px 2px 0 rgba(0,0,0,0.05)",
|
|
121
146
|
"md": ["var(--un-shadow-inset) 0 4px 6px -1px rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 2px 4px -2px rgba(0,0,0,0.1)"],
|
|
122
147
|
"lg": ["var(--un-shadow-inset) 0 10px 15px -3px rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 4px 6px -4px rgba(0,0,0,0.1)"],
|
|
123
148
|
"xl": ["var(--un-shadow-inset) 0 20px 25px -5px rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 8px 10px -6px rgba(0,0,0,0.1)"],
|
|
124
149
|
"2xl": "var(--un-shadow-inset) 0 25px 50px -12px rgba(0,0,0,0.25)",
|
|
125
|
-
"inner": "inset 0 2px 4px 0 rgba(0,0,0,0.05)"
|
|
126
|
-
"none": "0 0 #0000"
|
|
150
|
+
"inner": "inset 0 2px 4px 0 rgba(0,0,0,0.05)"
|
|
127
151
|
};
|
|
128
152
|
const easing = {
|
|
129
153
|
"DEFAULT": "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
@@ -132,6 +156,10 @@ const easing = {
|
|
|
132
156
|
"out": "cubic-bezier(0, 0, 0.2, 1)",
|
|
133
157
|
"in-out": "cubic-bezier(0.4, 0, 0.2, 1)"
|
|
134
158
|
};
|
|
159
|
+
const ringWidth = {
|
|
160
|
+
DEFAULT: "1px",
|
|
161
|
+
none: "0px"
|
|
162
|
+
};
|
|
135
163
|
|
|
136
164
|
const blur = {
|
|
137
165
|
"DEFAULT": "8px",
|
|
@@ -216,7 +244,11 @@ const theme = {
|
|
|
216
244
|
textStrokeWidth,
|
|
217
245
|
blur,
|
|
218
246
|
dropShadow,
|
|
219
|
-
easing
|
|
247
|
+
easing,
|
|
248
|
+
lineWidth,
|
|
249
|
+
spacing,
|
|
250
|
+
duration,
|
|
251
|
+
ringWidth
|
|
220
252
|
};
|
|
221
253
|
|
|
222
254
|
exports.baseSize = baseSize;
|
|
@@ -225,14 +257,18 @@ exports.borderRadius = borderRadius;
|
|
|
225
257
|
exports.boxShadow = boxShadow;
|
|
226
258
|
exports.breakpoints = breakpoints;
|
|
227
259
|
exports.dropShadow = dropShadow;
|
|
260
|
+
exports.duration = duration;
|
|
228
261
|
exports.easing = easing;
|
|
229
262
|
exports.fontFamily = fontFamily;
|
|
230
263
|
exports.fontSize = fontSize;
|
|
231
264
|
exports.height = height;
|
|
232
265
|
exports.letterSpacing = letterSpacing;
|
|
233
266
|
exports.lineHeight = lineHeight;
|
|
267
|
+
exports.lineWidth = lineWidth;
|
|
234
268
|
exports.maxHeight = maxHeight;
|
|
235
269
|
exports.maxWidth = maxWidth;
|
|
270
|
+
exports.ringWidth = ringWidth;
|
|
271
|
+
exports.spacing = spacing;
|
|
236
272
|
exports.textIndent = textIndent;
|
|
237
273
|
exports.textShadow = textShadow;
|
|
238
274
|
exports.textStrokeWidth = textStrokeWidth;
|
package/dist/chunks/default.mjs
CHANGED
|
@@ -70,11 +70,11 @@ const textStrokeWidth = {
|
|
|
70
70
|
};
|
|
71
71
|
const textShadow = {
|
|
72
72
|
DEFAULT: ["0 0 1px rgba(0,0,0,0.2)", "0 0 1px rgba(1,0,5,0.1)"],
|
|
73
|
+
none: "0 0 #0000",
|
|
73
74
|
sm: "1px 1px 3px rgba(36,37,47,0.25)",
|
|
74
75
|
md: ["0 1px 2px rgba(30,29,39,0.19)", "1px 2px 4px rgba(54,64,147,0.18)"],
|
|
75
76
|
lg: ["3px 3px 6px rgba(0,0,0,0.26)", "0 0 5px rgba(15,3,86,0.22)"],
|
|
76
|
-
xl: ["1px 1px 3px rgba(0,0,0,0.29)", "2px 4px 7px rgba(73,64,125,0.35)"]
|
|
77
|
-
none: "0 0 #0000"
|
|
77
|
+
xl: ["1px 1px 3px rgba(0,0,0,0.29)", "2px 4px 7px rgba(73,64,125,0.35)"]
|
|
78
78
|
};
|
|
79
79
|
const lineHeight = {
|
|
80
80
|
none: "1",
|
|
@@ -102,9 +102,33 @@ const breakpoints = {
|
|
|
102
102
|
"2xl": "1536px"
|
|
103
103
|
};
|
|
104
104
|
const verticalBreakpoints = { ...breakpoints };
|
|
105
|
+
const lineWidth = {
|
|
106
|
+
DEFAULT: "1px",
|
|
107
|
+
none: "0px"
|
|
108
|
+
};
|
|
109
|
+
const spacing = {
|
|
110
|
+
"DEFAULT": "1rem",
|
|
111
|
+
"none": "0rem",
|
|
112
|
+
"xs": "0.75rem",
|
|
113
|
+
"sm": "0.875rem",
|
|
114
|
+
"lg": "1.125rem",
|
|
115
|
+
"xl": "1.25rem",
|
|
116
|
+
"2xl": "1.5rem",
|
|
117
|
+
"3xl": "1.875rem",
|
|
118
|
+
"4xl": "2.25rem",
|
|
119
|
+
"5xl": "3rem",
|
|
120
|
+
"6xl": "3.75rem",
|
|
121
|
+
"7xl": "4.5rem",
|
|
122
|
+
"8xl": "6rem",
|
|
123
|
+
"9xl": "8rem"
|
|
124
|
+
};
|
|
125
|
+
const duration = {
|
|
126
|
+
DEFAULT: "150ms",
|
|
127
|
+
none: "0ms"
|
|
128
|
+
};
|
|
105
129
|
const borderRadius = {
|
|
106
130
|
"DEFAULT": "0.25rem",
|
|
107
|
-
"none": "
|
|
131
|
+
"none": "0rem",
|
|
108
132
|
"sm": "0.125rem",
|
|
109
133
|
"md": "0.375rem",
|
|
110
134
|
"lg": "0.5rem",
|
|
@@ -115,13 +139,13 @@ const borderRadius = {
|
|
|
115
139
|
};
|
|
116
140
|
const boxShadow = {
|
|
117
141
|
"DEFAULT": ["var(--un-shadow-inset) 0 1px 3px 0 rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 1px 2px -1px rgba(0,0,0,0.1)"],
|
|
142
|
+
"none": "0 0 #0000",
|
|
118
143
|
"sm": "var(--un-shadow-inset) 0 1px 2px 0 rgba(0,0,0,0.05)",
|
|
119
144
|
"md": ["var(--un-shadow-inset) 0 4px 6px -1px rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 2px 4px -2px rgba(0,0,0,0.1)"],
|
|
120
145
|
"lg": ["var(--un-shadow-inset) 0 10px 15px -3px rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 4px 6px -4px rgba(0,0,0,0.1)"],
|
|
121
146
|
"xl": ["var(--un-shadow-inset) 0 20px 25px -5px rgba(0,0,0,0.1)", "var(--un-shadow-inset) 0 8px 10px -6px rgba(0,0,0,0.1)"],
|
|
122
147
|
"2xl": "var(--un-shadow-inset) 0 25px 50px -12px rgba(0,0,0,0.25)",
|
|
123
|
-
"inner": "inset 0 2px 4px 0 rgba(0,0,0,0.05)"
|
|
124
|
-
"none": "0 0 #0000"
|
|
148
|
+
"inner": "inset 0 2px 4px 0 rgba(0,0,0,0.05)"
|
|
125
149
|
};
|
|
126
150
|
const easing = {
|
|
127
151
|
"DEFAULT": "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
@@ -130,6 +154,10 @@ const easing = {
|
|
|
130
154
|
"out": "cubic-bezier(0, 0, 0.2, 1)",
|
|
131
155
|
"in-out": "cubic-bezier(0.4, 0, 0.2, 1)"
|
|
132
156
|
};
|
|
157
|
+
const ringWidth = {
|
|
158
|
+
DEFAULT: "1px",
|
|
159
|
+
none: "0px"
|
|
160
|
+
};
|
|
133
161
|
|
|
134
162
|
const blur = {
|
|
135
163
|
"DEFAULT": "8px",
|
|
@@ -214,7 +242,11 @@ const theme = {
|
|
|
214
242
|
textStrokeWidth,
|
|
215
243
|
blur,
|
|
216
244
|
dropShadow,
|
|
217
|
-
easing
|
|
245
|
+
easing,
|
|
246
|
+
lineWidth,
|
|
247
|
+
spacing,
|
|
248
|
+
duration,
|
|
249
|
+
ringWidth
|
|
218
250
|
};
|
|
219
251
|
|
|
220
|
-
export { fontSize as a, blur as b, textIndent as c, dropShadow as d, textStrokeWidth as e, fontFamily as f, textShadow as g, letterSpacing as h, breakpoints as i,
|
|
252
|
+
export { fontSize as a, blur as b, textIndent as c, dropShadow as d, textStrokeWidth as e, fontFamily as f, textShadow as g, letterSpacing as h, breakpoints as i, lineWidth as j, duration as k, lineHeight as l, borderRadius as m, boxShadow as n, easing as o, baseSize as p, width as q, ringWidth as r, spacing as s, theme as t, maxWidth as u, verticalBreakpoints as v, wordSpacing as w, height as x, maxHeight as y };
|
package/dist/chunks/default2.cjs
CHANGED
|
@@ -19,9 +19,9 @@ const textAligns = [
|
|
|
19
19
|
];
|
|
20
20
|
|
|
21
21
|
const outline = [
|
|
22
|
-
[/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": utilities.handler.bracket.cssvar.px(d) })],
|
|
22
|
+
[/^outline-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "outline-width": theme.lineWidth?.[d] ?? utilities.handler.bracket.cssvar.px(d) })],
|
|
23
23
|
[/^outline-(?:color-)?(.+)$/, utilities.colorResolver("outline-color", "outline-color")],
|
|
24
|
-
[/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": utilities.handler.bracket.cssvar.px(d) })],
|
|
24
|
+
[/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? utilities.handler.bracket.cssvar.px(d) })],
|
|
25
25
|
["outline", { "outline-style": "solid" }],
|
|
26
26
|
[/^outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
|
|
27
27
|
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
@@ -75,10 +75,7 @@ const borders = [
|
|
|
75
75
|
["border-hidden", { "border-style": "hidden" }],
|
|
76
76
|
["border-none", { "border-style": "none" }]
|
|
77
77
|
];
|
|
78
|
-
const
|
|
79
|
-
return color !== void 0 && !!utilities.parseColor(color, theme)?.color;
|
|
80
|
-
};
|
|
81
|
-
const borderColorResolver = (direction) => ([, body], { theme }) => {
|
|
78
|
+
const borderColorResolver = (direction) => ([, body], theme) => {
|
|
82
79
|
const data = utilities.parseColor(body, theme);
|
|
83
80
|
if (!data)
|
|
84
81
|
return;
|
|
@@ -107,8 +104,8 @@ const borderColorResolver = (direction) => ([, body], { theme }) => {
|
|
|
107
104
|
};
|
|
108
105
|
}
|
|
109
106
|
};
|
|
110
|
-
function handlerBorder(m) {
|
|
111
|
-
const borderSizes = handlerBorderSize(m);
|
|
107
|
+
function handlerBorder(m, ctx) {
|
|
108
|
+
const borderSizes = handlerBorderSize(m, ctx);
|
|
112
109
|
if (borderSizes) {
|
|
113
110
|
return [
|
|
114
111
|
...borderSizes,
|
|
@@ -116,14 +113,14 @@ function handlerBorder(m) {
|
|
|
116
113
|
];
|
|
117
114
|
}
|
|
118
115
|
}
|
|
119
|
-
function handlerBorderSize([, a = "", b
|
|
120
|
-
const v = utilities.handler.bracket.cssvar.px(b);
|
|
116
|
+
function handlerBorderSize([, a = "", b], { theme }) {
|
|
117
|
+
const v = theme.lineWidth?.[b || "DEFAULT"] ?? utilities.handler.bracket.cssvar.px(b || "1");
|
|
121
118
|
if (a in utilities.directionMap && v != null)
|
|
122
119
|
return utilities.directionMap[a].map((i) => [`border${i}-width`, v]);
|
|
123
120
|
}
|
|
124
|
-
function handlerBorderColor([, a = "", c],
|
|
125
|
-
if (a in utilities.directionMap &&
|
|
126
|
-
return Object.assign({}, ...utilities.directionMap[a].map((i) => borderColorResolver(i)(["", c],
|
|
121
|
+
function handlerBorderColor([, a = "", c], { theme }) {
|
|
122
|
+
if (a in utilities.directionMap && utilities.hasParseableColor(c, theme)) {
|
|
123
|
+
return Object.assign({}, ...utilities.directionMap[a].map((i) => borderColorResolver(i)(["", c], theme)));
|
|
127
124
|
}
|
|
128
125
|
}
|
|
129
126
|
function handlerBorderOpacity([, a = "", opacity]) {
|
|
@@ -131,8 +128,8 @@ function handlerBorderOpacity([, a = "", opacity]) {
|
|
|
131
128
|
if (a in utilities.directionMap && v != null)
|
|
132
129
|
return utilities.directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
|
|
133
130
|
}
|
|
134
|
-
function handlerRounded([, a = "", s
|
|
135
|
-
const v = theme.borderRadius?.[s] || utilities.handler.bracket.cssvar.fraction.rem(s);
|
|
131
|
+
function handlerRounded([, a = "", s], { theme }) {
|
|
132
|
+
const v = theme.borderRadius?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.rem(s || "1");
|
|
136
133
|
if (a in utilities.cornerMap && v != null)
|
|
137
134
|
return utilities.cornerMap[a].map((i) => [`border${i}-radius`, v]);
|
|
138
135
|
}
|
|
@@ -161,18 +158,19 @@ const transitionProperty = (prop) => {
|
|
|
161
158
|
return utilities.handler.properties(prop) ?? transitionPropertyGroup[prop];
|
|
162
159
|
};
|
|
163
160
|
const transitions = [
|
|
164
|
-
[/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop,
|
|
161
|
+
[/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop, d], { theme }) => {
|
|
165
162
|
const p = prop != null ? transitionProperty(prop) : [transitionPropertyGroup.colors, "opacity", "box-shadow", "transform", "filter", "backdrop-filter"].join(",");
|
|
166
163
|
if (p) {
|
|
164
|
+
const duration = theme.duration?.[d || "DEFAULT"] ?? utilities.handler.time(d || "150");
|
|
167
165
|
return {
|
|
168
166
|
"transition-property": p,
|
|
169
167
|
"transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
170
|
-
"transition-duration":
|
|
168
|
+
"transition-duration": duration
|
|
171
169
|
};
|
|
172
170
|
}
|
|
173
171
|
}],
|
|
174
|
-
[/^(?:transition-)?duration-(.+)$/, ([, d]) => ({ "transition-duration": utilities.handler.bracket.cssvar.time(d) })],
|
|
175
|
-
[/^(?:transition-)?delay-(.+)$/, ([, d]) => ({ "transition-delay": utilities.handler.bracket.cssvar.time(d) })],
|
|
172
|
+
[/^(?:transition-)?duration-(.+)$/, ([, d], { theme }) => ({ "transition-duration": theme.duration?.[d || "DEFAULT"] ?? utilities.handler.bracket.cssvar.time(d) })],
|
|
173
|
+
[/^(?:transition-)?delay-(.+)$/, ([, d], { theme }) => ({ "transition-delay": theme.duration?.[d || "DEFAULT"] ?? utilities.handler.bracket.cssvar.time(d) })],
|
|
176
174
|
[/^(?:transition-)?ease(?:-(.+))?$/, ([, d], { theme }) => ({ "transition-timing-function": theme.easing?.[d || "DEFAULT"] ?? utilities.handler.bracket.cssvar(d) })],
|
|
177
175
|
[/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": utilities.handler.global(v) || transitionProperty(v) })],
|
|
178
176
|
["transition-none", { transition: "none" }]
|
|
@@ -191,7 +189,7 @@ const flex = [
|
|
|
191
189
|
[/^(?:flex-)?shrink-0$/, () => ({ "flex-shrink": 0 })],
|
|
192
190
|
[/^(?:flex-)?grow$/, () => ({ "flex-grow": 1 })],
|
|
193
191
|
[/^(?:flex-)?grow-0$/, () => ({ "flex-grow": 0 })],
|
|
194
|
-
[/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": utilities.handler.bracket.cssvar.auto.fraction.rem(d) })],
|
|
192
|
+
[/^(?:flex-)?basis-(.+)$/, ([, d], { theme }) => ({ "flex-basis": theme.spacing?.[d] ?? utilities.handler.bracket.cssvar.auto.fraction.rem(d) })],
|
|
195
193
|
["flex-row", { "flex-direction": "row" }],
|
|
196
194
|
["flex-row-reverse", { "flex-direction": "row-reverse" }],
|
|
197
195
|
["flex-col", { "flex-direction": "column" }],
|
|
@@ -223,9 +221,14 @@ const fonts = [
|
|
|
223
221
|
"line-height": height
|
|
224
222
|
};
|
|
225
223
|
}
|
|
226
|
-
return { "font-size": utilities.handler.
|
|
224
|
+
return { "font-size": utilities.handler.bracketOfLength.rem(s) };
|
|
225
|
+
}],
|
|
226
|
+
[/^text-size-(.+)$/, ([, s], { theme }) => {
|
|
227
|
+
const themed = core.toArray(theme.fontSize?.[s]);
|
|
228
|
+
const size = themed?.[0] ?? utilities.handler.bracket.cssvar.rem(s);
|
|
229
|
+
if (size != null)
|
|
230
|
+
return { "font-size": size };
|
|
227
231
|
}],
|
|
228
|
-
[/^text-size-(.+)$/, ([, s]) => ({ "font-size": utilities.handler.bracket.cssvar.rem(s) })],
|
|
229
232
|
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || utilities.handler.number(s) })],
|
|
230
233
|
[/^(?:leading|lh)-(.+)$/, ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || utilities.handler.bracket.cssvar.rem(s) })],
|
|
231
234
|
[/^tracking-(.+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || utilities.handler.bracket.cssvar.rem(s) })],
|
|
@@ -271,8 +274,8 @@ const directions = {
|
|
|
271
274
|
"x": "column-",
|
|
272
275
|
"y": "row-"
|
|
273
276
|
};
|
|
274
|
-
const handleGap = ([, d = "", s]) => {
|
|
275
|
-
const v = utilities.handler.bracket.cssvar.rem(s);
|
|
277
|
+
const handleGap = ([, d = "", s], { theme }) => {
|
|
278
|
+
const v = theme.spacing?.[s] ?? utilities.handler.bracket.cssvar.rem(s);
|
|
276
279
|
if (v != null) {
|
|
277
280
|
return {
|
|
278
281
|
[`grid-${directions[d]}gap`]: v,
|
|
@@ -281,16 +284,17 @@ const handleGap = ([, d = "", s]) => {
|
|
|
281
284
|
}
|
|
282
285
|
};
|
|
283
286
|
const gaps = [
|
|
284
|
-
[/^(?:flex-|grid-)?gap-()(
|
|
285
|
-
[/^(?:flex-|grid-)?gap-([xy])-(
|
|
287
|
+
[/^(?:flex-|grid-)?gap-()(.+)$/, handleGap],
|
|
288
|
+
[/^(?:flex-|grid-)?gap-([xy])-(.+)$/, handleGap]
|
|
286
289
|
];
|
|
287
290
|
|
|
288
291
|
const rowCol = (s) => s.replace("col", "column");
|
|
289
|
-
const
|
|
290
|
-
|
|
292
|
+
const rowColTheme = (s) => s[0] === "r" ? "Row" : "Column";
|
|
293
|
+
const autoDirection = (c, theme, prop) => {
|
|
294
|
+
const v = theme[`gridAuto${rowColTheme(c)}`]?.[prop];
|
|
291
295
|
if (v != null)
|
|
292
|
-
return
|
|
293
|
-
switch (
|
|
296
|
+
return v;
|
|
297
|
+
switch (prop) {
|
|
294
298
|
case "min":
|
|
295
299
|
return "min-content";
|
|
296
300
|
case "max":
|
|
@@ -298,12 +302,14 @@ const autoDirection = (selector, theme) => {
|
|
|
298
302
|
case "fr":
|
|
299
303
|
return "minmax(0,1fr)";
|
|
300
304
|
}
|
|
301
|
-
return utilities.handler.bracket.cssvar.auto.rem(
|
|
305
|
+
return utilities.handler.bracket.cssvar.auto.rem(prop);
|
|
302
306
|
};
|
|
303
307
|
const grids = [
|
|
304
308
|
["grid", { display: "grid" }],
|
|
305
309
|
["inline-grid", { display: "inline-grid" }],
|
|
306
|
-
[/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({
|
|
310
|
+
[/^(?:grid-)?(row|col)-(.+)$/, ([, c, v], { theme }) => ({
|
|
311
|
+
[`grid-${rowCol(c)}`]: theme[`grid${rowColTheme(c)}`]?.[v] ?? utilities.handler.bracket.cssvar.auto(v)
|
|
312
|
+
})],
|
|
307
313
|
[/^(?:grid-)?(row|col)-span-(.+)$/, ([, c, s]) => {
|
|
308
314
|
if (s === "full")
|
|
309
315
|
return { [`grid-${rowCol(c)}`]: "1/-1" };
|
|
@@ -313,10 +319,12 @@ const grids = [
|
|
|
313
319
|
}],
|
|
314
320
|
[/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: utilities.handler.bracket.cssvar(v) ?? v })],
|
|
315
321
|
[/^(?:grid-)?(row|col)-end-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: utilities.handler.bracket.cssvar(v) ?? v })],
|
|
316
|
-
[/^(?:grid-)?auto-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(
|
|
322
|
+
[/^(?:grid-)?auto-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(c, theme, v) })],
|
|
317
323
|
[/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": utilities.handler.bracket.cssvar(v) })],
|
|
318
324
|
[/^(?:grid-auto-flow|auto-flow|grid-flow)-((?:row|col)(?:-dense)?)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
|
|
319
|
-
[/^grid-(rows|cols)-(.+)$/, ([, c, v]) => ({
|
|
325
|
+
[/^grid-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({
|
|
326
|
+
[`grid-template-${rowCol(c)}`]: theme[`gridTemplate${rowColTheme(c)}`]?.[v] ?? utilities.handler.bracket.cssvar(v)
|
|
327
|
+
})],
|
|
320
328
|
[/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
321
329
|
[/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` })],
|
|
322
330
|
["grid-rows-none", { "grid-template-rows": "none" }],
|
|
@@ -399,21 +407,21 @@ const placements = [
|
|
|
399
407
|
["place-self-center", { "place-self": "center" }],
|
|
400
408
|
["place-self-stretch", { "place-self": "stretch" }]
|
|
401
409
|
];
|
|
402
|
-
function handleInsetValue(v) {
|
|
403
|
-
return utilities.handler.bracket.cssvar.auto.fraction.rem(v);
|
|
410
|
+
function handleInsetValue(v, { theme }) {
|
|
411
|
+
return theme.spacing?.[v] ?? utilities.handler.bracket.cssvar.auto.fraction.rem(v);
|
|
404
412
|
}
|
|
405
|
-
function handleInsetValues([, d, v]) {
|
|
406
|
-
const r = handleInsetValue(v);
|
|
413
|
+
function handleInsetValues([, d, v], ctx) {
|
|
414
|
+
const r = handleInsetValue(v, ctx);
|
|
407
415
|
if (r != null && d in utilities.insetMap)
|
|
408
416
|
return utilities.insetMap[d].map((i) => [i.slice(1), r]);
|
|
409
417
|
}
|
|
410
418
|
const insets = [
|
|
411
|
-
[/^(?:position-|pos-)?inset-(.+)$/, ([, v]) => ({ inset: handleInsetValue(v) })],
|
|
419
|
+
[/^(?:position-|pos-)?inset-(.+)$/, ([, v], ctx) => ({ inset: handleInsetValue(v, ctx) })],
|
|
412
420
|
[/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
|
|
413
421
|
[/^(?:position-|pos-)?inset-([rltbse])-(.+)$/, handleInsetValues],
|
|
414
422
|
[/^(?:position-|pos-)?inset-(block|inline)-(.+)$/, handleInsetValues],
|
|
415
423
|
[/^(?:position-|pos-)?inset-([bi][se])-(.+)$/, handleInsetValues],
|
|
416
|
-
[/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
|
|
424
|
+
[/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v], ctx) => ({ [d]: handleInsetValue(v, ctx) })]
|
|
417
425
|
];
|
|
418
426
|
const floats = [
|
|
419
427
|
["float-left", { float: "left" }],
|
|
@@ -509,45 +517,19 @@ const fontSmoothings = [
|
|
|
509
517
|
}]
|
|
510
518
|
];
|
|
511
519
|
|
|
512
|
-
const shadowBase = {
|
|
513
|
-
[core.CONTROL_SHORTCUT_NO_MERGE]: "",
|
|
514
|
-
"--un-ring-offset-shadow": "0 0 #0000",
|
|
515
|
-
"--un-ring-shadow": "0 0 #0000",
|
|
516
|
-
"--un-shadow-inset": varEmpty,
|
|
517
|
-
"--un-shadow": "0 0 #0000"
|
|
518
|
-
};
|
|
519
|
-
const boxShadows = [
|
|
520
|
-
[/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
|
|
521
|
-
const v = theme.boxShadow?.[d || "DEFAULT"];
|
|
522
|
-
if (v) {
|
|
523
|
-
return [
|
|
524
|
-
shadowBase,
|
|
525
|
-
{
|
|
526
|
-
"--un-shadow": utilities.colorableShadows(v, "--un-shadow-color").join(","),
|
|
527
|
-
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
528
|
-
}
|
|
529
|
-
];
|
|
530
|
-
}
|
|
531
|
-
}],
|
|
532
|
-
[/^shadow-(.+)$/, utilities.colorResolver("--un-shadow-color", "shadow")],
|
|
533
|
-
[/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
534
|
-
["shadow-inset", { "--un-shadow-inset": "inset" }]
|
|
535
|
-
];
|
|
536
|
-
|
|
537
|
-
const ringBase = {
|
|
538
|
-
...shadowBase,
|
|
539
|
-
"--un-ring-inset": varEmpty,
|
|
540
|
-
"--un-ring-offset-width": "0px",
|
|
541
|
-
"--un-ring-offset-color": "#fff",
|
|
542
|
-
"--un-ring-width": "0px",
|
|
543
|
-
"--un-ring-color": "rgba(147,197,253,0.5)"
|
|
544
|
-
};
|
|
545
520
|
const rings = [
|
|
546
|
-
[/^ring(?:-(.+))?$/, ([, d]) => {
|
|
547
|
-
const value = utilities.handler.px(d || "1");
|
|
521
|
+
[/^ring(?:-(.+))?$/, ([, d], { theme }) => {
|
|
522
|
+
const value = theme.ringWidth?.[d || "DEFAULT"] ?? utilities.handler.px(d || "1");
|
|
548
523
|
if (value) {
|
|
549
524
|
return [
|
|
550
|
-
|
|
525
|
+
{
|
|
526
|
+
[core.CONTROL_SHORTCUT_NO_MERGE]: "",
|
|
527
|
+
"--un-ring-inset": varEmpty,
|
|
528
|
+
"--un-ring-offset-width": "0px",
|
|
529
|
+
"--un-ring-offset-color": "#fff",
|
|
530
|
+
"--un-ring-width": "0px",
|
|
531
|
+
"--un-ring-color": "rgba(147,197,253,0.5)"
|
|
532
|
+
},
|
|
551
533
|
{
|
|
552
534
|
"--un-ring-width": value,
|
|
553
535
|
"--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
|
|
@@ -557,9 +539,9 @@ const rings = [
|
|
|
557
539
|
];
|
|
558
540
|
}
|
|
559
541
|
}],
|
|
560
|
-
[/^ring-(?:width-|size-)(.+)$/, ([, d]) => ({ "--un-ring-width": utilities.handler.bracket.cssvar.px(d) })],
|
|
542
|
+
[/^ring-(?:width-|size-)(.+)$/, ([, d], { theme }) => ({ "--un-ring-width": theme.lineWidth?.[d] ?? utilities.handler.bracket.cssvar.px(d) })],
|
|
561
543
|
["ring-offset", { "--un-ring-offset-width": "1px" }],
|
|
562
|
-
[/^ring-offset-(?:width-|size-)?(.+)$/, ([, d]) => ({ "--un-ring-offset-width": utilities.handler.bracket.cssvar.px(d) })],
|
|
544
|
+
[/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? utilities.handler.bracket.cssvar.px(d) })],
|
|
563
545
|
[/^ring-(.+)$/, utilities.colorResolver("--un-ring-color", "ring")],
|
|
564
546
|
[/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
565
547
|
[/^ring-offset-(.+)$/, utilities.colorResolver("--un-ring-offset-color", "ring-offset")],
|
|
@@ -567,6 +549,28 @@ const rings = [
|
|
|
567
549
|
["ring-inset", { "--un-ring-inset": "inset" }]
|
|
568
550
|
];
|
|
569
551
|
|
|
552
|
+
const boxShadows = [
|
|
553
|
+
[/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
|
|
554
|
+
const v = theme.boxShadow?.[d || "DEFAULT"];
|
|
555
|
+
if (v) {
|
|
556
|
+
return [
|
|
557
|
+
{
|
|
558
|
+
[core.CONTROL_SHORTCUT_NO_MERGE]: "",
|
|
559
|
+
"--un-shadow-inset": varEmpty,
|
|
560
|
+
"--un-shadow": "0 0 #0000"
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
"--un-shadow": utilities.colorableShadows(v, "--un-shadow-color").join(","),
|
|
564
|
+
"box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
|
|
565
|
+
}
|
|
566
|
+
];
|
|
567
|
+
}
|
|
568
|
+
}],
|
|
569
|
+
[/^shadow-(.+)$/, utilities.colorResolver("--un-shadow-color", "shadow")],
|
|
570
|
+
[/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
571
|
+
["shadow-inset", { "--un-shadow-inset": "inset" }]
|
|
572
|
+
];
|
|
573
|
+
|
|
570
574
|
const sizeMapping = {
|
|
571
575
|
h: "height",
|
|
572
576
|
w: "width",
|
|
@@ -708,8 +712,8 @@ const transforms = [
|
|
|
708
712
|
["transform-cpu", transformCpu],
|
|
709
713
|
["transform-none", { transform: "none" }]
|
|
710
714
|
];
|
|
711
|
-
function handleTranslate([, d, b]) {
|
|
712
|
-
const v = utilities.handler.bracket.cssvar.fraction.rem(b);
|
|
715
|
+
function handleTranslate([, d, b], { theme }) {
|
|
716
|
+
const v = theme.spacing?.[b] ?? utilities.handler.bracket.cssvar.fraction.rem(b);
|
|
713
717
|
if (v != null) {
|
|
714
718
|
return [
|
|
715
719
|
transformBase,
|
|
@@ -811,7 +815,7 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
|
811
815
|
|
|
812
816
|
const textDecorations = [
|
|
813
817
|
[/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s })],
|
|
814
|
-
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": utilities.handler.bracket.cssvar.px(s) })],
|
|
818
|
+
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s], { theme }) => ({ "text-decoration-thickness": theme.lineWidth?.[s] ?? utilities.handler.bracket.cssvar.px(s) })],
|
|
815
819
|
[/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
|
|
816
820
|
[/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
|
|
817
821
|
const result = utilities.colorResolver("text-decoration-color", "line")(match, ctx);
|
|
@@ -823,7 +827,7 @@ const textDecorations = [
|
|
|
823
827
|
}
|
|
824
828
|
}],
|
|
825
829
|
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
826
|
-
[/^(?:underline|decoration)-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": utilities.handler.auto.bracket.cssvar.px(s) })],
|
|
830
|
+
[/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? utilities.handler.auto.bracket.cssvar.px(s) })],
|
|
827
831
|
[/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)$/, ([, d]) => ({ "text-decoration-style": d })],
|
|
828
832
|
["no-underline", { "text-decoration": "none" }],
|
|
829
833
|
["decoration-none", { "text-decoration": "none" }]
|
|
@@ -833,9 +837,9 @@ const svgUtilities = [
|
|
|
833
837
|
[/^fill-(.+)$/, utilities.colorResolver("fill", "fill")],
|
|
834
838
|
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
835
839
|
["fill-none", { fill: "none" }],
|
|
836
|
-
[/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": utilities.handler.bracket.cssvar.fraction.px.number(s) })],
|
|
840
|
+
[/^stroke-(?:width-|size-)?(.+)$/, ([, s], { theme }) => ({ "stroke-width": theme.lineWidth?.[s] ?? utilities.handler.bracket.cssvar.fraction.px.number(s) })],
|
|
837
841
|
[/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": utilities.handler.bracket.cssvar.number(s) })],
|
|
838
|
-
[/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": utilities.handler.bracket.cssvar.px.numberWithUnit(s) })],
|
|
842
|
+
[/^stroke-offset-(.+)$/, ([, s], { theme }) => ({ "stroke-dashoffset": theme.lineWidth?.[s] ?? utilities.handler.bracket.cssvar.px.numberWithUnit(s) })],
|
|
839
843
|
[/^stroke-(.+)$/, utilities.colorResolver("stroke", "stroke")],
|
|
840
844
|
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": utilities.handler.bracket.percent(opacity) })],
|
|
841
845
|
["stroke-cap-square", { "stroke-linecap": "square" }],
|
|
@@ -942,7 +946,6 @@ exports.questionMark = questionMark;
|
|
|
942
946
|
exports.resizes = resizes;
|
|
943
947
|
exports.rings = rings;
|
|
944
948
|
exports.rules = rules;
|
|
945
|
-
exports.shadowBase = shadowBase;
|
|
946
949
|
exports.sizes = sizes;
|
|
947
950
|
exports.svgUtilities = svgUtilities;
|
|
948
951
|
exports.tabSizes = tabSizes;
|