API Fixes (#30)
This commit is contained in:
Generated
+1
@@ -2516,6 +2516,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"slotmap",
|
||||
"smallvec",
|
||||
"smol",
|
||||
"spin 0.10.0",
|
||||
"stacksafe",
|
||||
"strum",
|
||||
|
||||
@@ -148,6 +148,7 @@ windows = { version = "0.61", features = ["Win32_Foundation"] }
|
||||
|
||||
[dev-dependencies]
|
||||
backtrace.workspace = true
|
||||
smol.workspace = true
|
||||
collections = { workspace = true, features = ["test-support"] }
|
||||
env_logger.workspace = true
|
||||
gpui_platform = { workspace = true, features = ["font-kit", "wayland", "x11"] }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::{ops::Range, rc::Rc, time::Duration};
|
||||
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point,
|
||||
App, Bounds, Context, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point,
|
||||
Render, SharedString, UniformListScrollHandle, Window, WindowBounds, WindowOptions, canvas,
|
||||
div, point, prelude::*, px, rgb, size, uniform_list,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use gpui::{
|
||||
Application, Background, Bounds, ColorSpace, Context, Path, PathBuilder, Pixels, Render,
|
||||
Background, Bounds, ColorSpace, Context, Path, PathBuilder, Pixels, Render,
|
||||
TitlebarOptions, Window, WindowBounds, WindowOptions, canvas, div, linear_color_stop,
|
||||
linear_gradient, point, prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use gpui::{
|
||||
App, AppContext, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div,
|
||||
App, AppContext, Bounds, Context, Window, WindowBounds, WindowOptions, div,
|
||||
linear_color_stop, linear_gradient, pattern_slash, prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use gpui::{
|
||||
App, Application, Bounds, BoxShadow, Context, Div, SharedString, Window, WindowBounds,
|
||||
WindowOptions, current_platform, div, hsla, point, prelude::*, px, relative, rgb, size,
|
||||
App, Bounds, BoxShadow, Context, Div, SharedString, Window, WindowBounds,
|
||||
WindowOptions, div, hsla, point, prelude::*, px, relative, rgb, size,
|
||||
};
|
||||
|
||||
struct Shadow {}
|
||||
@@ -106,6 +106,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -116,6 +117,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -126,6 +128,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -136,6 +139,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -146,6 +150,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
]),
|
||||
@@ -182,6 +187,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(0.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -191,6 +197,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(2.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -200,6 +207,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(4.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -209,6 +217,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -218,6 +227,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(16.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
]),
|
||||
@@ -234,6 +244,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -243,6 +254,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(2.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -252,6 +264,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(4.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -261,6 +274,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(8.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -270,6 +284,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(16.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
]),
|
||||
@@ -286,6 +301,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -295,6 +311,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(8.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -304,6 +321,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(16.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
]),
|
||||
@@ -320,6 +338,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -329,6 +348,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(8.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -338,6 +358,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(16.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
]),
|
||||
@@ -354,6 +375,7 @@ impl Render for Shadow {
|
||||
offset: point(px(-8.), px(0.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -363,6 +385,7 @@ impl Render for Shadow {
|
||||
offset: point(px(8.), px(0.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -372,6 +395,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(-8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -381,6 +405,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
]),
|
||||
@@ -397,6 +422,7 @@ impl Render for Shadow {
|
||||
offset: point(px(-8.), px(0.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -406,6 +432,7 @@ impl Render for Shadow {
|
||||
offset: point(px(8.), px(0.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -415,6 +442,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(-8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -424,6 +452,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
]),
|
||||
@@ -440,6 +469,7 @@ impl Render for Shadow {
|
||||
offset: point(px(-8.), px(0.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -449,6 +479,7 @@ impl Render for Shadow {
|
||||
offset: point(px(8.), px(0.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -458,6 +489,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(-8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
example(
|
||||
@@ -467,6 +499,7 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(8.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(0.),
|
||||
inset: false,
|
||||
}]),
|
||||
),
|
||||
]),
|
||||
@@ -484,24 +517,28 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(-12.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(2.),
|
||||
inset: false,
|
||||
},
|
||||
BoxShadow {
|
||||
color: hsla(60.0 / 360., 1.0, 0.5, 0.3), // Yellow
|
||||
offset: point(px(12.), px(0.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(2.),
|
||||
inset: false,
|
||||
},
|
||||
BoxShadow {
|
||||
color: hsla(120.0 / 360., 1.0, 0.5, 0.3), // Green
|
||||
offset: point(px(0.), px(12.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(2.),
|
||||
inset: false,
|
||||
},
|
||||
BoxShadow {
|
||||
color: hsla(240.0 / 360., 1.0, 0.5, 0.3), // Blue
|
||||
offset: point(px(-12.), px(0.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(2.),
|
||||
inset: false,
|
||||
},
|
||||
]),
|
||||
),
|
||||
@@ -513,24 +550,28 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(-12.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(2.),
|
||||
inset: false,
|
||||
},
|
||||
BoxShadow {
|
||||
color: hsla(60.0 / 360., 1.0, 0.5, 0.3), // Yellow
|
||||
offset: point(px(12.), px(0.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(2.),
|
||||
inset: false,
|
||||
},
|
||||
BoxShadow {
|
||||
color: hsla(120.0 / 360., 1.0, 0.5, 0.3), // Green
|
||||
offset: point(px(0.), px(12.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(2.),
|
||||
inset: false,
|
||||
},
|
||||
BoxShadow {
|
||||
color: hsla(240.0 / 360., 1.0, 0.5, 0.3), // Blue
|
||||
offset: point(px(-12.), px(0.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(2.),
|
||||
inset: false,
|
||||
},
|
||||
]),
|
||||
),
|
||||
@@ -542,24 +583,28 @@ impl Render for Shadow {
|
||||
offset: point(px(0.), px(-12.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(2.),
|
||||
inset: false,
|
||||
},
|
||||
BoxShadow {
|
||||
color: hsla(60.0 / 360., 1.0, 0.5, 0.3), // Yellow
|
||||
offset: point(px(12.), px(0.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(2.),
|
||||
inset: false,
|
||||
},
|
||||
BoxShadow {
|
||||
color: hsla(120.0 / 360., 1.0, 0.5, 0.3), // Green
|
||||
offset: point(px(0.), px(12.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(2.),
|
||||
inset: false,
|
||||
},
|
||||
BoxShadow {
|
||||
color: hsla(240.0 / 360., 1.0, 0.5, 0.3), // Blue
|
||||
offset: point(px(-12.), px(0.)),
|
||||
blur_radius: px(8.),
|
||||
spread_radius: px(2.),
|
||||
inset: false,
|
||||
},
|
||||
]),
|
||||
),
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//! 3. Transformations - rotate, scale, translate
|
||||
//! 4. Repeating and duration controls
|
||||
|
||||
#[path = "../prelude.rs"]
|
||||
#[path = "../shared/prelude.rs"]
|
||||
mod example_prelude;
|
||||
|
||||
use std::time::Duration;
|
||||
@@ -15,7 +15,7 @@ use std::time::Duration;
|
||||
use anyhow::Result;
|
||||
use gpui::colors::Colors;
|
||||
use gpui::{
|
||||
Animation, AnimationExt as _, App, Application, AssetSource, Bounds, Context, Hsla,
|
||||
Animation, AnimationExt as _, App, AssetSource, Bounds, Context, Hsla,
|
||||
SharedString, Transformation, Window, WindowBounds, WindowOptions, bounce, div, ease_in_out,
|
||||
linear, percentage, prelude::*, px, rgb, size as gpui_size, svg,
|
||||
};
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
//! 3. Task management - Storing, canceling, and detaching tasks
|
||||
//! 4. Progress updates - Communicating from background to UI
|
||||
|
||||
#[path = "../prelude.rs"]
|
||||
#[path = "../shared/prelude.rs"]
|
||||
mod example_prelude;
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use gpui::colors::Colors;
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, Entity, Render, Task, Window, WindowBounds, WindowOptions,
|
||||
App, Bounds, Context, Entity, Render, Task, Window, WindowBounds, WindowOptions,
|
||||
div, prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
//! 2. `RenderOnce` - Stateless component that receives state from parent
|
||||
//! 3. `Render` - Entity-backed view with persistent internal state
|
||||
|
||||
#[path = "../prelude.rs"]
|
||||
#[path = "../shared/prelude.rs"]
|
||||
mod example_prelude;
|
||||
|
||||
use example_prelude::init_example;
|
||||
use gpui::colors::Colors;
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, Entity, IntoElement, Render, RenderOnce, Window,
|
||||
App, Bounds, Context, Entity, IntoElement, Render, RenderOnce, Window,
|
||||
WindowBounds, WindowOptions, div, prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
use gpui::colors::Colors;
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, Hsla, MouseButton, MouseDownEvent, MouseMoveEvent,
|
||||
App, Bounds, Context, Hsla, MouseButton, MouseDownEvent, MouseMoveEvent,
|
||||
MouseUpEvent, Path, PathBuilder, Pixels, Point, Render, Rgba, Window, WindowBounds,
|
||||
WindowOptions, canvas, div, fill, point, prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
#[path = "../prelude.rs"]
|
||||
#[path = "../shared/prelude.rs"]
|
||||
mod example_prelude;
|
||||
|
||||
// Example 1: Basic Canvas Drawing
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
//! 3. Mouse events - mouse down, mouse up, mouse move
|
||||
//! 4. Drag and drop - draggable elements and drop targets
|
||||
|
||||
#[path = "../prelude.rs"]
|
||||
#[path = "../shared/prelude.rs"]
|
||||
mod example_prelude;
|
||||
|
||||
use example_prelude::init_example;
|
||||
use gpui::colors::Colors;
|
||||
use gpui::{
|
||||
App, Application, Bounds, ClickEvent, Context, Entity, Half, Hsla, IntoElement, MouseButton,
|
||||
App, Bounds, ClickEvent, Context, Entity, Half, Hsla, IntoElement, MouseButton,
|
||||
MouseMoveEvent, Pixels, Point, Render, Window, WindowBounds, WindowOptions, div, prelude::*,
|
||||
px, rgb, size,
|
||||
};
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
//! 2. Grid - Two-dimensional layouts with spans
|
||||
//! 3. Common patterns - Sidebar, header/footer, centering
|
||||
|
||||
#[path = "../prelude.rs"]
|
||||
#[path = "../shared/prelude.rs"]
|
||||
mod example_prelude;
|
||||
|
||||
use example_prelude::init_example;
|
||||
use gpui::colors::Colors;
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, Div, Hsla, Render, Rgba, Window, WindowBounds,
|
||||
App, Bounds, Context, Div, Hsla, Render, Rgba, Window, WindowBounds,
|
||||
WindowOptions, div, prelude::*, px, size,
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
use gpui::colors::Colors;
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, FocusHandle, Hsla, KeyBinding, Menu, MenuItem, Render, Rgba,
|
||||
App, Bounds, Context, FocusHandle, Hsla, KeyBinding, Menu, MenuItem, Render, Rgba,
|
||||
Window, WindowBounds, WindowOptions, actions, div, prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
@@ -493,7 +493,7 @@ fn main() {
|
||||
items: vec![MenuItem::action("Quit", Quit)],
|
||||
disabled: false,
|
||||
}]);
|
||||
cx.on_window_closed(|cx| {
|
||||
cx.on_window_closed(|cx, _window_id| {
|
||||
if cx.windows().is_empty() {
|
||||
cx.quit();
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
//! 5. Styled Text - Inline style variations with highlights
|
||||
//! 6. Character Grid - Unicode and emoji support
|
||||
|
||||
#[path = "../prelude.rs"]
|
||||
#[path = "../shared/prelude.rs"]
|
||||
mod example_prelude;
|
||||
|
||||
use example_prelude::init_example;
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, FontStyle, FontWeight, Hsla, Render, StyledText,
|
||||
TextOverflow, Window, WindowBounds, WindowOptions, colors::Colors, current_platform, div,
|
||||
App, Bounds, Context, FontStyle, FontWeight, Hsla, Render, StyledText,
|
||||
TextOverflow, Window, WindowBounds, WindowOptions, colors::Colors, div,
|
||||
prelude::*, px, relative, rgb, size,
|
||||
};
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//!
|
||||
//! This example demonstrates transition capabilities in GPUI via `use_keyed_transition`.
|
||||
|
||||
#[path = "../prelude.rs"]
|
||||
#[path = "../shared/prelude.rs"]
|
||||
mod example_prelude;
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, Div, ElementId, FocusHandle, KeyBinding, SharedString,
|
||||
App, Bounds, Context, Div, ElementId, FocusHandle, KeyBinding, SharedString,
|
||||
Stateful, Window, WindowBounds, WindowOptions, actions, div, prelude::*, px, size,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use gpui::{App, Application, Context, Render, Window, WindowOptions, div, img, prelude::*};
|
||||
use gpui::{App, Context, Render, Window, WindowOptions, div, img, prelude::*};
|
||||
use std::path::PathBuf;
|
||||
|
||||
struct GifViewer {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use gpui::{
|
||||
App, Application, Bounds, ColorSpace, Context, Half, Render, Window, WindowOptions, canvas,
|
||||
App, Bounds, ColorSpace, Context, Half, Render, Window, WindowOptions, canvas,
|
||||
div, linear_color_stop, linear_gradient, point, prelude::*, px, size,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, SharedString, Window, WindowBounds, WindowOptions, div,
|
||||
App, Bounds, Context, SharedString, Window, WindowBounds, WindowOptions, div,
|
||||
prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::sync::Arc;
|
||||
|
||||
use anyhow::Result;
|
||||
use gpui::{
|
||||
actions, div, img, prelude::*, px, rgb, size, App, AppContext, Application, AssetSource,
|
||||
actions, div, img, prelude::*, px, rgb, size, App, AppContext, AssetSource,
|
||||
Bounds, Context, ImageSource, KeyBinding, Menu, MenuItem, Point, SharedString, SharedUri,
|
||||
TitlebarOptions, Window, WindowBounds, WindowOptions,
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::{path::Path, sync::Arc, time::Duration};
|
||||
|
||||
use gpui::{
|
||||
Animation, AnimationExt, App, Application, Asset, AssetLogger, AssetSource, Bounds, Context,
|
||||
Animation, AnimationExt, App, Asset, AssetLogger, AssetSource, Bounds, Context,
|
||||
Hsla, ImageAssetLoader, ImageCacheError, ImgResourceLoader, LOADING_DELAY, Length, RenderImage,
|
||||
Resource, SharedString, Window, WindowBounds, WindowOptions, black, div, img, prelude::*,
|
||||
pulsating_between, px, red, size,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::ops::Range;
|
||||
|
||||
use gpui::{
|
||||
App, Application, Bounds, ClipboardItem, Context, CursorStyle, ElementId, ElementInputHandler,
|
||||
App, Bounds, ClipboardItem, Context, CursorStyle, ElementId, ElementInputHandler,
|
||||
Entity, EntityInputHandler, FocusHandle, Focusable, GlobalElementId, KeyBinding, Keystroke,
|
||||
LayoutId, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, PaintQuad, Pixels, Point,
|
||||
ShapedLine, SharedString, Style, TextRun, UTF16Selection, UnderlineStyle, Window, WindowBounds,
|
||||
|
||||
@@ -11,7 +11,7 @@ mod example {
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, FontWeight, Size, Window, WindowBackgroundAppearance,
|
||||
App, Bounds, Context, FontWeight, Size, Window, WindowBackgroundAppearance,
|
||||
WindowBounds, WindowKind, WindowOptions, div, layer_shell::*, point, prelude::*, px, rems,
|
||||
rgba, white,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, FocusHandle, KeyBinding, Window, WindowBounds,
|
||||
App, Bounds, Context, FocusHandle, KeyBinding, Window, WindowBounds,
|
||||
WindowOptions, actions, div, prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ fn main() {
|
||||
let mut bounds = Bounds::centered(None, size(px(500.), px(500.0)), cx);
|
||||
|
||||
cx.bind_keys([KeyBinding::new("cmd-w", CloseWindow, None)]);
|
||||
cx.on_window_closed(|cx| {
|
||||
cx.on_window_closed(|cx, _| {
|
||||
if cx.windows().is_empty() {
|
||||
cx.quit();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::{fs, path::PathBuf};
|
||||
|
||||
use anyhow::Result;
|
||||
use gpui::{
|
||||
App, Application, AssetSource, Bounds, BoxShadow, ClickEvent, Context, SharedString, Task,
|
||||
App, AssetSource, Bounds, BoxShadow, ClickEvent, Context, SharedString, Task,
|
||||
Window, WindowBounds, WindowOptions, div, hsla, img, point, prelude::*, px, rgb, size, svg,
|
||||
};
|
||||
|
||||
@@ -116,6 +116,7 @@ impl Render for HelloWorld {
|
||||
blur_radius: px(1.0),
|
||||
spread_radius: px(5.0),
|
||||
offset: point(px(10.0), px(10.0)),
|
||||
inset: false,
|
||||
}])
|
||||
.child(img("image/app-icon.png").size_8())
|
||||
.child("Opacity Panel (Click to test)")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px,
|
||||
App, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px,
|
||||
size,
|
||||
};
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ use std::path::PathBuf;
|
||||
|
||||
use anyhow::Result;
|
||||
use gpui::{
|
||||
App, Application, AssetSource, Bounds, Context, SharedString, Window, WindowBounds,
|
||||
WindowOptions, current_platform, div, prelude::*, px, rgb, size, svg,
|
||||
App, AssetSource, Bounds, Context, SharedString, Window, WindowBounds,
|
||||
WindowOptions, div, prelude::*, px, rgb, size, svg,
|
||||
};
|
||||
|
||||
struct Assets {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, Div, ElementId, FocusHandle, KeyBinding, SharedString,
|
||||
App, Bounds, Context, Div, ElementId, FocusHandle, KeyBinding, SharedString,
|
||||
Stateful, Window, WindowBounds, WindowOptions, actions, div, prelude::*, px, size,
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px,
|
||||
App, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px,
|
||||
size,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px,
|
||||
App, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px,
|
||||
rgb, size, uniform_list,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, KeyBinding, PromptButton, PromptLevel, Window, WindowBounds,
|
||||
App, Bounds, Context, KeyBinding, PromptButton, PromptLevel, Window, WindowBounds,
|
||||
WindowKind, WindowOptions, actions, div, prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, DisplayId, Hsla, Pixels, SharedString, Size, Window,
|
||||
App, Bounds, Context, DisplayId, Hsla, Pixels, SharedString, Size, Window,
|
||||
WindowBackgroundAppearance, WindowBounds, WindowKind, WindowOptions, div, point, prelude::*,
|
||||
px, rgb,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, CursorStyle, Decorations, HitboxBehavior, Hsla, MouseButton,
|
||||
App, Bounds, Context, CursorStyle, Decorations, HitboxBehavior, Hsla, MouseButton,
|
||||
Pixels, Point, ResizeEdge, Size, Window, WindowBackgroundAppearance, WindowBounds,
|
||||
WindowDecorations, WindowOptions, black, canvas, div, green, point, prelude::*, px, rgb, size,
|
||||
transparent_black, white,
|
||||
@@ -114,6 +114,7 @@ impl Render for WindowShadow {
|
||||
blur_radius: shadow_size / 2.,
|
||||
spread_radius: px(0.),
|
||||
offset: point(px(0.0), px(0.0)),
|
||||
inset: false,
|
||||
}])
|
||||
}),
|
||||
})
|
||||
@@ -154,6 +155,7 @@ impl Render for WindowShadow {
|
||||
blur_radius: px(20.0),
|
||||
spread_radius: px(0.0),
|
||||
offset: point(px(0.0), px(0.0)),
|
||||
inset: false,
|
||||
}])
|
||||
.map(|div| match decorations {
|
||||
Decorations::Server => div,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! Common helpers for GPUI examples. Import with:
|
||||
//!
|
||||
//! ```ignore
|
||||
//! #[path = "../prelude.rs"]
|
||||
//! #[path = "../shared/prelude.rs"]
|
||||
//! mod example_prelude;
|
||||
//! use example_prelude::init_example;
|
||||
//! ```
|
||||
@@ -1724,7 +1724,7 @@ impl PlatformWindow for MacWindow {
|
||||
}
|
||||
|
||||
fn play_system_bell(&self) {
|
||||
unsafe { NSBeep() }
|
||||
NSBeep()
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
|
||||
Reference in New Issue
Block a user