Jason Lee
80689264e2
sheet: Rename Drawer to Sheet. ( #1527 )
...
## Break Change
- Renamed `Drawer` to `Sheet`, also renamed relative method contains
`drawer` to `sheet`.
- Renamed `ContextModal` to `WindowExt`.
```diff
- use gpui_component::drawer::Drawer
+ use gpui_component::sheet::Sheet
- use gpui_component::ContextModal
+ use gpui_component::WindowExt
```
2025-11-06 07:19:10 +00:00
Jason Lee
998a5fd922
chore: Standardize the overall API and improve docs. ( #1516 )
2025-11-05 19:10:30 +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
74b3aa7e67
text_view: Add to support selection. ( #1169 )
...
### Links
Maybe we can do it in TextLayout in GPUI:
fda6eda3c2/crates/gpui/src/elements/text.rs (L309)
## Demo
https://github.com/user-attachments/assets/abbebee7-df8f-4067-86a7-15bc1a4c44cd
## Todo
- [x] Test for HTML View.
- [x] CodeBlock selection support.
- [x] Selection lines sometimes incorrect.
- [x] Listener Bounds changed to unselect.
2025-08-28 18:09:30 +08:00
Floyd Wang
6d28cce719
notification: Fix display issues caused by the taffy upgrade ( #1084 )
2025-07-23 19:12:13 +08:00
Floyd Wang
1055131ffe
notification: Support remove notification with the given id ( #980 )
2025-06-18 14:02:07 +08:00
Floyd Wang
838ffe0a79
modal: Display overlay at the correct z-index ( #909 )
...
| Before | After |
| - | - |
| <img width="1712" alt="SCR-20250528-ksil"
src="https://github.com/user-attachments/assets/3725f142-0792-478a-ac7e-1a9c5604821a "
/> | <img width="1712" alt="SCR-20250528-krmi"
src="https://github.com/user-attachments/assets/b0fac5db-97b2-4ebd-83e2-94786950185c "
/> |
2025-05-28 11:57:23 +08:00
Jason Lee
bc398adbf3
input: Refactor Input, Picker as stateless mode. ( #858 )
2025-05-16 23:41:26 +08:00
Jason Lee
373d97ddf0
root: Fix to reset focused_input when close modal or drawer. ( #807 )
2025-04-22 18:54:07 +08:00
王子凌
b016d9fff4
modal: Fix close Modal by clicking overlay to support closing layer by layer. ( #771 )
...
Fix the issue that wrongly trigger `overlay` click event for the
layer-stacked `modals`.
Fix #772
I.E. When clicking the `overlay`, only the last modal will possibly be
hide(If the last modal is not `overlayClosable`, click the overlay, all
the modals will not be hide).

I had tried another solution:


If this one is better than prev, I will commit it~
---------
Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-04-03 13:29:31 +08:00
Jason Lee
ffa36c1c5b
input: Add focused_input, has_focused_input method to Root. #727
...
Add this to save current focused Input, this used to avoid some special keybinding conflict.
For example: `/` as ToggleSearch, if on this action, we can check is there `has_focused_input` to decide to ignore or handle action.
- dock: Rename toggle button visible method.
2025-03-21 17:34:32 +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
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
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
9eba97ddf6
modal: Fix modal, drawer overlay position on Linux. ( #515 )
...
- Update `overlay` for Modal, still handle click out to dismiss, even it
no overlay.
2024-12-24 14:43:37 +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
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
d8636a31bd
chore: Fix clippy warnings. ( #465 )
2024-12-05 12:03:29 +08:00
Jason Lee
e478d5606f
chore: Add base ui attributes to Root and add change font size to story to test font adjust. ( #409 )
2024-11-12 11:17:16 +08:00
Jason Lee
c986a294e4
chore: Add view method to get the child view from Root. ( #385 )
2024-10-31 15:27:45 +08:00
Jason Lee
a798bd81c6
chore: Fix typos. ( #364 )
2024-10-18 14:30:24 +08:00
Jason Lee
41c64e2912
chore: Update controls detail. ( #352 )
...
- Better icon style in Input, Dropdown, DatePicker.
2024-10-16 17:51:39 +08:00
xda
51df8f2f04
drawer: support ESC to close it by on_action and call on_close ( #341 )
...
Fix #263

2024-10-15 21:47:45 +08:00
Jason Lee
8f0ba2e5c3
modal: Only focus modal when it not focused on. ( #250 )
...
- Fix dropdown to mouse down out to dismiss.
https://github.com/user-attachments/assets/f5ab4aca-bfdc-460e-ae5a-cd0a31a30906
2024-09-17 18:48:06 +08:00
Jason Lee
ce87c3a001
modal: Improve Modal and Panel focus handle. ( #238 )
...
- modal: Improve modal focus take, when modal close, make sure focus
back.
- modal: Fix hover close button will cross to back modal on multiple
modal layer.
- panel: Add focus handle to Panel and TabPanel.
- panel: Update title method to return `AnyElement`.
2024-09-12 19:51:33 +08:00
Jason Lee
a0d3d35be4
modal: Add to support open multiple Modals. ( #232 )
...
- Add `Esc` to close modal.
2024-09-10 16:58:22 +08:00
Jason Lee
1dbf809e99
Improved Notification to manage autohide on list. ( #177 )
2024-08-24 00:26:16 +08:00
Jason Lee
981d1391e6
Update Root API ( #150 )
2024-08-15 17:27:34 +08:00
Jason Lee
c9763224c2
Add Notification ( #149 )
...
https://github.com/user-attachments/assets/8a10bff7-f669-471e-8516-2a64ae95ae0a
2024-08-15 16:50:33 +08:00
Jason Lee
a36e3e09d5
Focus back last focus handle when modal, drawer closed. ( #145 )
2024-08-14 18:14:59 +08:00
Jason Lee
3550b1ee13
Add slide down animation t Modal. ( #141 )
...
- Export cx.active_modal and cx.active_drawer
- Add support custom modal style, and add show_close option.
2024-08-14 17:23:39 +08:00
Jason Lee
b934ff76e6
Add Modal ( #138 )
...
https://github.com/user-attachments/assets/f4c2f9dd-2508-4251-a861-1af3af7542a3
2024-08-13 17:41:12 +08:00
Jason Lee
63f333d8ad
Add Drawer ( #137 )
...
- Update scrollable to accept EntityId.
https://github.com/user-attachments/assets/a6c02890-3a6e-4b82-b5c5-3f0a48f35368
2024-08-13 16:01:52 +08:00