@angular-wave/angular.ts 0.0.46 → 0.0.48

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 (60) hide show
  1. package/dist/angular-ts.esm.js +2 -2
  2. package/dist/angular-ts.umd.js +2 -2
  3. package/package.json +1 -1
  4. package/src/angular.spec.js +1 -2
  5. package/src/animations/animate-css-driver.js +1 -1
  6. package/src/animations/animate-queue.js +3 -4
  7. package/src/animations/animation.js +1 -1
  8. package/src/animations/raf-scheduler.js +0 -1
  9. package/src/animations/shared.js +1 -1
  10. package/src/core/animate/animate.js +0 -1
  11. package/src/core/compile/compile.spec.js +1 -1
  12. package/src/core/filter/filter.js +2 -2
  13. package/src/core/location/location.js +1 -1
  14. package/src/core/location/location.spec.js +1 -1
  15. package/src/core/parser/ast-type.js +22 -0
  16. package/src/core/parser/ast.js +422 -0
  17. package/src/core/parser/compiler.js +561 -0
  18. package/src/core/parser/interpreter.js +422 -0
  19. package/src/core/parser/lexer.js +257 -0
  20. package/src/core/parser/parse.js +9 -1930
  21. package/src/core/parser/parse.spec.js +2 -2
  22. package/src/core/parser/parser.js +39 -0
  23. package/src/core/parser/shared.js +228 -0
  24. package/src/core/q/q.spec.js +0 -1
  25. package/src/core/sce/sce.js +3 -6
  26. package/src/core/scope/scope.js +19 -11
  27. package/src/core/task-tracker-factory.js +0 -1
  28. package/src/directive/attrs/attrs.js +4 -185
  29. package/src/directive/attrs/attrs.md +224 -0
  30. package/src/directive/class/class.js +0 -2
  31. package/src/directive/form/form.js +0 -3
  32. package/src/directive/include/include.js +1 -1
  33. package/src/directive/include/include.spec.js +0 -1
  34. package/src/directive/input/input.js +1 -2
  35. package/src/directive/model/model.js +1 -3
  36. package/src/directive/model/model.spec.js +0 -1
  37. package/src/directive/repeat/repeat.spec.js +0 -2
  38. package/src/exts/aria/aria.js +0 -1
  39. package/src/filters/filter.spec.js +0 -1
  40. package/src/injector.js +1 -1
  41. package/src/injector.spec.js +0 -5
  42. package/src/loader.js +0 -5
  43. package/src/services/cookie-reader.js +0 -1
  44. package/src/services/http/http.spec.js +0 -2
  45. package/src/shared/jqlite/jqlite.js +219 -140
  46. package/src/shared/utils.js +18 -7
  47. package/src/types.js +10 -0
  48. package/types/core/parser/ast-type.d.ts +20 -0
  49. package/types/core/parser/ast.d.ts +78 -0
  50. package/types/core/parser/compiler.d.ts +49 -0
  51. package/types/core/parser/interpreter.d.ts +57 -0
  52. package/types/core/parser/parse.d.ts +79 -0
  53. package/types/core/parser/parser.d.ts +22 -0
  54. package/types/core/parser/shared.d.ts +29 -0
  55. package/types/core/scope/scope.d.ts +9 -2
  56. package/types/directive/attrs/attrs.d.ts +0 -174
  57. package/types/shared/jqlite/jqlite.d.ts +33 -4
  58. package/types/shared/utils.d.ts +18 -5
  59. package/types/types.d.ts +1 -0
  60. package/types-back/index.d.ts +0 -12
@@ -0,0 +1,224 @@
1
+ /\*\*
2
+
3
+ - @ngdoc directive
4
+ - @name ngHref
5
+ - @restrict A
6
+ - @priority 99
7
+ -
8
+ - @description
9
+ - Using AngularJS markup like `{{hash}}` in an href attribute will
10
+ - make the link go to the wrong URL if the user clicks it before
11
+ - AngularJS has a chance to replace the `{{hash}}` markup with its
12
+ - value. Until AngularJS replaces the markup the link will be broken
13
+ - and will most likely return a 404 error. The `ngHref` directive
14
+ - solves this problem.
15
+ -
16
+ - The wrong way to write it:
17
+ - ```html
18
+
19
+ ```
20
+
21
+ - <a href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
22
+ - ```
23
+
24
+ ```
25
+
26
+ -
27
+ - The correct way to write it:
28
+ - ```html
29
+
30
+ ```
31
+
32
+ - <a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
33
+ - ```
34
+
35
+ ```
36
+
37
+ -
38
+ - @element A
39
+ - @param {template} ngHref any string which can contain `{{}}` markup.
40
+ - \*/
41
+
42
+ /\*\*
43
+
44
+ - @ngdoc directive
45
+ - @name ngSrc
46
+ - @restrict A
47
+ - @priority 99
48
+ -
49
+ - @description
50
+ - Using AngularJS markup like `{{hash}}` in a `src` attribute doesn't
51
+ - work right: The browser will fetch from the URL with the literal
52
+ - text `{{hash}}` until AngularJS replaces the expression inside
53
+ - `{{hash}}`. The `ngSrc` directive solves this problem.
54
+ -
55
+ - The buggy way to write it:
56
+ - ```html
57
+
58
+ ```
59
+
60
+ - <img src="http://www.gravatar.com/avatar/{{hash}}" alt="Description"/>
61
+ - ```
62
+
63
+ ```
64
+
65
+ -
66
+ - The correct way to write it:
67
+ - ```html
68
+
69
+ ```
70
+
71
+ - <img ng-src="http://www.gravatar.com/avatar/{{hash}}" alt="Description" />
72
+ - ```
73
+
74
+ ```
75
+
76
+ -
77
+ - @element IMG
78
+ - @param {template} ngSrc any string which can contain `{{}}` markup.
79
+ \*/
80
+
81
+ /\*\*
82
+
83
+ - @ngdoc directive
84
+ - @name ngSrcset
85
+ - @restrict A
86
+ - @priority 99
87
+ -
88
+ - @description
89
+ - Using AngularJS markup like `{{hash}}` in a `srcset` attribute doesn't
90
+ - work right: The browser will fetch from the URL with the literal
91
+ - text `{{hash}}` until AngularJS replaces the expression inside
92
+ - `{{hash}}`. The `ngSrcset` directive solves this problem.
93
+ -
94
+ - The buggy way to write it:
95
+ - ```html
96
+
97
+ ```
98
+
99
+ - <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description"/>
100
+ - ```
101
+
102
+ ```
103
+
104
+ -
105
+ - The correct way to write it:
106
+ - ```html
107
+
108
+ ```
109
+
110
+ - <img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description" />
111
+ - ```
112
+
113
+ ```
114
+
115
+ -
116
+ - @element IMG
117
+ - @param {template} ngSrcset any string which can contain `{{}}` markup.
118
+ \*/
119
+
120
+ /\*\*
121
+
122
+ - @ngdoc directive
123
+ - @name ngDisabled
124
+ - @restrict A
125
+ - @priority 100
126
+ -
127
+ - @description
128
+ -
129
+ - This directive sets the `disabled` attribute on the element (typically a form control,
130
+ - e.g. `input`, `button`, `select` etc.) if the
131
+ - {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.
132
+ -
133
+ - A special directive is necessary because we cannot use interpolation inside the `disabled`
134
+ - attribute. See the {@link guide/interpolation interpolation guide} for more info.
135
+ -
136
+ - @param {string} ngDisabled If the {@link guide/expression expression} is truthy,
137
+ - then the `disabled` attribute will be set on the element
138
+ \*/
139
+
140
+ /\*\*
141
+
142
+ - @ngdoc directive
143
+ - @name ngChecked
144
+ - @restrict A
145
+ - @priority 100
146
+ -
147
+ - @description
148
+ - Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy.
149
+ -
150
+ - Note that this directive should not be used together with {@link ngModel `ngModel`},
151
+ - as this can lead to unexpected behavior.
152
+ -
153
+ - A special directive is necessary because we cannot use interpolation inside the `checked`
154
+ - attribute. See the {@link guide/interpolation interpolation guide} for more info.
155
+ -
156
+ - @element INPUT
157
+ - @param {string} ngChecked If the {@link guide/expression expression} is truthy,
158
+ - then the `checked` attribute will be set on the element
159
+ \*/
160
+
161
+ /\*\*
162
+
163
+ -
164
+ - @description
165
+ -
166
+ - Sets the `readonly` attribute on the element, if the expression inside `ngReadonly` is truthy.
167
+ - Note that `readonly` applies only to `input` elements with specific types. [See the input docs on
168
+ - MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) for more information.
169
+ -
170
+ - A special directive is necessary because we cannot use interpolation inside the `readonly`
171
+ - attribute. See the {@link guide/interpolation interpolation guide} for more info.
172
+ - @element INPUT
173
+ - @param {string} ngReadonly If the {@link guide/expression expression} is truthy,
174
+ - then special attribute "readonly" will be set on the element
175
+ \*/
176
+
177
+ /\*\*
178
+
179
+ - @ngdoc directive
180
+ - @name ngSelected
181
+ - @restrict A
182
+ - @priority 100
183
+ -
184
+ - @description
185
+ -
186
+ - Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy.
187
+ -
188
+ - A special directive is necessary because we cannot use interpolation inside the `selected`
189
+ - attribute. See the {@link guide/interpolation interpolation guide} for more info.
190
+ -
191
+ - <div class="alert alert-warning">
192
+ - **Note:** `ngSelected` does not interact with the `select` and `ngModel` directives, it only
193
+ - sets the `selected` attribute on the element. If you are using `ngModel` on the select, you
194
+ - should not use `ngSelected` on the options, as `ngModel` will set the select value and
195
+ - selected options.
196
+ - </div>
197
+ - @element OPTION
198
+ - @param {string} ngSelected If the {@link guide/expression expression} is truthy,
199
+ - then special attribute "selected" will be set on the element
200
+ \*/
201
+
202
+ /\*\*
203
+
204
+ - @ngdoc directive
205
+ - @name ngOpen
206
+ - @restrict A
207
+ - @priority 100
208
+ -
209
+ - @description
210
+ -
211
+ - Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy.
212
+ -
213
+ - A special directive is necessary because we cannot use interpolation inside the `open`
214
+ - attribute. See the {@link guide/interpolation interpolation guide} for more info.
215
+ -
216
+ - ## A note about browser compatibility
217
+ -
218
+ - Internet Explorer and Edge do not support the `details` element, it is
219
+ - recommended to use {@link ng.ngShow} and {@link ng.ngHide} instead.
220
+ -
221
+ - @element DETAILS
222
+ - @param {string} ngOpen If the {@link guide/expression expression} is truthy,
223
+ - then special attribute "open" will be set on the element
224
+ \*/
@@ -1,7 +1,6 @@
1
1
  import { forEach, isObject, isString } from "../../shared/utils";
2
2
 
3
3
  function classDirective(name, selector) {
4
- // eslint-disable-next-line no-param-reassign
5
4
  name = `ngClass${name}`;
6
5
  var indexWatchExpression;
7
6
 
@@ -24,7 +23,6 @@ function classDirective(name, selector) {
24
23
  if (name !== "ngClass") {
25
24
  if (!indexWatchExpression) {
26
25
  indexWatchExpression = $parse("$index", function moduloTwo($index) {
27
- // eslint-disable-next-line no-bitwise
28
26
  return $index & 1;
29
27
  });
30
28
  }
@@ -244,7 +244,6 @@ FormController.prototype = {
244
244
  forEach(
245
245
  this.$pending,
246
246
  function (value, name) {
247
- // eslint-disable-next-line no-invalid-this
248
247
  this.$setValidity(name, null, control);
249
248
  },
250
249
  this,
@@ -252,7 +251,6 @@ FormController.prototype = {
252
251
  forEach(
253
252
  this.$error,
254
253
  function (value, name) {
255
- // eslint-disable-next-line no-invalid-this
256
254
  this.$setValidity(name, null, control);
257
255
  },
258
256
  this,
@@ -260,7 +258,6 @@ FormController.prototype = {
260
258
  forEach(
261
259
  this.$$success,
262
260
  function (value, name) {
263
- // eslint-disable-next-line no-invalid-this
264
261
  this.$setValidity(name, null, control);
265
262
  },
266
263
  this,
@@ -49,7 +49,7 @@ export const ngIncludeDirective = [
49
49
  $anchorScroll();
50
50
  }
51
51
  };
52
- // eslint-disable-next-line no-plusplus
52
+
53
53
  const thisChangeId = ++changeCounter;
54
54
  if (src) {
55
55
  // set the 2nd param to true to ignore the template request error so that the inner
@@ -381,7 +381,6 @@ describe("ngInclude", () => {
381
381
  await wait(100);
382
382
  const child = element.find("rect");
383
383
  expect(child.length).toBe(2);
384
- // // eslint-disable-next-line no-undef
385
384
  expect(child[0] instanceof SVGRectElement).toBe(true);
386
385
  });
387
386
 
@@ -34,7 +34,7 @@ export const ISO_DATE_REGEXP =
34
34
  // 1111111111111111 222 333333 44444 55555555555555555555555 666 77777777 8888888 999
35
35
  export const URL_REGEXP =
36
36
  /^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i;
37
- // eslint-disable-next-line max-len
37
+
38
38
  export const EMAIL_REGEXP =
39
39
  /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;
40
40
  const NUMBER_REGEXP = /^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/;
@@ -1144,7 +1144,6 @@ export function isNumberInteger(num) {
1144
1144
  // See http://stackoverflow.com/questions/14636536/how-to-check-if-a-variable-is-an-integer-in-javascript#14794066
1145
1145
  // (minus the assumption that `num` is a number)
1146
1146
 
1147
- // eslint-disable-next-line no-bitwise
1148
1147
  return (num | 0) === num;
1149
1148
  }
1150
1149
 
@@ -328,7 +328,6 @@ NgModelController.prototype = {
328
328
  * @returns {boolean} True if `value` is "empty".
329
329
  */
330
330
  $isEmpty(value) {
331
- // eslint-disable-next-line no-self-compare
332
331
  return (
333
332
  isUndefined(value) || value === "" || value === null || value !== value
334
333
  );
@@ -771,7 +770,6 @@ NgModelController.prototype = {
771
770
  try {
772
771
  listener();
773
772
  } catch (e) {
774
- // eslint-disable-next-line no-invalid-this
775
773
  this.$$exceptionHandler(e);
776
774
  }
777
775
  },
@@ -1082,7 +1080,7 @@ function setupModelWatcher(ctrl) {
1082
1080
  if (
1083
1081
  modelValue !== ctrl.$modelValue &&
1084
1082
  // checks for NaN is needed to allow setting the model to NaN when there's an asyncValidator
1085
- // eslint-disable-next-line no-self-compare
1083
+
1086
1084
  (ctrl.$modelValue === ctrl.$modelValue || modelValue === modelValue)
1087
1085
  ) {
1088
1086
  ctrl.$$setModelValue(modelValue);
@@ -1173,7 +1173,6 @@ describe("ngModel", () => {
1173
1173
  });
1174
1174
 
1175
1175
  it("should be possible to extend Object prototype and still be able to do form validation", () => {
1176
- // eslint-disable-next-line no-extend-native
1177
1176
  Object.prototype.someThing = function () {};
1178
1177
  const element = $compile(
1179
1178
  '<form name="myForm">' +
@@ -129,7 +129,6 @@ describe("ngRepeat", () => {
129
129
 
130
130
  it("should iterate over an array-like class", () => {
131
131
  function Collection() {}
132
- // eslint-disable-next-line no-array-constructor
133
132
  Collection.prototype = new Array();
134
133
  Collection.prototype.length = 0;
135
134
 
@@ -296,7 +295,6 @@ describe("ngRepeat", () => {
296
295
  "</ul>",
297
296
  )(scope);
298
297
 
299
- // eslint-disable-next-line no-extend-native
300
298
  Array.prototype.extraProperty = "should be ignored";
301
299
  // INIT
302
300
  scope.items = [true, true, true];
@@ -128,7 +128,6 @@ export function initAriaModule() {
128
128
 
129
129
  function getRadioReaction() {
130
130
  // Strict comparison would cause a BC
131
- // eslint-disable-next-line eqeqeq
132
131
  elem[0].setAttribute(
133
132
  "aria-checked",
134
133
  (attr.value == ngModel.$viewValue).toString(),
@@ -434,7 +434,6 @@ describe("Filter: filter", () => {
434
434
  });
435
435
 
436
436
  it("should not be affected by `Object.prototype` when using a string expression", () => {
437
- // eslint-disable-next-line no-extend-native
438
437
  Object.prototype.someProp = "oo";
439
438
 
440
439
  const items = [
package/src/injector.js CHANGED
@@ -275,7 +275,7 @@ export function createInjector(modulesToLoad, strictDi) {
275
275
  // unlike those of Chrome and IE
276
276
  // So if stack doesn't contain message, we create a new string that contains both.
277
277
  // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.
278
- // eslint-disable-next-line no-ex-assign
278
+
279
279
  e = `${e.message}\n${e.stack}`;
280
280
  }
281
281
  throw $injectorMinErr(
@@ -461,21 +461,17 @@ describe("annotate", () => {
461
461
 
462
462
  describe("es6", () => {
463
463
  it("should be possible to annotate shorthand methods", () => {
464
- // eslint-disable-next-line no-eval
465
464
  expect(annotate(eval("({ fn(x) { return; } })").fn)).toEqual(["x"]);
466
465
  });
467
466
 
468
467
  it("should create $inject for arrow functions", () => {
469
- // eslint-disable-next-line no-eval
470
468
  expect(annotate(eval("(a, b) => a"))).toEqual(["a", "b"]);
471
469
  });
472
470
  it("should create $inject for arrow functions with no parenthesis", () => {
473
- // eslint-disable-next-line no-eval
474
471
  expect(annotate(eval("a => a"))).toEqual(["a"]);
475
472
  });
476
473
 
477
474
  it("should take args before first arrow", () => {
478
- // eslint-disable-next-line no-eval
479
475
  expect(annotate(eval("a => b => b"))).toEqual(["a"]);
480
476
  });
481
477
 
@@ -492,7 +488,6 @@ describe("annotate", () => {
492
488
  "class/* Test */{}",
493
489
  "class /* Test */ {}",
494
490
  ].forEach((classDefinition) => {
495
- // eslint-disable-next-line no-eval
496
491
  const Clazz = eval(`(${classDefinition})`);
497
492
  const instance = injector.invoke(Clazz);
498
493
 
package/src/loader.js CHANGED
@@ -174,7 +174,6 @@ export class Angular {
174
174
  * @returns {angular.auto.IInjectorService} Returns the newly created injector for this app.
175
175
  */
176
176
  bootstrap(element, modules, config) {
177
- // eslint-disable-next-line no-param-reassign
178
177
  config = config || {
179
178
  debugInfoEnabled: false,
180
179
  strictDi: false,
@@ -333,7 +332,6 @@ export class Angular {
333
332
  }
334
333
 
335
334
  function ensure(obj, name, factory) {
336
- // eslint-disable-next-line no-return-assign, no-param-reassign
337
335
  return obj[name] || (obj[name] = factory());
338
336
  }
339
337
 
@@ -357,7 +355,6 @@ export class Angular {
357
355
  /** @type {!Array.<Function>} */
358
356
  const runBlocks = [];
359
357
 
360
- // eslint-disable-next-line no-use-before-define
361
358
  const config = invokeLater("$injector", "invoke", "push", configBlocks);
362
359
 
363
360
  /** @type {import('./types').Module} */
@@ -883,7 +880,6 @@ export function setupModuleLoader(window) {
883
880
  const $injectorMinErr = minErr("$injector");
884
881
 
885
882
  function ensure(obj, name, factory) {
886
- // eslint-disable-next-line no-return-assign
887
883
  return obj[name] || (obj[name] = factory());
888
884
  }
889
885
 
@@ -974,7 +970,6 @@ export function setupModuleLoader(window) {
974
970
  /** @type {!Array.<Function>} */
975
971
  const runBlocks = [];
976
972
 
977
- // eslint-disable-next-line no-use-before-define
978
973
  const config = invokeLater("$injector", "invoke", "push", configBlocks);
979
974
 
980
975
  /** @type {import('./types').Module} */
@@ -43,7 +43,6 @@ export function $$CookieReader($document) {
43
43
  cookieArray = lastCookieString.split("; ");
44
44
  lastCookies = {};
45
45
 
46
- // eslint-disable-next-line no-plusplus
47
46
  for (i = 0; i < cookieArray.length; i++) {
48
47
  cookie = cookieArray[i];
49
48
  index = cookie.indexOf("=");
@@ -2417,7 +2417,6 @@ describe("$http", function () {
2417
2417
  // it("should ignore Blob objects", () => {
2418
2418
  // if (!window.Blob) return;
2419
2419
 
2420
- // // eslint-disable-next-line no-undef
2421
2420
  // const blob = new Blob(["blob!"], { type: "text/plain" });
2422
2421
 
2423
2422
  // $httpBackend.expect("POST", "/url", "[object Blob]").respond("");
@@ -2427,7 +2426,6 @@ describe("$http", function () {
2427
2426
  // it("should ignore FormData objects", () => {
2428
2427
  // if (!window.FormData) return;
2429
2428
 
2430
- // // eslint-disable-next-line no-undef
2431
2429
  // const formData = new FormData();
2432
2430
  // formData.append("angular", "is great");
2433
2431