@unocss/preset-mini 0.37.3 → 0.38.1

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.
@@ -92,19 +92,19 @@ const borderColorResolver = (direction) => ([, body], theme) => {
92
92
  }
93
93
  if (direction === "") {
94
94
  return {
95
- "--un-border-opacity": cssColor.alpha ?? 1,
96
- [`border${direction}-color`]: utilities.colorToString(cssColor, `var(--un-border${direction}-opacity)`)
95
+ "--un-border-opacity": utilities.colorOpacityToString(cssColor),
96
+ "border-color": utilities.colorToString(cssColor, "var(--un-border-opacity)")
97
97
  };
98
98
  } else {
99
99
  return {
100
- "--un-border-opacity": cssColor.alpha ?? 1,
100
+ "--un-border-opacity": utilities.colorOpacityToString(cssColor),
101
101
  [`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
102
102
  [`border${direction}-color`]: utilities.colorToString(cssColor, `var(--un-border${direction}-opacity)`)
103
103
  };
104
104
  }
105
105
  } else if (color) {
106
106
  return {
107
- [`border${direction}-color`]: color.replace("%alpha", `${alpha ?? 1}`)
107
+ [`border${direction}-color`]: utilities.colorToString(color, alpha)
108
108
  };
109
109
  }
110
110
  };
@@ -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 cornerMap, f as colorableShadows, i as insetMap, r as resolveVerticalBreakpoints, j as resolveBreakpoints, k as directionSize } from './utilities.mjs';
1
+ import { g as globalKeywords, h as handler, c as colorResolver, d as directionMap, a as hasParseableColor, p as parseColor, b as colorToString, e as colorOpacityToString, f as cornerMap, i as colorableShadows, j as insetMap, r as resolveVerticalBreakpoints, k as resolveBreakpoints, l as directionSize } from './utilities.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
 
@@ -90,19 +90,19 @@ const borderColorResolver = (direction) => ([, body], theme) => {
90
90
  }
91
91
  if (direction === "") {
92
92
  return {
93
- "--un-border-opacity": cssColor.alpha ?? 1,
94
- [`border${direction}-color`]: colorToString(cssColor, `var(--un-border${direction}-opacity)`)
93
+ "--un-border-opacity": colorOpacityToString(cssColor),
94
+ "border-color": colorToString(cssColor, "var(--un-border-opacity)")
95
95
  };
96
96
  } else {
97
97
  return {
98
- "--un-border-opacity": cssColor.alpha ?? 1,
98
+ "--un-border-opacity": colorOpacityToString(cssColor),
99
99
  [`--un-border${direction}-opacity`]: "var(--un-border-opacity)",
100
100
  [`border${direction}-color`]: colorToString(cssColor, `var(--un-border${direction}-opacity)`)
101
101
  };
102
102
  }
103
103
  } else if (color) {
104
104
  return {
105
- [`border${direction}-color`]: color.replace("%alpha", `${alpha ?? 1}`)
105
+ [`border${direction}-color`]: colorToString(color, alpha)
106
106
  };
107
107
  }
108
108
  };
@@ -1,4 +1,4 @@
1
- import { j as resolveBreakpoints, C as CONTROL_MINI_NO_NEGATIVE } from './utilities.mjs';
1
+ import { k as resolveBreakpoints, C as CONTROL_MINI_NO_NEGATIVE } from './utilities.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, c as colorResolver, f as colorableShadows, l as positionMap, x as xyzMap } from './utilities.mjs';
1
+ import { h as handler, c as colorResolver, i as colorableShadows, m as positionMap, x as xyzMap } from './utilities.mjs';
2
2
 
3
3
  const varEmpty = "var(--un-empty,/*!*/ /*!*/)";
4
4
  const displays = [
@@ -120,7 +120,13 @@ function parseCssColor(str = "") {
120
120
  return;
121
121
  return { type, components, alpha };
122
122
  }
123
+ function colorOpacityToString(color) {
124
+ const alpha = color.alpha ?? 1;
125
+ return alpha === "%alpha" ? 1 : alpha;
126
+ }
123
127
  function colorToString(color, alphaOverride) {
128
+ if (typeof color === "string")
129
+ return color.replace("%alpha", `${alphaOverride ?? 1}`);
124
130
  const { components } = color;
125
131
  let { alpha, type } = color;
126
132
  alpha = alphaOverride ?? alpha;
@@ -588,13 +594,13 @@ const colorResolver = (property, varName) => ([, body], { theme }) => {
588
594
  };
589
595
  } else {
590
596
  return {
591
- [`--un-${varName}-opacity`]: cssColor.alpha ?? 1,
597
+ [`--un-${varName}-opacity`]: colorOpacityToString(cssColor),
592
598
  [property]: colorToString(cssColor, `var(--un-${varName}-opacity)`)
593
599
  };
594
600
  }
595
601
  } else if (color) {
596
602
  return {
597
- [property]: color.replace("%alpha", `${alpha ?? 1}`)
603
+ [property]: colorToString(color, alpha)
598
604
  };
599
605
  }
600
606
  };
@@ -633,6 +639,7 @@ const resolveVerticalBreakpoints = ({ theme, generator }) => {
633
639
  };
634
640
 
635
641
  exports.CONTROL_MINI_NO_NEGATIVE = CONTROL_MINI_NO_NEGATIVE;
642
+ exports.colorOpacityToString = colorOpacityToString;
636
643
  exports.colorResolver = colorResolver;
637
644
  exports.colorToString = colorToString;
638
645
  exports.colorableShadows = colorableShadows;
@@ -118,7 +118,13 @@ function parseCssColor(str = "") {
118
118
  return;
119
119
  return { type, components, alpha };
120
120
  }
121
+ function colorOpacityToString(color) {
122
+ const alpha = color.alpha ?? 1;
123
+ return alpha === "%alpha" ? 1 : alpha;
124
+ }
121
125
  function colorToString(color, alphaOverride) {
126
+ if (typeof color === "string")
127
+ return color.replace("%alpha", `${alphaOverride ?? 1}`);
122
128
  const { components } = color;
123
129
  let { alpha, type } = color;
124
130
  alpha = alphaOverride ?? alpha;
@@ -586,13 +592,13 @@ const colorResolver = (property, varName) => ([, body], { theme }) => {
586
592
  };
587
593
  } else {
588
594
  return {
589
- [`--un-${varName}-opacity`]: cssColor.alpha ?? 1,
595
+ [`--un-${varName}-opacity`]: colorOpacityToString(cssColor),
590
596
  [property]: colorToString(cssColor, `var(--un-${varName}-opacity)`)
591
597
  };
592
598
  }
593
599
  } else if (color) {
594
600
  return {
595
- [property]: color.replace("%alpha", `${alpha ?? 1}`)
601
+ [property]: colorToString(color, alpha)
596
602
  };
597
603
  }
598
604
  };
@@ -630,4 +636,4 @@ const resolveVerticalBreakpoints = ({ theme, generator }) => {
630
636
  return verticalBreakpoints;
631
637
  };
632
638
 
633
- export { CONTROL_MINI_NO_NEGATIVE as C, hasParseableColor as a, colorToString as b, colorResolver as c, directionMap as d, cornerMap as e, colorableShadows as f, globalKeywords as g, handler as h, insetMap as i, resolveBreakpoints as j, directionSize as k, positionMap as l, hex2rgba as m, parseCssColor as n, getComponents as o, parseColor as p, h as q, resolveVerticalBreakpoints as r, valueHandlers as v, xyzMap as x };
639
+ 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, positionMap as m, hex2rgba as n, parseCssColor as o, parseColor as p, getComponents as q, resolveVerticalBreakpoints as r, h as s, valueHandlers as v, xyzMap as x };
@@ -1,4 +1,4 @@
1
- import { T as Theme } from './types-0f7ef446.js';
1
+ import { T as Theme } from './types-2a2972f5.js';
2
2
 
3
3
  declare const colors: Theme['colors'];
4
4
 
package/dist/colors.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { c as colors } from './colors-5590b862.js';
2
- import './types-0f7ef446.js';
1
+ export { c as colors } from './colors-b075335e.js';
2
+ import './types-2a2972f5.js';
@@ -1,4 +1,4 @@
1
- import { T as Theme } from './types-0f7ef446.js';
1
+ import { T as Theme } from './types-2a2972f5.js';
2
2
 
3
3
  declare const theme: Theme;
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { Preflight, PresetOptions, Preset } from '@unocss/core';
2
- import { T as Theme } from './types-0f7ef446.js';
3
- export { T as Theme, a as ThemeAnimation } from './types-0f7ef446.js';
4
- export { t as theme } from './default-ee82f36d.js';
5
- export { c as colors } from './colors-5590b862.js';
6
- export { p as parseColor } from './utilities-a77178bb.js';
2
+ import { T as Theme } from './types-2a2972f5.js';
3
+ export { T as Theme, a as ThemeAnimation } from './types-2a2972f5.js';
4
+ export { t as theme } from './default-08edad2c.js';
5
+ export { c as colors } from './colors-b075335e.js';
6
+ export { p as parseColor } from './utilities-c3da10e0.js';
7
7
 
8
8
  declare const preflights: Preflight[];
9
9
 
package/dist/rules.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Rule } from '@unocss/core';
2
- import { T as Theme } from './types-0f7ef446.js';
2
+ import { T as Theme } from './types-2a2972f5.js';
3
3
 
4
4
  declare const verticalAligns: Rule[];
5
5
  declare const textAligns: Rule[];
package/dist/theme.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { c as colors } from './colors-5590b862.js';
2
- export { t as theme } from './default-ee82f36d.js';
3
- import { T as Theme } from './types-0f7ef446.js';
4
- export { T as Theme, a as ThemeAnimation } from './types-0f7ef446.js';
1
+ export { c as colors } from './colors-b075335e.js';
2
+ export { t as theme } from './default-08edad2c.js';
3
+ import { T as Theme } from './types-2a2972f5.js';
4
+ export { T as Theme, a as ThemeAnimation } from './types-2a2972f5.js';
5
5
 
6
6
  declare const blur: {
7
7
  DEFAULT: string;
@@ -3,6 +3,7 @@ interface ThemeAnimation {
3
3
  durations?: Record<string, string>;
4
4
  timingFns?: Record<string, string>;
5
5
  properties?: Record<string, object>;
6
+ counts?: Record<string, string | number>;
6
7
  }
7
8
  interface Theme {
8
9
  width?: Record<string, string>;
@@ -1,5 +1,5 @@
1
1
  import { RuleContext, CSSEntries, ParsedColorValue, CSSObject, VariantContext } from '@unocss/core';
2
- import { T as Theme } from './types-0f7ef446.js';
2
+ import { T as Theme } from './types-2a2972f5.js';
3
3
 
4
4
  declare const CONTROL_MINI_NO_NEGATIVE = "$$mini-no-negative";
5
5
  /**
package/dist/utils.cjs CHANGED
@@ -9,6 +9,7 @@ require('@unocss/core');
9
9
 
10
10
 
11
11
  exports.CONTROL_MINI_NO_NEGATIVE = utilities.CONTROL_MINI_NO_NEGATIVE;
12
+ exports.colorOpacityToString = utilities.colorOpacityToString;
12
13
  exports.colorResolver = utilities.colorResolver;
13
14
  exports.colorToString = utilities.colorToString;
14
15
  exports.colorableShadows = utilities.colorableShadows;
package/dist/utils.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
2
  import { RGBAColorValue, CSSColorValue, VariantObject } from '@unocss/core';
3
- export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, a as colorableShadows, d as directionSize, h as hasParseableColor, p as parseColor, r as resolveBreakpoints, b as resolveVerticalBreakpoints } from './utilities-a77178bb.js';
4
- import './types-0f7ef446.js';
3
+ export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, a as colorableShadows, d as directionSize, h as hasParseableColor, p as parseColor, r as resolveBreakpoints, b as resolveVerticalBreakpoints } from './utilities-c3da10e0.js';
4
+ import './types-2a2972f5.js';
5
5
 
6
6
  declare function hex2rgba(hex?: string): RGBAColorValue | undefined;
7
7
  declare function parseCssColor(str?: string): CSSColorValue | undefined;
8
- declare function colorToString(color: CSSColorValue, alphaOverride?: string | number): string;
8
+ declare function colorOpacityToString(color: CSSColorValue): string | number;
9
+ declare function colorToString(color: CSSColorValue | string, alphaOverride?: string | number): string;
9
10
  declare function getComponents(str: string, separator?: string, limit?: number): string[] | undefined;
10
11
 
11
12
  declare const directionMap: Record<string, string[]>;
@@ -78,4 +79,4 @@ declare const h: _unocss_core.ValueHandler<"number" | "auto" | "global" | "posit
78
79
  declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => VariantObject;
79
80
  declare const variantParentMatcher: (name: string, parent: string) => VariantObject;
80
81
 
81
- export { colorToString, cornerMap, directionMap, getComponents, globalKeywords, h, handler, hex2rgba, insetMap, parseCssColor, positionMap, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
82
+ export { colorOpacityToString, colorToString, cornerMap, directionMap, getComponents, globalKeywords, h, handler, hex2rgba, insetMap, parseCssColor, positionMap, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
package/dist/utils.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { C as CONTROL_MINI_NO_NEGATIVE, c as colorResolver, b as colorToString, f as colorableShadows, e as cornerMap, d as directionMap, k as directionSize, o as getComponents, g as globalKeywords, q as h, h as handler, a as hasParseableColor, m as hex2rgba, i as insetMap, p as parseColor, n as parseCssColor, l as positionMap, j as resolveBreakpoints, r as resolveVerticalBreakpoints, v as valueHandlers, x as xyzMap } from './chunks/utilities.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, q as getComponents, g as globalKeywords, s as h, h as handler, a as hasParseableColor, n as hex2rgba, j as insetMap, p as parseColor, o as parseCssColor, m as positionMap, k 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';
@@ -1,9 +1,9 @@
1
1
  import { Variant, VariantObject } from '@unocss/core';
2
- import { T as Theme } from './types-0f7ef446.js';
2
+ import { T as Theme } from './types-2a2972f5.js';
3
3
  import { PresetMiniOptions } from './index.js';
4
- import './default-ee82f36d.js';
5
- import './colors-5590b862.js';
6
- import './utilities-a77178bb.js';
4
+ import './default-08edad2c.js';
5
+ import './colors-b075335e.js';
6
+ import './utilities-c3da10e0.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.37.3",
3
+ "version": "0.38.1",
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.37.3"
64
+ "@unocss/core": "0.38.1"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",