@unocss/core 0.4.7 → 0.4.8
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.ts +2 -3
- package/dist/index.js +8 -11
- package/dist/index.mjs +8 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ declare class UnoGenerator {
|
|
|
12
12
|
applyVariants(parsed: ParsedUtil, variantHandlers?: VariantHandler[], raw?: string): readonly [string, CSSEntries, string | undefined];
|
|
13
13
|
parseUtil(input: string | VariantMatchedResult): Promise<ParsedUtil | RawUtil | undefined>;
|
|
14
14
|
stringifyUtil(parsed?: ParsedUtil | RawUtil): StringifiedUtil | undefined;
|
|
15
|
-
expandShortcut(processed: string): string[] | undefined;
|
|
15
|
+
expandShortcut(processed: string, depth?: number): string[] | undefined;
|
|
16
16
|
stringifyShortcuts(parent: VariantMatchedResult, expanded: string[]): Promise<StringifiedUtil[]>;
|
|
17
17
|
isExcluded(raw: string): boolean;
|
|
18
18
|
}
|
|
@@ -164,7 +164,6 @@ declare type StringifiedUtil = readonly [
|
|
|
164
164
|
string,
|
|
165
165
|
string | undefined
|
|
166
166
|
];
|
|
167
|
-
declare function defineConfig(config: UserConfig): UserConfig<{}>;
|
|
168
167
|
|
|
169
168
|
declare function escapeRegExp(string: string): string;
|
|
170
169
|
/**
|
|
@@ -208,4 +207,4 @@ declare class BetterMap<K, V> extends Map<K, V> {
|
|
|
208
207
|
|
|
209
208
|
declare const extractorSplit: Extractor;
|
|
210
209
|
|
|
211
|
-
export { ArgumentType, Awaitable, BetterMap, CSSEntries, CSSObject, ConfigBase, DeepPartial, DynamicRule, DynamicShortcut, ExcludeRule, Extractor, GenerateResult, GeneratorOptions, ParsedUtil, Preset, RawUtil, ResolvedConfig, RestArgs, Rule, RuleContext, Shift, Shortcut, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, TwoKeyMap, UnoGenerator, UserConfig, UserConfigDefaults, UserShortcuts, Variant, VariantFunction, VariantHandler, VariantMatchedResult, VariantObject, attributifyRE, createGenerator,
|
|
210
|
+
export { ArgumentType, Awaitable, BetterMap, CSSEntries, CSSObject, ConfigBase, DeepPartial, DynamicRule, DynamicShortcut, ExcludeRule, Extractor, GenerateResult, GeneratorOptions, ParsedUtil, Preset, RawUtil, ResolvedConfig, RestArgs, Rule, RuleContext, Shift, Shortcut, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, TwoKeyMap, UnoGenerator, UserConfig, UserConfigDefaults, UserShortcuts, Variant, VariantFunction, VariantHandler, VariantMatchedResult, VariantObject, attributifyRE, createGenerator, e, entriesToCss, escapeRegExp, escapeSelector, extractorSplit, hasScopePlaceholder, hex2rgba, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isValidSelector, mergeDeep, mergeSet, normalizeVariant, toArray, uniq, validateFilterRE };
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,6 @@ __export(exports, {
|
|
|
13
13
|
UnoGenerator: () => UnoGenerator,
|
|
14
14
|
attributifyRE: () => attributifyRE,
|
|
15
15
|
createGenerator: () => createGenerator,
|
|
16
|
-
defineConfig: () => defineConfig,
|
|
17
16
|
e: () => e,
|
|
18
17
|
entriesToCss: () => entriesToCss,
|
|
19
18
|
escapeRegExp: () => escapeRegExp,
|
|
@@ -35,11 +34,6 @@ __export(exports, {
|
|
|
35
34
|
validateFilterRE: () => validateFilterRE
|
|
36
35
|
});
|
|
37
36
|
|
|
38
|
-
// src/types.ts
|
|
39
|
-
function defineConfig(config) {
|
|
40
|
-
return config;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
37
|
// src/utils/escape.ts
|
|
44
38
|
function escapeRegExp(string) {
|
|
45
39
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -340,7 +334,7 @@ var UnoGenerator = class {
|
|
|
340
334
|
return;
|
|
341
335
|
}
|
|
342
336
|
const expanded = this.expandShortcut(applied[1]);
|
|
343
|
-
if (expanded) {
|
|
337
|
+
if (expanded == null ? void 0 : expanded.length) {
|
|
344
338
|
const utils = await this.stringifyShortcuts(applied, expanded);
|
|
345
339
|
if (utils.length) {
|
|
346
340
|
hit(raw, utils);
|
|
@@ -467,12 +461,16 @@ ${rules}
|
|
|
467
461
|
return;
|
|
468
462
|
return [parsed[0], selector, body, mediaQuery];
|
|
469
463
|
}
|
|
470
|
-
expandShortcut(processed) {
|
|
464
|
+
expandShortcut(processed, depth = 3) {
|
|
465
|
+
if (depth === 0)
|
|
466
|
+
return;
|
|
471
467
|
let result;
|
|
472
468
|
for (const s of this.config.shortcuts) {
|
|
473
469
|
if (isStaticShortcut(s)) {
|
|
474
|
-
if (s[0] === processed)
|
|
470
|
+
if (s[0] === processed) {
|
|
475
471
|
result = s[1];
|
|
472
|
+
break;
|
|
473
|
+
}
|
|
476
474
|
} else {
|
|
477
475
|
const match = processed.match(s[0]);
|
|
478
476
|
if (match)
|
|
@@ -485,7 +483,7 @@ ${rules}
|
|
|
485
483
|
return;
|
|
486
484
|
if (typeof result === "string")
|
|
487
485
|
result = result.split(/ /g);
|
|
488
|
-
return result;
|
|
486
|
+
return uniq(result.flatMap((r) => this.expandShortcut(r, depth - 1) || [r]));
|
|
489
487
|
}
|
|
490
488
|
async stringifyShortcuts(parent, expanded) {
|
|
491
489
|
const selectorMap = new TwoKeyMap();
|
|
@@ -536,7 +534,6 @@ function normalizeEntries(obj) {
|
|
|
536
534
|
UnoGenerator,
|
|
537
535
|
attributifyRE,
|
|
538
536
|
createGenerator,
|
|
539
|
-
defineConfig,
|
|
540
537
|
e,
|
|
541
538
|
entriesToCss,
|
|
542
539
|
escapeRegExp,
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
// src/types.ts
|
|
2
|
-
function defineConfig(config) {
|
|
3
|
-
return config;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
1
|
// src/utils/escape.ts
|
|
7
2
|
function escapeRegExp(string) {
|
|
8
3
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -303,7 +298,7 @@ var UnoGenerator = class {
|
|
|
303
298
|
return;
|
|
304
299
|
}
|
|
305
300
|
const expanded = this.expandShortcut(applied[1]);
|
|
306
|
-
if (expanded) {
|
|
301
|
+
if (expanded == null ? void 0 : expanded.length) {
|
|
307
302
|
const utils = await this.stringifyShortcuts(applied, expanded);
|
|
308
303
|
if (utils.length) {
|
|
309
304
|
hit(raw, utils);
|
|
@@ -430,12 +425,16 @@ ${rules}
|
|
|
430
425
|
return;
|
|
431
426
|
return [parsed[0], selector, body, mediaQuery];
|
|
432
427
|
}
|
|
433
|
-
expandShortcut(processed) {
|
|
428
|
+
expandShortcut(processed, depth = 3) {
|
|
429
|
+
if (depth === 0)
|
|
430
|
+
return;
|
|
434
431
|
let result;
|
|
435
432
|
for (const s of this.config.shortcuts) {
|
|
436
433
|
if (isStaticShortcut(s)) {
|
|
437
|
-
if (s[0] === processed)
|
|
434
|
+
if (s[0] === processed) {
|
|
438
435
|
result = s[1];
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
439
438
|
} else {
|
|
440
439
|
const match = processed.match(s[0]);
|
|
441
440
|
if (match)
|
|
@@ -448,7 +447,7 @@ ${rules}
|
|
|
448
447
|
return;
|
|
449
448
|
if (typeof result === "string")
|
|
450
449
|
result = result.split(/ /g);
|
|
451
|
-
return result;
|
|
450
|
+
return uniq(result.flatMap((r) => this.expandShortcut(r, depth - 1) || [r]));
|
|
452
451
|
}
|
|
453
452
|
async stringifyShortcuts(parent, expanded) {
|
|
454
453
|
const selectorMap = new TwoKeyMap();
|
|
@@ -498,7 +497,6 @@ export {
|
|
|
498
497
|
UnoGenerator,
|
|
499
498
|
attributifyRE,
|
|
500
499
|
createGenerator,
|
|
501
|
-
defineConfig,
|
|
502
500
|
e,
|
|
503
501
|
entriesToCss,
|
|
504
502
|
escapeRegExp,
|