T45 Website: native captures stand in where a browser cannot run, an OG image, no web notes
This commit is contained in:
1 parent
587e08b5cb
commit
327bdf4b7f
68 files changed
+315
-155
No files matched your search
+22
-19
@@ -53,25 +53,28 @@ actions!(gallery, [Quit, About, LightMode, DarkMode, NewWindow]);
|
||||
|
||||
/// The gallery's menu bar, drawn natively and by MenuBar.
|
||||
pub fn app_menus() -> Vec<Menu> {
|
||||
vec![
|
||||
Menu {
|
||||
name: "Ely".into(),
|
||||
items: vec![
|
||||
MenuItem::action("About Ely", About),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Quit Ely", Quit),
|
||||
],
|
||||
disabled: false,
|
||||
},
|
||||
Menu {
|
||||
name: "View".into(),
|
||||
items: vec![
|
||||
MenuItem::action("Light", LightMode),
|
||||
MenuItem::action("Dark", DarkMode),
|
||||
],
|
||||
disabled: false,
|
||||
},
|
||||
]
|
||||
let view = Menu {
|
||||
name: "View".into(),
|
||||
items: vec![
|
||||
MenuItem::action("Light", LightMode),
|
||||
MenuItem::action("Dark", DarkMode),
|
||||
],
|
||||
disabled: false,
|
||||
};
|
||||
// A page opens no second window and cannot quit.
|
||||
if cfg!(target_family = "wasm") {
|
||||
return vec![view];
|
||||
}
|
||||
let ely = Menu {
|
||||
name: "Ely".into(),
|
||||
items: vec![
|
||||
MenuItem::action("About Ely", About),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Quit Ely", Quit),
|
||||
],
|
||||
disabled: false,
|
||||
};
|
||||
vec![ely, view]
|
||||
}
|
||||
|
||||
/// Menu bar and Dock menu, set before the window opens.
|
||||
|
||||
@@ -12,7 +12,7 @@ use gpui::{App, IntoElement, ParentElement, SharedString, Styled, Window, div, p
|
||||
|
||||
use crate::{
|
||||
probe::probe,
|
||||
ui::{NO_FILES, change, keep, section, web_note},
|
||||
ui::{change, keep, section},
|
||||
};
|
||||
|
||||
/// The switchers' demo: the account and workspace in use.
|
||||
@@ -115,7 +115,6 @@ pub fn profile(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
"Someone at a glance, and their profile to edit: Save waits for a change, a name and an email that reads; Discard puts the saved profile back.",
|
||||
cx,
|
||||
)
|
||||
.children(web_note(NO_FILES, cx))
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
|
||||
@@ -15,7 +15,7 @@ use web_time::Instant;
|
||||
|
||||
use crate::{
|
||||
probe::probe,
|
||||
ui::{NO_FILES, keep, noise, section, set, web_note},
|
||||
ui::{keep, noise, section, set},
|
||||
};
|
||||
|
||||
const SYSTEM: &str = "You answer about color in plain words. Cite sources.";
|
||||
@@ -160,7 +160,6 @@ pub fn composer(
|
||||
"Where a message is written: attachments and context above the field, tools below, send at the end; Enter sends and Shift-Enter breaks the line. A slash at the start offers commands, an at sign offers context, and files dropped on it attach.",
|
||||
cx,
|
||||
)
|
||||
.children(web_note(NO_FILES, cx))
|
||||
.child(probe(
|
||||
"chat-composer",
|
||||
div()
|
||||
|
||||
@@ -15,7 +15,7 @@ use gpui::{App, IntoElement, ParentElement, SharedString, Styled, Window, div};
|
||||
|
||||
use crate::{
|
||||
probe::probe,
|
||||
ui::{NO_FILES, keep, picture, row, section, set, specimen, specimens, web_note},
|
||||
ui::{keep, picture, row, section, set, specimen, specimens},
|
||||
};
|
||||
|
||||
const DUNES: &str = asset!("dunes-square.jpg");
|
||||
@@ -119,7 +119,6 @@ pub fn avatars(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
"A picture, or initials on a tone the name keeps, or an icon. Presence sits on the corner. Hover the last one, then press it to choose a picture, or drop one on it.",
|
||||
cx,
|
||||
)
|
||||
.children(web_note(NO_FILES, cx))
|
||||
.child(specimens().children(sizes.map(|(size, name)| {
|
||||
specimen(name, Avatar::new(SharedString::from(format!("avatar-{name}")), "Kofi Mensah").size(size), cx)
|
||||
})))
|
||||
|
||||
@@ -10,7 +10,7 @@ use jiff::Timestamp;
|
||||
|
||||
use crate::{
|
||||
probe::probe,
|
||||
ui::{NO_FILES, change, keep, section, web_note},
|
||||
ui::{change, keep, section},
|
||||
};
|
||||
|
||||
pub fn context_menu(cx: &mut App) -> impl IntoElement + use<> {
|
||||
@@ -84,7 +84,6 @@ pub fn drop_files(window: &mut Window, cx: &mut App) -> impl IntoElement + use<>
|
||||
"Files dropped in, as forms::DropZone takes them; each lands in the list below.",
|
||||
cx,
|
||||
)
|
||||
.children(web_note(NO_FILES, cx))
|
||||
.child(probe(
|
||||
"files-drop",
|
||||
div()
|
||||
|
||||
@@ -5,7 +5,7 @@ use gpui::{App, IntoElement, ParentElement, Styled, Window, div, px};
|
||||
|
||||
use crate::{
|
||||
probe::probe,
|
||||
ui::{NO_FILES, keep, section, set, specimen, specimens, web_note},
|
||||
ui::{keep, section, set, specimen, specimens},
|
||||
};
|
||||
|
||||
fn names(paths: &[PathBuf]) -> String {
|
||||
@@ -44,7 +44,6 @@ pub fn files(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
"Click a field or Browse for the system's dialog, or drop files from Finder. A folder, or two files on a one-file target, turns it red.",
|
||||
cx,
|
||||
)
|
||||
.children(web_note(NO_FILES, cx))
|
||||
.child(
|
||||
specimens()
|
||||
.child(specimen(
|
||||
|
||||
@@ -10,7 +10,7 @@ use gpui::{App, IntoElement, Keystroke, ParentElement, SharedString, Styled, Win
|
||||
use super::text::field;
|
||||
use crate::{
|
||||
probe::probe,
|
||||
ui::{NO_FILES, code, section, web_note},
|
||||
ui::{code, section},
|
||||
};
|
||||
|
||||
pub fn mention(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
@@ -99,7 +99,6 @@ pub fn path(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
"Type a path, or Browse with the system's dialog.",
|
||||
cx,
|
||||
)
|
||||
.children(web_note(NO_FILES, cx))
|
||||
.child(probe(
|
||||
"path",
|
||||
div()
|
||||
|
||||
@@ -9,7 +9,7 @@ use gpui::{App, IntoElement, ParentElement, SharedString, Styled, Window, div, p
|
||||
|
||||
use crate::{
|
||||
probe::probe,
|
||||
ui::{keep, picture, section, set, web_note},
|
||||
ui::{keep, picture, section, set},
|
||||
};
|
||||
|
||||
const ATRIUM: &str = asset!("atrium.jpg");
|
||||
@@ -106,10 +106,6 @@ pub fn upload(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
"A picture to send: drop one or browse for it, then crop it. Replace picks another; Remove empties it.",
|
||||
cx,
|
||||
)
|
||||
.children(web_note(
|
||||
"A browser hands gpui no files: on the web the file dialog fails, drops never arrive, and the picture this starts with, a file on disk, cannot be read.",
|
||||
cx,
|
||||
))
|
||||
.child(probe(
|
||||
"media-upload",
|
||||
div().w(px(420.)).child(
|
||||
|
||||
@@ -9,7 +9,7 @@ use gpui::{App, IntoElement, ParentElement, Styled, Window, div, px};
|
||||
use super::rows::{ran, run};
|
||||
use crate::{
|
||||
probe::probe,
|
||||
ui::{section, specimen, web_note},
|
||||
ui::{section, specimen},
|
||||
};
|
||||
|
||||
pub fn menu_bar(cx: &mut App) -> impl IntoElement + use<> {
|
||||
@@ -26,10 +26,6 @@ pub fn menu_bar(cx: &mut App) -> impl IntoElement + use<> {
|
||||
"The app's own menus, the ones cx.set_menus gave the system, drawn in the window. Picking a row dispatches its action.",
|
||||
cx,
|
||||
)
|
||||
.children(web_note(
|
||||
"A browser page has no menu bar, and gpui on the web keeps no cx.set_menus: this bar draws the gallery's own list of the same menus. About Ely would open a second window and Quit would end the app, neither of which a page can, so both only log.",
|
||||
cx,
|
||||
))
|
||||
.child(specimen(
|
||||
"hover moves between menus while one is open",
|
||||
probe("menubar", MenuBar::new("app-bar", menus)),
|
||||
|
||||
@@ -8,7 +8,7 @@ use gpui::{App, Entity, IntoElement, ParentElement, SharedString, Window};
|
||||
|
||||
use crate::{
|
||||
probe::{Opened, probe},
|
||||
ui::{keep, own_window, row, section, set, specimen},
|
||||
ui::{keep, native_only, row, section, set, specimen},
|
||||
};
|
||||
|
||||
/// Moves `value` to the front of a recent list, keeping `size` entries.
|
||||
@@ -396,9 +396,9 @@ pub fn search_palette(window: &mut Window, cx: &mut App) -> impl IntoElement + u
|
||||
),
|
||||
cx,
|
||||
))
|
||||
.child(specimen(
|
||||
.child(native_only(specimen(
|
||||
"a window above all others",
|
||||
own_window(probe(
|
||||
probe(
|
||||
"launcher",
|
||||
Button::new("launcher-button", "Open the launcher")
|
||||
.variant(ButtonVariant::Ghost)
|
||||
@@ -415,9 +415,9 @@ pub fn search_palette(window: &mut Window, cx: &mut App) -> impl IntoElement + u
|
||||
Err(error) => log::error!("gallery: launcher: {error:#}"),
|
||||
}
|
||||
}),
|
||||
), cx),
|
||||
),
|
||||
cx,
|
||||
)),
|
||||
))),
|
||||
)
|
||||
.children(palette)
|
||||
}
|
||||
@@ -11,7 +11,7 @@ use ely_gpui_component::{
|
||||
use gpui::{AnyElement, App, Entity, IntoElement, ParentElement, Styled, div, px};
|
||||
|
||||
use super::window::{Fields, Prefs, SIZE};
|
||||
use crate::ui::{NO_FILES, change, web_note};
|
||||
use crate::ui::change;
|
||||
|
||||
/// The open section's page.
|
||||
pub(super) fn page(prefs: &Entity<Prefs>, fields: &Fields, section: &str, cx: &App) -> AnyElement {
|
||||
@@ -198,7 +198,6 @@ fn storage(prefs: &Entity<Prefs>, cx: &App) -> AnyElement {
|
||||
}),
|
||||
),
|
||||
)
|
||||
.children(web_note(NO_FILES, cx))
|
||||
.child(
|
||||
SettingsSection::new("Defaults")
|
||||
.description("A larger font size shows here.")
|
||||
|
||||
@@ -7,7 +7,7 @@ use ely_gpui_component::{
|
||||
};
|
||||
use gpui::{App, Div, IntoElement, ParentElement, Styled, Window, div, px};
|
||||
|
||||
use crate::ui::{code, row, section, specimen, specimens, web_note};
|
||||
use crate::ui::{code, row, section, specimen, specimens};
|
||||
|
||||
/// A window drawn inside the page.
|
||||
pub fn window_frame(width: f32, height: f32, cx: &App) -> Div {
|
||||
@@ -116,10 +116,6 @@ pub fn window_controls(cx: &App) -> impl IntoElement + use<> {
|
||||
"Minimize and zoom act on this window. Close here only logs.",
|
||||
cx,
|
||||
))
|
||||
.children(web_note(
|
||||
"A browser owns the page's window: gpui on the web only logs minimize and zoom.",
|
||||
cx,
|
||||
))
|
||||
}
|
||||
|
||||
pub fn drag_area(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
@@ -146,10 +142,6 @@ pub fn drag_area(window: &mut Window, cx: &mut App) -> impl IntoElement + use<>
|
||||
.child("Double-click to zoom this window"),
|
||||
)
|
||||
.child(code("drag_region(id, window, cx)", cx))
|
||||
.children(web_note(
|
||||
"A browser owns the page's window: gpui on the web neither moves nor zooms it.",
|
||||
cx,
|
||||
))
|
||||
}
|
||||
|
||||
pub fn resize_border(cx: &App) -> impl IntoElement + use<> {
|
||||
@@ -162,10 +154,6 @@ pub fn resize_border(cx: &App) -> impl IntoElement + use<> {
|
||||
"Linux draws its own edges. This macOS window keeps the system's, so the border lays out only.",
|
||||
))
|
||||
.child(code("ResizeBorder::new().child(app)", cx))
|
||||
.children(web_note(
|
||||
"A browser sizes the page's canvas itself: gpui on the web resizes no window from its edges.",
|
||||
cx,
|
||||
))
|
||||
}
|
||||
|
||||
pub fn menus(cx: &App) -> impl IntoElement + use<> {
|
||||
@@ -189,8 +177,4 @@ pub fn menus(cx: &App) -> impl IntoElement + use<> {
|
||||
.child(Caption::new(
|
||||
"MenuBar draws the same menus inside the window. It lands with Menus, chapter 8.",
|
||||
))
|
||||
.children(web_note(
|
||||
"A browser page has no menu bar and no Dock: gpui on the web keeps neither cx.set_menus nor cx.set_dock_menu.",
|
||||
cx,
|
||||
))
|
||||
}
|
||||
@@ -11,7 +11,7 @@ use gpui::{App, IntoElement, ParentElement, Styled, Window, div};
|
||||
use super::chrome::window_frame;
|
||||
use crate::{
|
||||
probe::{Opened, probe},
|
||||
ui::{own_window, row, section, specimen},
|
||||
ui::{native_only, row, section, specimen},
|
||||
};
|
||||
|
||||
fn log_action(name: &'static str) -> impl Fn(&mut Window, &mut App) + 'static {
|
||||
@@ -59,18 +59,15 @@ pub fn update_window(cx: &App) -> impl IntoElement + use<> {
|
||||
.child(update_dialog().on_later(log_action("later"))),
|
||||
cx,
|
||||
))
|
||||
.child(own_window(
|
||||
probe(
|
||||
"update-open",
|
||||
Button::new("update-open", "Open update window")
|
||||
.variant(ButtonVariant::Outline)
|
||||
.on_click(|_, _, cx| match update_dialog().open(cx) {
|
||||
Ok(handle) => Opened::insert("update", handle.into(), cx),
|
||||
Err(error) => log::error!("gallery: update window failed: {error:#}"),
|
||||
}),
|
||||
),
|
||||
cx,
|
||||
))
|
||||
.child(native_only(probe(
|
||||
"update-open",
|
||||
Button::new("update-open", "Open update window")
|
||||
.variant(ButtonVariant::Outline)
|
||||
.on_click(|_, _, cx| match update_dialog().open(cx) {
|
||||
Ok(handle) => Opened::insert("update", handle.into(), cx),
|
||||
Err(error) => log::error!("gallery: update window failed: {error:#}"),
|
||||
}),
|
||||
)))
|
||||
}
|
||||
|
||||
const REPORT: &str = "Exception Type: EXC_BAD_ACCESS (SIGSEGV)
|
||||
@@ -104,18 +101,15 @@ pub fn crash_reporter(cx: &App) -> impl IntoElement + use<> {
|
||||
.child(reporter(true)),
|
||||
cx,
|
||||
))
|
||||
.child(own_window(
|
||||
probe(
|
||||
"crash-open",
|
||||
Button::new("crash-open", "Open crash window")
|
||||
.variant(ButtonVariant::Outline)
|
||||
.on_click(move |_, _, cx| match reporter(false).open(cx) {
|
||||
Ok(handle) => Opened::insert("crash", handle.into(), cx),
|
||||
Err(error) => log::error!("gallery: crash window failed: {error:#}"),
|
||||
}),
|
||||
),
|
||||
cx,
|
||||
))
|
||||
.child(native_only(probe(
|
||||
"crash-open",
|
||||
Button::new("crash-open", "Open crash window")
|
||||
.variant(ButtonVariant::Outline)
|
||||
.on_click(move |_, _, cx| match reporter(false).open(cx) {
|
||||
Ok(handle) => Opened::insert("crash", handle.into(), cx),
|
||||
Err(error) => log::error!("gallery: crash window failed: {error:#}"),
|
||||
}),
|
||||
)))
|
||||
}
|
||||
|
||||
pub fn offline(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
|
||||
@@ -7,7 +7,7 @@ use gpui::{App, IntoElement, ParentElement, SharedString, Window};
|
||||
|
||||
use crate::{
|
||||
probe::probe,
|
||||
ui::{blocked, row, section, web_note},
|
||||
ui::{blocked, row, section},
|
||||
};
|
||||
|
||||
const ITEMS: [&str; 3] = ["Open gallery", "Toggle theme", "Quit"];
|
||||
@@ -23,10 +23,6 @@ pub fn tray(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
"An SF Symbol in the menu bar with a menu. macOS only.",
|
||||
cx,
|
||||
)
|
||||
.children(web_note(
|
||||
"A browser page has no menu bar to hold an icon, so showing one fails and logs why.",
|
||||
cx,
|
||||
))
|
||||
.child(
|
||||
row()
|
||||
.child(probe(
|
||||
@@ -117,10 +113,6 @@ pub fn dock(cx: &mut App) -> impl IntoElement + use<> {
|
||||
"A count on the app's Dock icon. macOS only.",
|
||||
cx,
|
||||
)
|
||||
.children(web_note(
|
||||
"A browser page has no Dock icon to badge, so setting one fails and logs why.",
|
||||
cx,
|
||||
))
|
||||
.child(
|
||||
row()
|
||||
.child(probe(
|
||||
|
||||
@@ -15,7 +15,7 @@ use gpui::{
|
||||
use super::chrome::window_frame;
|
||||
use crate::{
|
||||
probe::{Opened, probe},
|
||||
ui::{code, own_window, picture, row, section, specimen},
|
||||
ui::{code, native_only, picture, row, section, specimen},
|
||||
};
|
||||
|
||||
const DUNES: &str = asset!("dunes.jpg");
|
||||
@@ -80,13 +80,14 @@ pub fn splash_screen(cx: &App) -> impl IntoElement + use<> {
|
||||
.child(splash().progress(Some(0.62))),
|
||||
cx,
|
||||
))
|
||||
.child(own_window(
|
||||
trigger("splash-open", "Show splash window", |cx| {
|
||||
.child(native_only(trigger(
|
||||
"splash-open",
|
||||
"Show splash window",
|
||||
|cx| {
|
||||
let result = splash().open(cx);
|
||||
opened("splash", result, cx)
|
||||
}),
|
||||
cx,
|
||||
))
|
||||
},
|
||||
)))
|
||||
}
|
||||
|
||||
pub fn open_about(cx: &mut App) {
|
||||
@@ -108,10 +109,11 @@ pub fn about_dialog(cx: &App) -> impl IntoElement + use<> {
|
||||
.child(about()),
|
||||
cx,
|
||||
))
|
||||
.child(own_window(
|
||||
trigger("about-open", "Open About window", open_about),
|
||||
cx,
|
||||
))
|
||||
.child(native_only(trigger(
|
||||
"about-open",
|
||||
"Open About window",
|
||||
open_about,
|
||||
)))
|
||||
}
|
||||
|
||||
struct Managed {
|
||||
@@ -192,10 +194,11 @@ pub fn window_manager(cx: &mut App) -> impl IntoElement + use<> {
|
||||
"Each new window cascades from the last; the manager knows them by name.",
|
||||
cx,
|
||||
)
|
||||
.child(own_window(
|
||||
trigger("managed-open", "New window", open_managed),
|
||||
cx,
|
||||
))
|
||||
.child(native_only(trigger(
|
||||
"managed-open",
|
||||
"New window",
|
||||
open_managed,
|
||||
)))
|
||||
.child(
|
||||
row().children(open.into_iter().enumerate().map(|(ix, (handle, title))| {
|
||||
Button::new(("managed-focus", ix), title)
|
||||
@@ -335,7 +338,7 @@ pub fn mini_windows(cx: &App) -> impl IntoElement + use<> {
|
||||
"Small windows above the rest. Hover for the bar; expand returns to the app.",
|
||||
cx,
|
||||
)
|
||||
.child(own_window(
|
||||
.child(native_only(
|
||||
row()
|
||||
.child(trigger("mini-open", "Mini player", |cx| {
|
||||
let view = cx.new(|_| Player { playing: true });
|
||||
@@ -359,7 +362,6 @@ pub fn mini_windows(cx: &App) -> impl IntoElement + use<> {
|
||||
);
|
||||
opened("pip", result, cx)
|
||||
})),
|
||||
cx,
|
||||
))
|
||||
.child(code(
|
||||
"AlwaysOnTop is gpui's WindowOptions { kind: WindowKind::PopUp, .. }",
|
||||
|
||||
@@ -37,7 +37,7 @@ const SCRIPT: &[Step] = &[
|
||||
Step::Rest,
|
||||
];
|
||||
|
||||
/// A live shell natively; on the web, why not.
|
||||
/// A live shell natively; on the web, its header alone.
|
||||
fn live(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
let section = section(
|
||||
"Terminal / TerminalTabs / TerminalSplit / TerminalToolbar / ShellSelector / TerminalSearch / TerminalLink",
|
||||
@@ -56,10 +56,7 @@ fn live(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
#[cfg(target_family = "wasm")]
|
||||
{
|
||||
let _ = window;
|
||||
section.child(crate::ui::blocked(
|
||||
"A browser starts no processes and has no pseudo-terminal, so no shell runs here, and alacritty's grid, which draws the build's output, does not build for the web. The page's other stories, command blocks, colored output, logs and processes, draw without one.",
|
||||
cx,
|
||||
))
|
||||
section
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use ely_gpui_component::{
|
||||
};
|
||||
use gpui::{App, IntoElement, ParentElement, SharedString, Styled, Window, div, px};
|
||||
|
||||
use crate::ui::{NO_FILES, change, keep, section, specimen, specimens, web_note};
|
||||
use crate::ui::{change, keep, section, specimen, specimens};
|
||||
|
||||
/// Which code palette the demo last chose.
|
||||
struct Chosen(SharedString);
|
||||
@@ -17,7 +17,6 @@ pub fn importing(window: &mut Window, cx: &mut App) -> impl IntoElement + use<>
|
||||
"A VS Code color theme dropped here reads into Ely's palette, the colors it leaves out kept from Ely's; Apply sets it on the whole gallery. Code palettes choose the colors of code for the mode shown.",
|
||||
cx,
|
||||
)
|
||||
.children(web_note(NO_FILES, cx))
|
||||
.child(
|
||||
specimens()
|
||||
.child(specimen(
|
||||
|
||||
@@ -36,19 +36,15 @@ pub fn platform(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
|
||||
specimens()
|
||||
.child(specimen("Platform", platforms(cx), cx))
|
||||
.child(specimen("IconTheme", icons(window, cx), cx))
|
||||
.child(specimen(
|
||||
.child(native_only(specimen(
|
||||
"Vibrancy",
|
||||
native_only(
|
||||
probe(
|
||||
probe(
|
||||
"frosted-open",
|
||||
Button::new("frosted-open", "Open a frosted window")
|
||||
.on_click(|_, _, cx| frosted(cx)),
|
||||
),
|
||||
"A browser page is a single window, and gpui leaves what lies behind it to the browser, so no frosted window opens and nothing blurs through.",
|
||||
cx,
|
||||
),
|
||||
cx,
|
||||
)),
|
||||
))),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+6
-22
@@ -208,31 +208,15 @@ pub const UNREAD: &str = if cfg!(target_family = "wasm") {
|
||||
"gpui builds an AccessKit tree from elements with an id and a role, and no screen reader here reads it"
|
||||
};
|
||||
|
||||
/// Why a demo takes no files on the web.
|
||||
pub const NO_FILES: &str = "A browser hands gpui no files: on the web the file dialog fails and dropped files never arrive, so nothing is taken here.";
|
||||
|
||||
/// On the web, what a browser cannot do.
|
||||
pub fn web_note(text: &'static str, cx: &App) -> Option<AnyElement> {
|
||||
cfg!(target_family = "wasm").then(|| blocked(text, cx).into_any_element())
|
||||
}
|
||||
|
||||
/// A demo browsers cannot run; there, its note instead.
|
||||
pub fn native_only(element: impl IntoElement, note: &'static str, cx: &App) -> AnyElement {
|
||||
match web_note(note, cx) {
|
||||
Some(note) => note,
|
||||
None => element.into_any_element(),
|
||||
/// A demo browsers cannot run draws natively alone; the site shows its capture.
|
||||
pub fn native_only(element: impl IntoElement) -> AnyElement {
|
||||
if cfg!(target_family = "wasm") {
|
||||
div().into_any_element()
|
||||
} else {
|
||||
element.into_any_element()
|
||||
}
|
||||
}
|
||||
|
||||
/// A button opening its own window, which browsers cannot.
|
||||
pub fn own_window(button: impl IntoElement, cx: &App) -> AnyElement {
|
||||
native_only(
|
||||
button,
|
||||
"A browser page is a single window: gpui opens no second window or popup on the web, so this one cannot open here.",
|
||||
cx,
|
||||
)
|
||||
}
|
||||
|
||||
/// A demo's state, kept across frames under `key`.
|
||||
pub fn keep<T: 'static>(
|
||||
key: &'static str,
|
||||
|
||||
Reference in new issue
Block a user