1#![cfg_attr(target_family = "wasm", no_main)]
2//! Renders a div with deep children hierarchy. This example is useful to exemplify that Zed can
3//! handle deep hierarchies (even though it cannot just yet!).
4use std::sync::LazyLock;
5
6use gpui::{App, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px, size};
7use gpui_platform::application;
…lines 8–26 unchanged (19 lines)
27 depth -= 1;
28 }
29 innermost_node
30 }
31}
32
33fn run_example() {
34 application().run(|cx: &mut App| {
35 let bounds = Bounds::centered(None, size(px(300.0), px(300.0)), cx);
36 cx.open_window(
37 WindowOptions {
38 window_bounds: Some(WindowBounds::Windowed(bounds)),
39 ..Default::default()
40 },
41 |_, cx| cx.new(|_| Tree {}),
42 )
43 .unwrap();
44 });
45}
46
47#[cfg(not(target_family = "wasm"))]
48fn main() {
49 run_example();
50}
51
52#[cfg(target_family = "wasm")]
53#[wasm_bindgen::prelude::wasm_bindgen(start)]
54pub fn start() {
55 gpui_platform::web_init();
56 run_example();
57}
58