Expand description
moss component contract — Source 2 of the federated contract.
Single source of truth for every moss-* class moss currently emits.
Each entry declares: the class name, its kind (container/instance/standalone/chrome),
accepted data-* attributes with value spaces, example HTML, example markdown.
§Adding a new emitter class
- Emit the class from your renderer module (
build/markdown/*,build/components/*). - Add a
ComponentEntrytoCOMPONENTShere. - Run
cargo test --test components_sync_testfrom src-tauri/ — the scanner test will fail if you forget. - Run
cargo run --bin generate-artifacts --features dev-tools -- contract-docsto refreshdocs/reference/contract.md.
§Why a const table, not a derive macro?
Mirrors the BUILTIN_FIELDS precedent in schema_fields.rs. The synchronization
is enforced by a sync test (emitter_classes_match_components_table) that
scans emitter Rust source for class="moss-..." literals. This is a
best-effort scanner (won’t catch classes assembled via format!()), not a
type-checked guarantee like BUILTIN_FIELDS’ compile-time mirror. The
limitation is documented in the spec § Source 2.
Structs§
- Component
Entry - A single component contract entry.
- Data
Attr - A declared
data-*attribute on a component.
Enums§
- Status
- Status of a component entry.
Constants§
- COMPONENTS
- The full contract surface — every
moss-*class moss currently emits. - UNPREFIXED_
LEGACY_ CLASSES - Classes in
COMPONENTSthat deliberately carry nomoss-prefix.
Functions§
- is_
unprefixed_ legacy - Whether
classis exempt from themoss-prefix rule. - retired_
class_ names - Iterator over class names with
Status::Retired. Used by the build pipeline’s theme lint to warn users about pre-v1 vocabulary.