vendored bevy_egui and removed legacy code :/

Signed-off-by: Sienna Meridian Satterwhite <sienna@r3t.io>
This commit is contained in:
2025-12-14 20:25:55 +00:00
parent b0f62dae38
commit 5493faa1f1
32 changed files with 4844 additions and 865 deletions

View File

@@ -1,41 +1,81 @@
//! Data access layer for iMessage chat.db
//! Marathon - A collaborative real-time editing engine
//!
//! This library provides a read-only interface to query messages from a
//! specific conversation.
//! This library provides the core functionality for building collaborative
//! applications with CRDT-based synchronization, persistence, and networking.
//!
//! # Safety
//! # Features
//!
//! All database connections are opened in read-only mode to prevent any
//! accidental modifications to your iMessage database.
//! - **Networking**: Real-time collaborative editing with gossip-based sync
//! - **Persistence**: SQLite-backed storage with automatic migration
//! - **Debug UI**: Built-in egui integration for development
//! - **Engine**: Event-driven architecture with async task coordination
//!
//! # Example
//!
//! ```no_run
//! use libmarathon::ChatDb;
//! use bevy::prelude::*;
//! use libmarathon::{MarathonPlugin, persistence::PersistenceConfig};
//!
//! let db = ChatDb::open("chat.db")?;
//!
//! // Get all messages from January 2024 to now
//! let messages = db.get_our_messages(None, None)?;
//! println!("Found {} messages", messages.len());
//! # Ok::<(), libmarathon::ChatDbError>(())
//! fn main() {
//! App::new()
//! .add_plugins(MarathonPlugin::new("my_app.db", PersistenceConfig::default()))
//! .run();
//! }
//! ```
mod db;
mod error;
mod models;
pub mod debug_ui;
pub mod engine;
pub mod networking;
pub mod persistence;
pub mod platform;
pub mod sync;
pub use db::ChatDb;
pub use error::{
ChatDbError,
Result,
};
pub use models::{
Chat,
Message,
};
/// Unified Marathon plugin that bundles all core functionality.
///
/// This plugin combines:
/// - Networking for collaborative editing (with CRDT-based synchronization)
/// - Debug UI using egui
/// - Persistence for local storage
///
/// For simple integration, just add this single plugin to your Bevy app.
/// Note: You'll still need to add your app-specific bridge/event handling.
pub struct MarathonPlugin {
/// Path to the persistence database
pub db_path: std::path::PathBuf,
/// Persistence configuration
pub persistence_config: persistence::PersistenceConfig,
}
impl MarathonPlugin {
/// Create a new MarathonPlugin with custom database path and config
pub fn new(db_path: impl Into<std::path::PathBuf>, config: persistence::PersistenceConfig) -> Self {
Self {
db_path: db_path.into(),
persistence_config: config,
}
}
/// Create with default settings (database in current directory)
pub fn with_default_db() -> Self {
Self {
db_path: "marathon.db".into(),
persistence_config: Default::default(),
}
}
}
impl bevy::app::Plugin for MarathonPlugin {
fn build(&self, app: &mut bevy::app::App) {
// Networking for collaboration (uses default config with random node_id)
app.add_plugins(networking::NetworkingPlugin::new(Default::default()));
// Debug UI
app.add_plugins(debug_ui::EguiPlugin::default());
// Persistence
app.add_plugins(persistence::PersistencePlugin::with_config(
self.db_path.clone(),
self.persistence_config.clone(),
));
}
}