Commit graph

315 commits

Author SHA1 Message Date
Nate Butler
2b0c959137 Add terminal colors to ThemeColors, add _background to some color names. 2023-11-02 19:53:52 -04:00
Nathan Sobo
29d8390743 Fix formatting 2023-11-02 12:28:58 -06:00
Nathan Sobo
1dd20d4c0a Merge remote-tracking branch 'origin/main' into gpui2-image-reborrow 2023-11-02 12:25:06 -06:00
Marshall Bowers
0e1d2fdf21 Checkpoint: Narrow down error 2023-11-02 12:47:06 -04:00
Marshall Bowers
66e4d75e6f Checkpoint: Reproduction with Avatar story 2023-11-02 12:34:40 -04:00
Nate Butler
6f41a77a25 Document format_distance
Adds docs for:
- distance_in_seconds
- distance_string
- naive_format_distance
- naive_format_distance_from_now
2023-11-02 11:53:20 -04:00
Marshall Bowers
ec0cff0e1a
Add map method to Components (#3210)
This PR adds a `map` method to the `Component` trait.

`map` is a fully-generalized form of `when`, as `when` can be expressed
in terms of `map`:

```rs
div().map(|this| if condition { then(this) } else { this })
```

This allows us to take advantage of Rust's pattern matching when
building up conditions:

```rs
// Before
div()
    .when(self.current_side == PanelSide::Left, |this| this.border_r())
    .when(self.current_side == PanelSide::Right, |this| {
        this.border_l()
    })
    .when(self.current_side == PanelSide::Bottom, |this| {
        this.border_b().w_full().h(current_size)
    })

// After
div()
    .map(|this| match self.current_side {
        PanelSide::Left => this.border_r(),
        PanelSide::Right => this.border_l(),
        PanelSide::Bottom => this.border_b().w_full().h(current_size),
    })
```

Release Notes:

- N/A
2023-11-02 11:39:40 -04:00
Nate Butler
d4db7a14b3 Remove unused import 2023-11-02 11:04:04 -04:00
Nate Butler
3b91a76159 Merge branch 'main' into n/t2 2023-11-02 11:02:55 -04:00
Nate Butler
d48ec7d58e Remove unused import 2023-11-02 11:02:46 -04:00
Nate Butler
6d562aaa6f Use naive_format_distance_from_now in Notifications 2023-11-02 11:02:17 -04:00
Nate Butler
b76c117979 Update naive_format_distance and tests 2023-11-02 10:37:33 -04:00
Nate Butler
cde7b244bc Checkpoint - impl format_distance 2023-11-02 10:11:25 -04:00
Nathan Sobo
db9ccd7f34 Merge remote-tracking branch 'origin/main' into gpui2-no-send 2023-11-01 21:10:31 -06:00
Nathan Sobo
53066df522 Get project2 tests green 2023-11-01 20:14:40 -06:00
Nate Butler
d0975aacac Merge branch 'main' into n/t2 2023-11-01 16:52:43 -04:00
Nate Butler
229ba0744e Add additional notifications and style tweaks
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-01 16:50:59 -04:00
Nate Butler
be3cc6458c Implement Notifications
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-01 16:34:42 -04:00
Nate Butler
3f74f75dee WIP 2023-11-01 16:19:49 -04:00
Marshall Bowers
b910bbf002
Add ui_font_size setting (#3199)
This PR adds a new `ui_font_size` setting that can be used to control
the scale of the entire UI.

We use the value in this setting to set the base rem size of the window.

Release Notes:

- N/A
2023-11-01 13:11:12 -04:00
Nate Butler
8dafd5f1f3 Allow ListHeader to take a meta 2023-11-01 12:43:25 -04:00
Marshall Bowers
3189cd779e Remove unused impl 2023-11-01 10:52:25 -04:00
Nate Butler
3bcc2fa17b Update notifications panel 2023-11-01 02:10:23 -04:00
Nate Butler
bfb1f5ecf0 Continue refining theme, update tabs & tab bar 2023-11-01 01:41:33 -04:00
Nate Butler
0efd69c60f Refine default colors 2023-11-01 00:51:57 -04:00
Marshall Bowers
18431051d9
Rework theme2 with new theme structure (#3194)
This PR reworks the theme definition in the `theme2` crate to be based
off of the new theme work that @iamnbutler has been working on.

We're still developing the new theme system, but it is complete enough
that we can now load the default theme and use it to theme the storybook
(albeit with some further refining of the color palette required).

---------

Co-authored-by: Nate Butler <iamnbutler@gmail.com>
Co-authored-by: Marshall Bowers <marshall@zed.dev>
2023-10-31 22:23:00 -04:00
Max Brunsfeld
30dffbb409 Introduce a Render trait, make views implement it
Don't pass a render function separately from the view.

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Antonio <as-cii@zed.dev>
2023-10-30 15:19:40 -07:00
Marshall Bowers
ba789fc0c4 Remove old theme constructs 2023-10-30 14:47:44 -04:00
Antonio Scandurra
1a54ac0d69 Rename Handle to Model 2023-10-30 19:44:01 +01:00
Marshall Bowers
14d24a9ac6 Remove references to old_theme 2023-10-30 14:36:49 -04:00
Marshall Bowers
7b4e699d0e Remove themed wrapper 2023-10-30 14:28:25 -04:00
Nathan Sobo
a1c3826858 Add View::update which provides a ViewContext 2023-10-26 19:41:42 +02:00
Antonio Scandurra
637cff3ebd WIP 2023-10-26 17:15:19 +02:00
Marshall Bowers
973ca8d4f0 ui2: Remove dependency on theme crate 2023-10-26 16:50:04 +02:00
Marshall Bowers
692aeff263 ui2: Remove dependency on settings crate 2023-10-26 16:50:04 +02:00
Marshall Bowers
61694bba6a Remove unneeded constructors for stories 2023-10-26 16:46:49 +02:00
Max Brunsfeld
0eae962abf Represent theme's syntax colors with string keys
Co-authored-by: Marshall Bowers <marshall@zed.dev>
2023-10-26 16:38:50 +02:00
Marshall Bowers
ed233d583f ui2: Remove ElementExt trait 2023-10-26 15:59:18 +02:00
Marshall Bowers
1887f3b594 Rename S type to V 2023-10-26 15:54:43 +02:00
Marshall Bowers
8a70ef3e8f Remove unused state_type 2023-10-26 15:45:08 +02:00
Marshall Bowers
eb19071d84 ui2: Clean up takes 2023-10-26 15:44:39 +02:00
Marshall Bowers
7b4a895ab9 ui2: Clean up drains 2023-10-26 15:41:29 +02:00
Marshall Bowers
d62c51a4b8 Merge branch 'gpui2-element-renderer' into zed2 2023-10-26 15:23:02 +02:00
Marshall Bowers
88ef74ec8f Checkpoint: Compiling after view type removal 2023-10-26 15:20:38 +02:00
Marshall Bowers
c9c9db903d Fix Component derive macro 2023-10-26 14:20:25 +02:00
Kirill Bulatov
27d2accb51 Fix the formatting 2023-10-26 13:52:04 +02:00
Kirill Bulatov
0a04c5734b Update mouse position during file drag and drop 2023-10-26 13:50:35 +02:00
Nathan Sobo
f4cff69729 WIP: Macro not working fully yet 2023-10-26 13:18:58 +02:00
Nathan Sobo
0285284ae1 Rename IntoAnyElement trait to Component 2023-10-26 12:46:52 +02:00
Nathan Sobo
8ecfea55cd Replace derive Element with derive IntoAnyElement everywhere 2023-10-26 12:38:23 +02:00
Nathan Sobo
315744ec20 Add derive macro for IntoAnyElement 2023-10-26 12:20:46 +02:00
Nathan Sobo
927278e20d Remove IntoAnyElement bound from Element trait 2023-10-26 11:49:36 +02:00
Nathan Sobo
45a8aea0f0 Make FnOnces that render elements IntoAnyElement 2023-10-26 11:21:42 +02:00
Nathan Sobo
db7d12f628 WIP 2023-10-26 10:59:27 +02:00
Marshall Bowers
4266ead958 WIP: Trait bounds 2023-10-26 10:46:02 +02:00
Marshall Bowers
e31a9401a8 Merge branch 'remove-view-state-associated-type' into gpui2-element-renderer 2023-10-26 10:10:17 +02:00
Marshall Bowers
65389a8fac Merge branch 'zed2' into gpui2-element-renderer 2023-10-26 10:10:10 +02:00
Marshall Bowers
9fb9885931 Checkpoint: Compiling 2023-10-26 10:08:39 +02:00
Marshall Bowers
9c10152c89 Use Display instead of custom to_string 2023-10-26 09:30:21 +02:00
Marshall Bowers
28ef30f7a2 Removed unused ui2::color module 2023-10-26 09:26:22 +02:00
Marshall Bowers
06bff41818 WIP: ElementRenderer 2023-10-25 21:08:34 +02:00
Marshall Bowers
7ec9cc08c7 Fix z-index targeting for drag and drop 2023-10-25 20:49:40 +02:00
Marshall Bowers
e67048ee7b Load themes from settings and rework Settings trait 2023-10-25 20:37:55 +02:00
Marshall Bowers
a0fe859d87 Make theme converter spit out valid Rust structs 2023-10-25 18:20:16 +02:00
Marshall Bowers
437d147935 Rename player to players 2023-10-25 16:39:06 +02:00
Marshall Bowers
0867175a4e Remove reference to removed ThemeColor 2023-10-25 16:34:03 +02:00
Marshall Bowers
4fcbc91aca Add note about fixing dead_code and unused_variables warnings in ui2 2023-10-25 16:33:33 +02:00
Marshall Bowers
e1032c5341 Remove ThemeColor in favor of theme2::Theme 2023-10-25 16:32:44 +02:00
Marshall Bowers
bb3f59252e Rename theme2 getter to theme 2023-10-25 16:04:49 +02:00
Marshall Bowers
258496700f Rename theme getter to old_theme 2023-10-25 16:02:47 +02:00
Marshall Bowers
8043d0d8a9 Reference theme2 colors in ThemeColor 2023-10-25 15:58:56 +02:00
Marshall Bowers
dd34bb273e Load Theme from theme2 into the storybook 2023-10-25 15:50:50 +02:00
Kirill Bulatov
a01b507ef4 Add OS file drop event handler
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-10-24 19:26:06 +02:00
Marshall Bowers
d6bd000aa8 Rename cx.global_default_mut to cx.global_default 2023-10-24 17:58:14 +02:00
Marshall Bowers
09866ec3e9 WIP 2023-10-24 16:59:24 +02:00
Nate Butler
9f48cdac83 Lower the default state intensities 2023-10-24 08:41:39 -04:00
Nate Butler
bfb37bbe94 Merge branch 'n/elevation' into zed2 2023-10-24 08:34:54 -04:00
Marshall Bowers
8117e7933c Add missing bounds to Themed 2023-10-24 14:30:26 +02:00
Marshall Bowers
cf380a9f62 Remove set_ prefix for List setters 2023-10-24 14:18:51 +02:00
Marshall Bowers
bb35583998 Merge branch 'gpui2' into zed2 2023-10-24 14:11:13 +02:00
Marshall Bowers
f2710f37c5 Fix default font family 2023-10-24 12:49:18 +02:00
Marshall Bowers
785901c75e Load embedded fonts 2023-10-24 12:32:30 +02:00
Marshall Bowers
171db00f6e Fix stack overflow 2023-10-24 11:39:15 +02:00
Marshall Bowers
6f5cf10acb Comment out .state setting 2023-10-24 11:39:10 +02:00
Marshall Bowers
6a532af1fd Swap the parameters to IconButton 2023-10-24 11:26:19 +02:00
Marshall Bowers
47f979d457 Pass IDs to IconButtons instead of generating them 2023-10-24 11:20:31 +02:00
Nate Butler
e99d862f3f WIP Button Refactor 2023-10-23 14:50:53 -04:00
Nate Butler
c1c9db2ae2 Add elevation enums + docs 2023-10-23 13:50:39 -04:00
Nate Butler
297cef14ed WIP add Elevation Docs 2023-10-23 11:21:48 -04:00
Nathan Sobo
192b3512fd Merge branch 'gpui2-drag-drop' into zed2 2023-10-23 17:18:07 +02:00
Nate Butler
3a326bfa7e 🤦 Remove references to system_color 2023-10-23 11:05:17 -04:00
Nate Butler
1e13e273d2 Add ThemeColor interface for UI coloring and remove redundancy 2023-10-23 11:01:04 -04:00
Nate Butler
438cf529bb Remove duplicate ThemeColor defs 2023-10-23 11:00:45 -04:00
Nathan Sobo
ec0b2e5430 Add on_drop listeners 2023-10-23 16:59:16 +02:00
Nate Butler
c9d214e8ef Start crate doc 2023-10-23 10:21:30 -04:00
Nathan Sobo
239b0c2f71 Clear active state when drag starts 2023-10-23 16:10:04 +02:00
Nate Butler
cc445f7cef Start scaffolding out the Copilot Modal UI
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
2023-10-23 10:00:02 -04:00
Nathan Sobo
d1adce5890 Show red box when dragging 2023-10-23 15:09:22 +02:00
Nathan Sobo
96f2c4a9de Checkpoint 2023-10-23 14:15:12 +02:00
Nathan Sobo
da8919002f Fix runtime errors 2023-10-23 11:34:35 +02:00