tailwindcss 4.1.4 → 4.1.18
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/README.md +1 -5
- package/dist/chunk-CT46QCH7.mjs +38 -0
- package/dist/chunk-GFBUASX3.mjs +1 -0
- package/dist/default-theme.js +1 -1
- package/dist/default-theme.mjs +1 -1
- package/dist/flatten-color-palette.js +2 -2
- package/dist/flatten-color-palette.mjs +1 -1
- package/dist/lib.d.mts +115 -10
- package/dist/lib.js +27 -25
- package/dist/lib.mjs +1 -1
- package/dist/plugin.d.mts +2 -2
- package/dist/plugin.d.ts +30 -0
- package/dist/{types-B254mqw1.d.mts → types-CJYAW1ql.d.mts} +31 -1
- package/index.css +8 -0
- package/package.json +8 -5
- package/preflight.css +8 -0
- package/dist/chunk-P5FH2LZE.mjs +0 -1
- package/dist/chunk-QMW34FGX.mjs +0 -36
package/dist/lib.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { U as UserConfig, P as Plugin } from './types-
|
|
1
|
+
import { S as SourceLocation, U as UserConfig, P as Plugin } from './types-CJYAW1ql.mjs';
|
|
2
2
|
import { V as Variant, C as Candidate } from './resolve-config-QUZ9b-Gn.mjs';
|
|
3
3
|
import './colors.mjs';
|
|
4
4
|
|
|
@@ -18,8 +18,10 @@ declare class Theme {
|
|
|
18
18
|
constructor(values?: Map<string, {
|
|
19
19
|
value: string;
|
|
20
20
|
options: ThemeOptions;
|
|
21
|
+
src: Declaration["src"];
|
|
21
22
|
}>, keyframes?: Set<AtRule>);
|
|
22
|
-
|
|
23
|
+
get size(): number;
|
|
24
|
+
add(key: string, value: string, options?: ThemeOptions, src?: Declaration['src']): void;
|
|
23
25
|
keysInNamespaces(themeKeys: Iterable<ThemeKey>): string[];
|
|
24
26
|
get(themeKeys: ThemeKey[]): string | null;
|
|
25
27
|
hasDefault(key: string): boolean;
|
|
@@ -27,9 +29,11 @@ declare class Theme {
|
|
|
27
29
|
entries(): IterableIterator<[string, {
|
|
28
30
|
value: string;
|
|
29
31
|
options: ThemeOptions;
|
|
32
|
+
src: Declaration["src"];
|
|
30
33
|
}]> | [string, {
|
|
31
34
|
value: string;
|
|
32
35
|
options: ThemeOptions;
|
|
36
|
+
src: Declaration["src"];
|
|
33
37
|
}][];
|
|
34
38
|
prefixKey(key: string): string;
|
|
35
39
|
clearNamespace(namespace: string, clearOptions: ThemeOptions): void;
|
|
@@ -77,7 +81,7 @@ declare class Variants {
|
|
|
77
81
|
compounds?: Compounds;
|
|
78
82
|
order?: number;
|
|
79
83
|
}): void;
|
|
80
|
-
fromAst(name: string, ast: AstNode[]): void;
|
|
84
|
+
fromAst(name: string, ast: AstNode[], designSystem: DesignSystem): void;
|
|
81
85
|
functional(name: string, applyFn: VariantFn<'functional'>, { compounds, order }?: {
|
|
82
86
|
compounds?: Compounds;
|
|
83
87
|
order?: number;
|
|
@@ -95,7 +99,7 @@ declare class Variants {
|
|
|
95
99
|
compoundsWith: Compounds;
|
|
96
100
|
compounds: Compounds;
|
|
97
101
|
} | undefined;
|
|
98
|
-
kind(name: string): "
|
|
102
|
+
kind(name: string): "arbitrary" | "static" | "functional" | "compound";
|
|
99
103
|
compoundsWith(parent: string, child: string | Variant): boolean;
|
|
100
104
|
suggest(name: string, suggestions: () => string[]): void;
|
|
101
105
|
getCompletions(name: string): string[];
|
|
@@ -112,7 +116,7 @@ declare class Variants {
|
|
|
112
116
|
private nextOrder;
|
|
113
117
|
}
|
|
114
118
|
|
|
115
|
-
declare function compileAstNodes(candidate: Candidate, designSystem: DesignSystem): {
|
|
119
|
+
declare function compileAstNodes(candidate: Candidate, designSystem: DesignSystem, flags: CompileAstFlags): {
|
|
116
120
|
node: AstNode;
|
|
117
121
|
propertySort: {
|
|
118
122
|
order: number[];
|
|
@@ -120,6 +124,29 @@ declare function compileAstNodes(candidate: Candidate, designSystem: DesignSyste
|
|
|
120
124
|
};
|
|
121
125
|
}[];
|
|
122
126
|
|
|
127
|
+
interface CanonicalizeOptions {
|
|
128
|
+
/**
|
|
129
|
+
* The root font size in pixels. If provided, `rem` values will be normalized
|
|
130
|
+
* to `px` values.
|
|
131
|
+
*
|
|
132
|
+
* E.g.: `mt-[16px]` with `rem: 16` will become `mt-4` (assuming `--spacing: 0.25rem`).
|
|
133
|
+
*/
|
|
134
|
+
rem?: number;
|
|
135
|
+
/**
|
|
136
|
+
* Whether to collapse multiple utilities into a single utility if possible.
|
|
137
|
+
*
|
|
138
|
+
* E.g.: `mt-2 mr-2 mb-2 ml-2` → `m-2`
|
|
139
|
+
*/
|
|
140
|
+
collapse?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Whether to convert between logical and physical properties when collapsing
|
|
143
|
+
* utilities.
|
|
144
|
+
*
|
|
145
|
+
* E.g.: `mr-2 ml-2` → `mx-2`
|
|
146
|
+
*/
|
|
147
|
+
logicalToPhysical?: boolean;
|
|
148
|
+
}
|
|
149
|
+
|
|
123
150
|
interface ClassMetadata {
|
|
124
151
|
modifiers: string[];
|
|
125
152
|
}
|
|
@@ -164,6 +191,10 @@ declare class Utilities {
|
|
|
164
191
|
keys(kind: 'static' | 'functional'): string[];
|
|
165
192
|
}
|
|
166
193
|
|
|
194
|
+
declare const enum CompileAstFlags {
|
|
195
|
+
None = 0,
|
|
196
|
+
RespectImportant = 1
|
|
197
|
+
}
|
|
167
198
|
type DesignSystem = {
|
|
168
199
|
theme: Theme;
|
|
169
200
|
utilities: Utilities;
|
|
@@ -175,46 +206,114 @@ type DesignSystem = {
|
|
|
175
206
|
getVariants(): VariantEntry[];
|
|
176
207
|
parseCandidate(candidate: string): Readonly<Candidate>[];
|
|
177
208
|
parseVariant(variant: string): Readonly<Variant> | null;
|
|
178
|
-
compileAstNodes(candidate: Candidate): ReturnType<typeof compileAstNodes>;
|
|
209
|
+
compileAstNodes(candidate: Candidate, flags?: CompileAstFlags): ReturnType<typeof compileAstNodes>;
|
|
210
|
+
printCandidate(candidate: Candidate): string;
|
|
211
|
+
printVariant(variant: Variant): string;
|
|
179
212
|
getVariantOrder(): Map<Variant, number>;
|
|
180
213
|
resolveThemeValue(path: string, forceInline?: boolean): string | undefined;
|
|
181
214
|
trackUsedVariables(raw: string): void;
|
|
215
|
+
canonicalizeCandidates(candidates: string[], options?: CanonicalizeOptions): string[];
|
|
182
216
|
candidatesToCss(classes: string[]): (string | null)[];
|
|
217
|
+
candidatesToAst(classes: string[]): AstNode[][];
|
|
218
|
+
storage: Record<symbol, unknown>;
|
|
183
219
|
};
|
|
184
220
|
|
|
185
221
|
type StyleRule = {
|
|
186
222
|
kind: 'rule';
|
|
187
223
|
selector: string;
|
|
188
224
|
nodes: AstNode[];
|
|
225
|
+
src?: SourceLocation;
|
|
226
|
+
dst?: SourceLocation;
|
|
189
227
|
};
|
|
190
228
|
type AtRule = {
|
|
191
229
|
kind: 'at-rule';
|
|
192
230
|
name: string;
|
|
193
231
|
params: string;
|
|
194
232
|
nodes: AstNode[];
|
|
233
|
+
src?: SourceLocation;
|
|
234
|
+
dst?: SourceLocation;
|
|
195
235
|
};
|
|
196
236
|
type Declaration = {
|
|
197
237
|
kind: 'declaration';
|
|
198
238
|
property: string;
|
|
199
239
|
value: string | undefined;
|
|
200
240
|
important: boolean;
|
|
241
|
+
src?: SourceLocation;
|
|
242
|
+
dst?: SourceLocation;
|
|
201
243
|
};
|
|
202
244
|
type Comment = {
|
|
203
245
|
kind: 'comment';
|
|
204
246
|
value: string;
|
|
247
|
+
src?: SourceLocation;
|
|
248
|
+
dst?: SourceLocation;
|
|
205
249
|
};
|
|
206
250
|
type Context = {
|
|
207
251
|
kind: 'context';
|
|
208
252
|
context: Record<string, string | boolean>;
|
|
209
253
|
nodes: AstNode[];
|
|
254
|
+
src?: undefined;
|
|
255
|
+
dst?: undefined;
|
|
210
256
|
};
|
|
211
257
|
type AtRoot = {
|
|
212
258
|
kind: 'at-root';
|
|
213
259
|
nodes: AstNode[];
|
|
260
|
+
src?: undefined;
|
|
261
|
+
dst?: undefined;
|
|
214
262
|
};
|
|
215
263
|
type Rule = StyleRule | AtRule;
|
|
216
264
|
type AstNode = StyleRule | AtRule | Declaration | Comment | Context | AtRoot;
|
|
217
265
|
|
|
266
|
+
/**
|
|
267
|
+
* Line offset tables are the key to generating our source maps. They allow us
|
|
268
|
+
* to store indexes with our AST nodes and later convert them into positions as
|
|
269
|
+
* when given the source that the indexes refer to.
|
|
270
|
+
*/
|
|
271
|
+
/**
|
|
272
|
+
* A position in source code
|
|
273
|
+
*
|
|
274
|
+
* https://tc39.es/ecma426/#sec-position-record-type
|
|
275
|
+
*/
|
|
276
|
+
interface Position {
|
|
277
|
+
/** The line number, one-based */
|
|
278
|
+
line: number;
|
|
279
|
+
/** The column/character number, one-based */
|
|
280
|
+
column: number;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
interface OriginalPosition extends Position {
|
|
284
|
+
source: DecodedSource;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* A "decoded" sourcemap
|
|
288
|
+
*
|
|
289
|
+
* @see https://tc39.es/ecma426/#decoded-source-map-record
|
|
290
|
+
*/
|
|
291
|
+
interface DecodedSourceMap {
|
|
292
|
+
file: string | null;
|
|
293
|
+
sources: DecodedSource[];
|
|
294
|
+
mappings: DecodedMapping[];
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* A "decoded" source
|
|
298
|
+
*
|
|
299
|
+
* @see https://tc39.es/ecma426/#decoded-source-record
|
|
300
|
+
*/
|
|
301
|
+
interface DecodedSource {
|
|
302
|
+
url: string | null;
|
|
303
|
+
content: string | null;
|
|
304
|
+
ignore: boolean;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* A "decoded" mapping
|
|
308
|
+
*
|
|
309
|
+
* @see https://tc39.es/ecma426/#decoded-mapping-record
|
|
310
|
+
*/
|
|
311
|
+
interface DecodedMapping {
|
|
312
|
+
originalPosition: OriginalPosition | null;
|
|
313
|
+
generatedPosition: Position;
|
|
314
|
+
name: string | null;
|
|
315
|
+
}
|
|
316
|
+
|
|
218
317
|
type Config = UserConfig;
|
|
219
318
|
declare const enum Polyfills {
|
|
220
319
|
None = 0,
|
|
@@ -224,14 +323,17 @@ declare const enum Polyfills {
|
|
|
224
323
|
}
|
|
225
324
|
type CompileOptions = {
|
|
226
325
|
base?: string;
|
|
326
|
+
from?: string;
|
|
227
327
|
polyfills?: Polyfills;
|
|
228
328
|
loadModule?: (id: string, base: string, resourceHint: 'plugin' | 'config') => Promise<{
|
|
229
|
-
|
|
329
|
+
path: string;
|
|
230
330
|
base: string;
|
|
331
|
+
module: Plugin | Config;
|
|
231
332
|
}>;
|
|
232
333
|
loadStylesheet?: (id: string, base: string) => Promise<{
|
|
233
|
-
|
|
334
|
+
path: string;
|
|
234
335
|
base: string;
|
|
336
|
+
content: string;
|
|
235
337
|
}>;
|
|
236
338
|
};
|
|
237
339
|
type Root = null | 'none' | {
|
|
@@ -245,7 +347,8 @@ declare const enum Features {
|
|
|
245
347
|
JsPluginCompat = 4,
|
|
246
348
|
ThemeFunction = 8,
|
|
247
349
|
Utilities = 16,
|
|
248
|
-
Variants = 32
|
|
350
|
+
Variants = 32,
|
|
351
|
+
AtTheme = 64
|
|
249
352
|
}
|
|
250
353
|
declare function compileAst(input: AstNode[], opts?: CompileOptions): Promise<{
|
|
251
354
|
sources: {
|
|
@@ -257,6 +360,7 @@ declare function compileAst(input: AstNode[], opts?: CompileOptions): Promise<{
|
|
|
257
360
|
features: Features;
|
|
258
361
|
build(candidates: string[]): AstNode[];
|
|
259
362
|
}>;
|
|
363
|
+
|
|
260
364
|
declare function compile(css: string, opts?: CompileOptions): Promise<{
|
|
261
365
|
sources: {
|
|
262
366
|
base: string;
|
|
@@ -266,8 +370,9 @@ declare function compile(css: string, opts?: CompileOptions): Promise<{
|
|
|
266
370
|
root: Root;
|
|
267
371
|
features: Features;
|
|
268
372
|
build(candidates: string[]): string;
|
|
373
|
+
buildSourceMap(): DecodedSourceMap;
|
|
269
374
|
}>;
|
|
270
375
|
declare function __unstable__loadDesignSystem(css: string, opts?: CompileOptions): Promise<DesignSystem>;
|
|
271
376
|
declare function postcssPluginWarning(): void;
|
|
272
377
|
|
|
273
|
-
export { type Config, Features, Polyfills, __unstable__loadDesignSystem, compile, compileAst, postcssPluginWarning as default };
|
|
378
|
+
export { type Config, type DecodedSourceMap, Features, Polyfills, __unstable__loadDesignSystem, compile, compileAst, postcssPluginWarning as default };
|