Jason Lee
a5db381ef4
chore: Upgrade GPUI 2025/02/10 ( #610 )
...
- Replace `Window::parent_view_id()` with `Window::current_view()`
https://github.com/zed-industries/zed/pull/24212
- Fix SvgImg crash by move `use_asset` to `request_layout`.
- Fix Input to implement `character_index_for_point` method
https://github.com/zed-industries/zed/pull/23989
- Fix Input IME position to under the cursor line.
<img width="504" alt="image"
src="https://github.com/user-attachments/assets/8a6f56c8-6aae-4c0c-8c5a-3959d6a9d224 "
/>
- Fix Input overflow sub crash.
2025-02-10 11:53:25 +08:00
Jens Krause
a6922e3a10
example: Fix tiles needs package gpui-component ( #609 )
2025-02-08 23:43:37 +08:00
Floyd Wang
abb3de013e
Rename package from ui to gpui-component ( #606 )
...
## 🚨 Break Change
Update dependencies from `ui` to `gpui-component`.
2025-02-06 17:21:46 +08:00
Floyd Wang
e423497da6
tooltip: Support render element ( #605 )
...
<img width="376" alt="image"
src="https://github.com/user-attachments/assets/52793001-03cb-46ca-80a3-42aa3db57ecb "
/>
2025-02-06 16:05:44 +08:00
Jason Lee
99a4c793c5
chore: Update crate name to gpui-component for publish crate to hold the name. ( #603 )
2025-02-06 11:57:34 +08:00
Jason Lee
9675f1e02b
dock: Add cache to panel view. ( #600 )
2025-02-05 17:23:40 +08:00
Jason Lee
3e16c0d220
chore: Remove reexport prelude. ( #599 )
...
This is useless, we can just use `gpui::prelude`, so I removed it.
## Break changes
- The `ui::prelude` has been removed, you can replace by use
`gpui::prelude`.
2025-02-04 17:37:28 +08:00
Jason Lee
dffb419145
chore: Fix subscriptions leak. ( #597 )
2025-02-04 15:43:26 +08:00
Jason Lee
3ffbbb0688
theme: Ensure all elements to use radius. ( #596 )
...
- Fix menu dispatch action.
2025-02-03 19:03:16 +08:00
Jason Lee
6fa1888ee6
chore: Upgrade for GPUI API changes. ( #589 )
2025-01-29 16:49:17 +08:00
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
Jason Lee
e658aeee96
table: Improve sort icon color and fix stripe row display. ( #578 )
...
- Improve sort icon color:
<img width="139" alt="image"
src="https://github.com/user-attachments/assets/6374c26a-4555-4735-953b-dbd961fe5b31 "
/>
- Avoid duplicate border when enabled fixed column.
<img width="587" alt="image"
src="https://github.com/user-attachments/assets/6e186d29-5d8a-404e-b160-20c2af6a16fa "
/>
TODO
- [x] The extra rows not show when `stripe` is true.
2025-01-26 16:25:34 +08:00
Jason Lee
649e765729
story: Add TitleBar to examples. ( #586 )
2025-01-26 15:07:34 +08:00
Jason Lee
cd613db6d6
number_input: Improve NumberInput to better handle mouse down position cursor and fix sizable API. ( #582 )
...
Close #579
- Leave some space before the Input to support mouse down to position
cursor at start of line.
- Fix to match with size appearance.
- Keep padding left and right to Input, even setup `appearance: false`.
## Break Changes
- The `xlarge`, `large`, `small`, `xsmall` ... method has been moved to
use `ui::Sizable` trait to same as other component.
2025-01-24 23:39:19 +08:00
Jason Lee
1689f4208f
table: Add measure to table. ( #577 )
...
- Improve to not calc extra rows if `stripe` not enable.
- Improve to not change offset, when scrollbar drag changed less than
1px.
- Improve render cells to use `Vec::with_capacity` to prepare enough
space.
```bash
ZED_MEASUREMENTS=1 MTL_HUD_ENABLED=1 cargo run --release --example table
```
2025-01-24 18:59:01 +08:00
Jason Lee
878a51e5a9
example: Split single examples. ( #574 )
...
```bash
cargo run --example table
cargo run --example list
```
2025-01-24 11:13:24 +08:00
Jason Lee
77badb5799
radio: Add RadioGroup. ( #571 )
...
<img width="1265" alt="image"
src="https://github.com/user-attachments/assets/7ff51cb8-0aad-4d7d-a80a-e97c572c468a "
/>
2025-01-23 20:13:01 +08:00
Floyd Wang
1ff84a9943
popup_menu: Add max_h to set the height of menu ( #570 )
2025-01-23 18:43:34 +08:00
Jason Lee
e03a0d4f4e
chore: Fix Switch, Radio, Checkbox to use inline layout. ( #569 )
2025-01-23 18:05:32 +08:00
Jason Lee
a89e2430d3
form: Add Form and FormField. ( #565 )
...
<img width="899" alt="image"
src="https://github.com/user-attachments/assets/842dac65-36c3-4f3a-b55a-59d204d9a93c "
/>
<img width="901" alt="image"
src="https://github.com/user-attachments/assets/616b7a3a-4a84-4d27-b554-63ebd5213ad7 "
/>
2025-01-23 16:09:50 +08:00
Jason Lee
78ce573a52
list, table: Refactor to control loading by use delegate. ( #562 )
...
- Add `loading` method to `ListDelegate` and `TableDelegate` to control
loading view display.
## Break Changes
- Remove `loading`, `set_loading` method from List and Table, use
`loading` method in delegate instead.
2025-01-21 20:33:37 +08:00
Jason Lee
9f2cd84b23
color: Add mix method and merge ColorExt to Colorize. ( #561 )
...
- Add `mix` method to mix two color.
- Export `ui::theme::*` to crate root, before `use
ui:theme::ActiveTheme` to `use ui::ActiveTheme`.
## Break Changes
- Moved `ui::theme::Colorize` to `ui::Colorize`.
- Merged `ColorExt` to `Colorize`.
- Renamed `to_hex_string` to `to_hex`, `parse_hex_string` to
`parse_hex`.
2025-01-21 18:31:01 +08:00
Jason Lee
493acdefab
story: Fix story and merge checkbox, radio to switch story.
2025-01-21 10:43:10 +08:00
Jason Lee
20feab5f40
modal: Add confirm Modal with default Ok, Cancel buttons. ( #558 )
...
<img width="581" alt="image"
src="https://github.com/user-attachments/assets/ad53fb63-f3be-41e6-90c0-f03cba48c4db "
/>
- Added `overlay_closable` method to Modal to control overlay click to
close modal.
- Added `on_ok`, `on_cancel` callback method.
- Added `confirm` to setup to use default confirm style (With a Ok,
Cancel button).
## Break Changes
- The `footer` method has been changed to with a fn not a element.
2025-01-20 17:42:05 +08:00
Jason Lee
ad04b699fc
clipboard: Add value_fn to get copy value with callback to Clipboard. ( #557 )
2025-01-20 15:54:27 +08:00
Jason Lee
355dfa5556
slider: Add vertical and reverse support to Slider. ( #556 )
...
- Fix to support stop at any position.
- Fix click bounds.
2025-01-20 15:22:28 +08:00
Floyd Wang
bd3cdd7167
dropdown_button: Add more style preferences ( #554 )
2025-01-17 16:24:46 +08:00
Jason Lee
4fa8b9d65c
list: Fix #552 broken move down to select first item. ( #553 )
2025-01-17 16:19:03 +08:00
Jason Lee
f41edfd318
list: Add ListEvent to List. ( #552 )
...
- Add `ListEvent` and emit event for List with `Select`, `Confirm`,
`Cancel` events.
## Break Changes
- Removed useless `ListDelegate::confirmed_index` method.
- Updated `ListDelegate::confirm` method, to change `ix: Option<usize>`
to `ix: usize`.
2025-01-17 16:00:28 +08:00
Floyd Wang
569a4e7262
dropdown_button: Add new component ( #551 )
...
## Regular
<img width="162" alt="image"
src="https://github.com/user-attachments/assets/4e597d0b-41d1-4b0e-9939-728cae71fe65 "
/>
## Active
<img width="162" alt="image"
src="https://github.com/user-attachments/assets/0871ed6b-3188-44dd-93d4-5996f9213edc "
/>
<br />
<img width="162" alt="image"
src="https://github.com/user-attachments/assets/b05ccdc6-e405-47d0-97e7-470afadbbd38 "
/>
## Break Change
Move `ButtonGroup` into the `button`.
2025-01-17 14:16:24 +08:00
Floyd Wang
0312e47554
input: Move number input into input ( #549 )
2025-01-17 10:07:41 +08:00
Jason Lee
a0f6b48eff
chore: Update GPUI 2025/01/14 ( #547 )
2025-01-14 19:21:04 +08:00
Jason Lee
7848311046
list, table: Add default loading animation to List and Table. ( #546 )
...
<img width="485" alt="image"
src="https://github.com/user-attachments/assets/568cbf3a-6e32-4b21-8816-5e3cb26acc82 "
/>
<img width="755" alt="image"
src="https://github.com/user-attachments/assets/5e13d6b8-e6f4-4cc3-b1f6-9b378ff523a4 "
/>
2025-01-14 11:36:33 +08:00
Ylin
eb10186463
table: Add visible_rows_changed, visible_cols_changed method to table delegate. ( #543 )
...
Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-01-13 13:51:20 +08:00
Floyd Wang
464fceac96
theme: Rename destructive to danger ( #541 )
2025-01-10 15:16:19 +08:00
Floyd Wang
31736b0e21
badge: Add new component ( #540 )
...
<img width="137" alt="image"
src="https://github.com/user-attachments/assets/6d7008b2-fe0f-4c4e-bd16-1dd8ae883f11 "
/>
<img width="118" alt="image"
src="https://github.com/user-attachments/assets/3137dd88-5038-4c59-90c1-cee2cdc542bd "
/>
2025-01-10 14:28:27 +08:00
Floyd Wang
2aad7e412a
tag: Rename badge to tag ( #539 )
2025-01-10 10:28:47 +08:00
Floyd Wang
ceba66c22d
dock: Add PanelControl for pinning the toolbar button ( #537 )
...
<img width="387" alt="image"
src="https://github.com/user-attachments/assets/b3d3f2a8-dc4e-49e6-8e82-e7f551d70bc7 "
/>
2025-01-09 19:18:59 +08:00
Jason Lee
de42cc46a7
panel: Update Panel toolbar_buttons method to use ViewContext<Self>. ( #536 )
...
## Break changes
The `toolbar_buttons` trait method in Panel has been changed:
```diff
- fn toolbar_buttons(&self, cx: &WindowContext) -> Vec<Button>
+ fn toolbar_buttons(&self, cx: &mut ViewContext<Self>) -> Option<Vec<Button>>
```
2025-01-09 16:49:35 +08:00
Jason Lee
bf82e3db13
list, table: Add scroll_to_item to List, scroll_to_row to Table. ( #535 )
2025-01-09 14:23:46 +08:00
Jason Lee
63a9e61fd1
Fix lint
2025-01-08 15:08:41 +08:00
Jason Lee
3773337e04
list: Add load_more. ( #532 )
2025-01-08 15:05:40 +08:00
Jason Lee
99e51288e0
table: Binding popup menu on the table not on row for avoid render it on each rows. ( #528 )
...
- Add `TableEvent::DoubleClickedRow` to emit double clicked row event to
table.
2025-01-03 18:10:07 +08:00
Jason Lee
a5427ae662
title_bar: Avoid zoom window on double clicked on title bar right area. ( #522 )
...
Close #516
2024-12-31 18:57:11 +08:00
Jason Lee
0327df323d
modal: Fix Model, Drawer overlay size on tiling mode. ( #518 )
2024-12-27 17:22:02 +08:00
Jason Lee
6acbfb5298
root: Fix window border and add cx.theme().window_border
2024-12-24 13:48:28 +08:00
Jason Lee
466c5e2005
root: Add window shadow to Root for support window border style on Linux. ( #514 )
...
And fix the title bar buttons click handle on Linux.
2024-12-24 13:33:06 +08:00
Jason Lee
7d8166a05e
linux: Fix window border on Linux.
2024-12-24 11:33:33 +08:00
Jason Lee
ea0954b425
drawer: Render notification at the side of drawer when drawer (top, right) it opened. ( #512 )
...
This change to make sure notification will display when WebView render
on the drawer.

2024-12-24 09:46:40 +08:00
Jason Lee
c8fae22684
story: Fix image story image size.
2024-12-20 18:29:11 +08:00