@unocss/core 0.50.6 → 0.50.7
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 +14 -8
- package/dist/index.d.ts +4 -2
- package/dist/index.mjs +13 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -326,11 +326,12 @@ function createValueHandler(handlers) {
|
|
|
326
326
|
return handler;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
const defaultSplitRE =
|
|
329
|
+
const defaultSplitRE = /[\\:]?[\s'"`;{}]+/g;
|
|
330
|
+
const splitWithVariantGroupRE = /[\\:]?([\s"'`;<>*]|:\(|\)"|\)\s)/g;
|
|
330
331
|
const quotedArbitraryValuesRE = /(?:[\w&:[\]-]|\[\S+=\S+\])+\[\\?['"]?\S+?['"]\]\]?[\w:-]*/g;
|
|
331
|
-
const arbitraryPropertyRE = /\[(\\\W|[\w-])+:[
|
|
332
|
-
const arbitraryPropertyCandidateRE =
|
|
333
|
-
|
|
332
|
+
const arbitraryPropertyRE = /\[(\\\W|[\w-])+:[^\s:]*?("\S+?"|'\S+?'|`\S+?`|[^\s:]+?)[^\s:]*?\)?\]/g;
|
|
333
|
+
const arbitraryPropertyCandidateRE = /^\[(\\\W|[\w-])+:['"]?\S+?['"]?\]$/;
|
|
334
|
+
function splitCode(code) {
|
|
334
335
|
const result = /* @__PURE__ */ new Set();
|
|
335
336
|
for (const match of code.matchAll(arbitraryPropertyRE)) {
|
|
336
337
|
if (!code[match.index - 1]?.match(/^[\s'"`]/))
|
|
@@ -340,10 +341,11 @@ const splitCode = (code) => {
|
|
|
340
341
|
for (const match of code.matchAll(quotedArbitraryValuesRE))
|
|
341
342
|
result.add(match[0]);
|
|
342
343
|
code.split(defaultSplitRE).forEach((match) => {
|
|
343
|
-
isValidSelector(match) && !arbitraryPropertyCandidateRE.test(match)
|
|
344
|
+
if (isValidSelector(match) && !arbitraryPropertyCandidateRE.test(match))
|
|
345
|
+
result.add(match);
|
|
344
346
|
});
|
|
345
347
|
return [...result];
|
|
346
|
-
}
|
|
348
|
+
}
|
|
347
349
|
const extractorSplit = {
|
|
348
350
|
name: "split",
|
|
349
351
|
order: 0,
|
|
@@ -484,7 +486,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
484
486
|
};
|
|
485
487
|
}
|
|
486
488
|
|
|
487
|
-
const version = "0.50.
|
|
489
|
+
const version = "0.50.7";
|
|
488
490
|
|
|
489
491
|
class UnoGenerator {
|
|
490
492
|
constructor(userConfig = {}, defaults = {}) {
|
|
@@ -950,7 +952,9 @@ function createGenerator(config, defaults) {
|
|
|
950
952
|
return new UnoGenerator(config, defaults);
|
|
951
953
|
}
|
|
952
954
|
const regexScopePlaceholder = /\s\$\$\s+/g;
|
|
953
|
-
|
|
955
|
+
function hasScopePlaceholder(css) {
|
|
956
|
+
return css.match(/\s\$\$\s/);
|
|
957
|
+
}
|
|
954
958
|
function applyScope(css, scope) {
|
|
955
959
|
if (hasScopePlaceholder(css))
|
|
956
960
|
return css.replace(regexScopePlaceholder, scope ? ` ${scope} ` : " ");
|
|
@@ -979,6 +983,7 @@ exports.collapseVariantGroup = collapseVariantGroup;
|
|
|
979
983
|
exports.createGenerator = createGenerator;
|
|
980
984
|
exports.createValueHandler = createValueHandler;
|
|
981
985
|
exports.cssIdRE = cssIdRE;
|
|
986
|
+
exports.defaultSplitRE = defaultSplitRE;
|
|
982
987
|
exports.e = e;
|
|
983
988
|
exports.entriesToCss = entriesToCss;
|
|
984
989
|
exports.escapeRegExp = escapeRegExp;
|
|
@@ -1004,6 +1009,7 @@ exports.notNull = notNull;
|
|
|
1004
1009
|
exports.parseVariantGroup = parseVariantGroup;
|
|
1005
1010
|
exports.quotedArbitraryValuesRE = quotedArbitraryValuesRE;
|
|
1006
1011
|
exports.regexScopePlaceholder = regexScopePlaceholder;
|
|
1012
|
+
exports.splitWithVariantGroupRE = splitWithVariantGroupRE;
|
|
1007
1013
|
exports.toArray = toArray;
|
|
1008
1014
|
exports.toEscapedSelector = toEscapedSelector;
|
|
1009
1015
|
exports.uniq = uniq;
|
package/dist/index.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ declare class UnoGenerator<Theme extends {} = {}> {
|
|
|
79
79
|
}
|
|
80
80
|
declare function createGenerator<Theme extends {} = {}>(config?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): UnoGenerator<Theme>;
|
|
81
81
|
declare const regexScopePlaceholder: RegExp;
|
|
82
|
-
declare
|
|
82
|
+
declare function hasScopePlaceholder(css: string): RegExpMatchArray | null;
|
|
83
83
|
declare function toEscapedSelector(raw: string): string;
|
|
84
84
|
|
|
85
85
|
declare function escapeRegExp(string: string): string;
|
|
@@ -825,10 +825,12 @@ interface GenerateOptions {
|
|
|
825
825
|
scope?: string;
|
|
826
826
|
}
|
|
827
827
|
|
|
828
|
+
declare const defaultSplitRE: RegExp;
|
|
829
|
+
declare const splitWithVariantGroupRE: RegExp;
|
|
828
830
|
declare const quotedArbitraryValuesRE: RegExp;
|
|
829
831
|
declare const arbitraryPropertyRE: RegExp;
|
|
830
832
|
declare const extractorSplit: Extractor;
|
|
831
833
|
|
|
832
834
|
declare const extractorSvelte: Extractor;
|
|
833
835
|
|
|
834
|
-
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, collapseVariantGroup, createGenerator, createValueHandler, cssIdRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit, extractorSvelte, hasScopePlaceholder, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, makeRegexClassGroup, mergeDeep, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseVariantGroup, quotedArbitraryValuesRE, regexScopePlaceholder, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer };
|
|
836
|
+
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, collapseVariantGroup, createGenerator, createValueHandler, cssIdRE, defaultSplitRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit, extractorSvelte, hasScopePlaceholder, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, makeRegexClassGroup, mergeDeep, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseVariantGroup, quotedArbitraryValuesRE, regexScopePlaceholder, splitWithVariantGroupRE, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer };
|
package/dist/index.mjs
CHANGED
|
@@ -322,11 +322,12 @@ function createValueHandler(handlers) {
|
|
|
322
322
|
return handler;
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
const defaultSplitRE =
|
|
325
|
+
const defaultSplitRE = /[\\:]?[\s'"`;{}]+/g;
|
|
326
|
+
const splitWithVariantGroupRE = /[\\:]?([\s"'`;<>*]|:\(|\)"|\)\s)/g;
|
|
326
327
|
const quotedArbitraryValuesRE = /(?:[\w&:[\]-]|\[\S+=\S+\])+\[\\?['"]?\S+?['"]\]\]?[\w:-]*/g;
|
|
327
|
-
const arbitraryPropertyRE = /\[(\\\W|[\w-])+:[
|
|
328
|
-
const arbitraryPropertyCandidateRE =
|
|
329
|
-
|
|
328
|
+
const arbitraryPropertyRE = /\[(\\\W|[\w-])+:[^\s:]*?("\S+?"|'\S+?'|`\S+?`|[^\s:]+?)[^\s:]*?\)?\]/g;
|
|
329
|
+
const arbitraryPropertyCandidateRE = /^\[(\\\W|[\w-])+:['"]?\S+?['"]?\]$/;
|
|
330
|
+
function splitCode(code) {
|
|
330
331
|
const result = /* @__PURE__ */ new Set();
|
|
331
332
|
for (const match of code.matchAll(arbitraryPropertyRE)) {
|
|
332
333
|
if (!code[match.index - 1]?.match(/^[\s'"`]/))
|
|
@@ -336,10 +337,11 @@ const splitCode = (code) => {
|
|
|
336
337
|
for (const match of code.matchAll(quotedArbitraryValuesRE))
|
|
337
338
|
result.add(match[0]);
|
|
338
339
|
code.split(defaultSplitRE).forEach((match) => {
|
|
339
|
-
isValidSelector(match) && !arbitraryPropertyCandidateRE.test(match)
|
|
340
|
+
if (isValidSelector(match) && !arbitraryPropertyCandidateRE.test(match))
|
|
341
|
+
result.add(match);
|
|
340
342
|
});
|
|
341
343
|
return [...result];
|
|
342
|
-
}
|
|
344
|
+
}
|
|
343
345
|
const extractorSplit = {
|
|
344
346
|
name: "split",
|
|
345
347
|
order: 0,
|
|
@@ -480,7 +482,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
480
482
|
};
|
|
481
483
|
}
|
|
482
484
|
|
|
483
|
-
const version = "0.50.
|
|
485
|
+
const version = "0.50.7";
|
|
484
486
|
|
|
485
487
|
class UnoGenerator {
|
|
486
488
|
constructor(userConfig = {}, defaults = {}) {
|
|
@@ -946,7 +948,9 @@ function createGenerator(config, defaults) {
|
|
|
946
948
|
return new UnoGenerator(config, defaults);
|
|
947
949
|
}
|
|
948
950
|
const regexScopePlaceholder = /\s\$\$\s+/g;
|
|
949
|
-
|
|
951
|
+
function hasScopePlaceholder(css) {
|
|
952
|
+
return css.match(/\s\$\$\s/);
|
|
953
|
+
}
|
|
950
954
|
function applyScope(css, scope) {
|
|
951
955
|
if (hasScopePlaceholder(css))
|
|
952
956
|
return css.replace(regexScopePlaceholder, scope ? ` ${scope} ` : " ");
|
|
@@ -963,4 +967,4 @@ function defaultVariantHandler(input, next) {
|
|
|
963
967
|
return next(input);
|
|
964
968
|
}
|
|
965
969
|
|
|
966
|
-
export { BetterMap, CONTROL_SHORTCUT_NO_MERGE, TwoKeyMap, UnoGenerator, arbitraryPropertyRE, attributifyRE, clearIdenticalEntries, clone, collapseVariantGroup, createGenerator, createValueHandler, cssIdRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit, extractorSvelte, hasScopePlaceholder, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, makeRegexClassGroup, mergeDeep, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseVariantGroup, quotedArbitraryValuesRE, regexScopePlaceholder, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer };
|
|
970
|
+
export { BetterMap, CONTROL_SHORTCUT_NO_MERGE, TwoKeyMap, UnoGenerator, arbitraryPropertyRE, attributifyRE, clearIdenticalEntries, clone, collapseVariantGroup, createGenerator, createValueHandler, cssIdRE, defaultSplitRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit, extractorSvelte, hasScopePlaceholder, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, makeRegexClassGroup, mergeDeep, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseVariantGroup, quotedArbitraryValuesRE, regexScopePlaceholder, splitWithVariantGroupRE, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer };
|