diff --git a/Cargo.lock b/Cargo.lock index 9bb7b304..e268be8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -474,7 +474,7 @@ dependencies = [ "bitflags 2.6.0", "cexpr", "clang-sys", - "itertools 0.13.0", + "itertools 0.11.0", "log", "prettyplease", "proc-macro2", @@ -952,7 +952,7 @@ dependencies = [ [[package]] name = "collections" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f" +source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573" dependencies = [ "indexmap 2.7.1", "rustc-hash 2.1.0", @@ -1316,7 +1316,7 @@ dependencies = [ [[package]] name = "derive_refineable" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f" +source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573" dependencies = [ "proc-macro2", "quote", @@ -2275,7 +2275,7 @@ dependencies = [ [[package]] name = "gpui" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f" +source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573" dependencies = [ "anyhow", "as-raw-xcb-connection", @@ -2361,7 +2361,7 @@ dependencies = [ [[package]] name = "gpui_macros" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f" +source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573" dependencies = [ "proc-macro2", "quote", @@ -2551,7 +2551,7 @@ dependencies = [ [[package]] name = "http_client" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f" +source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573" dependencies = [ "anyhow", "bytes", @@ -3129,7 +3129,7 @@ dependencies = [ [[package]] name = "media" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f" +source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573" dependencies = [ "anyhow", "bindgen", @@ -4409,7 +4409,7 @@ dependencies = [ [[package]] name = "refineable" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f" +source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573" dependencies = [ "derive_refineable", ] @@ -4737,7 +4737,7 @@ checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a" [[package]] name = "semantic_version" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f" +source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573" dependencies = [ "anyhow", "serde", @@ -5176,7 +5176,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sum_tree" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f" +source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573" dependencies = [ "arrayvec", "log", @@ -5861,7 +5861,7 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "util" version = "0.1.0" -source = "git+https://github.com/huacnlee/zed.git?branch=webview#47beb1e705567fd74d0035ef6902299c757b7b5f" +source = "git+https://github.com/huacnlee/zed.git?branch=webview#c4fcc5dc17051485232855eefe860cad1946b573" dependencies = [ "anyhow", "async-fs 2.1.2", diff --git a/crates/story/src/modal_story.rs b/crates/story/src/modal_story.rs index a88ebe19..ad885a64 100644 --- a/crates/story/src/modal_story.rs +++ b/crates/story/src/modal_story.rs @@ -242,7 +242,7 @@ impl ModalStory { .map(|s| Arc::new(s.to_string())) .collect(); - let story = cx.model().downgrade(); + let story = cx.entity().downgrade(); let delegate = ListItemDeletegate { story, selected_index: None, @@ -362,7 +362,7 @@ impl ModalStory { let input1 = self.input1.clone(); let date_picker = self.date_picker.clone(); let dropdown = self.dropdown.clone(); - let view = cx.model().clone(); + let view = cx.entity().clone(); let keyboard = self.model_keyboard; window.open_modal(cx, move |modal, _, _| { diff --git a/crates/story/src/scrollable_story.rs b/crates/story/src/scrollable_story.rs index 731b9929..15882bc2 100644 --- a/crates/story/src/scrollable_story.rs +++ b/crates/story/src/scrollable_story.rs @@ -170,7 +170,7 @@ impl Render for ScrollableStory { _: &mut gpui::Window, cx: &mut gpui::Context, ) -> impl gpui::IntoElement { - let view = cx.model().clone(); + let view = cx.entity().clone(); v_flex() .size_full() @@ -185,7 +185,7 @@ impl Render for ScrollableStory { .size_full() .child( v_virtual_list( - cx.model().clone(), + cx.entity().clone(), "items", self.item_sizes.clone(), move |story, visible_range, content_size, _, cx| { @@ -270,7 +270,7 @@ impl Render for ScrollableStory { .p_3() .w(self.test_width) .id("test-1") - .scrollable(cx.model().entity_id(), ScrollbarAxis::Vertical) + .scrollable(cx.entity().entity_id(), ScrollbarAxis::Vertical) .gap_1() .child("Scrollable Example") .children(self.items.iter().take(500).map(|item| { diff --git a/crates/story/src/sidebar_story.rs b/crates/story/src/sidebar_story.rs index b8dd61ff..689d4812 100644 --- a/crates/story/src/sidebar_story.rs +++ b/crates/story/src/sidebar_story.rs @@ -205,7 +205,7 @@ impl Render for SidebarStory { .border_color(cx.theme().border) .h_full() .child( - Sidebar::left(&cx.model()) + Sidebar::left(&cx.entity()) .collapsed(self.is_collapsed) .header( SidebarHeader::new() diff --git a/crates/story/src/text_story.rs b/crates/story/src/text_story.rs index 2551aba9..22e132e4 100644 --- a/crates/story/src/text_story.rs +++ b/crates/story/src/text_story.rs @@ -138,7 +138,7 @@ impl Render for TextStory { Clipboard::new("clipboard1") .content(|_, _| Label::new("Click icon to copy")) .value_fn({ - let view = cx.model().clone(); + let view = cx.entity().clone(); move |_, cx| { SharedString::from(format!( "masked :{}", diff --git a/crates/ui/src/color_picker.rs b/crates/ui/src/color_picker.rs index dd94f10c..671dde2d 100644 --- a/crates/ui/src/color_picker.rs +++ b/crates/ui/src/color_picker.rs @@ -299,7 +299,7 @@ impl Render for ColorPicker { } .into(); - let view = cx.model().clone(); + let view = cx.entity().clone(); div() .id(self.id.clone()) diff --git a/crates/ui/src/dock/dock.rs b/crates/ui/src/dock/dock.rs index 00ca83e0..efd9652f 100644 --- a/crates/ui/src/dock/dock.rs +++ b/crates/ui/src/dock/dock.rs @@ -278,7 +278,7 @@ impl Dock { fn render_resize_handle(&mut self, _: &mut Window, cx: &mut Context) -> impl IntoElement { let axis = self.placement.axis(); let neg_offset = -HANDLE_PADDING; - let view = cx.model().clone(); + let view = cx.entity().clone(); div() .id("resize-handle") @@ -340,7 +340,7 @@ impl Dock { // Get the size of the left dock if it's open and not the current dock if let Some(left_dock) = &dock_area.left_dock { - if left_dock.entity_id() != cx.model().entity_id() { + if left_dock.entity_id() != cx.entity().entity_id() { let left_dock_read = left_dock.read(cx); if left_dock_read.is_open() { left_dock_size = left_dock_read.size; @@ -350,7 +350,7 @@ impl Dock { // Get the size of the right dock if it's open and not the current dock if let Some(right_dock) = &dock_area.right_dock { - if right_dock.entity_id() != cx.model().entity_id() { + if right_dock.entity_id() != cx.entity().entity_id() { let right_dock_read = right_dock.read(cx); if right_dock_read.is_open() { right_dock_size = right_dock_read.size; @@ -415,7 +415,7 @@ impl Render for Dock { }) .child(self.render_resize_handle(window, cx)) .child(DockElement { - view: cx.model().clone(), + view: cx.entity().clone(), }) } } diff --git a/crates/ui/src/dock/mod.rs b/crates/ui/src/dock/mod.rs index af48d5bd..aa2416dc 100644 --- a/crates/ui/src/dock/mod.rs +++ b/crates/ui/src/dock/mod.rs @@ -455,7 +455,7 @@ impl DockArea { cx: &mut Context, ) { self.subscribe_item(&panel, window, cx); - let weak_self = cx.model().downgrade(); + let weak_self = cx.entity().downgrade(); self.left_dock = Some(cx.new(|cx| { let mut dock = Dock::left(weak_self.clone(), window, cx); if let Some(size) = size { @@ -477,7 +477,7 @@ impl DockArea { cx: &mut Context, ) { self.subscribe_item(&panel, window, cx); - let weak_self = cx.model().downgrade(); + let weak_self = cx.entity().downgrade(); self.bottom_dock = Some(cx.new(|cx| { let mut dock = Dock::bottom(weak_self.clone(), window, cx); if let Some(size) = size { @@ -499,7 +499,7 @@ impl DockArea { cx: &mut Context, ) { self.subscribe_item(&panel, window, cx); - let weak_self = cx.model().downgrade(); + let weak_self = cx.entity().downgrade(); self.right_dock = Some(cx.new(|cx| { let mut dock = Dock::right(weak_self.clone(), window, cx); if let Some(size) = size { @@ -634,7 +634,7 @@ impl DockArea { window: &mut Window, cx: &mut Context, ) { - let weak_self = cx.model().downgrade(); + let weak_self = cx.entity().downgrade(); match placement { DockPlacement::Left => { if let Some(dock) = self.left_dock.as_ref() { @@ -677,7 +677,7 @@ impl DockArea { } DockPlacement::Center => { self.items - .add_panel(panel, &cx.model().downgrade(), window, cx); + .add_panel(panel, &cx.entity().downgrade(), window, cx); } } } @@ -692,7 +692,7 @@ impl DockArea { cx: &mut Context, ) -> Result<()> { self.version = state.version; - let weak_self = cx.model().downgrade(); + let weak_self = cx.entity().downgrade(); if let Some(left_dock_state) = state.left_dock { self.left_dock = Some(left_dock_state.to_dock(weak_self.clone(), window, cx)); @@ -875,7 +875,7 @@ impl DockArea { impl EventEmitter for DockArea {} impl Render for DockArea { fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement { - let view = cx.model().clone(); + let view = cx.entity().clone(); div() .id("dock-area") diff --git a/crates/ui/src/dock/stack_panel.rs b/crates/ui/src/dock/stack_panel.rs index 1ea477ff..647e40a5 100644 --- a/crates/ui/src/dock/stack_panel.rs +++ b/crates/ui/src/dock/stack_panel.rs @@ -203,7 +203,7 @@ impl StackPanel { return; } - let view = cx.model().clone(); + let view = cx.entity().clone(); window.defer(cx, { let panel = panel.clone(); @@ -300,7 +300,7 @@ impl StackPanel { return; } - let view = cx.model().clone(); + let view = cx.entity().clone(); if let Some(parent) = self.parent.as_ref() { _ = parent.update(cx, |parent, cx| { parent.remove_panel(Arc::new(view.clone()), window, cx); diff --git a/crates/ui/src/dock/tab_panel.rs b/crates/ui/src/dock/tab_panel.rs index 048ea513..f859f52f 100644 --- a/crates/ui/src/dock/tab_panel.rs +++ b/crates/ui/src/dock/tab_panel.rs @@ -321,7 +321,7 @@ impl TabPanel { return; } - let tab_view = cx.model().clone(); + let tab_view = cx.entity().clone(); if let Some(stack_panel) = self.stack_panel.as_ref() { _ = stack_panel.update(cx, |view, cx| { view.remove_panel(Arc::new(tab_view), window, cx); @@ -400,7 +400,7 @@ impl TabPanel { cx: &mut Context, ) -> impl IntoElement { let is_zoomed = self.is_zoomed; - let view = cx.model().clone(); + let view = cx.entity().clone(); let zoomable_toolbar_visible = state.zoomable.map_or(false, |v| v.toolbar_visible()); // TODO: Do not show MenuButton if there is no menu items @@ -480,7 +480,7 @@ impl TabPanel { return None; } - let view_entity_id = cx.model().entity_id(); + let view_entity_id = cx.entity().entity_id(); let toggle_button_panels = dock_area.toggle_button_panels; // Check if current TabPanel's entity_id matches the one stored in DockArea for this placement @@ -553,7 +553,7 @@ impl TabPanel { window: &mut Window, cx: &mut Context, ) -> impl IntoElement { - let view = cx.model().clone(); + let view = cx.entity().clone(); let Some(dock_area) = self.dock_area.upgrade() else { return div().into_any_element(); @@ -838,7 +838,7 @@ impl TabPanel { cx: &mut Context, ) { let panel = drag.panel.clone(); - let is_same_tab = drag.tab_panel == cx.model(); + let is_same_tab = drag.tab_panel == cx.entity(); // If target is same tab, and it is only one panel, do nothing. if is_same_tab && ix.is_none() { @@ -904,7 +904,7 @@ impl TabPanel { let ix = stack_panel .read(cx) - .index_of_panel(Arc::new(cx.model().clone())) + .index_of_panel(Arc::new(cx.entity().clone())) .unwrap_or_default(); if parent_axis.is_vertical() && placement.is_vertical() { @@ -933,10 +933,10 @@ impl TabPanel { }); } else { // 1. Create new StackPanel with new axis - // 2. Move cx.model() from parent StackPanel to the new StackPanel + // 2. Move cx.entity() from parent StackPanel to the new StackPanel // 3. Add the new TabPanel to the new StackPanel at the correct index // 4. Add new StackPanel to the parent StackPanel at the correct index - let tab_panel = cx.model().clone(); + let tab_panel = cx.entity().clone(); // Try to use the old stack panel, not just create a new one, to avoid too many nested stack panels let new_stack_panel = if stack_panel.read(cx).panels_len() <= 1 { diff --git a/crates/ui/src/dock/tiles.rs b/crates/ui/src/dock/tiles.rs index 1f5a127d..c2057676 100644 --- a/crates/ui/src/dock/tiles.rs +++ b/crates/ui/src/dock/tiles.rs @@ -837,7 +837,7 @@ impl EventEmitter for Tiles {} impl EventEmitter for Tiles {} impl Render for Tiles { fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement { - let view = cx.model().clone(); + let view = cx.entity().clone(); let view_id = view.entity_id(); let panels = self.sorted_panels(); let scroll_bounds = diff --git a/crates/ui/src/dropdown.rs b/crates/ui/src/dropdown.rs index 41ed59b6..e040f7f4 100644 --- a/crates/ui/src/dropdown.rs +++ b/crates/ui/src/dropdown.rs @@ -338,7 +338,7 @@ where let focus_handle = cx.focus_handle(); let delegate = DropdownListDelegate { delegate, - dropdown: cx.model().downgrade(), + dropdown: cx.entity().downgrade(), selected_index, }; @@ -604,7 +604,7 @@ where fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement { let is_focused = self.focus_handle.is_focused(window); let show_clean = self.cleanable && self.selected_index(cx).is_some(); - let view = cx.model().clone(); + let view = cx.entity().clone(); let bounds = self.bounds; let allow_open = !(self.open || self.disabled); let outline_visible = self.open || is_focused && !self.disabled; diff --git a/crates/ui/src/input/input.rs b/crates/ui/src/input/input.rs index 5b489e5b..5a1299c3 100644 --- a/crates/ui/src/input/input.rs +++ b/crates/ui/src/input/input.rs @@ -12,10 +12,10 @@ use unicode_segmentation::*; use gpui::prelude::FluentBuilder as _; use gpui::{ actions, div, point, px, AnyElement, App, AppContext, Bounds, ClickEvent, ClipboardItem, - Context, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement as _, IntoElement, - KeyBinding, KeyDownEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, - ParentElement as _, Pixels, Point, Rems, Render, ScrollHandle, ScrollWheelEvent, SharedString, - Styled as _, UTF16Selection, ViewInputHandler, Window, WrappedLine, + Context, Entity, EntityInputHandler, EventEmitter, FocusHandle, Focusable, + InteractiveElement as _, IntoElement, KeyBinding, KeyDownEvent, MouseButton, MouseDownEvent, + MouseMoveEvent, MouseUpEvent, ParentElement as _, Pixels, Point, Rems, Render, ScrollHandle, + ScrollWheelEvent, SharedString, Styled as _, UTF16Selection, Window, WrappedLine, }; // TODO: @@ -1362,7 +1362,7 @@ impl Sizable for TextInput { } } -impl ViewInputHandler for TextInput { +impl EntityInputHandler for TextInput { fn text_for_range( &mut self, range_utf16: Range, @@ -1593,7 +1593,7 @@ impl Render for TextInput { .id("TextElement") .flex_grow() .overflow_x_hidden() - .child(TextElement::new(cx.model().clone())), + .child(TextElement::new(cx.entity().clone())), ) .when(self.loading, |this| { this.child(Indicator::new().color(cx.theme().muted_foreground)) @@ -1604,7 +1604,7 @@ impl Render for TextInput { ) .children(suffix) .when(self.is_multi_line(), |this| { - let entity_id = cx.model().entity_id(); + let entity_id = cx.entity().entity_id(); if self.last_layout.is_some() { let scroll_size = self.scroll_size; diff --git a/crates/ui/src/list/list.rs b/crates/ui/src/list/list.rs index 4634c4c3..60883384 100644 --- a/crates/ui/src/list/list.rs +++ b/crates/ui/src/list/list.rs @@ -285,7 +285,7 @@ where } Some(Scrollbar::uniform_scroll( - cx.model().entity_id(), + cx.entity().entity_id(), self.scrollbar_state.clone(), self.vertical_scroll_handle.clone(), )) @@ -520,7 +520,7 @@ where D: ListDelegate, { fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement { - let view = cx.model().clone(); + let view = cx.entity().clone(); let vertical_scroll_handle = self.vertical_scroll_handle.clone(); let items_count = self.delegate.items_count(cx); let loading = self.delegate.loading(cx); diff --git a/crates/ui/src/popup_menu.rs b/crates/ui/src/popup_menu.rs index b40d6c77..e672a207 100644 --- a/crates/ui/src/popup_menu.rs +++ b/crates/ui/src/popup_menu.rs @@ -331,7 +331,7 @@ impl PopupMenu { f: impl Fn(PopupMenu, &mut Window, &mut Context) -> PopupMenu + 'static, ) -> Self { let submenu = PopupMenu::build(window, cx, f); - let parent_menu = cx.model().downgrade(); + let parent_menu = cx.entity().downgrade(); submenu.update(cx, |view, _| { view.parent_menu = Some(parent_menu); }); @@ -507,7 +507,7 @@ impl Focusable for PopupMenu { impl Render for PopupMenu { fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement { - let view = cx.model().clone(); + let view = cx.entity().clone(); let has_icon = self.menu_items.iter().any(|item| item.has_icon()); let items_count = self.menu_items.len(); let max_width = self.max_width; diff --git a/crates/ui/src/resizable/panel.rs b/crates/ui/src/resizable/panel.rs index bfeeaea1..714bf396 100644 --- a/crates/ui/src/resizable/panel.rs +++ b/crates/ui/src/resizable/panel.rs @@ -102,7 +102,7 @@ impl ResizablePanelGroup { pub fn add_child(&mut self, panel: ResizablePanel, cx: &mut Context) { let mut panel = panel; panel.axis = self.axis; - panel.group = Some(cx.model().downgrade()); + panel.group = Some(cx.entity().downgrade()); self.sizes.push(panel.initial_size.unwrap_or_default()); self.panels.push(cx.new(|_| panel)); } @@ -116,7 +116,7 @@ impl ResizablePanelGroup { ) { let mut panel = panel; panel.axis = self.axis; - panel.group = Some(cx.model().downgrade()); + panel.group = Some(cx.entity().downgrade()); self.sizes .insert(ix, panel.initial_size.unwrap_or_default()); @@ -141,7 +141,7 @@ impl ResizablePanelGroup { panel.initial_size = old_panel_initial_size; panel.size_ratio = old_panel_size_ratio; panel.axis = self.axis; - panel.group = Some(cx.model().downgrade()); + panel.group = Some(cx.entity().downgrade()); self.sizes[ix] = panel.initial_size.unwrap_or_default(); self.panels[ix] = cx.new(|_| panel); cx.notify() @@ -165,7 +165,7 @@ impl ResizablePanelGroup { _: &mut Window, cx: &mut Context, ) -> impl IntoElement { - let view = cx.model().clone(); + let view = cx.entity().clone(); resize_handle(("resizable-handle", ix), self.axis).on_drag( DragPanel((cx.entity_id(), ix, self.axis)), move |drag_panel, _, _, cx| { @@ -264,7 +264,7 @@ impl ResizablePanelGroup { impl EventEmitter for ResizablePanelGroup {} impl Render for ResizablePanelGroup { fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement { - let view = cx.model().clone(); + let view = cx.entity().clone(); let container = if self.axis.is_horizontal() { h_flex() } else { @@ -292,7 +292,7 @@ impl Render for ResizablePanelGroup { .size_full() }) .child(ResizePanelGroupElement { - view: cx.model().clone(), + view: cx.entity().clone(), axis: self.axis, }) } @@ -365,7 +365,7 @@ impl ResizablePanel { self.size_ratio = None; self.size = Some(new_size); - let entity_id = cx.model().entity_id(); + let entity_id = cx.entity().entity_id(); if let Some(group) = self.group.as_ref() { _ = group.update(cx, |view, _| { if let Some(ix) = view.panels.iter().position(|v| v.entity_id() == entity_id) { @@ -388,7 +388,7 @@ impl Render for ResizablePanel { return div(); } - let view = cx.model().clone(); + let view = cx.entity().clone(); let total_size = self .group .as_ref() diff --git a/crates/ui/src/root.rs b/crates/ui/src/root.rs index 6440267f..691c2855 100644 --- a/crates/ui/src/root.rs +++ b/crates/ui/src/root.rs @@ -262,14 +262,14 @@ impl Root { where F: FnOnce(&mut Self, &mut Window, &mut Context) + 'static, { - if let Some(Some(root)) = window.root_model::() { + if let Some(Some(root)) = window.root::() { root.update(cx, |root, cx| f(root, window, cx)); } } - pub fn read<'a>(window: &'a mut Window, cx: &'a mut App) -> &'a Self { + pub fn read<'a>(window: &'a Window, cx: &'a App) -> &'a Self { &window - .root_model::() + .root::() .expect("The window root view should be of type `ui::Root`.") .unwrap() .read(cx) @@ -286,7 +286,7 @@ impl Root { window: &mut Window, cx: &mut App, ) -> Option { - let root = window.root_model::()??; + let root = window.root::()??; let active_drawer_placement = root.read(cx).active_drawer.clone().map(|d| d.placement); @@ -306,7 +306,7 @@ impl Root { /// Render the Drawer layer. pub fn render_drawer_layer(window: &mut Window, cx: &mut App) -> Option { - let root = window.root_model::()??; + let root = window.root::()??; if let Some(active_drawer) = root.read(cx).active_drawer.clone() { let mut drawer = Drawer::new(window, cx); @@ -333,7 +333,7 @@ impl Root { /// Render the Modal layer. pub fn render_modal_layer(window: &mut Window, cx: &mut App) -> Option { - let root = window.root_model::()??; + let root = window.root::()??; let active_modals = root.read(cx).active_modals.clone(); let mut has_overlay = false; diff --git a/crates/ui/src/slider.rs b/crates/ui/src/slider.rs index d82e1bd9..b5f47764 100644 --- a/crates/ui/src/slider.rs +++ b/crates/ui/src/slider.rs @@ -260,7 +260,7 @@ impl Render for Slider { ) .child(self.render_thumb(thumb_bar_size, window, cx)) .child({ - let view = cx.model().clone(); + let view = cx.entity().clone(); canvas( move |bounds, _, cx| view.update(cx, |r, _| r.bounds = bounds), |_, _, _, _| {}, diff --git a/crates/ui/src/table.rs b/crates/ui/src/table.rs index baf62c97..5e478c59 100644 --- a/crates/ui/src/table.rs +++ b/crates/ui/src/table.rs @@ -867,7 +867,7 @@ where .right_0() .bottom_0() .child(Scrollbar::uniform_scroll( - cx.model().entity_id(), + cx.entity().entity_id(), state, self.vertical_scroll_handle.clone(), )), @@ -889,7 +889,7 @@ where .bottom_0() .size_full() .child(Scrollbar::horizontal( - cx.model().entity_id(), + cx.entity().entity_id(), state, self.horizontal_scroll_handle.clone(), self.head_content_bounds().size, @@ -1101,7 +1101,7 @@ where .child(self.render_resize_handle(col_ix, window, cx)) // to save the bounds of this col. .child({ - let view = cx.model().clone(); + let view = cx.entity().clone(); canvas( move |bounds, _, cx| { view.update(cx, |r, _| r.col_groups[col_ix].bounds = bounds) @@ -1119,7 +1119,7 @@ where window: &mut Window, cx: &mut Context, ) -> impl IntoElement { - let view = cx.model().clone(); + let view = cx.entity().clone(); let horizontal_scroll_handle = self.horizontal_scroll_handle.clone(); h_flex() @@ -1218,7 +1218,7 @@ where let horizontal_scroll_handle = self.horizontal_scroll_handle.clone(); let is_stripe_row = self.stripe && row_ix % 2 != 0; let is_selected = self.selected_row == Some(row_ix); - let view = cx.model().clone(); + let view = cx.entity().clone(); if row_ix < rows_count { self.delegate @@ -1478,7 +1478,7 @@ where fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement { self.measure(window, cx); - let view = cx.model().clone(); + let view = cx.entity().clone(); let vertical_scroll_handle = self.vertical_scroll_handle.clone(); let horizontal_scroll_handle = self.horizontal_scroll_handle.clone(); let cols_count: usize = self.delegate.cols_count(cx); @@ -1590,7 +1590,7 @@ where } }); - let view = cx.model().clone(); + let view = cx.entity().clone(); div() .size_full() .when(self.border, |this| { @@ -1603,7 +1603,7 @@ where .when(!loading, |this| { this.child(inner_table) .child(ScrollableMask::new( - cx.model().entity_id(), + cx.entity().entity_id(), Axis::Horizontal, &horizontal_scroll_handle, )) diff --git a/crates/ui/src/webview.rs b/crates/ui/src/webview.rs index 6f4c263d..564c4df5 100644 --- a/crates/ui/src/webview.rs +++ b/crates/ui/src/webview.rs @@ -85,13 +85,13 @@ impl Render for WebView { window: &mut gpui::Window, cx: &mut gpui::Context, ) -> impl IntoElement { - let view = cx.model().clone(); + let view = cx.entity().clone(); div() .track_focus(&self.focus_handle) .size_full() .child({ - let view = cx.model().clone(); + let view = cx.entity().clone(); canvas( move |bounds, _, cx| view.update(cx, |r, _| r.bounds = bounds), |_, _, _, _| {},