@unocss/core 66.0.0 → 66.1.0-beta.10

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.d.mts CHANGED
@@ -265,6 +265,7 @@ interface RuleContext<Theme extends object = object> {
265
265
  variants?: Variant<Theme>[];
266
266
  }
267
267
  declare const SymbolShortcutsNoMerge: unique symbol;
268
+ declare const SymbolNoMerge: unique symbol;
268
269
  declare const SymbolVariants: unique symbol;
269
270
  declare const SymbolParent: unique symbol;
270
271
  declare const SymbolSelector: unique symbol;
@@ -275,6 +276,10 @@ interface ControlSymbols {
275
276
  * Prevent merging in shortcuts
276
277
  */
277
278
  shortcutsNoMerge: typeof SymbolShortcutsNoMerge;
279
+ /**
280
+ * Prevent merging in rules
281
+ */
282
+ noMerge: typeof SymbolNoMerge;
278
283
  /**
279
284
  * Additional variants applied to this rule
280
285
  */
@@ -298,7 +303,8 @@ interface ControlSymbols {
298
303
  }
299
304
  interface ControlSymbolsValue {
300
305
  [SymbolShortcutsNoMerge]: true;
301
- [SymbolVariants]: VariantHandler[];
306
+ [SymbolNoMerge]: true;
307
+ [SymbolVariants]: VariantHandler[] | ((handlers: VariantHandler[]) => VariantHandler[]);
302
308
  [SymbolParent]: string;
303
309
  [SymbolSelector]: (selector: string) => string;
304
310
  [SymbolLayer]: string;
@@ -397,7 +403,7 @@ type CSSValue = CSSObject | CSSEntries;
397
403
  type CSSValues = CSSValue | CSSValue[];
398
404
  type DynamicMatcher<Theme extends object = object> = (match: RegExpMatchArray, context: Readonly<RuleContext<Theme>>) => Awaitable<CSSValueInput | string | (CSSValueInput | string)[] | undefined> | Generator<CSSValueInput | string | undefined> | AsyncGenerator<CSSValueInput | string | undefined>;
399
405
  type DynamicRule<Theme extends object = object> = [RegExp, DynamicMatcher<Theme>, RuleMeta?];
400
- type StaticRule = [string, CSSObject | CSSEntries, RuleMeta?];
406
+ type StaticRule = [string, CSSObject | CSSEntries | (CSSValueInput | string)[], RuleMeta?];
401
407
  type Rule<Theme extends object = object> = DynamicRule<Theme> | StaticRule;
402
408
  type DynamicShortcutMatcher<Theme extends object = object> = ((match: RegExpMatchArray, context: Readonly<RuleContext<Theme>>) => (string | ShortcutValue[] | undefined));
403
409
  type StaticShortcut = [string, string | ShortcutValue[], RuleMeta?];
@@ -740,6 +746,10 @@ interface Preset<Theme extends object = object> extends ConfigBase<Theme> {
740
746
  * Custom API endpoint for cross-preset communication
741
747
  */
742
748
  api?: any;
749
+ /**
750
+ * Custom metadata for the preset
751
+ */
752
+ meta?: Record<string, any>;
743
753
  }
744
754
  type PresetFactory<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Preset<Theme>;
745
755
  type PresetFactoryAwaitable<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Awaitable<Preset<Theme>>;
@@ -1112,4 +1122,4 @@ declare const defaultSplitRE: RegExp;
1112
1122
  declare const splitWithVariantGroupRE: RegExp;
1113
1123
  declare const extractorSplit: Extractor;
1114
1124
 
1115
- export { type ArgumentType, type Arrayable, type AutoCompleteExtractor, type AutoCompleteExtractorContext, type AutoCompleteExtractorResult, type AutoCompleteFunction, type AutoCompleteTemplate, type Awaitable, BetterMap, type BlocklistMeta, type BlocklistRule, type BlocklistValue, type CSSEntries, type CSSEntriesInput, type CSSEntry, type CSSObject, type CSSObjectInput, type CSSValue, type CSSValueInput, type CSSValues, type CliEntryItem, type CliOptions, type ConfigBase, type ContentOptions, type ControlSymbols, type ControlSymbolsEntry, type ControlSymbolsValue, CountableSet, DEFAULT_LAYERS, type DeepPartial, type DynamicMatcher, type DynamicRule, type DynamicShortcut, type DynamicShortcutMatcher, Emitter, type ExtendedTokenInfo, type Extractor, type ExtractorContext, type FilterPattern, type FlatObjectTuple, type GenerateOptions, type GenerateResult, type GeneratorOptions, type HighlightAnnotation, LAYER_DEFAULT, LAYER_IMPORTS, LAYER_PREFLIGHTS, LAYER_SHORTCUTS, type ObjectToEntry, type OutputCssLayersOptions, type ParsedUtil, type PartialByKeys, type PluginOptions, type Postprocessor, type Preflight, type PreflightContext, type PreparedRule, type Preprocessor, type Preset, type PresetFactory, type PresetFactoryAwaitable, type PresetOptions, type PresetOrFactory, type PresetOrFactoryAwaitable, type RawUtil, type Replacement, type RequiredByKey, type ResolvedConfig, type RestArgs, type Rule, type RuleContext, type RuleMeta, type SafeListContext, type Shift, type Shortcut, type ShortcutInlineValue, type ShortcutValue, type SourceCodeTransformer, type SourceCodeTransformerEnforce, type SourceMap, type StaticRule, type StaticShortcut, type StaticShortcutMap, type StringifiedUtil, type SuggestResult, type ThemeExtender, type ToArray, TwoKeyMap, UnoGenerator, type UnocssPluginContext, type Unsubscribe, type UserConfig, type UserConfigDefaults, type UserOnlyOptions, type UserShortcuts, type UtilObject, type Variant, type VariantContext, type VariantFunction, type VariantHandler, type VariantHandlerContext, type VariantMatchedResult, type VariantObject, attributifyRE, clearIdenticalEntries, clone, collapseVariantGroup, createGenerator, createNanoEvents, cssIdRE, defaultSplitRE, definePreset, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, hasScopePlaceholder, isAttributifySelector, isCountableSet, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseVariantGroup, regexScopePlaceholder, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, splitWithVariantGroupRE, symbols, toArray, toEscapedSelector, uniq, uniqueBy, validateFilterRE, warnOnce, withLayer };
1125
+ export { type ArgumentType, type Arrayable, type AutoCompleteExtractor, type AutoCompleteExtractorContext, type AutoCompleteExtractorResult, type AutoCompleteFunction, type AutoCompleteTemplate, type Awaitable, type BaseContext, BetterMap, type BlocklistMeta, type BlocklistRule, type BlocklistValue, type CSSEntries, type CSSEntriesInput, type CSSEntry, type CSSObject, type CSSObjectInput, type CSSValue, type CSSValueInput, type CSSValues, type CliEntryItem, type CliOptions, type ConfigBase, type ContentOptions, type ControlSymbols, type ControlSymbolsEntry, type ControlSymbolsValue, CountableSet, DEFAULT_LAYERS, type DeepPartial, type DynamicMatcher, type DynamicRule, type DynamicShortcut, type DynamicShortcutMatcher, Emitter, type ExtendedTokenInfo, type Extractor, type ExtractorContext, type FilterPattern, type FlatObjectTuple, type GenerateOptions, type GenerateResult, type GeneratorOptions, type HighlightAnnotation, LAYER_DEFAULT, LAYER_IMPORTS, LAYER_PREFLIGHTS, LAYER_SHORTCUTS, type ObjectToEntry, type OutputCssLayersOptions, type ParsedUtil, type PartialByKeys, type PluginOptions, type Postprocessor, type Preflight, type PreflightContext, type PreparedRule, type Preprocessor, type Preset, type PresetFactory, type PresetFactoryAwaitable, type PresetOptions, type PresetOrFactory, type PresetOrFactoryAwaitable, type RawUtil, type Replacement, type RequiredByKey, type ResolvedConfig, type RestArgs, type Rule, type RuleContext, type RuleMeta, type SafeListContext, type Shift, type Shortcut, type ShortcutInlineValue, type ShortcutValue, type SourceCodeTransformer, type SourceCodeTransformerEnforce, type SourceMap, type StaticRule, type StaticShortcut, type StaticShortcutMap, type StringifiedUtil, type SuggestResult, type ThemeExtender, type ToArray, TwoKeyMap, UnoGenerator, type UnocssPluginContext, type Unsubscribe, type UserConfig, type UserConfigDefaults, type UserOnlyOptions, type UserShortcuts, type UtilObject, type Variant, type VariantContext, type VariantFunction, type VariantHandler, type VariantHandlerContext, type VariantMatchedResult, type VariantObject, attributifyRE, clearIdenticalEntries, clone, collapseVariantGroup, createGenerator, createNanoEvents, cssIdRE, defaultSplitRE, definePreset, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, hasScopePlaceholder, isAttributifySelector, isCountableSet, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseVariantGroup, regexScopePlaceholder, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, splitWithVariantGroupRE, symbols, toArray, toEscapedSelector, uniq, uniqueBy, validateFilterRE, warnOnce, withLayer };
package/dist/index.d.ts CHANGED
@@ -265,6 +265,7 @@ interface RuleContext<Theme extends object = object> {
265
265
  variants?: Variant<Theme>[];
266
266
  }
267
267
  declare const SymbolShortcutsNoMerge: unique symbol;
268
+ declare const SymbolNoMerge: unique symbol;
268
269
  declare const SymbolVariants: unique symbol;
269
270
  declare const SymbolParent: unique symbol;
270
271
  declare const SymbolSelector: unique symbol;
@@ -275,6 +276,10 @@ interface ControlSymbols {
275
276
  * Prevent merging in shortcuts
276
277
  */
277
278
  shortcutsNoMerge: typeof SymbolShortcutsNoMerge;
279
+ /**
280
+ * Prevent merging in rules
281
+ */
282
+ noMerge: typeof SymbolNoMerge;
278
283
  /**
279
284
  * Additional variants applied to this rule
280
285
  */
@@ -298,7 +303,8 @@ interface ControlSymbols {
298
303
  }
299
304
  interface ControlSymbolsValue {
300
305
  [SymbolShortcutsNoMerge]: true;
301
- [SymbolVariants]: VariantHandler[];
306
+ [SymbolNoMerge]: true;
307
+ [SymbolVariants]: VariantHandler[] | ((handlers: VariantHandler[]) => VariantHandler[]);
302
308
  [SymbolParent]: string;
303
309
  [SymbolSelector]: (selector: string) => string;
304
310
  [SymbolLayer]: string;
@@ -397,7 +403,7 @@ type CSSValue = CSSObject | CSSEntries;
397
403
  type CSSValues = CSSValue | CSSValue[];
398
404
  type DynamicMatcher<Theme extends object = object> = (match: RegExpMatchArray, context: Readonly<RuleContext<Theme>>) => Awaitable<CSSValueInput | string | (CSSValueInput | string)[] | undefined> | Generator<CSSValueInput | string | undefined> | AsyncGenerator<CSSValueInput | string | undefined>;
399
405
  type DynamicRule<Theme extends object = object> = [RegExp, DynamicMatcher<Theme>, RuleMeta?];
400
- type StaticRule = [string, CSSObject | CSSEntries, RuleMeta?];
406
+ type StaticRule = [string, CSSObject | CSSEntries | (CSSValueInput | string)[], RuleMeta?];
401
407
  type Rule<Theme extends object = object> = DynamicRule<Theme> | StaticRule;
402
408
  type DynamicShortcutMatcher<Theme extends object = object> = ((match: RegExpMatchArray, context: Readonly<RuleContext<Theme>>) => (string | ShortcutValue[] | undefined));
403
409
  type StaticShortcut = [string, string | ShortcutValue[], RuleMeta?];
@@ -740,6 +746,10 @@ interface Preset<Theme extends object = object> extends ConfigBase<Theme> {
740
746
  * Custom API endpoint for cross-preset communication
741
747
  */
742
748
  api?: any;
749
+ /**
750
+ * Custom metadata for the preset
751
+ */
752
+ meta?: Record<string, any>;
743
753
  }
744
754
  type PresetFactory<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Preset<Theme>;
745
755
  type PresetFactoryAwaitable<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Awaitable<Preset<Theme>>;
@@ -1112,4 +1122,4 @@ declare const defaultSplitRE: RegExp;
1112
1122
  declare const splitWithVariantGroupRE: RegExp;
1113
1123
  declare const extractorSplit: Extractor;
1114
1124
 
1115
- export { type ArgumentType, type Arrayable, type AutoCompleteExtractor, type AutoCompleteExtractorContext, type AutoCompleteExtractorResult, type AutoCompleteFunction, type AutoCompleteTemplate, type Awaitable, BetterMap, type BlocklistMeta, type BlocklistRule, type BlocklistValue, type CSSEntries, type CSSEntriesInput, type CSSEntry, type CSSObject, type CSSObjectInput, type CSSValue, type CSSValueInput, type CSSValues, type CliEntryItem, type CliOptions, type ConfigBase, type ContentOptions, type ControlSymbols, type ControlSymbolsEntry, type ControlSymbolsValue, CountableSet, DEFAULT_LAYERS, type DeepPartial, type DynamicMatcher, type DynamicRule, type DynamicShortcut, type DynamicShortcutMatcher, Emitter, type ExtendedTokenInfo, type Extractor, type ExtractorContext, type FilterPattern, type FlatObjectTuple, type GenerateOptions, type GenerateResult, type GeneratorOptions, type HighlightAnnotation, LAYER_DEFAULT, LAYER_IMPORTS, LAYER_PREFLIGHTS, LAYER_SHORTCUTS, type ObjectToEntry, type OutputCssLayersOptions, type ParsedUtil, type PartialByKeys, type PluginOptions, type Postprocessor, type Preflight, type PreflightContext, type PreparedRule, type Preprocessor, type Preset, type PresetFactory, type PresetFactoryAwaitable, type PresetOptions, type PresetOrFactory, type PresetOrFactoryAwaitable, type RawUtil, type Replacement, type RequiredByKey, type ResolvedConfig, type RestArgs, type Rule, type RuleContext, type RuleMeta, type SafeListContext, type Shift, type Shortcut, type ShortcutInlineValue, type ShortcutValue, type SourceCodeTransformer, type SourceCodeTransformerEnforce, type SourceMap, type StaticRule, type StaticShortcut, type StaticShortcutMap, type StringifiedUtil, type SuggestResult, type ThemeExtender, type ToArray, TwoKeyMap, UnoGenerator, type UnocssPluginContext, type Unsubscribe, type UserConfig, type UserConfigDefaults, type UserOnlyOptions, type UserShortcuts, type UtilObject, type Variant, type VariantContext, type VariantFunction, type VariantHandler, type VariantHandlerContext, type VariantMatchedResult, type VariantObject, attributifyRE, clearIdenticalEntries, clone, collapseVariantGroup, createGenerator, createNanoEvents, cssIdRE, defaultSplitRE, definePreset, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, hasScopePlaceholder, isAttributifySelector, isCountableSet, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseVariantGroup, regexScopePlaceholder, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, splitWithVariantGroupRE, symbols, toArray, toEscapedSelector, uniq, uniqueBy, validateFilterRE, warnOnce, withLayer };
1125
+ export { type ArgumentType, type Arrayable, type AutoCompleteExtractor, type AutoCompleteExtractorContext, type AutoCompleteExtractorResult, type AutoCompleteFunction, type AutoCompleteTemplate, type Awaitable, type BaseContext, BetterMap, type BlocklistMeta, type BlocklistRule, type BlocklistValue, type CSSEntries, type CSSEntriesInput, type CSSEntry, type CSSObject, type CSSObjectInput, type CSSValue, type CSSValueInput, type CSSValues, type CliEntryItem, type CliOptions, type ConfigBase, type ContentOptions, type ControlSymbols, type ControlSymbolsEntry, type ControlSymbolsValue, CountableSet, DEFAULT_LAYERS, type DeepPartial, type DynamicMatcher, type DynamicRule, type DynamicShortcut, type DynamicShortcutMatcher, Emitter, type ExtendedTokenInfo, type Extractor, type ExtractorContext, type FilterPattern, type FlatObjectTuple, type GenerateOptions, type GenerateResult, type GeneratorOptions, type HighlightAnnotation, LAYER_DEFAULT, LAYER_IMPORTS, LAYER_PREFLIGHTS, LAYER_SHORTCUTS, type ObjectToEntry, type OutputCssLayersOptions, type ParsedUtil, type PartialByKeys, type PluginOptions, type Postprocessor, type Preflight, type PreflightContext, type PreparedRule, type Preprocessor, type Preset, type PresetFactory, type PresetFactoryAwaitable, type PresetOptions, type PresetOrFactory, type PresetOrFactoryAwaitable, type RawUtil, type Replacement, type RequiredByKey, type ResolvedConfig, type RestArgs, type Rule, type RuleContext, type RuleMeta, type SafeListContext, type Shift, type Shortcut, type ShortcutInlineValue, type ShortcutValue, type SourceCodeTransformer, type SourceCodeTransformerEnforce, type SourceMap, type StaticRule, type StaticShortcut, type StaticShortcutMap, type StringifiedUtil, type SuggestResult, type ThemeExtender, type ToArray, TwoKeyMap, UnoGenerator, type UnocssPluginContext, type Unsubscribe, type UserConfig, type UserConfigDefaults, type UserOnlyOptions, type UserShortcuts, type UtilObject, type Variant, type VariantContext, type VariantFunction, type VariantHandler, type VariantHandlerContext, type VariantMatchedResult, type VariantObject, attributifyRE, clearIdenticalEntries, clone, collapseVariantGroup, createGenerator, createNanoEvents, cssIdRE, defaultSplitRE, definePreset, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, hasScopePlaceholder, isAttributifySelector, isCountableSet, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseVariantGroup, regexScopePlaceholder, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, splitWithVariantGroupRE, symbols, toArray, toEscapedSelector, uniq, uniqueBy, validateFilterRE, warnOnce, withLayer };
package/dist/index.mjs CHANGED
@@ -41,17 +41,23 @@ function isString(s) {
41
41
  }
42
42
 
43
43
  class CountableSet extends Set {
44
- _map;
44
+ _map = /* @__PURE__ */ new Map();
45
45
  constructor(values) {
46
- super(values);
47
- this._map ??= /* @__PURE__ */ new Map();
46
+ super();
47
+ if (values) {
48
+ for (const key of values) {
49
+ this.add(key);
50
+ }
51
+ }
48
52
  }
49
53
  add(key) {
50
- this._map ??= /* @__PURE__ */ new Map();
51
54
  this._map.set(key, (this._map.get(key) ?? 0) + 1);
52
55
  return super.add(key);
53
56
  }
54
57
  delete(key) {
58
+ if (!this._map.has(key)) {
59
+ return false;
60
+ }
55
61
  this._map.delete(key);
56
62
  return super.delete(key);
57
63
  }
@@ -320,7 +326,7 @@ const regexCache = {};
320
326
  function makeRegexClassGroup(separators = ["-", ":"]) {
321
327
  const key = separators.join("|");
322
328
  if (!regexCache[key])
323
- regexCache[key] = new RegExp(`((?:[!@<~\\w+:_-]|\\[&?>?:?\\S*\\])+?)(${key})\\(((?:[~!<>\\w\\s:/\\\\,%#.$?-]|\\[.*?\\])+?)\\)(?!\\s*?=>)`, "gm");
329
+ regexCache[key] = new RegExp(`((?:[!@<~\\w+:_-]|\\[&?>?:?\\S*\\])+?)(${key})\\(((?:[~!<>\\w\\s:/\\\\,%#.$?-]|\\[[^\\]]*?\\])+?)\\)(?!\\s*?=>)`, "gm");
324
330
  regexCache[key].lastIndex = 0;
325
331
  return regexCache[key];
326
332
  }
@@ -651,10 +657,11 @@ function definePreset(preset) {
651
657
  return preset;
652
658
  }
653
659
 
654
- const version = "66.0.0";
660
+ const version = "66.1.0-beta.10";
655
661
 
656
662
  const symbols = {
657
663
  shortcutsNoMerge: "$$symbol-shortcut-no-merge",
664
+ noMerge: "$$symbol-no-merge",
658
665
  variants: "$$symbol-variants",
659
666
  parent: "$$symbol-parent",
660
667
  selector: "$$symbol-selector",
@@ -782,8 +789,9 @@ class UnoGeneratorInternal {
782
789
  theme: this.config.theme
783
790
  };
784
791
  this.config.safelist.flatMap((s) => typeof s === "function" ? s(safelistContext) : s).forEach((s) => {
785
- if (!tokens.has(s))
786
- tokens.add(s);
792
+ const trimedS = s.trim();
793
+ if (trimedS && !tokens.has(trimedS))
794
+ tokens.add(trimedS);
787
795
  });
788
796
  }
789
797
  const nl = minify ? "" : "\n";
@@ -867,7 +875,7 @@ class UnoGeneratorInternal {
867
875
  });
868
876
  if (!sorted.length)
869
877
  return void 0;
870
- const rules = sorted.reverse().map(([selectorSortPair, body, noMerge], idx) => {
878
+ const ruleLines = sorted.reverse().map(([selectorSortPair, body, noMerge], idx) => {
871
879
  if (!noMerge && this.config.mergeSelectors) {
872
880
  for (let i = idx + 1; i < size; i++) {
873
881
  const current = sorted[i];
@@ -880,7 +888,8 @@ class UnoGeneratorInternal {
880
888
  }
881
889
  const selectors = selectorSortPair ? uniq(selectorSortPair.sort((a, b) => a[1] - b[1] || a[0]?.localeCompare(b[0] || "") || 0).map((pair) => pair[0]).filter(Boolean)) : [];
882
890
  return selectors.length ? `${selectors.join(`,${nl}`)}{${body}}` : body;
883
- }).filter(Boolean).reverse().join(nl);
891
+ }).filter(Boolean);
892
+ const rules = Array.from(new Set(ruleLines)).reverse().join(nl);
884
893
  if (!parent)
885
894
  return rules;
886
895
  const parents = parent.split(" $$ ");
@@ -988,10 +997,11 @@ class UnoGeneratorInternal {
988
997
  (previous, v) => (input) => {
989
998
  const entries = v.body?.(input.entries) || input.entries;
990
999
  const parents = Array.isArray(v.parent) ? v.parent : [v.parent, void 0];
1000
+ const selector = v.selector?.(input.selector, entries);
991
1001
  return (v.handle ?? defaultVariantHandler)({
992
1002
  ...input,
993
1003
  entries,
994
- selector: v.selector?.(input.selector, entries) || input.selector,
1004
+ selector: selector || input.selector,
995
1005
  parent: parents[0] || input.parent,
996
1006
  parentOrder: parents[1] || input.parentOrder,
997
1007
  layer: v.layer || input.layer,
@@ -1043,16 +1053,19 @@ class UnoGeneratorInternal {
1043
1053
  const staticMatch = this.config.rulesStaticMap[processed];
1044
1054
  if (staticMatch) {
1045
1055
  if (staticMatch[1] && (internal || !staticMatch[2]?.internal)) {
1046
- context.generator.activatedRules.add(staticMatch);
1047
1056
  if (this.config.details)
1048
1057
  context.rules.push(staticMatch);
1049
1058
  const index = this.config.rules.indexOf(staticMatch);
1050
- const entry = normalizeCSSEntries(staticMatch[1]);
1059
+ const entries = normalizeCSSValues(staticMatch[1]).filter((i) => i.length);
1051
1060
  const meta = staticMatch[2];
1052
- if (isString(entry))
1053
- return [[index, entry, meta]];
1054
- else
1055
- return [[index, raw, entry, meta, variantHandlers]];
1061
+ if (entries.length) {
1062
+ context.generator.activatedRules.add(staticMatch);
1063
+ return entries.map((css) => {
1064
+ if (isString(css))
1065
+ return [index, css, meta];
1066
+ return [index, raw, css, meta, variantHandlers];
1067
+ });
1068
+ }
1056
1069
  }
1057
1070
  }
1058
1071
  context.variantHandlers = variantHandlers;
@@ -1081,7 +1094,6 @@ class UnoGeneratorInternal {
1081
1094
  let result = await handler(match, context);
1082
1095
  if (!result)
1083
1096
  continue;
1084
- context.generator.activatedRules.add(rule);
1085
1097
  if (this.config.details)
1086
1098
  context.rules.push(rule);
1087
1099
  if (typeof result !== "string") {
@@ -1098,6 +1110,7 @@ class UnoGeneratorInternal {
1098
1110
  }
1099
1111
  const entries = normalizeCSSValues(result).filter((i) => i.length);
1100
1112
  if (entries.length) {
1113
+ context.generator.activatedRules.add(rule);
1101
1114
  const index = this.config.rules.indexOf(rule);
1102
1115
  return entries.map((css) => {
1103
1116
  if (isString(css))
@@ -1106,10 +1119,14 @@ class UnoGeneratorInternal {
1106
1119
  let entryMeta = meta;
1107
1120
  for (const entry of css) {
1108
1121
  if (entry[0] === symbols.variants) {
1109
- variants = [
1110
- ...toArray(entry[1]),
1111
- ...variants
1112
- ];
1122
+ if (typeof entry[1] === "function") {
1123
+ variants = entry[1](variants) || variants;
1124
+ } else {
1125
+ variants = [
1126
+ ...toArray(entry[1]),
1127
+ ...variants
1128
+ ];
1129
+ }
1113
1130
  } else if (entry[0] === symbols.parent) {
1114
1131
  variants = [
1115
1132
  { parent: entry[1] },
@@ -1130,6 +1147,11 @@ class UnoGeneratorInternal {
1130
1147
  ...entryMeta,
1131
1148
  sort: entry[1]
1132
1149
  };
1150
+ } else if (entry[0] === symbols.noMerge) {
1151
+ entryMeta = {
1152
+ ...entryMeta,
1153
+ noMerge: entry[1]
1154
+ };
1133
1155
  }
1134
1156
  }
1135
1157
  return [index, raw, css, entryMeta, variants];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/core",
3
3
  "type": "module",
4
- "version": "66.0.0",
4
+ "version": "66.1.0-beta.10",
5
5
  "description": "The instant on-demand Atomic CSS engine.",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  ],
39
39
  "devDependencies": {
40
40
  "magic-string": "^0.30.17",
41
- "unconfig": "~7.0.0"
41
+ "unconfig": "^7.3.1"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "unbuild",