Skip to content

Morphing algorithms#766

Draft
adamghill wants to merge 1 commit intomainfrom
morpher
Draft

Morphing algorithms#766
adamghill wants to merge 1 commit intomainfrom
morpher

Conversation

@adamghill
Copy link
Member

No description provided.

@adamghill adamghill marked this pull request as draft January 25, 2026 01:36
@adamghill adamghill changed the title Trying out morphing algorithms Morphing algorithms Jan 25, 2026
@github-actions
Copy link
Contributor

Coverage report

This PR does not seem to contain any modification to coverable code.

@JohananOppongAmoateng
Copy link
Contributor

JohananOppongAmoateng commented Feb 17, 2026

@adamghill Thanks for opening this! I see this PR is mostly scaffolding to introduce morphing algorithms into Unicorn, with initial support for both Idiomorph and Nanomorph. A few thoughts:

Selection logic: Right now there are two separate getMorpher() functions. It might be clearer to unify this into a single factory that accepts a strategy argument (e.g., "idiomorph" vs "nanomorph").

Testing: Even at this setup stage, adding basic tests—especially around Nanomorph’s <script> handling—will help prevent regressions.

Documentation: A short note explaining why Unicorn is experimenting with multiple morphing libraries would help contributors / users understand the intent.

Defaults: Since Unicorn already has a morphing implementation, Idiomorph and Nanomorph should probably be opt‑in alternatives rather than replacements. Making this configurable would be valuable.

Potential Additions

Add a configuration option in Unicorn settings to choose the morphing strategy (Unicorn default, Idiomorph, or Nanomorph).

Provide a benchmarking utility to compare performance and DOM diff accuracy between morphers.

Explore hybrid strategies (e.g., Unicorn default for most cases, Nanomorph for script‑heavy components).

Consider fallback handling: if one morpher fails, gracefully retry with another.

Write a migration guide for contributors explaining how morphing affects Unicorn’s rendering lifecycle.

I haven’t pulled this down locally to test yet, so these notes are based on reviewing the code and setup.

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.

2 participants