snowscape 0.0.0

A framework for previewing Iced components
Documentation
  • Coverage
  • 0%
    0 out of 1 items documented0 out of 0 items with examples
  • Size
  • Source code size: 3.9 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 14.9 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
  • bradysimon/snowscape
    7 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • bradysimon

Snowscape

This crate will be for previewing components build using Iced. This is a placeholder since the crate depends on some unreleased Iced APIs. This crate will let you create a preview application that displays your components in isolation, similar to Storybook for React or SwiftUI Previews.

If you're familiar with Iced, this is what the usage will look like. Stateless widgets are just functions that return an iced::Element and ignore messages, while stateful widgets have their own state and can respond to messages.

use snowscape::{stateful, stateless};

/// A counter app that has various parts of the counter UI as
/// individual functions that can be previewed in isolation.
pub fn main() -> iced::Result {
    snowscape::run(|app| {
        app.title("My previews")
            .preview(stateless("Label", || label(42)))
            .preview(stateless("Increment", add_button).group("Button"))
            .preview(stateless("Decrement", minus_button).group("Button"))
            .preview(
                stateful("Counter", App::default, App::update, App::view)
                    .description("A counter that increments when the button is pressed")
                    .tags(["counter", "stateful"]),
            )
    })
}

In the meantime, follow along with this crate's development at https://github.com/bradysimon/snowscape