Skip to content

fix(components): revive white-space, rich_text measurement and the glow effect #109

Description

@LeadcodeDev

Part of #102 — wave 2.

Mini-spec

Goal: revive three features the schema advertises and the engine ignores.

Invariants

  • A property the schema accepts either has an observable effect, or is removed. No third state.
  • rich_text renders in normal flow without the author having to guess a width.

Out of scope: the geometry validator (owned by the diagnostics workstream this wave), schema type deletion (dead-types workstream).

Acceptance

  • M1 — white-space has no render effect. It is read in exactly two places repo-wide: cascade inheritance and the geometry validator. TextIntrinsic::from_parts hardcodes wrap: true with a comment saying CssStyle has no wrap field, and the painter wraps unconditionally at layout_width. So unwrappable_text_overflow fires on a condition the renderer cannot produce.
    Implement nowrap/pre in measurement and painting, so the property means something and the existing validator check becomes truthful. Prove it by rendering: a nowrap line must stay on one line and visibly exceed its box.
  • M2 — rich_text is invisible in flow. It has no entry in component_intrinsic, so it lays out 0×0 unless given explicit width/height. Add a RichTextIntrinsic. Note line-breaking currently happens only at span boundaries — a long single span never wraps internally; fix that too or document it precisely.
  • M3 — the glow animation effect is a no-op. extract_effects stores it; resolve_props_for_effects never reads it. Renders with and without are byte-identical. Either make it render (note GlowConfig.color is currently never plumbed anywhere, and the keyframe path builds a DropShadow with color: None, which resolves to black), or remove it from the schema and say so. Do not leave it half-alive.

Files: crates/rustmotion-components/src/{box_builder,intrinsic,text,rich_text}.rs, crates/rustmotion-core/src/engine/animator.rs

Verify

rtk cargo test --workspace
rtk cargo build --release
for f in examples/*.json; do ./target/release/rustmotion validate -f "$f"; done

Render-based proof required for each of the three — a passing unit test is not evidence that something is visible on screen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions