Commit graph

514 commits

Author SHA1 Message Date
reya
8260b5f6a0
fix: wrong size variant in sizable trait (#493) 2024-12-17 09:22:48 +08:00
xda
5874c6974f
tiles: Add Tiles (#435)
## Break Changes

- Renamed `DockItemState` to `PanelState`.
- Renamed `DockItemInfo` to `PanelInfo`.
- Update `cx` type from `WindowContext` to `AppContext` for Panel trait
`panel_name` method.

## TODO

- [ ] Support merge panels into TabPanel.
- [ ] Support split panels into Tile.

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2024-12-16 20:33:14 +08:00
Jason Lee
5a1b61b0b5 chore: Update LICENSE-APACHE file to add copyright info. 2024-12-13 11:46:00 +08:00
Jason Lee
a5a72fcb5a
panel: Avoid render panel when TabPanel is collapsed. (#492)
Close #488

- Fix `collapsed` sync to `TabPanel` when load state.
2024-12-13 11:23:00 +08:00
Jason Lee
5630154590 chore: Save layout.json to target/layout.json. 2024-12-13 10:20:30 +08:00
Jason Lee
d701baed28
dock: Do not active tab when drop to TabPanel right empty area. (#491) 2024-12-12 19:18:42 +08:00
Jason Lee
28c072d9c6
table: Fix incorrect column offset when have fixed columns. (#490) 2024-12-12 17:40:25 +08:00
Jason Lee
8558da4a7b
table: Improve Table to only render visible range columns for performance up to stable on 120 FPS (#489)
This change to make Table to only render visible range columns.

With the example table story case:

- 32 columns

## Before

- Normally fast scroll: 80~90 FPS
- Drag fast scroll: 60 FPS

## After

- Normally fast scroll: 120 FPS
- Drag fast scroll: 90~100 FPS

![CleanShot 2024-12-12 at 16 57
54](https://github.com/user-attachments/assets/1553d109-442c-4633-92f2-d3a9724668f3)
2024-12-12 17:09:26 +08:00
Jason Lee
64a3b4399b
chore: Update GPUI with gradient support. (#487) 2024-12-12 10:19:38 +08:00
Jason Lee
094611a2ae
input: Avoid handle up, down in Input single line mode. (#485) 2024-12-10 19:01:35 +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
26024ba2b5
scrollbar: Use default cursor style when hovered on scrollbar. (#480)
- Move prepare code to `prepaint` stage.

Close #474
2024-12-10 14:43:02 +08:00
Jason Lee
22f60c7299
story: Revert scrollable for StoryContainer for fix size_full. (#479)
Ref #478
2024-12-10 14:38:09 +08:00
Jason Lee
782cea35fc
chore: Rename longbridgeapp to longbridge. (#477) 2024-12-10 11:36:39 +08:00
Jason Lee
9288dc91c2
input: Add to support multi-line Input. (#463) 2024-12-09 20:17:05 +08:00
ihavecoke
39ec84b989
table: Add a theme color to fixed the drag column in dark mode text style (#476) 2024-12-09 20:00:48 +08:00
Jason Lee
62ce148c19
scrollbar: Fix position may out of container bounds when clicked scrollbar bg. (#475) 2024-12-09 17:21:48 +08:00
Floyd Wang
59d9341280 image_story: Fix the pie_chart size 2024-12-09 16:00:19 +08:00
ihavecoke
bf0e3a22de
table: Emit MoveCol when moved column. (#473) 2024-12-09 15:21:37 +08:00
Jason Lee
d8636a31bd
chore: Fix clippy warnings. (#465) 2024-12-05 12:03:29 +08:00
reya
07a8e70d1a
dock: Add DockItem::panel (#464)
**Description**:
Improve the flexibility of `DockArea`, sometime user won't need a
`TabPanel`, just display some message or UI elements. Curren implement
only allow use Tab or Split. So this PR will add `Plain` to `DockItem`,
user can put anything which implement `PanelView` trait.

**Usage**:
```rust
let left_panels = DockItem::panel(Arc::new(<- PanelView ->));

_ = dock_area.update(cx, |view, cx| {
    view.set_version(DOCK_AREA.version, cx);
    view.set_left_dock(left_panels, Some(px(260.)), true, cx);
    view.set_center(dock_item, cx);
    view.set_dock_collapsible(
        Edges {
            left: false,
            ..Default::default()
        },
        cx,
    );
});
```

**Screenshot**
<img width="1300" alt="image"
src="https://github.com/user-attachments/assets/a01e427c-50f1-4509-82d1-76cc016aa7b3">
2024-12-05 11:12:08 +08:00
Jason Lee
bc7dfb877b
badge: Add Badge. (#462)
<img width="824" alt="image"
src="https://github.com/user-attachments/assets/1aacdb99-a890-46fb-a0db-a94eb125598b">

<img width="824" alt="image"
src="https://github.com/user-attachments/assets/b9af9807-4994-4050-84d9-cf5d4d8d172a">
2024-12-03 23:07:39 +08:00
Jason Lee
cc23291d19
breadcrumb: Add Breadcrumb. (#461)
<img width="1187" alt="image"
src="https://github.com/user-attachments/assets/a64b88da-bc57-4d28-a440-b4b7b456612b">
2024-12-03 22:24:44 +08:00
Jason Lee
23f9352295
button: Rename ButtonStyle to ButtonVariant. (#460)
This is a breaking changes, we need refactor exist code by this:

- `ButtonStyled` -> `ButtonVariants`
- `.style` -> `.with_variant`
- `ButtonStyle` -> `ButtonVariant`
- `ButtonCustomStyle` -> `ButtonCustomVariant`
2024-12-03 19:22:28 +08:00
Floyd Wang
7560542659
divider: Support custom colors (#459)
<img width="850" alt="image"
src="https://github.com/user-attachments/assets/0161b14d-88ae-4bdf-a515-34df9aefb845">
2024-12-03 19:06:10 +08:00
Jason Lee
bdcf552ecf
theme: Remove Theme::get_global, there have Theme::global method. (#458) 2024-12-03 18:55:50 +08:00
Ylin
ee38970d68 table: Make selected_{row,col} public (#456) 2024-12-03 16:21:36 +08:00
Ylin
dd1b767b8a
table: Make set_selected_row, set_selected_col public (#455)
Co-authored-by: Jason Lee <huacnlee@gmail.com>
2024-12-03 12:00:15 +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
Ylin
09455df61c
table: Fix disabled sort field change to default (#451)
Co-authored-by: linxin <xin.lin@longbridge-inc.com>
2024-12-02 11:28:16 +08:00
Jason Lee
8c464d6709
dock: Fix some panel cannot able to split (#450)
- Rename `set_root` to `set_center`.
2024-12-02 10:42:31 +08:00
Jason Lee
9d476f9517
scrollbar: Use paint_layer for scrollbar paint. (#448)
And increase scrollbar thumb color in normal mode.

But, it looks like no difference for performance.
2024-11-28 11:42:19 +08:00
Jason Lee
5468d034da
theme: Add color method for default color palette to get color by a scale number. (#447)
```rs
ui::red(50);
ui::blue(600);
```
2024-11-28 11:36:33 +08:00
Jason Lee
a941c7b32e
panel: Fix toggle button border overlap with first tab. (#446)
<img width="202" alt="image"
src="https://github.com/user-attachments/assets/ab7b9865-52be-4bdb-bade-9b0c47e83bb7">
2024-11-27 23:00:25 +08:00
Jason Lee
36dcc53824
dock: Add set_dock_collapsible to support setting the Docks to be collapsible or not. (#445)
Close #442 

In this case, the left Dock is not collapsible:

<img width="1165" alt="image"
src="https://github.com/user-attachments/assets/21422cdd-d686-4931-9285-925b8e8d3343">
2024-11-27 21:34:44 +08:00
Jason Lee
7fe91e4e12
dock: Add panel_style to support always show TabBar. (#444)
Close #441 

```rs
DockArea::new(MAIN_DOCK_AREA.id, Some(MAIN_DOCK_AREA.version), cx).panel_style(PanelStyle::TabBar)
```

<img width="1433" alt="image"
src="https://github.com/user-attachments/assets/2013188e-990b-4709-ac7e-43c2de8bc895">
2024-11-27 21:34:27 +08:00
xda
53fe5823ef
dock: Fix panel should have a maximal width restriction when resizing (#443)
https://github.com/user-attachments/assets/617336d2-5392-4eba-a1b4-f1234c8d2eec
2024-11-27 20:36:05 +08:00
Jason Lee
142d092867
dock: Add add_panel method to add panel to DockArea. (#440)
Ref #438 

https://github.com/user-attachments/assets/93b40aed-39f3-4d16-a442-13aa7a931895
2024-11-27 11:27:04 +08:00
Jason Lee
0119c80120
input: Update GPUI and fix Input changes. (#437)
Ref https://github.com/zed-industries/zed/pull/20968
2024-11-26 21:41:34 +08:00
dependabot[bot]
931d762955
build(deps): bump wry from 0.47.0 to 0.47.2 (#434) 2024-11-26 13:29:03 +08:00
Floyd Wang
ea6ec8aa5d
ui: Add number_input (#433)
https://github.com/user-attachments/assets/ae6f4e48-b0fa-4f8c-bff5-809c70848b06
2024-11-25 19:32:56 +08:00
Jason Lee
ea011d11d6
dock: Hide toggle button when side dock is not exist. (#431) 2024-11-22 15:38:47 +08:00
xda
d937a90db6 dock: Render toggle dock buttons inside the Panels. (#414)
Co-authored-by: Jason Lee <huacnlee@gmail.com>
2024-11-22 14:41:04 +08:00
Jason Lee
c2678268b2 chore: Update background assign to use into. 2024-11-21 15:02:46 +08:00
Floyd Wang
8b23193f8f
dock: Make the panel dock open state controllable (#429) 2024-11-20 11:24:42 +08:00
Jason Lee
e6012fcc8f
table: Improve table render performance. (#421)
Before: ~85 - 100FPS
After:  ~110 - 115FPS
2024-11-18 14:43:22 +08:00
Jason Lee
fa6abe5a9e
chore: Upgrade GPUI and fix API changes. (#426)
Refs:

- https://github.com/zed-industries/zed/pull/20349
- https://github.com/zed-industries/zed/pull/20371
- https://github.com/zed-industries/zed/pull/20686
2024-11-18 11:35:49 +08:00