Skip to main content

Module vocabulary

Module vocabulary 

Source
Expand description

Every class this crate is responsible for, as a set rather than one name at a time.

The naming functions (crate::class, crate::option_class, crate::list::part_class, crate::list::cell_part_class) answer “what is this one thing called”. That is half the agreement, and 0.27.0 shipped it. The other half is the set: a checker cannot ask “is this app rule re-specifying something makeover already defines” without the list, and this crate is the only place that knows it, because this crate writes the sheet.

§Two sets, because there are two questions

vocabulary is the classes the generated stylesheet writes a rule for. That is the set a drift check wants: an app rule for one of these is a restatement of a rule the app already gets, and unlayered app CSS beats @layer makeover, so the restatement silently wins.

names is every class this crate can put in markup, which is the first set plus the ones it deliberately leaves unruled. row-actions, cell-actions, cell-tokens and cell-link have no rule on purpose: only .cell-value takes a colour, because a token carries its own tone and an action is a control rather than text. A class that sets no properties is a class that means “I thought about this”, and this crate does not emit those. So a screen renderer legitimately emits names that vocabulary does not contain, and a test asking “is every class this renderer emits one makeover knows about” has to read names or it fails on four correct ones.

§Why the first set is scraped and not listed

A hand-maintained copy of the sheet’s contents is the defect being fixed, one level up: it can disagree with the sheet, and the day it does, the checker reads the list and the browser reads the sheet. So vocabulary parses the CSS this crate generates. There is no second source to drift from, and a class added to an emitter enters the vocabulary in the same commit that adds it.

Functions§

classes_in_css
declarations_by_class
The class names a stylesheet’s selectors match.
names
Every class this crate can put in markup or in a rule.
vocabulary
Every class name the generated stylesheet defines a rule for, prefixed the way opts prefixes them.