diff --git a/crates/gpui/examples/animation.rs b/crates/gpui/examples/animation.rs index 80e4a4456a602a35c3a1b111bffdb884d418e895..c6f810ce17f458f9932d62816f9c024583446191 100644 --- a/crates/gpui/examples/animation.rs +++ b/crates/gpui/examples/animation.rs @@ -1,6 +1,11 @@ use std::time::Duration; -use gpui::*; +use anyhow::Result; +use gpui::{ + black, bounce, div, ease_in_out, percentage, prelude::*, px, rgb, size, svg, Animation, + AnimationExt as _, App, AppContext, AssetSource, Bounds, SharedString, Transformation, + ViewContext, WindowBounds, WindowOptions, +}; struct Assets {} @@ -37,7 +42,7 @@ impl Render for AnimationExample { div() .flex() .bg(rgb(0x2e7d32)) - .size(Length::Definite(Pixels(300.0).into())) + .size(px(300.0)) .justify_center() .items_center() .shadow_lg() diff --git a/crates/gpui/examples/hello_world.rs b/crates/gpui/examples/hello_world.rs index 57312c06bb8cebedbc777328a74d6c75ad6e8615..9045c7be04853fa4752c39bd90abea8703266b43 100644 --- a/crates/gpui/examples/hello_world.rs +++ b/crates/gpui/examples/hello_world.rs @@ -1,4 +1,7 @@ -use gpui::*; +use gpui::{ + div, prelude::*, px, rgb, size, App, AppContext, Bounds, SharedString, ViewContext, + WindowBounds, WindowOptions, +}; struct HelloWorld { text: SharedString, @@ -11,7 +14,7 @@ impl Render for HelloWorld { .flex_col() .gap_3() .bg(rgb(0x505050)) - .size(Length::Definite(Pixels(500.0).into())) + .size(px(500.0)) .justify_center() .items_center() .shadow_lg() diff --git a/crates/gpui/examples/image/image.rs b/crates/gpui/examples/image/image.rs index 19a4e9313f6e4f9aacce6adfce1b5a03bc8df5cb..4aeea3affca9e3590a2a4971c5ec99da52223a1f 100644 --- a/crates/gpui/examples/image/image.rs +++ b/crates/gpui/examples/image/image.rs @@ -1,9 +1,14 @@ +use std::fs; use std::path::PathBuf; use std::str::FromStr; use std::sync::Arc; -use gpui::*; -use std::fs; +use anyhow::Result; +use gpui::{ + actions, div, img, prelude::*, px, rgb, size, App, AppContext, AssetSource, Bounds, + ImageSource, KeyBinding, Menu, MenuItem, Point, SharedString, SharedUri, TitlebarOptions, + ViewContext, WindowBounds, WindowContext, WindowOptions, +}; struct Assets { base: PathBuf, @@ -55,7 +60,7 @@ impl RenderOnce for ImageContainer { .size_full() .gap_4() .child(self.text) - .child(img(self.src).w(px(256.0)).h(px(256.0))), + .child(img(self.src).size(px(256.0))), ) } } @@ -75,7 +80,7 @@ impl Render for ImageShowcase { .justify_center() .items_center() .gap_8() - .bg(rgb(0xFFFFFF)) + .bg(rgb(0xffffff)) .child( div() .flex() diff --git a/crates/gpui/examples/input.rs b/crates/gpui/examples/input.rs index 1a49688a8f787a9d67f880d9d195989814d811c6..7544800e5e4474af769563ffeded318b3a39ea83 100644 --- a/crates/gpui/examples/input.rs +++ b/crates/gpui/examples/input.rs @@ -1,6 +1,13 @@ use std::ops::Range; -use gpui::*; +use gpui::{ + actions, black, div, fill, hsla, opaque_grey, point, prelude::*, px, relative, rgb, rgba, size, + white, yellow, App, AppContext, Bounds, ClipboardItem, CursorStyle, ElementId, + ElementInputHandler, FocusHandle, FocusableView, GlobalElementId, KeyBinding, Keystroke, + LayoutId, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, PaintQuad, Pixels, Point, + ShapedLine, SharedString, Style, TextRun, UTF16Selection, UnderlineStyle, View, ViewContext, + ViewInputHandler, WindowBounds, WindowContext, WindowOptions, +}; use unicode_segmentation::*; actions!( @@ -463,7 +470,7 @@ impl Element for TextElement { bounds.bottom(), ), ), - rgba(0x3311FF30), + rgba(0x3311ff30), )), None, ) diff --git a/crates/gpui/examples/opacity.rs b/crates/gpui/examples/opacity.rs index 6ab28f7f8c6ae30480068b0455ecee50c0e83151..1ebdee544cb686f15b712cd38526f755df241a53 100644 --- a/crates/gpui/examples/opacity.rs +++ b/crates/gpui/examples/opacity.rs @@ -1,6 +1,10 @@ use std::{fs, path::PathBuf, time::Duration}; -use gpui::*; +use anyhow::Result; +use gpui::{ + div, hsla, img, point, prelude::*, px, rgb, size, svg, App, AppContext, AssetSource, Bounds, + BoxShadow, ClickEvent, SharedString, Task, Timer, ViewContext, WindowBounds, WindowOptions, +}; struct Assets { base: PathBuf, @@ -76,7 +80,7 @@ impl Render for HelloWorld { .flex() .flex_row() .size_full() - .bg(rgb(0xE0E0E0)) + .bg(rgb(0xe0e0e0)) .text_xl() .child( div() diff --git a/crates/gpui/examples/set_menus.rs b/crates/gpui/examples/set_menus.rs index b06f279ce5e0814697b2a4d9d266bc3f91641b41..e37c207e72530da23d637930df80769bac5db1c8 100644 --- a/crates/gpui/examples/set_menus.rs +++ b/crates/gpui/examples/set_menus.rs @@ -1,4 +1,6 @@ -use gpui::*; +use gpui::{ + actions, div, prelude::*, rgb, App, AppContext, Menu, MenuItem, ViewContext, WindowOptions, +}; struct SetMenus; diff --git a/crates/gpui/examples/shadow.rs b/crates/gpui/examples/shadow.rs index cdf3ba42e9e2b0222055d77a50676b34b6b35fc1..c4f379325c41841414d48dc12bea319f707f6db3 100644 --- a/crates/gpui/examples/shadow.rs +++ b/crates/gpui/examples/shadow.rs @@ -1,4 +1,7 @@ -use gpui::*; +use gpui::{ + div, prelude::*, px, rgb, size, App, AppContext, Bounds, ViewContext, WindowBounds, + WindowOptions, +}; struct Shadow {} diff --git a/crates/gpui/examples/svg/svg.rs b/crates/gpui/examples/svg/svg.rs index 79b83b31e12e149fac501b891e855063cc2d564f..45d918f63371b72c4c153ff9b64b1556ef36a2a7 100644 --- a/crates/gpui/examples/svg/svg.rs +++ b/crates/gpui/examples/svg/svg.rs @@ -1,7 +1,11 @@ +use std::fs; use std::path::PathBuf; -use gpui::*; -use std::fs; +use anyhow::Result; +use gpui::{ + div, prelude::*, px, rgb, size, svg, App, AppContext, AssetSource, Bounds, SharedString, + ViewContext, WindowBounds, WindowOptions, +}; struct Assets { base: PathBuf, diff --git a/crates/gpui/examples/text_wrapper.rs b/crates/gpui/examples/text_wrapper.rs index cb064259286ef85f52bdb83b0329ff438b2fca32..c211ece035027ef23c5abb8cd82d50bb3d2003a1 100644 --- a/crates/gpui/examples/text_wrapper.rs +++ b/crates/gpui/examples/text_wrapper.rs @@ -1,4 +1,6 @@ -use gpui::*; +use gpui::{ + div, prelude::*, px, size, App, AppContext, Bounds, ViewContext, WindowBounds, WindowOptions, +}; struct HelloWorld {} diff --git a/crates/gpui/examples/uniform_list.rs b/crates/gpui/examples/uniform_list.rs index 2994c0d8fc81d8a001386323c99e1cc3b823d285..33dcc2a6ae5479706502a9f8f07ad3d131d8c6a1 100644 --- a/crates/gpui/examples/uniform_list.rs +++ b/crates/gpui/examples/uniform_list.rs @@ -1,4 +1,7 @@ -use gpui::*; +use gpui::{ + div, prelude::*, px, rgb, size, uniform_list, App, AppContext, Bounds, ViewContext, + WindowBounds, WindowOptions, +}; struct UniformListExample {} diff --git a/crates/gpui/examples/window.rs b/crates/gpui/examples/window.rs index 78a47782c956a8ae01844ce82685684e90bd46b2..8f8faa5ad07dd213522c43268c286922a411e4e5 100644 --- a/crates/gpui/examples/window.rs +++ b/crates/gpui/examples/window.rs @@ -1,5 +1,7 @@ -use gpui::*; -use prelude::FluentBuilder as _; +use gpui::{ + div, prelude::*, px, rgb, size, App, AppContext, Bounds, SharedString, Timer, ViewContext, + WindowBounds, WindowContext, WindowKind, WindowOptions, +}; struct SubWindow { custom_titlebar: bool, diff --git a/crates/gpui/examples/window_positioning.rs b/crates/gpui/examples/window_positioning.rs index 10651c9640ba128cc1a87d553e68217a068c5e92..5c39bf5d3fa1a42ac25ba4f0945f5536bc21bb62 100644 --- a/crates/gpui/examples/window_positioning.rs +++ b/crates/gpui/examples/window_positioning.rs @@ -1,4 +1,8 @@ -use gpui::*; +use gpui::{ + div, point, prelude::*, px, rgb, App, AppContext, Bounds, DisplayId, Hsla, Pixels, + SharedString, Size, ViewContext, WindowBackgroundAppearance, WindowBounds, WindowKind, + WindowOptions, +}; struct WindowContent { text: SharedString, diff --git a/crates/gpui/examples/window_shadow.rs b/crates/gpui/examples/window_shadow.rs index 122231f6b5a8a0cc9d0642ccd0e796d841e28c07..919773fdb728fecd0a35399ae7d95046211a05dc 100644 --- a/crates/gpui/examples/window_shadow.rs +++ b/crates/gpui/examples/window_shadow.rs @@ -1,15 +1,16 @@ -use gpui::*; -use prelude::FluentBuilder; +use gpui::{ + black, canvas, div, green, point, prelude::*, px, rgb, size, transparent_black, white, App, + AppContext, Bounds, CursorStyle, Decorations, Hsla, MouseButton, Pixels, Point, ResizeEdge, + Size, ViewContext, WindowBackgroundAppearance, WindowBounds, WindowDecorations, WindowOptions, +}; struct WindowShadow {} -/* -Things to do: -1. We need a way of calculating which edge or corner the mouse is on, - and then dispatch on that -2. We need to improve the shadow rendering significantly -3. We need to implement the techniques in here in Zed -*/ +// Things to do: +// 1. We need a way of calculating which edge or corner the mouse is on, +// and then dispatch on that +// 2. We need to improve the shadow rendering significantly +// 3. We need to implement the techniques in here in Zed impl Render for WindowShadow { fn render(&mut self, cx: &mut ViewContext) -> impl IntoElement { @@ -128,7 +129,7 @@ impl Render for WindowShadow { div() .flex() .bg(white()) - .size(Length::Definite(Pixels(300.0).into())) + .size(px(300.0)) .justify_center() .items_center() .shadow_lg() diff --git a/crates/markdown/examples/markdown_as_child.rs b/crates/markdown/examples/markdown_as_child.rs index a7be4d28914ec137052da6b8ecf847fc1ca82f7f..1fc45416456ae9f7bed0ad68ea2981eba99d76a7 100644 --- a/crates/markdown/examples/markdown_as_child.rs +++ b/crates/markdown/examples/markdown_as_child.rs @@ -1,5 +1,5 @@ use assets::Assets; -use gpui::*; +use gpui::{rgb, App, KeyBinding, Length, StyleRefinement, View, WindowOptions}; use language::{language_settings::AllLanguageSettings, LanguageRegistry}; use markdown::{Markdown, MarkdownStyle}; use node_runtime::NodeRuntime;