The CSS code generator.

Methods

  • Call this if there is a 1-1 relationship between an input property 'prop' and a generated output CSS variable (varName). There must be no computation involved in order to generate the CSS variable value from the value of the property. Note: this means that the CSS variables are dynamically updated when the 'prop' property is updated.

    Parameters

    • name: string

      The CSS variable name (without the leading --);

    • unit: string

      The unit that is appended to the value of the variable.

    • prop: Property<any>

      The input property from which the CSS variable value is derived

    • Optionalcb: ((propVar: CSSVariableKind) => void)
        • (propVar): void
        • Parameters

          • propVar: CSSVariableKind

          Returns void

    Returns void

  • Call this when there is a more complicated relationship between input properties and output CSS variables.

    Parameters

    • name: string

      A unique name.

    • unit: string
    • props: Property<any>[]

      Any number of properties which are monitored for changes before calling 'cb'.

    • cb: ((propVar: CSSVariableKind) => void)

      The callback called each time all 'props' are initialized and any values change.

        • (propVar): void
        • Parameters

          • propVar: CSSVariableKind

          Returns void

    • Optionalopts: {
          or?: boolean;
      }
      • Optionalor?: boolean

    Returns void