@unocss/core
Advanced tools
Comparing version 0.54.3 to 0.55.0
@@ -54,33 +54,2 @@ import { LoadConfigResult } from 'unconfig'; | ||
declare class UnoGenerator<Theme extends object = object> { | ||
userConfig: UserConfig<Theme>; | ||
defaults: UserConfigDefaults<Theme>; | ||
version: string; | ||
private _cache; | ||
config: ResolvedConfig<Theme>; | ||
blocked: Set<string>; | ||
parentOrders: Map<string, number>; | ||
events: Emitter<{ | ||
config: (config: ResolvedConfig<Theme>) => void; | ||
}>; | ||
constructor(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>); | ||
setConfig(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): void; | ||
applyExtractors(code: string, id?: string, extracted?: Set<string>): Promise<Set<string>>; | ||
makeContext(raw: string, applied: VariantMatchedResult<Theme>): RuleContext<Theme>; | ||
parseToken(raw: string, alias?: string): Promise<StringifiedUtil<Theme>[] | undefined | null>; | ||
generate(input: string | Set<string> | string[], options?: GenerateOptions): Promise<GenerateResult>; | ||
matchVariants(raw: string, current?: string): Promise<VariantMatchedResult<Theme>>; | ||
private applyVariants; | ||
constructCustomCSS(context: Readonly<RuleContext<Theme>>, body: CSSObject | CSSEntries, overrideSelector?: string): string; | ||
parseUtil(input: string | VariantMatchedResult<Theme>, context: RuleContext<Theme>, internal?: boolean, shortcutPrefix?: string | string[] | undefined): Promise<(ParsedUtil | RawUtil)[] | undefined>; | ||
stringifyUtil(parsed?: ParsedUtil | RawUtil, context?: RuleContext<Theme>): StringifiedUtil<Theme> | undefined; | ||
expandShortcut(input: string, context: RuleContext<Theme>, depth?: number): Promise<[ShortcutValue[], RuleMeta | undefined] | undefined>; | ||
stringifyShortcuts(parent: VariantMatchedResult<Theme>, context: RuleContext<Theme>, expanded: ShortcutValue[], meta?: RuleMeta): Promise<StringifiedUtil<Theme>[] | undefined>; | ||
isBlocked(raw: string): boolean; | ||
} | ||
declare function createGenerator<Theme extends object = object>(config?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): UnoGenerator<Theme>; | ||
declare const regexScopePlaceholder: RegExp; | ||
declare function hasScopePlaceholder(css: string): RegExpMatchArray | null; | ||
declare function toEscapedSelector(raw: string): string; | ||
declare function escapeRegExp(string: string): string; | ||
@@ -135,2 +104,13 @@ /** | ||
declare class CountableSet<K> extends Set<K> { | ||
_map: Map<K, number>; | ||
constructor(values?: Iterable<K>); | ||
add(key: K): this; | ||
delete(key: K): boolean; | ||
clear(): void; | ||
getCount(key: K): number; | ||
setCount(key: K, count: number): this; | ||
} | ||
declare function isCountableSet<T = string>(value: any): value is CountableSet<T>; | ||
declare function withLayer<T extends object>(layer: string, rules: Rule<T>[]): Rule<T>[]; | ||
@@ -166,2 +146,35 @@ | ||
declare class UnoGenerator<Theme extends object = object> { | ||
userConfig: UserConfig<Theme>; | ||
defaults: UserConfigDefaults<Theme>; | ||
version: string; | ||
private _cache; | ||
config: ResolvedConfig<Theme>; | ||
blocked: Set<string>; | ||
parentOrders: Map<string, number>; | ||
events: Emitter<{ | ||
config: (config: ResolvedConfig<Theme>) => void; | ||
}>; | ||
constructor(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>); | ||
setConfig(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): void; | ||
applyExtractors(code: string, id?: string, extracted?: Set<string>): Promise<Set<string>>; | ||
applyExtractors(code: string, id?: string, extracted?: CountableSet<string>): Promise<CountableSet<string>>; | ||
makeContext(raw: string, applied: VariantMatchedResult<Theme>): RuleContext<Theme>; | ||
parseToken(raw: string, alias?: string): Promise<StringifiedUtil<Theme>[] | undefined | null>; | ||
generate(input: string | Set<string> | CountableSet<string> | string[], options?: GenerateOptions<false>): Promise<GenerateResult<Set<string>>>; | ||
generate(input: string | Set<string> | CountableSet<string> | string[], options?: GenerateOptions<true>): Promise<GenerateResult<Map<string, ExtendedTokenInfo<Theme>>>>; | ||
matchVariants(raw: string, current?: string): Promise<VariantMatchedResult<Theme>>; | ||
private applyVariants; | ||
constructCustomCSS(context: Readonly<RuleContext<Theme>>, body: CSSObject | CSSEntries, overrideSelector?: string): string; | ||
parseUtil(input: string | VariantMatchedResult<Theme>, context: RuleContext<Theme>, internal?: boolean, shortcutPrefix?: string | string[] | undefined): Promise<(ParsedUtil | RawUtil)[] | undefined>; | ||
stringifyUtil(parsed?: ParsedUtil | RawUtil, context?: RuleContext<Theme>): StringifiedUtil<Theme> | undefined; | ||
expandShortcut(input: string, context: RuleContext<Theme>, depth?: number): Promise<[ShortcutValue[], RuleMeta | undefined] | undefined>; | ||
stringifyShortcuts(parent: VariantMatchedResult<Theme>, context: RuleContext<Theme>, expanded: ShortcutValue[], meta?: RuleMeta): Promise<StringifiedUtil<Theme>[] | undefined>; | ||
isBlocked(raw: string): boolean; | ||
} | ||
declare function createGenerator<Theme extends object = object>(config?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): UnoGenerator<Theme>; | ||
declare const regexScopePlaceholder: RegExp; | ||
declare function hasScopePlaceholder(css: string): RegExpMatchArray | null; | ||
declare function toEscapedSelector(raw: string): string; | ||
type Awaitable<T> = T | Promise<T>; | ||
@@ -278,3 +291,4 @@ type Arrayable<T> = T | T[]; | ||
id?: string; | ||
extracted: Set<string>; | ||
extracted: Set<string> | CountableSet<string>; | ||
envMode?: 'dev' | 'build'; | ||
} | ||
@@ -299,3 +313,3 @@ interface PreflightContext<Theme extends object = object> { | ||
*/ | ||
extract?(ctx: ExtractorContext): Awaitable<Set<string> | string[] | undefined | void>; | ||
extract?(ctx: ExtractorContext): Awaitable<Set<string> | CountableSet<string> | string[] | undefined | void>; | ||
} | ||
@@ -868,3 +882,3 @@ interface RuleMeta { | ||
} | ||
interface GenerateResult { | ||
interface GenerateResult<T = Set<string>> { | ||
css: string; | ||
@@ -874,3 +888,3 @@ layers: string[]; | ||
getLayers(includes?: string[], excludes?: string[]): string; | ||
matched: Set<string>; | ||
matched: T; | ||
} | ||
@@ -921,4 +935,17 @@ type VariantMatchedResult<Theme extends object = object> = readonly [ | ||
} | ||
interface GenerateOptions { | ||
/** | ||
* Returned from `uno.generate()` when `extendedInfo` option is enabled. | ||
*/ | ||
interface ExtendedTokenInfo<Theme extends object = object> { | ||
/** | ||
* Stringified util data | ||
*/ | ||
data: StringifiedUtil<Theme>[]; | ||
/** | ||
* Return -1 if the data structure is not countable | ||
*/ | ||
count: number; | ||
} | ||
interface GenerateOptions<T extends boolean> { | ||
/** | ||
* Filepath of the file being processed. | ||
@@ -946,2 +973,6 @@ */ | ||
scope?: string; | ||
/** | ||
* If return extended "matched" with payload and count | ||
*/ | ||
extendedInfo?: T; | ||
} | ||
@@ -968,2 +999,2 @@ | ||
export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BetterMap, BlocklistRule, CONTROL_SHORTCUT_NO_MERGE, CSSColorValue, CSSEntries, CSSObject, CSSValue, CSSValues, CliEntryItem, CliOptions, ConfigBase, ContentOptions, DeepPartial, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateOptions, GenerateResult, GeneratorOptions, HighlightAnnotation, 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, ToArray, TwoKeyMap, UnoGenerator, UnocssPluginContext, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, ValueHandler, ValueHandlerCallback, Variant, VariantContext, VariantFunction, VariantHandler, VariantHandlerContext, VariantMatchedResult, VariantObject, attributifyRE, clearIdenticalEntries, clone, collapseVariantGroup, createGenerator, createValueHandler, cssIdRE, defaultSplitRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, hasScopePlaceholder, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseVariantGroup, regexScopePlaceholder, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, splitWithVariantGroupRE, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer }; | ||
export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BetterMap, BlocklistRule, CONTROL_SHORTCUT_NO_MERGE, CSSColorValue, CSSEntries, CSSObject, CSSValue, CSSValues, CliEntryItem, CliOptions, ConfigBase, ContentOptions, CountableSet, DeepPartial, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, ExtendedTokenInfo, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateOptions, GenerateResult, GeneratorOptions, HighlightAnnotation, 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, ToArray, TwoKeyMap, UnoGenerator, UnocssPluginContext, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, ValueHandler, ValueHandlerCallback, Variant, VariantContext, VariantFunction, VariantHandler, VariantHandlerContext, VariantMatchedResult, VariantObject, attributifyRE, clearIdenticalEntries, clone, collapseVariantGroup, createGenerator, createValueHandler, cssIdRE, defaultSplitRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, hasScopePlaceholder, isAttributifySelector, isCountableSet, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseVariantGroup, regexScopePlaceholder, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, splitWithVariantGroupRE, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer }; |
{ | ||
"name": "@unocss/core", | ||
"version": "0.54.3", | ||
"version": "0.55.0", | ||
"description": "The instant on-demand Atomic CSS engine.", | ||
@@ -5,0 +5,0 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110928
3216