ng-auto-animate 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -10
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,30 +1,46 @@
|
|
|
1
1
|
# ng-auto-animate
|
|
2
2
|
|
|
3
|
-
An Angular Directive to use FormKit's [`auto-animate`](https://auto-animate.formkit.com) library
|
|
3
|
+
An Angular Directive to use FormKit's [`auto-animate`](https://auto-animate.formkit.com) library within Angular projects.
|
|
4
|
+
|
|
5
|
+
## Highlights
|
|
4
6
|
|
|
5
|
-
### Highlights:
|
|
6
7
|
- ✅ Standalone Directive, for Angular v14 and above. Tested on Node 18.x, but should work on previous versions.
|
|
7
8
|
- ✅ Custom `InjectionToken` for configuring global settings and plugins.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
## Why a new wrapper library?
|
|
11
|
+
|
|
12
|
+
A publishable library for Angular needs [`ng-packagr`](https://github.com/ng-packagr/ng-packagr) and Angular CLI for proper scaffolding and finalized formatting. Migrating the repository structure for `auto-animate` is a non-trivial task and would need an unbiased build system like [Nx](https://nx.dev) (which I am using here) or some other similar tool.
|
|
11
13
|
|
|
12
14
|
[Justin Schroeder](https://github.com/justin-schroeder), the creator of [`auto-animate`](https://auto-animate.formkit.com), has been supportive towards [contributions](https://github.com/formkit/auto-animate/pull/38) for Angular integration, but he [does not work with Angular](https://github.com/formkit/auto-animate/issues/72#issuecomment-1222732238) and is unable to work towards this actively. I, too, would not be able to do much in his shoes, especially when it requires replacing all build actions, scripts and the project structure, all to support a single framework.
|
|
13
15
|
|
|
14
|
-
If there is a simpler solution, I would be willing to submit a PR with my changes here to the original project, especially the support
|
|
16
|
+
If there is a simpler solution, I would be willing to submit a PR with my changes here to the original project, especially the support for global options/plugin via an `InjectionToken`.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
15
19
|
|
|
16
|
-
### Installation
|
|
17
20
|
1. Install the peer dependency.
|
|
21
|
+
|
|
18
22
|
```bash
|
|
19
23
|
npm i @formkit/auto-animate
|
|
20
24
|
```
|
|
25
|
+
|
|
21
26
|
1. Install this package.
|
|
27
|
+
|
|
22
28
|
```bash
|
|
23
29
|
npm i ng-auto-animate
|
|
24
30
|
```
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
### Principle
|
|
35
|
+
|
|
36
|
+
Add the directive to the parent tag, within which DOM elements are being shown or hidden dynamically.
|
|
37
|
+
|
|
38
|
+
Adding the directive to the same tag which is being hidden will do nothing since it will look for changes in child nodes only.
|
|
39
|
+
|
|
40
|
+
### Variants
|
|
41
|
+
|
|
27
42
|
1. Default usage:
|
|
43
|
+
|
|
28
44
|
```html
|
|
29
45
|
<article auto-animate>
|
|
30
46
|
<p *ngFor="let paragraph of paragraphs">
|
|
@@ -32,7 +48,9 @@ If there is a simpler solution, I would be willing to submit a PR with my change
|
|
|
32
48
|
</p>
|
|
33
49
|
</article>
|
|
34
50
|
```
|
|
51
|
+
|
|
35
52
|
1. Pass one-off options:
|
|
53
|
+
|
|
36
54
|
```html
|
|
37
55
|
<article [auto-animate]="{ duration: 750 }">
|
|
38
56
|
<p *ngFor="let paragraph of paragraphs">
|
|
@@ -40,7 +58,9 @@ If there is a simpler solution, I would be willing to submit a PR with my change
|
|
|
40
58
|
</p>
|
|
41
59
|
</article>
|
|
42
60
|
```
|
|
61
|
+
|
|
43
62
|
1. Configure global default options:
|
|
63
|
+
|
|
44
64
|
```ts
|
|
45
65
|
// src/app/app.config.ts
|
|
46
66
|
import { ApplicationConfig } from '@angular/core';
|
|
@@ -69,6 +89,7 @@ If there is a simpler solution, I would be willing to submit a PR with my change
|
|
|
69
89
|
console.error(err)
|
|
70
90
|
);
|
|
71
91
|
```
|
|
92
|
+
|
|
72
93
|
```html
|
|
73
94
|
<article auto-animate> <!-- Default usage -->
|
|
74
95
|
<p *ngFor="let paragraph of paragraphs">
|
|
@@ -76,20 +97,23 @@ If there is a simpler solution, I would be willing to submit a PR with my change
|
|
|
76
97
|
</p>
|
|
77
98
|
</article>
|
|
78
99
|
```
|
|
100
|
+
|
|
79
101
|
1. Pass a custom plugin
|
|
80
|
-
> See example here in the [demo app](https://github.com/ajitzero/ng-auto-animate/blob/
|
|
102
|
+
> See the example here in the [demo app](https://github.com/ajitzero/ng-auto-animate/blob/0f305d97a9a30ab715b1c41304572519f0d27894/apps/demo/src/app/app.component.ts#L68) for a "bouncy" effect.
|
|
103
|
+
|
|
81
104
|
```ts
|
|
82
105
|
customPlugin: AutoAnimationPlugin = (...) => {...};
|
|
83
106
|
```
|
|
107
|
+
|
|
84
108
|
```html
|
|
85
109
|
<article [auto-animate]="customPlugin">...</article>
|
|
86
110
|
```
|
|
87
111
|
|
|
88
|
-
|
|
112
|
+
## Missing support for something?
|
|
89
113
|
|
|
90
114
|
Go through existing issues if your problem is already being tracked; otherwise, [raise an issue!](https://github.com/ajitzero/ng-auto-animate/issues/new/choose)
|
|
91
115
|
|
|
92
|
-
|
|
116
|
+
## License
|
|
93
117
|
|
|
94
118
|
[MIT](https://github.com/ajitzero/ng-auto-animate/blob/main/LICENSE).
|
|
95
119
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ng-auto-animate",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Add motion to your apps with a single line of code. An Angular Directive to use FormKit's auto-animate library.",
|
|
5
5
|
"repository": "https://github.com/ajitzero/ng-auto-animate.git",
|
|
6
|
+
"homepage": "https://github.com/ajitzero/ng-auto-animate/tree/main/libs/ng-auto-animate#readme",
|
|
6
7
|
"author": "Ajit Panigrahi <hello@ajitpanigrahi.com>",
|
|
7
8
|
"license": "MIT",
|
|
8
9
|
"peerDependencies": {
|
|
@@ -14,6 +15,9 @@
|
|
|
14
15
|
"tslib": "^2.3.0"
|
|
15
16
|
},
|
|
16
17
|
"sideEffects": false,
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
17
21
|
"module": "fesm2022/ng-auto-animate.mjs",
|
|
18
22
|
"typings": "index.d.ts",
|
|
19
23
|
"exports": {
|