use-design-token 0.1.0

Framework-neutral design-token primitives for RustUse
Documentation
  • Coverage
  • 18.42%
    7 out of 38 items documented1 out of 24 items with examples
  • Size
  • Source code size: 7.87 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 678.64 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 5s Average build duration of successful builds.
  • all releases: 5s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-ui
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-design-token

Primitive design-token structures for RustUse UI.

Purpose

use-design-token models token names, paths, categories, simple values, references, and token metadata. It does not parse token files or implement a design-token format.

Example

use use_design_token::{DesignToken, TokenCategory, TokenName, TokenPath, TokenValue};

let path = TokenPath::from_segments(["color", "background", "primary"]);
let token = DesignToken::new(
    TokenName::new("primary"),
    TokenCategory::Color,
    TokenValue::text("#3366cc"),
)
.with_path(path);

assert_eq!(token.name().as_str(), "primary");
assert_eq!(token.category().as_str(), "color");
assert_eq!(token.path().map(TokenPath::len), Some(3));

Main types

  • DesignToken
  • TokenName
  • TokenPath
  • TokenCategory
  • TokenValue
  • TokenReference

Facade relationship

The use-ui facade exposes this crate as use_ui::design_token when the design-token or full feature is enabled.