@teacss/core 0.3.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/LICENSE +22 -0
- package/README.md +124 -0
- package/dist/index.d.ts +1555 -0
- package/dist/index.js +21 -0
- package/package.json +27 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1555 @@
|
|
|
1
|
+
//#region src/condition.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The `@` condition axis — the spine of the v0 language.
|
|
4
|
+
*
|
|
5
|
+
* In TeaCSS, `@` unifies every "selector / condition relative to `&` (the classed
|
|
6
|
+
* element)": pseudo-classes, pseudo-elements, target combinators, relations, media,
|
|
7
|
+
* and arbitrary selectors are all the same axis. A token may carry many `@cond`
|
|
8
|
+
* segments; they are always AND (there is no OR), and the rightmost element is the
|
|
9
|
+
* one styled. See `docs/proposals/v00-teacss.md` for the current language contract.
|
|
10
|
+
*
|
|
11
|
+
* This module is the **core parsing primitive**, consistent with `parseClassToken`:
|
|
12
|
+
* it classifies each condition by first-character dispatch, resolves the
|
|
13
|
+
* purely-structural kinds (self-class/id, pseudo-element, target combinator) itself,
|
|
14
|
+
* and routes everything it cannot resolve — named conditions (`hover`, `md`,
|
|
15
|
+
* `group-hover`, `media(...)`) and arbitrary selectors (`[…]`) — through a
|
|
16
|
+
* **resolver hook** so presets can register named and arbitrary-selector
|
|
17
|
+
* vocabulary without moving that vocabulary into core.
|
|
18
|
+
*
|
|
19
|
+
* Core owns the mechanism (classification, the hook registry, canonical assembly);
|
|
20
|
+
* presets own the vocabulary.
|
|
21
|
+
*/
|
|
22
|
+
/** How an `@cond` segment is classified by its first character (after a NOT `!`). */
|
|
23
|
+
type ConditionKind =
|
|
24
|
+
/** `@.cls` / `@#id` — a class/id on the subject itself. */
|
|
25
|
+
"self" |
|
|
26
|
+
/** `@::after` — a pseudo-element on the subject. */
|
|
27
|
+
"pseudo-element" |
|
|
28
|
+
/** `@>li` `@_p` `@+span` `@~span` `@>*` — a combinator + target; the target is styled. */
|
|
29
|
+
"target" |
|
|
30
|
+
/** `@[…]` — an arbitrary selector (`&` implicit). Resolved by a hook. */
|
|
31
|
+
"arbitrary" |
|
|
32
|
+
/** Letter-first: a named condition (pseudo-class / media / relation / breakpoint / at-rule). Resolved by hooks. */
|
|
33
|
+
"named";
|
|
34
|
+
/** A single `@cond` segment parsed into structured form (no CSS resolved yet). */
|
|
35
|
+
interface ParsedCondition {
|
|
36
|
+
/** The segment without its leading `@`, exactly as written (e.g. `hover`, `.is-dragging`, `>li:hover`, `!disabled`). */
|
|
37
|
+
raw: string;
|
|
38
|
+
kind: ConditionKind;
|
|
39
|
+
/** True when the segment began with `!` (NOT). The `!` is stripped from `value`. */
|
|
40
|
+
negate: boolean;
|
|
41
|
+
/** The classification payload, after stripping a leading `!` (e.g. `hover`, `.is-dragging`, `>li:hover`, `[…]`). */
|
|
42
|
+
value: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Classify a single condition segment (without its leading `@`).
|
|
46
|
+
*
|
|
47
|
+
* Pure and total. A leading `!` sets `negate` and is stripped before dispatch.
|
|
48
|
+
* First-character dispatch follows the current condition grammar:
|
|
49
|
+
* `::` → pseudo-element · `.`/`#` → self · `> _ + ~` → target · `[` → arbitrary · else → named.
|
|
50
|
+
*/
|
|
51
|
+
declare function parseCondition(raw: string): ParsedCondition;
|
|
52
|
+
/** Classify a list of condition segments (e.g. `ParsedClassToken.conditions`). */
|
|
53
|
+
declare function parseConditions(conditions: string[]): ParsedCondition[];
|
|
54
|
+
/**
|
|
55
|
+
* The contribution of one resolved condition to the final rule, split by role so
|
|
56
|
+
* assembly can place each part canonically (selector-first), independent of the
|
|
57
|
+
* order conditions were written in.
|
|
58
|
+
*/
|
|
59
|
+
interface ResolvedCondition {
|
|
60
|
+
/** Ancestor prepended before the subject, e.g. `.group:hover `. */
|
|
61
|
+
prefix?: string;
|
|
62
|
+
/** Combinator + target appended after the subject, shifting the styled element, e.g. ` > li`. */
|
|
63
|
+
combinator?: string;
|
|
64
|
+
/** Appended directly to the subject, e.g. `:hover`, `.is-dragging`, `[data-open]`. */
|
|
65
|
+
suffix?: string;
|
|
66
|
+
/** Pseudo-element on the styled element, e.g. `::after`. At most one per token. */
|
|
67
|
+
pseudoElement?: string;
|
|
68
|
+
/** At-rule wrapping the whole rule, e.g. `@media (min-width: 48rem)`. */
|
|
69
|
+
parent?: string;
|
|
70
|
+
}
|
|
71
|
+
/** Context handed to resolver hooks. */
|
|
72
|
+
interface ConditionResolveContext {
|
|
73
|
+
/** The full parsed condition list, for hooks that need siblings (e.g. named container). */
|
|
74
|
+
conditions: ParsedCondition[];
|
|
75
|
+
/** The resolved theme, for hooks whose vocabulary is theme-driven (e.g. breakpoints). */
|
|
76
|
+
theme?: object;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A resolver hook. Returns a {@link ResolvedCondition} when it handles `cond`,
|
|
80
|
+
* or `undefined` to defer to the next hook. Presets register hooks for named
|
|
81
|
+
* and arbitrary conditions.
|
|
82
|
+
*/
|
|
83
|
+
type ConditionResolver = (cond: ParsedCondition, ctx: ConditionResolveContext) => ResolvedCondition | undefined;
|
|
84
|
+
interface ResolveConditionsResult {
|
|
85
|
+
/** Conditions resolved to structured contributions (by core or a hook). */
|
|
86
|
+
resolved: ResolvedCondition[];
|
|
87
|
+
/** Conditions no hook handled — surfaced so callers/tests can detect missing vocabulary. */
|
|
88
|
+
unresolved: ParsedCondition[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Resolve a list of parsed conditions. Core resolves the structural kinds; the
|
|
92
|
+
* arbitrary and named kinds are offered to `resolvers` in order (first match wins).
|
|
93
|
+
* Anything left over is returned in `unresolved` (it stays unresolved until a
|
|
94
|
+
* feature registers a hook for it).
|
|
95
|
+
*
|
|
96
|
+
* Enforces at most one pseudo-element per token.
|
|
97
|
+
*/
|
|
98
|
+
declare function resolveConditions(conditions: ParsedCondition[], resolvers?: ConditionResolver[], theme?: object): ResolveConditionsResult;
|
|
99
|
+
interface BuiltConditionSelector {
|
|
100
|
+
/** The assembled selector, e.g. `.group:hover .bg\:red:hover > li`. */
|
|
101
|
+
selector: string;
|
|
102
|
+
/** At-rule parents wrapping the rule, outermost-last (e.g. `["@media (min-width: 48rem)"]`). */
|
|
103
|
+
parents: string[];
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Assemble resolved conditions onto a subject selector, canonically (selector-first):
|
|
107
|
+
*
|
|
108
|
+
* `<prefixes><subject><suffixes><combinators><pseudoElement>`, wrapped by `<parents>`.
|
|
109
|
+
*
|
|
110
|
+
* Assembly canonicalizes conditions that contribute different roles, so
|
|
111
|
+
* `a@_svg@group-hover@md` and `a@md@group-hover@_svg` produce the same selector
|
|
112
|
+
* + parents. Conditions within the same role retain their authored order.
|
|
113
|
+
*/
|
|
114
|
+
declare function buildConditionSelector(subject: string, resolved: ResolvedCondition[]): BuiltConditionSelector;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/utils/basic.d.ts
|
|
117
|
+
type ToArrayResult<T> = T extends any[] ? T[number][] : T extends readonly (infer U)[] ? readonly U[] : T[];
|
|
118
|
+
declare function toArray<T = never>(): T[];
|
|
119
|
+
declare function toArray(value: undefined): [];
|
|
120
|
+
declare function toArray<T>(value: T): ToArrayResult<T>;
|
|
121
|
+
declare function uniq<T>(value: T[]): T[];
|
|
122
|
+
declare function uniqueBy<T>(array: readonly T[], equalFn: (a: T, b: T) => boolean): T[];
|
|
123
|
+
declare function isString(s: any): s is string;
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/utils/countable-set.d.ts
|
|
126
|
+
declare class CountableSet<K> extends Set<K> {
|
|
127
|
+
_map: Map<K, number>;
|
|
128
|
+
constructor(values?: Iterable<K>);
|
|
129
|
+
add(key: K): this;
|
|
130
|
+
delete(key: K): boolean;
|
|
131
|
+
clear(): void;
|
|
132
|
+
getCount(key: K): number;
|
|
133
|
+
setCount(key: K, count: number): this;
|
|
134
|
+
}
|
|
135
|
+
declare function isCountableSet<T = string>(value: any): value is CountableSet<T>;
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/utils/escape.d.ts
|
|
138
|
+
declare function escapeRegExp(string: string): string;
|
|
139
|
+
/**
|
|
140
|
+
* CSS Selector Escape
|
|
141
|
+
*/
|
|
142
|
+
declare function escapeSelector(str: string): string;
|
|
143
|
+
declare const e: typeof escapeSelector;
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/utils/events.d.ts
|
|
146
|
+
type EventsMap = Record<string, any>;
|
|
147
|
+
interface DefaultEvents extends EventsMap {
|
|
148
|
+
[event: string]: (...args: any) => void;
|
|
149
|
+
}
|
|
150
|
+
type Unsubscribe = () => void;
|
|
151
|
+
interface Emitter<Events extends EventsMap = DefaultEvents> {
|
|
152
|
+
/**
|
|
153
|
+
* Event names in keys and arrays with listeners in values.
|
|
154
|
+
*
|
|
155
|
+
* ```js
|
|
156
|
+
* emitter1.events = emitter2.events
|
|
157
|
+
* emitter2.events = { }
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
events: Partial<{ [E in keyof Events]: Events[E][]; }>;
|
|
161
|
+
/**
|
|
162
|
+
* Add a listener for a given event.
|
|
163
|
+
*
|
|
164
|
+
* ```js
|
|
165
|
+
* const unbind = ee.on('tick', (tickType, tickDuration) => {
|
|
166
|
+
* count += 1
|
|
167
|
+
* })
|
|
168
|
+
*
|
|
169
|
+
* disable () {
|
|
170
|
+
* unbind()
|
|
171
|
+
* }
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* @param event The event name.
|
|
175
|
+
* @param cb The listener function.
|
|
176
|
+
* @returns Unbind listener from event.
|
|
177
|
+
*/
|
|
178
|
+
on<K extends keyof Events>(this: this, event: K, cb: Events[K]): Unsubscribe;
|
|
179
|
+
/**
|
|
180
|
+
* Calls each of the listeners registered for a given event.
|
|
181
|
+
*
|
|
182
|
+
* ```js
|
|
183
|
+
* ee.emit('tick', tickType, tickDuration)
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @param event The event name.
|
|
187
|
+
* @param args The arguments for listeners.
|
|
188
|
+
*/
|
|
189
|
+
emit<K extends keyof Events>(this: this, event: K, ...args: Parameters<Events[K]>): void;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Create event emitter.
|
|
193
|
+
*
|
|
194
|
+
* ```js
|
|
195
|
+
* import { createNanoEvents } from 'nanoevents'
|
|
196
|
+
*
|
|
197
|
+
* class Ticker {
|
|
198
|
+
* constructor() {
|
|
199
|
+
* this.emitter = createNanoEvents()
|
|
200
|
+
* }
|
|
201
|
+
* on(...args) {
|
|
202
|
+
* return this.emitter.on(...args)
|
|
203
|
+
* }
|
|
204
|
+
* tick() {
|
|
205
|
+
* this.emitter.emit('tick')
|
|
206
|
+
* }
|
|
207
|
+
* }
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
declare function createNanoEvents<Events extends EventsMap = DefaultEvents>(): Emitter<Events>;
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/utils/helpers.d.ts
|
|
213
|
+
declare const attributifyRE: RegExp;
|
|
214
|
+
declare const cssIdRE: RegExp;
|
|
215
|
+
declare const validateFilterRE: RegExp;
|
|
216
|
+
declare function isAttributifySelector(selector: string): RegExpMatchArray | null;
|
|
217
|
+
declare function isValidSelector(selector?: string): selector is string;
|
|
218
|
+
declare function normalizeVariant(variant: Variant<any>): VariantObject<any>;
|
|
219
|
+
declare function isRawUtil(util: ParsedUtil | RawUtil | StringifiedUtil): util is RawUtil;
|
|
220
|
+
declare function notNull<T>(value: T | null | undefined): value is T;
|
|
221
|
+
/**
|
|
222
|
+
* A value is a thenable (promise-like) — used to take a synchronous fast path on
|
|
223
|
+
* the per-token hot path: only genuinely-async handler/variant results are
|
|
224
|
+
* `await`ed, so the common all-synchronous case never allocates a microtask.
|
|
225
|
+
*/
|
|
226
|
+
declare function isThenable<T>(value: T | PromiseLike<T>): value is PromiseLike<T>;
|
|
227
|
+
declare function noop(): void;
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/utils/layer.d.ts
|
|
230
|
+
declare function withLayer<T extends object>(layer: string, rules: Rule<T>[]): Rule<T>[];
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region src/utils/map.d.ts
|
|
233
|
+
declare class TwoKeyMap<K1, K2, V> {
|
|
234
|
+
_map: Map<K1, Map<K2, V>>;
|
|
235
|
+
get(key1: K1, key2: K2): V | undefined;
|
|
236
|
+
getFallback(key1: K1, key2: K2, fallback: V): V;
|
|
237
|
+
set(key1: K1, key2: K2, value: V): this;
|
|
238
|
+
has(key1: K1, key2: K2): boolean;
|
|
239
|
+
delete(key1: K1, key2: K2): boolean;
|
|
240
|
+
deleteTop(key1: K1): boolean;
|
|
241
|
+
map<T>(fn: (v: V, k1: K1, k2: K2) => T): T[];
|
|
242
|
+
}
|
|
243
|
+
declare class BetterMap<K, V> extends Map<K, V> {
|
|
244
|
+
getFallback(key: K, fallback: V): V;
|
|
245
|
+
map<R>(mapFn: (value: V, key: K) => R): R[];
|
|
246
|
+
flatMap<R extends readonly unknown[]>(mapFn: (value: V, key: K) => R): R[number][];
|
|
247
|
+
}
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/utils/object.d.ts
|
|
250
|
+
declare function normalizeCSSEntries(obj: string | CSSEntriesInput | CSSObjectInput): string | CSSEntriesInput;
|
|
251
|
+
declare function normalizeCSSValues(obj: CSSValueInput | string | (CSSValueInput | string)[]): (string | CSSEntriesInput)[];
|
|
252
|
+
declare function clearIdenticalEntries(entry: CSSEntriesInput): CSSEntries;
|
|
253
|
+
declare const VirtualKey = "__virtual_key__";
|
|
254
|
+
declare function entriesToCss(arr?: CSSEntriesInput): string;
|
|
255
|
+
declare function isObject(item: any): item is Record<string, any>;
|
|
256
|
+
/**
|
|
257
|
+
* Marker key on a patch object that forces a full replacement of the
|
|
258
|
+
* corresponding original value instead of a deep merge. An explicit
|
|
259
|
+
* `{ $reset: true, … }` replaces an entire category.
|
|
260
|
+
* The marker is stripped from output.
|
|
261
|
+
*/
|
|
262
|
+
declare const RESET_KEY = "$reset";
|
|
263
|
+
/**
|
|
264
|
+
* Deep merge two objects.
|
|
265
|
+
*
|
|
266
|
+
* A patch object whose own `$reset` is truthy is treated as a *replacement*: the
|
|
267
|
+
* original value at that position is discarded and the patch (minus the `$reset`
|
|
268
|
+
* marker) is used as-is. This applies recursively, so a single theme category can
|
|
269
|
+
* opt out of deep-merging (`theme.colors = { $reset: true, ... }`).
|
|
270
|
+
*/
|
|
271
|
+
declare function mergeDeep<T>(original: T, patch: DeepPartial<T>, mergeArray?: boolean): T;
|
|
272
|
+
declare function clone<T>(val: T): T;
|
|
273
|
+
declare function isStaticRule(rule: Rule<any>): rule is StaticRule;
|
|
274
|
+
declare function isStaticShortcut(sc: Shortcut<any>): sc is StaticShortcut;
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/utils/source.d.ts
|
|
277
|
+
declare function getPath(id: string): string;
|
|
278
|
+
declare function isCssId(id: string): boolean;
|
|
279
|
+
declare function hash(str: string): string;
|
|
280
|
+
declare function transformSkipCode(code: string, map: Map<string, string>, SKIP_RULES_RE: RegExp, keyFlag: string): string;
|
|
281
|
+
declare function restoreSkipCode(code: string, map: Map<string, string>): string;
|
|
282
|
+
declare function replaceAsync(string: string, searchValue: RegExp, replacer: (substring: string, ...args: any[]) => Promise<string>): Promise<string>;
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/utils/variant-group.d.ts
|
|
285
|
+
declare function makeRegexClassGroup(separators?: string[]): RegExp;
|
|
286
|
+
interface VariantGroup {
|
|
287
|
+
length: number;
|
|
288
|
+
items: HighlightAnnotation[];
|
|
289
|
+
}
|
|
290
|
+
declare function parseVariantGroup(str: string | MagicStringLike, separators?: string[], depth?: number): {
|
|
291
|
+
prefixes: string[];
|
|
292
|
+
hasChanged: boolean;
|
|
293
|
+
groupsByOffset: Map<number, VariantGroup>;
|
|
294
|
+
readonly expanded: string;
|
|
295
|
+
};
|
|
296
|
+
declare function collapseVariantGroup(str: string, prefixes: string[]): string;
|
|
297
|
+
declare function expandVariantGroup(str: string, separators?: string[], depth?: number): string;
|
|
298
|
+
declare function expandVariantGroup(str: MagicStringLike, separators?: string[], depth?: number): MagicStringLike;
|
|
299
|
+
//#endregion
|
|
300
|
+
//#region src/utils/warn.d.ts
|
|
301
|
+
declare function warnOnce(msg: string): void;
|
|
302
|
+
//#endregion
|
|
303
|
+
//#region src/generator.d.ts
|
|
304
|
+
declare const symbols: ControlSymbols;
|
|
305
|
+
type ExpansionEntry<Theme extends object = object> = Shortcut<Theme>;
|
|
306
|
+
type ExpansionResult = [(string | ExpansionInlineValue)[], RuleMeta | undefined];
|
|
307
|
+
type ExpansionPrefixes = readonly (string | undefined)[];
|
|
308
|
+
interface PreparedGeneratorConfig<Theme extends object = object> {
|
|
309
|
+
readonly config: ResolvedConfig<Theme>;
|
|
310
|
+
readonly defaults: UserConfigDefaults<Theme>;
|
|
311
|
+
/** Isolated generator for validating work against `config` before commit. */
|
|
312
|
+
readonly generator: TeacssGenerator<Theme>;
|
|
313
|
+
readonly userConfig: UserConfig<Theme>;
|
|
314
|
+
readonly version: number;
|
|
315
|
+
}
|
|
316
|
+
declare class TeacssGeneratorInternal<Theme extends object = object> {
|
|
317
|
+
userConfig: UserConfig<Theme>;
|
|
318
|
+
defaults: UserConfigDefaults<Theme>;
|
|
319
|
+
readonly version: string;
|
|
320
|
+
readonly events: Emitter<{
|
|
321
|
+
config: (config: ResolvedConfig<Theme>) => void;
|
|
322
|
+
}>;
|
|
323
|
+
config: ResolvedConfig<Theme>;
|
|
324
|
+
cache: Map<string, StringifiedUtil<Theme>[] | null>;
|
|
325
|
+
blocked: Set<string>;
|
|
326
|
+
parentOrders: Map<string, number>;
|
|
327
|
+
activatedRules: Set<Rule<Theme>>;
|
|
328
|
+
/** Property-prefix dispatch index for `config.rulesDynamic`, rebuilt when the config changes. */
|
|
329
|
+
private _dynamicIndex?;
|
|
330
|
+
private _contextConfigs;
|
|
331
|
+
private _expansionPrefixes;
|
|
332
|
+
private _generationContexts;
|
|
333
|
+
private _configVersion;
|
|
334
|
+
private _collectionGeneration;
|
|
335
|
+
private _preparedConfigs;
|
|
336
|
+
private _indexedRules?;
|
|
337
|
+
private _indexedRuleSnapshot?;
|
|
338
|
+
private _preparedCacheSnapshot?;
|
|
339
|
+
private _preparedConfigMutable;
|
|
340
|
+
private _preparedCacheReliable;
|
|
341
|
+
private _startingGenerationParse;
|
|
342
|
+
private _runtimeRevision;
|
|
343
|
+
private _variantCacheOwner;
|
|
344
|
+
private _initialization?;
|
|
345
|
+
private _constructedCSSResults;
|
|
346
|
+
private _constructedCSSSequence;
|
|
347
|
+
private _parsedOutputOrders;
|
|
348
|
+
private _rawUtilMetadata;
|
|
349
|
+
private _stringifiedCurrentSelectors;
|
|
350
|
+
private _stringifiedOutputOrders;
|
|
351
|
+
private _stringifiedParentOrders;
|
|
352
|
+
private _shortcutMergeOrders;
|
|
353
|
+
private _utilParentOrders;
|
|
354
|
+
private reportConfigObserverErrors;
|
|
355
|
+
private dispatchConfig;
|
|
356
|
+
private clearRuntimeCaches;
|
|
357
|
+
private ensureRuleIndexesCurrent;
|
|
358
|
+
private collectParentOrders;
|
|
359
|
+
private transferOutputOrder;
|
|
360
|
+
private recordStringifiedContext;
|
|
361
|
+
private copyStringifiedUtil;
|
|
362
|
+
private copyStringifiedUtils;
|
|
363
|
+
private getDynamicIndex;
|
|
364
|
+
protected constructor(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>);
|
|
365
|
+
protected ensureInitialized(): Promise<void>;
|
|
366
|
+
private static constructPublic;
|
|
367
|
+
static create<Theme extends object = object>(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<TeacssGeneratorInternal<Theme>>;
|
|
368
|
+
setConfig(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<void>;
|
|
369
|
+
/** Resolve a candidate configuration without mutating this live generator. */
|
|
370
|
+
prepareConfig(userConfig: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<PreparedGeneratorConfig<Theme>>;
|
|
371
|
+
/** Commit a prepared configuration if no newer configuration request superseded it. */
|
|
372
|
+
commitConfig(prepared: PreparedGeneratorConfig<Theme>): boolean;
|
|
373
|
+
applyExtractors(code: string, id?: string, extracted?: Set<string>): Promise<Set<string>>;
|
|
374
|
+
applyExtractors(code: string, id?: string, extracted?: CountableSet<string>): Promise<CountableSet<string>>;
|
|
375
|
+
private applyExtractorsCurrent;
|
|
376
|
+
private applyExtractorsForConfig;
|
|
377
|
+
private requireInitialized;
|
|
378
|
+
private makeContextForConfig;
|
|
379
|
+
makeContext(raw: string, applied: VariantMatchedResult<Theme>): RuleContext<Theme>;
|
|
380
|
+
private getContextConfig;
|
|
381
|
+
parseToken(raw: string, alias?: string): Promise<StringifiedUtil<Theme>[] | undefined | null>;
|
|
382
|
+
private parseTokenInternal;
|
|
383
|
+
private parseTokenForGeneration;
|
|
384
|
+
/**
|
|
385
|
+
* Returns cached token names that currently emit the same declaration bodies as
|
|
386
|
+
* `raw`. Tooling uses this after generation has populated the parse cache, so
|
|
387
|
+
* references can include aliases without reading the cache's tuple shape.
|
|
388
|
+
*/
|
|
389
|
+
getCachedEquivalentTokens(raw: string): string[];
|
|
390
|
+
generate(input: string | Set<string> | CountableSet<string> | string[], options?: GenerateOptions<false>): Promise<GenerateResult<Set<string>>>;
|
|
391
|
+
generate(input: string | Set<string> | CountableSet<string> | string[], options?: GenerateOptions<true>): Promise<GenerateResult<Map<string, ExtendedTokenInfo<Theme>>>>;
|
|
392
|
+
private generateInternal;
|
|
393
|
+
matchVariants(raw: string, current?: string): Promise<readonly VariantMatchedResult<Theme>[]>;
|
|
394
|
+
private matchVariantsCurrent;
|
|
395
|
+
private matchVariantsForConfig;
|
|
396
|
+
private applyVariants;
|
|
397
|
+
constructCustomCSS(context: Readonly<RuleContext<Theme>>, body: CSSObjectInput | CSSEntriesInput, overrideSelector?: string): string;
|
|
398
|
+
private constructNormalizedCSS;
|
|
399
|
+
parseUtil(input: string | VariantMatchedResult<Theme>, context: RuleContext<Theme>, internal?: boolean, shortcutPrefix?: string | string[] | undefined): Promise<(ParsedUtil | RawUtil)[] | undefined>;
|
|
400
|
+
private resolveCSSResult;
|
|
401
|
+
stringifyUtil(parsed?: ParsedUtil | RawUtil, context?: RuleContext<Theme>): StringifiedUtil<Theme>[] | undefined;
|
|
402
|
+
expandShortcut(input: string, context: RuleContext<Theme>, depth?: number): Promise<ExpansionResult | undefined>;
|
|
403
|
+
private expandMatchedShortcut;
|
|
404
|
+
expandConfiguredExpansions(input: string, context: RuleContext<Theme>, depth: number, entries: ExpansionEntry<Theme>[], label: "shortcut", fallback?: (input: string, context: RuleContext<Theme>, depth: number) => Promise<ExpansionResult | undefined>, inheritedPrefix?: string): Promise<ExpansionResult | undefined>;
|
|
405
|
+
private expandConfiguredExpansionsForInput;
|
|
406
|
+
stringifyShortcuts(parent: VariantMatchedResult<Theme>, context: RuleContext<Theme>, expanded: (string | ExpansionInlineValue)[], meta?: RuleMeta, matchedPrefixes?: ExpansionPrefixes): Promise<StringifiedUtil<Theme>[] | undefined>;
|
|
407
|
+
isBlocked(raw: string): boolean;
|
|
408
|
+
getBlocked(raw: string): [BlocklistValue, BlocklistMeta | undefined] | undefined;
|
|
409
|
+
private matchesBlocklist;
|
|
410
|
+
}
|
|
411
|
+
declare class TeacssGenerator<Theme extends object = object> extends TeacssGeneratorInternal<Theme> {
|
|
412
|
+
/**
|
|
413
|
+
* @deprecated `new TeacssGenerator` is deprecated, please use `createGenerator()` instead
|
|
414
|
+
*/
|
|
415
|
+
constructor(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>);
|
|
416
|
+
}
|
|
417
|
+
declare function createGenerator<Theme extends object = object>(config?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<TeacssGenerator<Theme>>;
|
|
418
|
+
declare const regexScopePlaceholder: RegExp;
|
|
419
|
+
declare function hasScopePlaceholder(css: string): boolean;
|
|
420
|
+
declare function toEscapedSelector(raw: string): string;
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/types.d.ts
|
|
423
|
+
/**
|
|
424
|
+
* The subset of `magic-string`'s API that the transformer contract and variant-group
|
|
425
|
+
* expansion actually use. Typing against this keeps `magic-string` out of
|
|
426
|
+
* `@teacss/core`'s public types — a real `MagicString` satisfies it structurally,
|
|
427
|
+
* so the integration layer (which constructs one) still passes it directly, but
|
|
428
|
+
* consumers of `@teacss/core` don't inherit a dependency on `magic-string`.
|
|
429
|
+
*/
|
|
430
|
+
interface MagicStringLike {
|
|
431
|
+
readonly original: string;
|
|
432
|
+
slice(start?: number, end?: number): string;
|
|
433
|
+
toString(): string;
|
|
434
|
+
overwrite(start: number, end: number, content: string): MagicStringLike;
|
|
435
|
+
update(start: number, end: number, content: string): MagicStringLike;
|
|
436
|
+
remove(start: number, end: number): MagicStringLike;
|
|
437
|
+
appendLeft(index: number, content: string): MagicStringLike;
|
|
438
|
+
appendRight(index: number, content: string): MagicStringLike;
|
|
439
|
+
}
|
|
440
|
+
/** The result of resolving config from the CSS entry: the config + its source file(s). */
|
|
441
|
+
interface LoadConfigResult<Config = any> {
|
|
442
|
+
config: Config;
|
|
443
|
+
sources: string[];
|
|
444
|
+
}
|
|
445
|
+
type Awaitable<T> = T | Promise<T>;
|
|
446
|
+
type Arrayable<T> = T | T[];
|
|
447
|
+
type ToArray<T> = T extends any[] ? T[number][] : T extends readonly (infer U)[] ? readonly U[] : T[];
|
|
448
|
+
type ArgumentType<T> = T extends ((...args: infer A) => any) ? A : never;
|
|
449
|
+
type Shift<T> = T extends [_: any, ...args: infer A] ? A : never;
|
|
450
|
+
type RestArgs<T> = Shift<ArgumentType<T>>;
|
|
451
|
+
type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]>; };
|
|
452
|
+
type FlatObjectTuple<T> = { [K in keyof T]: T[K]; };
|
|
453
|
+
type PartialByKeys<T, K extends keyof T = keyof T> = FlatObjectTuple<Partial<Pick<T, Extract<keyof T, K>>> & Omit<T, K>>;
|
|
454
|
+
type RequiredByKey<T, K extends keyof T = keyof T> = FlatObjectTuple<Required<Pick<T, Extract<keyof T, K>>> & Omit<T, K>>;
|
|
455
|
+
type CSSObject = Record<string, string | number | undefined>;
|
|
456
|
+
/**
|
|
457
|
+
* [property, value, operators?]
|
|
458
|
+
*
|
|
459
|
+
* - operators: Used to perform specific operations on value or property.
|
|
460
|
+
*/
|
|
461
|
+
type CSSEntry = [string, string | number | undefined, Arrayable<string>?];
|
|
462
|
+
type CSSEntries = CSSEntry[];
|
|
463
|
+
type CSSObjectInput = CSSObject | Partial<ControlSymbolsValue>;
|
|
464
|
+
type CSSEntriesInput = (CSSEntry | ControlSymbolsEntry)[];
|
|
465
|
+
type CSSValueInput = CSSObjectInput | CSSEntriesInput | CSSValue;
|
|
466
|
+
interface PresetOptions {
|
|
467
|
+
[key: string]: any;
|
|
468
|
+
}
|
|
469
|
+
interface RuleContext<Theme extends object = object> {
|
|
470
|
+
/**
|
|
471
|
+
* Unprocessed selector from user input.
|
|
472
|
+
* Useful for generating CSS rule.
|
|
473
|
+
*/
|
|
474
|
+
rawSelector: string;
|
|
475
|
+
/**
|
|
476
|
+
* Current selector for rule matching
|
|
477
|
+
*/
|
|
478
|
+
currentSelector: string;
|
|
479
|
+
/**
|
|
480
|
+
* Generator instance
|
|
481
|
+
*/
|
|
482
|
+
generator: TeacssGenerator<Theme>;
|
|
483
|
+
/**
|
|
484
|
+
* Symbols for special handling
|
|
485
|
+
*/
|
|
486
|
+
symbols: ControlSymbols;
|
|
487
|
+
/**
|
|
488
|
+
* The theme object
|
|
489
|
+
*/
|
|
490
|
+
theme: Theme;
|
|
491
|
+
/**
|
|
492
|
+
* Matched variants handlers for this rule.
|
|
493
|
+
*/
|
|
494
|
+
variantHandlers: VariantHandler[];
|
|
495
|
+
/**
|
|
496
|
+
* The result of variant matching.
|
|
497
|
+
*/
|
|
498
|
+
variantMatch: VariantMatchedResult<Theme>;
|
|
499
|
+
/**
|
|
500
|
+
* Construct a custom CSS rule.
|
|
501
|
+
* Variants and selector escaping will be handled automatically.
|
|
502
|
+
*/
|
|
503
|
+
constructCSS: (body: CSSEntriesInput | CSSObjectInput, overrideSelector?: string) => string;
|
|
504
|
+
/**
|
|
505
|
+
* Available only when `details` option is enabled.
|
|
506
|
+
*/
|
|
507
|
+
rules?: Rule<Theme>[];
|
|
508
|
+
/**
|
|
509
|
+
* Available only when `details` option is enabled.
|
|
510
|
+
*/
|
|
511
|
+
shortcuts?: Shortcut<Theme>[];
|
|
512
|
+
/**
|
|
513
|
+
* Available only when `details` option is enabled.
|
|
514
|
+
*/
|
|
515
|
+
variants?: Variant<Theme>[];
|
|
516
|
+
}
|
|
517
|
+
declare const SymbolShortcutsNoMerge: unique symbol;
|
|
518
|
+
declare const SymbolNoMerge: unique symbol;
|
|
519
|
+
declare const SymbolNoScope: unique symbol;
|
|
520
|
+
declare const SymbolVariants: unique symbol;
|
|
521
|
+
declare const SymbolParent: unique symbol;
|
|
522
|
+
declare const SymbolSelector: unique symbol;
|
|
523
|
+
declare const SymbolLayer: unique symbol;
|
|
524
|
+
declare const SymbolSort: unique symbol;
|
|
525
|
+
declare const SymbolBody: unique symbol;
|
|
526
|
+
interface ControlSymbols {
|
|
527
|
+
/**
|
|
528
|
+
* Prevent merging in shortcuts
|
|
529
|
+
*/
|
|
530
|
+
readonly shortcutsNoMerge: typeof SymbolShortcutsNoMerge;
|
|
531
|
+
/**
|
|
532
|
+
* Prevent merging in rules
|
|
533
|
+
*/
|
|
534
|
+
readonly noMerge: typeof SymbolNoMerge;
|
|
535
|
+
/**
|
|
536
|
+
* Prevent applying the `scope` option to this rule/selector
|
|
537
|
+
*/
|
|
538
|
+
readonly noScope: typeof SymbolNoScope;
|
|
539
|
+
/**
|
|
540
|
+
* Additional variants applied to this rule
|
|
541
|
+
*/
|
|
542
|
+
readonly variants: typeof SymbolVariants;
|
|
543
|
+
/**
|
|
544
|
+
* Parent selector (`@media`, `@supports`, etc.)
|
|
545
|
+
*/
|
|
546
|
+
readonly parent: typeof SymbolParent;
|
|
547
|
+
/**
|
|
548
|
+
* Selector modifier
|
|
549
|
+
*/
|
|
550
|
+
readonly selector: typeof SymbolSelector;
|
|
551
|
+
/**
|
|
552
|
+
* Layer modifier
|
|
553
|
+
*/
|
|
554
|
+
readonly layer: typeof SymbolLayer;
|
|
555
|
+
/**
|
|
556
|
+
* Sort modifier
|
|
557
|
+
*/
|
|
558
|
+
readonly sort: typeof SymbolSort;
|
|
559
|
+
/**
|
|
560
|
+
* Custom css body modifier
|
|
561
|
+
*/
|
|
562
|
+
readonly body: typeof SymbolBody;
|
|
563
|
+
}
|
|
564
|
+
interface ControlSymbolsValue {
|
|
565
|
+
[SymbolShortcutsNoMerge]: boolean;
|
|
566
|
+
[SymbolNoMerge]: boolean;
|
|
567
|
+
[SymbolNoScope]: boolean;
|
|
568
|
+
[SymbolVariants]: VariantHandler[] | ((handlers: VariantHandler[]) => VariantHandler[]);
|
|
569
|
+
[SymbolParent]: string;
|
|
570
|
+
[SymbolSelector]: (selector: string) => string;
|
|
571
|
+
[SymbolLayer]: string;
|
|
572
|
+
[SymbolSort]: number;
|
|
573
|
+
[SymbolBody]: string;
|
|
574
|
+
}
|
|
575
|
+
type ObjectToEntry<T> = { [K in keyof T]: [K, T[K]]; }[keyof T];
|
|
576
|
+
type ControlSymbolsEntry = ObjectToEntry<ControlSymbolsValue>;
|
|
577
|
+
interface VariantContext<Theme extends object = object> {
|
|
578
|
+
/**
|
|
579
|
+
* Unprocessed selector from user input.
|
|
580
|
+
*/
|
|
581
|
+
rawSelector: string;
|
|
582
|
+
/**
|
|
583
|
+
* Generator instance
|
|
584
|
+
*/
|
|
585
|
+
generator: TeacssGenerator<Theme>;
|
|
586
|
+
/**
|
|
587
|
+
* The theme object
|
|
588
|
+
*/
|
|
589
|
+
theme: Theme;
|
|
590
|
+
}
|
|
591
|
+
interface ExtractorContext {
|
|
592
|
+
readonly original: string;
|
|
593
|
+
code: string;
|
|
594
|
+
id?: string;
|
|
595
|
+
extracted: Set<string> | CountableSet<string>;
|
|
596
|
+
envMode?: "dev" | "build";
|
|
597
|
+
}
|
|
598
|
+
interface BaseContext<Theme extends object = object> {
|
|
599
|
+
/**
|
|
600
|
+
* Generator instance
|
|
601
|
+
*/
|
|
602
|
+
generator: TeacssGenerator<Theme>;
|
|
603
|
+
/**
|
|
604
|
+
* The theme object
|
|
605
|
+
*/
|
|
606
|
+
theme: Theme;
|
|
607
|
+
}
|
|
608
|
+
interface PreflightContext<Theme extends object = object> extends BaseContext<Theme> {
|
|
609
|
+
/** Utilities produced for this generate() call after postprocessing, including cache hits and excluding preflights. */
|
|
610
|
+
generated?: readonly StringifiedUtil<Theme>[];
|
|
611
|
+
}
|
|
612
|
+
interface SafeListContext<Theme extends object = object> extends BaseContext<Theme> {}
|
|
613
|
+
interface Extractor {
|
|
614
|
+
name: string;
|
|
615
|
+
order?: number;
|
|
616
|
+
/**
|
|
617
|
+
* Extract the code and return a list of selectors.
|
|
618
|
+
*
|
|
619
|
+
* Return `undefined` to skip this extractor.
|
|
620
|
+
*/
|
|
621
|
+
extract?: (ctx: ExtractorContext) => Awaitable<Set<string> | CountableSet<string> | string[] | undefined | void>;
|
|
622
|
+
}
|
|
623
|
+
interface RuleMeta {
|
|
624
|
+
/**
|
|
625
|
+
* The layer name of this rule.
|
|
626
|
+
* @default 'default'
|
|
627
|
+
*/
|
|
628
|
+
layer?: string;
|
|
629
|
+
/**
|
|
630
|
+
* Option to not merge this selector even if the body are the same.
|
|
631
|
+
* @default false
|
|
632
|
+
*/
|
|
633
|
+
noMerge?: boolean;
|
|
634
|
+
/**
|
|
635
|
+
* Option to not apply scope to this selector.
|
|
636
|
+
* @default false
|
|
637
|
+
*/
|
|
638
|
+
noScope?: boolean;
|
|
639
|
+
/**
|
|
640
|
+
* Fine tune sort
|
|
641
|
+
*/
|
|
642
|
+
sort?: number;
|
|
643
|
+
/**
|
|
644
|
+
* Templates to provide autocomplete suggestions
|
|
645
|
+
*/
|
|
646
|
+
autocomplete?: Arrayable<AutoCompleteTemplate>;
|
|
647
|
+
/**
|
|
648
|
+
* Matching prefix before this util
|
|
649
|
+
*/
|
|
650
|
+
prefix?: string | string[];
|
|
651
|
+
/**
|
|
652
|
+
* Internal rules will only be matched from expansions but not the user code.
|
|
653
|
+
* @default false
|
|
654
|
+
*/
|
|
655
|
+
internal?: boolean;
|
|
656
|
+
/**
|
|
657
|
+
* Store the hash of the rule boy
|
|
658
|
+
*
|
|
659
|
+
* @internal
|
|
660
|
+
* @private
|
|
661
|
+
*/
|
|
662
|
+
__hash?: string;
|
|
663
|
+
/**
|
|
664
|
+
* Internal index of the rulelist
|
|
665
|
+
* @internal
|
|
666
|
+
* @private
|
|
667
|
+
*/
|
|
668
|
+
__index?: number;
|
|
669
|
+
/**
|
|
670
|
+
* Custom metadata
|
|
671
|
+
*/
|
|
672
|
+
custom?: Record<string, any>;
|
|
673
|
+
}
|
|
674
|
+
type CSSValue = CSSObject | CSSEntries;
|
|
675
|
+
type CSSValues = CSSValue | CSSValue[];
|
|
676
|
+
type DynamicMatcher<Theme extends object = object> = (match: RegExpMatchArray, context: Readonly<RuleContext<Theme>>) => Awaitable<CSSValueInput | string | (CSSValueInput | string)[] | undefined> | Generator<CSSValueInput | string | undefined> | AsyncGenerator<CSSValueInput | string | undefined>;
|
|
677
|
+
type DynamicRule<Theme extends object = object> = [RegExp, DynamicMatcher<Theme>, RuleMeta?];
|
|
678
|
+
type StaticRule = [string, CSSObjectInput | CSSEntriesInput | (CSSValueInput | string)[], RuleMeta?];
|
|
679
|
+
type Rule<Theme extends object = object> = DynamicRule<Theme> | StaticRule;
|
|
680
|
+
type ExpansionValue = string | CSSValue;
|
|
681
|
+
interface ExpansionInlineValue {
|
|
682
|
+
handles: VariantHandler[];
|
|
683
|
+
value: ExpansionValue;
|
|
684
|
+
}
|
|
685
|
+
type DynamicExpansionMatcher<Theme extends object = object> = (match: RegExpMatchArray, context: Readonly<RuleContext<Theme>>) => string | ExpansionValue[] | undefined;
|
|
686
|
+
type DynamicShortcutMatcher<Theme extends object = object> = DynamicExpansionMatcher<Theme>;
|
|
687
|
+
type StaticShortcut = [string, string | ExpansionValue[], RuleMeta?];
|
|
688
|
+
type StaticShortcutMap = Record<string, string | ExpansionValue[]>;
|
|
689
|
+
type DynamicShortcut<Theme extends object = object> = [RegExp, DynamicShortcutMatcher<Theme>, RuleMeta?];
|
|
690
|
+
type UserShortcuts<Theme extends object = object> = StaticShortcutMap | (StaticShortcut | DynamicShortcut<Theme> | StaticShortcutMap)[];
|
|
691
|
+
type Shortcut<Theme extends object = object> = StaticShortcut | DynamicShortcut<Theme>;
|
|
692
|
+
type ShortcutInlineValue = ExpansionInlineValue;
|
|
693
|
+
type ShortcutValue = ExpansionValue;
|
|
694
|
+
type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
|
|
695
|
+
interface Preflight<Theme extends object = object> {
|
|
696
|
+
getCSS: (context: PreflightContext<Theme>) => Promise<string | undefined> | string | undefined;
|
|
697
|
+
layer?: string;
|
|
698
|
+
}
|
|
699
|
+
interface BlocklistMeta {
|
|
700
|
+
/**
|
|
701
|
+
* Custom message to show why this selector is blocked.
|
|
702
|
+
*/
|
|
703
|
+
message?: string | ((selector: string) => string);
|
|
704
|
+
}
|
|
705
|
+
type BlocklistValue = string | RegExp | ((selector: string) => boolean | null | undefined);
|
|
706
|
+
type BlocklistRule = BlocklistValue | [BlocklistValue, BlocklistMeta];
|
|
707
|
+
interface VariantHandlerContext {
|
|
708
|
+
/**
|
|
709
|
+
* Rewrite the output selector. Often be used to append parents.
|
|
710
|
+
*/
|
|
711
|
+
prefix: string;
|
|
712
|
+
/**
|
|
713
|
+
* Rewrite the output selector. Often be used to append pseudo classes.
|
|
714
|
+
*/
|
|
715
|
+
selector: string;
|
|
716
|
+
/**
|
|
717
|
+
* Rewrite the output selector. Often be used to append pseudo elements.
|
|
718
|
+
*/
|
|
719
|
+
pseudo: string;
|
|
720
|
+
/**
|
|
721
|
+
* Rewrite the output css body. The input come in [key,value][] pairs.
|
|
722
|
+
*/
|
|
723
|
+
entries: CSSEntriesInput;
|
|
724
|
+
/**
|
|
725
|
+
* Provide a parent selector(e.g. media query) to the output css.
|
|
726
|
+
*/
|
|
727
|
+
parent?: string;
|
|
728
|
+
/**
|
|
729
|
+
* Provide order to the `parent` parent selector within layer.
|
|
730
|
+
*/
|
|
731
|
+
parentOrder?: number;
|
|
732
|
+
/**
|
|
733
|
+
* Override layer to the output css.
|
|
734
|
+
*/
|
|
735
|
+
layer?: string;
|
|
736
|
+
/**
|
|
737
|
+
* Order in which the variant is sorted within single rule.
|
|
738
|
+
*/
|
|
739
|
+
sort?: number;
|
|
740
|
+
/**
|
|
741
|
+
* Option to not merge the resulting entries even if the body are the same.
|
|
742
|
+
* @default false
|
|
743
|
+
*/
|
|
744
|
+
noMerge?: boolean;
|
|
745
|
+
}
|
|
746
|
+
interface VariantHandler {
|
|
747
|
+
/**
|
|
748
|
+
* Callback to process the handler.
|
|
749
|
+
*/
|
|
750
|
+
handle?: (input: VariantHandlerContext, next: (input: VariantHandlerContext) => VariantHandlerContext) => VariantHandlerContext;
|
|
751
|
+
/**
|
|
752
|
+
* The result rewritten selector for the next round of matching
|
|
753
|
+
*/
|
|
754
|
+
matcher?: string;
|
|
755
|
+
/**
|
|
756
|
+
* Order in which the variant is applied to selector.
|
|
757
|
+
*/
|
|
758
|
+
order?: number;
|
|
759
|
+
/**
|
|
760
|
+
* Rewrite the output selector. Often be used to append pseudo classes or parents.
|
|
761
|
+
*/
|
|
762
|
+
selector?: (input: string, body: CSSEntriesInput) => string | undefined;
|
|
763
|
+
/**
|
|
764
|
+
* Rewrite the output css body. The input come in [key,value][] pairs.
|
|
765
|
+
*/
|
|
766
|
+
body?: (body: CSSEntriesInput) => CSSEntriesInput | undefined;
|
|
767
|
+
/**
|
|
768
|
+
* Provide a parent selector(e.g. media query) to the output css.
|
|
769
|
+
*/
|
|
770
|
+
parent?: string | [string, number] | undefined;
|
|
771
|
+
/**
|
|
772
|
+
* Order in which the variant is sorted within single rule.
|
|
773
|
+
*/
|
|
774
|
+
sort?: number;
|
|
775
|
+
/**
|
|
776
|
+
* Override layer to the output css.
|
|
777
|
+
*/
|
|
778
|
+
layer?: string | undefined;
|
|
779
|
+
}
|
|
780
|
+
type VariantFunction<Theme extends object = object> = (matcher: string, context: Readonly<VariantContext<Theme>>) => Awaitable<string | VariantHandler | VariantHandler[] | undefined>;
|
|
781
|
+
interface VariantObject<Theme extends object = object> {
|
|
782
|
+
/**
|
|
783
|
+
* The name of the variant.
|
|
784
|
+
*/
|
|
785
|
+
name?: string;
|
|
786
|
+
/**
|
|
787
|
+
* The entry function to match and rewrite the selector for further processing.
|
|
788
|
+
*/
|
|
789
|
+
match: VariantFunction<Theme>;
|
|
790
|
+
/**
|
|
791
|
+
* Sort for when the match is applied.
|
|
792
|
+
*/
|
|
793
|
+
order?: number;
|
|
794
|
+
/**
|
|
795
|
+
* Allows this variant to be used more than once in matching a single rule
|
|
796
|
+
*
|
|
797
|
+
* @default false
|
|
798
|
+
*/
|
|
799
|
+
multiPass?: boolean;
|
|
800
|
+
/**
|
|
801
|
+
* Custom function for auto complete
|
|
802
|
+
*/
|
|
803
|
+
autocomplete?: Arrayable<AutoCompleteFunction | AutoCompleteTemplate>;
|
|
804
|
+
}
|
|
805
|
+
type Variant<Theme extends object = object> = VariantFunction<Theme> | VariantObject<Theme>;
|
|
806
|
+
type Preprocessor = (matcher: string) => string | undefined;
|
|
807
|
+
type Postprocessor = (util: UtilObject) => void | UtilObject | (UtilObject | null | undefined)[];
|
|
808
|
+
type ThemeExtender<Theme extends object = object> = (theme: Theme, config: Readonly<ResolvedConfig<Theme>>) => Theme | void;
|
|
809
|
+
interface ConfigBase<Theme extends object = object> {
|
|
810
|
+
/**
|
|
811
|
+
* Rules to generate CSS utilities.
|
|
812
|
+
*
|
|
813
|
+
* Later entries have higher priority.
|
|
814
|
+
*/
|
|
815
|
+
rules?: Rule<Theme>[];
|
|
816
|
+
/**
|
|
817
|
+
* Variant separator
|
|
818
|
+
*
|
|
819
|
+
* @default [':', '-']
|
|
820
|
+
*/
|
|
821
|
+
separators?: Arrayable<string>;
|
|
822
|
+
/**
|
|
823
|
+
* Variants that preprocess the selectors,
|
|
824
|
+
* having the ability to rewrite the CSS object.
|
|
825
|
+
*/
|
|
826
|
+
variants?: Variant<Theme>[];
|
|
827
|
+
/**
|
|
828
|
+
* Similar to Windi CSS's shortcuts,
|
|
829
|
+
* allows you have create new utilities by combining existing ones.
|
|
830
|
+
*
|
|
831
|
+
* Later entries have higher priority.
|
|
832
|
+
*/
|
|
833
|
+
shortcuts?: UserShortcuts<Theme>;
|
|
834
|
+
/**
|
|
835
|
+
* Rules to exclude the selectors for your design system (to narrow down the possibilities).
|
|
836
|
+
* Combining `warnExcluded` options it can also help you identify wrong usages.
|
|
837
|
+
*/
|
|
838
|
+
blocklist?: BlocklistRule[];
|
|
839
|
+
/**
|
|
840
|
+
* Utilities that always been included
|
|
841
|
+
*/
|
|
842
|
+
safelist?: (string | ((context: SafeListContext<Theme>) => Arrayable<string>))[];
|
|
843
|
+
/**
|
|
844
|
+
* Extractors to handle the source file and outputs possible classes/selectors
|
|
845
|
+
* Can be language-aware.
|
|
846
|
+
*/
|
|
847
|
+
extractors?: Extractor[];
|
|
848
|
+
/**
|
|
849
|
+
* Default extractor that are always applied.
|
|
850
|
+
* By default it split the source code by whitespace and quotes.
|
|
851
|
+
*
|
|
852
|
+
* It maybe be replaced by preset or user config,
|
|
853
|
+
* only one default extractor can be presented,
|
|
854
|
+
* later one will override the previous one.
|
|
855
|
+
*
|
|
856
|
+
* Pass `null` or `false` to disable the default extractor.
|
|
857
|
+
*
|
|
858
|
+
*/
|
|
859
|
+
extractorDefault?: Extractor | null | false;
|
|
860
|
+
/**
|
|
861
|
+
* Raw CSS injections.
|
|
862
|
+
*/
|
|
863
|
+
preflights?: Preflight<Theme>[];
|
|
864
|
+
/**
|
|
865
|
+
* Theme object for shared configuration between rules
|
|
866
|
+
*/
|
|
867
|
+
theme?: Theme;
|
|
868
|
+
/**
|
|
869
|
+
* Layer orders. Default to 0.
|
|
870
|
+
*/
|
|
871
|
+
layers?: Record<string, number>;
|
|
872
|
+
/**
|
|
873
|
+
* Output the internal layers as CSS Cascade Layers.
|
|
874
|
+
*/
|
|
875
|
+
outputToCssLayers?: boolean | OutputCssLayersOptions;
|
|
876
|
+
/**
|
|
877
|
+
* Custom function to sort layers.
|
|
878
|
+
*/
|
|
879
|
+
sortLayers?: (layers: string[]) => string[];
|
|
880
|
+
/**
|
|
881
|
+
* Preprocess the incoming utilities, return falsy value to exclude
|
|
882
|
+
*/
|
|
883
|
+
preprocess?: Arrayable<Preprocessor>;
|
|
884
|
+
/**
|
|
885
|
+
* Postprocess the generate utils object
|
|
886
|
+
*/
|
|
887
|
+
postprocess?: Arrayable<Postprocessor>;
|
|
888
|
+
/**
|
|
889
|
+
* Custom functions mutate the theme object.
|
|
890
|
+
*
|
|
891
|
+
* It's also possible to return a new theme object to completely replace the original one.
|
|
892
|
+
*/
|
|
893
|
+
extendTheme?: Arrayable<ThemeExtender<Theme>>;
|
|
894
|
+
/**
|
|
895
|
+
* Presets
|
|
896
|
+
*/
|
|
897
|
+
presets?: (PresetOrFactoryAwaitable<Theme> | PresetOrFactoryAwaitable<Theme>[])[];
|
|
898
|
+
/**
|
|
899
|
+
* Additional options for auto complete
|
|
900
|
+
*/
|
|
901
|
+
autocomplete?: {
|
|
902
|
+
/**
|
|
903
|
+
* Custom functions / templates to provide autocomplete suggestions
|
|
904
|
+
*/
|
|
905
|
+
templates?: Arrayable<AutoCompleteFunction | AutoCompleteTemplate>;
|
|
906
|
+
/**
|
|
907
|
+
* Custom extractors to pickup possible classes and
|
|
908
|
+
* transform class-name style suggestions to the correct format
|
|
909
|
+
*/
|
|
910
|
+
extractors?: Arrayable<AutoCompleteExtractor>;
|
|
911
|
+
/**
|
|
912
|
+
* Custom shorthands to provide autocomplete suggestions.
|
|
913
|
+
* if values is an array, it will be joined with `|` and wrapped with `()`
|
|
914
|
+
*/
|
|
915
|
+
shorthands?: Record<string, string | string[]>;
|
|
916
|
+
};
|
|
917
|
+
/**
|
|
918
|
+
* Hook to modify the resolved config.
|
|
919
|
+
*
|
|
920
|
+
* First presets runs first and the user config
|
|
921
|
+
*/
|
|
922
|
+
configResolved?: (config: ResolvedConfig<Theme>) => void;
|
|
923
|
+
/**
|
|
924
|
+
* Expose internal details for debugging / inspecting
|
|
925
|
+
*
|
|
926
|
+
* Added `rules`, `shortcuts`, `variants` to the context and expose the context object in `StringifiedUtil`
|
|
927
|
+
*
|
|
928
|
+
* You don't usually need to set this.
|
|
929
|
+
*
|
|
930
|
+
* @default `true` when `envMode` is `dev`, otherwise `false`
|
|
931
|
+
*/
|
|
932
|
+
details?: boolean;
|
|
933
|
+
/**
|
|
934
|
+
* Options for sources to be extracted as utilities usages.
|
|
935
|
+
*
|
|
936
|
+
*/
|
|
937
|
+
content?: ContentOptions;
|
|
938
|
+
/**
|
|
939
|
+
* Custom transformers to the source code.
|
|
940
|
+
*/
|
|
941
|
+
transformers?: SourceCodeTransformer[];
|
|
942
|
+
}
|
|
943
|
+
interface OutputCssLayersOptions {
|
|
944
|
+
/**
|
|
945
|
+
* Specify the css layer that the internal layer should be output to.
|
|
946
|
+
*
|
|
947
|
+
* Return `null` to specify that the layer should not be output to any css layer.
|
|
948
|
+
*/
|
|
949
|
+
cssLayerName?: (internalLayer: string) => string | undefined | null;
|
|
950
|
+
/**
|
|
951
|
+
* Force output all css layers, even if they are not used.
|
|
952
|
+
*
|
|
953
|
+
* @example `@layer theme, preflights, [unused-layer], utilities;`
|
|
954
|
+
*/
|
|
955
|
+
allLayers?: boolean;
|
|
956
|
+
}
|
|
957
|
+
type AutoCompleteTemplate = string;
|
|
958
|
+
type AutoCompleteFunction = (input: string) => Awaitable<string[]>;
|
|
959
|
+
interface AutoCompleteExtractorContext {
|
|
960
|
+
content: string;
|
|
961
|
+
cursor: number;
|
|
962
|
+
}
|
|
963
|
+
interface Replacement {
|
|
964
|
+
/**
|
|
965
|
+
* The range of the original text
|
|
966
|
+
*/
|
|
967
|
+
start: number;
|
|
968
|
+
end: number;
|
|
969
|
+
/**
|
|
970
|
+
* The text used to replace
|
|
971
|
+
*/
|
|
972
|
+
replacement: string;
|
|
973
|
+
}
|
|
974
|
+
interface SuggestResult {
|
|
975
|
+
/**
|
|
976
|
+
* The generated suggestions
|
|
977
|
+
*
|
|
978
|
+
* `[original, formatted]`
|
|
979
|
+
*/
|
|
980
|
+
suggestions: [string, string][];
|
|
981
|
+
/**
|
|
982
|
+
* The function to convert the selected suggestion back.
|
|
983
|
+
* Needs to pass in the original one.
|
|
984
|
+
*/
|
|
985
|
+
resolveReplacement: (suggestion: string) => Replacement;
|
|
986
|
+
}
|
|
987
|
+
interface AutoCompleteExtractorResult {
|
|
988
|
+
/**
|
|
989
|
+
* The extracted string
|
|
990
|
+
*/
|
|
991
|
+
extracted: string;
|
|
992
|
+
/**
|
|
993
|
+
* The function to convert the selected suggestion back
|
|
994
|
+
*/
|
|
995
|
+
resolveReplacement: (suggestion: string) => Replacement;
|
|
996
|
+
/**
|
|
997
|
+
* The function to format suggestions
|
|
998
|
+
*/
|
|
999
|
+
transformSuggestions?: (suggestions: string[]) => string[];
|
|
1000
|
+
}
|
|
1001
|
+
interface AutoCompleteExtractor {
|
|
1002
|
+
name: string;
|
|
1003
|
+
extract: (context: AutoCompleteExtractorContext) => Awaitable<AutoCompleteExtractorResult | null>;
|
|
1004
|
+
order?: number;
|
|
1005
|
+
}
|
|
1006
|
+
interface Preset<Theme extends object = object> extends ConfigBase<Theme> {
|
|
1007
|
+
name: string;
|
|
1008
|
+
/**
|
|
1009
|
+
* Enforce the preset to be applied before or after other presets
|
|
1010
|
+
*/
|
|
1011
|
+
enforce?: "pre" | "post";
|
|
1012
|
+
/**
|
|
1013
|
+
* Preset options for other tools like IDE to consume
|
|
1014
|
+
*/
|
|
1015
|
+
options?: PresetOptions;
|
|
1016
|
+
/**
|
|
1017
|
+
* Apply prefix to all utilities and shortcuts
|
|
1018
|
+
*/
|
|
1019
|
+
prefix?: string | string[];
|
|
1020
|
+
/**
|
|
1021
|
+
* Apply layer to all utilities and shortcuts
|
|
1022
|
+
*/
|
|
1023
|
+
layer?: string;
|
|
1024
|
+
/**
|
|
1025
|
+
* Custom API endpoint for cross-preset communication
|
|
1026
|
+
*/
|
|
1027
|
+
api?: any;
|
|
1028
|
+
/**
|
|
1029
|
+
* Custom metadata for the preset
|
|
1030
|
+
*/
|
|
1031
|
+
meta?: Record<string, any>;
|
|
1032
|
+
}
|
|
1033
|
+
type PresetFactory<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Preset<Theme>;
|
|
1034
|
+
type PresetFactoryAwaitable<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Awaitable<Preset<Theme>>;
|
|
1035
|
+
type PresetOrFactory<Theme extends object = object> = Preset<Theme> | PresetFactory<Theme, any>;
|
|
1036
|
+
type PresetOrFactoryAwaitable<Theme extends object = object> = PresetOrFactory<Theme> | Promise<Preset<Theme>> | PresetFactoryAwaitable<Theme>;
|
|
1037
|
+
interface GeneratorOptions {
|
|
1038
|
+
/**
|
|
1039
|
+
* Merge utilities with the exact same body to save the file size
|
|
1040
|
+
*
|
|
1041
|
+
* @default true
|
|
1042
|
+
*/
|
|
1043
|
+
mergeSelectors?: boolean;
|
|
1044
|
+
/**
|
|
1045
|
+
* Emit warning when matched selectors are presented in blocklist
|
|
1046
|
+
*
|
|
1047
|
+
* @default true
|
|
1048
|
+
*/
|
|
1049
|
+
warn?: boolean;
|
|
1050
|
+
}
|
|
1051
|
+
interface UserOnlyOptions<Theme extends object = object> {
|
|
1052
|
+
/**
|
|
1053
|
+
* Plain theme objects are deep-merged with preset themes. Non-plain themes
|
|
1054
|
+
* are atomic; use `$reset` to replace one with a plain object or
|
|
1055
|
+
* `extendTheme` for class-aware composition.
|
|
1056
|
+
*/
|
|
1057
|
+
theme?: Theme;
|
|
1058
|
+
/**
|
|
1059
|
+
* Layer name for shortcuts
|
|
1060
|
+
*
|
|
1061
|
+
* @default 'shortcuts'
|
|
1062
|
+
*/
|
|
1063
|
+
shortcutsLayer?: string;
|
|
1064
|
+
/**
|
|
1065
|
+
* Environment mode
|
|
1066
|
+
*
|
|
1067
|
+
* @default 'build'
|
|
1068
|
+
*/
|
|
1069
|
+
envMode?: "dev" | "build";
|
|
1070
|
+
/**
|
|
1071
|
+
* Custom prefix for virtual modules
|
|
1072
|
+
*
|
|
1073
|
+
* @default '__tea'
|
|
1074
|
+
*/
|
|
1075
|
+
virtualModulePrefix?: string;
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* For cli config
|
|
1079
|
+
*/
|
|
1080
|
+
interface CliOptions {
|
|
1081
|
+
cli?: {
|
|
1082
|
+
entry?: Arrayable<CliEntryItem>;
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
interface TeacssPluginContext<Config extends UserConfig = UserConfig> {
|
|
1086
|
+
/**
|
|
1087
|
+
* Singleton promise for config loading
|
|
1088
|
+
*/
|
|
1089
|
+
ready: Promise<LoadConfigResult<Config>>;
|
|
1090
|
+
/**
|
|
1091
|
+
* The generator instance. Should be used after `ready` resolved.
|
|
1092
|
+
*/
|
|
1093
|
+
generator: TeacssGenerator;
|
|
1094
|
+
/**
|
|
1095
|
+
* All tokens scanned
|
|
1096
|
+
*/
|
|
1097
|
+
tokens: Set<string>;
|
|
1098
|
+
/**
|
|
1099
|
+
* Current transformed or extracted content keyed by module ID
|
|
1100
|
+
*/
|
|
1101
|
+
modules: BetterMap<string, string>;
|
|
1102
|
+
/**
|
|
1103
|
+
* Module IDs
|
|
1104
|
+
*/
|
|
1105
|
+
affectedModules: Set<string>;
|
|
1106
|
+
/**
|
|
1107
|
+
* Pending promises
|
|
1108
|
+
*/
|
|
1109
|
+
tasks: Promise<any>[];
|
|
1110
|
+
/**
|
|
1111
|
+
* Await all pending tasks
|
|
1112
|
+
*/
|
|
1113
|
+
flushTasks: () => Promise<any>;
|
|
1114
|
+
filter: (code: string, id: string) => boolean;
|
|
1115
|
+
extract: (code: string, id?: string) => Promise<void>;
|
|
1116
|
+
reloadConfig: () => Promise<LoadConfigResult<Config>>;
|
|
1117
|
+
getConfig: () => Promise<Config>;
|
|
1118
|
+
/** Subscribe to config reloads. Returns a function that removes the listener. */
|
|
1119
|
+
onReload: (fn: () => void) => () => void;
|
|
1120
|
+
invalidate: () => void;
|
|
1121
|
+
/** Subscribe to generated-output invalidations. Returns a function that removes the listener. */
|
|
1122
|
+
onInvalidate: (fn: () => void) => () => void;
|
|
1123
|
+
root: string;
|
|
1124
|
+
updateRoot: (root: string) => Promise<LoadConfigResult<Config>>;
|
|
1125
|
+
getConfigFileList: () => string[];
|
|
1126
|
+
/**
|
|
1127
|
+
* Get regexes to match virtual module ids
|
|
1128
|
+
*/
|
|
1129
|
+
getVMPRegexes: () => Promise<{
|
|
1130
|
+
prefix: string;
|
|
1131
|
+
RESOLVED_ID_WITH_QUERY_RE: RegExp;
|
|
1132
|
+
RESOLVED_ID_RE: RegExp;
|
|
1133
|
+
}>;
|
|
1134
|
+
}
|
|
1135
|
+
interface SourceMap {
|
|
1136
|
+
file?: string;
|
|
1137
|
+
mappings?: string;
|
|
1138
|
+
names?: string[];
|
|
1139
|
+
sources?: string[];
|
|
1140
|
+
sourcesContent?: string[];
|
|
1141
|
+
version?: number;
|
|
1142
|
+
}
|
|
1143
|
+
interface HighlightAnnotation {
|
|
1144
|
+
offset: number;
|
|
1145
|
+
length: number;
|
|
1146
|
+
className: string;
|
|
1147
|
+
}
|
|
1148
|
+
type SourceCodeTransformerEnforce = "pre" | "post" | "default";
|
|
1149
|
+
interface SourceCodeTransformer {
|
|
1150
|
+
name: string;
|
|
1151
|
+
/**
|
|
1152
|
+
* The order of transformer
|
|
1153
|
+
*/
|
|
1154
|
+
enforce?: SourceCodeTransformerEnforce;
|
|
1155
|
+
/**
|
|
1156
|
+
* Custom id filter, if not provided, the extraction filter will be applied
|
|
1157
|
+
*/
|
|
1158
|
+
idFilter?: (id: string) => boolean;
|
|
1159
|
+
/**
|
|
1160
|
+
* The transform function
|
|
1161
|
+
*/
|
|
1162
|
+
transform: (code: MagicStringLike, id: string, ctx: TeacssPluginContext) => Awaitable<{
|
|
1163
|
+
highlightAnnotations?: HighlightAnnotation[];
|
|
1164
|
+
} | void>;
|
|
1165
|
+
/**
|
|
1166
|
+
* Release state owned by a module after the integration removes it.
|
|
1167
|
+
*/
|
|
1168
|
+
onModuleRemoved?: (id: string, ctx: TeacssPluginContext) => Awaitable<void>;
|
|
1169
|
+
}
|
|
1170
|
+
interface ContentOptions {
|
|
1171
|
+
/**
|
|
1172
|
+
* Glob patterns to extract from the file system, in addition to other content sources.
|
|
1173
|
+
*
|
|
1174
|
+
* In dev mode, the files will be watched and trigger HMR.
|
|
1175
|
+
*
|
|
1176
|
+
* @default []
|
|
1177
|
+
*/
|
|
1178
|
+
filesystem?: string[];
|
|
1179
|
+
/**
|
|
1180
|
+
* Inline text to be extracted
|
|
1181
|
+
*/
|
|
1182
|
+
inline?: (string | {
|
|
1183
|
+
code: string;
|
|
1184
|
+
id?: string;
|
|
1185
|
+
} | (() => Awaitable<string | {
|
|
1186
|
+
code: string;
|
|
1187
|
+
id?: string;
|
|
1188
|
+
}>))[];
|
|
1189
|
+
/**
|
|
1190
|
+
* Filters to determine whether to extract certain modules from the build tools' transformation pipeline.
|
|
1191
|
+
*
|
|
1192
|
+
* Used by integrations that receive source modules from a build pipeline.
|
|
1193
|
+
*
|
|
1194
|
+
* Set `false` to disable.
|
|
1195
|
+
*/
|
|
1196
|
+
pipeline?: false | {
|
|
1197
|
+
/**
|
|
1198
|
+
* Patterns that filter the files being extracted.
|
|
1199
|
+
* Supports regular expressions and `picomatch` glob patterns.
|
|
1200
|
+
*
|
|
1201
|
+
* By default, `.ts` and `.js` files are NOT extracted.
|
|
1202
|
+
*
|
|
1203
|
+
* @see https://www.npmjs.com/package/picomatch
|
|
1204
|
+
* @default [/\.(vue|svelte|[jt]sx|vine.ts|mdx?|astro|elm|php|phtml|marko|html)($|\?)/]
|
|
1205
|
+
*/
|
|
1206
|
+
include?: FilterPattern;
|
|
1207
|
+
/**
|
|
1208
|
+
* Patterns that filter the files NOT being extracted.
|
|
1209
|
+
* Supports regular expressions and `picomatch` glob patterns.
|
|
1210
|
+
*
|
|
1211
|
+
* By default, `node_modules` and `dist` are also extracted.
|
|
1212
|
+
*
|
|
1213
|
+
* @see https://www.npmjs.com/package/picomatch
|
|
1214
|
+
* @default [/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/]
|
|
1215
|
+
*/
|
|
1216
|
+
exclude?: FilterPattern;
|
|
1217
|
+
};
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* For other modules to aggregate the options
|
|
1221
|
+
*/
|
|
1222
|
+
interface PluginOptions {
|
|
1223
|
+
/**
|
|
1224
|
+
* Custom transformers to the source code
|
|
1225
|
+
*/
|
|
1226
|
+
transformers?: SourceCodeTransformer[];
|
|
1227
|
+
/**
|
|
1228
|
+
* Options for sources to be extracted as utilities usages
|
|
1229
|
+
*
|
|
1230
|
+
* Supported sources:
|
|
1231
|
+
* - `filesystem` - extract from file system
|
|
1232
|
+
* - `inline` - extract from plain inline text
|
|
1233
|
+
* - `pipeline` - extract from a build tool's transformation pipeline
|
|
1234
|
+
*
|
|
1235
|
+
* The usage extracted from each source will be **merged** together.
|
|
1236
|
+
*/
|
|
1237
|
+
content?: ContentOptions;
|
|
1238
|
+
}
|
|
1239
|
+
interface UserConfig<Theme extends object = object> extends ConfigBase<Theme>, UserOnlyOptions<Theme>, GeneratorOptions, PluginOptions, CliOptions {}
|
|
1240
|
+
interface UserConfigDefaults<Theme extends object = object> extends ConfigBase<Theme>, UserOnlyOptions<Theme> {}
|
|
1241
|
+
interface ResolvedConfig<Theme extends object = object> extends Omit<RequiredByKey<UserConfig<Theme>, "mergeSelectors" | "theme" | "rules" | "variants" | "layers" | "extractors" | "blocklist" | "safelist" | "preflights" | "sortLayers">, "rules" | "shortcuts" | "autocomplete" | "presets"> {
|
|
1242
|
+
presets: Preset<Theme>[];
|
|
1243
|
+
shortcuts: Shortcut<Theme>[];
|
|
1244
|
+
variants: VariantObject<Theme>[];
|
|
1245
|
+
preprocess: Preprocessor[];
|
|
1246
|
+
postprocess: Postprocessor[];
|
|
1247
|
+
rulesSize: number;
|
|
1248
|
+
rules: readonly Rule<Theme>[];
|
|
1249
|
+
rulesDynamic: readonly DynamicRule<Theme>[];
|
|
1250
|
+
rulesStaticMap: Record<string, StaticRule | undefined>;
|
|
1251
|
+
autocomplete: {
|
|
1252
|
+
templates: (AutoCompleteFunction | AutoCompleteTemplate)[];
|
|
1253
|
+
extractors: AutoCompleteExtractor[];
|
|
1254
|
+
shorthands: Record<string, string>;
|
|
1255
|
+
};
|
|
1256
|
+
separators: string[];
|
|
1257
|
+
}
|
|
1258
|
+
interface GenerateResult<T = Set<string>> {
|
|
1259
|
+
css: string;
|
|
1260
|
+
layers: string[];
|
|
1261
|
+
getLayer: (name?: string) => string | undefined;
|
|
1262
|
+
getLayers: (includes?: string[], excludes?: string[]) => string;
|
|
1263
|
+
setLayer: (layer: string, callback: (content: string) => Awaitable<string>) => Promise<string>;
|
|
1264
|
+
matched: T;
|
|
1265
|
+
}
|
|
1266
|
+
type VariantMatchedResult<Theme extends object = object> = [raw: string, current: string, variantHandlers: VariantHandler[], variants: Set<Variant<Theme>>];
|
|
1267
|
+
type ParsedUtil = readonly [index: number, raw: string, entries: CSSEntriesInput, meta: RuleMeta | undefined, variantHandlers: VariantHandler[]];
|
|
1268
|
+
type RawUtil = readonly [index: number, rawCSS: string, meta: RuleMeta | undefined];
|
|
1269
|
+
type StringifiedUtil<Theme extends object = object> = readonly [index: number, selector: string | undefined, body: string, parent: string | undefined, meta: RuleMeta | undefined, context: RuleContext<Theme> | undefined, noMerge: boolean | undefined];
|
|
1270
|
+
type PreparedRule = readonly [selector: [string, number][], body: string, noMerge: boolean];
|
|
1271
|
+
interface CliEntryItem {
|
|
1272
|
+
patterns: string[];
|
|
1273
|
+
outFile: string;
|
|
1274
|
+
/**
|
|
1275
|
+
* Whether to rewrite the transformed utilities.
|
|
1276
|
+
*
|
|
1277
|
+
* - For css: if rewrite is true, it will not generate a new file, but directly modify the original file content.
|
|
1278
|
+
* - For other files: if rewrite is true, it replaces the original file with the transformed content.
|
|
1279
|
+
*
|
|
1280
|
+
* @default false
|
|
1281
|
+
*/
|
|
1282
|
+
rewrite?: boolean;
|
|
1283
|
+
/**
|
|
1284
|
+
* Whether to output CSS files scanned from patterns to outFile
|
|
1285
|
+
*
|
|
1286
|
+
* - false: Do not output CSS files
|
|
1287
|
+
* - true: Transform and output scanned CSS file contents to outFile
|
|
1288
|
+
* - 'multi': Output each CSS file separately with filename format `${originFile}-[hash]`
|
|
1289
|
+
* - 'single': Merge multiple CSS files into one output file named `outFile-merged.css`
|
|
1290
|
+
*
|
|
1291
|
+
* @default true
|
|
1292
|
+
*/
|
|
1293
|
+
splitCss?: boolean | "multi" | "single";
|
|
1294
|
+
}
|
|
1295
|
+
interface UtilObject {
|
|
1296
|
+
selector: string;
|
|
1297
|
+
entries: CSSEntriesInput;
|
|
1298
|
+
parent: string | undefined;
|
|
1299
|
+
layer: string | undefined;
|
|
1300
|
+
sort: number | undefined;
|
|
1301
|
+
noMerge: boolean | undefined;
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Returned from `tea.generate()` when `extendedInfo` option is enabled.
|
|
1305
|
+
*/
|
|
1306
|
+
interface ExtendedTokenInfo<Theme extends object = object> {
|
|
1307
|
+
/**
|
|
1308
|
+
* Stringified util data
|
|
1309
|
+
*/
|
|
1310
|
+
data: StringifiedUtil<Theme>[];
|
|
1311
|
+
/**
|
|
1312
|
+
* Return -1 if the data structure is not countable
|
|
1313
|
+
*/
|
|
1314
|
+
count: number;
|
|
1315
|
+
}
|
|
1316
|
+
interface GenerateOptions<T extends boolean> {
|
|
1317
|
+
/**
|
|
1318
|
+
* Filepath of the file being processed.
|
|
1319
|
+
*/
|
|
1320
|
+
id?: string;
|
|
1321
|
+
/**
|
|
1322
|
+
* Generate preflights (if defined)
|
|
1323
|
+
*
|
|
1324
|
+
* @default true
|
|
1325
|
+
*/
|
|
1326
|
+
preflights?: boolean;
|
|
1327
|
+
/**
|
|
1328
|
+
* Includes safelist
|
|
1329
|
+
*/
|
|
1330
|
+
safelist?: boolean;
|
|
1331
|
+
/**
|
|
1332
|
+
* Generate minified CSS
|
|
1333
|
+
* @default false
|
|
1334
|
+
*/
|
|
1335
|
+
minify?: boolean;
|
|
1336
|
+
/**
|
|
1337
|
+
* Maximum number of tokens parsed concurrently. Omit to preserve unbounded
|
|
1338
|
+
* scheduling; set a positive integer to cap peak work for large inputs.
|
|
1339
|
+
*/
|
|
1340
|
+
tokenConcurrency?: number;
|
|
1341
|
+
/**
|
|
1342
|
+
* @experimental
|
|
1343
|
+
*/
|
|
1344
|
+
scope?: string;
|
|
1345
|
+
/**
|
|
1346
|
+
* If return extended "matched" with payload and count
|
|
1347
|
+
*/
|
|
1348
|
+
extendedInfo?: T;
|
|
1349
|
+
}
|
|
1350
|
+
//#endregion
|
|
1351
|
+
//#region src/condition-variant.d.ts
|
|
1352
|
+
interface ConditionVariantOptions {
|
|
1353
|
+
/**
|
|
1354
|
+
* Variant name (for debugging / `details`).
|
|
1355
|
+
* @default "at-condition"
|
|
1356
|
+
*/
|
|
1357
|
+
name?: string;
|
|
1358
|
+
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Build the `@` condition-axis variant from a vocabulary of {@link ConditionResolver}s.
|
|
1361
|
+
*
|
|
1362
|
+
* When a token carries trailing `@cond` segments, the variant:
|
|
1363
|
+
* - parses + resolves them with the supplied `resolvers`,
|
|
1364
|
+
* - strips the `@cond` from the `matcher` so the remaining declaration (plus an
|
|
1365
|
+
* optional `!`) still matches a rule, and
|
|
1366
|
+
* - in `handle`, appends the resolved selector parts around the styled element.
|
|
1367
|
+
*
|
|
1368
|
+
* If any condition is unrecognized by the resolvers, the token is left unclaimed
|
|
1369
|
+
* (`undefined`), preserving the generator's behavior for unknown tokens.
|
|
1370
|
+
*/
|
|
1371
|
+
declare function createConditionVariant<Theme extends object = object>(resolvers: ConditionResolver[], options?: ConditionVariantOptions): VariantObject<Theme>;
|
|
1372
|
+
//#endregion
|
|
1373
|
+
//#region src/config.d.ts
|
|
1374
|
+
declare function resolveShortcuts<Theme extends object = object>(shortcuts: UserShortcuts<Theme>): Shortcut<Theme>[];
|
|
1375
|
+
/**
|
|
1376
|
+
* Resolve a single preset, nested presets are ignored
|
|
1377
|
+
*/
|
|
1378
|
+
declare function resolvePreset<Theme extends object = object>(presetInput: PresetOrFactoryAwaitable<Theme>): Promise<Preset<Theme>>;
|
|
1379
|
+
/**
|
|
1380
|
+
* Resolve presets with nested presets
|
|
1381
|
+
*/
|
|
1382
|
+
declare function resolvePresets<Theme extends object = object>(preset: PresetOrFactoryAwaitable<Theme>): Promise<Preset<Theme>[]>;
|
|
1383
|
+
declare function resolveConfig<Theme extends object = object>(userConfig?: UserConfig<Theme>, defaults?: UserConfigDefaults<Theme>): Promise<ResolvedConfig<Theme>>;
|
|
1384
|
+
declare function mergeConfigs<Theme extends object = object>(configs: UserConfig<Theme>[]): UserConfig<Theme>;
|
|
1385
|
+
declare function definePreset<Options extends object | undefined = undefined, Theme extends object = object>(preset: PresetFactory<Theme, Options>): PresetFactory<Theme, Options>;
|
|
1386
|
+
declare function definePreset<Options extends object | undefined = undefined, Theme extends object = object>(preset: PresetFactoryAwaitable<Theme, Options>): PresetFactoryAwaitable<Theme, Options>;
|
|
1387
|
+
declare function definePreset<Theme extends object = object>(preset: Preset<Theme>): Preset<Theme>;
|
|
1388
|
+
//#endregion
|
|
1389
|
+
//#region src/constants.d.ts
|
|
1390
|
+
declare const LAYER_IMPORTS = "imports";
|
|
1391
|
+
declare const LAYER_PRIMITIVES = "primitives";
|
|
1392
|
+
declare const LAYER_PROPERTIES = "properties";
|
|
1393
|
+
declare const LAYER_PREFLIGHTS = "preflights";
|
|
1394
|
+
declare const LAYER_SHORTCUTS = "shortcuts";
|
|
1395
|
+
declare const LAYER_UTILITIES = "utilities";
|
|
1396
|
+
declare const DEFAULT_LAYERS: Readonly<{
|
|
1397
|
+
imports: -200;
|
|
1398
|
+
properties: -150;
|
|
1399
|
+
preflights: -100;
|
|
1400
|
+
shortcuts: -50;
|
|
1401
|
+
primitives: -10;
|
|
1402
|
+
utilities: 0;
|
|
1403
|
+
}>;
|
|
1404
|
+
//#endregion
|
|
1405
|
+
//#region src/env.d.ts
|
|
1406
|
+
declare function getEnvFlags(): {
|
|
1407
|
+
isNode: boolean;
|
|
1408
|
+
isVSCode: boolean;
|
|
1409
|
+
isESLint: boolean;
|
|
1410
|
+
};
|
|
1411
|
+
//#endregion
|
|
1412
|
+
//#region src/extractors/split.d.ts
|
|
1413
|
+
declare const defaultSplitRE: RegExp;
|
|
1414
|
+
declare const splitWithVariantGroupRE: RegExp;
|
|
1415
|
+
declare const extractorSplit: Extractor;
|
|
1416
|
+
//#endregion
|
|
1417
|
+
//#region src/group.d.ts
|
|
1418
|
+
/** Expand groups in host source, including groups nested in strings/arrays. */
|
|
1419
|
+
declare function expandGroups(code: string): string;
|
|
1420
|
+
/** Expand groups in a class list while preserving braces inside attached literals. */
|
|
1421
|
+
declare function expandClassGroups(code: string): string;
|
|
1422
|
+
//#endregion
|
|
1423
|
+
//#region src/hash.d.ts
|
|
1424
|
+
declare function getHash(input: string, length?: number): string;
|
|
1425
|
+
//#endregion
|
|
1426
|
+
//#region src/literal.d.ts
|
|
1427
|
+
/**
|
|
1428
|
+
* Literal regions — `()` and `[]`.
|
|
1429
|
+
*
|
|
1430
|
+
* Inside `()` (a CSS function) and `[]` (an arbitrary value / selector), characters
|
|
1431
|
+
* are taken literally and operators do not participate in symbol parsing — they only
|
|
1432
|
+
* act at depth 0 in the token and condition parsers. This module turns the
|
|
1433
|
+
* *contents* of those regions into their final CSS form:
|
|
1434
|
+
*
|
|
1435
|
+
* - `()` = CSS function: `_` stays literal (`var(--my_var)`), and `calc` / `clamp` /
|
|
1436
|
+
* `min` / `max` operators get surrounding spaces the engine fills in.
|
|
1437
|
+
* - `[]` = arbitrary value / selector: `_` means a space, `\_` means a literal
|
|
1438
|
+
* underscore (`|` is NOT used for spaces). `_` inside a nested `()` stays literal.
|
|
1439
|
+
*
|
|
1440
|
+
* These are pure string utilities, consistent with `parseClassToken` and the
|
|
1441
|
+
* condition parser. They do not resolve rules, theme, or bracket *type hints*
|
|
1442
|
+
* (`[color:red]` etc.) — that interpretation belongs to the rule/preset layer.
|
|
1443
|
+
*/
|
|
1444
|
+
/**
|
|
1445
|
+
* Split a class list on whitespace outside attached `[]` literal regions.
|
|
1446
|
+
*
|
|
1447
|
+
* Unlike the source extractor, this does not treat quotes, semicolons, braces,
|
|
1448
|
+
* or backticks as delimiters. It is for already-isolated class-list surfaces
|
|
1449
|
+
* such as shortcuts, `cn()`, and `@apply`.
|
|
1450
|
+
*/
|
|
1451
|
+
declare function splitClassTokens(input: string): string[];
|
|
1452
|
+
/**
|
|
1453
|
+
* Expand `_` to a space inside an arbitrary `[]` region.
|
|
1454
|
+
*
|
|
1455
|
+
* - `\_` → a literal underscore.
|
|
1456
|
+
* - `_` at paren depth 0 → a space.
|
|
1457
|
+
* - `_` inside `(…)` → kept literal (so `var(--my_var)` survives).
|
|
1458
|
+
*/
|
|
1459
|
+
declare function expandUnderscores(content: string): string;
|
|
1460
|
+
/**
|
|
1461
|
+
* Add surrounding spaces to `+ - * /` operators inside balanced `calc()` /
|
|
1462
|
+
* `clamp()` / `min()` / `max()` functions without rewriting adjacent values,
|
|
1463
|
+
* quoted text, URLs, custom-property names, or numeric exponent signs.
|
|
1464
|
+
*/
|
|
1465
|
+
declare function spaceCalcOperators(str: string): string;
|
|
1466
|
+
/** True when `value` is a single `[…]` arbitrary region. */
|
|
1467
|
+
declare function isArbitrary(value: string): boolean;
|
|
1468
|
+
interface NormalizeArbitraryOptions {
|
|
1469
|
+
/**
|
|
1470
|
+
* Apply `calc` / `clamp` / `min` / `max` operator spacing.
|
|
1471
|
+
* @default true
|
|
1472
|
+
*/
|
|
1473
|
+
calc?: boolean;
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Normalize a value's literal regions to final CSS.
|
|
1477
|
+
*
|
|
1478
|
+
* - A `[…]` arbitrary value has its brackets stripped and underscores expanded
|
|
1479
|
+
* (`_`→space, `\_`→`_`, `_` inside `()` kept).
|
|
1480
|
+
* - `calc` / `clamp` / `min` / `max` operators get spacing (in both arbitrary and
|
|
1481
|
+
* raw function values).
|
|
1482
|
+
* - A raw value (no brackets) keeps `_` literal — only `[]` uses `_` for spaces.
|
|
1483
|
+
*
|
|
1484
|
+
* Bracket *type hints* (`[color:red]`, `[length:4px]`) are intentionally not
|
|
1485
|
+
* interpreted here; that is the rule/preset layer's job.
|
|
1486
|
+
*
|
|
1487
|
+
* @example normalizeArbitraryValue("[1px_solid_red]") // "1px solid red"
|
|
1488
|
+
* @example normalizeArbitraryValue("calc(100%-1rem)") // "calc(100% - 1rem)"
|
|
1489
|
+
* @example normalizeArbitraryValue("var(--my_var)") // "var(--my_var)"
|
|
1490
|
+
*/
|
|
1491
|
+
declare function normalizeArbitraryValue(value: string, options?: NormalizeArbitraryOptions): string;
|
|
1492
|
+
//#endregion
|
|
1493
|
+
//#region src/markers.d.ts
|
|
1494
|
+
declare const INCLUDE_COMMENT = "@teacss-include";
|
|
1495
|
+
declare const IGNORE_COMMENT = "@teacss-ignore";
|
|
1496
|
+
declare const INCLUDE_COMMENT_IDE = "@teacss-ide-include";
|
|
1497
|
+
declare const CSS_PLACEHOLDER = "@teacss-placeholder";
|
|
1498
|
+
declare const SKIP_START_COMMENT = "@teacss-skip-start";
|
|
1499
|
+
declare const SKIP_END_COMMENT = "@teacss-skip-end";
|
|
1500
|
+
declare const SKIP_COMMENT_RE: RegExp;
|
|
1501
|
+
declare const VIRTUAL_ENTRY_ALIAS: RegExp[];
|
|
1502
|
+
declare const LAYER_MARK_ALL = "__ALL__";
|
|
1503
|
+
//#endregion
|
|
1504
|
+
//#region src/token.d.ts
|
|
1505
|
+
/**
|
|
1506
|
+
* Token parsing primitives.
|
|
1507
|
+
*
|
|
1508
|
+
* Splits a single TeaCSS class token into its stable structural parts so every
|
|
1509
|
+
* later stage (the `@` condition axis, escaping, rules) can build on one source
|
|
1510
|
+
* of truth. This module is pure structure: it does not resolve rules, variants,
|
|
1511
|
+
* or CSS. The current token shape is documented in
|
|
1512
|
+
* `docs/proposals/v00-teacss.md`.
|
|
1513
|
+
*
|
|
1514
|
+
* Token shape:
|
|
1515
|
+
*
|
|
1516
|
+
* ```txt
|
|
1517
|
+
* (property:value | keyword)[!](@cond)*
|
|
1518
|
+
* ```
|
|
1519
|
+
*
|
|
1520
|
+
* - A declaration is either `property:value` (split on the first depth-0 `:`) or
|
|
1521
|
+
* a bare keyword (no depth-0 `:`, e.g. `relative`, `sticky`, `truncate`).
|
|
1522
|
+
* - `()` and `[]` are literal regions; operators inside them (`:` `!` `@` …) do
|
|
1523
|
+
* not participate in parsing.
|
|
1524
|
+
* - `!` immediately after the value (before any `@`) is `!important`.
|
|
1525
|
+
* - The value extends up to the first depth-0 `!` or `@`.
|
|
1526
|
+
* - Zero or more `@cond` segments follow; each is captured verbatim (without its
|
|
1527
|
+
* leading `@`). Interpreting a condition (pseudo / target / media / NOT `!…` …)
|
|
1528
|
+
* belongs to the condition pipeline.
|
|
1529
|
+
*/
|
|
1530
|
+
interface ParsedClassToken {
|
|
1531
|
+
/** The full original token, unchanged. */
|
|
1532
|
+
raw: string;
|
|
1533
|
+
/** Declaration body without the trailing `!` or any `@cond` (e.g. `bg:red`, `d:flex`, `content:[""]`). */
|
|
1534
|
+
body: string;
|
|
1535
|
+
/** Property side, present only when the declaration has a depth-0 `:`. */
|
|
1536
|
+
property?: string;
|
|
1537
|
+
/** Value side, present only when the declaration has a depth-0 `:`. */
|
|
1538
|
+
value?: string;
|
|
1539
|
+
/** True when the declaration is a bare keyword (no depth-0 `:`). */
|
|
1540
|
+
keyword: boolean;
|
|
1541
|
+
/** True when a depth-0 `!` immediately follows the value (`!important`). */
|
|
1542
|
+
important: boolean;
|
|
1543
|
+
/** Ordered `@cond` segments, each without its leading `@` (e.g. `["hover"]`, `[">li::after"]`). */
|
|
1544
|
+
conditions: string[];
|
|
1545
|
+
}
|
|
1546
|
+
/**
|
|
1547
|
+
* Parse a single class token into its structural parts.
|
|
1548
|
+
*
|
|
1549
|
+
* Pure and total: any non-empty string yields a result. Malformed tokens (e.g.
|
|
1550
|
+
* unbalanced brackets) are parsed leniently rather than throwing — validation is
|
|
1551
|
+
* left to the rule layer.
|
|
1552
|
+
*/
|
|
1553
|
+
declare function parseClassToken(raw: string): ParsedClassToken;
|
|
1554
|
+
//#endregion
|
|
1555
|
+
export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BaseContext, BetterMap, BlocklistMeta, BlocklistRule, BlocklistValue, BuiltConditionSelector, CSSEntries, CSSEntriesInput, CSSEntry, CSSObject, CSSObjectInput, CSSValue, CSSValueInput, CSSValues, CSS_PLACEHOLDER, CliEntryItem, CliOptions, ConditionKind, ConditionResolveContext, ConditionResolver, ConditionVariantOptions, ConfigBase, ContentOptions, ControlSymbols, ControlSymbolsEntry, ControlSymbolsValue, CountableSet, DEFAULT_LAYERS, DeepPartial, DynamicExpansionMatcher, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, Emitter, ExpansionInlineValue, ExpansionValue, ExtendedTokenInfo, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateOptions, GenerateResult, GeneratorOptions, HighlightAnnotation, IGNORE_COMMENT, INCLUDE_COMMENT, INCLUDE_COMMENT_IDE, LAYER_IMPORTS, LAYER_MARK_ALL, LAYER_PREFLIGHTS, LAYER_PRIMITIVES, LAYER_PROPERTIES, LAYER_SHORTCUTS, LAYER_UTILITIES, LoadConfigResult, MagicStringLike, NormalizeArbitraryOptions, ObjectToEntry, OutputCssLayersOptions, ParsedClassToken, ParsedCondition, ParsedUtil, PartialByKeys, PluginOptions, Postprocessor, Preflight, PreflightContext, PreparedGeneratorConfig, PreparedRule, Preprocessor, Preset, PresetFactory, PresetFactoryAwaitable, PresetOptions, PresetOrFactory, PresetOrFactoryAwaitable, RESET_KEY, RawUtil, Replacement, RequiredByKey, ResolveConditionsResult, ResolvedCondition, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, SKIP_COMMENT_RE, SKIP_END_COMMENT, SKIP_START_COMMENT, SafeListContext, Shift, Shortcut, ShortcutInlineValue, ShortcutValue, SourceCodeTransformer, SourceCodeTransformerEnforce, SourceMap, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, SuggestResult, TeacssGenerator, TeacssPluginContext, ThemeExtender, ToArray, TwoKeyMap, Unsubscribe, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, VIRTUAL_ENTRY_ALIAS, Variant, VariantContext, VariantFunction, VariantHandler, VariantHandlerContext, VariantMatchedResult, VariantObject, VirtualKey, attributifyRE, buildConditionSelector, clearIdenticalEntries, clone, collapseVariantGroup, createConditionVariant, createGenerator, createNanoEvents, cssIdRE, defaultSplitRE, definePreset, e, entriesToCss, escapeRegExp, escapeSelector, expandClassGroups, expandGroups, expandUnderscores, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, getEnvFlags, getHash, getPath, hasScopePlaceholder, hash, isArbitrary, isAttributifySelector, isCountableSet, isCssId, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isThenable, isValidSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeArbitraryValue, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseClassToken, parseCondition, parseConditions, parseVariantGroup, regexScopePlaceholder, replaceAsync, resolveConditions, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, restoreSkipCode, spaceCalcOperators, splitClassTokens, splitWithVariantGroupRE, symbols, toArray, toEscapedSelector, transformSkipCode, uniq, uniqueBy, validateFilterRE, warnOnce, withLayer };
|