barbajs/barba ? reverse-engineered prompt

Reverse engineered prompt

Build me a small TypeScript library for smooth page transitions on regular websites.

I want it to make page changes feel like a single page app, with animated leave and enter transitions, hooks for before and after a page swap, and a simple way to attach custom logic to specific pages. It should support choosing transitions based on rules, let the leave and enter animations run together if needed, and include a basic plugin system so it can be extended later.

Please keep it lightweight and easy to use, with good defaults and clean docs or examples showing how to set it up on a normal multi page site. If useful, add prefetching and a few helper utilities so navigation feels fast. Make sure it works well in modern browsers, but still degrades gracefully if JavaScript is limited.

Look up current docs online if you need to, then wire up the library, tests, and a simple demo or usage example so I can see the transitions working end to end.