Resources
Examples
Runnable and copyable Travels examples for core history, frameworks, persistence, and editing applications.
The repository contains small examples that exercise the public API without hiding the integration boundary behind a demo framework. Use them alongside the focused guides in this documentation.
Core examples
| Example | What it demonstrates |
|---|---|
| Basic usage | Create a timeline, update state, navigate, and subscribe. |
| Manual archive | Group pending updates into application-defined undo steps. |
| Persistence | Serialize, deserialize, and restore a versioned timeline. |
| Local-first persistence | A durable editing flow built around stored snapshots. |
| Persistence adapters | Storage-oriented adapter patterns and recovery. |
Framework integrations
| Example | Framework or pattern |
|---|---|
| React integration | useSyncExternalStore, revisions, state, and controls. |
| Vue integration | Vue state binding and undo/redo. |
| Zustand integration | Immutable timeline synchronization with a store. |
| MobX integration | Reference-stable mutable history. |
| Pinia integration | A setup store with mutable Travels state. |
Editing applications
- Form builder: manual history boundaries around structured form edits.
- Canvas editor: grouped visual operations and metadata-driven history.
- Vite application: a runnable browser consumer of the package.
You can also try the Travels Counter Demo on CodeSandbox.
Run repository checks
From the repository root:
corepack enable
pnpm install
pnpm run test:examples
pnpm run test:types
pnpm run testThe examples are included in the TypeScript example checks. When adapting one, keep the core invariants: one authoritative update path, synchronous timeline callbacks, read-only shared views, and semantic validation for unverified persisted history.