Commit Graph

91 Commits

Author SHA1 Message Date
Jason Lee 2a3c297d76 focus_trap: Add to support focus_trap. (#1977)
https://github.com/user-attachments/assets/fc0b992e-4b7b-4315-98de-df21a42029f7
2026-01-28 03:15:46 +00:00
fhluo a93725f2d9 docs: Fix description list example (#1949)
Fix `DescriptionList` example to use the correct `item` method.
2026-01-16 09:44:16 +08:00
Floyd Wang bc5745c5af sidebar: Add context menu support (#1934)
This pull request enhances the sidebar and context menu functionality
with improved right-click context menu support and better event
handling.

- Added context menu support to `SidebarMenuItem`.
- Enhanced popover overlay dismiss behavior to handle both left and
right mouse clicks.

## Preview
<img width="381" height="285" alt="image"
src="https://github.com/user-attachments/assets/f0f61465-2fcc-4f1e-9160-5af7af0884b3"
/>
2026-01-14 07:46:53 +00:00
Jason Lee b86b3c753b hover_card: Add HoverCard component. (#1931)
https://github.com/user-attachments/assets/c3019ba5-a982-45ca-b1e4-8897b325f708
2026-01-14 03:38:44 +00:00
Floyd Wang 5a4026a567 sidebar: Add virtual list support (#1927)
This PR adds **virtual list support** to the `Sidebar` component,
significantly improving performance when rendering large numbers of menu
items. The implementation uses GPUI's `ListState` for virtualized
rendering, ensuring smooth scrolling even with hundreds of sidebar
items.

Additionally, this update refactors the `Sidebar` API to use a more
flexible builder pattern and introduces a new `SidebarItem` trait that
enables better composition of sidebar elements including `SidebarMenu`,
`SidebarMenuItem`, and `SidebarGroup`.

## Breaking changes
- An `id` is required when creating a `Sidebar`.
```diff
- Sidebar::new()
+ Sidebar::new("sidebar1")
``` 

- Removed the left and right methods; use side instead.
> Default is left.
```diff
- Sidebar::right()
+ Sidebar::new("sidebar1").side(Side::Right)
```

- Use the builder pattern for the `suffix` of `SidebarMenuItem`.
```diff
- this.suffix(IconName::Settings2)
+ this.suffix(|_, _| Icon::new(IconName::Settings2))
```
2026-01-14 03:15:03 +00:00
Jason Lee 19aa045325 popover: Add center anchor support for Popover. (#1929)
Closes #1688

<img width="1124" height="884" alt="image"
src="https://github.com/user-attachments/assets/176c77c7-38c0-4e4d-b9d3-651a04b5a5a5"
/>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-13 11:24:21 +00:00
Jason Lee fef2f050eb docs: Add GPUI Skills. (#1923) 2026-01-12 22:31:40 +08:00
Jason Lee 2af1007a6d progress: Add ProgressCircle. (#1918)
## Break Changes

- Renamed `bg` method to `color` for Progress.

<img width="1174" height="987" alt="image"
src="https://github.com/user-attachments/assets/cc6066a7-42f8-4e2a-b47f-a39de768a5e9"
/>
2026-01-12 15:08:03 +08:00
Jason Lee 919c2a0b72 list: Update to hide section if items is empty. (#1911)
Closes #1895

- If the section have 0 items, the section will be hide.
- Fix move up, down to skip empty sections.
- Ensure `section_count` min `1`.

## Show case

In this example section 0, 2, 3 have no items, not it not show.

<img width="1007" height="778" alt="image"
src="https://github.com/user-attachments/assets/99746885-8b0d-49af-88c9-899ff77cffac"
/>
2026-01-08 14:21:11 +00:00
Jason Lee 5242461553 rating: Add Rating component. (#1887)
<img width="940" height="719" alt="image"
src="https://github.com/user-attachments/assets/b7048fd4-537d-4ab4-af6c-8e4e6d40ec71"
/>
2026-01-02 10:42:17 +00:00
yoogo 6d9f1b7e99 tree: Add set_selected_item method. (#1871)
Closes #1869

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-12-31 02:05:52 +00:00
John c3ca1e287b pagination: Add Pagination component (#1791)
## Screenshot

<img width="1192" height="829" alt="image"
src="https://github.com/user-attachments/assets/ed11b563-6d1f-4b08-bf4a-a9d65967c555"
/>

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-12-26 08:15:48 +00:00
Jason Lee 88fda36351 progress: Add animation to Progress. (#1829)
https://github.com/user-attachments/assets/c57a423a-1272-47ce-aa02-652986d0727f
2025-12-18 13:35:50 +00:00
Jason Lee 2ad2a47934 stepper: Add Stepper. (#1810)
<img width="1199" height="1056" alt="image"
src="https://github.com/user-attachments/assets/3393041b-58bc-461b-9959-8213cc46ff84"
/>

<img width="1263" height="1108" alt="image"
src="https://github.com/user-attachments/assets/02f23c23-f847-44fa-abf6-1ba1e580581c"
/>
2025-12-17 10:58:31 +00:00
Jason Lee 67608353f2 text_view: Add markdown, html method to short use. (#1790)
- Added `markdown`, `html` simple method to create a TextView.

```diff
- TextView::markdown("text1", "Hello world", window, cx);
+ markdown("Hello world")
```

- Added `TextView::new(&text_view_state)` to support managed
TextViewState.
- Added `push_str` method to TextViewState for stream update content to
reparse. And also added a `crates/story/examples/stream_markdown.rs`
example.

> NOTE: Still not have increment parse, the `push_str` just update the
text and full reparse the Markdown agian.


https://github.com/user-attachments/assets/0372828e-25b5-48f7-a318-ac00d41c5984


## Break Change

- Reduced arguments of the `TextView::markdown` and `TextView::html`,
not need `window` and `cx`.

```diff
- TextView::markdown("text1", "Hello world", window, cx);
+ TextView::markdown("text1", "Hello world");

- TextView::html("text1", "<p>Hello world</p>", window, cx);
+ TextView::html("text1", "<p>Hello world</p>");
```
2025-12-11 19:37:19 +08:00
Tajang ffb3a60ce5 docs: Add anyhow dependency to Getting Started. (#1772) 2025-12-09 15:20:09 +08:00
Jason Lee 1d8f9bdd1b webview: Split a gpui-wry crate for WebView. (#1759)
## Break Change

- Removed `webview` feature, use `gpui-wry` crate instead.
2025-12-08 07:33:23 +00:00
Floyd Wang 8bb9d7f654 list, table: Rename both delegate is_eof to has_more (#1757)
Previously, we misused the meaning of is_eof and treated it with the
opposite semantics.

* Rename both delegate `is_eof` to `has_more`.
* Set default value to `false`.

## Breaking Change
```diff
- fn is_eof(&self, cx: &App) -> bool {
+ fn has_more(&self, cx: &App) -> bool {
```
2025-12-08 10:46:54 +08:00
amiyzku f705d10f72 chart: Add candlestick chart (#1749)
## Description

Add `CandlestickChart` component for visualizing financial OHLC data
with candlestick patterns.

- Introduced a new CandlestickChart for displaying OHLC (Open, High,
Low, Close) values.
- Updated ChartStory to include stock price data and render multiple
candlestick chart variations.
- Enhanced theme with bullish and bearish colors for candlestick
representation.
- Updated documentation to include CandlestickChart examples and usage.

This addition enhances the charting library by providing a crucial tool
for visualizing stock market trends.

## Screenshot

<img width="1335" height="423" alt="image"
src="https://github.com/user-attachments/assets/5df7078e-a469-4262-b645-6434d08b7ccf"
/>

## How to Test

```bash
cargo run -p gpui-component-story
```

## Checklist

- [x] I have read the [CONTRIBUTING](../CONTRIBUTING.md) document and
followed the guidelines.
- [x] Reviewed the changes in this PR and confirmed AI generated code
(If any) is accurate.
- [x] Passed `cargo run` for story tests related to the changes.
- [ ] Tested macOS, Windows and Linux platforms performance (if the
change is platform-specific)
2025-12-05 18:24:25 +08:00
Jason Lee 893155bcee docs: Fix typo in notifications doc. (#1747)
Close #1745
2025-12-05 07:25:09 +00:00
Jason Lee ec097ed406 docs: Fix footer display. (#1727) 2025-12-02 19:24:14 +08:00
Jason Lee 4ded78ed30 dock: Refactor Panel trait to has &mut self and &mut Context<Self>. (#1716)
Continue #1712, #1713

## Description

Also change the `Panel` trait to has `&mut self` and `&mut
Context<Self>`.

## Break Changes

The methods `title`, `title_prefix`, `set_zoomed`, `set_active`,
`dropdown_menu`, `toolbar_buttons`, `on_added_to`, `on_removed` has
changed `&self` to `&mut self`, and `cx: &App` to `cx: &mut
Context<Self>`.

```diff
- fn title(&self, window: &Window, cx: &App) -> AnyElement
+ fn title(&mut self, window: &Window, cx: &mut Context<Self>) -> AnyElement
```
2025-12-01 17:57:18 +08:00
Andreas Johansson 7e479aa7f2 input: Add to support CodeEditor as single line mode. (#1696)
## Screenshot

From `input_story`:

<img width="1069" height="122" alt="Screenshot From 2025-11-28 09-14-03"
src="https://github.com/user-attachments/assets/f14ef2fc-4939-4ceb-be3e-bede492f8602"
/>

## Breaking Changes

- `.multi_line()` was changed to `.multi_line(bool)`.  
- Removed pub `InputMode`, this should only for internal.

```diff
InputState::new(window, cx)
-    .multi_line()
+    .multi_line(true)
```

## Checklist

- [x] I have read the [CONTRIBUTING](../CONTRIBUTING.md) document and
followed the guidelines.
- [x] Reviewed the changes in this PR and confirmed AI generated code
(If any) is accurate.
- [x] Passed `cargo run` for story tests related to the changes.
- [ ] Tested macOS, Windows and Linux platforms performance (if the
change is platform-specific)

Use cases,

1) In my API client, I have a tree sitter language for the URL input,

<img width="1001" height="162" alt="Image"
src="https://github.com/user-attachments/assets/9771decf-b0b7-4230-8ed6-784a95b72af1"
/>

2) In my SQL editor I want to be able to allow JSON syntax highlighting
for inline editing of json columns,

<img width="501" height="130" alt="Image"
src="https://github.com/user-attachments/assets/f0f879cc-841f-49d2-a23a-2effc3747f38"
/>

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-11-28 19:51:40 +08:00
Jason Lee 660c88cc21 docs: Add icons for page background to website. (#1701) 2025-11-28 07:14:43 +00:00
Jason Lee 118a0f500e scrollbar: Introduce overflow_scrollbar to adds Scrollbars to elements. (#1694)
## Description

1. Add `overflow_scrollbar`, `overflow_y_scrollbar`, `overflow_x_scroll`
to GPUI elements to let them has scrollbars. It is almost like the
`overscroll` but adds the Scrollbar.
2. And adjust the display scrollbar of margining 4px of the container.
3. Add `scrollbar`, `vertical_scrollbar`, `horizontal_scrollbar` with
your own scroll handle.

<img width="1181" height="911" alt="image"
src="https://github.com/user-attachments/assets/8b02cd54-d527-4f22-b9be-f762ede22122"
/>

## Break Changes

- There `Scrollable` trait and it `scrollable` method has been removed.

```diff
- div().id("contents").scrollable(Axis::Vertical)
+ div().id("contents").overflow_y_scrollbar()
```
2025-11-27 11:29:50 +00:00