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 29f1c8f467
commit 09dd3fc2cb
83 files changed
+1000 -455

No files matched your search

+5 -19
View File
@@ -1,5 +1,3 @@
use std::path::Path;
use ely_gpui_component::{
buttons::{Button, ButtonVariant, IconButton},
forms::{Input, TextInput},
@@ -14,24 +12,12 @@ use gpui::{
use crate::{
probe::probe,
ui::{keep, row, section, set, specimen},
ui::{keep, picture, row, section, set, specimen},
};
const PHOTOS: [(&str, &str); 2] = [
(
concat!(
env!("CARGO_MANIFEST_DIR"),
"/examples/gallery/assets/dunes.jpg"
),
"Dunes at first light",
),
(
concat!(
env!("CARGO_MANIFEST_DIR"),
"/examples/gallery/assets/atrium.jpg"
),
"An atrium, noon",
),
(asset!("dunes.jpg"), "Dunes at first light"),
(asset!("atrium.jpg"), "An atrium, noon"),
];
pub fn lightbox(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
@@ -46,7 +32,7 @@ pub fn lightbox(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
.h_32()
.cursor_pointer()
.child(
Image::new(("thumb-image", ix), Path::new(*path))
Image::new(("thumb-image", ix), picture(*path))
.fit(ObjectFit::Cover)
.size_full(),
)
@@ -57,7 +43,7 @@ pub fn lightbox(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
let (step, close) = (shown.clone(), shown.clone());
Lightbox::new(
"lightbox",
PHOTOS.map(|(path, caption)| Slide::new(Path::new(path), caption)),
PHOTOS.map(|(path, caption)| Slide::new(picture(path), caption)),
at,
move |_, cx| set(&close, None, cx),
)
+1 -1
View File
@@ -5,7 +5,7 @@ mod guides;
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: 9,