linkedin / css-blocks

High performance, maintainable stylesheets.
http://css-blocks.com/
BSD 2-Clause "Simplified" License
6.33k stars 152 forks source link

Runtime refactor #471

Closed chriseppstein closed 3 years ago

chriseppstein commented 3 years ago

This refactors the runtime service for readability and testability.

There's two new classes:

Note that the underlying implementation of the resolver was changed from a set to a graph to properly support style requirements and the ability to safely remove styles that have requirement conditions that aren't met.

In this implementation, because the nodes of the graph in the StyleResolver are just unique numbers, we don't explicitly create "node objects". Instead we infer their existence from the existence of an edge that connects to it. Directed edges are represented by a Map of a "from" node to a Set of "to" nodes.