/astro-vtbot

The ๐Ÿ‘œ Bag of Tricks โœจ for Astro's View Transitions. โญ๏ธ Please star to support this work!

Primary LanguageAstroISC LicenseISC

No, its NOT a roBOT ๐Ÿค–, its a ๐Ÿ‘œ Bag of Tricks!โœจ

The Bag of Tricks for Astro's View Transitions

The bag of tricks provides extensions & support around Astro's view transitions.

Build Status npm version

A current deployment of tech demos and the documentation can be found at https://events-3bg.pages.dev/

!!! NEW TRICKS โœจ IN THE BAG ๐Ÿ‘œ !!!

More Starlight Improvements:

Mission Accomplished

This release completes the series of additions to the view transition support for Starlight! The last two of the originally planned features are:

Of course there will be further additions if required. Please contact me if you are missing something.

Friendly Neighbor List

The Friendly Neighbor List of the Starlight support keeps growing. Now features:

  • starlight-image-zoom
  • starlight-utils
  • starlight-blog
  • starlight-docsearch

Automatically Name Selected Elements for Additional Morph Effects

The Bag features a new component to declaratively assign view transition names to selected elements: <AutoNameSelected/>. This component provides for a lot of fun as can be seen in the image gallery demo.

Recently Learned Tricks

Starlight Support: Ever wanted to see what your Starlight site looks like with view transitions enabled? Follow these steps to get rid of full page loads and make your Starlight site look like a SPA!

The selection of optional Starlight components keeps growing:

Ever wished clicking on Starlight's previous page and next page links would slide content from the left respectively from the right? Now you can enable <PageOrder /> on Starlight sites. This automatically alters the direction of the view transition. Visit a page further down the sidebar and get a forward navigation, visit a page further up, and you get a back navigation.

Eliminate the Pseudo-Scrolling of the Main Section: With <PageOffset />, The Bag offers a simple to use component that eliminates pseudo scrolling effects induced by morph transitions on elements that are larger than the viewport. Especially useful to get a smooth and neat transition animation for your main content.

Reusable Components ๐Ÿงฉ

  • In need for extensions for view transitions because you have issues with iframes on your pages?
  • Wanting support in understanding and debugging view transitions or simply want a second pair of eyes ๐Ÿ‘€ on your view transition settings?
  • Looking for reusable animations or special transition effects?
  • Want to use view transitions on your Starlight site?

The astro-vtbotpackage isn't a monolithic library. Use the components you need and only pay bandwidth for those.

Component Brotli bytes added
Animation Style โœจ ~0.1k
AutoNameSelected ๐Ÿ“› ~0.3k
BorderControl ๐Ÿ›‚ ~0.1k
BrakePad ๐Ÿฆฅ ~0.2k
Linter ๐Ÿงน ~1.9k
LoadingIndicator โณ ~0.4k
Move ๐ŸšŸ ~0.2k
NoScroll ๐Ÿ“œ ~0.1k
PageOffset ๐Ÿ“„โ‡ž ~0.1k
Portal ๐Ÿšช ~0.2k
ReplacementSwap โ†น ~0.5k
Starlight โ€ฆ ๐ŸŒŸ ~3.0k
SwapSound ๐Ÿ”Š -0.3k
Swing ๐ŸŽท ~0.1k
VtBotDebug ๐Ÿ› ~2.8k
Zoom ๐Ÿ”Ž ~0.1k

Visit the documentation of the reusable components for detailed information.

  • <Linter/>: A linter component that helps you identify problems when setting up transitions.

  • <VtBotDebug/>: A Debugging component that logs the events and their data as they occur.

  • <ReplacementSwap/>: An alterantive DOM swap(), which preserves elements in the original DOM to avoid reinitialization of iframes or CSS animations.

  • <LoadIndicator>: Have you ever missed the visual feedback on sites with view transitions as to whether the app has noticed the click? You need a loading indicator! Here you go!

  • Zoom, <Move> and Swing animations and the <AnimationsStyle/> component allows for extended styling options.

  • <Portal/> component that forces all view transitions through a portal/loading page.

  • <NoScroll/> keep the current vertical and horizontal scroll position when transitioning to the next page.

Tech Demos ๐Ÿ”ฅ

The bag of tricks currently contains several technical demos that show examples of the implementation of various effects using the view transition events.

The sources are in this repository.

The Jotter ๐Ÿ““

Last but not least, the deployment also includes the โ–ถ Jotter โ—€ with a wealth of information on transition events as well as background information and valuable tips & tricks on view transitions in Astro.

Some of the contents are technical demos, some are useful tools, and some are reusable components that you can use in your own project to handle edge cases that go beyond Astro's standard features.

Troubleshooting

For help, check out the Discussions tab on the GitHub repo.

Contributing

This package is maintained by martrapp independently from Astro. You're welcome to contribute by submitting an issue or opening a PR!

Changelog

See CHANGELOG.md for a history of changes to this package.