Commit graph

69 commits

Author SHA1 Message Date
Jason Lee
9dade704fb
webview: Let webview as a feature and not default enable. (#648)
Close #646
2025-02-24 14:24:22 +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
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
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
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
Floyd Wang
6d0b332071
svg_img: Render SVGs with text tags (#390)
<img width="620" alt="image"
src="https://github.com/user-attachments/assets/61f2a1f8-6926-484d-bcb8-076a9d85e89c">
2024-11-07 11:39:06 +08:00
Jason Lee
fdca75d5a7
title_bar: Add a new TitleBar, remove the old version. (#348)
- Removed old workspace crate, moved out to
[gpui-workspace](https://github.com/huacnlee/gpui-workspace)

<img width="491" alt="image"
src="https://github.com/user-attachments/assets/5048491c-9b98-4af5-9f0f-9a0f20c2308f">

Icons for Windows and Linux use by SVG icon, it based on:

-
https://learn.microsoft.com/en-us/windows/apps/design/style/segoe-fluent-icons-font
- Download Font: [Segoe Fluent
Icons](https://learn.microsoft.com/en-us/windows/apps/design/downloads/#fonts)
2024-10-16 16:22:17 +08:00
Jason Lee
33200aa685
webview: Blur WebView when clicked out to fix IME cannot input bug. (#320)
- Closes #316 
- Ref https://github.com/tauri-apps/wry/pull/1385

## Before

https://github.com/user-attachments/assets/cc614334-47fe-4722-8745-aea783fbab4a

## After

On macOS, now the IME bug is gone.

https://github.com/user-attachments/assets/363bb016-229f-4766-84f7-6a4838e490bf

https://github.com/user-attachments/assets/320c5c1c-cfac-4165-af8a-bc9708952460
2024-10-08 17:01:52 +08:00
Jason Lee
9bc4887d55 Update dependencies. 2024-09-09 22:33:41 +08:00
Jason Lee
d659713555
Fix Label, Checkbox, Radio to support label text wrap. (#90)
<img width="1102" alt="image"
src="https://github.com/user-attachments/assets/1443378d-54e9-43a4-8bb8-0d0f4581169d">
2024-07-31 11:49:32 +08:00
Jason Lee
f6146220e4
Add WebView (#2)
- https://github.com/huacnlee/zed/pull/6
- https://github.com/zed-industries/zed/pull/13730
2024-07-18 18:00:23 +08:00
Jason Lee
eb43c78cea
Add to support open Popover as a child window. (#18)
## Goal

Change to let Popup elements open into a window, to make sure the Popup
windows, panels, menus render top than the WebView.

Then we can embed wry or other webview into GPUI.



https://github.com/huacnlee/gpui-component/assets/5518/ce005456-088f-4298-bf5d-2642cf96faff


----

This is also like other software, they are also used in child window to
render the menus, popups.

- https://github.com/huacnlee/gpui-component/pull/2
- https://github.com/zed-industries/zed/pull/13730

## Todos

- [x] Multiple display window position.
- [x] Windows transparent background. (No transparent, just render a
correct window border)
- [x] Disable window resize on Windows. 
- [ ] Handle Menu action.
- [x] Provided `popover` or `window` two mode to uses.
2024-07-11 16:20:26 +08:00
Jason Lee
ac789b2379
Add Table (#16)
https://github.com/huacnlee/gpui-component/assets/5518/8603cbcc-c416-4d10-84a0-8cfe2e021e1a
2024-07-06 21:01:16 +08:00
Jason Lee
f2703122b8 Move title_bar, util into workspace. 2024-07-01 23:51:47 +08:00
Jason Lee
502d4df135
Add Dock & Panel (#10)
https://github.com/huacnlee/gpui-component/assets/5518/51622a5e-f51d-4ede-8cae-04cae703f8aa
2024-07-01 14:20:56 +08:00
Jason Lee
3288270b49
Add Popover (#6) 2024-06-29 10:03:59 +08:00
Jason Lee
1f21469e7b Split story into a crate. 2024-06-26 14:38:06 +08:00
Jason Lee
94cb714ebf Update to use shadcn ui theme 2024-06-24 15:39:26 +08:00
Jason Lee
9ffea5798e First commit, with Button UI. 2024-06-13 21:46:28 +08:00