@unocss/preset-mini 0.22.1 → 0.22.5

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.
@@ -19,9 +19,9 @@ const textAligns = [
19
19
  ];
20
20
 
21
21
  const outline = [
22
- [/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": utilities.handler.bracket.fraction.auto.rem(d) })],
22
+ [/^outline-(?:width-|size-)?(.+)$/, ([, d]) => ({ "outline-width": utilities.handler.bracket.cssvar.fraction.rem(d) })],
23
23
  [/^outline-(?:color-)?(.+)$/, utilities.colorResolver("outline-color", "outline-color")],
24
- [/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": utilities.handler.bracket.fraction.auto.rem(d) })],
24
+ [/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": utilities.handler.bracket.cssvar.fraction.rem(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" }]
@@ -120,7 +120,7 @@ function handlerBorder(m) {
120
120
  }
121
121
  }
122
122
  function handlerBorderSize([, a = "", b = "1"]) {
123
- const v = utilities.handler.bracket.px(b);
123
+ const v = utilities.handler.bracket.cssvar.px(b);
124
124
  if (a in utilities.directionMap && v != null)
125
125
  return utilities.directionMap[a].map((i) => [`border${i}-width`, v]);
126
126
  }
@@ -135,7 +135,7 @@ function handlerBorderOpacity([, a = "", opacity]) {
135
135
  return utilities.directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
136
136
  }
137
137
  function handlerRounded([, a = "", s = "DEFAULT"], { theme }) {
138
- const v = theme.borderRadius?.[s] || utilities.handler.auto.rem.fraction.bracket.cssvar(s);
138
+ const v = theme.borderRadius?.[s] || utilities.handler.bracket.cssvar.fraction.rem(s);
139
139
  if (a in utilities.cornerMap && v != null)
140
140
  return utilities.cornerMap[a].map((i) => [`border${i}-radius`, v]);
141
141
  }
@@ -145,7 +145,7 @@ const opacity = [
145
145
  ];
146
146
  const textColors = [
147
147
  [/^(?:text|color|c)-(.+)$/, utilities.colorResolver("color", "text")],
148
- [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": utilities.handler.bracket.percent.cssvar(opacity2) })]
148
+ [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": utilities.handler.bracket.percent(opacity2) })]
149
149
  ];
150
150
  const bgColors = [
151
151
  [/^bg-(.+)$/, utilities.colorResolver("background-color", "bg")],
@@ -173,9 +173,9 @@ const transitions = [
173
173
  };
174
174
  }
175
175
  }],
176
- [/^(?:transition-)?delay-(.+)(?:s|ms)?$/, ([, d]) => ({ "transition-delay": utilities.handler.bracket.time(d) })],
177
- [/^(?:transition-)?duration-(.+)(?:s|ms)?$/, ([, d]) => ({ "transition-duration": utilities.handler.bracket.time(d) })],
178
- [/^ease-(.+)$/, ([, d]) => ({ "transition-timing-function": utilities.handler.bracket(d) })],
176
+ [/^(?:transition-)?duration-(.+)$/, ([, d]) => ({ "transition-duration": utilities.handler.bracket.cssvar.time(d) })],
177
+ [/^(?:transition-)?delay-(.+)$/, ([, d]) => ({ "transition-delay": utilities.handler.bracket.cssvar.time(d) })],
178
+ [/^ease-(.+)$/, ([, d]) => ({ "transition-timing-function": utilities.handler.bracket.cssvar(d) })],
179
179
  ["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
180
180
  ["ease-linear", { "transition-timing-function": "linear" }],
181
181
  ["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
@@ -200,7 +200,7 @@ const flex = [
200
200
  [/^(?:flex-)?shrink-0$/, () => ({ "flex-shrink": 0 })],
201
201
  [/^(?:flex-)?grow$/, () => ({ "flex-grow": 1 })],
202
202
  [/^(?:flex-)?grow-0$/, () => ({ "flex-grow": 0 })],
203
- [/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": utilities.handler.bracket.fraction.auto.rem(d) })],
203
+ [/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": utilities.handler.bracket.cssvar.auto.fraction.rem(d) })],
204
204
  ["flex-row", { "flex-direction": "row" }],
205
205
  ["flex-row-reverse", { "flex-direction": "row-reverse" }],
206
206
  ["flex-col", { "flex-direction": "column" }],
@@ -210,6 +210,117 @@ const flex = [
210
210
  ["flex-nowrap", { "flex-wrap": "nowrap" }]
211
211
  ];
212
212
 
213
+ const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
214
+ const displays = [
215
+ ["inline", { display: "inline" }],
216
+ ["block", { display: "block" }],
217
+ ["inline-block", { display: "inline-block" }],
218
+ ["contents", { display: "contents" }],
219
+ ["flow-root", { display: "flow-root" }],
220
+ ["list-item", { display: "list-item" }],
221
+ ["hidden", { display: "none" }]
222
+ ];
223
+ const appearances = [
224
+ ["visible", { visibility: "visible" }],
225
+ ["invisible", { visibility: "hidden" }],
226
+ ["backface-visible", { "backface-visibility": "visible" }],
227
+ ["backface-hidden", { "backface-visibility": "hidden" }]
228
+ ];
229
+ const cursors = [
230
+ [/^cursor-(.+)$/, ([, c]) => ({ cursor: utilities.handler.bracket.cssvar(c) || c })]
231
+ ];
232
+ const pointerEvents = [
233
+ ["pointer-events-auto", { "pointer-events": "auto" }],
234
+ ["pointer-events-none", { "pointer-events": "none" }]
235
+ ];
236
+ const resizes = [
237
+ ["resize-x", { resize: "horizontal" }],
238
+ ["resize-y", { resize: "vertical" }],
239
+ ["resize", { resize: "both" }],
240
+ ["resize-none", { resize: "none" }]
241
+ ];
242
+ const userSelects = [
243
+ ["select-auto", { "user-select": "auto" }],
244
+ ["select-all", { "user-select": "all" }],
245
+ ["select-text", { "user-select": "text" }],
246
+ ["select-none", { "user-select": "none" }]
247
+ ];
248
+ const whitespaces = [
249
+ [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
250
+ ];
251
+ const contents = [
252
+ ["content-empty", { content: '""' }],
253
+ ["content-none", { content: '""' }]
254
+ ];
255
+ const breaks = [
256
+ ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
257
+ ["break-words", { "overflow-wrap": "break-word" }],
258
+ ["break-all", { "word-break": "break-all" }]
259
+ ];
260
+ const textOverflows = [
261
+ ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
262
+ ["text-ellipsis", { "text-overflow": "ellipsis" }],
263
+ ["text-clip", { "text-overflow": "clip" }]
264
+ ];
265
+ const textTransforms = [
266
+ ["case-upper", { "text-transform": "uppercase" }],
267
+ ["case-lower", { "text-transform": "lowercase" }],
268
+ ["case-capital", { "text-transform": "capitalize" }],
269
+ ["case-normal", { "text-transform": "none" }]
270
+ ];
271
+ const fontStyles = [
272
+ ["italic", { "font-style": "italic" }],
273
+ ["not-italic", { "font-style": "normal" }]
274
+ ];
275
+ const fontSmoothings = [
276
+ ["antialiased", {
277
+ "-webkit-font-smoothing": "antialiased",
278
+ "-moz-osx-font-smoothing": "grayscale",
279
+ "font-smoothing": "grayscale"
280
+ }],
281
+ ["subpixel-antialiased", {
282
+ "-webkit-font-smoothing": "auto",
283
+ "-moz-osx-font-smoothing": "auto",
284
+ "font-smoothing": "auto"
285
+ }]
286
+ ];
287
+
288
+ const shadowBase = {
289
+ [core.CONTROL_SHORTCUT_NO_MERGE]: "",
290
+ "--un-ring-offset-shadow": "0 0 #0000",
291
+ "--un-ring-shadow": "0 0 #0000",
292
+ "--un-shadow-inset": varEmpty,
293
+ "--un-shadow": "0 0 #0000"
294
+ };
295
+ const colorableShadows = (shadows, colorVar) => {
296
+ const colored = [];
297
+ shadows = core.toArray(shadows);
298
+ for (let i = 0; i < shadows.length; i++) {
299
+ const [size, color] = shadows[i].split(/\s(\S+)$/);
300
+ if (color.split("(").length !== color.split(")").length)
301
+ return shadows;
302
+ colored.push(`${size} var(${colorVar}, ${color})`);
303
+ }
304
+ return colored;
305
+ };
306
+ const boxShadows = [
307
+ [/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
308
+ const v = theme.boxShadow?.[d || "DEFAULT"];
309
+ if (v) {
310
+ return [
311
+ shadowBase,
312
+ {
313
+ "--un-shadow": colorableShadows(v, "--un-shadow-color").join(","),
314
+ "box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
315
+ }
316
+ ];
317
+ }
318
+ }],
319
+ [/^shadow-(.+)$/, utilities.colorResolver("--un-shadow-color", "shadow")],
320
+ [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": utilities.handler.bracket.percent(opacity) })],
321
+ ["shadow-inset", { "--un-shadow-inset": "inset" }]
322
+ ];
323
+
213
324
  const weightMap = {
214
325
  thin: "100",
215
326
  extralight: "200",
@@ -232,17 +343,17 @@ const fonts = [
232
343
  "line-height": height
233
344
  };
234
345
  }
235
- return { "font-size": utilities.handler.bracket.auto.rem(s) };
346
+ return { "font-size": utilities.handler.bracket.rem(s) };
236
347
  }],
237
- [/^text-size-(.+)$/, ([, s]) => ({ "font-size": utilities.handler.bracket.auto.rem(s) })],
348
+ [/^text-size-(.+)$/, ([, s]) => ({ "font-size": utilities.handler.bracket.cssvar.rem(s) })],
238
349
  [/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || utilities.handler.number(s) })],
239
- [/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || utilities.handler.bracket.auto.rem(s) })],
240
- [/^tracking-([^-]+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || utilities.handler.bracket.auto.rem(s) })],
241
- [/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || utilities.handler.bracket.auto.rem(s) })]
350
+ [/^(?:leading|lh)-(.+)$/, ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || utilities.handler.bracket.cssvar.rem(s) })],
351
+ [/^tracking-(.+)$/, ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || utilities.handler.bracket.cssvar.rem(s) })],
352
+ [/^word-spacing-(.+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || utilities.handler.bracket.cssvar.rem(s) })]
242
353
  ];
243
354
  const tabSizes = [
244
- [/^tab(?:-([^-]+))?$/, ([, s]) => {
245
- const v = utilities.handler.bracket.global.number(s || "4");
355
+ [/^tab(?:-(.+))?$/, ([, s]) => {
356
+ const v = utilities.handler.bracket.cssvar.global.number(s || "4");
246
357
  if (v != null) {
247
358
  return {
248
359
  "-moz-tab-size": v,
@@ -253,7 +364,7 @@ const tabSizes = [
253
364
  }]
254
365
  ];
255
366
  const textIndents = [
256
- [/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.auto.rem(s) })]
367
+ [/^indent(?:-(.+))?$/, ([, s], { theme }) => ({ "text-indent": theme.textIndent?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.fraction.rem(s) })]
257
368
  ];
258
369
  const textStrokes = [
259
370
  [/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => ({ "-webkit-text-stroke-width": theme.textStrokeWidth?.[s || "DEFAULT"] || utilities.handler.bracket.cssvar.px(s) })],
@@ -264,25 +375,14 @@ const textShadows = [
264
375
  [/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
265
376
  const v = theme.textShadow?.[s || "DEFAULT"];
266
377
  if (v != null) {
267
- const shadow = core.toArray(v);
268
- const colored = shadow.map((s2) => s2.replace(/\s\S+$/, " var(--un-text-shadow-color)"));
269
378
  return {
270
- "--un-text-shadow": shadow.join(","),
271
- "--un-text-shadow-colored": colored.join(","),
379
+ "--un-text-shadow": colorableShadows(v, "--un-text-shadow-color").join(","),
272
380
  "text-shadow": "var(--un-text-shadow)"
273
381
  };
274
382
  }
275
383
  return { "text-shadow": utilities.handler.bracket.cssvar(s) };
276
384
  }],
277
- [/^text-shadow-color-(.+)$/, (m, ctx) => {
278
- const color = utilities.colorResolver("--un-text-shadow-color", "text-shadow")(m, ctx);
279
- if (color) {
280
- return {
281
- ...color,
282
- "--un-text-shadow": "var(--un-text-shadow-colored)"
283
- };
284
- }
285
- }],
385
+ [/^text-shadow-color-(.+)$/, utilities.colorResolver("--un-text-shadow-color", "text-shadow")],
286
386
  [/^text-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-shadow-opacity": utilities.handler.bracket.percent(opacity) })]
287
387
  ];
288
388
 
@@ -292,7 +392,7 @@ const directions = {
292
392
  "y": "row-"
293
393
  };
294
394
  const handleGap = ([, d = "", s]) => {
295
- const v = utilities.handler.bracket.auto.rem(s);
395
+ const v = utilities.handler.bracket.cssvar.rem(s);
296
396
  if (v != null) {
297
397
  return {
298
398
  [`grid-${directions[d]}gap`]: v,
@@ -318,12 +418,12 @@ const autoDirection = (selector, theme) => {
318
418
  case "fr":
319
419
  return "minmax(0,1fr)";
320
420
  }
321
- return utilities.handler.bracket.auto.rem(selector);
421
+ return utilities.handler.bracket.cssvar.auto.rem(selector);
322
422
  };
323
423
  const grids = [
324
424
  ["grid", { display: "grid" }],
325
425
  ["inline-grid", { display: "inline-grid" }],
326
- [/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: utilities.handler.bracket.auto(v) })],
426
+ [/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: utilities.handler.bracket.cssvar.auto(v) })],
327
427
  [/^(?:grid-)?(row|col)-span-(.+)$/, ([, c, s]) => {
328
428
  if (s === "full")
329
429
  return { [`grid-${rowCol(c)}`]: "1/-1" };
@@ -331,11 +431,12 @@ const grids = [
331
431
  if (v != null)
332
432
  return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
333
433
  }],
334
- [/^(?:grid-)?(row|col)-start-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: v })],
335
- [/^(?:grid-)?(row|col)-end-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: v })],
336
- [/^(?:grid-)?auto-(rows|cols)-([\w.-]+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) })],
434
+ [/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: utilities.handler.bracket.cssvar(v) ?? v })],
435
+ [/^(?:grid-)?(row|col)-end-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: utilities.handler.bracket.cssvar(v) ?? v })],
436
+ [/^(?:grid-)?auto-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) })],
437
+ [/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": utilities.handler.bracket.cssvar(v) })],
337
438
  [/^(?:grid-auto-flow|auto-flow|grid-flow)-((?:row|col)(?:-dense)?)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
338
- [/^grid-(rows|cols)-(\[.+\])$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: utilities.handler.bracket(v) })],
439
+ [/^grid-(rows|cols)-(.+)$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: utilities.handler.bracket.cssvar(v) })],
339
440
  [/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
340
441
  [/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` })],
341
442
  ["grid-rows-none", { "grid-template-rows": "none" }],
@@ -376,7 +477,7 @@ const justifies = [
376
477
  ["justify-self-stretch", { "justify-self": "stretch" }]
377
478
  ];
378
479
  const orders = [
379
- [/^order-(.+)$/, ([, v]) => ({ order: utilities.handler.bracket.number(v) })],
480
+ [/^order-(.+)$/, ([, v]) => ({ order: utilities.handler.bracket.cssvar.number(v) })],
380
481
  ["order-first", { order: "-9999" }],
381
482
  ["order-last", { order: "9999" }],
382
483
  ["order-none", { order: "0" }]
@@ -419,7 +520,7 @@ const placements = [
419
520
  ["place-self-stretch", { "place-self": "stretch" }]
420
521
  ];
421
522
  function handleInsetValue(v) {
422
- return utilities.handler.bracket.fraction.cssvar.auto.rem(v);
523
+ return utilities.handler.bracket.cssvar.auto.fraction.rem(v);
423
524
  }
424
525
  function handleInsetValues([, d, v]) {
425
526
  const r = handleInsetValue(v);
@@ -429,6 +530,7 @@ function handleInsetValues([, d, v]) {
429
530
  const insets = [
430
531
  [/^(?:position-|pos-)?inset-(.+)$/, ([, v]) => ({ inset: handleInsetValue(v) })],
431
532
  [/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
533
+ [/^(?:position-|pos-)?inset-([rltbse])-(.+)$/, handleInsetValues],
432
534
  [/^(?:position-|pos-)?inset-(block|inline)-(.+)$/, handleInsetValues],
433
535
  [/^(?:position-|pos-)?inset-([bi][se])-(.+)$/, handleInsetValues],
434
536
  [/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
@@ -443,132 +545,21 @@ const floats = [
443
545
  ["clear-none", { clear: "none" }]
444
546
  ];
445
547
  const zIndexes = [
446
- ["z-auto", { "z-index": "auto" }],
447
- [/^z-([^-]+)$/, ([, v]) => ({ "z-index": utilities.handler.number(v) })]
548
+ [/^z-(.+)$/, ([, v]) => ({ "z-index": utilities.handler.bracket.cssvar.number(v) })],
549
+ ["z-auto", { "z-index": "auto" }]
448
550
  ];
449
551
  const boxSizing = [
450
552
  ["box-border", { "box-sizing": "border-box" }],
451
553
  ["box-content", { "box-sizing": "content-box" }]
452
554
  ];
453
555
 
454
- const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
455
- const displays = [
456
- ["inline", { display: "inline" }],
457
- ["block", { display: "block" }],
458
- ["inline-block", { display: "inline-block" }],
459
- ["contents", { display: "contents" }],
460
- ["flow-root", { display: "flow-root" }],
461
- ["list-item", { display: "list-item" }],
462
- ["hidden", { display: "none" }]
463
- ];
464
- const appearances = [
465
- ["visible", { visibility: "visible" }],
466
- ["invisible", { visibility: "hidden" }],
467
- ["backface-visible", { "backface-visibility": "visible" }],
468
- ["backface-hidden", { "backface-visibility": "hidden" }]
469
- ];
470
- const cursors = [
471
- [/^cursor-(.+)$/, ([, c]) => ({ cursor: c })]
472
- ];
473
- const pointerEvents = [
474
- ["pointer-events-auto", { "pointer-events": "auto" }],
475
- ["pointer-events-none", { "pointer-events": "none" }]
476
- ];
477
- const resizes = [
478
- ["resize-x", { resize: "horizontal" }],
479
- ["resize-y", { resize: "vertical" }],
480
- ["resize", { resize: "both" }],
481
- ["resize-none", { resize: "none" }]
482
- ];
483
- const userSelects = [
484
- ["select-auto", { "user-select": "auto" }],
485
- ["select-all", { "user-select": "all" }],
486
- ["select-text", { "user-select": "text" }],
487
- ["select-none", { "user-select": "none" }]
488
- ];
489
- const whitespaces = [
490
- [/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
491
- ];
492
- const contents = [
493
- ["content-empty", { content: '""' }],
494
- ["content-none", { content: '""' }]
495
- ];
496
- const breaks = [
497
- ["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
498
- ["break-words", { "overflow-wrap": "break-word" }],
499
- ["break-all", { "word-break": "break-all" }]
500
- ];
501
- const textOverflows = [
502
- ["truncate", { "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }],
503
- ["text-ellipsis", { "text-overflow": "ellipsis" }],
504
- ["text-clip", { "text-overflow": "clip" }]
505
- ];
506
- const textTransforms = [
507
- ["case-upper", { "text-transform": "uppercase" }],
508
- ["case-lower", { "text-transform": "lowercase" }],
509
- ["case-capital", { "text-transform": "capitalize" }],
510
- ["case-normal", { "text-transform": "none" }]
511
- ];
512
- const fontStyles = [
513
- ["italic", { "font-style": "italic" }],
514
- ["not-italic", { "font-style": "normal" }]
515
- ];
516
- const fontSmoothings = [
517
- ["antialiased", {
518
- "-webkit-font-smoothing": "antialiased",
519
- "-moz-osx-font-smoothing": "grayscale",
520
- "font-smoothing": "grayscale"
521
- }],
522
- ["subpixel-antialiased", {
523
- "-webkit-font-smoothing": "auto",
524
- "-moz-osx-font-smoothing": "auto",
525
- "font-smoothing": "auto"
526
- }]
527
- ];
528
-
529
- const shadowBase = {
530
- [core.CONTROL_SHORTCUT_NO_MERGE]: "",
531
- "--un-ring-offset-shadow": "0 0 #0000",
532
- "--un-ring-shadow": "0 0 #0000",
533
- "--un-shadow-inset": varEmpty,
534
- "--un-shadow": "0 0 #0000",
535
- "--un-shadow-colored": "0 0 #0000"
536
- };
537
- const boxShadows = [
538
- [/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
539
- const v = theme.boxShadow?.[d || "DEFAULT"];
540
- if (v) {
541
- const shadow = core.toArray(v);
542
- const colored = shadow.map((s) => s.replace(/\s\S+$/, " var(--un-shadow-color)"));
543
- return [
544
- shadowBase,
545
- {
546
- "--un-shadow": shadow.join(","),
547
- "--un-shadow-colored": colored.join(","),
548
- "box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
549
- }
550
- ];
551
- }
552
- }],
553
- [/^shadow-(.+)$/, (m, ctx) => {
554
- const color = utilities.colorResolver("--un-shadow-color", "shadow")(m, ctx);
555
- if (color) {
556
- return {
557
- ...color,
558
- "--un-shadow": "var(--un-shadow-colored)"
559
- };
560
- }
561
- }],
562
- [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": utilities.handler.bracket.percent.cssvar(opacity) })],
563
- ["shadow-inset", { "--un-shadow-inset": "inset" }]
564
- ];
565
-
566
556
  const ringBase = {
557
+ ...shadowBase,
567
558
  "--un-ring-inset": varEmpty,
568
559
  "--un-ring-offset-width": "0px",
569
560
  "--un-ring-offset-color": "#fff",
570
- "--un-ring-color": "rgba(147,197,253,0.5)",
571
- ...shadowBase
561
+ "--un-ring-width": "0px",
562
+ "--un-ring-color": "rgba(147,197,253,0.5)"
572
563
  };
573
564
  const rings = [
574
565
  [/^ring(?:-(.+))?$/, ([, d]) => {
@@ -577,15 +568,17 @@ const rings = [
577
568
  return [
578
569
  ringBase,
579
570
  {
571
+ "--un-ring-width": value,
580
572
  "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
581
- "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
573
+ "--un-ring-shadow": "var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color)",
582
574
  "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
583
575
  }
584
576
  ];
585
577
  }
586
578
  }],
579
+ [/^ring-(?:width-|size-)(.+)$/, ([, d]) => ({ "--un-ring-width": utilities.handler.bracket.cssvar.px(d) })],
587
580
  ["ring-offset", { "--un-ring-offset-width": "1px" }],
588
- [/^ring-offset-(.+)$/, ([, d]) => ({ "--un-ring-offset-width": utilities.handler.px(d || "1") })],
581
+ [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d]) => ({ "--un-ring-offset-width": utilities.handler.bracket.cssvar.px(d) })],
589
582
  [/^ring-(.+)$/, utilities.colorResolver("--un-ring-color", "ring")],
590
583
  [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity) })],
591
584
  [/^ring-offset-(.+)$/, utilities.colorResolver("--un-ring-offset-color", "ring-offset")],
@@ -613,7 +606,7 @@ function getSizeValue(minmax, hw, theme, prop) {
613
606
  case "min":
614
607
  return `${prop}-content`;
615
608
  }
616
- return utilities.handler.bracket.cssvar.fraction.auto.rem(prop);
609
+ return utilities.handler.bracket.cssvar.auto.fraction.rem(prop);
617
610
  }
618
611
  const sizes = [
619
612
  [/^(min-|max-)?([wh])-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
@@ -639,14 +632,14 @@ const paddings = [
639
632
  [/^pa?()-?(-?.+)$/, utilities.directionSize("padding")],
640
633
  [/^p-?([xy])-?(-?.+)$/, utilities.directionSize("padding")],
641
634
  [/^p-?([rltbse])-?(-?.+)$/, utilities.directionSize("padding")],
642
- [/^p-(inline|block)-(-?.+)$/, utilities.directionSize("padding")],
635
+ [/^p-(block|inline)-(-?.+)$/, utilities.directionSize("padding")],
643
636
  [/^p-?([bi][se])-?(-?.+)$/, utilities.directionSize("padding")]
644
637
  ];
645
638
  const margins = [
646
639
  [/^ma?()-?(-?.+)$/, utilities.directionSize("margin")],
647
640
  [/^m-?([xy])-?(-?.+)$/, utilities.directionSize("margin")],
648
641
  [/^m-?([rltbse])-?(-?.+)$/, utilities.directionSize("margin")],
649
- [/^m-(inline|block)-(-?.+)$/, utilities.directionSize("margin")],
642
+ [/^m-(block|inline)-(-?.+)$/, utilities.directionSize("margin")],
650
643
  [/^m-?([bi][se])-?(-?.+)$/, utilities.directionSize("margin")]
651
644
  ];
652
645
 
@@ -697,9 +690,9 @@ const transformBase = {
697
690
  [core.CONTROL_SHORTCUT_NO_MERGE]: ""
698
691
  };
699
692
  const transforms = [
700
- [/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] })],
701
- [/^perspect-(.+)$/, ([, s]) => {
702
- const v = utilities.handler.px.numberWithUnit(s);
693
+ [/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] ?? utilities.handler.bracket.cssvar(s) })],
694
+ [/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
695
+ const v = utilities.handler.bracket.cssvar.px.numberWithUnit(s);
703
696
  if (v != null) {
704
697
  return {
705
698
  "-webkit-perspective": v,
@@ -707,8 +700,8 @@ const transforms = [
707
700
  };
708
701
  }
709
702
  }],
710
- [/^perspect-origin-(.+)$/, ([, s]) => {
711
- const v = utilities.handler.bracket(s) ?? (s.length >= 3 ? utilities.positionMap[s] : void 0);
703
+ [/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
704
+ const v = utilities.handler.bracket.cssvar(s) ?? (s.length >= 3 ? utilities.positionMap[s] : void 0);
712
705
  if (v != null) {
713
706
  return {
714
707
  "-webkit-perspective-origin": v,
@@ -716,16 +709,15 @@ const transforms = [
716
709
  };
717
710
  }
718
711
  }],
719
- [/^translate-()(.+)$/, handleTranslate],
720
- [/^translate-([xyz])-(.+)$/, handleTranslate],
721
- [/^rotate-()(.+)$/, handleRotate],
722
- [/^rotate(-[xyz])-(.+)$/, handleRotate],
723
- [/^skew-()(.+)$/, handleSkew],
724
- [/^skew-([xy])-(.+)$/, handleSkew],
725
- [/^scale-()(.+)$/, handleScale],
726
- [/^scale-([xyz])-(.+)$/, handleScale],
727
- ["preserve-3d", { "transform-style": "preserve-3d" }],
728
- ["preserve-flat", { "transform-style": "flat" }],
712
+ [/^(?:transform-)?translate-()(.+)$/, handleTranslate],
713
+ [/^(?:transform-)?translate-([xyz])-(.+)$/, handleTranslate],
714
+ [/^(?:transform-)?rotate-()(.+)$/, handleRotate],
715
+ [/^(?:transform-)?rotate-([xyz])-(.+)$/, handleRotate],
716
+ [/^(?:transform-)?skew-([xy])-(.+)$/, handleSkew],
717
+ [/^(?:transform-)?scale-()(.+)$/, handleScale],
718
+ [/^(?:transform-)?scale-([xyz])-(.+)$/, handleScale],
719
+ [/^(?:transform-)?preserve-3d$/, () => ({ "transform-style": "preserve-3d" })],
720
+ [/^(?:transform-)?preserve-flat$/, () => ({ "transform-style": "flat" })],
729
721
  [/^transform$/, () => [
730
722
  transformBase,
731
723
  { transform: "var(--un-transform)" }
@@ -735,7 +727,7 @@ const transforms = [
735
727
  ["transform-none", { transform: "none" }]
736
728
  ];
737
729
  function handleTranslate([, d, b]) {
738
- const v = utilities.handler.bracket.fraction.auto.rem(b);
730
+ const v = utilities.handler.bracket.cssvar.fraction.rem(b);
739
731
  if (v != null) {
740
732
  return [
741
733
  transformBase,
@@ -747,7 +739,7 @@ function handleTranslate([, d, b]) {
747
739
  }
748
740
  }
749
741
  function handleScale([, d, b]) {
750
- const v = utilities.handler.bracket.fraction.percent(b);
742
+ const v = utilities.handler.bracket.cssvar.fraction.percent(b);
751
743
  if (v != null) {
752
744
  return [
753
745
  transformBase,
@@ -758,20 +750,34 @@ function handleScale([, d, b]) {
758
750
  ];
759
751
  }
760
752
  }
761
- function handleRotate([, d, b]) {
762
- const v = utilities.handler.bracket.degree(b);
753
+ function handleRotate([, d = "", b]) {
754
+ const v = utilities.handler.bracket.cssvar.degree(b);
763
755
  if (v != null) {
764
- return [
765
- transformBase,
766
- {
767
- [`--un-rotate${d || ""}`]: v,
768
- transform: "var(--un-transform)"
769
- }
770
- ];
756
+ if (d) {
757
+ return [
758
+ transformBase,
759
+ {
760
+ "--un-rotate": 0,
761
+ [`--un-rotate-${d}`]: v,
762
+ "transform": "var(--un-transform)"
763
+ }
764
+ ];
765
+ } else {
766
+ return [
767
+ transformBase,
768
+ {
769
+ "--un-rotate-x": 0,
770
+ "--un-rotate-y": 0,
771
+ "--un-rotate-z": 0,
772
+ "--un-rotate": v,
773
+ "transform": "var(--un-transform)"
774
+ }
775
+ ];
776
+ }
771
777
  }
772
778
  }
773
779
  function handleSkew([, d, b]) {
774
- const v = utilities.handler.bracket.degree(b);
780
+ const v = utilities.handler.bracket.cssvar.degree(b);
775
781
  if (v != null) {
776
782
  return [
777
783
  transformBase,
@@ -784,38 +790,30 @@ function handleSkew([, d, b]) {
784
790
  }
785
791
 
786
792
  const variablesAbbrMap = {
787
- "visible": "visibility",
788
- "select": "user-select",
789
- "vertical": "vertical-align",
790
- "backface": "backface-visibility",
791
- "whitespace": "white-space",
792
- "break": "word-break",
793
- "case": "text-transform",
794
- "origin": "transform-origin",
795
- "bg-opacity": "background-opacity",
796
- "tab": "tab-size",
797
- "underline": "text-decoration-thickness",
798
- "underline-offset": "text-underline-offset",
799
- "grid-cols": "grid-template-columns",
800
- "grid-rows": "grid-template-rows",
801
- "auto-flow": "grid-auto-flow",
802
- "row-start": "grid-row-start",
803
- "row-end": "grid-row-end",
804
- "justify": "justify-content",
805
- "content": "align-content",
806
- "items": "align-items",
807
- "self": "align-self",
808
- "object": "object-fit"
793
+ backface: "backface-visibility",
794
+ break: "word-break",
795
+ case: "text-transform",
796
+ content: "align-content",
797
+ flex: "flex",
798
+ fw: "font-weight",
799
+ items: "align-items",
800
+ justify: "justify-content",
801
+ select: "user-select",
802
+ self: "align-self",
803
+ vertical: "vertical-align",
804
+ visible: "visibility",
805
+ whitespace: "white-space",
806
+ ws: "white-space"
809
807
  };
810
808
  const cssVariables = [
811
- [/^(.+)-\$(.+)$/, ([, name, varname]) => {
809
+ [/^(.+?)-\$(.+)$/, ([, name, varname]) => {
812
810
  const prop = variablesAbbrMap[name];
813
811
  if (prop)
814
812
  return { [prop]: `var(--${varname})` };
815
813
  }]
816
814
  ];
817
815
  const cssProperty = [
818
- [/^\[(.+):(.+)\]$/, ([, prop, value]) => ({ [prop]: utilities.handler.bracket(`[${value}]`) })]
816
+ [/^\[([^:]+):(.+)\]$/, ([, prop, value]) => ({ [prop]: utilities.handler.bracket(`[${value}]`) })]
819
817
  ];
820
818
 
821
819
  const questionMark = [
@@ -835,7 +833,7 @@ const textDecorations = [
835
833
  ["line-through", { "text-decoration-line": "line-through" }],
836
834
  ["decoration-underline", { "text-decoration-line": "underline" }],
837
835
  ["decoration-line-through", { "text-decoration-line": "line-through" }],
838
- [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": utilities.handler.bracket.px(s) })],
836
+ [/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": utilities.handler.bracket.cssvar.px(s) })],
839
837
  [/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
840
838
  [/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
841
839
  const result = utilities.colorResolver("text-decoration-color", "line")(match, ctx);
@@ -847,7 +845,7 @@ const textDecorations = [
847
845
  }
848
846
  }],
849
847
  [/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": utilities.handler.bracket.percent(opacity) })],
850
- [/^underline-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": utilities.handler.auto.bracket.px(s) })],
848
+ [/^(?:underline|decoration)-offset-(.+)$/, ([, s]) => ({ "text-underline-offset": utilities.handler.auto.bracket.cssvar.px(s) })],
851
849
  [/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy|inherit|initial|revert|unset)$/, ([, d]) => ({ "text-decoration-style": d })],
852
850
  ["no-underline", { "text-decoration": "none" }],
853
851
  ["decoration-none", { "text-decoration": "none" }]
@@ -857,9 +855,9 @@ const svgUtilities = [
857
855
  [/^fill-(.+)$/, utilities.colorResolver("fill", "fill")],
858
856
  [/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utilities.handler.bracket.percent(opacity) })],
859
857
  ["fill-none", { fill: "none" }],
860
- [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": utilities.handler.bracket.fraction.px.number(s) })],
861
- [/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": utilities.handler.bracket.number(s) })],
862
- [/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": utilities.handler.bracket.px.numberWithUnit(s) })],
858
+ [/^stroke-(?:width-|size-)?(.+)$/, ([, s]) => ({ "stroke-width": utilities.handler.bracket.cssvar.fraction.px.number(s) })],
859
+ [/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": utilities.handler.bracket.cssvar.number(s) })],
860
+ [/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": utilities.handler.bracket.cssvar.px.numberWithUnit(s) })],
863
861
  [/^stroke-(.+)$/, utilities.colorResolver("stroke", "stroke")],
864
862
  [/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": utilities.handler.bracket.percent(opacity) })],
865
863
  ["stroke-cap-square", { "stroke-linecap": "square" }],
@@ -939,6 +937,7 @@ exports.borders = borders;
939
937
  exports.boxShadows = boxShadows;
940
938
  exports.boxSizing = boxSizing;
941
939
  exports.breaks = breaks;
940
+ exports.colorableShadows = colorableShadows;
942
941
  exports.contents = contents;
943
942
  exports.cssProperty = cssProperty;
944
943
  exports.cssVariables = cssVariables;