@csszyx/compiler 0.9.0 → 0.9.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.cts CHANGED
@@ -308,7 +308,38 @@ interface TransformSourceCodeOptions {
308
308
  * are still safe to transform.
309
309
  */
310
310
  astBudget?: number;
311
+ /**
312
+ * Opt into tiered CSS custom property names for parser paths that support
313
+ * the CSS variable system. Unsupported parser paths must preserve existing
314
+ * `--_sz-*` output until they explicitly port this option.
315
+ *
316
+ * @default false
317
+ */
318
+ mangleVars?: boolean;
319
+ /**
320
+ * Maximum cascade depth for component-tier CSS variable hoisting.
321
+ *
322
+ * Only used when `mangleVars` is enabled. Defaults to 5 to keep the
323
+ * invalidation surface bounded.
324
+ */
325
+ mangleVarHoistMaxDepth?: number;
326
+ /**
327
+ * Explicit app-owned global CSS custom-property aliases. Parser paths that
328
+ * support Phase H rewrite exact static sz string values from original
329
+ * token names to aliases, for example `--brand-primary` -> `---gz`.
330
+ */
331
+ globalVarAliases?: GlobalVarAliasTableInput;
311
332
  }
333
+ /**
334
+ * Accepted input shapes for global CSS custom-property alias tables.
335
+ */
336
+ type GlobalVarAliasTableInput = ReadonlyMap<string, string> | ReadonlyArray<readonly [string, string]> | Readonly<Record<string, string>>;
337
+ /**
338
+ * CSS custom-property mangle metadata. Most originals map to one mangled name,
339
+ * but the same original can legitimately appear in both scoped and hoisted
340
+ * tiers in one build, e.g. `--_sz-p` -> `--sz` and `--cz`.
341
+ */
342
+ type CssVariableMangleValue = string | string[];
312
343
  /**
313
344
  * Source transform result shared by the Babel and oxc parser paths.
314
345
  */
@@ -331,6 +362,8 @@ interface SourceTransformResult {
331
362
  diagnostics: string[];
332
363
  /** Recovery tokens emitted by szRecover attributes. */
333
364
  recoveryTokens: Map<string, TokenData>;
365
+ /** CSS custom property original-to-mangled names emitted by mangleVars. */
366
+ cssVariableMap: Map<string, CssVariableMangleValue>;
334
367
  }
335
368
  /**
336
369
  * Transforms all sz props in a source code string into Tailwind classNames.
@@ -406,6 +439,44 @@ declare class CsszyxCompiler {
406
439
  }): string;
407
440
  }
408
441
 
442
+ /** Kind of out-of-band global custom-property usage. */
443
+ type GlobalVarUsageKind = 'style-set-property' | 'style-get-property' | 'style-remove-property' | 'jsx-style-key' | 'class-string-var-reference';
444
+ /** Source location for one out-of-band usage. */
445
+ interface GlobalVarUsageLocation {
446
+ /** Source file path. */
447
+ filePath: string;
448
+ /** 1-based source line. */
449
+ line: number;
450
+ /** 1-based source column. */
451
+ column: number;
452
+ }
453
+ /** One out-of-band global custom-property usage diagnostic. */
454
+ interface GlobalVarUsageDiagnostic {
455
+ /** Usage kind. */
456
+ kind: GlobalVarUsageKind;
457
+ /** Custom-property name including leading `--`. */
458
+ name: string;
459
+ /** Source location. */
460
+ location: GlobalVarUsageLocation;
461
+ /** Human-readable message. */
462
+ message: string;
463
+ }
464
+ /** Options for JS/JSX global variable usage scanning. */
465
+ interface ScanGlobalVarUsagesOptions {
466
+ /** Candidate tokens to report. Undefined reports every concrete token. */
467
+ tokens?: Iterable<string>;
468
+ }
469
+ /**
470
+ * Scans JS/TS/JSX/TSX source for global custom-property usages csszyx does not
471
+ * currently rewrite.
472
+ *
473
+ * @param source Source text.
474
+ * @param filename Source filename.
475
+ * @param options Scanner options.
476
+ * @returns Out-of-band usage diagnostics.
477
+ */
478
+ declare function scanGlobalVarUsages(source: string, filename?: string, options?: ScanGlobalVarUsagesOptions): GlobalVarUsageDiagnostic[];
479
+
409
480
  /**
410
481
  * CSS Variable Hoisting — deduplicates identical CSS variables across sibling elements.
411
482
  *
@@ -13313,6 +13384,18 @@ interface InteractivityProps {
13313
13384
  select?: 'none' | 'text' | 'all' | 'auto';
13314
13385
  /** @see https://tailwindcss.com/docs/will-change */
13315
13386
  willChange?: 'auto' | 'scroll' | 'contents' | 'transform' | (string & {});
13387
+ /** @see https://tailwindcss.com/docs/scrollbar-width */
13388
+ scrollbar?: 'auto' | 'thin' | 'none';
13389
+ /** @see https://tailwindcss.com/docs/scrollbar-color */
13390
+ scrollbarThumb?: ColorPropValue;
13391
+ /** @see https://tailwindcss.com/docs/scrollbar-color */
13392
+ scrollbarTrack?: ColorPropValue;
13393
+ /** @see https://tailwindcss.com/docs/scrollbar-gutter */
13394
+ scrollbarGutter?: 'auto' | 'stable' | 'both';
13395
+ /** @see https://tailwindcss.com/docs/zoom */
13396
+ zoom?: number | (string & {});
13397
+ /** @see https://tailwindcss.com/docs/tab-size */
13398
+ tabSize?: number | (string & {});
13316
13399
  }
13317
13400
  /**
13318
13401
  *
@@ -13354,6 +13437,12 @@ interface MaskProps {
13354
13437
  maskRepeat?: 'repeat' | 'no-repeat' | 'repeat-x' | 'repeat-y' | 'round' | 'space';
13355
13438
  /** CSS mask-type (shape-rendering) */
13356
13439
  maskShape?: 'alpha' | 'luminance';
13440
+ /** Mask gradient from color stop (v4.1) */
13441
+ maskFrom?: ColorPropValue;
13442
+ /** Mask gradient via color stop (v4.1) */
13443
+ maskVia?: ColorPropValue;
13444
+ /** Mask gradient to color stop (v4.1) */
13445
+ maskTo?: ColorPropValue;
13357
13446
  }
13358
13447
  /**
13359
13448
  * Variant modifiers for pseudo-classes, breakpoints, and states.
@@ -13414,6 +13503,17 @@ interface VariantModifiers {
13414
13503
  motionSafe?: SzPropsBase;
13415
13504
  contrastMore?: SzPropsBase;
13416
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;
13417
13517
  print?: SzPropsBase;
13418
13518
  portrait?: SzPropsBase;
13419
13519
  landscape?: SzPropsBase;
@@ -13526,5 +13626,5 @@ declare const DEFAULT_COMPILER_OPTIONS: Required<CompilerOptions>;
13526
13626
  */
13527
13627
  declare function mergeOptions(options?: Partial<CompilerOptions>): Required<CompilerOptions>;
13528
13628
 
13529
- export { COLOR_PROPERTIES, CsszyxCompiler, DEFAULT_COMPILER_OPTIONS, ManifestBuilder, OxcNotImplementedError, OxcRustNotImplementedError, PROPERTY_CATEGORY_MAP, PropertyCategory, SzObject, VERSION, buildParentMap, createRecoveryToken, ensureRustTransformAvailable, generateRecoveryToken, getCSSVariableName, getPropertyCategory, hoistCSSVariables, injectRecoveryToken, isValidRecoveryMode, mergeOptions, parseManifest, serializeManifest, transformOxc, transformRust, transformRustBatch, transformSourceCode, validateManifest, validateSzRecover };
13530
- export type { BackgroundProps, BorderProps, BorderRadiusValue, CSSVarUsage, ColorName, ColorObjectValue, ColorPropValue, ColorShade, ColorValue, CompilerOptions, ContainerSize, CustomTheme, EffectsProps, FilterProps, FlexboxGridProps, FractionValue, InteractivityProps, LayoutProps, NegativeSpacingValue, RecoveryManifest, RecoveryMode, RecoveryToken, ShadowValue, SizingProps, SourceTransformResult, SpacingProps, SpacingScale, SpacingValue, SvgProps, SzPropValue, SzProps, SzPropsBase, TableProps, TokenData, TokenMetadata, TransformOxcResult, TransformProps, TransformRustFile, TransitionAnimationProps, TypographyProps, VariantModifiers };
13629
+ export { COLOR_PROPERTIES, CsszyxCompiler, DEFAULT_COMPILER_OPTIONS, ManifestBuilder, OxcNotImplementedError, OxcRustNotImplementedError, PROPERTY_CATEGORY_MAP, PropertyCategory, SzObject, VERSION, buildParentMap, createRecoveryToken, ensureRustTransformAvailable, generateRecoveryToken, getCSSVariableName, getPropertyCategory, hoistCSSVariables, injectRecoveryToken, isValidRecoveryMode, mergeOptions, parseManifest, scanGlobalVarUsages, serializeManifest, transformOxc, transformRust, transformRustBatch, transformSourceCode, validateManifest, validateSzRecover };
13630
+ export type { BackgroundProps, BorderProps, BorderRadiusValue, CSSVarUsage, ColorName, ColorObjectValue, ColorPropValue, ColorShade, ColorValue, CompilerOptions, ContainerSize, CssVariableMangleValue, CustomTheme, EffectsProps, FilterProps, FlexboxGridProps, FractionValue, GlobalVarAliasTableInput, GlobalVarUsageDiagnostic, GlobalVarUsageKind, GlobalVarUsageLocation, InteractivityProps, LayoutProps, NegativeSpacingValue, RecoveryManifest, RecoveryMode, RecoveryToken, ScanGlobalVarUsagesOptions, ShadowValue, SizingProps, SourceTransformResult, SpacingProps, SpacingScale, SpacingValue, SvgProps, SzPropValue, SzProps, SzPropsBase, TableProps, TokenData, TokenMetadata, TransformOxcResult, TransformProps, TransformRustFile, TransformSourceCodeOptions, TransitionAnimationProps, TypographyProps, VariantModifiers };
package/dist/index.d.mts CHANGED
@@ -308,7 +308,38 @@ interface TransformSourceCodeOptions {
308
308
  * are still safe to transform.
309
309
  */
310
310
  astBudget?: number;
311
+ /**
312
+ * Opt into tiered CSS custom property names for parser paths that support
313
+ * the CSS variable system. Unsupported parser paths must preserve existing
314
+ * `--_sz-*` output until they explicitly port this option.
315
+ *
316
+ * @default false
317
+ */
318
+ mangleVars?: boolean;
319
+ /**
320
+ * Maximum cascade depth for component-tier CSS variable hoisting.
321
+ *
322
+ * Only used when `mangleVars` is enabled. Defaults to 5 to keep the
323
+ * invalidation surface bounded.
324
+ */
325
+ mangleVarHoistMaxDepth?: number;
326
+ /**
327
+ * Explicit app-owned global CSS custom-property aliases. Parser paths that
328
+ * support Phase H rewrite exact static sz string values from original
329
+ * token names to aliases, for example `--brand-primary` -> `---gz`.
330
+ */
331
+ globalVarAliases?: GlobalVarAliasTableInput;
311
332
  }
333
+ /**
334
+ * Accepted input shapes for global CSS custom-property alias tables.
335
+ */
336
+ type GlobalVarAliasTableInput = ReadonlyMap<string, string> | ReadonlyArray<readonly [string, string]> | Readonly<Record<string, string>>;
337
+ /**
338
+ * CSS custom-property mangle metadata. Most originals map to one mangled name,
339
+ * but the same original can legitimately appear in both scoped and hoisted
340
+ * tiers in one build, e.g. `--_sz-p` -> `--sz` and `--cz`.
341
+ */
342
+ type CssVariableMangleValue = string | string[];
312
343
  /**
313
344
  * Source transform result shared by the Babel and oxc parser paths.
314
345
  */
@@ -331,6 +362,8 @@ interface SourceTransformResult {
331
362
  diagnostics: string[];
332
363
  /** Recovery tokens emitted by szRecover attributes. */
333
364
  recoveryTokens: Map<string, TokenData>;
365
+ /** CSS custom property original-to-mangled names emitted by mangleVars. */
366
+ cssVariableMap: Map<string, CssVariableMangleValue>;
334
367
  }
335
368
  /**
336
369
  * Transforms all sz props in a source code string into Tailwind classNames.
@@ -406,6 +439,44 @@ declare class CsszyxCompiler {
406
439
  }): string;
407
440
  }
408
441
 
442
+ /** Kind of out-of-band global custom-property usage. */
443
+ type GlobalVarUsageKind = 'style-set-property' | 'style-get-property' | 'style-remove-property' | 'jsx-style-key' | 'class-string-var-reference';
444
+ /** Source location for one out-of-band usage. */
445
+ interface GlobalVarUsageLocation {
446
+ /** Source file path. */
447
+ filePath: string;
448
+ /** 1-based source line. */
449
+ line: number;
450
+ /** 1-based source column. */
451
+ column: number;
452
+ }
453
+ /** One out-of-band global custom-property usage diagnostic. */
454
+ interface GlobalVarUsageDiagnostic {
455
+ /** Usage kind. */
456
+ kind: GlobalVarUsageKind;
457
+ /** Custom-property name including leading `--`. */
458
+ name: string;
459
+ /** Source location. */
460
+ location: GlobalVarUsageLocation;
461
+ /** Human-readable message. */
462
+ message: string;
463
+ }
464
+ /** Options for JS/JSX global variable usage scanning. */
465
+ interface ScanGlobalVarUsagesOptions {
466
+ /** Candidate tokens to report. Undefined reports every concrete token. */
467
+ tokens?: Iterable<string>;
468
+ }
469
+ /**
470
+ * Scans JS/TS/JSX/TSX source for global custom-property usages csszyx does not
471
+ * currently rewrite.
472
+ *
473
+ * @param source Source text.
474
+ * @param filename Source filename.
475
+ * @param options Scanner options.
476
+ * @returns Out-of-band usage diagnostics.
477
+ */
478
+ declare function scanGlobalVarUsages(source: string, filename?: string, options?: ScanGlobalVarUsagesOptions): GlobalVarUsageDiagnostic[];
479
+
409
480
  /**
410
481
  * CSS Variable Hoisting — deduplicates identical CSS variables across sibling elements.
411
482
  *
@@ -13313,6 +13384,18 @@ interface InteractivityProps {
13313
13384
  select?: 'none' | 'text' | 'all' | 'auto';
13314
13385
  /** @see https://tailwindcss.com/docs/will-change */
13315
13386
  willChange?: 'auto' | 'scroll' | 'contents' | 'transform' | (string & {});
13387
+ /** @see https://tailwindcss.com/docs/scrollbar-width */
13388
+ scrollbar?: 'auto' | 'thin' | 'none';
13389
+ /** @see https://tailwindcss.com/docs/scrollbar-color */
13390
+ scrollbarThumb?: ColorPropValue;
13391
+ /** @see https://tailwindcss.com/docs/scrollbar-color */
13392
+ scrollbarTrack?: ColorPropValue;
13393
+ /** @see https://tailwindcss.com/docs/scrollbar-gutter */
13394
+ scrollbarGutter?: 'auto' | 'stable' | 'both';
13395
+ /** @see https://tailwindcss.com/docs/zoom */
13396
+ zoom?: number | (string & {});
13397
+ /** @see https://tailwindcss.com/docs/tab-size */
13398
+ tabSize?: number | (string & {});
13316
13399
  }
13317
13400
  /**
13318
13401
  *
@@ -13354,6 +13437,12 @@ interface MaskProps {
13354
13437
  maskRepeat?: 'repeat' | 'no-repeat' | 'repeat-x' | 'repeat-y' | 'round' | 'space';
13355
13438
  /** CSS mask-type (shape-rendering) */
13356
13439
  maskShape?: 'alpha' | 'luminance';
13440
+ /** Mask gradient from color stop (v4.1) */
13441
+ maskFrom?: ColorPropValue;
13442
+ /** Mask gradient via color stop (v4.1) */
13443
+ maskVia?: ColorPropValue;
13444
+ /** Mask gradient to color stop (v4.1) */
13445
+ maskTo?: ColorPropValue;
13357
13446
  }
13358
13447
  /**
13359
13448
  * Variant modifiers for pseudo-classes, breakpoints, and states.
@@ -13414,6 +13503,17 @@ interface VariantModifiers {
13414
13503
  motionSafe?: SzPropsBase;
13415
13504
  contrastMore?: SzPropsBase;
13416
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;
13417
13517
  print?: SzPropsBase;
13418
13518
  portrait?: SzPropsBase;
13419
13519
  landscape?: SzPropsBase;
@@ -13526,5 +13626,5 @@ declare const DEFAULT_COMPILER_OPTIONS: Required<CompilerOptions>;
13526
13626
  */
13527
13627
  declare function mergeOptions(options?: Partial<CompilerOptions>): Required<CompilerOptions>;
13528
13628
 
13529
- export { COLOR_PROPERTIES, CsszyxCompiler, DEFAULT_COMPILER_OPTIONS, ManifestBuilder, OxcNotImplementedError, OxcRustNotImplementedError, PROPERTY_CATEGORY_MAP, PropertyCategory, SzObject, VERSION, buildParentMap, createRecoveryToken, ensureRustTransformAvailable, generateRecoveryToken, getCSSVariableName, getPropertyCategory, hoistCSSVariables, injectRecoveryToken, isValidRecoveryMode, mergeOptions, parseManifest, serializeManifest, transformOxc, transformRust, transformRustBatch, transformSourceCode, validateManifest, validateSzRecover };
13530
- export type { BackgroundProps, BorderProps, BorderRadiusValue, CSSVarUsage, ColorName, ColorObjectValue, ColorPropValue, ColorShade, ColorValue, CompilerOptions, ContainerSize, CustomTheme, EffectsProps, FilterProps, FlexboxGridProps, FractionValue, InteractivityProps, LayoutProps, NegativeSpacingValue, RecoveryManifest, RecoveryMode, RecoveryToken, ShadowValue, SizingProps, SourceTransformResult, SpacingProps, SpacingScale, SpacingValue, SvgProps, SzPropValue, SzProps, SzPropsBase, TableProps, TokenData, TokenMetadata, TransformOxcResult, TransformProps, TransformRustFile, TransitionAnimationProps, TypographyProps, VariantModifiers };
13629
+ export { COLOR_PROPERTIES, CsszyxCompiler, DEFAULT_COMPILER_OPTIONS, ManifestBuilder, OxcNotImplementedError, OxcRustNotImplementedError, PROPERTY_CATEGORY_MAP, PropertyCategory, SzObject, VERSION, buildParentMap, createRecoveryToken, ensureRustTransformAvailable, generateRecoveryToken, getCSSVariableName, getPropertyCategory, hoistCSSVariables, injectRecoveryToken, isValidRecoveryMode, mergeOptions, parseManifest, scanGlobalVarUsages, serializeManifest, transformOxc, transformRust, transformRustBatch, transformSourceCode, validateManifest, validateSzRecover };
13630
+ export type { BackgroundProps, BorderProps, BorderRadiusValue, CSSVarUsage, ColorName, ColorObjectValue, ColorPropValue, ColorShade, ColorValue, CompilerOptions, ContainerSize, CssVariableMangleValue, CustomTheme, EffectsProps, FilterProps, FlexboxGridProps, FractionValue, GlobalVarAliasTableInput, GlobalVarUsageDiagnostic, GlobalVarUsageKind, GlobalVarUsageLocation, InteractivityProps, LayoutProps, NegativeSpacingValue, RecoveryManifest, RecoveryMode, RecoveryToken, ScanGlobalVarUsagesOptions, ShadowValue, SizingProps, SourceTransformResult, SpacingProps, SpacingScale, SpacingValue, SvgProps, SzPropValue, SzProps, SzPropsBase, TableProps, TokenData, TokenMetadata, TransformOxcResult, TransformProps, TransformRustFile, TransformSourceCodeOptions, TransitionAnimationProps, TypographyProps, VariantModifiers };