CSSNumericValue.d.ts 1.4 KB

1234567891011121314151617181920212223242526272829
  1. import { CSSStyleValue, CSSStyleValueType } from './CSSStyleValue';
  2. import { Nested, ParenLess, UnitType } from './types';
  3. export type CSSNumberish = number;
  4. export declare const toCanonicalUnit: (unit: UnitType) => UnitType.kUnknown | UnitType.kNumber | UnitType.kPercentage | UnitType.kPixels | UnitType.kDegrees | UnitType.kSeconds;
  5. /**
  6. * CSSNumericValue is the base class for numeric and length typed CSS Values.
  7. * @see https://drafts.css-houdini.org/css-typed-om/#numeric-objects
  8. * @see https://developer.mozilla.org/en-US/docs/Web/API/CSSNumericValue
  9. * @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_numeric_value.idl
  10. */
  11. /**
  12. * Represents numeric values that can be expressed as a single number plus a
  13. * unit (or a naked number or percentage).
  14. * @see https://drafts.css-houdini.org/css-typed-om/#cssunitvalue
  15. */
  16. export declare class CSSUnitValue extends CSSStyleValue {
  17. unit: UnitType;
  18. value: number;
  19. constructor(value: number, unitOrName?: UnitType | string);
  20. clone(): CSSUnitValue;
  21. equals(other: CSSUnitValue): boolean;
  22. getType(): CSSStyleValueType;
  23. convertTo(target_unit: UnitType): CSSUnitValue;
  24. buildCSSText(n: Nested, p: ParenLess, result: string): string;
  25. }
  26. export declare const Opx: CSSUnitValue;
  27. export declare const Lpx: CSSUnitValue;
  28. export declare const Odeg: CSSUnitValue;
  29. //# sourceMappingURL=CSSNumericValue.d.ts.map