Commit graph

1317 commits

Author SHA1 Message Date
ihavecoke
fbaddbe9e3
tiles: Add scrollbar_show option to Tiles (#1496) 2025-11-04 17:42:46 +08:00
Jason Lee
b7815ed6ec
table: Keep scroll to item at bottom when move down. (#1499) 2025-11-04 09:28:37 +00:00
Floyd Wang
2e5bdd0c3a
list: Fix incorrect next selection when select index is none (#1498)
Previously, pressing next would select the second item.
2025-11-04 17:17:17 +08:00
Moulberry
e7aa8983dc
input: Delete selected text with modifier keys (#1497)
In most applications, when text is selected and backspace/delete is
pressed, the selection is simply deleted.

Currently, gpui-component will ignore the selected text and delete the
previous/next word when Ctrl is pressed.

This can be very confusing especially if you do ctrl+a then
ctrl+backspace, expecting the input to be cleared.

This PR makes it so that if there is an active selection, the active
selection is deleted before doing any extra processing.
2025-11-04 16:54:31 +08:00
Jason Lee
893e323692
Fix state internal update to refresh for List, Tree, Table and Select. (#1492)
This to fix #1468, #1449 changes broken the state (e.g.: `SelectState`
to call `cx.notify()`) update not notify parent element (e.g.: `Select`)
to rerender.
2025-11-04 16:25:37 +08:00
Jason Lee
f6bbef0082
docs: Update docs website style. (#1488) 2025-11-03 22:18:18 +08:00
Jason Lee
faee23eef8
table: Change context_menu method in TableDelegate to mutable window and cx. (#1487)
## Break Change

- The `window`, `cx` has changed from `&Window`, `&App` to `&mut
Window`, `&mut App`.

```diff
- fn context_menu(&self, row_ix: usize, menu: PopupMenu, window: &Window, cx: &App)
+ fn context_menu(&self, row_ix: usize, menu: PopupMenu, window: &mut Window, cx: &mut App)
```
2025-11-03 18:06:29 +08:00
FlyingYu
be460dcbed
modal, drawer: Block background interaction when Modal, Drawer is active. (#1483)
Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-11-03 16:51:38 +08:00
Floyd Wang
3d606a6909
select: Avoid reopen menu when clearing selection (#1484) 2025-11-03 08:24:54 +00:00
Jason Lee
9fa2669ff4
list, table: Refactor List, Table to have ListState, TableState. (#1468)
## Break Change

- Like Select, Input API design, now `List`, `Table` also has ListState
and TableState.

```diff
- let table = cx.new(|_| Table::new(delegate, window, cx).stripe(true).border(true))
+ let table = cx.new(|_| TableState::new(delegate, window, cx))
+ Table::new(&table).stripe(true).border(true) // for render

- let list = cx.new(|_| List::new(delegate, window, cx))
+ let list = cx.new(|_| ListState::new(delegate, window, cx))
+ List::new(&list) // for render
```

- ListDelegate, TableDelegate methods has changed some argument type:
  
- If first argument is `&mut self`, the `cx` has been changed to `&mut
Context<ListState<Self>>` or `&mut Context<TableState<Self>>`.
  

    ```diff
- fn confirm(&mut self, _secondary: bool, _: &mut Window, cx: &mut
Context<List<Self>>)
+ fn confirm(&mut self, _secondary: bool, _: &mut Window, cx: &mut
Context<ListState<Self>>)
    ```

- If first argument is `&self`, the `cx` has been changed to `&mut App`.

    ```diff
- fn render_item(&self, ix: IndexPath, _: &mut Window, _: &mut
Context<List<Self>>)
    + fn render_item(&self, ix: IndexPath, _: &mut Window, _: &mut App)
    ```
2025-11-02 12:59:37 +00:00
Floyd Wang
123934237a Bump v0.4.0-preview0 2025-10-30 15:50:45 +08:00
Jason Lee
e75c37a1ac
chore: Update List, Tree, Kbd exports. (#1467)
## Break Change

- Removed `Kbd` from root export, use `gpui_component::kbd::Kbd`
instead.
- Removed `List` from root export, use `gpui_component::list::*`
instead.
- Removed `Tree` from root export, use `gpui_component::tree:*` instead.
2025-10-30 07:19:39 +00:00
Jason Lee
ed11282782
docs: Add Context & ElementId doc. (#1460)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-29 23:37:26 +08:00
Jason Lee
2727a65494
resizable: Simplify Resizable API. (#1459)
- Added `on_resize` callback method to `ResizabelPanelGroup`.

## Break Changes

- Remove `state` argument from `h_resizable`, `v_resizable` method.

```diff
- v_resizable("resizable-1", state)
+ v_resizable("resizable-1")
```

- Removed `group` method from `ResizabelPanelGroup`, use `child`
instead.

```diff
- v_resizable(..).group(..)
+ v_resizable(..).child(..)
```
2025-10-29 23:01:05 +08:00
Jason Lee
a1ca8624af
example: Add file tree to Editor example. (#1457)
<img width="1205" height="861" alt="image"
src="https://github.com/user-attachments/assets/4b3814cd-7dc0-4fc1-8f0f-d98d7cc29294"
/>
2025-10-29 12:58:40 +00:00
Jason Lee
7036415662
chore: Keep spawn task on it owner. (#1456) 2025-10-29 19:11:49 +08:00
Jason Lee
d34ea6640a
docs: Improve docs add more details. (#1447)
- Also update "Compare to others", close #1452
2025-10-29 02:41:28 +00:00
Jason Lee
4eb1ed2cfd
tab: Use on_click instead of action for TabBar dropdown menu. (#1454)
Close #1453
2025-10-29 01:04:14 +00:00
Jason Lee
55db53a46d
select: Impl SelectItem for &'static str. (#1451) 2025-10-28 13:37:00 +00:00
Jason Lee
34ef0ff6d0
chore: Rename Dropdown to Select, TextInput to Input. (#1449)
## Break Change

- The `Dropdown` has been renamed to `Select`.
- The `TextInput` has been renamed to `Input`.

| Before | After |
| --- | --- |
| TextInput | Input |
| Dropdown | Select |
| DropdownItem | SelectItem |
| DropdownItemGroup | SelectGroup |
| DropdownState | SelectState |
| DropdownEvent | SelectEvent |
| DropdownDelegate | SelectDelegate |
| dropdown::ListEvent | ~~Removed~~ |

- Renamed `PopupMenuExt` to `DropdownMenu`.
- Removed pub mod `menu::popup_menu`, `menu::context_menu`, they are
moved into `menu` mod.
- Renamed `popup_menu` method to `dropdown_menu` for `DropdownMenu`,
`Panel`, `PanelView` and `DropdownButton`.

| Before | After |
| --- | --- |
| popup_menu::PopupMenuExt | menu::DropdownMenu |
| popup_menu | dropdown_menu |
| popup_menu_with_anchor | dropdown_menu_with_anchor |
2025-10-28 21:22:31 +08:00
Floyd Wang
0e2397cf15
chart(bar): Fix the label is not centered (#1448) 2025-10-28 16:53:42 +08:00
Floyd Wang
e005bd0f46
docs: Update chart (#1446) 2025-10-28 14:46:13 +08:00
Jason Lee
38a10fe05c
menu: Add item and export PopupMenuItem with builder methods to PopupMenu. (#1445)
Now we can be easy to add a menu item without define `action`, just use
`on_click` callback.

## Break Changes

- Removed complex methods: `menu_element_with_check_and_disabled`,
`menu_element_with_icon_and_disabled`, you can use `item` and
`PopupMenuItem` instead.
2025-10-28 14:42:56 +08:00
Floyd Wang
19a54d6065
chart(pie): Support dynamic inner and outer radius (#1444)
## ⚠️Breaking Change
Add `inner_radius` and `outer_radius` options for `Arc` paint function.

```diff
- arc.paint(a, "#9d9d9d", bounds, window)
+ arc.paint(a, "#9d9d9d", Some(20.), Some(30.), bounds, window)
```
## Demo
<img width="410" height="442" alt="SCR-20251028-kohu"
src="https://github.com/user-attachments/assets/8b849053-22e6-4d6f-933f-b9fb2a47f5e3"
/>
2025-10-28 13:53:28 +08:00
Jason Lee
904c9f3fa7
theme: Export more theme options for schema. (#1442)
- Fix theme switch to support other UI settings (e.g.: radius, shadow,
font_size).
- Update `matrix` theme to use rounded 0px.

<img width="1380" height="1139" alt="image"
src="https://github.com/user-attachments/assets/24832fde-5b5e-4508-9b38-6c3c2890aedb"
/>
2025-10-28 03:28:18 +00:00
Jason Lee
cc0f936348
tiles: Add tile_radius theme option and default 0px. (#1441) 2025-10-28 02:54:41 +00:00
Jason Lee
519540eaa7
docs: Remove incorrect Accessibility section. (#1439) 2025-10-28 10:24:48 +08:00
Gurjeet Singh
c57e1ade72
docs: Fix typo in README charting description (#1434) 2025-10-27 19:22:20 +08:00
Floyd Wang
183d17731d Bump v0.3.1 2025-10-27 13:52:29 +08:00
Jason Lee
5f63ddb822
example: Fix title bar paddings for window_title example. (#1429) 2025-10-24 13:54:52 +00:00
Jason Lee
6ebb9418a0
editor: Use measure_indent_width for indent guides width. (#1428)
Continue #1426, this changes I was forgotten to push before #1426
merged.
2025-10-24 20:18:30 +08:00
Jason Lee
178269be63
editor: Add indent guides. (#1426)
<img width="1070" height="1006" alt="image"
src="https://github.com/user-attachments/assets/a456b055-b45f-45ae-84b0-452a952cc19c"
/>
2025-10-24 19:03:09 +08:00
Floyd Wang
21eff06e11
list: Use click events instead of mouse events when confirming (#1427)
Fix the issue where inner list buttons do not respond to clicks.
2025-10-24 16:51:37 +08:00
Iain
b740123d4b
example: Add missed control icon assets (#1424) 2025-10-24 13:30:27 +08:00
Jason Lee
fe137caba0 chore: Fix Cargo.toml meta info. 2025-10-24 13:30:11 +08:00
Jason Lee
98c17740c7 docs: Update from 40+ to 60+ components. 2025-10-24 13:25:31 +08:00
Floyd Wang
9bbb603aae Update CONTRIBUTING.md 2025-10-24 11:38:18 +08:00
Floyd Wang
73362c59da
Add bump version shell (#1423)
<img width="517" height="663" alt="image"
src="https://github.com/user-attachments/assets/49ae644e-9304-453a-940a-dde14075aedf"
/>
2025-10-24 11:35:59 +08:00
Jason Lee
ab7af9c01d Bump v0.3.0 2025-10-24 10:47:04 +08:00
Jason Lee
04fd5e1511
tiles: Ensure to response correct panel on drag or resize. (#1422)
Use `item_id` to store the dragging and resizing item.
2025-10-23 11:29:39 +00:00
Copilot
08b5013b36
theme: Update scrollbar background color to transparent for all themes. (#1421)
## Problem

When scrolling quickly, a distracting background color was appearing in
the scrollbar area, as shown below:

<img
src="https://github.com/user-attachments/assets/c9ebe200-a6b2-47ca-992d-ceaa5ed3db04">

## Root Cause

Several theme files had scrollbar background colors configured with
partial transparency (alpha values like `33`, `44`, `80`, etc.) instead
of full transparency (`00`). This caused a semi-transparent background
to become visible during fast scrolling, creating an unwanted visual
artifact.

## Solution

Updated all `scrollbar.background` color values to use full transparency
by setting the alpha channel to `00`. This ensures the scrollbar
background is completely invisible across all themes, with only the
scrollbar thumb (the draggable indicator) remaining visible.

## Changes

Modified 7 theme files with non-transparent scrollbar backgrounds:

- **alduin.json**: `#28282833` → `#28282800`
- **hybrid.json**: `#E0E0E044` → `#E0E0E000`, `#1D1F2144` → `#1D1F2100`
- **jellybeans.json**: `#26262633` → `#26262600`
- **mellifluous.json**: `#fafafa33` → `#fafafa00`
- **molokai.json**: `#FEFAF933` → `#FEFAF900`
- **solarized.json**: `#EEE8D533` → `#EEE8D500`, `#002b3633` →
`#002b3600`
- **default-theme.json**: `#fafafa80` → `#fafafa00`, `#17171780` →
`#17171700`

All other themes already had transparent scrollbar backgrounds and
remain unchanged.

## Impact

- Eliminates the visual glitch where a background color appears during
fast scrolling
- Provides a consistent, clean scrollbar appearance across all 20 themes
plus the default theme
- No functional changes to scrollbar behavior - only visual appearance
- Total of 37 scrollbar.background entries now fully transparent

Fixes the issue reported by @huacnlee in the comments.





<issue_title>A different background color appears when the scroll bar
scrolls quickly</issue_title>
&gt;<issue_description>A different background color appears when the
scroll bar scrolls quickly
&gt; 
&gt;<img
src="https://github.com/user-attachments/assets/c9ebe200-a6b2-47ca-992d-ceaa5ed3db04"></issue_description>
&gt; 
&gt;<agent_instructions>Make change to update scrollbar background color
to transparent for all themes.</agent_instructions>
&gt; 
&gt; ## Comments on the Issue (you are @copilot in this section)
&gt; 
&gt;<comments>
&gt;<comment_new><author>@huacnlee</author>
&gt; That is the scrollbar background color. I am still on to consider
removing that color.</comment_new>
&gt;</comments>
&gt;

Fixes longbridge/gpui-component#1402

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>A different background color appears when the scroll bar
scrolls quickly</issue_title>
> <issue_description>A different background color appears when the
scroll bar scrolls quickly
> 
> <img width="1338" height="387" alt="Image"
src="https://github.com/user-attachments/assets/c9ebe200-a6b2-47ca-992d-ceaa5ed3db04"
/></issue_description>
> 
> <agent_instructions>Make change to update scrollbar background color
to transparent for all themes.</agent_instructions>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> <comment_new><author>@huacnlee</author><body>
> That is the scrollbar background color. I am still on to consider
removing that color.</body></comment_new>
> </comments>
> 


</details>

Fixes longbridge/gpui-component#1402

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute
survey](https://survey3.medallia.com/?EAHeSx-AP01bZqG0Ld9QLQ).

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: huacnlee <5518+huacnlee@users.noreply.github.com>
2025-10-23 18:13:33 +08:00
Jason Lee
6dd857a7f7
input: Fix may flash scroll when move cursor in auto grow mode. (#1419) 2025-10-23 17:43:33 +08:00
Floyd Wang
b80fca28c1 Bump v0.3.0-preview2 2025-10-23 16:36:23 +08:00
Jason Lee
b42a429fdc
input: Fix Input to prepare text wrapper. (#1417)
To ensure call update_all in TextWrapper.
2025-10-23 08:03:38 +00:00
Jason Lee
804a89df20
chore: Update GPUI v0.2.2 (#1416) 2025-10-23 07:41:50 +00:00
Copilot
3c6a7b6a9b
highlighter: Make SyntaxHighlighter::styles method public for external use (#1415) 2025-10-23 10:34:13 +08:00
Jason Lee
ab104b6ba9 docs: Update docs links. 2025-10-22 22:27:49 +08:00
Jason Lee
5153e67691
docs: Update dark theme logo. (#1412) 2025-10-22 22:09:30 +08:00
Stephan Aßmus
5ccdba41af
Call dropdown item's display_title() method also for rendering within the dropdown when open (#1410)
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
2025-10-22 11:35:34 +08:00
Jason Lee
df2d6967ca
docs: Add Theme, RootView doc. (#1408) 2025-10-22 00:02:36 +08:00