@unocss/core 0.47.6 → 0.48.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +24 -3
- package/dist/index.mjs +7 -7
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -219,8 +219,8 @@ function withLayer(layer, rules) {
|
|
|
219
219
|
return rules;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
const regexClassGroup = /((?:[
|
|
223
|
-
function expandVariantGroup(str,
|
|
222
|
+
const regexClassGroup = /((?:[!@\w+:_/-]|\[&?>?:?.*\])+?)([:-])\(((?:[~!\w\s:/\\,%#.$?-]|\[.*?\])+?)\)(?!\s*?=>)/gm;
|
|
223
|
+
function expandVariantGroup(str, separators = ["-", ":"], depth = 5) {
|
|
224
224
|
regexClassGroup.lastIndex = 0;
|
|
225
225
|
let hasChanged = false;
|
|
226
226
|
let content = str.toString();
|
|
@@ -229,7 +229,7 @@ function expandVariantGroup(str, seperators = ["-", ":"], depth = 5) {
|
|
|
229
229
|
content = content.replace(
|
|
230
230
|
regexClassGroup,
|
|
231
231
|
(from, pre, sep, body) => {
|
|
232
|
-
if (!
|
|
232
|
+
if (!separators.includes(sep))
|
|
233
233
|
return from;
|
|
234
234
|
return body.split(/\s/g).filter(Boolean).map((i) => i === "~" ? pre : i.replace(/^(!?)(.*)/, `$1${pre}${sep}$2`)).join(" ");
|
|
235
235
|
}
|
|
@@ -431,7 +431,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
431
431
|
};
|
|
432
432
|
}
|
|
433
433
|
|
|
434
|
-
const version = "0.
|
|
434
|
+
const version = "0.48.1";
|
|
435
435
|
|
|
436
436
|
class UnoGenerator {
|
|
437
437
|
constructor(userConfig = {}, defaults = {}) {
|
|
@@ -849,17 +849,17 @@ class UnoGenerator {
|
|
|
849
849
|
return result || [];
|
|
850
850
|
}))).flat(1).filter(Boolean).sort((a, b) => a[0] - b[0]);
|
|
851
851
|
const [raw, , parentVariants] = parent;
|
|
852
|
-
const
|
|
852
|
+
const rawStringifiedUtil = [];
|
|
853
853
|
for (const item of parsed) {
|
|
854
854
|
if (isRawUtil(item)) {
|
|
855
|
-
|
|
855
|
+
rawStringifiedUtil.push([item[0], void 0, item[1], void 0, item[2], context, void 0]);
|
|
856
856
|
continue;
|
|
857
857
|
}
|
|
858
858
|
const { selector, entries, parent: parent2, sort, noMerge } = this.applyVariants(item, [...item[4], ...parentVariants], raw);
|
|
859
859
|
const mapItem = selectorMap.getFallback(selector, parent2, [[], item[0]]);
|
|
860
860
|
mapItem[0].push([entries, !!(noMerge ?? item[3]?.noMerge), sort ?? 0]);
|
|
861
861
|
}
|
|
862
|
-
return
|
|
862
|
+
return rawStringifiedUtil.concat(selectorMap.map(([e2, index], selector, joinedParents) => {
|
|
863
863
|
const stringify = (flatten, noMerge, entrySortPair) => {
|
|
864
864
|
const maxSort = Math.max(...entrySortPair.map((e3) => e3[1]));
|
|
865
865
|
const entriesList = entrySortPair.map((e3) => e3[0]);
|
package/dist/index.d.ts
CHANGED
|
@@ -132,8 +132,8 @@ declare class BetterMap<K, V> extends Map<K, V> {
|
|
|
132
132
|
declare function withLayer<T extends {}>(layer: string, rules: Rule<T>[]): Rule<T>[];
|
|
133
133
|
|
|
134
134
|
declare const regexClassGroup: RegExp;
|
|
135
|
-
declare function expandVariantGroup(str: string,
|
|
136
|
-
declare function expandVariantGroup(str: MagicString,
|
|
135
|
+
declare function expandVariantGroup(str: string, separators?: string[], depth?: number): string;
|
|
136
|
+
declare function expandVariantGroup(str: MagicString, separators?: string[], depth?: number): MagicString;
|
|
137
137
|
|
|
138
138
|
declare function warnOnce(msg: string): void;
|
|
139
139
|
|
|
@@ -620,6 +620,12 @@ interface UnocssPluginContext<Config extends UserConfig = UserConfig> {
|
|
|
620
620
|
modules: BetterMap<string, string>;
|
|
621
621
|
/** Module IDs that been affected by UnoCSS */
|
|
622
622
|
affectedModules: Set<string>;
|
|
623
|
+
/** Pending promises */
|
|
624
|
+
tasks: Promise<any>[];
|
|
625
|
+
/**
|
|
626
|
+
* Await all pending tasks
|
|
627
|
+
*/
|
|
628
|
+
flushTasks(): Promise<any>;
|
|
623
629
|
filter: (code: string, id: string) => boolean;
|
|
624
630
|
extract: (code: string, id?: string) => Promise<void>;
|
|
625
631
|
reloadConfig: () => Promise<LoadConfigResult<Config>>;
|
|
@@ -662,6 +668,17 @@ interface SourceCodeTransformer {
|
|
|
662
668
|
*/
|
|
663
669
|
transform: (code: MagicString, id: string, ctx: UnocssPluginContext) => Awaitable<void>;
|
|
664
670
|
}
|
|
671
|
+
interface ExtraContentOptions {
|
|
672
|
+
/**
|
|
673
|
+
* Glob patterns to match the files to be extracted
|
|
674
|
+
* In dev mode, the files will be watched and trigger HMR
|
|
675
|
+
*/
|
|
676
|
+
filesystem?: string[];
|
|
677
|
+
/**
|
|
678
|
+
* Plain text to be extracted
|
|
679
|
+
*/
|
|
680
|
+
plain?: string[];
|
|
681
|
+
}
|
|
665
682
|
/**
|
|
666
683
|
* For other modules to aggregate the options
|
|
667
684
|
*/
|
|
@@ -688,6 +705,10 @@ interface PluginOptions {
|
|
|
688
705
|
* Custom transformers to the source code
|
|
689
706
|
*/
|
|
690
707
|
transformers?: SourceCodeTransformer[];
|
|
708
|
+
/**
|
|
709
|
+
* Extra content outside of build pipeline (assets, backend, etc.) to be extracted
|
|
710
|
+
*/
|
|
711
|
+
extraContent?: ExtraContentOptions;
|
|
691
712
|
}
|
|
692
713
|
interface UserConfig<Theme extends {} = {}> extends ConfigBase<Theme>, UserOnlyOptions<Theme>, GeneratorOptions, PluginOptions, CliOptions {
|
|
693
714
|
}
|
|
@@ -789,4 +810,4 @@ declare const extractorSplit: Extractor;
|
|
|
789
810
|
|
|
790
811
|
declare const extractorSvelte: Extractor;
|
|
791
812
|
|
|
792
|
-
export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BetterMap, BlocklistRule, CONTROL_SHORTCUT_NO_MERGE, CSSColorValue, CSSEntries, CSSObject, CSSValue, CSSValues, CliEntryItem, CliOptions, ConfigBase, DeepPartial, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateOptions, GenerateResult, GeneratorOptions, ParsedColorValue, ParsedUtil, PartialByKeys, PluginOptions, Postprocessor, Preflight, PreflightContext, PreparedRule, Preprocessor, Preset, PresetOptions, RGBAColorValue, RawUtil, Replacement, RequiredByKey, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, Shift, Shortcut, ShortcutValue, SourceCodeTransformer, SourceCodeTransformerEnforce, SourceMap, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, SuggestResult, ThemeExtender, TransformResult, TwoKeyMap, UnoGenerator, UnocssPluginContext, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, ValueHandler, ValueHandlerCallback, Variant, VariantContext, VariantFunction, VariantHandler, VariantHandlerContext, VariantMatchedResult, VariantObject, arbitraryPropertyRE, attributifyRE, clearIdenticalEntries, clone, createGenerator, createValueHandler, cssIdRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit, extractorSvelte, hasScopePlaceholder, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, mergeDeep, movePseudoElementsEnd, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, regexClassGroup, regexScopePlaceholder, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer };
|
|
813
|
+
export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BetterMap, BlocklistRule, CONTROL_SHORTCUT_NO_MERGE, CSSColorValue, CSSEntries, CSSObject, CSSValue, CSSValues, CliEntryItem, CliOptions, ConfigBase, DeepPartial, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, ExtraContentOptions, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateOptions, GenerateResult, GeneratorOptions, ParsedColorValue, ParsedUtil, PartialByKeys, PluginOptions, Postprocessor, Preflight, PreflightContext, PreparedRule, Preprocessor, Preset, PresetOptions, RGBAColorValue, RawUtil, Replacement, RequiredByKey, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, Shift, Shortcut, ShortcutValue, SourceCodeTransformer, SourceCodeTransformerEnforce, SourceMap, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, SuggestResult, ThemeExtender, TransformResult, TwoKeyMap, UnoGenerator, UnocssPluginContext, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, ValueHandler, ValueHandlerCallback, Variant, VariantContext, VariantFunction, VariantHandler, VariantHandlerContext, VariantMatchedResult, VariantObject, arbitraryPropertyRE, attributifyRE, clearIdenticalEntries, clone, createGenerator, createValueHandler, cssIdRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit, extractorSvelte, hasScopePlaceholder, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, mergeDeep, movePseudoElementsEnd, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, regexClassGroup, regexScopePlaceholder, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer };
|
package/dist/index.mjs
CHANGED
|
@@ -215,8 +215,8 @@ function withLayer(layer, rules) {
|
|
|
215
215
|
return rules;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
const regexClassGroup = /((?:[
|
|
219
|
-
function expandVariantGroup(str,
|
|
218
|
+
const regexClassGroup = /((?:[!@\w+:_/-]|\[&?>?:?.*\])+?)([:-])\(((?:[~!\w\s:/\\,%#.$?-]|\[.*?\])+?)\)(?!\s*?=>)/gm;
|
|
219
|
+
function expandVariantGroup(str, separators = ["-", ":"], depth = 5) {
|
|
220
220
|
regexClassGroup.lastIndex = 0;
|
|
221
221
|
let hasChanged = false;
|
|
222
222
|
let content = str.toString();
|
|
@@ -225,7 +225,7 @@ function expandVariantGroup(str, seperators = ["-", ":"], depth = 5) {
|
|
|
225
225
|
content = content.replace(
|
|
226
226
|
regexClassGroup,
|
|
227
227
|
(from, pre, sep, body) => {
|
|
228
|
-
if (!
|
|
228
|
+
if (!separators.includes(sep))
|
|
229
229
|
return from;
|
|
230
230
|
return body.split(/\s/g).filter(Boolean).map((i) => i === "~" ? pre : i.replace(/^(!?)(.*)/, `$1${pre}${sep}$2`)).join(" ");
|
|
231
231
|
}
|
|
@@ -427,7 +427,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
427
427
|
};
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
-
const version = "0.
|
|
430
|
+
const version = "0.48.1";
|
|
431
431
|
|
|
432
432
|
class UnoGenerator {
|
|
433
433
|
constructor(userConfig = {}, defaults = {}) {
|
|
@@ -845,17 +845,17 @@ class UnoGenerator {
|
|
|
845
845
|
return result || [];
|
|
846
846
|
}))).flat(1).filter(Boolean).sort((a, b) => a[0] - b[0]);
|
|
847
847
|
const [raw, , parentVariants] = parent;
|
|
848
|
-
const
|
|
848
|
+
const rawStringifiedUtil = [];
|
|
849
849
|
for (const item of parsed) {
|
|
850
850
|
if (isRawUtil(item)) {
|
|
851
|
-
|
|
851
|
+
rawStringifiedUtil.push([item[0], void 0, item[1], void 0, item[2], context, void 0]);
|
|
852
852
|
continue;
|
|
853
853
|
}
|
|
854
854
|
const { selector, entries, parent: parent2, sort, noMerge } = this.applyVariants(item, [...item[4], ...parentVariants], raw);
|
|
855
855
|
const mapItem = selectorMap.getFallback(selector, parent2, [[], item[0]]);
|
|
856
856
|
mapItem[0].push([entries, !!(noMerge ?? item[3]?.noMerge), sort ?? 0]);
|
|
857
857
|
}
|
|
858
|
-
return
|
|
858
|
+
return rawStringifiedUtil.concat(selectorMap.map(([e2, index], selector, joinedParents) => {
|
|
859
859
|
const stringify = (flatten, noMerge, entrySortPair) => {
|
|
860
860
|
const maxSort = Math.max(...entrySortPair.map((e3) => e3[1]));
|
|
861
861
|
const entriesList = entrySortPair.map((e3) => e3[0]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.1",
|
|
4
4
|
"description": "The instant on-demand Atomic CSS engine.",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"magic-string": "^0.
|
|
40
|
+
"magic-string": "^0.27.0",
|
|
41
41
|
"unconfig": "^0.3.7"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|