Commit Graph
100 Commits
Author SHA1 Message Date
Marshall Bowers 25876161f8 theme_importer: Format generated themes (#3255)
This PR makes the `theme_importer` format the themes that it generates
automatically.

Release Notes:

- N/A
2023-11-07 12:45:09 -05:00
Marshall Bowers 0d95410634 Rework third-party themes (#3254)
This PR reworks the way we define our third-party themes to make them
work as overlays on top of a base theme.

We introduce the concept of a `UserThemeFamily` that contains
`UserTheme`s. Rather than being an entire theme definition on their own,
a `UserTheme` just contains optional overrides for the values in a
`Theme`.

When resolving a `UserTheme`, we apply it on top of the base theme. Any
values not overridden in the `UserTheme` will fall back to the `Theme`
defaults.

Right now we are just using `UserTheme` to model third-party themes that
we distribute with the Zed binary. However, this same structure can also
be used to import arbitrary user themes (such as from a theme registry,
or even a theme blob from the settings file).

Release Notes:

- N/A
2023-11-07 11:40:07 -05:00
Marshall Bowers 74853ea55f Rename ThemeVariant to Theme (#3252)
This PR renames the `ThemeVariant` type to `Theme`.

This better reflects its purpose, as well as matches the same name as we
had before, which should make porting crates slightly easier.

Release Notes:

- N/A
2023-11-07 10:41:36 -05:00
Marshall Bowers 7078c5fbb9 Regenerate all themes 2023-11-07 08:59:50 -05:00
Marshall Bowers 01eac50fc8 Add new ThemeColors values to the theme printer 2023-11-07 08:59:37 -05:00
Marshall Bowers d224f511fa Add interactivity to Checkbox component (#3240)
This PR adds interactivity to the `Checkbox` component.

They can now be checked and unchecked by clicking them.

Release Notes:

- N/A
2023-11-06 13:22:25 -05:00
Marshall Bowers f8504c349c Merge branch 'main' into import-theme 2023-11-06 12:08:46 -05:00
bf80c1da5b Rename fields in ThemeColors (#3242)
This PR applies a number of field renames in the `ThemeColors` struct
from the `import-theme` branch.

This will help prevent this branch from diverging too far from `main`.

Release Notes:

- N/A

---------

Co-authored-by: Nate Butler <iamnbutler@gmail.com>
Co-authored-by: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-06 11:53:27 -05:00
Marshall Bowers 5d36331942 storybook2: Remove unreferenced components module (#3229)
This PR removes the `components` module from `storybook2` as it was
dead, unreferenced code.

Release Notes:

- N/A
2023-11-03 18:12:21 -04:00
Marshall Bowers 6abdab7735 Remove theme.txt 2023-11-03 17:52:19 -04:00
Marshall Bowers 76db100d11 ui2: Reorganize components (#3228)
This PR reorganizes the components in the `ui2` crate.

The distinction between "elements" and "components" is now gone, with
all of the reusable components living under `components/`.

The components that we built while prototyping but will eventually live
in other crates currently reside in the `to_extract/` module.

Release Notes:

- N/A
2023-11-03 17:34:11 -04:00
Marshall Bowers 287ea0a6e4 Allow deriving Serialize and Deserialize on generated refinement (#3227)
This PR adds support for deriving `Serialize` and `Deserialize` on the
refinement type generated by `#[derive(Refineable)]`.

Release Notes:

- N/A
2023-11-03 17:21:00 -04:00
Marshall Bowers b5224bdafd Remove unneeded type qualification 2023-11-03 16:40:46 -04:00
Marshall Bowers 1361b61708 Use an IconButton for the tab close button 2023-11-03 16:36:02 -04:00
Marshall Bowers 12500364b4 Merge branch 'main' into import-theme 2023-11-03 15:41:12 -04:00
Marshall Bowers fa7d6c0e70 Remove Default impl for ThemeColors` (#3226)
This PR removes the `Default` impl for `ThemeColors`.

Since we need default light and dark variants for `ThemeColors`, we
can't use a single `Default` impl.

Release Notes:

- N/A
2023-11-03 15:40:50 -04:00
Marshall Bowers 363d7c6634 Exclude source themes from Zed2 binary 2023-11-03 11:11:10 -04:00
Marshall Bowers acc36e6dab Update emitted module import 2023-11-03 10:58:06 -04:00
Marshall Bowers 293fbe4c75 Account for colors in VS Code theme being optional 2023-11-03 10:54:12 -04:00
Marshall Bowers e0382a61b9 Update color names in workspace2 2023-11-03 10:16:34 -04:00
Marshall Bowers a7edd380e3 Merge branch 'main' into import-theme 2023-11-03 10:11:35 -04:00
Marshall Bowers 95a0827517 Clean up unused code 2023-11-02 19:20:21 -04:00
Marshall Bowers 152ac6927f Add themes2/src/themes directory 2023-11-02 19:17:39 -04:00
Marshall Bowers d1636bf16b Finish up theme printer 2023-11-02 19:14:51 -04:00
Marshall Bowers fc376287e0 Start work on theme printer 2023-11-02 18:57:13 -04:00
Marshall Bowers 0bc51382b2 Add basic VsCodeThemeConverter 2023-11-02 18:24:38 -04:00
Marshall Bowers e48332c81f Parse VSCode theme files 2023-11-02 18:00:55 -04:00
Marshall Bowers 54969877a4 Make the Zed2 window movable (#3218)
This PR makes the Zed2 window movable and fixes a crash related to a
`todo!()` that wasn't necessary.

Release Notes:

- N/A
2023-11-02 16:17:31 -04:00
Marshall Bowers 9c8220d04e Remove commented-out label code 2023-11-02 15:04:52 -04:00
Marshall Bowers 3605afc163 Render active item in pane 2023-11-02 14:40:34 -04:00
Marshall Bowers 8b1b7a2f80 Checkpoint: Basic tab bar structure 2023-11-02 14:34:48 -04:00
Marshall Bowers 1e7a216d55 WIP 2023-11-02 13:21:28 -04: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
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
Marshall Bowers aa14552fee Remove unneeded .intos 2023-11-01 22:01:59 -04:00
Marshall Bowers b9ac1e43cd Update scale accessors 2023-11-01 22:00:16 -04:00
Marshall Bowers bd4bff47a0 Merge branch 'main' into n/t2 2023-11-01 21:54:10 -04:00
Marshall Bowers 72d060108d Make indexing into ColorScales safe (#3205)
This PR makes indexing into `ColorScale`s safe by constraining the
`ColorScaleStep`s to a set of known values.

Release Notes:

- N/A
2023-11-01 21:52:42 -04:00
Marshall Bowers 220228c183 Fix underflow when indexing into ColorScales 2023-11-01 21:15:06 -04:00
Marshall Bowers 115bd65344 Merge branch 'main' into n/t2 2023-11-01 21:11:26 -04:00
Marshall Bowers 69aafe9ff6 Adjust ColorScale representation (#3204)
This PR adjusts the representations of `ColorScale`s to allow us to
remove an unsafe `From` impl when converting from the statically-defined
representation of the scale.

Release Notes:

- N/A
2023-11-01 21:10:50 -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
Marshall Bowers 6ed60769ac Merge branch 'n/t2' of github.com:zed-industries/zed into n/t2 2023-11-01 10:52:29 -04:00
Marshall Bowers 3189cd779e Remove unused impl 2023-11-01 10:52:25 -04:00
Marshall Bowers d2a8f972f3 Fix return type 2023-11-01 10:48:23 -04:00
Marshall Bowers 8fb7c174b0 Merge branch 'main' into n/t2 2023-11-01 10:46:27 -04:00
Marshall Bowers bbe53895ef Return ColorScaleSets from individual color scale functions (#3197)
This PR adjusts the individual color scale functions to return
`ColorScaleSet`s instead of `DefaultColorScaleSet`s.

We only use the `DefaultColorScaleSet`s to simplify the construction of
the scales, so it isn't necessary to surface them outside of the
function.

Release Notes:

-  N/A
2023-11-01 10:45:42 -04:00
Marshall Bowers b8547e926d Remove blanket From<&str> impl for Hsla
Since this is a fallible operation we don't want to have a blanket
infallible conversion from any arbitrary `&str` to an `Hsla`.
2023-11-01 10:31:03 -04:00
Marshall Bowers 272f856460 Use Refineable for ThemeStyles (#3196)
This PR updates the `ThemeStyles` struct to use the `Refineable` trait
instead of a custom declarative macro for generating refinements.

Release Notes:

- N/A
2023-10-31 23:33:51 -04:00
Marshall Bowers 36a73d657a Remove old Theme definition (#3195)
This PR removes the old `Theme` definition in favor of the new
`ThemeVariant`s.

The new `SyntaxStyles` have been reverted to the old `SyntaxTheme` that
operates by storing the syntax styles as a vector of
`gpui2::HighlightStyle`s.

This is necessary for the intended usage by `language2`, where we find
the longest key in the theme's syntax styles that matches the capture
name:

https://github.com/zed-industries/zed/blob/18431051d9d750d9e66284a71f7a55a1e31c1374/crates/language2/src/highlight_map.rs#L15-L41
2023-10-31 23:05:50 -04:00
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
Marshall Bowers 607813e646 Tweak style for color scale story 2023-10-30 17:45:37 -04:00
Marshall Bowers 49571127da theme2: Correctly reference the dark alpha scale 2023-10-30 17:35:13 -04:00
Marshall Bowers 609836397b Merge branch 'theme-color-scales' into zed2 2023-10-30 17:31:51 -04:00
Marshall Bowers a02d806715 Add a story showcasing the color scales 2023-10-30 17:31:15 -04:00
Marshall Bowers 991f58409e Fix alpha channel values for color scales 2023-10-30 17:20:43 -04:00
Marshall Bowers e0f68c77b0 Add type alias for steps in color scales 2023-10-30 17:08:37 -04:00
Marshall Bowers b128377cd2 Register all of the color scales 2023-10-30 17:03:33 -04:00
Marshall Bowers ccccf84867 Define all color scales 2023-10-30 17:00:46 -04:00
Marshall Bowers 7841a56a11 Start work on defining color scales 2023-10-30 16:21:59 -04:00
Marshall Bowers 78573fb140 Merge branch 'zed2' of github.com:zed-industries/zed into zed2 2023-10-30 15:17:16 -04:00
Marshall Bowers 942167e046 Format ui2 2023-10-30 15:17:11 -04:00
Marshall Bowers ba789fc0c4 Remove old theme constructs 2023-10-30 14:47:44 -04:00
Marshall Bowers 14d24a9ac6 Remove references to old_theme 2023-10-30 14:36:49 -04:00
Marshall Bowers 7bacdefa2e Merge branch 'zed2' of github.com:zed-industries/zed into zed2 2023-10-30 14:28:27 -04:00
Marshall Bowers 7b4e699d0e Remove themed wrapper 2023-10-30 14:28:25 -04:00
Marshall Bowers b31a004def Add menu2 crate 2023-10-30 12:56:23 -04:00
Marshall Bowers d3cd5f3ec5 Format theme2 2023-10-30 11:26:30 -04:00
Marshall Bowers 3d8516b25f Convert all themes 2023-10-30 11:22:04 -04:00
Marshall Bowers 7a66ebae71 Emit modules for each theme 2023-10-30 11:21:33 -04:00
Marshall Bowers 2879d231b1 Revert changes to themes 2023-10-30 11:06:45 -04:00
Marshall Bowers 3591ffe4a7 Emit all themes at once 2023-10-30 11:04:03 -04:00
Marshall Bowers b8ae949dbe Merge branch 'zed2' of github.com:zed-industries/zed into zed2 2023-10-30 10:40:48 -04:00
Marshall Bowers 61cc3b93e3 Factor out ThemePrinter into its own module 2023-10-30 10:40:46 -04:00
Marshall Bowers 452006560e Merge branch 'zed2' of github.com:zed-industries/zed into zed2 2023-10-26 17:14:49 +02:00
Marshall Bowers 560e115656 Pull syntax colors from JSON theme 2023-10-26 17:06:05 +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
Marshall Bowers a569c82492 Merge branch 'zed2' of github.com:zed-industries/zed into zed2 2023-10-26 15:59:21 +02:00
Marshall Bowers ed233d583f ui2: Remove ElementExt trait 2023-10-26 15:59:18 +02:00
Marshall Bowers 6784ccd9fe Merge branch 'zed2' of github.com:zed-industries/zed into zed2 2023-10-26 15:54:48 +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 fccc4ca85c Initialize element before layout 2023-10-26 15:22:48 +02:00
Marshall Bowers 42095f0673 Remove debug from derive Component proc macro 2023-10-26 15:22:38 +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
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 8b972f6d8e WIP: Fix compilation of gpui2 2023-10-26 09:51:33 +02:00
Marshall Bowers 965bfd8439 WIP: Pass in V to Element 2023-10-26 09:45:26 +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