@csszyx/compiler 0.1.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/README.md +146 -0
- package/dist/index.cjs +2873 -0
- package/dist/index.d.cts +1319 -0
- package/dist/index.d.ts +1319 -0
- package/dist/index.js +2820 -0
- package/package.json +58 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1319 @@
|
|
|
1
|
+
import * as t from '@babel/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* JSX Transform - Converts sz prop to className string.
|
|
5
|
+
*
|
|
6
|
+
* This module handles the transformation of csszyx object syntax into
|
|
7
|
+
* Tailwind CSS class strings. It processes nested objects for variants
|
|
8
|
+
* like hover, focus, etc.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Represents a value in the sz object.
|
|
12
|
+
* Can be a string, number, boolean, or nested object for variants.
|
|
13
|
+
*/
|
|
14
|
+
type SzValue = string | number | boolean | SzObject;
|
|
15
|
+
/**
|
|
16
|
+
* Represents the sz object structure.
|
|
17
|
+
* Keys are CSS property abbreviations, values can be primitives or nested objects.
|
|
18
|
+
*/
|
|
19
|
+
interface SzObject {
|
|
20
|
+
[key: string]: SzValue;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Represents the result of a transformation.
|
|
24
|
+
*/
|
|
25
|
+
interface TransformResult {
|
|
26
|
+
className: string;
|
|
27
|
+
attributes: Record<string, string>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Transforms a csszyx sz object into a Tailwind CSS className string and extracted attributes.
|
|
31
|
+
*
|
|
32
|
+
* @param {SzObject} szProp - The sz object from JSX
|
|
33
|
+
* @param {string} prefix - Variant prefix for nested properties
|
|
34
|
+
* @param {Record<string, string>} [mangleMap] - Optional map for property name mangling
|
|
35
|
+
* @returns {TransformResult} The transformation result
|
|
36
|
+
*/
|
|
37
|
+
declare function transform(szProp: SzObject, prefix?: string, mangleMap?: Record<string, string>): TransformResult;
|
|
38
|
+
/**
|
|
39
|
+
* Validates that an sz prop object is valid.
|
|
40
|
+
*
|
|
41
|
+
* @param {unknown} szProp - The value to validate
|
|
42
|
+
* @returns {boolean} True if valid, false otherwise
|
|
43
|
+
*/
|
|
44
|
+
declare function isValidSzProp(szProp: unknown): szProp is SzObject;
|
|
45
|
+
/**
|
|
46
|
+
* Normalizes a className string by removing extra whitespace.
|
|
47
|
+
*
|
|
48
|
+
* @param {string} className - The className string to normalize
|
|
49
|
+
* @returns {string} The normalized className string
|
|
50
|
+
*/
|
|
51
|
+
declare function normalizeClassName(className: string): string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Transforms all sz props in a source code string into Tailwind classNames.
|
|
55
|
+
*
|
|
56
|
+
* @param {string} source - The source code to transform
|
|
57
|
+
* @returns {object} Transformation result with code and metadata
|
|
58
|
+
*/
|
|
59
|
+
declare function transformSourceCode(source: string): {
|
|
60
|
+
code: string;
|
|
61
|
+
transformed: boolean;
|
|
62
|
+
usesRuntime: boolean;
|
|
63
|
+
usesColorVar: boolean;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Core Compiler class for csszyx.
|
|
68
|
+
*
|
|
69
|
+
* This class manages the WASM lifecycle and provides high-performance
|
|
70
|
+
* transformation methods. It falls back to JavaScript if WASM is not available.
|
|
71
|
+
*/
|
|
72
|
+
declare class CsszyxCompiler {
|
|
73
|
+
private static instance;
|
|
74
|
+
private wasmLoaded;
|
|
75
|
+
/**
|
|
76
|
+
* Private constructor to enforce singleton pattern.
|
|
77
|
+
*/
|
|
78
|
+
private constructor();
|
|
79
|
+
/**
|
|
80
|
+
* Gets the singleton instance of the compiler.
|
|
81
|
+
*
|
|
82
|
+
* @returns {CsszyxCompiler} The compiler instance.
|
|
83
|
+
*/
|
|
84
|
+
static getInstance(): CsszyxCompiler;
|
|
85
|
+
/**
|
|
86
|
+
* Initializes the WASM core.
|
|
87
|
+
*
|
|
88
|
+
* @returns {Promise<void>} Resolves when WASM is ready.
|
|
89
|
+
*/
|
|
90
|
+
init(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Transforms an sz object into Tailwind classes.
|
|
93
|
+
*
|
|
94
|
+
* @param {SzObject} sz - The object to transform.
|
|
95
|
+
* @returns {string} The transformed class string.
|
|
96
|
+
*/
|
|
97
|
+
transform(sz: SzObject): string;
|
|
98
|
+
/**
|
|
99
|
+
* Checks if the WASM core is currently active.
|
|
100
|
+
*
|
|
101
|
+
* @returns {boolean} True if WASM is loaded.
|
|
102
|
+
*/
|
|
103
|
+
isWasmActive(): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Generates a recovery token using WASM or JS fallback.
|
|
106
|
+
*
|
|
107
|
+
* @param {object} metadata - Token metadata
|
|
108
|
+
* @param metadata.component - Component name
|
|
109
|
+
* @param metadata.filePath - File path source
|
|
110
|
+
* @param metadata.line - Line number
|
|
111
|
+
* @param metadata.column - Column number
|
|
112
|
+
* @param metadata.mode - Build mode (dev/prod)
|
|
113
|
+
* @param metadata.buildId - Unique build identifier
|
|
114
|
+
* @returns {string} The generated token
|
|
115
|
+
*/
|
|
116
|
+
generateRecoveryToken(metadata: {
|
|
117
|
+
component: string;
|
|
118
|
+
filePath: string;
|
|
119
|
+
line: number;
|
|
120
|
+
column: number;
|
|
121
|
+
mode: 'csr' | 'dev-only';
|
|
122
|
+
buildId: string;
|
|
123
|
+
}): string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Valid recovery modes for szRecover attribute.
|
|
128
|
+
*/
|
|
129
|
+
type RecoveryMode = 'csr' | 'dev-only';
|
|
130
|
+
/**
|
|
131
|
+
* Metadata for a recovery token.
|
|
132
|
+
*/
|
|
133
|
+
interface TokenMetadata {
|
|
134
|
+
/**
|
|
135
|
+
* The recovery mode ('csr' or 'dev-only')
|
|
136
|
+
*/
|
|
137
|
+
mode: RecoveryMode;
|
|
138
|
+
/**
|
|
139
|
+
* Component name where szRecover is used
|
|
140
|
+
*/
|
|
141
|
+
component: string;
|
|
142
|
+
/**
|
|
143
|
+
* Absolute file path
|
|
144
|
+
*/
|
|
145
|
+
filePath: string;
|
|
146
|
+
/**
|
|
147
|
+
* Line number in source file
|
|
148
|
+
*/
|
|
149
|
+
line: number;
|
|
150
|
+
/**
|
|
151
|
+
* Column number in source file
|
|
152
|
+
*/
|
|
153
|
+
column: number;
|
|
154
|
+
/**
|
|
155
|
+
* Build ID (git hash or timestamp)
|
|
156
|
+
*/
|
|
157
|
+
buildId: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Generated recovery token with metadata.
|
|
161
|
+
*/
|
|
162
|
+
interface RecoveryToken {
|
|
163
|
+
/**
|
|
164
|
+
* The generated token string
|
|
165
|
+
*/
|
|
166
|
+
token: string;
|
|
167
|
+
/**
|
|
168
|
+
* Token metadata
|
|
169
|
+
*/
|
|
170
|
+
metadata: TokenMetadata;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Validates if a value is a valid recovery mode.
|
|
174
|
+
*
|
|
175
|
+
* @param {unknown} value - The value to validate
|
|
176
|
+
* @returns {value is RecoveryMode} True if valid recovery mode
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* isValidRecoveryMode('csr') // true
|
|
181
|
+
* isValidRecoveryMode('dev-only') // true
|
|
182
|
+
* isValidRecoveryMode('invalid') // false
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
declare function isValidRecoveryMode(value: unknown): value is RecoveryMode;
|
|
186
|
+
/**
|
|
187
|
+
* Generates a cryptographic token for a recovery declaration using WASM.
|
|
188
|
+
*
|
|
189
|
+
* @param {TokenMetadata} metadata - Token metadata
|
|
190
|
+
* @returns {string} The generated token (Base62 format)
|
|
191
|
+
*/
|
|
192
|
+
declare function generateRecoveryToken(metadata: TokenMetadata): string;
|
|
193
|
+
/**
|
|
194
|
+
* Creates a recovery token with full metadata.
|
|
195
|
+
*
|
|
196
|
+
* @param {Omit<TokenMetadata, 'buildId'>} metadata - Token metadata without buildId
|
|
197
|
+
* @param {string} buildId - Build ID to use
|
|
198
|
+
* @returns {RecoveryToken} The generated token with metadata
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* const recovery = createRecoveryToken({
|
|
203
|
+
* mode: 'csr',
|
|
204
|
+
* component: 'Button',
|
|
205
|
+
* filePath: '/app/Button.tsx',
|
|
206
|
+
* line: 10,
|
|
207
|
+
* column: 5
|
|
208
|
+
* }, 'build-123');
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
declare function createRecoveryToken(metadata: Omit<TokenMetadata, 'buildId'>, buildId: string): RecoveryToken;
|
|
212
|
+
/**
|
|
213
|
+
* Validates szRecover attribute value.
|
|
214
|
+
*
|
|
215
|
+
* Ensures the value is a static literal 'csr' or 'dev-only'.
|
|
216
|
+
* Runtime expressions are not allowed.
|
|
217
|
+
*
|
|
218
|
+
* @param {unknown} value - The attribute value to validate
|
|
219
|
+
* @param {string} componentName - Component name for error messages
|
|
220
|
+
* @returns {{ valid: boolean; error?: string }} Validation result
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```typescript
|
|
224
|
+
* validateSzRecover('csr', 'MyComponent')
|
|
225
|
+
* // Returns: { valid: true }
|
|
226
|
+
*
|
|
227
|
+
* validateSzRecover('invalid', 'MyComponent')
|
|
228
|
+
* // Returns: { valid: false, error: '...' }
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
declare function validateSzRecover(value: unknown, componentName: string): {
|
|
232
|
+
valid: boolean;
|
|
233
|
+
error?: string;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Injects recovery token into JSX attributes.
|
|
237
|
+
*
|
|
238
|
+
* Adds the data-sz-recovery-token attribute with the generated token.
|
|
239
|
+
*
|
|
240
|
+
* @param {Record<string, unknown>} attributes - JSX attributes object
|
|
241
|
+
* @param {string} token - The recovery token to inject
|
|
242
|
+
* @returns {Record<string, unknown>} Updated attributes with token
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```typescript
|
|
246
|
+
* const attrs = { szRecover: 'csr', className: 'foo' };
|
|
247
|
+
* const updated = injectRecoveryToken(attrs, 'abc123');
|
|
248
|
+
* // Returns: { szRecover: 'csr', className: 'foo', 'data-sz-recovery-token': 'abc123' }
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
declare function injectRecoveryToken(attributes: Record<string, unknown>, token: string): Record<string, unknown>;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Recovery Manifest Generation.
|
|
255
|
+
*
|
|
256
|
+
* This module handles the creation and management of the recovery manifest,
|
|
257
|
+
* which maps recovery tokens to their metadata for runtime verification.
|
|
258
|
+
*/
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Token data stored in the manifest.
|
|
262
|
+
*/
|
|
263
|
+
interface TokenData {
|
|
264
|
+
/**
|
|
265
|
+
* Recovery mode ('csr' or 'dev-only')
|
|
266
|
+
*/
|
|
267
|
+
mode: RecoveryMode;
|
|
268
|
+
/**
|
|
269
|
+
* Component name
|
|
270
|
+
*/
|
|
271
|
+
component: string;
|
|
272
|
+
/**
|
|
273
|
+
* File path (relative to project root)
|
|
274
|
+
*/
|
|
275
|
+
path: string;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Recovery manifest structure.
|
|
279
|
+
*
|
|
280
|
+
* Embedded in the build output as a JSON script tag.
|
|
281
|
+
*/
|
|
282
|
+
interface RecoveryManifest {
|
|
283
|
+
/**
|
|
284
|
+
* Build ID (git hash or timestamp)
|
|
285
|
+
*/
|
|
286
|
+
buildId: string;
|
|
287
|
+
/**
|
|
288
|
+
* SHA-256 checksum of the tokens object
|
|
289
|
+
*/
|
|
290
|
+
checksum: string;
|
|
291
|
+
/**
|
|
292
|
+
* Map of token → token data
|
|
293
|
+
*/
|
|
294
|
+
tokens: Record<string, TokenData>;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Builder class for creating recovery manifests.
|
|
298
|
+
*/
|
|
299
|
+
declare class ManifestBuilder {
|
|
300
|
+
private tokens;
|
|
301
|
+
private buildId;
|
|
302
|
+
/**
|
|
303
|
+
* Creates a new manifest builder.
|
|
304
|
+
*
|
|
305
|
+
* @param {string} buildId - Build ID (git hash or timestamp)
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```typescript
|
|
309
|
+
* const builder = new ManifestBuilder('abc123');
|
|
310
|
+
* ```
|
|
311
|
+
*/
|
|
312
|
+
constructor(buildId: string);
|
|
313
|
+
/**
|
|
314
|
+
* Adds a token to the manifest.
|
|
315
|
+
*
|
|
316
|
+
* @param {string} token - The recovery token
|
|
317
|
+
* @param {TokenMetadata} metadata - Token metadata
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```typescript
|
|
321
|
+
* builder.addToken('a94f1c2e8b3d', {
|
|
322
|
+
* mode: 'csr',
|
|
323
|
+
* component: 'Button',
|
|
324
|
+
* filePath: '/app/Button.tsx',
|
|
325
|
+
* line: 10,
|
|
326
|
+
* column: 5,
|
|
327
|
+
* buildId: 'abc123'
|
|
328
|
+
* });
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
addToken(token: string, metadata: TokenMetadata): void;
|
|
332
|
+
/**
|
|
333
|
+
* Converts absolute path to relative path.
|
|
334
|
+
*
|
|
335
|
+
* @param {string} absolutePath - Absolute file path
|
|
336
|
+
* @returns {string} Relative path
|
|
337
|
+
*/
|
|
338
|
+
private toRelativePath;
|
|
339
|
+
/**
|
|
340
|
+
* Computes checksum of the tokens object.
|
|
341
|
+
*
|
|
342
|
+
* @param {Record<string, TokenData>} tokens - Tokens object
|
|
343
|
+
* @returns {string} SHA-256 checksum
|
|
344
|
+
*/
|
|
345
|
+
private computeChecksum;
|
|
346
|
+
/**
|
|
347
|
+
* Builds the final recovery manifest.
|
|
348
|
+
*
|
|
349
|
+
* @returns {RecoveryManifest} The complete recovery manifest
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* ```typescript
|
|
353
|
+
* const manifest = builder.build();
|
|
354
|
+
* // Returns: { buildId: 'abc123', checksum: '...', tokens: {...} }
|
|
355
|
+
* ```
|
|
356
|
+
*/
|
|
357
|
+
build(): RecoveryManifest;
|
|
358
|
+
/**
|
|
359
|
+
* Gets the number of tokens in the manifest.
|
|
360
|
+
*
|
|
361
|
+
* @returns {number} Token count
|
|
362
|
+
*/
|
|
363
|
+
size(): number;
|
|
364
|
+
/**
|
|
365
|
+
* Checks if a token exists in the manifest.
|
|
366
|
+
*
|
|
367
|
+
* @param {string} token - Token to check
|
|
368
|
+
* @returns {boolean} True if token exists
|
|
369
|
+
*/
|
|
370
|
+
hasToken(token: string): boolean;
|
|
371
|
+
/**
|
|
372
|
+
* Clears all tokens from the manifest.
|
|
373
|
+
*/
|
|
374
|
+
clear(): void;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Serializes a recovery manifest to JSON string.
|
|
378
|
+
*
|
|
379
|
+
* @param {RecoveryManifest} manifest - The manifest to serialize
|
|
380
|
+
* @param {boolean} pretty - Whether to pretty-print the JSON
|
|
381
|
+
* @returns {string} JSON string
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* ```typescript
|
|
385
|
+
* const json = serializeManifest(manifest, true);
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
declare function serializeManifest(manifest: RecoveryManifest, pretty?: boolean): string;
|
|
389
|
+
/**
|
|
390
|
+
* Parses a recovery manifest from JSON string.
|
|
391
|
+
*
|
|
392
|
+
* @param {string} json - JSON string to parse
|
|
393
|
+
* @returns {RecoveryManifest} Parsed manifest
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* ```typescript
|
|
397
|
+
* const manifest = parseManifest(jsonString);
|
|
398
|
+
* ```
|
|
399
|
+
*/
|
|
400
|
+
declare function parseManifest(json: string): RecoveryManifest;
|
|
401
|
+
/**
|
|
402
|
+
* Validates a recovery manifest structure.
|
|
403
|
+
*
|
|
404
|
+
* @param {unknown} manifest - Manifest to validate
|
|
405
|
+
* @returns {{ valid: boolean; error?: string }} Validation result
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* ```typescript
|
|
409
|
+
* const result = validateManifest(manifest);
|
|
410
|
+
* if (!result.valid) {
|
|
411
|
+
* console.error(result.error);
|
|
412
|
+
* }
|
|
413
|
+
* ```
|
|
414
|
+
*/
|
|
415
|
+
declare function validateManifest(manifest: unknown): {
|
|
416
|
+
valid: boolean;
|
|
417
|
+
error?: string;
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Property Type System for CSS Variable Auto-Compile.
|
|
422
|
+
*
|
|
423
|
+
* Maps every sz property to its CSS variable value generation strategy,
|
|
424
|
+
* determining how dynamic values should be converted to inline style values.
|
|
425
|
+
*
|
|
426
|
+
* @module @csszyx/compiler/property-types
|
|
427
|
+
*/
|
|
428
|
+
/**
|
|
429
|
+
* Property categories for CSS variable value generation.
|
|
430
|
+
* Each category determines how a dynamic runtime value is transformed
|
|
431
|
+
* into a CSS custom property value.
|
|
432
|
+
*/
|
|
433
|
+
declare enum PropertyCategory {
|
|
434
|
+
/** Spacing props (p, m, gap, inset, top, etc.) → calc(N * var(--spacing)) */
|
|
435
|
+
SPACING = 0,
|
|
436
|
+
/** Color props (bg, color, borderColor, etc.) → __szColorVar(value) */
|
|
437
|
+
COLOR = 1,
|
|
438
|
+
/** Fraction props (w, h when value like '1/2') → percentage */
|
|
439
|
+
FRACTION = 2,
|
|
440
|
+
/** Unitless number props (z, order, columns, opacity) → direct number */
|
|
441
|
+
UNITLESS = 3,
|
|
442
|
+
/** Angle props (rotate, skew) → Ndeg */
|
|
443
|
+
ANGLE = 4,
|
|
444
|
+
/** Duration props (duration, delay) → Nms */
|
|
445
|
+
DURATION = 5,
|
|
446
|
+
/** Already has [] brackets → pass-through */
|
|
447
|
+
ARBITRARY = 6,
|
|
448
|
+
/** Unknown → direct pass-through */
|
|
449
|
+
PASSTHROUGH = 7
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Maps sz property names to their PropertyCategory.
|
|
453
|
+
* Covers all ~200 properties from PROPERTY_MAP in transform.ts.
|
|
454
|
+
*/
|
|
455
|
+
declare const PROPERTY_CATEGORY_MAP: Record<string, PropertyCategory>;
|
|
456
|
+
/**
|
|
457
|
+
* Returns the PropertyCategory for a given sz property name.
|
|
458
|
+
* Falls back to PASSTHROUGH for unknown properties.
|
|
459
|
+
* @param property - the sz property name to look up
|
|
460
|
+
* @returns the PropertyCategory for the property, or PASSTHROUGH if unknown
|
|
461
|
+
*/
|
|
462
|
+
declare function getPropertyCategory(property: string): PropertyCategory;
|
|
463
|
+
/**
|
|
464
|
+
* Set of all properties that are color-type.
|
|
465
|
+
* Used for quick lookup to determine if __szColorVar import is needed.
|
|
466
|
+
*/
|
|
467
|
+
declare const COLOR_PROPERTIES: Set<string>;
|
|
468
|
+
/**
|
|
469
|
+
* Generates the CSS variable naming convention for a property.
|
|
470
|
+
* @param property - the sz property name
|
|
471
|
+
* @param variantPrefix - variant chain (e.g., 'hover', 'md')
|
|
472
|
+
* @returns CSS variable name like '--_sz-p' or '--_sz-hover-bg'
|
|
473
|
+
*/
|
|
474
|
+
declare function getCSSVariableName(property: string, variantPrefix?: string): string;
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* CSS Variable Hoisting — deduplicates identical CSS variables across sibling elements.
|
|
478
|
+
*
|
|
479
|
+
* When multiple JSX elements in the same component share the same CSS variable
|
|
480
|
+
* name and value, the variable is hoisted to the nearest common ancestor JSX element.
|
|
481
|
+
*
|
|
482
|
+
* Hoisting rule: ALWAYS safe within the same Babel transform scope.
|
|
483
|
+
* Inner inline styles override inherited CSS variable values due to CSS cascade.
|
|
484
|
+
*
|
|
485
|
+
* @module @csszyx/compiler/hoisting
|
|
486
|
+
*/
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Tracks a CSS variable usage on a specific JSX element.
|
|
490
|
+
*/
|
|
491
|
+
interface CSSVarUsage {
|
|
492
|
+
/** The JSX element AST node */
|
|
493
|
+
element: t.JSXOpeningElement;
|
|
494
|
+
/** CSS variable name, e.g., --_sz-p */
|
|
495
|
+
varName: string;
|
|
496
|
+
/** The style value AST expression */
|
|
497
|
+
valueExpr: t.Expression;
|
|
498
|
+
/** Serialized value for comparison (null if dynamic/non-comparable) */
|
|
499
|
+
serializedValue: string | null;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Hoists CSS variables to common ancestor elements when multiple siblings
|
|
503
|
+
* share the same variable name and value.
|
|
504
|
+
*
|
|
505
|
+
* @param usages - All CSS variable usages collected during transform
|
|
506
|
+
* @param parentMap - Map of child-to-parent relationships in the AST
|
|
507
|
+
*/
|
|
508
|
+
declare function hoistCSSVariables(usages: CSSVarUsage[], parentMap: Map<t.Node, t.Node>): void;
|
|
509
|
+
/**
|
|
510
|
+
* Builds a parent map for AST nodes (child-to-parent relationship).
|
|
511
|
+
* Used by hoistCSSVariables to find LCA.
|
|
512
|
+
*
|
|
513
|
+
* @param ast - The root AST node to traverse
|
|
514
|
+
* @returns A map of child-to-parent node relationships
|
|
515
|
+
*/
|
|
516
|
+
declare function buildParentMap(ast: t.Node): Map<t.Node, t.Node>;
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* @csszyx/compiler - TypeScript type definitions for sz prop.
|
|
520
|
+
*
|
|
521
|
+
* This module provides comprehensive type definitions for the sz prop
|
|
522
|
+
* to enable IntelliSense, autocompletion, and type safety.
|
|
523
|
+
*
|
|
524
|
+
* @module @csszyx/compiler/types
|
|
525
|
+
*/
|
|
526
|
+
/** Tailwind spacing scale values (0-96 + special values) */
|
|
527
|
+
type SpacingScale = 0 | 0.5 | 1 | 1.5 | 2 | 2.5 | 3 | 3.5 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 16 | 20 | 24 | 28 | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 72 | 80 | 96;
|
|
528
|
+
/** Spacing value that can be scale, keyword, or arbitrary */
|
|
529
|
+
type SpacingValue = SpacingScale | 'px' | 'auto' | (number & {}) | (string & {});
|
|
530
|
+
/** Negative spacing value */
|
|
531
|
+
type NegativeSpacingValue = SpacingValue | number;
|
|
532
|
+
/** Tailwind color names */
|
|
533
|
+
type ColorName = 'inherit' | 'current' | 'transparent' | 'black' | 'white' | 'slate' | 'gray' | 'zinc' | 'neutral' | 'stone' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose';
|
|
534
|
+
/** Tailwind color shades */
|
|
535
|
+
type ColorShade = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950;
|
|
536
|
+
/** Color value (string-based) */
|
|
537
|
+
type ColorValue = 'inherit' | 'current' | 'transparent' | 'black' | 'white' | `${ColorName}-${ColorShade}` | (string & {});
|
|
538
|
+
/** Color object with opacity */
|
|
539
|
+
interface ColorObjectValue {
|
|
540
|
+
color: ColorValue;
|
|
541
|
+
op?: number | (string & {});
|
|
542
|
+
}
|
|
543
|
+
/** Union type for all color properties */
|
|
544
|
+
type ColorPropValue = ColorValue | ColorObjectValue;
|
|
545
|
+
/** Container size names */
|
|
546
|
+
type ContainerSize = '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl';
|
|
547
|
+
/** Fraction values */
|
|
548
|
+
type FractionValue = '1/2' | '1/3' | '2/3' | '1/4' | '2/4' | '3/4' | '1/5' | '2/5' | '3/5' | '4/5' | '1/6' | '2/6' | '3/6' | '4/6' | '5/6' | '1/12' | '2/12' | '3/12' | '4/12' | '5/12' | '6/12' | '7/12' | '8/12' | '9/12' | '10/12' | '11/12';
|
|
549
|
+
/** Border radius keywords */
|
|
550
|
+
type BorderRadiusValue = 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' | true | (string & {});
|
|
551
|
+
/** Shadow keywords */
|
|
552
|
+
type ShadowValue = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'inner' | 'none' | true | (string & {});
|
|
553
|
+
/**
|
|
554
|
+
*
|
|
555
|
+
*/
|
|
556
|
+
interface LayoutProps {
|
|
557
|
+
/** @see https://tailwindcss.com/docs/aspect-ratio */
|
|
558
|
+
aspect?: 'auto' | 'square' | 'video' | (string & {});
|
|
559
|
+
/** @see https://tailwindcss.com/docs/columns */
|
|
560
|
+
columns?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 'auto' | ContainerSize | (string & {});
|
|
561
|
+
/** @see https://tailwindcss.com/docs/break-after */
|
|
562
|
+
breakAfter?: 'auto' | 'avoid' | 'all' | 'avoid-page' | 'page' | 'left' | 'right' | 'column';
|
|
563
|
+
/** @see https://tailwindcss.com/docs/break-before */
|
|
564
|
+
breakBefore?: 'auto' | 'avoid' | 'all' | 'avoid-page' | 'page' | 'left' | 'right' | 'column';
|
|
565
|
+
/** @see https://tailwindcss.com/docs/break-inside */
|
|
566
|
+
breakInside?: 'auto' | 'avoid' | 'avoid-page' | 'avoid-column';
|
|
567
|
+
/** @see https://tailwindcss.com/docs/box-decoration-break */
|
|
568
|
+
boxDecoration?: 'slice' | 'clone';
|
|
569
|
+
/** @see https://tailwindcss.com/docs/box-sizing */
|
|
570
|
+
box?: 'border' | 'content';
|
|
571
|
+
/** @see https://tailwindcss.com/docs/display */
|
|
572
|
+
display?: 'block' | 'inline-block' | 'inline' | 'flex' | 'inline-flex' | 'grid' | 'inline-grid' | 'contents' | 'table' | 'inline-table' | 'table-caption' | 'table-cell' | 'table-column' | 'table-column-group' | 'table-footer-group' | 'table-header-group' | 'table-row-group' | 'table-row' | 'flow-root' | 'list-item' | 'none';
|
|
573
|
+
/** Boolean sugar for display: block */
|
|
574
|
+
block?: boolean;
|
|
575
|
+
/** Boolean sugar for display: inline-block */
|
|
576
|
+
inlineBlock?: boolean;
|
|
577
|
+
/** Boolean sugar for display: inline */
|
|
578
|
+
inline?: boolean;
|
|
579
|
+
/** Boolean sugar for display: flex */
|
|
580
|
+
flex?: boolean | 'auto' | 'initial' | 'none' | 1 | (string & {});
|
|
581
|
+
/** Boolean sugar for display: inline-flex */
|
|
582
|
+
inlineFlex?: boolean;
|
|
583
|
+
/** Boolean sugar for display: grid */
|
|
584
|
+
grid?: boolean;
|
|
585
|
+
/** Boolean sugar for display: inline-grid */
|
|
586
|
+
inlineGrid?: boolean;
|
|
587
|
+
/** Boolean sugar for display: table */
|
|
588
|
+
table?: boolean;
|
|
589
|
+
/** Boolean sugar for display: table-row */
|
|
590
|
+
tableRow?: boolean;
|
|
591
|
+
/** Boolean sugar for display: table-cell */
|
|
592
|
+
tableCell?: boolean;
|
|
593
|
+
/** Boolean sugar for display: flow-root */
|
|
594
|
+
flowRoot?: boolean;
|
|
595
|
+
/** Boolean sugar for display: list-item */
|
|
596
|
+
listItem?: boolean;
|
|
597
|
+
/** Boolean sugar for display: contents */
|
|
598
|
+
contents?: boolean;
|
|
599
|
+
/** Boolean sugar for display: hidden/none */
|
|
600
|
+
hidden?: boolean;
|
|
601
|
+
/** Boolean sugar for sr-only */
|
|
602
|
+
srOnly?: boolean;
|
|
603
|
+
/** Boolean sugar for not-sr-only */
|
|
604
|
+
notSrOnly?: boolean;
|
|
605
|
+
/** Boolean sugar for container */
|
|
606
|
+
container?: boolean;
|
|
607
|
+
/** Boolean sugar for prose */
|
|
608
|
+
prose?: boolean;
|
|
609
|
+
/** @see https://tailwindcss.com/docs/float */
|
|
610
|
+
float?: 'right' | 'left' | 'start' | 'end' | 'none';
|
|
611
|
+
/** @see https://tailwindcss.com/docs/clear */
|
|
612
|
+
clear?: 'left' | 'right' | 'both' | 'none' | 'start' | 'end';
|
|
613
|
+
/** @see https://tailwindcss.com/docs/isolation */
|
|
614
|
+
isolation?: 'isolate' | 'auto';
|
|
615
|
+
isolate?: boolean;
|
|
616
|
+
/** @see https://tailwindcss.com/docs/object-fit */
|
|
617
|
+
objectFit?: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
|
|
618
|
+
/** @see https://tailwindcss.com/docs/object-position */
|
|
619
|
+
objectPos?: 'bottom' | 'center' | 'left' | 'left-bottom' | 'left-top' | 'right' | 'right-bottom' | 'right-top' | 'top' | (string & {});
|
|
620
|
+
/** @see https://tailwindcss.com/docs/overflow */
|
|
621
|
+
overflow?: 'auto' | 'hidden' | 'clip' | 'visible' | 'scroll';
|
|
622
|
+
overflowX?: 'auto' | 'hidden' | 'clip' | 'visible' | 'scroll';
|
|
623
|
+
overflowY?: 'auto' | 'hidden' | 'clip' | 'visible' | 'scroll';
|
|
624
|
+
/** @see https://tailwindcss.com/docs/overscroll-behavior */
|
|
625
|
+
overscroll?: 'auto' | 'contain' | 'none';
|
|
626
|
+
overscrollX?: 'auto' | 'contain' | 'none';
|
|
627
|
+
overscrollY?: 'auto' | 'contain' | 'none';
|
|
628
|
+
/** @see https://tailwindcss.com/docs/position */
|
|
629
|
+
position?: 'static' | 'fixed' | 'absolute' | 'relative' | 'sticky';
|
|
630
|
+
static?: boolean;
|
|
631
|
+
fixed?: boolean;
|
|
632
|
+
absolute?: boolean;
|
|
633
|
+
relative?: boolean;
|
|
634
|
+
sticky?: boolean;
|
|
635
|
+
/** @see https://tailwindcss.com/docs/top-right-bottom-left */
|
|
636
|
+
inset?: SpacingValue;
|
|
637
|
+
insetX?: SpacingValue;
|
|
638
|
+
insetY?: SpacingValue;
|
|
639
|
+
top?: NegativeSpacingValue;
|
|
640
|
+
right?: NegativeSpacingValue;
|
|
641
|
+
bottom?: NegativeSpacingValue;
|
|
642
|
+
left?: NegativeSpacingValue;
|
|
643
|
+
start?: SpacingValue;
|
|
644
|
+
end?: SpacingValue;
|
|
645
|
+
/** @see https://tailwindcss.com/docs/visibility */
|
|
646
|
+
visibility?: 'visible' | 'hidden' | 'collapse';
|
|
647
|
+
visible?: boolean;
|
|
648
|
+
invisible?: boolean;
|
|
649
|
+
collapse?: boolean;
|
|
650
|
+
/** @see https://tailwindcss.com/docs/z-index */
|
|
651
|
+
z?: 'auto' | 0 | 10 | 20 | 30 | 40 | 50 | number | (string & {});
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
*
|
|
655
|
+
*/
|
|
656
|
+
interface FlexboxGridProps {
|
|
657
|
+
/** @see https://tailwindcss.com/docs/flex-basis */
|
|
658
|
+
basis?: SpacingScale | 'px' | 'auto' | 'full' | FractionValue | ContainerSize | (string & {});
|
|
659
|
+
/** @see https://tailwindcss.com/docs/flex-direction */
|
|
660
|
+
flexDir?: 'row' | 'row-reverse' | 'col' | 'col-reverse';
|
|
661
|
+
/** @see https://tailwindcss.com/docs/flex-wrap */
|
|
662
|
+
flexWrap?: 'wrap' | 'nowrap' | 'wrap-reverse';
|
|
663
|
+
/** @see https://tailwindcss.com/docs/flex-grow */
|
|
664
|
+
grow?: boolean | 0 | number | (string & {});
|
|
665
|
+
/** @see https://tailwindcss.com/docs/flex-shrink */
|
|
666
|
+
shrink?: boolean | 0 | number | (string & {});
|
|
667
|
+
/** @see https://tailwindcss.com/docs/order */
|
|
668
|
+
order?: 'first' | 'last' | 'none' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | number | (string & {});
|
|
669
|
+
/** @see https://tailwindcss.com/docs/grid-template-columns */
|
|
670
|
+
gridCols?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 'none' | 'subgrid' | (string & {});
|
|
671
|
+
/** @see https://tailwindcss.com/docs/grid-template-rows */
|
|
672
|
+
gridRows?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 'none' | 'subgrid' | (string & {});
|
|
673
|
+
/** @see https://tailwindcss.com/docs/grid-column */
|
|
674
|
+
col?: 'auto' | number | (string & {});
|
|
675
|
+
colSpan?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 'full' | number | (string & {});
|
|
676
|
+
colStart?: 'auto' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | number | (string & {});
|
|
677
|
+
colEnd?: 'auto' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | number | (string & {});
|
|
678
|
+
/** @see https://tailwindcss.com/docs/grid-row */
|
|
679
|
+
row?: 'auto' | number | (string & {});
|
|
680
|
+
rowSpan?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 'full' | number | (string & {});
|
|
681
|
+
rowStart?: 'auto' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | number | (string & {});
|
|
682
|
+
rowEnd?: 'auto' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | number | (string & {});
|
|
683
|
+
/** @see https://tailwindcss.com/docs/grid-auto-flow */
|
|
684
|
+
gridFlow?: 'row' | 'col' | 'dense' | 'row-dense' | 'col-dense';
|
|
685
|
+
/** @see https://tailwindcss.com/docs/grid-auto-columns */
|
|
686
|
+
autoCols?: 'auto' | 'min' | 'max' | 'fr' | (string & {});
|
|
687
|
+
/** @see https://tailwindcss.com/docs/grid-auto-rows */
|
|
688
|
+
autoRows?: 'auto' | 'min' | 'max' | 'fr' | (string & {});
|
|
689
|
+
/** @see https://tailwindcss.com/docs/gap */
|
|
690
|
+
gap?: SpacingValue;
|
|
691
|
+
gapX?: SpacingValue;
|
|
692
|
+
gapY?: SpacingValue;
|
|
693
|
+
/** @see https://tailwindcss.com/docs/justify-content */
|
|
694
|
+
justify?: 'normal' | 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'stretch' | 'baseline' | 'safe-center' | 'safe-end';
|
|
695
|
+
/** @see https://tailwindcss.com/docs/justify-items */
|
|
696
|
+
justifyItems?: 'start' | 'end' | 'center' | 'stretch' | 'normal' | 'safe-center' | 'safe-end';
|
|
697
|
+
/** @see https://tailwindcss.com/docs/justify-self */
|
|
698
|
+
justifySelf?: 'auto' | 'start' | 'end' | 'center' | 'stretch' | 'safe-center' | 'safe-end';
|
|
699
|
+
/** @see https://tailwindcss.com/docs/align-items */
|
|
700
|
+
items?: 'start' | 'end' | 'center' | 'baseline' | 'stretch' | 'safe-center' | 'safe-end' | (string & {});
|
|
701
|
+
/** @see https://tailwindcss.com/docs/align-self */
|
|
702
|
+
self?: 'auto' | 'start' | 'end' | 'center' | 'stretch' | 'baseline' | 'safe-center' | 'safe-end' | (string & {});
|
|
703
|
+
/** @see https://tailwindcss.com/docs/place-content */
|
|
704
|
+
placeContent?: 'center' | 'start' | 'end' | 'between' | 'around' | 'evenly' | 'baseline' | 'stretch' | 'safe-center' | 'safe-end';
|
|
705
|
+
/** @see https://tailwindcss.com/docs/place-items */
|
|
706
|
+
placeItems?: 'start' | 'end' | 'center' | 'baseline' | 'stretch' | 'safe-center' | 'safe-end';
|
|
707
|
+
/** @see https://tailwindcss.com/docs/place-self */
|
|
708
|
+
placeSelf?: 'auto' | 'start' | 'end' | 'center' | 'stretch' | 'safe-center' | 'safe-end';
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
*
|
|
712
|
+
*/
|
|
713
|
+
interface SpacingProps {
|
|
714
|
+
/** Padding - all sides */
|
|
715
|
+
p?: SpacingValue;
|
|
716
|
+
/** Padding - X axis (left/right) */
|
|
717
|
+
px?: SpacingValue;
|
|
718
|
+
/** Padding - Y axis (top/bottom) */
|
|
719
|
+
py?: SpacingValue;
|
|
720
|
+
/** Padding - top */
|
|
721
|
+
pt?: SpacingValue;
|
|
722
|
+
/** Padding - right */
|
|
723
|
+
pr?: SpacingValue;
|
|
724
|
+
/** Padding - bottom */
|
|
725
|
+
pb?: SpacingValue;
|
|
726
|
+
/** Padding - left */
|
|
727
|
+
pl?: SpacingValue;
|
|
728
|
+
/** Padding - inline start (logical) */
|
|
729
|
+
ps?: SpacingValue;
|
|
730
|
+
/** Padding - inline end (logical) */
|
|
731
|
+
pe?: SpacingValue;
|
|
732
|
+
/** Margin - all sides */
|
|
733
|
+
m?: NegativeSpacingValue;
|
|
734
|
+
/** Margin - X axis (left/right) */
|
|
735
|
+
mx?: NegativeSpacingValue;
|
|
736
|
+
/** Margin - Y axis (top/bottom) */
|
|
737
|
+
my?: NegativeSpacingValue;
|
|
738
|
+
/** Margin - top */
|
|
739
|
+
mt?: NegativeSpacingValue;
|
|
740
|
+
/** Margin - right */
|
|
741
|
+
mr?: NegativeSpacingValue;
|
|
742
|
+
/** Margin - bottom */
|
|
743
|
+
mb?: NegativeSpacingValue;
|
|
744
|
+
/** Margin - left */
|
|
745
|
+
ml?: NegativeSpacingValue;
|
|
746
|
+
/** Margin - inline start (logical) */
|
|
747
|
+
ms?: NegativeSpacingValue;
|
|
748
|
+
/** Margin - inline end (logical) */
|
|
749
|
+
me?: NegativeSpacingValue;
|
|
750
|
+
/** Space between child elements - X axis */
|
|
751
|
+
spaceX?: NegativeSpacingValue;
|
|
752
|
+
/** Space between child elements - Y axis */
|
|
753
|
+
spaceY?: NegativeSpacingValue;
|
|
754
|
+
/** Reverse space-x direction */
|
|
755
|
+
spaceXReverse?: boolean;
|
|
756
|
+
/** Reverse space-y direction */
|
|
757
|
+
spaceYReverse?: boolean;
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
*
|
|
761
|
+
*/
|
|
762
|
+
interface SizingProps {
|
|
763
|
+
/** @see https://tailwindcss.com/docs/width */
|
|
764
|
+
w?: SpacingScale | 'px' | 'auto' | 'full' | 'screen' | 'svw' | 'lvw' | 'dvw' | 'min' | 'max' | 'fit' | FractionValue | (string & {});
|
|
765
|
+
/** @see https://tailwindcss.com/docs/min-width */
|
|
766
|
+
minW?: SpacingScale | 'px' | 'full' | 'min' | 'max' | 'fit' | FractionValue | (string & {});
|
|
767
|
+
/** @see https://tailwindcss.com/docs/max-width */
|
|
768
|
+
maxW?: SpacingScale | 'px' | 'full' | 'none' | 'prose' | 'min' | 'max' | 'fit' | ContainerSize | 'screen-sm' | 'screen-md' | 'screen-lg' | 'screen-xl' | 'screen-2xl' | FractionValue | (string & {});
|
|
769
|
+
/** @see https://tailwindcss.com/docs/height */
|
|
770
|
+
h?: SpacingScale | 'px' | 'auto' | 'full' | 'screen' | 'svh' | 'lvh' | 'dvh' | 'min' | 'max' | 'fit' | FractionValue | (string & {});
|
|
771
|
+
/** @see https://tailwindcss.com/docs/min-height */
|
|
772
|
+
minH?: SpacingScale | 'px' | 'full' | 'screen' | 'svh' | 'lvh' | 'dvh' | 'min' | 'max' | 'fit' | (string & {});
|
|
773
|
+
/** @see https://tailwindcss.com/docs/max-height */
|
|
774
|
+
maxH?: SpacingScale | 'px' | 'full' | 'screen' | 'svh' | 'lvh' | 'dvh' | 'min' | 'max' | 'fit' | (string & {});
|
|
775
|
+
/** @see https://tailwindcss.com/docs/size */
|
|
776
|
+
size?: SpacingScale | 'px' | 'auto' | 'full' | 'min' | 'max' | 'fit' | (string & {});
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
*
|
|
780
|
+
*/
|
|
781
|
+
interface TypographyProps {
|
|
782
|
+
/** @see https://tailwindcss.com/docs/font-size */
|
|
783
|
+
text?: 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | '8xl' | '9xl' | 'left' | 'center' | 'right' | 'justify' | 'start' | 'end' | ColorPropValue | (string & {});
|
|
784
|
+
/** @see https://tailwindcss.com/docs/font-smoothing */
|
|
785
|
+
antialiased?: boolean;
|
|
786
|
+
subpixelAntialiased?: boolean;
|
|
787
|
+
/** @see https://tailwindcss.com/docs/font-style */
|
|
788
|
+
italic?: boolean;
|
|
789
|
+
notItalic?: boolean;
|
|
790
|
+
/** @see https://tailwindcss.com/docs/font-weight — also accepts font-family keywords */
|
|
791
|
+
font?: 'thin' | 'extralight' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black' | 'sans' | 'serif' | 'mono' | (string & {});
|
|
792
|
+
/** Explicit font-weight key. Use `font` for the short form */
|
|
793
|
+
fontWeight?: 'thin' | 'extralight' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | (string & {});
|
|
794
|
+
/** Explicit font-family key. Use `font` for the short form */
|
|
795
|
+
fontFamily?: 'sans' | 'serif' | 'mono' | (string & {});
|
|
796
|
+
/** @see https://tailwindcss.com/docs/font-stretch */
|
|
797
|
+
fontStretch?: 'ultra-condensed' | 'extra-condensed' | 'condensed' | 'semi-condensed' | 'normal' | 'semi-expanded' | 'expanded' | 'extra-expanded' | 'ultra-expanded' | (string & {});
|
|
798
|
+
/** @see https://tailwindcss.com/docs/font-variant-numeric */
|
|
799
|
+
ordinal?: boolean;
|
|
800
|
+
slashedZero?: boolean;
|
|
801
|
+
liningNums?: boolean;
|
|
802
|
+
oldstyleNums?: boolean;
|
|
803
|
+
proportionalNums?: boolean;
|
|
804
|
+
tabularNums?: boolean;
|
|
805
|
+
diagonalFractions?: boolean;
|
|
806
|
+
stackedFractions?: boolean;
|
|
807
|
+
/** @see https://tailwindcss.com/docs/letter-spacing */
|
|
808
|
+
tracking?: 'tighter' | 'tight' | 'normal' | 'wide' | 'wider' | 'widest' | (string & {});
|
|
809
|
+
/** @see https://tailwindcss.com/docs/line-clamp */
|
|
810
|
+
lineClamp?: 1 | 2 | 3 | 4 | 5 | 6 | 'none' | number | (string & {});
|
|
811
|
+
/** @see https://tailwindcss.com/docs/line-height */
|
|
812
|
+
leading?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 'none' | 'tight' | 'snug' | 'normal' | 'relaxed' | 'loose' | (string & {});
|
|
813
|
+
/** @see https://tailwindcss.com/docs/list-style-image */
|
|
814
|
+
listImg?: 'none' | (string & {});
|
|
815
|
+
/** @see https://tailwindcss.com/docs/list-style-position */
|
|
816
|
+
listPos?: 'inside' | 'outside';
|
|
817
|
+
/** @see https://tailwindcss.com/docs/list-style-type */
|
|
818
|
+
list?: 'none' | 'disc' | 'decimal' | (string & {});
|
|
819
|
+
/** @see https://tailwindcss.com/docs/text-align */
|
|
820
|
+
textAlign?: 'left' | 'center' | 'right' | 'justify' | 'start' | 'end';
|
|
821
|
+
/** @see https://tailwindcss.com/docs/text-color */
|
|
822
|
+
color?: ColorPropValue;
|
|
823
|
+
/** @see https://tailwindcss.com/docs/text-decoration */
|
|
824
|
+
underline?: boolean;
|
|
825
|
+
overline?: boolean;
|
|
826
|
+
lineThrough?: boolean;
|
|
827
|
+
noUnderline?: boolean;
|
|
828
|
+
/** String-keyed text-decoration prop for arbitrary values */
|
|
829
|
+
decoration?: 'underline' | 'overline' | 'line-through' | 'none' | (string & {});
|
|
830
|
+
/** @see https://tailwindcss.com/docs/text-decoration-color */
|
|
831
|
+
decorationColor?: ColorPropValue;
|
|
832
|
+
/** @see https://tailwindcss.com/docs/text-decoration-style */
|
|
833
|
+
decorationStyle?: 'solid' | 'double' | 'dotted' | 'dashed' | 'wavy';
|
|
834
|
+
/** @see https://tailwindcss.com/docs/text-decoration-thickness */
|
|
835
|
+
decorationThickness?: 'auto' | 'from-font' | 0 | 1 | 2 | 4 | 8 | (string & {});
|
|
836
|
+
/** @see https://tailwindcss.com/docs/text-underline-offset */
|
|
837
|
+
underlineOffset?: 'auto' | 0 | 1 | 2 | 4 | 8 | (string & {});
|
|
838
|
+
/** @see https://tailwindcss.com/docs/text-transform */
|
|
839
|
+
uppercase?: boolean;
|
|
840
|
+
lowercase?: boolean;
|
|
841
|
+
capitalize?: boolean;
|
|
842
|
+
normalCase?: boolean;
|
|
843
|
+
/** @see https://tailwindcss.com/docs/text-overflow */
|
|
844
|
+
truncate?: boolean;
|
|
845
|
+
textEllipsis?: boolean;
|
|
846
|
+
textClip?: boolean;
|
|
847
|
+
/** @see https://tailwindcss.com/docs/text-wrap */
|
|
848
|
+
textWrap?: 'wrap' | 'nowrap' | 'balance' | 'pretty';
|
|
849
|
+
/** @see https://tailwindcss.com/docs/overflow-wrap (v4.1+) */
|
|
850
|
+
wrap?: 'normal' | 'break-word' | 'anywhere';
|
|
851
|
+
/** @see https://tailwindcss.com/docs/text-indent */
|
|
852
|
+
indent?: SpacingValue;
|
|
853
|
+
/** @see https://tailwindcss.com/docs/vertical-align */
|
|
854
|
+
align?: 'baseline' | 'top' | 'middle' | 'bottom' | 'text-top' | 'text-bottom' | 'sub' | 'super' | (string & {});
|
|
855
|
+
/** @see https://tailwindcss.com/docs/whitespace */
|
|
856
|
+
whitespace?: 'normal' | 'nowrap' | 'pre' | 'pre-line' | 'pre-wrap' | 'break-spaces';
|
|
857
|
+
/** @see https://tailwindcss.com/docs/word-break */
|
|
858
|
+
break?: 'normal' | 'all' | 'keep';
|
|
859
|
+
/** @see https://tailwindcss.com/docs/hyphens */
|
|
860
|
+
hyphens?: 'none' | 'manual' | 'auto';
|
|
861
|
+
/** @see https://tailwindcss.com/docs/content — also handles align-content */
|
|
862
|
+
content?: 'none' | 'normal' | 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'baseline' | 'stretch' | (string & {});
|
|
863
|
+
/** @see https://tailwindcss.com/docs/forced-color-adjust */
|
|
864
|
+
forcedColorAdjust?: 'auto' | 'none';
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
*
|
|
868
|
+
*/
|
|
869
|
+
interface BgImgGradient {
|
|
870
|
+
gradient: 'linear' | 'radial' | 'conic';
|
|
871
|
+
dir?: string | number;
|
|
872
|
+
in?: 'srgb' | 'hsl' | 'oklab' | 'oklch' | 'longer' | 'shorter' | 'increasing' | 'decreasing';
|
|
873
|
+
}
|
|
874
|
+
/** Background-related sz prop definitions. */
|
|
875
|
+
interface BackgroundProps {
|
|
876
|
+
/** @see https://tailwindcss.com/docs/background-attachment */
|
|
877
|
+
bgAttach?: 'fixed' | 'local' | 'scroll';
|
|
878
|
+
/** @see https://tailwindcss.com/docs/background-clip */
|
|
879
|
+
bgClip?: 'border' | 'padding' | 'content' | 'text';
|
|
880
|
+
/** @see https://tailwindcss.com/docs/background-color */
|
|
881
|
+
bg?: ColorPropValue | (string & {});
|
|
882
|
+
/** @see https://tailwindcss.com/docs/background-origin */
|
|
883
|
+
bgOrigin?: 'border' | 'padding' | 'content';
|
|
884
|
+
/** @see https://tailwindcss.com/docs/background-position */
|
|
885
|
+
bgPos?: 'top-left' | 'top' | 'top-right' | 'left' | 'center' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right' | (string & {});
|
|
886
|
+
/** @see https://tailwindcss.com/docs/background-repeat */
|
|
887
|
+
bgRepeat?: 'repeat' | 'no-repeat' | 'repeat-x' | 'repeat-y' | 'round' | 'space';
|
|
888
|
+
/** @see https://tailwindcss.com/docs/background-size */
|
|
889
|
+
bgSize?: 'auto' | 'cover' | 'contain' | (string & {});
|
|
890
|
+
/** @see https://tailwindcss.com/docs/background-image */
|
|
891
|
+
bgImg?: 'none' | BgImgGradient | (string & {});
|
|
892
|
+
/** @see https://tailwindcss.com/docs/gradient-color-stops */
|
|
893
|
+
from?: ColorPropValue;
|
|
894
|
+
via?: ColorPropValue;
|
|
895
|
+
to?: ColorPropValue;
|
|
896
|
+
/** @see https://tailwindcss.com/docs/gradient-color-stops (position) */
|
|
897
|
+
fromPos?: number | (string & {});
|
|
898
|
+
viaPos?: number | (string & {});
|
|
899
|
+
toPos?: number | (string & {});
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
*
|
|
903
|
+
*/
|
|
904
|
+
interface BorderProps {
|
|
905
|
+
/** @see https://tailwindcss.com/docs/border-radius */
|
|
906
|
+
rounded?: BorderRadiusValue;
|
|
907
|
+
roundedT?: BorderRadiusValue;
|
|
908
|
+
roundedR?: BorderRadiusValue;
|
|
909
|
+
roundedB?: BorderRadiusValue;
|
|
910
|
+
roundedL?: BorderRadiusValue;
|
|
911
|
+
roundedTl?: BorderRadiusValue;
|
|
912
|
+
roundedTr?: BorderRadiusValue;
|
|
913
|
+
roundedBl?: BorderRadiusValue;
|
|
914
|
+
roundedBr?: BorderRadiusValue;
|
|
915
|
+
roundedS?: BorderRadiusValue;
|
|
916
|
+
roundedE?: BorderRadiusValue;
|
|
917
|
+
roundedSs?: BorderRadiusValue;
|
|
918
|
+
roundedSe?: BorderRadiusValue;
|
|
919
|
+
roundedEs?: BorderRadiusValue;
|
|
920
|
+
roundedEe?: BorderRadiusValue;
|
|
921
|
+
/** @see https://tailwindcss.com/docs/border-width */
|
|
922
|
+
border?: boolean | 0 | 2 | 4 | 8 | ColorValue | (string & {});
|
|
923
|
+
borderX?: boolean | 0 | 2 | 4 | 8 | (string & {});
|
|
924
|
+
borderY?: boolean | 0 | 2 | 4 | 8 | (string & {});
|
|
925
|
+
borderT?: boolean | 0 | 2 | 4 | 8 | (string & {});
|
|
926
|
+
borderR?: boolean | 0 | 2 | 4 | 8 | (string & {});
|
|
927
|
+
borderB?: boolean | 0 | 2 | 4 | 8 | (string & {});
|
|
928
|
+
borderL?: boolean | 0 | 2 | 4 | 8 | (string & {});
|
|
929
|
+
borderS?: boolean | 0 | 2 | 4 | 8 | (string & {});
|
|
930
|
+
borderE?: boolean | 0 | 2 | 4 | 8 | (string & {});
|
|
931
|
+
/** @see https://tailwindcss.com/docs/border-color */
|
|
932
|
+
borderColor?: ColorPropValue;
|
|
933
|
+
/** @see https://tailwindcss.com/docs/border-style */
|
|
934
|
+
borderStyle?: 'solid' | 'dashed' | 'dotted' | 'double' | 'hidden' | 'none';
|
|
935
|
+
/** @see https://tailwindcss.com/docs/divide-width */
|
|
936
|
+
divideX?: boolean | 0 | 2 | 4 | 8 | 'reverse' | (string & {});
|
|
937
|
+
divideY?: boolean | 0 | 2 | 4 | 8 | 'reverse' | (string & {});
|
|
938
|
+
/** @see https://tailwindcss.com/docs/divide-color */
|
|
939
|
+
divideColor?: ColorPropValue;
|
|
940
|
+
/** @see https://tailwindcss.com/docs/divide-style */
|
|
941
|
+
divideStyle?: 'solid' | 'dashed' | 'dotted' | 'double' | 'none';
|
|
942
|
+
/** Reverse divide-x direction */
|
|
943
|
+
divideXReverse?: boolean;
|
|
944
|
+
/** Reverse divide-y direction */
|
|
945
|
+
divideYReverse?: boolean;
|
|
946
|
+
/** @see https://tailwindcss.com/docs/outline-width */
|
|
947
|
+
outline?: boolean | 'none' | 0 | 1 | 2 | 4 | 8 | (string & {});
|
|
948
|
+
/** @see https://tailwindcss.com/docs/outline-color */
|
|
949
|
+
outlineColor?: ColorPropValue;
|
|
950
|
+
/** @see https://tailwindcss.com/docs/outline-style */
|
|
951
|
+
outlineStyle?: 'solid' | 'dashed' | 'dotted' | 'double' | 'none';
|
|
952
|
+
/** @see https://tailwindcss.com/docs/outline-offset */
|
|
953
|
+
outlineOffset?: 0 | 1 | 2 | 4 | 8 | (string & {});
|
|
954
|
+
/** @see https://tailwindcss.com/docs/ring-width */
|
|
955
|
+
ring?: boolean | 0 | 1 | 2 | 4 | 8 | 'inset' | (string & {});
|
|
956
|
+
/** @see https://tailwindcss.com/docs/ring-color */
|
|
957
|
+
ringColor?: ColorPropValue;
|
|
958
|
+
/** @see https://tailwindcss.com/docs/ring-offset-width */
|
|
959
|
+
ringOffset?: 0 | 1 | 2 | 4 | 8 | (string & {});
|
|
960
|
+
/** @see https://tailwindcss.com/docs/ring-offset-color */
|
|
961
|
+
ringOffsetColor?: ColorPropValue;
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
*
|
|
965
|
+
*/
|
|
966
|
+
interface EffectsProps {
|
|
967
|
+
/** @see https://tailwindcss.com/docs/box-shadow */
|
|
968
|
+
shadow?: ShadowValue;
|
|
969
|
+
/** @see https://tailwindcss.com/docs/box-shadow-color */
|
|
970
|
+
shadowColor?: ColorPropValue;
|
|
971
|
+
/** Text shadow */
|
|
972
|
+
textShadow?: ShadowValue;
|
|
973
|
+
/** Text shadow color */
|
|
974
|
+
textShadowColor?: ColorPropValue;
|
|
975
|
+
/** Inset shadow */
|
|
976
|
+
insetShadow?: ShadowValue;
|
|
977
|
+
/** Inset shadow color */
|
|
978
|
+
insetShadowColor?: ColorPropValue;
|
|
979
|
+
/** Drop shadow color */
|
|
980
|
+
dropShadowColor?: ColorPropValue;
|
|
981
|
+
/** @see https://tailwindcss.com/docs/opacity */
|
|
982
|
+
opacity?: 0 | 5 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | number | (string & {});
|
|
983
|
+
/** @see https://tailwindcss.com/docs/mix-blend-mode */
|
|
984
|
+
mixBlend?: 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity' | 'plus-darker' | 'plus-lighter';
|
|
985
|
+
/** @see https://tailwindcss.com/docs/background-blend-mode */
|
|
986
|
+
bgBlend?: 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity';
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
*
|
|
990
|
+
*/
|
|
991
|
+
interface FilterProps {
|
|
992
|
+
/** @see https://tailwindcss.com/docs/blur */
|
|
993
|
+
blur?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | true | (string & {});
|
|
994
|
+
/** @see https://tailwindcss.com/docs/brightness */
|
|
995
|
+
brightness?: 0 | 50 | 75 | 90 | 95 | 100 | 105 | 110 | 125 | 150 | 200 | number | (string & {});
|
|
996
|
+
/** @see https://tailwindcss.com/docs/contrast */
|
|
997
|
+
contrast?: 0 | 50 | 75 | 100 | 125 | 150 | 200 | number | (string & {});
|
|
998
|
+
/** @see https://tailwindcss.com/docs/drop-shadow */
|
|
999
|
+
dropShadow?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'none' | true | (string & {});
|
|
1000
|
+
/** @see https://tailwindcss.com/docs/grayscale */
|
|
1001
|
+
grayscale?: boolean | 0 | (string & {});
|
|
1002
|
+
/** @see https://tailwindcss.com/docs/hue-rotate */
|
|
1003
|
+
hueRotate?: 0 | 15 | 30 | 60 | 90 | 180 | number | (string & {});
|
|
1004
|
+
/** @see https://tailwindcss.com/docs/invert */
|
|
1005
|
+
invert?: boolean | 0 | (string & {});
|
|
1006
|
+
/** @see https://tailwindcss.com/docs/saturate */
|
|
1007
|
+
saturate?: 0 | 50 | 100 | 150 | 200 | number | (string & {});
|
|
1008
|
+
/** @see https://tailwindcss.com/docs/sepia */
|
|
1009
|
+
sepia?: boolean | 0 | (string & {});
|
|
1010
|
+
/** @see https://tailwindcss.com/docs/backdrop-blur */
|
|
1011
|
+
backdropBlur?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | true | (string & {});
|
|
1012
|
+
/** @see https://tailwindcss.com/docs/backdrop-brightness */
|
|
1013
|
+
backdropBrightness?: 0 | 50 | 75 | 90 | 95 | 100 | 105 | 110 | 125 | 150 | 200 | number | (string & {});
|
|
1014
|
+
/** @see https://tailwindcss.com/docs/backdrop-contrast */
|
|
1015
|
+
backdropContrast?: 0 | 50 | 75 | 100 | 125 | 150 | 200 | number | (string & {});
|
|
1016
|
+
/** @see https://tailwindcss.com/docs/backdrop-grayscale */
|
|
1017
|
+
backdropGrayscale?: boolean | 0 | (string & {});
|
|
1018
|
+
/** @see https://tailwindcss.com/docs/backdrop-hue-rotate */
|
|
1019
|
+
backdropHueRotate?: 0 | 15 | 30 | 60 | 90 | 180 | number | (string & {});
|
|
1020
|
+
/** @see https://tailwindcss.com/docs/backdrop-invert */
|
|
1021
|
+
backdropInvert?: boolean | 0 | (string & {});
|
|
1022
|
+
/** @see https://tailwindcss.com/docs/backdrop-opacity */
|
|
1023
|
+
backdropOpacity?: 0 | 5 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | number | (string & {});
|
|
1024
|
+
/** @see https://tailwindcss.com/docs/backdrop-saturate */
|
|
1025
|
+
backdropSaturate?: 0 | 50 | 100 | 150 | 200 | number | (string & {});
|
|
1026
|
+
/** @see https://tailwindcss.com/docs/backdrop-sepia */
|
|
1027
|
+
backdropSepia?: boolean | 0 | (string & {});
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
*
|
|
1031
|
+
*/
|
|
1032
|
+
interface TransformProps {
|
|
1033
|
+
/** @see https://tailwindcss.com/docs/scale */
|
|
1034
|
+
scale?: 0 | 50 | 75 | 90 | 95 | 100 | 105 | 110 | 125 | 150 | 200 | number | (string & {});
|
|
1035
|
+
scaleX?: TransformProps['scale'];
|
|
1036
|
+
scaleY?: TransformProps['scale'];
|
|
1037
|
+
/** Boolean sugar for 3D scale */
|
|
1038
|
+
scale3d?: boolean;
|
|
1039
|
+
/** @see https://tailwindcss.com/docs/rotate */
|
|
1040
|
+
rotate?: 0 | 1 | 2 | 3 | 6 | 12 | 45 | 90 | 180 | number | (string & {});
|
|
1041
|
+
/** Boolean sugar for 3D rotate */
|
|
1042
|
+
rotate3d?: boolean;
|
|
1043
|
+
/** @see https://tailwindcss.com/docs/translate */
|
|
1044
|
+
translateX?: SpacingValue | FractionValue;
|
|
1045
|
+
translateY?: SpacingValue | FractionValue;
|
|
1046
|
+
/** Boolean sugar for 3D translate */
|
|
1047
|
+
translate3d?: boolean;
|
|
1048
|
+
/** @see https://tailwindcss.com/docs/skew */
|
|
1049
|
+
skewX?: 0 | 1 | 2 | 3 | 6 | 12 | number | (string & {});
|
|
1050
|
+
skewY?: 0 | 1 | 2 | 3 | 6 | 12 | number | (string & {});
|
|
1051
|
+
/** @see https://tailwindcss.com/docs/transform-origin */
|
|
1052
|
+
origin?: 'center' | 'top' | 'top-right' | 'right' | 'bottom-right' | 'bottom' | 'bottom-left' | 'left' | 'top-left' | (string & {});
|
|
1053
|
+
/** Transform rendering hints */
|
|
1054
|
+
transformGpu?: boolean;
|
|
1055
|
+
transformCpu?: boolean;
|
|
1056
|
+
transformNone?: boolean;
|
|
1057
|
+
/** @see https://tailwindcss.com/docs/perspective */
|
|
1058
|
+
perspective?: 'none' | (string & {});
|
|
1059
|
+
perspectiveOrigin?: (string & {});
|
|
1060
|
+
/** @see https://tailwindcss.com/docs/backface-visibility */
|
|
1061
|
+
backface?: 'visible' | 'hidden';
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
*
|
|
1065
|
+
*/
|
|
1066
|
+
interface TransitionAnimationProps {
|
|
1067
|
+
/** @see https://tailwindcss.com/docs/transition-property */
|
|
1068
|
+
transition?: boolean | 'none' | 'all' | 'colors' | 'opacity' | 'shadow' | 'transform' | (string & {});
|
|
1069
|
+
/** @see https://tailwindcss.com/docs/transition-duration */
|
|
1070
|
+
duration?: 0 | 75 | 100 | 150 | 200 | 300 | 500 | 700 | 1000 | number | (string & {});
|
|
1071
|
+
/** @see https://tailwindcss.com/docs/transition-timing-function */
|
|
1072
|
+
ease?: 'linear' | 'in' | 'out' | 'in-out' | (string & {});
|
|
1073
|
+
/** @see https://tailwindcss.com/docs/transition-delay */
|
|
1074
|
+
delay?: 0 | 75 | 100 | 150 | 200 | 300 | 500 | 700 | 1000 | number | (string & {});
|
|
1075
|
+
/** @see https://tailwindcss.com/docs/animation */
|
|
1076
|
+
animate?: 'none' | 'spin' | 'ping' | 'pulse' | 'bounce' | (string & {});
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
*
|
|
1080
|
+
*/
|
|
1081
|
+
interface InteractivityProps {
|
|
1082
|
+
/** @see https://tailwindcss.com/docs/accent-color */
|
|
1083
|
+
accent?: 'auto' | ColorPropValue;
|
|
1084
|
+
/** @see https://tailwindcss.com/docs/appearance */
|
|
1085
|
+
appearance?: 'none' | 'auto';
|
|
1086
|
+
/** @see https://tailwindcss.com/docs/cursor */
|
|
1087
|
+
cursor?: 'auto' | 'default' | 'pointer' | 'wait' | 'text' | 'move' | 'help' | 'not-allowed' | 'none' | 'context-menu' | 'progress' | 'cell' | 'crosshair' | 'vertical-text' | 'alias' | 'copy' | 'no-drop' | 'grab' | 'grabbing' | 'all-scroll' | 'col-resize' | 'row-resize' | 'n-resize' | 's-resize' | 'e-resize' | 'w-resize' | 'ne-resize' | 'nw-resize' | 'se-resize' | 'sw-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'zoom-in' | 'zoom-out' | (string & {});
|
|
1088
|
+
/** @see https://tailwindcss.com/docs/caret-color */
|
|
1089
|
+
caret?: 'auto' | ColorPropValue;
|
|
1090
|
+
/** @see https://tailwindcss.com/docs/pointer-events */
|
|
1091
|
+
pointerEvents?: 'none' | 'auto';
|
|
1092
|
+
/** @see https://tailwindcss.com/docs/resize */
|
|
1093
|
+
resize?: 'none' | 'y' | 'x' | boolean;
|
|
1094
|
+
/** @see https://tailwindcss.com/docs/scroll-behavior */
|
|
1095
|
+
scroll?: 'auto' | 'smooth';
|
|
1096
|
+
/** @see https://tailwindcss.com/docs/scroll-margin */
|
|
1097
|
+
scrollM?: SpacingValue;
|
|
1098
|
+
scrollMx?: SpacingValue;
|
|
1099
|
+
scrollMy?: SpacingValue;
|
|
1100
|
+
scrollMt?: SpacingValue;
|
|
1101
|
+
scrollMr?: SpacingValue;
|
|
1102
|
+
scrollMb?: SpacingValue;
|
|
1103
|
+
scrollMl?: SpacingValue;
|
|
1104
|
+
scrollMs?: SpacingValue;
|
|
1105
|
+
scrollMe?: SpacingValue;
|
|
1106
|
+
/** @see https://tailwindcss.com/docs/scroll-padding */
|
|
1107
|
+
scrollP?: SpacingValue;
|
|
1108
|
+
scrollPx?: SpacingValue;
|
|
1109
|
+
scrollPy?: SpacingValue;
|
|
1110
|
+
scrollPt?: SpacingValue;
|
|
1111
|
+
scrollPr?: SpacingValue;
|
|
1112
|
+
scrollPb?: SpacingValue;
|
|
1113
|
+
scrollPl?: SpacingValue;
|
|
1114
|
+
scrollPs?: SpacingValue;
|
|
1115
|
+
scrollPe?: SpacingValue;
|
|
1116
|
+
/** @see https://tailwindcss.com/docs/scroll-snap-align */
|
|
1117
|
+
snapAlign?: 'start' | 'end' | 'center' | 'align-none';
|
|
1118
|
+
/** @see https://tailwindcss.com/docs/scroll-snap-stop */
|
|
1119
|
+
snapStop?: 'normal' | 'always';
|
|
1120
|
+
/** @see https://tailwindcss.com/docs/scroll-snap-type */
|
|
1121
|
+
snapType?: 'none' | 'x' | 'y' | 'both' | 'mandatory' | 'proximity';
|
|
1122
|
+
/** @see https://tailwindcss.com/docs/touch-action */
|
|
1123
|
+
touch?: 'auto' | 'none' | 'pan-x' | 'pan-left' | 'pan-right' | 'pan-y' | 'pan-up' | 'pan-down' | 'pinch-zoom' | 'manipulation';
|
|
1124
|
+
/** @see https://tailwindcss.com/docs/user-select */
|
|
1125
|
+
select?: 'none' | 'text' | 'all' | 'auto';
|
|
1126
|
+
/** @see https://tailwindcss.com/docs/will-change */
|
|
1127
|
+
willChange?: 'auto' | 'scroll' | 'contents' | 'transform' | (string & {});
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
*
|
|
1131
|
+
*/
|
|
1132
|
+
interface SvgProps {
|
|
1133
|
+
/** @see https://tailwindcss.com/docs/fill */
|
|
1134
|
+
fill?: 'none' | 'current' | ColorPropValue;
|
|
1135
|
+
/** @see https://tailwindcss.com/docs/stroke */
|
|
1136
|
+
stroke?: 'none' | 'current' | ColorPropValue;
|
|
1137
|
+
/** @see https://tailwindcss.com/docs/stroke-width */
|
|
1138
|
+
strokeWidth?: 0 | 1 | 2 | number | (string & {});
|
|
1139
|
+
}
|
|
1140
|
+
/**
|
|
1141
|
+
*
|
|
1142
|
+
*/
|
|
1143
|
+
interface TableProps {
|
|
1144
|
+
/** @see https://tailwindcss.com/docs/border-collapse */
|
|
1145
|
+
borderCollapse?: 'collapse' | 'separate';
|
|
1146
|
+
/** @see https://tailwindcss.com/docs/border-spacing */
|
|
1147
|
+
borderSpacing?: SpacingValue;
|
|
1148
|
+
borderSpacingX?: SpacingValue;
|
|
1149
|
+
borderSpacingY?: SpacingValue;
|
|
1150
|
+
/** @see https://tailwindcss.com/docs/table-layout */
|
|
1151
|
+
tableLayout?: 'auto' | 'fixed';
|
|
1152
|
+
/** @see https://tailwindcss.com/docs/caption-side */
|
|
1153
|
+
caption?: 'top' | 'bottom';
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
*
|
|
1157
|
+
*/
|
|
1158
|
+
interface MaskProps {
|
|
1159
|
+
/** CSS mask shorthand */
|
|
1160
|
+
mask?: 'none' | (string & {});
|
|
1161
|
+
/** CSS mask-size */
|
|
1162
|
+
maskSize?: 'auto' | 'cover' | 'contain' | (string & {});
|
|
1163
|
+
/** CSS mask-position */
|
|
1164
|
+
maskPos?: (string & {});
|
|
1165
|
+
/** CSS mask-repeat */
|
|
1166
|
+
maskRepeat?: 'repeat' | 'no-repeat' | 'repeat-x' | 'repeat-y' | 'round' | 'space';
|
|
1167
|
+
/** CSS mask-type (shape-rendering) */
|
|
1168
|
+
maskShape?: 'alpha' | 'luminance';
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* Variant modifiers for pseudo-classes, breakpoints, and states.
|
|
1172
|
+
* These allow nesting SzProps for conditional styling.
|
|
1173
|
+
*/
|
|
1174
|
+
interface VariantModifiers {
|
|
1175
|
+
hover?: SzPropsBase;
|
|
1176
|
+
focus?: SzPropsBase;
|
|
1177
|
+
active?: SzPropsBase;
|
|
1178
|
+
visited?: SzPropsBase;
|
|
1179
|
+
target?: SzPropsBase;
|
|
1180
|
+
first?: SzPropsBase;
|
|
1181
|
+
last?: SzPropsBase;
|
|
1182
|
+
only?: SzPropsBase;
|
|
1183
|
+
odd?: SzPropsBase;
|
|
1184
|
+
even?: SzPropsBase;
|
|
1185
|
+
firstOfType?: SzPropsBase;
|
|
1186
|
+
lastOfType?: SzPropsBase;
|
|
1187
|
+
onlyOfType?: SzPropsBase;
|
|
1188
|
+
empty?: SzPropsBase;
|
|
1189
|
+
disabled?: SzPropsBase;
|
|
1190
|
+
enabled?: SzPropsBase;
|
|
1191
|
+
checked?: SzPropsBase;
|
|
1192
|
+
indeterminate?: SzPropsBase;
|
|
1193
|
+
default?: SzPropsBase;
|
|
1194
|
+
required?: SzPropsBase;
|
|
1195
|
+
valid?: SzPropsBase;
|
|
1196
|
+
invalid?: SzPropsBase;
|
|
1197
|
+
inRange?: SzPropsBase;
|
|
1198
|
+
outOfRange?: SzPropsBase;
|
|
1199
|
+
placeholderShown?: SzPropsBase;
|
|
1200
|
+
autofill?: SzPropsBase;
|
|
1201
|
+
readOnly?: SzPropsBase;
|
|
1202
|
+
focusWithin?: SzPropsBase;
|
|
1203
|
+
focusVisible?: SzPropsBase;
|
|
1204
|
+
before?: SzPropsBase;
|
|
1205
|
+
after?: SzPropsBase;
|
|
1206
|
+
placeholder?: SzPropsBase;
|
|
1207
|
+
file?: SzPropsBase;
|
|
1208
|
+
marker?: SzPropsBase;
|
|
1209
|
+
selection?: SzPropsBase;
|
|
1210
|
+
firstLine?: SzPropsBase;
|
|
1211
|
+
firstLetter?: SzPropsBase;
|
|
1212
|
+
backdrop?: SzPropsBase;
|
|
1213
|
+
sm?: SzPropsBase;
|
|
1214
|
+
md?: SzPropsBase;
|
|
1215
|
+
lg?: SzPropsBase;
|
|
1216
|
+
xl?: SzPropsBase;
|
|
1217
|
+
'2xl'?: SzPropsBase;
|
|
1218
|
+
'@sm'?: SzPropsBase;
|
|
1219
|
+
'@md'?: SzPropsBase;
|
|
1220
|
+
'@lg'?: SzPropsBase;
|
|
1221
|
+
'@xl'?: SzPropsBase;
|
|
1222
|
+
'@2xl'?: SzPropsBase;
|
|
1223
|
+
dark?: SzPropsBase;
|
|
1224
|
+
light?: SzPropsBase;
|
|
1225
|
+
motionReduce?: SzPropsBase;
|
|
1226
|
+
motionSafe?: SzPropsBase;
|
|
1227
|
+
contrastMore?: SzPropsBase;
|
|
1228
|
+
contrastLess?: SzPropsBase;
|
|
1229
|
+
print?: SzPropsBase;
|
|
1230
|
+
portrait?: SzPropsBase;
|
|
1231
|
+
landscape?: SzPropsBase;
|
|
1232
|
+
rtl?: SzPropsBase;
|
|
1233
|
+
ltr?: SzPropsBase;
|
|
1234
|
+
group?: boolean | string | SzPropsBase;
|
|
1235
|
+
peer?: boolean | string | SzPropsBase;
|
|
1236
|
+
not?: SzPropsBase;
|
|
1237
|
+
has?: Record<string, SzPropsBase>;
|
|
1238
|
+
aria?: Record<string, SzPropsBase>;
|
|
1239
|
+
data?: Record<string, SzPropsBase>;
|
|
1240
|
+
supports?: Record<string, SzPropsBase>;
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Base sz props without variant modifiers (to prevent infinite recursion).
|
|
1244
|
+
*/
|
|
1245
|
+
type SzPropsBase = LayoutProps & FlexboxGridProps & SpacingProps & SizingProps & TypographyProps & BackgroundProps & BorderProps & EffectsProps & FilterProps & TransformProps & TransitionAnimationProps & InteractivityProps & SvgProps & TableProps & MaskProps & {
|
|
1246
|
+
[key: string]: unknown;
|
|
1247
|
+
};
|
|
1248
|
+
/**
|
|
1249
|
+
* Complete sz prop type with all properties and variant modifiers.
|
|
1250
|
+
*
|
|
1251
|
+
* @example
|
|
1252
|
+
* ```tsx
|
|
1253
|
+
* <div sz={{ p: 4, bg: 'blue-500', hover: { bg: 'blue-700' } }} />
|
|
1254
|
+
* ```
|
|
1255
|
+
*/
|
|
1256
|
+
type SzProps = SzPropsBase & VariantModifiers;
|
|
1257
|
+
/**
|
|
1258
|
+
* String-based sz prop for pass-through class names.
|
|
1259
|
+
*
|
|
1260
|
+
* @example
|
|
1261
|
+
* ```tsx
|
|
1262
|
+
* <div sz="p-4 bg-blue-500 hover:bg-blue-700" />
|
|
1263
|
+
* ```
|
|
1264
|
+
*/
|
|
1265
|
+
type SzPropValue = string | SzProps;
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* @csszyx/compiler - TypeScript compiler package for csszyx.
|
|
1269
|
+
*
|
|
1270
|
+
* This package provides the core compilation functionality for csszyx,
|
|
1271
|
+
* including JSX transformation, recovery token generation, and manifest
|
|
1272
|
+
* creation.
|
|
1273
|
+
*
|
|
1274
|
+
* @module @csszyx/compiler
|
|
1275
|
+
*/
|
|
1276
|
+
|
|
1277
|
+
/**
|
|
1278
|
+
* Compiler version.
|
|
1279
|
+
*/
|
|
1280
|
+
declare const VERSION = "0.0.0";
|
|
1281
|
+
/**
|
|
1282
|
+
* Compiler configuration options.
|
|
1283
|
+
*/
|
|
1284
|
+
interface CompilerOptions {
|
|
1285
|
+
/**
|
|
1286
|
+
* Build ID (git hash or timestamp)
|
|
1287
|
+
*/
|
|
1288
|
+
buildId?: string;
|
|
1289
|
+
/**
|
|
1290
|
+
* Enable development mode features
|
|
1291
|
+
*/
|
|
1292
|
+
development?: boolean;
|
|
1293
|
+
/**
|
|
1294
|
+
* Auto-inject recovery tokens
|
|
1295
|
+
*/
|
|
1296
|
+
autoInjectRecovery?: boolean;
|
|
1297
|
+
/**
|
|
1298
|
+
* Strict mode - fail build on warnings
|
|
1299
|
+
*/
|
|
1300
|
+
strictMode?: boolean;
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Default compiler options.
|
|
1304
|
+
*/
|
|
1305
|
+
declare const DEFAULT_COMPILER_OPTIONS: Required<CompilerOptions>;
|
|
1306
|
+
/**
|
|
1307
|
+
* Merges user options with defaults.
|
|
1308
|
+
*
|
|
1309
|
+
* @param {Partial<CompilerOptions>} options - User-provided options
|
|
1310
|
+
* @returns {Required<CompilerOptions>} Complete options object
|
|
1311
|
+
*
|
|
1312
|
+
* @example
|
|
1313
|
+
* ```typescript
|
|
1314
|
+
* const options = mergeOptions({ development: true });
|
|
1315
|
+
* ```
|
|
1316
|
+
*/
|
|
1317
|
+
declare function mergeOptions(options?: Partial<CompilerOptions>): Required<CompilerOptions>;
|
|
1318
|
+
|
|
1319
|
+
export { type BackgroundProps, type BorderProps, type BorderRadiusValue, COLOR_PROPERTIES, type CSSVarUsage, type ColorName, type ColorObjectValue, type ColorPropValue, type ColorShade, type ColorValue, type CompilerOptions, type ContainerSize, CsszyxCompiler, DEFAULT_COMPILER_OPTIONS, type EffectsProps, type FilterProps, type FlexboxGridProps, type FractionValue, type InteractivityProps, type LayoutProps, ManifestBuilder, type NegativeSpacingValue, PROPERTY_CATEGORY_MAP, PropertyCategory, type RecoveryManifest, type RecoveryMode, type RecoveryToken, type ShadowValue, type SizingProps, type SpacingProps, type SpacingScale, type SpacingValue, type SvgProps, type SzObject, type SzPropValue, type SzProps, type SzPropsBase, type SzValue, type TableProps, type TokenData, type TokenMetadata, type TransformProps, type TransitionAnimationProps, type TypographyProps, VERSION, type VariantModifiers, buildParentMap, createRecoveryToken, generateRecoveryToken, getCSSVariableName, getPropertyCategory, hoistCSSVariables, injectRecoveryToken, isValidRecoveryMode, isValidSzProp, mergeOptions, normalizeClassName, parseManifest, serializeManifest, transform, transformSourceCode, validateManifest, validateSzRecover };
|