
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@pariharshyamu/morph
Advanced tools
Interrupt-safe DOM morphing with spring physics, FLIP animations, Hungarian algorithm matching, and auto-animate via MutationObserver. Works with htmx, Alpine.js, Turbo, or vanilla JS.
Interrupt-safe DOM morphing with spring physics, FLIP animations, and auto-animate.
morph.js v2 patches your DOM like morphdom, but adds silky smooth animations — spring physics, FLIP transitions, choreographed enter/exit/move, and mid-animation interruption handling.
getBoundingClientRect across scrolled containersnpm install @pariharshyamu/morph
Or use a CDN:
<script type="module">
import morph from 'https://unpkg.com/@pariharshyamu/morph';
</script>
import morph from '@pariharshyamu/morph';
// Morph an element to new HTML
const result = morph(element, '<div class="card">New content</div>');
// Wait for all animations to complete
await result.finished;
morph(fromEl, toElOrHTML, options?)Patches fromEl to match toElOrHTML (a DOM element or HTML string), animating the transition.
Returns: { animations, finished, debug, cancel() }
| Option | Default | Description |
|---|---|---|
duration | 400 | Base duration in ms |
easing | 'spring' | 'spring' or any CSS easing string |
spring | { stiffness: 280, damping: 24, mass: 1 } | Spring physics parameters |
stagger | 25 | Stagger delay between elements (ms) |
keyAttribute | 'data-morph-key' | Attribute for explicit element matching |
matchConfidenceThreshold | 1.5 | Below this → treat as enter/exit |
respectReducedMotion | true | Skip animation if user prefers reduced motion |
morphContent | true | Cross-fade content changes during move |
debug | false | Log matching info to console |
morph.text(el, newText, options?)Cross-fade text content change with a fade-out → swap → fade-in sequence.
await morph.text(heading, 'New Title').finished;
morph.prepare(fromEl, toEl, options?)Create a controllable transition that can be triggered later.
const transition = morph.prepare(el, newEl, { duration: 500 });
transition.play(); // triggers when ready
MorphObserverAuto-animate any DOM mutations on a container:
import { MorphObserver } from '@pariharshyamu/morph';
const observer = new MorphObserver(container, { duration: 350 });
observer.observe();
// Now any mutation to container's children will auto-animate
container.innerHTML = '<div>New content</div>'; // animated!
observer.disconnect();
<script src="https://unpkg.com/htmx.org"></script>
<script type="module">
import morph from '@pariharshyamu/morph';
morph.htmx({ duration: 350 });
</script>
<div hx-ext="morph" hx-get="/api/items" hx-swap="innerHTML">
<!-- content swaps are now animated -->
</div>
Control the timing of exit, move, and enter phases:
morph(el, newHTML, {
choreography: {
exit: { at: 0, duration: 0.5 }, // fractions of total duration
move: { at: 0.15, duration: 0.85 },
enter: { at: 0.4, duration: 0.6 },
}
});
morph(el, newHTML, {
onEnter: (el) => [
{ opacity: 0, transform: 'translateX(-20px)' },
{ opacity: 1, transform: 'translateX(0)' },
],
onLeave: (el) => [
{ opacity: 1 },
{ opacity: 0, transform: 'scale(0.8)' },
],
onMove: (el, fromRect, toRect) => null, // return keyframes or null
});
MIT
FAQs
Interrupt-safe DOM morphing with spring physics, FLIP animations, Hungarian algorithm matching, and auto-animate via MutationObserver. Works with htmx, Alpine.js, Turbo, or vanilla JS.
We found that @pariharshyamu/morph demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.