@angular-wave/angular.ts 0.4.2 → 0.4.4

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 (150) hide show
  1. package/dist/angular-ts.esm.js +2 -2
  2. package/dist/angular-ts.umd.js +12 -2
  3. package/index.html +74 -3
  4. package/package.json +7 -7
  5. package/src/angular.spec.js +1 -269
  6. package/src/animations/animate-css-driver.js +2 -2
  7. package/src/animations/animate-css.js +12 -21
  8. package/src/animations/animate-js-driver.js +1 -3
  9. package/src/animations/animate-js.js +4 -4
  10. package/src/animations/animate-queue.js +23 -23
  11. package/src/animations/animate-runner.js +4 -8
  12. package/src/animations/animate.md +1 -1
  13. package/src/animations/animate.spec.js +0 -21
  14. package/src/animations/animation.js +4 -4
  15. package/src/animations/shared.js +14 -12
  16. package/src/binding.spec.js +0 -1
  17. package/src/core/cache/cache.js +2 -29
  18. package/src/core/compile/attributes.js +2 -3
  19. package/src/core/compile/compile.js +260 -245
  20. package/src/core/compile/compile.spec.js +63 -317
  21. package/src/core/compile/compile.test.js +1 -1
  22. package/src/core/controller/controller.js +2 -0
  23. package/src/core/di/injector.md +1 -1
  24. package/src/core/di/injector.spec.js +0 -2
  25. package/src/core/di/internal-injector.js +2 -1
  26. package/src/core/interpolate/interpolate.js +16 -3
  27. package/src/core/interpolate/interpolate.spec.js +70 -16
  28. package/src/core/location/location.js +0 -2
  29. package/src/core/location/location.spec.js +27 -27
  30. package/src/core/{scope/scope.html → model/model.html} +1 -1
  31. package/src/core/model/model.js +944 -0
  32. package/src/core/model/model.spec.js +3012 -0
  33. package/src/core/on.spec.js +0 -7
  34. package/src/core/parse/interpreter.js +10 -7
  35. package/src/core/parse/parse.js +28 -7
  36. package/src/core/parse/parse.spec.js +95 -91
  37. package/src/core/prop.spec.js +4 -60
  38. package/src/core/sce/sce.js +1 -2
  39. package/src/core/sce/sce.spec.js +0 -8
  40. package/src/core/scope/scope.js +62 -32
  41. package/src/core/scope/scope.spec.js +25 -1960
  42. package/src/directive/aria/aria.js +3 -6
  43. package/src/directive/aria/aria.spec.js +0 -87
  44. package/src/directive/attrs/attrs.spec.js +0 -5
  45. package/src/directive/{list/list.test.js → attrs/attrs.test.js} +1 -1
  46. package/src/{core/q/q.html → directive/attrs/boolean.html} +1 -1
  47. package/src/directive/attrs/boolean.spec.js +0 -15
  48. package/src/{core/q/q.test.js → directive/attrs/boolean.test.js} +1 -2
  49. package/src/{core/timeout/timeout.html → directive/attrs/element-style.html} +4 -1
  50. package/src/directive/attrs/element-style.spec.js +0 -8
  51. package/src/{core/scope/scope.test.js → directive/attrs/element-style.test.js} +1 -2
  52. package/src/directive/attrs/src.spec.js +0 -7
  53. package/src/directive/bind/bind.spec.js +0 -33
  54. package/src/directive/bind/bing-html.spec.js +1 -4
  55. package/src/{core/interval/interval.html → directive/channel/channel.html} +1 -1
  56. package/src/directive/channel/channel.js +29 -0
  57. package/src/directive/channel/channel.spec.js +52 -0
  58. package/src/directive/channel/channel.test.js +9 -0
  59. package/src/directive/class/class.js +3 -3
  60. package/src/directive/class/class.spec.js +9 -75
  61. package/src/directive/controller/controller.spec.js +0 -13
  62. package/src/directive/events/click.spec.js +0 -3
  63. package/src/directive/events/event.spec.js +0 -6
  64. package/src/directive/form/form.js +14 -22
  65. package/src/directive/form/form.spec.js +0 -65
  66. package/src/directive/if/if.spec.js +2 -7
  67. package/src/directive/if/if.test.js +1 -2
  68. package/src/directive/include/include.js +2 -2
  69. package/src/directive/include/include.spec.js +8 -59
  70. package/src/directive/init/init.js +6 -2
  71. package/src/directive/init/init.spec.js +0 -2
  72. package/src/directive/input/input.js +1 -2
  73. package/src/directive/input/input.spec.js +191 -331
  74. package/src/directive/messages/messages.spec.js +4 -35
  75. package/src/directive/model/model.js +30 -42
  76. package/src/directive/model/model.spec.js +2 -49
  77. package/src/directive/model-options/model-options.js +22 -26
  78. package/src/directive/model-options/model-options.spec.js +0 -6
  79. package/src/directive/non-bindable/non-bindable.spec.js +0 -1
  80. package/src/directive/observe/observe.js +0 -1
  81. package/src/directive/observe/observe.spec.js +0 -1
  82. package/src/directive/options/options.js +1 -3
  83. package/src/directive/options/options.spec.js +3 -38
  84. package/src/directive/ref/href.spec.js +0 -15
  85. package/src/directive/repeat/repeat.js +2 -2
  86. package/src/directive/repeat/repeat.spec.js +56 -192
  87. package/src/directive/script/script.spec.js +0 -2
  88. package/src/directive/select/select.js +3 -3
  89. package/src/directive/select/select.spec.js +9 -106
  90. package/src/directive/show-hide/show-hide.js +2 -2
  91. package/src/directive/show-hide/show-hide.spec.js +8 -19
  92. package/src/directive/style/style.spec.js +0 -7
  93. package/src/directive/switch/switch.js +1 -2
  94. package/src/directive/switch/switch.spec.js +5 -5
  95. package/src/directive/validators/validators.spec.js +0 -1
  96. package/src/loader.js +0 -1
  97. package/src/public.js +75 -80
  98. package/src/router/common/coreservices.js +0 -2
  99. package/src/router/directives/state-directives.js +24 -30
  100. package/src/router/directives/state-directives.spec.js +0 -83
  101. package/src/router/directives/view-directive.js +6 -15
  102. package/src/router/directives/view-directive.spec.js +25 -71
  103. package/src/router/hooks/lazy-load.js +2 -2
  104. package/src/router/hooks/views.js +3 -5
  105. package/src/router/resolve/resolvable.js +3 -6
  106. package/src/router/resolve/resolve-context.js +2 -2
  107. package/src/router/state/state-service.js +4 -4
  108. package/src/router/state/state.spec.js +2 -5
  109. package/src/router/state/views.js +9 -12
  110. package/src/router/template-factory.js +3 -6
  111. package/src/router/template-factory.spec.js +0 -4
  112. package/src/router/transition/transition-hook.js +1 -1
  113. package/src/router/transition/transition.js +1 -1
  114. package/src/router/url/url-service.js +2 -8
  115. package/src/router/url/url-service.spec.js +3 -4
  116. package/src/router/view-hook.spec.js +2 -2
  117. package/src/router/view-scroll.js +4 -6
  118. package/src/services/http/http.js +11 -15
  119. package/src/services/http/http.spec.js +30 -31
  120. package/src/services/http/template-request.spec.js +0 -10
  121. package/src/services/http-backend/http-backend.js +19 -17
  122. package/src/services/http-backend/http-backend.spec.js +3 -3
  123. package/src/services/template-request.js +2 -4
  124. package/src/shared/common.js +6 -10
  125. package/src/shared/jqlite/jqlite.js +14 -15
  126. package/src/shared/jqlite/jqlite.spec.js +2 -2
  127. package/src/shared/utils.js +15 -92
  128. package/types/core/cache/cache.d.ts +1 -1
  129. package/types/core/model/model.d.ts +204 -0
  130. package/types/core/parse/parse.d.ts +26 -0
  131. package/types/core/scope/scope.d.ts +22 -21
  132. package/types/directive/channel/channel.d.ts +11 -0
  133. package/types/directive/form/form.d.ts +1 -0
  134. package/types/shared/common.d.ts +0 -1
  135. package/types/shared/utils.d.ts +0 -35
  136. package/src/core/interval/interval-factory.js +0 -50
  137. package/src/core/interval/interval.js +0 -77
  138. package/src/core/interval/interval.md +0 -123
  139. package/src/core/interval/interval.spec.js +0 -280
  140. package/src/core/q/q.js +0 -472
  141. package/src/core/q/q.md +0 -211
  142. package/src/core/q/q.spec.js +0 -2748
  143. package/src/core/timeout/timeout.js +0 -109
  144. package/src/core/timeout/timeout.spec.js +0 -354
  145. package/src/core/timeout/timout.test.js +0 -12
  146. package/src/directive/list/list.html +0 -18
  147. package/src/directive/list/list.js +0 -46
  148. package/src/directive/list/list.md +0 -22
  149. package/src/directive/list/list.spec.js +0 -172
  150. package/types/directive/list/list.d.ts +0 -4
@@ -3,7 +3,6 @@ import {
3
3
  arrayRemove,
4
4
  concat,
5
5
  extend,
6
- forEach,
7
6
  isDefined,
8
7
  isFunction,
9
8
  isObject,
@@ -103,9 +102,9 @@ export function JQLite(element) {
103
102
  JQLite.prototype = {
104
103
  toString() {
105
104
  const value = [];
106
- forEach(this, (e) => {
107
- value.push(`${e}`);
108
- });
105
+ for (var i = 0; i < this.length; i++) {
106
+ value.push(`${this[i]}`);
107
+ }
109
108
  return `[${value.join(", ")}]`;
110
109
  },
111
110
 
@@ -276,7 +275,7 @@ JQLite.prototype.off = function (type, fn) {
276
275
  }
277
276
  };
278
277
 
279
- forEach(type.split(" "), (type) => {
278
+ type.split(" ").forEach((type) => {
280
279
  removeHandler(type);
281
280
  if (MOUSE_EVENT_MAP[type]) {
282
281
  removeHandler(MOUSE_EVENT_MAP[type]);
@@ -379,7 +378,7 @@ JQLite.prototype.val = function (value) {
379
378
  // read
380
379
  if (element.multiple && getNodeName(element) === "select") {
381
380
  const result = [];
382
- forEach(element.options, (option) => {
381
+ Array.from(element.options).forEach((option) => {
383
382
  if (option.selected) {
384
383
  result.push(option.value || option.text);
385
384
  }
@@ -482,14 +481,16 @@ JQLite.prototype.replaceWith = function (arg1) {
482
481
  let index;
483
482
  const parent = element.parentNode;
484
483
  dealoc(element);
485
- forEach(new JQLite(replaceNode), (node) => {
484
+ const nodes = new JQLite(replaceNode);
485
+ for (let i = 0; i < nodes.length; i++) {
486
+ const node = nodes[i];
486
487
  if (index) {
487
488
  parent.insertBefore(node, index.nextSibling);
488
489
  } else {
489
490
  parent.replaceChild(node, element);
490
491
  }
491
492
  index = node;
492
- });
493
+ }
493
494
  };
494
495
  for (let i = 0; i < this.length; i++) {
495
496
  addNodes(value, fn(this[i], arg1));
@@ -542,9 +543,10 @@ JQLite.prototype.prepend = function (node) {
542
543
  const element = this[i];
543
544
  if (element.nodeType === Node.ELEMENT_NODE) {
544
545
  const index = element.firstChild;
545
- forEach(new JQLite(node), (child) => {
546
- element.insertBefore(child, index);
547
- });
546
+ const el = new JQLite(node);
547
+ for (let i = 0; i < el.length; i++) {
548
+ element.insertBefore(el[i], index);
549
+ }
548
550
  }
549
551
  }
550
552
  return this;
@@ -683,7 +685,7 @@ JQLite.prototype.triggerHandler = function (event, extraParameters) {
683
685
  ? [dummyEvent].concat(extraParameters)
684
686
  : [dummyEvent];
685
687
 
686
- forEach(eventFnsCopy, (fn) => {
688
+ eventFnsCopy.forEach((fn) => {
687
689
  if (!dummyEvent.isImmediatePropagationStopped()) {
688
690
  fn.apply(element, handlerArgs);
689
691
  }
@@ -1093,9 +1095,6 @@ function createEventHandler(element, events) {
1093
1095
  }
1094
1096
  };
1095
1097
 
1096
- // TODO: this is a hack for angularMocks/clearDataCache that makes it possible to deregister all
1097
- // events on `element`
1098
- eventHandler.elem = element;
1099
1098
  return eventHandler;
1100
1099
  }
1101
1100
 
@@ -8,7 +8,7 @@ import {
8
8
  } from "./jqlite";
9
9
  import { Angular } from "../../loader";
10
10
  import { createInjector } from "../../core/di/injector";
11
- import { equals, forEach } from "../utils";
11
+ import { equals } from "../utils";
12
12
  import { browserTrigger } from "../test-utils";
13
13
  import { CACHE, EXPANDO } from "../../core/cache/cache";
14
14
 
@@ -902,7 +902,7 @@ describe("jqLite", () => {
902
902
  });
903
903
 
904
904
  it("should not fail on elements without the getAttribute method", () => {
905
- forEach([window, document], (node) => {
905
+ [window, document].forEach((node) => {
906
906
  expect(() => {
907
907
  const elem = JQLite(node);
908
908
  elem.attr("foo");
@@ -288,86 +288,6 @@ export function snakeCase(name, separator) {
288
288
  );
289
289
  }
290
290
 
291
- /**
292
- * Invokes the `iterator` function once for each item in `obj` collection, which can be either an
293
- * object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value`
294
- * is the value of an object property or an array element, `key` is the object property key or
295
- * array element index and obj is the `obj` itself. Specifying a `context` for the function is optional.
296
- *
297
- * It is worth noting that `.forEach` does not iterate over inherited properties because it filters
298
- * using the `hasOwnProperty` method.
299
- *
300
- * Unlike ES262's
301
- * [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18),
302
- * providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just
303
- * return the value provided.
304
- *
305
- ```js
306
- let values = {name: 'misko', gender: 'male'};
307
- let log = [];
308
- forEach(values, function(value, key) {
309
- this.push(key + ': ' + value);
310
- }, log);
311
- expect(log).toEqual(['name: misko', 'gender: male']);
312
- ```
313
- *
314
- * @param {Object|Array} obj Object to iterate over.
315
- * @param {Function} iterator Iterator function.
316
- * @param {Object=} context Object to become context (`this`) for the iterator function.
317
- * @returns {Object|Array} Reference to `obj`.
318
- */
319
- export function forEach(obj, iterator, context) {
320
- let key;
321
- let length;
322
- if (obj) {
323
- if (isFunction(obj)) {
324
- for (key in obj) {
325
- if (
326
- key !== "prototype" &&
327
- key !== "length" &&
328
- key !== "name" &&
329
- Object.prototype.hasOwnProperty.call(obj, key)
330
- ) {
331
- iterator.call(context, obj[key], key, obj);
332
- }
333
- }
334
- } else if (Array.isArray(obj) || isArrayLike(obj)) {
335
- const isPrimitive = typeof obj !== "object";
336
- for (key = 0, length = obj.length; key < length; key++) {
337
- if (isPrimitive || key in obj) {
338
- iterator.call(context, obj[key], key, obj);
339
- }
340
- }
341
- } else if (obj.forEach && obj.forEach !== forEach) {
342
- obj.forEach(iterator, context, obj);
343
- } else if (isBlankObject(obj)) {
344
- // Object.create(null) fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
345
- for (key in obj) {
346
- iterator.call(context, obj[key], key, obj);
347
- }
348
- } else {
349
- // Slow path for objects which do not have a method `hasOwnProperty`
350
- for (key in obj) {
351
- if (Object.hasOwnProperty.call(obj, key)) {
352
- iterator.call(context, obj[key], key, obj);
353
- }
354
- }
355
- }
356
- }
357
- return obj;
358
- }
359
-
360
- /**
361
- * when using forEach the params are value, key, but it is often useful to have key, value.
362
- * @param {function(string, *):any} iteratorFn
363
- * @returns {function(*, string)}
364
- */
365
- export function reverseParams(iteratorFn) {
366
- return function (value, key) {
367
- iteratorFn(key, value);
368
- };
369
- }
370
-
371
291
  /**
372
292
  * Set or clear the hashkey for an object.
373
293
  * @param obj object
@@ -923,21 +843,24 @@ export function parseKeyValue(keyValue) {
923
843
 
924
844
  export function toKeyValue(obj) {
925
845
  const parts = [];
926
- forEach(obj, (value, key) => {
927
- if (Array.isArray(value)) {
928
- forEach(value, (arrayValue) => {
846
+ obj &&
847
+ Object.entries(obj).forEach(([key, value]) => {
848
+ if (Array.isArray(value)) {
849
+ value.forEach((arrayValue) => {
850
+ parts.push(
851
+ encodeUriQuery(key, true) +
852
+ (arrayValue === true
853
+ ? ""
854
+ : `=${encodeUriQuery(arrayValue, true)}`),
855
+ );
856
+ });
857
+ } else {
929
858
  parts.push(
930
859
  encodeUriQuery(key, true) +
931
- (arrayValue === true ? "" : `=${encodeUriQuery(arrayValue, true)}`),
860
+ (value === true ? "" : `=${encodeUriQuery(value, true)}`),
932
861
  );
933
- });
934
- } else {
935
- parts.push(
936
- encodeUriQuery(key, true) +
937
- (value === true ? "" : `=${encodeUriQuery(value, true)}`),
938
- );
939
- }
940
- });
862
+ }
863
+ });
941
864
  return parts.length ? parts.join("&") : "";
942
865
  }
943
866
 
@@ -6,7 +6,7 @@
6
6
  * @property {?Function} handle
7
7
  *
8
8
  */
9
- export const EXPANDO: "ngId";
9
+ export const EXPANDO: "ng";
10
10
  /**
11
11
  * Expando cache for adding properties to DOM nodes with JavaScript.
12
12
  * This used to be an Object in JQLite decorator, but swapped out for a Map
@@ -0,0 +1,204 @@
1
+ /**
2
+ * Creates a deep proxy for the target object, intercepting property changes
3
+ * and recursively applying proxies to nested objects.
4
+ *
5
+ * @param {Object} target - The object to be wrapped in a proxy.
6
+ * @param {Model} [context] - The context for the handler, used to track listeners.
7
+ * @returns {ProxyHandler<Object>} - A proxy that intercepts operations on the target object,
8
+ * or the original value if the target is not an object.
9
+ */
10
+ export function createModel(target?: any, context?: Model): ProxyHandler<any>;
11
+ /**
12
+ * @typedef {Object} AsyncQueueTask
13
+ * @property {Model} handler
14
+ * @property {Function} fn
15
+ * @property {Object} locals
16
+ */
17
+ export const $postUpdateQueue: any[];
18
+ /**
19
+ * @type {Function[]}
20
+ */
21
+ export const $$applyAsyncQueue: Function[];
22
+ export class RootModelProvider {
23
+ rootModel: ProxyHandler<any>;
24
+ $get: (string | ((exceptionHandler: import("../exception-handler").ErrorHandler, parse: import("../parse/parse.js").ParseService) => ProxyHandler<any>))[];
25
+ }
26
+ export type ModelPhase = number;
27
+ export namespace ModelPhase {
28
+ let NONE: number;
29
+ let WATCH: number;
30
+ let DIGEST: number;
31
+ }
32
+ export type AsyncQueueTask = {
33
+ handler: Model;
34
+ fn: Function;
35
+ locals: any;
36
+ };
37
+ /**
38
+ * Listener function definition.
39
+ */
40
+ export type Listener = {
41
+ /**
42
+ * - The original target object.
43
+ */
44
+ originalTarget: any;
45
+ /**
46
+ * - The function invoked when changes are detected.
47
+ */
48
+ listenerFn: ListenerFunction;
49
+ watchFn: import("../parse/parse.js").CompiledExpression;
50
+ id: number;
51
+ oneTime: boolean;
52
+ property: string;
53
+ /**
54
+ * - The optional context in which a property exists
55
+ */
56
+ context?: any;
57
+ foreignListener?: ProxyConstructor;
58
+ };
59
+ /**
60
+ * Listener function type.
61
+ */
62
+ export type ListenerFunction = (newValue: any, oldValue: any, originalTarget: any) => any;
63
+ /**
64
+ * Model class for the Proxy. It intercepts operations like property access (get)
65
+ * and property setting (set), and adds support for deep change tracking and
66
+ * observer-like behavior.
67
+ */
68
+ declare class Model {
69
+ /**
70
+ * Initializes the handler with the target object and a context.
71
+ *
72
+ * @param {Object} target - The target object being proxied.
73
+ * @param {Model} [context] - The context containing listeners.
74
+ */
75
+ constructor(target: any, context?: Model);
76
+ /** @type {Object} */
77
+ $target: any;
78
+ context: Model;
79
+ /** @type {Map<string, Array<Listener>>} Watch listeners */
80
+ listeners: Map<string, Array<Listener>>;
81
+ /** @type {Map<string, Array<Listener>>} Watch listeners from other proxies */
82
+ foreignListeners: Map<string, Array<Listener>>;
83
+ /** @type {WeakMap<Object, Array<string>>} */
84
+ objectListeners: WeakMap<any, Array<string>>;
85
+ /** @type {Map<Function, {oldValue: any, fn: Function}>} */
86
+ functionListeners: Map<Function, {
87
+ oldValue: any;
88
+ fn: Function;
89
+ }>;
90
+ /** @type {?number} */
91
+ listenerCache: number | null;
92
+ /** @type {Proxy} */
93
+ proxy: ProxyConstructor;
94
+ /**
95
+ * @type {Proxy[]}
96
+ */
97
+ children: ProxyConstructor[];
98
+ /**
99
+ * @type {number} Unique model ID (monotonically increasing) useful for debugging.
100
+ */
101
+ id: number;
102
+ /**
103
+ * @type {Model}
104
+ */
105
+ $root: Model;
106
+ $parent: Model;
107
+ /** @type {number} */
108
+ $$watchersCount: number;
109
+ /** @type {AsyncQueueTask[]} */
110
+ $$asyncQueue: AsyncQueueTask[];
111
+ /** @type {Map<String, Function[]>} Event listeners */
112
+ $$listeners: Map<string, Function[]>;
113
+ filters: any[];
114
+ /** @type {ModelPhase} */
115
+ state: ModelPhase;
116
+ /**
117
+ * Intercepts and handles property assignments on the target object. If a new value is
118
+ * an object, it will be recursively proxied.
119
+ *
120
+ * @param {Object} target - The target object.
121
+ * @param {string} property - The name of the property being set.
122
+ * @param {*} value - The new value being assigned to the property.
123
+ * @returns {boolean} - Returns true to indicate success of the operation.
124
+ */
125
+ set(target: any, property: string, value: any, proxy: any): boolean;
126
+ /**
127
+ * Intercepts property access on the target object. It checks for specific
128
+ * properties (`watch` and `sync`) and binds their methods. For other properties,
129
+ * it returns the value directly.
130
+ *
131
+ * @param {Object} target - The target object.
132
+ * @param {string|number|symbol} property - The name of the property being accessed.
133
+ * @param {Proxy} proxy - The proxy object being invoked
134
+ * @returns {*} - The value of the property or a method if accessing `watch` or `sync`.
135
+ */
136
+ get(target: any, property: string | number | symbol, proxy: ProxyConstructor): any;
137
+ /**
138
+ * @private
139
+ * @param {Listener[]} listeners
140
+ * @param {*} oldValue
141
+ */
142
+ private scheduleListener;
143
+ deleteProperty(target: any, property: any): boolean;
144
+ /**
145
+ * Registers a watcher for a property along with a listener function. The listener
146
+ * function is invoked when changes to that property are detected.
147
+ *
148
+ * @param {string} watchProp - An expression to be watched in the context of this model.
149
+ * @param {ListenerFunction} [listenerFn] - A function to execute when changes are detected on watched context.
150
+ */
151
+ $watch(watchProp: string, listenerFn?: ListenerFunction): () => void;
152
+ $watchGroup(watchArray: any, listenerFn: any): void;
153
+ $watchCollection(watchProp: any, listenerFn: any): () => void;
154
+ $new(isIsolated: boolean, parent: any): any;
155
+ registerKey(key: any, listener: any): void;
156
+ registerForeignKey(key: any, listener: any): void;
157
+ deregisterKey(key: any, id: any): boolean;
158
+ deregisterForeignKey(key: any, id: any): boolean;
159
+ /**
160
+ * @deprecated
161
+ */
162
+ $digest(): void;
163
+ $eval(expr: any, locals: any): any;
164
+ $evalAsync(expr: any, locals: any): Promise<any>;
165
+ $apply(expr: any): any;
166
+ $on(name: any, listener: any): () => void;
167
+ /**
168
+ * @param {string} name
169
+ * @param {...any} args
170
+ * @returns
171
+ */
172
+ $emit(name: string, ...args: any[]): any;
173
+ /**
174
+ * @param {string} name
175
+ * @param {...any} args
176
+ * @returns
177
+ */
178
+ $broadcast(name: string, ...args: any[]): any;
179
+ eventHelper({ name, event, broadcast }: {
180
+ name: any;
181
+ event: any;
182
+ broadcast: any;
183
+ }, ...args: any[]): any;
184
+ /**
185
+ * @private
186
+ * @returns {boolean}
187
+ */
188
+ private isRoot;
189
+ $applyAsync(expr: any): Promise<any>;
190
+ $postUpdate(fn: any): void;
191
+ $destroy(): void;
192
+ /**
193
+ * @param {number} count
194
+ */
195
+ incrementWatchersCount(count: number): void;
196
+ /**
197
+ * Invokes the registered listener function with watched property changes.
198
+ *
199
+ * @param {Listener} listener - The property path that was changed.
200
+ * @param {*} oldValue - The old value of the property.
201
+ */
202
+ notifyListener(listener: Listener, oldValue: any): void;
203
+ }
204
+ export {};
@@ -4,10 +4,19 @@
4
4
  * @property {boolean} constant - Indicates if the expression is constant.
5
5
  * @property {boolean} [isPure]
6
6
  * @property {boolean} oneTime
7
+ * @property {import("./interpreter.js").DecoratedASTNode} decoratedNode
7
8
  * @property {function(import('../scope/scope').Scope, import('../scope/scope').WatchListener, boolean, CompiledExpression, string | ((scope: import('../scope/scope').Scope) => any) | CompiledExpression): any} [$$watchDelegate]
8
9
  * @property {any[]|Function} inputs
9
10
  * @property {function(any, any): any} [assign] - Assigns a value to a context. If value is not provided,
10
11
  */
12
+ /**
13
+ * @typedef {Object} CompiledExpressionHandlerMap
14
+ * @property {boolean} literal - Indicates if the expression is a literal.
15
+ * @property {boolean} constant - Indicates if the expression is constant.
16
+ * @property {boolean} [isPure]
17
+ * @property {boolean} oneTime
18
+ * @property {Map<string, Function>} keyMap - property keys to observe
19
+ */
11
20
  /**
12
21
  * @typedef {Function} CompiledExpressionFunction
13
22
  * @param {import('../scope/scope').Scope} context - An object against which any expressions embedded in the strings are evaluated against (typically a scope object).
@@ -61,6 +70,7 @@ export type CompiledExpressionProps = {
61
70
  constant: boolean;
62
71
  isPure?: boolean;
63
72
  oneTime: boolean;
73
+ decoratedNode: import("./interpreter.js").DecoratedASTNode;
64
74
  $$watchDelegate?: (arg0: import("../scope/scope").Scope, arg1: import("../scope/scope").WatchListener, arg2: boolean, arg3: CompiledExpression, arg4: string | ((scope: import("../scope/scope").Scope) => any) | CompiledExpression) => any;
65
75
  inputs: any[] | Function;
66
76
  /**
@@ -68,6 +78,22 @@ export type CompiledExpressionProps = {
68
78
  */
69
79
  assign?: (arg0: any, arg1: any) => any;
70
80
  };
81
+ export type CompiledExpressionHandlerMap = {
82
+ /**
83
+ * - Indicates if the expression is a literal.
84
+ */
85
+ literal: boolean;
86
+ /**
87
+ * - Indicates if the expression is constant.
88
+ */
89
+ constant: boolean;
90
+ isPure?: boolean;
91
+ oneTime: boolean;
92
+ /**
93
+ * - property keys to observe
94
+ */
95
+ keyMap: Map<string, Function>;
96
+ };
71
97
  export type CompiledExpressionFunction = Function;
72
98
  export type CompiledExpression = CompiledExpressionFunction & CompiledExpressionProps;
73
99
  export type ParseService = (arg0: CompiledExpression | string | ((arg0: import("../scope/scope").Scope) => any), arg1: ((arg0: any, arg1: import("../scope/scope").Scope, arg2: any) => any) | undefined, arg2: boolean | undefined) => CompiledExpression;
@@ -56,7 +56,7 @@ export type TTL = number;
56
56
  export const TTL: TTL;
57
57
  /** @type {AsyncQueueTask[]} */
58
58
  export const $$asyncQueue: AsyncQueueTask[];
59
- export const $$postDigestQueue: any[];
59
+ export const $postUpdateQueue: any[];
60
60
  /**
61
61
  * @type {Function[]}
62
62
  */
@@ -158,10 +158,6 @@ export class Scope {
158
158
  /** @type {number} */
159
159
  $$watchersCount: number;
160
160
  $$isolateBindings: any;
161
- /**
162
- * @type {?Scope}
163
- */
164
- $$ChildScope: Scope | null;
165
161
  /**
166
162
  * Creates a new child {@link Scope}.
167
163
  *
@@ -177,16 +173,21 @@ export class Scope {
177
173
  * When creating widgets, it is useful for the widget to not accidentally read parent
178
174
  * state.
179
175
  *
180
- * @param {?Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent`
181
- * of the newly created scope. Defaults to `this` scope if not provided.
182
- * This is used when creating a transclude scope to correctly place it
183
- * in the scope hierarchy while maintaining the correct prototypical
184
- * inheritance.
185
176
  *
186
177
  * @returns {Scope} The newly created child scope.
187
178
  *
188
179
  */
189
- $new(isolate: boolean | null, parent?: Scope | null): Scope;
180
+ $new(isolate: boolean | null): Scope;
181
+ /**
182
+ * Creates a transcluded scope
183
+ * @param {Scope} parent The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent`
184
+ * of the newly created scope. This is used when creating a transclude scope to correctly place it
185
+ * in the scope hierarchy while maintaining the correct prototypical inheritance.
186
+ *
187
+ * @returns {Scope} The newly created child scope.
188
+ *
189
+ */
190
+ $transcluded(parent: Scope): Scope;
190
191
  /**
191
192
  * Registers a `listener` callback to be executed whenever the `watchExpression` changes.
192
193
  *
@@ -239,16 +240,16 @@ export class Scope {
239
240
  });
240
241
  expect(scope.counter).toEqual(0);
241
242
 
242
- scope.$digest();
243
+ ;
243
244
  // the listener is always called during the first $digest loop after it was registered
244
245
  expect(scope.counter).toEqual(1);
245
246
 
246
- scope.$digest();
247
+ ;
247
248
  // but now it will not be called unless the value changes
248
249
  expect(scope.counter).toEqual(1);
249
250
 
250
251
  scope.name = 'adam';
251
- scope.$digest();
252
+ ;
252
253
  expect(scope.counter).toEqual(2);
253
254
 
254
255
  // Using a function as a watchExpression
@@ -270,12 +271,12 @@ export class Scope {
270
271
  expect(scope.foodCounter).toEqual(0);
271
272
 
272
273
  // Run the digest but since food has not changed count will still be zero
273
- scope.$digest();
274
+ ;
274
275
  expect(scope.foodCounter).toEqual(0);
275
276
 
276
277
  // Update food and run digest. Now the counter will increment
277
278
  food = 'cheeseburger';
278
- scope.$digest();
279
+ ;
279
280
  expect(scope.foodCounter).toEqual(1);
280
281
 
281
282
  * ```
@@ -377,16 +378,16 @@ export class Scope {
377
378
  });
378
379
  expect(scope.counter).toEqual(0);
379
380
 
380
- scope.$digest();
381
+ ;
381
382
  // the listener is always called during the first $digest loop after it was registered
382
383
  expect(scope.counter).toEqual(1);
383
384
 
384
- scope.$digest();
385
+ ;
385
386
  // but now it will not be called unless the value changes
386
387
  expect(scope.counter).toEqual(1);
387
388
 
388
389
  scope.name = 'adam';
389
- scope.$digest();
390
+ ;
390
391
  expect(scope.counter).toEqual(2);
391
392
  * ```
392
393
  *
@@ -411,7 +412,7 @@ export class Scope {
411
412
  * Some of the things to consider are:
412
413
  *
413
414
  * * Any external event on a directive/component will not trigger a digest while the hosting
414
- * scope is suspended - even if the event handler calls `$apply()` or `$rootScope.$digest()`.
415
+ * scope is suspended - even if the event handler calls `$apply()` or ``.
415
416
  * * Transcluded content exists on a scope that inherits from outside a directive but exists
416
417
  * as a child of the directive's containing scope. If the containing scope is suspended the
417
418
  * transcluded scope will also be suspended, even if the scope from which the transcluded
@@ -614,7 +615,7 @@ export class Scope {
614
615
  * @returns {*} The result of evaluating the expression.
615
616
  */
616
617
  $eval(expr?: string | ((arg0: Scope) => any), locals?: (object) | undefined): any;
617
- $$postDigest(fn: any): void;
618
+ $postUpdate(fn: any): void;
618
619
  /**
619
620
  * @private
620
621
  */
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Dynamically updates an element's content based on events published on a specified channel.
3
+ * When the directive is applied, it listens for data sent via `EventBus` and
4
+ * updates the inner HTML of the element accordingly.
5
+ *
6
+ * When the scope is destroyed, the directive automatically unsubscribes from the channel.
7
+ *
8
+ *
9
+ * @returns {import("../../types").Directive}
10
+ */
11
+ export function ngChannelDirective(): import("../../types").Directive;
@@ -75,6 +75,7 @@ export class FormController {
75
75
  * may not mean that the form is still `$dirty`.
76
76
  */
77
77
  $removeControl(control: any): void;
78
+ $setValidity: (_a: any, _b: any, _c: any) => void;
78
79
  /**
79
80
  * Sets the form to a dirty state.
80
81
  *
@@ -1,4 +1,3 @@
1
- export function forEach(obj: any, cb: any, thisArg: any): void;
2
1
  export function equals(o1: any, o2: any): any;
3
2
  /**
4
3
  * Builds proxy functions on the `to` object which pass through to the `from` object.
@@ -163,41 +163,6 @@ export function isArrayBuffer(obj: any): boolean;
163
163
  */
164
164
  export function trim(value: any): string | any;
165
165
  export function snakeCase(name: any, separator: any): any;
166
- /**
167
- * Invokes the `iterator` function once for each item in `obj` collection, which can be either an
168
- * object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value`
169
- * is the value of an object property or an array element, `key` is the object property key or
170
- * array element index and obj is the `obj` itself. Specifying a `context` for the function is optional.
171
- *
172
- * It is worth noting that `.forEach` does not iterate over inherited properties because it filters
173
- * using the `hasOwnProperty` method.
174
- *
175
- * Unlike ES262's
176
- * [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18),
177
- * providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just
178
- * return the value provided.
179
- *
180
- ```js
181
- let values = {name: 'misko', gender: 'male'};
182
- let log = [];
183
- forEach(values, function(value, key) {
184
- this.push(key + ': ' + value);
185
- }, log);
186
- expect(log).toEqual(['name: misko', 'gender: male']);
187
- ```
188
- *
189
- * @param {Object|Array} obj Object to iterate over.
190
- * @param {Function} iterator Iterator function.
191
- * @param {Object=} context Object to become context (`this`) for the iterator function.
192
- * @returns {Object|Array} Reference to `obj`.
193
- */
194
- export function forEach(obj: any | any[], iterator: Function, context?: any | undefined): any | any[];
195
- /**
196
- * when using forEach the params are value, key, but it is often useful to have key, value.
197
- * @param {function(string, *):any} iteratorFn
198
- * @returns {function(*, string)}
199
- */
200
- export function reverseParams(iteratorFn: (arg0: string, arg1: any) => any): (arg0: any, arg1: string) => any;
201
166
  /**
202
167
  * Set or clear the hashkey for an object.
203
168
  * @param obj object