@unocss/preset-mini 0.37.1 → 0.37.4

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
  };
@@ -182,7 +182,7 @@ const numberRE = /[0-9.]+(?:[a-z]+|%)?/;
182
182
  const variantNegative = {
183
183
  name: "negative",
184
184
  match(matcher) {
185
- if (!matcher.startsWith("-") || !matcher.match(/\d|-px|-full/))
185
+ if (!matcher.startsWith("-"))
186
186
  return;
187
187
  return {
188
188
  matcher: matcher.slice(1),
@@ -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
 
@@ -180,7 +180,7 @@ const numberRE = /[0-9.]+(?:[a-z]+|%)?/;
180
180
  const variantNegative = {
181
181
  name: "negative",
182
182
  match(matcher) {
183
- if (!matcher.startsWith("-") || !matcher.match(/\d|-px|-full/))
183
+ if (!matcher.startsWith("-"))
184
184
  return;
185
185
  return {
186
186
  matcher: matcher.slice(1),
@@ -177,8 +177,7 @@ const transformBase = {
177
177
  "--un-skew-y": 0,
178
178
  "--un-translate-x": 0,
179
179
  "--un-translate-y": 0,
180
- "--un-translate-z": 0,
181
- "--un-transform": transformCpu
180
+ "--un-translate-z": 0
182
181
  };
183
182
  const transforms = [
184
183
  [/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] ?? utilities.handler.bracket.cssvar(s) }), { autocomplete: [`transform-origin-(${Object.keys(utilities.positionMap).join("|")})`, `origin-(${Object.keys(utilities.positionMap).join("|")})`] }],
@@ -209,8 +208,8 @@ const transforms = [
209
208
  [/^(?:transform-)?scale-([xyz])-(.+)$/, handleScale],
210
209
  [/^(?:transform-)?preserve-3d$/, () => ({ "transform-style": "preserve-3d" })],
211
210
  [/^(?:transform-)?preserve-flat$/, () => ({ "transform-style": "flat" })],
212
- ["transform", { transform: "var(--un-transform)" }],
213
- ["transform-cpu", { transform: "var(--un-transform)" }],
211
+ ["transform", { transform: transformCpu }],
212
+ ["transform-cpu", { transform: transformCpu }],
214
213
  ["transform-gpu", { transform: transformGpu }],
215
214
  ["transform-none", { transform: "none" }]
216
215
  ];
@@ -219,7 +218,7 @@ function handleTranslate([, d, b], { theme }) {
219
218
  if (v != null) {
220
219
  return [
221
220
  ...utilities.xyzMap[d].map((i) => [`--un-translate${i}`, v]),
222
- ["transform", "var(--un-transform)"]
221
+ ["transform", transformCpu]
223
222
  ];
224
223
  }
225
224
  }
@@ -228,7 +227,7 @@ function handleScale([, d, b]) {
228
227
  if (v != null) {
229
228
  return [
230
229
  ...utilities.xyzMap[d].map((i) => [`--un-scale${i}`, v]),
231
- ["transform", "var(--un-transform)"]
230
+ ["transform", transformCpu]
232
231
  ];
233
232
  }
234
233
  }
@@ -239,7 +238,7 @@ function handleRotate([, d = "", b]) {
239
238
  return {
240
239
  "--un-rotate": 0,
241
240
  [`--un-rotate-${d}`]: v,
242
- "transform": "var(--un-transform)"
241
+ "transform": transformCpu
243
242
  };
244
243
  } else {
245
244
  return {
@@ -247,7 +246,7 @@ function handleRotate([, d = "", b]) {
247
246
  "--un-rotate-y": 0,
248
247
  "--un-rotate-z": 0,
249
248
  "--un-rotate": v,
250
- "transform": "var(--un-transform)"
249
+ "transform": transformCpu
251
250
  };
252
251
  }
253
252
  }
@@ -257,7 +256,7 @@ function handleSkew([, d, b]) {
257
256
  if (v != null) {
258
257
  return {
259
258
  [`--un-skew-${d}`]: v,
260
- transform: "var(--un-transform)"
259
+ transform: transformCpu
261
260
  };
262
261
  }
263
262
  }
@@ -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 = [
@@ -175,8 +175,7 @@ const transformBase = {
175
175
  "--un-skew-y": 0,
176
176
  "--un-translate-x": 0,
177
177
  "--un-translate-y": 0,
178
- "--un-translate-z": 0,
179
- "--un-transform": transformCpu
178
+ "--un-translate-z": 0
180
179
  };
181
180
  const transforms = [
182
181
  [/^(?:transform-)?origin-(.+)$/, ([, s]) => ({ "transform-origin": positionMap[s] ?? handler.bracket.cssvar(s) }), { autocomplete: [`transform-origin-(${Object.keys(positionMap).join("|")})`, `origin-(${Object.keys(positionMap).join("|")})`] }],
@@ -207,8 +206,8 @@ const transforms = [
207
206
  [/^(?:transform-)?scale-([xyz])-(.+)$/, handleScale],
208
207
  [/^(?:transform-)?preserve-3d$/, () => ({ "transform-style": "preserve-3d" })],
209
208
  [/^(?:transform-)?preserve-flat$/, () => ({ "transform-style": "flat" })],
210
- ["transform", { transform: "var(--un-transform)" }],
211
- ["transform-cpu", { transform: "var(--un-transform)" }],
209
+ ["transform", { transform: transformCpu }],
210
+ ["transform-cpu", { transform: transformCpu }],
212
211
  ["transform-gpu", { transform: transformGpu }],
213
212
  ["transform-none", { transform: "none" }]
214
213
  ];
@@ -217,7 +216,7 @@ function handleTranslate([, d, b], { theme }) {
217
216
  if (v != null) {
218
217
  return [
219
218
  ...xyzMap[d].map((i) => [`--un-translate${i}`, v]),
220
- ["transform", "var(--un-transform)"]
219
+ ["transform", transformCpu]
221
220
  ];
222
221
  }
223
222
  }
@@ -226,7 +225,7 @@ function handleScale([, d, b]) {
226
225
  if (v != null) {
227
226
  return [
228
227
  ...xyzMap[d].map((i) => [`--un-scale${i}`, v]),
229
- ["transform", "var(--un-transform)"]
228
+ ["transform", transformCpu]
230
229
  ];
231
230
  }
232
231
  }
@@ -237,7 +236,7 @@ function handleRotate([, d = "", b]) {
237
236
  return {
238
237
  "--un-rotate": 0,
239
238
  [`--un-rotate-${d}`]: v,
240
- "transform": "var(--un-transform)"
239
+ "transform": transformCpu
241
240
  };
242
241
  } else {
243
242
  return {
@@ -245,7 +244,7 @@ function handleRotate([, d = "", b]) {
245
244
  "--un-rotate-y": 0,
246
245
  "--un-rotate-z": 0,
247
246
  "--un-rotate": v,
248
- "transform": "var(--un-transform)"
247
+ "transform": transformCpu
249
248
  };
250
249
  }
251
250
  }
@@ -255,7 +254,7 @@ function handleSkew([, d, b]) {
255
254
  if (v != null) {
256
255
  return {
257
256
  [`--un-skew-${d}`]: v,
258
- transform: "var(--un-transform)"
257
+ transform: transformCpu
259
258
  };
260
259
  }
261
260
  }
@@ -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 };
package/dist/rules.d.ts CHANGED
@@ -101,7 +101,6 @@ declare const transformBase: {
101
101
  '--un-translate-x': number;
102
102
  '--un-translate-y': number;
103
103
  '--un-translate-z': number;
104
- '--un-transform': string;
105
104
  };
106
105
  declare const transforms: Rule[];
107
106
 
package/dist/theme.d.ts CHANGED
@@ -216,7 +216,6 @@ declare const preflightBase: {
216
216
  '--un-translate-x': number;
217
217
  '--un-translate-y': number;
218
218
  '--un-translate-z': number;
219
- '--un-transform': string;
220
219
  };
221
220
 
222
221
  export { baseSize, blur, borderRadius, boxShadow, breakpoints, dropShadow, duration, easing, fontFamily, fontSize, height, letterSpacing, lineHeight, lineWidth, maxHeight, maxWidth, preflightBase, ringWidth, spacing, textIndent, textShadow, textStrokeWidth, verticalBreakpoints, width, wordSpacing };
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
@@ -5,7 +5,8 @@ import './types-0f7ef446.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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.37.1",
3
+ "version": "0.37.4",
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.1"
64
+ "@unocss/core": "0.37.4"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",