@unocss/preset-mini 0.41.2 → 0.43.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,4 +1,4 @@
1
- import { g as globalKeywords, h as handler, c as colorResolver, d as directionMap, a as hasParseableColor, p as parseColor, b as colorToString, e as colorOpacityToString, f as cornerMap, m as makeGlobalStaticRules, i as colorableShadows, j as insetMap, r as resolveVerticalBreakpoints, k as resolveBreakpoints, l as directionSize } from './utilities.mjs';
1
+ import { g as globalKeywords, h as handler, c as colorResolver, d as directionMap, a as hasParseableColor, p as parseColor, b as colorToString, e as colorOpacityToString, f as cornerMap, m as makeGlobalStaticRules, i as colorableShadows, j as insetMap, r as resolveVerticalBreakpoints, k as resolveBreakpoints, l as directionSize } from './colors2.mjs';
2
2
  import { toArray } from '@unocss/core';
3
3
  import { d as displays, c as contents, a as textOverflows, e as textTransforms, f as fontStyles, g as fontSmoothings, h as boxShadows, i as rings, j as cursors, k as appearances, p as pointerEvents, l as resizes, u as userSelects, w as whitespaces, m as breaks, n as transforms } from './transform.mjs';
4
4
 
@@ -272,11 +272,11 @@ const fonts = [
272
272
  ([, s], { theme }) => ({ "line-height": theme.lineHeight?.[s] || handler.bracket.cssvar.global.rem(s) }),
273
273
  { autocomplete: "(leading|lh)-$lineHeight" }
274
274
  ],
275
- [
276
- /^font-synthesis-(.+)$/,
277
- ([, s]) => ({ "font-synthesis": s }),
278
- { autocomplete: "font-synthesis-(none|weight|style|small-caps)" }
279
- ],
275
+ ["font-synthesis-weight", { "font-synthesis": "weight" }],
276
+ ["font-synthesis-style", { "font-synthesis": "style" }],
277
+ ["font-synthesis-small-caps", { "font-synthesis": "small-caps" }],
278
+ ["font-synthesis-none", { "font-synthesis": "none" }],
279
+ [/^font-synthesis-(.+)$/, ([, s]) => ({ "font-synthesis": handler.bracket.cssvar.global(s) })],
280
280
  [
281
281
  /^(?:font-)?tracking-(.+)$/,
282
282
  ([, s], { theme }) => ({ "letter-spacing": theme.letterSpacing?.[s] || handler.bracket.cssvar.global.rem(s) }),
@@ -372,15 +372,15 @@ const grids = [
372
372
  return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
373
373
  }, { autocomplete: ["grid-(row|col)-span-<num>", "(row|col)-span-<num>"] }],
374
374
  [/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: handler.bracket.cssvar(v) ?? v })],
375
- [/^(?:grid-)?(row|col)-end-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: handler.bracket.cssvar(v) ?? v })],
376
- [/^(?:grid-)?auto-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(c, theme, v) })],
375
+ [/^(?:grid-)?(row|col)-end-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: handler.bracket.cssvar(v) ?? v }), { autocomplete: ["grid-(row|col)-(start|end)-<num>"] }],
376
+ [/^(?:grid-)?auto-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(c, theme, v) }), { autocomplete: ["grid-auto-(rows|cols)-<num>"] }],
377
377
  [/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": handler.bracket.cssvar(v) })],
378
- [/^(?:grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
378
+ [/^(?:grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") }), { autocomplete: ["(grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)"] }],
379
379
  [/^grid-(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({
380
380
  [`grid-template-${rowCol(c)}`]: theme[`gridTemplate${rowColTheme(c)}`]?.[v] ?? handler.bracket.cssvar(v)
381
381
  })],
382
382
  [/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
383
- [/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` })],
383
+ [/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` }), { autocomplete: ["grid-(rows|cols)-<num>", "grid-(rows|cols)-none"] }],
384
384
  ["grid-rows-none", { "grid-template-rows": "none" }],
385
385
  ["grid-cols-none", { "grid-template-columns": "none" }]
386
386
  ];
@@ -543,28 +543,26 @@ function getSizeValue(minmax, hw, theme, prop) {
543
543
  return handler.bracket.cssvar.global.auto.fraction.rem(prop);
544
544
  }
545
545
  const sizes = [
546
- [
547
- /^(min-|max-)?([wh])-?(.+)$/,
548
- ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) }),
549
- {
550
- autocomplete: [
551
- "(w|h)-$width|height|maxWidth|maxHeight|minWidth|minHeight|inlineSize|blockSize|maxInlineSize|maxBlockSize|minInlineSize|minBlockSize",
552
- "(max|min)-(w|h)-$width|height|maxWidth|maxHeight|minWidth|minHeight|inlineSize|blockSize|maxInlineSize|maxBlockSize|minInlineSize|minBlockSize"
553
- ]
554
- }
555
- ],
556
- [
557
- /^(min-|max-)?(block|inline)-(.+)$/,
558
- ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) }),
559
- {
560
- autocomplete: [
561
- "(w|h)-(block|inline)-$width|height|maxWidth|maxHeight|minWidth|minHeight|inlineSize|blockSize|maxInlineSize|maxBlockSize|minInlineSize|minBlockSize",
562
- "(max|min)-(w|h)-(block|inline)-$width|height|maxWidth|maxHeight|minWidth|minHeight|inlineSize|blockSize|maxInlineSize|maxBlockSize|minInlineSize|minBlockSize"
563
- ]
564
- }
565
- ],
566
- [/^(min-|max-)?(h)-screen-(.+)$/, ([, m, w, s], context) => ({ [getPropName(m, w)]: resolveVerticalBreakpoints(context)?.[s] }), { autocomplete: ["h-screen-$verticalBreakpoints", "(min|max)-h-screen-$verticalBreakpoints"] }],
567
- [/^(min-|max-)?(w)-screen-(.+)$/, ([, m, w, s], context) => ({ [getPropName(m, w)]: resolveBreakpoints(context)?.[s] }), { autocomplete: ["w-screen-$breakpoints", "(min|max)-w-screen-$breakpoints"] }]
546
+ [/^(min-|max-)?([wh])-?(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
547
+ [/^(min-|max-)?(block|inline)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) }), {
548
+ autocomplete: [
549
+ "(w|h)-$width|height|maxWidth|maxHeight|minWidth|minHeight|inlineSize|blockSize|maxInlineSize|maxBlockSize|minInlineSize|minBlockSize",
550
+ "(block|inline)-$width|height|maxWidth|maxHeight|minWidth|minHeight|inlineSize|blockSize|maxInlineSize|maxBlockSize|minInlineSize|minBlockSize",
551
+ "(max|min)-(w|h|block|inline)",
552
+ "(max|min)-(w|h|block|inline)-$width|height|maxWidth|maxHeight|minWidth|minHeight|inlineSize|blockSize|maxInlineSize|maxBlockSize|minInlineSize|minBlockSize"
553
+ ]
554
+ }],
555
+ [/^(min-|max-)?(h)-screen-(.+)$/, ([, m, w, s], context) => ({ [getPropName(m, w)]: resolveVerticalBreakpoints(context)?.[s] })],
556
+ [/^(min-|max-)?(w)-screen-(.+)$/, ([, m, w, s], context) => ({ [getPropName(m, w)]: resolveBreakpoints(context)?.[s] }), {
557
+ autocomplete: [
558
+ "(w|h)-screen",
559
+ "(min|max)-(w|h)-screen",
560
+ "h-screen-$verticalBreakpoints",
561
+ "(min|max)-h-screen-$verticalBreakpoints",
562
+ "w-screen-$breakpoints",
563
+ "(min|max)-w-screen-$breakpoints"
564
+ ]
565
+ }]
568
566
  ];
569
567
  function getAspectRatio(prop) {
570
568
  if (/^\d+\/\d+$/.test(prop))
@@ -578,7 +576,7 @@ function getAspectRatio(prop) {
578
576
  return handler.bracket.cssvar.global.auto.number(prop);
579
577
  }
580
578
  const aspectRatio = [
581
- [/^aspect-(?:ratio-)?(.+)$/, ([, d]) => ({ "aspect-ratio": getAspectRatio(d) }), { autocomplete: ["aspect-(square|video)", "aspect-ratio-(square|video)"] }]
579
+ [/^aspect-(?:ratio-)?(.+)$/, ([, d]) => ({ "aspect-ratio": getAspectRatio(d) }), { autocomplete: ["aspect-(square|video|ratio)", "aspect-ratio-(square|video)"] }]
582
580
  ];
583
581
 
584
582
  const paddings = [
@@ -733,4 +731,4 @@ const rules = [
733
731
  questionMark
734
732
  ].flat(1);
735
733
 
736
- export { paddings as A, margins as B, svgUtilities as C, transitions as D, fonts as E, tabSizes as F, textIndents as G, textStrokes as H, textShadows as I, cssVariables as J, cssProperty as K, textDecorations as L, appearance as a, borders as b, opacity as c, textColors as d, bgColors as e, flex as f, gaps as g, grids as h, overflows as i, justifies as j, orders as k, alignments as l, placements as m, insets as n, outline as o, positions as p, floats as q, rules as r, boxSizing as s, textAligns as t, questionMark as u, verticalAligns as v, willChange as w, sizes as x, aspectRatio as y, zIndexes as z };
734
+ export { aspectRatio as A, paddings as B, margins as C, svgUtilities as D, transitions as E, fonts as F, tabSizes as G, textIndents as H, textStrokes as I, textShadows as J, cssVariables as K, cssProperty as L, textDecorations as M, appearance as a, borderStyles as b, borders as c, opacity as d, textColors as e, bgColors as f, flex as g, gaps as h, grids as i, overflows as j, justifies as k, orders as l, alignments as m, placements as n, outline as o, positions as p, insets as q, rules as r, floats as s, textAligns as t, boxSizing as u, verticalAligns as v, willChange as w, questionMark as x, sizes as y, zIndexes as z };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const utilities = require('./utilities.cjs');
3
+ const colors = require('./colors2.cjs');
4
4
  const variants$1 = require('./variants.cjs');
5
5
  const core = require('@unocss/core');
6
6
 
@@ -14,7 +14,7 @@ const calcMaxWidthBySize = (size) => {
14
14
  const variantBreakpoints = {
15
15
  name: "breakpoints",
16
16
  match(matcher, context) {
17
- const variantEntries = Object.entries(utilities.resolveBreakpoints(context) ?? {}).map(([point, size], idx) => [point, size, idx]);
17
+ const variantEntries = Object.entries(colors.resolveBreakpoints(context) ?? {}).map(([point, size], idx) => [point, size, idx]);
18
18
  for (const [point, size, idx] of variantEntries) {
19
19
  if (!regexCache[point])
20
20
  regexCache[point] = new RegExp(`^((?:[al]t-)?${point}[:-])`);
@@ -183,24 +183,28 @@ const variantScope = {
183
183
  const variantVariables = {
184
184
  name: "variables",
185
185
  match(matcher) {
186
- const match = matcher.match(/^(\[.+?\]):/);
187
- if (match) {
188
- const variant = utilities.handler.bracket(match[1]) ?? "";
189
- return {
190
- matcher: matcher.slice(match[0].length),
191
- handle(input, next) {
192
- const updates = variant.startsWith("@") ? {
193
- parent: `${input.parent ? `${input.parent} $$ ` : ""}${variant}`
194
- } : {
195
- selector: variant.replace(/&/g, input.selector)
196
- };
197
- return next({
198
- ...input,
199
- ...updates
200
- });
201
- }
202
- };
203
- }
186
+ if (!matcher.startsWith("["))
187
+ return;
188
+ const [match, rest] = colors.getComponent(matcher, "[", "]", ":") ?? [];
189
+ if (!(match && rest && rest !== ""))
190
+ return;
191
+ const variant = colors.handler.bracket(match) ?? "";
192
+ if (!(variant.startsWith("@") || variant.includes("&")))
193
+ return;
194
+ return {
195
+ matcher: rest,
196
+ handle(input, next) {
197
+ const updates = variant.startsWith("@") ? {
198
+ parent: `${input.parent ? `${input.parent} $$ ` : ""}${variant}`
199
+ } : {
200
+ selector: variant.replace(/&/g, input.selector)
201
+ };
202
+ return next({
203
+ ...input,
204
+ ...updates
205
+ });
206
+ }
207
+ };
204
208
  },
205
209
  multiPass: true
206
210
  };
@@ -217,7 +221,7 @@ const variantNegative = {
217
221
  return {
218
222
  matcher: matcher.slice(1),
219
223
  body: (body) => {
220
- if (body.find((v) => v[0] === utilities.CONTROL_MINI_NO_NEGATIVE))
224
+ if (body.find((v) => v[0] === colors.CONTROL_MINI_NO_NEGATIVE))
221
225
  return;
222
226
  let changed = false;
223
227
  body.forEach((v) => {
@@ -327,7 +331,7 @@ const sortValue = (pseudo) => {
327
331
  return 1;
328
332
  };
329
333
  const taggedPseudoClassMatcher = (tag, parent, combinator) => {
330
- const rawRe = new RegExp(`${core.escapeRegExp(parent)}:`);
334
+ const rawRe = new RegExp(`^(${core.escapeRegExp(parent)}:)(\\S+)${core.escapeRegExp(combinator)}\\1`);
331
335
  const pseudoRE = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
332
336
  const pseudoColonRE = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesColonStr}))[:]`);
333
337
  return {
@@ -342,12 +346,13 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
342
346
  matcher: input.slice(match[0].length),
343
347
  handle: (input2, next) => next({
344
348
  ...input2,
345
- prefix: rawRe.test(input2.prefix) ? input2.prefix.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${input2.prefix}`,
349
+ prefix: `${parent}${pseudo}${combinator}${input2.prefix}`.replace(rawRe, "$1$2:"),
346
350
  sort: sortValue(match[3])
347
351
  })
348
352
  };
349
353
  }
350
- }
354
+ },
355
+ multiPass: true
351
356
  };
352
357
  };
353
358
  const PseudoClassesAndElementsStr = Object.entries(PseudoClasses).map(([key]) => key).join("|");
@@ -400,22 +405,10 @@ const variantPseudoClassFunctions = {
400
405
  const variantTaggedPseudoClasses = (options = {}) => {
401
406
  const attributify = !!options?.attributifyPseudo;
402
407
  return [
403
- {
404
- ...taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
405
- multiPass: true
406
- },
407
- {
408
- ...taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
409
- multiPass: true
410
- },
411
- {
412
- ...taggedPseudoClassMatcher("parent", attributify ? '[parent=""]' : ".parent", ">"),
413
- multiPass: true
414
- },
415
- {
416
- ...taggedPseudoClassMatcher("previous", attributify ? '[previous=""]' : ".previous", "+"),
417
- multiPass: true
418
- }
408
+ taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
409
+ taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
410
+ taggedPseudoClassMatcher("parent", attributify ? '[parent=""]' : ".parent", ">"),
411
+ taggedPseudoClassMatcher("previous", attributify ? '[previous=""]' : ".previous", "+")
419
412
  ];
420
413
  };
421
414
  const PartClassesRE = /(part-\[(.+)]:)(.+)/;
@@ -1,4 +1,4 @@
1
- import { k as resolveBreakpoints, h as handler, C as CONTROL_MINI_NO_NEGATIVE } from './utilities.mjs';
1
+ import { k as resolveBreakpoints, n as getComponent, h as handler, C as CONTROL_MINI_NO_NEGATIVE } from './colors2.mjs';
2
2
  import { v as variantParentMatcher, a as variantMatcher } from './variants.mjs';
3
3
  import { escapeRegExp } from '@unocss/core';
4
4
 
@@ -181,24 +181,28 @@ const variantScope = {
181
181
  const variantVariables = {
182
182
  name: "variables",
183
183
  match(matcher) {
184
- const match = matcher.match(/^(\[.+?\]):/);
185
- if (match) {
186
- const variant = handler.bracket(match[1]) ?? "";
187
- return {
188
- matcher: matcher.slice(match[0].length),
189
- handle(input, next) {
190
- const updates = variant.startsWith("@") ? {
191
- parent: `${input.parent ? `${input.parent} $$ ` : ""}${variant}`
192
- } : {
193
- selector: variant.replace(/&/g, input.selector)
194
- };
195
- return next({
196
- ...input,
197
- ...updates
198
- });
199
- }
200
- };
201
- }
184
+ if (!matcher.startsWith("["))
185
+ return;
186
+ const [match, rest] = getComponent(matcher, "[", "]", ":") ?? [];
187
+ if (!(match && rest && rest !== ""))
188
+ return;
189
+ const variant = handler.bracket(match) ?? "";
190
+ if (!(variant.startsWith("@") || variant.includes("&")))
191
+ return;
192
+ return {
193
+ matcher: rest,
194
+ handle(input, next) {
195
+ const updates = variant.startsWith("@") ? {
196
+ parent: `${input.parent ? `${input.parent} $$ ` : ""}${variant}`
197
+ } : {
198
+ selector: variant.replace(/&/g, input.selector)
199
+ };
200
+ return next({
201
+ ...input,
202
+ ...updates
203
+ });
204
+ }
205
+ };
202
206
  },
203
207
  multiPass: true
204
208
  };
@@ -325,7 +329,7 @@ const sortValue = (pseudo) => {
325
329
  return 1;
326
330
  };
327
331
  const taggedPseudoClassMatcher = (tag, parent, combinator) => {
328
- const rawRe = new RegExp(`${escapeRegExp(parent)}:`);
332
+ const rawRe = new RegExp(`^(${escapeRegExp(parent)}:)(\\S+)${escapeRegExp(combinator)}\\1`);
329
333
  const pseudoRE = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
330
334
  const pseudoColonRE = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesColonStr}))[:]`);
331
335
  return {
@@ -340,12 +344,13 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
340
344
  matcher: input.slice(match[0].length),
341
345
  handle: (input2, next) => next({
342
346
  ...input2,
343
- prefix: rawRe.test(input2.prefix) ? input2.prefix.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${input2.prefix}`,
347
+ prefix: `${parent}${pseudo}${combinator}${input2.prefix}`.replace(rawRe, "$1$2:"),
344
348
  sort: sortValue(match[3])
345
349
  })
346
350
  };
347
351
  }
348
- }
352
+ },
353
+ multiPass: true
349
354
  };
350
355
  };
351
356
  const PseudoClassesAndElementsStr = Object.entries(PseudoClasses).map(([key]) => key).join("|");
@@ -398,22 +403,10 @@ const variantPseudoClassFunctions = {
398
403
  const variantTaggedPseudoClasses = (options = {}) => {
399
404
  const attributify = !!options?.attributifyPseudo;
400
405
  return [
401
- {
402
- ...taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
403
- multiPass: true
404
- },
405
- {
406
- ...taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
407
- multiPass: true
408
- },
409
- {
410
- ...taggedPseudoClassMatcher("parent", attributify ? '[parent=""]' : ".parent", ">"),
411
- multiPass: true
412
- },
413
- {
414
- ...taggedPseudoClassMatcher("previous", attributify ? '[previous=""]' : ".previous", "+"),
415
- multiPass: true
416
- }
406
+ taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " "),
407
+ taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~"),
408
+ taggedPseudoClassMatcher("parent", attributify ? '[parent=""]' : ".parent", ">"),
409
+ taggedPseudoClassMatcher("previous", attributify ? '[previous=""]' : ".previous", "+")
417
410
  ];
418
411
  };
419
412
  const PartClassesRE = /(part-\[(.+)]:)(.+)/;
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const utilities = require('./utilities.cjs');
3
+ const colors = require('./colors2.cjs');
4
4
 
5
- const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
5
+ const cursorValues = ["auto", "default", "none", "context-menu", "help", "pointer", "progress", "wait", "cell", "crosshair", "text", "vertical-text", "alias", "copy", "move", "no-drop", "not-allowed", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out"];
6
+ const varEmpty = " ";
6
7
  const displays = [
7
8
  ["inline", { display: "inline" }],
8
9
  ["block", { display: "block" }],
@@ -11,47 +12,48 @@ const displays = [
11
12
  ["flow-root", { display: "flow-root" }],
12
13
  ["list-item", { display: "list-item" }],
13
14
  ["hidden", { display: "none" }],
14
- [/^display-(.+)$/, ([, c]) => ({ display: utilities.handler.bracket.cssvar.global(c) || c })]
15
+ [/^display-(.+)$/, ([, c]) => ({ display: colors.handler.bracket.cssvar.global(c) || c })]
15
16
  ];
16
17
  const appearances = [
17
18
  ["visible", { visibility: "visible" }],
18
19
  ["invisible", { visibility: "hidden" }],
19
20
  ["backface-visible", { "backface-visibility": "visible" }],
20
21
  ["backface-hidden", { "backface-visibility": "hidden" }],
21
- ...utilities.makeGlobalStaticRules("backface", "backface-visibility")
22
+ ...colors.makeGlobalStaticRules("backface", "backface-visibility")
22
23
  ];
23
24
  const cursors = [
24
- [/^cursor-(.+)$/, ([, c]) => ({ cursor: utilities.handler.bracket.cssvar.global(c) || c })]
25
+ [/^cursor-(.+)$/, ([, c]) => ({ cursor: colors.handler.bracket.cssvar.global(c) })],
26
+ ...cursorValues.map((v) => [`cursor-${v}`, { cursor: v }])
25
27
  ];
26
28
  const pointerEvents = [
27
29
  ["pointer-events-auto", { "pointer-events": "auto" }],
28
30
  ["pointer-events-none", { "pointer-events": "none" }],
29
- ...utilities.makeGlobalStaticRules("pointer-events")
31
+ ...colors.makeGlobalStaticRules("pointer-events")
30
32
  ];
31
33
  const resizes = [
32
34
  ["resize-x", { resize: "horizontal" }],
33
35
  ["resize-y", { resize: "vertical" }],
34
36
  ["resize", { resize: "both" }],
35
37
  ["resize-none", { resize: "none" }],
36
- ...utilities.makeGlobalStaticRules("resize")
38
+ ...colors.makeGlobalStaticRules("resize")
37
39
  ];
38
40
  const userSelects = [
39
41
  ["select-auto", { "user-select": "auto" }],
40
42
  ["select-all", { "user-select": "all" }],
41
43
  ["select-text", { "user-select": "text" }],
42
44
  ["select-none", { "user-select": "none" }],
43
- ...utilities.makeGlobalStaticRules("select", "user-select")
45
+ ...colors.makeGlobalStaticRules("select", "user-select")
44
46
  ];
45
47
  const whitespaces = [
46
48
  [
47
49
  /^(?:whitespace-|ws-)([-\w]+)$/,
48
- ([, v]) => ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces", ...utilities.globalKeywords].includes(v) ? { "white-space": v } : void 0,
50
+ ([, v]) => ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces", ...colors.globalKeywords].includes(v) ? { "white-space": v } : void 0,
49
51
  { autocomplete: "(whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap|break-spaces)" }
50
52
  ]
51
53
  ];
52
54
  const contents = [
53
55
  [/^content-\[(.+)\]$/, ([, v]) => ({ content: `"${v}"` })],
54
- [/^content-(\$.+)]$/, ([, v]) => ({ content: utilities.handler.cssvar(v) })],
56
+ [/^content-(\$.+)]$/, ([, v]) => ({ content: colors.handler.cssvar(v) })],
55
57
  ["content-empty", { content: '""' }],
56
58
  ["content-none", { content: '""' }]
57
59
  ];
@@ -70,7 +72,7 @@ const textTransforms = [
70
72
  ["case-lower", { "text-transform": "lowercase" }],
71
73
  ["case-capital", { "text-transform": "capitalize" }],
72
74
  ["case-normal", { "text-transform": "none" }],
73
- ...utilities.makeGlobalStaticRules("case", "text-transform")
75
+ ...colors.makeGlobalStaticRules("case", "text-transform")
74
76
  ];
75
77
  const fontStyles = [
76
78
  ["italic", { "font-style": "italic" }],
@@ -101,51 +103,56 @@ const ringBase = {
101
103
  "--un-ring-offset-color": "#fff",
102
104
  "--un-ring-width": "0px",
103
105
  "--un-ring-color": "rgba(147,197,253,0.5)",
104
- "--un-shadow": "0 0 #0000"
106
+ "--un-shadow": "0 0 rgba(0,0,0,0)"
105
107
  };
106
108
  const rings = [
107
109
  [/^ring(?:-(.+))?$/, ([, d], { theme }) => {
108
- const value = theme.ringWidth?.[d || "DEFAULT"] ?? utilities.handler.px(d || "1");
110
+ const value = theme.ringWidth?.[d || "DEFAULT"] ?? colors.handler.px(d || "1");
109
111
  if (value) {
110
112
  return {
111
113
  "--un-ring-width": value,
112
114
  "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
113
115
  "--un-ring-shadow": "var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color)",
114
- "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
116
+ "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
115
117
  };
116
118
  }
117
119
  }, { autocomplete: "ring-$ringWidth" }],
118
- [/^ring-(?:width-|size-)(.+)$/, ([, d], { theme }) => ({ "--un-ring-width": theme.lineWidth?.[d] ?? utilities.handler.bracket.cssvar.px(d) }), { autocomplete: "ring-(width|size)-$lineWidth" }],
120
+ [/^ring-(?:width-|size-)(.+)$/, ([, d], { theme }) => ({ "--un-ring-width": theme.lineWidth?.[d] ?? colors.handler.bracket.cssvar.px(d) }), { autocomplete: "ring-(width|size)-$lineWidth" }],
119
121
  ["ring-offset", { "--un-ring-offset-width": "1px" }],
120
- [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? utilities.handler.bracket.cssvar.px(d) }), { autocomplete: "ring-offset-(width|size)-$lineWidth" }],
121
- [/^ring-(.+)$/, utilities.colorResolver("--un-ring-color", "ring"), { autocomplete: "ring-$colors" }],
122
- [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity) }), { autocomplete: "ring-(op|opacity)-<percent>" }],
123
- [/^ring-offset-(.+)$/, utilities.colorResolver("--un-ring-offset-color", "ring-offset"), { autocomplete: "ring-offset-$colors" }],
124
- [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": utilities.handler.bracket.percent(opacity) }), { autocomplete: "ring-offset-(op|opacity)-<percent>" }],
122
+ [/^ring-offset-(?:width-|size-)?(.+)$/, ([, d], { theme }) => ({ "--un-ring-offset-width": theme.lineWidth?.[d] ?? colors.handler.bracket.cssvar.px(d) }), { autocomplete: "ring-offset-(width|size)-$lineWidth" }],
123
+ [/^ring-(.+)$/, colors.colorResolver("--un-ring-color", "ring"), { autocomplete: "ring-$colors" }],
124
+ [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": colors.handler.bracket.percent(opacity) }), { autocomplete: "ring-(op|opacity)-<percent>" }],
125
+ [/^ring-offset-(.+)$/, colors.colorResolver("--un-ring-offset-color", "ring-offset"), { autocomplete: "ring-offset-$colors" }],
126
+ [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": colors.handler.bracket.percent(opacity) }), { autocomplete: "ring-offset-(op|opacity)-<percent>" }],
125
127
  ["ring-inset", { "--un-ring-inset": "inset" }]
126
128
  ];
127
129
 
128
130
  const boxShadowsBase = {
129
- "--un-ring-offset-shadow": "0 0 #0000",
130
- "--un-ring-shadow": "0 0 #0000",
131
+ "--un-ring-offset-shadow": "0 0 rgba(0,0,0,0)",
132
+ "--un-ring-shadow": "0 0 rgba(0,0,0,0)",
131
133
  "--un-shadow-inset": varEmpty,
132
- "--un-shadow": "0 0 #0000"
134
+ "--un-shadow": "0 0 rgba(0,0,0,0)"
133
135
  };
134
136
  const boxShadows = [
135
137
  [/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
136
138
  const v = theme.boxShadow?.[d || "DEFAULT"];
137
139
  if (v) {
138
140
  return {
139
- "--un-shadow": utilities.colorableShadows(v, "--un-shadow-color").join(","),
140
- "box-shadow": "var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow)"
141
+ "--un-shadow": colors.colorableShadows(v, "--un-shadow-color").join(","),
142
+ "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
141
143
  };
142
144
  }
143
145
  }, { autocomplete: "shadow-$boxShadow" }],
144
- [/^shadow-(.+)$/, utilities.colorResolver("--un-shadow-color", "shadow"), { autocomplete: "shadow-$colors" }],
145
- [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": utilities.handler.bracket.percent(opacity) }), { autocomplete: "shadow-(op|opacity)-<percent>" }],
146
+ [/^shadow-(.+)$/, colors.colorResolver("--un-shadow-color", "shadow"), { autocomplete: "shadow-$colors" }],
147
+ [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": colors.handler.bracket.percent(opacity) }), { autocomplete: "shadow-(op|opacity)-<percent>" }],
146
148
  ["shadow-inset", { "--un-shadow-inset": "inset" }]
147
149
  ];
148
150
 
151
+ const transformValues = [
152
+ "translate",
153
+ "rotate",
154
+ "scale"
155
+ ];
149
156
  const transformCpu = [
150
157
  "translateX(var(--un-translate-x))",
151
158
  "translateY(var(--un-translate-y))",
@@ -187,9 +194,9 @@ const transformBase = {
187
194
  "--un-translate-z": 0
188
195
  };
189
196
  const transforms = [
190
- [/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] ?? utilities.handler.bracket.cssvar(s) }), { autocomplete: [`transform-origin-(${Object.keys(utilities.positionMap).join("|")})`, `origin-(${Object.keys(utilities.positionMap).join("|")})`] }],
197
+ [/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": colors.positionMap[s] ?? colors.handler.bracket.cssvar(s) }), { autocomplete: [`transform-origin-(${Object.keys(colors.positionMap).join("|")})`, `origin-(${Object.keys(colors.positionMap).join("|")})`] }],
191
198
  [/^(?:transform-)?perspect(?:ive)?-(.+)$/, ([, s]) => {
192
- const v = utilities.handler.bracket.cssvar.px.numberWithUnit(s);
199
+ const v = colors.handler.bracket.cssvar.px.numberWithUnit(s);
193
200
  if (v != null) {
194
201
  return {
195
202
  "-webkit-perspective": v,
@@ -198,7 +205,7 @@ const transforms = [
198
205
  }
199
206
  }],
200
207
  [/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
201
- const v = utilities.handler.bracket.cssvar(s) ?? (s.length >= 3 ? utilities.positionMap[s] : void 0);
208
+ const v = colors.handler.bracket.cssvar(s) ?? (s.length >= 3 ? colors.positionMap[s] : void 0);
202
209
  if (v != null) {
203
210
  return {
204
211
  "-webkit-perspective-origin": v,
@@ -210,37 +217,37 @@ const transforms = [
210
217
  [/^(?:transform-)?translate-([xyz])-(.+)$/, handleTranslate],
211
218
  [/^(?:transform-)?rotate-()(.+)$/, handleRotate],
212
219
  [/^(?:transform-)?rotate-([xyz])-(.+)$/, handleRotate],
213
- [/^(?:transform-)?skew-([xy])-(.+)$/, handleSkew],
220
+ [/^(?:transform-)?skew-([xy])-(.+)$/, handleSkew, { autocomplete: ["transform-skew-(x|y)-<percent>"] }],
214
221
  [/^(?:transform-)?scale-()(.+)$/, handleScale],
215
- [/^(?:transform-)?scale-([xyz])-(.+)$/, handleScale],
222
+ [/^(?:transform-)?scale-([xyz])-(.+)$/, handleScale, { autocomplete: [`transform-(${transformValues.join("|")})-<percent>`, `transform-(${transformValues.join("|")})-(x|y|z)-<percent>`] }],
216
223
  [/^(?:transform-)?preserve-3d$/, () => ({ "transform-style": "preserve-3d" })],
217
224
  [/^(?:transform-)?preserve-flat$/, () => ({ "transform-style": "flat" })],
218
225
  ["transform", { transform: transformCpu }],
219
226
  ["transform-cpu", { transform: transformCpu }],
220
227
  ["transform-gpu", { transform: transformGpu }],
221
228
  ["transform-none", { transform: "none" }],
222
- ...utilities.makeGlobalStaticRules("transform")
229
+ ...colors.makeGlobalStaticRules("transform")
223
230
  ];
224
231
  function handleTranslate([, d, b], { theme }) {
225
- const v = theme.spacing?.[b] ?? utilities.handler.bracket.cssvar.fraction.rem(b);
232
+ const v = theme.spacing?.[b] ?? colors.handler.bracket.cssvar.fraction.rem(b);
226
233
  if (v != null) {
227
234
  return [
228
- ...utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v]),
235
+ ...colors.xyzMap[d].map((i) => [`--un-translate${i}`, v]),
229
236
  ["transform", transformCpu]
230
237
  ];
231
238
  }
232
239
  }
233
240
  function handleScale([, d, b]) {
234
- const v = utilities.handler.bracket.cssvar.fraction.percent(b);
241
+ const v = colors.handler.bracket.cssvar.fraction.percent(b);
235
242
  if (v != null) {
236
243
  return [
237
- ...utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v]),
244
+ ...colors.xyzMap[d].map((i) => [`--un-scale${i}`, v]),
238
245
  ["transform", transformCpu]
239
246
  ];
240
247
  }
241
248
  }
242
249
  function handleRotate([, d = "", b]) {
243
- const v = utilities.handler.bracket.cssvar.degree(b);
250
+ const v = colors.handler.bracket.cssvar.degree(b);
244
251
  if (v != null) {
245
252
  if (d) {
246
253
  return {
@@ -260,7 +267,7 @@ function handleRotate([, d = "", b]) {
260
267
  }
261
268
  }
262
269
  function handleSkew([, d, b]) {
263
- const v = utilities.handler.bracket.cssvar.degree(b);
270
+ const v = colors.handler.bracket.cssvar.degree(b);
264
271
  if (v != null) {
265
272
  return {
266
273
  [`--un-skew-${d}`]: v,