@unocss/preset-mini 0.30.6 → 0.30.10

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.
@@ -228,8 +228,8 @@ const weightMap = {
228
228
  };
229
229
  const fonts = [
230
230
  [
231
- /^font-(\w+)$/,
232
- ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] || utilities.handler.global(d) }),
231
+ /^font-(.+)$/,
232
+ ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] || utilities.handler.bracket.cssvar.global(d) }),
233
233
  { autocomplete: "font-$fontFamily" }
234
234
  ],
235
235
  [
@@ -668,8 +668,8 @@ const sizes = [
668
668
  ]
669
669
  }
670
670
  ],
671
- [/^(min-|max-)?(h)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.verticalBreakpoints?.[s] }), { autocomplete: ["h-screen-$verticalBreakpoints", "(min|max)-h-screen-$verticalBreakpoints"] }],
672
- [/^(min-|max-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] }), { autocomplete: ["w-screen-$breakpoints", "(min|max)-w-screen-$breakpoints"] }]
671
+ [/^(min-|max-)?(h)-screen-(.+)$/, ([, m, w, s], context) => ({ [getPropName(m, w)]: utilities.resolveVerticalBreakpoints(context)?.[s] }), { autocomplete: ["h-screen-$verticalBreakpoints", "(min|max)-h-screen-$verticalBreakpoints"] }],
672
+ [/^(min-|max-)?(w)-screen-(.+)$/, ([, m, w, s], context) => ({ [getPropName(m, w)]: utilities.resolveBreakpoints(context)?.[s] }), { autocomplete: ["w-screen-$breakpoints", "(min|max)-w-screen-$breakpoints"] }]
673
673
  ];
674
674
  function getAspectRatio(prop) {
675
675
  if (/^\d+\/\d+$/.test(prop))
@@ -688,17 +688,19 @@ const aspectRatio = [
688
688
 
689
689
  const paddings = [
690
690
  [/^pa?()-?(-?.+)$/, utilities.directionSize("padding"), { autocomplete: ["(m|p)<num>", "(m|p)-<num>"] }],
691
- [/^p-?([xy])-?(-?.+)$/, utilities.directionSize("padding")],
692
- [/^p-?([rltbse])-?(-?.+)$/, utilities.directionSize("padding"), { autocomplete: "(m|p)<directions>-<num>" }],
693
- [/^p-(block|inline)-(-?.+)$/, utilities.directionSize("padding"), { autocomplete: "(m|p)-(block|inline)-<num>" }],
694
- [/^p-?([bi][se])-?(-?.+)$/, utilities.directionSize("padding"), { autocomplete: "(m|p)-(bs|be|is|ie)-<num>" }]
691
+ [/^p-?xy()()$/, utilities.directionSize("padding"), { autocomplete: "(m|p)-(xy)" }],
692
+ [/^p-?([xy])(?:-?(-?.+))?$/, utilities.directionSize("padding")],
693
+ [/^p-?([rltbse])(?:-?(-?.+))?$/, utilities.directionSize("padding"), { autocomplete: "(m|p)<directions>-<num>" }],
694
+ [/^p-(block|inline)(?:-(-?.+))?$/, utilities.directionSize("padding"), { autocomplete: "(m|p)-(block|inline)-<num>" }],
695
+ [/^p-?([bi][se])(?:-?(-?.+))?$/, utilities.directionSize("padding"), { autocomplete: "(m|p)-(bs|be|is|ie)-<num>" }]
695
696
  ];
696
697
  const margins = [
697
698
  [/^ma?()-?(-?.+)$/, utilities.directionSize("margin")],
698
- [/^m-?([xy])-?(-?.+)$/, utilities.directionSize("margin")],
699
- [/^m-?([rltbse])-?(-?.+)$/, utilities.directionSize("margin")],
700
- [/^m-(block|inline)-(-?.+)$/, utilities.directionSize("margin")],
701
- [/^m-?([bi][se])-?(-?.+)$/, utilities.directionSize("margin")]
699
+ [/^m-?xy()()$/, utilities.directionSize("margin")],
700
+ [/^m-?([xy])(?:-?(-?.+))?$/, utilities.directionSize("margin")],
701
+ [/^m-?([rltbse])(?:-?(-?.+))?$/, utilities.directionSize("margin")],
702
+ [/^m-(block|inline)(?:-(-?.+))?$/, utilities.directionSize("margin")],
703
+ [/^m-?([bi][se])(?:-?(-?.+))?$/, utilities.directionSize("margin")]
702
704
  ];
703
705
 
704
706
  const transformGpu = {
@@ -1,4 +1,4 @@
1
- import { h as handler, c as colorResolver, d as directionMap, a as hasParseableColor, p as parseColor, b as colorToString, e as cornerMap, f as colorableShadows, i as insetMap, g as directionSize, j as positionMap, x as xyzMap } from './utilities.mjs';
1
+ import { h as handler, c as colorResolver, d as directionMap, a as hasParseableColor, p as parseColor, b as colorToString, e as cornerMap, f as colorableShadows, i as insetMap, r as resolveVerticalBreakpoints, g as resolveBreakpoints, j as directionSize, k as positionMap, x as xyzMap } from './utilities.mjs';
2
2
  import { toArray, CONTROL_SHORTCUT_NO_MERGE } from '@unocss/core';
3
3
 
4
4
  const verticalAlignAlias = {
@@ -226,8 +226,8 @@ const weightMap = {
226
226
  };
227
227
  const fonts = [
228
228
  [
229
- /^font-(\w+)$/,
230
- ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] || handler.global(d) }),
229
+ /^font-(.+)$/,
230
+ ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] || handler.bracket.cssvar.global(d) }),
231
231
  { autocomplete: "font-$fontFamily" }
232
232
  ],
233
233
  [
@@ -666,8 +666,8 @@ const sizes = [
666
666
  ]
667
667
  }
668
668
  ],
669
- [/^(min-|max-)?(h)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.verticalBreakpoints?.[s] }), { autocomplete: ["h-screen-$verticalBreakpoints", "(min|max)-h-screen-$verticalBreakpoints"] }],
670
- [/^(min-|max-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] }), { autocomplete: ["w-screen-$breakpoints", "(min|max)-w-screen-$breakpoints"] }]
669
+ [/^(min-|max-)?(h)-screen-(.+)$/, ([, m, w, s], context) => ({ [getPropName(m, w)]: resolveVerticalBreakpoints(context)?.[s] }), { autocomplete: ["h-screen-$verticalBreakpoints", "(min|max)-h-screen-$verticalBreakpoints"] }],
670
+ [/^(min-|max-)?(w)-screen-(.+)$/, ([, m, w, s], context) => ({ [getPropName(m, w)]: resolveBreakpoints(context)?.[s] }), { autocomplete: ["w-screen-$breakpoints", "(min|max)-w-screen-$breakpoints"] }]
671
671
  ];
672
672
  function getAspectRatio(prop) {
673
673
  if (/^\d+\/\d+$/.test(prop))
@@ -686,17 +686,19 @@ const aspectRatio = [
686
686
 
687
687
  const paddings = [
688
688
  [/^pa?()-?(-?.+)$/, directionSize("padding"), { autocomplete: ["(m|p)<num>", "(m|p)-<num>"] }],
689
- [/^p-?([xy])-?(-?.+)$/, directionSize("padding")],
690
- [/^p-?([rltbse])-?(-?.+)$/, directionSize("padding"), { autocomplete: "(m|p)<directions>-<num>" }],
691
- [/^p-(block|inline)-(-?.+)$/, directionSize("padding"), { autocomplete: "(m|p)-(block|inline)-<num>" }],
692
- [/^p-?([bi][se])-?(-?.+)$/, directionSize("padding"), { autocomplete: "(m|p)-(bs|be|is|ie)-<num>" }]
689
+ [/^p-?xy()()$/, directionSize("padding"), { autocomplete: "(m|p)-(xy)" }],
690
+ [/^p-?([xy])(?:-?(-?.+))?$/, directionSize("padding")],
691
+ [/^p-?([rltbse])(?:-?(-?.+))?$/, directionSize("padding"), { autocomplete: "(m|p)<directions>-<num>" }],
692
+ [/^p-(block|inline)(?:-(-?.+))?$/, directionSize("padding"), { autocomplete: "(m|p)-(block|inline)-<num>" }],
693
+ [/^p-?([bi][se])(?:-?(-?.+))?$/, directionSize("padding"), { autocomplete: "(m|p)-(bs|be|is|ie)-<num>" }]
693
694
  ];
694
695
  const margins = [
695
696
  [/^ma?()-?(-?.+)$/, directionSize("margin")],
696
- [/^m-?([xy])-?(-?.+)$/, directionSize("margin")],
697
- [/^m-?([rltbse])-?(-?.+)$/, directionSize("margin")],
698
- [/^m-(block|inline)-(-?.+)$/, directionSize("margin")],
699
- [/^m-?([bi][se])-?(-?.+)$/, directionSize("margin")]
697
+ [/^m-?xy()()$/, directionSize("margin")],
698
+ [/^m-?([xy])(?:-?(-?.+))?$/, directionSize("margin")],
699
+ [/^m-?([rltbse])(?:-?(-?.+))?$/, directionSize("margin")],
700
+ [/^m-(block|inline)(?:-(-?.+))?$/, directionSize("margin")],
701
+ [/^m-?([bi][se])(?:-?(-?.+))?$/, directionSize("margin")]
700
702
  ];
701
703
 
702
704
  const transformGpu = {
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ const utilities = require('./utilities.cjs');
3
4
  const variants$1 = require('./variants.cjs');
4
5
  const core = require('@unocss/core');
5
6
 
@@ -11,8 +12,8 @@ const calcMaxWidthBySize = (size) => {
11
12
  return Number.isNaN(maxWidth) ? size : `${maxWidth}${unit}`;
12
13
  };
13
14
  const variantBreakpoints = {
14
- match(matcher, { theme }) {
15
- const variantEntries = Object.entries(theme.breakpoints || {}).map(([point, size], idx) => [point, size, idx]);
15
+ match(matcher, context) {
16
+ const variantEntries = Object.entries(utilities.resolveBreakpoints(context) ?? {}).map(([point, size], idx) => [point, size, idx]);
16
17
  for (const [point, size, idx] of variantEntries) {
17
18
  if (!regexCache[point])
18
19
  regexCache[point] = new RegExp(`^((?:[al]t-)?${point}[:-])`);
@@ -1,3 +1,4 @@
1
+ import { g as resolveBreakpoints } from './utilities.mjs';
1
2
  import { v as variantParentMatcher, a as variantMatcher } from './variants.mjs';
2
3
  import { toArray, escapeRegExp } from '@unocss/core';
3
4
 
@@ -9,8 +10,8 @@ const calcMaxWidthBySize = (size) => {
9
10
  return Number.isNaN(maxWidth) ? size : `${maxWidth}${unit}`;
10
11
  };
11
12
  const variantBreakpoints = {
12
- match(matcher, { theme }) {
13
- const variantEntries = Object.entries(theme.breakpoints || {}).map(([point, size], idx) => [point, size, idx]);
13
+ match(matcher, context) {
14
+ const variantEntries = Object.entries(resolveBreakpoints(context) ?? {}).map(([point, size], idx) => [point, size, idx]);
14
15
  for (const [point, size, idx] of variantEntries) {
15
16
  if (!regexCache[point])
16
17
  regexCache[point] = new RegExp(`^((?:[al]t-)?${point}[:-])`);
@@ -600,6 +600,22 @@ const colorableShadows = (shadows, colorVar) => {
600
600
  const hasParseableColor = (color, theme) => {
601
601
  return color != null && !!parseColor(color, theme)?.color;
602
602
  };
603
+ const resolveBreakpoints = ({ theme, generator }) => {
604
+ let breakpoints;
605
+ if (generator.userConfig && generator.userConfig.theme)
606
+ breakpoints = generator.userConfig.theme.breakpoints;
607
+ if (!breakpoints)
608
+ breakpoints = theme.breakpoints;
609
+ return breakpoints;
610
+ };
611
+ const resolveVerticalBreakpoints = ({ theme, generator }) => {
612
+ let verticalBreakpoints;
613
+ if (generator.userConfig && generator.userConfig.theme)
614
+ verticalBreakpoints = generator.userConfig.theme.verticalBreakpoints;
615
+ if (!verticalBreakpoints)
616
+ verticalBreakpoints = theme.verticalBreakpoints;
617
+ return verticalBreakpoints;
618
+ };
603
619
 
604
620
  exports.colorResolver = colorResolver;
605
621
  exports.colorToString = colorToString;
@@ -616,5 +632,7 @@ exports.insetMap = insetMap;
616
632
  exports.parseColor = parseColor;
617
633
  exports.parseCssColor = parseCssColor;
618
634
  exports.positionMap = positionMap;
635
+ exports.resolveBreakpoints = resolveBreakpoints;
636
+ exports.resolveVerticalBreakpoints = resolveVerticalBreakpoints;
619
637
  exports.valueHandlers = valueHandlers;
620
638
  exports.xyzMap = xyzMap;
@@ -598,5 +598,21 @@ const colorableShadows = (shadows, colorVar) => {
598
598
  const hasParseableColor = (color, theme) => {
599
599
  return color != null && !!parseColor(color, theme)?.color;
600
600
  };
601
+ const resolveBreakpoints = ({ theme, generator }) => {
602
+ let breakpoints;
603
+ if (generator.userConfig && generator.userConfig.theme)
604
+ breakpoints = generator.userConfig.theme.breakpoints;
605
+ if (!breakpoints)
606
+ breakpoints = theme.breakpoints;
607
+ return breakpoints;
608
+ };
609
+ const resolveVerticalBreakpoints = ({ theme, generator }) => {
610
+ let verticalBreakpoints;
611
+ if (generator.userConfig && generator.userConfig.theme)
612
+ verticalBreakpoints = generator.userConfig.theme.verticalBreakpoints;
613
+ if (!verticalBreakpoints)
614
+ verticalBreakpoints = theme.verticalBreakpoints;
615
+ return verticalBreakpoints;
616
+ };
601
617
 
602
- export { hasParseableColor as a, colorToString as b, colorResolver as c, directionMap as d, cornerMap as e, colorableShadows as f, directionSize as g, handler as h, insetMap as i, positionMap as j, hex2rgba as k, parseCssColor as l, getComponents as m, h as n, parseColor as p, valueHandlers as v, xyzMap as x };
618
+ export { hasParseableColor as a, colorToString as b, colorResolver as c, directionMap as d, cornerMap as e, colorableShadows as f, resolveBreakpoints as g, handler as h, insetMap as i, directionSize as j, positionMap as k, hex2rgba as l, parseCssColor as m, getComponents as n, h as o, parseColor as p, resolveVerticalBreakpoints as r, valueHandlers as v, xyzMap as x };
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { T as Theme } from './types-f7b2c653.js';
3
3
  export { T as Theme, a as ThemeAnimation } from './types-f7b2c653.js';
4
4
  export { t as theme } from './default-e6d1b2e8.js';
5
5
  export { c as colors } from './colors-ce2fecb8.js';
6
- export { p as parseColor } from './utilities-820bcff8.js';
6
+ export { p as parseColor } from './utilities-e0ec1790.js';
7
7
 
8
8
  interface PresetMiniOptions extends PresetOptions {
9
9
  /**
@@ -1,4 +1,4 @@
1
- import { RuleContext, CSSEntries, ParsedColorValue, CSSObject } from '@unocss/core';
1
+ import { RuleContext, CSSEntries, ParsedColorValue, CSSObject, VariantContext } from '@unocss/core';
2
2
  import { T as Theme } from './types-f7b2c653.js';
3
3
 
4
4
  /**
@@ -52,5 +52,7 @@ declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | und
52
52
  declare const colorResolver: (property: string, varName: string) => ([, body]: string[], { theme }: RuleContext<Theme>) => CSSObject | undefined;
53
53
  declare const colorableShadows: (shadows: string | string[], colorVar: string) => string[];
54
54
  declare const hasParseableColor: (color: string | undefined, theme: Theme) => boolean;
55
+ declare const resolveBreakpoints: ({ theme, generator }: Readonly<VariantContext<Theme>>) => Record<string, string> | undefined;
56
+ declare const resolveVerticalBreakpoints: ({ theme, generator }: Readonly<VariantContext<Theme>>) => Record<string, string> | undefined;
55
57
 
56
- export { colorableShadows as a, colorResolver as c, directionSize as d, hasParseableColor as h, parseColor as p };
58
+ export { colorableShadows as a, resolveVerticalBreakpoints as b, colorResolver as c, directionSize as d, hasParseableColor as h, parseColor as p, resolveBreakpoints as r };
package/dist/utils.cjs CHANGED
@@ -23,6 +23,8 @@ exports.insetMap = utilities.insetMap;
23
23
  exports.parseColor = utilities.parseColor;
24
24
  exports.parseCssColor = utilities.parseCssColor;
25
25
  exports.positionMap = utilities.positionMap;
26
+ exports.resolveBreakpoints = utilities.resolveBreakpoints;
27
+ exports.resolveVerticalBreakpoints = utilities.resolveVerticalBreakpoints;
26
28
  exports.valueHandlers = utilities.valueHandlers;
27
29
  exports.xyzMap = utilities.xyzMap;
28
30
  exports.variantMatcher = variants.variantMatcher;
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
2
  import { RGBAColorValue, CSSColorValue, VariantObject } from '@unocss/core';
3
- export { c as colorResolver, a as colorableShadows, d as directionSize, h as hasParseableColor, p as parseColor } from './utilities-820bcff8.js';
3
+ export { c as colorResolver, a as colorableShadows, d as directionSize, h as hasParseableColor, p as parseColor, r as resolveBreakpoints, b as resolveVerticalBreakpoints } from './utilities-e0ec1790.js';
4
4
  import './types-f7b2c653.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 colorResolver, b as colorToString, f as colorableShadows, e as cornerMap, d as directionMap, g as directionSize, m as getComponents, n as h, h as handler, a as hasParseableColor, k as hex2rgba, i as insetMap, p as parseColor, l as parseCssColor, j as positionMap, v as valueHandlers, x as xyzMap } from './chunks/utilities.mjs';
1
+ export { c as colorResolver, b as colorToString, f as colorableShadows, e as cornerMap, d as directionMap, j as directionSize, n as getComponents, o as h, h as handler, a as hasParseableColor, l as hex2rgba, i as insetMap, p as parseColor, m as parseCssColor, k as positionMap, g as resolveBreakpoints, r as resolveVerticalBreakpoints, v as valueHandlers, x as xyzMap } from './chunks/utilities.mjs';
2
2
  export { a as variantMatcher, v as variantParentMatcher } from './chunks/variants.mjs';
3
3
  import '@unocss/core';
package/dist/variants.cjs CHANGED
@@ -3,8 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const _default = require('./chunks/default3.cjs');
6
- require('./chunks/variants.cjs');
6
+ require('./chunks/utilities.cjs');
7
7
  require('@unocss/core');
8
+ require('./chunks/variants.cjs');
8
9
 
9
10
 
10
11
 
@@ -3,7 +3,7 @@ import { T as Theme } from './types-f7b2c653.js';
3
3
  import { PresetMiniOptions } from './index.js';
4
4
  import './default-e6d1b2e8.js';
5
5
  import './colors-ce2fecb8.js';
6
- import './utilities-820bcff8.js';
6
+ import './utilities-e0ec1790.js';
7
7
 
8
8
  declare const variantBreakpoints: Variant<Theme>;
9
9
 
package/dist/variants.mjs CHANGED
@@ -1,3 +1,4 @@
1
1
  export { p as partClasses, a as variantBreakpoints, e as variantColorsMediaOrClass, b as variantCombinators, d as variantCustomMedia, j as variantImportant, f as variantLanguageDirections, h as variantLayer, k as variantNegative, c as variantPrint, n as variantPseudoClassFunctions, m as variantPseudoClasses, l as variantPseudoElements, i as variantScope, g as variantSelector, o as variantTaggedPseudoClasses, v as variants } from './chunks/default3.mjs';
2
- import './chunks/variants.mjs';
2
+ import './chunks/utilities.mjs';
3
3
  import '@unocss/core';
4
+ import './chunks/variants.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.30.6",
3
+ "version": "0.30.10",
4
4
  "description": "The minimal preset for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -61,7 +61,7 @@
61
61
  ],
62
62
  "sideEffects": false,
63
63
  "dependencies": {
64
- "@unocss/core": "0.30.6"
64
+ "@unocss/core": "0.30.10"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",