Commit Graph

76 Commits

Author SHA1 Message Date
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
Jason Lee 4a3f520c5f scrollbar: Manage ScrollbarState in Scrollbar internal. (#1690)
This PR to improve the Scrollbar API to manage the state in the
internal.

## Break Changes

Describe any breaking changes introduced by this pull request. If none,
remove this section.

- Removed `scrollbar_state` argument from `Scrollbar::new`,
`Scrollbar::both`, `Scrollbar::vertical` and `Scrollbar::horizontal`.

```diff
- Scrollbar::horizontal(&self.scrollbar_state, &self.scroll_handle)
+ Scrollbar::horizontal(&self.scroll_handle)

- Scrollbar::vertical(&self.scrollbar_state, &self.scroll_handle)
+ Scrollbar::vertical(&self.scroll_handle)
```

- Change `struct ScrollbarState` to private, we not need this not.

```diff
- pub struct ScrollbarState {
+ struct ScrollbarState {
```

- Renamed `trait ScrollHandleOffsetable` to `trait ScrollbarHanle`.

```diff
- pub trait ScrollHandleOffsetable {
+ pub trait ScrollbarHanle {
```

- Removed `Scrollbar::both`, now use `Scrollbar::new` instead.

```diff
- Scrollbar::both(&scroll_handle)
+ Scrollbar::new(&scroll_handle)
```
2025-11-27 11:39:58 +08:00
Floyd Wang 0d167f61e5 plot: Add support for stacked chart (#1681)
## Description

- Add `stack` shape.
- Add `ordinal` scale.
- Add plot docs.

<img width="337" height="424" alt="SCR-20251126-puzm"
src="https://github.com/user-attachments/assets/eff9e2d0-c13a-449a-b717-9568e0c2f88d"
/>

## Breaking change
The bar shape `y0` value is now returned for each data item.

```diff
- Bar::new().y0(height)
+ Bar::new().y0(move |_| height)
+ Bar::new().y0(move |d| d.height)
```
2025-11-26 10:24:57 +00:00
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 44829a05e4 setting: Add SettingFieldElement trait. (#1657)
Co-authored-by: Sunli <scott_s829@163.com>
2025-11-21 10:48:29 +00:00
Andreas Johansson ffeeee5d12 docs: Fix minor docs issues (#1656)
Fixes #1643 by removing invalid docs
2025-11-21 17:34:30 +08:00
Jason Lee c8652f9010 setting: Add Settings component. (#1632)
https://github.com/user-attachments/assets/3c6315d9-1183-419c-bb17-a8f7ac0cf25c
2025-11-20 13:51:44 +00:00
grubby d251a9b08b icon: Rework icons to make use of the IconNamed trait (#1640)
This makes use of the `IconNamed` trait and a blanked implementation to
convert anything that implements this to an `Icon`.

This allows for easily defined custom versions of `IconName`, while
minimally changing existing code (essentially only if you previously
made use of the `.path()` method on the `IconName` enum; this now
requires an import of the `IconNamed` trait).

# Example
```rust
use gpui_component::IconNamed;

pub enum IconName {
    Encounters,
    Monsters,
    Spells,
}

impl IconNamed for IconName {
    fn path(self) -> gpui::SharedString {
        match self {
            IconName::Encounters => "icons/encounters.svg",
            IconName::Monsters => "icons/monsters.svg",
            IconName::Spells => "icons/spells.svg",
        }
        .into()
    }
}

// this allows for the following interactions (works with anything that has the `.icon(icon)` method
Button::new("my-button").icon(IconName::Spells);
Icon::new(IconName::Monsters); 
```

If you want to directly "render" a custom `IconName` you must implement
the `RenderOnce` trait and derive `IntoElement` on the `IconName`.

```rust
use gpui::{IntoElement, RenderOnce};
use gpui_component::IconNamed;

#[derive(IntoElement)]
pub enum IconName {
    // The same as before
}

impl IconNamed for IconName {
    // The same as before
}

impl RenderOnce for IconName {
    fn render(self, _: &mut gpui::Window, _: &mut gpui::App) -> impl gpui::IntoElement {
        gpui_component::Icon::empty().path(self.path())
    }
}

// this allows for the following interaction
div()
    .child(IconName::Monsters)
```

Overall I think is an improvement to the existing way to do custom
`IconName` implementations.

I am unsure if this change should also be reflected in the documentation
on the section with "Icons & Assets", though I personally think it would
make sense to highlight this way to do custom versions of `IconName` as
it is considerably less involved than the current approach.

Closes #1627.

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-11-20 02:30:08 +00:00
Jason Lee 96c34a9fb0 sidebar: Improve Sidebar to allows caret icon to expand submenu. (#1642)
https://github.com/user-attachments/assets/7cd4ef52-e633-4db4-bdba-2912bba2120d
2025-11-19 05:39:24 +00:00
Jason Lee 01082f11d2 button: Add dropdown_caret option to show a caret icon to end of button. (#1637)
<img width="658" height="162" alt="image"
src="https://github.com/user-attachments/assets/7c233982-04c3-408c-8ae4-f672f8b135a3"
/>
2025-11-18 16:41:16 +08:00
Jason Lee 4f882a1b98 docs: Little adjust logo border and radius. (#1635) 2025-11-18 14:57:31 +08:00
Jason Lee f8a7dd71bf dropdown_button: Add more button option methods to DropdownButton. (#1633)
- Fix to not handle `dropdown_menu` when Button is disabled.
- Split a single DropdownButtonStory.
2025-11-18 14:31:14 +08:00
Jason Lee 672a80dcd8 docs: Remove index page warrning. 2025-11-17 10:22:01 +08:00
Andreas Johansson 0e8b8761a4 docs: Fix theme_name type (#1614) 2025-11-17 09:56:24 +08:00
Jason Lee 7de69d1dd1 assets: Move assets files into crates/assets folder for crate publish. (#1609) 2025-11-14 19:00:29 +08:00
Jason Lee ec3eda60e0 docs: Fix button gap. (#1608) 2025-11-14 18:46:23 +08:00