Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Checkpoint
Nathan Sobocee5ddee53b5
diff --git a/crates/storybook/src/gpui3/app.rs b/crates/storybook/src/gpui3/app.rsindex 9ab1e99a139..8d501341d01 100644--- a/crates/storybook/src/gpui3/app.rs+++ b/crates/storybook/src/gpui3/app.rs@@ -23,15 +23,18 @@ impl AppContext {}}- pub fn open_window<S>(+ pub fn open_window<S: 'static>(&mut self,build_root_view: impl FnOnce(&mut WindowContext) -> View<S>,) -> WindowHandle<S> {- // let window = self.windows.insert_with_key(|id| {+ let id = self.windows.insert(None);- // });+ let mut window = Window::new(id);+ let root_view = build_root_view(&mut WindowContext::mutable(self, &mut window));+ window.root_view.replace(Box::new(root_view));- unimplemented!()+ self.windows.get_mut(id).unwrap().replace(window);+ WindowHandle::new(id)}pub(crate) fn update_window<R>(diff --git a/crates/storybook/src/gpui3/window.rs b/crates/storybook/src/gpui3/window.rsindex 29677df58d6..feabe41aeb5 100644--- a/crates/storybook/src/gpui3/window.rs+++ b/crates/storybook/src/gpui3/window.rs@@ -2,12 +2,15 @@ use super::{px, AppContext, Bounds, Context, EntityId, Handle, Pixels, Style, Tause anyhow::Result;use derive_more::{Deref, DerefMut};use gpui2::Reference;-use std::marker::PhantomData;+use std::{any::Any, marker::PhantomData};++pub struct AnyWindow {}pub struct Window {id: WindowId,rem_size: Pixels,layout_engine: Box<dyn LayoutEngine>,+ pub(crate) root_view: Option<Box<dyn Any>>,}impl Window {@@ -16,6 +19,7 @@ impl Window {id,layout_engine: Box::new(TaffyLayoutEngine::new()),rem_size: px(16.),+ root_view: None,}}}@@ -198,6 +202,15 @@ pub struct WindowHandle<S> {state_type: PhantomData<S>,}+impl<S> WindowHandle<S> {+ pub fn new(id: WindowId) -> Self {+ WindowHandle {+ id,+ state_type: PhantomData,+ }+ }+}+#[derive(Clone)]pub struct Layout {pub order: u32,