Skip to content

component: Add component and component_preview crates to power UI components #24456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 9, 2025

Conversation

iamnbutler
Copy link
Contributor

@iamnbutler iamnbutler commented Feb 7, 2025

This PR formalizes design components with the Component and ComponentPreview traits.

You can open the preview UI with workspace: open component preview.

Component previews no longer need to return Self allowing for more complex previews, and previews of components like ui::Tooltip that supplement other components rather than are rendered by default.

cargo-machete incorrectly identifies linkme as an unused dep on crates that have components deriving IntoComponent, so you may need to add this to that crate's Cargo.toml:

# cargo-machete doesn't understand that linkme is used in the component macro
[package.metadata.cargo-machete]
ignored = ["linkme"]

Release Notes:

  • N/A

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 7, 2025
@iamnbutler iamnbutler marked this pull request as ready for review February 9, 2025 13:44
@iamnbutler iamnbutler changed the title WIP: Component registry (try 4?) component: Add component and component_preview crates to power ui components Feb 9, 2025
@maxdeviant maxdeviant changed the title component: Add component and component_preview crates to power ui components component: Add component and component_preview crates to power UI components Feb 9, 2025
@maxdeviant
Copy link
Member

We should consider using inventory instead of linkme. We recently switched GPUI over, and it’s a higher-level crate that is geared towards what we’re trying to do.

maxdeviant added a commit that referenced this pull request Feb 9, 2025
This PR removes the `ToolStrip` component.

Pulling this change out of
#24456.

Release Notes:

- N/A
@iamnbutler iamnbutler merged commit 8f1ff18 into main Feb 9, 2025
12 checks passed
@iamnbutler iamnbutler deleted the components branch February 9, 2025 18:25
osiewicz pushed a commit that referenced this pull request Feb 10, 2025
This PR removes the `ToolStrip` component.

Pulling this change out of
#24456.

Release Notes:

- N/A
osiewicz pushed a commit that referenced this pull request Feb 10, 2025
… components (#24456)

This PR formalizes design components with the Component and
ComponentPreview traits.

You can open the preview UI with `workspace: open component preview`.

Component previews no longer need to return `Self` allowing for more
complex previews, and previews of components like `ui::Tooltip` that
supplement other components rather than are rendered by default.

`cargo-machete` incorrectly identifies `linkme` as an unused dep on
crates that have components deriving `IntoComponent`, so you may need to
add this to that crate's `Cargo.toml`:

```toml
# cargo-machete doesn't understand that linkme is used in the component macro
[package.metadata.cargo-machete]
ignored = ["linkme"]
```

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants