@unocss/preset-mini 0.24.0 → 0.24.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.
@@ -197,6 +197,10 @@ const PartClassesRE = /(part-\[(.+)]:)(.+)/;
197
197
  const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
198
198
  const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
199
199
  const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
200
+ const sortValue = (pseudo) => {
201
+ if (pseudo === "active")
202
+ return 1;
203
+ };
200
204
  const taggedPseudoClassMatcher = (tag, parent, combinator) => {
201
205
  const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
202
206
  const rawRe = new RegExp(`^${core.escapeRegExp(parent)}:`);
@@ -208,7 +212,8 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
208
212
  pseudo = `:${match[2]}(${pseudo})`;
209
213
  return {
210
214
  matcher: input.slice(match[0].length),
211
- selector: (s) => rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`
215
+ selector: (s) => rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`,
216
+ sort: sortValue(match[3])
212
217
  };
213
218
  }
214
219
  };
@@ -230,7 +235,8 @@ const variantPseudoClasses = {
230
235
  const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
231
236
  return {
232
237
  matcher: input.slice(match[0].length),
233
- selector: (s) => `${s}${pseudo}`
238
+ selector: (s) => `${s}${pseudo}`,
239
+ sort: sortValue(match[1])
234
240
  };
235
241
  }
236
242
  },
@@ -195,6 +195,10 @@ const PartClassesRE = /(part-\[(.+)]:)(.+)/;
195
195
  const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
196
196
  const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
197
197
  const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
198
+ const sortValue = (pseudo) => {
199
+ if (pseudo === "active")
200
+ return 1;
201
+ };
198
202
  const taggedPseudoClassMatcher = (tag, parent, combinator) => {
199
203
  const re = new RegExp(`^${tag}-((?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))[:-]`);
200
204
  const rawRe = new RegExp(`^${escapeRegExp(parent)}:`);
@@ -206,7 +210,8 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
206
210
  pseudo = `:${match[2]}(${pseudo})`;
207
211
  return {
208
212
  matcher: input.slice(match[0].length),
209
- selector: (s) => rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`
213
+ selector: (s) => rawRe.test(s) ? s.replace(rawRe, `${parent}${pseudo}:`) : `${parent}${pseudo}${combinator}${s}`,
214
+ sort: sortValue(match[3])
210
215
  };
211
216
  }
212
217
  };
@@ -228,7 +233,8 @@ const variantPseudoClasses = {
228
233
  const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
229
234
  return {
230
235
  matcher: input.slice(match[0].length),
231
- selector: (s) => `${s}${pseudo}`
236
+ selector: (s) => `${s}${pseudo}`,
237
+ sort: sortValue(match[1])
232
238
  };
233
239
  }
234
240
  },
@@ -556,14 +556,13 @@ const colorableShadows = (shadows, colorVar) => {
556
556
  const colored = [];
557
557
  shadows = core.toArray(shadows);
558
558
  for (let i = 0; i < shadows.length; i++) {
559
- const components = getComponents(shadows[i]);
560
- if (!components)
559
+ const components = getComponents(shadows[i], " ", 6);
560
+ if (!components || components.length < 3)
561
561
  return shadows;
562
- const [maybeColor, ...size] = components.reverse();
563
- const color = parseCssColor(maybeColor);
562
+ const color = parseCssColor(components.pop());
564
563
  if (color == null)
565
564
  return shadows;
566
- colored.push(`${size.reverse().join(" ")} var(${colorVar}, ${colorToString(color)})`);
565
+ colored.push(`${components.join(" ")} var(${colorVar}, ${colorToString(color)})`);
567
566
  }
568
567
  return colored;
569
568
  };
@@ -554,14 +554,13 @@ const colorableShadows = (shadows, colorVar) => {
554
554
  const colored = [];
555
555
  shadows = toArray(shadows);
556
556
  for (let i = 0; i < shadows.length; i++) {
557
- const components = getComponents(shadows[i]);
558
- if (!components)
557
+ const components = getComponents(shadows[i], " ", 6);
558
+ if (!components || components.length < 3)
559
559
  return shadows;
560
- const [maybeColor, ...size] = components.reverse();
561
- const color = parseCssColor(maybeColor);
560
+ const color = parseCssColor(components.pop());
562
561
  if (color == null)
563
562
  return shadows;
564
- colored.push(`${size.reverse().join(" ")} var(${colorVar}, ${colorToString(color)})`);
563
+ colored.push(`${components.join(" ")} var(${colorVar}, ${colorToString(color)})`);
565
564
  }
566
565
  return colored;
567
566
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.24.0",
3
+ "version": "0.24.1",
4
4
  "description": "The minimal preset for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -61,7 +61,7 @@
61
61
  "*.css"
62
62
  ],
63
63
  "dependencies": {
64
- "@unocss/core": "0.24.0"
64
+ "@unocss/core": "0.24.1"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",