This commit is contained in:
2026-10-21 19:51:01 +07:00
parent d7160e196e
commit 6117c8184c
149 changed files with 591 additions and 18 deletions
+7 -8
View File
@@ -1,7 +1,8 @@
use anyhow::Context;
use gpui::{AssetSource, Result, SharedString};
use rust_embed::RustEmbed;
/// The Lucide icons the app and the kit components draw, vendored so they ship
/// with the binary and resolve like any other coop asset.
#[derive(RustEmbed)]
#[folder = "../../assets"]
#[include = "fonts/**/*"]
@@ -10,20 +11,20 @@ use rust_embed::RustEmbed;
#[exclude = "*.DS_Store"]
pub struct Assets;
/// Coop's bundled assets, with the GPUI Kit component icon bundle (Lucide) as
/// the fallback so `IconName` SVGs resolve alongside coop's own files.
/// Coop's bundled assets, with the GPUI Kit component icon bundle as the
/// fallback for any icon not vendored here.
pub struct CombinedAssets;
impl AssetSource for CombinedAssets {
fn load(&self, path: &str) -> Result<Option<std::borrow::Cow<'static, [u8]>>> {
if let Some(data) = Assets.load(path)? {
if let Ok(Some(data)) = Assets.load(path) {
return Ok(Some(data));
}
gpui_kit::assets::Assets.load(path)
}
fn list(&self, path: &str) -> Result<Vec<SharedString>> {
let mut paths = Assets.list(path)?;
let mut paths = Assets.list(path).unwrap_or_default();
paths.extend(gpui_kit::assets::Assets.list(path)?);
Ok(paths)
}
@@ -31,9 +32,7 @@ impl AssetSource for CombinedAssets {
impl AssetSource for Assets {
fn load(&self, path: &str) -> Result<Option<std::borrow::Cow<'static, [u8]>>> {
Self::get(path)
.map(|f| Some(f.data))
.with_context(|| format!("loading asset at path {path:?}"))
Ok(Self::get(path).map(|f| f.data))
}
fn list(&self, path: &str) -> Result<Vec<SharedString>> {