@unocss/preset-mini 0.43.2 → 0.44.2

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.
@@ -96,6 +96,10 @@ const globalKeywords = [
96
96
  "unset"
97
97
  ];
98
98
 
99
+ const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|cqw|cqh|cqi|cqb|cqmin|cqmax|rpx)?$/i;
100
+ const numberRE = /^(-?[0-9.]+)$/i;
101
+ const unitOnlyRE = /^(px)$/i;
102
+
99
103
  const cssProps = [
100
104
  "color",
101
105
  "border-color",
@@ -149,9 +153,6 @@ const cssProps = [
149
153
  "clip",
150
154
  "border-radius"
151
155
  ];
152
- const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|cqw|cqh|cqi|cqb|cqmin|cqmax|rpx)?$/i;
153
- const numberRE = /^(-?[0-9.]+)$/i;
154
- const unitOnlyRE = /^(px)$/i;
155
156
  function round(n) {
156
157
  return n.toFixed(10).replace(/\.0+$/, "").replace(/(\.\d+?)0+$/, "$1");
157
158
  }
@@ -300,13 +301,32 @@ const handler = core.createValueHandler(valueHandlers);
300
301
  const h = handler;
301
302
 
302
303
  const CONTROL_MINI_NO_NEGATIVE = "$$mini-no-negative";
303
- const directionSize = (propertyPrefix) => ([_, direction, size], { theme }) => {
304
- const v = theme.spacing?.[size || "DEFAULT"] ?? handler.bracket.cssvar.global.auto.fraction.rem(size);
305
- if (v != null)
306
- return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
307
- };
308
- const getThemeColor = (theme, colors) => theme.colors?.[colors.join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase())];
309
- const parseColor$1 = (body, theme) => {
304
+ function directionSize(propertyPrefix) {
305
+ return ([_, direction, size], { theme }) => {
306
+ const v = theme.spacing?.[size || "DEFAULT"] ?? handler.bracket.cssvar.global.auto.fraction.rem(size);
307
+ if (v != null)
308
+ return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
309
+ };
310
+ }
311
+ function getThemeColor(theme, colors) {
312
+ let obj = theme.colors;
313
+ let index = -1;
314
+ for (const c of colors) {
315
+ index += 1;
316
+ if (obj && typeof obj !== "string") {
317
+ const camel = colors.slice(index).join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase());
318
+ if (obj[camel])
319
+ return obj[camel];
320
+ if (obj[c]) {
321
+ obj = obj[c];
322
+ continue;
323
+ }
324
+ }
325
+ return void 0;
326
+ }
327
+ return obj;
328
+ }
329
+ function parseColor$1(body, theme) {
310
330
  const split = body.split(/(?:\/|:)/);
311
331
  let main, opacity;
312
332
  if (split[0] === "[color") {
@@ -336,17 +356,21 @@ const parseColor$1 = (body, theme) => {
336
356
  if (scale.match(/^\d+$/)) {
337
357
  no = scale;
338
358
  colorData = getThemeColor(theme, colors.slice(0, -1));
359
+ if (!colorData || typeof colorData === "string")
360
+ color = void 0;
361
+ else
362
+ color = colorData[no];
339
363
  } else {
340
364
  colorData = getThemeColor(theme, colors);
341
365
  if (!colorData && colors.length <= 2) {
342
366
  [, no = no] = colors;
343
367
  colorData = getThemeColor(theme, [name]);
344
368
  }
369
+ if (typeof colorData === "string")
370
+ color = colorData;
371
+ else if (no && colorData)
372
+ color = colorData[no];
345
373
  }
346
- if (typeof colorData === "string")
347
- color = colorData;
348
- else if (no && colorData)
349
- color = colorData[no];
350
374
  }
351
375
  return {
352
376
  opacity,
@@ -356,30 +380,29 @@ const parseColor$1 = (body, theme) => {
356
380
  cssColor: parseCssColor(color),
357
381
  alpha: handler.bracket.cssvar.percent(opacity ?? "")
358
382
  };
359
- };
360
- const colorResolver = (property, varName) => ([, body], { theme }) => {
361
- const data = parseColor$1(body, theme);
362
- if (!data)
363
- return;
364
- const { alpha, color, cssColor } = data;
365
- if (cssColor) {
366
- if (alpha != null) {
367
- return {
368
- [property]: colorToString(cssColor, alpha)
369
- };
370
- } else {
371
- return {
372
- [`--un-${varName}-opacity`]: colorOpacityToString(cssColor),
373
- [property]: colorToString(cssColor, `var(--un-${varName}-opacity)`)
374
- };
383
+ }
384
+ function colorResolver(property, varName, shouldPass) {
385
+ return ([, body], { theme }) => {
386
+ const data = parseColor$1(body, theme);
387
+ if (!data)
388
+ return;
389
+ const { alpha, color, cssColor } = data;
390
+ const css = {};
391
+ if (cssColor) {
392
+ if (alpha != null) {
393
+ css[property] = colorToString(cssColor, alpha);
394
+ } else {
395
+ css[`--un-${varName}-opacity`] = colorOpacityToString(cssColor);
396
+ css[property] = colorToString(cssColor, `var(--un-${varName}-opacity)`);
397
+ }
398
+ } else if (color) {
399
+ css[property] = colorToString(color, alpha);
375
400
  }
376
- } else if (color) {
377
- return {
378
- [property]: colorToString(color, alpha)
379
- };
380
- }
381
- };
382
- const colorableShadows = (shadows, colorVar) => {
401
+ if (shouldPass?.(css) !== false)
402
+ return css;
403
+ };
404
+ }
405
+ function colorableShadows(shadows, colorVar) {
383
406
  const colored = [];
384
407
  shadows = core.toArray(shadows);
385
408
  for (let i = 0; i < shadows.length; i++) {
@@ -392,29 +415,29 @@ const colorableShadows = (shadows, colorVar) => {
392
415
  colored.push(`${components.join(" ")} var(${colorVar}, ${colorToString(color)})`);
393
416
  }
394
417
  return colored;
395
- };
396
- const hasParseableColor = (color, theme) => {
418
+ }
419
+ function hasParseableColor(color, theme) {
397
420
  return color != null && !!parseColor$1(color, theme)?.color;
398
- };
399
- const resolveBreakpoints = ({ theme, generator }) => {
421
+ }
422
+ function resolveBreakpoints({ theme, generator }) {
400
423
  let breakpoints;
401
424
  if (generator.userConfig && generator.userConfig.theme)
402
425
  breakpoints = generator.userConfig.theme.breakpoints;
403
426
  if (!breakpoints)
404
427
  breakpoints = theme.breakpoints;
405
428
  return breakpoints;
406
- };
407
- const resolveVerticalBreakpoints = ({ theme, generator }) => {
429
+ }
430
+ function resolveVerticalBreakpoints({ theme, generator }) {
408
431
  let verticalBreakpoints;
409
432
  if (generator.userConfig && generator.userConfig.theme)
410
433
  verticalBreakpoints = generator.userConfig.theme.verticalBreakpoints;
411
434
  if (!verticalBreakpoints)
412
435
  verticalBreakpoints = theme.verticalBreakpoints;
413
436
  return verticalBreakpoints;
414
- };
415
- const makeGlobalStaticRules = (prefix, property) => {
437
+ }
438
+ function makeGlobalStaticRules(prefix, property) {
416
439
  return globalKeywords.map((keyword) => [`${prefix}-${keyword}`, { [property ?? prefix]: keyword }]);
417
- };
440
+ }
418
441
  function getComponent(str, open, close, separator) {
419
442
  if (str === "")
420
443
  return;
@@ -661,6 +684,7 @@ exports.hasParseableColor = hasParseableColor;
661
684
  exports.hex2rgba = hex2rgba;
662
685
  exports.insetMap = insetMap;
663
686
  exports.makeGlobalStaticRules = makeGlobalStaticRules;
687
+ exports.numberWithUnitRE = numberWithUnitRE;
664
688
  exports.parseColor = parseColor$1;
665
689
  exports.parseCssColor = parseCssColor;
666
690
  exports.positionMap = positionMap;
@@ -94,6 +94,10 @@ const globalKeywords = [
94
94
  "unset"
95
95
  ];
96
96
 
97
+ const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|cqw|cqh|cqi|cqb|cqmin|cqmax|rpx)?$/i;
98
+ const numberRE = /^(-?[0-9.]+)$/i;
99
+ const unitOnlyRE = /^(px)$/i;
100
+
97
101
  const cssProps = [
98
102
  "color",
99
103
  "border-color",
@@ -147,9 +151,6 @@ const cssProps = [
147
151
  "clip",
148
152
  "border-radius"
149
153
  ];
150
- const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|cqw|cqh|cqi|cqb|cqmin|cqmax|rpx)?$/i;
151
- const numberRE = /^(-?[0-9.]+)$/i;
152
- const unitOnlyRE = /^(px)$/i;
153
154
  function round(n) {
154
155
  return n.toFixed(10).replace(/\.0+$/, "").replace(/(\.\d+?)0+$/, "$1");
155
156
  }
@@ -298,13 +299,32 @@ const handler = createValueHandler(valueHandlers);
298
299
  const h = handler;
299
300
 
300
301
  const CONTROL_MINI_NO_NEGATIVE = "$$mini-no-negative";
301
- const directionSize = (propertyPrefix) => ([_, direction, size], { theme }) => {
302
- const v = theme.spacing?.[size || "DEFAULT"] ?? handler.bracket.cssvar.global.auto.fraction.rem(size);
303
- if (v != null)
304
- return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
305
- };
306
- const getThemeColor = (theme, colors) => theme.colors?.[colors.join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase())];
307
- const parseColor$1 = (body, theme) => {
302
+ function directionSize(propertyPrefix) {
303
+ return ([_, direction, size], { theme }) => {
304
+ const v = theme.spacing?.[size || "DEFAULT"] ?? handler.bracket.cssvar.global.auto.fraction.rem(size);
305
+ if (v != null)
306
+ return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
307
+ };
308
+ }
309
+ function getThemeColor(theme, colors) {
310
+ let obj = theme.colors;
311
+ let index = -1;
312
+ for (const c of colors) {
313
+ index += 1;
314
+ if (obj && typeof obj !== "string") {
315
+ const camel = colors.slice(index).join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase());
316
+ if (obj[camel])
317
+ return obj[camel];
318
+ if (obj[c]) {
319
+ obj = obj[c];
320
+ continue;
321
+ }
322
+ }
323
+ return void 0;
324
+ }
325
+ return obj;
326
+ }
327
+ function parseColor$1(body, theme) {
308
328
  const split = body.split(/(?:\/|:)/);
309
329
  let main, opacity;
310
330
  if (split[0] === "[color") {
@@ -334,17 +354,21 @@ const parseColor$1 = (body, theme) => {
334
354
  if (scale.match(/^\d+$/)) {
335
355
  no = scale;
336
356
  colorData = getThemeColor(theme, colors.slice(0, -1));
357
+ if (!colorData || typeof colorData === "string")
358
+ color = void 0;
359
+ else
360
+ color = colorData[no];
337
361
  } else {
338
362
  colorData = getThemeColor(theme, colors);
339
363
  if (!colorData && colors.length <= 2) {
340
364
  [, no = no] = colors;
341
365
  colorData = getThemeColor(theme, [name]);
342
366
  }
367
+ if (typeof colorData === "string")
368
+ color = colorData;
369
+ else if (no && colorData)
370
+ color = colorData[no];
343
371
  }
344
- if (typeof colorData === "string")
345
- color = colorData;
346
- else if (no && colorData)
347
- color = colorData[no];
348
372
  }
349
373
  return {
350
374
  opacity,
@@ -354,30 +378,29 @@ const parseColor$1 = (body, theme) => {
354
378
  cssColor: parseCssColor(color),
355
379
  alpha: handler.bracket.cssvar.percent(opacity ?? "")
356
380
  };
357
- };
358
- const colorResolver = (property, varName) => ([, body], { theme }) => {
359
- const data = parseColor$1(body, theme);
360
- if (!data)
361
- return;
362
- const { alpha, color, cssColor } = data;
363
- if (cssColor) {
364
- if (alpha != null) {
365
- return {
366
- [property]: colorToString(cssColor, alpha)
367
- };
368
- } else {
369
- return {
370
- [`--un-${varName}-opacity`]: colorOpacityToString(cssColor),
371
- [property]: colorToString(cssColor, `var(--un-${varName}-opacity)`)
372
- };
381
+ }
382
+ function colorResolver(property, varName, shouldPass) {
383
+ return ([, body], { theme }) => {
384
+ const data = parseColor$1(body, theme);
385
+ if (!data)
386
+ return;
387
+ const { alpha, color, cssColor } = data;
388
+ const css = {};
389
+ if (cssColor) {
390
+ if (alpha != null) {
391
+ css[property] = colorToString(cssColor, alpha);
392
+ } else {
393
+ css[`--un-${varName}-opacity`] = colorOpacityToString(cssColor);
394
+ css[property] = colorToString(cssColor, `var(--un-${varName}-opacity)`);
395
+ }
396
+ } else if (color) {
397
+ css[property] = colorToString(color, alpha);
373
398
  }
374
- } else if (color) {
375
- return {
376
- [property]: colorToString(color, alpha)
377
- };
378
- }
379
- };
380
- const colorableShadows = (shadows, colorVar) => {
399
+ if (shouldPass?.(css) !== false)
400
+ return css;
401
+ };
402
+ }
403
+ function colorableShadows(shadows, colorVar) {
381
404
  const colored = [];
382
405
  shadows = toArray(shadows);
383
406
  for (let i = 0; i < shadows.length; i++) {
@@ -390,29 +413,29 @@ const colorableShadows = (shadows, colorVar) => {
390
413
  colored.push(`${components.join(" ")} var(${colorVar}, ${colorToString(color)})`);
391
414
  }
392
415
  return colored;
393
- };
394
- const hasParseableColor = (color, theme) => {
416
+ }
417
+ function hasParseableColor(color, theme) {
395
418
  return color != null && !!parseColor$1(color, theme)?.color;
396
- };
397
- const resolveBreakpoints = ({ theme, generator }) => {
419
+ }
420
+ function resolveBreakpoints({ theme, generator }) {
398
421
  let breakpoints;
399
422
  if (generator.userConfig && generator.userConfig.theme)
400
423
  breakpoints = generator.userConfig.theme.breakpoints;
401
424
  if (!breakpoints)
402
425
  breakpoints = theme.breakpoints;
403
426
  return breakpoints;
404
- };
405
- const resolveVerticalBreakpoints = ({ theme, generator }) => {
427
+ }
428
+ function resolveVerticalBreakpoints({ theme, generator }) {
406
429
  let verticalBreakpoints;
407
430
  if (generator.userConfig && generator.userConfig.theme)
408
431
  verticalBreakpoints = generator.userConfig.theme.verticalBreakpoints;
409
432
  if (!verticalBreakpoints)
410
433
  verticalBreakpoints = theme.verticalBreakpoints;
411
434
  return verticalBreakpoints;
412
- };
413
- const makeGlobalStaticRules = (prefix, property) => {
435
+ }
436
+ function makeGlobalStaticRules(prefix, property) {
414
437
  return globalKeywords.map((keyword) => [`${prefix}-${keyword}`, { [property ?? prefix]: keyword }]);
415
- };
438
+ }
416
439
  function getComponent(str, open, close, separator) {
417
440
  if (str === "")
418
441
  return;
@@ -642,4 +665,4 @@ function parseCssSpaceColorValues(componentString) {
642
665
  };
643
666
  }
644
667
 
645
- export { CONTROL_MINI_NO_NEGATIVE as C, hasParseableColor as a, colorToString as b, colorResolver as c, directionMap as d, colorOpacityToString as e, cornerMap as f, globalKeywords as g, handler as h, colorableShadows as i, insetMap as j, resolveBreakpoints as k, directionSize as l, makeGlobalStaticRules as m, getComponent as n, positionMap as o, parseColor$1 as p, hex2rgba as q, resolveVerticalBreakpoints as r, parseCssColor as s, h as t, getComponents as u, valueHandlers as v, xyzMap as x };
668
+ export { CONTROL_MINI_NO_NEGATIVE as C, hasParseableColor as a, colorToString as b, colorResolver as c, directionMap as d, colorOpacityToString as e, cornerMap as f, globalKeywords as g, handler as h, colorableShadows as i, insetMap as j, resolveBreakpoints as k, directionSize as l, makeGlobalStaticRules as m, numberWithUnitRE as n, getComponent as o, parseColor$1 as p, positionMap as q, resolveVerticalBreakpoints as r, hex2rgba as s, parseCssColor as t, h as u, valueHandlers as v, getComponents as w, xyzMap as x };
@@ -148,7 +148,8 @@ const opacity = [
148
148
  [/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: colors.handler.bracket.percent.cssvar(d) })]
149
149
  ];
150
150
  const textColors = [
151
- [/^(?:text|color|c)-(.+)$/, colors.colorResolver("color", "text"), { autocomplete: "(text|color|c)-$colors" }],
151
+ [/^(?:color|c)-(.+)$/, colors.colorResolver("color", "text"), { autocomplete: "(text|color|c)-$colors" }],
152
+ [/^text-(.+)$/, colors.colorResolver("color", "text", (css) => !css.color?.toString().match(colors.numberWithUnitRE)), { autocomplete: "(text|color|c)-$colors" }],
152
153
  [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": colors.handler.bracket.percent(opacity2) }), { autocomplete: "(text|color|c)-(op|opacity)-<percent>" }]
153
154
  ];
154
155
  const bgColors = [
@@ -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 './colors2.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, n as numberWithUnitRE, 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
 
@@ -146,7 +146,8 @@ const opacity = [
146
146
  [/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: handler.bracket.percent.cssvar(d) })]
147
147
  ];
148
148
  const textColors = [
149
- [/^(?:text|color|c)-(.+)$/, colorResolver("color", "text"), { autocomplete: "(text|color|c)-$colors" }],
149
+ [/^(?:color|c)-(.+)$/, colorResolver("color", "text"), { autocomplete: "(text|color|c)-$colors" }],
150
+ [/^text-(.+)$/, colorResolver("color", "text", (css) => !css.color?.toString().match(numberWithUnitRE)), { autocomplete: "(text|color|c)-$colors" }],
150
151
  [/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent(opacity2) }), { autocomplete: "(text|color|c)-(op|opacity)-<percent>" }]
151
152
  ];
152
153
  const bgColors = [
@@ -112,10 +112,11 @@ const variantCustomMedia = {
112
112
  };
113
113
 
114
114
  const variantColorsMediaOrClass = (options = {}) => {
115
- if (options?.dark === "class") {
115
+ if (options?.dark === "class" || typeof options.dark === "object") {
116
+ const { dark = ".dark", light = ".light" } = typeof options.dark === "string" ? {} : options.dark;
116
117
  return [
117
- variants$1.variantMatcher("dark", (input) => ({ prefix: `.dark $$ ${input.prefix}` })),
118
- variants$1.variantMatcher("light", (input) => ({ prefix: `.light $$ ${input.prefix}` }))
118
+ variants$1.variantMatcher("dark", (input) => ({ prefix: `${dark} $$ ${input.prefix}` })),
119
+ variants$1.variantMatcher("light", (input) => ({ prefix: `${light} $$ ${input.prefix}` }))
119
120
  ];
120
121
  }
121
122
  return [
@@ -1,4 +1,4 @@
1
- import { k as resolveBreakpoints, n as getComponent, h as handler, C as CONTROL_MINI_NO_NEGATIVE } from './colors2.mjs';
1
+ import { k as resolveBreakpoints, o 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
 
@@ -110,10 +110,11 @@ const variantCustomMedia = {
110
110
  };
111
111
 
112
112
  const variantColorsMediaOrClass = (options = {}) => {
113
- if (options?.dark === "class") {
113
+ if (options?.dark === "class" || typeof options.dark === "object") {
114
+ const { dark = ".dark", light = ".light" } = typeof options.dark === "string" ? {} : options.dark;
114
115
  return [
115
- variantMatcher("dark", (input) => ({ prefix: `.dark $$ ${input.prefix}` })),
116
- variantMatcher("light", (input) => ({ prefix: `.light $$ ${input.prefix}` }))
116
+ variantMatcher("dark", (input) => ({ prefix: `${dark} $$ ${input.prefix}` })),
117
+ variantMatcher("light", (input) => ({ prefix: `${light} $$ ${input.prefix}` }))
117
118
  ];
118
119
  }
119
120
  return [
@@ -1,4 +1,4 @@
1
- import { h as handler, m as makeGlobalStaticRules, g as globalKeywords, c as colorResolver, i as colorableShadows, o as positionMap, x as xyzMap } from './colors2.mjs';
1
+ import { h as handler, m as makeGlobalStaticRules, g as globalKeywords, c as colorResolver, i as colorableShadows, q as positionMap, x as xyzMap } from './colors2.mjs';
2
2
 
3
3
  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"];
4
4
  const varEmpty = " ";
package/dist/index.d.ts CHANGED
@@ -3,20 +3,40 @@ import { T as Theme } from './types-9e30040a.js';
3
3
  export { T as Theme, a as ThemeAnimation } from './types-9e30040a.js';
4
4
  export { t as theme } from './default-0fe8c7f8.js';
5
5
  export { c as colors } from './colors-f2b5968c.js';
6
- export { p as parseColor } from './utilities-b44b330d.js';
6
+ export { p as parseColor } from './utilities-00da4436.js';
7
7
 
8
8
  declare const preflights: Preflight[];
9
9
 
10
+ interface DarkModeSelectors {
11
+ /**
12
+ * Selector for light variant.
13
+ *
14
+ * @default '.light'
15
+ */
16
+ light?: string;
17
+ /**
18
+ * Selector for dark variant.
19
+ *
20
+ * @default '.dark'
21
+ */
22
+ dark?: string;
23
+ }
10
24
  interface PresetMiniOptions extends PresetOptions {
11
25
  /**
26
+ * Dark mode options
27
+ *
12
28
  * @default 'class'
13
29
  */
14
- dark?: 'class' | 'media';
30
+ dark?: 'class' | 'media' | DarkModeSelectors;
15
31
  /**
32
+ * Generate pesudo selector as `[group=""]` instead of `.group`
33
+ *
16
34
  * @default false
17
35
  */
18
36
  attributifyPseudo?: Boolean;
19
37
  /**
38
+ * Prefix for CSS variables.
39
+ *
20
40
  * @default 'un-'
21
41
  */
22
42
  variablePrefix?: string;
@@ -29,4 +49,4 @@ interface PresetMiniOptions extends PresetOptions {
29
49
  }
30
50
  declare const presetMini: (options?: PresetMiniOptions) => Preset<Theme>;
31
51
 
32
- export { PresetMiniOptions, presetMini as default, preflights, presetMini };
52
+ export { DarkModeSelectors, PresetMiniOptions, presetMini as default, preflights, presetMini };
@@ -1,4 +1,4 @@
1
- import { RuleContext, CSSEntries, ParsedColorValue, CSSObject, VariantContext, Rule } from '@unocss/core';
1
+ import { DynamicMatcher, ParsedColorValue, CSSObject, VariantContext, Rule } from '@unocss/core';
2
2
  import { T as Theme } from './types-9e30040a.js';
3
3
 
4
4
  declare const CONTROL_MINI_NO_NEGATIVE = "$$mini-no-negative";
@@ -6,10 +6,9 @@ declare const CONTROL_MINI_NO_NEGATIVE = "$$mini-no-negative";
6
6
  * Provide {@link DynamicMatcher} function returning spacing definition. See spacing rules.
7
7
  *
8
8
  * @param {string} propertyPrefix - Property for the css value to be created. Postfix will be appended according to direction matched.
9
- * @return {@link DynamicMatcher} object.
10
9
  * @see {@link directionMap}
11
10
  */
12
- declare const directionSize: (propertyPrefix: string) => ([_, direction, size]: string[], { theme }: RuleContext<Theme>) => CSSEntries | undefined;
11
+ declare function directionSize(propertyPrefix: string): DynamicMatcher;
13
12
  /**
14
13
  * Parse color string into {@link ParsedColorValue} (if possible). Color value will first be matched to theme object before parsing.
15
14
  * See also color.tests.ts for more examples.
@@ -24,7 +23,7 @@ declare const directionSize: (propertyPrefix: string) => ([_, direction, size]:
24
23
  * @param {Theme} theme - {@link Theme} object.
25
24
  * @return {ParsedColorValue|undefined} {@link ParsedColorValue} object if string is parseable.
26
25
  */
27
- declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | undefined;
26
+ declare function parseColor(body: string, theme: Theme): ParsedColorValue | undefined;
28
27
  /**
29
28
  * Provide {@link DynamicMatcher} function to produce color value matched from rule.
30
29
  *
@@ -50,12 +49,12 @@ declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | und
50
49
  * @param {string} varName - Base name for the opacity variable.
51
50
  * @return {@link DynamicMatcher} object.
52
51
  */
53
- declare const colorResolver: (property: string, varName: string) => ([, body]: string[], { theme }: RuleContext<Theme>) => CSSObject | undefined;
54
- declare const colorableShadows: (shadows: string | string[], colorVar: string) => string[];
55
- declare const hasParseableColor: (color: string | undefined, theme: Theme) => boolean;
56
- declare const resolveBreakpoints: ({ theme, generator }: Readonly<VariantContext<Theme>>) => Record<string, string> | undefined;
57
- declare const resolveVerticalBreakpoints: ({ theme, generator }: Readonly<VariantContext<Theme>>) => Record<string, string> | undefined;
58
- declare const makeGlobalStaticRules: (prefix: string, property?: string) => Rule<{}>[];
52
+ declare function colorResolver(property: string, varName: string, shouldPass?: (css: CSSObject) => boolean): DynamicMatcher;
53
+ declare function colorableShadows(shadows: string | string[], colorVar: string): string[];
54
+ declare function hasParseableColor(color: string | undefined, theme: Theme): boolean;
55
+ declare function resolveBreakpoints({ theme, generator }: Readonly<VariantContext<Theme>>): Record<string, string> | undefined;
56
+ declare function resolveVerticalBreakpoints({ theme, generator }: Readonly<VariantContext<Theme>>): Record<string, string> | undefined;
57
+ declare function makeGlobalStaticRules(prefix: string, property?: string): Rule<{}>[];
59
58
  declare function getComponent(str: string, open: string, close: string, separator: string): string[] | undefined;
60
59
  declare function getComponents(str: string, separator: string, limit?: number): string[] | undefined;
61
60
 
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
2
  import { RGBAColorValue, CSSColorValue, VariantHandlerContext, VariantObject } from '@unocss/core';
3
- export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, a as colorableShadows, d as directionSize, g as getComponent, e as getComponents, h as hasParseableColor, m as makeGlobalStaticRules, p as parseColor, r as resolveBreakpoints, b as resolveVerticalBreakpoints } from './utilities-b44b330d.js';
3
+ export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, a as colorableShadows, d as directionSize, g as getComponent, e as getComponents, h as hasParseableColor, m as makeGlobalStaticRules, p as parseColor, r as resolveBreakpoints, b as resolveVerticalBreakpoints } from './utilities-00da4436.js';
4
4
  import './types-9e30040a.js';
5
5
 
6
6
  declare function hex2rgba(hex?: string): RGBAColorValue | undefined;
package/dist/utils.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { C as CONTROL_MINI_NO_NEGATIVE, e as colorOpacityToString, c as colorResolver, b as colorToString, i as colorableShadows, f as cornerMap, d as directionMap, l as directionSize, n as getComponent, u as getComponents, g as globalKeywords, t as h, h as handler, a as hasParseableColor, q as hex2rgba, j as insetMap, m as makeGlobalStaticRules, p as parseColor, s as parseCssColor, o as positionMap, k as resolveBreakpoints, r as resolveVerticalBreakpoints, v as valueHandlers, x as xyzMap } from './chunks/colors2.mjs';
1
+ export { C as CONTROL_MINI_NO_NEGATIVE, e as colorOpacityToString, c as colorResolver, b as colorToString, i as colorableShadows, f as cornerMap, d as directionMap, l as directionSize, o as getComponent, w as getComponents, g as globalKeywords, u as h, h as handler, a as hasParseableColor, s as hex2rgba, j as insetMap, m as makeGlobalStaticRules, p as parseColor, t as parseCssColor, q as positionMap, k as resolveBreakpoints, r as resolveVerticalBreakpoints, v as valueHandlers, x as xyzMap } from './chunks/colors2.mjs';
2
2
  export { a as variantMatcher, v as variantParentMatcher } from './chunks/variants.mjs';
3
3
  import '@unocss/core';
@@ -3,7 +3,7 @@ import { T as Theme } from './types-9e30040a.js';
3
3
  import { PresetMiniOptions } from './index.js';
4
4
  import './default-0fe8c7f8.js';
5
5
  import './colors-f2b5968c.js';
6
- import './utilities-b44b330d.js';
6
+ import './utilities-00da4436.js';
7
7
 
8
8
  declare const variantBreakpoints: Variant<Theme>;
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.43.2",
3
+ "version": "0.44.2",
4
4
  "description": "The minimal preset for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "*.css"
62
62
  ],
63
63
  "dependencies": {
64
- "@unocss/core": "0.43.2"
64
+ "@unocss/core": "0.44.2"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",