formkit / auto-animate

A zero-config, drop-in animation utility that adds smooth transitions to your web app. You can use it with React, Vue, or any other JavaScript application.
https://auto-animate.formkit.com
MIT License
12.8k stars 225 forks source link

add standalone directive for new angular #145

Open createdbyjurand opened 1 year ago

createdbyjurand commented 1 year ago

I had to create a standalone directive for new Angular to use it with standalone components. It would be nice to have it build in.

@Directive({
  selector: '[auto-animate]',
  standalone: true,
})

I am happy to contribute and create a pull-request just to make my mark on the project :) love it :) Or just do it yourself, I don't mind :) That is not that much work.

ajitzero commented 1 year ago

72 covers a discussion on this. The current project setup can not easily support ng-packagr for building a publishable Angular library since the Angular CLI is a required tool here.

AsimNet commented 1 year ago

I noticed that Angular support is no longer available. Perhaps we should consider updating the landing page to reflect this change and provide clarity.

ajitzero commented 1 year ago

The directive is fairly simple; you can copy and maintain your version for most projects.

I have made my library just for Angular because ~I plan to support~ I am supporting global options with an InjectionToken in the provider list.

justin-schroeder commented 1 year ago

I’m happy to ship off angular support to another package like yours @ajitzero! I really don’t have enough experience with angular to have any recommendations for how to consolidate it here. That said, it seems totally wild that there isn’t a way to have a build system pack angular support into the /angular imports directory.

How many standards does Angular have to break for that to be the case 😂?

ajitzero commented 1 year ago

Yeah, it's unfortunate but necessary in "Angular-land" because Angular code must be compiled and exported into a specific format for usage as a library (not talking about transpilation). They're not plain exported Js/Ts classes/functions. This is my understanding of the root problem.

I only know a little about this, and I leave all of the build system stuff on Nx (or Lerna or whatever works for you) for my own libraries. It allows me to target different frameworks as needed. Maintaining something for a single framework is hard enough, and here we're trying to do so for so many.

In the long term, this repo can benefit from migrating the project structure to Nx, but that's such a significant, non-trivial change; I figured we're better off with a spin-off library dedicated to Angular.

justin-schroeder commented 1 year ago

I have no plans or desire to migrate this to NX or Lerna — there’s nothing inherent in those systems that is needed here. Even if we went multi-package I would still just use small discrete custom build tooling — I greatly prefer to own the build process as we do on formkit/formkit..

I’ll need to look into what angular actually needs here, but I feel quite confident we can build a subpath with everything it needs.

ajitzero commented 1 year ago

In that case, please look at ng-packagr, the primary dependency for building these libraries.

Additional notes (from me making the wrapper library):