Commit graph

96 commits

Author SHA1 Message Date
Jason Lee
e2463bbdcf
linux: Fix sync_system_appearance on Linux. (#796)
Close #104
2025-04-16 14:55:01 +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
Floyd Wang
f34ebdf621
theme: Update table_head_foreground (#753) 2025-03-31 15:12:54 +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
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
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
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
d009b37bf1
tab: Add tab_bar_segemented theme variable. (#690) 2025-03-05 19:07:58 +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
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
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
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
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
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
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
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
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
86db990b51
chore: Add #[inline] to util methods. (#576) 2025-01-24 15:34:57 +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
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
464fceac96
theme: Rename destructive to danger (#541) 2025-01-10 15:16:19 +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
4e3b988e24
theme: Fix secondary active color in light mode. (#498)
<img width="968" alt="image"
src="https://github.com/user-attachments/assets/e86a3772-227e-4223-adbd-fb0387f9d735"
/>
2024-12-18 18:13:46 +08:00
Jason Lee
cf090923a7
theme: Fix lighten, darken method. (#483)
Close #332
2024-12-10 17:35:44 +08:00
Jason Lee
9f0f05af2d
scrollbar: Adjust scrollbar style and add scrollbar_thumb_hover to theme. (#482)
<img width="297" alt="image"
src="https://github.com/user-attachments/assets/1779bf6c-2d01-4a12-9052-2ba571bff68b">

<img width="301" alt="image"
src="https://github.com/user-attachments/assets/9971b248-9a48-47ff-847c-00eafff17fe1">
2024-12-10 17:08:09 +08:00
Jason Lee
2836540260
scrollbar: Improve scrollbar behaviour. (#481)
- Only show scroll when recent scrolled.
- Keep showing scrollbar when is visible and hovered on.
- Delay 3s to fade out.
- If not visible, do not handle mouse down event.
- Add `cx.theme().scrollbar_show` option to control scrollbar show
`[Hover, Scrolling]`, default: `Scrolling`.

Close #472

![CleanShot 2024-12-10 at 15 43
43](https://github.com/user-attachments/assets/17e5f46a-5602-4544-9a5c-82ec68a24dd4)
2024-12-10 16:18:38 +08:00
Jason Lee
d8636a31bd
chore: Fix clippy warnings. (#465) 2024-12-05 12:03:29 +08:00
Jason Lee
bdcf552ecf
theme: Remove Theme::get_global, there have Theme::global method. (#458) 2024-12-03 18:55:50 +08:00
Jason Lee
97c01c75e8
theme: Fix menu item hover style. (#454)
<img width="470" alt="image"
src="https://github.com/user-attachments/assets/0255d03d-1e67-49c7-ad3f-5507777d82a3">
<img width="449" alt="image"
src="https://github.com/user-attachments/assets/ab7dd027-8e81-408b-8d02-69cc27fcb801">
<img width="255" alt="image"
src="https://github.com/user-attachments/assets/e789cceb-8aa6-432e-abb0-ba7a14b793bd">
2024-12-03 10:07:53 +08:00
Jason Lee
23d273eaf9
sidebar: Add Sidebar (#452)
Close #430

<img width="1150" alt="image"
src="https://github.com/user-attachments/assets/2564bcfa-7aff-41d3-a7be-496ef2365e30">

<img width="1150" alt="image"
src="https://github.com/user-attachments/assets/18c6718a-7641-4e8f-ad0f-bc18bd91fc42">
2024-12-02 23:21:39 +08:00
Jason Lee
e478d5606f
chore: Add base ui attributes to Root and add change font size to story to test font adjust. (#409) 2024-11-12 11:17:16 +08:00
ihavecoke
f96c21782d
skeleton: Fix the bug where the theme color of the skeleton does not display in light mode (#407) 2024-11-11 11:48:03 +08:00
Jason Lee
3508453b11
theme: Rename Colors to ThemeColor and public it. (#395) 2024-11-05 23:02:54 +08:00
Jason Lee
26211000f7
button: Fix Button disabled style. (#394)
- Fix `lighten`, `darken` method for Hsla.
<img width="619" alt="image"
src="https://github.com/user-attachments/assets/75c64f46-1551-4abf-8521-f0b9c90682d2">
<img width="620" alt="image"
src="https://github.com/user-attachments/assets/9f3655ba-1506-4e58-aa20-b17546fbc215">
2024-11-05 14:36:05 +08:00
Jason Lee
292d1a6a9a
theme: Rename title_bar_background to title_bar. (#382)
Use same name rule as other theme variables.
2024-10-30 14:25:21 +08:00
Jason Lee
4bef681c9a
table, list: Add right clicked row style and improve selection style. (#362)
- table: Add `content_menu` to TableDelegate.

<img width="644" alt="image"
src="https://github.com/user-attachments/assets/4c21299f-00e8-4a61-964d-338ef7daa802">
2024-10-18 11:52:14 +08:00
Jason Lee
f35db249a6
theme: Update GPUI and imporve dark color. (#358)
## Before

<img width="1712" alt="image"
src="https://github.com/user-attachments/assets/f4e74cf0-e386-4e91-86d1-05ee75b26471">

## After 

<img width="1712" alt="image"
src="https://github.com/user-attachments/assets/da393ea9-79ee-4535-a46d-68684d7ad738">
2024-10-17 19:14:42 +08:00
Jason Lee
8eff75d357
accordion: Add Accordion. (#355)
<img width="920" alt="image"
src="https://github.com/user-attachments/assets/3269aa05-7531-43a1-84a9-469959a68d06">
2024-10-17 17:31:59 +08:00
Jason Lee
1fdcff3b51
theme: Add apply_color to theme to support merge a new color into theme color. (#353)
- Fix #334 to keep selected theme color.

## Example

<img width="1472" alt="image"
src="https://github.com/user-attachments/assets/3a05f58c-2720-436c-8df9-c582871d87d5">
<img width="1472" alt="image"
src="https://github.com/user-attachments/assets/5b8db494-1402-4785-8d98-a87173b15284">
<img width="1472" alt="image"
src="https://github.com/user-attachments/assets/0305c05b-c2fb-4fea-9a50-5aa00de504fe">
<img width="1472" alt="image"
src="https://github.com/user-attachments/assets/91fbb7b6-7494-440d-95bf-2de37d6bbb44">
2024-10-16 18:38:21 +08:00
Jason Lee
ce10a0340c
table: Set fixed height to table head to fix some case table head disappear bug. (#300)
Closes #299 

- Improved sort icon to better color.
- Improved table story.
- Disable `horizontal_scroll_handle.scroll_to_item` on select_col, there
have a bug need to fix.
2024-10-03 10:14:44 +08:00
Jason Lee
13e42dfac3
table: Add to support fixed column on left to Table. (#295)
- Update table details, fix table head height.
- Add `table_row_border` theme color and use this for row border.

## Demo

https://github.com/user-attachments/assets/91df4b9d-f079-4ddb-b14d-fbcf303dcc44

Fix #292
2024-10-02 22:02:21 +08:00
Jason Lee
33e5fdcb78
scrollbar: Smaller the scrollbar size. (#294)
<img width="918" alt="image"
src="https://github.com/user-attachments/assets/787766ab-63eb-4568-972b-5abd668511f7">
2024-10-02 18:15:53 +08:00
Jason Lee
2a331fcb79
theme: Add shadow option to support toggle shadow for base controls, default: true. (#268)
- Add shadow to Button if it enabled.
2024-09-24 10:52:01 +08:00
Jason Lee
a8d4abea69
button: Improve ButtonGroup to add style, size methods. (#241)
- Add `ButtonStyled` trait to apply the style for Button and
ButtonGroup.
2024-09-13 12:00:47 +08:00
Floyd Wang
9388b88f59
theme: Simplify init (#237) 2024-09-12 16:14:41 +08:00
Jason Lee
e1d6b3aaed
dock: Improve drop target style and size to 35%. (#217) 2024-09-04 22:01:09 +08:00
Jason Lee
476f97d5e0
scrollbar: Opacity scrollbar when not hover on it. (#213)
https://github.com/user-attachments/assets/ea070e6f-3d4c-4a0d-b6da-be34e7dfc579
2024-09-04 16:48:49 +08:00