@unocss/core 0.50.7 → 0.50.8

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
@@ -327,7 +327,7 @@ function createValueHandler(handlers) {
327
327
  }
328
328
 
329
329
  const defaultSplitRE = /[\\:]?[\s'"`;{}]+/g;
330
- const splitWithVariantGroupRE = /[\\:]?([\s"'`;<>*]|:\(|\)"|\)\s)/g;
330
+ const splitWithVariantGroupRE = /([\\:]?[\s"'`;<>*]|:\(|\)"|\)\s)/g;
331
331
  const quotedArbitraryValuesRE = /(?:[\w&:[\]-]|\[\S+=\S+\])+\[\\?['"]?\S+?['"]\]\]?[\w:-]*/g;
332
332
  const arbitraryPropertyRE = /\[(\\\W|[\w-])+:[^\s:]*?("\S+?"|'\S+?'|`\S+?`|[^\s:]+?)[^\s:]*?\)?\]/g;
333
333
  const arbitraryPropertyCandidateRE = /^\[(\\\W|[\w-])+:['"]?\S+?['"]?\]$/;
@@ -460,7 +460,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
460
460
  let separators = toArray(mergePresets("separators"));
461
461
  if (!separators.length)
462
462
  separators = [":", "-"];
463
- return {
463
+ const resolved = {
464
464
  mergeSelectors: true,
465
465
  warn: true,
466
466
  blocklist: [],
@@ -484,9 +484,13 @@ function resolveConfig(userConfig = {}, defaults = {}) {
484
484
  safelist: mergePresets("safelist"),
485
485
  separators
486
486
  };
487
+ for (const p of sortedPresets)
488
+ p?.configResolved?.(resolved);
489
+ userConfig?.configResolved?.(resolved);
490
+ return resolved;
487
491
  }
488
492
 
489
- const version = "0.50.7";
493
+ const version = "0.50.8";
490
494
 
491
495
  class UnoGenerator {
492
496
  constructor(userConfig = {}, defaults = {}) {
package/dist/index.d.ts CHANGED
@@ -510,6 +510,12 @@ interface ConfigBase<Theme extends {} = {}> {
510
510
  */
511
511
  extractors?: Arrayable<AutoCompleteExtractor>;
512
512
  };
513
+ /**
514
+ * Hook to modify the resolved config.
515
+ *
516
+ * First presets runs first and the user config
517
+ */
518
+ configResolved?: (config: ResolvedConfig) => void;
513
519
  /**
514
520
  * Expose internal details for debugging / inspecting
515
521
  *
@@ -572,6 +578,9 @@ interface AutoCompleteExtractor {
572
578
  }
573
579
  interface Preset<Theme extends {} = {}> extends ConfigBase<Theme> {
574
580
  name: string;
581
+ /**
582
+ * Enforce the preset to be applied before or after other presets
583
+ */
575
584
  enforce?: 'pre' | 'post';
576
585
  /**
577
586
  * Preset options for other tools like IDE to consume
package/dist/index.mjs CHANGED
@@ -323,7 +323,7 @@ function createValueHandler(handlers) {
323
323
  }
324
324
 
325
325
  const defaultSplitRE = /[\\:]?[\s'"`;{}]+/g;
326
- const splitWithVariantGroupRE = /[\\:]?([\s"'`;<>*]|:\(|\)"|\)\s)/g;
326
+ const splitWithVariantGroupRE = /([\\:]?[\s"'`;<>*]|:\(|\)"|\)\s)/g;
327
327
  const quotedArbitraryValuesRE = /(?:[\w&:[\]-]|\[\S+=\S+\])+\[\\?['"]?\S+?['"]\]\]?[\w:-]*/g;
328
328
  const arbitraryPropertyRE = /\[(\\\W|[\w-])+:[^\s:]*?("\S+?"|'\S+?'|`\S+?`|[^\s:]+?)[^\s:]*?\)?\]/g;
329
329
  const arbitraryPropertyCandidateRE = /^\[(\\\W|[\w-])+:['"]?\S+?['"]?\]$/;
@@ -456,7 +456,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
456
456
  let separators = toArray(mergePresets("separators"));
457
457
  if (!separators.length)
458
458
  separators = [":", "-"];
459
- return {
459
+ const resolved = {
460
460
  mergeSelectors: true,
461
461
  warn: true,
462
462
  blocklist: [],
@@ -480,9 +480,13 @@ function resolveConfig(userConfig = {}, defaults = {}) {
480
480
  safelist: mergePresets("safelist"),
481
481
  separators
482
482
  };
483
+ for (const p of sortedPresets)
484
+ p?.configResolved?.(resolved);
485
+ userConfig?.configResolved?.(resolved);
486
+ return resolved;
483
487
  }
484
488
 
485
- const version = "0.50.7";
489
+ const version = "0.50.8";
486
490
 
487
491
  class UnoGenerator {
488
492
  constructor(userConfig = {}, defaults = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/core",
3
- "version": "0.50.7",
3
+ "version": "0.50.8",
4
4
  "description": "The instant on-demand Atomic CSS engine.",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",