Commit Graph

284 Commits

Author SHA1 Message Date
Nathan Sobo
47071605a1 Merge remote-tracking branch 'origin/main' into new-view-new-model-rename 2024-01-01 17:42:12 -07:00
Nathan Sobo
db1cf8f6e1 Rename build_view to new_view and build_model to new_model
The word "new" is shorter and blends in with `new` constructors that are common
in Rust. Been meaning to do this for a while.
2024-01-01 17:42:01 -07:00
Nathan Sobo
81b03d379e Rearrange to hopefully make merging easier 2024-01-01 12:21:17 -07:00
Nathan Sobo
51d1d92d66 Attempt to return impl Element from render. 3 errors. 2024-01-01 14:23:02 +01:00
Marshall Bowers
71a222abcb Use sparse spacing for ListItems in Pickers 2023-12-21 16:33:41 -05:00
Marshall Bowers
443b1dd345 Add ToggleButton component 2023-12-20 18:23:21 -05:00
Nate Butler
f459fc5e27 Fix import 2023-12-15 10:33:27 -05:00
Nate Butler
62ea58618c Merge branch 'main' into story-enhancements 2023-12-15 10:26:59 -05:00
Nate Butler
3d9e051b07 Update storybook2.rs 2023-12-15 10:25:07 -05:00
Nate Butler
936c78be94 WIP IconButton story 2023-12-14 17:51:08 -05:00
Nate Butler
3cf003763e Use updated story container in Text story 2023-12-14 17:38:22 -05:00
Nate Butler
63c3edfb83 Continue styling new story components 2023-12-14 16:52:05 -05:00
Nathan Sobo
fb3382bcc5 Merge remote-tracking branch 'origin/main' into perf-2 2023-12-14 14:16:59 -07:00
Nate Butler
c041799c6a Extend Story components, allow linking to story file
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-12-14 15:55:17 -05:00
Nathan Sobo
1ae25f52a1 WIP 2023-12-14 10:31:45 -07:00
Marshall Bowers
fd133df896
Improve storybook story selection (#3653)
This PR builds on top of #3652 by adding a selection prompt to the
storybook to allow you to choose from the available list of stories if
you don't provide one explicitly:

<img width="1387" alt="Screenshot 2023-12-14 at 12 00 26 PM"
src="https://github.com/zed-industries/zed/assets/1486634/640d62a3-1340-45f1-9746-69b513faff62">

This way we don't have to keep generating the `script/storybook` script
whenever stories are added/removed.

#### Usage (through `cargo`):

```sh
# Select from the available stories
cargo run -p storybook2

# Run a specific story
cargo run -p storybook2 -- components/list_item
```

#### Usage (through `script/storybook`):

```sh
# Select from the available stories
./script/storybook

# Run a specific story
./script/storybook list_item
```

Release Notes:

- N/A
2023-12-14 12:13:02 -05:00
Nate Butler
4ace342cf0 Fix typo 2023-12-14 11:59:24 -05:00
Nate Butler
ac3622cc6a Generate script/storybook 2023-12-14 11:42:08 -05:00
Antonio Scandurra
13c064186a
Fix regressions in focus and active support (#3622)
Release Notes:

- N/A
2023-12-13 11:31:37 +01:00
Max Brunsfeld
a579713a45 Allow dragging and dropping tabs
Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Marshall <marshall@zed.dev>
2023-12-12 15:07:03 -08:00
Marshall Bowers
e489e2e583
Enable scrolling in tab bar (#3614)
This PR enables scrolling horizontally in the tab bar.

Currently this requires holding down <kbd>Shift</kbd> for the scroll to
activate. We'll need to look into this.

Scrolling also currently works when there is a split in the editor, as
the non-split view goes down a different rendering path that does not
constrain the pane width, which breaks a number of things.

Release Notes:

- N/A
2023-12-12 16:38:25 -05:00
Marshall Bowers
d2feaa41a5
Extract TabBar component (#3613)
This PR extracts a new `TabBar` component from the tab bar
implementation in the workspace.

Release Notes:

- N/A
2023-12-12 15:50:05 -05:00
Antonio Scandurra
e53b9f5ccf Fix Div::active not working
Somehow a condition got inverted and caused the bug.
2023-12-12 17:40:22 +01:00
Kirill Bulatov
ca8e8d1065 Finish removing all dangerous focus APIs 2023-12-12 16:11:14 +02:00
Kirill Bulatov
717b2885f8 Attempt to remove the dangeous element focus API 2023-12-12 15:07:27 +02:00
Marshall Bowers
75c1f0e997
Add w_vw and h_vh to StyledExt for setting sizes in viewport units (#3600)
This PR adds `w_vw` and `h_vh` methods to `StyledExt`.

These methods are the same as their `w` and `h` counterparts, but
operate in viewport units, giving us the equivalent of `vw` and `vh` in
CSS.

You can see them in action in this story:

```
cargo run -p storybook2 -- components/viewport_units
```

Release Notes:

- N/A
2023-12-11 18:19:11 -05:00
Conrad Irwin
4290c67b6a Restore namespace parameter to actions!
This does not yet fix `derive(Action)`, but will conflict with a lot so
wanted to merge quickly.
2023-12-09 15:18:31 -07:00
Marshall Bowers
393be3cedf
Extract Tab component (#3539)
This PR extracts a new `Tab` component from the tabs implementation in
the workspace.

This will allow us to reuse this component anywhere that we need to use
tabs.

Like our other newer components, the `Tab` component has a relatively
open API.

It accepts `children` (or `child`) as well as a `start_slot` and
`end_slot` to position content in the slots on either end of the
content. These slots also respect the `TabCloseSide` and will switch
positions based on this value.

<img width="763" alt="Screenshot 2023-12-07 at 12 19 42 PM"
src="https://github.com/zed-industries/zed/assets/1486634/78e4db6a-f807-431e-8777-f52f2631e6ed">

Release Notes:

- N/A
2023-12-07 12:30:43 -05:00
Marshall Bowers
c10d8a8110
Fix cursor styles not displaying properly (#3493)
This PR fixes an issue where an element with a cursor style set would
not update the cursor when hovering over it.

Previously the cursor style would only appear by interacting with the
element in some way, for instance, by clicking on the element or by
having a `.hover` with some other style being applied.

Release Notes:

- N/A
2023-12-04 16:40:53 -05:00
Nate Butler
80ae640060 Add additional cursors to gpui2
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-12-04 11:20:41 -05:00
Julia
13f4cc563c Merge branch 'main' into zed2-breadcrumbs 2023-12-01 11:02:34 -05:00
Antonio Scandurra
c9be637b6b
Re-introduce auto-height in editor2 (#3471)
Release Notes:

- N/A
2023-12-01 12:02:45 +01:00
Marshall Bowers
e5a5b1e84c
Rework ListHeader to be more open (#3467)
This PR reworks the `ListHeader` component to be more open.

The `meta` method can now be used to append meta items of any element to
the `ListHeader`, and they will be rendered with the appropriate spacing
between them.

Release Notes:

- N/A
2023-11-30 15:55:31 -05:00
Antonio Scandurra
0e1597d385 WIP 2023-11-30 18:00:41 +01:00
Julia
428c517693 Merge branch 'main' into zed2-breadcrumbs 2023-11-30 11:38:29 -05:00
Marshall Bowers
6f5cc0af94 Rework Disclosure component 2023-11-29 14:07:48 -05:00
Marshall Bowers
390b0d8d56 Reorganize list components 2023-11-29 13:34:50 -05:00
Nate Butler
a8bf0834e6
Button2 – Part1 (#3420)
## TODO

- [x] Remove `InteractionState`
- [ ] `Selectable` should use `Selection` instead of a boolean
- [x] Clean out ui2 prelude
- [ ] Build out button2 button types
- [ ] Port old buttons

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-29 12:23:09 -05:00
Marshall Bowers
ee027bc112
Fix tooltips not showing on IconButtons (#3427)
This PR fixes tooltips not showing on `IconButton`s.

The "fix" here is the same hack that we used to fix `on_click` handlers
for `ListItem`s, where we introduce another layer of wrapping with an
element with an ID set.

This PR also adds a story for the `IconButton` so this issue can be
tested/observed in isolation.

Release Notes:

- N/A
2023-11-28 17:01:53 -05:00
Marshall Bowers
8ee84249ec
storybook2: Unsuppress and fix warnings (#3425)
This PR unsupresses the warnings in `storybook2` and summarily fixes
them.

Release Notes:

- N/A
2023-11-28 15:43:43 -05:00
Marshall Bowers
874fde09ab
Add inset variant to ListItem (#3422)
This PR adds an inset variant to the `ListItem` component.

We're now using this inset variant for the `ListItem`s we render in
pickers.

Release Notes:

- N/A
2023-11-28 14:27:19 -05:00
Marshall Bowers
ecb3bd7f59 Use ListItems in Picker story 2023-11-28 10:52:17 -05:00
Marshall Bowers
63bd4ac999 Allow render_match to return an Option to represent no matches 2023-11-28 10:33:13 -05:00
Julia
d551b41aae zed2: Mostly port breadcrumbs & improve StyledText api
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2023-11-27 16:09:31 -05:00
Marshall Bowers
19ecccb107 Add ListItem story 2023-11-27 14:20:33 -05:00
Antonio Scandurra
1ad22231d2 Allow providing a background color in a TextRun 2023-11-23 18:55:16 +01:00
Antonio Scandurra
56d043f671 Allow finding which ranges were clicked on an InteractiveText 2023-11-23 18:08:49 +01:00
Nathan Sobo
c23f17ee0b Reorganize element-related traits 2023-11-22 11:19:43 -07:00
Marshall Bowers
a94cf54aab
Fix storybook (#3379)
This PR fixes storybook and gets it back into a compiling and running
state.

Release Notes:

- N/A
2023-11-21 14:28:00 -05:00
Marshall Bowers
1b05aad30c
Extract Story into separate story crate (#3378)
This PR extracts the `Story` component into a separate `story` crate so
that it can be shared among various crates that define stories.

Release Notes:

- N/A

---------

Co-authored-by: Nate Butler <iamnbutler@gmail.com>
2023-11-21 13:42:00 -05:00