# shelly-liveview

Core runtime primitives for Shelly LiveView.

This crate provides the server-authoritative runtime surface:

- `LiveView` and `LiveSession`
- protocol message types (`ClientMessage`, `ServerMessage`)
- HTML/template primitives (`Html`, `Template`)
- runtime context helpers (`Context`)
- replay, pubsub, and telemetry contracts

It intentionally excludes HTTP/WebSocket transport details.

## Install

```bash
cargo add shelly-liveview
```

## Quick Example

```rust
use shelly::{Context, Event, Html, LiveResult, LiveView};

#[derive(Default)]
struct Counter {
    count: i64,
}

impl LiveView for Counter {
    fn handle_event(&mut self, event: Event, _ctx: &mut Context) -> LiveResult {
        if event.name == "inc" {
            self.count += 1;
        }
        Ok(())
    }

    fn render(&self) -> Html {
        Html::new(format!("<h1>{}</h1>", self.count))
    }
}
```

## Related Crates

- `shelly-axum` transport adapter: <https://docs.rs/shelly-axum>
- `shelly-test` testing helpers: <https://docs.rs/shelly-test>

## API Docs

<https://docs.rs/shelly-liveview>
