//! Core runtime primitives for Shelly LiveView.
//!
//! This crate intentionally avoids HTTP concerns. It defines the framework
//! contract: events, server messages, HTML rendering, session lifecycle, and
//! the `LiveView` trait.
//!
//! # Quick Example
//!
//! ```
//! 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))
//!     }
//! }
//!
//! let mut view = Counter::default();
//! let mut ctx = Context::new("root");
//! view.handle_event(Event::new("inc"), &mut ctx).expect("event should succeed");
//! assert_eq!(view.render().as_str(), "<h1>1</h1>");
//! ```

mod component;
mod context;
mod error;
mod event;
mod form;
mod html;
mod invariants;
mod live_view;
mod nested;
mod protocol;
mod pubsub;
mod replay;
mod runtime;
mod session;
mod telemetry;

pub use component::{ComponentId, ComponentRender, LiveComponent};
pub use context::{Context, SessionId};
pub use error::{LiveResult, ShellyError};
pub use event::Event;
pub use form::{dot_path, parse_path_segments, value_as_string, FormData, ValidationErrors};
pub use html::{escape_html, Html, Template, TemplateSnapshot};
pub use invariants::{
    describe_client_message, describe_server_message, is_supported_protocol_version,
    validate_client_message_invariants, validate_server_message_invariants,
    validate_server_message_sequence, ProtocolAuthority, ProtocolDirection, ProtocolDurability,
    ProtocolInstructionClass, ProtocolInstructionDescriptor, ProtocolInvariantViolation,
    ProtocolOrdering, ProtocolRenderEffect, SUPPORTED_PROTOCOL_VERSIONS,
};
pub use live_view::LiveView;
pub use nested::{NestedLiveViewId, NestedLiveViewSnapshot, NestedLiveViewState};
pub use protocol::{
    ChartAnnotation, ChartPoint, ClientMessage, DynamicSlotPatch, GridColumn, GridPinned, GridRow,
    GridRowsWindow, GridSavedView, GridSort, GridSortDirection, GridState, InboxItem,
    JsInteropDispatch, ResumeStatus, ServerMessage, StreamBatchOperation, StreamPosition, Toast,
    ToastLevel, PROTOCOL_VERSION_V1,
};
pub use pubsub::{
    PubSub, PubSubBackend, PubSubCapabilities, PubSubCommand, PubSubDeliveryScope, PubSubMessage,
    PubSubOrdering, PubSubPresenceSnapshot, PubSubReceiveError, PubSubSubscription,
    SessionAffinityRequirement,
};
pub use replay::{
    replay_trace, ReplayReport, ReplayStepResult, ReplayStepStatus, SessionReplayMetadata,
    SessionReplayTrace, SessionReplayTraceStep, SessionTraceRecorder, TimeTravelFrame,
    TimeTravelInspector, TraceRedactionPolicy, TraceRedactionSummary, REPLAY_TRACE_FORMAT_VERSION,
};
pub use runtime::{RuntimeCommand, RuntimeEvent};
pub use session::{LiveSession, INTERNAL_RENDER_FLUSH_EVENT};
pub use telemetry::{
    MemoryTelemetrySink, NoopTelemetrySink, TelemetryEvent, TelemetryEventKind, TelemetrySink,
};
