/** * Copyright IBM Corp. 2026 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import type { CarbonToken, ValidationResult } from '../types/index.js'; /** * Check if a value is a SCSS variable (including negative variables) * Examples: $spacing-05, -$spacing-05 */ export declare function isScssVariable(value: string): boolean; /** * Clean SCSS value by removing interpolation and namespaces * Examples: * #{$spacing-04} → $spacing-04 * spacing.$spacing-04 → $spacing-04 * theme.$layer → $layer * -$spacing-05 → -$spacing-05 (preserved) * -#{$spacing-05} → -$spacing-05 */ export declare function cleanScssValue(value: string): string; /** * Resolve SCSS variables in a value using file-level variable declarations * Supports: * - Simple variables: $indicator-width → $spacing-02 * - Variables in calc(): calc(-1 * $indicator-width) → calc(-1 * $spacing-02) * - Multiple variables: $a $b → $spacing-05 $spacing-03 * - Negative variables: -$indicator-width → -$spacing-02 * * @param value The value to resolve * @param fileVariables Map of variable names to their resolved values * @returns The value with variables resolved */ export declare function resolveFileVariables(value: string, fileVariables: Map): string; /** * Check if a declaration is a SCSS variable declaration * @param prop The property name (e.g., "$indicator-width") * @returns True if this is a variable declaration */ export declare function isVariableDeclaration(prop: string): boolean; /** * Check if a value is a CSS custom property */ export declare function isCssCustomProperty(value: string): boolean; /** * Check if a value is a Carbon CSS custom property */ export declare function isCarbonCustomProperty(value: string, carbonPrefix?: string): boolean; /** * Extract variable name from CSS custom property * Handles fallback values: var(--name, fallback) → --name */ export declare function extractCssVarName(value: string): string | null; /** * Check if value matches any of the accepted patterns */ export declare function matchesAcceptedValue(value: string, acceptedValues: string[]): boolean; /** * Check if a property should be validated */ export declare function shouldValidateProperty(prop: string, includeProps: string[]): boolean; /** * Validate a value against Carbon tokens */ export declare function validateValue(value: string, tokens: CarbonToken[], options?: { acceptUndefinedVariables?: boolean; acceptCarbonCustomProp?: boolean; acceptValues?: string[]; carbonPrefix?: string; validateVariables?: string[]; validateGradients?: 'recommended' | 'strict'; }): ValidationResult; /** * Parse a CSS value into individual values */ export declare function parseValue(value: string): string[]; /** * Check if a value contains a calc() function */ export declare function isCalcExpression(value: string): boolean; /** * Extract the contents of a calc() expression */ export declare function extractCalcContents(value: string): string | null; /** * Validate calc() expression according to V4 rules * Supports: * 1. Proportional math: calc(100vw - #{$spacing-01}) * 2. Token negation: calc(-1 * #{$spacing-01}) or calc(#{$spacing-01} / -1) */ export declare function validateCalcExpression(value: string, tokens: CarbonToken[]): ValidationResult; /** * Check if value is a transform function (translate, translateX, translateY, translate3d) */ export declare function isTransformFunction(value: string): boolean; /** * Check if a transform function should be validated for spacing * Only translate functions use spacing values */ export declare function isSpacingTransformFunction(value: string): boolean; /** * Check if value is a gradient function */ export declare function isGradientFunction(value: string): boolean; /** * Extract function name and parameters from a function call * Returns null if not a valid function */ export declare function extractFunctionParams(value: string): { name: string; params: string[]; } | null; /** * Check if a parameter is a gradient direction or angle * Examples: 'to right', '90deg', 'to bottom right', 'at center', 'closest-side' */ export declare function isDirectionOrAngle(param: string): boolean; /** * Parse a gradient color stop to extract the color value * Examples: * '$blue-90 0%' -> { color: '$blue-90', positions: ['0%'] } * 'rgba(255, 255, 255, 0.5)' -> { color: 'rgba(255, 255, 255, 0.5)', positions: [] } * 'red 10% 20%' -> { color: 'red', positions: ['10%', '20%'] } */ export declare function parseGradientColorStop(param: string): { color: string; positions: string[]; }; /** * Check if an rgba/rgb function uses white or black * Accepts both old and new syntax: * - rgba(255, 255, 255, 0.5) or rgba(white, 0.5) * - rgb(255 255 255 / 50%) or rgb(0 0 0 / 50%) */ export declare function isWhiteOrBlackRgba(value: string): boolean; /** * Validate gradient function color stops based on validation mode * @param value - The gradient function value * @param tokens - Available Carbon tokens * @param options - Validation options including validateGradients mode */ export declare function validateGradientFunction(value: string, tokens: CarbonToken[], options?: { acceptUndefinedVariables?: boolean; acceptCarbonCustomProp?: boolean; acceptValues?: string[]; carbonPrefix?: string; validateGradients?: 'recommended' | 'strict'; }): ValidationResult; /** * Check if a value is valid for spacing (layout) properties * Valid values: * - Carbon tokens (SCSS variables or CSS custom properties) * - Relative units: %, vw, vh, svw, lvw, dvw, svh, lvh, dvh, vi, vb, vmin, vmax * - calc() expressions * - 0 (unitless zero) */ export declare function isValidSpacingValue(value: string, tokens: CarbonToken[]): boolean; /** * Validate transform function according to V4 rules * Supports: * - translate(x, y) - validates both parameters * - translateX(x) - validates single parameter * - translateY(y) - validates single parameter * - translate3d(x, y, z) - validates only first 2 parameters (z-axis not validated) */ export declare function validateTransformFunction(value: string, tokens: CarbonToken[]): ValidationResult; /** * Check if value is an rgba() function */ export declare function isRgbaFunction(value: string): boolean; /** * Validate rgba() function according to V4 rules * Only validates the first parameter (color) - must be a Carbon theme token * Alpha and other parameters are not validated */ export declare function validateRgbaFunction(value: string, tokens: CarbonToken[]): ValidationResult; /** * Check if value is a Carbon type function (type-scale, font-family, font-weight) * These are SCSS functions that return Carbon typography values */ export declare function isCarbonTypeFunction(value: string): boolean; /** * Validate Carbon type function * These functions are accepted as-is without parameter validation * Parameter correctness is validated by Sass at compile time */ export declare function validateCarbonTypeFunction(value: string): ValidationResult; /** * Check if value is a Carbon motion function * motion(easing_type, motion_style) returns a cubic-bezier() easing curve */ export declare function isCarbonMotionFunction(value: string): boolean; /** * Validate Carbon motion function parameters * Signature: motion(easing_type, motion_style) or motion(easing_type) * - easing_type: 'standard' | 'entrance' | 'exit' * - motion_style: 'productive' | 'expressive' (optional) * SCSS processes motion(standard) as a string, so shorthand is permitted */ export declare function validateCarbonMotionFunction(value: string): ValidationResult; //# sourceMappingURL=validators.d.ts.map