Retrieve the Attribute that this AttrValue belongs to.
The parent Attribute, or null.
Get the style that this style inherits from, if any.
This walks down the declared styles of the parent's inheritance chain, and attempts to find a matching directly declared style on each.
The result is cached because it never changes and is decidable as soon as the style is instantiated.
The block
property is an alias for root
. This isn't the dryest place to put
this line, but every extension re-declared this interface itself and I wanted it
in one place.
The base node in this tree.
Retrieve the BlockClass that this AttrValue belongs to.
The parent BlockClass, or null.
If this is the presence state.
The parent node in this tree.
The root node in this tree.
The token object used to create this node.
The unique name of this node.
The string value this AttrValue represents.
Return array self and all children.
Array of Styles.
Debug utility to help log Styles
Options for rendering cssClass.
A debug string.
Export as original AttrValue name.
Optional scope to resolve this name relative to. If true
, return the Block name instead of :scope
. If a Block object, return with the local name instead of :scope
.
String representing original AttrValue path.
Returns an array of all children nodes in the order they were added for Self.
The children array.
Returns a hash of all children nodes at the keys they are stored.. TODO: Cache this maybe? Convert entire model to only use hash?...
The children hash.
Returns a map of all children nodes at the keys they are stored..
The children map.
Returns all the classes needed to represent this block object including inherited classes.
this object's css class and all inherited classes.
Ensure a child node exists on this object at key
. If it does not, create it.
If key
is not provided, use the child name as the key.
string The key at which this child object should be (optional)
The child node.
Retrieve a child node from this object at key
.
The child node.
Every Block tree maintains its own local cache of parsed selectors. From any sub-inheritable, or from the root inheritable itself, given a PostCSS Rule, ensure it is present in the root Block's parsed rule selectors cache, and return the ParsedSelector array.
PostCSS Rule
ParsedSelector array
Returns the styles that are implied by this style. TODO: Placeholder for when we implement class composition. (https://github.com/linkedin/css-blocks/issues/72)
The Style objects, or undefined if no styles are implied.
Resolves the child with the given name from this node's inheritance chain. Returns null if the child is not found.
The child node, or null
Returns an array of all children nodes in the order they were added for self and all inherited children.
The children array.
Returns a map of all children nodes at the keys they are stored..
The children map.
Returns a map of all children nodes at the keys they are stored..
The children map.
Compute all block objects that are implied by this block object through inheritance. Does not include this object or the styles it implies through other relationships to this object.
The values are returned in inheritance order, with the first value returned (if any) having no base, and the the last value returned (if any) being the base of this object.
If nothing is inherited, this returns an empty array.
The array of nodes this node inherits from.
Return all Block Objects that are implied by this object. This takes inheritance, attr/class correlations, and any other declared links between styles into account.
This block object is included in the returned result so the resolved value's size is always 1 or greater.
Set a child node on this object at key
.
The child node.
The tokenToUid
method would ideally be a static method, but
Typescript doesn't expose class generics to static methods, so it
needs to be a protected method.
In order to map children to generic Tokens
, we need a way to map
any given Token
shape to a UID. By default, we stringify the token
passed to us. If more complex behavior is required, this method can
be overridden.
A unique string that represents this token.
Generated using TypeDoc
AttrValue represents the value of an Attribute in a particular Block. An Attribute can have many AttrValue children that are considered to be mutually exclusive. Attributes can be designated as "global";