ZIm/crates/workspace/src
Nate Butler 94d8ead270
Refactor Spacing into DynamicSpacing using proc macro (#20504)
Density tracking issue: #18078 

This PR refactors our spacing system to use a more flexible and
maintainable approach. We've replaced the static `Spacing` enum with a
dynamically generated `DynamicSpacing` enum using a proc macro.

Enum variants now use a `BaseXX` format, where XX = the pixel value @
default rem size and the default UI density.

For example:

`CustomSpacing::Base16` would return 16px at the default UI scale &
density.

I'd love to find another name other than `Base` that is clear (to avoid
base_10, etc confusion), let me know if you have any ideas!

Changes:

- Introduced a new `derive_dynamic_spacing` proc macro to generate the
`DynamicSpacing` enum
- Updated all usages of `Spacing` to use the new `DynamicSpacing`
- Removed the `custom_spacing` function, mapping previous usages to
appropriate `DynamicSpacing` variants
- Improved documentation and type safety for spacing values

New usage example:

```rust
.child(
    div()
        .flex()
        .flex_none()
        .m(DynamicSpacing::Base04.px(cx))
        .size(DynamicSpacing::Base16.rems(cx))
        .children(icon),
)
```

vs old usage example:

```
.child(
    div()
        .flex()
        .flex_none()
        .m(Spacing::Small.px(cx))
        .size(custom_spacing(px(16.)))
        .children(icon),
)
```

Release Notes:

- N/A
2024-11-11 11:08:55 -05:00
..
persistence Remove dev servers (#19638) 2024-10-24 12:14:03 -06:00
dock.rs Fix mouse clicks on remote-open-folder UI (#19851) 2024-10-28 12:55:55 -07:00
item.rs Fix mouse clicks on remote-open-folder UI (#19851) 2024-10-28 12:55:55 -07:00
modal_layer.rs chore: Fix several style lints (#17488) 2024-09-06 11:58:39 +02:00
notifications.rs Add settings to remote servers, use XDG paths on remote, and enable node LSPs (#19176) 2024-10-15 23:32:44 -07:00
pane.rs Refactor Spacing into DynamicSpacing using proc macro (#20504) 2024-11-11 11:08:55 -05:00
pane_group.rs Extension refactor (#20305) 2024-11-06 10:06:25 -07:00
persistence.rs Add language toolchains (#19576) 2024-10-28 15:34:03 +01:00
searchable.rs Display buffer/project search entries in the outline panel (#16589) 2024-08-25 21:40:02 +03:00
shared_screen.rs Copy/paste images into editors (Mac only) (#15782) 2024-08-13 13:18:25 -04:00
status_bar.rs Refactor Spacing into DynamicSpacing using proc macro (#20504) 2024-11-11 11:08:55 -05:00
tasks.rs Do not allow [re]running ssh tasks when not connected to the server (#19306) 2024-10-16 22:57:39 +03:00
theme_preview.rs Add preview for Checkbox with Label (#20448) 2024-11-08 22:53:15 -05:00
toolbar.rs Refactor Spacing into DynamicSpacing using proc macro (#20504) 2024-11-11 11:08:55 -05:00
workspace.rs Set up editor actions after workspace not on stack (#20445) 2024-11-08 17:11:43 -08:00
workspace_settings.rs workspace: Add settings to dim inactive panes and highlight active pane (#18968) 2024-11-05 17:26:07 +02:00