Skip to content

feat: add component body abstraction with proc macros#4

Merged
AsPulse merged 2 commits into
mainfrom
feat/component-body-abstraction
May 24, 2026
Merged

feat: add component body abstraction with proc macros#4
AsPulse merged 2 commits into
mainfrom
feat/component-body-abstraction

Conversation

@AsPulse
Copy link
Copy Markdown
Member

@AsPulse AsPulse commented May 24, 2026

React/SwiftUI-style component composition. User-defined composites can now return another component instead of constructing a VectorGraphic themselves, and #[vector_component] / #[raster_component] proc macros collapse the struct + impl boilerplate into a single function.

  • tellur-core::vector::VectorBody and tellur-core::raster::RasterBody: new enums distinguishing element components (own a render() implementation — Rectangle, Circle, Ellipse, VectorLayer, Layer, Rasterize<V>) from composite components that delegate via Body::Of(Box<dyn ...>).
  • VectorComponent / RasterComponent traits gain default body() returning Body::Element and default render() that walks the body chain. target: Resolution threads through RasterBody::Of automatically — composites never see it in their signature.
  • tellur-macros: new proc-macro crate exposing #[vector_component] and #[raster_component]. Each turns a function-style component definition into a PascalCase struct (fields = function args, #[derive(Clone)]) plus the trait impl. Re-exported from tellur-core.
  • Examples migrated: BouncingDot (in timeline_to_mp4) and Blob (in raster_layer_to_png) are now written as plain functions; BouncingDot drops ~16 lines of boilerplate, Blob shrinks to 7 lines from 20.
  • CI: tellur-macros added to the per-crate fmt / clippy / build / test matrix.

@AsPulse AsPulse merged commit ad97cd7 into main May 24, 2026
14 checks passed
@AsPulse AsPulse deleted the feat/component-body-abstraction branch May 25, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant