@unocss/preset-mini 0.19.0 → 0.20.4

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.
@@ -115,12 +115,12 @@ const borderRadius = {
115
115
  "full": "9999px"
116
116
  };
117
117
  const boxShadow = {
118
- "DEFAULT": "0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), 0 1px 2px 0 rgba(var(--un-shadow-color), 0.06)",
119
- "sm": "0 1px 2px 0 rgba(var(--un-shadow-color), 0.05)",
120
- "md": "0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), 0 2px 4px -1px rgba(var(--un-shadow-color), 0.06)",
121
- "lg": "0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), 0 4px 6px -2px rgba(var(--un-shadow-color), 0.05)",
122
- "xl": "0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), 0 10px 10px -5px rgba(var(--un-shadow-color), 0.04)",
123
- "2xl": "25px 50px -12px rgba(var(--un-shadow-color), 0.25)",
118
+ "DEFAULT": "var(--un-shadow-inset) 0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 1px 2px 0 rgba(var(--un-shadow-color), 0.06)",
119
+ "sm": "var(--un-shadow-inset) 0 1px 2px 0 rgba(var(--un-shadow-color), 0.05)",
120
+ "md": "var(--un-shadow-inset) 0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 2px 4px -1px rgba(var(--un-shadow-color), 0.06)",
121
+ "lg": "var(--un-shadow-inset) 0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 4px 6px -2px rgba(var(--un-shadow-color), 0.05)",
122
+ "xl": "var(--un-shadow-inset) 0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 10px 10px -5px rgba(var(--un-shadow-color), 0.04)",
123
+ "2xl": "var(--un-shadow-inset) 0 25px 50px -12px rgba(var(--un-shadow-color), 0.25)",
124
124
  "inner": "inset 0 2px 4px 0 rgba(var(--un-shadow-color), 0.06)",
125
125
  "none": "none"
126
126
  };
@@ -113,12 +113,12 @@ const borderRadius = {
113
113
  "full": "9999px"
114
114
  };
115
115
  const boxShadow = {
116
- "DEFAULT": "0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), 0 1px 2px 0 rgba(var(--un-shadow-color), 0.06)",
117
- "sm": "0 1px 2px 0 rgba(var(--un-shadow-color), 0.05)",
118
- "md": "0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), 0 2px 4px -1px rgba(var(--un-shadow-color), 0.06)",
119
- "lg": "0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), 0 4px 6px -2px rgba(var(--un-shadow-color), 0.05)",
120
- "xl": "0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), 0 10px 10px -5px rgba(var(--un-shadow-color), 0.04)",
121
- "2xl": "25px 50px -12px rgba(var(--un-shadow-color), 0.25)",
116
+ "DEFAULT": "var(--un-shadow-inset) 0 1px 3px 0 rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 1px 2px 0 rgba(var(--un-shadow-color), 0.06)",
117
+ "sm": "var(--un-shadow-inset) 0 1px 2px 0 rgba(var(--un-shadow-color), 0.05)",
118
+ "md": "var(--un-shadow-inset) 0 4px 6px -1px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 2px 4px -1px rgba(var(--un-shadow-color), 0.06)",
119
+ "lg": "var(--un-shadow-inset) 0 10px 15px -3px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 4px 6px -2px rgba(var(--un-shadow-color), 0.05)",
120
+ "xl": "var(--un-shadow-inset) 0 20px 25px -5px rgba(var(--un-shadow-color), 0.1), var(--un-shadow-inset) 0 10px 10px -5px rgba(var(--un-shadow-color), 0.04)",
121
+ "2xl": "var(--un-shadow-inset) 0 25px 50px -12px rgba(var(--un-shadow-color), 0.25)",
122
122
  "inner": "inset 0 2px 4px 0 rgba(var(--un-shadow-color), 0.06)",
123
123
  "none": "none"
124
124
  };
@@ -38,63 +38,61 @@ const willChange = [
38
38
  ];
39
39
 
40
40
  const borders = [
41
- [/^border$/, handlerBorder],
42
- [/^(?:border|b)()-(.+)$/, handlerBorder],
43
- [/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorder],
44
- [/^(?:border|b)()-size-(.+)$/, handlerBorderSize],
45
- [/^(?:border|b)-([^-]+)-size-(.+)$/, handlerBorderSize],
46
- [/^(?:border|b)()-(.+)$/, handlerBorderColor],
47
- [/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
48
- [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity], { options: { variablePrefix: p } }) => ({ [`--${p}border-opacity`]: utilities.handler.bracket.percent(opacity) })],
49
- [/^(?:border|b)-([^-]+)-op(?:acity)?-?(.+)$/, ([, a, opacity], { options: { variablePrefix: p } }) => {
50
- const v = utilities.handler.bracket.percent(opacity);
51
- const d = utilities.directionMap[a];
52
- if (v !== void 0 && d)
53
- return d.map((i) => [`--${p}border${i}-opacity`, v]);
54
- }],
55
- [/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
56
- [/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
57
- [/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(.+))?$/, handlerRounded],
41
+ [/^(?:border|b)()(?:-(.+))?$/, handlerBorder],
42
+ [/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
43
+ [/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorder],
44
+ [/^(?:border|b)-()size-(.+)$/, handlerBorderSize],
45
+ [/^(?:border|b)-([xy])-size-(.+)$/, handlerBorderSize],
46
+ [/^(?:border|b)-([rltbse])-size-(.+)$/, handlerBorderSize],
47
+ [/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor],
48
+ [/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColor],
49
+ [/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColor],
50
+ [/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity],
51
+ [/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
52
+ [/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
53
+ [/^(?:border-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded],
54
+ [/^(?:border-)?(?:rounded|rd)-([xy])(?:-(.+))?$/, handlerRounded],
55
+ [/^(?:border-)?(?:rounded|rd)-([rltb])(?:-(.+))?$/, handlerRounded],
56
+ [/^(?:border-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
58
57
  ["border-solid", { "border-style": "solid" }],
59
58
  ["border-dashed", { "border-style": "dashed" }],
60
59
  ["border-dotted", { "border-style": "dotted" }],
61
60
  ["border-double", { "border-style": "double" }],
61
+ ["border-hidden", { "border-style": "hidden" }],
62
62
  ["border-none", { "border-style": "none" }]
63
63
  ];
64
64
  const borderHasColor = (color, { theme }) => {
65
65
  return color !== void 0 && !!utilities.parseColor(color, theme)?.color;
66
66
  };
67
- const borderColorResolver = (direction) => ([, body], { theme, options: { variablePrefix: p } }) => {
67
+ const borderColorResolver = (direction) => ([, body], { theme }) => {
68
68
  const data = utilities.parseColor(body, theme);
69
69
  if (!data)
70
70
  return;
71
- const { opacity, color, rgba } = data;
71
+ const { alpha, opacity, color, rgba } = data;
72
72
  if (!color)
73
73
  return;
74
- const a = opacity ? opacity[0] === "[" ? utilities.handler.bracket.percent(opacity) : parseFloat(opacity) / 100 : rgba?.[3];
75
74
  if (rgba) {
76
- if (a != null && !Number.isNaN(a)) {
77
- rgba[3] = typeof a === "string" && !a.includes("%") ? parseFloat(a) : a;
75
+ if (alpha != null) {
78
76
  return {
79
77
  [`border${direction}-color`]: `rgba(${rgba.join(",")})`
80
78
  };
81
79
  } else {
82
80
  if (direction === "") {
83
81
  return {
84
- [`--${p}border-opacity`]: 1,
85
- [`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--${p}border${direction}-opacity))`
82
+ "--un-border-opacity": (opacity && utilities.handler.cssvar(opacity)) ?? 1,
83
+ [`border${direction}-color`]: `rgba(${rgba.join(",")},var(--un-border${direction}-opacity))`
86
84
  };
87
85
  } else {
88
86
  return {
89
- [`--${p}border-opacity`]: 1,
90
- [`--${p}border${direction}-opacity`]: `var(--${p}border-opacity)`,
91
- [`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--${p}border${direction}-opacity))`
87
+ "--un-border-opacity": (opacity && utilities.handler.cssvar(opacity)) ?? 1,
88
+ [`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
89
+ [`border${direction}-color`]: `rgba(${rgba.join(",")},var(--un-border${direction}-opacity))`
92
90
  };
93
91
  }
94
92
  }
95
93
  } else {
96
94
  return {
97
- [`border${direction}-color`]: color.replace("%alpha", `${a || 1}`)
95
+ [`border${direction}-color`]: color.replace("%alpha", `${alpha || 1}`)
98
96
  };
99
97
  }
100
98
  };
@@ -107,22 +105,25 @@ function handlerBorder(m) {
107
105
  ];
108
106
  }
109
107
  }
110
- function handlerBorderSize([, a, b]) {
111
- const [d, s = "1"] = utilities.directionMap[a] ? [a, b] : ["", a];
112
- const v = utilities.handler.bracket.px(s);
113
- if (v !== void 0)
114
- return utilities.directionMap[d].map((i) => [`border${i}-width`, v]);
108
+ function handlerBorderSize([, a = "", b = "1"]) {
109
+ const v = utilities.handler.bracket.px(b);
110
+ if (a in utilities.directionMap && v != null)
111
+ return utilities.directionMap[a].map((i) => [`border${i}-width`, v]);
115
112
  }
116
- function handlerBorderColor([, a, c], ctx) {
117
- if (borderHasColor(c, ctx)) {
118
- return Object.assign({}, ...utilities.directionMap[utilities.directionMap[a] ? a : ""].map((i) => borderColorResolver(i)(["", c], ctx)));
113
+ function handlerBorderColor([, a = "", c], ctx) {
114
+ if (a in utilities.directionMap && borderHasColor(c, ctx)) {
115
+ return Object.assign({}, ...utilities.directionMap[a].map((i) => borderColorResolver(i)(["", c], ctx)));
119
116
  }
120
117
  }
121
- function handlerRounded([, a, b], { theme }) {
122
- const [d, s = "DEFAULT"] = utilities.cornerMap[a] ? [a, b] : ["", a];
118
+ function handlerBorderOpacity([, a = "", opacity]) {
119
+ const v = utilities.handler.bracket.percent(opacity);
120
+ if (a in utilities.directionMap && v != null)
121
+ return utilities.directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
122
+ }
123
+ function handlerRounded([, a = "", s = "DEFAULT"], { theme }) {
123
124
  const v = theme.borderRadius?.[s] || utilities.handler.auto.rem.fraction.bracket.cssvar(s);
124
- if (v !== void 0)
125
- return utilities.cornerMap[d].map((i) => [`border${i}-radius`, v]);
125
+ if (a in utilities.cornerMap && v != null)
126
+ return utilities.cornerMap[a].map((i) => [`border${i}-radius`, v]);
126
127
  }
127
128
 
128
129
  const opacity = [
@@ -137,12 +138,19 @@ const bgColors = [
137
138
  [/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": utilities.handler.bracket.percent(opacity2) })]
138
139
  ];
139
140
 
141
+ const transitionPropertyGroup = {
142
+ all: "all",
143
+ colors: ["color", "background-color", "border-color", "text-decoration-color", "fill", "stroke"].join(","),
144
+ opacity: "opacity",
145
+ shadow: "box-shadow",
146
+ transform: "transform"
147
+ };
140
148
  const transitionProperty = (prop) => {
141
- return utilities.handler.properties(prop) || (prop === "all" ? prop : void 0);
149
+ return utilities.handler.properties(prop) ?? transitionPropertyGroup[prop];
142
150
  };
143
151
  const transitions = [
144
- [/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop = "all", duration = "150"]) => {
145
- const p = transitionProperty(prop);
152
+ [/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
153
+ const p = prop != null ? transitionProperty(prop) : [transitionPropertyGroup.colors, "opacity", "box-shadow", "transform", "filter", "backdrop-filter"].join(",");
146
154
  if (p) {
147
155
  return {
148
156
  "transition-property": p,
@@ -151,14 +159,14 @@ const transitions = [
151
159
  };
152
160
  }
153
161
  }],
154
- [/^duration-(\d+)$/, ([, duration = "150"]) => ({ "transition-duration": `${duration}ms` })],
162
+ [/^(?:transition-)?delay-(.+)(?:s|ms)?$/, ([, d]) => ({ "transition-delay": utilities.handler.bracket.time(d) })],
163
+ [/^(?:transition-)?duration-(.+)(?:s|ms)?$/, ([, d]) => ({ "transition-duration": utilities.handler.bracket.time(d) })],
164
+ [/^ease-(.+)$/, ([, d]) => ({ "transition-timing-function": utilities.handler.bracket(d) })],
155
165
  ["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
156
166
  ["ease-linear", { "transition-timing-function": "linear" }],
157
167
  ["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
158
168
  ["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
159
169
  ["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
160
- [/^transition-delay-(\d+)$/, ([, v]) => ({ "transition-delay": `${v}ms` })],
161
- [/^transition-duration-(\d+)$/, ([, v]) => ({ "transition-duration": `${v}ms` })],
162
170
  [/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": utilities.handler.global(v) || transitionProperty(v) })],
163
171
  ["transition-property-none", { "transition-property": "none" }],
164
172
  ["property-none", { "transition-property": "none" }],
@@ -178,6 +186,7 @@ const flex = [
178
186
  ["flex-shrink-0", { "flex-shrink": 0 }],
179
187
  ["flex-grow", { "flex-grow": 1 }],
180
188
  ["flex-grow-0", { "flex-grow": 0 }],
189
+ [/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": utilities.handler.bracket.fraction.auto.rem(d) })],
181
190
  ["flex-row", { "flex-direction": "row" }],
182
191
  ["flex-row-reverse", { "flex-direction": "row-reverse" }],
183
192
  ["flex-col", { "flex-direction": "column" }],
@@ -199,14 +208,7 @@ const weightMap = {
199
208
  black: "900"
200
209
  };
201
210
  const fonts = [
202
- [/^font-(\w+)$/, ([, d], { theme }) => {
203
- const font = theme.fontFamily?.[d];
204
- if (font) {
205
- return {
206
- "font-family": font
207
- };
208
- }
209
- }],
211
+ [/^font-(\w+)$/, ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] })],
210
212
  [/^text-(.+)$/, ([, s = "base"], { theme }) => {
211
213
  const size = utilities.handler.bracket.auto.rem(s);
212
214
  if (size)
@@ -220,37 +222,16 @@ const fonts = [
220
222
  };
221
223
  }
222
224
  }],
223
- [/^text-size-(.+)$/, ([, s]) => {
224
- const raw = utilities.handler.bracket.auto.rem(s);
225
- if (raw)
226
- return { "font-size": raw };
227
- }],
228
- [/^(?:font|fw)-?([^-]+)$/, ([, s]) => {
229
- const v = weightMap[s] || utilities.handler.number(s);
230
- if (v)
231
- return { "font-weight": v };
232
- }],
233
- [/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
234
- const v = theme.lineHeight?.[s] || utilities.handler.bracket.auto.rem(s);
235
- if (v !== null)
236
- return { "line-height": v };
237
- }],
238
- [/^tracking-([^-]+)$/, ([, s], { theme }) => {
239
- const v = theme.letterSpacing?.[s] || utilities.handler.bracket.auto.rem(s);
240
- if (v !== null)
241
- return { "letter-spacing": v };
242
- }],
243
- [/^word-spacing-([^-]+)$/, ([, s], { theme }) => {
244
- const v = theme.wordSpacing?.[s] || utilities.handler.bracket.auto.rem(s);
245
- if (v !== null)
246
- return { "word-spacing": v };
247
- }]
225
+ [/^text-size-(.+)$/, ([, s]) => ({ "font-size": utilities.handler.bracket.auto.rem(s) })],
226
+ [/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || utilities.handler.number(s) })],
227
+ [/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || utilities.handler.bracket.auto.rem(s) })],
228
+ [/^tracking-([^-]+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || utilities.handler.bracket.auto.rem(s) })],
229
+ [/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || utilities.handler.bracket.auto.rem(s) })]
248
230
  ];
249
231
  const tabSizes = [
250
232
  [/^tab-?([^-]*)$/, ([, s]) => {
251
- s = s || "4";
252
- const v = utilities.handler.bracket.global.number(s);
253
- if (v !== null) {
233
+ const v = utilities.handler.bracket.global.number(s || "4");
234
+ if (v != null) {
254
235
  return {
255
236
  "-moz-tab-size": v,
256
237
  "-o-tab-size": v,
@@ -260,44 +241,34 @@ const tabSizes = [
260
241
  }]
261
242
  ];
262
243
  const textIndents = [
263
- [/^indent(?:-(.+))?$/, ([, s], { theme }) => {
264
- const v = theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.auto.rem(s);
265
- if (v != null)
266
- return { "text-indent": v };
267
- }]
244
+ [/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.auto.rem(s) })]
268
245
  ];
269
246
  const textStrokes = [
270
- [/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => {
271
- const v = theme.textStrokeWidth?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.px(s);
272
- if (v != null)
273
- return { "-webkit-text-stroke-width": v };
274
- }],
247
+ [/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.px(s) })],
275
248
  [/^text-stroke-(.+)$/, utilities.colorResolver("-webkit-text-stroke-color", "text-stroke")],
276
249
  [/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": utilities.handler.bracket.percent(opacity) })]
277
250
  ];
278
251
  const textShadows = [
279
- [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
280
- const v = theme.textShadow?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar(s);
281
- if (v != null)
282
- return { "text-shadow": v };
283
- }]
252
+ [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => ({ "text-shadow": theme.textShadow?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar(s) })]
284
253
  ];
285
254
 
255
+ const directions = {
256
+ "": "",
257
+ "x": "column-",
258
+ "y": "row-"
259
+ };
260
+ const handleGap = ([, d = "", s]) => {
261
+ const v = utilities.handler.bracket.auto.rem(s);
262
+ if (v != null) {
263
+ return {
264
+ [`grid-${directions[d]}gap`]: v,
265
+ [`${directions[d]}gap`]: v
266
+ };
267
+ }
268
+ };
286
269
  const gaps = [
287
- [/^(?:flex-|grid-)?gap-(x-|y-)?([^-]+)$/, ([, d = "", s]) => {
288
- const v = utilities.handler.bracket.auto.rem(s);
289
- if (v != null) {
290
- const direction = {
291
- "": "",
292
- "x-": "column-",
293
- "y-": "row-"
294
- }[d];
295
- return {
296
- [`grid-${direction}gap`]: v,
297
- [`${direction}gap`]: v
298
- };
299
- }
300
- }]
270
+ [/^(?:flex-|grid-)?gap-()([^-]+)$/, handleGap],
271
+ [/^(?:flex-|grid-)?gap-([xy])-([^-]+)$/, handleGap]
301
272
  ];
302
273
 
303
274
  const calSize = (s, theme) => core.toArray(theme.fontSize?.[s] || utilities.handler.bracket.auto.rem(s))[0];
@@ -355,7 +326,6 @@ const overflows = [
355
326
  [/^(?:overflow|of)-([xy])-(.+)$/, ([, d, v]) => overflowValues.includes(v) ? { [`overflow-${d}`]: v } : void 0]
356
327
  ];
357
328
 
358
- const basicSet = ["auto", "start", "end", "center", "stretch"];
359
329
  const positions = [
360
330
  [/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, ([, v]) => ({ position: v })],
361
331
  [/^(?:position-|pos-)?(static)$/, ([, v]) => ({ position: v })]
@@ -367,8 +337,15 @@ const justifies = [
367
337
  ["justify-between", { "justify-content": "space-between" }],
368
338
  ["justify-around", { "justify-content": "space-around" }],
369
339
  ["justify-evenly", { "justify-content": "space-evenly" }],
370
- ...basicSet.map((i) => [`justify-items-${i}`, { "justify-items": i }]),
371
- ...basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }])
340
+ ["justify-items-start", { "justify-items": "start" }],
341
+ ["justify-items-end", { "justify-items": "end" }],
342
+ ["justify-items-center", { "justify-items": "center" }],
343
+ ["justify-items-stretch", { "justify-items": "stretch" }],
344
+ ["justify-self-auto", { "justify-self": "auto" }],
345
+ ["justify-self-start", { "justify-self": "start" }],
346
+ ["justify-self-end", { "justify-self": "end" }],
347
+ ["justify-self-center", { "justify-self": "center" }],
348
+ ["justify-self-stretch", { "justify-self": "stretch" }]
372
349
  ];
373
350
  const orders = [
374
351
  [/^order-(.+)$/, ([, v]) => ({ order: utilities.handler.bracket.number(v) })],
@@ -377,9 +354,9 @@ const orders = [
377
354
  ["order-none", { order: "0" }]
378
355
  ];
379
356
  const alignments = [
357
+ ["content-center", { "align-content": "center" }],
380
358
  ["content-start", { "align-content": "flex-start" }],
381
359
  ["content-end", { "align-content": "flex-end" }],
382
- ["content-center", { "align-content": "center" }],
383
360
  ["content-between", { "align-content": "space-between" }],
384
361
  ["content-around", { "align-content": "space-around" }],
385
362
  ["content-evenly", { "align-content": "space-evenly" }],
@@ -392,29 +369,39 @@ const alignments = [
392
369
  ["self-start", { "align-self": "flex-start" }],
393
370
  ["self-end", { "align-self": "flex-end" }],
394
371
  ["self-center", { "align-self": "center" }],
395
- ["self-stretch", { "align-self": "stretch" }]
372
+ ["self-stretch", { "align-self": "stretch" }],
373
+ ["self-baseline", { "align-self": "baseline" }]
396
374
  ];
397
375
  const placements = [
376
+ ["place-content-center", { "place-content": "center" }],
398
377
  ["place-content-start", { "place-content": "start" }],
399
378
  ["place-content-end", { "place-content": "end" }],
400
- ["place-content-center", { "place-content": "center" }],
401
379
  ["place-content-between", { "place-content": "space-between" }],
402
380
  ["place-content-around", { "place-content": "space-around" }],
403
381
  ["place-content-evenly", { "place-content": "space-evenly" }],
404
382
  ["place-content-stretch", { "place-content": "stretch" }],
405
- ...basicSet.map((i) => [`place-items-${i}`, { "place-items": i }]),
406
- ...basicSet.map((i) => [`place-self-${i}`, { "place-self": i }])
383
+ ["place-items-start", { "place-items": "start" }],
384
+ ["place-items-end", { "place-items": "end" }],
385
+ ["place-items-center", { "place-items": "center" }],
386
+ ["place-items-stretch", { "place-items": "stretch" }],
387
+ ["place-self-auto", { "place-self": "auto" }],
388
+ ["place-self-start", { "place-self": "start" }],
389
+ ["place-self-end", { "place-self": "end" }],
390
+ ["place-self-center", { "place-self": "center" }],
391
+ ["place-self-stretch", { "place-self": "stretch" }]
407
392
  ];
408
393
  function handleInsetValue(v) {
409
394
  return { auto: "auto", full: "100%" }[v] ?? utilities.handler.bracket.fraction.cssvar.auto.rem(v);
410
395
  }
396
+ function handleInsetValues([, d, v]) {
397
+ const r = handleInsetValue(v);
398
+ if (r != null && d in utilities.directionMap)
399
+ return utilities.directionMap[d].map((i) => [i.slice(1), r]);
400
+ }
411
401
  const insets = [
412
- [/^(?:position-|pos-)?(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
413
- [/^(?:position-|pos-)?inset-([xy])-(.+)$/, ([, d, v]) => {
414
- const r = handleInsetValue(v);
415
- if (r != null && d in utilities.directionMap)
416
- return utilities.directionMap[d].map((i) => [i.slice(1), r]);
417
- }]
402
+ [/^(?:position-|pos-)?inset-()(.+)$/, handleInsetValues],
403
+ [/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
404
+ [/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
418
405
  ];
419
406
  const floats = [
420
407
  ["float-left", { float: "left" }],
@@ -434,7 +421,6 @@ const boxSizing = [
434
421
  ["box-content", { "box-sizing": "content-box" }]
435
422
  ];
436
423
 
437
- const varEmptyFn = core.cacheFunction((prefix) => `var(--${prefix}empty,/*!*/ /*!*/)`);
438
424
  const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
439
425
  const displays = [
440
426
  ["inline", { display: "inline" }],
@@ -510,31 +496,30 @@ const fontSmoothings = [
510
496
  ];
511
497
 
512
498
  const rings = [
513
- [/^ring-?(.*)$/, ([, d], { options: { variablePrefix: p } }) => {
499
+ [/^ring-?(.*)$/, ([, d]) => {
514
500
  const value = utilities.handler.px(d || "1");
515
501
  if (value) {
516
502
  return {
517
- [`--${p}ring-inset`]: varEmptyFn(p),
518
- [`--${p}ring-offset-width`]: "0px",
519
- [`--${p}ring-offset-color`]: "#fff",
520
- [`--${p}ring-color`]: "rgba(59, 130, 246, .5)",
521
- [`--${p}ring-offset-shadow`]: `var(--${p}ring-inset) 0 0 0 var(--${p}ring-offset-width) var(--${p}ring-offset-color)`,
522
- [`--${p}ring-shadow`]: `var(--${p}ring-inset) 0 0 0 calc(${value} + var(--${p}ring-offset-width)) var(--${p}ring-color)`,
523
- "-webkit-box-shadow": `var(--${p}ring-offset-shadow), var(--${p}ring-shadow), var(--${p}shadow, 0 0 #0000)`,
524
- "box-shadow": `var(--${p}ring-offset-shadow), var(--${p}ring-shadow), var(--${p}shadow, 0 0 #0000)`
503
+ "--un-ring-inset": varEmpty,
504
+ "--un-ring-offset-width": "0px",
505
+ "--un-ring-offset-color": "#fff",
506
+ "--un-ring-color": "rgba(59, 130, 246, .5)",
507
+ "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
508
+ "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
509
+ "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
525
510
  };
526
511
  }
527
512
  }],
528
- [/^ring-offset$/, (_, { options: { variablePrefix: p } }) => ({ [`--${p}ring-offset-width`]: "1px" })],
529
- [/^ring-offset-(.+)$/, ([, d], { options: { variablePrefix: p } }) => ({ [`--${p}ring-offset-width`]: utilities.handler.px(d || "1") })],
530
- [/^ring-(.+)$/, (m, ctx) => utilities.colorResolver(`--${ctx.options.variablePrefix}ring-color`, "ring")(m, ctx)],
531
- [/^ring-op(?:acity)?-?(.+)$/, ([, opacity], { options: { variablePrefix: p } }) => ({ [`--${p}ring-opacity`]: utilities.handler.bracket.percent(opacity) })],
532
- [/^ring-offset-(.+)$/, (m, ctx) => utilities.colorResolver(`--${ctx.options.variablePrefix}ring-offset-color`, "ring-offset")(m, ctx)],
533
- [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity], { options: { variablePrefix: p } }) => ({ [`--${p}ring-offset-opacity`]: utilities.handler.bracket.percent(opacity) })],
534
- [/^ring-inset$/, (_, { options: { variablePrefix: p } }) => ({ [`--${p}ring-inset`]: "inset" })]
513
+ ["ring-offset", { "--un-ring-offset-width": "1px" }],
514
+ [/^ring-offset-(.+)$/, ([, d]) => ({ "--un-ring-offset-width": utilities.handler.px(d || "1") })],
515
+ [/^ring-(.+)$/, utilities.colorResolver("--un-ring-color", "ring")],
516
+ [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity) })],
517
+ [/^ring-offset-(.+)$/, utilities.colorResolver("--un-ring-offset-color", "ring-offset")],
518
+ [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": utilities.handler.bracket.percent(opacity) })],
519
+ ["ring-inset", { "--un-ring-inset": "inset" }]
535
520
  ];
536
521
 
537
- const colorResolver = (body, theme) => {
522
+ const shadowColorResolver = (body, theme) => {
538
523
  const data = utilities.parseColor(body, theme);
539
524
  if (!data)
540
525
  return;
@@ -556,13 +541,15 @@ const boxShadows = [
556
541
  const value = theme.boxShadow?.[d || "DEFAULT"];
557
542
  if (value) {
558
543
  return {
544
+ "--un-shadow-inset": varEmpty,
559
545
  "--un-shadow-color": "0,0,0",
560
546
  "--un-shadow": value,
561
547
  "box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
562
548
  };
563
549
  }
564
550
  }],
565
- [/^shadow-(.+)$/, ([, d], { theme }) => colorResolver(d, theme)]
551
+ [/^shadow-(.+)$/, ([, d], { theme }) => shadowColorResolver(d, theme)],
552
+ ["shadow-inset", { "--un-shadow-inset": "inset" }]
566
553
  ];
567
554
 
568
555
  function getPropName(minmax, hw) {
@@ -587,11 +574,17 @@ const sizes = [
587
574
  }]
588
575
  ];
589
576
  const aspectRatio = [
590
- ["aspect-ratio-auto", { "aspect-ratio": "auto" }],
591
- [/^aspect-ratio-(.+)$/, ([, d]) => {
592
- const v = (/^\d+\/\d+$/.test(d) ? d : null) || utilities.handler.bracket.cssvar.number(d);
577
+ [/^aspect-(?:ratio-)?(.+)$/, ([, d]) => {
578
+ if (/^\d+\/\d+$/.test(d))
579
+ return { "aspect-ratio": d };
580
+ const v = {
581
+ auto: "auto",
582
+ square: "1/1",
583
+ video: "16/9"
584
+ }[d];
593
585
  if (v != null)
594
586
  return { "aspect-ratio": v };
587
+ return { "aspect-ratio": utilities.handler.bracket.cssvar.number(d) };
595
588
  }]
596
589
  ];
597
590
 
@@ -640,24 +633,14 @@ const transforms = [
640
633
  ["transform-gpu", transformGpu],
641
634
  ["transform-cpu", transformCpu],
642
635
  ["transform-none", { transform: "none" }],
643
- ["origin-center", { "transform-origin": "center" }],
644
- ["origin-top", { "transform-origin": "top" }],
645
- ["origin-top-right", { "transform-origin": "top right" }],
646
- ["origin-right", { "transform-origin": "right" }],
647
- ["origin-bottom-right", { "transform-origin": "bottom right" }],
648
- ["origin-bottom", { "transform-origin": "bottom" }],
649
- ["origin-bottom-left", { "transform-origin": "bottom left" }],
650
- ["origin-left", { "transform-origin": "left" }],
651
- ["origin-top-left", { "transform-origin": "top left" }]
636
+ [/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] })]
652
637
  ];
653
638
  function handleTranslate([, d, b]) {
654
639
  const v = utilities.handler.bracket.fraction.auto.rem(b);
655
640
  if (v != null) {
656
641
  return [
657
642
  transformBase,
658
- [
659
- ...utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v])
660
- ]
643
+ utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v])
661
644
  ];
662
645
  }
663
646
  }
@@ -666,9 +649,7 @@ function handleScale([, d, b]) {
666
649
  if (v != null) {
667
650
  return [
668
651
  transformBase,
669
- [
670
- ...utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v])
671
- ]
652
+ utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v])
672
653
  ];
673
654
  }
674
655
  }
@@ -716,17 +697,12 @@ const variablesAbbrMap = {
716
697
  "backface": "backface-visibility",
717
698
  "whitespace": "white-space",
718
699
  "break": "word-break",
719
- "b": "border-color",
720
- "border": "border-color",
721
- "color": "color",
722
700
  "case": "text-transform",
723
701
  "origin": "transform-origin",
724
- "bg": "background-color",
725
702
  "bg-opacity": "background-opacity",
726
703
  "tab": "tab-size",
727
704
  "underline": "text-decoration-thickness",
728
705
  "underline-offset": "text-underline-offset",
729
- "text": "color",
730
706
  "grid-cols": "grid-template-columns",
731
707
  "grid-rows": "grid-template-rows",
732
708
  "auto-flow": "grid-auto-flow",
@@ -741,15 +717,8 @@ const variablesAbbrMap = {
741
717
  const cssVariables = [
742
718
  [/^(.+)-\$(.+)$/, ([, name, varname]) => {
743
719
  const prop = variablesAbbrMap[name];
744
- if (prop) {
745
- return {
746
- [prop]: `var(--${varname})`
747
- };
748
- }
749
- }],
750
- [/^(?:border|b)-([^-]+)-\$(.+)$/, ([, a, v]) => {
751
- if (a in utilities.directionMap)
752
- return utilities.directionMap[a].map((i) => [`border${i}-color`, `var(--${v})`]);
720
+ if (prop)
721
+ return { [prop]: `var(--${varname})` };
753
722
  }]
754
723
  ];
755
724
 
@@ -791,11 +760,7 @@ const svgUtilities = [
791
760
  [/^fill-(.+)$/, utilities.colorResolver("fill", "fill")],
792
761
  [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
793
762
  ["fill-none", { fill: "none" }],
794
- [/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => {
795
- const v = utilities.handler.bracket.fraction.px.number(s);
796
- if (v)
797
- return { "stroke-width": v };
798
- }],
763
+ [/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => ({ "stroke-width": utilities.handler.bracket.fraction.px.number(s) })],
799
764
  [/^stroke-(.+)$/, utilities.colorResolver("stroke", "stroke")],
800
765
  [/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": utilities.handler.bracket.percent(opacity) })],
801
766
  ["stroke-none", { stroke: "none" }]
@@ -907,7 +872,6 @@ exports.transforms = transforms;
907
872
  exports.transitions = transitions;
908
873
  exports.userSelects = userSelects;
909
874
  exports.varEmpty = varEmpty;
910
- exports.varEmptyFn = varEmptyFn;
911
875
  exports.verticalAligns = verticalAligns;
912
876
  exports.whitespaces = whitespaces;
913
877
  exports.willChange = willChange;