@unocss/core 0.20.0 → 0.20.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.
package/dist/index.cjs CHANGED
@@ -363,7 +363,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
363
363
  };
364
364
  }
365
365
 
366
- const version = "0.20.0";
366
+ const version = "0.20.1";
367
367
 
368
368
  class UnoGenerator {
369
369
  constructor(userConfig = {}, defaults = {}) {
@@ -565,11 +565,12 @@ class UnoGenerator {
565
565
  return [raw, processed, handlers];
566
566
  }
567
567
  applyVariants(parsed, variantHandlers = parsed[4], raw = parsed[1]) {
568
- const entries = variantHandlers.reduce((p, v) => v.body?.(p) || p, parsed[2]);
568
+ const handlers = [...variantHandlers].sort((a, b) => (a.order || 0) - (b.order || 0));
569
+ const entries = handlers.reduce((p, v) => v.body?.(p) || p, parsed[2]);
569
570
  const obj = {
570
- selector: variantHandlers.reduce((p, v) => v.selector?.(p, entries) || p, toEscapedSelector(raw)),
571
+ selector: handlers.reduce((p, v) => v.selector?.(p, entries) || p, toEscapedSelector(raw)),
571
572
  entries,
572
- parent: variantHandlers.reduce((p, v) => Array.isArray(v.parent) ? v.parent[0] : v.parent || p, void 0)
573
+ parent: handlers.reduce((p, v) => Array.isArray(v.parent) ? v.parent[0] : v.parent || p, void 0)
573
574
  };
574
575
  for (const p of this.config.postprocess)
575
576
  p(obj);
package/dist/index.d.ts CHANGED
@@ -167,6 +167,10 @@ interface VariantHandler {
167
167
  * Provide a parent selector(e.g. media query) to the output css.
168
168
  */
169
169
  parent?: string | [string, number] | undefined;
170
+ /**
171
+ * Variant ordering.
172
+ */
173
+ order?: number;
170
174
  }
171
175
  declare type VariantFunction<Theme extends {} = {}> = (matcher: string, context: Readonly<VariantContext<Theme>>) => string | VariantHandler | undefined;
172
176
  declare type VariantObject<Theme extends {} = {}> = {
package/dist/index.mjs CHANGED
@@ -359,7 +359,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
359
359
  };
360
360
  }
361
361
 
362
- const version = "0.20.0";
362
+ const version = "0.20.1";
363
363
 
364
364
  class UnoGenerator {
365
365
  constructor(userConfig = {}, defaults = {}) {
@@ -561,11 +561,12 @@ class UnoGenerator {
561
561
  return [raw, processed, handlers];
562
562
  }
563
563
  applyVariants(parsed, variantHandlers = parsed[4], raw = parsed[1]) {
564
- const entries = variantHandlers.reduce((p, v) => v.body?.(p) || p, parsed[2]);
564
+ const handlers = [...variantHandlers].sort((a, b) => (a.order || 0) - (b.order || 0));
565
+ const entries = handlers.reduce((p, v) => v.body?.(p) || p, parsed[2]);
565
566
  const obj = {
566
- selector: variantHandlers.reduce((p, v) => v.selector?.(p, entries) || p, toEscapedSelector(raw)),
567
+ selector: handlers.reduce((p, v) => v.selector?.(p, entries) || p, toEscapedSelector(raw)),
567
568
  entries,
568
- parent: variantHandlers.reduce((p, v) => Array.isArray(v.parent) ? v.parent[0] : v.parent || p, void 0)
569
+ parent: handlers.reduce((p, v) => Array.isArray(v.parent) ? v.parent[0] : v.parent || p, void 0)
569
570
  };
570
571
  for (const p of this.config.postprocess)
571
572
  p(obj);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/core",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "description": "The instant on-demand Atomic CSS engine.",
5
5
  "keywords": [
6
6
  "unocss",