@unocss/preset-mini 0.36.0 → 0.37.0

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.
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index.cjs');
4
3
  const utilities = require('./utilities.cjs');
5
4
  const core = require('@unocss/core');
6
5
  const transform = require('./transform.cjs');
@@ -21,14 +20,14 @@ const verticalAlignAlias = {
21
20
  const verticalAligns = [
22
21
  [/^(?:vertical|align|v)-(.+)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] }), { autocomplete: `(vertical|align|v)-(${Object.keys(verticalAlignAlias).join("|")})` }]
23
22
  ];
24
- const textAligns = ["center", "left", "right", "justify", "start", "end", ...index.globalKeywords].map((v) => [`text-${v}`, { "text-align": v }]);
23
+ const textAligns = ["center", "left", "right", "justify", "start", "end", ...utilities.globalKeywords].map((v) => [`text-${v}`, { "text-align": v }]);
25
24
 
26
25
  const outline = [
27
- [/^outline-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "outline-width": theme.lineWidth?.[d] ?? index.handler.bracket.cssvar.px(d) }), { autocomplete: "outline-(width|size)-<num>" }],
26
+ [/^outline-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "outline-width": theme.lineWidth?.[d] ?? utilities.handler.bracket.cssvar.px(d) }), { autocomplete: "outline-(width|size)-<num>" }],
28
27
  [/^outline-(?:color-)?(.+)$/, utilities.colorResolver("outline-color", "outline-color"), { autocomplete: "outline-$colors" }],
29
- [/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? index.handler.bracket.cssvar.px(d) }), { autocomplete: "outline-(offset)-<num>" }],
28
+ [/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? utilities.handler.bracket.cssvar.px(d) }), { autocomplete: "outline-(offset)-<num>" }],
30
29
  ["outline", { "outline-style": "solid" }],
31
- ...["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset", ...index.globalKeywords].map((v) => [`outline-${v}`, { "outline-style": v }]),
30
+ ...["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset", ...utilities.globalKeywords].map((v) => [`outline-${v}`, { "outline-style": v }]),
32
31
  ["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
33
32
  ];
34
33
  const appearance = [
@@ -38,7 +37,7 @@ const appearance = [
38
37
  }]
39
38
  ];
40
39
  const willChangeProperty = (prop) => {
41
- return index.handler.properties.auto.global(prop) ?? {
40
+ return utilities.handler.properties.auto.global(prop) ?? {
42
41
  contents: "contents",
43
42
  scroll: "scroll-position"
44
43
  }[prop];
@@ -47,7 +46,7 @@ const willChange = [
47
46
  [/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]
48
47
  ];
49
48
 
50
- const borderStyles = ["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset", ...index.globalKeywords];
49
+ const borderStyles = ["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset", ...utilities.globalKeywords];
51
50
  const borders = [
52
51
  [/^(?:border|b)()(?:-(.+))?$/, handlerBorder, { autocomplete: "(border|b)-<directions>" }],
53
52
  [/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
@@ -120,40 +119,40 @@ function handlerBorder(m, ctx) {
120
119
  }
121
120
  }
122
121
  function handlerBorderSize([, a = "", b], { theme }) {
123
- const v = theme.lineWidth?.[b || "DEFAULT"] ?? index.handler.bracket.cssvar.px(b || "1");
124
- if (a in index.directionMap && v != null)
125
- return index.directionMap[a].map((i) => [`border${i}-width`, v]);
122
+ const v = theme.lineWidth?.[b || "DEFAULT"] ?? utilities.handler.bracket.cssvar.px(b || "1");
123
+ if (a in utilities.directionMap && v != null)
124
+ return utilities.directionMap[a].map((i) => [`border${i}-width`, v]);
126
125
  }
127
126
  function handlerBorderColor([, a = "", c], { theme }) {
128
- if (a in index.directionMap && utilities.hasParseableColor(c, theme)) {
129
- return Object.assign({}, ...index.directionMap[a].map((i) => borderColorResolver(i)(["", c], theme)));
127
+ if (a in utilities.directionMap && utilities.hasParseableColor(c, theme)) {
128
+ return Object.assign({}, ...utilities.directionMap[a].map((i) => borderColorResolver(i)(["", c], theme)));
130
129
  }
131
130
  }
132
131
  function handlerBorderOpacity([, a = "", opacity]) {
133
- const v = index.handler.bracket.percent(opacity);
134
- if (a in index.directionMap && v != null)
135
- return index.directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
132
+ const v = utilities.handler.bracket.percent(opacity);
133
+ if (a in utilities.directionMap && v != null)
134
+ return utilities.directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
136
135
  }
137
136
  function handlerRounded([, a = "", s], { theme }) {
138
- const v = theme.borderRadius?.[s || "DEFAULT"] || index.handler.bracket.cssvar.fraction.rem(s || "1");
139
- if (a in index.cornerMap && v != null)
140
- return index.cornerMap[a].map((i) => [`border${i}-radius`, v]);
137
+ const v = theme.borderRadius?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.rem(s || "1");
138
+ if (a in utilities.cornerMap && v != null)
139
+ return utilities.cornerMap[a].map((i) => [`border${i}-radius`, v]);
141
140
  }
142
141
  function handlerBorderStyle([, a = "", s]) {
143
- if (borderStyles.includes(s) && a in index.directionMap)
144
- return index.directionMap[a].map((i) => [`border${i}-style`, s]);
142
+ if (borderStyles.includes(s) && a in utilities.directionMap)
143
+ return utilities.directionMap[a].map((i) => [`border${i}-style`, s]);
145
144
  }
146
145
 
147
146
  const opacity = [
148
- [/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: index.handler.bracket.percent.cssvar(d) })]
147
+ [/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: utilities.handler.bracket.percent.cssvar(d) })]
149
148
  ];
150
149
  const textColors = [
151
150
  [/^(?:text|color|c)-(.+)$/, utilities.colorResolver("color", "text"), { autocomplete: "(text|color|c)-$colors" }],
152
- [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": index.handler.bracket.percent(opacity2) }), { autocomplete: "(text|color|c)-(op|opacity)-<percent>" }]
151
+ [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": utilities.handler.bracket.percent(opacity2) }), { autocomplete: "(text|color|c)-(op|opacity)-<percent>" }]
153
152
  ];
154
153
  const bgColors = [
155
154
  [/^bg-(.+)$/, utilities.colorResolver("background-color", "bg"), { autocomplete: "bg-$colors" }],
156
- [/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": index.handler.bracket.percent(opacity2) }), { autocomplete: "bg-(op|opacity)-<percent>" }]
155
+ [/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": utilities.handler.bracket.percent(opacity2) }), { autocomplete: "bg-(op|opacity)-<percent>" }]
157
156
  ];
158
157
 
159
158
  const transitionPropertyGroup = {
@@ -165,13 +164,13 @@ const transitionPropertyGroup = {
165
164
  transform: "transform"
166
165
  };
167
166
  const transitionProperty = (prop) => {
168
- return index.handler.properties(prop) ?? transitionPropertyGroup[prop];
167
+ return utilities.handler.properties(prop) ?? transitionPropertyGroup[prop];
169
168
  };
170
169
  const transitions = [
171
170
  [/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop, d], { theme }) => {
172
171
  const p = prop != null ? transitionProperty(prop) : [transitionPropertyGroup.colors, "opacity", "box-shadow", "transform", "filter", "backdrop-filter"].join(",");
173
172
  if (p) {
174
- const duration = theme.duration?.[d || "DEFAULT"] ?? index.handler.time(d || "150");
173
+ const duration = theme.duration?.[d || "DEFAULT"] ?? utilities.handler.time(d || "150");
175
174
  return {
176
175
  "transition-property": p,
177
176
  "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)",
@@ -181,23 +180,23 @@ const transitions = [
181
180
  }, { autocomplete: `transition-(${Object.keys(transitionPropertyGroup).join("|")})` }],
182
181
  [
183
182
  /^(?:transition-)?duration-(.+)$/,
184
- ([, d], { theme }) => ({ "transition-duration": theme.duration?.[d || "DEFAULT"] ?? index.handler.bracket.cssvar.time(d) }),
183
+ ([, d], { theme }) => ({ "transition-duration": theme.duration?.[d || "DEFAULT"] ?? utilities.handler.bracket.cssvar.time(d) }),
185
184
  { autocomplete: ["transition-duration-$duration", "duration-$duration"] }
186
185
  ],
187
186
  [
188
187
  /^(?:transition-)?delay-(.+)$/,
189
- ([, d], { theme }) => ({ "transition-delay": theme.duration?.[d || "DEFAULT"] ?? index.handler.bracket.cssvar.time(d) }),
188
+ ([, d], { theme }) => ({ "transition-delay": theme.duration?.[d || "DEFAULT"] ?? utilities.handler.bracket.cssvar.time(d) }),
190
189
  { autocomplete: ["transition-delay-$duration", "delay-$duration"] }
191
190
  ],
192
191
  [
193
192
  /^(?:transition-)?ease(?:-(.+))?$/,
194
- ([, d], { theme }) => ({ "transition-timing-function": theme.easing?.[d || "DEFAULT"] ?? index.handler.bracket.cssvar(d) }),
193
+ ([, d], { theme }) => ({ "transition-timing-function": theme.easing?.[d || "DEFAULT"] ?? utilities.handler.bracket.cssvar(d) }),
195
194
  { autocomplete: ["transition-ease-(linear|in|out|in-out|DEFAULT)", "ease-(linear|in|out|in-out|DEFAULT)"] }
196
195
  ],
197
196
  [
198
197
  /^(?:transition-)?property-(.+)$/,
199
- ([, v]) => ({ "transition-property": index.handler.global(v) || transitionProperty(v) }),
200
- { autocomplete: [`transition-property-(${[...index.globalKeywords, ...Object.keys(transitionPropertyGroup)].join("|")})`] }
198
+ ([, v]) => ({ "transition-property": utilities.handler.global(v) || transitionProperty(v) }),
199
+ { autocomplete: [`transition-property-(${[...utilities.globalKeywords, ...Object.keys(transitionPropertyGroup)].join("|")})`] }
201
200
  ],
202
201
  ["transition-none", { transition: "none" }]
203
202
  ];
@@ -206,7 +205,7 @@ const flex = [
206
205
  ["flex", { display: "flex" }],
207
206
  ["inline-flex", { display: "inline-flex" }],
208
207
  ["flex-inline", { display: "inline-flex" }],
209
- [/^flex-(.*)$/, ([, d]) => ({ flex: index.handler.bracket(d) != null ? index.handler.bracket(d).split(" ").map((e) => index.handler.cssvar.fraction(e) ?? e).join(" ") : index.handler.cssvar.fraction(d) })],
208
+ [/^flex-(.*)$/, ([, d]) => ({ flex: utilities.handler.bracket(d) != null ? utilities.handler.bracket(d).split(" ").map((e) => utilities.handler.cssvar.fraction(e) ?? e).join(" ") : utilities.handler.cssvar.fraction(d) })],
210
209
  ["flex-1", { flex: "1 1 0%" }],
211
210
  ["flex-auto", { flex: "1 1 auto" }],
212
211
  ["flex-initial", { flex: "0 1 auto" }],
@@ -215,7 +214,7 @@ const flex = [
215
214
  [/^(?:flex-)?shrink-0$/, () => ({ "flex-shrink": 0 })],
216
215
  [/^(?:flex-)?grow$/, () => ({ "flex-grow": 1 })],
217
216
  [/^(?:flex-)?grow-0$/, () => ({ "flex-grow": 0 })],
218
- [/^(?:flex-)?basis-(.+)$/, ([, d], { theme }) => ({ "flex-basis": theme.spacing?.[d] ?? index.handler.bracket.cssvar.auto.fraction.rem(d) })],
217
+ [/^(?:flex-)?basis-(.+)$/, ([, d], { theme }) => ({ "flex-basis": theme.spacing?.[d] ?? utilities.handler.bracket.cssvar.auto.fraction.rem(d) })],
219
218
  ["flex-row", { "flex-direction": "row" }],
220
219
  ["flex-row-reverse", { "flex-direction": "row-reverse" }],
221
220
  ["flex-col", { "flex-direction": "column" }],
@@ -239,7 +238,7 @@ const weightMap = {
239
238
  const fonts = [
240
239
  [
241
240
  /^font-(.+)$/,
242
- ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] || index.handler.bracket.cssvar.global(d) }),
241
+ ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] || utilities.handler.bracket.cssvar.global(d) }),
243
242
  { autocomplete: "font-$fontFamily" }
244
243
  ],
245
244
  [
@@ -253,24 +252,24 @@ const fonts = [
253
252
  "line-height": height
254
253
  };
255
254
  }
256
- return { "font-size": index.handler.bracketOfLength.rem(s) };
255
+ return { "font-size": utilities.handler.bracketOfLength.rem(s) };
257
256
  },
258
257
  { autocomplete: "text-$fontSize" }
259
258
  ],
260
259
  [/^text-size-(.+)$/, ([, s], { theme }) => {
261
260
  const themed = core.toArray(theme.fontSize?.[s]);
262
- const size = themed?.[0] ?? index.handler.bracket.cssvar.rem(s);
261
+ const size = themed?.[0] ?? utilities.handler.bracket.cssvar.rem(s);
263
262
  if (size != null)
264
263
  return { "font-size": size };
265
264
  }, { autocomplete: "text-size-$fontSize" }],
266
265
  [
267
266
  /^(?:font|fw)-?([^-]+)$/,
268
- ([, s]) => ({ "font-weight": weightMap[s] || index.handler.global.number(s) }),
267
+ ([, s]) => ({ "font-weight": weightMap[s] || utilities.handler.global.number(s) }),
269
268
  { autocomplete: `(font|fw)-(100|200|300|400|500|600|700|800|900|${Object.keys(weightMap).join("|")})` }
270
269
  ],
271
270
  [
272
271
  /^(?:font-)?(?:leading|lh)-(.+)$/,
273
- ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || index.handler.bracket.cssvar.global.rem(s) }),
272
+ ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || utilities.handler.bracket.cssvar.global.rem(s) }),
274
273
  { autocomplete: "(leading|lh)-$lineHeight" }
275
274
  ],
276
275
  [
@@ -280,18 +279,18 @@ const fonts = [
280
279
  ],
281
280
  [
282
281
  /^(?:font-)?tracking-(.+)$/,
283
- ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || index.handler.bracket.cssvar.global.rem(s) }),
282
+ ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || utilities.handler.bracket.cssvar.global.rem(s) }),
284
283
  { autocomplete: "tracking-$letterSpacing" }
285
284
  ],
286
285
  [
287
286
  /^(?:font-)?word-spacing-(.+)$/,
288
- ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || index.handler.bracket.cssvar.global.rem(s) }),
287
+ ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || utilities.handler.bracket.cssvar.global.rem(s) }),
289
288
  { autocomplete: "word-spacing-$wordSpacing" }
290
289
  ]
291
290
  ];
292
291
  const tabSizes = [
293
292
  [/^tab(?:-(.+))?$/, ([, s]) => {
294
- const v = index.handler.bracket.cssvar.global.number(s || "4");
293
+ const v = utilities.handler.bracket.cssvar.global.number(s || "4");
295
294
  if (v != null) {
296
295
  return {
297
296
  "-moz-tab-size": v,
@@ -302,12 +301,12 @@ const tabSizes = [
302
301
  }]
303
302
  ];
304
303
  const textIndents = [
305
- [/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || index.handler.bracket.cssvar.global.fraction.rem(s) }), { autocomplete: "indent-$textIndent" }]
304
+ [/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.global.fraction.rem(s) }), { autocomplete: "indent-$textIndent" }]
306
305
  ];
307
306
  const textStrokes = [
308
- [/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || index.handler.bracket.cssvar.px(s) }), { autocomplete: "text-stroke-$textStrokeWidth" }],
307
+ [/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.px(s) }), { autocomplete: "text-stroke-$textStrokeWidth" }],
309
308
  [/^text-stroke-(.+)$/, utilities.colorResolver("-webkit-text-stroke-color", "text-stroke"), { autocomplete: "text-stroke-$colors" }],
310
- [/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": index.handler.bracket.percent(opacity) }), { autocomplete: "text-stroke-(op|opacity)-<percent>" }]
309
+ [/^text-stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-stroke-opacity": utilities.handler.bracket.percent(opacity) }), { autocomplete: "text-stroke-(op|opacity)-<percent>" }]
311
310
  ];
312
311
  const textShadows = [
313
312
  [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
@@ -318,10 +317,10 @@ const textShadows = [
318
317
  "text-shadow": "var(--un-text-shadow)"
319
318
  };
320
319
  }
321
- return { "text-shadow": index.handler.bracket.cssvar(s) };
320
+ return { "text-shadow": utilities.handler.bracket.cssvar(s) };
322
321
  }, { autocomplete: "text-shadow-$textShadow" }],
323
322
  [/^text-shadow-color-(.+)$/, utilities.colorResolver("--un-text-shadow-color", "text-shadow"), { autocomplete: "text-shadow-color-$colors" }],
324
- [/^text-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-shadow-opacity": index.handler.bracket.percent(opacity) }), { autocomplete: "text-shadow-color-(op|opacity)-<percent>" }]
323
+ [/^text-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-shadow-opacity": utilities.handler.bracket.percent(opacity) }), { autocomplete: "text-shadow-color-(op|opacity)-<percent>" }]
325
324
  ];
326
325
 
327
326
  const directions = {
@@ -330,7 +329,7 @@ const directions = {
330
329
  "y": "row-"
331
330
  };
332
331
  const handleGap = ([, d = "", s], { theme }) => {
333
- const v = theme.spacing?.[s] ?? index.handler.bracket.cssvar.rem(s);
332
+ const v = theme.spacing?.[s] ?? utilities.handler.bracket.cssvar.rem(s);
334
333
  if (v != null) {
335
334
  return {
336
335
  [`grid-${directions[d]}gap`]: v,
@@ -357,28 +356,28 @@ const autoDirection = (c, theme, prop) => {
357
356
  case "fr":
358
357
  return "minmax(0,1fr)";
359
358
  }
360
- return index.handler.bracket.cssvar.auto.rem(prop);
359
+ return utilities.handler.bracket.cssvar.auto.rem(prop);
361
360
  };
362
361
  const grids = [
363
362
  ["grid", { display: "grid" }],
364
363
  ["inline-grid", { display: "inline-grid" }],
365
364
  [/^(?:grid-)?(row|col)-(.+)$/, ([, c, v], { theme }) => ({
366
- [`grid-${rowCol(c)}`]: theme[`grid${rowColTheme(c)}`]?.[v] ?? index.handler.bracket.cssvar.auto(v)
365
+ [`grid-${rowCol(c)}`]: theme[`grid${rowColTheme(c)}`]?.[v] ?? utilities.handler.bracket.cssvar.auto(v)
367
366
  })],
368
367
  [/^(?:grid-)?(row|col)-span-(.+)$/, ([, c, s]) => {
369
368
  if (s === "full")
370
369
  return { [`grid-${rowCol(c)}`]: "1/-1" };
371
- const v = index.handler.bracket.number(s);
370
+ const v = utilities.handler.bracket.number(s);
372
371
  if (v != null)
373
372
  return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
374
373
  }, { autocomplete: ["grid-(row|col)-span-<num>", "(row|col)-span-<num>"] }],
375
- [/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: index.handler.bracket.cssvar(v) ?? v })],
376
- [/^(?:grid-)?(row|col)-end-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: index.handler.bracket.cssvar(v) ?? v })],
374
+ [/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: utilities.handler.bracket.cssvar(v) ?? v })],
375
+ [/^(?:grid-)?(row|col)-end-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: utilities.handler.bracket.cssvar(v) ?? v })],
377
376
  [/^(?:grid-)?auto-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(c, theme, v) })],
378
- [/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": index.handler.bracket.cssvar(v) })],
377
+ [/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": utilities.handler.bracket.cssvar(v) })],
379
378
  [/^(?:grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
380
379
  [/^grid-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({
381
- [`grid-template-${rowCol(c)}`]: theme[`gridTemplate${rowColTheme(c)}`]?.[v] ?? index.handler.bracket.cssvar(v)
380
+ [`grid-template-${rowCol(c)}`]: theme[`gridTemplate${rowColTheme(c)}`]?.[v] ?? utilities.handler.bracket.cssvar(v)
382
381
  })],
383
382
  [/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
384
383
  [/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` })],
@@ -420,7 +419,7 @@ const justifies = [
420
419
  ["justify-self-stretch", { "justify-self": "stretch" }]
421
420
  ];
422
421
  const orders = [
423
- [/^order-(.+)$/, ([, v]) => ({ order: index.handler.bracket.cssvar.number(v) })],
422
+ [/^order-(.+)$/, ([, v]) => ({ order: utilities.handler.bracket.cssvar.number(v) })],
424
423
  ["order-first", { order: "-9999" }],
425
424
  ["order-last", { order: "9999" }],
426
425
  ["order-none", { order: "0" }]
@@ -463,12 +462,12 @@ const placements = [
463
462
  ["place-self-stretch", { "place-self": "stretch" }]
464
463
  ];
465
464
  function handleInsetValue(v, { theme }) {
466
- return theme.spacing?.[v] ?? index.handler.bracket.cssvar.auto.fraction.rem(v);
465
+ return theme.spacing?.[v] ?? utilities.handler.bracket.cssvar.auto.fraction.rem(v);
467
466
  }
468
467
  function handleInsetValues([, d, v], ctx) {
469
468
  const r = handleInsetValue(v, ctx);
470
- if (r != null && d in index.insetMap)
471
- return index.insetMap[d].map((i) => [i.slice(1), r]);
469
+ if (r != null && d in utilities.insetMap)
470
+ return utilities.insetMap[d].map((i) => [i.slice(1), r]);
472
471
  }
473
472
  const insets = [
474
473
  [
@@ -499,154 +498,14 @@ const floats = [
499
498
  ["clear-none", { clear: "none" }]
500
499
  ];
501
500
  const zIndexes = [
502
- [/^z([\d.]+)$/, ([, v]) => ({ "z-index": index.handler.number(v) })],
503
- [/^z-(.+)$/, ([, v]) => ({ "z-index": index.handler.bracket.cssvar.auto.number(v) }), { autocomplete: "z-<num>" }]
501
+ [/^z([\d.]+)$/, ([, v]) => ({ "z-index": utilities.handler.number(v) })],
502
+ [/^z-(.+)$/, ([, v]) => ({ "z-index": utilities.handler.bracket.cssvar.auto.number(v) }), { autocomplete: "z-<num>" }]
504
503
  ];
505
504
  const boxSizing = [
506
505
  ["box-border", { "box-sizing": "border-box" }],
507
506
  ["box-content", { "box-sizing": "content-box" }]
508
507
  ];
509
508
 
510
- const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
511
- const displays = [
512
- ["inline", { display: "inline" }],
513
- ["block", { display: "block" }],
514
- ["inline-block", { display: "inline-block" }],
515
- ["contents", { display: "contents" }],
516
- ["flow-root", { display: "flow-root" }],
517
- ["list-item", { display: "list-item" }],
518
- ["hidden", { display: "none" }],
519
- [/^display-(.+)$/, ([, c]) => ({ display: index.handler.bracket.cssvar(c) || c })]
520
- ];
521
- const appearances = [
522
- ["visible", { visibility: "visible" }],
523
- ["invisible", { visibility: "hidden" }],
524
- ["backface-visible", { "backface-visibility": "visible" }],
525
- ["backface-hidden", { "backface-visibility": "hidden" }]
526
- ];
527
- const cursors = [
528
- [/^cursor-(.+)$/, ([, c]) => ({ cursor: index.handler.bracket.cssvar(c) || c })]
529
- ];
530
- const pointerEvents = [
531
- ["pointer-events-auto", { "pointer-events": "auto" }],
532
- ["pointer-events-none", { "pointer-events": "none" }]
533
- ];
534
- const resizes = [
535
- ["resize-x", { resize: "horizontal" }],
536
- ["resize-y", { resize: "vertical" }],
537
- ["resize", { resize: "both" }],
538
- ["resize-none", { resize: "none" }]
539
- ];
540
- const userSelects = [
541
- ["select-auto", { "user-select": "auto" }],
542
- ["select-all", { "user-select": "all" }],
543
- ["select-text", { "user-select": "text" }],
544
- ["select-none", { "user-select": "none" }]
545
- ];
546
- const whitespaces = [
547
- [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap|break-spaces)$/, ([, v]) => ({ "white-space": v }), { autocomplete: "(whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap|break-spaces)" }]
548
- ];
549
- const contents = [
550
- [/^content-(.+)$/, ([, v]) => {
551
- const c = index.handler.bracket.cssvar(v);
552
- return { content: c == null ? `"${v}"` : c };
553
- }],
554
- ["content-empty", { content: '""' }],
555
- ["content-none", { content: '""' }]
556
- ];
557
- const breaks = [
558
- ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
559
- ["break-words", { "overflow-wrap": "break-word" }],
560
- ["break-all", { "word-break": "break-all" }]
561
- ];
562
- const textOverflows = [
563
- ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
564
- ["text-ellipsis", { "text-overflow": "ellipsis" }],
565
- ["text-clip", { "text-overflow": "clip" }]
566
- ];
567
- const textTransforms = [
568
- ["case-upper", { "text-transform": "uppercase" }],
569
- ["case-lower", { "text-transform": "lowercase" }],
570
- ["case-capital", { "text-transform": "capitalize" }],
571
- ["case-normal", { "text-transform": "none" }]
572
- ];
573
- const fontStyles = [
574
- ["italic", { "font-style": "italic" }],
575
- ["not-italic", { "font-style": "normal" }],
576
- ["font-italic", { "font-style": "italic" }],
577
- ["font-not-italic", { "font-style": "normal" }],
578
- ["oblique", { "font-style": "oblique" }],
579
- ["not-oblique", { "font-style": "normal" }],
580
- ["font-oblique", { "font-style": "oblique" }],
581
- ["font-not-oblique", { "font-style": "normal" }]
582
- ];
583
- const fontSmoothings = [
584
- ["antialiased", {
585
- "-webkit-font-smoothing": "antialiased",
586
- "-moz-osx-font-smoothing": "grayscale",
587
- "font-smoothing": "grayscale"
588
- }],
589
- ["subpixel-antialiased", {
590
- "-webkit-font-smoothing": "auto",
591
- "-moz-osx-font-smoothing": "auto",
592
- "font-smoothing": "auto"
593
- }]
594
- ];
595
-
596
- const rings = [
597
- [/^ring(?:-(.+))?$/, ([, d], { theme }) => {
598
- const value = theme.ringWidth?.[d || "DEFAULT"] ?? index.handler.px(d || "1");
599
- if (value) {
600
- return [
601
- {
602
- [core.CONTROL_SHORTCUT_NO_MERGE]: "",
603
- "--un-ring-inset": varEmpty,
604
- "--un-ring-offset-width": "0px",
605
- "--un-ring-offset-color": "#fff",
606
- "--un-ring-width": "0px",
607
- "--un-ring-color": "rgba(147,197,253,0.5)"
608
- },
609
- {
610
- "--un-ring-width": value,
611
- "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
612
- "--un-ring-shadow": "var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color)",
613
- "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
614
- }
615
- ];
616
- }
617
- }, { autocomplete: "ring-$ringWidth" }],
618
- [/^ring-(?:width-|size-)(.+)$/, ([, d], { theme }) => ({ "--un-ring-width": theme.lineWidth?.[d] ?? index.handler.bracket.cssvar.px(d) }), { autocomplete: "ring-(width|size)-$lineWidth" }],
619
- ["ring-offset", { "--un-ring-offset-width": "1px" }],
620
- [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? index.handler.bracket.cssvar.px(d) }), { autocomplete: "ring-offset-(width|size)-$lineWidth" }],
621
- [/^ring-(.+)$/, utilities.colorResolver("--un-ring-color", "ring"), { autocomplete: "ring-$colors" }],
622
- [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": index.handler.bracket.percent(opacity) }), { autocomplete: "ring-(op|opacity)-<percent>" }],
623
- [/^ring-offset-(.+)$/, utilities.colorResolver("--un-ring-offset-color", "ring-offset"), { autocomplete: "ring-offset-$colors" }],
624
- [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": index.handler.bracket.percent(opacity) }), { autocomplete: "ring-offset-(op|opacity)-<percent>" }],
625
- ["ring-inset", { "--un-ring-inset": "inset" }]
626
- ];
627
-
628
- const boxShadows = [
629
- [/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
630
- const v = theme.boxShadow?.[d || "DEFAULT"];
631
- if (v) {
632
- return [
633
- {
634
- [core.CONTROL_SHORTCUT_NO_MERGE]: "",
635
- "--un-shadow-inset": varEmpty,
636
- "--un-shadow": "0 0 #0000"
637
- },
638
- {
639
- "--un-shadow": utilities.colorableShadows(v, "--un-shadow-color").join(","),
640
- "box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
641
- }
642
- ];
643
- }
644
- }, { autocomplete: "shadow-$boxShadow" }],
645
- [/^shadow-(.+)$/, utilities.colorResolver("--un-shadow-color", "shadow"), { autocomplete: "shadow-$colors" }],
646
- [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": index.handler.bracket.percent(opacity) }), { autocomplete: "shadow-(op|opacity)-<percent>" }],
647
- ["shadow-inset", { "--un-shadow-inset": "inset" }]
648
- ];
649
-
650
509
  const sizeMapping = {
651
510
  h: "height",
652
511
  w: "width",
@@ -667,7 +526,7 @@ function getSizeValue(minmax, hw, theme, prop) {
667
526
  case "min":
668
527
  return `${prop}-content`;
669
528
  }
670
- return index.handler.bracket.cssvar.auto.fraction.rem(prop);
529
+ return utilities.handler.bracket.cssvar.auto.fraction.rem(prop);
671
530
  }
672
531
  const sizes = [
673
532
  [
@@ -702,7 +561,7 @@ function getAspectRatio(prop) {
702
561
  case "video":
703
562
  return "16/9";
704
563
  }
705
- return index.handler.bracket.cssvar.auto.number(prop);
564
+ return utilities.handler.bracket.cssvar.auto.number(prop);
706
565
  }
707
566
  const aspectRatio = [
708
567
  [/^aspect-(?:ratio-)?(.+)$/, ([, d]) => ({ "aspect-ratio": getAspectRatio(d) }), { autocomplete: ["aspect-(square|video)", "aspect-ratio-(square|video)"] }]
@@ -744,11 +603,11 @@ const cssVariables = [
744
603
  [/^(.+?)-(\$.+)$/, ([, name, varname]) => {
745
604
  const prop = variablesAbbrMap[name];
746
605
  if (prop)
747
- return { [prop]: index.handler.cssvar(varname) };
606
+ return { [prop]: utilities.handler.cssvar(varname) };
748
607
  }]
749
608
  ];
750
609
  const cssProperty = [
751
- [/^\[([\w_-]+):([^'"]+)\]$/, ([, prop, value]) => ({ [prop]: index.handler.bracket(`[${value}]`) })]
610
+ [/^\[([\w_-]+):([^'"]+)\]$/, ([, prop, value]) => ({ [prop]: utilities.handler.bracket(`[${value}]`) })]
752
611
  ];
753
612
 
754
613
  const questionMark = [
@@ -762,10 +621,10 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
762
621
  ]
763
622
  ];
764
623
 
765
- const decorationStyles = ["solid", "double", "dotted", "dashed", "wavy", ...index.globalKeywords];
624
+ const decorationStyles = ["solid", "double", "dotted", "dashed", "wavy", ...utilities.globalKeywords];
766
625
  const textDecorations = [
767
626
  [/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s }), { autocomplete: "decoration-(underline|overline|line-through)" }],
768
- [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s], { theme }) => ({ "text-decoration-thickness": theme.lineWidth?.[s] ?? index.handler.bracket.cssvar.px(s) }), { autocomplete: "(underline|decoration)-<num>" }],
627
+ [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s], { theme }) => ({ "text-decoration-thickness": theme.lineWidth?.[s] ?? utilities.handler.bracket.cssvar.px(s) }), { autocomplete: "(underline|decoration)-<num>" }],
769
628
  [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s }), { autocomplete: "(underline|decoration)-(auto|from-font)" }],
770
629
  [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
771
630
  const result = utilities.colorResolver("text-decoration-color", "line")(match, ctx);
@@ -776,8 +635,8 @@ const textDecorations = [
776
635
  };
777
636
  }
778
637
  }, { autocomplete: "(underline|decoration)-$colors" }],
779
- [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": index.handler.bracket.percent(opacity) }), { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }],
780
- [/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? index.handler.auto.bracket.cssvar.px(s) }), { autocomplete: "(underline|decoration)-(offset)-<num>" }],
638
+ [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": utilities.handler.bracket.percent(opacity) }), { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }],
639
+ [/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? utilities.handler.auto.bracket.cssvar.px(s) }), { autocomplete: "(underline|decoration)-(offset)-<num>" }],
781
640
  ...decorationStyles.map((v) => [`underline-${v}`, { "text-decoration-style": v }]),
782
641
  ...decorationStyles.map((v) => [`decoration-${v}`, { "text-decoration-style": v }]),
783
642
  ["no-underline", { "text-decoration": "none" }],
@@ -786,13 +645,13 @@ const textDecorations = [
786
645
 
787
646
  const svgUtilities = [
788
647
  [/^fill-(.+)$/, utilities.colorResolver("fill", "fill"), { autocomplete: "fill-$colors" }],
789
- [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": index.handler.bracket.percent(opacity) }), { autocomplete: "fill-(op|opacity)-<percent>" }],
648
+ [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) }), { autocomplete: "fill-(op|opacity)-<percent>" }],
790
649
  ["fill-none", { fill: "none" }],
791
- [/^stroke-(?:width-|size-)?(.+)$/, ([, s], { theme }) => ({ "stroke-width": theme.lineWidth?.[s] ?? index.handler.bracket.cssvar.fraction.px.number(s) }), { autocomplete: ["stroke-width-$lineWidth", "stroke-size-$lineWidth"] }],
792
- [/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": index.handler.bracket.cssvar.number(s) }), { autocomplete: "stroke-dash-<num>" }],
793
- [/^stroke-offset-(.+)$/, ([, s], { theme }) => ({ "stroke-dashoffset": theme.lineWidth?.[s] ?? index.handler.bracket.cssvar.px.numberWithUnit(s) }), { autocomplete: "stroke-offset-$lineWidth" }],
650
+ [/^stroke-(?:width-|size-)?(.+)$/, ([, s], { theme }) => ({ "stroke-width": theme.lineWidth?.[s] ?? utilities.handler.bracket.cssvar.fraction.px.number(s) }), { autocomplete: ["stroke-width-$lineWidth", "stroke-size-$lineWidth"] }],
651
+ [/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": utilities.handler.bracket.cssvar.number(s) }), { autocomplete: "stroke-dash-<num>" }],
652
+ [/^stroke-offset-(.+)$/, ([, s], { theme }) => ({ "stroke-dashoffset": theme.lineWidth?.[s] ?? utilities.handler.bracket.cssvar.px.numberWithUnit(s) }), { autocomplete: "stroke-offset-$lineWidth" }],
794
653
  [/^stroke-(.+)$/, utilities.colorResolver("stroke", "stroke"), { autocomplete: "stroke-$colors" }],
795
- [/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": index.handler.bracket.percent(opacity) }), { autocomplete: "stroke-(op|opacity)-<percent>" }],
654
+ [/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": utilities.handler.bracket.percent(opacity) }), { autocomplete: "stroke-(op|opacity)-<percent>" }],
796
655
  ["stroke-cap-square", { "stroke-linecap": "square" }],
797
656
  ["stroke-cap-round", { "stroke-linecap": "round" }],
798
657
  ["stroke-cap-auto", { "stroke-linecap": "butt" }],
@@ -809,40 +668,40 @@ const rules = [
809
668
  cssProperty,
810
669
  paddings,
811
670
  margins,
812
- displays,
671
+ transform.displays,
813
672
  opacity,
814
673
  bgColors,
815
674
  svgUtilities,
816
675
  borders,
817
- contents,
676
+ transform.contents,
818
677
  fonts,
819
678
  tabSizes,
820
679
  textIndents,
821
- textOverflows,
680
+ transform.textOverflows,
822
681
  textDecorations,
823
682
  textStrokes,
824
683
  textShadows,
825
- textTransforms,
684
+ transform.textTransforms,
826
685
  textAligns,
827
686
  textColors,
828
- fontStyles,
829
- fontSmoothings,
830
- boxShadows,
831
- rings,
687
+ transform.fontStyles,
688
+ transform.fontSmoothings,
689
+ transform.boxShadows,
690
+ transform.rings,
832
691
  flex,
833
692
  grids,
834
693
  gaps,
835
694
  positions,
836
695
  sizes,
837
696
  aspectRatio,
838
- cursors,
839
- appearances,
840
- pointerEvents,
841
- resizes,
697
+ transform.cursors,
698
+ transform.appearances,
699
+ transform.pointerEvents,
700
+ transform.resizes,
842
701
  verticalAligns,
843
- userSelects,
844
- whitespaces,
845
- breaks,
702
+ transform.userSelects,
703
+ transform.whitespaces,
704
+ transform.breaks,
846
705
  overflows,
847
706
  outline,
848
707
  appearance,
@@ -862,22 +721,14 @@ const rules = [
862
721
 
863
722
  exports.alignments = alignments;
864
723
  exports.appearance = appearance;
865
- exports.appearances = appearances;
866
724
  exports.aspectRatio = aspectRatio;
867
725
  exports.bgColors = bgColors;
868
726
  exports.borders = borders;
869
- exports.boxShadows = boxShadows;
870
727
  exports.boxSizing = boxSizing;
871
- exports.breaks = breaks;
872
- exports.contents = contents;
873
728
  exports.cssProperty = cssProperty;
874
729
  exports.cssVariables = cssVariables;
875
- exports.cursors = cursors;
876
- exports.displays = displays;
877
730
  exports.flex = flex;
878
731
  exports.floats = floats;
879
- exports.fontSmoothings = fontSmoothings;
880
- exports.fontStyles = fontStyles;
881
732
  exports.fonts = fonts;
882
733
  exports.gaps = gaps;
883
734
  exports.grids = grids;
@@ -890,11 +741,8 @@ exports.outline = outline;
890
741
  exports.overflows = overflows;
891
742
  exports.paddings = paddings;
892
743
  exports.placements = placements;
893
- exports.pointerEvents = pointerEvents;
894
744
  exports.positions = positions;
895
745
  exports.questionMark = questionMark;
896
- exports.resizes = resizes;
897
- exports.rings = rings;
898
746
  exports.rules = rules;
899
747
  exports.sizes = sizes;
900
748
  exports.svgUtilities = svgUtilities;
@@ -903,14 +751,9 @@ exports.textAligns = textAligns;
903
751
  exports.textColors = textColors;
904
752
  exports.textDecorations = textDecorations;
905
753
  exports.textIndents = textIndents;
906
- exports.textOverflows = textOverflows;
907
754
  exports.textShadows = textShadows;
908
755
  exports.textStrokes = textStrokes;
909
- exports.textTransforms = textTransforms;
910
756
  exports.transitions = transitions;
911
- exports.userSelects = userSelects;
912
- exports.varEmpty = varEmpty;
913
757
  exports.verticalAligns = verticalAligns;
914
- exports.whitespaces = whitespaces;
915
758
  exports.willChange = willChange;
916
759
  exports.zIndexes = zIndexes;