@unocss/core 0.65.0 → 0.65.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 +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.mjs +18 -12
- package/package.json +5 -4
package/dist/index.d.mts
CHANGED
|
@@ -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> {
|
|
@@ -1062,4 +1066,4 @@ declare const defaultSplitRE: RegExp;
|
|
|
1062
1066
|
declare const splitWithVariantGroupRE: RegExp;
|
|
1063
1067
|
declare const extractorSplit: Extractor;
|
|
1064
1068
|
|
|
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 };
|
|
1069
|
+
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
|
@@ -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> {
|
|
@@ -1062,4 +1066,4 @@ declare const defaultSplitRE: RegExp;
|
|
|
1062
1066
|
declare const splitWithVariantGroupRE: RegExp;
|
|
1063
1067
|
declare const extractorSplit: Extractor;
|
|
1064
1068
|
|
|
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 };
|
|
1069
|
+
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
|
@@ -653,7 +653,7 @@ function definePreset(preset) {
|
|
|
653
653
|
return preset;
|
|
654
654
|
}
|
|
655
655
|
|
|
656
|
-
const version = "0.65.
|
|
656
|
+
const version = "0.65.2";
|
|
657
657
|
|
|
658
658
|
function createNanoEvents() {
|
|
659
659
|
return {
|
|
@@ -1196,6 +1196,8 @@ class UnoGeneratorInternal {
|
|
|
1196
1196
|
} : noop;
|
|
1197
1197
|
let meta;
|
|
1198
1198
|
let result;
|
|
1199
|
+
let stringResult;
|
|
1200
|
+
let inlineResult;
|
|
1199
1201
|
for (const s of this.config.shortcuts) {
|
|
1200
1202
|
let unprefixed = input;
|
|
1201
1203
|
if (s[2]?.prefix) {
|
|
@@ -1224,34 +1226,38 @@ class UnoGeneratorInternal {
|
|
|
1224
1226
|
}
|
|
1225
1227
|
}
|
|
1226
1228
|
if (result) {
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
return expandVariantGroup(s.trim()).split(/\s+/g);
|
|
1230
|
-
return s;
|
|
1231
|
-
}).flat();
|
|
1229
|
+
stringResult = uniq(toArray(result).filter(isString).map((s) => expandVariantGroup(s.trim()).split(/\s+/g)).flat());
|
|
1230
|
+
inlineResult = toArray(result).filter((i) => !isString(i)).map((i) => ({ handles: [], value: i }));
|
|
1232
1231
|
}
|
|
1233
1232
|
if (!result) {
|
|
1234
1233
|
const matched = isString(input) ? await this.matchVariants(input) : [input];
|
|
1235
1234
|
for (const match of matched) {
|
|
1236
|
-
const [raw, inputWithoutVariant] = match;
|
|
1235
|
+
const [raw, inputWithoutVariant, handles] = match;
|
|
1237
1236
|
if (raw !== inputWithoutVariant) {
|
|
1238
1237
|
const expanded = await this.expandShortcut(inputWithoutVariant, context, depth - 1);
|
|
1239
|
-
if (expanded)
|
|
1240
|
-
|
|
1238
|
+
if (expanded) {
|
|
1239
|
+
stringResult = expanded[0].filter(isString).map((item) => raw.replace(inputWithoutVariant, item));
|
|
1240
|
+
inlineResult = expanded[0].filter((i) => !isString(i)).map((item) => {
|
|
1241
|
+
return { handles: [...item.handles, ...handles], value: item.value };
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1241
1244
|
}
|
|
1242
1245
|
}
|
|
1243
1246
|
}
|
|
1244
|
-
if (!
|
|
1247
|
+
if (!stringResult?.length && !inlineResult?.length)
|
|
1245
1248
|
return;
|
|
1246
1249
|
return [
|
|
1247
|
-
|
|
1250
|
+
[
|
|
1251
|
+
await Promise.all(toArray(stringResult).map(async (s) => (await this.expandShortcut(s, context, depth - 1))?.[0] || [s])),
|
|
1252
|
+
inlineResult
|
|
1253
|
+
].flat(2).filter((x) => !!x),
|
|
1248
1254
|
meta
|
|
1249
1255
|
];
|
|
1250
1256
|
}
|
|
1251
1257
|
async stringifyShortcuts(parent, context, expanded, meta = { layer: this.config.shortcutsLayer }) {
|
|
1252
1258
|
const layerMap = new BetterMap();
|
|
1253
1259
|
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,
|
|
1260
|
+
const result = isString(i) ? await this.parseUtil(i, context, true, meta.prefix) : [[Number.POSITIVE_INFINITY, "{inline}", normalizeCSSEntries(i.value), void 0, i.handles]];
|
|
1255
1261
|
if (!result && this.config.warn)
|
|
1256
1262
|
warnOnce(`unmatched utility "${i}" in shortcut "${parent[1]}"`);
|
|
1257
1263
|
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.2",
|
|
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
|
}
|