Add StatusToast & the ToastLayer (#26232)

https://github.com/user-attachments/assets/b16e32e6-46c6-41dc-ab68-1824d288c8c2

This PR adds the first part of our planned extended notification system:
StatusToasts.

It also makes various updates to ComponentPreview and adds a `Styled`
extension in `ui::style::animation` to make it easier to animate styled
elements.

_**Note**: We will be very, very selective with what elements are
allowed to be animated in Zed. Assume PRs adding animation to elements
will all need to be manually signed off on by a designer._

## Status Toast

![CleanShot 2025-03-06 at 14 15
52@2x](https://github.com/user-attachments/assets/b65d4661-f8d1-4e98-b9be-2c05cba1409f)

These are designed to be used for notifying about things that don't
require an action to be taken or don't need to be triaged. They are
designed to be ignorable, and dismiss themselves automatically after a
set time.

They can optionally include a single action. 

Example: When the user enables Vim Mode, that action might let them undo
enabling it.

![CleanShot 2025-03-06 at 14 18
34@2x](https://github.com/user-attachments/assets/eb6cb20e-c968-4f03-88a5-ecb6a8809150)

Status Toasts should _not_ be used when an action is required, or for
any binary choice.

If the user must provide some input, this isn't the right component!

### Out of scope

- Toasts should fade over a short time (like AnimationDuration::Fast or
Instant) when dismissed
- We should visually show when the toast will dismiss. We'll need to
pipe the `duration_remaining` from the toast layer -> ActiveToast to do
this.
- Dismiss any active toast if another notification kind is created, like
a Notification or Alert.

Release Notes:

- N/A

---------

Co-authored-by: Cole Miller <m@cole-miller.net>
This commit is contained in:
Nate Butler 2025-03-06 15:37:54 -05:00 committed by GitHub
parent b8a8b9c699
commit 7e964290bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 1308 additions and 75 deletions

8
Cargo.lock generated
View file

@ -3046,8 +3046,12 @@ dependencies = [
name = "component_preview"
version = "0.1.0"
dependencies = [
"client",
"component",
"gpui",
"languages",
"notifications",
"project",
"ui",
"workspace",
]
@ -8378,13 +8382,17 @@ dependencies = [
"channel",
"client",
"collections",
"component",
"db",
"gpui",
"linkme",
"rpc",
"settings",
"sum_tree",
"time",
"ui",
"util",
"workspace",
]
[[package]]