@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.
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +12 -2
- package/index.html +74 -3
- package/package.json +7 -7
- package/src/angular.spec.js +1 -269
- package/src/animations/animate-css-driver.js +2 -2
- package/src/animations/animate-css.js +12 -21
- package/src/animations/animate-js-driver.js +1 -3
- package/src/animations/animate-js.js +4 -4
- package/src/animations/animate-queue.js +23 -23
- package/src/animations/animate-runner.js +4 -8
- package/src/animations/animate.md +1 -1
- package/src/animations/animate.spec.js +0 -21
- package/src/animations/animation.js +4 -4
- package/src/animations/shared.js +14 -12
- package/src/binding.spec.js +0 -1
- package/src/core/cache/cache.js +2 -29
- package/src/core/compile/attributes.js +2 -3
- package/src/core/compile/compile.js +260 -245
- package/src/core/compile/compile.spec.js +63 -317
- package/src/core/compile/compile.test.js +1 -1
- package/src/core/controller/controller.js +2 -0
- package/src/core/di/injector.md +1 -1
- package/src/core/di/injector.spec.js +0 -2
- package/src/core/di/internal-injector.js +2 -1
- package/src/core/interpolate/interpolate.js +16 -3
- package/src/core/interpolate/interpolate.spec.js +70 -16
- package/src/core/location/location.js +0 -2
- package/src/core/location/location.spec.js +27 -27
- package/src/core/{scope/scope.html → model/model.html} +1 -1
- package/src/core/model/model.js +944 -0
- package/src/core/model/model.spec.js +3012 -0
- package/src/core/on.spec.js +0 -7
- package/src/core/parse/interpreter.js +10 -7
- package/src/core/parse/parse.js +28 -7
- package/src/core/parse/parse.spec.js +95 -91
- package/src/core/prop.spec.js +4 -60
- package/src/core/sce/sce.js +1 -2
- package/src/core/sce/sce.spec.js +0 -8
- package/src/core/scope/scope.js +62 -32
- package/src/core/scope/scope.spec.js +25 -1960
- package/src/directive/aria/aria.js +3 -6
- package/src/directive/aria/aria.spec.js +0 -87
- package/src/directive/attrs/attrs.spec.js +0 -5
- package/src/directive/{list/list.test.js → attrs/attrs.test.js} +1 -1
- package/src/{core/q/q.html → directive/attrs/boolean.html} +1 -1
- package/src/directive/attrs/boolean.spec.js +0 -15
- package/src/{core/q/q.test.js → directive/attrs/boolean.test.js} +1 -2
- package/src/{core/timeout/timeout.html → directive/attrs/element-style.html} +4 -1
- package/src/directive/attrs/element-style.spec.js +0 -8
- package/src/{core/scope/scope.test.js → directive/attrs/element-style.test.js} +1 -2
- package/src/directive/attrs/src.spec.js +0 -7
- package/src/directive/bind/bind.spec.js +0 -33
- package/src/directive/bind/bing-html.spec.js +1 -4
- package/src/{core/interval/interval.html → directive/channel/channel.html} +1 -1
- package/src/directive/channel/channel.js +29 -0
- package/src/directive/channel/channel.spec.js +52 -0
- package/src/directive/channel/channel.test.js +9 -0
- package/src/directive/class/class.js +3 -3
- package/src/directive/class/class.spec.js +9 -75
- package/src/directive/controller/controller.spec.js +0 -13
- package/src/directive/events/click.spec.js +0 -3
- package/src/directive/events/event.spec.js +0 -6
- package/src/directive/form/form.js +14 -22
- package/src/directive/form/form.spec.js +0 -65
- package/src/directive/if/if.spec.js +2 -7
- package/src/directive/if/if.test.js +1 -2
- package/src/directive/include/include.js +2 -2
- package/src/directive/include/include.spec.js +8 -59
- package/src/directive/init/init.js +6 -2
- package/src/directive/init/init.spec.js +0 -2
- package/src/directive/input/input.js +1 -2
- package/src/directive/input/input.spec.js +191 -331
- package/src/directive/messages/messages.spec.js +4 -35
- package/src/directive/model/model.js +30 -42
- package/src/directive/model/model.spec.js +2 -49
- package/src/directive/model-options/model-options.js +22 -26
- package/src/directive/model-options/model-options.spec.js +0 -6
- package/src/directive/non-bindable/non-bindable.spec.js +0 -1
- package/src/directive/observe/observe.js +0 -1
- package/src/directive/observe/observe.spec.js +0 -1
- package/src/directive/options/options.js +1 -3
- package/src/directive/options/options.spec.js +3 -38
- package/src/directive/ref/href.spec.js +0 -15
- package/src/directive/repeat/repeat.js +2 -2
- package/src/directive/repeat/repeat.spec.js +56 -192
- package/src/directive/script/script.spec.js +0 -2
- package/src/directive/select/select.js +3 -3
- package/src/directive/select/select.spec.js +9 -106
- package/src/directive/show-hide/show-hide.js +2 -2
- package/src/directive/show-hide/show-hide.spec.js +8 -19
- package/src/directive/style/style.spec.js +0 -7
- package/src/directive/switch/switch.js +1 -2
- package/src/directive/switch/switch.spec.js +5 -5
- package/src/directive/validators/validators.spec.js +0 -1
- package/src/loader.js +0 -1
- package/src/public.js +75 -80
- package/src/router/common/coreservices.js +0 -2
- package/src/router/directives/state-directives.js +24 -30
- package/src/router/directives/state-directives.spec.js +0 -83
- package/src/router/directives/view-directive.js +6 -15
- package/src/router/directives/view-directive.spec.js +25 -71
- package/src/router/hooks/lazy-load.js +2 -2
- package/src/router/hooks/views.js +3 -5
- package/src/router/resolve/resolvable.js +3 -6
- package/src/router/resolve/resolve-context.js +2 -2
- package/src/router/state/state-service.js +4 -4
- package/src/router/state/state.spec.js +2 -5
- package/src/router/state/views.js +9 -12
- package/src/router/template-factory.js +3 -6
- package/src/router/template-factory.spec.js +0 -4
- package/src/router/transition/transition-hook.js +1 -1
- package/src/router/transition/transition.js +1 -1
- package/src/router/url/url-service.js +2 -8
- package/src/router/url/url-service.spec.js +3 -4
- package/src/router/view-hook.spec.js +2 -2
- package/src/router/view-scroll.js +4 -6
- package/src/services/http/http.js +11 -15
- package/src/services/http/http.spec.js +30 -31
- package/src/services/http/template-request.spec.js +0 -10
- package/src/services/http-backend/http-backend.js +19 -17
- package/src/services/http-backend/http-backend.spec.js +3 -3
- package/src/services/template-request.js +2 -4
- package/src/shared/common.js +6 -10
- package/src/shared/jqlite/jqlite.js +14 -15
- package/src/shared/jqlite/jqlite.spec.js +2 -2
- package/src/shared/utils.js +15 -92
- package/types/core/cache/cache.d.ts +1 -1
- package/types/core/model/model.d.ts +204 -0
- package/types/core/parse/parse.d.ts +26 -0
- package/types/core/scope/scope.d.ts +22 -21
- package/types/directive/channel/channel.d.ts +11 -0
- package/types/directive/form/form.d.ts +1 -0
- package/types/shared/common.d.ts +0 -1
- package/types/shared/utils.d.ts +0 -35
- package/src/core/interval/interval-factory.js +0 -50
- package/src/core/interval/interval.js +0 -77
- package/src/core/interval/interval.md +0 -123
- package/src/core/interval/interval.spec.js +0 -280
- package/src/core/q/q.js +0 -472
- package/src/core/q/q.md +0 -211
- package/src/core/q/q.spec.js +0 -2748
- package/src/core/timeout/timeout.js +0 -109
- package/src/core/timeout/timeout.spec.js +0 -354
- package/src/core/timeout/timout.test.js +0 -12
- package/src/directive/list/list.html +0 -18
- package/src/directive/list/list.js +0 -46
- package/src/directive/list/list.md +0 -22
- package/src/directive/list/list.spec.js +0 -172
- 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
|
-
|
|
107
|
-
value.push(`${
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
546
|
-
|
|
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(
|
|
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
|
|
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
|
-
|
|
905
|
+
[window, document].forEach((node) => {
|
|
906
906
|
expect(() => {
|
|
907
907
|
const elem = JQLite(node);
|
|
908
908
|
elem.attr("foo");
|
package/src/shared/utils.js
CHANGED
|
@@ -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
|
-
|
|
927
|
-
|
|
928
|
-
|
|
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
|
-
(
|
|
860
|
+
(value === true ? "" : `=${encodeUriQuery(value, true)}`),
|
|
932
861
|
);
|
|
933
|
-
}
|
|
934
|
-
}
|
|
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
|
|
|
@@ -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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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;
|
package/types/shared/common.d.ts
CHANGED
package/types/shared/utils.d.ts
CHANGED
|
@@ -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
|