Jason Lee
e70d072b88
menu: Add check_side to PopupMenu to support display check at right side. ( #1677 )
...
<img width="507" height="511" alt="image"
src="https://github.com/user-attachments/assets/2d89381a-2acb-49d8-be69-8cb6ab211f41 "
/>
2025-11-25 15:30:36 +08:00
Jason Lee
a2c16bfae6
popover: Revert defer_to focus on Popover open. ( #1571 )
...
Revert #1559 added defer to focus.
Removed the behavior of focus back to was focused handle on close
Popover, this is not correct for Popover.
2025-11-12 17:29:22 +08:00
Jason Lee
a185d8ed24
menu: Fix #1545 Popover change broken submenu click in dropdown menu. ( #1563 )
...
This bug was caused by #1545 .
2025-11-11 22:18:26 +08:00
Jason Lee
3cd94ea0be
popover: Fix click trigger to close popover. ( #1559 )
2025-11-11 21:14:56 +08:00
Jason Lee
eef8abaa15
popover: Fix #1545 incorrect to sync on_open_change to state. ( #1557 )
2025-11-11 18:41:23 +08:00
Jason Lee
2dbfba3490
popover: Improve Popover API. ( #1545 )
...
- Add `open`, `on_open_change` method to control open state.
- Add `default_open` method.
## Break Change
This PR to rewrite the API of Popover API to make it easy to use.
- The `content` method now can receive an element directly.
```diff
- .content(|window, cx| {
- cx.new(|cx| {
- PopoverContent::new(window, cx, |_, _| {
- div().child("This popover content.")
- })
- })
- })
+ .content(|state, window, cx| {
+ div().child("This popover content.")
+ })
```
- And you can also just use `child` and `children` to add child
elements.
```rs
Popover::new("my-popover")
.trigger(Button::new("trigger").label("Open Popover"))
.child("This popover content.")
```
- Removed `PopoverContent`, and changed `Popover` default paddings to
`p_3`.
2025-11-11 17:45:30 +08:00
Jason Lee
945db0be56
dialog: Rename Modal to Dialog. ( #1538 )
...
## Break Change
- Renamed `Modal` to `Dialog`.
```diff
- window.open_modal(...)
+ window.open_dialog(...)
- window.close_modal(...);
+ window.close_dialog(...);
```
- Renamed `show_close` method to `close_button` in Dialog.
```diff
- .show_close(false)
+ .close_button(true)
```
2025-11-07 17:25:55 +08:00
Jason Lee
2ba0dfbb96
popover: Renamed no_style to appearance like the Input. ( #1523 )
...
## Break Change
- The `no_style` method has been removed, use `appearance` instead.
2025-11-05 08:01:27 +00:00
Jason Lee
6817c8d3cc
menu: Add AppMenuBar. ( #1338 )
...
- input: Change Input to not unselect when blur.
- popup_menu: Fix get key binding on PopupMenu with action context.
<img width="935" height="694" alt="image"
src="https://github.com/user-attachments/assets/295fa84e-f1d8-4f6f-8a77-601a45f8ad6d "
/>
## TODO
- [x] Keyboard support.
- [x] Add submenu to example.
- [ ] ~~Icon~~ and check support. Wait
https://github.com/zed-industries/zed/pull/39876
2025-10-10 21:03:16 +08:00
Jason Lee
5e504d10bb
chore: Refactor tab key to switch focus. ( #991 )
...
Wait https://github.com/zed-industries/zed/pull/33008 ,
https://github.com/zed-industries/zed/pull/34804 to merge.
https://github.com/user-attachments/assets/3c21ebc9-44a0-4311-bb0f-5f63fe8d4bb3
- Improved `focus_ring` to render like an outline.
- Added to support press `Enter`, `Space` key to trigger Checkbox,
Button, Radio.
## Break Changes
- The `FocusableExt` has been changed to only for crate internal.
- The `FocusableCycle` has been removed, now GPUI has it own tab stop
implementation.
2025-09-29 16:48:24 +08:00
Jason Lee
93b578294c
list: Update ListItem and DropdownListItem style. ( #1095 )
...
## Break Change
- The `Selectable` trait has been removed `element_id` method, this is
necessary.
- The `item` of `List` now must impl `Selectable` trait.
## List
> NOTE: The default ListItem is no rounded and paddings.
<img width="1144" height="762" alt="image"
src="https://github.com/user-attachments/assets/32348682-f89a-487a-af9f-5ed379a7f2d8 "
/>
## Dropdown
<img width="537" height="387" alt="image"
src="https://github.com/user-attachments/assets/3cc99d9f-3714-4d10-b467-6c91917bcbf0 "
/>
2025-07-28 18:38:39 +08:00
Jason Lee
e29b51cc83
popover: Improve PopoverContent to support styled methods. ( #951 )
...
- Add `refine_style` method to `StyledExt`.
- Also improve the Popover example style.
<img width="1053" alt="image"
src="https://github.com/user-attachments/assets/bf435a79-6c34-41ab-802a-29a7600ecd29 "
/>
2025-06-12 15:00:00 +08:00
Floyd Wang
dc1d516a30
button: Impl Selectable for the dropdown button ( #913 )
...
## Break Change
- Add `is_selected` to the `Selectable` trait; Returns true if the
element is selected.
2025-06-02 14:25:18 +08:00
Jason Lee
901312bc5a
chore: Switch gpui to depends on Zed official. ( #912 )
...
Now, GPUI have merged `window_handle` support for all platforms.
- https://github.com/zed-industries/zed/pull/24327
- https://github.com/zed-industries/zed/pull/24545
- https://github.com/zed-industries/zed/pull/28152
It's time to depends on Zed official main branch.
2025-06-02 10:05:45 +08:00
Jason Lee
a95482fdd8
chore: Upgrade GPUI 2025/05/26 with inspector changes. ( #895 )
...
https://github.com/zed-industries/zed/pull/31315
2025-05-26 13:40:27 +08:00
Jason Lee
a60acd7e4d
list: Add secondary confirm support to list. ( #769 )
2025-04-02 16:45:27 +08:00
Jason Lee
0ebedbe79f
chrome: Refactor state fields to remove is_ prefix. ( #627 )
2025-02-14 15:20:18 +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
d4819b34aa
chore: Update GPUI with AnchorCorner renamed to Corner. ( #497 )
...
Ref https://github.com/zed-industries/zed/pull/22119
2024-12-18 18:02:47 +08:00
Jason Lee
23d273eaf9
sidebar: Add Sidebar ( #452 )
...
Close #430
<img width="1150" alt="image"
src="https://github.com/user-attachments/assets/2564bcfa-7aff-41d3-a7be-496ef2365e30 ">
<img width="1150" alt="image"
src="https://github.com/user-attachments/assets/18c6718a-7641-4e8f-ad0f-bc18bd91fc42 ">
2024-12-02 23:21:39 +08:00
Jason Lee
cbed7b1ea1
menu: Add scrollable support to menu. ( #310 )
...
<img width="274" alt="image"
src="https://github.com/user-attachments/assets/eaff16a6-1294-4381-96c0-c178c195999b ">
2024-10-04 14:24:05 +08:00
Jason Lee
20926b7077
popover: Fix PopoverContent content build to use ViewContext<Self>. ( #254 )
...
And add popover self dismiss example.
## How to dismiss popover from inside.
```rs
cx.emit(DismissEvent);
```
2024-09-19 10:54:04 +08:00
Jason Lee
821487bed5
Improve popup snap to window with margin. ( #225 )
...
- Also update GPUI.
Ref: https://github.com/zed-industries/zed/pull/17159
<img width="866" alt="image"
src="https://github.com/user-attachments/assets/0737e4e4-7069-4554-a766-b9fc7b487fd6 ">
2024-09-07 11:50:38 +08:00
Floyd Wang
b6ce44c349
Support press esc to close popover ( #188 )
2024-08-29 18:07:26 +08:00
Floyd Wang
311abe07fe
Reduce Popover pop-up margin ( #187 )
2024-08-29 16:19:29 +08:00
Floyd Wang
7286866afd
Reduce PopoverContent padding ( #186 )
2024-08-29 11:35:38 +08:00
ihavecoke
a5217df13e
Popover content supports setting the maximum width ( #180 )
...
Before:

After:

2024-08-27 22:08:50 +08:00
Jason Lee
f05d2ebbd2
popup_menu: Add submenu support. ( #165 )
...
- Add submenu support.
- Removed Popover `window` mode, this is not a good design.
https://github.com/user-attachments/assets/0e3735f4-2bfb-459f-a24d-e3440e738d4f
2024-08-19 14:58:28 +08:00
Jason Lee
bb6d8d8f60
Cleanup first version impls ( #132 )
2024-08-11 14:46:55 +08:00
Jason Lee
8f71b807aa
Add Animate ( #130 )
2024-08-09 18:22:06 +08:00
Jason Lee
8aaeb9383d
Fix dropdown click to lose focus. ( #80 )
2024-07-29 19:00:17 +08:00
Jason Lee
e54d1f600b
Add to masked Label and support children to Button ( #50 )
...
https://github.com/user-attachments/assets/9583ce15-b801-45f9-aafb-54f0ecdf7dc9
- Add masked mode to Label.
- Add to support any children to Button.
- Fix Popover to support selected state style.
2024-07-19 18:54:16 +08:00
Jason Lee
eb43c78cea
Add to support open Popover as a child window. ( #18 )
...
## Goal
Change to let Popup elements open into a window, to make sure the Popup
windows, panels, menus render top than the WebView.
Then we can embed wry or other webview into GPUI.
https://github.com/huacnlee/gpui-component/assets/5518/ce005456-088f-4298-bf5d-2642cf96faff
----
This is also like other software, they are also used in child window to
render the menus, popups.
- https://github.com/huacnlee/gpui-component/pull/2
- https://github.com/zed-industries/zed/pull/13730
## Todos
- [x] Multiple display window position.
- [x] Windows transparent background. (No transparent, just render a
correct window border)
- [x] Disable window resize on Windows.
- [ ] Handle Menu action.
- [x] Provided `popover` or `window` two mode to uses.
2024-07-11 16:20:26 +08:00
Jason Lee
acbc029eed
Add PopupMenu ( #15 )
...

2024-07-05 00:04:34 +08:00
Jason Lee
93779164f0
Rewrite Popover ( #7 )
...
https://github.com/huacnlee/gpui-app/assets/5518/dfe0ba05-ecb7-4604-a057-56daed53c16c
2024-06-29 23:49:59 +08:00
Jason Lee
329b116980
Use Element to paint DropdownMenu to fix layer priority.
2024-06-29 18:04:47 +08:00
Jason Lee
3288270b49
Add Popover ( #6 )
2024-06-29 10:03:59 +08:00