Class CSS

A utility class which exposes various numeric factory functions to easily create CSSUnitValues, similar to CSS Typed Om’s CSS namespace.

const size = CSS.px(14);
// Is a shorthand for
const size = new CSSUnitValue(14, 'px');
Hierarchy
  • CSS
Index
Methods
Static

Hz

Static

Q

Static

areCompatible

  • areCompatible(...units: string[]): boolean
  • Returns true if the provided units are compatible (ie cm and mm are compatible, px and Hz are incompatible)

    Parameters
    • Rest ...units: string[]
    Returns boolean
Static

ch

Static

cm

Static

deg

  • Creates a CSSUnitValue with value and deg unit

    Parameters
    • value: number

      The numeric value

    Returns CSSUnitValue
Static

dpcm

  • Creates a CSSUnitValue with value and dpcm unit

    Parameters
    • value: number

      The numeric value

    Returns CSSUnitValue
Static

dpi

  • Creates a CSSUnitValue with value and dpi unit

    Parameters
    • value: number

      The numeric value

    Returns CSSUnitValue
Static

dppx

  • Creates a CSSUnitValue with value and dppx unit

    Parameters
    • value: number

      The numeric value

    Returns CSSUnitValue
Static

em

Static

ex

Static

fr

Static

getCanonicalUnit

Static

getUnitData

  • Gets some basic data about unit such as name, symbol or compatibility set

    Parameters
    • unit: string | CSSUnit

      The name or symbol of the unit

    Returns CSSUnitData
Static

grad

  • Creates a CSSUnitValue with value and grad unit

    Parameters
    • value: number

      The numeric value

    Returns CSSUnitValue
Static

in

Static

kHz

  • Creates a CSSUnitValue with value and kHz unit

    Parameters
    • value: number

      The numeric value

    Returns CSSUnitValue
Static

mm

Static

ms

Static

number

  • Creates a CSSUnitValue with value and number unit

    Parameters
    • value: number

      The numeric value

    Returns CSSUnitValue
Static

pc

Static

percent

  • Creates a CSSUnitValue with value and percent unit

    Parameters
    • value: number

      The numeric value

    Returns CSSUnitValue
Static

pt

Static

px

Static

rad

  • Creates a CSSUnitValue with value and rad unit

    Parameters
    • value: number

      The numeric value

    Returns CSSUnitValue
Static

rem

  • Creates a CSSUnitValue with value and rem unit

    Parameters
    • value: number

      The numeric value

    Returns CSSUnitValue
Static

resolveUnit

  • If unit is a valid css unit name or symbol returns its data, otherwise throws an error

    Parameters
    • unit: string

      The name or symbol of the unit

    Returns CSSUnitData
Static

s

Static

turn

  • Creates a CSSUnitValue with value and turn unit

    Parameters
    • value: number

      The numeric value

    Returns CSSUnitValue
Static

vh

Static

vmax

  • Creates a CSSUnitValue with value and vmax unit

    Parameters
    • value: number

      The numeric value

    Returns CSSUnitValue
Static

vmin

  • Creates a CSSUnitValue with value and vmin unit

    Parameters
    • value: number

      The numeric value

    Returns CSSUnitValue
Static

vw