@angular-wave/angular.ts 0.11.0 → 0.12.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/@types/angular.d.ts +64 -51
- package/@types/animations/animate.d.ts +1 -351
- package/@types/animations/animation.d.ts +2 -2
- package/@types/animations/interface.d.ts +72 -0
- package/@types/animations/{animate-queue.d.ts → queue/animate-queue.d.ts} +2 -7
- package/@types/animations/queue/interface.d.ts +50 -0
- package/@types/core/compile/attributes.d.ts +5 -5
- package/@types/core/compile/compile.d.ts +4 -4
- package/@types/core/controller/controller.d.ts +1 -1
- package/@types/core/di/di.d.ts +26 -0
- package/@types/core/di/injector.d.ts +0 -11
- package/@types/core/di/internal-injector.d.ts +2 -2
- package/@types/core/di/ng-module/ng-module.d.ts +197 -0
- package/@types/core/sanitize/interface.d.ts +8 -0
- package/@types/core/sanitize/sanitize-uri.d.ts +5 -2
- package/@types/core/scope/interface.d.ts +2 -2
- package/@types/core/scope/scope.d.ts +5 -2
- package/@types/directive/form/form.d.ts +7 -7
- package/@types/directive/if/if.d.ts +2 -2
- package/@types/directive/include/include.d.ts +4 -4
- package/@types/directive/messages/messages.d.ts +18 -22
- package/@types/directive/model/model.d.ts +3 -3
- package/@types/directive/scope/scope.d.ts +4 -0
- package/@types/directive/show-hide/show-hide.d.ts +3 -4
- package/@types/directive/switch/switch.d.ts +3 -5
- package/@types/directive/wasm/wasm.d.ts +4 -0
- package/@types/{services → directive}/worker/interface.d.ts +1 -0
- package/@types/directive/worker/worker.d.ts +18 -8
- package/@types/interface.d.ts +14 -15
- package/@types/namespace.d.ts +25 -4
- package/@types/services/log/log.d.ts +2 -2
- package/@types/services/sce/sce.d.ts +4 -82
- package/@types/services/sse/sse.d.ts +1 -5
- package/@types/services/storage/interface.d.ts +5 -0
- package/@types/services/storage/storage.d.ts +19 -0
- package/@types/services/stream/interface.d.ts +18 -0
- package/@types/shared/dom.d.ts +21 -5
- package/@types/shared/strings.d.ts +0 -6
- package/@types/shared/utils.d.ts +24 -14
- package/dist/angular-ts.esm.js +1448 -1194
- package/dist/angular-ts.umd.js +1448 -1194
- package/dist/angular-ts.umd.min.js +1 -1
- package/package.json +1 -1
- package/@types/core/di/ng-module.d.ts +0 -156
- package/@types/services/worker/worker.d.ts +0 -31
package/@types/angular.d.ts
CHANGED
|
@@ -24,11 +24,63 @@ export class Angular {
|
|
|
24
24
|
getInjector: (Element: any) => ng.InjectorService;
|
|
25
25
|
/**
|
|
26
26
|
* Gets scope for a given element.
|
|
27
|
-
* @type {(Element) =>
|
|
27
|
+
* @type {(Element) => ng.Scope}
|
|
28
28
|
*/
|
|
29
|
-
getScope: (Element: any) =>
|
|
29
|
+
getScope: (Element: any) => ng.Scope;
|
|
30
30
|
errorHandlingConfig: typeof errorHandlingConfig;
|
|
31
31
|
$t: Readonly<Record<string, string>>;
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* The `angular.module` is a global place for creating, registering and retrieving AngularTS
|
|
35
|
+
* modules.
|
|
36
|
+
* All modules (AngularTS core or 3rd party) that should be available to an application must be
|
|
37
|
+
* registered using this mechanism.
|
|
38
|
+
*
|
|
39
|
+
* Passing one argument retrieves an existing {@link ng.NgModule},
|
|
40
|
+
* whereas passing more than one argument creates a new {@link ng.NgModule}
|
|
41
|
+
*
|
|
42
|
+
*
|
|
43
|
+
* # Module
|
|
44
|
+
*
|
|
45
|
+
* A module is a collection of services, directives, controllers, filters, workers, WebAssembly modules, and configuration information.
|
|
46
|
+
* `angular.module` is used to configure the {@link auto.$injector $injector}.
|
|
47
|
+
*
|
|
48
|
+
* ```js
|
|
49
|
+
* // Create a new module
|
|
50
|
+
* let myModule = angular.module('myModule', []);
|
|
51
|
+
*
|
|
52
|
+
* // register a new service
|
|
53
|
+
* myModule.value('appName', 'MyCoolApp');
|
|
54
|
+
*
|
|
55
|
+
* // configure existing services inside initialization blocks.
|
|
56
|
+
* myModule.config(['$locationProvider', function($locationProvider) {
|
|
57
|
+
* // Configure existing providers
|
|
58
|
+
* $locationProvider.hashPrefix('!');
|
|
59
|
+
* }]);
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* Then you can create an injector and load your modules like this:
|
|
63
|
+
*
|
|
64
|
+
* ```js
|
|
65
|
+
* let injector = angular.injector(['ng', 'myModule'])
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* However it's more likely that you'll just use
|
|
69
|
+
* `ng-app` directive or
|
|
70
|
+
* {@link bootstrap} to simplify this process for you.
|
|
71
|
+
*
|
|
72
|
+
* @param {string} name The name of the module to create or retrieve.
|
|
73
|
+
* @param {Array.<string>} [requires] If specified then new module is being created. If
|
|
74
|
+
* unspecified then the module is being retrieved for further configuration.
|
|
75
|
+
* @param {ng.Injectable<any>} [configFn] Optional configuration function for the module that gets
|
|
76
|
+
* passed to {@link NgModule.config NgModule.config()}.
|
|
77
|
+
* @returns {NgModule} A newly registered module.
|
|
78
|
+
*/
|
|
79
|
+
module(
|
|
80
|
+
name: string,
|
|
81
|
+
requires?: Array<string>,
|
|
82
|
+
configFn?: ng.Injectable<any>,
|
|
83
|
+
): NgModule;
|
|
32
84
|
/**
|
|
33
85
|
* Use this function to manually start up AngularTS application.
|
|
34
86
|
*
|
|
@@ -77,6 +129,7 @@ export class Angular {
|
|
|
77
129
|
modules?: Array<string | any>,
|
|
78
130
|
config?: import("./interface.ts").AngularBootstrapConfig,
|
|
79
131
|
): import("./core/di/internal-injector.js").InjectorService;
|
|
132
|
+
$rootScope: import("./interface.ts").Scope;
|
|
80
133
|
$injector: import("./interface.ts").InjectorService;
|
|
81
134
|
/**
|
|
82
135
|
* @param {any[]} modules
|
|
@@ -92,57 +145,17 @@ export class Angular {
|
|
|
92
145
|
*/
|
|
93
146
|
init(element: Element | Document): void;
|
|
94
147
|
/**
|
|
148
|
+
* Retrieves a scope by its registered name and returns its Proxy wrapper.
|
|
95
149
|
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* Passing one argument retrieves an existing {@link import('./interface.ts').Module},
|
|
102
|
-
* whereas passing more than one argument creates a new {@link import('./interface.ts').Module}
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* # Module
|
|
106
|
-
*
|
|
107
|
-
* A module is a collection of services, directives, controllers, filters, and configuration information.
|
|
108
|
-
* `angular.module` is used to configure the {@link auto.$injector $injector}.
|
|
109
|
-
*
|
|
110
|
-
* ```js
|
|
111
|
-
* // Create a new module
|
|
112
|
-
* let myModule = angular.module('myModule', []);
|
|
150
|
+
* Internally, this walks down the `Scope` tree starting from `$rootScope`
|
|
151
|
+
* and checks for a matching `$scopename` property. The `$scopename` property
|
|
152
|
+
* may be defined statically on controllers using `as` syntax, assigned via the `ngScope` directive,
|
|
153
|
+
* or defined on `$scope` injectable.
|
|
113
154
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* // configure existing services inside initialization blocks.
|
|
118
|
-
* myModule.config(['$locationProvider', function($locationProvider) {
|
|
119
|
-
* // Configure existing providers
|
|
120
|
-
* $locationProvider.hashPrefix('!');
|
|
121
|
-
* }]);
|
|
122
|
-
* ```
|
|
123
|
-
*
|
|
124
|
-
* Then you can create an injector and load your modules like this:
|
|
125
|
-
*
|
|
126
|
-
* ```js
|
|
127
|
-
* let injector = angular.injector(['ng', 'myModule'])
|
|
128
|
-
* ```
|
|
129
|
-
*
|
|
130
|
-
* However it's more likely that you'll just use
|
|
131
|
-
* {@link ng.directive:ngApp ngApp} or
|
|
132
|
-
* {@link angular.bootstrap} to simplify this process for you.
|
|
133
|
-
*
|
|
134
|
-
* @param {string} name The name of the module to create or retrieve.
|
|
135
|
-
* @param {Array.<string>} [requires] If specified then new module is being created. If
|
|
136
|
-
* unspecified then the module is being retrieved for further configuration.
|
|
137
|
-
* @param {import("./interface.ts").Injectable<any>} [configFn] Optional configuration function for the module that gets
|
|
138
|
-
* passed to {@link NgModule.config NgModule.config()}.
|
|
139
|
-
* @returns {NgModule} A newly registered module.
|
|
155
|
+
* @param {string} name
|
|
156
|
+
* @returns {ProxyHandler<ng.Scope>|undefined}
|
|
140
157
|
*/
|
|
141
|
-
|
|
142
|
-
name: string,
|
|
143
|
-
requires?: Array<string>,
|
|
144
|
-
configFn?: import("./interface.ts").Injectable<any>,
|
|
145
|
-
): NgModule;
|
|
158
|
+
getScopeByName(name: string): ProxyHandler<ng.Scope> | undefined;
|
|
146
159
|
}
|
|
147
160
|
import { errorHandlingConfig } from "./shared/utils.js";
|
|
148
|
-
import { NgModule } from "./core/di/ng-module.js";
|
|
161
|
+
import { NgModule } from "./core/di/ng-module/ng-module.js";
|
|
@@ -93,358 +93,8 @@ export class AnimateProvider {
|
|
|
93
93
|
* @return {RegExp} The current CSS className expression value. If null then there is no expression value
|
|
94
94
|
*/
|
|
95
95
|
classNameFilter: (expression?: RegExp | undefined, ...args: any[]) => RegExp;
|
|
96
|
-
$get:
|
|
97
|
-
| string
|
|
98
|
-
| (($$animateQueue: any) => {
|
|
99
|
-
/**
|
|
100
|
-
*
|
|
101
|
-
* Sets up an event listener to fire whenever the animation event (enter, leave, move, etc...)
|
|
102
|
-
* has fired on the given element or among any of its children. Once the listener is fired, the provided callback
|
|
103
|
-
* is fired with the following params:
|
|
104
|
-
*
|
|
105
|
-
* ```js
|
|
106
|
-
* $animate.on('enter', container,
|
|
107
|
-
* function callback(element, phase) {
|
|
108
|
-
* // cool we detected an enter animation within the container
|
|
109
|
-
* }
|
|
110
|
-
* );
|
|
111
|
-
* ```
|
|
112
|
-
*
|
|
113
|
-
* <div class="alert alert-warning">
|
|
114
|
-
* **Note**: Generally, the events that are fired correspond 1:1 to `$animate` method names,
|
|
115
|
-
* e.g. {@link ng.$animate#addClass addClass()} will fire `addClass`, and {@link ng.ngClass}
|
|
116
|
-
* will fire `addClass` if classes are added, and `removeClass` if classes are removed.
|
|
117
|
-
* However, there are two exceptions:
|
|
118
|
-
*
|
|
119
|
-
* <ul>
|
|
120
|
-
* <li>if both an {@link ng.$animate#addClass addClass()} and a
|
|
121
|
-
* {@link ng.$animate#removeClass removeClass()} action are performed during the same
|
|
122
|
-
* animation, the event fired will be `setClass`. This is true even for `ngClass`.</li>
|
|
123
|
-
* <li>an {@link ng.$animate#animate animate()} call that adds and removes classes will fire
|
|
124
|
-
* the `setClass` event, but if it either removes or adds classes,
|
|
125
|
-
* it will fire `animate` instead.</li>
|
|
126
|
-
* </ul>
|
|
127
|
-
*
|
|
128
|
-
* </div>
|
|
129
|
-
*
|
|
130
|
-
* @param {string} event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...)
|
|
131
|
-
* @param {Element} container the container element that will capture each of the animation events that are fired on itself
|
|
132
|
-
* as well as among its children
|
|
133
|
-
* @param {Function} callback the callback function that will be fired when the listener is triggered.
|
|
134
|
-
*
|
|
135
|
-
* The arguments present in the callback function are:
|
|
136
|
-
* * `element` - The captured DOM element that the animation was fired on.
|
|
137
|
-
* * `phase` - The phase of the animation. The two possible phases are **start** (when the animation starts) and **close** (when it ends).
|
|
138
|
-
* * `data` - an object with these properties:
|
|
139
|
-
* * addClass - `{string|null}` - space-separated CSS classes to add to the element
|
|
140
|
-
* * removeClass - `{string|null}` - space-separated CSS classes to remove from the element
|
|
141
|
-
* * from - `{Object|null}` - CSS properties & values at the beginning of the animation
|
|
142
|
-
* * to - `{Object|null}` - CSS properties & values at the end of the animation
|
|
143
|
-
*
|
|
144
|
-
* Note that the callback does not trigger a scope digest. Wrap your call into a
|
|
145
|
-
* {@link $rootScope.Scope#$apply scope.$apply} to propagate changes to the scope.
|
|
146
|
-
*/
|
|
147
|
-
on: any;
|
|
148
|
-
/**
|
|
149
|
-
* Deregisters an event listener based on the event which has been associated with the provided element. This method
|
|
150
|
-
* can be used in three different ways depending on the arguments:
|
|
151
|
-
*
|
|
152
|
-
* ```js
|
|
153
|
-
* // remove all the animation event listeners listening for `enter`
|
|
154
|
-
* $animate.off('enter');
|
|
155
|
-
*
|
|
156
|
-
* // remove listeners for all animation events from the container element
|
|
157
|
-
* $animate.off(container);
|
|
158
|
-
*
|
|
159
|
-
* // remove all the animation event listeners listening for `enter` on the given element and its children
|
|
160
|
-
* $animate.off('enter', container);
|
|
161
|
-
*
|
|
162
|
-
* // remove the event listener function provided by `callback` that is set
|
|
163
|
-
* // to listen for `enter` on the given `container` as well as its children
|
|
164
|
-
* $animate.off('enter', container, callback);
|
|
165
|
-
* ```
|
|
166
|
-
*
|
|
167
|
-
* @param {string|Element} event|container the animation event (e.g. enter, leave, move,
|
|
168
|
-
* addClass, removeClass, etc...), or the container element. If it is the element, all other
|
|
169
|
-
* arguments are ignored.
|
|
170
|
-
* @param {Element=} container the container element the event listener was placed on
|
|
171
|
-
* @param {Function=} callback the callback function that was registered as the listener
|
|
172
|
-
*/
|
|
173
|
-
off: any;
|
|
174
|
-
/**
|
|
175
|
-
* Associates the provided element with a host parent element to allow the element to be animated even if it exists
|
|
176
|
-
* outside of the DOM structure of the AngularTS application. By doing so, any animation triggered via `$animate` can be issued on the
|
|
177
|
-
* element despite being outside the realm of the application or within another application. Say for example if the application
|
|
178
|
-
* was bootstrapped on an element that is somewhere inside of the `<body>` tag, but we wanted to allow for an element to be situated
|
|
179
|
-
* as a direct child of `document.body`, then this can be achieved by pinning the element via `$animate.pin(element)`. Keep in mind
|
|
180
|
-
* that calling `$animate.pin(element, parentElement)` will not actually insert into the DOM anywhere; it will just create the association.
|
|
181
|
-
*
|
|
182
|
-
* Note that this feature is only active when the `ngAnimate` module is used.
|
|
183
|
-
*
|
|
184
|
-
* @param {Element} element the external element that will be pinned
|
|
185
|
-
* @param {Element} parentElement the host parent element that will be associated with the external element
|
|
186
|
-
*/
|
|
187
|
-
pin: any;
|
|
188
|
-
/**
|
|
189
|
-
* Used to get and set whether animations are enabled or not on the entire application or on an element and its children. This
|
|
190
|
-
* function can be called in four ways:
|
|
191
|
-
*
|
|
192
|
-
* ```js
|
|
193
|
-
* // returns true or false
|
|
194
|
-
* $animate.enabled();
|
|
195
|
-
*
|
|
196
|
-
* // changes the enabled state for all animations
|
|
197
|
-
* $animate.enabled(false);
|
|
198
|
-
* $animate.enabled(true);
|
|
199
|
-
*
|
|
200
|
-
* // returns true or false if animations are enabled for an element
|
|
201
|
-
* $animate.enabled(element);
|
|
202
|
-
*
|
|
203
|
-
* // changes the enabled state for an element and its children
|
|
204
|
-
* $animate.enabled(element, true);
|
|
205
|
-
* $animate.enabled(element, false);
|
|
206
|
-
* ```
|
|
207
|
-
*
|
|
208
|
-
* @param {Element=} element the element that will be considered for checking/setting the enabled state
|
|
209
|
-
* @param {boolean=} enabled whether or not the animations will be enabled for the element
|
|
210
|
-
*
|
|
211
|
-
* @return {boolean} whether or not animations are enabled
|
|
212
|
-
*/
|
|
213
|
-
enabled: any;
|
|
214
|
-
/**
|
|
215
|
-
* Cancels the provided animation and applies the end state of the animation.
|
|
216
|
-
* Note that this does not cancel the underlying operation, e.g. the setting of classes or
|
|
217
|
-
* adding the element to the DOM.
|
|
218
|
-
*
|
|
219
|
-
* @param {import('./runner/animate-runner.js').AnimateRunner} runner An animation runner returned by an $animate function.
|
|
220
|
-
*
|
|
221
|
-
* @example
|
|
222
|
-
<example module="animationExample" deps="angular-animate.js" animations="true" name="animate-cancel">
|
|
223
|
-
<file name="app.js">
|
|
224
|
-
angular.module('animationExample', []).component('cancelExample', {
|
|
225
|
-
templateUrl: 'template.html',
|
|
226
|
-
controller: function($element, $animate) {
|
|
227
|
-
this.runner = null;
|
|
228
|
-
|
|
229
|
-
this.addClass = function() {
|
|
230
|
-
this.runner = $animate.addClass($element.querySelectorAll('div'), 'red');
|
|
231
|
-
let ctrl = this;
|
|
232
|
-
this.runner.finally(function() {
|
|
233
|
-
ctrl.runner = null;
|
|
234
|
-
});
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
this.removeClass = function() {
|
|
238
|
-
this.runner = $animate.removeClass($element.querySelectorAll('div'), 'red');
|
|
239
|
-
let ctrl = this;
|
|
240
|
-
this.runner.finally(function() {
|
|
241
|
-
ctrl.runner = null;
|
|
242
|
-
});
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
this.cancel = function() {
|
|
246
|
-
$animate.cancel(this.runner);
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
</file>
|
|
251
|
-
<file name="template.html">
|
|
252
|
-
<p>
|
|
253
|
-
<button id="add" ng-click="$ctrl.addClass()">Add</button>
|
|
254
|
-
<button ng-click="$ctrl.removeClass()">Remove</button>
|
|
255
|
-
<br>
|
|
256
|
-
<button id="cancel" ng-click="$ctrl.cancel()" ng-disabled="!$ctrl.runner">Cancel</button>
|
|
257
|
-
<br>
|
|
258
|
-
<div id="target">CSS-Animated Text</div>
|
|
259
|
-
</p>
|
|
260
|
-
</file>
|
|
261
|
-
<file name="index.html">
|
|
262
|
-
<cancel-example></cancel-example>
|
|
263
|
-
</file>
|
|
264
|
-
<file name="style.css">
|
|
265
|
-
.red-add, .red-remove {
|
|
266
|
-
transition: all 4s cubic-bezier(0.250, 0.460, 0.450, 0.940);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
.red,
|
|
270
|
-
.red-add.red-add-active {
|
|
271
|
-
color: #FF0000;
|
|
272
|
-
font-size: 40px;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
.red-remove.red-remove-active {
|
|
276
|
-
font-size: 10px;
|
|
277
|
-
color: black;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
</file>
|
|
281
|
-
</example>
|
|
282
|
-
*/
|
|
283
|
-
cancel(
|
|
284
|
-
runner: import("./runner/animate-runner.js").AnimateRunner,
|
|
285
|
-
): void;
|
|
286
|
-
/**
|
|
287
|
-
* Inserts the element into the DOM either after the `after` element (if provided) or
|
|
288
|
-
* as the first child within the `parent` element and then triggers an animation.
|
|
289
|
-
* A promise is returned that will be resolved during the next digest once the animation
|
|
290
|
-
* has completed.
|
|
291
|
-
*
|
|
292
|
-
* @param {Element} element - the element which will be inserted into the DOM
|
|
293
|
-
* @param {Element} parent - the parent element which will append the element as a child (so long as the after element is not present)
|
|
294
|
-
* @param {Element} [after] - after the sibling element after which the element will be appended
|
|
295
|
-
* @param {AnimationOptions} [options] - an optional collection of options/styles that will be applied to the element.
|
|
296
|
-
* @returns {import('./runner/animate-runner.js').AnimateRunner} the animation runner
|
|
297
|
-
*/
|
|
298
|
-
enter(
|
|
299
|
-
element: Element,
|
|
300
|
-
parent: Element,
|
|
301
|
-
after?: Element,
|
|
302
|
-
options?: AnimationOptions,
|
|
303
|
-
): import("./runner/animate-runner.js").AnimateRunner;
|
|
304
|
-
/**
|
|
305
|
-
* Inserts (moves) the element into its new position in the DOM either after
|
|
306
|
-
* the `after` element (if provided) or as the first child within the `parent` element
|
|
307
|
-
* and then triggers an animation. A promise is returned that will be resolved
|
|
308
|
-
* during the next digest once the animation has completed.
|
|
309
|
-
*
|
|
310
|
-
* @param {Element} element - the element which will be inserted into the DOM
|
|
311
|
-
* @param {Element} parent - the parent element which will append the element as a child (so long as the after element is not present)
|
|
312
|
-
* @param {Element} after - after the sibling element after which the element will be appended
|
|
313
|
-
* @param {AnimationOptions} [options] - an optional collection of options/styles that will be applied to the element.
|
|
314
|
-
* @returns {import('./runner/animate-runner.js').AnimateRunner} the animation runner
|
|
315
|
-
*/
|
|
316
|
-
move(
|
|
317
|
-
element: Element,
|
|
318
|
-
parent: Element,
|
|
319
|
-
after: Element,
|
|
320
|
-
options?: AnimationOptions,
|
|
321
|
-
): import("./runner/animate-runner.js").AnimateRunner;
|
|
322
|
-
/**
|
|
323
|
-
* Triggers an animation and then removes the element from the DOM.
|
|
324
|
-
* When the function is called a promise is returned that will be resolved during the next
|
|
325
|
-
* digest once the animation has completed.
|
|
326
|
-
*
|
|
327
|
-
* @param {Element} element the element which will be removed from the DOM
|
|
328
|
-
* @param {AnimationOptions} [options] an optional collection of options/styles that will be applied to the element.
|
|
329
|
-
* @returns {import('./runner/animate-runner.js').AnimateRunner} the animation runner
|
|
330
|
-
*/
|
|
331
|
-
leave(
|
|
332
|
-
element: Element,
|
|
333
|
-
options?: AnimationOptions,
|
|
334
|
-
): import("./runner/animate-runner.js").AnimateRunner;
|
|
335
|
-
/**
|
|
336
|
-
* Triggers an addClass animation surrounding the addition of the provided CSS class(es). Upon
|
|
337
|
-
* execution, the addClass operation will only be handled after the next digest and it will not trigger an
|
|
338
|
-
* animation if element already contains the CSS class or if the class is removed at a later step.
|
|
339
|
-
* Note that class-based animations are treated differently compared to structural animations
|
|
340
|
-
* (like enter, move and leave) since the CSS classes may be added/removed at different points
|
|
341
|
-
* depending if CSS or JavaScript animations are used.
|
|
342
|
-
*
|
|
343
|
-
* @param {Element} element the element which the CSS classes will be applied to
|
|
344
|
-
* @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)
|
|
345
|
-
* @param {AnimationOptions} [options] an optional collection of options/styles that will be applied to the element.
|
|
346
|
-
* @return {import('./runner/animate-runner.js').AnimateRunner}} animationRunner the animation runner
|
|
347
|
-
*/
|
|
348
|
-
addClass(
|
|
349
|
-
element: Element,
|
|
350
|
-
className: string,
|
|
351
|
-
options?: AnimationOptions,
|
|
352
|
-
): import("./runner/animate-runner.js").AnimateRunner;
|
|
353
|
-
/**
|
|
354
|
-
* Triggers a removeClass animation surrounding the removal of the provided CSS class(es). Upon
|
|
355
|
-
* execution, the removeClass operation will only be handled after the next digest and it will not trigger an
|
|
356
|
-
* animation if element does not contain the CSS class or if the class is added at a later step.
|
|
357
|
-
* Note that class-based animations are treated differently compared to structural animations
|
|
358
|
-
* (like enter, move and leave) since the CSS classes may be added/removed at different points
|
|
359
|
-
* depending if CSS or JavaScript animations are used.
|
|
360
|
-
*
|
|
361
|
-
* @param {Element} element the element which the CSS classes will be applied to
|
|
362
|
-
* @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)
|
|
363
|
-
* @param {AnimationOptions} [options] an optional collection of options/styles that will be applied to the element. *
|
|
364
|
-
* @return {import('./runner/animate-runner.js').AnimateRunner} animationRunner the animation runner
|
|
365
|
-
*/
|
|
366
|
-
removeClass(
|
|
367
|
-
element: Element,
|
|
368
|
-
className: string,
|
|
369
|
-
options?: AnimationOptions,
|
|
370
|
-
): import("./runner/animate-runner.js").AnimateRunner;
|
|
371
|
-
/**
|
|
372
|
-
* Performs both the addition and removal of a CSS classes on an element and (during the process)
|
|
373
|
-
* triggers an animation surrounding the class addition/removal. Much like `$animate.addClass` and
|
|
374
|
-
* `$animate.removeClass`, `setClass` will only evaluate the classes being added/removed once a digest has
|
|
375
|
-
* passed. Note that class-based animations are treated differently compared to structural animations
|
|
376
|
-
* (like enter, move and leave) since the CSS classes may be added/removed at different points
|
|
377
|
-
* depending if CSS or JavaScript animations are used.
|
|
378
|
-
*
|
|
379
|
-
* @param {Element} element the element which the CSS classes will be applied to
|
|
380
|
-
* @param {string} add the CSS class(es) that will be added (multiple classes are separated via spaces)
|
|
381
|
-
* @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces)
|
|
382
|
-
* @param {object=} options an optional collection of options/styles that will be applied to the element.
|
|
383
|
-
*
|
|
384
|
-
* @return {import('./runner/animate-runner.js').AnimateRunner} the animation runner
|
|
385
|
-
*/
|
|
386
|
-
setClass(
|
|
387
|
-
element: Element,
|
|
388
|
-
add: string,
|
|
389
|
-
remove: string,
|
|
390
|
-
options?: object | undefined,
|
|
391
|
-
): import("./runner/animate-runner.js").AnimateRunner;
|
|
392
|
-
/**
|
|
393
|
-
* Performs an inline animation on the element which applies the provided to and from CSS styles to the element.
|
|
394
|
-
* If any detected CSS transition, keyframe or JavaScript matches the provided className value, then the animation will take
|
|
395
|
-
* on the provided styles. For example, if a transition animation is set for the given className, then the provided `from` and
|
|
396
|
-
* `to` styles will be applied alongside the given transition. If the CSS style provided in `from` does not have a corresponding
|
|
397
|
-
* style in `to`, the style in `from` is applied immediately, and no animation is run.
|
|
398
|
-
* If a JavaScript animation is detected then the provided styles will be given in as function parameters into the `animate`
|
|
399
|
-
* method (or as part of the `options` parameter):
|
|
400
|
-
*
|
|
401
|
-
* ```js
|
|
402
|
-
* ngModule.animation('.my-inline-animation', function() {
|
|
403
|
-
* return {
|
|
404
|
-
* animate : function(element, from, to, done, options) {
|
|
405
|
-
* //animation
|
|
406
|
-
* done();
|
|
407
|
-
* }
|
|
408
|
-
* }
|
|
409
|
-
* });
|
|
410
|
-
* ```
|
|
411
|
-
* @return {import('./runner/animate-runner.js').AnimateRunner} the animation runner
|
|
412
|
-
*/
|
|
413
|
-
animate(
|
|
414
|
-
element: any,
|
|
415
|
-
from: any,
|
|
416
|
-
to: any,
|
|
417
|
-
className: any,
|
|
418
|
-
options: any,
|
|
419
|
-
): import("./runner/animate-runner.js").AnimateRunner;
|
|
420
|
-
})
|
|
421
|
-
)[];
|
|
96
|
+
$get: any[];
|
|
422
97
|
}
|
|
423
98
|
export namespace AnimateProvider {
|
|
424
99
|
let $inject: string[];
|
|
425
100
|
}
|
|
426
|
-
export type AnimationMethod =
|
|
427
|
-
| "enter"
|
|
428
|
-
| "leave"
|
|
429
|
-
| "move"
|
|
430
|
-
| "addClass"
|
|
431
|
-
| "setClass"
|
|
432
|
-
| "removeClass";
|
|
433
|
-
export type AnimationOptions = {
|
|
434
|
-
/**
|
|
435
|
-
* - space-separated CSS classes to add to element
|
|
436
|
-
*/
|
|
437
|
-
addClass: string;
|
|
438
|
-
/**
|
|
439
|
-
* - CSS properties & values at the beginning of animation. Must have matching `to`
|
|
440
|
-
*/
|
|
441
|
-
from: any;
|
|
442
|
-
/**
|
|
443
|
-
* - space-separated CSS classes to remove from element
|
|
444
|
-
*/
|
|
445
|
-
removeClass: string;
|
|
446
|
-
/**
|
|
447
|
-
* - CSS properties & values at end of animation. Must have matching `from`
|
|
448
|
-
*/
|
|
449
|
-
to: string;
|
|
450
|
-
};
|
|
@@ -5,8 +5,8 @@ export class AnimationProvider {
|
|
|
5
5
|
| string
|
|
6
6
|
| ((
|
|
7
7
|
$rootScope: ng.RootScopeService,
|
|
8
|
-
$injector:
|
|
9
|
-
$$rAFScheduler:
|
|
8
|
+
$injector: ng.InjectorService,
|
|
9
|
+
$$rAFScheduler: import("./raf-scheduler.js").RafScheduler,
|
|
10
10
|
$$animateCache: any,
|
|
11
11
|
) => (element: any, event: any, options: any) => AnimateRunner)
|
|
12
12
|
)[];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { AnimateRunner } from "./runner/animate-runner.js";
|
|
2
|
+
import { QueuePhase } from "./queue/interface.ts";
|
|
1
3
|
export type RafScheduler = {
|
|
2
4
|
/**
|
|
3
5
|
* Schedules a list of functions to run on the next animation frame(s).
|
|
@@ -27,3 +29,73 @@ export interface AnimationHost {
|
|
|
27
29
|
/** Report animation progress. */
|
|
28
30
|
progress?: (...args: any[]) => void;
|
|
29
31
|
}
|
|
32
|
+
export interface AnimateService {
|
|
33
|
+
on(
|
|
34
|
+
event: string,
|
|
35
|
+
container: Element,
|
|
36
|
+
callback: (
|
|
37
|
+
element: Element,
|
|
38
|
+
phase: QueuePhase,
|
|
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
|
+
}
|
|
88
|
+
export type AnimationMethod =
|
|
89
|
+
| "enter"
|
|
90
|
+
| "leave"
|
|
91
|
+
| "move"
|
|
92
|
+
| "addClass"
|
|
93
|
+
| "setClass"
|
|
94
|
+
| "removeClass";
|
|
95
|
+
export interface AnimationOptions {
|
|
96
|
+
addClass?: string;
|
|
97
|
+
from?: Record<string, string | number>;
|
|
98
|
+
removeClass?: string;
|
|
99
|
+
to?: Record<string, string | number>;
|
|
100
|
+
tempClasses: string | string[];
|
|
101
|
+
}
|
|
@@ -12,13 +12,8 @@ export class AnimateQueueProvider {
|
|
|
12
12
|
$rootScope: ng.RootScopeService,
|
|
13
13
|
$injector: ng.InjectorService,
|
|
14
14
|
$$animation: any,
|
|
15
|
-
$templateRequest:
|
|
16
|
-
) =>
|
|
17
|
-
on(event: any, container: any, callback: any): void;
|
|
18
|
-
off(event: any, container: any, callback: any, ...args: any[]): void;
|
|
19
|
-
pin(element: any, parentElement: any): void;
|
|
20
|
-
push(element: any, event: any, options: any, domOperation: any): any;
|
|
21
|
-
})
|
|
15
|
+
$templateRequest: ng.TemplateRequestService,
|
|
16
|
+
) => import("../queue/interface.ts").AnimateQueueService)
|
|
22
17
|
)[];
|
|
23
18
|
}
|
|
24
19
|
export namespace AnimateQueueProvider {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { AnimateRunner } from "../runner/animate-runner.js";
|
|
2
|
+
export type QueuePhase =
|
|
3
|
+
| "start"
|
|
4
|
+
| "close"
|
|
5
|
+
| "cancel"
|
|
6
|
+
| "progress"
|
|
7
|
+
| "dom"
|
|
8
|
+
| string;
|
|
9
|
+
export interface QueueAnimationData {
|
|
10
|
+
addClass: string | null;
|
|
11
|
+
removeClass: string | null;
|
|
12
|
+
from: Record<string, any> | null;
|
|
13
|
+
to: Record<string, any> | null;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
export interface AnimateQueueService {
|
|
17
|
+
on(
|
|
18
|
+
event: string,
|
|
19
|
+
container: Element,
|
|
20
|
+
callback?: (
|
|
21
|
+
el: Element,
|
|
22
|
+
phase: QueuePhase,
|
|
23
|
+
data: QueueAnimationData,
|
|
24
|
+
) => void,
|
|
25
|
+
): void;
|
|
26
|
+
off(
|
|
27
|
+
event: string,
|
|
28
|
+
container?: Element,
|
|
29
|
+
callback?: (
|
|
30
|
+
el: Element,
|
|
31
|
+
phase: QueuePhase,
|
|
32
|
+
data: QueueAnimationData,
|
|
33
|
+
) => void,
|
|
34
|
+
): void;
|
|
35
|
+
pin(element: Element, parent: Element): void;
|
|
36
|
+
push(
|
|
37
|
+
element: Element,
|
|
38
|
+
event: string,
|
|
39
|
+
options: {
|
|
40
|
+
addClass?: string | null;
|
|
41
|
+
removeClass?: string | null;
|
|
42
|
+
from?: Record<string, any> | null;
|
|
43
|
+
to?: Record<string, any> | null;
|
|
44
|
+
tempClasses?: string | string[] | null;
|
|
45
|
+
domOperation?: () => void;
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
},
|
|
48
|
+
domOperation?: () => void,
|
|
49
|
+
): AnimateRunner;
|
|
50
|
+
}
|