Commit Graph

270 Commits

Author SHA1 Message Date
Nathan Sobo
fb3382bcc5 Merge remote-tracking branch 'origin/main' into perf-2 2023-12-14 14:16:59 -07: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
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
Mikayla
2c4d83c9af
WIP
co-authored-by: conrad <conrad@zed.dev>
co-authored-by: Nathan <nathan@zed.dev>
2023-11-20 14:46:01 -08:00
Conrad Irwin
0798cfd58c Merge branch 'main' into derive-element-redux 2023-11-20 09:15:38 -07:00
Conrad Irwin
0711121586 Add some test cases 2023-11-18 22:16:28 -07:00
Nathan Sobo
33cd6f520a Clean compile with redesigned element traits 2023-11-18 21:51:47 -07:00
Conrad Irwin
7172ce37b1 Fix text wrapping when a child of a v_stack() 2023-11-18 20:35:22 -07:00
Nathan Sobo
adc355a1e6 Element refinement passing on ui2 2023-11-18 20:05:47 -07:00
Nathan Sobo
23ffce9fbe WIP: Work toward eliminating Component trait
This refactor enhances the overall design by promoting reusable and composable UI component structures within the Zed project codebase.
2023-11-18 00:03:23 -07:00
Conrad Irwin
6d4276ea5f Merge branch 'main' into collab_ui2 2023-11-16 22:08:42 -07:00
Conrad Irwin
547888942f Add storybook3 2023-11-16 19:42:25 -07:00
Marshall Bowers
b559bfd80f
Parameterize theme2::init to allow loading just the base theme (#3345)
This PR adds a parameter to the `theme2::init` method to indicate what
the theme-loading behavior should be.

This allows us to indicate when we want to load all of the additional
built-in user themes (like in the Zed binary and in the storybook), and
when we don't want to load the user themes (like in tests).

We're using an enum over just a `bool` here for clarity at the call
site.

Release Notes:

- N/A
2023-11-16 13:03:30 -05:00
Conrad Irwin
74afa62a55 Add Overlay component to gpui2 2023-11-15 23:00:36 -07:00
Nathan Sobo
4f09633379 Remove focus_in styling helper 2023-11-15 14:17:49 -07:00
Nathan Sobo
6abaacc457 Fix formatting 2023-11-14 01:58:10 -07:00
Nathan Sobo
364e3e7de5 Merge remote-tracking branch 'origin/main' into element-types 2023-11-14 01:55:58 -07:00