Commit graph

875 commits

Author SHA1 Message Date
Jason Lee
989e85211a doc: Update README to add features. 2025-06-04 19:26:41 +08:00
Floyd Wang
516c8fada4
chart: Introduce chart (#878)
Add a new component called `plot`. It provides a low-level approach to
data analysis and visualization.
Chart is a collection of ready-to-use chart components built with
`plot`.

| Light | Dark |
| - | - |
| <img width="1712" alt="SCR-20250604-qhxb"
src="https://github.com/user-attachments/assets/bf7ce76e-ab7a-42c2-92e7-17cd135de66f"
/> | <img width="1712" alt="SCR-20250604-qhxr"
src="https://github.com/user-attachments/assets/dd3e44ea-bbb5-41a2-8cce-38b316d7d800"
/> |
2025-06-04 19:22:11 +08:00
Jason Lee
7934e8af31 story: Fix double border in ResizableStory. 2025-06-04 18:11:00 +08:00
Jason Lee
c97cdd7b89
input: Fix line number width, when line number not enable. (#916) 2025-06-03 23:40:21 +08:00
Jason Lee
2b796c94e9
highlighter: Improve performance for large file. (#911)
Still need to improve.

This version can work smooth when the file lines are less than 5000
lines.

> cargo run --release on MacBook Pro, Apple M3 CPU

- Editing at 110 FPS+
- Display at 120 FPS.

<img width="977" alt="image"
src="https://github.com/user-attachments/assets/37958bcb-20d8-486b-8c50-2728d16f971b"
/>
2025-06-03 23:20:33 +08:00
Floyd Wang
dc1d516a30
button: Impl Selectable for the dropdown button (#913)
## Break Change
- Add `is_selected` to the `Selectable` trait; Returns true if the
element is selected.
2025-06-02 14:25:18 +08:00
Jason Lee
901312bc5a
chore: Switch gpui to depends on Zed official. (#912)
Now, GPUI have merged `window_handle` support for all platforms.

- https://github.com/zed-industries/zed/pull/24327
- https://github.com/zed-industries/zed/pull/24545
- https://github.com/zed-industries/zed/pull/28152

It's time to depends on Zed official main branch.
2025-06-02 10:05:45 +08:00
Jason Lee
a4aff404ce
highlighter: Use tree-sitter to highlight code. (#904)
<img width="1318" alt="image"
src="https://github.com/user-attachments/assets/4a8e7b93-a7e7-4648-b8da-c5a6e7ede4f9"
/>
<img width="1318" alt="image"
src="https://github.com/user-attachments/assets/bfc35845-719f-4c97-bf50-087feb0f6775"
/>
2025-05-29 19:54:52 +08:00
Floyd Wang
838ffe0a79
modal: Display overlay at the correct z-index (#909)
| Before | After |
| - | - |
| <img width="1712" alt="SCR-20250528-ksil"
src="https://github.com/user-attachments/assets/3725f142-0792-478a-ac7e-1a9c5604821a"
/> | <img width="1712" alt="SCR-20250528-krmi"
src="https://github.com/user-attachments/assets/b0fac5db-97b2-4ebd-83e2-94786950185c"
/> |
2025-05-28 11:57:23 +08:00
Floyd Wang
49f1ac511d
form: Add text wrapping support for label (#907) 2025-05-27 19:31:06 +08:00
Jason Lee
bad9506ebb
inspector: Fix Inspector on release build. (#906) 2025-05-27 18:51:57 +08:00
Jason Lee
372c78fac6
input: Fix enter newline position incorrect by #901 change. (#905) 2025-05-27 17:25:54 +08:00
Jason Lee
0389608f59 chore: Update GPUI and fix Edges type chagnes. 2025-05-27 09:54:13 +08:00
Jason Lee
9073818d4e
input: Fix outdent when selection first line is no indent. (#903)
## Before


https://github.com/user-attachments/assets/67f94a09-b01b-43e4-9809-2e876f53a7b7

## After


https://github.com/user-attachments/assets/0ff7fee8-cbbc-4f55-8877-96c7ad07d662
2025-05-26 22:46:26 +08:00
Jason Lee
5419600fcd
input: Fix Input may out of char boundary (#901)
```
byte index 3 is not a char boundary; it is inside '吧' (bytes 1..4) of `L吧2`:    0: <unknown>
```
2025-05-26 22:42:31 +08:00
Jason Lee
1cbbf6ef18
code-editor: Improve CodeEditor to has default themes. (#900) 2025-05-26 18:17:15 +08:00
Floyd Wang
ebe10e20c7
alert: Add support for text wrapping (#899)
<img width="935" alt="image"
src="https://github.com/user-attachments/assets/6eb10c67-5301-4414-af7f-9b4444b77fb6"
/>
2025-05-26 17:09:12 +08:00
Jason Lee
0a9de15d79
input: Change InputState::disabled to as builder method. (#898)
## Break Changes

- The `disabled` method now is for builder method, and `is_disabled` for
get state.

```diff
- pub fn disabled(mut self) -> bool
+ pub fn is_disabled(&self) -> bool
+ pub fn disabled(mut self, disabled: bool) -> Self
```
2025-05-26 17:00:17 +08:00
Jason Lee
1c11b5fb55
inspector: Add Inspector. (#897)
<img width="1434" alt="image"
src="https://github.com/user-attachments/assets/f6ec2e1d-ff1c-4798-90fe-d29bef20fa9d"
/>
2025-05-26 16:44:11 +08:00
Floyd Wang
a1ad647527
number_input: Add support for prefix and suffix (#896)
<img width="1097" alt="image"
src="https://github.com/user-attachments/assets/b4c1fc69-88ad-4ecd-b1c8-1a5a92836e82"
/>
2025-05-26 16:16:22 +08:00
Jason Lee
a95482fdd8
chore: Upgrade GPUI 2025/05/26 with inspector changes. (#895)
https://github.com/zed-industries/zed/pull/31315
2025-05-26 13:40:27 +08:00
Zimo Li
6f28df6a7d
Rename DEVELOPMENT to DEVELOPMENT.md (#894) 2025-05-26 13:35:33 +08:00
Jason Lee
c99e696cb1
code-editor: Update code highlight theme colors. (#888) 2025-05-25 10:21:37 +08:00
Jason Lee
f539817d9b
alert: Add banner mode and on_close to Alert. (#893)
## Break Changes

- The `Alert::new` method change to 2 args, first is `id`.

```diff
- fn new(message: impl Into<Text>) -> Self
+ fn new(id: impl Into<ElementId>, message: impl Into<Text>) -> Self
```

<img width="1120" alt="image"
src="https://github.com/user-attachments/assets/214df737-6129-4a53-8f3b-86e83bc8082b"
/>
2025-05-23 19:20:13 +08:00
Jason Lee
a1e2160083
menu: Fix sub-menu item height to match with other items. (#892) 2025-05-23 17:24:52 +08:00
Jason Lee
8dc9666214
input: Fix cursor and IME popup position when IME typing. (#889)
- Fix cursor position when IME typing.
- Fix selection range when canceled IME typing.
- Fix IME popup position to follow the cursor position.
- Fix IME text to render with underline style.

Close #55

<img width="1231" alt="image"
src="https://github.com/user-attachments/assets/c746703f-23de-4b3b-bd5b-210a8447eeba"
/>
2025-05-23 15:00:24 +08:00
Jason Lee
2c4a28a6da
code-editor: Add current line background. (#887)
https://github.com/user-attachments/assets/3ab6a1b5-648c-4431-91d2-7ebefee2f511
2025-05-22 23:03:53 +08:00
Jason Lee
2d6284694d
code-editor: Fix highlight offset on Windows. (#886)
Again, caused by need `split('\n')` not use `.lines()`.
2025-05-22 22:10:59 +08:00
Jason Lee
d0ccb6bf17
code-editor: Improve code highlight performance. (#885)
- Split code to lines to improve performance and cache hit rate, close
#881
- Update default code highlight theme to use `macOS Classic`.

<img width="1208" alt="image"
src="https://github.com/user-attachments/assets/511b442d-5960-493f-88cc-b8aceb68f77b"
/>
<img width="1208" alt="image"
src="https://github.com/user-attachments/assets/6e5b2728-384f-4b62-b069-268118dec9ab"
/>
2025-05-22 18:09:18 +08:00
Floyd Wang
244090ddc5
number_input: Remove InputEvent from NumberInputEvent (#884)
## Break Change
- Number input no longer emits `InputEvent`; you need an additional
subscription for `InputEvent`.
2025-05-22 14:38:43 +08:00
Jason Lee
119d348e4a
input: Fix indent, outdent to consider \r on Windows. (#880)
https://github.com/user-attachments/assets/c662c251-36e5-4a80-bad9-7438ba1b395c
2025-05-21 22:37:07 +08:00
Jason Lee
445b1e4e02
input: Fix click can not to position cursor on empty line on Windows. (#875)
Reverts longbridge/gpui-component#874

Ref https://github.com/zed-industries/zed/pull/31031
2025-05-21 10:01:53 +08:00
Jason Lee
1b13bd707a
input: Update GPUI for fix click can not to position cursor on a empty line on Windows. (#874)
https://github.com/zed-industries/zed/pull/31022
2025-05-20 23:09:24 +08:00
ZW
6a190da785
calendar: Support custom matcher (#873)
See #870
2025-05-20 21:07:17 +08:00
Jason Lee
e68419bc95
example: Add resizable feature to HTML, Markdown example. (#872) 2025-05-20 18:25:14 +08:00
Jason Lee
5658db42c7
input: Add CodeEditor mode. (#863)
## TODO

- [x] Cache highlight result.
- [x] Add a `code-editor` example with more languages test.
- [x] Support setup font to Input (Base on window scope text style).
- [x] Line number
- [x] Change font size and font family.
- [x] Enter newline to keep indent.
- [x] Height with flex_1
- [x] Add to support press `up`, `down` to move cursor to start or end
of the selection, if there is selected.
- [x] Add `Tab`, `Shift-Tab` to indent or outdent for cursor and
selection.
- [x] Double click to select at least 1 char.


https://github.com/user-attachments/assets/af74862d-15a9-4802-b4b4-2aeb606227ec
2025-05-20 15:51:00 +08:00
Jason Lee
67dd658635
input: Fix selection rendering for empty lines. (#868)
<img width="491" alt="image"
src="https://github.com/user-attachments/assets/b24e4fbc-40e8-4570-b254-2974aa7735a7"
/>
2025-05-19 20:32:46 +08:00
Jason Lee
b97abd6394
input: Fix auto-grow height. (#865)
Fix #864 

Updated InputState API to split `single_line`, `multi_line` and
`auto_grow`.

The `InputState::new` for default single_line, and added `multi_line`
and `auto_grow` to change other mode.

### With no wrap

https://github.com/user-attachments/assets/22a8f0d6-e264-4f39-bb30-386a41975d2b

### With soft wrap

https://github.com/user-attachments/assets/b71f0fb1-5937-470b-a278-8b1de7cfd7d7
2025-05-19 19:26:27 +08:00
Jason Lee
769b1887d0 dock: Ensure add panel to StackPanel is type of TabPanel or StackPanel. (#862) 2025-05-17 22:42:03 +08:00
Jason Lee
1e2cc8315a
dock: Show keybinding for ToggleZoom menu and button. (#861)
And binding `Shift-Esc` for example to toggle zoom panel, `Ctrl-W` for
close panel.


![image](https://github.com/user-attachments/assets/993dcbb3-ae39-467f-bf4c-d5faf5639b35)
2025-05-17 22:23:45 +08:00
Jason Lee
3c85ccbe2a
number_input: Fix NumberInput appearance by #858 change. (#860) 2025-05-17 10:51:04 +08:00
Jason Lee
bc398adbf3
input: Refactor Input, Picker as stateless mode. (#858) 2025-05-16 23:41:26 +08:00
Ratazzi
f3d97bf8e2
chore: Unify icon parameter types in ListItem and Dropdown. (#857)
## Changes

This PR unifies icon parameter types in UI components:

- Changed `ListItem.check_icon` parameter type from `IconName` to `impl
Into<Icon>`
- Changed `Dropdown.icon` parameter type from `impl Into<IconName>` to
`impl Into<Icon>`
- Updated related rendering logic

## Impact

- **API Consistency**: All components now accept the same icon parameter
type
- **Backward Compatible**: Existing code using `IconName` continues to
work
- **Enhanced Flexibility**: Components can now accept custom `Icon`
instances directly
2025-05-15 16:13:30 +08:00
Jason Lee
c0e0d82594
input: Add mask pattern to format display. (#854)
- Add `mask_pattern` to Input, NumberInput.
- Fix Input `set_text` to move cursor to end.

https://github.com/user-attachments/assets/2d7e362a-3f80-47a4-94e3-efd729bffcac
2025-05-14 22:27:46 +08:00
Jason Lee
1535df796e
resizable: Refactor to use stateless Resizable element. (#852)
## Break Changes

- The `ResizablePanelGroup` and `ResizablePanel` are changed to as
stateless element, please check out the diff to migrate.
2025-05-12 17:15:11 +08:00
Jason Lee
0a95f7c0f1
resizable: Add size_range to limit panel size and fix resize and initial_size of panel. (#844)
## Fix panel resize bug

- Fix some panel resizing details.
- Fix initial_size for panel and ensure split dock panel to get average
size.

### Before


https://github.com/user-attachments/assets/cd6c7e10-aec7-46a6-8a4d-11bf4d221f92

### After


https://github.com/user-attachments/assets/90c8b865-630a-4abd-98c9-310800b12fee
2025-05-12 11:07:06 +08:00
Michael Angerman
28582bc905
chore: Remove unused file text_view (#850)
The file text_view was empty.
So it does not need to be in the repo.
2025-05-12 10:40:00 +08:00
Jason Lee
8bea37ed74
dock: Update drop panel target mask to 50% of panel. (#845) 2025-05-09 22:55:48 +08:00
Jason Lee
d288a51e06
dock: Revert panel radio size to back to use Pixels type for panel size. (#842)
This PR to revert previous dock changes to back to use `Pixels` type for
panel size.

- #833 
- #839 
- #840
2025-05-09 16:47:24 +08:00
Losses Don
6caf6f95df
chore: Add Nix/Flake development environment. (#837) 2025-05-08 21:54:58 +08:00