@angular-wave/angular.ts 0.0.64 → 0.0.65
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/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.spec.js +2 -3
- 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/{injector.js → core/di/injector.js} +58 -45
- package/src/{injector.spec.js → core/di/injector.spec.js} +19 -6
- package/src/core/di/injector.test.js +12 -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.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.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 +6 -6
- package/src/loader.spec.js +4 -19
- package/src/public.spec.js +1 -1
- 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/types/core/di/injector.d.ts +12 -0
- package/types/core/{ng-module.d.ts → di/ng-module.d.ts} +30 -8
- package/types/loader.d.ts +5 -5
- package/types/shared/utils.d.ts +7 -1
- package/types/injector.d.ts +0 -12
- /package/src/{injector.md → core/di/injector.md} +0 -0
|
@@ -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
|
/**
|
|
@@ -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
|
@@ -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>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {Array<String|Function>} modulesToLoad
|
|
4
|
+
* @param {boolean} [strictDi]
|
|
5
|
+
* @returns {import("../../types").InjectorService}
|
|
6
|
+
*/
|
|
7
|
+
export function createInjector(modulesToLoad: Array<string | Function>, strictDi?: boolean): import("../../types").InjectorService;
|
|
8
|
+
export namespace createInjector {
|
|
9
|
+
export { annotate as $$annotate };
|
|
10
|
+
}
|
|
11
|
+
declare function annotate(fn: any, strictDi: any, name: any): any;
|
|
12
|
+
export {};
|
|
@@ -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;
|
package/types/loader.d.ts
CHANGED
|
@@ -126,14 +126,14 @@ export class Angular {
|
|
|
126
126
|
* {@link ng.directive:ngApp ngApp} or
|
|
127
127
|
* {@link angular.bootstrap} to simplify this process for you.
|
|
128
128
|
*
|
|
129
|
-
* @param {
|
|
130
|
-
* @param {
|
|
129
|
+
* @param {string} name The name of the module to create or retrieve.
|
|
130
|
+
* @param {Array.<string>} [requires] If specified then new module is being created. If
|
|
131
131
|
* unspecified then the module is being retrieved for further configuration.
|
|
132
|
-
* @param {Function
|
|
132
|
+
* @param {Function} [configFn] Optional configuration function for the module. Same as
|
|
133
133
|
* {@link import('./types').Module#config Module#config()}.
|
|
134
134
|
* @returns {NgModule} A newly registered module.
|
|
135
135
|
*/
|
|
136
|
-
module(name: string, requires?: Array<string
|
|
136
|
+
module(name: string, requires?: Array<string>, configFn?: Function): NgModule;
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* Configuration option for AngularTS bootstrap process.
|
|
@@ -144,4 +144,4 @@ export type AngularBootstrapConfig = {
|
|
|
144
144
|
*/
|
|
145
145
|
strictDi?: boolean;
|
|
146
146
|
};
|
|
147
|
-
import { NgModule } from "./core/ng-module";
|
|
147
|
+
import { NgModule } from "./core/di/ng-module";
|
package/types/shared/utils.d.ts
CHANGED
|
@@ -486,7 +486,13 @@ export function getNgAttribute(element: any, ngAttr: any): any;
|
|
|
486
486
|
*/
|
|
487
487
|
export function shallowCopy(src: any, dst: any): any;
|
|
488
488
|
/**
|
|
489
|
-
*
|
|
489
|
+
* Throw error if the argument is false
|
|
490
|
+
* @param {boolean} argument
|
|
491
|
+
* @param {string} errorMsg
|
|
492
|
+
*/
|
|
493
|
+
export function assert(argument: boolean, errorMsg?: string): void;
|
|
494
|
+
/**
|
|
495
|
+
* Throw error if the argument is falsy.
|
|
490
496
|
*/
|
|
491
497
|
export function assertArg(arg: any, name: any, reason: any): any;
|
|
492
498
|
export function assertArgFn(arg: any, name: any, acceptArrayAnnotation: any): any;
|
package/types/injector.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
export namespace createInjector {
|
|
9
|
-
export { annotate as $$annotate };
|
|
10
|
-
}
|
|
11
|
-
declare function annotate(fn: any, strictDi: any, name: any): any;
|
|
12
|
-
export {};
|
|
File without changes
|