@csszyx/compiler 0.9.10 → 0.10.1

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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SzObject } from './transform-core.mjs';
2
- export { BOOLEAN_SHORTHANDS, KNOWN_VARIANTS, PROPERTY_MAP, SPECIAL_VARIANTS, SUGGESTION_MAP, SzValue, isValidSzProp, normalizeClassName, transform } from './transform-core.mjs';
2
+ export { BOOLEAN_SHORTHANDS, KNOWN_VARIANTS, PROPERTY_MAP, REMOVED_BOOLEAN_SUGAR, SPECIAL_VARIANTS, SUGGESTION_MAP, SzValue, isValidSzProp, normalizeClassName, transform } from './transform-core.mjs';
3
3
  import * as t from '@babel/types';
4
4
 
5
5
  /**
@@ -12772,34 +12772,13 @@ interface LayoutProps {
12772
12772
  box?: 'border' | 'content';
12773
12773
  /** @see https://tailwindcss.com/docs/display */
12774
12774
  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';
12775
- /** Boolean sugar for display: block */
12776
- block?: boolean;
12777
- /** Boolean sugar for display: inline-block */
12778
- inlineBlock?: boolean;
12779
- /** Boolean sugar for display: inline */
12780
- inline?: boolean;
12781
- /** Boolean sugar for display: flex */
12782
- flex?: boolean | 'auto' | 'initial' | 'none' | 1 | (string & {});
12783
- /** Boolean sugar for display: inline-flex */
12784
- inlineFlex?: boolean;
12785
- /** Boolean sugar for display: grid */
12786
- grid?: boolean;
12787
- /** Boolean sugar for display: inline-grid */
12788
- inlineGrid?: boolean;
12789
- /** Boolean sugar for display: table */
12790
- table?: boolean;
12791
- /** Boolean sugar for display: table-row */
12792
- tableRow?: boolean;
12793
- /** Boolean sugar for display: table-cell */
12794
- tableCell?: boolean;
12795
- /** Boolean sugar for display: flow-root */
12796
- flowRoot?: boolean;
12797
- /** Boolean sugar for display: list-item */
12798
- listItem?: boolean;
12799
- /** Boolean sugar for display: contents */
12800
- contents?: boolean;
12801
- /** Boolean sugar for display: hidden/none */
12802
- hidden?: boolean;
12775
+ /**
12776
+ * Flex shorthand (flex-grow/shrink/basis). `flex: 1` → flex-1,
12777
+ * `flex: 'auto'` flex-auto. This is NOT the removed `display: flex` sugar —
12778
+ * for display use `display: 'flex'`.
12779
+ * @see https://tailwindcss.com/docs/flex
12780
+ */
12781
+ flex?: 'auto' | 'initial' | 'none' | number | (string & {});
12803
12782
  /** Boolean sugar for sr-only */
12804
12783
  srOnly?: boolean;
12805
12784
  /** Boolean sugar for not-sr-only */
@@ -12816,7 +12795,6 @@ interface LayoutProps {
12816
12795
  clear?: 'left' | 'right' | 'both' | 'none' | 'start' | 'end';
12817
12796
  /** @see https://tailwindcss.com/docs/isolation */
12818
12797
  isolation?: 'isolate' | 'auto';
12819
- isolate?: boolean;
12820
12798
  /** @see https://tailwindcss.com/docs/object-fit */
12821
12799
  objectFit?: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
12822
12800
  /** @see https://tailwindcss.com/docs/object-position */
@@ -12831,11 +12809,6 @@ interface LayoutProps {
12831
12809
  overscrollY?: 'auto' | 'contain' | 'none';
12832
12810
  /** @see https://tailwindcss.com/docs/position */
12833
12811
  position?: 'static' | 'fixed' | 'absolute' | 'relative' | 'sticky';
12834
- static?: boolean;
12835
- fixed?: boolean;
12836
- absolute?: boolean;
12837
- relative?: boolean;
12838
- sticky?: boolean;
12839
12812
  /** @see https://tailwindcss.com/docs/top-right-bottom-left */
12840
12813
  inset?: SpacingValue;
12841
12814
  insetX?: SpacingValue;
@@ -12856,9 +12829,6 @@ interface LayoutProps {
12856
12829
  insetBe?: SpacingValue;
12857
12830
  /** @see https://tailwindcss.com/docs/visibility */
12858
12831
  visibility?: 'visible' | 'hidden' | 'collapse';
12859
- visible?: boolean;
12860
- invisible?: boolean;
12861
- collapse?: boolean;
12862
12832
  /** @see https://tailwindcss.com/docs/z-index */
12863
12833
  z?: 'auto' | 0 | 10 | 20 | 30 | 40 | 50 | number | (string & {});
12864
12834
  }
@@ -13015,14 +12985,20 @@ interface SizingProps {
13015
12985
  interface TypographyProps {
13016
12986
  /** @see https://tailwindcss.com/docs/font-size — use `color` for text color, `textAlign` for alignment */
13017
12987
  text?: 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | '8xl' | '9xl' | (string & {});
13018
- /** @see https://tailwindcss.com/docs/font-smoothing */
13019
- antialiased?: boolean;
13020
- subpixelAntialiased?: boolean;
13021
- /** @see https://tailwindcss.com/docs/font-style */
13022
- italic?: boolean;
13023
- notItalic?: boolean;
12988
+ /**
12989
+ * Font smoothing. `'grayscale'` → antialiased, `'subpixel'` → subpixel-antialiased.
12990
+ * The values name the rendering technique. (Distinct from the `grayscale` filter.)
12991
+ * @see https://tailwindcss.com/docs/font-smoothing
12992
+ */
12993
+ fontSmoothing?: 'grayscale' | 'subpixel';
12994
+ /**
12995
+ * Font style. `'italic'` → italic, `'normal'` → not-italic. Tailwind models
12996
+ * only these two; for oblique use `css: { fontStyle: 'oblique 10deg' }`.
12997
+ * @see https://tailwindcss.com/docs/font-style
12998
+ */
12999
+ fontStyle?: 'italic' | 'normal';
13024
13000
  /** @see https://tailwindcss.com/docs/font-weight */
13025
- fontWeight?: 'thin' | 'extralight' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | (string & {});
13001
+ weight?: 'thin' | 'extralight' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black' | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | (string & {});
13026
13002
  /** Explicit font-family key. Use `font` for the short form */
13027
13003
  fontFamily?: 'sans' | 'serif' | 'mono' | CT_Fonts | (string & {});
13028
13004
  /** @see https://tailwindcss.com/docs/font-stretch */
@@ -13052,12 +13028,12 @@ interface TypographyProps {
13052
13028
  textAlign?: 'left' | 'center' | 'right' | 'justify' | 'start' | 'end';
13053
13029
  /** @see https://tailwindcss.com/docs/text-color */
13054
13030
  color?: ColorPropValue;
13055
- /** @see https://tailwindcss.com/docs/text-decoration */
13056
- underline?: boolean;
13057
- overline?: boolean;
13058
- lineThrough?: boolean;
13059
- noUnderline?: boolean;
13060
- /** String-keyed text-decoration prop for arbitrary values */
13031
+ /**
13032
+ * Text decoration line. `'underline'`, `'overline'`, `'line-through'`,
13033
+ * `'none'` (→ no-underline). Decoration color/style/thickness are separate
13034
+ * keys (decorationColor/decorationStyle/decorationThickness).
13035
+ * @see https://tailwindcss.com/docs/text-decoration-line
13036
+ */
13061
13037
  decoration?: 'underline' | 'overline' | 'line-through' | 'none' | (string & {});
13062
13038
  /** @see https://tailwindcss.com/docs/text-decoration-color */
13063
13039
  decorationColor?: ColorPropValue;
@@ -13067,11 +13043,12 @@ interface TypographyProps {
13067
13043
  decorationThickness?: 'auto' | 'from-font' | 0 | 1 | 2 | 4 | 8 | (string & {});
13068
13044
  /** @see https://tailwindcss.com/docs/text-underline-offset */
13069
13045
  underlineOffset?: 'auto' | 0 | 1 | 2 | 4 | 8 | (string & {});
13070
- /** @see https://tailwindcss.com/docs/text-transform */
13071
- uppercase?: boolean;
13072
- lowercase?: boolean;
13073
- capitalize?: boolean;
13074
- normalCase?: boolean;
13046
+ /**
13047
+ * Text transform. `'uppercase'`, `'lowercase'`, `'capitalize'`,
13048
+ * `'none'` (→ normal-case).
13049
+ * @see https://tailwindcss.com/docs/text-transform
13050
+ */
13051
+ textTransform?: 'uppercase' | 'lowercase' | 'capitalize' | 'none';
13075
13052
  /** @see https://tailwindcss.com/docs/text-overflow */
13076
13053
  truncate?: boolean;
13077
13054
  textEllipsis?: boolean;
@@ -13437,6 +13414,10 @@ interface MaskProps {
13437
13414
  maskRepeat?: 'repeat' | 'no-repeat' | 'repeat-x' | 'repeat-y' | 'round' | 'space';
13438
13415
  /** CSS mask-type (shape-rendering) */
13439
13416
  maskShape?: 'alpha' | 'luminance';
13417
+ /** CSS mask-clip */
13418
+ maskClip?: 'border' | 'content' | 'fill' | 'padding' | 'stroke' | 'view' | (string & {});
13419
+ /** CSS mask-origin */
13420
+ maskOrigin?: 'border' | 'content' | 'fill' | 'padding' | 'stroke' | 'view' | (string & {});
13440
13421
  /** Mask gradient from color stop (v4.1) */
13441
13422
  maskFrom?: ColorPropValue;
13442
13423
  /** Mask gradient via color stop (v4.1) */
@@ -13449,86 +13430,99 @@ interface MaskProps {
13449
13430
  * These allow nesting SzProps for conditional styling.
13450
13431
  */
13451
13432
  interface VariantModifiers {
13452
- hover?: SzPropsBase;
13453
- focus?: SzPropsBase;
13454
- active?: SzPropsBase;
13455
- visited?: SzPropsBase;
13456
- target?: SzPropsBase;
13457
- first?: SzPropsBase;
13458
- last?: SzPropsBase;
13459
- only?: SzPropsBase;
13460
- odd?: SzPropsBase;
13461
- even?: SzPropsBase;
13462
- firstOfType?: SzPropsBase;
13463
- lastOfType?: SzPropsBase;
13464
- onlyOfType?: SzPropsBase;
13465
- empty?: SzPropsBase;
13466
- disabled?: SzPropsBase;
13467
- enabled?: SzPropsBase;
13468
- checked?: SzPropsBase;
13469
- indeterminate?: SzPropsBase;
13470
- default?: SzPropsBase;
13471
- required?: SzPropsBase;
13472
- valid?: SzPropsBase;
13473
- invalid?: SzPropsBase;
13474
- inRange?: SzPropsBase;
13475
- outOfRange?: SzPropsBase;
13476
- placeholderShown?: SzPropsBase;
13477
- autofill?: SzPropsBase;
13478
- readOnly?: SzPropsBase;
13479
- focusWithin?: SzPropsBase;
13480
- focusVisible?: SzPropsBase;
13481
- before?: SzPropsBase;
13482
- after?: SzPropsBase;
13483
- placeholder?: SzPropsBase;
13484
- file?: SzPropsBase;
13485
- marker?: SzPropsBase;
13486
- selection?: SzPropsBase;
13487
- firstLine?: SzPropsBase;
13488
- firstLetter?: SzPropsBase;
13489
- backdrop?: SzPropsBase;
13490
- sm?: SzPropsBase;
13491
- md?: SzPropsBase;
13492
- lg?: SzPropsBase;
13493
- xl?: SzPropsBase;
13494
- '2xl'?: SzPropsBase;
13495
- '@sm'?: SzPropsBase;
13496
- '@md'?: SzPropsBase;
13497
- '@lg'?: SzPropsBase;
13498
- '@xl'?: SzPropsBase;
13499
- '@2xl'?: SzPropsBase;
13500
- dark?: SzPropsBase;
13501
- light?: SzPropsBase;
13502
- motionReduce?: SzPropsBase;
13503
- motionSafe?: SzPropsBase;
13504
- contrastMore?: SzPropsBase;
13505
- contrastLess?: SzPropsBase;
13506
- pointerFine?: SzPropsBase;
13507
- pointerCoarse?: SzPropsBase;
13508
- pointerNone?: SzPropsBase;
13509
- anyPointerFine?: SzPropsBase;
13510
- anyPointerCoarse?: SzPropsBase;
13511
- anyPointerNone?: SzPropsBase;
13512
- userValid?: SzPropsBase;
13513
- userInvalid?: SzPropsBase;
13514
- detailsContent?: SzPropsBase;
13515
- invertedColors?: SzPropsBase;
13516
- noscript?: SzPropsBase;
13517
- forcedColors?: SzPropsBase;
13518
- print?: SzPropsBase;
13519
- starting?: SzPropsBase;
13520
- inert?: SzPropsBase;
13521
- portrait?: SzPropsBase;
13522
- landscape?: SzPropsBase;
13523
- rtl?: SzPropsBase;
13524
- ltr?: SzPropsBase;
13525
- group?: boolean | string | SzPropsBase;
13526
- peer?: boolean | string | SzPropsBase;
13527
- not?: SzPropsBase;
13528
- has?: Record<string, SzPropsBase>;
13529
- aria?: Record<string, SzPropsBase>;
13530
- data?: Record<string, SzPropsBase>;
13531
- supports?: Record<string, SzPropsBase>;
13433
+ hover?: SzProps;
13434
+ focus?: SzProps;
13435
+ active?: SzProps;
13436
+ visited?: SzProps;
13437
+ target?: SzProps;
13438
+ first?: SzProps;
13439
+ last?: SzProps;
13440
+ only?: SzProps;
13441
+ odd?: SzProps;
13442
+ even?: SzProps;
13443
+ firstOfType?: SzProps;
13444
+ lastOfType?: SzProps;
13445
+ onlyOfType?: SzProps;
13446
+ empty?: SzProps;
13447
+ disabled?: SzProps;
13448
+ enabled?: SzProps;
13449
+ checked?: SzProps;
13450
+ indeterminate?: SzProps;
13451
+ default?: SzProps;
13452
+ required?: SzProps;
13453
+ valid?: SzProps;
13454
+ invalid?: SzProps;
13455
+ inRange?: SzProps;
13456
+ outOfRange?: SzProps;
13457
+ placeholderShown?: SzProps;
13458
+ autofill?: SzProps;
13459
+ readOnly?: SzProps;
13460
+ focusWithin?: SzProps;
13461
+ focusVisible?: SzProps;
13462
+ before?: SzProps;
13463
+ after?: SzProps;
13464
+ placeholder?: SzProps;
13465
+ file?: SzProps;
13466
+ marker?: SzProps;
13467
+ selection?: SzProps;
13468
+ firstLine?: SzProps;
13469
+ firstLetter?: SzProps;
13470
+ backdrop?: SzProps;
13471
+ sm?: SzProps;
13472
+ md?: SzProps;
13473
+ lg?: SzProps;
13474
+ xl?: SzProps;
13475
+ '2xl'?: SzProps;
13476
+ '@sm'?: SzProps;
13477
+ '@md'?: SzProps;
13478
+ '@lg'?: SzProps;
13479
+ '@xl'?: SzProps;
13480
+ '@2xl'?: SzProps;
13481
+ dark?: SzProps;
13482
+ light?: SzProps;
13483
+ motionReduce?: SzProps;
13484
+ motionSafe?: SzProps;
13485
+ contrastMore?: SzProps;
13486
+ contrastLess?: SzProps;
13487
+ pointerFine?: SzProps;
13488
+ pointerCoarse?: SzProps;
13489
+ pointerNone?: SzProps;
13490
+ anyPointerFine?: SzProps;
13491
+ anyPointerCoarse?: SzProps;
13492
+ anyPointerNone?: SzProps;
13493
+ userValid?: SzProps;
13494
+ userInvalid?: SzProps;
13495
+ detailsContent?: SzProps;
13496
+ invertedColors?: SzProps;
13497
+ noscript?: SzProps;
13498
+ forcedColors?: SzProps;
13499
+ print?: SzProps;
13500
+ starting?: SzProps;
13501
+ inert?: SzProps;
13502
+ portrait?: SzProps;
13503
+ landscape?: SzProps;
13504
+ rtl?: SzProps;
13505
+ ltr?: SzProps;
13506
+ group?: boolean | string | SzProps;
13507
+ peer?: boolean | string | SzProps;
13508
+ not?: SzProps;
13509
+ has?: Record<string, SzProps>;
13510
+ aria?: Record<string, SzProps>;
13511
+ data?: Record<string, SzProps>;
13512
+ supports?: Record<string, SzProps>;
13513
+ [variant: `@${string}`]: SzProps | boolean | undefined;
13514
+ [variant: `min-[${string}`]: SzProps | undefined;
13515
+ [variant: `max-[${string}`]: SzProps | undefined;
13516
+ [variant: `[${string}`]: SzProps | undefined;
13517
+ [variant: `group-${string}`]: SzProps | undefined;
13518
+ [variant: `peer-${string}`]: SzProps | undefined;
13519
+ [variant: `has-${string}`]: SzProps | undefined;
13520
+ [variant: `aria-${string}`]: SzProps | undefined;
13521
+ [variant: `data-${string}`]: SzProps | undefined;
13522
+ [variant: `not-${string}`]: SzProps | undefined;
13523
+ [variant: `in-${string}`]: SzProps | undefined;
13524
+ [variant: `nth-${string}`]: SzProps | undefined;
13525
+ [variant: `supports-${string}`]: SzProps | undefined;
13532
13526
  }
13533
13527
  /**
13534
13528
  * Base sz props without variant modifiers (to prevent infinite recursion).
@@ -13549,8 +13543,6 @@ type SzPropsBase = LayoutProps & FlexboxGridProps & SpacingProps & SizingProps &
13549
13543
  css?: Properties & {
13550
13544
  [cssVar: `--${string}`]: string | number;
13551
13545
  };
13552
- } & {
13553
- [key: string]: unknown;
13554
13546
  };
13555
13547
  /**
13556
13548
  * Complete sz prop type with all properties and variant modifiers.
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { init, version, transform_sz, encode } from '@csszyx/core';
2
- import { t as transform, C as COLOR_PROPERTIES, P as PROPERTY_MAP, g as getCSSVariableName, a as PropertyCategory, K as KNOWN_VARIANTS, b as getVariantPrefix, c as getPropertyCategory, s as stripInvalidColorStrings } from './shared/compiler.fR1gse9A.mjs';
3
- export { B as BOOLEAN_SHORTHANDS, d as PROPERTY_CATEGORY_MAP, S as SPECIAL_VARIANTS, e as SUGGESTION_MAP, i as isValidSzProp, n as normalizeClassName } from './shared/compiler.fR1gse9A.mjs';
2
+ import { t as transform, C as COLOR_PROPERTIES, P as PROPERTY_MAP, g as getCSSVariableName, a as PropertyCategory, K as KNOWN_VARIANTS, b as getVariantPrefix, c as getPropertyCategory, s as stripInvalidColorStrings } from './shared/compiler.BUCRKtMU.mjs';
3
+ export { B as BOOLEAN_SHORTHANDS, d as PROPERTY_CATEGORY_MAP, R as REMOVED_BOOLEAN_SUGAR, S as SPECIAL_VARIANTS, e as SUGGESTION_MAP, i as isValidSzProp, n as normalizeClassName } from './shared/compiler.BUCRKtMU.mjs';
4
4
  import { parseSync } from 'oxc-parser';
5
5
  import * as t from '@babel/types';
6
6
  import { createHash } from 'node:crypto';
@@ -582,6 +582,11 @@ function transformSourceCode(source, filename, options) {
582
582
  `sz fallback at ${lineCol}: ${reason}.
583
583
  Suggestion: ${suggestion}`
584
584
  );
585
+ if (t.isObjectExpression(expression) && expression.properties.some((prop) => t.isSpreadElement(prop))) {
586
+ diagnostics.push(
587
+ `[csszyx] unresolvable sz spread at ${lineCol}: sz={{ ...x }} cannot be resolved at build time and falls back to runtime; it may render no styles in production. Use array form: sz={[x, { ... }]}.`
588
+ );
589
+ }
585
590
  path.node.name.name = "className";
586
591
  const szCall = t.callExpression(t.identifier("_sz"), [
587
592
  expression
@@ -2658,6 +2663,14 @@ function transformOxc(source, filename, options) {
2658
2663
  if (runtimeFallbackExpr.type !== "ArrayExpression") {
2659
2664
  diagnostics.push(buildRuntimeFallbackDiagnostic(runtimeFallbackExpr, source));
2660
2665
  }
2666
+ if (runtimeFallbackExpr.type === "ObjectExpression" && runtimeFallbackExpr.properties.some(
2667
+ (prop) => prop.type === "SpreadElement"
2668
+ )) {
2669
+ const { line, column } = offsetToLineColumn(source, runtimeFallbackExpr.start);
2670
+ diagnostics.push(
2671
+ `[csszyx] unresolvable sz spread at ${line}:${column + 1}: sz={{ ...x }} cannot be resolved at build time and falls back to runtime; it may render no styles in production. Use array form: sz={[x, { ... }]}.`
2672
+ );
2673
+ }
2661
2674
  collectCandidateClassesFromExpression(
2662
2675
  runtimeFallbackExpr,
2663
2676
  effectiveFilename,