npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-easy-view-transitions

v2.0.0

Published

Angular library for easier use of the View Transitions API

Downloads

15

Readme

ngx-easy-view-transitions

npm version npm downloads build GitHub license

Angular library for easier use of the View Transitions API

Demo

https://derstimmler.github.io/ngx-easy-view-transitions/

Installation

Available on npm.

npm install ngx-easy-view-transitions

You have to enable Angulars built-in view transitions in the Router using the withViewTransitions() function.

bootstrapApplication(AppComponent,
  {
    providers: [
      provideRouter(appRoutes, withViewTransitions())
    ]
  }
);

Usage

Morph elements

To morph an element during navigation from the old to the new state use the transitionName directive and provide the same name on both pages.

import { TransitionNameDirective } from 'ngx-easy-view-transitions';

users.component.html

<img transitionName="profile-picture" src="...">

user.component.html

<img transitionName="profile-picture" src="...">

Note that each transitionName must be unique for a page.

Customize animations

Instead of morphing an element, you can provide custom animations for entering and leaving the view using the inAnimation and outAnimation inputs. There are two ways to provide a custom animations: As CSS @keyframes rule or Keyframe array.

Using CSS @keyframes

You can simply use a CSS @keyframes rule from your CSS:

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}
inAnimation = { keyframeName: 'fadeIn', duration: 600 };
outAnimation = { keyframeName: 'fadeIn', duration: 600, reverse: true };
<img transitionName="profile-picture" [inAnimation]="inAnimation" [outAnimation]="outAnimation" src="...">

Using Keyframe array

When you want to use typed objects instead of CSS you can provide a Keyframe array:

const fadeIn: Keyframe[] = [
  {
    opacity: 0,
    offset: 0,
  },
  {
    opacity: 1,
    offset: 1,
  },
];
inAnimation = { keyframes: fadeIn, duration: 600 };
outAnimation = { keyframes: fadeIn, duration: 600, reverse: true };
<img transitionName="profile-picture" [inAnimation]="inAnimation" [outAnimation]="outAnimation" src="...">

Built-In animations

To start faster there are some built-in animations available under DefaultTransitions.*.

import { DefaultTransitions } from 'ngx-easy-view-transitions';

inAnimation = { keyframes: DefaultTransitions.fadeInUp, duration: 600 };

You can see them in the demo and here.

Exclude element from view transitions

When you want to exclude an element form view transitions you can add the noTransition directive.

import { NoTransitionDirective } from 'ngx-easy-view-transitions';
<img noTransition src="...">

Configure default transition

By default View Transitions API will perform a cross-fade animation on all elements. But you can also provide your own in and out animations by adding the provideDefaultViewTransition() provider function.

In the following example the default animation gets disabled:

bootstrapApplication(AppComponent,
  {
    providers: [
      provideRouter(appRoutes, withViewTransitions()),
      provideDefaultViewTransition(
        { keyframes: DefaultTransitions.none, duration: 0 },
        { keyframes: DefaultTransitions.none, duration: 0 }
      )
    ]
  }
);

Development

Install dependencies with: pnpm install

Run pnpm demo to run the demo app on a local development server. You can access it on http://localhost:4200.

Run pnpm test to test all projects.

Run pnpm lint to lint all projects.

Run pnpm build to build all projects. You can find the output under /dist.

Since it's a nx workspace you can use the common nx commands for everything else.