@unocss/core 0.46.2 → 0.46.4
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 +3 -2
- package/dist/index.d.ts +36 -36
- package/dist/index.mjs +3 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -291,6 +291,7 @@ const extractorSplit = {
|
|
|
291
291
|
}
|
|
292
292
|
};
|
|
293
293
|
|
|
294
|
+
const rightTrimRe = /=$/;
|
|
294
295
|
const extractorSvelte = {
|
|
295
296
|
name: "svelte",
|
|
296
297
|
order: 0,
|
|
@@ -298,7 +299,7 @@ const extractorSvelte = {
|
|
|
298
299
|
let result = splitCode(code);
|
|
299
300
|
if (id && id.endsWith(".svelte")) {
|
|
300
301
|
result = result.map((r) => {
|
|
301
|
-
return r.startsWith("class:") ? r.slice(6) : r;
|
|
302
|
+
return r.startsWith("class:") ? r.slice(6).replace(rightTrimRe, "") : r;
|
|
302
303
|
});
|
|
303
304
|
}
|
|
304
305
|
return new Set(result);
|
|
@@ -416,7 +417,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
416
417
|
};
|
|
417
418
|
}
|
|
418
419
|
|
|
419
|
-
const version = "0.46.
|
|
420
|
+
const version = "0.46.4";
|
|
420
421
|
|
|
421
422
|
class UnoGenerator {
|
|
422
423
|
constructor(userConfig = {}, defaults = {}) {
|
package/dist/index.d.ts
CHANGED
|
@@ -51,33 +51,33 @@ declare class Emitter<Events extends EventsMap = DefaultEvents> {
|
|
|
51
51
|
emit<K extends keyof Events>(this: this, event: K, ...args: Parameters<Events[K]>): void;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
declare class UnoGenerator {
|
|
55
|
-
userConfig: UserConfig
|
|
56
|
-
defaults: UserConfigDefaults
|
|
54
|
+
declare class UnoGenerator<Theme extends {} = {}> {
|
|
55
|
+
userConfig: UserConfig<Theme>;
|
|
56
|
+
defaults: UserConfigDefaults<Theme>;
|
|
57
57
|
version: string;
|
|
58
58
|
private _cache;
|
|
59
|
-
config: ResolvedConfig
|
|
59
|
+
config: ResolvedConfig<Theme>;
|
|
60
60
|
blocked: Set<string>;
|
|
61
61
|
parentOrders: Map<string, number>;
|
|
62
62
|
events: Emitter<{
|
|
63
|
-
config: (config: ResolvedConfig) => void;
|
|
63
|
+
config: (config: ResolvedConfig<Theme>) => void;
|
|
64
64
|
}>;
|
|
65
|
-
constructor(userConfig?: UserConfig
|
|
66
|
-
setConfig(userConfig?: UserConfig
|
|
65
|
+
constructor(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>);
|
|
66
|
+
setConfig(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): void;
|
|
67
67
|
applyExtractors(code: string, id?: string, set?: Set<string>): Promise<Set<string>>;
|
|
68
|
-
makeContext(raw: string, applied: VariantMatchedResult): RuleContext<
|
|
69
|
-
parseToken(raw: string, alias?: string): Promise<StringifiedUtil[] | null | undefined>;
|
|
68
|
+
makeContext(raw: string, applied: VariantMatchedResult<Theme>): RuleContext<Theme>;
|
|
69
|
+
parseToken(raw: string, alias?: string): Promise<StringifiedUtil<Theme>[] | null | undefined>;
|
|
70
70
|
generate(input: string | Set<string> | string[], options?: GenerateOptions): Promise<GenerateResult>;
|
|
71
|
-
matchVariants(raw: string, current?: string): VariantMatchedResult
|
|
71
|
+
matchVariants(raw: string, current?: string): VariantMatchedResult<Theme>;
|
|
72
72
|
private applyVariants;
|
|
73
|
-
constructCustomCSS(context: Readonly<RuleContext
|
|
74
|
-
parseUtil(input: string | VariantMatchedResult
|
|
75
|
-
stringifyUtil(parsed?: ParsedUtil | RawUtil, context?: RuleContext): StringifiedUtil | undefined;
|
|
76
|
-
expandShortcut(input: string, context: RuleContext
|
|
77
|
-
stringifyShortcuts(parent: VariantMatchedResult
|
|
73
|
+
constructCustomCSS(context: Readonly<RuleContext<Theme>>, body: CSSObject | CSSEntries, overrideSelector?: string): string;
|
|
74
|
+
parseUtil(input: string | VariantMatchedResult<Theme>, context: RuleContext<Theme>, internal?: boolean, shortcutPrefix?: string | undefined): Promise<(ParsedUtil | RawUtil)[] | undefined>;
|
|
75
|
+
stringifyUtil(parsed?: ParsedUtil | RawUtil, context?: RuleContext<Theme>): StringifiedUtil<Theme> | undefined;
|
|
76
|
+
expandShortcut(input: string, context: RuleContext<Theme>, depth?: number): [ShortcutValue[], RuleMeta | undefined] | undefined;
|
|
77
|
+
stringifyShortcuts(parent: VariantMatchedResult<Theme>, context: RuleContext<Theme>, expanded: ShortcutValue[], meta?: RuleMeta): Promise<StringifiedUtil<Theme>[] | undefined>;
|
|
78
78
|
isBlocked(raw: string): boolean;
|
|
79
79
|
}
|
|
80
|
-
declare function createGenerator(config?: UserConfig
|
|
80
|
+
declare function createGenerator<Theme extends {} = {}>(config?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): UnoGenerator<Theme>;
|
|
81
81
|
declare const regexScopePlaceholder: RegExp;
|
|
82
82
|
declare const hasScopePlaceholder: (css: string) => RegExpMatchArray | null;
|
|
83
83
|
declare function movePseudoElementsEnd(selector: string): string;
|
|
@@ -97,8 +97,8 @@ declare function entriesToCss(arr?: CSSEntries): string;
|
|
|
97
97
|
declare function isObject(item: any): item is Record<string, any>;
|
|
98
98
|
declare function mergeDeep<T>(original: T, patch: DeepPartial<T>): T;
|
|
99
99
|
declare function clone<T>(val: T): T;
|
|
100
|
-
declare function isStaticRule(rule: Rule): rule is StaticRule;
|
|
101
|
-
declare function isStaticShortcut(sc: Shortcut): sc is StaticShortcut;
|
|
100
|
+
declare function isStaticRule(rule: Rule<any>): rule is StaticRule;
|
|
101
|
+
declare function isStaticShortcut(sc: Shortcut<any>): sc is StaticShortcut;
|
|
102
102
|
|
|
103
103
|
declare function toArray<T>(value?: T | T[]): T[];
|
|
104
104
|
declare function uniq<T>(value: T[]): T[];
|
|
@@ -110,7 +110,7 @@ declare const validateFilterRE: RegExp;
|
|
|
110
110
|
declare const CONTROL_SHORTCUT_NO_MERGE = "$$shortcut-no-merge";
|
|
111
111
|
declare function isAttributifySelector(selector: string): RegExpMatchArray | null;
|
|
112
112
|
declare function isValidSelector(selector?: string): selector is string;
|
|
113
|
-
declare function normalizeVariant(variant: Variant): VariantObject
|
|
113
|
+
declare function normalizeVariant(variant: Variant<any>): VariantObject<any>;
|
|
114
114
|
declare function isRawUtil(util: ParsedUtil | RawUtil | StringifiedUtil): util is RawUtil;
|
|
115
115
|
declare function notNull<T>(value: T | null | undefined): value is T;
|
|
116
116
|
declare function noop(): void;
|
|
@@ -209,7 +209,7 @@ interface RuleContext<Theme extends {} = {}> {
|
|
|
209
209
|
/**
|
|
210
210
|
* UnoCSS generator instance
|
|
211
211
|
*/
|
|
212
|
-
generator: UnoGenerator
|
|
212
|
+
generator: UnoGenerator<Theme>;
|
|
213
213
|
/**
|
|
214
214
|
* The theme object
|
|
215
215
|
*/
|
|
@@ -221,7 +221,7 @@ interface RuleContext<Theme extends {} = {}> {
|
|
|
221
221
|
/**
|
|
222
222
|
* The result of variant matching.
|
|
223
223
|
*/
|
|
224
|
-
variantMatch: VariantMatchedResult
|
|
224
|
+
variantMatch: VariantMatchedResult<Theme>;
|
|
225
225
|
/**
|
|
226
226
|
* Construct a custom CSS rule.
|
|
227
227
|
* Variants and selector escaping will be handled automatically.
|
|
@@ -230,15 +230,15 @@ interface RuleContext<Theme extends {} = {}> {
|
|
|
230
230
|
/**
|
|
231
231
|
* Available only when `details` option is enabled.
|
|
232
232
|
*/
|
|
233
|
-
rules?: Rule[];
|
|
233
|
+
rules?: Rule<Theme>[];
|
|
234
234
|
/**
|
|
235
235
|
* Available only when `details` option is enabled.
|
|
236
236
|
*/
|
|
237
|
-
shortcuts?: Shortcut[];
|
|
237
|
+
shortcuts?: Shortcut<Theme>[];
|
|
238
238
|
/**
|
|
239
239
|
* Available only when `details` option is enabled.
|
|
240
240
|
*/
|
|
241
|
-
variants?: Variant[];
|
|
241
|
+
variants?: Variant<Theme>[];
|
|
242
242
|
}
|
|
243
243
|
interface VariantContext<Theme extends {} = {}> {
|
|
244
244
|
/**
|
|
@@ -248,7 +248,7 @@ interface VariantContext<Theme extends {} = {}> {
|
|
|
248
248
|
/**
|
|
249
249
|
* UnoCSS generator instance
|
|
250
250
|
*/
|
|
251
|
-
generator: UnoGenerator
|
|
251
|
+
generator: UnoGenerator<Theme>;
|
|
252
252
|
/**
|
|
253
253
|
* The theme object
|
|
254
254
|
*/
|
|
@@ -263,7 +263,7 @@ interface PreflightContext<Theme extends {} = {}> {
|
|
|
263
263
|
/**
|
|
264
264
|
* UnoCSS generator instance
|
|
265
265
|
*/
|
|
266
|
-
generator: UnoGenerator
|
|
266
|
+
generator: UnoGenerator<Theme>;
|
|
267
267
|
/**
|
|
268
268
|
* The theme object
|
|
269
269
|
*/
|
|
@@ -693,15 +693,15 @@ interface UserConfig<Theme extends {} = {}> extends ConfigBase<Theme>, UserOnlyO
|
|
|
693
693
|
}
|
|
694
694
|
interface UserConfigDefaults<Theme extends {} = {}> extends ConfigBase<Theme>, UserOnlyOptions<Theme> {
|
|
695
695
|
}
|
|
696
|
-
interface ResolvedConfig extends Omit<RequiredByKey<UserConfig
|
|
697
|
-
presets: Preset[];
|
|
698
|
-
shortcuts: Shortcut[];
|
|
699
|
-
variants: VariantObject[];
|
|
696
|
+
interface ResolvedConfig<Theme extends {} = {}> extends Omit<RequiredByKey<UserConfig<Theme>, 'mergeSelectors' | 'theme' | 'rules' | 'variants' | 'layers' | 'extractors' | 'blocklist' | 'safelist' | 'preflights' | 'sortLayers'>, 'rules' | 'shortcuts' | 'autocomplete'> {
|
|
697
|
+
presets: Preset<Theme>[];
|
|
698
|
+
shortcuts: Shortcut<Theme>[];
|
|
699
|
+
variants: VariantObject<Theme>[];
|
|
700
700
|
preprocess: Preprocessor[];
|
|
701
701
|
postprocess: Postprocessor[];
|
|
702
702
|
rulesSize: number;
|
|
703
|
-
rulesDynamic: [number, ...DynamicRule][];
|
|
704
|
-
rulesStaticMap: Record<string, [number, CSSObject | CSSEntries, RuleMeta | undefined, Rule] | undefined>;
|
|
703
|
+
rulesDynamic: [number, ...DynamicRule<Theme>][];
|
|
704
|
+
rulesStaticMap: Record<string, [number, CSSObject | CSSEntries, RuleMeta | undefined, Rule<Theme>] | undefined>;
|
|
705
705
|
autocomplete: {
|
|
706
706
|
templates: (AutoCompleteFunction | AutoCompleteTemplate)[];
|
|
707
707
|
extractors: AutoCompleteExtractor[];
|
|
@@ -714,11 +714,11 @@ interface GenerateResult {
|
|
|
714
714
|
getLayers(includes?: string[], excludes?: string[]): string;
|
|
715
715
|
matched: Set<string>;
|
|
716
716
|
}
|
|
717
|
-
declare type VariantMatchedResult = readonly [
|
|
717
|
+
declare type VariantMatchedResult<Theme extends {} = {}> = readonly [
|
|
718
718
|
raw: string,
|
|
719
719
|
current: string,
|
|
720
720
|
variantHandlers: VariantHandler[],
|
|
721
|
-
variants: Set<Variant
|
|
721
|
+
variants: Set<Variant<Theme>>
|
|
722
722
|
];
|
|
723
723
|
declare type ParsedUtil = readonly [
|
|
724
724
|
index: number,
|
|
@@ -732,13 +732,13 @@ declare type RawUtil = readonly [
|
|
|
732
732
|
rawCSS: string,
|
|
733
733
|
meta: RuleMeta | undefined
|
|
734
734
|
];
|
|
735
|
-
declare type StringifiedUtil = readonly [
|
|
735
|
+
declare type StringifiedUtil<Theme extends {} = {}> = readonly [
|
|
736
736
|
index: number,
|
|
737
737
|
selector: string | undefined,
|
|
738
738
|
body: string,
|
|
739
739
|
parent: string | undefined,
|
|
740
740
|
meta: RuleMeta | undefined,
|
|
741
|
-
context: RuleContext | undefined,
|
|
741
|
+
context: RuleContext<Theme> | undefined,
|
|
742
742
|
noMerge: boolean | undefined
|
|
743
743
|
];
|
|
744
744
|
declare type PreparedRule = readonly [
|
package/dist/index.mjs
CHANGED
|
@@ -287,6 +287,7 @@ const extractorSplit = {
|
|
|
287
287
|
}
|
|
288
288
|
};
|
|
289
289
|
|
|
290
|
+
const rightTrimRe = /=$/;
|
|
290
291
|
const extractorSvelte = {
|
|
291
292
|
name: "svelte",
|
|
292
293
|
order: 0,
|
|
@@ -294,7 +295,7 @@ const extractorSvelte = {
|
|
|
294
295
|
let result = splitCode(code);
|
|
295
296
|
if (id && id.endsWith(".svelte")) {
|
|
296
297
|
result = result.map((r) => {
|
|
297
|
-
return r.startsWith("class:") ? r.slice(6) : r;
|
|
298
|
+
return r.startsWith("class:") ? r.slice(6).replace(rightTrimRe, "") : r;
|
|
298
299
|
});
|
|
299
300
|
}
|
|
300
301
|
return new Set(result);
|
|
@@ -412,7 +413,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
412
413
|
};
|
|
413
414
|
}
|
|
414
415
|
|
|
415
|
-
const version = "0.46.
|
|
416
|
+
const version = "0.46.4";
|
|
416
417
|
|
|
417
418
|
class UnoGenerator {
|
|
418
419
|
constructor(userConfig = {}, defaults = {}) {
|