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

+25
View File
@@ -1,3 +1,5 @@
use std::time::Duration;
use gpui::{TestAppContext, hsla};
use super::{ActiveTheme, Mode, Palette, Syntax, Theme};
@@ -19,6 +21,29 @@ fn an_owners_palette_serves_its_mode_alone(cx: &mut TestAppContext) {
assert_eq!(cx.read(|cx| cx.theme().palette()), Palette::light(false));
}
/// A mode set at once wears its palette at once, and a fade under way cannot pull it back.
#[gpui::test]
fn a_mode_set_at_once_skips_the_fade(cx: &mut TestAppContext) {
cx.update(|cx| {
Theme::init(cx);
Theme::update(cx, |theme| theme.reduced_motion = true);
Theme::set_mode(Mode::Dark, cx);
Theme::set_mode_now(Mode::Light, cx);
});
assert_eq!(
cx.read(|cx| cx.theme().colors.clone()),
Palette::light(false)
);
std::thread::sleep(Duration::from_millis(2));
cx.executor().advance_clock(Duration::from_millis(100));
cx.run_until_parked();
assert!(!cx.read(|cx| cx.theme().is_dark()));
assert_eq!(
cx.read(|cx| cx.theme().colors.clone()),
Palette::light(false)
);
}
/// Every color of the palette and of code answers to its field's name, the quiet fills too.
#[test]
fn every_color_answers_to_its_name() {