包详细信息

@vtbag/element-crossing

vtbag53.3kISC1.1.0

Sites using cross-document view transitions do full page loads of static content on navigation. The element crossing provides a way to preserve current dynamic state of selected elements across cross-document view transitions for a smoother user experienc

view, transitions, view transition, view-transition

自述文件

⭐️Please star to support this work⭐️

🚸 The Element Crossing

Transfer selected element state across cross-document view transitions.

Build Status npm version minzip NPM Downloads

The @vtbag website can be found at https://vtbag.dev/

!!! News !!!

Native cross-document view transitions now work for Safari, and so does the Element Crossing!

For details see the CHANGELOG

What happened before?

Full support for crossing of data-* properties.

Now also preserves the animation state of animated SVGs across cross-document view transitions, thanks to Lukas!

Small improvements for smoother animations and handling reloads.

What is it?

Boost the smoothness of your cross-document view transitions with the Element Crossing library! No more resetting to static states! This library preserves the current dynamic state of your DOM and CSS properties, ensuring a seamless user experience.

With Element Crossing, you can automatically retain:

  • Current form inputs
  • Current scrollbar positions
  • Current state of active CSS animations
  • Current media playback time
  • Current toggle states
  • Current values of dynamically added classes and CSS properties
  • ...and (current) anything else you'd like to carry over from the previous page to the new one!

Simply annotate your elements in the HTML source or DOM, and let the library handle the rest. Keep your users engaged by preserving the exact state they left off, making transitions across documents smoother than ever!

Address any CSS property or DOM element property, any CSS class, or CSS animation.

View configuration examples and see the Element Crossing in action

更新日志

@vtbag/element-crossing

1.1.0 2025-01-01

Minor Changes

  • 065f143: Adds support for Safari.

    Starting with version 18.2, Safari introduced support for cross-document view transitions but still lacks support for the Navigation API.

    As of version 1.1.0, Element-Crossing now handles Safari as well, again enabling the transfer of selected element states across cross-document view transitions in all browsers that support this feature.

1.0.4 - 2024-11-15

Patch Changes

  • a7cbdee: Fixes access to data-* properties, which were previously ignored.

1.0.3 - 2024-10-30

Patch Changes

  • d4fd998: Extend anim expression with support for SVG animations.\ Many thanks to Lukas for this contirbution!

    To transfer the SVG animation state to the new document use the /svg key for the anim expression

    <svg data-vtbag-x="id:svg anim:/svg">...</svg>
    

1.0.2 - 2024-10-17

Patch Changes

  • 2ccb6db: Adds .d.ts declarations
  • 417fd4d: Dependency updates

1.0.1 - 2024-09-08

Patch Changes

  • 444ab59: Animation playback time now does a fast forward to take swap time into account
  • c15cf38: Ensures that state does not cross full page reloads.

1.0.0 - 2024-09-05

Major Changes

  • 5ec1341: Initial release