@csszyx/compiler 0.3.0 → 0.4.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 +737 -114
- package/dist/index.d.cts +110 -26
- package/dist/index.d.ts +110 -26
- package/dist/index.js +736 -120
- 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
|
*/
|
|
@@ -707,6 +765,8 @@ interface FlexboxGridProps {
|
|
|
707
765
|
justifyItems?: 'start' | 'end' | 'center' | 'stretch' | 'normal' | 'safe-center' | 'safe-end';
|
|
708
766
|
/** @see https://tailwindcss.com/docs/justify-self */
|
|
709
767
|
justifySelf?: 'auto' | 'start' | 'end' | 'center' | 'stretch' | 'safe-center' | 'safe-end';
|
|
768
|
+
/** @see https://tailwindcss.com/docs/align-content */
|
|
769
|
+
alignContent?: 'normal' | 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'baseline' | 'stretch';
|
|
710
770
|
/** @see https://tailwindcss.com/docs/align-items */
|
|
711
771
|
items?: 'start' | 'end' | 'center' | 'baseline' | 'stretch' | 'safe-center' | 'safe-end' | (string & {});
|
|
712
772
|
/** @see https://tailwindcss.com/docs/align-self */
|
|
@@ -821,7 +881,7 @@ interface TypographyProps {
|
|
|
821
881
|
/** @see https://tailwindcss.com/docs/font-weight */
|
|
822
882
|
fontWeight?: 'thin' | 'extralight' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | (string & {});
|
|
823
883
|
/** Explicit font-family key. Use `font` for the short form */
|
|
824
|
-
fontFamily?: 'sans' | 'serif' | 'mono' | (string & {});
|
|
884
|
+
fontFamily?: 'sans' | 'serif' | 'mono' | CT_Fonts | (string & {});
|
|
825
885
|
/** @see https://tailwindcss.com/docs/font-stretch */
|
|
826
886
|
fontStretch?: 'ultra-condensed' | 'extra-condensed' | 'condensed' | 'semi-condensed' | 'normal' | 'semi-expanded' | 'expanded' | 'extra-expanded' | 'ultra-expanded' | (string & {});
|
|
827
887
|
/** @see https://tailwindcss.com/docs/font-variant-numeric */
|
|
@@ -887,8 +947,8 @@ interface TypographyProps {
|
|
|
887
947
|
break?: 'normal' | 'all' | 'keep';
|
|
888
948
|
/** @see https://tailwindcss.com/docs/hyphens */
|
|
889
949
|
hyphens?: 'none' | 'manual' | 'auto';
|
|
890
|
-
/** @see https://tailwindcss.com/docs/content
|
|
891
|
-
content?: 'none' |
|
|
950
|
+
/** @see https://tailwindcss.com/docs/content */
|
|
951
|
+
content?: 'none' | (string & {});
|
|
892
952
|
/** @see https://tailwindcss.com/docs/font-feature-settings */
|
|
893
953
|
fontFeatures?: string & {};
|
|
894
954
|
/** @see https://tailwindcss.com/docs/forced-color-adjust */
|
|
@@ -1066,13 +1126,11 @@ interface FilterProps {
|
|
|
1066
1126
|
*/
|
|
1067
1127
|
interface TransformProps {
|
|
1068
1128
|
/** @see https://tailwindcss.com/docs/scale */
|
|
1069
|
-
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 & {});
|
|
1070
1130
|
scaleX?: TransformProps['scale'];
|
|
1071
1131
|
scaleY?: TransformProps['scale'];
|
|
1072
1132
|
/** @see https://tailwindcss.com/docs/scale (Z-axis, 3D) */
|
|
1073
1133
|
scaleZ?: TransformProps['scale'];
|
|
1074
|
-
/** Boolean sugar for 3D scale */
|
|
1075
|
-
scale3d?: boolean;
|
|
1076
1134
|
/** @see https://tailwindcss.com/docs/rotate */
|
|
1077
1135
|
rotate?: 0 | 1 | 2 | 3 | 6 | 12 | 45 | 90 | 180 | number | (string & {});
|
|
1078
1136
|
/** @see https://tailwindcss.com/docs/rotate (X-axis, 3D) */
|
|
@@ -1081,25 +1139,20 @@ interface TransformProps {
|
|
|
1081
1139
|
rotateY?: TransformProps['rotate'];
|
|
1082
1140
|
/** @see https://tailwindcss.com/docs/rotate (Z-axis, 3D) */
|
|
1083
1141
|
rotateZ?: TransformProps['rotate'];
|
|
1084
|
-
/**
|
|
1085
|
-
|
|
1142
|
+
/** @see https://tailwindcss.com/docs/translate — shorthand sets both axes */
|
|
1143
|
+
translate?: SpacingValue | FractionValue;
|
|
1086
1144
|
/** @see https://tailwindcss.com/docs/translate */
|
|
1087
1145
|
translateX?: SpacingValue | FractionValue;
|
|
1088
1146
|
translateY?: SpacingValue | FractionValue;
|
|
1089
1147
|
/** @see https://tailwindcss.com/docs/translate (Z-axis, 3D) */
|
|
1090
1148
|
translateZ?: SpacingValue;
|
|
1091
|
-
/** Boolean sugar for 3D translate */
|
|
1092
|
-
translate3d?: boolean;
|
|
1093
1149
|
/** @see https://tailwindcss.com/docs/skew */
|
|
1094
1150
|
skewX?: 0 | 1 | 2 | 3 | 6 | 12 | number | (string & {});
|
|
1095
1151
|
skewY?: 0 | 1 | 2 | 3 | 6 | 12 | number | (string & {});
|
|
1096
1152
|
/** @see https://tailwindcss.com/docs/transform-origin */
|
|
1097
1153
|
origin?: 'center' | 'top' | 'top-right' | 'right' | 'bottom-right' | 'bottom' | 'bottom-left' | 'left' | 'top-left' | (string & {});
|
|
1098
|
-
/** Transform rendering hints */
|
|
1099
|
-
transformGpu?: boolean;
|
|
1100
|
-
transformCpu?: boolean;
|
|
1101
1154
|
/** @see https://tailwindcss.com/docs/transform */
|
|
1102
|
-
transform?: 'none';
|
|
1155
|
+
transform?: 'none' | 'gpu' | 'cpu';
|
|
1103
1156
|
/** @see https://tailwindcss.com/docs/perspective */
|
|
1104
1157
|
perspective?: 'none' | (string & {});
|
|
1105
1158
|
perspectiveOrigin?: (string & {});
|
|
@@ -1120,6 +1173,11 @@ interface TransitionAnimationProps {
|
|
|
1120
1173
|
delay?: 0 | 75 | 100 | 150 | 200 | 300 | 500 | 700 | 1000 | number | (string & {});
|
|
1121
1174
|
/** @see https://tailwindcss.com/docs/animation */
|
|
1122
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 & {});
|
|
1123
1181
|
}
|
|
1124
1182
|
/**
|
|
1125
1183
|
*
|
|
@@ -1301,6 +1359,22 @@ interface VariantModifiers {
|
|
|
1301
1359
|
* Base sz props without variant modifiers (to prevent infinite recursion).
|
|
1302
1360
|
*/
|
|
1303
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
|
+
} & {
|
|
1304
1378
|
[key: string]: unknown;
|
|
1305
1379
|
};
|
|
1306
1380
|
/**
|
|
@@ -1313,14 +1387,24 @@ type SzPropsBase = LayoutProps & FlexboxGridProps & SpacingProps & SizingProps &
|
|
|
1313
1387
|
*/
|
|
1314
1388
|
type SzProps = SzPropsBase & VariantModifiers;
|
|
1315
1389
|
/**
|
|
1316
|
-
*
|
|
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]}`
|
|
1317
1399
|
*
|
|
1318
1400
|
* @example
|
|
1319
1401
|
* ```tsx
|
|
1320
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]} />
|
|
1321
1405
|
* ```
|
|
1322
1406
|
*/
|
|
1323
|
-
type SzPropValue = string | SzProps;
|
|
1407
|
+
type SzPropValue = string | SzProps | SzArrayElement[];
|
|
1324
1408
|
|
|
1325
1409
|
/**
|
|
1326
1410
|
* @csszyx/compiler - TypeScript compiler package for csszyx.
|
|
@@ -1374,4 +1458,4 @@ declare const DEFAULT_COMPILER_OPTIONS: Required<CompilerOptions>;
|
|
|
1374
1458
|
*/
|
|
1375
1459
|
declare function mergeOptions(options?: Partial<CompilerOptions>): Required<CompilerOptions>;
|
|
1376
1460
|
|
|
1377
|
-
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
|
*/
|
|
@@ -707,6 +765,8 @@ interface FlexboxGridProps {
|
|
|
707
765
|
justifyItems?: 'start' | 'end' | 'center' | 'stretch' | 'normal' | 'safe-center' | 'safe-end';
|
|
708
766
|
/** @see https://tailwindcss.com/docs/justify-self */
|
|
709
767
|
justifySelf?: 'auto' | 'start' | 'end' | 'center' | 'stretch' | 'safe-center' | 'safe-end';
|
|
768
|
+
/** @see https://tailwindcss.com/docs/align-content */
|
|
769
|
+
alignContent?: 'normal' | 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'baseline' | 'stretch';
|
|
710
770
|
/** @see https://tailwindcss.com/docs/align-items */
|
|
711
771
|
items?: 'start' | 'end' | 'center' | 'baseline' | 'stretch' | 'safe-center' | 'safe-end' | (string & {});
|
|
712
772
|
/** @see https://tailwindcss.com/docs/align-self */
|
|
@@ -821,7 +881,7 @@ interface TypographyProps {
|
|
|
821
881
|
/** @see https://tailwindcss.com/docs/font-weight */
|
|
822
882
|
fontWeight?: 'thin' | 'extralight' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | (string & {});
|
|
823
883
|
/** Explicit font-family key. Use `font` for the short form */
|
|
824
|
-
fontFamily?: 'sans' | 'serif' | 'mono' | (string & {});
|
|
884
|
+
fontFamily?: 'sans' | 'serif' | 'mono' | CT_Fonts | (string & {});
|
|
825
885
|
/** @see https://tailwindcss.com/docs/font-stretch */
|
|
826
886
|
fontStretch?: 'ultra-condensed' | 'extra-condensed' | 'condensed' | 'semi-condensed' | 'normal' | 'semi-expanded' | 'expanded' | 'extra-expanded' | 'ultra-expanded' | (string & {});
|
|
827
887
|
/** @see https://tailwindcss.com/docs/font-variant-numeric */
|
|
@@ -887,8 +947,8 @@ interface TypographyProps {
|
|
|
887
947
|
break?: 'normal' | 'all' | 'keep';
|
|
888
948
|
/** @see https://tailwindcss.com/docs/hyphens */
|
|
889
949
|
hyphens?: 'none' | 'manual' | 'auto';
|
|
890
|
-
/** @see https://tailwindcss.com/docs/content
|
|
891
|
-
content?: 'none' |
|
|
950
|
+
/** @see https://tailwindcss.com/docs/content */
|
|
951
|
+
content?: 'none' | (string & {});
|
|
892
952
|
/** @see https://tailwindcss.com/docs/font-feature-settings */
|
|
893
953
|
fontFeatures?: string & {};
|
|
894
954
|
/** @see https://tailwindcss.com/docs/forced-color-adjust */
|
|
@@ -1066,13 +1126,11 @@ interface FilterProps {
|
|
|
1066
1126
|
*/
|
|
1067
1127
|
interface TransformProps {
|
|
1068
1128
|
/** @see https://tailwindcss.com/docs/scale */
|
|
1069
|
-
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 & {});
|
|
1070
1130
|
scaleX?: TransformProps['scale'];
|
|
1071
1131
|
scaleY?: TransformProps['scale'];
|
|
1072
1132
|
/** @see https://tailwindcss.com/docs/scale (Z-axis, 3D) */
|
|
1073
1133
|
scaleZ?: TransformProps['scale'];
|
|
1074
|
-
/** Boolean sugar for 3D scale */
|
|
1075
|
-
scale3d?: boolean;
|
|
1076
1134
|
/** @see https://tailwindcss.com/docs/rotate */
|
|
1077
1135
|
rotate?: 0 | 1 | 2 | 3 | 6 | 12 | 45 | 90 | 180 | number | (string & {});
|
|
1078
1136
|
/** @see https://tailwindcss.com/docs/rotate (X-axis, 3D) */
|
|
@@ -1081,25 +1139,20 @@ interface TransformProps {
|
|
|
1081
1139
|
rotateY?: TransformProps['rotate'];
|
|
1082
1140
|
/** @see https://tailwindcss.com/docs/rotate (Z-axis, 3D) */
|
|
1083
1141
|
rotateZ?: TransformProps['rotate'];
|
|
1084
|
-
/**
|
|
1085
|
-
|
|
1142
|
+
/** @see https://tailwindcss.com/docs/translate — shorthand sets both axes */
|
|
1143
|
+
translate?: SpacingValue | FractionValue;
|
|
1086
1144
|
/** @see https://tailwindcss.com/docs/translate */
|
|
1087
1145
|
translateX?: SpacingValue | FractionValue;
|
|
1088
1146
|
translateY?: SpacingValue | FractionValue;
|
|
1089
1147
|
/** @see https://tailwindcss.com/docs/translate (Z-axis, 3D) */
|
|
1090
1148
|
translateZ?: SpacingValue;
|
|
1091
|
-
/** Boolean sugar for 3D translate */
|
|
1092
|
-
translate3d?: boolean;
|
|
1093
1149
|
/** @see https://tailwindcss.com/docs/skew */
|
|
1094
1150
|
skewX?: 0 | 1 | 2 | 3 | 6 | 12 | number | (string & {});
|
|
1095
1151
|
skewY?: 0 | 1 | 2 | 3 | 6 | 12 | number | (string & {});
|
|
1096
1152
|
/** @see https://tailwindcss.com/docs/transform-origin */
|
|
1097
1153
|
origin?: 'center' | 'top' | 'top-right' | 'right' | 'bottom-right' | 'bottom' | 'bottom-left' | 'left' | 'top-left' | (string & {});
|
|
1098
|
-
/** Transform rendering hints */
|
|
1099
|
-
transformGpu?: boolean;
|
|
1100
|
-
transformCpu?: boolean;
|
|
1101
1154
|
/** @see https://tailwindcss.com/docs/transform */
|
|
1102
|
-
transform?: 'none';
|
|
1155
|
+
transform?: 'none' | 'gpu' | 'cpu';
|
|
1103
1156
|
/** @see https://tailwindcss.com/docs/perspective */
|
|
1104
1157
|
perspective?: 'none' | (string & {});
|
|
1105
1158
|
perspectiveOrigin?: (string & {});
|
|
@@ -1120,6 +1173,11 @@ interface TransitionAnimationProps {
|
|
|
1120
1173
|
delay?: 0 | 75 | 100 | 150 | 200 | 300 | 500 | 700 | 1000 | number | (string & {});
|
|
1121
1174
|
/** @see https://tailwindcss.com/docs/animation */
|
|
1122
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 & {});
|
|
1123
1181
|
}
|
|
1124
1182
|
/**
|
|
1125
1183
|
*
|
|
@@ -1301,6 +1359,22 @@ interface VariantModifiers {
|
|
|
1301
1359
|
* Base sz props without variant modifiers (to prevent infinite recursion).
|
|
1302
1360
|
*/
|
|
1303
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
|
+
} & {
|
|
1304
1378
|
[key: string]: unknown;
|
|
1305
1379
|
};
|
|
1306
1380
|
/**
|
|
@@ -1313,14 +1387,24 @@ type SzPropsBase = LayoutProps & FlexboxGridProps & SpacingProps & SizingProps &
|
|
|
1313
1387
|
*/
|
|
1314
1388
|
type SzProps = SzPropsBase & VariantModifiers;
|
|
1315
1389
|
/**
|
|
1316
|
-
*
|
|
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]}`
|
|
1317
1399
|
*
|
|
1318
1400
|
* @example
|
|
1319
1401
|
* ```tsx
|
|
1320
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]} />
|
|
1321
1405
|
* ```
|
|
1322
1406
|
*/
|
|
1323
|
-
type SzPropValue = string | SzProps;
|
|
1407
|
+
type SzPropValue = string | SzProps | SzArrayElement[];
|
|
1324
1408
|
|
|
1325
1409
|
/**
|
|
1326
1410
|
* @csszyx/compiler - TypeScript compiler package for csszyx.
|
|
@@ -1374,4 +1458,4 @@ declare const DEFAULT_COMPILER_OPTIONS: Required<CompilerOptions>;
|
|
|
1374
1458
|
*/
|
|
1375
1459
|
declare function mergeOptions(options?: Partial<CompilerOptions>): Required<CompilerOptions>;
|
|
1376
1460
|
|
|
1377
|
-
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 };
|