Home Reference Source
import ComputedStyles from 'potassium-es/src/style/ComputedStyles.js'
public class | source

ComputedStyles

ComputedStyles holds the previous and computed declarations for a single Object3D

The computed styles are the combined output of a node's {AssignedStyles}, {LocalStyles}, and inherited computed parental styles.

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public get

changes: Array<property{string}>: *

changes is used by the Stylist to know which styles need to be updated on the Three.Object3D

Method Summary

Public Methods
public

Iterate over the current declarations

public

computeStyles(assignedStyles: AssignedStyles, localStyles: LocalStyles, parentalComputedStyles: ComputedStyles)

Compute the final styles for a node:

  • apply the assigned styles
  • apply local styles that aren't assigned
  • apply inherited styles that aren't assigned or local
public

get(property: *): *

Public Constructors

public constructor() source

Public Members

public get changes: Array<property{string}>: * source

changes is used by the Stylist to know which styles need to be updated on the Three.Object3D

Return:

Array<property{string}>

the declarations that changed since the last update

Public Methods

public * [Symbol.iterator]() source

Iterate over the current declarations

public computeStyles(assignedStyles: AssignedStyles, localStyles: LocalStyles, parentalComputedStyles: ComputedStyles) source

Compute the final styles for a node:

  • apply the assigned styles
  • apply local styles that aren't assigned
  • apply inherited styles that aren't assigned or local

Params:

NameTypeAttributeDescription
assignedStyles AssignedStyles
localStyles LocalStyles
parentalComputedStyles ComputedStyles
  • optional
  • default: null

TODO:

  • calculate relative units like `em`
  • handle the 'inherit' and 'reset' style values
  • handle inherited sub values like `border-top: 10px` inherited on top of `border: 0`
  • handle value methods like `calc()`

public get(property: *): * source

Params:

NameTypeAttributeDescription
property *

Return:

*