ng-auto-animate 0.3.1 → 0.3.2

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.
Files changed (70) hide show
  1. package/README.md +114 -24
  2. package/esm2022/index.mjs +2 -0
  3. package/esm2022/lib/ng-auto-animate.directive.mjs +45 -0
  4. package/esm2022/ng-auto-animate.mjs +5 -0
  5. package/fesm2022/ng-auto-animate.mjs +52 -0
  6. package/fesm2022/ng-auto-animate.mjs.map +1 -0
  7. package/lib/ng-auto-animate.directive.d.ts +14 -0
  8. package/package.json +33 -77
  9. package/.editorconfig +0 -13
  10. package/.eslintignore +0 -1
  11. package/.eslintrc.json +0 -48
  12. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -32
  13. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  14. package/.github/auto_assign.yml +0 -17
  15. package/.github/workflows/ci.yml +0 -24
  16. package/.github/workflows/npm-publish.yml +0 -23
  17. package/.github/workflows/release.yml +0 -32
  18. package/.node-version +0 -1
  19. package/.prettierignore +0 -7
  20. package/.prettierrc +0 -8
  21. package/.vscode/extensions.json +0 -10
  22. package/CHANGELOG.md +0 -6
  23. package/LICENSE +0 -21
  24. package/apps/.gitkeep +0 -0
  25. package/apps/demo/.eslintrc.json +0 -33
  26. package/apps/demo/jest.config.ts +0 -22
  27. package/apps/demo/project.json +0 -84
  28. package/apps/demo/src/app/app.component.ts +0 -148
  29. package/apps/demo/src/app/app.config.ts +0 -12
  30. package/apps/demo/src/app/app.routes.ts +0 -3
  31. package/apps/demo/src/assets/.gitkeep +0 -0
  32. package/apps/demo/src/favicon.ico +0 -0
  33. package/apps/demo/src/index.html +0 -14
  34. package/apps/demo/src/main.ts +0 -5
  35. package/apps/demo/src/styles.scss +0 -1
  36. package/apps/demo/src/test-setup.ts +0 -8
  37. package/apps/demo/tsconfig.app.json +0 -10
  38. package/apps/demo/tsconfig.editor.json +0 -7
  39. package/apps/demo/tsconfig.json +0 -32
  40. package/apps/demo/tsconfig.spec.json +0 -11
  41. package/apps/demo-e2e/.eslintrc.json +0 -10
  42. package/apps/demo-e2e/cypress.config.ts +0 -6
  43. package/apps/demo-e2e/project.json +0 -30
  44. package/apps/demo-e2e/src/e2e/app.cy.ts +0 -13
  45. package/apps/demo-e2e/src/fixtures/example.json +0 -4
  46. package/apps/demo-e2e/src/support/app.po.ts +0 -1
  47. package/apps/demo-e2e/src/support/commands.ts +0 -33
  48. package/apps/demo-e2e/src/support/e2e.ts +0 -17
  49. package/apps/demo-e2e/tsconfig.json +0 -16
  50. package/jest.config.ts +0 -5
  51. package/jest.preset.js +0 -3
  52. package/libs/.gitkeep +0 -0
  53. package/libs/ng-auto-animate/.eslintrc.json +0 -33
  54. package/libs/ng-auto-animate/README.md +0 -131
  55. package/libs/ng-auto-animate/jest.config.ts +0 -22
  56. package/libs/ng-auto-animate/ng-package.json +0 -7
  57. package/libs/ng-auto-animate/package.json +0 -21
  58. package/libs/ng-auto-animate/project.json +0 -43
  59. package/libs/ng-auto-animate/src/lib/ng-auto-animate.directive.spec.ts +0 -2
  60. package/libs/ng-auto-animate/src/lib/ng-auto-animate.directive.ts +0 -45
  61. package/libs/ng-auto-animate/src/test-setup.ts +0 -8
  62. package/libs/ng-auto-animate/tsconfig.json +0 -29
  63. package/libs/ng-auto-animate/tsconfig.lib.json +0 -12
  64. package/libs/ng-auto-animate/tsconfig.lib.prod.json +0 -9
  65. package/libs/ng-auto-animate/tsconfig.spec.json +0 -11
  66. package/nx.json +0 -59
  67. package/release.config.js +0 -40
  68. package/tools/tsconfig.tools.json +0 -12
  69. package/tsconfig.base.json +0 -22
  70. /package/{libs/ng-auto-animate/src/index.ts → index.d.ts} +0 -0
package/README.md CHANGED
@@ -1,41 +1,131 @@
1
1
  # ng-auto-animate
2
2
 
3
- Mono-repo for the library and demo app.
3
+ An Angular Directive to use FormKit's [`auto-animate`](https://auto-animate.formkit.com) library within Angular projects.
4
4
 
5
- - Library:
6
- - ⭐️ [Source & README](https://github.com/ajitzero/ng-auto-animate/tree/main/libs/ng-auto-animate) (Visit here first)
7
- - [NPM](https://www.npmjs.com/package/ng-auto-animate).
8
- - Demo app, deployed via Netlify:
9
- - [Source](https://github.com/ajitzero/ng-auto-animate/tree/main/apps/demo)
10
- - [Live Demo](https://ng-auto-animate.netlify.app/)
11
- - Original library docs:
12
- - ⭐️ [Source & README](https://github.com/formkit/auto-animate) (For everything else)
13
- - [Live Demo](https://auto-animate.formkit.com)
5
+ ## Highlights
14
6
 
15
- ### Missing support for something?
7
+ - Standalone Directive, for Angular v14 and above. Tested on Node 18.x, but should work on previous versions.
8
+ - ✅ Custom `InjectionToken` for configuring global settings and plugins.
16
9
 
17
- Go through existing issues if your problem is already being tracked, otherwise [raise an issue!](https://github.com/ajitzero/ng-auto-animate/issues/new)
10
+ ## Why a new wrapper library?
18
11
 
19
- ### License
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.
20
13
 
21
- [MIT](https://github.com/ajitzero/ng-auto-animate/blob/main/LICENSE).
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.
22
15
 
23
- Built by [Ajit Panigrahi](https://github.com/ajitzero). Original library by [Justin Schroeder](https://github.com/justin-schroeder) and many contributors.
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`.
24
17
 
25
- ---
26
- <a alt="Nx logo" href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a>
18
+ ## Installation
19
+
20
+ 1. Install the peer dependency.
21
+
22
+ ```bash
23
+ npm i @formkit/auto-animate
24
+ ```
25
+
26
+ 1. Install this package.
27
+
28
+ ```bash
29
+ npm i ng-auto-animate
30
+ ```
31
+
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
+ ### Import Path
41
+
42
+ Import and add the directive to your module or standalone component's imports array.
43
+ ```ts
44
+ import { NgAutoAnimateDirective } from 'ng-auto-animate';
45
+ ```
46
+
47
+ ### Variants
48
+
49
+ 1. **Default usage.** This uses the default values configured by `@formkit/auto-animate`.
27
50
 
28
- ✨ **This workspace has been generated by [Nx, a Smart, fast and extensible build system.](https://nx.dev)** ✨
51
+ ```html
52
+ <article auto-animate>
53
+ <p *ngFor="let paragraph of paragraphs">
54
+ {{ paragraph }}
55
+ </p>
56
+ </article>
57
+ ```
29
58
 
59
+ 1. **Pass one-off options.** Inline options will completely replace/override the default options.
30
60
 
31
- ## Start the demo app
61
+ ```html
62
+ <article [auto-animate]="{ duration: 750 }">
63
+ <p *ngFor="let paragraph of paragraphs">
64
+ {{ paragraph }}
65
+ </p>
66
+ </article>
67
+ ```
32
68
 
33
- To start the development server run `nx serve demo`. Open your browser and navigate to http://localhost:4200/. Happy coding!
69
+ 1. **Global options.** The ideal place to configure common settings across your app.
34
70
 
35
- ## Want better Editor Integration?
71
+ ```ts
72
+ // src/app/app.config.ts
73
+ import { ApplicationConfig } from '@angular/core';
74
+ import { GLOBAL_AUTO_ANIMATE_OPTIONS } from 'ng-auto-animate';
36
75
 
37
- Have a look at the [Nx Console extensions](https://nx.dev/nx-console). It provides autocomplete support, a UI for exploring and running tasks & generators, and more! Available for VSCode, IntelliJ and comes with a LSP for Vim users.
76
+ export const appConfig: ApplicationConfig = {
77
+ providers: [
78
+ {
79
+ provide: GLOBAL_AUTO_ANIMATE_OPTIONS,
80
+ useValue: {
81
+ duration: 750,
82
+ easing: 'ease-out',
83
+ // etc.
84
+ },
85
+ },
86
+ // other providers
87
+ ],
88
+ };
38
89
 
39
- ## Ready to deploy?
90
+ // main.ts
91
+ import { bootstrapApplication } from '@angular/platform-browser';
92
+ import { appConfig } from './app/app.config';
93
+ import { AppComponent } from './app/app.component';
94
+
95
+ bootstrapApplication(AppComponent, appConfig).catch((err) =>
96
+ console.error(err)
97
+ );
98
+ ```
99
+
100
+ ```html
101
+ <article auto-animate> <!-- Default usage -->
102
+ <p *ngFor="let paragraph of paragraphs">
103
+ {{ paragraph }}
104
+ </p>
105
+ </article>
106
+ ```
107
+
108
+ 1. **Custom plugins.** Same support as `@formkit/auto-animate`.
109
+ > 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.
110
+
111
+ ```ts
112
+ customPlugin: AutoAnimationPlugin = (...) => {...};
113
+ ```
114
+
115
+ ```html
116
+ <article [auto-animate]="customPlugin">...</article>
117
+ ```
118
+
119
+ ## Missing support for something?
120
+
121
+ 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)
122
+
123
+ ## License
124
+
125
+ [MIT](https://github.com/ajitzero/ng-auto-animate/blob/main/LICENSE).
126
+
127
+ Built by [Ajit Panigrahi](https://github.com/ajitzero). Original library by [Justin Schroeder](https://github.com/justin-schroeder) and many contributors.
128
+
129
+ ---
40
130
 
41
- Just run `nx build demoapp` to build the application. The build artifacts will be stored in the `dist/` directory, ready to be deployed.
131
+ This library was generated with [Nx](https://nx.dev).
@@ -0,0 +1,2 @@
1
+ export * from './lib/ng-auto-animate.directive';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9saWJzL25nLWF1dG8tYW5pbWF0ZS9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxpQ0FBaUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vbGliL25nLWF1dG8tYW5pbWF0ZS5kaXJlY3RpdmUnO1xuIl19
@@ -0,0 +1,45 @@
1
+ import { Directive, ElementRef, InjectionToken, computed, inject, input } from '@angular/core';
2
+ import autoAnimate from '@formkit/auto-animate';
3
+ import * as i0 from "@angular/core";
4
+ const isPlugin = (config) => typeof config === 'function';
5
+ export const GLOBAL_AUTO_ANIMATE_OPTIONS = new InjectionToken('Global AutoAnimate Options or Plugin', {
6
+ factory: () => ({}),
7
+ });
8
+ export class NgAutoAnimateDirective {
9
+ constructor() {
10
+ this.el = inject(ElementRef);
11
+ this.globalOptions = inject(GLOBAL_AUTO_ANIMATE_OPTIONS);
12
+ this.autoAnimateOptions = input('', { alias: 'auto-animate' });
13
+ this.options = computed(() => {
14
+ const localOptions = this.autoAnimateOptions();
15
+ if (typeof localOptions === 'string') {
16
+ // Default case, when no options or plugin is passed
17
+ return this.globalOptions;
18
+ }
19
+ // When either some options or a plugin is passed
20
+ if (isPlugin(this.globalOptions) || isPlugin(localOptions)) {
21
+ // A plugin must replace any previously set options or plugin.
22
+ // A plugin must be replaced by options or another plugin.
23
+ return localOptions;
24
+ }
25
+ // When plugins are not involved
26
+ return {
27
+ ...this.globalOptions,
28
+ ...localOptions,
29
+ };
30
+ });
31
+ }
32
+ ngAfterViewInit() {
33
+ autoAnimate(this.el.nativeElement, this.options());
34
+ }
35
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: NgAutoAnimateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
36
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.0.4", type: NgAutoAnimateDirective, isStandalone: true, selector: "[auto-animate]", inputs: { autoAnimateOptions: { classPropertyName: "autoAnimateOptions", publicName: "auto-animate", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
37
+ }
38
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: NgAutoAnimateDirective, decorators: [{
39
+ type: Directive,
40
+ args: [{
41
+ selector: '[auto-animate]',
42
+ standalone: true,
43
+ }]
44
+ }] });
45
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmctYXV0by1hbmltYXRlLmRpcmVjdGl2ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMvbmctYXV0by1hbmltYXRlL3NyYy9saWIvbmctYXV0by1hbmltYXRlLmRpcmVjdGl2ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQWlCLFNBQVMsRUFBRSxVQUFVLEVBQUUsY0FBYyxFQUFTLFFBQVEsRUFBRSxNQUFNLEVBQUUsS0FBSyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3JILE9BQU8sV0FBd0QsTUFBTSx1QkFBdUIsQ0FBQzs7QUFHN0YsTUFBTSxRQUFRLEdBQUcsQ0FBQyxNQUEyQixFQUFFLEVBQUUsQ0FBQyxPQUFPLE1BQU0sS0FBSyxVQUFVLENBQUM7QUFFL0UsTUFBTSxDQUFDLE1BQU0sMkJBQTJCLEdBQUcsSUFBSSxjQUFjLENBQzVELHNDQUFzQyxFQUN0QztJQUNDLE9BQU8sRUFBRSxHQUFHLEVBQUUsQ0FBQyxDQUFDLEVBQUUsQ0FBQztDQUNuQixDQUNELENBQUM7QUFNRixNQUFNLE9BQU8sc0JBQXNCO0lBSm5DO1FBS2tCLE9BQUUsR0FBRyxNQUFN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CB7XG5cdFx0YXV0b0FuaW1hdGUodGhpcy5lbC5uYXRpdmVFbGVtZW50LCB0aGlzLm9wdGlvbnMoKSk7XG5cdH1cbn1cbiJdfQ==
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './index';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmctYXV0by1hbmltYXRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vbGlicy9uZy1hdXRvLWFuaW1hdGUvc3JjL25nLWF1dG8tYW5pbWF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ==
@@ -0,0 +1,52 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, ElementRef, input, computed, Directive } from '@angular/core';
3
+ import autoAnimate from '@formkit/auto-animate';
4
+
5
+ const isPlugin = (config) => typeof config === 'function';
6
+ const GLOBAL_AUTO_ANIMATE_OPTIONS = new InjectionToken('Global AutoAnimate Options or Plugin', {
7
+ factory: () => ({}),
8
+ });
9
+ class NgAutoAnimateDirective {
10
+ constructor() {
11
+ this.el = inject(ElementRef);
12
+ this.globalOptions = inject(GLOBAL_AUTO_ANIMATE_OPTIONS);
13
+ this.autoAnimateOptions = input('', { alias: 'auto-animate' });
14
+ this.options = computed(() => {
15
+ const localOptions = this.autoAnimateOptions();
16
+ if (typeof localOptions === 'string') {
17
+ // Default case, when no options or plugin is passed
18
+ return this.globalOptions;
19
+ }
20
+ // When either some options or a plugin is passed
21
+ if (isPlugin(this.globalOptions) || isPlugin(localOptions)) {
22
+ // A plugin must replace any previously set options or plugin.
23
+ // A plugin must be replaced by options or another plugin.
24
+ return localOptions;
25
+ }
26
+ // When plugins are not involved
27
+ return {
28
+ ...this.globalOptions,
29
+ ...localOptions,
30
+ };
31
+ });
32
+ }
33
+ ngAfterViewInit() {
34
+ autoAnimate(this.el.nativeElement, this.options());
35
+ }
36
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: NgAutoAnimateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
37
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.0.4", type: NgAutoAnimateDirective, isStandalone: true, selector: "[auto-animate]", inputs: { autoAnimateOptions: { classPropertyName: "autoAnimateOptions", publicName: "auto-animate", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
38
+ }
39
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: NgAutoAnimateDirective, decorators: [{
40
+ type: Directive,
41
+ args: [{
42
+ selector: '[auto-animate]',
43
+ standalone: true,
44
+ }]
45
+ }] });
46
+
47
+ /**
48
+ * Generated bundle index. Do not edit.
49
+ */
50
+
51
+ export { GLOBAL_AUTO_ANIMATE_OPTIONS, NgAutoAnimateDirective };
52
+ //# sourceMappingURL=ng-auto-animate.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-auto-animate.mjs","sources":["../../../../libs/ng-auto-animate/src/lib/ng-auto-animate.directive.ts","../../../../libs/ng-auto-animate/src/ng-auto-animate.ts"],"sourcesContent":["import { AfterViewInit, Directive, ElementRef, InjectionToken, Input, computed, inject, input } from '@angular/core';\nimport autoAnimate, { AutoAnimateOptions, AutoAnimationPlugin } from '@formkit/auto-animate';\n\nexport type AutoAnimationConfig = Partial<AutoAnimateOptions> | AutoAnimationPlugin;\nconst isPlugin = (config: AutoAnimationConfig) => typeof config === 'function';\n\nexport const GLOBAL_AUTO_ANIMATE_OPTIONS = new InjectionToken<AutoAnimationConfig>(\n\t'Global AutoAnimate Options or Plugin',\n\t{\n\t\tfactory: () => ({}),\n\t},\n);\n\n@Directive({\n\tselector: '[auto-animate]',\n\tstandalone: true,\n})\nexport class NgAutoAnimateDirective implements AfterViewInit {\n\tprivate readonly el = inject(ElementRef);\n\tprivate readonly globalOptions = inject(GLOBAL_AUTO_ANIMATE_OPTIONS);\n\n\tautoAnimateOptions = input<AutoAnimationConfig | string>('', { alias: 'auto-animate' });\n\tprivate options = computed(() => {\n\t\tconst localOptions = this.autoAnimateOptions();\n\t\tif (typeof localOptions === 'string') {\n\t\t\t// Default case, when no options or plugin is passed\n\t\t\treturn this.globalOptions;\n\t\t}\n\t\t// When either some options or a plugin is passed\n\t\tif (isPlugin(this.globalOptions) || isPlugin(localOptions)) {\n\t\t\t// A plugin must replace any previously set options or plugin.\n\t\t\t// A plugin must be replaced by options or another plugin.\n\t\t\treturn localOptions;\n\t\t}\n\t\t// When plugins are not involved\n\t\treturn {\n\t\t\t...this.globalOptions,\n\t\t\t...localOptions,\n\t\t};\n\t});\n\n\tngAfterViewInit(): void {\n\t\tautoAnimate(this.el.nativeElement, this.options());\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAIA,MAAM,QAAQ,GAAG,CAAC,MAA2B,KAAK,OAAO,MAAM,KAAK,UAAU,CAAC;MAElE,2BAA2B,GAAG,IAAI,cAAc,CAC5D,sCAAsC,EACtC;AACC,IAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,CAAA,EACA;MAMW,sBAAsB,CAAA;AAJnC,IAAA,WAAA,GAAA;AAKkB,QAAA,IAAA,CAAA,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AACxB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAC;QAErE,IAAkB,CAAA,kBAAA,GAAG,KAAK,CAA+B,EA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-0,0 +1,14 @@
1
+ import { AfterViewInit, InjectionToken } from '@angular/core';
2
+ import { AutoAnimateOptions, AutoAnimationPlugin } from '@formkit/auto-animate';
3
+ import * as i0 from "@angular/core";
4
+ export type AutoAnimationConfig = Partial<AutoAnimateOptions> | AutoAnimationPlugin;
5
+ export declare const GLOBAL_AUTO_ANIMATE_OPTIONS: InjectionToken<AutoAnimationConfig>;
6
+ export declare class NgAutoAnimateDirective implements AfterViewInit {
7
+ private readonly el;
8
+ private readonly globalOptions;
9
+ autoAnimateOptions: import("@angular/core").InputSignal<string | AutoAnimationConfig>;
10
+ private options;
11
+ ngAfterViewInit(): void;
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgAutoAnimateDirective, never>;
13
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgAutoAnimateDirective, "[auto-animate]", never, { "autoAnimateOptions": { "alias": "auto-animate"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
14
+ }
package/package.json CHANGED
@@ -1,78 +1,34 @@
1
1
  {
2
- "name": "ng-auto-animate",
3
- "version": "0.3.1",
4
- "license": "MIT",
5
- "scripts": {
6
- "clean": "rimraf dist ./node_modules ./.angular",
7
- "format": "prettier -w --cache **.{ts,js,json,html,scss,css}"
8
- },
9
- "dependencies": {
10
- "@angular/animations": "18.0.4",
11
- "@angular/common": "18.0.4",
12
- "@angular/compiler": "18.0.4",
13
- "@angular/core": "18.0.4",
14
- "@angular/forms": "18.0.4",
15
- "@angular/platform-browser": "18.0.4",
16
- "@angular/platform-browser-dynamic": "18.0.4",
17
- "@angular/router": "18.0.4",
18
- "@formkit/auto-animate": "^0.8.2",
19
- "@nx/angular": "19.3.0",
20
- "rxjs": "~7.8.0",
21
- "tslib": "^2.3.0"
22
- },
23
- "devDependencies": {
24
- "@angular-devkit/build-angular": "18.0.5",
25
- "@angular-devkit/core": "18.0.5",
26
- "@angular-devkit/schematics": "18.0.5",
27
- "@angular-eslint/eslint-plugin": "~16.0.0",
28
- "@angular-eslint/eslint-plugin-template": "~16.0.0",
29
- "@angular-eslint/template-parser": "~16.0.0",
30
- "@angular/cli": "18.0.5",
31
- "@angular/compiler-cli": "18.0.4",
32
- "@angular/language-service": "18.0.4",
33
- "@nx/cypress": "19.3.0",
34
- "@nx/eslint": "19.3.0",
35
- "@nx/eslint-plugin": "19.3.0",
36
- "@nx/jest": "19.3.0",
37
- "@nx/js": "19.3.0",
38
- "@nx/web": "19.3.0",
39
- "@nx/workspace": "19.3.0",
40
- "@schematics/angular": "~16.0.0",
41
- "@semantic-release/changelog": "^6.0.3",
42
- "@semantic-release/commit-analyzer": "^10.0.1",
43
- "@semantic-release/exec": "^6.0.3",
44
- "@semantic-release/git": "^10.0.1",
45
- "@semantic-release/release-notes-generator": "^11.0.4",
46
- "@types/jest": "^29.4.0",
47
- "@types/node": "^18.16.9",
48
- "@typescript-eslint/eslint-plugin": "7.9.0",
49
- "@typescript-eslint/parser": "7.9.0",
50
- "conventional-changelog-conventionalcommits": "^6.1.0",
51
- "cypress": "^4.2.0",
52
- "cz-conventional-changelog": "^3.3.0",
53
- "eslint": "8.57.0",
54
- "eslint-config-prettier": "9.1.0",
55
- "eslint-plugin-cypress": "2.15.2",
56
- "jest": "^29.4.1",
57
- "jest-environment-jsdom": "^29.4.1",
58
- "jest-preset-angular": "14.1.1",
59
- "ng-packagr": "^18.0.0",
60
- "nx": "19.3.0",
61
- "nx-release": "^3.1.5",
62
- "postcss": "^8.4.31",
63
- "postcss-import": "~14.1.0",
64
- "postcss-preset-env": "~7.5.0",
65
- "postcss-url": "~10.1.3",
66
- "prettier": "^3.3.2",
67
- "replace-json-property": "^1.9.0",
68
- "rimraf": "^5.0.7",
69
- "ts-jest": "^29.1.0",
70
- "ts-node": "10.9.1",
71
- "typescript": "5.4"
72
- },
73
- "config": {
74
- "commitizen": {
75
- "path": "./node_modules/cz-conventional-changelog"
76
- }
77
- }
78
- }
2
+ "name": "ng-auto-animate",
3
+ "version": "0.3.2",
4
+ "description": "Add motion to your apps with a single line of code. An Angular Directive to use FormKit's auto-animate library.",
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",
7
+ "author": "Ajit Panigrahi <hello@ajitpanigrahi.com>",
8
+ "license": "MIT",
9
+ "peerDependencies": {
10
+ "@angular/common": "^18.0.0",
11
+ "@angular/core": "^18.0.0",
12
+ "@formkit/auto-animate": "^0.8.2"
13
+ },
14
+ "dependencies": {
15
+ "tslib": "^2.3.0"
16
+ },
17
+ "sideEffects": false,
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "module": "fesm2022/ng-auto-animate.mjs",
22
+ "typings": "index.d.ts",
23
+ "exports": {
24
+ "./package.json": {
25
+ "default": "./package.json"
26
+ },
27
+ ".": {
28
+ "types": "./index.d.ts",
29
+ "esm2022": "./esm2022/ng-auto-animate.mjs",
30
+ "esm": "./esm2022/ng-auto-animate.mjs",
31
+ "default": "./fesm2022/ng-auto-animate.mjs"
32
+ }
33
+ }
34
+ }
package/.editorconfig DELETED
@@ -1,13 +0,0 @@
1
- # Editor configuration, see http://editorconfig.org
2
- root = true
3
-
4
- [*]
5
- charset = utf-8
6
- indent_style = space
7
- indent_size = 2
8
- insert_final_newline = true
9
- trim_trailing_whitespace = true
10
-
11
- [*.md]
12
- max_line_length = off
13
- trim_trailing_whitespace = false
package/.eslintignore DELETED
@@ -1 +0,0 @@
1
- node_modules
package/.eslintrc.json DELETED
@@ -1,48 +0,0 @@
1
- {
2
- "root": true,
3
- "ignorePatterns": ["**/*"],
4
- "plugins": ["@nx"],
5
- "overrides": [
6
- {
7
- "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
8
- "rules": {
9
- "@nx/enforce-module-boundaries": [
10
- "error",
11
- {
12
- "enforceBuildableLibDependency": true,
13
- "allow": [],
14
- "depConstraints": [
15
- {
16
- "sourceTag": "*",
17
- "onlyDependOnLibsWithTags": ["*"]
18
- }
19
- ]
20
- }
21
- ]
22
- }
23
- },
24
- {
25
- "files": ["*.ts", "*.tsx"],
26
- "extends": ["plugin:@nx/typescript"],
27
- "rules": {
28
- "@typescript-eslint/no-extra-semi": "error",
29
- "no-extra-semi": "off"
30
- }
31
- },
32
- {
33
- "files": ["*.js", "*.jsx"],
34
- "extends": ["plugin:@nx/javascript"],
35
- "rules": {
36
- "@typescript-eslint/no-extra-semi": "error",
37
- "no-extra-semi": "off"
38
- }
39
- },
40
- {
41
- "files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
42
- "env": {
43
- "jest": true
44
- },
45
- "rules": {}
46
- }
47
- ]
48
- }
@@ -1,32 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Create a report to help us improve
4
- title: 'bug: X does not work when Y'
5
- labels: bug, unverified
6
- assignees: ajitzero
7
-
8
- ---
9
-
10
- **Describe the bug**
11
- A clear and concise description of what the bug is.
12
-
13
- **To Reproduce**
14
- Steps to reproduce the behavior:
15
- 1. Go to '...'
16
- 2. Click on '....'
17
- 3. Scroll down to '....'
18
- 4. See error
19
-
20
- **Expected behavior**
21
- A clear and concise description of what you expected to happen.
22
-
23
- **Screenshots**
24
- If applicable, add screenshots to help explain your problem.
25
-
26
- **Version Info (please complete the following information):**
27
- - Angular: [e.g. v14.3.0]
28
- - Node: [e.g. 18.4.0]
29
- - ng-auto-animate: [e.g. 0.0.2]
30
-
31
- **Additional context**
32
- Add any other context about the problem here.
@@ -1,20 +0,0 @@
1
- ---
2
- name: Feature request
3
- about: Suggest an idea for this project
4
- title: 'feat: Support X when Y'
5
- labels: enhancement, unconfirmed
6
- assignees: ajitzero
7
-
8
- ---
9
-
10
- **Is your feature request related to a problem? Please describe.**
11
- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
-
13
- **Describe the solution you'd like**
14
- A clear and concise description of what you want to happen.
15
-
16
- **Describe alternatives you've considered**
17
- A clear and concise description of any alternative solutions or features you've considered.
18
-
19
- **Additional context**
20
- Add any other context or screenshots about the feature request here.
@@ -1,17 +0,0 @@
1
- # Set to true to add reviewers to pull requests
2
- addReviewers: true
3
-
4
- # Set to true to add assignees to pull requests
5
- addAssignees: true
6
-
7
- # A list of reviewers to be added to pull requests (GitHub user name)
8
- reviewers:
9
- - ajitzero
10
-
11
- # A list of keywords to be skipped the process that add reviewers if pull requests include it
12
- skipKeywords:
13
- - wip
14
-
15
- # A number of reviewers added to the pull request
16
- # Set 0 to add all the reviewers (default: 0)
17
- numberOfReviewers: 1
@@ -1,24 +0,0 @@
1
- name: CI
2
- on:
3
- push:
4
- branches:
5
- - '*'
6
- - '*/*'
7
- - '**'
8
- - '!main'
9
- jobs:
10
- main:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/checkout@v2
14
- with:
15
- fetch-depth: 0
16
- - uses: nrwl/nx-set-shas@v3
17
- - name: Install deps
18
- run: npm ci --legacy-peer-deps
19
- - name: Lint affected
20
- run: npx nx affected -t lint
21
- # - name: Test affected
22
- # run: npx nx affected -t test --configuration=ci
23
- - name: Build affected
24
- run: npx nx affected -t build
@@ -1,23 +0,0 @@
1
- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
- # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
-
4
- name: Node.js Package
5
-
6
- on: [workflow_dispatch]
7
- # on:
8
- # release:
9
- # types: [created]
10
-
11
- jobs:
12
- publish-npm:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@v4
16
- - uses: actions/setup-node@v3
17
- with:
18
- node-version: 22
19
- registry-url: https://registry.npmjs.org/
20
- - run: npm ci
21
- - run: npm publish
22
- env:
23
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,32 +0,0 @@
1
- name: RELEASE
2
-
3
- on: [workflow_dispatch]
4
-
5
- permissions:
6
- contents: read # for checkout
7
-
8
- jobs:
9
- main:
10
- name: Version and Publish
11
- runs-on: ubuntu-latest
12
- steps:
13
- - name: Checkout
14
- uses: actions/checkout@v3
15
- with:
16
- fetch-depth: 0
17
- - name: Setup Node.js
18
- uses: actions/setup-node@v3
19
- with:
20
- node-version-file: .node-version
21
- - uses: nrwl/nx-set-shas@v3
22
- - name: Install deps
23
- run: npm ci
24
- - name: Lint
25
- run: npx nx run-many -t lint
26
- # - name: Test
27
- # run: npx nx run-many -t test --configuration=ci
28
- - name: Release
29
- run: npx semantic-release
30
- env:
31
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
32
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
package/.node-version DELETED
@@ -1 +0,0 @@
1
- v22.3.0
package/.prettierignore DELETED
@@ -1,7 +0,0 @@
1
- # Add files here to ignore them from prettier formatting
2
- /dist
3
- /coverage
4
- .angular
5
-
6
- /.nx/cache
7
- /.nx/workspace-data