Commit graph

639 commits

Author SHA1 Message Date
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