# modules/vista/ — Deck horizontal swipe (PageView) **Propósito.** Carousel/PageView estilo Flutter: gesto horizontal con snap a página, distinción horizontal vs vertical, soporte mouse + touch + pointer events. Lógica separada del binding DOM. ## Crates | crate | tipo | rol | | ------------- | ---- | --------------------------------------------------------- | | `vista-core` | lib | `DeckState` agnóstico: pointer_down/move/end → outcomes | | `vista-web` | lib | Binding DOM sobre ``: traduce eventos + aplica CSS | ## Dependencias - `vista-core`: sin deps externas. Pura state machine. - `vista-web` ← `vista-core`, `wasm-bindgen`, `web-sys` (PointerEvent). ## API agnóstica (vista-core) ```rust let mut deck = DeckState::new(); deck.pointer_down(x, y, pointer_id, viewport_width); match deck.pointer_move(x, y) { DragOutcome::StartHorizontal { pointer_id } => capture_pointer(), DragOutcome::DragOffset(px) => apply_translate(px), DragOutcome::CancelVertical => yield_to_scroll(), DragOutcome::Idle => {} } if let Some(r) = deck.pointer_end(offset, width, n_pages) { apply_translate(r.offset_px); if r.changed { notify(r.target_index); } } ``` ## Estado vista-core: 5 tests verdes (drag decision + snap + clamp + goto). vista-web: binding DOM intacto, ahora delega toda la lógica a core. LOC core 177 + web ~355. Reutilizable en backends no-web.