Skip to content

Commit

Permalink
Signal (#194)
Browse files Browse the repository at this point in the history
* new: turn-signal

* renaming and restructuring

* updates

* merge

* bumps

* update
  • Loading branch information
martrapp authored Sep 25, 2024
1 parent ec02f38 commit 5efdf5e
Show file tree
Hide file tree
Showing 11 changed files with 356 additions and 64 deletions.
5 changes: 5 additions & 0 deletions .changeset/beige-chairs-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro-vtbot': minor
---

Introducing a new tool for your transition from `<ViewTransitions />` to `@view-transitions {navigation: auto}`: The `<TurnSignal />` component enables seamless integration of forward and backward animations from `transition:animate` in cross-document transitions. Sync the direction of your animations with browser history navigation, or even with the page order of your site, if you prefer!
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ A current deployment of tech demos and the documentation can be found at https:/

## !!! NEW TRICKS ✨ IN THE BAG 👜 !!!

New component for cross-document view transitions: The `<TurnSignal>` enables Astro's forward/backward animations provided by `transition:animate` to work with native cross-document `@view-transition{}`. Slide right and left as you traverse the browser's history! Optionally you can configure the component with a total order of your site's pages, allowing it to automatically detect the transition direction.

Bug fix for the Linter and an update of the InspectionChamber!

For details, see the [CHANGELOG of the Bag](https://github.com/martrapp/astro-vtbot/blob/main/CHANGELOG.md) and of the [CHANGELOG of the InstructionChamber](https://github.com/vtbag/inspection-chamber/blob/main/CHANGELOG.md)
For details, see the [CHANGELOG of the Bag](https://github.com/martrapp/astro-vtbot/blob/main/CHANGELOG.md) and of the [CHANGELOG of the InstructionChamber](https://github.com/vtbag/inspection-chamber/blob/main/CHANGELOG.md) for minor improvements regarding the Chamber.


## Recently Learned Tricks ##
Expand Down
29 changes: 29 additions & 0 deletions components/TurnSignal.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
import signalURL from '@vtbag/turn-signal?url';
import forcedTraversalURL from '@vtbag/turn-signal/forced-traversal?url';
export interface Props {
selector?: string;
forcedTraversal?: boolean;
directionTypes?: string;
directionAttribute?: string;
}
const {
selector,
forcedTraversal,
directionTypes = '',
directionAttribute = 'data-astro-transition, back, forward, forward',
} = Astro.props;
---

{forcedTraversal && <script is:inline src={forcedTraversalURL} />}{
(
<script
is:inline
{...(selector ? { 'data-selector': selector } : {})}
{...(directionTypes ? { 'data-direction-types': directionTypes } : {})}
{...(directionAttribute ? { 'data-direction-attribute': directionAttribute } : {})}
src={signalURL}
/>
)
}
1 change: 1 addition & 0 deletions components/TurnSignal.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default function TurnSignal(_props: import('./TurnSignal.astro').Props): any;
Loading

0 comments on commit 5efdf5e

Please sign in to comment.