@angular-wave/angular.ts 0.0.64 → 0.0.66
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 +2 -2
- package/package.json +1 -1
- package/public/jasmine/jasmine-5.1.2/jasmine-html.js +0 -1
- package/src/angular.spec.js +1 -1
- package/src/animations/animate-js.js +6 -0
- package/src/animations/animation.js +1 -1
- package/src/binding.spec.js +1 -1
- package/src/core/animate/animate.spec.js +1 -1
- package/src/core/cache/cache-factory.spec.js +1 -1
- package/src/core/compile/compile.js +13 -1
- package/src/core/compile/compile.spec.js +2 -3
- package/src/core/controller/controller.js +5 -0
- package/src/core/controller/controller.spec.js +1 -1
- package/src/core/cookie-reader.spec.js +1 -1
- package/src/core/di/injector.html +18 -0
- package/src/core/di/injector.js +299 -0
- package/src/{injector.md → core/di/injector.md} +3 -3
- package/src/{injector.spec.js → core/di/injector.spec.js} +49 -30
- package/src/core/di/injector.test.js +12 -0
- package/src/core/di/internal-injector.js +233 -0
- package/src/core/di/ng-module.html +18 -0
- package/src/core/{ng-module.js → di/ng-module.js} +64 -29
- package/src/core/di/ng-module.spec.js +269 -0
- package/src/core/di/ng-module.test.js +12 -0
- package/src/core/filter/filter.js +5 -0
- package/src/core/filter/filter.spec.js +1 -1
- package/src/core/interpolate/interpolate.spec.js +1 -1
- package/src/core/interval/interval.spec.js +1 -1
- package/src/core/location/location.spec.js +1 -1
- package/src/core/on.spec.js +1 -1
- package/src/core/parser/lexer.spec.js +1 -1
- package/src/core/parser/parse.spec.js +1 -1
- package/src/core/prop.spec.js +1 -1
- package/src/core/q/q.spec.js +1 -4
- package/src/core/q/q.test.js +12 -0
- package/src/core/sce/sce.js +6 -1
- package/src/core/sce/sce.spec.js +1 -1
- package/src/core/scope/scope.js +0 -1
- package/src/core/scope/scope.spec.js +1 -1
- package/src/core/timeout/timeout.spec.js +1 -1
- package/src/directive/attrs/attrs.spec.js +2 -2
- package/src/directive/attrs/boolean.spec.js +1 -1
- package/src/directive/attrs/element-style.spec.js +1 -1
- package/src/directive/attrs/src.spec.js +2 -2
- package/src/directive/bind/bind.spec.js +2 -2
- package/src/directive/bind/bing-html.spec.js +1 -1
- package/src/directive/change/change.spec.js +1 -1
- package/src/directive/class/class.spec.js +1 -1
- package/src/directive/cloak/cloak.spec.js +1 -1
- package/src/directive/controller/controller.spec.js +1 -1
- package/src/directive/events/click.spec.js +2 -2
- package/src/directive/events/event.spec.js +1 -1
- package/src/directive/form/form.spec.js +1 -1
- package/src/directive/if/if.spec.js +1 -1
- package/src/directive/include/include.spec.js +1 -1
- package/src/directive/init/init.spec.js +1 -1
- package/src/directive/input/input.spec.js +1 -2
- package/src/directive/list/list.spec.js +2 -2
- package/src/directive/model/model.spec.js +1 -1
- package/src/directive/model-options/model-options.spec.js +1 -1
- package/src/directive/non-bindable/non-bindable.spec.js +2 -2
- package/src/directive/options/options.spec.js +1 -1
- package/src/directive/ref/href.spec.js +1 -1
- package/src/directive/ref/ref.spec.js +1 -1
- package/src/directive/repeat/repeat.spec.js +1 -1
- package/src/directive/script/script.spec.js +1 -1
- package/src/directive/select/select.spec.js +1 -1
- package/src/directive/show-hide/show-hide.spec.js +1 -1
- package/src/directive/style/style.spec.js +1 -1
- package/src/directive/switch/switch.spec.js +1 -1
- package/src/directive/validators/validators.spec.js +1 -1
- package/src/exts/aria/aria.spec.js +1 -1
- package/src/exts/messages/messages.spec.js +1 -1
- package/src/filters/filter.spec.js +1 -1
- package/src/filters/filters.spec.js +1 -1
- package/src/filters/limit-to.spec.js +1 -1
- package/src/filters/order-by.spec.js +1 -1
- package/src/loader.js +7 -7
- package/src/loader.spec.js +4 -19
- package/src/public.spec.js +1 -1
- package/src/router/services.js +9 -4
- package/src/router/state/state-builder.js +4 -3
- package/src/router/state/state-registry.js +5 -0
- package/src/router/state/views.js +2 -1
- package/src/router/template-factory.js +5 -4
- package/src/services/http/http.js +12 -0
- package/src/services/http/http.spec.js +1 -1
- package/src/services/http/template-request.spec.js +1 -1
- package/src/services/http-backend/http-backend.spec.js +1 -1
- package/src/shared/jqlite/jqlite.js +0 -2
- package/src/shared/jqlite/jqlite.spec.js +1 -1
- package/src/shared/utils.js +10 -1
- package/src/src.html +0 -1
- package/src/types.js +9 -11
- package/types/animations/animate-js.d.ts +1 -1
- package/types/animations/animation.d.ts +1 -1
- package/types/core/compile/compile.d.ts +1 -1
- package/types/core/controller/controller.d.ts +1 -1
- package/types/core/di/injector.d.ts +18 -0
- package/types/core/di/internal-injector.d.ts +36 -0
- package/types/core/{ng-module.d.ts → di/ng-module.d.ts} +30 -8
- package/types/core/filter/filter.d.ts +1 -1
- package/types/core/sce/sce.d.ts +1 -1
- package/types/loader.d.ts +5 -5
- package/types/router/services.d.ts +8 -1
- package/types/router/state/state-registry.d.ts +2 -2
- package/types/router/template-factory.d.ts +2 -2
- package/types/services/http/http.d.ts +1 -1
- package/types/shared/utils.d.ts +7 -1
- package/types/types.d.ts +7 -32
- package/src/injector.js +0 -409
- package/types/injector.d.ts +0 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Angular } from "../../loader";
|
|
2
|
-
import { createInjector } from "../../injector";
|
|
2
|
+
import { createInjector } from "../../core/di/injector";
|
|
3
3
|
import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
|
|
4
4
|
import { forEach, valueFn } from "../../shared/utils";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Angular } from "../../loader";
|
|
2
|
-
import { createInjector } from "../../injector";
|
|
2
|
+
import { createInjector } from "../../core/di/injector";
|
|
3
3
|
import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
|
|
4
4
|
import { forEach, hashKey, equals, isNumberNaN } from "../../shared/utils";
|
|
5
5
|
import { browserTrigger } from "../../shared/test-utils";
|
package/src/loader.js
CHANGED
|
@@ -7,16 +7,16 @@ import {
|
|
|
7
7
|
errorHandlingConfig,
|
|
8
8
|
} from "./shared/utils";
|
|
9
9
|
import { JQLite } from "./shared/jqlite/jqlite";
|
|
10
|
-
import { createInjector } from "./injector";
|
|
10
|
+
import { createInjector } from "./core/di/injector";
|
|
11
|
+
import { NgModule } from "./core/di/ng-module";
|
|
11
12
|
import { CACHE } from "./core/cache/cache";
|
|
12
13
|
import { publishExternalAPI } from "./public";
|
|
13
|
-
import { NgModule } from "./core/ng-module";
|
|
14
14
|
import { VERSION } from "./public";
|
|
15
15
|
|
|
16
16
|
const ngMinErr = minErr("ng");
|
|
17
17
|
const $injectorMinErr = minErr("$injector");
|
|
18
18
|
|
|
19
|
-
/** @type {Object.<string,
|
|
19
|
+
/** @type {Object.<string, NgModule>} */
|
|
20
20
|
const modules = {};
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -144,7 +144,7 @@ export class Angular {
|
|
|
144
144
|
* @param {*} scope
|
|
145
145
|
* @param {JQLite} el
|
|
146
146
|
* @param {*} compile
|
|
147
|
-
* @param {
|
|
147
|
+
* @param {import("./core/di/internal-injector").InjectorService} $injector
|
|
148
148
|
*/
|
|
149
149
|
function (scope, el, compile, $injector) {
|
|
150
150
|
scope.$apply(() => {
|
|
@@ -264,10 +264,10 @@ export class Angular {
|
|
|
264
264
|
* {@link ng.directive:ngApp ngApp} or
|
|
265
265
|
* {@link angular.bootstrap} to simplify this process for you.
|
|
266
266
|
*
|
|
267
|
-
* @param {
|
|
268
|
-
* @param {
|
|
267
|
+
* @param {string} name The name of the module to create or retrieve.
|
|
268
|
+
* @param {Array.<string>} [requires] If specified then new module is being created. If
|
|
269
269
|
* unspecified then the module is being retrieved for further configuration.
|
|
270
|
-
* @param {Function
|
|
270
|
+
* @param {Function} [configFn] Optional configuration function for the module. Same as
|
|
271
271
|
* {@link import('./types').Module#config Module#config()}.
|
|
272
272
|
* @returns {NgModule} A newly registered module.
|
|
273
273
|
*/
|
package/src/loader.spec.js
CHANGED
|
@@ -1,27 +1,12 @@
|
|
|
1
1
|
import { Angular } from "./loader";
|
|
2
|
-
import { createInjector } from "./injector";
|
|
2
|
+
import { createInjector } from "./core/di/injector";
|
|
3
3
|
|
|
4
4
|
describe("module loader", () => {
|
|
5
5
|
var angular;
|
|
6
6
|
beforeEach(() => {
|
|
7
|
-
delete window.angular;
|
|
8
7
|
angular = window.angular = new Angular();
|
|
9
8
|
});
|
|
10
9
|
|
|
11
|
-
it("should set up namespace", () => {
|
|
12
|
-
expect(angular).toBeDefined();
|
|
13
|
-
expect(angular.module).toBeDefined();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("should not override existing namespace", () => {
|
|
17
|
-
const { angular } = window;
|
|
18
|
-
const { module } = angular;
|
|
19
|
-
|
|
20
|
-
window.angular = new Angular();
|
|
21
|
-
expect(angular).toBe(angular);
|
|
22
|
-
expect(angular.module).toBe(module);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
10
|
it("allows registering a module", () => {
|
|
26
11
|
const myModule = angular.module("myModule", []);
|
|
27
12
|
expect(myModule).toBeDefined();
|
|
@@ -81,7 +66,7 @@ describe("module loader", () => {
|
|
|
81
66
|
).toBe(myModule);
|
|
82
67
|
|
|
83
68
|
expect(myModule.requires).toEqual(["other"]);
|
|
84
|
-
expect(myModule.
|
|
69
|
+
expect(myModule.invokeQueue).toEqual([
|
|
85
70
|
["$provide", "constant", jasmine.objectContaining(["abc", 123])],
|
|
86
71
|
["$provide", "provider", jasmine.objectContaining(["sk", "sv"])],
|
|
87
72
|
["$provide", "factory", jasmine.objectContaining(["fk", "fv"])],
|
|
@@ -96,12 +81,12 @@ describe("module loader", () => {
|
|
|
96
81
|
jasmine.objectContaining(["ctrl", "ccc"]),
|
|
97
82
|
],
|
|
98
83
|
]);
|
|
99
|
-
expect(myModule.
|
|
84
|
+
expect(myModule.configBlocks).toEqual([
|
|
100
85
|
["$injector", "invoke", jasmine.objectContaining(["config"])],
|
|
101
86
|
["$provide", "decorator", jasmine.objectContaining(["dk", "dv"])],
|
|
102
87
|
["$injector", "invoke", jasmine.objectContaining(["init2"])],
|
|
103
88
|
]);
|
|
104
|
-
expect(myModule.
|
|
89
|
+
expect(myModule.runBlocks).toEqual(["runBlock"]);
|
|
105
90
|
});
|
|
106
91
|
|
|
107
92
|
it("should not throw error when `module.decorator` is declared before provider that it decorates", () => {
|
package/src/public.spec.js
CHANGED
package/src/router/services.js
CHANGED
|
@@ -10,8 +10,16 @@
|
|
|
10
10
|
import { services } from "./common/coreservices";
|
|
11
11
|
import { unnestR } from "../shared/common";
|
|
12
12
|
import { trace } from "./common/trace";
|
|
13
|
+
import { annotate } from "../core/di/injector";
|
|
13
14
|
|
|
14
15
|
runBlock.$inject = ["$injector", "$q", "$stateRegistry", "$urlService"];
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param {import("../core/di/internal-injector").InjectorService} $injector
|
|
19
|
+
* @param {*} $q
|
|
20
|
+
* @param {*} $stateRegistry
|
|
21
|
+
* @param {*} $urlService
|
|
22
|
+
*/
|
|
15
23
|
export function runBlock($injector, $q, $stateRegistry, $urlService) {
|
|
16
24
|
services.$injector = $injector;
|
|
17
25
|
services.$q = $q;
|
|
@@ -32,10 +40,7 @@ export function runBlock($injector, $q, $stateRegistry, $urlService) {
|
|
|
32
40
|
.filter((x) => x.deps === "deferred")
|
|
33
41
|
.forEach(
|
|
34
42
|
(resolvable) =>
|
|
35
|
-
(resolvable.deps = $injector.
|
|
36
|
-
resolvable.resolveFn,
|
|
37
|
-
$injector.strictDi,
|
|
38
|
-
)),
|
|
43
|
+
(resolvable.deps = annotate(resolvable.resolveFn, $injector.strictDi)),
|
|
39
44
|
);
|
|
40
45
|
// Start listening for url changes
|
|
41
46
|
$urlService.listen();
|
|
@@ -11,6 +11,7 @@ import { stringify } from "../../shared/strings";
|
|
|
11
11
|
import { is, pattern, pipe, prop, val } from "../../shared/hof";
|
|
12
12
|
import { Resolvable } from "../resolve/resolvable";
|
|
13
13
|
import { services } from "../common/coreservices";
|
|
14
|
+
import { annotate } from "../../core/di/injector";
|
|
14
15
|
const parseUrl = (url) => {
|
|
15
16
|
if (!isString(url)) return false;
|
|
16
17
|
const root = url.charAt(0) === "^";
|
|
@@ -145,14 +146,14 @@ export function resolvablesBuilder(state) {
|
|
|
145
146
|
policy: resolvePolicies[token],
|
|
146
147
|
}));
|
|
147
148
|
/** fetch DI annotations from a function or ng1-style array */
|
|
148
|
-
const
|
|
149
|
+
const annotateFn = (fn) => {
|
|
149
150
|
const $injector = services.$injector;
|
|
150
151
|
// ng1 doesn't have an $injector until runtime.
|
|
151
152
|
// If the $injector doesn't exist, use "deferred" literal as a
|
|
152
153
|
// marker indicating they should be annotated when runtime starts
|
|
153
154
|
return (
|
|
154
155
|
fn["$inject"] ||
|
|
155
|
-
($injector &&
|
|
156
|
+
($injector && annotate(fn, $injector.strictDi)) ||
|
|
156
157
|
"deferred"
|
|
157
158
|
);
|
|
158
159
|
};
|
|
@@ -207,7 +208,7 @@ export function resolvablesBuilder(state) {
|
|
|
207
208
|
const tuple2Resolvable = pattern([
|
|
208
209
|
[pipe(prop('val'), isString), (tuple) => new Resolvable(tuple.token, ((x) => x), [tuple.val], tuple.policy)],
|
|
209
210
|
[pipe(prop('val'), Array.isArray), (tuple) => new Resolvable(tuple.token, tail(tuple.val), tuple.val.slice(0, -1), tuple.policy)],
|
|
210
|
-
[pipe(prop('val'), isFunction), (tuple) => new Resolvable(tuple.token, tuple.val,
|
|
211
|
+
[pipe(prop('val'), isFunction), (tuple) => new Resolvable(tuple.token, tuple.val, annotateFn(tuple.val), tuple.policy)],
|
|
211
212
|
]);
|
|
212
213
|
// prettier-ignore
|
|
213
214
|
const item2Resolvable = pattern([
|
|
@@ -50,6 +50,11 @@ export class StateRegistry {
|
|
|
50
50
|
|
|
51
51
|
$get = [
|
|
52
52
|
"$injector",
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @param {import("../../core/di/internal-injector").InjectorService} $injector
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
53
58
|
($injector) => {
|
|
54
59
|
this.$injector = $injector;
|
|
55
60
|
this.builder.$injector = $injector;
|
|
@@ -5,6 +5,7 @@ import { services } from "../common/coreservices";
|
|
|
5
5
|
import { trace } from "../common/trace";
|
|
6
6
|
import { ResolveContext } from "../resolve/resolve-context";
|
|
7
7
|
import { Resolvable } from "../resolve/resolvable";
|
|
8
|
+
import { annotate } from "../../core/di/injector";
|
|
8
9
|
|
|
9
10
|
export function getNg1ViewConfigFactory() {
|
|
10
11
|
let templateFactory = null;
|
|
@@ -141,7 +142,7 @@ export class Ng1ViewConfig {
|
|
|
141
142
|
getController(context) {
|
|
142
143
|
const provider = this.viewDecl.controllerProvider;
|
|
143
144
|
if (!isInjectable(provider)) return this.viewDecl.controller;
|
|
144
|
-
const deps =
|
|
145
|
+
const deps = annotate(provider);
|
|
145
146
|
const providerFn = Array.isArray(provider) ? tail(provider) : provider;
|
|
146
147
|
const resolvable = new Resolvable("", providerFn, deps);
|
|
147
148
|
return resolvable.get(context);
|
|
@@ -3,6 +3,7 @@ import { services } from "./common/coreservices";
|
|
|
3
3
|
import { tail, unnestR } from "../shared/common";
|
|
4
4
|
import { Resolvable } from "./resolve/resolvable";
|
|
5
5
|
import { kebobString } from "../shared/strings";
|
|
6
|
+
import { annotate } from "../core/di/injector";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @typedef BindingTuple
|
|
@@ -30,7 +31,7 @@ export class TemplateFactory {
|
|
|
30
31
|
* @param {angular.ITemplateCacheService} $templateCache
|
|
31
32
|
* @param {angular.ITemplateRequestService} $templateRequest
|
|
32
33
|
* @param {angular.IQService} $q
|
|
33
|
-
* @param {
|
|
34
|
+
* @param {import("../core/di/internal-injector").InjectorService} $injector
|
|
34
35
|
* @returns
|
|
35
36
|
*/
|
|
36
37
|
($http, $templateCache, $templateRequest, $q, $injector) => {
|
|
@@ -146,7 +147,7 @@ export class TemplateFactory {
|
|
|
146
147
|
* for that string.
|
|
147
148
|
*/
|
|
148
149
|
fromProvider(provider, params, context) {
|
|
149
|
-
const deps =
|
|
150
|
+
const deps = annotate(provider);
|
|
150
151
|
const providerFn = Array.isArray(provider) ? tail(provider) : provider;
|
|
151
152
|
const resolvable = new Resolvable("", providerFn, deps);
|
|
152
153
|
return resolvable.get(context);
|
|
@@ -159,7 +160,7 @@ export class TemplateFactory {
|
|
|
159
160
|
* @return {string} The template html as a string: "<component-name input1='::$resolve.foo'></component-name>".
|
|
160
161
|
*/
|
|
161
162
|
fromComponentProvider(provider, params, context) {
|
|
162
|
-
const deps =
|
|
163
|
+
const deps = annotate(provider);
|
|
163
164
|
const providerFn = Array.isArray(provider) ? tail(provider) : provider;
|
|
164
165
|
const resolvable = new Resolvable("", providerFn, deps);
|
|
165
166
|
return resolvable.get(context);
|
|
@@ -207,7 +208,7 @@ export class TemplateFactory {
|
|
|
207
208
|
if (type === "&") {
|
|
208
209
|
const res = context.getResolvable(resolveName);
|
|
209
210
|
const fn = res && res.data;
|
|
210
|
-
const args = (fn &&
|
|
211
|
+
const args = (fn && annotate(fn)) || [];
|
|
211
212
|
// account for array style injection, i.e., ['foo', function(foo) {}]
|
|
212
213
|
const arrayIdxStr = Array.isArray(fn) ? `[${fn.length - 1}]` : "";
|
|
213
214
|
return `${attrName}='$resolve.${resolveName}${arrayIdxStr}(${args.join(",")})'`;
|
|
@@ -499,6 +499,18 @@ export function $HttpProvider() {
|
|
|
499
499
|
"$q",
|
|
500
500
|
"$injector",
|
|
501
501
|
"$sce",
|
|
502
|
+
/**
|
|
503
|
+
*
|
|
504
|
+
* @param {*} $browser
|
|
505
|
+
* @param {*} $httpBackend
|
|
506
|
+
* @param {*} $$cookieReader
|
|
507
|
+
* @param {*} $cacheFactory
|
|
508
|
+
* @param {*} $rootScope
|
|
509
|
+
* @param {*} $q
|
|
510
|
+
* @param {import("../../core/di/internal-injector").InjectorService} $injector
|
|
511
|
+
* @param {*} $sce
|
|
512
|
+
* @returns
|
|
513
|
+
*/
|
|
502
514
|
function (
|
|
503
515
|
$browser,
|
|
504
516
|
$httpBackend,
|
|
@@ -744,11 +744,9 @@ JQLite.prototype.triggerHandler = function (event, extraParameters) {
|
|
|
744
744
|
if (isUndefined(value)) {
|
|
745
745
|
value = fn(this[i], event, extraParameters);
|
|
746
746
|
if (isDefined(value)) {
|
|
747
|
-
// @ts-ignore
|
|
748
747
|
value = JQLite(value);
|
|
749
748
|
}
|
|
750
749
|
} else {
|
|
751
|
-
// @ts-ignore
|
|
752
750
|
addNodes(value, fn(this[i], event, extraParameters));
|
|
753
751
|
}
|
|
754
752
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
removeElementData,
|
|
8
8
|
} from "./jqlite";
|
|
9
9
|
import { Angular } from "../../loader";
|
|
10
|
-
import { createInjector } from "../../injector";
|
|
10
|
+
import { createInjector } from "../../core/di/injector";
|
|
11
11
|
import { equals, forEach } from "../../shared/utils";
|
|
12
12
|
import { browserTrigger } from "../../shared/test-utils";
|
|
13
13
|
import { CACHE, EXPANDO } from "../../core/cache/cache";
|
package/src/shared/utils.js
CHANGED
|
@@ -1070,7 +1070,16 @@ export function shallowCopy(src, dst) {
|
|
|
1070
1070
|
}
|
|
1071
1071
|
|
|
1072
1072
|
/**
|
|
1073
|
-
*
|
|
1073
|
+
* Throw error if the argument is false
|
|
1074
|
+
* @param {boolean} argument
|
|
1075
|
+
* @param {string} errorMsg
|
|
1076
|
+
*/
|
|
1077
|
+
export function assert(argument, errorMsg = "Assertion failed") {
|
|
1078
|
+
if (!argument) throw new Error(errorMsg);
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* Throw error if the argument is falsy.
|
|
1074
1083
|
*/
|
|
1075
1084
|
export function assertArg(arg, name, reason) {
|
|
1076
1085
|
if (!arg) {
|
package/src/src.html
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
<script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
|
|
13
13
|
<script type="module" src="/src/angular.spec.js"></script>
|
|
14
14
|
<script type="module" src="/src/binding.spec.js"></script>
|
|
15
|
-
<script type="module" src="/src/injector.spec.js"></script>
|
|
16
15
|
<script type="module" src="/src/loader.spec.js"></script>
|
|
17
16
|
<script type="module" src="/src/public.spec.js"></script>
|
|
18
17
|
</head>
|
package/src/types.js
CHANGED
|
@@ -10,6 +10,15 @@
|
|
|
10
10
|
* @template T
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @typedef {Object} Annotated
|
|
16
|
+
* @property {Array<String>} $inject
|
|
17
|
+
* *
|
|
18
|
+
* @typedef {Function & Annotated & Array<any>} AnnotatedFunction
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
|
|
13
22
|
/**
|
|
14
23
|
* @typedef {Object} ComponentOptions
|
|
15
24
|
* @description Component definition object (a simplified directive definition object)
|
|
@@ -444,15 +453,4 @@
|
|
|
444
453
|
* @property {function(any, any): IPromise<any>} [index] - Async validator function for each index.
|
|
445
454
|
*/
|
|
446
455
|
|
|
447
|
-
/**
|
|
448
|
-
* @typedef {Object} InjectorService
|
|
449
|
-
* @property {function(Function, boolean=): string[]} annotate - Annotate a function or an array of inline annotations.
|
|
450
|
-
* @property {function(string, string=): any} get - Get a service by name.
|
|
451
|
-
* @property {function(Function, any?): any} instantiate - Instantiate a type constructor with optional locals.
|
|
452
|
-
* @property {function(Injectable<Function | ((...args: any[]) => any)>, any=, any=): any} invoke - Invoke a function with optional context and locals.
|
|
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.
|
|
456
|
-
*/
|
|
457
|
-
|
|
458
456
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function $$AnimateJsProvider($animateProvider: any): void;
|
|
2
2
|
export class $$AnimateJsProvider {
|
|
3
3
|
constructor($animateProvider: any);
|
|
4
|
-
$get: (string | (($injector:
|
|
4
|
+
$get: (string | (($injector: import("../core/di/internal-injector").InjectorService, $$AnimateRunner: any) => (element: any, event: any, classes: any, options: any, ...args: any[]) => {
|
|
5
5
|
$$willAnimate: boolean;
|
|
6
6
|
end(): any;
|
|
7
7
|
start(): any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function $$AnimationProvider(): void;
|
|
2
2
|
export class $$AnimationProvider {
|
|
3
3
|
drivers: any[];
|
|
4
|
-
$get: (string | (($rootScope: any, $injector:
|
|
4
|
+
$get: (string | (($rootScope: any, $injector: import("../core/di/internal-injector").InjectorService, $$AnimateRunner: any, $$rAFScheduler: import("./raf-scheduler").RafScheduler, $$animateCache: any) => (element: any, event: any, options: any) => any))[];
|
|
5
5
|
}
|
|
@@ -161,7 +161,7 @@ export class $CompileProvider {
|
|
|
161
161
|
* @returns {object} `this` for chaining
|
|
162
162
|
*/
|
|
163
163
|
addPropertySecurityContext: (elementName: string, propertyName: string, ctx: string) => object;
|
|
164
|
-
$get: (string | (($injector:
|
|
164
|
+
$get: (string | (($injector: import("../../core/di/internal-injector").InjectorService, $interpolate: any, $exceptionHandler: any, $templateRequest: any, $parse: any, $controller: any, $rootScope: any, $sce: any, $animate: any) => ($compileNodes: string | NodeList, transcludeFn: any, maxPriority: any, ignoreDirective: any, previousCompileContext: any) => (scope: any, cloneConnectFn: any, options: any) => string | NodeList | JQLite))[];
|
|
165
165
|
}
|
|
166
166
|
export namespace $CompileProvider {
|
|
167
167
|
let $inject: string[];
|
|
@@ -28,5 +28,5 @@ export class $ControllerProvider {
|
|
|
28
28
|
* annotations in the array notation).
|
|
29
29
|
*/
|
|
30
30
|
register: (name: string | any, constructor: Function | any[]) => void;
|
|
31
|
-
$get: (string | (($injector:
|
|
31
|
+
$get: (string | (($injector: import("../../core/di/internal-injector").InjectorService) => (expression: Function | string, locals: any, later: any, ident: any) => any))[];
|
|
32
32
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {Array<String|Function>} modulesToLoad
|
|
4
|
+
* @param {boolean} [strictDi]
|
|
5
|
+
* @returns {InjectorService}
|
|
6
|
+
*/
|
|
7
|
+
export function createInjector(modulesToLoad: Array<string | Function>, strictDi?: boolean): InjectorService;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {any} fn
|
|
11
|
+
* @param {boolean} [strictDi]
|
|
12
|
+
* @param {String} [name]
|
|
13
|
+
* @returns {Array<string>}
|
|
14
|
+
*/
|
|
15
|
+
export function annotate(fn: any, strictDi?: boolean, name?: string): Array<string>;
|
|
16
|
+
/** @type {String[]} Used only for error reporting of circular dependencies*/
|
|
17
|
+
export const path: string[];
|
|
18
|
+
import { InjectorService } from "./internal-injector";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export class ProviderInjector {
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} cache
|
|
5
|
+
* @param {boolean} strictDi
|
|
6
|
+
*/
|
|
7
|
+
constructor(cache: any, strictDi: boolean);
|
|
8
|
+
cache: any;
|
|
9
|
+
strictDi: boolean;
|
|
10
|
+
path: any[];
|
|
11
|
+
providerCache: any;
|
|
12
|
+
modules: any;
|
|
13
|
+
factory(caller: any): void;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param {String} serviceName
|
|
17
|
+
* @returns {any}
|
|
18
|
+
*/
|
|
19
|
+
get(serviceName: string): any;
|
|
20
|
+
injectionArgs(fn: any, locals: any, serviceName: any): any[];
|
|
21
|
+
invoke(fn: any, self: any, locals: any, serviceName: any): any;
|
|
22
|
+
instantiate(Type: any, locals: any, serviceName: any): any;
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param {String} name
|
|
26
|
+
* @returns {boolean}
|
|
27
|
+
*/
|
|
28
|
+
has(name: string): boolean;
|
|
29
|
+
}
|
|
30
|
+
export class InjectorService extends ProviderInjector {
|
|
31
|
+
constructor(cache: any, strictDi: any, providerInjector: any);
|
|
32
|
+
strictDi: any;
|
|
33
|
+
providerInjector: any;
|
|
34
|
+
factory(serviceName: any, caller: any): any;
|
|
35
|
+
loadNewModules(): void;
|
|
36
|
+
}
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
export const PROVIDE_LITERAL: "$provide";
|
|
2
|
+
export const INJECTOR_LITERAL: "$injector";
|
|
3
|
+
export const COMPILE_LITERAL: "$compileProvider";
|
|
4
|
+
export const ANIMATION_LITERAL: "$animateProvider";
|
|
5
|
+
export const FILTER_LITERAL: "$filterProvider";
|
|
6
|
+
export const CONTROLLER_LITERAL: "$controllerProvider";
|
|
7
|
+
/**
|
|
8
|
+
* Modules are collections of application configuration information for components:
|
|
9
|
+
* controllers, directives, filters, etc. They provide recipes for the injector
|
|
10
|
+
* to do the actual instantiation. A module itself has no behaviour but only state.
|
|
11
|
+
* A such, it acts as a data structure between the Angular instance and the injector service.
|
|
12
|
+
*
|
|
13
|
+
* Since this is an internal structure that is exposed only via the Angular instance,
|
|
14
|
+
* it contains no validation of the items it receives. It is up to the instantiator on
|
|
15
|
+
* modules to do the actual validation.
|
|
16
|
+
*/
|
|
1
17
|
export class NgModule {
|
|
2
18
|
/**
|
|
3
19
|
*
|
|
@@ -16,17 +32,18 @@ export class NgModule {
|
|
|
16
32
|
* loaded.
|
|
17
33
|
*/
|
|
18
34
|
requires: string[];
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Holds a collection of tasks, required to instantiate an angular component
|
|
37
|
+
* @type {!Array<Array<*>>}
|
|
38
|
+
*/
|
|
39
|
+
invokeQueue: Array<Array<any>>;
|
|
40
|
+
/** @type {!Array<Array<*>>} */
|
|
41
|
+
configBlocks: Array<Array<any>>;
|
|
24
42
|
/** @type {!Array.<Function>} */
|
|
25
|
-
|
|
43
|
+
runBlocks: Array<Function>;
|
|
26
44
|
/** @type {Object} */
|
|
27
45
|
infoState: any;
|
|
28
46
|
/**
|
|
29
|
-
*
|
|
30
47
|
* @param {Object} value
|
|
31
48
|
* @returns
|
|
32
49
|
*/
|
|
@@ -43,7 +60,12 @@ export class NgModule {
|
|
|
43
60
|
* @returns {NgModule}
|
|
44
61
|
*/
|
|
45
62
|
constant(name: string, object: any): NgModule;
|
|
46
|
-
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* @param {Function} configFn
|
|
66
|
+
* @returns {NgModule}
|
|
67
|
+
*/
|
|
68
|
+
config(configFn: Function): NgModule;
|
|
47
69
|
run(block: any): this;
|
|
48
70
|
component(name: any, options: any): this;
|
|
49
71
|
factory(name: any, providerFunction: any): this;
|