gpui-component/crates/story/src
Jason Lee 327d40e0e0
chore: Upgrade GPUI 3 (#587)
The pervious version has keep on
[gpui2](https://github.com/longbridge/gpui-component/tree/gpui2) branch,
if there need to use.

Ref https://github.com/zed-industries/zed/pull/22632

## Prepare

### Generate index.scip

```bash
rust-analyzer scip ./ > index.scip
```

### Get [refactor](https://github.com/zed-industries/refactor)

```bash
https://github.com/zed-industries/refactor.git
```

## Refactor exist code

```bash
cd refactor
cargo run -- ~/work/gpui-component
```

Then will get result if successed:

```
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/refactor /Users/jason/work/gpui-component`
Loaded 115 SCIP documents
Processing files starting with focus path: ""
Changed 90 files
```

-------------

## Changes

```diff
- View<T>
- Model<T>
+ Entity<T>

- WeakView<T>
+ WeakEntity<T>

- FocusableView
+ Focusable

- cx.bounds()
+ window.bounds()
- cx.refresh()
+ window.refresh()
- cx.focused()
+ window.focused(cx)
- cx.with_optional_element_state
- window.with_optional_element_state
```

```diff
- &mut WindowContext
+ &mut Window, &mut App

- cx: &mut WindowContext
+ window: &mut Window, cx: &mut App

- &mut ViewContext<
+ &mut Window, &mut Context<

- cx: &mut ViewContext<
+ window: &mut Window, cx: &mut Context<
```

```diff
- cx.spawn(|_, mut cx| async move { 
+ cx.spawn_in(window, |_, mut cx| async move {
- cx.dispatch_action(Box::new(...))
+ window.dispatch_action(Box::new(...), cx)
```

`cx.spawn`

```diff
- cx.spawn(|view, mut cx| async move {
+ cx.spawn_in(window, |view, mut window| async move {
+     _ = view.update_in(&mut window, move |view, window, cx| {
```
2025-01-27 03:58:48 +08:00
..
fixtures svg_img: Embed the font file (#401) 2024-11-08 15:45:00 +08:00
accordion_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
assets.rs tiles: Add Tiles (#435) 2024-12-16 20:33:14 +08:00
button_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
calendar_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
dropdown_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
form_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
icon_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
image_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
input_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
lib.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
list_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
main.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
modal_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
popup_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
progress_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
resizable_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
scrollable_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
sidebar_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
switch_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
table_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
text_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
title_bar.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
tooltip_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00
webview_story.rs chore: Upgrade GPUI 3 (#587) 2025-01-27 03:58:48 +08:00