CSSStyleValue.d.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { Nested, ParenLess, UnitCategory, UnitType } from './types';
  2. export declare enum CSSStyleValueType {
  3. kUnknownType = 0,
  4. kUnparsedType = 1,
  5. kKeywordType = 2,
  6. kUnitType = 3,
  7. kSumType = 4,
  8. kProductType = 5,
  9. kNegateType = 6,
  10. kInvertType = 7,
  11. kMinType = 8,
  12. kMaxType = 9,
  13. kClampType = 10,
  14. kTransformType = 11,
  15. kPositionType = 12,
  16. kURLImageType = 13,
  17. kColorType = 14,
  18. kUnsupportedColorType = 15
  19. }
  20. export declare const unitFromName: (name: string) => UnitType;
  21. export declare const unitTypeToUnitCategory: (type: UnitType) => UnitCategory;
  22. export declare const canonicalUnitTypeForCategory: (category: UnitCategory) => UnitType.kUnknown | UnitType.kNumber | UnitType.kPercentage | UnitType.kPixels | UnitType.kDegrees | UnitType.kSeconds;
  23. /**
  24. * @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/css_primitive_value.cc#353
  25. */
  26. export declare const conversionToCanonicalUnitsScaleFactor: (unit_type: UnitType) => number;
  27. export declare const unitTypeToString: (type: UnitType) => "em" | "px" | "deg" | "rad" | "grad" | "ms" | "s" | "rem" | "turn" | "" | "%";
  28. /**
  29. * CSSStyleValue is the base class for all CSS values accessible from Typed OM.
  30. * Values that are not yet supported as specific types are also returned as base CSSStyleValues.
  31. *
  32. * Spec @see https://drafts.css-houdini.org/css-typed-om/#stylevalue-objects
  33. * Docs @see https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleValue
  34. */
  35. export declare abstract class CSSStyleValue {
  36. static isAngle(unit: UnitType): boolean;
  37. static isLength(type: UnitType): boolean;
  38. static isRelativeUnit(type: UnitType): boolean;
  39. static isTime(unit: UnitType): boolean;
  40. protected abstract getType(): CSSStyleValueType;
  41. abstract buildCSSText(n: Nested, p: ParenLess, result: string): string;
  42. abstract clone(): CSSStyleValue;
  43. toString(): string;
  44. isNumericValue(): boolean;
  45. }
  46. //# sourceMappingURL=CSSStyleValue.d.ts.map