@unocss/preset-mini 0.43.0 → 0.44.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.
package/README.md CHANGED
@@ -82,6 +82,54 @@ will generate:
82
82
  }
83
83
  ```
84
84
 
85
+ ### Theme
86
+ You can fully customize your theme property in your config, and UnoCSS will eventually deeply merge it to the default theme.
87
+
88
+ <!--eslint-skip-->
89
+
90
+ ```ts
91
+ presetMini({
92
+ theme: {
93
+ // ...
94
+ colors: {
95
+ 'veryCool': '#0000ff', // class="text-very-cool"
96
+ 'brand': {
97
+ 'primary': 'hsla(var(--hue, 217), 78%, 51%)', //class="bg-brand-primary"
98
+ }
99
+ },
100
+ }
101
+ })
102
+ ```
103
+
104
+ To consume the theme in rules:
105
+
106
+ ```ts
107
+ rules: [
108
+ [/^text-(.*)$/, ([, c], { theme }) => {
109
+ if (theme.colors[c])
110
+ return { color: theme.colors[c] }
111
+ }],
112
+ ]
113
+ ```
114
+
115
+ One exception is that UnoCSS gives full control of `breakpoints` to users. When a custom `breakpoints` is provided, the default will be overridden instead of merging. For example:
116
+
117
+ ```ts
118
+ presetMini({
119
+ theme: {
120
+ // ...
121
+ breakpoints: {
122
+ sm: '320px',
123
+ md: '640px',
124
+ },
125
+ },
126
+ })
127
+ ```
128
+
129
+ Right now, you can only use the `sm:` and `md:` breakpoint variants.
130
+
131
+ `verticalBreakpoints` is same as `breakpoints` but for vertical layout.
132
+
85
133
  ## License
86
134
 
87
135
  MIT License &copy; 2021-PRESENT [Anthony Fu](https://github.com/antfu)
@@ -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 = [
@@ -747,6 +748,7 @@ exports.floats = floats;
747
748
  exports.fonts = fonts;
748
749
  exports.gaps = gaps;
749
750
  exports.grids = grids;
751
+ exports.handlerBorderStyle = handlerBorderStyle;
750
752
  exports.insets = insets;
751
753
  exports.justifies = justifies;
752
754
  exports.margins = margins;
@@ -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 = [
@@ -731,4 +732,4 @@ const rules = [
731
732
  questionMark
732
733
  ].flat(1);
733
734
 
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 };
735
+ export { sizes as A, aspectRatio as B, paddings as C, margins as D, svgUtilities as E, transitions as F, fonts as G, tabSizes as H, textIndents as I, textStrokes as J, textShadows as K, cssVariables as L, cssProperty as M, textDecorations as N, appearance as a, borderStyles as b, borders as c, opacity as d, textColors as e, bgColors as f, flex as g, handlerBorderStyle as h, gaps as i, grids as j, overflows as k, justifies as l, orders as m, alignments as n, outline as o, positions as p, placements as q, rules as r, insets as s, textAligns as t, floats as u, verticalAligns as v, willChange as w, boxSizing as x, questionMark as y, zIndexes as z };
@@ -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
 
@@ -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,7 +3,7 @@ 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
 
package/dist/rules.cjs CHANGED
@@ -23,6 +23,7 @@ exports.floats = _default.floats;
23
23
  exports.fonts = _default.fonts;
24
24
  exports.gaps = _default.gaps;
25
25
  exports.grids = _default.grids;
26
+ exports.handlerBorderStyle = _default.handlerBorderStyle;
26
27
  exports.insets = _default.insets;
27
28
  exports.justifies = _default.justifies;
28
29
  exports.margins = _default.margins;
package/dist/rules.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Rule } from '@unocss/core';
1
+ import { Rule, CSSEntries } from '@unocss/core';
2
2
  import { T as Theme } from './types-9e30040a.js';
3
3
 
4
4
  declare const verticalAligns: Rule[];
@@ -10,6 +10,7 @@ declare const willChange: Rule[];
10
10
 
11
11
  declare const borderStyles: string[];
12
12
  declare const borders: Rule[];
13
+ declare function handlerBorderStyle([, a, s]: string[]): CSSEntries | undefined;
13
14
 
14
15
  /**
15
16
  * @example op10 op-30 opacity-100
@@ -118,4 +119,4 @@ declare const cssProperty: Rule[];
118
119
 
119
120
  declare const textDecorations: Rule<Theme>[];
120
121
 
121
- export { alignments, appearance, appearances, aspectRatio, bgColors, borderStyles, borders, boxShadows, boxShadowsBase, boxSizing, breaks, contents, cssProperty, cssVariables, cursors, displays, flex, floats, fontSmoothings, fontStyles, fonts, gaps, grids, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, ringBase, rings, rules, sizes, svgUtilities, tabSizes, textAligns, textColors, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, transformBase, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, willChange, zIndexes };
122
+ export { alignments, appearance, appearances, aspectRatio, bgColors, borderStyles, borders, boxShadows, boxShadowsBase, boxSizing, breaks, contents, cssProperty, cssVariables, cursors, displays, flex, floats, fontSmoothings, fontStyles, fonts, gaps, grids, handlerBorderStyle, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, ringBase, rings, rules, sizes, svgUtilities, tabSizes, textAligns, textColors, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, transformBase, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, willChange, zIndexes };
package/dist/rules.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { m as alignments, a as appearance, A as aspectRatio, f as bgColors, b as borderStyles, c as borders, u as boxSizing, L as cssProperty, K as cssVariables, g as flex, s as floats, F as fonts, h as gaps, i as grids, q as insets, k as justifies, C as margins, d as opacity, l as orders, o as outline, j as overflows, B as paddings, n as placements, p as positions, x as questionMark, r as rules, y as sizes, D as svgUtilities, G as tabSizes, t as textAligns, e as textColors, M as textDecorations, H as textIndents, J as textShadows, I as textStrokes, E as transitions, v as verticalAligns, w as willChange, z as zIndexes } from './chunks/default2.mjs';
1
+ export { n as alignments, a as appearance, B as aspectRatio, f as bgColors, b as borderStyles, c as borders, x as boxSizing, M as cssProperty, L as cssVariables, g as flex, u as floats, G as fonts, i as gaps, j as grids, h as handlerBorderStyle, s as insets, l as justifies, D as margins, d as opacity, m as orders, o as outline, k as overflows, C as paddings, q as placements, p as positions, y as questionMark, r as rules, A as sizes, E as svgUtilities, H as tabSizes, t as textAligns, e as textColors, N as textDecorations, I as textIndents, K as textShadows, J as textStrokes, F as transitions, v as verticalAligns, w as willChange, z as zIndexes } from './chunks/default2.mjs';
2
2
  export { k as appearances, h as boxShadows, b as boxShadowsBase, m as breaks, c as contents, j as cursors, d as displays, g as fontSmoothings, f as fontStyles, p as pointerEvents, l as resizes, r as ringBase, i as rings, a as textOverflows, e as textTransforms, t as transformBase, n as transforms, u as userSelects, v as varEmpty, w as whitespaces } from './chunks/transform.mjs';
3
3
  import './chunks/colors2.mjs';
4
4
  import '@unocss/core';
@@ -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.0",
3
+ "version": "0.44.0",
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.0"
64
+ "@unocss/core": "0.44.0"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",