Commit graph

1029 commits

Author SHA1 Message Date
Jason Lee
e2153c9198
dock: Hide panel toolbar when dock is collapsed. (#1105) 2025-07-30 15:38:14 +08:00
Cyandev
b8db00dd3c
scrollbar: Reduce unnecessary frame updates (#1104)
The current scrollbar implementation calls
`Window::request_animation_frame` during the delay phase, which causes
unnecessary CPU usage. This PR updates the scrollbar to use a timer to
wait before starting the fade-out animation, allowing the CPU to remain
idle during this phase.

There is the comparison with Instruments.
**Before:**
<img width="632" height="75" alt="image"
src="https://github.com/user-attachments/assets/b407f1e5-8337-4f8f-b308-2cc16f6bf7ba"
/>

**After:**
<img width="608" height="75" alt="image"
src="https://github.com/user-attachments/assets/965787cf-1a42-413a-9a5e-ad0910c5cbee"
/>
2025-07-30 09:55:24 +08:00
Jason Lee
518004a014
input: Fix to let set_value works when Input is disabled. (#1103) 2025-07-29 17:55:53 +08:00
obito
7487662343
chrore: Refactor the disabled API for NumberInput, DatePicker, OtpInput, Calandar. (#1102)
- Added `disabled` method to OtpInput.
- Added `disabled` method to DatePicker.
- Added `disabled_matcher` method to CalendarState.

## Break Changes

- The `InputState` has been removed `disabled` and `set_disabled`
method, the disabled state should assign from TextInput element.

```diff
- let state = InputState::new("input1").disabled(true)
+ let state = InputState::new("input1");
+ TextInput::new(&state).disabled(true)
```

- Renamed `set_disabled` method to `set_disabled_matcher` from
`CalendarState`.
- Removed `set_disabled` method from `DatePickerState`, use
`disabled_matcher` method in `DatePicker` element.

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-07-29 17:31:52 +08:00
Floyd Wang
c07bc4aaad
list: Add support for scrolling to item with the given strategy (#1100)
## Breaking Change
- Add `strategy` to the `scroll_to_item` method.

```diff
+ list.scroll_to_item(selected, ScrollStrategy::Center, window, cx);
- list.scroll_to_item(selected, window, cx);
```
2025-07-29 15:14:26 +08:00
Jason Lee
771fd78416
tabs: Fix tab_bar_segmented default fallback color to secondary. (#1101) 2025-07-29 14:42:46 +08:00
Jason Lee
f423b8ffa2
table: Fix table head size. (#1099)
Close #1098, this issue was included from #1094
2025-07-29 10:03:25 +08:00
Jason Lee
058dd27687
tab: Fix tab text vertical center in small, xsmall size. (#1097) 2025-07-28 19:33:04 +08:00
Jason Lee
461ed9c173
chore: Fix Slider, Progress width in horizontal mode. (#1096)
This bug included since Taffy 0.8 update in
[#taffy](https://github.com/zed-industries/zed/pull/34939)
2025-07-28 18:56:09 +08:00
Jason Lee
93b578294c
list: Update ListItem and DropdownListItem style. (#1095)
## Break Change

- The `Selectable` trait has been removed `element_id` method, this is
necessary.
- The `item` of `List` now must impl `Selectable` trait.

## List

> NOTE: The default ListItem is no rounded and paddings.

<img width="1144" height="762" alt="image"
src="https://github.com/user-attachments/assets/32348682-f89a-487a-af9f-5ed379a7f2d8"
/>

## Dropdown

<img width="537" height="387" alt="image"
src="https://github.com/user-attachments/assets/3cc99d9f-3714-4d10-b467-6c91917bcbf0"
/>
2025-07-28 18:38:39 +08:00
Floyd Wang
6d0443998c
table: Fix the incorrect rendering of the header border (#1094) 2025-07-28 10:32:11 +08:00
Floyd Wang
75af2b31ba
story: Fix the startup error in the dock example (#1093) 2025-07-28 09:43:29 +08:00
Jason Lee
37aa26d655
check, radio: Add fade in animation to Checkbox and Radio. (#1092) 2025-07-24 11:41:34 +00:00
Jason Lee
479ab8f0d6
switch: Apply use_keyed_state to store toggle state for animation. (#1091)
Ref https://github.com/zed-industries/zed/pull/34741

Now `Switch` can use impl RenderOnce.
2025-07-24 19:22:55 +08:00
Jason Lee
76a64eb072
theme: Fix some theme's scrollbar background color. (#1090) 2025-07-24 16:54:04 +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
Jason Lee
56cf05b749
table: Fix horizontal scroll range when no fixed columns. (#1089) 2025-07-24 15:35:14 +08:00
Floyd Wang
634ab14306 button: Use muted foreground as disabled text color (#1088) 2025-07-24 14:19:10 +08:00
Cyandev
e9d8741835
scrollbar: Fix content size (#1086)
Caused by PR #1078 incorrect changes, and GPUI was changed API
https://github.com/zed-industries/zed/pull/34832

The content size of the scrollable area should be its max scroll offset
plus the container size.

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-07-24 10:20:04 +08:00
Jason Lee
fcf447d612
theme: Fix scrollbar default color and list hover color. (#1085) 2025-07-23 11:50:42 +00:00
Floyd Wang
6d28cce719
notification: Fix display issues caused by the taffy upgrade (#1084) 2025-07-23 19:12:13 +08:00
Jason Lee
f458cb83f8
accordion: Fix accordion to size full. (#1083)
- Remove `accordion.background` color from themes.
2025-07-23 10:45:02 +00:00
Floyd Wang
a2b91a7a2b
input(state): Provide context to the validate method (#1082) 2025-07-23 14:30:16 +08:00
Jason Lee
271116926c
code-editor: Add go_to_line method to CodeEditor. (#1081)
- Fix to emit `enter` press key in Input single-line mode.
2025-07-23 13:33:09 +08: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
61b7e54bfa
table: Refactor the Table API for describe the columns. (#1072)
## Break Changes

- The `ColFixed` has renamed to `ColumnFixed`.
- The `ColSort` has renamed to `ColumnSort`.

### TableDelegate

- Removed `col_name`, `col_resizable`, `col_selectable`, `col_width`,
`col_sort`, `col_fixed`, `col_paddings`, `col_movable` method, now use
`col` method to return a TableCol for describe of them.
- The `cols_count` method renamed to `columns_count`.

    ```diff
    - fn cols_count(&self, _: &App) -> usize
    + fn columns_count(&self, _: &App) -> usize
    ``` 
- The `move_col` has renamed to `move_column`.
- The `visible_cols_changed` has renamed to `visible_columns_changed`.

### TableEvent

```diff
- TableEvent::SelectCol
+ TableEvent::SelectColumn
- TableEvent::MoveCol
+ TableEvent::MoveColumn
- TableEvent::ColWidthsChanged
+ TableEvent::ColumnWidthsChanged
```
2025-07-21 11:16:35 +08:00
Floyd Wang
b7f443b73f
label: Streamline the test cases (#1074) 2025-07-18 17:10:36 +08:00
Floyd Wang
b553ca8dcc
label: Add support for highlighting specified text (#1073)
<img width="1712" height="1312" alt="SCR-20250718-ogsp"
src="https://github.com/user-attachments/assets/5f0043ef-77c7-4d91-ad99-4061b14497ff"
/>
<img width="1712" height="1312" alt="SCR-20250718-oguh"
src="https://github.com/user-attachments/assets/ed0bf114-37d0-458d-9321-82766fe75076"
/>
2025-07-18 16:33:36 +08:00
Jason Lee
7f3f2a3940
button: Fix selected style for outline button. (#1070) 2025-07-17 14:20:19 +08:00
Jason Lee
6a3a5f8a4c theme: Fix missed key warnings in theme files. 2025-07-17 11:54:19 +08:00
Jason Lee
3fd2fd9293 chore: Remove danger.foreground, danger.background from the required list in jsonschema. 2025-07-17 11:50:34 +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
Jason Lee
9166c1db25
Add .theme-schema.json 2025-07-16 18:23:38 +08:00
Jason Lee
ed75659765
table: Update to standardization the TableDelegate API. (#1067)
## Break Changes

- Renamed some method name of the TableDelegate.

```diff
- fn can_select_col
+ fn col_selectable

- fn can_resize_col
+ fn col_resizable

- fn col_padding
+ fn col_paddings

- fn can_move_col
+ fn col_movable
```

- Removed `fn can_loop_select` remove TableDelegate, instead of to use
`loop_selection` option on `Table`.
2025-07-16 17:11:49 +08:00
Jason Lee
ea1f5331c8
input: Hide cursor and selection when window is deactivated. (#1066) 2025-07-16 14:01:46 +08:00
Jason Lee
eca7949583
input: Update input behaviors to do not unselect on blur or press escape. (#1065)
- Also to pub `unselect` for manually use, and fix this method will
incorrect to move right 1 char.
2025-07-16 13:29:58 +08:00
Jason Lee
0fbe32c7d7
highlighter: Fix to support custom language register. (#1064) 2025-07-15 19:24:25 +08:00
Jason Lee
ffa0a2eb3a theme: Fix catppuccin theme button color. 2025-07-15 18:41:33 +08:00
Jason Lee
ac026e26c9
theme: Improve theme color fallbacks and add more themes. (#1063) 2025-07-15 18:33:36 +08:00
Jason Lee
51f03b926e
theme: Compact theme config files. (#1062) 2025-07-15 16:54:10 +08:00
Jason Lee
d139198c15
theme: Impl Default for Theme. (#1061) 2025-07-15 16:35:12 +08:00
Jason Lee
c9b5993472
story: Improve story case style. (#1060) 2025-07-15 11:56:07 +08:00
Jason Lee
cfd1551575
theme: Add more theme and fix to use default color from base color. (#1058) 2025-07-14 20:17:11 +08:00
Jason Lee
6508927e7f
input: Add appearance option to NumberInput, Dropdown, DatePicker to render without style. (#1054)
<img width="1100" height="935" alt="image"
src="https://github.com/user-attachments/assets/b213c778-eef0-4d63-8d07-b68da9a078b1"
/>
2025-07-14 19:57:56 +08:00
Jason Lee
867b4ff3a6
dock: Open dock if clicked on the tab of the collapsed bottom dock. (#1057) 2025-07-14 18:49:31 +08:00
Jason Lee
1df450d3b0
story: Fix tiles story. (#1056) 2025-07-14 18:06:46 +08:00
Jason Lee
44427afacb
theme: Add to support highlight color to theme config. (#1055)
<img width="1058" height="1026" alt="image"
src="https://github.com/user-attachments/assets/300fb16b-c5e4-4eef-9690-54fcabc4fe47"
/>
<img width="836" height="855" alt="image"
src="https://github.com/user-attachments/assets/3fdc8301-375d-4223-a2ea-8d4f411a90bd"
/>
2025-07-14 17:04:18 +08:00
Jason Lee
82b87d92ab
text_view: Fix nested Blockquote render in Markdown and HTML. (#1053)
<img width="986" height="271" alt="image"
src="https://github.com/user-attachments/assets/1de04629-2bdc-48f2-ae69-45c33482aeff"
/>

- Also fixed short language name in code block, e.g.: `rs` -> `rust`.
2025-07-14 14:30:40 +08:00