UNPKG

@salesforce-ux/eslint-plugin-slds

Version:

ESLint plugin provides custom linting rules specifically built for Salesforce Lightning Design System 2 (SLDS 2 beta)

42 lines (41 loc) 1.91 kB
/** * Checks if a value is a CSS global value. * * CSS global values are special keywords that can be used for any CSS property and have a universal meaning: * - initial: Resets the property to its initial value as defined by the CSS specification. * - inherit: Inherits the value from the parent element. * - unset: Acts as inherit if the property is inheritable, otherwise acts as initial. * - revert: Rolls back the property to the value established by the user-agent or user styles. * - revert-layer: Rolls back the property to the value established by the previous cascade layer. * * All CSS properties accept these global values, including but not limited to: * - color * - background * - font-size * - margin * - padding * - border * - display * - position * - z-index * - and many more * * These values are part of the CSS standard and are not considered violations, even if a rule would otherwise flag a value as invalid or non-design-token. They are always allowed for any property. * * @param value The CSS value to check. * @returns True if the value is a CSS global value, false otherwise. * * @see https://developer.mozilla.org/en-US/docs/Web/CSS/initial * @see https://developer.mozilla.org/en-US/docs/Web/CSS/inherit * @see https://developer.mozilla.org/en-US/docs/Web/CSS/unset * @see https://developer.mozilla.org/en-US/docs/Web/CSS/revert * @see https://developer.mozilla.org/en-US/docs/Web/CSS/revert-layer */ export declare function isGlobalValue(value: string): boolean; export declare const ALLOWED_UNITS: string[]; export type ParsedUnitValue = { unit: 'px' | 'rem' | '%' | 'em' | 'ch' | null; number: number; } | null; export declare function parseUnitValue(value: string): ParsedUnitValue; export declare function toAlternateUnitValue(numberVal: number, unitType: 'px' | 'rem' | '%' | 'em' | 'ch' | null): ParsedUnitValue;