topcoat_ui/lib.rs
1#![cfg_attr(docsrs, feature(doc_cfg))]
2//! Premade UI components for Topcoat applications.
3//!
4//! In the spirit of [shadcn/ui](https://ui.shadcn.com), components are not
5//! consumed as an opaque dependency. Instead, `topcoat ui add <name>` copies a
6//! component's source straight into the user's project, where it can be freely
7//! modified.
8//!
9//! This crate models the *registry* that backs that command. A registry is a
10//! cargo crate that carries a `[package.metadata.topcoat-ui]` key pointing at a
11//! directory holding a `registry.toml` manifest alongside the component source
12//! files. A registry is referenced by its crate name and must be a dependency
13//! of the consuming project, so its component source is always present locally
14//! at the matching version. Registries are read at runtime, so the set of
15//! available components can change without rebuilding the CLI.
16//!
17//! Each component is versioned independently by a hash of its source (see
18//! [`content_hash`]). A `registry.toml` records no hashes: it names each
19//! component and its source file, and the hash is computed from the registry's
20//! current source. The hash is recorded in the project's install state when a
21//! component is added, then recomputed from the registry to surface updates.
22//!
23//! A `registry.toml` is written by hand; there is no generator.
24
25pub mod manage;
26mod registry;
27
28pub use registry::*;