@angular-wave/angular.ts 0.0.62 → 0.0.64
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/Makefile +6 -2
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/angular.spec.js +13 -27
- package/src/animations/animate-css-driver.js +1 -1
- package/src/animations/animate-queue.js +9 -0
- package/src/animations/module.js +2 -2
- package/src/binding.spec.js +6 -3
- package/src/core/animate/animate.spec.js +1 -3
- package/src/core/cache/cache-factory.spec.js +2 -2
- package/src/core/compile/compile.js +0 -33
- package/src/core/compile/compile.spec.js +64 -104
- package/src/core/controller/controller.spec.js +2 -2
- package/src/core/cookie-reader.spec.js +2 -2
- package/src/core/filter/filter.spec.js +4 -4
- package/src/core/interpolate/interpolate.spec.js +2 -2
- package/src/core/interval/interval.spec.js +10 -7
- package/src/core/location/location.js +7 -0
- package/src/core/location/location.spec.js +2 -2
- package/src/core/ng-module.js +167 -0
- package/src/core/on.spec.js +2 -2
- package/src/core/parser/lexer.spec.js +11 -8
- package/src/core/parser/parse.spec.js +11 -8
- package/src/core/prop.spec.js +47 -35
- package/src/core/q/q.spec.js +6 -6
- package/src/core/root-element.spec.js +0 -2
- package/src/core/sce/sce.spec.js +7 -6
- package/src/core/scope/scope.spec.js +11 -8
- package/src/core/timeout/timeout.spec.js +10 -7
- package/src/directive/attrs/attrs.spec.js +4 -3
- package/src/directive/attrs/boolean.spec.js +2 -2
- package/src/directive/attrs/element-style.spec.js +4 -3
- package/src/directive/attrs/src.spec.js +7 -5
- package/src/directive/bind/bind.spec.js +10 -7
- package/src/directive/bind/bing-html.spec.js +2 -2
- package/src/directive/change/change.spec.js +2 -2
- package/src/directive/class/class.spec.js +2 -2
- package/src/directive/cloak/cloak.spec.js +2 -2
- package/src/directive/controller/controller.spec.js +2 -3
- package/src/directive/events/click.spec.js +2 -2
- package/src/directive/events/event.spec.js +16 -13
- package/src/directive/form/form.spec.js +11 -9
- package/src/directive/if/if.spec.js +2 -3
- package/src/directive/include/include.spec.js +11 -10
- package/src/directive/init/init.spec.js +3 -4
- package/src/directive/input/input.spec.js +10 -7
- package/src/directive/list/list.spec.js +2 -2
- package/src/directive/model/model.spec.js +11 -11
- package/src/directive/model-options/model-options.spec.js +11 -9
- package/src/directive/non-bindable/non-bindable.spec.js +10 -7
- package/src/directive/options/options.spec.js +10 -7
- package/src/directive/ref/href.spec.js +11 -8
- package/src/directive/ref/ref.spec.js +10 -7
- package/src/directive/repeat/repeat.spec.js +11 -10
- package/src/directive/script/script.spec.js +4 -3
- package/src/directive/select/select.spec.js +10 -7
- package/src/directive/show-hide/show-hide.spec.js +4 -3
- package/src/directive/style/style.spec.js +9 -6
- package/src/directive/switch/switch.spec.js +2 -2
- package/src/directive/validators/validators.spec.js +12 -9
- package/src/exts/aria/aria.js +2 -2
- package/src/exts/aria/aria.spec.js +2 -2
- package/src/exts/messages/messages.js +2 -2
- package/src/exts/messages/messages.spec.js +2 -2
- package/src/filters/filter.spec.js +4 -3
- package/src/filters/filters.spec.js +4 -3
- package/src/filters/limit-to.spec.js +4 -3
- package/src/filters/order-by.spec.js +7 -5
- package/src/index.js +2 -8
- package/src/injector.js +7 -0
- package/src/injector.spec.js +26 -29
- package/src/loader.js +133 -1126
- package/src/loader.md +142 -0
- package/src/loader.spec.js +5 -9
- package/src/public.js +113 -107
- package/src/public.spec.js +2 -4
- package/src/router/directives/state-directives.spec.js +0 -3
- package/src/router/directives/view-directive.spec.js +0 -6
- package/src/router/index.js +2 -2
- package/src/router/services.spec.js +0 -2
- package/src/router/state/state.spec.js +2 -4
- package/src/router/state-filter.spec.js +0 -2
- package/src/router/template-factory.spec.js +0 -2
- package/src/router/url/url-service.spec.js +0 -2
- package/src/router/view/view.spec.js +1 -2
- package/src/router/view-hook.spec.js +0 -2
- package/src/router/view-scroll.spec.js +0 -3
- package/src/services/http/http.spec.js +2 -2
- package/src/services/http/template-request.spec.js +3 -3
- package/src/services/http-backend/http-backend.spec.js +3 -2
- package/src/shared/jqlite/jqlite.js +20 -29
- package/src/shared/jqlite/jqlite.md +62 -0
- package/src/shared/jqlite/jqlite.spec.js +3 -4
- package/src/shared/min-err.spec.js +1 -2
- package/src/shared/test-utils.js +1 -1
- package/src/shared/utils.js +36 -2
- package/src/types.js +3 -4
- package/types/animations/animate-css-driver.d.ts +2 -1
- package/types/animations/animate-queue.d.ts +2 -1
- package/types/animations/module.d.ts +1 -1
- package/types/core/compile/compile.d.ts +0 -1
- package/types/core/location/location.d.ts +2 -1
- package/types/core/ng-module.d.ts +57 -0
- package/types/exts/aria/aria.d.ts +1 -1
- package/types/exts/messages/messages.d.ts +1 -1
- package/types/index.d.ts +0 -3
- package/types/injector.d.ts +7 -7
- package/types/loader.d.ts +69 -267
- package/types/public.d.ts +6 -1
- package/types/router/index.d.ts +1 -1
- package/types/shared/jqlite/jqlite.d.ts +5 -5
- package/types/shared/test-utils.d.ts +3 -2
- package/types/shared/utils.d.ts +20 -1
- package/types/types.d.ts +3 -3
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { dealoc } from "../shared/jqlite/jqlite";
|
|
2
2
|
import { Angular } from "../loader";
|
|
3
|
-
import { publishExternalAPI } from "../public";
|
|
4
3
|
import { wait } from "../shared/test-utils";
|
|
5
4
|
|
|
6
5
|
describe("ngView", () => {
|
|
@@ -10,7 +9,6 @@ describe("ngView", () => {
|
|
|
10
9
|
beforeEach(() => {
|
|
11
10
|
dealoc(document.getElementById("dummy"));
|
|
12
11
|
window.angular = new Angular();
|
|
13
|
-
publishExternalAPI();
|
|
14
12
|
window.angular.module("defaultModule", ["ng.router"]);
|
|
15
13
|
let $injector = window.angular.bootstrap(
|
|
16
14
|
document.getElementById("dummy"),
|
|
@@ -48,7 +46,6 @@ describe("ngView", () => {
|
|
|
48
46
|
beforeEach(() => {
|
|
49
47
|
dealoc(document.getElementById("dummy"));
|
|
50
48
|
window.angular = new Angular();
|
|
51
|
-
publishExternalAPI();
|
|
52
49
|
let module = window.angular.module("defaultModule", ["ng.router"]);
|
|
53
50
|
module.config(($provide, $ngViewScrollProvider) => {
|
|
54
51
|
$provide.decorator("$anchorScroll", function ($delegate) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createInjector } from "../../injector";
|
|
2
2
|
import { isObject } from "../../shared/utils";
|
|
3
|
-
import {
|
|
3
|
+
import { Angular } from "../../loader";
|
|
4
4
|
|
|
5
5
|
export function getLastAjaxRequest() {
|
|
6
6
|
let ajaxEntries = performance
|
|
@@ -13,7 +13,7 @@ describe("$http", function () {
|
|
|
13
13
|
let $http, $injector, $httpBackend, requests, response, $rootScope, $q;
|
|
14
14
|
|
|
15
15
|
beforeEach(function () {
|
|
16
|
-
|
|
16
|
+
window.angular = new Angular();
|
|
17
17
|
requests = [];
|
|
18
18
|
$injector = createInjector(["ng"]);
|
|
19
19
|
$http = $injector.get("$http");
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createInjector } from "../../injector";
|
|
2
|
-
import {
|
|
2
|
+
import { Angular } from "../../loader";
|
|
3
3
|
|
|
4
4
|
describe("$templateRequest", () => {
|
|
5
|
-
let module, $rootScope, $templateRequest, $templateCache, $sce;
|
|
5
|
+
let module, $rootScope, $templateRequest, $templateCache, $sce, angular;
|
|
6
6
|
|
|
7
7
|
beforeEach(() => {
|
|
8
|
-
|
|
8
|
+
angular = window.angular = new Angular();
|
|
9
9
|
module = angular.module("test", ["ng"]);
|
|
10
10
|
let injector = createInjector(["test"]);
|
|
11
11
|
$rootScope = injector.get("$rootScope");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createInjector } from "../../injector";
|
|
2
|
-
import {
|
|
2
|
+
import { Angular } from "../../loader";
|
|
3
3
|
import { createHttpBackend } from "./http-backend";
|
|
4
4
|
import sinon from "sinon";
|
|
5
5
|
|
|
@@ -9,6 +9,7 @@ describe("$httpBackend", () => {
|
|
|
9
9
|
let xhr;
|
|
10
10
|
let callback;
|
|
11
11
|
let requests;
|
|
12
|
+
let angular;
|
|
12
13
|
|
|
13
14
|
beforeEach(() => {
|
|
14
15
|
xhr = sinon.useFakeXMLHttpRequest();
|
|
@@ -16,7 +17,7 @@ describe("$httpBackend", () => {
|
|
|
16
17
|
xhr.onCreate = function (req) {
|
|
17
18
|
requests.push(req);
|
|
18
19
|
};
|
|
19
|
-
|
|
20
|
+
angular = window.angular = new Angular();
|
|
20
21
|
let $injector = createInjector(["ng"]);
|
|
21
22
|
$browser = $injector.get("$browser");
|
|
22
23
|
xhr = sinon.useFakeXMLHttpRequest();
|
|
@@ -16,11 +16,6 @@ import {
|
|
|
16
16
|
import { CACHE, EXPANDO } from "../../core/cache/cache";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* @name angular.element
|
|
20
|
-
* @module ng
|
|
21
|
-
* @kind function
|
|
22
|
-
*
|
|
23
|
-
* @description
|
|
24
19
|
* Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element. Regardless of the presence of jQuery, `angular.element`
|
|
25
20
|
* delegates to AngularJS's built-in subset of jQuery, called "jQuery lite" or **jqLite**.
|
|
26
21
|
*
|
|
@@ -80,12 +75,6 @@ import { CACHE, EXPANDO } from "../../core/cache/cache";
|
|
|
80
75
|
* Requires {@link guide/production#disabling-debug-data Debug Data} to be enabled.
|
|
81
76
|
* - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top
|
|
82
77
|
* parent element is reached.
|
|
83
|
-
*
|
|
84
|
-
* @knownIssue You cannot spy on `angular.element` if you are using Jasmine version 1.x. See
|
|
85
|
-
* https://github.com/angular/angular.js/issues/14251 for more information.
|
|
86
|
-
*
|
|
87
|
-
* @param {string|Element} element HTML string or Element to be wrapped into jQuery.
|
|
88
|
-
* @returns {JQLite} jQuery object.
|
|
89
78
|
*/
|
|
90
79
|
|
|
91
80
|
/** @type {number} */
|
|
@@ -135,7 +124,7 @@ const BOOLEAN_ELEMENTS = {};
|
|
|
135
124
|
* JQLite both a function and an array-like data structure for manipulation of DOM, linking elements to expando cache,
|
|
136
125
|
* and execution of chain functions.
|
|
137
126
|
*
|
|
138
|
-
* @param {string|
|
|
127
|
+
* @param {string|Node|JQLite|ArrayLike<Element>|(() => void)} element
|
|
139
128
|
* @returns {JQLite}
|
|
140
129
|
*/
|
|
141
130
|
export function JQLite(element) {
|
|
@@ -553,15 +542,7 @@ JQLite.prototype.replaceWith = function (arg1) {
|
|
|
553
542
|
});
|
|
554
543
|
};
|
|
555
544
|
for (let i = 0; i < this.length; i++) {
|
|
556
|
-
|
|
557
|
-
value = fn(this[i], arg1);
|
|
558
|
-
if (isDefined(value)) {
|
|
559
|
-
// any function which returns a value needs to be wrapped
|
|
560
|
-
value = JQLite(value);
|
|
561
|
-
}
|
|
562
|
-
} else {
|
|
563
|
-
addNodes(value, fn(this[i], arg1));
|
|
564
|
-
}
|
|
545
|
+
addNodes(value, fn(this[i], arg1));
|
|
565
546
|
}
|
|
566
547
|
return isDefined(value) ? value : this;
|
|
567
548
|
};
|
|
@@ -893,6 +874,7 @@ function elementAcceptsData(node) {
|
|
|
893
874
|
* @returns {DocumentFragment}
|
|
894
875
|
*/
|
|
895
876
|
export function buildFragment(html) {
|
|
877
|
+
/** @type {HTMLDivElement} */
|
|
896
878
|
let tmp;
|
|
897
879
|
let tag;
|
|
898
880
|
let wrap;
|
|
@@ -905,6 +887,7 @@ export function buildFragment(html) {
|
|
|
905
887
|
nodes.push(document.createTextNode(html));
|
|
906
888
|
} else {
|
|
907
889
|
// Convert html into DOM nodes
|
|
890
|
+
|
|
908
891
|
tmp = tempFragment.appendChild(document.createElement("div"));
|
|
909
892
|
tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase();
|
|
910
893
|
|
|
@@ -914,13 +897,13 @@ export function buildFragment(html) {
|
|
|
914
897
|
i = wrap.length;
|
|
915
898
|
while (--i > -1) {
|
|
916
899
|
tmp.appendChild(window.document.createElement(wrap[i]));
|
|
917
|
-
tmp = tmp.firstChild;
|
|
900
|
+
tmp = /** @type {HTMLDivElement} */ (tmp.firstChild);
|
|
918
901
|
}
|
|
919
902
|
tmp.innerHTML = html;
|
|
920
903
|
|
|
921
904
|
nodes = concat(nodes, tmp.childNodes);
|
|
922
905
|
|
|
923
|
-
tmp = tempFragment.firstChild;
|
|
906
|
+
tmp = /** @type {HTMLDivElement} */ (tempFragment.firstChild);
|
|
924
907
|
tmp.textContent = "";
|
|
925
908
|
}
|
|
926
909
|
|
|
@@ -1021,7 +1004,7 @@ export function getOrSetCacheData(element, key, value) {
|
|
|
1021
1004
|
/**
|
|
1022
1005
|
* Adds nodes or elements to the root array-like object.
|
|
1023
1006
|
*
|
|
1024
|
-
* @param {
|
|
1007
|
+
* @param {JQLite} root - The array-like object to which elements will be added.
|
|
1025
1008
|
* @param {(Node|Array|NodeList|Object)} elements - The elements to add to the root. This can be a single DOM node, an array-like object (such as an Array or NodeList), or any other object.
|
|
1026
1009
|
*/
|
|
1027
1010
|
function addNodes(root, elements) {
|
|
@@ -1054,7 +1037,7 @@ function getController(element, name) {
|
|
|
1054
1037
|
|
|
1055
1038
|
/**
|
|
1056
1039
|
*
|
|
1057
|
-
* @param {
|
|
1040
|
+
* @param {Node} element
|
|
1058
1041
|
* @param {string|string[]} name
|
|
1059
1042
|
* @param {any} [value]
|
|
1060
1043
|
* @returns
|
|
@@ -1064,13 +1047,20 @@ function getInheritedData(element, name, value) {
|
|
|
1064
1047
|
// this makes $(document).scope() possible
|
|
1065
1048
|
if (element.nodeType === Node.DOCUMENT_NODE) {
|
|
1066
1049
|
// TODO Fix types
|
|
1067
|
-
element = element.documentElement;
|
|
1050
|
+
element = /** @type {Document} */ (element).documentElement;
|
|
1068
1051
|
}
|
|
1069
1052
|
const names = Array.isArray(name) ? name : [name];
|
|
1070
1053
|
|
|
1071
1054
|
while (element) {
|
|
1072
1055
|
for (let i = 0, ii = names.length; i < ii; i++) {
|
|
1073
|
-
if (
|
|
1056
|
+
if (
|
|
1057
|
+
isDefined(
|
|
1058
|
+
(value = getOrSetCacheData(
|
|
1059
|
+
/** @type {Element} */ (element),
|
|
1060
|
+
names[i],
|
|
1061
|
+
)),
|
|
1062
|
+
)
|
|
1063
|
+
)
|
|
1074
1064
|
return value;
|
|
1075
1065
|
}
|
|
1076
1066
|
|
|
@@ -1079,7 +1069,8 @@ function getInheritedData(element, name, value) {
|
|
|
1079
1069
|
// to lookup parent controllers.
|
|
1080
1070
|
element =
|
|
1081
1071
|
element.parentNode ||
|
|
1082
|
-
(element.nodeType === Node.DOCUMENT_FRAGMENT_NODE &&
|
|
1072
|
+
(element.nodeType === Node.DOCUMENT_FRAGMENT_NODE &&
|
|
1073
|
+
/** @type {ShadowRoot} */ (element).host);
|
|
1083
1074
|
}
|
|
1084
1075
|
}
|
|
1085
1076
|
|
|
@@ -1193,7 +1184,7 @@ function specialMouseHandlerWrapper(target, event, handler) {
|
|
|
1193
1184
|
export function startingTag(elementStr) {
|
|
1194
1185
|
const clone = JQLite(elementStr)[0].cloneNode(true);
|
|
1195
1186
|
const element = JQLite(clone).empty();
|
|
1196
|
-
var elemHtml = JQLite("<div></div>").append(element).html();
|
|
1187
|
+
var elemHtml = JQLite("<div></div>").append(element[0]).html();
|
|
1197
1188
|
try {
|
|
1198
1189
|
return element[0].nodeType === Node.TEXT_NODE
|
|
1199
1190
|
? lowercase(elemHtml)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/\*\*
|
|
2
|
+
|
|
3
|
+
- Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element. Regardless of the presence of jQuery, `angular.element`
|
|
4
|
+
- delegates to AngularJS's built-in subset of jQuery, called "jQuery lite" or **jqLite**.
|
|
5
|
+
-
|
|
6
|
+
- JQLite is a tiny, API-compatible subset of jQuery that allows
|
|
7
|
+
- AngularJS to manipulate the DOM in a cross-browser compatible way. JQLite implements only the most
|
|
8
|
+
- commonly needed functionality with the goal of having a very small footprint.
|
|
9
|
+
-
|
|
10
|
+
- <div class="alert alert-info">**Note:** All element references in AngularJS are always wrapped with
|
|
11
|
+
- JQLite (such as the element argument in a directive's compile / link function). They are never raw DOM references.</div>
|
|
12
|
+
-
|
|
13
|
+
- <div class="alert alert-warning">**Note:** Keep in mind that this function will not find elements
|
|
14
|
+
- by tag name / CSS selector. For lookups by tag name, try instead `angular.element(document).find(...)`
|
|
15
|
+
- or `$document.find()`, or use the standard DOM APIs, e.g. `document.querySelectorAll()`.</div>
|
|
16
|
+
-
|
|
17
|
+
- ## AngularJS's JQLite
|
|
18
|
+
- JQLite provides only the following jQuery methods:
|
|
19
|
+
-
|
|
20
|
+
- - [`after()`](http://api.jquery.com/after/)
|
|
21
|
+
- - [`append()`](http://api.jquery.com/append/) - Contrary to jQuery, this doesn't clone elements
|
|
22
|
+
- so will not work correctly when invoked on a JQLite object containing more than one DOM node
|
|
23
|
+
- - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters
|
|
24
|
+
- - [`children()`](http://api.jquery.com/children/) - Does not support selectors
|
|
25
|
+
- - [`data()`](http://api.jquery.com/data/)
|
|
26
|
+
- - [`empty()`](http://api.jquery.com/empty/)
|
|
27
|
+
- - [`eq()`](http://api.jquery.com/eq/)
|
|
28
|
+
- - [`html()`](http://api.jquery.com/html/)
|
|
29
|
+
- - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData
|
|
30
|
+
- - [`off()`](http://api.jquery.com/off/) - Does not support namespaces, selectors or event object as parameter
|
|
31
|
+
- - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors
|
|
32
|
+
- - [`prepend()`](http://api.jquery.com/prepend/)
|
|
33
|
+
- - [`remove()`](http://api.jquery.com/remove/)
|
|
34
|
+
- - [`removeData()`](http://api.jquery.com/removeData/)
|
|
35
|
+
- - [`replaceWith()`](http://api.jquery.com/replaceWith/)
|
|
36
|
+
- - [`text()`](http://api.jquery.com/text/)
|
|
37
|
+
- - [`val()`](http://api.jquery.com/val/)
|
|
38
|
+
-
|
|
39
|
+
- ## jQuery/jqLite Extras
|
|
40
|
+
- AngularJS also provides the following additional methods and events to both jQuery and JQLite:
|
|
41
|
+
-
|
|
42
|
+
- ### Events
|
|
43
|
+
- - `$destroy` - AngularJS intercepts all JQLite/jQuery's DOM destruction apis and fires this event
|
|
44
|
+
- on all DOM nodes being removed. This can be used to clean up any 3rd party bindings to the DOM
|
|
45
|
+
- element before it is removed.
|
|
46
|
+
-
|
|
47
|
+
- ### Methods
|
|
48
|
+
- - `controller(name)` - retrieves the controller of the current element or its parent. By default
|
|
49
|
+
- retrieves controller associated with the `ngController` directive. If `name` is provided as
|
|
50
|
+
- camelCase directive name, then the controller for this directive will be retrieved (e.g.
|
|
51
|
+
- `'ngModel'`).
|
|
52
|
+
- - `injector()` - retrieves the injector of the current element or its parent.
|
|
53
|
+
- - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current
|
|
54
|
+
- element or its parent. Requires {@link guide/production#disabling-debug-data Debug Data} to
|
|
55
|
+
- be enabled.
|
|
56
|
+
- - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the
|
|
57
|
+
- current element. This getter should be used only on elements that contain a directive which starts a new isolate
|
|
58
|
+
- scope. Calling `scope()` on this element always returns the original non-isolate scope.
|
|
59
|
+
- Requires {@link guide/production#disabling-debug-data Debug Data} to be enabled.
|
|
60
|
+
- - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top
|
|
61
|
+
- parent element is reached.
|
|
62
|
+
\*/
|
|
@@ -6,9 +6,8 @@ import {
|
|
|
6
6
|
getOrSetCacheData,
|
|
7
7
|
removeElementData,
|
|
8
8
|
} from "./jqlite";
|
|
9
|
-
import {
|
|
9
|
+
import { Angular } from "../../loader";
|
|
10
10
|
import { createInjector } from "../../injector";
|
|
11
|
-
import { publishExternalAPI } from "../../public";
|
|
12
11
|
import { equals, forEach } from "../../shared/utils";
|
|
13
12
|
import { browserTrigger } from "../../shared/test-utils";
|
|
14
13
|
import { CACHE, EXPANDO } from "../../core/cache/cache";
|
|
@@ -27,7 +26,7 @@ describe("jqLite", () => {
|
|
|
27
26
|
});
|
|
28
27
|
|
|
29
28
|
beforeEach(() => {
|
|
30
|
-
|
|
29
|
+
window.angular = new Angular();
|
|
31
30
|
injector = createInjector(["ng"]);
|
|
32
31
|
scope = injector.get("$rootScope");
|
|
33
32
|
jasmine.addMatchers({
|
|
@@ -363,7 +362,7 @@ describe("jqLite", () => {
|
|
|
363
362
|
it("should retrieve injector attached to the current element or its parent", () => {
|
|
364
363
|
const template = JQLite("<div><span></span></div>");
|
|
365
364
|
const span = template.children().eq(0);
|
|
366
|
-
const injector =
|
|
365
|
+
const injector = window.angular.init(template[0]);
|
|
367
366
|
|
|
368
367
|
expect(span.injector()).toBe(injector);
|
|
369
368
|
dealoc(template);
|
package/src/shared/test-utils.js
CHANGED
package/src/shared/utils.js
CHANGED
|
@@ -1101,7 +1101,41 @@ export function assertArgFn(arg, name, acceptArrayAnnotation) {
|
|
|
1101
1101
|
return arg;
|
|
1102
1102
|
}
|
|
1103
1103
|
|
|
1104
|
-
|
|
1104
|
+
/**
|
|
1105
|
+
* @typedef {Object} ErrorHandlingConfig
|
|
1106
|
+
* Error configuration object. May only contain the options that need to be updated.
|
|
1107
|
+
* @property {number=} objectMaxDepth - The max depth for stringifying objects. Setting to a
|
|
1108
|
+
* non-positive or non-numeric value removes the max depth limit. Default: 5.
|
|
1109
|
+
* @property {boolean=} urlErrorParamsEnabled - Specifies whether the generated error URL will
|
|
1110
|
+
* contain the parameters of the thrown error. Default: true. When used without argument, it returns the current value.
|
|
1111
|
+
*/
|
|
1112
|
+
|
|
1113
|
+
/** @type {ErrorHandlingConfig} */
|
|
1114
|
+
const minErrConfig = {
|
|
1115
|
+
objectMaxDepth: 5,
|
|
1116
|
+
urlErrorParamsEnabled: true,
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
* @param {ErrorHandlingConfig} [config]
|
|
1121
|
+
* @returns {ErrorHandlingConfig}
|
|
1122
|
+
*/
|
|
1123
|
+
export function errorHandlingConfig(config) {
|
|
1124
|
+
if (isObject(config)) {
|
|
1125
|
+
if (isDefined(config.objectMaxDepth)) {
|
|
1126
|
+
minErrConfig.objectMaxDepth = isValidObjectMaxDepth(config.objectMaxDepth)
|
|
1127
|
+
? config.objectMaxDepth
|
|
1128
|
+
: NaN;
|
|
1129
|
+
}
|
|
1130
|
+
if (
|
|
1131
|
+
isDefined(config.urlErrorParamsEnabled) &&
|
|
1132
|
+
isBoolean(config.urlErrorParamsEnabled)
|
|
1133
|
+
) {
|
|
1134
|
+
minErrConfig.urlErrorParamsEnabled = config.urlErrorParamsEnabled;
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
return minErrConfig;
|
|
1138
|
+
}
|
|
1105
1139
|
|
|
1106
1140
|
/**
|
|
1107
1141
|
* This object provides a utility for producing rich Error messages within
|
|
@@ -1158,7 +1192,7 @@ export function minErr(module) {
|
|
|
1158
1192
|
|
|
1159
1193
|
message += `\n${url}${module ? `${module}/` : ""}${code}`;
|
|
1160
1194
|
|
|
1161
|
-
if (
|
|
1195
|
+
if (errorHandlingConfig().urlErrorParamsEnabled) {
|
|
1162
1196
|
for (
|
|
1163
1197
|
i = 0, paramPrefix = "?";
|
|
1164
1198
|
i < templateArgs.length;
|
package/src/types.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {Object} BootstrapConfig
|
|
3
3
|
* @description Configuration option for AngularTS bootstrap process.
|
|
4
|
-
* @property {boolean} debugInfoEnabled - Indicates whether debug information should be enabled. Setting this to `false` can improve performance but will disable some debugging features.
|
|
5
4
|
* @property {boolean} [strictDi] - Disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. Defaults to `false`.
|
|
6
5
|
*/
|
|
7
6
|
|
|
@@ -451,9 +450,9 @@
|
|
|
451
450
|
* @property {function(string, string=): any} get - Get a service by name.
|
|
452
451
|
* @property {function(Function, any?): any} instantiate - Instantiate a type constructor with optional locals.
|
|
453
452
|
* @property {function(Injectable<Function | ((...args: any[]) => any)>, any=, any=): any} invoke - Invoke a function with optional context and locals.
|
|
454
|
-
* @property {function(Array<Module | string | Injectable<(...args: any[]) => void>>): void} loadNewModules - Add and load new modules to the injector.
|
|
455
|
-
* @property {Object.<string, Module>} modules - A map of all the modules loaded into the injector.
|
|
456
|
-
* @property {boolean} strictDi - Indicates if strict dependency injection is enforced.
|
|
453
|
+
* @property {function(Array<Module | string | Injectable<(...args: any[]) => void>>): void} [loadNewModules] - Add and load new modules to the injector.
|
|
454
|
+
* @property {Object.<string, Module>} [modules] - A map of all the modules loaded into the injector.
|
|
455
|
+
* @property {boolean} [strictDi] - Indicates if strict dependency injection is enforced.
|
|
457
456
|
*/
|
|
458
457
|
|
|
459
458
|
export {};
|
|
@@ -4,8 +4,9 @@ export class $$AnimateCssDriverProvider {
|
|
|
4
4
|
/**
|
|
5
5
|
* @returns {Function}
|
|
6
6
|
*/
|
|
7
|
-
$get: (string | (($animateCss: any, $$AnimateRunner: typeof import("../core/animate/animate-runner").AnimateRunner, $rootElement:
|
|
7
|
+
$get: (string | (($animateCss: any, $$AnimateRunner: typeof import("../core/animate/animate-runner").AnimateRunner, $rootElement: JQLite) => (animationDetails: any) => any))[];
|
|
8
8
|
}
|
|
9
9
|
export namespace $$AnimateCssDriverProvider {
|
|
10
10
|
let $inject: string[];
|
|
11
11
|
}
|
|
12
|
+
import { JQLite } from "../shared/jqlite/jqlite";
|
|
@@ -6,7 +6,7 @@ export class $$AnimateQueueProvider {
|
|
|
6
6
|
cancel: any[];
|
|
7
7
|
join: any[];
|
|
8
8
|
};
|
|
9
|
-
$get: (string | (($rootScope: any, $rootElement:
|
|
9
|
+
$get: (string | (($rootScope: any, $rootElement: JQLite, $$animation: any, $$AnimateRunner: any, $templateRequest: any) => {
|
|
10
10
|
on(event: any, container: any, callback: any): void;
|
|
11
11
|
off(event: any, container: any, callback: any, ...args: any[]): void;
|
|
12
12
|
pin(element: any, parentElement: any): void;
|
|
@@ -17,3 +17,4 @@ export class $$AnimateQueueProvider {
|
|
|
17
17
|
export namespace $$AnimateQueueProvider {
|
|
18
18
|
let $inject: string[];
|
|
19
19
|
}
|
|
20
|
+
import { JQLite } from "../shared/jqlite/jqlite";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function initAnimateModule(): void;
|
|
1
|
+
export function initAnimateModule(angular: any): void;
|
|
@@ -147,7 +147,6 @@ export class $CompileProvider {
|
|
|
147
147
|
* chaining otherwise.
|
|
148
148
|
*/
|
|
149
149
|
imgSrcSanitizationTrustedUrlList: (regexp?: RegExp | undefined) => RegExp | ng.ICompileProvider;
|
|
150
|
-
debugInfoEnabled: (enabled: any) => boolean | this;
|
|
151
150
|
strictComponentBindingsEnabled: (enabled: any) => boolean | this;
|
|
152
151
|
/**
|
|
153
152
|
* @ngdoc method
|
|
@@ -204,6 +204,7 @@ export class $LocationProvider {
|
|
|
204
204
|
* @param {string=} newState New history state object
|
|
205
205
|
* @param {string=} oldState History state object that was before it was changed.
|
|
206
206
|
*/
|
|
207
|
-
$get: (string | (($rootScope: any, $browser: any, $rootElement:
|
|
207
|
+
$get: (string | (($rootScope: any, $browser: any, $rootElement: JQLite) => LocationHtml5Url | LocationHashbangUrl))[];
|
|
208
208
|
}
|
|
209
209
|
export const PATH_MATCH: RegExp;
|
|
210
|
+
import { JQLite } from "../../shared/jqlite/jqlite";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export class NgModule {
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param {String} name - Name of the module
|
|
5
|
+
* @param {Array<String>} requires - List of modules which the injector will load before the current module
|
|
6
|
+
* @param {Function} [configFn]
|
|
7
|
+
*/
|
|
8
|
+
constructor(name: string, requires: Array<string>, configFn?: Function);
|
|
9
|
+
/**
|
|
10
|
+
* @type {string}
|
|
11
|
+
* Name of the module.
|
|
12
|
+
*/
|
|
13
|
+
name: string;
|
|
14
|
+
/**
|
|
15
|
+
* Holds the list of modules which the injector will load before the current module is
|
|
16
|
+
* loaded.
|
|
17
|
+
*/
|
|
18
|
+
requires: string[];
|
|
19
|
+
configFn: Function;
|
|
20
|
+
/** @type {!Array.<Array.<*>>} */
|
|
21
|
+
_invokeQueue: Array<Array<any>>;
|
|
22
|
+
/** @type {!Array.<any>} */
|
|
23
|
+
_configBlocks: Array<any>;
|
|
24
|
+
/** @type {!Array.<Function>} */
|
|
25
|
+
_runBlocks: Array<Function>;
|
|
26
|
+
/** @type {Object} */
|
|
27
|
+
infoState: any;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} value
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
info(value: any): any;
|
|
34
|
+
/**
|
|
35
|
+
* @param {String} name
|
|
36
|
+
* @param {any} object
|
|
37
|
+
* @returns {NgModule}
|
|
38
|
+
*/
|
|
39
|
+
value(name: string, object: any): NgModule;
|
|
40
|
+
/**
|
|
41
|
+
* @param {String} name
|
|
42
|
+
* @param {any} object
|
|
43
|
+
* @returns {NgModule}
|
|
44
|
+
*/
|
|
45
|
+
constant(name: string, object: any): NgModule;
|
|
46
|
+
config(configFn: any): this;
|
|
47
|
+
run(block: any): this;
|
|
48
|
+
component(name: any, options: any): this;
|
|
49
|
+
factory(name: any, providerFunction: any): this;
|
|
50
|
+
service(name: any, serviceFunction: any): this;
|
|
51
|
+
provider(name: any, providerType: any): this;
|
|
52
|
+
decorator(name: any, decorFn: any): this;
|
|
53
|
+
directive(name: any, directiveFactory: any): this;
|
|
54
|
+
animation(name: any, animationFactory: any): this;
|
|
55
|
+
filter(name: any, filterFn: any): this;
|
|
56
|
+
controller(name: any, ctlFn: any): this;
|
|
57
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function initAriaModule(): void;
|
|
1
|
+
export function initAriaModule(angular: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function initMessageModule(): void;
|
|
1
|
+
export function initMessageModule(angular: any): void;
|
package/types/index.d.ts
CHANGED
package/types/injector.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {*} modulesToLoad
|
|
4
|
+
* @param {*} strictDi
|
|
5
|
+
* @returns {import("./types").InjectorService}
|
|
6
|
+
*/
|
|
7
|
+
export function createInjector(modulesToLoad: any, strictDi: any): import("./types").InjectorService;
|
|
8
8
|
export namespace createInjector {
|
|
9
9
|
export { annotate as $$annotate };
|
|
10
10
|
}
|