Commit graph

944 commits

Author SHA1 Message Date
Jason Lee
034e465d28
list: Select first item on search. (#798) 2025-04-17 17:29:02 +08:00
Jason Lee
5b508d7219
gallery: Redesign the gallery. (#797)
Close #773

<img width="1712" alt="image"
src="https://github.com/user-attachments/assets/e27a28ca-cdd7-4970-8518-4fd0104bb3f8"
/>
2025-04-17 17:12:48 +08:00
Jason Lee
225a306169 theme: Improve ThemeMode to add more features. 2025-04-16 15:26:14 +08:00
Jason Lee
e2463bbdcf
linux: Fix sync_system_appearance on Linux. (#796)
Close #104
2025-04-16 14:55:01 +08:00
Jason Lee
8d37716b88
list: Export query_input for support update the default Query Input. (#794)
## Break Change

- Updated `set_placeholder` and `set_pattern` method to add `window` and
`cx` argument.

    ```diff
- fn set_placeholder(&mut self, placeholder: impl Into<SharedString>)
+ fn set_placeholder(&mut self, placeholder: impl Into<SharedString>, _:
&Window, cx: &mut Context<Self>)

    - fn set_pattern(&mut self, pattern: regex::Regex)
+ fn set_pattern(&mut self, pattern: regex::Regex, window: &mut Window,
cx: &mut Context<Self>)
    ```
2025-04-15 20:36:04 +08:00
Floyd Wang
0c4a0538e6
sidebar: Better active menu background (#793) 2025-04-15 14:36:02 +08:00
Floyd Wang
8930acf648
sidebar: Add suffix for menu item (#792)
| Light | Dark |
| - | - |
| <img width="913" alt="SCR-20250415-mkdr"
src="https://github.com/user-attachments/assets/5c4931e6-4d03-48ec-91c6-ade2d86de75a"
/> | <img width="913" alt="SCR-20250415-mkec"
src="https://github.com/user-attachments/assets/f85af984-ecc3-4cd7-913c-c4e93384dbf1"
/> |
2025-04-15 14:02:52 +08:00
Jason Lee
71b79cf1b4
chore: Add Windows CI (#789) 2025-04-14 20:46:32 +08:00
Jason Lee
aa44fd3a43
kbd: Fix Kbd keys ordering and on Windows. (#788) 2025-04-14 19:27:23 +08:00
Jason Lee
9a6a0f4421
tooltip: Add action, key_binding method to Tooltip. (#787) 2025-04-14 17:38:21 +08:00
Floyd Wang
8ef4e2eb17
modal: Respond confirm events only when on_ok or footer present (#786) 2025-04-14 16:56:16 +08:00
Jason Lee
d0a73011de
tooltip: Add KeyBinding to tooltip and Button. (#783)
- Improve `Kbd::format` method.
- Add `tooltip_with_action` method to Button for display key binding in
tooltip.
- 
## Break change

- The `Tooltip::new` has been changed it argument and return type.
    
    ```diff
- pub fn new(text: impl Into<Text>, _: &mut Window, cx: &mut App) ->
AnyView
    + pub fn new(text: impl Into<Text>) -> Self
    ```
2025-04-14 16:40:40 +08:00
Floyd Wang
95fb86ec08
checkbox: Make checked icon sizable (#785)
| Before | After |
| - | - |
| <img width="642" alt="SCR-20250414-nbwx"
src="https://github.com/user-attachments/assets/fa3daaf8-5465-49f5-8cd5-d59c19b50494"
/> | <img width="644" alt="SCR-20250414-nbli"
src="https://github.com/user-attachments/assets/e45aa560-0183-460a-b76d-e3cb0203067f"
/> |
2025-04-14 14:47:15 +08:00
Jason Lee
73be54a0f7
input: Improve clear button position in Input. (#782)
| Before | After |
| -- | -- |
| <img width="529" alt="image"
src="https://github.com/user-attachments/assets/02fdba71-7e83-43b9-ba4c-476eb21dcf28"
/> | <img width="530" alt="image"
src="https://github.com/user-attachments/assets/ad7b6378-c9ff-4ea4-943a-87af53a2ac79"
/> |
2025-04-11 19:13:17 +08:00
Floyd Wang
d04866eb77
checkbox: Support sizable (#781)
| Before | After |
| - | - |
| <img width="672" alt="SCR-20250409-pgbg"
src="https://github.com/user-attachments/assets/73a46b13-a3bb-4f58-afb0-aa388bbaefb5"
/> | <img width="669" alt="SCR-20250409-phiy"
src="https://github.com/user-attachments/assets/1230a02d-cdc7-4c2e-9949-bcad09eb2edc"
/> |
2025-04-09 17:31:56 +08:00
Jason Lee
aaa88db52c
story: Add example for secondary click table row. (#780) 2025-04-09 13:42:08 +08:00
Floyd Wang
206a1e049b
description_list: Wrap description value if it’s too long (#779)
| Before | After |
| - | - |
| <img width="752" alt="SCR-20250408-nfvl"
src="https://github.com/user-attachments/assets/5ed558af-869a-4634-bbb5-80fc1481a15c"
/> | <img width="752" alt="SCR-20250408-ngcy"
src="https://github.com/user-attachments/assets/a5871af5-978b-421d-b608-12fa940a884c"
/> |
2025-04-08 14:57:30 +08:00
Jason Lee
231e8ea2db
history: Fix redo, undo chars order for Input. (#775)
Ref #469


https://github.com/user-attachments/assets/b12187cc-c778-4452-8761-63a849ef58a3
2025-04-03 21:17:17 +08:00
Jason Lee
d186bf7c9e
sidebar: Fix Sidebar details, something like icon size, remove view_id argument. (#774)
Also updated the Sidebar example to support expand multiple root items.

## Break Change

- Sidebar create not need assign parent view_id now.
2025-04-03 15:02:05 +08:00
王子凌
b016d9fff4
modal: Fix close Modal by clicking overlay to support closing layer by layer. (#771)
Fix the issue that wrongly trigger `overlay` click event for the
layer-stacked `modals`.

Fix #772 

I.E. When clicking the `overlay`, only the last modal will possibly be
hide(If the last modal is not `overlayClosable`, click the overlay, all
the modals will not be hide).


![gif](https://github.com/user-attachments/assets/96ac97fc-6b6d-463d-bce9-393e6236c5df)

I had tried another solution:

![image](https://github.com/user-attachments/assets/d9882d70-c82c-4397-a5ff-65cd49dc08ab)

![image](https://github.com/user-attachments/assets/3855fb6b-4aac-4c7c-9581-3b0843ef78dc)

If this one is better than prev, I will commit it~

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-04-03 13:29:31 +08:00
Jakku Sakura
3051b9c1c4
dock: Fix to sync active state to panels when collapse dock. (#770)
This is a continuation of #764
Without this, if we drag webview to sidebar and collapse, webview is not
aware of itself being hidden
<img width="994" alt="image"
src="https://github.com/user-attachments/assets/6d8d66d1-2a9b-472a-a42f-d04b47aefaac"
/>
2025-04-03 13:13:29 +08:00
Jason Lee
a60acd7e4d
list: Add secondary confirm support to list. (#769) 2025-04-02 16:45:27 +08:00
Jason Lee
c91dce3139
input: Add max_rows to support auto-grow. (#768)
Closes #762


https://github.com/user-attachments/assets/068a3f11-8498-4db6-a2ac-00cc043f16cf
2025-04-02 15:54:19 +08:00
Jason Lee
253c93063f
input: Fix delete beginning_of_line and end_of_line to handle empty line. (#767)
https://github.com/user-attachments/assets/58ff94df-3ff7-45ae-8657-a526b3ee75f7
2025-04-02 13:41:37 +08:00
Jason Lee
e921621a8b
scrollbar: Update min thumb size to 24px. (#766)
<img width="330" alt="image"
src="https://github.com/user-attachments/assets/ace52246-65ed-4d28-9906-c16281b6bd79"
/>
2025-04-02 11:37:19 +08:00
Jakku Sakura
4f0617e96f
example: Fix to hide WebView when switch tab. (#764)
fixes #763
it also prevent crashing on linux due to gtk not initialized

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-04-02 10:50:20 +08:00
Jason Lee
99e7f8ee70
history: Ensure unique History in redos and undos when push. (#761) 2025-04-01 19:35:16 +08:00
Jason Lee
ebe93210af
Use normal cursor for buttons. (#760)
This change to follow native UI to use normal cursor for all buttons,
items.

Only use `pointer` for link item.
2025-04-01 17:59:27 +08:00
Victor Quiroz
7986c2072b
sidebar: Fix menu item click handler (#759)
The sidebar stopped working properly. Only one item was handling the
click, by giving the ID to the `SidebarMenuItem` the issue seems to be
resolved. I guess something changed within `gpui` itself that it broke.

**Before**



https://github.com/user-attachments/assets/e4fd21a9-e16d-4be6-b687-64a8a040eee7

**After**



https://github.com/user-attachments/assets/aed91762-c8ae-49f3-aaa8-77df2155f0c6

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-04-01 16:41:46 +08:00
Jason Lee
88b5e5c023
input: Add mask_toggle button to toggle masked state to Input. (#758) 2025-03-31 22:57:07 +08:00
Jason Lee
3357197f60
example: Remove duplicate ProgressStory in main example. (#757)
Ref #740
2025-03-31 22:05:33 +08:00
Jason Lee
c310afadc6
tile: Add to support resize tile from left and top side. (#756) 2025-03-31 19:35:02 +08:00
Floyd Wang
f34ebdf621
theme: Update table_head_foreground (#753) 2025-03-31 15:12:54 +08:00
Floyd Wang
13de7d5a7e
chore: Update GPUI 2025/03/31 (#752) 2025-03-31 10:31:39 +08:00
Floyd Wang
417e097b1a
dock: Add tab_name for collapsed tab panels (#751) 2025-03-28 11:44:34 +08:00
Floyd Wang
9f103bac6f
svg_img: Use system fonts to support CJK characters (#750)
| Before | After |
| - | - |
| <img width="528" alt="SCR-20250327-mpcz"
src="https://github.com/user-attachments/assets/22dc30ea-582a-4133-996a-90bcf8cb54be"
/> | <img width="535" alt="SCR-20250327-mnbv"
src="https://github.com/user-attachments/assets/5f360d17-8285-44d8-963b-17784c4c0eb5"
/> |
2025-03-27 14:44:04 +08:00
Jason Lee
aadcf4e1df
accordion: Fix toggle accordion item. (#749)
Close #740

![CleanShot 2025-03-27 at 11 25
54](https://github.com/user-attachments/assets/7aa2e9ed-a3f2-4683-854a-bc1768912f54)
2025-03-27 14:22:00 +08:00
Floyd Wang
26b59ea23e
story: Sync number input value when changed (#748)
Closed #741 


https://github.com/user-attachments/assets/ec572918-a574-4adb-a8c0-c59010dc4d5e
2025-03-27 11:27:38 +08:00
Jason Lee
05fea87ec4
example: Fix modal example button id. (#747)
Ref #740

- Fix modal example button id.
- Fix switch example to allow check.
2025-03-27 11:24:06 +08:00
Jason Lee
e8f89e04d6
button: Update ButtonCustomVariant default variable value to use transparent. (#746) 2025-03-27 10:43:40 +08:00
Jason Lee
17926cea16
button: Add warning, success, info variant to Button. (#745)
<img width="1342" alt="SCR-20250327-jfzq"
src="https://github.com/user-attachments/assets/7c44458a-9467-4095-9cd6-1dcb35cc351b"
/>
<img width="1342" alt="SCR-20250327-jgak"
src="https://github.com/user-attachments/assets/07d33d60-f581-46d4-9a54-174e56ab82ca"
/>
2025-03-27 10:15:53 +08:00
Jason Lee
e582d22f11
sidebar: Fix collapsed to display icon only. (#743)
<img width="1056" alt="image"
src="https://github.com/user-attachments/assets/162f9e47-72ef-47c2-b3a4-9bc10682a624"
/>
2025-03-27 09:35:01 +08:00
Angelk90
a70a0f168d
i18n: Add italian (#738) 2025-03-26 21:54:30 +08:00
Jason Lee
814ea0e824
alert: Add to support styled. (#736) 2025-03-25 15:04:28 +08:00
Jason Lee
22d9394266
alert: Add Alert. (#735)
![](https://github.com/user-attachments/assets/dd0436b7-6821-49a2-8a7a-cf43285cd49e)

![image](https://github.com/user-attachments/assets/56e17233-f9ea-4be6-afed-16ef39ffb06c)

<img width="821" alt="image"
src="https://github.com/user-attachments/assets/6350f48b-6ced-4063-b115-06422d49b92c"
/>
<img width="821" alt="image"
src="https://github.com/user-attachments/assets/3d71688a-b0ca-4223-a097-858388a47f6d"
/>
<img width="821" alt="image"
src="https://github.com/user-attachments/assets/ec3af860-0f8f-420b-9da7-f390c4742492"
/>
<img width="821" alt="image"
src="https://github.com/user-attachments/assets/d9a85c06-209a-4ef9-ac9a-8456491fedc6"
/>
2025-03-25 14:10:24 +08:00
Jason Lee
f650491605
menu: Add external link icon to link menu item. (#734)
<img width="403" alt="image"
src="https://github.com/user-attachments/assets/ad6682b6-2114-4f55-be84-d06c02ae401e"
/>
2025-03-24 22:30:29 +08:00
Jason Lee
e0f4a7d3cd
menu: Add label item to PopupMenu. (#733)
<img width="883" alt="image"
src="https://github.com/user-attachments/assets/06071f62-ddd3-4f9e-ae2f-82b583089792"
/>
2025-03-24 22:04:47 +08:00
Floyd Wang
f759cc5023
calendar: Fix duplicate IDs cause click events not respond (#732) 2025-03-24 20:01:29 +08:00
Jason Lee
8a3b858d1a
tabs: Add menu to TabBar to display more items. (#731)
<img width="752" alt="image"
src="https://github.com/user-attachments/assets/a7efb600-553a-4b78-a8f4-aaba504d44f0"
/>

- tabs: Use default cursor when Tab is disabled.
- popup_menu: Add to support add menu item with disabled state.
2025-03-24 18:05:54 +08:00
Floyd Wang
760c0597eb
description_list: Fix incorrect align items for horizontal layout (#730)
| Before | After |
| - | - |
| <img width="539" alt="image"
src="https://github.com/user-attachments/assets/ecd997b5-1f59-4c41-83a3-dfdee6b1be8a"
/> | <img width="556" alt="image"
src="https://github.com/user-attachments/assets/1088d466-1635-45c3-b578-9ada1c960d66"
/> |
2025-03-24 17:15:46 +08:00
Jason Lee
12e3678e55
description_list: Update label_width type to accept any Into<DefiniteLength>. (#729) 2025-03-24 15:29:50 +08:00
Jason Lee
ffa36c1c5b input: Add focused_input, has_focused_input method to Root. #727
Add this to save current focused Input, this used to avoid some special keybinding conflict.

For example: `/` as ToggleSearch, if on this action, we can check is there `has_focused_input` to decide to ignore or handle action.

- dock: Rename toggle button visible method.
2025-03-21 17:34:32 +08:00
Floyd Wang
9d2a70be48
svg_img: Reduce ImageSource creation (#728) 2025-03-21 17:22:12 +08:00
Jason Lee
393e7e8f85 story: Update layout state file location on release mode. 2025-03-21 17:17:35 +08:00
Floyd Wang
0d1c40a56a
dock: Support hide dock toggle buttons (#726) 2025-03-21 11:55:02 +08:00
Jason Lee
a89f971108
chore: Update GPUI 2025/03/20 and fix spawn method. (#725)
- Update `resvg`, `usvg` to 0.45.0
2025-03-20 21:23:50 +08:00
Jason Lee
c98e4f0521
checkbox: Add children to Radio, Checkbox to display long texts. (#724)
This change is going to solve the wrapped text line-height.

Before this change, the Label is must set `line-height: 100%` to render
at same line with the checkbox.

But if there have a long text in label, wrapped lines need more
line-height to leave lines spaces. But if we set line-height over the
100%, that the checkbox will not align horizontal center.

So, this change to use other child to solve this issue, we can set
line-height to the child not to the label.


<img width="1204" alt="image"
src="https://github.com/user-attachments/assets/981cf925-01c7-48d7-9dd2-881c727a1759"
/>
2025-03-20 19:12:48 +08:00
Floyd Wang
49e8b06ccb
label: Fix typo (#722) 2025-03-19 14:15:49 +08:00
Jason Lee
88325ea14b
input: Add insert and replace method to Input. (#721)
Close #719 

https://github.com/user-attachments/assets/aed24aef-c69f-4512-81bb-bb7e4a6de14e
2025-03-17 22:40:09 +08:00
Jason Lee
a0c7d0b791
tab: Adjust underline tab style. (#720)
<img width="1293" alt="image"
src="https://github.com/user-attachments/assets/bd0cdd71-9e83-460a-8224-f255a590f2ac"
/>
2025-03-17 21:50:39 +08:00
Floyd Wang
7442aa1fba
dock: Fixed panels will lose height when dragged to minimum (#718)
## Before


https://github.com/user-attachments/assets/c49464bf-6106-422b-b948-83c5b4c4de60

## After


https://github.com/user-attachments/assets/b83fba18-ecfd-458f-8f25-5d59a60a66cb
2025-03-14 15:55:51 +08:00
Floyd Wang
8e7ef5631e
dropdown_button: Support outline style (#716) 2025-03-12 17:23:37 +08:00
Jason Lee
87b8958059
modal: Use bold text for Modal title. (#715)
<img width="995" alt="image"
src="https://github.com/user-attachments/assets/3e9ba919-eb91-4e8d-ba89-3a85e263e550"
/>
2025-03-12 11:57:59 +08:00
Jason Lee
6da7de5299
button: Improve Button to support combine outline with other variants. (#714)
<img width="1385" alt="image"
src="https://github.com/user-attachments/assets/240df695-bfd5-4680-89a2-2640db206b24"
/>
2025-03-12 11:57:25 +08:00
Jason Lee
89170eea1d
color_picker: Add icon use icon as color picker button. (#711) 2025-03-11 21:14:14 +08:00
Jason Lee
d0abcb2456
switch: Fix switch label to vertical center. (#710)
<img width="775" alt="image"
src="https://github.com/user-attachments/assets/c004e552-c161-4e09-9543-13727382204b"
/>
2025-03-11 20:55:58 +08:00
Jason Lee
c2dddf6f55
input: Update gap between input and prefix, suffix. (#709)
<img width="813" alt="image"
src="https://github.com/user-attachments/assets/9d99a74a-92b6-44f5-bf33-35ddef6a7ca0"
/>
2025-03-11 20:40:50 +08:00
Jason Lee
df94217999
tiles: Fix back panels flick when hover on top panel in tiles. (#708)
- Move resize handle out of the panel to avoid conflict with scrollbar.
2025-03-11 19:56:50 +08:00
Jason Lee
d8ec1ee516
title_bar: Fix TITLE_BAR_HEIGHT const to it actually height 34px. (#707) 2025-03-11 18:50:32 +08:00
Jason Lee
5e4e810c0d
description_list: Add to support border style to DescriptionList vertical layout. (#706)
<img width="899" alt="image"
src="https://github.com/user-attachments/assets/38108d88-7b27-4964-8b1d-07b81522698b"
/>
<img width="980" alt="image"
src="https://github.com/user-attachments/assets/c4467a72-0011-486b-9918-af21297b8c3e"
/>
<img width="980" alt="image"
src="https://github.com/user-attachments/assets/21e8fc31-1642-4ab4-b180-01aea6e81b38"
/>
<img width="980" alt="image"
src="https://github.com/user-attachments/assets/65a02a85-7538-4b6f-83e5-33502c30367e"
/>
2025-03-11 17:59:56 +08:00
Jason Lee
65fad70c21
menu: Fix min_w support to PopupMenu. (#705) 2025-03-11 13:41:41 +08:00
Jason Lee
d451ce5c2d
menu: Add menu_element_with_icon, menu_element_with_check to PopupMenu. (#704)
- Added `menu_element_with_icon` and `menu_element_with_check` method to
PopupMenu.

<img width="317" alt="image"
src="https://github.com/user-attachments/assets/d32575e3-25fc-4d6f-bde2-ec5bc5f238dd"
/>


## Break changes

- menu: Renamed `menu_with_element` method to `menu_element`.
2025-03-11 11:18:43 +08:00
Jason Lee
6a00cfcc4a
text_view: Fix HTML render to support blockquote. (#703)
<img width="850" alt="image"
src="https://github.com/user-attachments/assets/4d8f662f-aebe-4c40-bc56-828627f16064"
/>
2025-03-10 22:53:53 +08:00
Floyd Wang
81e6da503b
chore: Remove unused feature (#702) 2025-03-10 22:17:27 +08:00
Jason Lee
61bb78d174
tab: Update default tab size padding x to match with Panel's padding. (#701)
- Fix muted_foreground in dark mode.
- Fix secondary button active color in dark mode.
- Fix to ensure render last empty space when TabBar have suffix.

<img width="1203" alt="image"
src="https://github.com/user-attachments/assets/65144893-6705-4087-87f3-7e478eaa1405"
/>
<img width="1203" alt="image"
src="https://github.com/user-attachments/assets/0fe3b72b-11f5-4917-959c-a2c88ba0213c"
/>
2025-03-10 21:23:00 +08:00
Jason Lee
54d74a9617
kdb: Add min width 20px to Kdb. (#700)
<img width="358" alt="image"
src="https://github.com/user-attachments/assets/824a0cdd-e03b-49f4-bde6-b77ae0ab48cd"
/>
2025-03-10 17:12:43 +08:00
Jason Lee
4db0fd5819
kbd: Use background for Kbd. (#699) 2025-03-10 17:03:41 +08:00
Jason Lee
3e4a3ed046
tag: Add color to Tag to support more colors. (#698)
- Add `ColorName` enum.

<img width="588" alt="image"
src="https://github.com/user-attachments/assets/20670946-1a4f-45ff-b5ac-81e7eb760242"
/>

<img width="586" alt="image"
src="https://github.com/user-attachments/assets/7ce4a87f-fa6b-4794-83c5-3f18e6d09dcb"
/>
2025-03-07 21:41:04 +08:00
Jason Lee
4c9c7980ee
chore: Upgrade GPUI 2025/03/07 (#697) 2025-03-07 20:22:58 +08:00
Jason Lee
8f2ca40c51
tab: Add new pill style, renamed old pill tab to outline. (#696)
<img width="1011" alt="image"
src="https://github.com/user-attachments/assets/4800a737-4e57-405b-b083-bf57ae3038ad"
/>

## Break Changes

- As you see on the above screenshot, the old `pill` style has been
renamed to `outline`.
2025-03-07 18:46:47 +08:00
Jason Lee
8611a23aae
kbd: Add Kdb to show keystroke. (#695)
<img width="627" alt="image"
src="https://github.com/user-attachments/assets/c2a6f385-8820-4629-be57-bb5958e531ce"
/>
2025-03-07 14:29:50 +08:00
Jason Lee
c5416c4774
menu: Fix sub-menu render position. (#694)
<img width="385" alt="image"
src="https://github.com/user-attachments/assets/2e8527af-08af-4176-b4cf-931f79b6d45c"
/>
2025-03-07 11:47:27 +08:00
Jason Lee
bf1420357b
icon: Fix icon to support style size. (#693) 2025-03-07 10:52:57 +08:00
Jason Lee
3a4f442945
tab: Keep last empty when suffix exist. (#692) 2025-03-06 19:38:45 +08:00
Jason Lee
c9c6449d24
toggle: Add Toggle and ToggleGroup. (#691)
- Improve `Icon` to inherit parent element font size by default.

<img width="777" alt="image"
src="https://github.com/user-attachments/assets/1a0ee94e-46ef-4b02-9538-09880586d3f2"
/>
<img width="777" alt="image"
src="https://github.com/user-attachments/assets/4ecb016f-2e7c-4266-9a25-eae2566b2844"
/>
2025-03-06 19:10:28 +08:00
Jason Lee
d009b37bf1
tab: Add tab_bar_segemented theme variable. (#690) 2025-03-05 19:07:58 +08:00
Floyd Wang
9194d7f6bb popup_menu: Ensure focus is returned after menu is closed (#689) 2025-03-05 16:41:43 +08:00
Jason Lee
4c96679cf7
tab: Improve segmented tab style and add for icon mode tab support. (#688)
<img width="873" alt="image"
src="https://github.com/user-attachments/assets/f616a9ba-0a60-49f5-8291-04f79f5b582c"
/>
<img width="948" alt="image"
src="https://github.com/user-attachments/assets/5ba1b50e-5b5f-45e1-89ca-683bcac8331a"
/>
<img width="929" alt="image"
src="https://github.com/user-attachments/assets/6545b67f-6c53-482f-a3ac-b7929c9bec99"
/>
<img width="1153" alt="image"
src="https://github.com/user-attachments/assets/06abb411-43a7-4472-8e58-d7c8032bed7b"
/>
2025-03-05 15:41:03 +08:00
Jason Lee
6bf26f6f72
scrollbar: Update Scrollbar default to use hover to show on Linux. (#687)
Continue #686
2025-03-05 10:34:16 +08:00
Jens Krause
c06a0c5d78
scrollbar: Fix Scrollbar not clickable when it is always showing. (#686)
On `platform` level,
[should_auto_hide_scrollbars()](76a81607de/crates/gpui/src/platform.rs (L205))
might be `false` for some `platform`s, e.g. for `Linux`.

That's why another check is needed to make scrollbars work properly on
Linux.

Fixes #685

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-03-05 10:14:22 +08:00
Jason Lee
c3f08d52b9
text_view: Add syntax highlight to CodeBlock. (#684)
<img width="1712" alt="image"
src="https://github.com/user-attachments/assets/e7539df4-20db-431b-9bbc-52e08e9de062"
/>
<img width="1712" alt="image"
src="https://github.com/user-attachments/assets/85d52319-1029-4306-8629-ec0321d0571b"
/>
2025-03-04 21:50:50 +08:00
Jason Lee
8c4884d881
tab: Remove w_full from TabBar. (#683) 2025-03-04 17:31:40 +08:00
Floyd Wang
f8a530279a
dock: Fix incorrect extra inner padding in Panels. (#682) 2025-03-04 17:22:17 +08:00
Jason Lee
6c9a317b3b
scrollbar: Fix scroll to show scrollbar. (#681)
Fix #624 was broke scroll to show behaviors.
2025-03-04 15:37:13 +08:00
Jason Lee
581d92378c
tab: Add xsmall, large style to Tab. (#680)
<img width="1047" alt="image"
src="https://github.com/user-attachments/assets/763fc4c9-bda8-4292-83c5-4a44db091938"
/>
<img width="1047" alt="image"
src="https://github.com/user-attachments/assets/e21d5344-f31c-43b3-af6b-28d845af77f8"
/>
<img width="1047" alt="image"
src="https://github.com/user-attachments/assets/3da37f16-55aa-44b3-98c2-4cadfae458b3"
/>
<img width="1047" alt="image"
src="https://github.com/user-attachments/assets/cfbb1f7e-c810-4387-b7dc-d1d2870d50a6"
/>
2025-03-04 10:26:12 +08:00
Jason Lee
793a35eff2
text_view: Fix img height in TextView. (#679)
Close #643

<img width="1103" alt="image"
src="https://github.com/user-attachments/assets/0f0a0af0-8fe2-4322-b012-0f970ba9e13d"
/>

Ref https://github.com/zed-industries/zed/pull/25632
2025-03-03 20:51:26 +08:00
Jason Lee
c4331c9419
tab: Improve TabBar API. (#678)
- Fixed scroll support for TabBar.
- Remove `id` argument from Tab, it will set from TabBar iter.
- Add `id` to TabBar to ensure scroll_handle state will store correct.
- Update `label` argument of Tab, to use `impl Into<SharedString>` type
for better use.
- Added `child` to Tab for render custom element as label.
2025-03-03 19:48:28 +08:00
Jason Lee
bc89ce2536
tab: Add to support string children for TabBar. (#677)
## Break changes

- Removed `id` argument from `TabBar::new` method.
2025-03-03 17:34:17 +08:00
Jason Lee
1aa43b1bfe
tab: Add Pill, Segmented, Underline style Tab and complete the Tab API. (#676)
<img width="985" alt="image"
src="https://github.com/user-attachments/assets/3d3860ff-ac7c-459a-bb6e-d0ea09b8eac8"
/>

<img width="936" alt="image"
src="https://github.com/user-attachments/assets/abb39b8f-4139-4f41-9c12-2a22f767bec0"
/>

<img width="985" alt="image"
src="https://github.com/user-attachments/assets/9fccce5f-8da5-4c78-8679-1a85dcfc56f0"
/>


Run example:

```
cargo run --example tabs
```
2025-03-03 17:09:52 +08:00
Jason Lee
76efa2715b
tiles: Fix panels get item out of bound error when removed some panel. (#675) 2025-02-28 18:53:25 +08:00
Jason Lee
9732c3b7e8
tiles: To support close panel. (#674)
- Add `remove_panel` method to DockArea.
2025-02-28 18:36:58 +08:00
Jason Lee
5cf11ffe1b
tiles: Remove cursor style on Tile's title. (#673) 2025-02-28 16:57:01 +08:00
Jason Lee
7eaac7b171
chore: Update TabPanel closable doc. (#672) 2025-02-28 15:40:33 +08:00
Jason Lee
42c82bfc31
story: Rename closeable to closable. (#671) 2025-02-28 14:33:30 +08:00
Jason Lee
7582ad3fb3
text_view: Add heading_base_font_size to TextViewStyle and fix text wrap for list item. (#670)
- Fix list item to wrap text.

<img width="797" alt="image"
src="https://github.com/user-attachments/assets/9e8156ad-bf58-4d7a-a850-69dfcb56c850"
/>
2025-02-28 11:43:08 +08:00
Jason Lee
e443a219be
panel: Add title_suffix to panel and write a custom container panel example. (#669)
- Add to support `xsmall` size for TextInput.
- Add `global`, `global_mut`, `build_panel` static method to
`PanelRegistry`.

<img width="1011" alt="image"
src="https://github.com/user-attachments/assets/1a6e61c4-502a-4d1c-a4ea-2644777fd4d8"
/>
2025-02-27 14:52:28 +08:00
Floyd Wang
e61f6204cc
calendar: Differentiate text color of disabled and non-current month (#668)
| Before | After |
| - | - |
| <img width="341" alt="image"
src="https://github.com/user-attachments/assets/452d57b1-5ec6-4ad3-bc30-ed8a966d12e5"
/> | <img width="350" alt="image"
src="https://github.com/user-attachments/assets/9f664cea-aa55-479a-8d5b-61570101a66f"
/> |
2025-02-27 11:14:28 +08:00
Jason Lee
3ba63915ce
text_view: Fix some case may lose spaces, <br> in HTML and Markdown render. (#667) 2025-02-26 17:52:18 +08:00
Jason Lee
ffa848fb26
text_view: Fix markdown table alignment. (#666) 2025-02-26 15:49:13 +08:00
Jason Lee
6a125b391e
chore: Update example images in Markdown and HTML examples. (#664) 2025-02-26 15:26:22 +08:00
Jason Lee
98625edf01
tiles: Fix active_panel method to returns actually Panel view, avoid return TabPanel. (#665)
- Limit `add_item` only allows TabPanel type.
- Export `items` method in DockArea.
2025-02-26 11:33:58 +08:00
Jason Lee
00e5385878
input: Add h, h_full to Input for multi-line mode. (#642)
Close #641
<img width="1712" alt="image"
src="https://github.com/user-attachments/assets/9cbe090c-a5d7-4929-98db-5f71349fe559"
/>
2025-02-25 16:17:39 +08:00
Jason Lee
c74791aac8
description_list: Add DescriptionList. (#658)
<img width="1089" alt="image"
src="https://github.com/user-attachments/assets/15069422-14aa-4fa3-b661-65fcf7417323"
/>
<img width="1089" alt="image"
src="https://github.com/user-attachments/assets/df4a4b90-b304-40d3-a9ce-1be73eaaa9f4"
/>
<img width="1089" alt="image"
src="https://github.com/user-attachments/assets/1deaf1e8-4b30-4afd-90af-1bd0eecf53e2"
/>
2025-02-25 15:32:59 +08:00
Floyd Wang
dc4d7e614c dock: Panel trait set_zoomed with mutable window and cx (#661)
Need Update panel functions to mutable `self`, `window` and `cx`.
2025-02-25 14:34:49 +08:00
Jason Lee
9f429592ce
text_view: Remove last paragraph bottom margin. (#660)
Now, we can be easy to use TextView for 1 line text.

## Break Changes

- Removed `inline` method by previous #649 added, this is not needed.
2025-02-25 14:27:59 +08:00
Floyd Wang
f75f96f135
dock: Panel trait set_active with mutable window and cx (#659) 2025-02-25 14:15:42 +08:00
Jason Lee
8edd80d5ee
modal: Do not occlude when overlay is not enable. (#657) 2025-02-25 12:25:46 +08:00
Jason Lee
806c6dffe8
tiles: Add active_panel method to Tiles. (#656) 2025-02-25 12:00:43 +08:00
Ylin
6d7f20cd4f
webview: Update visible state when hide or show (#654) 2025-02-25 11:49:29 +08:00
Floyd Wang
9739493bce
dock: Add mutable reference for set_active (#655) 2025-02-25 11:46:54 +08:00
Jason Lee
3b4065ce4e
text_view: Stop propagation on click link in TextView. (#650)
To avoid trigger parent element, for example as a Label for checkbox.
2025-02-24 18:07:53 +08:00
Jason Lee
6bcc34c7f0
checkbox, switch: Improve Checkbox, Switch to use wrap text and TextView. (#651)
This change to revert #233 to let label to wrap.


<img width="1279" alt="image"
src="https://github.com/user-attachments/assets/8081216f-0ea0-4ba2-9095-6fd84102e03b"
/>
2025-02-24 18:04:06 +08:00
Jason Lee
8fa210bc21
text_view: Update Switch, Checkbox, Radio to let label method support TextView. (#649)
- Add `style` method to TextView.
- Add `inline` method to TextView to use default inline style.
2025-02-24 15:49:54 +08:00
Jason Lee
9dade704fb
webview: Let webview as a feature and not default enable. (#648)
Close #646
2025-02-24 14:24:22 +08:00
Jason Lee
d54dcdf417
text_view: Refactor TextView to RenderOnce to easy usage. (#647) 2025-02-24 14:13:50 +08:00
ihavecoke
c303b84303
dock: Add item to tiles layout should use default TabPanel view (#645) 2025-02-23 22:22:27 +08:00
ihavecoke
03d5f83a83
dock: Implement core panel addition logic for tiling layout (#644) 2025-02-20 21:20:59 +08:00
Jason Lee
06f9178ec4
text: Add TextView with Markdown and Simple HTML support. (#639) 2025-02-20 20:08:59 +08:00
ihavecoke
6c39078e8a
dock: Add drag drop event for tiles (#640) 2025-02-19 22:20:48 +08:00
Jason Lee
75212c3aba
chore: Fix focusd_border typo in #635 (#637) 2025-02-17 17:29:40 +08:00
Jason Lee
c62be93da6
panel: Reduce tool buttons gap from 8px to 4px. (#636)
<img width="314" alt="image"
src="https://github.com/user-attachments/assets/eab5f4f8-b604-4c5c-bfd4-2535340b1d1e"
/>

And use `selected` style for zoom button when zoomed:

<img width="114" alt="image"
src="https://github.com/user-attachments/assets/fa11ec81-a4db-42ea-8edc-39ed8ad40ba1"
/>
2025-02-17 14:46:44 +08:00
Jason Lee
4c554580c9
chore: Rename outline styled method to focused_border. (#635)
This change to avoid conflict with `outline` method in Button.

## Break changes:

- The `outline` method in `StyledExt` now renamed to `focused_border`.
2025-02-17 14:34:54 +08:00
Jason Lee
d96b4b44d2
number_input: Fix button margin. (#634) 2025-02-17 14:29:33 +08:00
Jason Lee
231772ee4e
modal: Remove opacity animation for improve Modal appear. (#633) 2025-02-17 13:32:17 +08:00
Jason Lee
2c377985bb
tiles: Limit panel x to out of bounds, but keep retaining 64px. (#632)
- Adjust `tile_grid_size` default to `8px`.
- Fix unexpected scroll size by `-1px` design.
2025-02-17 11:51:10 +08:00
Jason Lee
d446c0e7b3
tile: Add to support setup tiles background color, tile_shadow, tile_grid_size. (#631) 2025-02-17 10:49:26 +08:00
Jason Lee
e4c31f1ce4
tiles: Limit tile panel move to avoid out of the container. (#630) 2025-02-17 10:24:06 +08:00
Jason Lee
b18dd47ce0
panel: Only highlight resize handle when dragging. (#629) 2025-02-14 18:42:56 +08:00
Jason Lee
851099f890
sidebar: Refactor Sidebar API to avoid map call will segmentation fault on release. (#628)
Close #471

```
    Finished `release` profile [optimized] target(s) in 9.99s
     Running `target/release/examples/sidebar`
[1]    30606 segmentation fault  cargo run --example sidebar --release
```

This may cause by used `map` break by maybe Rust compiler bug, I
detected that if I remove a `map`, then the crash will gone.

So, this changes to refactor the Sidebar API to avoid use `map`.
2025-02-14 17:18:39 +08:00
Jason Lee
0ebedbe79f
chrome: Refactor state fields to remove is_ prefix. (#627) 2025-02-14 15:20:18 +08:00
Jason Lee
bf300a2880
sidebar: Fix sidebar example and add right side example. (#626) 2025-02-14 15:06:37 +08:00
Jason Lee
cca6277ea5
example: Add modal example. (#625)
```
cargo run --example modal
```
2025-02-14 14:44:26 +08:00
Jason Lee
6e2bb3fb58
scrollbar: Update scrollbar hitbox to it bounds, not fill the full of parent view. (#624)
And revert some #621 wrong changes for hover to show scrollbar.
2025-02-14 13:54:02 +08:00
Floyd Wang
c7257d36cf
calendar: Add Matcher for disabled dates (#623)
| Day Of Week | Interval | Range |
|--------------|---------|-------|
| <img width="420" alt="image"
src="https://github.com/user-attachments/assets/e23f69b8-3191-4370-8adf-266362680e5c"
/> | <img width="264" alt="image"
src="https://github.com/user-attachments/assets/c211d7c3-9878-402e-a6cc-e3ac1b50e588"
/> | <img width="337" alt="image"
src="https://github.com/user-attachments/assets/2b894ef1-14d0-4fc3-89e5-4e38b5e8572c"
/> |
2025-02-13 17:43:19 +08:00
Jason Lee
83375147fe
panel: Improve resize handle to show highlight color on dragging. (#622)
https://github.com/user-attachments/assets/aabbd73b-3c11-43e2-a4f2-121d46fba1d7
2025-02-13 16:07:00 +08:00
Jason Lee
437f1b2098
theme: Add to support always show scrollbar mode and default to match with system style. (#621)
Close #573

- Fix theme settings to keeping when switch theme mode.
2025-02-12 15:15:33 +08:00
Floyd Wang
d95cbabcc3
dropdown: Do not reset the selected index when cancelling (#618)
## Before


https://github.com/user-attachments/assets/e33c2324-94f0-42b0-99cc-9e2dcdee3f3d



## After


https://github.com/user-attachments/assets/7c5c6fee-b0f6-4cd5-986e-ea8f6f0e7f9d
2025-02-11 18:54:52 +08:00
Jason Lee
0050685a58
chore: Avoid some unnecessary window.refresh call. (#617)
Ref
https://github.com/zed-industries/zed/discussions/24260#discussioncomment-12135749
2025-02-11 17:06:17 +08:00
Jason Lee
4a26776289
label: Avoid String alloc and remove custom text-align. (#616)
Reverted #615 and recreate again.

## Break changes

- Remove `TextAlign` and `text_left`, `text_right` ... method from
label, we can use same things from GPUI.

<img width="1151" alt="image"
src="https://github.com/user-attachments/assets/95e9066a-e58d-47a8-9acf-b483b0203b1b"
/>
2025-02-11 10:30:45 +08:00
Floyd Wang
44e678b9bc
dock: Make the panel inner padding controllable (#613) 2025-02-10 17:55:57 +08:00
Floyd Wang
cd9c88a0f7
dock: Leave some space between the tabs title and panel (#612)
## Before
<img width="541" alt="image"
src="https://github.com/user-attachments/assets/a41390ec-a86b-4ca2-bcf4-a2b368c1e2e0"
/>

## After
<img width="518" alt="image"
src="https://github.com/user-attachments/assets/0896abe5-d499-4052-aa84-0864029c0346"
/>
2025-02-10 15:55:08 +08:00
Jason Lee
7ceae0acff
Revert "dock: Revert AnyView cached (#607)" (#611)
This reverts commit 2479fc3418.

> NOTE: When we enabled this, we need make sure call `cx.nofity()` when
the data has been updated.

In real world application, this may reduce about 3% CPU cost.

<img width="550" alt="image"
src="https://github.com/user-attachments/assets/9188cde9-3402-4860-9e03-328aa74a74e7"
/>

> I watched this data about 5 minutes, the CPU cost is always like this.
2025-02-10 14:09:09 +08:00
Jason Lee
a5db381ef4
chore: Upgrade GPUI 2025/02/10 (#610)
- Replace `Window::parent_view_id()` with `Window::current_view()`
https://github.com/zed-industries/zed/pull/24212
- Fix SvgImg crash by move `use_asset` to `request_layout`.
- Fix Input to implement `character_index_for_point` method
https://github.com/zed-industries/zed/pull/23989
- Fix Input IME position to under the cursor line.
  <img width="504" alt="image"
src="https://github.com/user-attachments/assets/8a6f56c8-6aae-4c0c-8c5a-3959d6a9d224"
/>
- Fix Input overflow sub crash.
2025-02-10 11:53:25 +08:00
Jens Krause
b1bae7ca21 color_picker: Fix popup does not close by clicking color button again. (#608) 2025-02-09 11:07:46 +08:00
Jens Krause
a6922e3a10
example: Fix tiles needs package gpui-component (#609) 2025-02-08 23:43:37 +08:00
Floyd Wang
2479fc3418
dock: Revert AnyView cached (#607)
* This may cause the interface to not update in real time.
2025-02-07 10:22:29 +08:00
Jason Lee
2e3f3dd669
scrollbar: Add max_fps to limit drag scroll update rate for reduce CPU usage. (#604)
And set Table to use 60 FPS.
2025-02-07 10:07:47 +08:00
Floyd Wang
abb3de013e
Rename package from ui to gpui-component (#606)
## 🚨Break Change

Update dependencies from `ui` to `gpui-component`.
2025-02-06 17:21:46 +08:00
Floyd Wang
e423497da6
tooltip: Support render element (#605)
<img width="376" alt="image"
src="https://github.com/user-attachments/assets/52793001-03cb-46ca-80a3-42aa3db57ecb"
/>
2025-02-06 16:05:44 +08:00
Jason Lee
99a4c793c5
chore: Update crate name to gpui-component for publish crate to hold the name. (#603) 2025-02-06 11:57:34 +08:00
Jason Lee
bc579c0b93
table: Fix Table subtract with overflow error. (#602)
```
thread 'main' panicked at gpui-component-f2cfc37a601d48ab/dffb419/crates/ui/src/[table.rs:1562](http://table.rs:1562/):45:
attempt to subtract with overflow
stack backtrace:
```
2025-02-05 19:26:19 +08:00
Jason Lee
9675f1e02b
dock: Add cache to panel view. (#600) 2025-02-05 17:23:40 +08:00
Jason Lee
3e16c0d220
chore: Remove reexport prelude. (#599)
This is useless, we can just use `gpui::prelude`, so I removed it.

## Break changes

- The `ui::prelude` has been removed, you can replace by use
`gpui::prelude`.
2025-02-04 17:37:28 +08:00
Jason Lee
155f2ee3b9
chore: Refactor ClearButton to as method. (#598) 2025-02-04 17:34:26 +08:00
Jason Lee
dffb419145
chore: Fix subscriptions leak. (#597) 2025-02-04 15:43:26 +08:00
Jason Lee
3ffbbb0688
theme: Ensure all elements to use radius. (#596)
- Fix menu dispatch action.
2025-02-03 19:03:16 +08:00
Jason Lee
eaec664a8d
theme: Add doc for Theme variables. (#595)
## Break change

- Removed unused `cx.theme().panel` variable.
2025-02-03 17:03:15 +08:00
Jason Lee
85c6872e68
input: Use closest_index_for_position from GPUI. (#593) 2025-02-03 15:03:31 +08:00
Jason Lee
8e931bd862
list: Avoid duplicate active item background. (#594) 2025-02-03 14:55:51 +08:00
Jason Lee
7539e6d44c
input: Fix Input to vertical center the mask chars. (#590)
Close #467

Windows:

<img width="397" alt="image"
src="https://github.com/user-attachments/assets/0a185b42-1432-404a-b889-da1143706035"
/>

macOS:

<img width="510" alt="image"
src="https://github.com/user-attachments/assets/ed186552-862b-404e-96dc-b0f3a0b552d6"
/>
2025-01-30 10:54:02 +08:00
Jason Lee
43f529c6d2
input: Add to support move, select and delete by word. (#591)
Close #466 

https://github.com/user-attachments/assets/48cda905-f2bf-4896-b3ae-08b7cd61467d
2025-01-30 10:47:11 +08:00
Jason Lee
6fa1888ee6
chore: Upgrade for GPUI API changes. (#589) 2025-01-29 16:49:17 +08:00
Jason Lee
327d40e0e0
chore: Upgrade GPUI 3 (#587)
The pervious version has keep on
[gpui2](https://github.com/longbridge/gpui-component/tree/gpui2) branch,
if there need to use.

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

## Prepare

### Generate index.scip

```bash
rust-analyzer scip ./ > index.scip
```

### Get [refactor](https://github.com/zed-industries/refactor)

```bash
https://github.com/zed-industries/refactor.git
```

## Refactor exist code

```bash
cd refactor
cargo run -- ~/work/gpui-component
```

Then will get result if successed:

```
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/refactor /Users/jason/work/gpui-component`
Loaded 115 SCIP documents
Processing files starting with focus path: ""
Changed 90 files
```

-------------

## Changes

```diff
- View<T>
- Model<T>
+ Entity<T>

- WeakView<T>
+ WeakEntity<T>

- FocusableView
+ Focusable

- cx.bounds()
+ window.bounds()
- cx.refresh()
+ window.refresh()
- cx.focused()
+ window.focused(cx)
- cx.with_optional_element_state
- window.with_optional_element_state
```

```diff
- &mut WindowContext
+ &mut Window, &mut App

- cx: &mut WindowContext
+ window: &mut Window, cx: &mut App

- &mut ViewContext<
+ &mut Window, &mut Context<

- cx: &mut ViewContext<
+ window: &mut Window, cx: &mut Context<
```

```diff
- cx.spawn(|_, mut cx| async move { 
+ cx.spawn_in(window, |_, mut cx| async move {
- cx.dispatch_action(Box::new(...))
+ window.dispatch_action(Box::new(...), cx)
```

`cx.spawn`

```diff
- cx.spawn(|view, mut cx| async move {
+ cx.spawn_in(window, |view, mut window| async move {
+     _ = view.update_in(&mut window, move |view, window, cx| {
```
2025-01-27 03:58:48 +08:00
Jason Lee
8d0773fc62 chore: Remove typo println debug info in Input. 2025-01-27 03:54:06 +08:00
Jason Lee
e658aeee96
table: Improve sort icon color and fix stripe row display. (#578)
- Improve sort icon color:

<img width="139" alt="image"
src="https://github.com/user-attachments/assets/6374c26a-4555-4735-953b-dbd961fe5b31"
/>

- Avoid duplicate border when enabled fixed column.

<img width="587" alt="image"
src="https://github.com/user-attachments/assets/6e186d29-5d8a-404e-b160-20c2af6a16fa"
/>


TODO

- [x] The extra rows not show when `stripe` is true.
2025-01-26 16:25:34 +08:00
Jason Lee
649e765729
story: Add TitleBar to examples. (#586) 2025-01-26 15:07:34 +08:00
Jason Lee
71de5dd882
input: Fix position cursor in multi-line mode. (#583)
Close #581

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

https://github.com/user-attachments/assets/c69d098e-d2cb-4053-b739-6c7dd666e769
2025-01-26 14:12:08 +08:00
Jason Lee
852ce923ae
input: Update carret style. (#585)
- 1px width.
- Add `cx.theme.carret` variable for color and default use foreground
color.
- Reduce height to match with font size.


https://github.com/user-attachments/assets/d16a51eb-2c9a-4586-8b0d-67922a738002
2025-01-26 14:11:51 +08:00
Jason Lee
cd613db6d6
number_input: Improve NumberInput to better handle mouse down position cursor and fix sizable API. (#582)
Close #579 

- Leave some space before the Input to support mouse down to position
cursor at start of line.
- Fix to match with size appearance.
- Keep padding left and right to Input, even setup `appearance: false`.

## Break Changes

- The `xlarge`, `large`, `small`, `xsmall` ... method has been moved to
use `ui::Sizable` trait to same as other component.
2025-01-24 23:39:19 +08:00
Jason Lee
68de692290
input: Fix to position cursor at correct offset on mouse down or select. (#580)
Ref: https://github.com/zed-industries/zed/pull/23603

---

## TODO

Here still have a little bug in multiple lines and soft wrapped line.
Only the first line can get correct position, the wrapped line is always
got the offset +1, so the first char of that soft wrapped line, we can't
position the cursor at the first.
2025-01-24 22:57:24 +08:00
Jason Lee
1689f4208f
table: Add measure to table. (#577)
- Improve to not calc extra rows if `stripe` not enable.
- Improve to not change offset, when scrollbar drag changed less than
1px.
- Improve render cells to use `Vec::with_capacity` to prepare enough
space.

```bash
ZED_MEASUREMENTS=1 MTL_HUD_ENABLED=1 cargo run --release --example table
```
2025-01-24 18:59:01 +08:00
Jason Lee
86db990b51
chore: Add #[inline] to util methods. (#576) 2025-01-24 15:34:57 +08:00
Floyd Wang
7aade44e7a
dock: Fix the tab panel cannot fill the entire height (#575)
## Before
<img width="411" alt="image"
src="https://github.com/user-attachments/assets/8801361d-20fd-4ba5-8b9e-bb18f6e8cc5a"
/>

## After
<img width="410" alt="image"
src="https://github.com/user-attachments/assets/91975382-5ed1-45a4-acd2-a131d2a162f5"
/>
2025-01-24 15:28:51 +08:00
Jason Lee
878a51e5a9
example: Split single examples. (#574)
```bash
cargo run --example table
cargo run --example list
```
2025-01-24 11:13:24 +08:00
Jason Lee
1dba2b6c70
input: Fix mouse click to position cursor to before of the char. (#572) 2025-01-23 20:46:52 +08:00
Jason Lee
77badb5799
radio: Add RadioGroup. (#571)
<img width="1265" alt="image"
src="https://github.com/user-attachments/assets/7ff51cb8-0aad-4d7d-a80a-e97c572c468a"
/>
2025-01-23 20:13:01 +08:00
Floyd Wang
1ff84a9943
popup_menu: Add max_h to set the height of menu (#570) 2025-01-23 18:43:34 +08:00
Jason Lee
e03a0d4f4e
chore: Fix Switch, Radio, Checkbox to use inline layout. (#569) 2025-01-23 18:05:32 +08:00
Floyd Wang
07b12b726c
number_input: Do not trigger step event when the input is disabled (#568) 2025-01-23 16:31:33 +08:00
Jason Lee
a89e2430d3
form: Add Form and FormField. (#565)
<img width="899" alt="image"
src="https://github.com/user-attachments/assets/842dac65-36c3-4f3a-b55a-59d204d9a93c"
/>
<img width="901" alt="image"
src="https://github.com/user-attachments/assets/616b7a3a-4a84-4d27-b554-63ebd5213ad7"
/>
2025-01-23 16:09:50 +08:00
Jason Lee
4028f46cb9
date_picker: Avoid focus back to DatePicker, when dismiss picker by clicked on Input. (#567) 2025-01-23 11:52:58 +08:00
Jason Lee
78ce573a52
list, table: Refactor to control loading by use delegate. (#562)
- Add `loading` method to `ListDelegate` and `TableDelegate` to control
loading view display.

## Break Changes

- Remove `loading`, `set_loading` method from List and Table, use
`loading` method in delegate instead.
2025-01-21 20:33:37 +08:00
Jason Lee
9f2cd84b23
color: Add mix method and merge ColorExt to Colorize. (#561)
- Add `mix` method to mix two color.
- Export `ui::theme::*` to crate root, before `use
ui:theme::ActiveTheme` to `use ui::ActiveTheme`.

## Break Changes

- Moved `ui::theme::Colorize` to `ui::Colorize`.
- Merged `ColorExt` to `Colorize`.
- Renamed `to_hex_string` to `to_hex`, `parse_hex_string` to
`parse_hex`.
2025-01-21 18:31:01 +08:00
Jason Lee
73c92f3a6b
input: Fix crash cause by incorrect selected range. (#560)
The `selected_range` should be UTF-8.
2025-01-21 11:49:36 +08:00
Jason Lee
493acdefab story: Fix story and merge checkbox, radio to switch story. 2025-01-21 10:43:10 +08:00
Jason Lee
20feab5f40
modal: Add confirm Modal with default Ok, Cancel buttons. (#558)
<img width="581" alt="image"
src="https://github.com/user-attachments/assets/ad53fb63-f3be-41e6-90c0-f03cba48c4db"
/>

- Added `overlay_closable` method to Modal to control overlay click to
close modal.
- Added `on_ok`, `on_cancel` callback method.
- Added `confirm` to setup to use default confirm style (With a Ok,
Cancel button).

## Break Changes

- The `footer` method has been changed to with a fn not a element.
2025-01-20 17:42:05 +08:00
Jason Lee
ad04b699fc
clipboard: Add value_fn to get copy value with callback to Clipboard. (#557) 2025-01-20 15:54:27 +08:00
Jason Lee
355dfa5556
slider: Add vertical and reverse support to Slider. (#556)
- Fix to support stop at any position.
- Fix click bounds.
2025-01-20 15:22:28 +08:00
Floyd Wang
06e9b1a25c
dropdown_button: Add compact style (#555) 2025-01-20 13:49:42 +08:00
Floyd Wang
bd3cdd7167
dropdown_button: Add more style preferences (#554) 2025-01-17 16:24:46 +08:00
Jason Lee
4fa8b9d65c
list: Fix #552 broken move down to select first item. (#553) 2025-01-17 16:19:03 +08:00
Jason Lee
f41edfd318
list: Add ListEvent to List. (#552)
- Add `ListEvent` and emit event for List with `Select`, `Confirm`,
`Cancel` events.

## Break Changes

- Removed useless `ListDelegate::confirmed_index` method.
- Updated `ListDelegate::confirm` method, to change `ix: Option<usize>`
to `ix: usize`.
2025-01-17 16:00:28 +08:00
Floyd Wang
569a4e7262
dropdown_button: Add new component (#551)
## Regular
<img width="162" alt="image"
src="https://github.com/user-attachments/assets/4e597d0b-41d1-4b0e-9939-728cae71fe65"
/>

## Active
<img width="162" alt="image"
src="https://github.com/user-attachments/assets/0871ed6b-3188-44dd-93d4-5996f9213edc"
/>
<br />
<img width="162" alt="image"
src="https://github.com/user-attachments/assets/b05ccdc6-e405-47d0-97e7-470afadbbd38"
/>


## Break Change
Move `ButtonGroup` into the `button`.
2025-01-17 14:16:24 +08:00
Jason Lee
04d720f3a7
chore: Improve Table, List load more threshold, and avoid duplicate request. (#550)
- Default `threshold` changed to 20.
2025-01-17 11:25:41 +08:00
Floyd Wang
0312e47554
input: Move number input into input (#549) 2025-01-17 10:07:41 +08:00
Jason Lee
8dca96469e
chore: Update GPUI with MSAA and PathBuilder. (#548) 2025-01-15 16:52:03 +08:00
Jason Lee
a0f6b48eff
chore: Update GPUI 2025/01/14 (#547) 2025-01-14 19:21:04 +08:00
Jason Lee
7848311046
list, table: Add default loading animation to List and Table. (#546)
<img width="485" alt="image"
src="https://github.com/user-attachments/assets/568cbf3a-6e32-4b21-8816-5e3cb26acc82"
/>

<img width="755" alt="image"
src="https://github.com/user-attachments/assets/5e13d6b8-e6f4-4cc3-b1f6-9b378ff523a4"
/>
2025-01-14 11:36:33 +08:00
ihavecoke
1d18edef12
list: Allow disabling List selection. (#545)
## Break changes

- Renamed list `enable_scrollbar` to `scrollbar_visible` to match with
the table API.

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-01-14 10:05:49 +08:00
Jason Lee
1218ceb7dc
table: Add scrollbar_visible to Table for control the scrollbar visibility. (#544)
Ref #513 #542 

Add this to ability to render some custom view on top of the table, but
below of the scrollbar.

## Break changes

- table: Renamed `scrollbar_state` to `vertical_scrollbar_state`.
- table: Removed `scroll_handle` and `horizontal_scroll_handle` method,
there have a pub `vertical_scroll_handle` and `horizontal_scroll_handle`
prop.
2025-01-13 14:59:03 +08:00
Ylin
eb10186463
table: Add visible_rows_changed, visible_cols_changed method to table delegate. (#543)
Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-01-13 13:51:20 +08:00
Jason Lee
205a499bc9
table: Revert deferred render scrollbr for table. (#542)
This will make scrollbar always stay on top, even there have other
element cover it.
2025-01-12 22:32:43 +08:00
Floyd Wang
464fceac96
theme: Rename destructive to danger (#541) 2025-01-10 15:16:19 +08:00
Floyd Wang
31736b0e21
badge: Add new component (#540)
<img width="137" alt="image"
src="https://github.com/user-attachments/assets/6d7008b2-fe0f-4c4e-bd16-1dd8ae883f11"
/>
<img width="118" alt="image"
src="https://github.com/user-attachments/assets/3137dd88-5038-4c59-90c1-cee2cdc542bd"
/>
2025-01-10 14:28:27 +08:00
Floyd Wang
2aad7e412a
tag: Rename badge to tag (#539) 2025-01-10 10:28:47 +08:00
Floyd Wang
ceba66c22d dock: Add PanelControl for pinning the toolbar button (#537)
<img width="387" alt="image"
src="https://github.com/user-attachments/assets/b3d3f2a8-dc4e-49e6-8e82-e7f551d70bc7"
/>
2025-01-09 19:18:59 +08:00
Jason Lee
de42cc46a7
panel: Update Panel toolbar_buttons method to use ViewContext<Self>. (#536)
## Break changes

The `toolbar_buttons` trait method in Panel has been changed:

```diff
- fn toolbar_buttons(&self, cx: &WindowContext) -> Vec<Button>
+ fn toolbar_buttons(&self, cx: &mut ViewContext<Self>) -> Option<Vec<Button>>
```
2025-01-09 16:49:35 +08:00
Jason Lee
bf82e3db13
list, table: Add scroll_to_item to List, scroll_to_row to Table. (#535) 2025-01-09 14:23:46 +08:00
Floyd Wang
8aac2f75e4
popup_menu: More compact checked style (#534)
## Before
<img width="360" alt="image"
src="https://github.com/user-attachments/assets/be388143-efed-4a47-b4f7-11018fe22f99"
/>

## After
<img width="336" alt="image"
src="https://github.com/user-attachments/assets/449b7dd3-c51f-4673-a068-34ac813d79fd"
/>
2025-01-08 18:37:14 +08:00
Floyd Wang
bf8eb3f459 ci: Fix lint 2025-01-08 16:25:35 +08:00
Floyd Wang
d48a6d4b43
table: Support clear selection (#533) 2025-01-08 16:18:49 +08:00
dependabot[bot]
804705a260
build(deps): bump wry from 0.47.2 to 0.48.0 (#530)
Bumps [wry](https://github.com/tauri-apps/wry) from 0.47.2 to 0.48.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/tauri-apps/wry/releases">wry's
releases</a>.</em></p>
<blockquote>
<h2>wry v0.48.0</h2>
<!-- raw HTML omitted -->
<pre><code>Updating crates.io index
     Locking 404 packages to latest compatible versions
      Adding html5ever v0.26.0 (available: v0.29.0)
      Adding soup3 v0.5.0 (available: v0.7.0)
      Adding toml v0.8.2 (available: v0.8.19)
      Adding toml_datetime v0.6.3 (available: v0.6.8)
      Adding toml_edit v0.20.2 (available: v0.20.7)
Fetching advisory database from
`https://github.com/RustSec/advisory-db.git`
Loaded 722 security advisories (from /home/runner/.cargo/advisory-db)
    Updating crates.io index
    Scanning Cargo.lock for vulnerabilities (405 crate dependencies)
Crate:     atk
Version:   0.18.2
Warning:   unmaintained
Title:     gtk-rs GTK3 bindings - no longer maintained
Date:      2024-03-04
ID:        RUSTSEC-2024-0413
URL:       https://rustsec.org/advisories/RUSTSEC-2024-0413
Dependency tree:
atk 0.18.2
└── gtk 0.18.2
    ├── wry 0.48.0
    ├── webkit2gtk 2.0.1
    │   └── wry 0.48.0
    └── tao 0.31.0
        └── wry 0.48.0
<p>Crate:     atk-sys
Version:   0.18.2
Warning:   unmaintained
Title:     gtk-rs GTK3 bindings - no longer maintained
Date:      2024-03-04
ID:        RUSTSEC-2024-0416
URL: <a
href="https://rustsec.org/advisories/RUSTSEC-2024-0416">https://rustsec.org/advisories/RUSTSEC-2024-0416</a>
Dependency tree:
atk-sys 0.18.2
├── gtk-sys 0.18.2
│   ├── webkit2gtk-sys 2.0.1
│   │   ├── wry 0.48.0
│   │   └── webkit2gtk 2.0.1
│   │       └── wry 0.48.0
│   ├── webkit2gtk 2.0.1
│   └── gtk 0.18.2
│       ├── wry 0.48.0
│       ├── webkit2gtk 2.0.1
&lt;/tr&gt;&lt;/table&gt;
</code></pre></p>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/tauri-apps/wry/blob/dev/CHANGELOG.md">wry's
changelog</a>.</em></p>
<blockquote>
<h2>[0.48.0]</h2>
<ul>
<li><a
href="eb0c8163f1"><code>eb0c816</code></a>
(<a
href="https://redirect.github.com/tauri-apps/wry/pull/1423">#1423</a> by
<a
href="https://github.com/tauri-apps/wry/../../SpikeHD"><code>@​SpikeHD</code></a>)
Rename <code>{WebViewBuilderExtWindows,
WebViewBuilderExtUnix}::with_extension_path</code> to
<code>with_extensions_path</code>.</li>
<li><a
href="b4ba5b47f2"><code>b4ba5b4</code></a>
(<a
href="https://redirect.github.com/tauri-apps/wry/pull/1426">#1426</a> by
<a
href="https://github.com/tauri-apps/wry/../../FabianLars"><code>@​FabianLars</code></a>)
On Windows, Wry will now log PostMessage errors instead of
panicking.</li>
<li><a
href="f0c6b947dd"><code>f0c6b94</code></a>
(<a
href="https://redirect.github.com/tauri-apps/wry/pull/1441">#1441</a> by
<a
href="https://github.com/tauri-apps/wry/../../renovate"><code>@​renovate</code></a>)
Updated <code>webview2-com</code> to <code>0.34</code>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="2ffcd494af"><code>2ffcd49</code></a>
Apply Version Updates From Current Changes (<a
href="https://redirect.github.com/tauri-apps/wry/issues/1424">#1424</a>)</li>
<li><a
href="6ad66d3880"><code>6ad66d3</code></a>
chore(deps): update rust crate pollster to 0.4.0 (<a
href="https://redirect.github.com/tauri-apps/wry/issues/1405">#1405</a>)</li>
<li><a
href="f0c6b947dd"><code>f0c6b94</code></a>
fix(deps): update rust crate webview2-com to 0.34 (<a
href="https://redirect.github.com/tauri-apps/wry/issues/1441">#1441</a>)</li>
<li><a
href="ca74176748"><code>ca74176</code></a>
chore(deps): update rust crate winit to 0.30 (<a
href="https://redirect.github.com/tauri-apps/wry/issues/1235">#1235</a>)</li>
<li><a
href="72f386f1c5"><code>72f386f</code></a>
fix: tried to access uninitialized instance variable (<a
href="https://redirect.github.com/tauri-apps/wry/issues/1425">#1425</a>)</li>
<li><a
href="413817c8ad"><code>413817c</code></a>
chore(deps): update rust crate tao to 0.31 (<a
href="https://redirect.github.com/tauri-apps/wry/issues/1351">#1351</a>)</li>
<li><a
href="e3ef45f586"><code>e3ef45f</code></a>
fix(deps): update rust crate thiserror to v2 (<a
href="https://redirect.github.com/tauri-apps/wry/issues/1411">#1411</a>)</li>
<li><a
href="b4ba5b47f2"><code>b4ba5b4</code></a>
fix: log postmessage errors (<a
href="https://redirect.github.com/tauri-apps/wry/issues/1426">#1426</a>)</li>
<li><a
href="4740c0bf60"><code>4740c0b</code></a>
refactor: destruct tuples to enhance readability (<a
href="https://redirect.github.com/tauri-apps/wry/issues/1438">#1438</a>)</li>
<li><a
href="eb0c8163f1"><code>eb0c816</code></a>
refactor!: Rename <code>with_extension_path</code> to
<code>with_extensions_path</code> (<a
href="https://redirect.github.com/tauri-apps/wry/issues/1423">#1423</a>)</li>
<li>See full diff in <a
href="https://github.com/tauri-apps/wry/compare/wry-v0.47.2...wry-v0.48">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=wry&package-manager=cargo&previous-version=0.47.2&new-version=0.48.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-08 15:11:33 +08:00
Jason Lee
63a9e61fd1 Fix lint 2025-01-08 15:08:41 +08:00
Jason Lee
3773337e04
list: Add load_more. (#532) 2025-01-08 15:05:40 +08:00
xda
da4c188bc6
input: Support Cmd+Up, Cmd+Down, Cmd+Shift+Up, Cmd+Shift+Down (#531)
![2025-01-06 22 28
27](https://github.com/user-attachments/assets/16a20c24-b8d6-4d43-bfa0-6b2dd0d80ffc)
2025-01-06 23:02:40 +08:00
Jason Lee
e012eb6d07
history: Add unique mode to keep unique item in History. (#529) 2025-01-06 19:19:36 +08:00
Jason Lee
99e51288e0
table: Binding popup menu on the table not on row for avoid render it on each rows. (#528)
- Add `TableEvent::DoubleClickedRow` to emit double clicked row event to
table.
2025-01-03 18:10:07 +08:00
Jason Lee
5be03543dd
history: Export undos, redos methods, and add clear method. (#527) 2025-01-03 16:57:00 +08:00
xda
8b89b5ba7c
input: Fix TextInput cursor getting stuck on Down key press (#526)
## Before

![2025-01-03 13 55 08
before](https://github.com/user-attachments/assets/3714e316-289b-4426-b18a-23ac718c05e6)

## After

![2025-01-03 13 54 22
after](https://github.com/user-attachments/assets/5d82a864-6cda-4191-adee-26634ef93506)
2025-01-03 14:46:51 +08:00
xda
0cc6b90cde
input: Handle moving above the first line (#525) 2025-01-03 12:22:48 +08:00
Jason Lee
482a31fa19
input: Fix TextArea enter to newline not work and scroll to visible on move cursor. (#523)
Close #494

- Fix enter to newline.
- Fix to ensure scroll on move cursor or enter.
2024-12-31 19:19:14 +08:00
Jason Lee
a5427ae662
title_bar: Avoid zoom window on double clicked on title bar right area. (#522)
Close #516
2024-12-31 18:57:11 +08:00
xda
66d9a34844
tiles: Add History<I> to track changes with undo, redo methods. (#510)
![2024-12-27 10 45
47](https://github.com/user-attachments/assets/616feb99-bfb4-42b1-a4b7-9670503be4a5)
2024-12-31 18:47:21 +08:00
Jason Lee
ecce9f2633
number_input: Fix Number Input border to use cx.theme.input. (#521) 2024-12-27 19:03:24 +08:00
Jason Lee
d7cd0e54c2
list: Fix selected and confirmed list item detail. (#520)
Closes #519 to fix popup_menu attempt to subtract with overflow bug.
2024-12-27 18:41:27 +08:00
Jason Lee
0327df323d
modal: Fix Model, Drawer overlay size on tiling mode. (#518) 2024-12-27 17:22:02 +08:00
Jason Lee
6851e53183
dock: Fix to active prev tab, when current tab is invisible. (#517) 2024-12-27 11:58:19 +08:00
Jason Lee
9eba97ddf6
modal: Fix modal, drawer overlay position on Linux. (#515)
- Update `overlay` for Modal, still handle click out to dismiss, even it
no overlay.
2024-12-24 14:43:37 +08:00
Jason Lee
6acbfb5298 root: Fix window border and add cx.theme().window_border 2024-12-24 13:48:28 +08:00
Jason Lee
466c5e2005
root: Add window shadow to Root for support window border style on Linux. (#514)
And fix the title bar buttons click handle on Linux.
2024-12-24 13:33:06 +08:00
Jason Lee
3601cb399b
table: Use deferred to render scrollbar to avoid some element overflow it. (#513) 2024-12-24 11:40:50 +08:00
Jason Lee
7d8166a05e linux: Fix window border on Linux. 2024-12-24 11:33:33 +08:00
Jason Lee
ea0954b425
drawer: Render notification at the side of drawer when drawer (top, right) it opened. (#512)
This change to make sure notification will display when WebView render
on the drawer.

![Screenshot from 2024-12-24
09-25-10](https://github.com/user-attachments/assets/01d9685c-7790-4fe7-ba0a-217a0fec7d34)
2024-12-24 09:46:40 +08:00
Jason Lee
d051ac6a8c
table: Update last empty column to 20px width. (#511) 2024-12-23 19:36:58 +08:00
Jason Lee
11dbdb125a
chore: Removed ScrollableAxis use Axis instead. (#509) 2024-12-23 15:30:36 +08:00
Jason Lee
500aa2d7c5 table: Fix to only handle one way scrolling at same time. (#507)
Closes #314
2024-12-20 22:07:01 +08:00
Jason Lee
28463d3a18
panel: Fix panel to unexpected size chagnes when moved some panel. (#506)
### Before 



https://github.com/user-attachments/assets/9174033b-d901-412f-9176-cdef6438822f
2024-12-20 19:15:31 +08:00
Jason Lee
57c1da2441
panel: To keep panel size when it going to hidden. (#505)
This change for make sure when Panel to hide and show, the original
panel size will keep.
2024-12-20 19:02:55 +08:00
Jason Lee
c8fae22684 story: Fix image story image size. 2024-12-20 18:29:11 +08:00
xda
6a310c618f
input: Up, Down to keep the same column if it possible (#500)
Fix #468
2024-12-20 18:21:22 +08:00