T44d Web · Gallery builds for wasm32: one story per section by URL, themed by the host

The gallery's entry runs natively or, on wasm32, from a wasm_bindgen start
through gpui_web, single-threaded with WebGL2 fallback. ?page, ?story and
?theme choose what shows; an unknown one fails in the page and the log.
set_theme switches the mode later. Pictures load from ELY_GALLERY_ASSETS.
scripts/stories.py writes examples/gallery/stories.json from the pages.
This commit is contained in:
ZacharyZhang-NY committed 2026-09-29 19:16:41 -04:00
1 parent a03df0987c
commit 48c7b09d8d
83 files changed
+1000 -455

No files matched your search

+4 -6
View File
@@ -1,5 +1,3 @@
use std::path::Path;
use ely_gpui_component::{
buttons::{Button, ButtonVariant},
data_display::{BeforeAfter, Carousel, Gallery, Watermark},
@@ -12,7 +10,7 @@ use gpui::{App, IntoElement, ObjectFit, ParentElement, Styled, Window, div, px};
use crate::{
probe::probe,
ui::{keep, section, set},
ui::{keep, picture, section, set},
};
const PICTURES: [(&str, &str); 6] = [
@@ -35,7 +33,7 @@ pub fn carousel(cx: &mut App) -> impl IntoElement + use<> {
.relative()
.size_full()
.child(
Image::new(("carousel-picture", ix), Path::new(*path))
Image::new(("carousel-picture", ix), picture(*path))
.fit(ObjectFit::Cover)
.size_full(),
)
@@ -74,14 +72,14 @@ pub fn gallery(cx: &mut App) -> impl IntoElement + use<> {
"gallery",
div().w(px(420.)).child(Gallery::new(
"gallery",
PICTURES.map(|(path, caption)| Slide::new(Path::new(path), caption)),
PICTURES.map(|(path, caption)| Slide::new(picture(path), caption)),
)),
)))
}
pub fn before_after(cx: &mut App) -> impl IntoElement + use<> {
let picture = |id: &'static str, path: &'static str| {
Image::new(id, Path::new(path))
Image::new(id, picture(path))
.fit(ObjectFit::Cover)
.size_full()
};
+1 -1
View File
@@ -6,7 +6,7 @@ mod records;
use gpui::{AnyElement, App, IntoElement, ParentElement, Window, div};
use super::Page;
use crate::script::Step;
use crate::step::Step;
pub const PAGE: Page = Page {
number: 12,
+5 -8
View File
@@ -1,4 +1,4 @@
use std::path::{Path, PathBuf};
use std::path::PathBuf;
use ely_gpui_component::{
buttons::{Button, ButtonVariant},
@@ -15,13 +15,10 @@ use gpui::{App, IntoElement, ParentElement, SharedString, Styled, Window, div};
use crate::{
probe::probe,
ui::{keep, row, section, set, specimen, specimens},
ui::{keep, picture, row, section, set, specimen, specimens},
};
const DUNES: &str = concat!(
env!("CARGO_MANIFEST_DIR"),
"/examples/gallery/assets/dunes-square.jpg"
);
const DUNES: &str = asset!("dunes-square.jpg");
pub fn badges(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
let unread = keep("badge-unread", || 3usize, window, cx);
@@ -127,7 +124,7 @@ pub fn avatars(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
})))
.child(
specimens()
.child(specimen("picture", Avatar::new("avatar-photo", "Dunes").image(Path::new(DUNES)).size(AvatarSize::Lg), cx))
.child(specimen("picture", Avatar::new("avatar-photo", "Dunes").image(picture(DUNES)).size(AvatarSize::Lg), cx))
.child(specimen("online", Avatar::new("avatar-online", "Aiko Tanaka").size(AvatarSize::Lg).presence(Presence::Online), cx))
.child(specimen("away", Avatar::new("avatar-away", "Lucía Romero").size(AvatarSize::Lg).presence(Presence::Away), cx))
.child(specimen("busy", Avatar::new("avatar-busy", "Ben Carter").size(AvatarSize::Lg).presence(Presence::Busy), cx))
@@ -182,7 +179,7 @@ pub fn groups(cx: &mut App) -> impl IntoElement + use<> {
.child("Assigned to")
.child(UserChip::new("chip-grace", "Grace Hopper"))
.child("and")
.child(UserChip::new("chip-dunes", "Dune Studio").image(Path::new(DUNES)))
.child(UserChip::new("chip-dunes", "Dune Studio").image(picture(DUNES)))
.child("for review."),
)
}