@unocss/preset-mini 0.18.1 → 0.19.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.
@@ -45,12 +45,12 @@ const borders = [
45
45
  [/^(?:border|b)-([^-]+)-size-(.+)$/, handlerBorderSize],
46
46
  [/^(?:border|b)()-(.+)$/, handlerBorderColor],
47
47
  [/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
48
- [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": utilities.handler.bracket.percent(opacity) })],
49
- [/^(?:border|b)-([^-]+)-op(?:acity)?-?(.+)$/, ([, a, opacity]) => {
48
+ [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity], { options: { variablePrefix: p } }) => ({ [`--${p}border-opacity`]: utilities.handler.bracket.percent(opacity) })],
49
+ [/^(?:border|b)-([^-]+)-op(?:acity)?-?(.+)$/, ([, a, opacity], { options: { variablePrefix: p } }) => {
50
50
  const v = utilities.handler.bracket.percent(opacity);
51
51
  const d = utilities.directionMap[a];
52
52
  if (v !== void 0 && d)
53
- return d.map((i) => [`--un-border${i}-opacity`, v]);
53
+ return d.map((i) => [`--${p}border${i}-opacity`, v]);
54
54
  }],
55
55
  [/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
56
56
  [/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
@@ -64,7 +64,7 @@ const borders = [
64
64
  const borderHasColor = (color, { theme }) => {
65
65
  return color !== void 0 && !!utilities.parseColor(color, theme)?.color;
66
66
  };
67
- const borderColorResolver = (direction) => ([, body], { theme }) => {
67
+ const borderColorResolver = (direction) => ([, body], { theme, options: { variablePrefix: p } }) => {
68
68
  const data = utilities.parseColor(body, theme);
69
69
  if (!data)
70
70
  return;
@@ -81,14 +81,14 @@ const borderColorResolver = (direction) => ([, body], { theme }) => {
81
81
  } else {
82
82
  if (direction === "") {
83
83
  return {
84
- "--un-border-opacity": 1,
85
- [`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
84
+ [`--${p}border-opacity`]: 1,
85
+ [`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--${p}border${direction}-opacity))`
86
86
  };
87
87
  } else {
88
88
  return {
89
- "--un-border-opacity": 1,
90
- [`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
91
- [`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
89
+ [`--${p}border-opacity`]: 1,
90
+ [`--${p}border${direction}-opacity`]: `var(--${p}border-opacity)`,
91
+ [`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--${p}border${direction}-opacity))`
92
92
  };
93
93
  }
94
94
  }
@@ -336,12 +336,12 @@ const grids = [
336
336
  [/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": autoDirection(v, theme) })],
337
337
  [/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": v.replace("col", "column").split("-").join(" ") })],
338
338
  [/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": autoDirection(v, theme) })],
339
+ [/^grid-cols-(.+)$/, ([, v]) => ({ "grid-template-columns": utilities.handler.bracket(v) })],
340
+ [/^grid-rows-(.+)$/, ([, v]) => ({ "grid-template-rows": utilities.handler.bracket(v) })],
339
341
  [/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,minmax(${d},1fr))` })],
340
342
  [/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,minmax(${d},1fr))` })],
341
343
  [/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
342
- [/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })],
343
- [/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
344
- [/^grid-rows-\[(.+)\]$/, ([, v]) => ({ "grid-template-rows": v.replace(/,/g, " ") })]
344
+ [/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })]
345
345
  ];
346
346
 
347
347
  const overflowValues = [
@@ -357,11 +357,8 @@ const overflows = [
357
357
 
358
358
  const basicSet = ["auto", "start", "end", "center", "stretch"];
359
359
  const positions = [
360
- ["relative", { position: "relative" }],
361
- ["absolute", { position: "absolute" }],
362
- ["fixed", { position: "fixed" }],
363
- ["sticky", { position: "sticky" }],
364
- ["static", { position: "static" }]
360
+ [/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, ([, v]) => ({ position: v })],
361
+ [/^(?:position-|pos-)?(static)$/, ([, v]) => ({ position: v })]
365
362
  ];
366
363
  const justifies = [
367
364
  ["justify-start", { "justify-content": "flex-start" }],
@@ -412,8 +409,8 @@ function handleInsetValue(v) {
412
409
  return { auto: "auto", full: "100%" }[v] ?? utilities.handler.bracket.fraction.cssvar.auto.rem(v);
413
410
  }
414
411
  const insets = [
415
- [/^(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
416
- [/^inset-([xy])-(.+)$/, ([, d, v]) => {
412
+ [/^(?:position-|pos-)?(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
413
+ [/^(?:position-|pos-)?inset-([xy])-(.+)$/, ([, d, v]) => {
417
414
  const r = handleInsetValue(v);
418
415
  if (r != null && d in utilities.directionMap)
419
416
  return utilities.directionMap[d].map((i) => [i.slice(1), r]);
@@ -437,6 +434,7 @@ const boxSizing = [
437
434
  ["box-content", { "box-sizing": "content-box" }]
438
435
  ];
439
436
 
437
+ const varEmptyFn = core.cacheFunction((prefix) => `var(--${prefix}empty,/*!*/ /*!*/)`);
440
438
  const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
441
439
  const displays = [
442
440
  ["inline", { display: "inline" }],
@@ -512,32 +510,28 @@ const fontSmoothings = [
512
510
  ];
513
511
 
514
512
  const rings = [
515
- [/^ring-?(.*)$/, ([, d]) => {
513
+ [/^ring-?(.*)$/, ([, d], { options: { variablePrefix: p } }) => {
516
514
  const value = utilities.handler.px(d || "1");
517
515
  if (value) {
518
516
  return {
519
- "--un-ring-inset": varEmpty,
520
- "--un-ring-offset-width": "0px",
521
- "--un-ring-offset-color": "#fff",
522
- "--un-ring-color": "rgba(59, 130, 246, .5)",
523
- "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
524
- "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
525
- "-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)",
526
- "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
517
+ [`--${p}ring-inset`]: varEmptyFn(p),
518
+ [`--${p}ring-offset-width`]: "0px",
519
+ [`--${p}ring-offset-color`]: "#fff",
520
+ [`--${p}ring-color`]: "rgba(59, 130, 246, .5)",
521
+ [`--${p}ring-offset-shadow`]: `var(--${p}ring-inset) 0 0 0 var(--${p}ring-offset-width) var(--${p}ring-offset-color)`,
522
+ [`--${p}ring-shadow`]: `var(--${p}ring-inset) 0 0 0 calc(${value} + var(--${p}ring-offset-width)) var(--${p}ring-color)`,
523
+ "-webkit-box-shadow": `var(--${p}ring-offset-shadow), var(--${p}ring-shadow), var(--${p}shadow, 0 0 #0000)`,
524
+ "box-shadow": `var(--${p}ring-offset-shadow), var(--${p}ring-shadow), var(--${p}shadow, 0 0 #0000)`
527
525
  };
528
526
  }
529
527
  }],
530
- ["ring-offset", { "--un-ring-offset-width": "1px" }],
531
- [/^ring-offset-(.+)$/, ([, d]) => {
532
- const value = utilities.handler.px(d || "1");
533
- if (value)
534
- return { "--un-ring-offset-width": value };
535
- }],
536
- [/^ring-(.+)$/, utilities.colorResolver("--un-ring-color", "ring")],
537
- [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": utilities.handler.bracket.percent(opacity) })],
538
- [/^ring-offset-(.+)$/, utilities.colorResolver("--un-ring-offset-color", "ring-offset")],
539
- [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": utilities.handler.bracket.percent(opacity) })],
540
- ["ring-inset", { "--un-ring-inset": "inset" }]
528
+ [/^ring-offset$/, (_, { options: { variablePrefix: p } }) => ({ [`--${p}ring-offset-width`]: "1px" })],
529
+ [/^ring-offset-(.+)$/, ([, d], { options: { variablePrefix: p } }) => ({ [`--${p}ring-offset-width`]: utilities.handler.px(d || "1") })],
530
+ [/^ring-(.+)$/, (m, ctx) => utilities.colorResolver(`--${ctx.options.variablePrefix}ring-color`, "ring")(m, ctx)],
531
+ [/^ring-op(?:acity)?-?(.+)$/, ([, opacity], { options: { variablePrefix: p } }) => ({ [`--${p}ring-opacity`]: utilities.handler.bracket.percent(opacity) })],
532
+ [/^ring-offset-(.+)$/, (m, ctx) => utilities.colorResolver(`--${ctx.options.variablePrefix}ring-offset-color`, "ring-offset")(m, ctx)],
533
+ [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity], { options: { variablePrefix: p } }) => ({ [`--${p}ring-offset-opacity`]: utilities.handler.bracket.percent(opacity) })],
534
+ [/^ring-inset$/, (_, { options: { variablePrefix: p } }) => ({ [`--${p}ring-inset`]: "inset" })]
541
535
  ];
542
536
 
543
537
  const colorResolver = (body, theme) => {
@@ -913,6 +907,7 @@ exports.transforms = transforms;
913
907
  exports.transitions = transitions;
914
908
  exports.userSelects = userSelects;
915
909
  exports.varEmpty = varEmpty;
910
+ exports.varEmptyFn = varEmptyFn;
916
911
  exports.verticalAligns = verticalAligns;
917
912
  exports.whitespaces = whitespaces;
918
913
  exports.willChange = willChange;
@@ -1,5 +1,5 @@
1
1
  import { h as handler, c as colorResolver$1, d as directionMap, p as parseColor, a as cornerMap, b as capitalize, e as directionSize, x as xyzMap } from './utilities.mjs';
2
- import { toArray } from '@unocss/core';
2
+ import { toArray, cacheFunction } from '@unocss/core';
3
3
  import { C as CONTROL_BYPASS_PSEUDO_CLASS } from './pseudo.mjs';
4
4
 
5
5
  const verticalAlignAlias = {
@@ -43,12 +43,12 @@ const borders = [
43
43
  [/^(?:border|b)-([^-]+)-size-(.+)$/, handlerBorderSize],
44
44
  [/^(?:border|b)()-(.+)$/, handlerBorderColor],
45
45
  [/^(?:border|b)-([^-]+)(?:-(.+))?$/, handlerBorderColor],
46
- [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": handler.bracket.percent(opacity) })],
47
- [/^(?:border|b)-([^-]+)-op(?:acity)?-?(.+)$/, ([, a, opacity]) => {
46
+ [/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity], { options: { variablePrefix: p } }) => ({ [`--${p}border-opacity`]: handler.bracket.percent(opacity) })],
47
+ [/^(?:border|b)-([^-]+)-op(?:acity)?-?(.+)$/, ([, a, opacity], { options: { variablePrefix: p } }) => {
48
48
  const v = handler.bracket.percent(opacity);
49
49
  const d = directionMap[a];
50
50
  if (v !== void 0 && d)
51
- return d.map((i) => [`--un-border${i}-opacity`, v]);
51
+ return d.map((i) => [`--${p}border${i}-opacity`, v]);
52
52
  }],
53
53
  [/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
54
54
  [/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
@@ -62,7 +62,7 @@ const borders = [
62
62
  const borderHasColor = (color, { theme }) => {
63
63
  return color !== void 0 && !!parseColor(color, theme)?.color;
64
64
  };
65
- const borderColorResolver = (direction) => ([, body], { theme }) => {
65
+ const borderColorResolver = (direction) => ([, body], { theme, options: { variablePrefix: p } }) => {
66
66
  const data = parseColor(body, theme);
67
67
  if (!data)
68
68
  return;
@@ -79,14 +79,14 @@ const borderColorResolver = (direction) => ([, body], { theme }) => {
79
79
  } else {
80
80
  if (direction === "") {
81
81
  return {
82
- "--un-border-opacity": 1,
83
- [`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
82
+ [`--${p}border-opacity`]: 1,
83
+ [`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--${p}border${direction}-opacity))`
84
84
  };
85
85
  } else {
86
86
  return {
87
- "--un-border-opacity": 1,
88
- [`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
89
- [`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--un-border${direction}-opacity))`
87
+ [`--${p}border-opacity`]: 1,
88
+ [`--${p}border${direction}-opacity`]: `var(--${p}border-opacity)`,
89
+ [`border${direction}-color`]: `rgba(${rgba.slice(0, 3).join(",")},var(--${p}border${direction}-opacity))`
90
90
  };
91
91
  }
92
92
  }
@@ -334,12 +334,12 @@ const grids = [
334
334
  [/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": autoDirection(v, theme) })],
335
335
  [/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": v.replace("col", "column").split("-").join(" ") })],
336
336
  [/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": autoDirection(v, theme) })],
337
+ [/^grid-cols-(.+)$/, ([, v]) => ({ "grid-template-columns": handler.bracket(v) })],
338
+ [/^grid-rows-(.+)$/, ([, v]) => ({ "grid-template-rows": handler.bracket(v) })],
337
339
  [/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill,minmax(${d},1fr))` })],
338
340
  [/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill,minmax(${d},1fr))` })],
339
341
  [/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
340
- [/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })],
341
- [/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
342
- [/^grid-rows-\[(.+)\]$/, ([, v]) => ({ "grid-template-rows": v.replace(/,/g, " ") })]
342
+ [/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })]
343
343
  ];
344
344
 
345
345
  const overflowValues = [
@@ -355,11 +355,8 @@ const overflows = [
355
355
 
356
356
  const basicSet = ["auto", "start", "end", "center", "stretch"];
357
357
  const positions = [
358
- ["relative", { position: "relative" }],
359
- ["absolute", { position: "absolute" }],
360
- ["fixed", { position: "fixed" }],
361
- ["sticky", { position: "sticky" }],
362
- ["static", { position: "static" }]
358
+ [/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, ([, v]) => ({ position: v })],
359
+ [/^(?:position-|pos-)?(static)$/, ([, v]) => ({ position: v })]
363
360
  ];
364
361
  const justifies = [
365
362
  ["justify-start", { "justify-content": "flex-start" }],
@@ -410,8 +407,8 @@ function handleInsetValue(v) {
410
407
  return { auto: "auto", full: "100%" }[v] ?? handler.bracket.fraction.cssvar.auto.rem(v);
411
408
  }
412
409
  const insets = [
413
- [/^(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
414
- [/^inset-([xy])-(.+)$/, ([, d, v]) => {
410
+ [/^(?:position-|pos-)?(top|left|right|bottom|inset)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })],
411
+ [/^(?:position-|pos-)?inset-([xy])-(.+)$/, ([, d, v]) => {
415
412
  const r = handleInsetValue(v);
416
413
  if (r != null && d in directionMap)
417
414
  return directionMap[d].map((i) => [i.slice(1), r]);
@@ -435,6 +432,7 @@ const boxSizing = [
435
432
  ["box-content", { "box-sizing": "content-box" }]
436
433
  ];
437
434
 
435
+ const varEmptyFn = cacheFunction((prefix) => `var(--${prefix}empty,/*!*/ /*!*/)`);
438
436
  const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
439
437
  const displays = [
440
438
  ["inline", { display: "inline" }],
@@ -510,32 +508,28 @@ const fontSmoothings = [
510
508
  ];
511
509
 
512
510
  const rings = [
513
- [/^ring-?(.*)$/, ([, d]) => {
511
+ [/^ring-?(.*)$/, ([, d], { options: { variablePrefix: p } }) => {
514
512
  const value = handler.px(d || "1");
515
513
  if (value) {
516
514
  return {
517
- "--un-ring-inset": varEmpty,
518
- "--un-ring-offset-width": "0px",
519
- "--un-ring-offset-color": "#fff",
520
- "--un-ring-color": "rgba(59, 130, 246, .5)",
521
- "--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
522
- "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
523
- "-webkit-box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)",
524
- "box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
515
+ [`--${p}ring-inset`]: varEmptyFn(p),
516
+ [`--${p}ring-offset-width`]: "0px",
517
+ [`--${p}ring-offset-color`]: "#fff",
518
+ [`--${p}ring-color`]: "rgba(59, 130, 246, .5)",
519
+ [`--${p}ring-offset-shadow`]: `var(--${p}ring-inset) 0 0 0 var(--${p}ring-offset-width) var(--${p}ring-offset-color)`,
520
+ [`--${p}ring-shadow`]: `var(--${p}ring-inset) 0 0 0 calc(${value} + var(--${p}ring-offset-width)) var(--${p}ring-color)`,
521
+ "-webkit-box-shadow": `var(--${p}ring-offset-shadow), var(--${p}ring-shadow), var(--${p}shadow, 0 0 #0000)`,
522
+ "box-shadow": `var(--${p}ring-offset-shadow), var(--${p}ring-shadow), var(--${p}shadow, 0 0 #0000)`
525
523
  };
526
524
  }
527
525
  }],
528
- ["ring-offset", { "--un-ring-offset-width": "1px" }],
529
- [/^ring-offset-(.+)$/, ([, d]) => {
530
- const value = handler.px(d || "1");
531
- if (value)
532
- return { "--un-ring-offset-width": value };
533
- }],
534
- [/^ring-(.+)$/, colorResolver$1("--un-ring-color", "ring")],
535
- [/^ring-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-opacity": handler.bracket.percent(opacity) })],
536
- [/^ring-offset-(.+)$/, colorResolver$1("--un-ring-offset-color", "ring-offset")],
537
- [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-ring-offset-opacity": handler.bracket.percent(opacity) })],
538
- ["ring-inset", { "--un-ring-inset": "inset" }]
526
+ [/^ring-offset$/, (_, { options: { variablePrefix: p } }) => ({ [`--${p}ring-offset-width`]: "1px" })],
527
+ [/^ring-offset-(.+)$/, ([, d], { options: { variablePrefix: p } }) => ({ [`--${p}ring-offset-width`]: handler.px(d || "1") })],
528
+ [/^ring-(.+)$/, (m, ctx) => colorResolver$1(`--${ctx.options.variablePrefix}ring-color`, "ring")(m, ctx)],
529
+ [/^ring-op(?:acity)?-?(.+)$/, ([, opacity], { options: { variablePrefix: p } }) => ({ [`--${p}ring-opacity`]: handler.bracket.percent(opacity) })],
530
+ [/^ring-offset-(.+)$/, (m, ctx) => colorResolver$1(`--${ctx.options.variablePrefix}ring-offset-color`, "ring-offset")(m, ctx)],
531
+ [/^ring-offset-op(?:acity)?-?(.+)$/, ([, opacity], { options: { variablePrefix: p } }) => ({ [`--${p}ring-offset-opacity`]: handler.bracket.percent(opacity) })],
532
+ [/^ring-inset$/, (_, { options: { variablePrefix: p } }) => ({ [`--${p}ring-inset`]: "inset" })]
539
533
  ];
540
534
 
541
535
  const colorResolver = (body, theme) => {
@@ -861,4 +855,4 @@ const rules = [
861
855
  questionMark
862
856
  ].flat(1);
863
857
 
864
- export { textDecorations as $, sizes as A, aspectRatio as B, paddings as C, margins as D, varEmpty as E, displays as F, appearances as G, cursors as H, pointerEvents as I, resizes as J, userSelects as K, whitespaces as L, contents as M, breaks as N, textOverflows as O, textTransforms as P, fontStyles as Q, fontSmoothings as R, svgUtilities as S, transforms as T, transitions as U, fonts as V, tabSizes as W, textIndents as X, textStrokes as Y, textShadows as Z, cssVariables as _, 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, rings as x, boxShadows as y, zIndexes as z };
858
+ export { cssVariables as $, sizes as A, aspectRatio as B, paddings as C, margins as D, varEmptyFn as E, varEmpty as F, displays as G, appearances as H, cursors as I, pointerEvents as J, resizes as K, userSelects as L, whitespaces as M, contents as N, breaks as O, textOverflows as P, textTransforms as Q, fontStyles as R, fontSmoothings as S, svgUtilities as T, transforms as U, transitions as V, fonts as W, tabSizes as X, textIndents as Y, textStrokes as Z, textShadows as _, appearance as a, textDecorations as a0, 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, rings as x, boxShadows as y, zIndexes as z };
@@ -4,7 +4,7 @@ const variants$1 = require('./variants.cjs');
4
4
  const pseudo = require('./pseudo.cjs');
5
5
 
6
6
  const regexCache = {};
7
- const variantBreakpoints = (matcher, _, theme) => {
7
+ const variantBreakpoints = (matcher, { theme }) => {
8
8
  const variantEntries = Object.entries(theme.breakpoints || {}).map(([point, size], idx) => [point, size, idx]);
9
9
  for (const [point, size, idx] of variantEntries) {
10
10
  if (!regexCache[point])
@@ -46,25 +46,41 @@ const variantCombinators = [
46
46
  variants$1.variantMatcher("svg", (input) => `${input} svg *`)
47
47
  ];
48
48
 
49
- const variantColorsClass = [
50
- variants$1.variantMatcher("dark", (input) => `.dark $$ ${input}`),
51
- variants$1.variantMatcher("light", (input) => `.light $$ ${input}`)
52
- ];
53
- const variantColorsMedia = [
54
- (v) => {
55
- const dark = variants$1.variantMatcher("dark")(v);
56
- if (dark) {
57
- return {
58
- ...dark,
59
- parent: "@media (prefers-color-scheme: dark)"
60
- };
49
+ const variantColorsMediaOrClass = [
50
+ (v, { options: { dark } }) => {
51
+ if (dark === "class") {
52
+ const match = variants$1.variantMatcher("dark", (input) => `.dark $$ ${input}`)(v);
53
+ if (match)
54
+ return match;
61
55
  }
62
- const light = variants$1.variantMatcher("light")(v);
63
- if (light) {
64
- return {
65
- ...light,
66
- parent: "@media (prefers-color-scheme: light)"
67
- };
56
+ },
57
+ (v, { options: { dark } }) => {
58
+ if (dark === "class") {
59
+ const match = variants$1.variantMatcher("light", (input) => `.light $$ ${input}`)(v);
60
+ if (match)
61
+ return match;
62
+ }
63
+ },
64
+ (v, { options: { dark } }) => {
65
+ if (dark === "media") {
66
+ const match = variants$1.variantMatcher("dark")(v);
67
+ if (match) {
68
+ return {
69
+ ...match,
70
+ parent: "@media (prefers-color-scheme: dark)"
71
+ };
72
+ }
73
+ }
74
+ },
75
+ (v, { options: { dark } }) => {
76
+ if (dark === "media") {
77
+ const match = variants$1.variantMatcher("light")(v);
78
+ if (match) {
79
+ return {
80
+ ...match,
81
+ parent: "@media (prefers-color-scheme: light)"
82
+ };
83
+ }
68
84
  }
69
85
  }
70
86
  ];
@@ -113,7 +129,7 @@ const variantSpace = (matcher) => {
113
129
  }
114
130
  };
115
131
 
116
- const variants = (options) => [
132
+ const variants = [
117
133
  variantSpace,
118
134
  variantNegative,
119
135
  variantImportant,
@@ -121,15 +137,14 @@ const variants = (options) => [
121
137
  ...variantCombinators,
122
138
  pseudo.variantPseudoClasses,
123
139
  pseudo.variantPseudoClassFunctions,
124
- pseudo.variantTaggedPseudoClasses(options),
140
+ pseudo.variantTaggedPseudoClasses,
125
141
  pseudo.variantPseudoElements,
126
142
  pseudo.partClasses,
127
- ...options.dark === "media" ? variantColorsMedia : variantColorsClass
143
+ ...variantColorsMediaOrClass
128
144
  ];
129
145
 
130
146
  exports.variantBreakpoints = variantBreakpoints;
131
- exports.variantColorsClass = variantColorsClass;
132
- exports.variantColorsMedia = variantColorsMedia;
147
+ exports.variantColorsMediaOrClass = variantColorsMediaOrClass;
133
148
  exports.variantCombinators = variantCombinators;
134
149
  exports.variantImportant = variantImportant;
135
150
  exports.variantNegative = variantNegative;
@@ -2,7 +2,7 @@ import { v as variantMatcher } from './variants.mjs';
2
2
  import { v as variantPseudoClasses, a as variantPseudoClassFunctions, b as variantTaggedPseudoClasses, c as variantPseudoElements, p as partClasses } from './pseudo.mjs';
3
3
 
4
4
  const regexCache = {};
5
- const variantBreakpoints = (matcher, _, theme) => {
5
+ const variantBreakpoints = (matcher, { theme }) => {
6
6
  const variantEntries = Object.entries(theme.breakpoints || {}).map(([point, size], idx) => [point, size, idx]);
7
7
  for (const [point, size, idx] of variantEntries) {
8
8
  if (!regexCache[point])
@@ -44,25 +44,41 @@ const variantCombinators = [
44
44
  variantMatcher("svg", (input) => `${input} svg *`)
45
45
  ];
46
46
 
47
- const variantColorsClass = [
48
- variantMatcher("dark", (input) => `.dark $$ ${input}`),
49
- variantMatcher("light", (input) => `.light $$ ${input}`)
50
- ];
51
- const variantColorsMedia = [
52
- (v) => {
53
- const dark = variantMatcher("dark")(v);
54
- if (dark) {
55
- return {
56
- ...dark,
57
- parent: "@media (prefers-color-scheme: dark)"
58
- };
47
+ const variantColorsMediaOrClass = [
48
+ (v, { options: { dark } }) => {
49
+ if (dark === "class") {
50
+ const match = variantMatcher("dark", (input) => `.dark $$ ${input}`)(v);
51
+ if (match)
52
+ return match;
59
53
  }
60
- const light = variantMatcher("light")(v);
61
- if (light) {
62
- return {
63
- ...light,
64
- parent: "@media (prefers-color-scheme: light)"
65
- };
54
+ },
55
+ (v, { options: { dark } }) => {
56
+ if (dark === "class") {
57
+ const match = variantMatcher("light", (input) => `.light $$ ${input}`)(v);
58
+ if (match)
59
+ return match;
60
+ }
61
+ },
62
+ (v, { options: { dark } }) => {
63
+ if (dark === "media") {
64
+ const match = variantMatcher("dark")(v);
65
+ if (match) {
66
+ return {
67
+ ...match,
68
+ parent: "@media (prefers-color-scheme: dark)"
69
+ };
70
+ }
71
+ }
72
+ },
73
+ (v, { options: { dark } }) => {
74
+ if (dark === "media") {
75
+ const match = variantMatcher("light")(v);
76
+ if (match) {
77
+ return {
78
+ ...match,
79
+ parent: "@media (prefers-color-scheme: light)"
80
+ };
81
+ }
66
82
  }
67
83
  }
68
84
  ];
@@ -111,7 +127,7 @@ const variantSpace = (matcher) => {
111
127
  }
112
128
  };
113
129
 
114
- const variants = (options) => [
130
+ const variants = [
115
131
  variantSpace,
116
132
  variantNegative,
117
133
  variantImportant,
@@ -119,10 +135,10 @@ const variants = (options) => [
119
135
  ...variantCombinators,
120
136
  variantPseudoClasses,
121
137
  variantPseudoClassFunctions,
122
- variantTaggedPseudoClasses(options),
138
+ variantTaggedPseudoClasses,
123
139
  variantPseudoElements,
124
140
  partClasses,
125
- ...options.dark === "media" ? variantColorsMedia : variantColorsClass
141
+ ...variantColorsMediaOrClass
126
142
  ];
127
143
 
128
- export { variantBreakpoints as a, variantCombinators as b, variantColorsClass as c, variantColorsMedia as d, variantImportant as e, variantNegative as f, variantSpace as g, variants as v };
144
+ export { variantBreakpoints as a, variantCombinators as b, variantColorsMediaOrClass as c, variantImportant as d, variantNegative as e, variantSpace as f, variants as v };
@@ -116,18 +116,17 @@ const variantPseudoClassFunctions = {
116
116
  },
117
117
  multiPass: true
118
118
  };
119
- const variantTaggedPseudoClasses = (options = {}) => ({
120
- match: (input) => {
121
- const attributify = !!options?.attributifyPseudo;
122
- const g = taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " ")(input);
119
+ const variantTaggedPseudoClasses = {
120
+ match: (input, { options: { attributifyPseudo } }) => {
121
+ const g = taggedPseudoClassMatcher("group", attributifyPseudo ? '[group=""]' : ".group", " ")(input);
123
122
  if (g)
124
123
  return g;
125
- const p = taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~")(input);
124
+ const p = taggedPseudoClassMatcher("peer", attributifyPseudo ? '[peer=""]' : ".peer", "~")(input);
126
125
  if (p)
127
126
  return p;
128
127
  },
129
128
  multiPass: true
130
- });
129
+ };
131
130
  const partClasses = {
132
131
  match: (input) => {
133
132
  const match = input.match(PartClassesRE);
@@ -114,18 +114,17 @@ const variantPseudoClassFunctions = {
114
114
  },
115
115
  multiPass: true
116
116
  };
117
- const variantTaggedPseudoClasses = (options = {}) => ({
118
- match: (input) => {
119
- const attributify = !!options?.attributifyPseudo;
120
- const g = taggedPseudoClassMatcher("group", attributify ? '[group=""]' : ".group", " ")(input);
117
+ const variantTaggedPseudoClasses = {
118
+ match: (input, { options: { attributifyPseudo } }) => {
119
+ const g = taggedPseudoClassMatcher("group", attributifyPseudo ? '[group=""]' : ".group", " ")(input);
121
120
  if (g)
122
121
  return g;
123
- const p = taggedPseudoClassMatcher("peer", attributify ? '[peer=""]' : ".peer", "~")(input);
122
+ const p = taggedPseudoClassMatcher("peer", attributifyPseudo ? '[peer=""]' : ".peer", "~")(input);
124
123
  if (p)
125
124
  return p;
126
125
  },
127
126
  multiPass: true
128
- });
127
+ };
129
128
  const partClasses = {
130
129
  match: (input) => {
131
130
  const match = input.match(PartClassesRE);
package/dist/index.cjs CHANGED
@@ -11,13 +11,18 @@ require('@unocss/core');
11
11
  require('./chunks/pseudo.cjs');
12
12
  require('./chunks/variants.cjs');
13
13
 
14
- const presetMini = (options = {}) => ({
15
- name: "@unocss/preset-mini",
16
- theme: _default.theme,
17
- rules: _default$1.rules,
18
- variants: _default$2.variants(options),
19
- options
20
- });
14
+ const presetMini = (options = {}) => {
15
+ options.dark = options.dark ?? "class";
16
+ options.attributifyPseudo = options.attributifyPseudo ?? false;
17
+ options.variablePrefix = options.variablePrefix ?? "un-";
18
+ return {
19
+ name: "@unocss/preset-mini",
20
+ theme: _default.theme,
21
+ rules: _default$1.rules,
22
+ variants: _default$2.variants,
23
+ options
24
+ };
25
+ };
21
26
 
22
27
  exports.theme = _default.theme;
23
28
  exports.colors = colors.colors;
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { Preset } from '@unocss/core';
1
+ import { PresetOptions, Preset } from '@unocss/core';
2
2
  import { T as Theme } from './types-a2d2b52f';
3
3
  export { T as Theme, a as ThemeAnimation } from './types-a2d2b52f';
4
4
  export { t as theme } from './default-958434b6';
5
5
  export { c as colors } from './colors-6d634692';
6
6
 
7
- interface PresetMiniOptions {
7
+ interface PresetMiniOptions extends PresetOptions {
8
8
  /**
9
9
  * @default 'class'
10
10
  */
@@ -13,6 +13,10 @@ interface PresetMiniOptions {
13
13
  * @default false
14
14
  */
15
15
  attributifyPseudo?: Boolean;
16
+ /**
17
+ * @default 'un-'
18
+ */
19
+ variablePrefix?: string;
16
20
  }
17
21
  declare const presetMini: (options?: PresetMiniOptions) => Preset<Theme>;
18
22
 
package/dist/index.mjs CHANGED
@@ -8,12 +8,17 @@ import '@unocss/core';
8
8
  import './chunks/pseudo.mjs';
9
9
  import './chunks/variants.mjs';
10
10
 
11
- const presetMini = (options = {}) => ({
12
- name: "@unocss/preset-mini",
13
- theme,
14
- rules,
15
- variants: variants(options),
16
- options
17
- });
11
+ const presetMini = (options = {}) => {
12
+ options.dark = options.dark ?? "class";
13
+ options.attributifyPseudo = options.attributifyPseudo ?? false;
14
+ options.variablePrefix = options.variablePrefix ?? "un-";
15
+ return {
16
+ name: "@unocss/preset-mini",
17
+ theme,
18
+ rules,
19
+ variants,
20
+ options
21
+ };
22
+ };
18
23
 
19
24
  export { presetMini as default, presetMini };
package/dist/rules.cjs CHANGED
@@ -59,6 +59,7 @@ exports.transforms = _default.transforms;
59
59
  exports.transitions = _default.transitions;
60
60
  exports.userSelects = _default.userSelects;
61
61
  exports.varEmpty = _default.varEmpty;
62
+ exports.varEmptyFn = _default.varEmptyFn;
62
63
  exports.verticalAligns = _default.verticalAligns;
63
64
  exports.whitespaces = _default.whitespaces;
64
65
  exports.willChange = _default.willChange;
package/dist/rules.d.ts CHANGED
@@ -57,6 +57,7 @@ declare const aspectRatio: Rule[];
57
57
  declare const paddings: Rule[];
58
58
  declare const margins: Rule[];
59
59
 
60
+ declare const varEmptyFn: (prefix: string) => `var(--${string}empty,/*!*/ /*!*/)`;
60
61
  declare const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
61
62
  declare const displays: Rule[];
62
63
  declare const appearances: Rule[];
@@ -88,4 +89,4 @@ declare const cssVariables: Rule[];
88
89
 
89
90
  declare const textDecorations: Rule[];
90
91
 
91
- export { alignments, appearance, appearances, aspectRatio, bgColors, borders, boxShadows, boxSizing, breaks, contents, cssVariables, cursors, displays, flex, floats, fontSmoothings, fontStyles, fonts, gaps, grids, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, rings, rules, sizes, svgUtilities, tabSizes, textAligns, textColors, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, willChange, zIndexes };
92
+ export { alignments, appearance, appearances, aspectRatio, bgColors, borders, boxShadows, boxSizing, breaks, contents, cssVariables, cursors, displays, flex, floats, fontSmoothings, fontStyles, fonts, gaps, grids, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, rings, rules, sizes, svgUtilities, tabSizes, textAligns, textColors, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, transforms, transitions, userSelects, varEmpty, varEmptyFn, verticalAligns, whitespaces, willChange, zIndexes };
package/dist/rules.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { l as alignments, a as appearance, G as appearances, B as aspectRatio, e as bgColors, b as borders, y as boxShadows, s as boxSizing, N as breaks, M as contents, _ as cssVariables, H as cursors, F as displays, f as flex, q as floats, R as fontSmoothings, Q as fontStyles, V as fonts, g as gaps, h as grids, n as insets, j as justifies, D as margins, c as opacity, k as orders, o as outline, i as overflows, C as paddings, m as placements, I as pointerEvents, p as positions, u as questionMark, J as resizes, x as rings, r as rules, A as sizes, S as svgUtilities, W as tabSizes, t as textAligns, d as textColors, $ as textDecorations, X as textIndents, O as textOverflows, Z as textShadows, Y as textStrokes, P as textTransforms, T as transforms, U as transitions, K as userSelects, E as varEmpty, v as verticalAligns, L as whitespaces, w as willChange, z as zIndexes } from './chunks/default2.mjs';
1
+ export { l as alignments, a as appearance, H as appearances, B as aspectRatio, e as bgColors, b as borders, y as boxShadows, s as boxSizing, O as breaks, N as contents, $ as cssVariables, I as cursors, G as displays, f as flex, q as floats, S as fontSmoothings, R as fontStyles, W as fonts, g as gaps, h as grids, n as insets, j as justifies, D as margins, c as opacity, k as orders, o as outline, i as overflows, C as paddings, m as placements, J as pointerEvents, p as positions, u as questionMark, K as resizes, x as rings, r as rules, A as sizes, T as svgUtilities, X as tabSizes, t as textAligns, d as textColors, a0 as textDecorations, Y as textIndents, P as textOverflows, _ as textShadows, Z as textStrokes, Q as textTransforms, U as transforms, V as transitions, L as userSelects, F as varEmpty, E as varEmptyFn, v as verticalAligns, M as whitespaces, w as willChange, z as zIndexes } from './chunks/default2.mjs';
2
2
  import './chunks/utilities.mjs';
3
3
  import '@unocss/core';
4
4
  import './chunks/pseudo.mjs';
package/dist/variants.cjs CHANGED
@@ -10,8 +10,7 @@ require('@unocss/core');
10
10
 
11
11
 
12
12
  exports.variantBreakpoints = _default.variantBreakpoints;
13
- exports.variantColorsClass = _default.variantColorsClass;
14
- exports.variantColorsMedia = _default.variantColorsMedia;
13
+ exports.variantColorsMediaOrClass = _default.variantColorsMediaOrClass;
15
14
  exports.variantCombinators = _default.variantCombinators;
16
15
  exports.variantImportant = _default.variantImportant;
17
16
  exports.variantNegative = _default.variantNegative;
@@ -1,17 +1,13 @@
1
1
  import { Variant, VariantFunction, VariantObject } from '@unocss/core';
2
2
  import { T as Theme } from './types-a2d2b52f';
3
- import { PresetMiniOptions } from './index';
4
- import './default-958434b6';
5
- import './colors-6d634692';
6
3
 
7
4
  declare const variantBreakpoints: Variant<Theme>;
8
5
 
9
6
  declare const variantCombinators: Variant[];
10
7
 
11
- declare const variantColorsClass: Variant[];
12
- declare const variantColorsMedia: Variant[];
8
+ declare const variantColorsMediaOrClass: Variant[];
13
9
 
14
- declare const variants: (options: PresetMiniOptions) => Variant<Theme>[];
10
+ declare const variants: Variant<Theme>[];
15
11
 
16
12
  declare const variantImportant: Variant;
17
13
  declare const variantNegative: Variant;
@@ -21,7 +17,7 @@ declare const CONTROL_BYPASS_PSEUDO_CLASS = "$$no-pseudo";
21
17
  declare const variantPseudoElements: VariantFunction;
22
18
  declare const variantPseudoClasses: VariantObject;
23
19
  declare const variantPseudoClassFunctions: VariantObject;
24
- declare const variantTaggedPseudoClasses: (options?: PresetMiniOptions) => VariantObject;
20
+ declare const variantTaggedPseudoClasses: VariantObject;
25
21
  declare const partClasses: VariantObject;
26
22
 
27
- export { CONTROL_BYPASS_PSEUDO_CLASS, partClasses, variantBreakpoints, variantColorsClass, variantColorsMedia, variantCombinators, variantImportant, variantNegative, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements, variantSpace, variantTaggedPseudoClasses, variants };
23
+ export { CONTROL_BYPASS_PSEUDO_CLASS, partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantImportant, variantNegative, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements, variantSpace, variantTaggedPseudoClasses, variants };
package/dist/variants.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { a as variantBreakpoints, c as variantColorsClass, d as variantColorsMedia, b as variantCombinators, e as variantImportant, f as variantNegative, g as variantSpace, v as variants } from './chunks/default3.mjs';
1
+ export { a as variantBreakpoints, c as variantColorsMediaOrClass, b as variantCombinators, d as variantImportant, e as variantNegative, f as variantSpace, v as variants } from './chunks/default3.mjs';
2
2
  export { C as CONTROL_BYPASS_PSEUDO_CLASS, p as partClasses, a as variantPseudoClassFunctions, v as variantPseudoClasses, c as variantPseudoElements, b as variantTaggedPseudoClasses } from './chunks/pseudo.mjs';
3
3
  import './chunks/variants.mjs';
4
4
  import '@unocss/core';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.18.1",
3
+ "version": "0.19.0",
4
4
  "description": "The minimal preset for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -61,7 +61,7 @@
61
61
  "*.css"
62
62
  ],
63
63
  "dependencies": {
64
- "@unocss/core": "0.18.1"
64
+ "@unocss/core": "0.19.0"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",