pub struct DesignSystem {
pub name: String,
pub created_at: String,
pub version: String,
pub tokens: TokenGroup,
pub palettes: Vec<ColorPalette>,
pub components: Vec<ComponentSpec>,
pub analysis: Option<DesignAnalysis>,
pub decisions: Vec<DesignDecision>,
}Expand description
A complete design system document with tokens, palettes, and components.
Fields§
§name: StringSystem name.
created_at: StringCreation timestamp.
version: StringVersion.
tokens: TokenGroupRoot token group hierarchy.
palettes: Vec<ColorPalette>Color palettes.
components: Vec<ComponentSpec>Component specifications.
analysis: Option<DesignAnalysis>Codebase analysis (if this system was extracted from an existing project).
decisions: Vec<DesignDecision>Design decisions and rationale.
Implementations§
Source§impl DesignSystem
impl DesignSystem
Sourcepub fn total_tokens(&self) -> usize
pub fn total_tokens(&self) -> usize
Total token count across all groups.
Sourcepub fn accessibility_report(&self) -> AccessibilityReport
pub fn accessibility_report(&self) -> AccessibilityReport
Check accessibility of all components.
Sourcepub fn add_palette(&mut self, palette: ColorPalette)
pub fn add_palette(&mut self, palette: ColorPalette)
Add a palette and register its tokens.
Sourcepub fn add_decision(
&mut self,
title: impl Into<String>,
decision: impl Into<String>,
rationale: impl Into<String>,
alternatives: Vec<String>,
)
pub fn add_decision( &mut self, title: impl Into<String>, decision: impl Into<String>, rationale: impl Into<String>, alternatives: Vec<String>, )
Record a design decision.
Sourcepub fn render_markdown(&self) -> String
pub fn render_markdown(&self) -> String
Render as a Markdown document.
Sourcepub fn write_markdown(&self, path: &Path) -> Result<PathBuf>
pub fn write_markdown(&self, path: &Path) -> Result<PathBuf>
Write the design system as Markdown to a file.
Sourcepub fn write_json(&self, path: &Path) -> Result<PathBuf>
pub fn write_json(&self, path: &Path) -> Result<PathBuf>
Write as JSON.
Trait Implementations§
Source§impl Clone for DesignSystem
impl Clone for DesignSystem
Source§fn clone(&self) -> DesignSystem
fn clone(&self) -> DesignSystem
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DesignSystem
impl Debug for DesignSystem
Source§impl<'de> Deserialize<'de> for DesignSystem
impl<'de> Deserialize<'de> for DesignSystem
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for DesignSystem
impl RefUnwindSafe for DesignSystem
impl Send for DesignSystem
impl Sync for DesignSystem
impl Unpin for DesignSystem
impl UnsafeUnpin for DesignSystem
impl UnwindSafe for DesignSystem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more