Initial public release of Warp.

Repo-Sync-Origin: warpdotdev/warp-internal@12af1d983b
This commit is contained in:
David Stern
2026-04-28 08:43:33 -05:00
commit 0dbd3d567a
4982 changed files with 1431549 additions and 0 deletions
@@ -0,0 +1,35 @@
use anyhow::{anyhow, Result};
use std::borrow::Cow;
pub mod root_view;
extern crate warpui;
use rust_embed::RustEmbed;
use warpui::{platform, AssetProvider};
#[derive(Clone, Copy, RustEmbed)]
#[folder = "examples/assets"]
pub struct Assets;
// The static assets we need to load in app.
pub static ASSETS: Assets = Assets;
// Implement the AssetProvider trait here (required by App::new).
impl AssetProvider for Assets {
fn get(&self, path: &str) -> Result<Cow<'_, [u8]>> {
<Assets as RustEmbed>::get(path)
.map(|f| f.data)
.ok_or_else(|| anyhow!("no asset exists at path {}", path))
}
}
fn main() -> Result<()> {
let app_builder =
platform::AppBuilder::new(platform::AppCallbacks::default(), Box::new(ASSETS), None);
let _ = app_builder.run(move |ctx| {
ctx.add_window(warpui::AddWindowOptions::default(), |_| {
root_view::RootView {}
});
});
Ok(())
}
@@ -0,0 +1,25 @@
use pathfinder_color::ColorU;
use warpui::{elements::Rect, AppContext, Element, Entity, TypedActionView, View};
pub struct RootView {}
// Implement the entity trait.
impl Entity for RootView {
type Event = ();
}
// Implement the view trait so RootView could be considered as a view.
impl View for RootView {
fn ui_name() -> &'static str {
"RootView"
}
// Let's render a simple black rect background.
fn render(&self, _: &AppContext) -> Box<dyn Element> {
Rect::new().with_background_color(ColorU::black()).finish()
}
}
impl TypedActionView for RootView {
type Action = ();
}