Skip to content

Commit f4ee779

Browse files
committed
Type improvements on animate
1 parent ae1b09c commit f4ee779

File tree

107 files changed

+242
-3535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+242
-3535
lines changed

.husky/pre-commit

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
make lint
2-
make check
3-
make types
4-
make pretty
1+
52
git add ./

@types/animations/animate.d.ts

Lines changed: 1 addition & 275 deletions
Large diffs are not rendered by default.

@types/animations/animation.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ export class AnimationProvider {
55
| string
66
| ((
77
$rootScope: ng.RootScopeService,
8-
$injector: any,
9-
$$rAFScheduler: any,
8+
$injector: ng.InjectorService,
9+
$$rAFScheduler: import("./raf-scheduler.js").RafScheduler,
1010
$$animateCache: any,
1111
) => (element: any, event: any, options: any) => AnimateRunner)
1212
)[];

@types/animations/interface.d.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { AnimationOptions } from "./animate.js";
2+
import { AnimateRunner } from "./runner/animate-runner.js";
13
export type RafScheduler = {
24
/**
35
* Schedules a list of functions to run on the next animation frame(s).
@@ -27,3 +29,59 @@ export interface AnimationHost {
2729
/** Report animation progress. */
2830
progress?: (...args: any[]) => void;
2931
}
32+
export interface AnimateService {
33+
on(
34+
event: string,
35+
container: Element,
36+
callback: (
37+
element: Element,
38+
phase: "start" | "close",
39+
data: {
40+
addClass: string | null;
41+
removeClass: string | null;
42+
from: Record<string, any> | null;
43+
to: Record<string, any> | null;
44+
},
45+
) => void,
46+
): void;
47+
off(event: string, container?: Element, callback?: Function): void;
48+
pin(element: Element, parentElement: Element): void;
49+
enabled(element?: Element, enabled?: boolean): boolean;
50+
cancel(runner: AnimateRunner): void;
51+
enter(
52+
element: Element,
53+
parent: Element,
54+
after?: Element,
55+
options?: AnimationOptions,
56+
): AnimateRunner;
57+
move(
58+
element: Element,
59+
parent: Element,
60+
after?: Element,
61+
options?: AnimationOptions,
62+
): AnimateRunner;
63+
leave(element: Element, options?: AnimationOptions): AnimateRunner;
64+
addClass(
65+
element: Element,
66+
className: string,
67+
options?: AnimationOptions,
68+
): AnimateRunner;
69+
removeClass(
70+
element: Element,
71+
className: string,
72+
options?: AnimationOptions,
73+
): AnimateRunner;
74+
setClass(
75+
element: Element,
76+
add: string,
77+
remove: string,
78+
options?: AnimationOptions,
79+
): AnimateRunner;
80+
animate(
81+
element: Element,
82+
from: Record<string, any>,
83+
to: Record<string, any>,
84+
className?: string,
85+
options?: AnimationOptions,
86+
): AnimateRunner;
87+
}

@types/core/compile/attributes.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ export class Attributes {
22
static $nonscope: boolean;
33
/**
44
* @param {ng.RootScopeService} $rootScope
5-
* @param {*} $animate
5+
* @param {ng.AnimateService} $animate
66
* @param {ng.ExceptionHandlerService} $exceptionHandler
77
* @param {*} $sce
88
* @param {import("../../shared/noderef.js").NodeRef} [nodeRef]
99
* @param {Object} [attributesToCopy]
1010
*/
1111
constructor(
1212
$rootScope: ng.RootScopeService,
13-
$animate: any,
13+
$animate: ng.AnimateService,
1414
$exceptionHandler: ng.ExceptionHandlerService,
1515
$sce: any,
1616
nodeRef?: import("../../shared/noderef.js").NodeRef,
1717
attributesToCopy?: any,
1818
);
1919
$rootScope: import("../scope/scope.js").Scope;
20-
$animate: any;
20+
$animate: import("../../interface.ts").AnimateService;
2121
$exceptionHandler: import("../../services/exception/interface.ts").ErrorHandler;
2222
$sce: any;
2323
$attr: {};

@types/core/compile/compile.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ export class CompileProvider {
124124
$get: (
125125
| string
126126
| ((
127-
$injector: import("../../core/di/internal-injector.js").InjectorService,
127+
$injector: ng.InjectorService,
128128
$interpolate: any,
129129
$exceptionHandler: import("../../services/exception/exception-handler.js").ErrorHandler,
130-
$templateRequest: any,
131-
$parse: import("../parse/interface.ts").ParseService,
130+
$templateRequest: ng.TemplateRequestService,
131+
$parse: ng.ParseService,
132132
$controller: any,
133133
$rootScope: import("../scope/scope.js").Scope,
134134
$sce: any,
135-
$animate: any,
135+
$animate: ng.AnimateService,
136136
) => (
137137
compileNode: string | Element | Node | ChildNode | NodeList,
138138
transcludeFn?: import("./inteface.ts").TranscludeFn,

@types/directive/form/form.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,16 @@ export class FormController {
7575
static $inject: string[];
7676
/**
7777
* @param {Element} $element
78-
* @param {import("../../core/compile/attributes.js").Attributes} $attrs
79-
* @param {import("../../core/scope/scope.js").Scope} $scope
80-
* @param {*} $animate
78+
* @param {ng.Attributes} $attrs
79+
* @param {ng.Scope} $scope
80+
* @param {ng.AnimateService} $animate
8181
* @param {*} $interpolate
8282
*/
8383
constructor(
8484
$element: Element,
85-
$attrs: import("../../core/compile/attributes.js").Attributes,
86-
$scope: import("../../core/scope/scope.js").Scope,
87-
$animate: any,
85+
$attrs: ng.Attributes,
86+
$scope: ng.Scope,
87+
$animate: ng.AnimateService,
8888
$interpolate: any,
8989
);
9090
$$controls: any[];
@@ -103,7 +103,7 @@ export class FormController {
103103
/** @type {FormController|Object} */
104104
$$parentForm: FormController | any;
105105
$$element: Element;
106-
$$animate: any;
106+
$$animate: import("../../interface.ts").AnimateService;
107107
$error: {};
108108
$$success: {};
109109
$pending: any;

@types/directive/if/if.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
2-
* @param {*} $animate
2+
* @param {ng.AnimateService} $animate
33
* @returns {ng.Directive}
44
*/
5-
export function ngIfDirective($animate: any): ng.Directive;
5+
export function ngIfDirective($animate: ng.AnimateService): ng.Directive;
66
export namespace ngIfDirective {
77
let $inject: string[];
88
}

@types/directive/include/include.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/**
22
*
3-
* @param {*} $templateRequest
3+
* @param {ng.TemplateRequestService} $templateRequest
44
* @param {import("../../services/anchor-scroll/anchor-scroll.js").AnchorScrollFunction} $anchorScroll
5-
* @param {*} $animate
5+
* @param {ng.AnimateService} $animate
66
* @param {import('../../services/exception/interface.ts').ErrorHandler} $exceptionHandler
77
* @returns {import('../../interface.ts').Directive}
88
*/
99
export function ngIncludeDirective(
10-
$templateRequest: any,
10+
$templateRequest: ng.TemplateRequestService,
1111
$anchorScroll: import("../../services/anchor-scroll/anchor-scroll.js").AnchorScrollFunction,
12-
$animate: any,
12+
$animate: ng.AnimateService,
1313
$exceptionHandler: import("../../services/exception/interface.ts").ErrorHandler,
1414
): import("../../interface.ts").Directive;
1515
export namespace ngIncludeDirective {
Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
export function ngMessagesDirective($animate: any): {
2-
require: string;
3-
restrict: string;
4-
controller: ($element: any, $scope: any, $attrs: any) => NgMessageCtrl;
5-
};
1+
/**
2+
* @param {ng.AnimateService} $animate
3+
* @returns {ng.Directive}
4+
*/
5+
export function ngMessagesDirective($animate: ng.AnimateService): ng.Directive;
66
export namespace ngMessagesDirective {
77
let $inject: string[];
88
}
@@ -18,46 +18,6 @@ export namespace ngMessagesIncludeDirective {
1818
let $inject_1: string[];
1919
export { $inject_1 as $inject };
2020
}
21-
export const ngMessageDirective: (
22-
any: any,
23-
) => import("../../interface.ts").Directive;
24-
export const ngMessageExpDirective: (
25-
any: any,
26-
) => import("../../interface.ts").Directive;
27-
export const ngMessageDefaultDirective: (
28-
any: any,
29-
) => import("../../interface.ts").Directive;
30-
declare class NgMessageCtrl {
31-
/**
32-
* @param {Element} $element
33-
* @param {import('../../core/scope/scope.js').Scope} $scope
34-
* @param {import('../../core/compile/attributes').Attributes} $attrs
35-
* @param {*} $animate
36-
*/
37-
constructor(
38-
$element: Element,
39-
$scope: import("../../core/scope/scope.js").Scope,
40-
$attrs: any,
41-
$animate: any,
42-
);
43-
$element: Element;
44-
$scope: import("../../interface.ts").Scope;
45-
$attrs: any;
46-
$animate: any;
47-
latestKey: number;
48-
nextAttachId: number;
49-
messages: {};
50-
renderLater: boolean;
51-
cachedCollection: {};
52-
head: any;
53-
default: any;
54-
getAttachId(): number;
55-
render(collection?: {}): void;
56-
reRender(): void;
57-
register(comment: any, messageCtrl: any, isDefault: any): void;
58-
deregister(comment: any, isDefault: any): void;
59-
findPreviousMessage(parent: any, comment: any): any;
60-
insertMessageNode(parent: any, comment: any, key: any): void;
61-
removeMessageNode(parent: any, comment: any, key: any): void;
62-
}
63-
export {};
21+
export const ngMessageDirective: (any: any) => ng.Directive;
22+
export const ngMessageExpDirective: (any: any) => ng.Directive;
23+
export const ngMessageDefaultDirective: (any: any) => ng.Directive;

0 commit comments

Comments
 (0)