Skip to content
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

Split whiskers widgets in their own whiskers-widgets crate #108

Merged
merged 4 commits into from
Jan 14, 2024

Conversation

abey79
Copy link
Owner

@abey79 abey79 commented Jan 12, 2024

The PR makes it possible for vsvg to use the Widget derive macro on its own types.

So far, the Widget trait for some vsvg types (such as Point, Unit, Length, etc.) was implemented within the whiskers crate. This is ok for manual implementation, but this would make it impossible to use the Widget derive macro because that would cause a circular dependency between the whiskers and vsvg crate.

This PR addresses this issue by splitting all widget traits and code into a separate whiskers-widgets crate, on which both whiskers and, optionally, vsvg depend. This is gated behind the whiskers-widgets feature of vsvg.

This PR also:

  • brings back into vsvg the widget code for vsvg types,
  • moves some UI utilities from vsvg_viewer to vsvg (gated behind the egui feature),
  • moves some other UI utilities from whisker to whiskers-widgets.

This is the resulting dependency graph:

flowchart LR
    UserSketch["User Sketch"]
    widgets["whiskers-widgets"]
    derive["whiskers-derive"]
    other["Custom Crate"]

    UserSketch --> whiskers
    UserSketch --> other
    other --> widgets
    whiskers --> vsvg
    whiskers --> widgets
    vsvg --> widgets
    widgets  --> derive
Loading

Note that whiskers reexport everything needed in whiskers::prelude::* so no other dependency/use statement is typically needed for user sketches.

TODO:

  • make sure derive works
  • cleanup docs?
  • crate README.md
  • check crate metadata

@abey79 abey79 added whiskers Relates to whiskers or whiskers-derive refactor Code refactor labels Jan 12, 2024
@abey79 abey79 changed the title Refactor whiskers widgets in their own crate Split whiskers widgets in their own whiskers-widget crate Jan 14, 2024
@abey79 abey79 merged commit 219d19a into master Jan 14, 2024
10 checks passed
@abey79 abey79 deleted the whiskers-widgets branch January 14, 2024 14:12
@abey79 abey79 changed the title Split whiskers widgets in their own whiskers-widget crate Split whiskers widgets in their own whiskers-widgets crate Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Code refactor whiskers Relates to whiskers or whiskers-derive
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant