array of paths that this block depends on and, if changed, would invalidate the compiled css of this block. This is usually only useful in pre-processed blocks.
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.
This Block's self-proclaimed name.
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.
Add an absolute, normalized path as a compilation dependency. This is used to invalidate caches and trigger watchers when those files change.
It is not necessary or helpful to add css-block files.
Return array self and all children.
Pass true to not include inherited objects.
Array of Styles.
Validate that all foreign blocks this block implements are fully...implemented.
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.
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.
Test if the supplied block is the same block object.
The other Block to test against.
True or False if self and other
are equal.
Returns a new array of ancestors in order of inheritance with the first one being the immediate super block.
If this block doesn't inherit, the array is empty.
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
Lookup a sub-block either locally, or on a referenced foreign block.
The Style referenced at the supplied path.
The new child object's Token
identifier.
The new child object created from token
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.
Sets the base Block that this Block inherits from.
Set a child node on this object at key
.
The child node.
Sets name
value of this Block
. Block names may change depending on the
value passed to its block-name
property in :scope
.
Objects that contain Blocks are often passed into assorted libraries' options
hashes. Some libraries like to JSON.stringify()
their options to create
unique identifiers for re-run caching. (ex: Webpack, awesome-typescript-loader)
Blocks contain circular dependencies, so we need to override their toJSON
method so these libraries don't implode.
The name of the block.
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