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"
/>
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))
```
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"
/>
- 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>");
```
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 {
```
## 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)
## 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>
## 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()
```