@unocss/core 0.33.5 → 0.34.0
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 +13 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +13 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -457,7 +457,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
-
const version = "0.
|
|
460
|
+
const version = "0.34.0";
|
|
461
461
|
|
|
462
462
|
class UnoGenerator {
|
|
463
463
|
constructor(userConfig = {}, defaults = {}) {
|
|
@@ -661,7 +661,7 @@ class UnoGenerator {
|
|
|
661
661
|
processed = handler.matcher;
|
|
662
662
|
if (Array.isArray(handler.parent))
|
|
663
663
|
this.parentOrders.set(handler.parent[0], handler.parent[1]);
|
|
664
|
-
handlers.
|
|
664
|
+
handlers.unshift(handler);
|
|
665
665
|
variants.add(v);
|
|
666
666
|
applied = true;
|
|
667
667
|
break;
|
|
@@ -676,8 +676,9 @@ class UnoGenerator {
|
|
|
676
676
|
applyVariants(parsed, variantHandlers = parsed[4], raw = parsed[1]) {
|
|
677
677
|
const handlers = [...variantHandlers].sort((a, b) => (a.order || 0) - (b.order || 0));
|
|
678
678
|
const entries = handlers.reduce((p, v) => v.body?.(p) || p, parsed[2]);
|
|
679
|
+
const selector = handlers.reduce((p, v) => v.selector?.(p, entries) || p, toEscapedSelector(raw));
|
|
679
680
|
const obj = {
|
|
680
|
-
selector:
|
|
681
|
+
selector: movePseudoElementsEnd(selector),
|
|
681
682
|
entries,
|
|
682
683
|
parent: handlers.reduce((p, v) => Array.isArray(v.parent) ? v.parent[0] : v.parent || p, void 0),
|
|
683
684
|
layer: handlers.reduce((p, v) => v.layer || p, void 0),
|
|
@@ -840,6 +841,14 @@ function applyScope(css, scope) {
|
|
|
840
841
|
else
|
|
841
842
|
return scope ? `${scope} ${css}` : css;
|
|
842
843
|
}
|
|
844
|
+
function movePseudoElementsEnd(selector) {
|
|
845
|
+
const pseudoElements = selector.match(/::[\w-]+/g);
|
|
846
|
+
if (pseudoElements) {
|
|
847
|
+
pseudoElements.forEach((e2) => selector = selector.replace(e2, ""));
|
|
848
|
+
selector += pseudoElements.join("");
|
|
849
|
+
}
|
|
850
|
+
return selector;
|
|
851
|
+
}
|
|
843
852
|
const attributifyRe = /^\[(.+?)(~?=)"(.*)"\]$/;
|
|
844
853
|
function toEscapedSelector(raw) {
|
|
845
854
|
if (attributifyRe.test(raw))
|
|
@@ -875,6 +884,7 @@ exports.isValidSelector = isValidSelector;
|
|
|
875
884
|
exports.matchingPair = matchingPair;
|
|
876
885
|
exports.mergeDeep = mergeDeep;
|
|
877
886
|
exports.mergeSet = mergeSet;
|
|
887
|
+
exports.movePseudoElementsEnd = movePseudoElementsEnd;
|
|
878
888
|
exports.noop = noop;
|
|
879
889
|
exports.normalizeCSSEntries = normalizeCSSEntries;
|
|
880
890
|
exports.normalizeCSSValues = normalizeCSSValues;
|
package/dist/index.d.ts
CHANGED
|
@@ -80,6 +80,7 @@ declare class UnoGenerator {
|
|
|
80
80
|
declare function createGenerator(config?: UserConfig, defaults?: UserConfigDefaults): UnoGenerator;
|
|
81
81
|
declare const regexScopePlaceholder: RegExp;
|
|
82
82
|
declare const hasScopePlaceholder: (css: string) => RegExpMatchArray | null;
|
|
83
|
+
declare function movePseudoElementsEnd(selector: string): string;
|
|
83
84
|
declare function toEscapedSelector(raw: string): string;
|
|
84
85
|
|
|
85
86
|
declare function escapeRegExp(string: string): string;
|
|
@@ -721,4 +722,4 @@ declare const extractorSplit: Extractor;
|
|
|
721
722
|
|
|
722
723
|
declare const extractorSvelte: Extractor;
|
|
723
724
|
|
|
724
|
-
export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BetterMap, BlocklistRule, CONTROL_SHORTCUT_NO_MERGE, CSSColorValue, CSSEntries, CSSObject, CSSValues, ConfigBase, DeepPartial, DetailString, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, ExtractStringOptions, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateOptions, GenerateResult, GeneratorOptions, ParsedColorValue, ParsedUtil, PartialByKeys, PluginOptions, Postprocessor, Preflight, PreflightContext, Preprocessor, Preset, PresetOptions, RGBAColorValue, Range, RawUtil, Replacement, RequiredByKey, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, Shift, Shortcut, SourceCodeTransformer, SourceMap, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, SuggestResult, ThemeExtender, TransformResult, TwoKeyMap, UnoGenerator, UnocssPluginContext, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, ValueHandler, ValueHandlerCallback, Variant, VariantContext, VariantFunction, VariantHandler, VariantMatchedResult, VariantObject, attributifyRE, clearIdenticalEntries, clone, createGenerator, createValueHandler, cssIdRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractQuoted, extractorSplit, extractorSvelte, hasScopePlaceholder, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isValidSelector, matchingPair, mergeDeep, mergeSet, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, regexClassGroup, regexScopePlaceholder, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer };
|
|
725
|
+
export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BetterMap, BlocklistRule, CONTROL_SHORTCUT_NO_MERGE, CSSColorValue, CSSEntries, CSSObject, CSSValues, ConfigBase, DeepPartial, DetailString, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, ExtractStringOptions, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateOptions, GenerateResult, GeneratorOptions, ParsedColorValue, ParsedUtil, PartialByKeys, PluginOptions, Postprocessor, Preflight, PreflightContext, Preprocessor, Preset, PresetOptions, RGBAColorValue, Range, RawUtil, Replacement, RequiredByKey, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, Shift, Shortcut, SourceCodeTransformer, SourceMap, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, SuggestResult, ThemeExtender, TransformResult, TwoKeyMap, UnoGenerator, UnocssPluginContext, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, ValueHandler, ValueHandlerCallback, Variant, VariantContext, VariantFunction, VariantHandler, VariantMatchedResult, VariantObject, attributifyRE, clearIdenticalEntries, clone, createGenerator, createValueHandler, cssIdRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractQuoted, extractorSplit, extractorSvelte, hasScopePlaceholder, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isValidSelector, matchingPair, mergeDeep, mergeSet, movePseudoElementsEnd, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, regexClassGroup, regexScopePlaceholder, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer };
|
package/dist/index.mjs
CHANGED
|
@@ -453,7 +453,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
453
453
|
};
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
-
const version = "0.
|
|
456
|
+
const version = "0.34.0";
|
|
457
457
|
|
|
458
458
|
class UnoGenerator {
|
|
459
459
|
constructor(userConfig = {}, defaults = {}) {
|
|
@@ -657,7 +657,7 @@ class UnoGenerator {
|
|
|
657
657
|
processed = handler.matcher;
|
|
658
658
|
if (Array.isArray(handler.parent))
|
|
659
659
|
this.parentOrders.set(handler.parent[0], handler.parent[1]);
|
|
660
|
-
handlers.
|
|
660
|
+
handlers.unshift(handler);
|
|
661
661
|
variants.add(v);
|
|
662
662
|
applied = true;
|
|
663
663
|
break;
|
|
@@ -672,8 +672,9 @@ class UnoGenerator {
|
|
|
672
672
|
applyVariants(parsed, variantHandlers = parsed[4], raw = parsed[1]) {
|
|
673
673
|
const handlers = [...variantHandlers].sort((a, b) => (a.order || 0) - (b.order || 0));
|
|
674
674
|
const entries = handlers.reduce((p, v) => v.body?.(p) || p, parsed[2]);
|
|
675
|
+
const selector = handlers.reduce((p, v) => v.selector?.(p, entries) || p, toEscapedSelector(raw));
|
|
675
676
|
const obj = {
|
|
676
|
-
selector:
|
|
677
|
+
selector: movePseudoElementsEnd(selector),
|
|
677
678
|
entries,
|
|
678
679
|
parent: handlers.reduce((p, v) => Array.isArray(v.parent) ? v.parent[0] : v.parent || p, void 0),
|
|
679
680
|
layer: handlers.reduce((p, v) => v.layer || p, void 0),
|
|
@@ -836,6 +837,14 @@ function applyScope(css, scope) {
|
|
|
836
837
|
else
|
|
837
838
|
return scope ? `${scope} ${css}` : css;
|
|
838
839
|
}
|
|
840
|
+
function movePseudoElementsEnd(selector) {
|
|
841
|
+
const pseudoElements = selector.match(/::[\w-]+/g);
|
|
842
|
+
if (pseudoElements) {
|
|
843
|
+
pseudoElements.forEach((e2) => selector = selector.replace(e2, ""));
|
|
844
|
+
selector += pseudoElements.join("");
|
|
845
|
+
}
|
|
846
|
+
return selector;
|
|
847
|
+
}
|
|
839
848
|
const attributifyRe = /^\[(.+?)(~?=)"(.*)"\]$/;
|
|
840
849
|
function toEscapedSelector(raw) {
|
|
841
850
|
if (attributifyRe.test(raw))
|
|
@@ -843,4 +852,4 @@ function toEscapedSelector(raw) {
|
|
|
843
852
|
return `.${e(raw)}`;
|
|
844
853
|
}
|
|
845
854
|
|
|
846
|
-
export { BetterMap, CONTROL_SHORTCUT_NO_MERGE, TwoKeyMap, UnoGenerator, attributifyRE, clearIdenticalEntries, clone, createGenerator, createValueHandler, cssIdRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractQuoted, extractorSplit, extractorSvelte, hasScopePlaceholder, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isValidSelector, matchingPair, mergeDeep, mergeSet, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, regexClassGroup, regexScopePlaceholder, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer };
|
|
855
|
+
export { BetterMap, CONTROL_SHORTCUT_NO_MERGE, TwoKeyMap, UnoGenerator, attributifyRE, clearIdenticalEntries, clone, createGenerator, createValueHandler, cssIdRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractQuoted, extractorSplit, extractorSvelte, hasScopePlaceholder, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isValidSelector, matchingPair, mergeDeep, mergeSet, movePseudoElementsEnd, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, regexClassGroup, regexScopePlaceholder, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer };
|