nexus-stratum-core 0.1.0

Core traits and types for NexusStratum UI component library
Documentation
  • Coverage
  • 51.79%
    188 out of 363 items documented1 out of 99 items with examples
  • Size
  • Source code size: 72.63 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 12.62 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 35s Average build duration of successful builds.
  • all releases: 1m 35s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • AutomataControls

stratum-core

Purpose

Foundation crate providing the core traits, types, and utilities that all other NexusStratum crates depend on.

Position in Pipeline

                        stratum-core
                             |
        +----------+---------+----------+---------+----------+
        |          |         |          |         |          |
   stratum-a11y  theme     css      tailwind   icons    security
        |          |         |          |         |
   primitives  components  css     tailwind    icons
        |          |                    |         |
   components  leptos/dioxus       components  leptos/dioxus

No dependencies on other stratum crates. Used by every other crate in the workspace.

Key Public API

Item Description
Component trait Base trait all components implement
Props trait Trait for component property structs
ComponentEvent Unified event type for component interactions
AriaAttributes Struct for WAI-ARIA attribute management
AriaRole Enum of ARIA roles
FocusManager Utility for managing focus state across components
IdGenerator Deterministic unique ID generation for SSR compatibility
RenderOutput Framework-agnostic render output type

Usage Example

use stratum_core::{Component, Props, AriaRole, IdGenerator};

#[derive(Props)]
struct MyButtonProps {
    label: String,
    disabled: bool,
}

struct MyButton;

impl Component for MyButton {
    type Props = MyButtonProps;

    fn render(props: &Self::Props) -> RenderOutput {
        let id = IdGenerator::next("my-button");
        RenderOutput::new("button")
            .aria_role(AriaRole::Button)
            .attr("id", &id)
            .text(&props.label)
    }
}

How to Run Tests

cargo test -p stratum-core