@unocss/core 0.65.1 → 0.65.3
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 +31 -12
- package/dist/index.d.ts +31 -12
- package/dist/index.mjs +37 -52
- package/package.json +5 -4
package/dist/index.d.mts
CHANGED
|
@@ -136,15 +136,15 @@ declare const symbols: ControlSymbols;
|
|
|
136
136
|
declare class UnoGeneratorInternal<Theme extends object = object> {
|
|
137
137
|
userConfig: UserConfig<Theme>;
|
|
138
138
|
defaults: UserConfigDefaults<Theme>;
|
|
139
|
-
version: string;
|
|
140
|
-
|
|
139
|
+
readonly version: string;
|
|
140
|
+
readonly events: Emitter<{
|
|
141
|
+
config: (config: ResolvedConfig<Theme>) => void;
|
|
142
|
+
}>;
|
|
141
143
|
config: ResolvedConfig<Theme>;
|
|
144
|
+
cache: Map<string, StringifiedUtil<Theme>[] | null>;
|
|
142
145
|
blocked: Set<string>;
|
|
143
146
|
parentOrders: Map<string, number>;
|
|
144
147
|
activatedRules: Set<Rule<Theme>>;
|
|
145
|
-
events: Emitter<{
|
|
146
|
-
config: (config: ResolvedConfig<Theme>) => void;
|
|
147
|
-
}>;
|
|
148
148
|
protected constructor(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>);
|
|
149
149
|
static create<Theme extends object = object>(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<UnoGeneratorInternal<Theme>>;
|
|
150
150
|
setConfig(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<void>;
|
|
@@ -159,8 +159,8 @@ declare class UnoGeneratorInternal<Theme extends object = object> {
|
|
|
159
159
|
constructCustomCSS(context: Readonly<RuleContext<Theme>>, body: CSSObject | CSSEntries, overrideSelector?: string): string;
|
|
160
160
|
parseUtil(input: string | VariantMatchedResult<Theme>, context: RuleContext<Theme>, internal?: boolean, shortcutPrefix?: string | string[] | undefined): Promise<(ParsedUtil | RawUtil)[] | undefined>;
|
|
161
161
|
stringifyUtil(parsed?: ParsedUtil | RawUtil, context?: RuleContext<Theme>): StringifiedUtil<Theme> | undefined;
|
|
162
|
-
expandShortcut(input: string, context: RuleContext<Theme>, depth?: number): Promise<[
|
|
163
|
-
stringifyShortcuts(parent: VariantMatchedResult<Theme>, context: RuleContext<Theme>, expanded:
|
|
162
|
+
expandShortcut(input: string, context: RuleContext<Theme>, depth?: number): Promise<[(string | ShortcutInlineValue)[], RuleMeta | undefined] | undefined>;
|
|
163
|
+
stringifyShortcuts(parent: VariantMatchedResult<Theme>, context: RuleContext<Theme>, expanded: (string | ShortcutInlineValue)[], meta?: RuleMeta): Promise<StringifiedUtil<Theme>[] | undefined>;
|
|
164
164
|
isBlocked(raw: string): boolean;
|
|
165
165
|
getBlocked(raw: string): [BlocklistValue, BlocklistMeta | undefined] | undefined;
|
|
166
166
|
}
|
|
@@ -385,6 +385,10 @@ type StaticShortcutMap = Record<string, string | ShortcutValue[]>;
|
|
|
385
385
|
type DynamicShortcut<Theme extends object = object> = [RegExp, DynamicShortcutMatcher<Theme>, RuleMeta?];
|
|
386
386
|
type UserShortcuts<Theme extends object = object> = StaticShortcutMap | (StaticShortcut | DynamicShortcut<Theme> | StaticShortcutMap)[];
|
|
387
387
|
type Shortcut<Theme extends object = object> = StaticShortcut | DynamicShortcut<Theme>;
|
|
388
|
+
interface ShortcutInlineValue {
|
|
389
|
+
handles: VariantHandler[];
|
|
390
|
+
value: ShortcutValue;
|
|
391
|
+
}
|
|
388
392
|
type ShortcutValue = string | CSSValue;
|
|
389
393
|
type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
|
|
390
394
|
interface Preflight<Theme extends object = object> {
|
|
@@ -768,15 +772,29 @@ interface CliOptions {
|
|
|
768
772
|
};
|
|
769
773
|
}
|
|
770
774
|
interface UnocssPluginContext<Config extends UserConfig = UserConfig> {
|
|
775
|
+
/**
|
|
776
|
+
* Singleton promise for config loading
|
|
777
|
+
*/
|
|
771
778
|
ready: Promise<LoadConfigResult<Config>>;
|
|
779
|
+
/**
|
|
780
|
+
* The UnoCSS generator instance. Should be used after `ready` resolved.
|
|
781
|
+
*/
|
|
772
782
|
uno: UnoGenerator;
|
|
773
|
-
/**
|
|
783
|
+
/**
|
|
784
|
+
* All tokens scanned
|
|
785
|
+
*/
|
|
774
786
|
tokens: Set<string>;
|
|
775
|
-
/**
|
|
787
|
+
/**
|
|
788
|
+
* Map for all module's raw content
|
|
789
|
+
*/
|
|
776
790
|
modules: BetterMap<string, string>;
|
|
777
|
-
/**
|
|
791
|
+
/**
|
|
792
|
+
* Module IDs that been affected by UnoCSS
|
|
793
|
+
*/
|
|
778
794
|
affectedModules: Set<string>;
|
|
779
|
-
/**
|
|
795
|
+
/**
|
|
796
|
+
* Pending promises
|
|
797
|
+
*/
|
|
780
798
|
tasks: Promise<any>[];
|
|
781
799
|
/**
|
|
782
800
|
* Await all pending tasks
|
|
@@ -1056,10 +1074,11 @@ declare function resolveConfig<Theme extends object = object>(userConfig?: UserC
|
|
|
1056
1074
|
*/
|
|
1057
1075
|
declare function mergeConfigs<Theme extends object = object>(configs: UserConfig<Theme>[]): UserConfig<Theme>;
|
|
1058
1076
|
declare function definePreset<Options extends object | undefined = undefined, Theme extends object = object>(preset: PresetFactory<Theme, Options>): PresetFactory<Theme, Options>;
|
|
1077
|
+
declare function definePreset<Options extends object | undefined = undefined, Theme extends object = object>(preset: PresetFactoryAwaitable<Theme, Options>): PresetFactoryAwaitable<Theme, Options>;
|
|
1059
1078
|
declare function definePreset<Theme extends object = object>(preset: Preset<Theme>): Preset<Theme>;
|
|
1060
1079
|
|
|
1061
1080
|
declare const defaultSplitRE: RegExp;
|
|
1062
1081
|
declare const splitWithVariantGroupRE: RegExp;
|
|
1063
1082
|
declare const extractorSplit: Extractor;
|
|
1064
1083
|
|
|
1065
|
-
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 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -136,15 +136,15 @@ declare const symbols: ControlSymbols;
|
|
|
136
136
|
declare class UnoGeneratorInternal<Theme extends object = object> {
|
|
137
137
|
userConfig: UserConfig<Theme>;
|
|
138
138
|
defaults: UserConfigDefaults<Theme>;
|
|
139
|
-
version: string;
|
|
140
|
-
|
|
139
|
+
readonly version: string;
|
|
140
|
+
readonly events: Emitter<{
|
|
141
|
+
config: (config: ResolvedConfig<Theme>) => void;
|
|
142
|
+
}>;
|
|
141
143
|
config: ResolvedConfig<Theme>;
|
|
144
|
+
cache: Map<string, StringifiedUtil<Theme>[] | null>;
|
|
142
145
|
blocked: Set<string>;
|
|
143
146
|
parentOrders: Map<string, number>;
|
|
144
147
|
activatedRules: Set<Rule<Theme>>;
|
|
145
|
-
events: Emitter<{
|
|
146
|
-
config: (config: ResolvedConfig<Theme>) => void;
|
|
147
|
-
}>;
|
|
148
148
|
protected constructor(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>);
|
|
149
149
|
static create<Theme extends object = object>(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<UnoGeneratorInternal<Theme>>;
|
|
150
150
|
setConfig(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<void>;
|
|
@@ -159,8 +159,8 @@ declare class UnoGeneratorInternal<Theme extends object = object> {
|
|
|
159
159
|
constructCustomCSS(context: Readonly<RuleContext<Theme>>, body: CSSObject | CSSEntries, overrideSelector?: string): string;
|
|
160
160
|
parseUtil(input: string | VariantMatchedResult<Theme>, context: RuleContext<Theme>, internal?: boolean, shortcutPrefix?: string | string[] | undefined): Promise<(ParsedUtil | RawUtil)[] | undefined>;
|
|
161
161
|
stringifyUtil(parsed?: ParsedUtil | RawUtil, context?: RuleContext<Theme>): StringifiedUtil<Theme> | undefined;
|
|
162
|
-
expandShortcut(input: string, context: RuleContext<Theme>, depth?: number): Promise<[
|
|
163
|
-
stringifyShortcuts(parent: VariantMatchedResult<Theme>, context: RuleContext<Theme>, expanded:
|
|
162
|
+
expandShortcut(input: string, context: RuleContext<Theme>, depth?: number): Promise<[(string | ShortcutInlineValue)[], RuleMeta | undefined] | undefined>;
|
|
163
|
+
stringifyShortcuts(parent: VariantMatchedResult<Theme>, context: RuleContext<Theme>, expanded: (string | ShortcutInlineValue)[], meta?: RuleMeta): Promise<StringifiedUtil<Theme>[] | undefined>;
|
|
164
164
|
isBlocked(raw: string): boolean;
|
|
165
165
|
getBlocked(raw: string): [BlocklistValue, BlocklistMeta | undefined] | undefined;
|
|
166
166
|
}
|
|
@@ -385,6 +385,10 @@ type StaticShortcutMap = Record<string, string | ShortcutValue[]>;
|
|
|
385
385
|
type DynamicShortcut<Theme extends object = object> = [RegExp, DynamicShortcutMatcher<Theme>, RuleMeta?];
|
|
386
386
|
type UserShortcuts<Theme extends object = object> = StaticShortcutMap | (StaticShortcut | DynamicShortcut<Theme> | StaticShortcutMap)[];
|
|
387
387
|
type Shortcut<Theme extends object = object> = StaticShortcut | DynamicShortcut<Theme>;
|
|
388
|
+
interface ShortcutInlineValue {
|
|
389
|
+
handles: VariantHandler[];
|
|
390
|
+
value: ShortcutValue;
|
|
391
|
+
}
|
|
388
392
|
type ShortcutValue = string | CSSValue;
|
|
389
393
|
type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
|
|
390
394
|
interface Preflight<Theme extends object = object> {
|
|
@@ -768,15 +772,29 @@ interface CliOptions {
|
|
|
768
772
|
};
|
|
769
773
|
}
|
|
770
774
|
interface UnocssPluginContext<Config extends UserConfig = UserConfig> {
|
|
775
|
+
/**
|
|
776
|
+
* Singleton promise for config loading
|
|
777
|
+
*/
|
|
771
778
|
ready: Promise<LoadConfigResult<Config>>;
|
|
779
|
+
/**
|
|
780
|
+
* The UnoCSS generator instance. Should be used after `ready` resolved.
|
|
781
|
+
*/
|
|
772
782
|
uno: UnoGenerator;
|
|
773
|
-
/**
|
|
783
|
+
/**
|
|
784
|
+
* All tokens scanned
|
|
785
|
+
*/
|
|
774
786
|
tokens: Set<string>;
|
|
775
|
-
/**
|
|
787
|
+
/**
|
|
788
|
+
* Map for all module's raw content
|
|
789
|
+
*/
|
|
776
790
|
modules: BetterMap<string, string>;
|
|
777
|
-
/**
|
|
791
|
+
/**
|
|
792
|
+
* Module IDs that been affected by UnoCSS
|
|
793
|
+
*/
|
|
778
794
|
affectedModules: Set<string>;
|
|
779
|
-
/**
|
|
795
|
+
/**
|
|
796
|
+
* Pending promises
|
|
797
|
+
*/
|
|
780
798
|
tasks: Promise<any>[];
|
|
781
799
|
/**
|
|
782
800
|
* Await all pending tasks
|
|
@@ -1056,10 +1074,11 @@ declare function resolveConfig<Theme extends object = object>(userConfig?: UserC
|
|
|
1056
1074
|
*/
|
|
1057
1075
|
declare function mergeConfigs<Theme extends object = object>(configs: UserConfig<Theme>[]): UserConfig<Theme>;
|
|
1058
1076
|
declare function definePreset<Options extends object | undefined = undefined, Theme extends object = object>(preset: PresetFactory<Theme, Options>): PresetFactory<Theme, Options>;
|
|
1077
|
+
declare function definePreset<Options extends object | undefined = undefined, Theme extends object = object>(preset: PresetFactoryAwaitable<Theme, Options>): PresetFactoryAwaitable<Theme, Options>;
|
|
1059
1078
|
declare function definePreset<Theme extends object = object>(preset: Preset<Theme>): Preset<Theme>;
|
|
1060
1079
|
|
|
1061
1080
|
declare const defaultSplitRE: RegExp;
|
|
1062
1081
|
declare const splitWithVariantGroupRE: RegExp;
|
|
1063
1082
|
declare const extractorSplit: Extractor;
|
|
1064
1083
|
|
|
1065
|
-
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 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 };
|
|
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 };
|
package/dist/index.mjs
CHANGED
|
@@ -40,20 +40,14 @@ function isString(s) {
|
|
|
40
40
|
return typeof s === "string";
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
var __defProp$2 = Object.defineProperty;
|
|
44
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
45
|
-
var __publicField$2 = (obj, key, value) => {
|
|
46
|
-
__defNormalProp$2(obj, key + "" , value);
|
|
47
|
-
return value;
|
|
48
|
-
};
|
|
49
43
|
class CountableSet extends Set {
|
|
44
|
+
_map;
|
|
50
45
|
constructor(values) {
|
|
51
46
|
super(values);
|
|
52
|
-
|
|
53
|
-
this._map ?? (this._map = /* @__PURE__ */ new Map());
|
|
47
|
+
this._map ??= /* @__PURE__ */ new Map();
|
|
54
48
|
}
|
|
55
49
|
add(key) {
|
|
56
|
-
this._map
|
|
50
|
+
this._map ??= /* @__PURE__ */ new Map();
|
|
57
51
|
this._map.set(key, (this._map.get(key) ?? 0) + 1);
|
|
58
52
|
return super.add(key);
|
|
59
53
|
}
|
|
@@ -157,16 +151,8 @@ function withLayer(layer, rules) {
|
|
|
157
151
|
return rules;
|
|
158
152
|
}
|
|
159
153
|
|
|
160
|
-
var __defProp$1 = Object.defineProperty;
|
|
161
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
162
|
-
var __publicField$1 = (obj, key, value) => {
|
|
163
|
-
__defNormalProp$1(obj, key + "" , value);
|
|
164
|
-
return value;
|
|
165
|
-
};
|
|
166
154
|
class TwoKeyMap {
|
|
167
|
-
|
|
168
|
-
__publicField$1(this, "_map", /* @__PURE__ */ new Map());
|
|
169
|
-
}
|
|
155
|
+
_map = /* @__PURE__ */ new Map();
|
|
170
156
|
get(key1, key2) {
|
|
171
157
|
const m2 = this._map.get(key1);
|
|
172
158
|
if (m2)
|
|
@@ -289,8 +275,7 @@ function clone(val) {
|
|
|
289
275
|
let k, out, tmp;
|
|
290
276
|
if (Array.isArray(val)) {
|
|
291
277
|
out = Array.from({ length: k = val.length });
|
|
292
|
-
while (k--)
|
|
293
|
-
out[k] = (tmp = val[k]) && typeof tmp === "object" ? clone(tmp) : tmp;
|
|
278
|
+
while (k--) out[k] = (tmp = val[k]) && typeof tmp === "object" ? clone(tmp) : tmp;
|
|
294
279
|
return out;
|
|
295
280
|
}
|
|
296
281
|
if (Object.prototype.toString.call(val) === "[object Object]") {
|
|
@@ -653,7 +638,7 @@ function definePreset(preset) {
|
|
|
653
638
|
return preset;
|
|
654
639
|
}
|
|
655
640
|
|
|
656
|
-
const version = "0.65.
|
|
641
|
+
const version = "0.65.3";
|
|
657
642
|
|
|
658
643
|
function createNanoEvents() {
|
|
659
644
|
return {
|
|
@@ -668,12 +653,6 @@ function createNanoEvents() {
|
|
|
668
653
|
};
|
|
669
654
|
}
|
|
670
655
|
|
|
671
|
-
var __defProp = Object.defineProperty;
|
|
672
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
673
|
-
var __publicField = (obj, key, value) => {
|
|
674
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
675
|
-
return value;
|
|
676
|
-
};
|
|
677
656
|
const symbols = {
|
|
678
657
|
shortcutsNoMerge: "$$symbol-shortcut-no-merge",
|
|
679
658
|
variants: "$$symbol-variants",
|
|
@@ -686,14 +665,14 @@ class UnoGeneratorInternal {
|
|
|
686
665
|
constructor(userConfig = {}, defaults = {}) {
|
|
687
666
|
this.userConfig = userConfig;
|
|
688
667
|
this.defaults = defaults;
|
|
689
|
-
__publicField(this, "version", version);
|
|
690
|
-
__publicField(this, "_cache", /* @__PURE__ */ new Map());
|
|
691
|
-
__publicField(this, "config");
|
|
692
|
-
__publicField(this, "blocked", /* @__PURE__ */ new Set());
|
|
693
|
-
__publicField(this, "parentOrders", /* @__PURE__ */ new Map());
|
|
694
|
-
__publicField(this, "activatedRules", /* @__PURE__ */ new Set());
|
|
695
|
-
__publicField(this, "events", createNanoEvents());
|
|
696
668
|
}
|
|
669
|
+
version = version;
|
|
670
|
+
events = createNanoEvents();
|
|
671
|
+
config = void 0;
|
|
672
|
+
cache = /* @__PURE__ */ new Map();
|
|
673
|
+
blocked = /* @__PURE__ */ new Set();
|
|
674
|
+
parentOrders = /* @__PURE__ */ new Map();
|
|
675
|
+
activatedRules = /* @__PURE__ */ new Set();
|
|
697
676
|
static async create(userConfig = {}, defaults = {}) {
|
|
698
677
|
const uno = new UnoGeneratorInternal(userConfig, defaults);
|
|
699
678
|
uno.config = await resolveConfig(uno.userConfig, uno.defaults);
|
|
@@ -709,7 +688,7 @@ class UnoGeneratorInternal {
|
|
|
709
688
|
this.blocked.clear();
|
|
710
689
|
this.parentOrders.clear();
|
|
711
690
|
this.activatedRules.clear();
|
|
712
|
-
this.
|
|
691
|
+
this.cache.clear();
|
|
713
692
|
this.config = await resolveConfig(userConfig, this.defaults);
|
|
714
693
|
this.events.emit("config", this.config);
|
|
715
694
|
}
|
|
@@ -752,20 +731,20 @@ class UnoGeneratorInternal {
|
|
|
752
731
|
if (this.blocked.has(raw))
|
|
753
732
|
return;
|
|
754
733
|
const cacheKey = `${raw}${alias ? ` ${alias}` : ""}`;
|
|
755
|
-
if (this.
|
|
756
|
-
return this.
|
|
734
|
+
if (this.cache.has(cacheKey))
|
|
735
|
+
return this.cache.get(cacheKey);
|
|
757
736
|
let current = raw;
|
|
758
737
|
for (const p of this.config.preprocess)
|
|
759
738
|
current = p(raw);
|
|
760
739
|
if (this.isBlocked(current)) {
|
|
761
740
|
this.blocked.add(raw);
|
|
762
|
-
this.
|
|
741
|
+
this.cache.set(cacheKey, null);
|
|
763
742
|
return;
|
|
764
743
|
}
|
|
765
744
|
const variantResults = await this.matchVariants(raw, current);
|
|
766
745
|
if (variantResults.every((i) => !i || this.isBlocked(i[1]))) {
|
|
767
746
|
this.blocked.add(raw);
|
|
768
|
-
this.
|
|
747
|
+
this.cache.set(cacheKey, null);
|
|
769
748
|
return;
|
|
770
749
|
}
|
|
771
750
|
const handleVariantResult = async (matched) => {
|
|
@@ -778,10 +757,10 @@ class UnoGeneratorInternal {
|
|
|
778
757
|
};
|
|
779
758
|
const result = (await Promise.all(variantResults.map((i) => handleVariantResult(i)))).flat().filter((x) => !!x);
|
|
780
759
|
if (result?.length) {
|
|
781
|
-
this.
|
|
760
|
+
this.cache.set(cacheKey, result);
|
|
782
761
|
return result;
|
|
783
762
|
}
|
|
784
|
-
this.
|
|
763
|
+
this.cache.set(cacheKey, null);
|
|
785
764
|
}
|
|
786
765
|
async generate(input, options = {}) {
|
|
787
766
|
const {
|
|
@@ -1196,6 +1175,8 @@ class UnoGeneratorInternal {
|
|
|
1196
1175
|
} : noop;
|
|
1197
1176
|
let meta;
|
|
1198
1177
|
let result;
|
|
1178
|
+
let stringResult;
|
|
1179
|
+
let inlineResult;
|
|
1199
1180
|
for (const s of this.config.shortcuts) {
|
|
1200
1181
|
let unprefixed = input;
|
|
1201
1182
|
if (s[2]?.prefix) {
|
|
@@ -1224,34 +1205,38 @@ class UnoGeneratorInternal {
|
|
|
1224
1205
|
}
|
|
1225
1206
|
}
|
|
1226
1207
|
if (result) {
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
return expandVariantGroup(s.trim()).split(/\s+/g);
|
|
1230
|
-
return s;
|
|
1231
|
-
}).flat();
|
|
1208
|
+
stringResult = uniq(toArray(result).filter(isString).map((s) => expandVariantGroup(s.trim()).split(/\s+/g)).flat());
|
|
1209
|
+
inlineResult = toArray(result).filter((i) => !isString(i)).map((i) => ({ handles: [], value: i }));
|
|
1232
1210
|
}
|
|
1233
1211
|
if (!result) {
|
|
1234
1212
|
const matched = isString(input) ? await this.matchVariants(input) : [input];
|
|
1235
1213
|
for (const match of matched) {
|
|
1236
|
-
const [raw, inputWithoutVariant] = match;
|
|
1214
|
+
const [raw, inputWithoutVariant, handles] = match;
|
|
1237
1215
|
if (raw !== inputWithoutVariant) {
|
|
1238
1216
|
const expanded = await this.expandShortcut(inputWithoutVariant, context, depth - 1);
|
|
1239
|
-
if (expanded)
|
|
1240
|
-
|
|
1217
|
+
if (expanded) {
|
|
1218
|
+
stringResult = expanded[0].filter(isString).map((item) => raw.replace(inputWithoutVariant, item));
|
|
1219
|
+
inlineResult = expanded[0].filter((i) => !isString(i)).map((item) => {
|
|
1220
|
+
return { handles: [...item.handles, ...handles], value: item.value };
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1241
1223
|
}
|
|
1242
1224
|
}
|
|
1243
1225
|
}
|
|
1244
|
-
if (!
|
|
1226
|
+
if (!stringResult?.length && !inlineResult?.length)
|
|
1245
1227
|
return;
|
|
1246
1228
|
return [
|
|
1247
|
-
|
|
1229
|
+
[
|
|
1230
|
+
await Promise.all(toArray(stringResult).map(async (s) => (await this.expandShortcut(s, context, depth - 1))?.[0] || [s])),
|
|
1231
|
+
inlineResult
|
|
1232
|
+
].flat(2).filter((x) => !!x),
|
|
1248
1233
|
meta
|
|
1249
1234
|
];
|
|
1250
1235
|
}
|
|
1251
1236
|
async stringifyShortcuts(parent, context, expanded, meta = { layer: this.config.shortcutsLayer }) {
|
|
1252
1237
|
const layerMap = new BetterMap();
|
|
1253
1238
|
const parsed = (await Promise.all(uniq(expanded).map(async (i) => {
|
|
1254
|
-
const result = isString(i) ? await this.parseUtil(i, context, true, meta.prefix) : [[Number.POSITIVE_INFINITY, "{inline}", normalizeCSSEntries(i), void 0,
|
|
1239
|
+
const result = isString(i) ? await this.parseUtil(i, context, true, meta.prefix) : [[Number.POSITIVE_INFINITY, "{inline}", normalizeCSSEntries(i.value), void 0, i.handles]];
|
|
1255
1240
|
if (!result && this.config.warn)
|
|
1256
1241
|
warnOnce(`unmatched utility "${i}" in shortcut "${parent[1]}"`);
|
|
1257
1242
|
return result || [];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.65.
|
|
4
|
+
"version": "0.65.3",
|
|
5
5
|
"description": "The instant on-demand Atomic CSS engine.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -37,11 +37,12 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"magic-string": "^0.30.
|
|
41
|
-
"unconfig": "~0.
|
|
40
|
+
"magic-string": "^0.30.17",
|
|
41
|
+
"unconfig": "~0.6.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "unbuild",
|
|
45
|
-
"stub": "unbuild --stub"
|
|
45
|
+
"stub": "unbuild --stub",
|
|
46
|
+
"test:attw": "attw --pack --config-path ../../.attw-esm-only.json"
|
|
46
47
|
}
|
|
47
48
|
}
|