Skip to content

Commit c6528bb

Browse files
committed
Refactor animation provider to class
1 parent fa0c05e commit c6528bb

10 files changed

Lines changed: 776 additions & 829 deletions

File tree

@types/animations/animation.d.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
export function AnimationProvider(): void;
21
export class AnimationProvider {
3-
drivers: string[];
2+
/**
3+
* @type {string[]}
4+
*/
5+
_drivers: string[];
46
$get: (
57
| string
68
| ((
79
$rootScope: ng.RootScopeService,
810
$injector: ng.InjectorService,
911
) => import("./interface.ts").AnimationService)
1012
)[];
13+
#private;
1114
}
1215
export type SortedAnimationEntry =
1316
import("./interface.ts").SortedAnimationEntry;

@types/animations/shared.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ export function pendClasses(
2828
export function stripCommentsFromElement(
2929
element: NodeList | Node,
3030
): Node[] | Node | undefined;
31-
export function applyAnimationClassesFactory(): (
32-
/** @type {HTMLElement} */ element: HTMLElement,
33-
/** @type {ng.AnimationOptions} */ options: ng.AnimationOptions,
34-
) => void;
31+
export function applyAnimationClasses(
32+
element: HTMLElement,
33+
options: ng.AnimationOptions,
34+
): void;
3535
/**
3636
* @param {ng.AnimationOptions | undefined} options
3737
*/

package-lock.json

Lines changed: 294 additions & 293 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/animations/animate-css-driver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ AnimateCssDriverProvider.$inject = provider([$injectTokens._animation]);
1919
* @param {import("./animation.js").AnimationProvider} $$animationProvider
2020
*/
2121
export function AnimateCssDriverProvider($$animationProvider) {
22-
$$animationProvider.drivers.push($injectTokens._animateCssDriver);
22+
$$animationProvider._drivers.push($injectTokens._animateCssDriver);
2323

2424
/**
2525
* @param {Element} node

src/animations/animate-js-driver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ AnimateJsDriverProvider.$inject = provider([$injectTokens._animation]);
77
* @param {import("./animation.js").AnimationProvider} $$animationProvider
88
*/
99
export function AnimateJsDriverProvider($$animationProvider) {
10-
$$animationProvider.drivers.push($injectTokens._animateJsDriver);
10+
$$animationProvider._drivers.push($injectTokens._animateJsDriver);
1111
this.$get = [
1212
$injectTokens._animateJs,
1313
/**

src/animations/animate-js.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { isArray, isFunction, isObject } from "../shared/utils.js";
22
import {
3-
applyAnimationClassesFactory,
3+
applyAnimationClasses,
44
applyAnimationStyles,
55
prepareAnimationOptions,
66
} from "./shared.js";
@@ -20,8 +20,6 @@ export function AnimateJsProvider($animateProvider) {
2020
* @returns {import("./interface.ts").AnimateJsFn}
2121
*/
2222
($injector) => {
23-
const applyAnimationClasses = applyAnimationClassesFactory();
24-
2523
/**
2624
* @param {HTMLElement} element
2725
* @param {string} event

0 commit comments

Comments
 (0)