Commit graph

181 commits

Author SHA1 Message Date
Jason Lee
429a4b2858
example: Add input example. (#1380) 2025-10-15 05:40:36 +00:00
Jason Lee
4ccd7d99d0
examples: Add examples folder. (#1378) 2025-10-15 02:26:13 +00:00
Jason Lee
6998708b81
Revert "chore: Update GPUI dependency." (#1376)
Reverts longbridge/gpui-component#1374

Because `gpui v0.2.1` have but, the text render not in vertical center.
2025-10-14 21:41:31 +08:00
Jason Lee
e56c7a39bf
chore: Update GPUI dependency. (#1374) 2025-10-14 12:37:15 +00:00
Jason Lee
ca9d5b77e2 chore: Release v0.2.0 2025-10-09 15:21:10 +08:00
Jason Lee
6ca9ac46fa
chore: Bump crate version. (#1340) 2025-10-09 15:20:34 +08:00
Floyd Wang
66851c55e4 Bump gpui (#1336) 2025-10-08 11:20:06 +08:00
Jason Lee
d0396d779e
editor: Add document_colors LSP. (#1329) 2025-10-06 18:08:12 +08:00
Floyd Wang
1358b2906e
Bump gpui (#1324)
* Wireup the `Pixels` change
https://github.com/zed-industries/zed/pull/39367.
2025-10-03 14:32:29 +08:00
Carlo Corradini
908c022efe
chore: Assets interpolate folder path via rust embed (#1318)
Use `rust-embed` feature `interpolate-folder-path` to always
(`debug`/`release`) load assets from the correct `assets` directory
2025-10-02 16:04:33 +08:00
Jason Lee
69af1be6e5
chore: Update GPUI and fix DeferredScrollToItem API changes. (#1315) 2025-09-30 16:10:25 +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
Copilot
ed05c3ebec
chore: Remove Wef code as it has been extracted to separate repository (#1302)
All WEF (Web Embedding Framework) related code has been successfully
removed from the repository as it has been extracted to
https://github.com/longbridge/wef

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: huacnlee <5518+huacnlee@users.noreply.github.com>
2025-09-29 15:31:58 +08:00
Sunli
b8651515f0
chore: Remove unnecessary RefCell (#1301) 2025-09-29 14:39:04 +08:00
Sunli
3413c33d1c
chore: use async-wry (#1300) 2025-09-29 13:32:12 +08:00
Jason Lee
8f5bff61fb
chore: Fix sum_tree API changes. (#1286)
https://github.com/zed-industries/zed/pull/38776
2025-09-25 10:41:37 +08:00
Jason Lee
1c3eca93b8
editor: Revert to use ropey. (#1284)
For the License reason.

- The performance is slow down, before version can handle 200K lines,
now 150K lines is good.
2025-09-24 20:52:18 +08:00
Jason Lee
993ce34bd8
editor: Avoid scroll on select all. (#1277)
- Add `replace_text_in_range_silent` for some case to avoid show
completion, for example on cut, paster ...
- Improve to only call validation, mask on single line mode.
- Improve move cursor to scroll to visible to keep edge 3 lines.

https://github.com/user-attachments/assets/ca8bcca8-a55b-4c98-af7c-7639d1c34923

- Fix `RopeExt::offset_to_position` may crash.
- Add deffered_scroll_offset to improve paste to scroll to cursor.

https://github.com/user-attachments/assets/1af09a50-37f0-47c8-8185-4b78820d064a
2025-09-23 15:59:48 +08:00
Jason Lee
455605d64b
menu: Fix to support keyboard to select menu items. (#1263)
- And add to support scroll to selected item.

---------

Co-authored-by: Floyd Wang <gassnake999@gmail.com>
2025-09-22 21:47:30 +08:00
Floyd Wang
d3d2a9ee49 chore: Remove gpui test-support feature 2025-09-19 17:38:42 +08:00
Jason Lee
51efa766ea
editor: Improve search to select first match in visible range. (#1258) 2025-09-18 16:07:35 +08:00
Jason Lee
8a3ef51ea1
input: Add to support search and replace. (#1252)
<img width="806" height="765" alt="image"
src="https://github.com/user-attachments/assets/5e2a7144-f814-4874-b9c1-89ebf5d942ec"
/>

- Close #1212 to support search for Input.
- Fix #1235 to support scroll to cursor when go to line.
2025-09-17 19:02:00 +08:00
dependabot[bot]
30b4723853
build(deps): bump gpui from 9c548a0 to 53b2f37 (#1248) 2025-09-15 23:47:25 +08:00
Jason Lee
f1b6d7c5ed editor: Add completion, code_action provider. (#1242) 2025-09-15 19:25:02 +08:00
Jason Lee
da85754b96
input: Refactor diagnostics. (#1240)
<img width="613" height="530" alt="image"
src="https://github.com/user-attachments/assets/be86658d-706c-411c-8ba6-09b495208051"
/>

## Break Changes

- The `Markers` has been renamed to use `Diagnostics`.
- The `input::LineNumber` has renamed to `input::Position` and changed
from 1-based to use 0-based.
- Renamed `go_to_line` to `set_cursor_position`, `line_column` to
`cursor_position`.

```diff
- pub fn line_column(&self) -> LineColumn
+ pub fn cursor_position(&self) -> Position

- pub fn go_to_line(&mut self, line: usize, column: Option<usize>, window: &mut Window, cx: &mut Context<Self>)
+ pub fn set_cursor_position(&mut self, position: impl Into<Position>, window: &mut Window, cx: &mut Context<Self>)
```
2025-09-11 16:54:40 +08:00
Jason Lee
3fa996c331
input: Fix line column by use chars offset. (#1239)
- Add autocorrect to markdown example for test `markers`.

<img width="1104" height="590" alt="image"
src="https://github.com/user-attachments/assets/03103088-e828-4039-82b0-c816d5f36141"
/>
2025-09-10 20:56:15 +08:00
Jason Lee
844574befc
input: Fix track scroll to selected end on drag move. (#1231) 2025-09-10 13:59:02 +08:00
Jason Lee
a9953a9349
input: Use zed's Rope (#1214)
Now with 10K lines plain text, in release mode on macOS. The
`large-text` example can work with:

- 120 FPS for display.
- 90 FPS for update text.

```
MTL_HUD_ENABLED=1 cargo run --example large-text --release
```

- Fixed the cursor position at end of line, also support at start of
line.


https://github.com/user-attachments/assets/1de52f6c-e138-4ed3-a600-06372a807ed8

### Check list

- [x] Modifying Text with Rope
- [x] LineColumn, GoToLine
- [x] Code Highlight
- [x] Delete word, select word
- [x] Delete line
- [x] Move left, right, up, down
2025-09-08 16:44:52 +08:00
Jason Lee
344e4407ff
input: Use Rope for InputState. (#1208)
This PR to change the Input to use
[ropey](https://github.com/cessen/ropey) to store the text.

## Break Changes

- The `value` method of `InputState` now returns a `SharedString` type.

```diff
- pub fn value(&self) -> &SharedString
+ pub fn value(&self) -> SharedString
```

Ref links:

- https://github.com/cessen/ropey
- https://zed.dev/blog/zed-decoded-rope-sumtree
- https://github.com/helix-editor/helix/blob/master/docs/architecture.md
2025-09-05 18:20:47 +08:00
Chuqiao Feng
8992852165
inspector: Add live editor to inspector (#1205)
Inspired by Zed, this PR implements a simple live Rust and JSON style
editor for the inspector.

The rust style editor only supports `Styled` and `StyledExt` method
calls with no arguments.




https://github.com/user-attachments/assets/df7f1746-92d7-416c-afd5-e389ac3ea9ae

---------

Co-authored-by: Floyd Wang <gassnake999@gmail.com>
2025-09-05 11:58:36 +08:00
Jason Lee
2cfb5d24a9
highlighter: Use sum_tree to store the highlight cache. (#1198) 2025-09-03 14:09:46 +08:00
Jason Lee
e4a367f157
chore: Update GPUI to solve SVG rendering size. (#1189)
https://github.com/zed-industries/zed/pull/36663
2025-09-01 10:48:49 +08:00
Jason Lee
785df6a5ff
chore: Remove SvgImg element. (#1187)
## Break Change

- The `SvgImg` element has been removed.
This is a special implementation and should not be included in the GPUI
Component.
2025-08-29 17:37:11 +08:00
Floyd Wang
2a652dcc01
chore: Bump gpui & wireup Keystroke changes (#1176) 2025-08-27 17:44:10 +08:00
Jason Lee
396c8dbe63
theme: Improve theme color fallback to use blend to avoid alpha. (#1162)
Also updated the themes colors to match this default rule.
2025-08-20 16:37:46 +08:00
Jason Lee
6ae7558c44
theme: Add ThemeRegistry to load and watch themes dir. (#1148) 2025-08-18 19:29:27 +08:00
Jason Lee
dcca730d65
group_box: Add GroupBox element. (#1146)
Close #1144 

## Break Changes

- Renamed used theme variable `card`, `card_foreground` to `group_box`,
`group_box_foreground` for GroupBox.

<img width="1088" height="958" alt="image"
src="https://github.com/user-attachments/assets/adb1cbe6-fd6f-4d22-a434-39455f57ce09"
/>
2025-08-18 11:36:07 +08:00
Jason Lee
406bf8d929
chore: Fork html5minify for HTML render. (#1140)
Continue #1137 

Forked html5minify to improve:

- Resolve `\n` not replaced issue, now no need Regexp to replace.
- Resolve the difference version of html5ever dependency.
2025-08-15 11:10:23 +08:00
Jason Lee
899fbd693a
chore: Use html5minify instead of minify-html. (#1137)
Ref #1132 

This change to reduce release mode binary size from 21MB to 12MB.

## HTML Render example

<img width="1712" height="1312" alt="image"
src="https://github.com/user-attachments/assets/f07c02c9-1b0e-4aa4-b81a-d2b0ac4f7260"
/>
2025-08-15 09:52:38 +08:00
Jason Lee
9a389224f3
chore: Update GPUI and other crates. (#1136) 2025-08-14 19:57:53 +08:00
Jason Lee
63f61dca04
chore: Avoid built-in tree-sitter languages in default. (#1135)
With a `tree-sitter-languages` feature to enable it (Default not
enable).

Changed this for reduce the application size (From 52 MB to 22MB), Ref
#1132

Now default only includes `tree-sitter-json`, if you want more:

```toml
[dependencies]
gpui-component = { features = ["tree-sitter-languages"] }
```

---

```
cargo bloat -p hello_world --release -n 10
    Finished `release` profile [optimized] target(s) in 0.27s
    Analyzing target/release/hello_world

 File  .text    Size              Crate Name
 0.4%   1.4% 88.5KiB simple_minify_html simple_minify_html::code_gen::attrs::ATTRS::{{closure}}
 0.3%   1.0% 62.1KiB              taffy taffy::compute::grid::track_sizing::resolve_intrinsic_track_sizes
 0.1%   0.5% 32.6KiB     gpui_component gpui_component::theme::theme_color::ThemeColor::dark
 0.1%   0.5% 30.0KiB     gpui_component gpui_component::theme::theme_color::ThemeColor::light
 0.1%   0.5% 29.9KiB          html5ever html5ever::tree_builder::TreeBuilder<Handle,Sink>::step
 0.1%   0.4% 27.2KiB               gpui taffy::compute::flexbox::compute_flexbox_layout
 0.1%   0.4% 23.3KiB               usvg usvg::text::layout::layout_text
 0.1%   0.4% 22.5KiB              resvg resvg::filter::apply_inner
 0.1%   0.3% 21.4KiB               gpui jpeg_decoder::decoder::Decoder<R>::decode_internal
 0.1%   0.3% 21.2KiB         image_webp image_webp::lossless::LosslessDecoder<R>::decode_image_stream
25.3%  94.3%  5.7MiB                    And 14091 smaller methods. Use -n N to show more.
26.8% 100.0%  6.0MiB                    .text section size, the file size is 22.4MiB
```
2025-08-14 18:02:27 +08:00
Jason Lee
a73273a0f1
text_view: Use simple-minify-html instead of minify-html. (#1134)
To avoid depends on lightningcss, this is a heavy crate.

Ref #1132 

```
cargo bloat --release -n 200  --crates
    Finished `release` profile [optimized] target(s) in 0.30s
    Analyzing target/release/story

 File  .text     Size Crate
 4.6%  16.9%   3.4MiB lightningcss
```
2025-08-14 13:54:00 +08:00
Jason Lee
123a4a9fcd
chore: Update GPUI to fix click_count API changes. (#1123)
Closes #1116
2025-08-08 11:53:45 +08:00
Jason Lee
9a040eaaac
list: Refactor List, Dropdown delegate API to support section. (#1107)
Ref UITableView API:

https://developer.apple.com/documentation/uikit/uitableviewdatasource

## Changes

- Added some section related API to `ListDelegeate` and
`DropdownDelegate` with default implement, so if you don't need section
that you can just keep the default.
- Added `sections_count` method to get the number of sections, default
is 1.
- Added `render_section_header` for special the section header by if
needed, default return None.
- Added `render_section_footer` for special the section footer by if
needed, default return None.

## Break Changes

- The `DropdownState` have change new method to use IndexPath type:

  ```diff
  - DropdownState::new(vec![], Some(1), window, cx);
  + DropdownState::new(vec![], Some(IndexPath::new(1)), window, cx);
  ```

- The `ListDelegeate`, `DropdownDelegate` has changed API:
  - The `ix` are change from `usize` to `IndexPath`.

  ```diff
- fn render_item(&self, ix: usize, window: &mut Window, cx: &mut
Context<List<Self>>) -> Option<Self::Item>
+ fn render_item(&self, ix: IndexPath, window: &mut Window, cx: &mut
Context<List<Self>>) -> Option<Self::Item>

- fn set_selected_index(&mut self, ix: Option<usize>, window: &mut
Window, cx: &mut Context<List<Self>>)
+ fn set_selected_index(&mut self, ix: Option<IndexPath>, window: &mut
Window, cx: &mut Context<List<Self>>)
  ```

- The `items_count` method have added `section` argument to support list
section.
  
  ```diff
  - fn items_count(&self, cx: &App) -> usize
  + fn items_count(&self, section: usize, cx: &App) -> usize
  ```

- The `can_load_more` method has renamed to `is_eof` in `ListDelegate`
and `TableDelegate`.

  ```diff
  - fn can_load_more(&self, cx: &App) -> bool
  + fn is_eof(&self, cx: &App) -> bool
  ```

- The `can_search` method has renamed to `searchable` in `ListDelegate`.

  ```diff
  - fn can_search(&self) -> bool
  + fn searchable(&self) -> bool
  ```

## Showcase

<img width="1196" height="925" alt="image"
src="https://github.com/user-attachments/assets/22750abe-cc3f-427e-903b-51758bd4e027"
/>

<img width="1214" height="934" alt="image"
src="https://github.com/user-attachments/assets/52d42546-e6e7-4448-9c0f-43cd659fb630"
/>

---------

Co-authored-by: Floyd Wang <gassnake999@gmail.com>
2025-08-05 19:23:32 +08:00
Jason Lee
efa2c7c9ef
virtual_list: Add VirtualListScrollHandle to support scroll_to_item. (#1108)
- Also fixed Table scroll to selected column support.


https://github.com/user-attachments/assets/3b7c51a7-addf-4657-9f9f-de9047fffab8
2025-07-31 18:09:23 +08:00
Jason Lee
579c7a3cbb
virtual_list: Fix scrollable size calculate in VirtualList. (#1087)
The `virtual_list` scroll range issue because recently GPUI changed the
`ScrollHandle` API, now we only get the `max_offset`.

So #1086 have fixed this to implementation a `content_size` method to
calculate `max_offset` and `bounds` of the `ScrollHandle`.

But I found that the `Interactivity` prepaint (This is used in
VirtualList) was not to update the `bounds` of the `ScrollHandle`.

Wait https://github.com/zed-industries/zed/pull/35013 to merge.

| Before | After |
| -- | --- |
| <img width="620" alt="image"
src="https://github.com/user-attachments/assets/6ffb8f30-93b4-42ec-a837-90f80ecb2bf5"
/> | <img width="620" alt="image"
src="https://github.com/user-attachments/assets/21466332-030c-495f-8c84-e3a2c6eeb403"
/> |
- Split `Scrollbale` and `VirtualList` story.

## Break Changes

- The `content_size` argument has been removed from `virtual_list`
callback.
2025-07-24 08:30:42 +00:00
Cyandev
dfbda3999a
modal: Refine enter animation (#1080)
This PR adds a fade in animation for modals, which makes the UI looks
smoother.


https://github.com/user-attachments/assets/7671aa78-a3bd-43a6-ace7-d051d24f2523

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-07-23 10:29:42 +08:00
Jason Lee
7d3301d695
tab_bar: Fix some incorrect style in TabBar. (#1078)
This change to fix some incorrect style use, that will break in Taffy
0.5.2+

Ref https://github.com/zed-industries/zed/pull/34827

- Add `Tab::empty` to create a Tab without label.
- Fix form layout in Taffy new version.
- Update GPUI for scroll API changes.
2025-07-22 13:30:04 +08:00
Jason Lee
9c782796c2
theme: Improve theme color fallbacks based on base colors. (#1069)
- Added a lot of default fallbacks for theme colors based on `base`
colors.
- Added `hue`, `saturation`, `lightness` method to change Hsla color.
- Update stories to use theme colors, not a direct color.
- Improve `Badge`, `Avatar` to use theme colors.
- Added a new theme: `Fahrenheit`.
2025-07-17 11:43:40 +08:00
Jason Lee
977ce5df29
theme: Refactor Theme config to support JSONSchama. (#1068) 2025-07-16 19:22:09 +08:00