Skip to main content

Module components

Module components 

Source
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

  1. Emit the class from your renderer module (build/markdown/*, build/components/*).
  2. Add a ComponentEntry to COMPONENTS here.
  3. Run cargo test --test components_sync_test from src-tauri/ — the scanner test will fail if you forget.
  4. Run cargo run --bin generate-artifacts --features dev-tools -- contract-docs to refresh docs/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§

ComponentEntry
A single component contract entry.
DataAttr
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 COMPONENTS that deliberately carry no moss- prefix.

Functions§

is_unprefixed_legacy
Whether class is exempt from the moss- 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.