@unocss/core 0.65.4 → 65.4.2

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
@@ -1,6 +1,29 @@
1
1
  import MagicString from 'magic-string';
2
2
  import { LoadConfigResult } from 'unconfig';
3
3
 
4
+ declare function toArray<T>(value?: T | T[]): T[];
5
+ declare function uniq<T>(value: T[]): T[];
6
+ declare function uniqueBy<T>(array: readonly T[], equalFn: (a: T, b: T) => boolean): T[];
7
+ declare function isString(s: any): s is string;
8
+
9
+ declare class CountableSet<K> extends Set<K> {
10
+ _map: Map<K, number>;
11
+ constructor(values?: Iterable<K>);
12
+ add(key: K): this;
13
+ delete(key: K): boolean;
14
+ clear(): void;
15
+ getCount(key: K): number;
16
+ setCount(key: K, count: number): this;
17
+ }
18
+ declare function isCountableSet<T = string>(value: any): value is CountableSet<T>;
19
+
20
+ declare function escapeRegExp(string: string): string;
21
+ /**
22
+ * CSS Selector Escape
23
+ */
24
+ declare function escapeSelector(str: string): string;
25
+ declare const e: typeof escapeSelector;
26
+
4
27
  type EventsMap = Record<string, any>;
5
28
  interface DefaultEvents extends EventsMap {
6
29
  [event: string]: (...args: any) => void;
@@ -50,29 +73,26 @@ declare class Emitter<Events extends EventsMap = DefaultEvents> {
50
73
  */
51
74
  emit<K extends keyof Events>(this: this, event: K, ...args: Parameters<Events[K]>): void;
52
75
  }
53
-
54
- declare function toArray<T>(value?: T | T[]): T[];
55
- declare function uniq<T>(value: T[]): T[];
56
- declare function uniqueBy<T>(array: readonly T[], equalFn: (a: T, b: T) => boolean): T[];
57
- declare function isString(s: any): s is string;
58
-
59
- declare class CountableSet<K> extends Set<K> {
60
- _map: Map<K, number>;
61
- constructor(values?: Iterable<K>);
62
- add(key: K): this;
63
- delete(key: K): boolean;
64
- clear(): void;
65
- getCount(key: K): number;
66
- setCount(key: K, count: number): this;
67
- }
68
- declare function isCountableSet<T = string>(value: any): value is CountableSet<T>;
69
-
70
- declare function escapeRegExp(string: string): string;
71
76
  /**
72
- * CSS Selector Escape
77
+ * Create event emitter.
78
+ *
79
+ * ```js
80
+ * import { createNanoEvents } from 'nanoevents'
81
+ *
82
+ * class Ticker {
83
+ * constructor() {
84
+ * this.emitter = createNanoEvents()
85
+ * }
86
+ * on(...args) {
87
+ * return this.emitter.on(...args)
88
+ * }
89
+ * tick() {
90
+ * this.emitter.emit('tick')
91
+ * }
92
+ * }
93
+ * ```
73
94
  */
74
- declare function escapeSelector(str: string): string;
75
- declare const e: typeof escapeSelector;
95
+ declare function createNanoEvents<Events extends EventsMap = DefaultEvents>(): Emitter<Events>;
76
96
 
77
97
  declare const attributifyRE: RegExp;
78
98
  declare const cssIdRE: RegExp;
@@ -554,7 +574,7 @@ interface ConfigBase<Theme extends object = object> {
554
574
  *
555
575
  * Pass `null` or `false` to disable the default extractor.
556
576
  *
557
- * @see https://github.com/unocss/unocss/blob/main/packages/core/src/extractors/split.ts
577
+ * @see https://github.com/unocss/unocss/blob/main/packages-engine/core/src/extractors/split.ts
558
578
  * @default import('@unocss/core').defaultExtractor
559
579
  */
560
580
  extractorDefault?: Extractor | null | false;
@@ -1077,8 +1097,19 @@ declare function definePreset<Options extends object | undefined = undefined, Th
1077
1097
  declare function definePreset<Options extends object | undefined = undefined, Theme extends object = object>(preset: PresetFactoryAwaitable<Theme, Options>): PresetFactoryAwaitable<Theme, Options>;
1078
1098
  declare function definePreset<Theme extends object = object>(preset: Preset<Theme>): Preset<Theme>;
1079
1099
 
1100
+ declare const LAYER_DEFAULT = "default";
1101
+ declare const LAYER_PREFLIGHTS = "preflights";
1102
+ declare const LAYER_SHORTCUTS = "shortcuts";
1103
+ declare const LAYER_IMPORTS = "imports";
1104
+ declare const DEFAULT_LAYERS: {
1105
+ imports: number;
1106
+ preflights: number;
1107
+ shortcuts: number;
1108
+ default: number;
1109
+ };
1110
+
1080
1111
  declare const defaultSplitRE: RegExp;
1081
1112
  declare const splitWithVariantGroupRE: RegExp;
1082
1113
  declare const extractorSplit: Extractor;
1083
1114
 
1084
- 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, type DeepPartial, type DynamicMatcher, type DynamicRule, type DynamicShortcut, type DynamicShortcutMatcher, type ExtendedTokenInfo, type Extractor, type ExtractorContext, type FilterPattern, type FlatObjectTuple, type GenerateOptions, type GenerateResult, type GeneratorOptions, type HighlightAnnotation, 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 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, 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,29 @@
1
1
  import MagicString from 'magic-string';
2
2
  import { LoadConfigResult } from 'unconfig';
3
3
 
4
+ declare function toArray<T>(value?: T | T[]): T[];
5
+ declare function uniq<T>(value: T[]): T[];
6
+ declare function uniqueBy<T>(array: readonly T[], equalFn: (a: T, b: T) => boolean): T[];
7
+ declare function isString(s: any): s is string;
8
+
9
+ declare class CountableSet<K> extends Set<K> {
10
+ _map: Map<K, number>;
11
+ constructor(values?: Iterable<K>);
12
+ add(key: K): this;
13
+ delete(key: K): boolean;
14
+ clear(): void;
15
+ getCount(key: K): number;
16
+ setCount(key: K, count: number): this;
17
+ }
18
+ declare function isCountableSet<T = string>(value: any): value is CountableSet<T>;
19
+
20
+ declare function escapeRegExp(string: string): string;
21
+ /**
22
+ * CSS Selector Escape
23
+ */
24
+ declare function escapeSelector(str: string): string;
25
+ declare const e: typeof escapeSelector;
26
+
4
27
  type EventsMap = Record<string, any>;
5
28
  interface DefaultEvents extends EventsMap {
6
29
  [event: string]: (...args: any) => void;
@@ -50,29 +73,26 @@ declare class Emitter<Events extends EventsMap = DefaultEvents> {
50
73
  */
51
74
  emit<K extends keyof Events>(this: this, event: K, ...args: Parameters<Events[K]>): void;
52
75
  }
53
-
54
- declare function toArray<T>(value?: T | T[]): T[];
55
- declare function uniq<T>(value: T[]): T[];
56
- declare function uniqueBy<T>(array: readonly T[], equalFn: (a: T, b: T) => boolean): T[];
57
- declare function isString(s: any): s is string;
58
-
59
- declare class CountableSet<K> extends Set<K> {
60
- _map: Map<K, number>;
61
- constructor(values?: Iterable<K>);
62
- add(key: K): this;
63
- delete(key: K): boolean;
64
- clear(): void;
65
- getCount(key: K): number;
66
- setCount(key: K, count: number): this;
67
- }
68
- declare function isCountableSet<T = string>(value: any): value is CountableSet<T>;
69
-
70
- declare function escapeRegExp(string: string): string;
71
76
  /**
72
- * CSS Selector Escape
77
+ * Create event emitter.
78
+ *
79
+ * ```js
80
+ * import { createNanoEvents } from 'nanoevents'
81
+ *
82
+ * class Ticker {
83
+ * constructor() {
84
+ * this.emitter = createNanoEvents()
85
+ * }
86
+ * on(...args) {
87
+ * return this.emitter.on(...args)
88
+ * }
89
+ * tick() {
90
+ * this.emitter.emit('tick')
91
+ * }
92
+ * }
93
+ * ```
73
94
  */
74
- declare function escapeSelector(str: string): string;
75
- declare const e: typeof escapeSelector;
95
+ declare function createNanoEvents<Events extends EventsMap = DefaultEvents>(): Emitter<Events>;
76
96
 
77
97
  declare const attributifyRE: RegExp;
78
98
  declare const cssIdRE: RegExp;
@@ -554,7 +574,7 @@ interface ConfigBase<Theme extends object = object> {
554
574
  *
555
575
  * Pass `null` or `false` to disable the default extractor.
556
576
  *
557
- * @see https://github.com/unocss/unocss/blob/main/packages/core/src/extractors/split.ts
577
+ * @see https://github.com/unocss/unocss/blob/main/packages-engine/core/src/extractors/split.ts
558
578
  * @default import('@unocss/core').defaultExtractor
559
579
  */
560
580
  extractorDefault?: Extractor | null | false;
@@ -1077,8 +1097,19 @@ declare function definePreset<Options extends object | undefined = undefined, Th
1077
1097
  declare function definePreset<Options extends object | undefined = undefined, Theme extends object = object>(preset: PresetFactoryAwaitable<Theme, Options>): PresetFactoryAwaitable<Theme, Options>;
1078
1098
  declare function definePreset<Theme extends object = object>(preset: Preset<Theme>): Preset<Theme>;
1079
1099
 
1100
+ declare const LAYER_DEFAULT = "default";
1101
+ declare const LAYER_PREFLIGHTS = "preflights";
1102
+ declare const LAYER_SHORTCUTS = "shortcuts";
1103
+ declare const LAYER_IMPORTS = "imports";
1104
+ declare const DEFAULT_LAYERS: {
1105
+ imports: number;
1106
+ preflights: number;
1107
+ shortcuts: number;
1108
+ default: number;
1109
+ };
1110
+
1080
1111
  declare const defaultSplitRE: RegExp;
1081
1112
  declare const splitWithVariantGroupRE: RegExp;
1082
1113
  declare const extractorSplit: Extractor;
1083
1114
 
1084
- 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, type DeepPartial, type DynamicMatcher, type DynamicRule, type DynamicShortcut, type DynamicShortcutMatcher, type ExtendedTokenInfo, type Extractor, type ExtractorContext, type FilterPattern, type FlatObjectTuple, type GenerateOptions, type GenerateResult, type GeneratorOptions, type HighlightAnnotation, 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 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, 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 };
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 };
package/dist/index.mjs CHANGED
@@ -120,6 +120,19 @@ function escapeSelector(str) {
120
120
  }
121
121
  const e = escapeSelector;
122
122
 
123
+ function createNanoEvents() {
124
+ return {
125
+ events: {},
126
+ emit(event, ...args) {
127
+ (this.events[event] || []).forEach((i) => i(...args));
128
+ },
129
+ on(event, cb) {
130
+ (this.events[event] = this.events[event] || []).push(cb);
131
+ return () => this.events[event] = (this.events[event] || []).filter((i) => i !== cb);
132
+ }
133
+ };
134
+ }
135
+
123
136
  const attributifyRE = /^\[(.+?)~?="(.*)"\]$/;
124
137
  const cssIdRE = /\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/;
125
138
  const validateFilterRE = /[\w\u00A0-\uFFFF%-?]/;
@@ -195,7 +208,7 @@ class TwoKeyMap {
195
208
  class BetterMap extends Map {
196
209
  getFallback(key, fallback) {
197
210
  const v = this.get(key);
198
- if (v === void 0) {
211
+ if (v === undefined) {
199
212
  this.set(key, fallback);
200
213
  return fallback;
201
214
  }
@@ -246,7 +259,7 @@ function clearIdenticalEntries(entry) {
246
259
  function entriesToCss(arr) {
247
260
  if (arr == null)
248
261
  return "";
249
- return clearIdenticalEntries(arr).map(([key, value]) => value != null && typeof value !== "function" ? `${key}:${value};` : void 0).filter(Boolean).join("");
262
+ return clearIdenticalEntries(arr).map(([key, value]) => value != null && typeof value !== "function" ? `${key}:${value};` : undefined).filter(Boolean).join("");
250
263
  }
251
264
  function isObject(item) {
252
265
  return item && typeof item === "object" && !Array.isArray(item);
@@ -436,7 +449,7 @@ async function resolvePreset(presetInput) {
436
449
  value: true,
437
450
  enumerable: false
438
451
  });
439
- const shortcuts = preset.shortcuts ? resolveShortcuts(preset.shortcuts) : void 0;
452
+ const shortcuts = preset.shortcuts ? resolveShortcuts(preset.shortcuts) : undefined;
440
453
  preset.shortcuts = shortcuts;
441
454
  if (preset.prefix || preset.layer) {
442
455
  const apply = (i) => {
@@ -530,8 +543,8 @@ async function resolveConfig(userConfig = {}, defaults = {}) {
530
543
  return uniq(sources.flatMap((p) => toArray(p[key] || [])));
531
544
  }
532
545
  const extractors = getMerged("extractors");
533
- let extractorDefault = sourcesReversed.find((i) => i.extractorDefault !== void 0)?.extractorDefault;
534
- if (extractorDefault === void 0)
546
+ let extractorDefault = sourcesReversed.find((i) => i.extractorDefault !== undefined)?.extractorDefault;
547
+ if (extractorDefault === undefined)
535
548
  extractorDefault = extractorSplit;
536
549
  if (extractorDefault && !extractors.includes(extractorDefault))
537
550
  extractors.unshift(extractorDefault);
@@ -638,20 +651,7 @@ function definePreset(preset) {
638
651
  return preset;
639
652
  }
640
653
 
641
- const version = "0.65.4";
642
-
643
- function createNanoEvents() {
644
- return {
645
- events: {},
646
- emit(event, ...args) {
647
- (this.events[event] || []).forEach((i) => i(...args));
648
- },
649
- on(event, cb) {
650
- (this.events[event] = this.events[event] || []).push(cb);
651
- return () => this.events[event] = (this.events[event] || []).filter((i) => i !== cb);
652
- }
653
- };
654
- }
654
+ const version = "65.4.2";
655
655
 
656
656
  const symbols = {
657
657
  shortcutsNoMerge: "$$symbol-shortcut-no-merge",
@@ -668,7 +668,7 @@ class UnoGeneratorInternal {
668
668
  }
669
669
  version = version;
670
670
  events = createNanoEvents();
671
- config = void 0;
671
+ config = undefined;
672
672
  cache = /* @__PURE__ */ new Map();
673
673
  blocked = /* @__PURE__ */ new Set();
674
674
  parentOrders = /* @__PURE__ */ new Map();
@@ -866,7 +866,7 @@ class UnoGeneratorInternal {
866
866
  ];
867
867
  });
868
868
  if (!sorted.length)
869
- return void 0;
869
+ return undefined;
870
870
  const rules = sorted.reverse().map(([selectorSortPair, body, noMerge], idx) => {
871
871
  if (!noMerge && this.config.mergeSelectors) {
872
872
  for (let i = idx + 1; i < size; i++) {
@@ -902,7 +902,7 @@ class UnoGeneratorInternal {
902
902
  const getLayers = (includes = layers, excludes) => {
903
903
  const layers2 = includes.filter((i) => !excludes?.includes(i));
904
904
  return [
905
- outputCssLayers && layers2.length > 0 ? `@layer ${layers2.map(getLayerAlias).filter(notNull).join(", ")};` : void 0,
905
+ outputCssLayers && layers2.length > 0 ? `@layer ${layers2.map(getLayerAlias).filter(notNull).join(", ")};` : undefined,
906
906
  ...layers2.map((i) => getLayer(i) || "")
907
907
  ].filter(Boolean).join(nl);
908
908
  };
@@ -987,7 +987,7 @@ class UnoGeneratorInternal {
987
987
  const handler = variantHandlers.slice().sort((a, b) => (a.order || 0) - (b.order || 0)).reduceRight(
988
988
  (previous, v) => (input) => {
989
989
  const entries = v.body?.(input.entries) || input.entries;
990
- const parents = Array.isArray(v.parent) ? v.parent : [v.parent, void 0];
990
+ const parents = Array.isArray(v.parent) ? v.parent : [v.parent, undefined];
991
991
  return (v.handle ?? defaultVariantHandler)({
992
992
  ...input,
993
993
  entries,
@@ -1029,7 +1029,7 @@ class UnoGeneratorInternal {
1029
1029
  const normalizedBody = normalizeCSSEntries(body);
1030
1030
  if (isString(normalizedBody))
1031
1031
  return normalizedBody;
1032
- const { selector, entries, parent } = this.applyVariants([0, overrideSelector || context.rawSelector, normalizedBody, void 0, context.variantHandlers]);
1032
+ const { selector, entries, parent } = this.applyVariants([0, overrideSelector || context.rawSelector, normalizedBody, undefined, context.variantHandlers]);
1033
1033
  const cssBody = `${selector}{${entriesToCss(entries)}}`;
1034
1034
  if (parent)
1035
1035
  return `${parent}{${cssBody}}`;
@@ -1139,14 +1139,14 @@ class UnoGeneratorInternal {
1139
1139
  };
1140
1140
  const parsed = (await Promise.all(variantResults.map((i) => parse(i)))).flat().filter((x) => !!x);
1141
1141
  if (!parsed.length)
1142
- return void 0;
1142
+ return undefined;
1143
1143
  return parsed;
1144
1144
  }
1145
1145
  stringifyUtil(parsed, context) {
1146
1146
  if (!parsed)
1147
1147
  return;
1148
1148
  if (isRawUtil(parsed))
1149
- return [parsed[0], void 0, parsed[1], void 0, parsed[2], this.config.details ? context : void 0, void 0];
1149
+ return [parsed[0], undefined, parsed[1], undefined, parsed[2], this.config.details ? context : undefined, undefined];
1150
1150
  const {
1151
1151
  selector,
1152
1152
  entries,
@@ -1164,7 +1164,7 @@ class UnoGeneratorInternal {
1164
1164
  layer: variantLayer ?? metaLayer,
1165
1165
  sort: variantSort ?? metaSort
1166
1166
  };
1167
- return [parsed[0], selector, body, parent, ruleMeta, this.config.details ? context : void 0, noMerge];
1167
+ return [parsed[0], selector, body, parent, ruleMeta, this.config.details ? context : undefined, noMerge];
1168
1168
  }
1169
1169
  async expandShortcut(input, context, depth = 5) {
1170
1170
  if (depth === 0)
@@ -1236,7 +1236,7 @@ class UnoGeneratorInternal {
1236
1236
  async stringifyShortcuts(parent, context, expanded, meta = { layer: this.config.shortcutsLayer }) {
1237
1237
  const layerMap = new BetterMap();
1238
1238
  const parsed = (await Promise.all(uniq(expanded).map(async (i) => {
1239
- const result = isString(i) ? await this.parseUtil(i, context, true, meta.prefix) : [[Number.POSITIVE_INFINITY, "{inline}", normalizeCSSEntries(i.value), void 0, i.handles]];
1239
+ const result = isString(i) ? await this.parseUtil(i, context, true, meta.prefix) : [[Number.POSITIVE_INFINITY, "{inline}", normalizeCSSEntries(i.value), undefined, i.handles]];
1240
1240
  if (!result && this.config.warn)
1241
1241
  warnOnce(`unmatched utility "${i}" in shortcut "${parent[1]}"`);
1242
1242
  return result || [];
@@ -1245,7 +1245,7 @@ class UnoGeneratorInternal {
1245
1245
  const rawStringifiedUtil = [];
1246
1246
  for (const item of parsed) {
1247
1247
  if (isRawUtil(item)) {
1248
- rawStringifiedUtil.push([item[0], void 0, item[1], void 0, item[2], context, void 0]);
1248
+ rawStringifiedUtil.push([item[0], undefined, item[1], undefined, item[2], context, undefined]);
1249
1249
  continue;
1250
1250
  }
1251
1251
  const { selector, entries, parent: parent2, sort, noMerge, layer } = this.applyVariants(item, [...item[4], ...parentVariants], raw);
@@ -1261,8 +1261,8 @@ class UnoGeneratorInternal {
1261
1261
  return (flatten ? [entriesList.flat(1)] : entriesList).map((entries) => {
1262
1262
  const body = entriesToCss(entries);
1263
1263
  if (body)
1264
- return [index, selector, body, joinedParents, { ...meta, noMerge, sort: maxSort, layer }, context, void 0];
1265
- return void 0;
1264
+ return [index, selector, body, joinedParents, { ...meta, noMerge, sort: maxSort, layer }, context, undefined];
1265
+ return undefined;
1266
1266
  });
1267
1267
  };
1268
1268
  const merges = [
@@ -1284,7 +1284,7 @@ class UnoGeneratorInternal {
1284
1284
  const v = Array.isArray(e2) ? e2[0] : e2;
1285
1285
  return typeof v === "function" ? v(raw) : isString(v) ? v === raw : v.test(raw);
1286
1286
  });
1287
- return rule ? Array.isArray(rule) ? rule : [rule, void 0] : void 0;
1287
+ return rule ? Array.isArray(rule) ? rule : [rule, undefined] : undefined;
1288
1288
  }
1289
1289
  }
1290
1290
  class UnoGenerator extends UnoGeneratorInternal {
@@ -1319,4 +1319,4 @@ function defaultVariantHandler(input, next) {
1319
1319
  return next(input);
1320
1320
  }
1321
1321
 
1322
- export { BetterMap, CountableSet, TwoKeyMap, UnoGenerator, attributifyRE, clearIdenticalEntries, clone, collapseVariantGroup, createGenerator, 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 };
1322
+ export { BetterMap, CountableSet, DEFAULT_LAYERS, LAYER_DEFAULT, LAYER_IMPORTS, LAYER_PREFLIGHTS, LAYER_SHORTCUTS, TwoKeyMap, UnoGenerator, 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/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@unocss/core",
3
3
  "type": "module",
4
- "version": "0.65.4",
4
+ "version": "65.4.2",
5
5
  "description": "The instant on-demand Atomic CSS engine.",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/antfu",
9
- "homepage": "https://github.com/unocss/unocss/tree/main/packages/core#readme",
9
+ "homepage": "https://unocss.dev",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "https://github.com/unocss/unocss",
13
- "directory": "packages/core"
13
+ "directory": "packages-engine/core"
14
14
  },
15
15
  "bugs": {
16
16
  "url": "https://github.com/unocss/unocss/issues"