Commit graph

43 commits

Author SHA1 Message Date
Jason Lee
ca9d5b77e2 chore: Release v0.2.0 2025-10-09 15:21:10 +08:00
Jason Lee
6ca9ac46fa
chore: Bump crate version. (#1340) 2025-10-09 15:20:34 +08:00
Floyd Wang
66851c55e4 Bump gpui (#1336) 2025-10-08 11:20:06 +08:00
Copilot
ed05c3ebec
chore: Remove Wef code as it has been extracted to separate repository (#1302)
All WEF (Web Embedding Framework) related code has been successfully
removed from the repository as it has been extracted to
https://github.com/longbridge/wef

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: huacnlee <5518+huacnlee@users.noreply.github.com>
2025-09-29 15:31:58 +08:00
Jason Lee
4983300ddf
input: Update RopeExt to use LF style for get correct line when have \r. (#1296) 2025-09-28 01:04:14 +08:00
Jason Lee
1c3eca93b8
editor: Revert to use ropey. (#1284)
For the License reason.

- The performance is slow down, before version can handle 200K lines,
now 150K lines is good.
2025-09-24 20:52:18 +08:00
Jason Lee
5e7a2cb37f
editor: Add DefinitionProvider. (#1261)
https://github.com/user-attachments/assets/f8234a3f-3075-48ce-ae46-8ea869b6a13d

- Hold `cmd` to hover on a word to trigger definition check.
2025-09-19 13:49:24 +08:00
Jason Lee
f1b6d7c5ed editor: Add completion, code_action provider. (#1242) 2025-09-15 19:25:02 +08:00
Jason Lee
a9953a9349
input: Use zed's Rope (#1214)
Now with 10K lines plain text, in release mode on macOS. The
`large-text` example can work with:

- 120 FPS for display.
- 90 FPS for update text.

```
MTL_HUD_ENABLED=1 cargo run --example large-text --release
```

- Fixed the cursor position at end of line, also support at start of
line.


https://github.com/user-attachments/assets/1de52f6c-e138-4ed3-a600-06372a807ed8

### Check list

- [x] Modifying Text with Rope
- [x] LineColumn, GoToLine
- [x] Code Highlight
- [x] Delete word, select word
- [x] Delete line
- [x] Move left, right, up, down
2025-09-08 16:44:52 +08:00
Chuqiao Feng
8992852165
inspector: Add live editor to inspector (#1205)
Inspired by Zed, this PR implements a simple live Rust and JSON style
editor for the inspector.

The rust style editor only supports `Styled` and `StyledExt` method
calls with no arguments.




https://github.com/user-attachments/assets/df7f1746-92d7-416c-afd5-e389ac3ea9ae

---------

Co-authored-by: Floyd Wang <gassnake999@gmail.com>
2025-09-05 11:58:36 +08:00
Jason Lee
2cfb5d24a9
highlighter: Use sum_tree to store the highlight cache. (#1198) 2025-09-03 14:09:46 +08:00
Jason Lee
6ae7558c44
theme: Add ThemeRegistry to load and watch themes dir. (#1148) 2025-08-18 19:29:27 +08:00
Jason Lee
63f61dca04
chore: Avoid built-in tree-sitter languages in default. (#1135)
With a `tree-sitter-languages` feature to enable it (Default not
enable).

Changed this for reduce the application size (From 52 MB to 22MB), Ref
#1132

Now default only includes `tree-sitter-json`, if you want more:

```toml
[dependencies]
gpui-component = { features = ["tree-sitter-languages"] }
```

---

```
cargo bloat -p hello_world --release -n 10
    Finished `release` profile [optimized] target(s) in 0.27s
    Analyzing target/release/hello_world

 File  .text    Size              Crate Name
 0.4%   1.4% 88.5KiB simple_minify_html simple_minify_html::code_gen::attrs::ATTRS::{{closure}}
 0.3%   1.0% 62.1KiB              taffy taffy::compute::grid::track_sizing::resolve_intrinsic_track_sizes
 0.1%   0.5% 32.6KiB     gpui_component gpui_component::theme::theme_color::ThemeColor::dark
 0.1%   0.5% 30.0KiB     gpui_component gpui_component::theme::theme_color::ThemeColor::light
 0.1%   0.5% 29.9KiB          html5ever html5ever::tree_builder::TreeBuilder<Handle,Sink>::step
 0.1%   0.4% 27.2KiB               gpui taffy::compute::flexbox::compute_flexbox_layout
 0.1%   0.4% 23.3KiB               usvg usvg::text::layout::layout_text
 0.1%   0.4% 22.5KiB              resvg resvg::filter::apply_inner
 0.1%   0.3% 21.4KiB               gpui jpeg_decoder::decoder::Decoder<R>::decode_internal
 0.1%   0.3% 21.2KiB         image_webp image_webp::lossless::LosslessDecoder<R>::decode_image_stream
25.3%  94.3%  5.7MiB                    And 14091 smaller methods. Use -n N to show more.
26.8% 100.0%  6.0MiB                    .text section size, the file size is 22.4MiB
```
2025-08-14 18:02:27 +08:00
Jason Lee
7d3301d695
tab_bar: Fix some incorrect style in TabBar. (#1078)
This change to fix some incorrect style use, that will break in Taffy
0.5.2+

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

- Add `Tab::empty` to create a Tab without label.
- Fix form layout in Taffy new version.
- Update GPUI for scroll API changes.
2025-07-22 13:30:04 +08:00
Jason Lee
9c782796c2
theme: Improve theme color fallbacks based on base colors. (#1069)
- Added a lot of default fallbacks for theme colors based on `base`
colors.
- Added `hue`, `saturation`, `lightness` method to change Hsla color.
- Update stories to use theme colors, not a direct color.
- Improve `Badge`, `Avatar` to use theme colors.
- Added a new theme: `Fahrenheit`.
2025-07-17 11:43:40 +08:00
Jason Lee
977ce5df29
theme: Refactor Theme config to support JSONSchama. (#1068) 2025-07-16 19:22:09 +08:00
Jason Lee
c9b5993472
story: Improve story case style. (#1060) 2025-07-15 11:56:07 +08:00
Jason Lee
44427afacb
theme: Add to support highlight color to theme config. (#1055)
<img width="1058" height="1026" alt="image"
src="https://github.com/user-attachments/assets/300fb16b-c5e4-4eef-9690-54fcabc4fe47"
/>
<img width="836" height="855" alt="image"
src="https://github.com/user-attachments/assets/3fdc8301-375d-4223-a2ea-8d4f411a90bd"
/>
2025-07-14 17:04:18 +08:00
Jason Lee
41663ca030
chore: Update GPUI and fix FocusableWrapper removed error. (#1026)
Close #1024 

Ref https://github.com/zed-industries/zed/pull/32436
2025-07-02 11:06:04 +08:00
Sunli
b70b229370
wef: Added a new WebView component named "Wef" based on CEF. (#877)
Wef is a Rust library for embedding WebView functionality using Chromium
Embedded Framework (CEF3) with offscreen rendering support.
2025-06-17 18:57:44 +08:00
Floyd Wang
516c8fada4
chart: Introduce chart (#878)
Add a new component called `plot`. It provides a low-level approach to
data analysis and visualization.
Chart is a collection of ready-to-use chart components built with
`plot`.

| Light | Dark |
| - | - |
| <img width="1712" alt="SCR-20250604-qhxb"
src="https://github.com/user-attachments/assets/bf7ce76e-ab7a-42c2-92e7-17cd135de66f"
/> | <img width="1712" alt="SCR-20250604-qhxr"
src="https://github.com/user-attachments/assets/dd3e44ea-bbb5-41a2-8cce-38b316d7d800"
/> |
2025-06-04 19:22:11 +08:00
Jason Lee
901312bc5a
chore: Switch gpui to depends on Zed official. (#912)
Now, GPUI have merged `window_handle` support for all platforms.

- https://github.com/zed-industries/zed/pull/24327
- https://github.com/zed-industries/zed/pull/24545
- https://github.com/zed-industries/zed/pull/28152

It's time to depends on Zed official main branch.
2025-06-02 10:05:45 +08:00
Jason Lee
38d9c24af5
chore: Update getter method to return reference to view components. (#827) 2025-04-30 17:18:44 +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
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