@csszyx/compiler 0.3.1 → 0.5.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/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/color-var.cjs +38 -0
- package/dist/color-var.d.cts +18 -0
- package/dist/color-var.d.ts +18 -0
- package/dist/color-var.js +15 -0
- package/dist/index.cjs +723 -106
- package/dist/index.d.cts +106 -24
- package/dist/index.d.ts +106 -24
- package/dist/index.js +722 -112
- package/package.json +14 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as t from '@babel/types';
|
|
2
|
+
import * as CSS from 'csstype';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* JSX Transform - Converts sz prop to className string.
|
|
@@ -19,6 +20,10 @@ type SzValue = string | number | boolean | SzObject;
|
|
|
19
20
|
interface SzObject {
|
|
20
21
|
[key: string]: SzValue;
|
|
21
22
|
}
|
|
23
|
+
declare const PROPERTY_MAP: Record<string, string>;
|
|
24
|
+
declare const SUGGESTION_MAP: Record<string, string>;
|
|
25
|
+
declare const KNOWN_VARIANTS: Set<string>;
|
|
26
|
+
declare const BOOLEAN_SHORTHANDS: Set<string>;
|
|
22
27
|
/**
|
|
23
28
|
* Represents the result of a transformation.
|
|
24
29
|
*/
|
|
@@ -60,8 +65,11 @@ declare function transformSourceCode(source: string): {
|
|
|
60
65
|
code: string;
|
|
61
66
|
transformed: boolean;
|
|
62
67
|
usesRuntime: boolean;
|
|
68
|
+
usesMerge: boolean;
|
|
63
69
|
usesColorVar: boolean;
|
|
64
70
|
classes: Set<string>;
|
|
71
|
+
rawClassNames: Set<string>;
|
|
72
|
+
diagnostics: string[];
|
|
65
73
|
};
|
|
66
74
|
|
|
67
75
|
/**
|
|
@@ -524,10 +532,55 @@ declare function buildParentMap(ast: t.Node): Map<t.Node, t.Node>;
|
|
|
524
532
|
*
|
|
525
533
|
* @module @csszyx/compiler/types
|
|
526
534
|
*/
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Augmentable interface for user-defined Tailwind v4 design tokens.
|
|
538
|
+
*
|
|
539
|
+
* Users (or the theme-scanner plugin) extend this via module augmentation so
|
|
540
|
+
* that custom tokens appear in sz prop IntelliSense without requiring
|
|
541
|
+
* changes to the core types.
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* // In .csszyx/theme.d.ts (auto-generated by @csszyx/unplugin scanCss option):
|
|
545
|
+
* declare module '@csszyx/compiler' {
|
|
546
|
+
* interface CustomTheme {
|
|
547
|
+
* colors: 'brand' | 'brand-dark';
|
|
548
|
+
* spacings: 'xl' | '2xs';
|
|
549
|
+
* }
|
|
550
|
+
* }
|
|
551
|
+
*/
|
|
552
|
+
interface CustomTheme {
|
|
553
|
+
}
|
|
554
|
+
/** Extracts custom color tokens from CustomTheme, or never if not defined. */
|
|
555
|
+
type CT_Colors = CustomTheme extends {
|
|
556
|
+
colors: infer T;
|
|
557
|
+
} ? T : never;
|
|
558
|
+
/** Extracts custom spacing tokens from CustomTheme, or never if not defined. */
|
|
559
|
+
type CT_Spacings = CustomTheme extends {
|
|
560
|
+
spacings: infer T;
|
|
561
|
+
} ? T : never;
|
|
562
|
+
/** Extracts custom font tokens from CustomTheme, or never if not defined. */
|
|
563
|
+
type CT_Fonts = CustomTheme extends {
|
|
564
|
+
fonts: infer T;
|
|
565
|
+
} ? T : never;
|
|
566
|
+
/** Extracts custom border-radius tokens from CustomTheme, or never if not defined. */
|
|
567
|
+
type CT_Radii = CustomTheme extends {
|
|
568
|
+
radii: infer T;
|
|
569
|
+
} ? T : never;
|
|
570
|
+
/** Extracts custom shadow tokens from CustomTheme, or never if not defined. */
|
|
571
|
+
type CT_Shadows = CustomTheme extends {
|
|
572
|
+
shadows: infer T;
|
|
573
|
+
} ? T : never;
|
|
574
|
+
/**
|
|
575
|
+
* Tailwind v4 spacing scale.
|
|
576
|
+
*
|
|
577
|
+
* Common preset values are listed for IDE autocomplete. Any number is valid —
|
|
578
|
+
* Tailwind v4's dynamic spacing system resolves n to `calc(var(--spacing) * n)`
|
|
579
|
+
* (e.g. w-13, w-92, p-1.5, p-2.5 are all valid).
|
|
580
|
+
*/
|
|
581
|
+
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 | (number & {});
|
|
582
|
+
/** Spacing value that can be scale, keyword, arbitrary, or custom token */
|
|
583
|
+
type SpacingValue = SpacingScale | 'px' | 'auto' | CT_Spacings | (number & {}) | (string & {});
|
|
531
584
|
/** Negative spacing value */
|
|
532
585
|
type NegativeSpacingValue = SpacingValue | number;
|
|
533
586
|
/** Tailwind color names */
|
|
@@ -535,7 +588,7 @@ type ColorName = 'inherit' | 'current' | 'transparent' | 'black' | 'white' | 'sl
|
|
|
535
588
|
/** Tailwind color shades */
|
|
536
589
|
type ColorShade = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950;
|
|
537
590
|
/** Color value (string-based) */
|
|
538
|
-
type ColorValue = 'inherit' | 'current' | 'transparent' | 'black' | 'white' | `${ColorName}-${ColorShade}` | (string & {});
|
|
591
|
+
type ColorValue = 'inherit' | 'current' | 'transparent' | 'black' | 'white' | `${ColorName}-${ColorShade}` | CT_Colors | (string & {});
|
|
539
592
|
/** Color object with opacity */
|
|
540
593
|
interface ColorObjectValue {
|
|
541
594
|
color: ColorValue;
|
|
@@ -545,12 +598,17 @@ interface ColorObjectValue {
|
|
|
545
598
|
type ColorPropValue = ColorValue | ColorObjectValue;
|
|
546
599
|
/** Container size names */
|
|
547
600
|
type ContainerSize = '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl';
|
|
548
|
-
/**
|
|
549
|
-
|
|
601
|
+
/**
|
|
602
|
+
* Fraction values for sizing/layout props.
|
|
603
|
+
*
|
|
604
|
+
* Common fractions are listed for IDE autocomplete. Any `n/m` string is valid —
|
|
605
|
+
* Tailwind v4 accepts arbitrary numerator/denominator (e.g. '3/7', '5/9', '11/16').
|
|
606
|
+
*/
|
|
607
|
+
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' | (string & {});
|
|
550
608
|
/** Border radius keywords */
|
|
551
|
-
type BorderRadiusValue = 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' | true | (string & {});
|
|
609
|
+
type BorderRadiusValue = 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' | CT_Radii | true | (string & {});
|
|
552
610
|
/** Shadow keywords */
|
|
553
|
-
type ShadowValue = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'inner' | 'none' | true | (string & {});
|
|
611
|
+
type ShadowValue = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'inner' | 'none' | CT_Shadows | true | (string & {});
|
|
554
612
|
/**
|
|
555
613
|
*
|
|
556
614
|
*/
|
|
@@ -823,7 +881,7 @@ interface TypographyProps {
|
|
|
823
881
|
/** @see https://tailwindcss.com/docs/font-weight */
|
|
824
882
|
fontWeight?: 'thin' | 'extralight' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | (string & {});
|
|
825
883
|
/** Explicit font-family key. Use `font` for the short form */
|
|
826
|
-
fontFamily?: 'sans' | 'serif' | 'mono' | (string & {});
|
|
884
|
+
fontFamily?: 'sans' | 'serif' | 'mono' | CT_Fonts | (string & {});
|
|
827
885
|
/** @see https://tailwindcss.com/docs/font-stretch */
|
|
828
886
|
fontStretch?: 'ultra-condensed' | 'extra-condensed' | 'condensed' | 'semi-condensed' | 'normal' | 'semi-expanded' | 'expanded' | 'extra-expanded' | 'ultra-expanded' | (string & {});
|
|
829
887
|
/** @see https://tailwindcss.com/docs/font-variant-numeric */
|
|
@@ -1068,13 +1126,11 @@ interface FilterProps {
|
|
|
1068
1126
|
*/
|
|
1069
1127
|
interface TransformProps {
|
|
1070
1128
|
/** @see https://tailwindcss.com/docs/scale */
|
|
1071
|
-
scale?: 0 | 50 | 75 | 90 | 95 | 100 | 105 | 110 | 125 | 150 | 200 | number | (string & {});
|
|
1129
|
+
scale?: 0 | 50 | 75 | 90 | 95 | 100 | 105 | 110 | 125 | 150 | 200 | '3d' | number | (string & {});
|
|
1072
1130
|
scaleX?: TransformProps['scale'];
|
|
1073
1131
|
scaleY?: TransformProps['scale'];
|
|
1074
1132
|
/** @see https://tailwindcss.com/docs/scale (Z-axis, 3D) */
|
|
1075
1133
|
scaleZ?: TransformProps['scale'];
|
|
1076
|
-
/** Boolean sugar for 3D scale */
|
|
1077
|
-
scale3d?: boolean;
|
|
1078
1134
|
/** @see https://tailwindcss.com/docs/rotate */
|
|
1079
1135
|
rotate?: 0 | 1 | 2 | 3 | 6 | 12 | 45 | 90 | 180 | number | (string & {});
|
|
1080
1136
|
/** @see https://tailwindcss.com/docs/rotate (X-axis, 3D) */
|
|
@@ -1083,25 +1139,20 @@ interface TransformProps {
|
|
|
1083
1139
|
rotateY?: TransformProps['rotate'];
|
|
1084
1140
|
/** @see https://tailwindcss.com/docs/rotate (Z-axis, 3D) */
|
|
1085
1141
|
rotateZ?: TransformProps['rotate'];
|
|
1086
|
-
/**
|
|
1087
|
-
|
|
1142
|
+
/** @see https://tailwindcss.com/docs/translate — shorthand sets both axes */
|
|
1143
|
+
translate?: SpacingValue | FractionValue;
|
|
1088
1144
|
/** @see https://tailwindcss.com/docs/translate */
|
|
1089
1145
|
translateX?: SpacingValue | FractionValue;
|
|
1090
1146
|
translateY?: SpacingValue | FractionValue;
|
|
1091
1147
|
/** @see https://tailwindcss.com/docs/translate (Z-axis, 3D) */
|
|
1092
1148
|
translateZ?: SpacingValue;
|
|
1093
|
-
/** Boolean sugar for 3D translate */
|
|
1094
|
-
translate3d?: boolean;
|
|
1095
1149
|
/** @see https://tailwindcss.com/docs/skew */
|
|
1096
1150
|
skewX?: 0 | 1 | 2 | 3 | 6 | 12 | number | (string & {});
|
|
1097
1151
|
skewY?: 0 | 1 | 2 | 3 | 6 | 12 | number | (string & {});
|
|
1098
1152
|
/** @see https://tailwindcss.com/docs/transform-origin */
|
|
1099
1153
|
origin?: 'center' | 'top' | 'top-right' | 'right' | 'bottom-right' | 'bottom' | 'bottom-left' | 'left' | 'top-left' | (string & {});
|
|
1100
|
-
/** Transform rendering hints */
|
|
1101
|
-
transformGpu?: boolean;
|
|
1102
|
-
transformCpu?: boolean;
|
|
1103
1154
|
/** @see https://tailwindcss.com/docs/transform */
|
|
1104
|
-
transform?: 'none';
|
|
1155
|
+
transform?: 'none' | 'gpu' | 'cpu';
|
|
1105
1156
|
/** @see https://tailwindcss.com/docs/perspective */
|
|
1106
1157
|
perspective?: 'none' | (string & {});
|
|
1107
1158
|
perspectiveOrigin?: (string & {});
|
|
@@ -1122,6 +1173,11 @@ interface TransitionAnimationProps {
|
|
|
1122
1173
|
delay?: 0 | 75 | 100 | 150 | 200 | 300 | 500 | 700 | 1000 | number | (string & {});
|
|
1123
1174
|
/** @see https://tailwindcss.com/docs/animation */
|
|
1124
1175
|
animate?: 'none' | 'spin' | 'ping' | 'pulse' | 'bounce' | (string & {});
|
|
1176
|
+
/**
|
|
1177
|
+
* Animation delay — sets `animation-delay` (distinct from `delay` which sets `transition-delay`).
|
|
1178
|
+
* Number values are treated as milliseconds: `150` → `[animation-delay:150ms]`.
|
|
1179
|
+
*/
|
|
1180
|
+
animationDelay?: 0 | 75 | 100 | 150 | 200 | 300 | 500 | 700 | 1000 | number | (string & {});
|
|
1125
1181
|
}
|
|
1126
1182
|
/**
|
|
1127
1183
|
*
|
|
@@ -1303,6 +1359,22 @@ interface VariantModifiers {
|
|
|
1303
1359
|
* Base sz props without variant modifiers (to prevent infinite recursion).
|
|
1304
1360
|
*/
|
|
1305
1361
|
type SzPropsBase = LayoutProps & FlexboxGridProps & SpacingProps & SizingProps & TypographyProps & BackgroundProps & BorderProps & EffectsProps & FilterProps & TransformProps & TransitionAnimationProps & InteractivityProps & SvgProps & TableProps & MaskProps & {
|
|
1362
|
+
/**
|
|
1363
|
+
* Arbitrary CSS escape hatch — for CSS properties with no sz/Tailwind equivalent.
|
|
1364
|
+
* Keys are camelCase CSS properties (or `--custom-property` for CSS vars).
|
|
1365
|
+
* Each entry generates a Tailwind arbitrary-property class: `[prop:value]`.
|
|
1366
|
+
*
|
|
1367
|
+
* @example
|
|
1368
|
+
* { css: { writingMode: 'vertical-lr', touchAction: 'none' } }
|
|
1369
|
+
* // → [writing-mode:vertical-lr] [touch-action:none]
|
|
1370
|
+
*
|
|
1371
|
+
* { css: { '--my-color': 'red' } }
|
|
1372
|
+
* // → [--my-color:red]
|
|
1373
|
+
*/
|
|
1374
|
+
css?: CSS.Properties & {
|
|
1375
|
+
[cssVar: `--${string}`]: string | number;
|
|
1376
|
+
};
|
|
1377
|
+
} & {
|
|
1306
1378
|
[key: string]: unknown;
|
|
1307
1379
|
};
|
|
1308
1380
|
/**
|
|
@@ -1315,14 +1387,24 @@ type SzPropsBase = LayoutProps & FlexboxGridProps & SpacingProps & SizingProps &
|
|
|
1315
1387
|
*/
|
|
1316
1388
|
type SzProps = SzPropsBase & VariantModifiers;
|
|
1317
1389
|
/**
|
|
1318
|
-
*
|
|
1390
|
+
* Array element type for sz array composition — each element is a style object or a falsy
|
|
1391
|
+
* conditional guard (`false | null | undefined` are skipped at runtime by `_szMerge`).
|
|
1392
|
+
*/
|
|
1393
|
+
type SzArrayElement = SzProps | false | null | undefined;
|
|
1394
|
+
/**
|
|
1395
|
+
* All accepted forms of the `sz` prop:
|
|
1396
|
+
* - A plain Tailwind class string: `sz="p-4 bg-blue-500"`
|
|
1397
|
+
* - A style object: `sz={{ p: 4, bg: 'blue-500' }}`
|
|
1398
|
+
* - An array of style objects for composition: `sz={[layout, text, isActive && active]}`
|
|
1319
1399
|
*
|
|
1320
1400
|
* @example
|
|
1321
1401
|
* ```tsx
|
|
1322
1402
|
* <div sz="p-4 bg-blue-500 hover:bg-blue-700" />
|
|
1403
|
+
* <div sz={{ p: 4, bg: 'blue-500' }} />
|
|
1404
|
+
* <div sz={[base, isActive && activeStyle]} />
|
|
1323
1405
|
* ```
|
|
1324
1406
|
*/
|
|
1325
|
-
type SzPropValue = string | SzProps;
|
|
1407
|
+
type SzPropValue = string | SzProps | SzArrayElement[];
|
|
1326
1408
|
|
|
1327
1409
|
/**
|
|
1328
1410
|
* @csszyx/compiler - TypeScript compiler package for csszyx.
|
|
@@ -1376,4 +1458,4 @@ declare const DEFAULT_COMPILER_OPTIONS: Required<CompilerOptions>;
|
|
|
1376
1458
|
*/
|
|
1377
1459
|
declare function mergeOptions(options?: Partial<CompilerOptions>): Required<CompilerOptions>;
|
|
1378
1460
|
|
|
1379
|
-
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 };
|
|
1461
|
+
export { BOOLEAN_SHORTHANDS, 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, type CustomTheme, DEFAULT_COMPILER_OPTIONS, type EffectsProps, type FilterProps, type FlexboxGridProps, type FractionValue, type InteractivityProps, KNOWN_VARIANTS, type LayoutProps, ManifestBuilder, type NegativeSpacingValue, PROPERTY_CATEGORY_MAP, PROPERTY_MAP, PropertyCategory, type RecoveryManifest, type RecoveryMode, type RecoveryToken, SUGGESTION_MAP, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as t from '@babel/types';
|
|
2
|
+
import * as CSS from 'csstype';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* JSX Transform - Converts sz prop to className string.
|
|
@@ -19,6 +20,10 @@ type SzValue = string | number | boolean | SzObject;
|
|
|
19
20
|
interface SzObject {
|
|
20
21
|
[key: string]: SzValue;
|
|
21
22
|
}
|
|
23
|
+
declare const PROPERTY_MAP: Record<string, string>;
|
|
24
|
+
declare const SUGGESTION_MAP: Record<string, string>;
|
|
25
|
+
declare const KNOWN_VARIANTS: Set<string>;
|
|
26
|
+
declare const BOOLEAN_SHORTHANDS: Set<string>;
|
|
22
27
|
/**
|
|
23
28
|
* Represents the result of a transformation.
|
|
24
29
|
*/
|
|
@@ -60,8 +65,11 @@ declare function transformSourceCode(source: string): {
|
|
|
60
65
|
code: string;
|
|
61
66
|
transformed: boolean;
|
|
62
67
|
usesRuntime: boolean;
|
|
68
|
+
usesMerge: boolean;
|
|
63
69
|
usesColorVar: boolean;
|
|
64
70
|
classes: Set<string>;
|
|
71
|
+
rawClassNames: Set<string>;
|
|
72
|
+
diagnostics: string[];
|
|
65
73
|
};
|
|
66
74
|
|
|
67
75
|
/**
|
|
@@ -524,10 +532,55 @@ declare function buildParentMap(ast: t.Node): Map<t.Node, t.Node>;
|
|
|
524
532
|
*
|
|
525
533
|
* @module @csszyx/compiler/types
|
|
526
534
|
*/
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Augmentable interface for user-defined Tailwind v4 design tokens.
|
|
538
|
+
*
|
|
539
|
+
* Users (or the theme-scanner plugin) extend this via module augmentation so
|
|
540
|
+
* that custom tokens appear in sz prop IntelliSense without requiring
|
|
541
|
+
* changes to the core types.
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* // In .csszyx/theme.d.ts (auto-generated by @csszyx/unplugin scanCss option):
|
|
545
|
+
* declare module '@csszyx/compiler' {
|
|
546
|
+
* interface CustomTheme {
|
|
547
|
+
* colors: 'brand' | 'brand-dark';
|
|
548
|
+
* spacings: 'xl' | '2xs';
|
|
549
|
+
* }
|
|
550
|
+
* }
|
|
551
|
+
*/
|
|
552
|
+
interface CustomTheme {
|
|
553
|
+
}
|
|
554
|
+
/** Extracts custom color tokens from CustomTheme, or never if not defined. */
|
|
555
|
+
type CT_Colors = CustomTheme extends {
|
|
556
|
+
colors: infer T;
|
|
557
|
+
} ? T : never;
|
|
558
|
+
/** Extracts custom spacing tokens from CustomTheme, or never if not defined. */
|
|
559
|
+
type CT_Spacings = CustomTheme extends {
|
|
560
|
+
spacings: infer T;
|
|
561
|
+
} ? T : never;
|
|
562
|
+
/** Extracts custom font tokens from CustomTheme, or never if not defined. */
|
|
563
|
+
type CT_Fonts = CustomTheme extends {
|
|
564
|
+
fonts: infer T;
|
|
565
|
+
} ? T : never;
|
|
566
|
+
/** Extracts custom border-radius tokens from CustomTheme, or never if not defined. */
|
|
567
|
+
type CT_Radii = CustomTheme extends {
|
|
568
|
+
radii: infer T;
|
|
569
|
+
} ? T : never;
|
|
570
|
+
/** Extracts custom shadow tokens from CustomTheme, or never if not defined. */
|
|
571
|
+
type CT_Shadows = CustomTheme extends {
|
|
572
|
+
shadows: infer T;
|
|
573
|
+
} ? T : never;
|
|
574
|
+
/**
|
|
575
|
+
* Tailwind v4 spacing scale.
|
|
576
|
+
*
|
|
577
|
+
* Common preset values are listed for IDE autocomplete. Any number is valid —
|
|
578
|
+
* Tailwind v4's dynamic spacing system resolves n to `calc(var(--spacing) * n)`
|
|
579
|
+
* (e.g. w-13, w-92, p-1.5, p-2.5 are all valid).
|
|
580
|
+
*/
|
|
581
|
+
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 | (number & {});
|
|
582
|
+
/** Spacing value that can be scale, keyword, arbitrary, or custom token */
|
|
583
|
+
type SpacingValue = SpacingScale | 'px' | 'auto' | CT_Spacings | (number & {}) | (string & {});
|
|
531
584
|
/** Negative spacing value */
|
|
532
585
|
type NegativeSpacingValue = SpacingValue | number;
|
|
533
586
|
/** Tailwind color names */
|
|
@@ -535,7 +588,7 @@ type ColorName = 'inherit' | 'current' | 'transparent' | 'black' | 'white' | 'sl
|
|
|
535
588
|
/** Tailwind color shades */
|
|
536
589
|
type ColorShade = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950;
|
|
537
590
|
/** Color value (string-based) */
|
|
538
|
-
type ColorValue = 'inherit' | 'current' | 'transparent' | 'black' | 'white' | `${ColorName}-${ColorShade}` | (string & {});
|
|
591
|
+
type ColorValue = 'inherit' | 'current' | 'transparent' | 'black' | 'white' | `${ColorName}-${ColorShade}` | CT_Colors | (string & {});
|
|
539
592
|
/** Color object with opacity */
|
|
540
593
|
interface ColorObjectValue {
|
|
541
594
|
color: ColorValue;
|
|
@@ -545,12 +598,17 @@ interface ColorObjectValue {
|
|
|
545
598
|
type ColorPropValue = ColorValue | ColorObjectValue;
|
|
546
599
|
/** Container size names */
|
|
547
600
|
type ContainerSize = '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl';
|
|
548
|
-
/**
|
|
549
|
-
|
|
601
|
+
/**
|
|
602
|
+
* Fraction values for sizing/layout props.
|
|
603
|
+
*
|
|
604
|
+
* Common fractions are listed for IDE autocomplete. Any `n/m` string is valid —
|
|
605
|
+
* Tailwind v4 accepts arbitrary numerator/denominator (e.g. '3/7', '5/9', '11/16').
|
|
606
|
+
*/
|
|
607
|
+
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' | (string & {});
|
|
550
608
|
/** Border radius keywords */
|
|
551
|
-
type BorderRadiusValue = 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' | true | (string & {});
|
|
609
|
+
type BorderRadiusValue = 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' | CT_Radii | true | (string & {});
|
|
552
610
|
/** Shadow keywords */
|
|
553
|
-
type ShadowValue = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'inner' | 'none' | true | (string & {});
|
|
611
|
+
type ShadowValue = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'inner' | 'none' | CT_Shadows | true | (string & {});
|
|
554
612
|
/**
|
|
555
613
|
*
|
|
556
614
|
*/
|
|
@@ -823,7 +881,7 @@ interface TypographyProps {
|
|
|
823
881
|
/** @see https://tailwindcss.com/docs/font-weight */
|
|
824
882
|
fontWeight?: 'thin' | 'extralight' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | (string & {});
|
|
825
883
|
/** Explicit font-family key. Use `font` for the short form */
|
|
826
|
-
fontFamily?: 'sans' | 'serif' | 'mono' | (string & {});
|
|
884
|
+
fontFamily?: 'sans' | 'serif' | 'mono' | CT_Fonts | (string & {});
|
|
827
885
|
/** @see https://tailwindcss.com/docs/font-stretch */
|
|
828
886
|
fontStretch?: 'ultra-condensed' | 'extra-condensed' | 'condensed' | 'semi-condensed' | 'normal' | 'semi-expanded' | 'expanded' | 'extra-expanded' | 'ultra-expanded' | (string & {});
|
|
829
887
|
/** @see https://tailwindcss.com/docs/font-variant-numeric */
|
|
@@ -1068,13 +1126,11 @@ interface FilterProps {
|
|
|
1068
1126
|
*/
|
|
1069
1127
|
interface TransformProps {
|
|
1070
1128
|
/** @see https://tailwindcss.com/docs/scale */
|
|
1071
|
-
scale?: 0 | 50 | 75 | 90 | 95 | 100 | 105 | 110 | 125 | 150 | 200 | number | (string & {});
|
|
1129
|
+
scale?: 0 | 50 | 75 | 90 | 95 | 100 | 105 | 110 | 125 | 150 | 200 | '3d' | number | (string & {});
|
|
1072
1130
|
scaleX?: TransformProps['scale'];
|
|
1073
1131
|
scaleY?: TransformProps['scale'];
|
|
1074
1132
|
/** @see https://tailwindcss.com/docs/scale (Z-axis, 3D) */
|
|
1075
1133
|
scaleZ?: TransformProps['scale'];
|
|
1076
|
-
/** Boolean sugar for 3D scale */
|
|
1077
|
-
scale3d?: boolean;
|
|
1078
1134
|
/** @see https://tailwindcss.com/docs/rotate */
|
|
1079
1135
|
rotate?: 0 | 1 | 2 | 3 | 6 | 12 | 45 | 90 | 180 | number | (string & {});
|
|
1080
1136
|
/** @see https://tailwindcss.com/docs/rotate (X-axis, 3D) */
|
|
@@ -1083,25 +1139,20 @@ interface TransformProps {
|
|
|
1083
1139
|
rotateY?: TransformProps['rotate'];
|
|
1084
1140
|
/** @see https://tailwindcss.com/docs/rotate (Z-axis, 3D) */
|
|
1085
1141
|
rotateZ?: TransformProps['rotate'];
|
|
1086
|
-
/**
|
|
1087
|
-
|
|
1142
|
+
/** @see https://tailwindcss.com/docs/translate — shorthand sets both axes */
|
|
1143
|
+
translate?: SpacingValue | FractionValue;
|
|
1088
1144
|
/** @see https://tailwindcss.com/docs/translate */
|
|
1089
1145
|
translateX?: SpacingValue | FractionValue;
|
|
1090
1146
|
translateY?: SpacingValue | FractionValue;
|
|
1091
1147
|
/** @see https://tailwindcss.com/docs/translate (Z-axis, 3D) */
|
|
1092
1148
|
translateZ?: SpacingValue;
|
|
1093
|
-
/** Boolean sugar for 3D translate */
|
|
1094
|
-
translate3d?: boolean;
|
|
1095
1149
|
/** @see https://tailwindcss.com/docs/skew */
|
|
1096
1150
|
skewX?: 0 | 1 | 2 | 3 | 6 | 12 | number | (string & {});
|
|
1097
1151
|
skewY?: 0 | 1 | 2 | 3 | 6 | 12 | number | (string & {});
|
|
1098
1152
|
/** @see https://tailwindcss.com/docs/transform-origin */
|
|
1099
1153
|
origin?: 'center' | 'top' | 'top-right' | 'right' | 'bottom-right' | 'bottom' | 'bottom-left' | 'left' | 'top-left' | (string & {});
|
|
1100
|
-
/** Transform rendering hints */
|
|
1101
|
-
transformGpu?: boolean;
|
|
1102
|
-
transformCpu?: boolean;
|
|
1103
1154
|
/** @see https://tailwindcss.com/docs/transform */
|
|
1104
|
-
transform?: 'none';
|
|
1155
|
+
transform?: 'none' | 'gpu' | 'cpu';
|
|
1105
1156
|
/** @see https://tailwindcss.com/docs/perspective */
|
|
1106
1157
|
perspective?: 'none' | (string & {});
|
|
1107
1158
|
perspectiveOrigin?: (string & {});
|
|
@@ -1122,6 +1173,11 @@ interface TransitionAnimationProps {
|
|
|
1122
1173
|
delay?: 0 | 75 | 100 | 150 | 200 | 300 | 500 | 700 | 1000 | number | (string & {});
|
|
1123
1174
|
/** @see https://tailwindcss.com/docs/animation */
|
|
1124
1175
|
animate?: 'none' | 'spin' | 'ping' | 'pulse' | 'bounce' | (string & {});
|
|
1176
|
+
/**
|
|
1177
|
+
* Animation delay — sets `animation-delay` (distinct from `delay` which sets `transition-delay`).
|
|
1178
|
+
* Number values are treated as milliseconds: `150` → `[animation-delay:150ms]`.
|
|
1179
|
+
*/
|
|
1180
|
+
animationDelay?: 0 | 75 | 100 | 150 | 200 | 300 | 500 | 700 | 1000 | number | (string & {});
|
|
1125
1181
|
}
|
|
1126
1182
|
/**
|
|
1127
1183
|
*
|
|
@@ -1303,6 +1359,22 @@ interface VariantModifiers {
|
|
|
1303
1359
|
* Base sz props without variant modifiers (to prevent infinite recursion).
|
|
1304
1360
|
*/
|
|
1305
1361
|
type SzPropsBase = LayoutProps & FlexboxGridProps & SpacingProps & SizingProps & TypographyProps & BackgroundProps & BorderProps & EffectsProps & FilterProps & TransformProps & TransitionAnimationProps & InteractivityProps & SvgProps & TableProps & MaskProps & {
|
|
1362
|
+
/**
|
|
1363
|
+
* Arbitrary CSS escape hatch — for CSS properties with no sz/Tailwind equivalent.
|
|
1364
|
+
* Keys are camelCase CSS properties (or `--custom-property` for CSS vars).
|
|
1365
|
+
* Each entry generates a Tailwind arbitrary-property class: `[prop:value]`.
|
|
1366
|
+
*
|
|
1367
|
+
* @example
|
|
1368
|
+
* { css: { writingMode: 'vertical-lr', touchAction: 'none' } }
|
|
1369
|
+
* // → [writing-mode:vertical-lr] [touch-action:none]
|
|
1370
|
+
*
|
|
1371
|
+
* { css: { '--my-color': 'red' } }
|
|
1372
|
+
* // → [--my-color:red]
|
|
1373
|
+
*/
|
|
1374
|
+
css?: CSS.Properties & {
|
|
1375
|
+
[cssVar: `--${string}`]: string | number;
|
|
1376
|
+
};
|
|
1377
|
+
} & {
|
|
1306
1378
|
[key: string]: unknown;
|
|
1307
1379
|
};
|
|
1308
1380
|
/**
|
|
@@ -1315,14 +1387,24 @@ type SzPropsBase = LayoutProps & FlexboxGridProps & SpacingProps & SizingProps &
|
|
|
1315
1387
|
*/
|
|
1316
1388
|
type SzProps = SzPropsBase & VariantModifiers;
|
|
1317
1389
|
/**
|
|
1318
|
-
*
|
|
1390
|
+
* Array element type for sz array composition — each element is a style object or a falsy
|
|
1391
|
+
* conditional guard (`false | null | undefined` are skipped at runtime by `_szMerge`).
|
|
1392
|
+
*/
|
|
1393
|
+
type SzArrayElement = SzProps | false | null | undefined;
|
|
1394
|
+
/**
|
|
1395
|
+
* All accepted forms of the `sz` prop:
|
|
1396
|
+
* - A plain Tailwind class string: `sz="p-4 bg-blue-500"`
|
|
1397
|
+
* - A style object: `sz={{ p: 4, bg: 'blue-500' }}`
|
|
1398
|
+
* - An array of style objects for composition: `sz={[layout, text, isActive && active]}`
|
|
1319
1399
|
*
|
|
1320
1400
|
* @example
|
|
1321
1401
|
* ```tsx
|
|
1322
1402
|
* <div sz="p-4 bg-blue-500 hover:bg-blue-700" />
|
|
1403
|
+
* <div sz={{ p: 4, bg: 'blue-500' }} />
|
|
1404
|
+
* <div sz={[base, isActive && activeStyle]} />
|
|
1323
1405
|
* ```
|
|
1324
1406
|
*/
|
|
1325
|
-
type SzPropValue = string | SzProps;
|
|
1407
|
+
type SzPropValue = string | SzProps | SzArrayElement[];
|
|
1326
1408
|
|
|
1327
1409
|
/**
|
|
1328
1410
|
* @csszyx/compiler - TypeScript compiler package for csszyx.
|
|
@@ -1376,4 +1458,4 @@ declare const DEFAULT_COMPILER_OPTIONS: Required<CompilerOptions>;
|
|
|
1376
1458
|
*/
|
|
1377
1459
|
declare function mergeOptions(options?: Partial<CompilerOptions>): Required<CompilerOptions>;
|
|
1378
1460
|
|
|
1379
|
-
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 };
|
|
1461
|
+
export { BOOLEAN_SHORTHANDS, 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, type CustomTheme, DEFAULT_COMPILER_OPTIONS, type EffectsProps, type FilterProps, type FlexboxGridProps, type FractionValue, type InteractivityProps, KNOWN_VARIANTS, type LayoutProps, ManifestBuilder, type NegativeSpacingValue, PROPERTY_CATEGORY_MAP, PROPERTY_MAP, PropertyCategory, type RecoveryManifest, type RecoveryMode, type RecoveryToken, SUGGESTION_MAP, 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 };
|