@angular-wave/angular.ts 0.0.60 → 0.0.62

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 (128) hide show
  1. package/README.md +1 -1
  2. package/dist/angular-ts.esm.js +2 -2
  3. package/dist/angular-ts.umd.js +2 -2
  4. package/package.json +2 -1
  5. package/src/angular.spec.js +2 -2
  6. package/src/core/parser/parse.js +14 -0
  7. package/src/core/parser/parse.spec.js +7 -5
  8. package/src/core/parser/parser.js +1 -1
  9. package/src/core/q/q.js +46 -289
  10. package/src/core/q/q.md +229 -0
  11. package/src/core/sanitize/sanitize-uri.js +2 -3
  12. package/src/core/scope/scope.js +18 -8
  13. package/src/directive/if/if.js +6 -1
  14. package/src/filters/limit-to.js +5 -2
  15. package/src/filters/order-by.js +1 -2
  16. package/src/index.js +1 -1
  17. package/src/loader.js +1 -55
  18. package/src/router/params/param-type.js +2 -1
  19. package/src/router/state/views.js +3 -0
  20. package/src/router/state-provider.js +1 -1
  21. package/src/router/transition/reject-factory.js +1 -0
  22. package/src/router/url/url-rule.js +1 -1
  23. package/src/router/url/url-service.js +4 -4
  24. package/src/router/url/url-service.spec.js +4 -3
  25. package/src/services/http/http.js +7 -5
  26. package/src/services/template-request.js +2 -7
  27. package/src/shared/common.js +1 -1
  28. package/src/shared/utils.js +2 -11
  29. package/src/types.js +9 -1
  30. package/types/core/parser/parse.d.ts +3 -4
  31. package/types/core/parser/parser.d.ts +1 -1
  32. package/types/core/q/q.d.ts +2 -2
  33. package/types/core/sanitize/sanitize-uri.d.ts +4 -5
  34. package/types/core/scope/scope.d.ts +19 -7
  35. package/types/index.d.ts +5 -1
  36. package/types/loader.d.ts +0 -52
  37. package/types/router/params/param-type.d.ts +2 -1
  38. package/types/router/state/views.d.ts +2 -0
  39. package/types/router/state-provider.d.ts +1 -1
  40. package/types/router/transition/reject-factory.d.ts +1 -0
  41. package/types/router/url/url-rule.d.ts +0 -1
  42. package/types/router/url/url-service.d.ts +7 -7
  43. package/types/services/template-request.d.ts +4 -9
  44. package/types/shared/utils.d.ts +1 -7
  45. package/types/types.d.ts +6 -1
  46. package/types-back/README.md +0 -2
  47. package/types-back/angular.d.ts +0 -146
  48. package/types-back/index.d.ts +0 -2126
  49. package/types-back/jqlite.d.ts +0 -374
  50. package/types-back/router/core/common/common.d.ts +0 -416
  51. package/types-back/router/core/common/coreservices.d.ts +0 -77
  52. package/types-back/router/core/common/glob.d.ts +0 -60
  53. package/types-back/router/core/common/hof.d.ts +0 -168
  54. package/types-back/router/core/common/index.d.ts +0 -8
  55. package/types-back/router/core/common/predicates.d.ts +0 -25
  56. package/types-back/router/core/common/queue.d.ts +0 -15
  57. package/types-back/router/core/common/safeConsole.d.ts +0 -5
  58. package/types-back/router/core/common/strings.d.ts +0 -66
  59. package/types-back/router/core/common/trace.d.ts +0 -126
  60. package/types-back/router/core/globals.d.ts +0 -43
  61. package/types-back/router/core/hooks/coreResolvables.d.ts +0 -6
  62. package/types-back/router/core/hooks/ignoredTransition.d.ts +0 -4
  63. package/types-back/router/core/hooks/invalidTransition.d.ts +0 -4
  64. package/types-back/router/core/hooks/lazyLoad.d.ts +0 -17
  65. package/types-back/router/core/hooks/onEnterExitRetain.d.ts +0 -10
  66. package/types-back/router/core/hooks/redirectTo.d.ts +0 -4
  67. package/types-back/router/core/hooks/resolve.d.ts +0 -11
  68. package/types-back/router/core/hooks/updateGlobals.d.ts +0 -4
  69. package/types-back/router/core/hooks/url.d.ts +0 -4
  70. package/types-back/router/core/hooks/views.d.ts +0 -7
  71. package/types-back/router/core/index.d.ts +0 -11
  72. package/types-back/router/core/interface.d.ts +0 -91
  73. package/types-back/router/core/params/index.d.ts +0 -12
  74. package/types-back/router/core/params/interface.d.ts +0 -606
  75. package/types-back/router/core/params/param.d.ts +0 -77
  76. package/types-back/router/core/params/paramType.d.ts +0 -65
  77. package/types-back/router/core/params/paramTypes.d.ts +0 -193
  78. package/types-back/router/core/params/stateParams.d.ts +0 -15
  79. package/types-back/router/core/path/index.d.ts +0 -2
  80. package/types-back/router/core/path/pathNode.d.ts +0 -60
  81. package/types-back/router/core/path/pathUtils.d.ts +0 -105
  82. package/types-back/router/core/resolve/index.d.ts +0 -3
  83. package/types-back/router/core/resolve/interface.d.ts +0 -210
  84. package/types-back/router/core/resolve/resolvable.d.ts +0 -75
  85. package/types-back/router/core/resolve/resolveContext.d.ts +0 -97
  86. package/types-back/router/core/router.d.ts +0 -57
  87. package/types-back/router/core/state/index.d.ts +0 -28
  88. package/types-back/router/core/state/interface.d.ts +0 -732
  89. package/types-back/router/core/state/stateBuilder.d.ts +0 -107
  90. package/types-back/router/core/state/stateMatcher.d.ts +0 -13
  91. package/types-back/router/core/state/stateObject.d.ts +0 -170
  92. package/types-back/router/core/state/stateQueueManager.d.ts +0 -27
  93. package/types-back/router/core/state/stateRegistry.d.ts +0 -138
  94. package/types-back/router/core/state/stateService.d.ts +0 -386
  95. package/types-back/router/core/state/targetState.d.ts +0 -105
  96. package/types-back/router/core/transition/hookBuilder.d.ts +0 -49
  97. package/types-back/router/core/transition/hookRegistry.d.ts +0 -115
  98. package/types-back/router/core/transition/index.d.ts +0 -20
  99. package/types-back/router/core/transition/interface.d.ts +0 -862
  100. package/types-back/router/core/transition/rejectFactory.d.ts +0 -103
  101. package/types-back/router/core/transition/transition.d.ts +0 -575
  102. package/types-back/router/core/transition/transitionEventType.d.ts +0 -26
  103. package/types-back/router/core/transition/transitionHook.d.ts +0 -96
  104. package/types-back/router/core/transition/transitionService.d.ts +0 -253
  105. package/types-back/router/core/url/index.d.ts +0 -8
  106. package/types-back/router/core/url/interface.d.ts +0 -169
  107. package/types-back/router/core/url/urlConfig.d.ts +0 -144
  108. package/types-back/router/core/url/urlMatcher.d.ts +0 -185
  109. package/types-back/router/core/url/urlMatcherFactory.d.ts +0 -56
  110. package/types-back/router/core/url/urlRouter.d.ts +0 -101
  111. package/types-back/router/core/url/urlRule.d.ts +0 -143
  112. package/types-back/router/core/url/urlRules.d.ts +0 -251
  113. package/types-back/router/core/url/urlService.d.ts +0 -205
  114. package/types-back/router/core/view/index.d.ts +0 -2
  115. package/types-back/router/core/view/interface.d.ts +0 -46
  116. package/types-back/router/core/view/view.d.ts +0 -176
  117. package/types-back/router/directives/viewDirective.d.ts +0 -144
  118. package/types-back/router/index.d.ts +0 -17
  119. package/types-back/router/interface.d.ts +0 -500
  120. package/types-back/router/legacy/resolveService.d.ts +0 -47
  121. package/types-back/router/legacy/stateEvents.d.ts +0 -124
  122. package/types-back/router/services.d.ts +0 -15
  123. package/types-back/router/stateFilters.d.ts +0 -10
  124. package/types-back/router/stateProvider.d.ts +0 -258
  125. package/types-back/router/statebuilders/onEnterExitRetain.d.ts +0 -13
  126. package/types-back/router/statebuilders/views.d.ts +0 -53
  127. package/types-back/router/templateFactory.d.ts +0 -104
  128. package/types-back/router/viewScroll.d.ts +0 -9
@@ -0,0 +1,229 @@
1
+ /\*\*
2
+
3
+ - A service that helps you run functions asynchronously, and use their return values (or exceptions)
4
+ - when they are done processing.
5
+ -
6
+ - This is a [Promises/A+](https://promisesaplus.com/)-compliant implementation of promises/deferred
7
+ - objects inspired by [Kris Kowal's Q](https://github.com/kriskowal/q).
8
+ -
9
+ - $q can be used in two fashions --- one which is more similar to Kris Kowal's Q or jQuery's Deferred
10
+ - implementations, and the other which resembles ES6 (ES2015) promises to some degree.
11
+ -
12
+ - ## $q constructor
13
+ -
14
+ - The streamlined ES6 style promise is essentially just using $q as a constructor which takes a `resolver`
15
+ - function as the first argument. This is similar to the native Promise implementation from ES6,
16
+ - see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
17
+ -
18
+ - While the constructor-style use is supported, not all of the supporting methods from ES6 promises are
19
+ - available yet.
20
+ -
21
+ - It can be used like so:
22
+ -
23
+ - ```js
24
+
25
+ ```
26
+
27
+ - // for the purpose of this example let's assume that variables `$q` and `okToGreet`
28
+ - // are available in the current lexical scope (they could have been injected or passed in).
29
+ -
30
+ - function asyncGreet(name) {
31
+ - // perform some asynchronous operation, resolve or reject the promise when appropriate.
32
+ - return $q(function(resolve, reject) {
33
+ - setTimeout(function() {
34
+ - if (okToGreet(name)) {
35
+ - resolve('Hello, ' + name + '!');
36
+ - } else {
37
+ - reject('Greeting ' + name + ' is not allowed.');
38
+ - }
39
+ - }, 1000);
40
+ - });
41
+ - }
42
+ -
43
+ - let promise = asyncGreet('Robin Hood');
44
+ - promise.then(function(greeting) {
45
+ - alert('Success: ' + greeting);
46
+ - }, function(reason) {
47
+ - alert('Failed: ' + reason);
48
+ - });
49
+ - ```
50
+
51
+ ```
52
+
53
+ -
54
+ - Note: progress/notify callbacks are not currently supported via the ES6-style interface.
55
+ -
56
+ - Note: unlike ES6 behavior, an exception thrown in the constructor function will NOT implicitly reject the promise.
57
+ -
58
+ - However, the more traditional CommonJS-style usage is still available, and documented below.
59
+ -
60
+ - [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an
61
+ - interface for interacting with an object that represents the result of an action that is
62
+ - performed asynchronously, and may or may not be finished at any given point in time.
63
+ -
64
+ - From the perspective of dealing with error handling, deferred and promise APIs are to
65
+ - asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.
66
+ -
67
+ - ```js
68
+
69
+ ```
70
+
71
+ - // for the purpose of this example let's assume that variables `$q` and `okToGreet`
72
+ - // are available in the current lexical scope (they could have been injected or passed in).
73
+ -
74
+ - function asyncGreet(name) {
75
+ - let deferred = $q.defer();
76
+ -
77
+ - setTimeout(function() {
78
+ - deferred.notify('About to greet ' + name + '.');
79
+ -
80
+ - if (okToGreet(name)) {
81
+ - deferred.resolve('Hello, ' + name + '!');
82
+ - } else {
83
+ - deferred.reject('Greeting ' + name + ' is not allowed.');
84
+ - }
85
+ - }, 1000);
86
+ -
87
+ - return deferred.promise;
88
+ - }
89
+ -
90
+ - let promise = asyncGreet('Robin Hood');
91
+ - promise.then(function(greeting) {
92
+ - alert('Success: ' + greeting);
93
+ - }, function(reason) {
94
+ - alert('Failed: ' + reason);
95
+ - }, function(update) {
96
+ - alert('Got notification: ' + update);
97
+ - });
98
+ - ```
99
+
100
+ ```
101
+
102
+ -
103
+ - At first it might not be obvious why this extra complexity is worth the trouble. The payoff
104
+ - comes in the way of guarantees that promise and deferred APIs make, see
105
+ - https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md.
106
+ -
107
+ - Additionally the promise api allows for composition that is very hard to do with the
108
+ - traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.
109
+ - For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the
110
+ - section on serial or parallel joining of promises.
111
+ -
112
+ - ## The Deferred API
113
+ -
114
+ - A new instance of deferred is constructed by calling `$q.defer()`.
115
+ -
116
+ - The purpose of the deferred object is to expose the associated Promise instance as well as APIs
117
+ - that can be used for signaling the successful or unsuccessful completion, as well as the status
118
+ - of the task.
119
+ -
120
+ - **Methods**
121
+ -
122
+ - - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection
123
+ - constructed via `$q.reject`, the promise will be rejected instead.
124
+ - - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to
125
+ - resolving it with a rejection constructed via `$q.reject`.
126
+ - - `notify(value)` - provides updates on the status of the promise's execution. This may be called
127
+ - multiple times before the promise is either resolved or rejected.
128
+ -
129
+ - **Properties**
130
+ -
131
+ - - promise – `{Promise}` – promise object associated with this deferred.
132
+ -
133
+ -
134
+ - ## The Promise API
135
+ -
136
+ - A new promise instance is created when a deferred instance is created and can be retrieved by
137
+ - calling `deferred.promise`.
138
+ -
139
+ - The purpose of the promise object is to allow for interested parties to get access to the result
140
+ - of the deferred task when it completes.
141
+ -
142
+ - **Methods**
143
+ -
144
+ - - `then(successCallback, [errorCallback], [notifyCallback])` – regardless of when the promise was or
145
+ - will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously
146
+ - as soon as the result is available. The callbacks are called with a single argument: the result
147
+ - or rejection reason. Additionally, the notify callback may be called zero or more times to
148
+ - provide a progress indication, before the promise is resolved or rejected.
149
+ -
150
+ - This method _returns a new promise_ which is resolved or rejected via the return value of the
151
+ - `successCallback`, `errorCallback` (unless that value is a promise, in which case it is resolved
152
+ - with the value which is resolved in that promise using
153
+ - [promise chaining](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promises-queues)).
154
+ - It also notifies via the return value of the `notifyCallback` method. The promise cannot be
155
+ - resolved or rejected from the notifyCallback method. The errorCallback and notifyCallback
156
+ - arguments are optional.
157
+ -
158
+ - - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)`
159
+ -
160
+ - - `finally(callback, notifyCallback)` – allows you to observe either the fulfillment or rejection of a promise,
161
+ - but to do so without modifying the final value. This is useful to release resources or do some
162
+ - clean-up that needs to be done whether the promise was rejected or resolved. See the [full
163
+ - specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for
164
+ - more information.
165
+ -
166
+ - ## Chaining promises
167
+ -
168
+ - Because calling the `then` method of a promise returns a new derived promise, it is easily
169
+ - possible to create a chain of promises:
170
+ -
171
+ - ```js
172
+
173
+ ```
174
+
175
+ - promiseB = promiseA.then(function(result) {
176
+ - return result + 1;
177
+ - });
178
+ -
179
+ - // promiseB will be resolved immediately after promiseA is resolved and its value
180
+ - // will be the result of promiseA incremented by 1
181
+ - ```
182
+
183
+ ```
184
+
185
+ -
186
+ - It is possible to create chains of any length and since a promise can be resolved with another
187
+ - promise (which will defer its resolution further), it is possible to pause/defer resolution of
188
+ - the promises at any point in the chain. This makes it possible to implement powerful APIs like
189
+ - $http's response interceptors.
190
+ -
191
+ -
192
+ - ## Differences between Kris Kowal's Q and $q
193
+ -
194
+ - There are two main differences:
195
+ -
196
+ - - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation
197
+ - mechanism in AngularJS, which means faster propagation of resolution or rejection into your
198
+ - models and avoiding unnecessary browser repaints, which would result in flickering UI.
199
+ - - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains
200
+ - all the important functionality needed for common async tasks.
201
+ -
202
+ - ## Testing
203
+ -
204
+ - ```js
205
+
206
+ ```
207
+
208
+ - it('should simulate promise', inject(function($q, $rootScope) {
209
+ - let deferred = $q.defer();
210
+ - let promise = deferred.promise;
211
+ - let resolvedValue;
212
+ -
213
+ - promise.then(function(value) { resolvedValue = value; });
214
+ - expect(resolvedValue).toBeUndefined();
215
+ -
216
+ - // Simulate resolving of promise
217
+ - deferred.resolve(123);
218
+ - // Note that the 'then' function does not get called synchronously.
219
+ - // This is because we want the promise API to always be async, whether or not
220
+ - // it got called synchronously or asynchronously.
221
+ - expect(resolvedValue).toBeUndefined();
222
+ -
223
+ - // Propagate promise resolution to 'then' functions using $apply().
224
+ - $rootScope.$apply();
225
+ - expect(resolvedValue).toEqual(123);
226
+ - }));
227
+ - ```
228
+ */
229
+ ```
@@ -28,7 +28,7 @@ export function SanitizeUriProvider() {
28
28
  * to the DOM it is inactive and potentially malicious code will not be executed.
29
29
  *
30
30
  * @param {RegExp=} regexp New regexp to trust urls with.
31
- * @returns {RegExp|ng.ICompileProvider} Current RegExp if called without value or self for
31
+ * @returns {RegExp|SanitizeUriProvider} Current RegExp if called without value or self for
32
32
  * chaining otherwise.
33
33
  */
34
34
  this.aHrefSanitizationTrustedUrlList = function (regexp) {
@@ -58,8 +58,7 @@ export function SanitizeUriProvider() {
58
58
  * to the DOM it is inactive and potentially malicious code will not be executed.
59
59
  *
60
60
  * @param {RegExp=} regexp New regexp to trust urls with.
61
- * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
62
- * chaining otherwise.
61
+ * @returns {RegExp|SanitizeUriProvider} Current RegExp if called without value or self for chaining otherwise.
63
62
  */
64
63
  this.imgSrcSanitizationTrustedUrlList = function (regexp) {
65
64
  if (isDefined(regexp)) {
@@ -28,6 +28,20 @@ export const ScopePhase = {
28
28
  * @property {Object} locals
29
29
  */
30
30
 
31
+ /**
32
+ * @typedef {function(any, any, Scope): any} WatchListener
33
+ * Callback function triggered whenever the value of `watchExpression` changes.
34
+ *
35
+ * @param {any} newVal - The current value of the `watchExpression`.
36
+ * @param {any} oldVal - The previous value of the `watchExpression`.
37
+ * @param {Scope} scope - The current scope in which the `watchExpression` is evaluated.
38
+ *
39
+ */
40
+
41
+ /**
42
+ * @typedef {string | ((scope: Scope) => any)} WatchExpression
43
+ */
44
+
31
45
  /**
32
46
  *
33
47
  * The default number of `$digest` iterations the scope should attempt to execute before giving up and
@@ -378,12 +392,7 @@ export class Scope {
378
392
  *
379
393
  * - `string`: Evaluated as {@link guide/expression expression}
380
394
  * - `function(scope)`: called with current `scope` as a parameter.
381
- * @param {(newVal: any, oldVal: any, scope: Scope) => any} listener Callback called whenever the value
382
- * of `watchExpression` changes.
383
- *
384
- * - `newVal` contains the current value of the `watchExpression`
385
- * - `oldVal` contains the previous value of the `watchExpression`
386
- * - `scope` refers to the current scope
395
+ * @param {WatchListener} listener
387
396
  * @param {boolean=} [objectEquality=false] Compare for object equality using {@link angular.equals} instead of
388
397
  * comparing for reference equality.
389
398
  * @returns {function()} Returns a deregistration function for this listener.
@@ -687,7 +696,7 @@ export class Scope {
687
696
  }
688
697
  }
689
698
  }
690
-
699
+ // TODO: fix this type signature
691
700
  return this.$watch(changeDetector, $watchCollectionAction);
692
701
  }
693
702
 
@@ -1282,7 +1291,8 @@ export class Scope {
1282
1291
  if (expr) {
1283
1292
  $$applyAsyncQueue.push(() => scope.$eval(expr));
1284
1293
  }
1285
- expr = $parse(expr);
1294
+ // TODO: investigate
1295
+ //expr = $parse(expr);
1286
1296
 
1287
1297
  if (applyAsyncId === null) {
1288
1298
  applyAsyncId = $browser.defer(flushApplyAsync, null, "$applyAsync");
@@ -17,7 +17,12 @@ export function ngIfDirective($animate) {
17
17
  terminal: true,
18
18
  restrict: "A",
19
19
  /**
20
- * TODO add type for $transclude service
20
+ *
21
+ * @param {*} $scope
22
+ * @param {*} $element
23
+ * @param {*} $attr
24
+ * @param {*} _ctrl
25
+ * @param {*} $transclude
21
26
  */
22
27
  link($scope, $element, $attr, _ctrl, $transclude) {
23
28
  /** @type {{clone: import("../../shared/jqlite/jqlite").JQLite }} */
@@ -19,14 +19,17 @@ export function limitToFilter() {
19
19
  if (Math.abs(Number(limit)) === Infinity) {
20
20
  limit = Number(limit);
21
21
  } else {
22
- limit = toInt(limit);
22
+ limit = toInt(/** @type {String} */ (limit));
23
23
  }
24
24
  if (isNumberNaN(limit)) return input;
25
25
 
26
26
  if (isNumber(input)) input = input.toString();
27
27
  if (!isArrayLike(input)) return input;
28
28
 
29
- begin = !begin || isNaN(/** @type {any} */ (begin)) ? 0 : toInt(begin);
29
+ begin =
30
+ !begin || isNaN(/** @type {any} */ (begin))
31
+ ? 0
32
+ : toInt(/** @type {String} */ (begin));
30
33
  begin =
31
34
  begin < 0 ? Math.max(0, /** @type {[]} */ (input).length + begin) : begin;
32
35
 
@@ -5,7 +5,6 @@ import {
5
5
  isArrayLike,
6
6
  isString,
7
7
  minErr,
8
- identity,
9
8
  } from "../shared/utils";
10
9
 
11
10
  orderByFilter.$inject = ["$parse"];
@@ -75,7 +74,7 @@ export function orderByFilter($parse) {
75
74
  function processPredicates(sortPredicates) {
76
75
  return sortPredicates.map((predicate) => {
77
76
  let descending = 1;
78
- let get = identity;
77
+ let get = (x) => x;
79
78
 
80
79
  if (isFunction(predicate)) {
81
80
  get = predicate;
package/src/index.js CHANGED
@@ -4,7 +4,7 @@ import { publishExternalAPI } from "./public";
4
4
  /**
5
5
  * @type {Angular}
6
6
  */
7
- const angular = new Angular();
7
+ export const angular = new Angular();
8
8
  window["angular"] = angular;
9
9
 
10
10
  publishExternalAPI();
package/src/loader.js CHANGED
@@ -16,7 +16,6 @@ import {
16
16
  bind,
17
17
  fromJson,
18
18
  toJson,
19
- identity,
20
19
  equals,
21
20
  assertNotHasOwnProperty,
22
21
  isBoolean,
@@ -58,58 +57,9 @@ export class Angular {
58
57
  /** @type {string} */
59
58
  this.version = VERSION;
60
59
 
61
- // Utility methods kept for backwards purposes
62
- /** @type {bind} */
63
- this.bind = bind;
64
-
65
- /** @type {equals} */
66
- this.equals = equals;
67
-
68
60
  /** @type {typeof import('./shared/jqlite/jqlite').JQLite} */
69
61
  this.element = JQLite;
70
62
 
71
- /** @type {extend} */
72
- this.extend = extend;
73
-
74
- /** @type {forEach} */
75
- this.forEach = forEach;
76
-
77
- /** @type {fromJson} */
78
- this.fromJson = fromJson;
79
-
80
- /** @type {toJson} */
81
- this.toJson = toJson;
82
-
83
- /** @type {identity} */
84
- this.identity = identity;
85
-
86
- /** @type {isDate} */
87
- this.isDate = isDate;
88
-
89
- /** @type {isDefined} */
90
- this.isDefined = isDefined;
91
-
92
- /** @type {isElement} */
93
- this.isElement = isElement;
94
-
95
- /** @type {isFunction} */
96
- this.isFunction = isFunction;
97
-
98
- /** @type {isNumber} */
99
- this.isNumber = isNumber;
100
-
101
- /** @type {isObject} */
102
- this.isObject = isObject;
103
-
104
- /** @type {isString} */
105
- this.isString = isString;
106
-
107
- /** @type {isUndefined} */
108
- this.isUndefined = isUndefined;
109
-
110
- /** @type {merge} */
111
- this.merge = merge;
112
-
113
63
  /** @type {errorHandlingConfig} */
114
64
  this.errorHandlingConfig = errorHandlingConfig;
115
65
 
@@ -275,10 +225,6 @@ export class Angular {
275
225
  }
276
226
 
277
227
  /**
278
- * @ngdoc function
279
- * @name angular.module
280
- * @module ng
281
- * @description
282
228
  *
283
229
  * The `angular.module` is a global place for creating, registering and retrieving AngularJS
284
230
  * modules.
@@ -414,7 +360,7 @@ export class Angular {
414
360
 
415
361
  /**
416
362
  * @ngdoc property
417
- * @name import('./types').Module#requires
363
+ * @type import('./types').Module#requires
418
364
  * @module ng
419
365
  *
420
366
  * @description
@@ -35,10 +35,11 @@ export class ParamType {
35
35
  /** @inheritdoc */
36
36
  this.inherit = true;
37
37
  Object.assign(this, def);
38
+ this.name = undefined;
38
39
  }
39
40
  // consider these four methods to be "abstract methods" that should be overridden
40
41
  /** @inheritdoc */
41
- is() {
42
+ is(_val) {
42
43
  return true;
43
44
  }
44
45
  /** @inheritdoc */
@@ -97,6 +97,8 @@ export class Ng1ViewConfig {
97
97
  this.path = path;
98
98
  this.viewDecl = viewDecl;
99
99
  this.factory = factory;
100
+ this.component = undefined;
101
+ this.template = undefined;
100
102
 
101
103
  /** @type {Number} */ this.$id = id++;
102
104
  this.loaded = false;
@@ -110,6 +112,7 @@ export class Ng1ViewConfig {
110
112
  )
111
113
  : this.template;
112
114
  }
115
+
113
116
  load() {
114
117
  const $q = services.$q;
115
118
  const context = new ResolveContext(this.path);
@@ -117,7 +117,7 @@ export class StateProvider {
117
117
  * let result = {},
118
118
  * views = parent(state);
119
119
  *
120
- * angular.forEach(views, function (config, name) {
120
+ * forEach(views, function (config, name) {
121
121
  * let autoName = (state.name + '.' + name).replace('.', '/');
122
122
  * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';
123
123
  * result[name] = config;
@@ -105,6 +105,7 @@ export class Rejection {
105
105
  this.type = type;
106
106
  this.message = message;
107
107
  this.detail = detail;
108
+ this.redirected = false;
108
109
  }
109
110
  toString() {
110
111
  const detailString = (d) =>
@@ -192,11 +192,11 @@ export class UrlRuleFactory {
192
192
  }
193
193
  UrlRuleFactory.isUrlRule = (obj) =>
194
194
  obj && ["type", "match", "handler"].every((key) => isDefined(obj[key]));
195
+
195
196
  /**
196
197
  * A base rule which calls `match`
197
198
  *
198
199
  * The value from the `match` function is passed through to the `handler`.
199
- * @type {angular.BaseUrlRule}
200
200
  */
201
201
  export class BaseUrlRule {
202
202
  constructor(match, handler) {
@@ -26,7 +26,7 @@ export class UrlService {
26
26
  ];
27
27
 
28
28
  /**
29
- * @param {angular.ILocationProvider} $locationProvider
29
+ * @param {import("../../core/location/location").$LocationProvider} $locationProvider
30
30
  */
31
31
  constructor($locationProvider, stateService, globals, urlConfigProvider) {
32
32
  this.stateService = stateService;
@@ -53,7 +53,7 @@ export class UrlService {
53
53
  * The nested [[UrlConfig]] API to configure the URL and retrieve URL information
54
54
  *
55
55
  * See: [[UrlConfig]] for details
56
- * @type {angular.UrlConfig}
56
+ * @type {import("./url-config").UrlConfigProvider}
57
57
  */
58
58
  this.config = urlConfigProvider;
59
59
 
@@ -231,7 +231,7 @@ export class UrlService {
231
231
  hash: this.hash(),
232
232
  };
233
233
  /**
234
- * @type {angular.MatchResult}
234
+ * @type {MatchResult}
235
235
  */
236
236
  const best = this.match(url);
237
237
  const applyResult = pattern([
@@ -313,7 +313,7 @@ export class UrlService {
313
313
  *
314
314
  * Given a URL (as a [[UrlParts]] object), check all rules and determine the best matching rule.
315
315
  * Return the result as a [[MatchResult]].
316
- * @returns {angular.MatchResult}
316
+ * @returns {any}
317
317
  */
318
318
  match(url) {
319
319
  url = Object.assign({ path: "", search: {}, hash: "" }, url);
@@ -2,6 +2,7 @@ import { dealoc } from "../../shared/jqlite/jqlite";
2
2
  import { Angular } from "../../loader";
3
3
  import { publishExternalAPI } from "../../public";
4
4
  import { map, find } from "../../shared/common";
5
+ import { forEach } from "../../shared/utils";
5
6
 
6
7
  describe("UrlMatcher", () => {
7
8
  let $url;
@@ -245,7 +246,7 @@ describe("UrlMatcher", () => {
245
246
  "/url/someword/child/childParam",
246
247
  };
247
248
 
248
- angular.forEach(shouldPass, function (url, route) {
249
+ forEach(shouldPass, function (url, route) {
249
250
  expect($url.compile(route).exec(url, {})).toEqual({
250
251
  childParam: "childParam",
251
252
  matchedParam: "someword",
@@ -261,7 +262,7 @@ describe("UrlMatcher", () => {
261
262
  "/url/someword/child/childParam",
262
263
  };
263
264
 
264
- angular.forEach(shouldThrow, function (url, route) {
265
+ forEach(shouldThrow, function (url, route) {
265
266
  expect(() => {
266
267
  $url.compile(route).exec(url, {});
267
268
  }).toThrowError("Unbalanced capture group in route '" + route + "'");
@@ -274,7 +275,7 @@ describe("UrlMatcher", () => {
274
275
  "/url/someword/child/childParam",
275
276
  };
276
277
 
277
- angular.forEach(shouldPass, function (url, route) {
278
+ forEach(shouldPass, function (url, route) {
278
279
  expect(() => {
279
280
  $url.compile(route).exec(url, {});
280
281
  }).not.toThrow();
@@ -275,9 +275,9 @@ function headersGetter(headers) {
275
275
  * This function is used for both request and response transforming
276
276
  *
277
277
  * @param {*} data Data to transform.
278
- * @param {function(string=)} headers HTTP headers getter fn.
278
+ * @param {function(string=):any} headers HTTP headers getter fn.
279
279
  * @param {number} status HTTP status code of the response.
280
- * @param {Function|Array<Function>} fns Function or an array of functions.
280
+ * @param {function(...any): any | Array<Function>} fns Function or an array of functions.
281
281
  * @returns {*} Transformed data.
282
282
  */
283
283
  function transformData(data, headers, status, fns) {
@@ -285,9 +285,11 @@ function transformData(data, headers, status, fns) {
285
285
  return fns(data, headers, status);
286
286
  }
287
287
 
288
- forEach(fns, (fn) => {
289
- data = fn(data, headers, status);
290
- });
288
+ if (Array.isArray(fns)) {
289
+ /** @type {Array<function(...any): any>} */ (fns).forEach((fn) => {
290
+ data = fn(data, headers, status);
291
+ });
292
+ }
291
293
 
292
294
  return data;
293
295
  }
@@ -4,11 +4,6 @@ import { extend, isString, isUndefined, minErr } from "../shared/utils";
4
4
  var $templateRequestMinErr = minErr("$templateRequest");
5
5
 
6
6
  /**
7
- * @ngdoc provider
8
- * @name $templateRequestProvider
9
- * @this
10
- *
11
- * @description
12
7
  * Used to configure the options passed to the {@link $http} service when making a template request.
13
8
  *
14
9
  * For example, it can be used for specifying the "Accept" header that is sent to the server, when
@@ -27,8 +22,8 @@ export function TemplateRequestProvider() {
27
22
  * The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the
28
23
  * options if not overridden here.
29
24
  *
30
- * @param {string=} value new value for the {@link $http} options.
31
- * @returns {string|self} Returns the {@link $http} options when used as getter and self if used as setter.
25
+ * @param {string=} val new value for the {@link $http} options.
26
+ * @returns {string|TemplateRequestProvider} Returns the {@link $http} options when used as getter and self if used as setter.
32
27
  */
33
28
  this.httpOptions = function (val) {
34
29
  if (val) {
@@ -345,7 +345,7 @@ export function assertFn(predicateOrMap, errMsg = "assert failure") {
345
345
  return (obj) => {
346
346
  const result = predicateOrMap(obj);
347
347
  if (!result) {
348
- throw new Error(isFunction(errMsg) ? errMsg(obj) : errMsg);
348
+ throw new Error(errMsg);
349
349
  }
350
350
  return result;
351
351
  };
@@ -307,7 +307,7 @@ export function snakeCase(name, separator) {
307
307
  ```js
308
308
  let values = {name: 'misko', gender: 'male'};
309
309
  let log = [];
310
- angular.forEach(values, function(value, key) {
310
+ forEach(values, function(value, key) {
311
311
  this.push(key + ': ' + value);
312
312
  }, log);
313
313
  expect(log).toEqual(['name: misko', 'gender: male']);
@@ -496,15 +496,6 @@ export function inherit(parent, extra) {
496
496
  return extend(Object.create(parent), extra);
497
497
  }
498
498
 
499
- /**
500
- *
501
- * @param {*} value to be returned.
502
- * @returns {*} the value passed in.
503
- */
504
- export function identity(value) {
505
- return value;
506
- }
507
-
508
499
  /**
509
500
  * @param {*} value
510
501
  * @returns {() => *}
@@ -894,7 +885,7 @@ export function toJson(obj, pretty) {
894
885
  if (!isNumber(pretty)) {
895
886
  pretty = pretty ? 2 : null;
896
887
  }
897
- return JSON.stringify(obj, toJsonReplacer, pretty);
888
+ return JSON.stringify(obj, toJsonReplacer, /** @type {Number} */ (pretty));
898
889
  }
899
890
 
900
891
  /**