@angular-wave/angular.ts 0.0.63 → 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.
Files changed (113) hide show
  1. package/Makefile +6 -2
  2. package/dist/angular-ts.esm.js +2 -2
  3. package/dist/angular-ts.umd.js +2 -2
  4. package/package.json +1 -1
  5. package/public/jasmine/jasmine-5.1.2/jasmine-html.js +0 -1
  6. package/src/angular.spec.js +14 -19
  7. package/src/animations/module.js +2 -2
  8. package/src/binding.spec.js +7 -4
  9. package/src/core/animate/animate.spec.js +2 -4
  10. package/src/core/cache/cache-factory.spec.js +3 -3
  11. package/src/core/compile/compile.spec.js +66 -60
  12. package/src/core/controller/controller.spec.js +3 -3
  13. package/src/core/cookie-reader.spec.js +3 -3
  14. package/src/core/di/injector.html +18 -0
  15. package/src/{injector.js → core/di/injector.js} +58 -45
  16. package/src/{injector.spec.js → core/di/injector.spec.js} +44 -34
  17. package/src/core/di/injector.test.js +12 -0
  18. package/src/core/di/ng-module.html +18 -0
  19. package/src/core/di/ng-module.js +202 -0
  20. package/src/core/di/ng-module.spec.js +269 -0
  21. package/src/core/di/ng-module.test.js +12 -0
  22. package/src/core/filter/filter.spec.js +5 -5
  23. package/src/core/interpolate/interpolate.spec.js +3 -3
  24. package/src/core/interval/interval.spec.js +11 -8
  25. package/src/core/location/location.spec.js +3 -3
  26. package/src/core/on.spec.js +3 -3
  27. package/src/core/parser/lexer.spec.js +12 -9
  28. package/src/core/parser/parse.spec.js +12 -9
  29. package/src/core/prop.spec.js +48 -36
  30. package/src/core/q/q.spec.js +7 -10
  31. package/src/core/q/q.test.js +12 -0
  32. package/src/core/root-element.spec.js +0 -2
  33. package/src/core/sce/sce.spec.js +8 -7
  34. package/src/core/scope/scope.js +0 -1
  35. package/src/core/scope/scope.spec.js +12 -9
  36. package/src/core/timeout/timeout.spec.js +11 -8
  37. package/src/directive/attrs/attrs.spec.js +6 -5
  38. package/src/directive/attrs/boolean.spec.js +3 -3
  39. package/src/directive/attrs/element-style.spec.js +5 -4
  40. package/src/directive/attrs/src.spec.js +9 -7
  41. package/src/directive/bind/bind.spec.js +12 -9
  42. package/src/directive/bind/bing-html.spec.js +3 -3
  43. package/src/directive/change/change.spec.js +3 -3
  44. package/src/directive/class/class.spec.js +3 -3
  45. package/src/directive/cloak/cloak.spec.js +3 -3
  46. package/src/directive/controller/controller.spec.js +3 -4
  47. package/src/directive/events/click.spec.js +4 -4
  48. package/src/directive/events/event.spec.js +16 -13
  49. package/src/directive/form/form.spec.js +12 -10
  50. package/src/directive/if/if.spec.js +2 -3
  51. package/src/directive/include/include.spec.js +12 -11
  52. package/src/directive/init/init.spec.js +3 -4
  53. package/src/directive/input/input.spec.js +11 -9
  54. package/src/directive/list/list.spec.js +4 -4
  55. package/src/directive/model/model.spec.js +12 -12
  56. package/src/directive/model-options/model-options.spec.js +12 -10
  57. package/src/directive/non-bindable/non-bindable.spec.js +12 -9
  58. package/src/directive/options/options.spec.js +11 -8
  59. package/src/directive/ref/href.spec.js +12 -9
  60. package/src/directive/ref/ref.spec.js +11 -8
  61. package/src/directive/repeat/repeat.spec.js +12 -11
  62. package/src/directive/script/script.spec.js +5 -4
  63. package/src/directive/select/select.spec.js +11 -8
  64. package/src/directive/show-hide/show-hide.spec.js +5 -4
  65. package/src/directive/style/style.spec.js +10 -7
  66. package/src/directive/switch/switch.spec.js +3 -3
  67. package/src/directive/validators/validators.spec.js +13 -10
  68. package/src/exts/aria/aria.js +2 -2
  69. package/src/exts/aria/aria.spec.js +3 -3
  70. package/src/exts/messages/messages.js +2 -2
  71. package/src/exts/messages/messages.spec.js +3 -3
  72. package/src/filters/filter.spec.js +5 -4
  73. package/src/filters/filters.spec.js +5 -4
  74. package/src/filters/limit-to.spec.js +5 -4
  75. package/src/filters/order-by.spec.js +8 -6
  76. package/src/index.js +2 -8
  77. package/src/loader.js +107 -539
  78. package/src/loader.md +142 -0
  79. package/src/loader.spec.js +8 -27
  80. package/src/public.js +113 -107
  81. package/src/public.spec.js +3 -5
  82. package/src/router/directives/state-directives.spec.js +0 -3
  83. package/src/router/directives/view-directive.spec.js +0 -6
  84. package/src/router/index.js +2 -2
  85. package/src/router/services.spec.js +0 -2
  86. package/src/router/state/state.spec.js +2 -4
  87. package/src/router/state-filter.spec.js +0 -2
  88. package/src/router/template-factory.spec.js +0 -2
  89. package/src/router/url/url-service.spec.js +0 -2
  90. package/src/router/view/view.spec.js +1 -2
  91. package/src/router/view-hook.spec.js +0 -2
  92. package/src/router/view-scroll.spec.js +0 -3
  93. package/src/services/http/http.spec.js +3 -3
  94. package/src/services/http/template-request.spec.js +4 -4
  95. package/src/services/http-backend/http-backend.spec.js +4 -3
  96. package/src/shared/jqlite/jqlite.js +0 -2
  97. package/src/shared/jqlite/jqlite.spec.js +4 -5
  98. package/src/shared/test-utils.js +1 -1
  99. package/src/shared/utils.js +10 -1
  100. package/src/src.html +0 -1
  101. package/types/animations/module.d.ts +1 -1
  102. package/types/core/di/injector.d.ts +12 -0
  103. package/types/core/di/ng-module.d.ts +79 -0
  104. package/types/exts/aria/aria.d.ts +1 -1
  105. package/types/exts/messages/messages.d.ts +1 -1
  106. package/types/index.d.ts +0 -3
  107. package/types/loader.d.ts +53 -179
  108. package/types/public.d.ts +6 -1
  109. package/types/router/index.d.ts +1 -1
  110. package/types/shared/test-utils.d.ts +3 -2
  111. package/types/shared/utils.d.ts +7 -1
  112. package/types/injector.d.ts +0 -12
  113. /package/src/{injector.md → core/di/injector.md} +0 -0
@@ -1,6 +1,5 @@
1
1
  import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
2
2
  import { Angular } from "../../loader";
3
- import { publishExternalAPI } from "../../public";
4
3
  import { curry } from "../../shared/hof";
5
4
  import { StateMatcher } from "../../router/state/state-matcher";
6
5
  import { StateBuilder } from "../../router/state/state-builder";
@@ -29,7 +28,7 @@ describe("view", () => {
29
28
  beforeEach(() => {
30
29
  dealoc(document.getElementById("dummy"));
31
30
  window.angular = new Angular();
32
- publishExternalAPI();
31
+ window.angular = new Angular();
33
32
 
34
33
  window.angular
35
34
  .module("defaultModule", ["ng.router"])
@@ -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("view hooks", () => {
@@ -23,7 +22,6 @@ describe("view hooks", () => {
23
22
  beforeEach(() => {
24
23
  dealoc(document.getElementById("dummy"));
25
24
  window.angular = new Angular();
26
- publishExternalAPI();
27
25
  app = window.angular
28
26
  .module("defaultModule", ["ng.router"])
29
27
  .config(($stateProvider) => {
@@ -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
- import { createInjector } from "../../injector";
1
+ import { createInjector } from "../../core/di/injector";
2
2
  import { isObject } from "../../shared/utils";
3
- import { publishExternalAPI } from "../../public";
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
- publishExternalAPI();
16
+ window.angular = new Angular();
17
17
  requests = [];
18
18
  $injector = createInjector(["ng"]);
19
19
  $http = $injector.get("$http");
@@ -1,11 +1,11 @@
1
- import { createInjector } from "../../injector";
2
- import { publishExternalAPI } from "../../public";
1
+ import { createInjector } from "../../core/di/injector";
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
- publishExternalAPI();
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
- import { createInjector } from "../../injector";
2
- import { publishExternalAPI } from "../../public";
1
+ import { createInjector } from "../../core/di/injector";
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
- publishExternalAPI();
20
+ angular = window.angular = new Angular();
20
21
  let $injector = createInjector(["ng"]);
21
22
  $browser = $injector.get("$browser");
22
23
  xhr = sinon.useFakeXMLHttpRequest();
@@ -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
  }
@@ -6,9 +6,8 @@ import {
6
6
  getOrSetCacheData,
7
7
  removeElementData,
8
8
  } from "./jqlite";
9
- import { angularInit } from "../../loader";
10
- import { createInjector } from "../../injector";
11
- import { publishExternalAPI } from "../../public";
9
+ import { Angular } from "../../loader";
10
+ import { createInjector } from "../../core/di/injector";
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
- publishExternalAPI();
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 = angularInit(template[0]);
365
+ const injector = window.angular.init(template[0]);
367
366
 
368
367
  expect(span.injector()).toBe(injector);
369
368
  dealoc(template);
@@ -1,7 +1,7 @@
1
1
  import { JQLite } from "./jqlite/jqlite";
2
2
 
3
3
  /**
4
- * @param {HTMLElement} element
4
+ * @param {HTMLElement|JQLite} element
5
5
  * @param {string} event
6
6
  */
7
7
  export function browserTrigger(element, event) {
@@ -1070,7 +1070,16 @@ export function shallowCopy(src, dst) {
1070
1070
  }
1071
1071
 
1072
1072
  /**
1073
- * throw error if the argument is falsy.
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>
@@ -1 +1 @@
1
- export function initAnimateModule(): void;
1
+ export function initAnimateModule(angular: any): void;
@@ -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 {};
@@ -0,0 +1,79 @@
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
+ */
17
+ export class NgModule {
18
+ /**
19
+ *
20
+ * @param {String} name - Name of the module
21
+ * @param {Array<String>} requires - List of modules which the injector will load before the current module
22
+ * @param {Function} [configFn]
23
+ */
24
+ constructor(name: string, requires: Array<string>, configFn?: Function);
25
+ /**
26
+ * @type {string}
27
+ * Name of the module.
28
+ */
29
+ name: string;
30
+ /**
31
+ * Holds the list of modules which the injector will load before the current module is
32
+ * loaded.
33
+ */
34
+ requires: string[];
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>>;
42
+ /** @type {!Array.<Function>} */
43
+ runBlocks: Array<Function>;
44
+ /** @type {Object} */
45
+ infoState: any;
46
+ /**
47
+ * @param {Object} value
48
+ * @returns
49
+ */
50
+ info(value: any): any;
51
+ /**
52
+ * @param {String} name
53
+ * @param {any} object
54
+ * @returns {NgModule}
55
+ */
56
+ value(name: string, object: any): NgModule;
57
+ /**
58
+ * @param {String} name
59
+ * @param {any} object
60
+ * @returns {NgModule}
61
+ */
62
+ constant(name: string, object: any): NgModule;
63
+ /**
64
+ *
65
+ * @param {Function} configFn
66
+ * @returns {NgModule}
67
+ */
68
+ config(configFn: Function): NgModule;
69
+ run(block: any): this;
70
+ component(name: any, options: any): this;
71
+ factory(name: any, providerFunction: any): this;
72
+ service(name: any, serviceFunction: any): this;
73
+ provider(name: any, providerType: any): this;
74
+ decorator(name: any, decorFn: any): this;
75
+ directive(name: any, directiveFactory: any): this;
76
+ animation(name: any, animationFactory: any): this;
77
+ filter(name: any, filterFn: any): this;
78
+ controller(name: any, ctlFn: any): this;
79
+ }
@@ -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
@@ -1,5 +1,2 @@
1
- /**
2
- * @type {Angular}
3
- */
4
1
  export const angular: Angular;
5
2
  import { Angular } from "./loader";
package/types/loader.d.ts CHANGED
@@ -1,170 +1,9 @@
1
- /**
2
- * @ngdoc directive
3
- * @name ngApp
4
- *
5
- * @element ANY
6
- * @param {import('./types').Module} ngApp an optional application
7
- * {@link angular.module module} name to load.
8
- * @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be
9
- * created in "strict-di" mode. This means that the application will fail to invoke functions which
10
- * do not use explicit function annotation (and are thus unsuitable for minification), as described
11
- * in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in
12
- * tracking down the root of these bugs.
13
- *
14
- * @description
15
- *
16
- * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive
17
- * designates the **root element** of the application and is typically placed near the root element
18
- * of the page - e.g. on the `<body>` or `<html>` tags.
19
- *
20
- * There are a few things to keep in mind when using `ngApp`:
21
- * - only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp`
22
- * found in the document will be used to define the root element to auto-bootstrap as an
23
- * application. To run multiple applications in an HTML document you must manually bootstrap them using
24
- * {@link angular.bootstrap} instead.
25
- * - AngularJS applications cannot be nested within each other.
26
- * - Do not use a directive that uses {@link ng.$compile#transclusion transclusion} on the same element as `ngApp`.
27
- * This includes directives such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and
28
- * {@link ngRoute.ngView `ngView`}.
29
- * Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},
30
- * causing animations to stop working and making the injector inaccessible from outside the app.
31
- *
32
- * You can specify an **AngularJS module** to be used as the root module for the application. This
33
- * module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It
34
- * should contain the application code needed or have dependencies on other modules that will
35
- * contain the code. See {@link angular.module} for more information.
36
- *
37
- * In the example below if the `ngApp` directive were not placed on the `html` element then the
38
- * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`
39
- * would not be resolved to `3`.
40
- *
41
- * @example
42
- *
43
- * ### Simple Usage
44
- *
45
- * `ngApp` is the easiest, and most common way to bootstrap an application.
46
- *
47
- <example module="ngAppDemo" name="ng-app">
48
- <file name="index.html">
49
- <div ng-controller="ngAppDemoController">
50
- I can add: {{a}} + {{b}} = {{ a+b }}
51
- </div>
52
- </file>
53
- <file name="script.js">
54
- angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {
55
- $scope.a = 1;
56
- $scope.b = 2;
57
- });
58
- </file>
59
- </example>
60
- *
61
- * @example
62
- *
63
- * ### With `ngStrictDi`
64
- *
65
- * Using `ngStrictDi`, you would see something like this:
66
- *
67
- <example ng-app-included="true" name="strict-di">
68
- <file name="index.html">
69
- <div ng-app="ngAppStrictDemo" ng-strict-di>
70
- <div ng-controller="GoodController1">
71
- I can add: {{a}} + {{b}} = {{ a+b }}
72
-
73
- <p>This renders because the controller does not fail to
74
- instantiate, by using explicit annotation style (see
75
- script.js for details)
76
- </p>
77
- </div>
78
-
79
- <div ng-controller="GoodController2">
80
- Name: <input ng-model="name"><br />
81
- Hello, {{name}}!
82
-
83
- <p>This renders because the controller does not fail to
84
- instantiate, by using explicit annotation style
85
- (see script.js for details)
86
- </p>
87
- </div>
88
-
89
- <div ng-controller="BadController">
90
- I can add: {{a}} + {{b}} = {{ a+b }}
91
-
92
- <p>The controller could not be instantiated, due to relying
93
- on automatic function annotations (which are disabled in
94
- strict mode). As such, the content of this section is not
95
- interpolated, and there should be an error in your web console.
96
- </p>
97
- </div>
98
- </div>
99
- </file>
100
- <file name="script.js">
101
- angular.module('ngAppStrictDemo', [])
102
- // BadController will fail to instantiate, due to relying on automatic function annotation,
103
- // rather than an explicit annotation
104
- .controller('BadController', function($scope) {
105
- $scope.a = 1;
106
- $scope.b = 2;
107
- })
108
- // Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated,
109
- // due to using explicit annotations using the array style and $inject property, respectively.
110
- .controller('GoodController1', ['$scope', function($scope) {
111
- $scope.a = 1;
112
- $scope.b = 2;
113
- }])
114
- .controller('GoodController2', GoodController2);
115
- function GoodController2($scope) {
116
- $scope.name = 'World';
117
- }
118
- GoodController2.$inject = ['$scope'];
119
- </file>
120
- <file name="style.css">
121
- div[ng-controller] {
122
- margin-bottom: 1em;
123
- -webkit-border-radius: 4px;
124
- border-radius: 4px;
125
- border: 1px solid;
126
- padding: .5em;
127
- }
128
- div[ng-controller^=Good] {
129
- border-color: #d6e9c6;
130
- background-color: #dff0d8;
131
- color: #3c763d;
132
- }
133
- div[ng-controller^=Bad] {
134
- border-color: #ebccd1;
135
- background-color: #f2dede;
136
- color: #a94442;
137
- margin-bottom: 0;
138
- }
139
- </file>
140
- </example>
141
- */
142
- /**
143
- * @param {Element|Document} element
144
- */
145
- export function angularInit(element: Element | Document): void;
146
- /**
147
- * @ngdoc type
148
- * @name import('./types').Module
149
- * @module ng
150
- * @description
151
- *
152
- * Interface for configuring AngularJS {@link angular.module modules}.
153
- */
154
- export function setupModuleLoader(window: any): any;
155
- /**
156
- * @type {string} `version` from `package.json`, injected by Rollup plugin
157
- */
158
- export const VERSION: string;
159
1
  /**
160
2
  * Configuration option for AngularTS bootstrap process.
161
3
  *
162
4
  * @typedef {Object} AngularBootstrapConfig
163
5
  * @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`.
164
6
  */
165
- /**
166
- * @class
167
- */
168
7
  export class Angular {
169
8
  /** @type {Map<number, import("./core/cache/cache").ExpandoStore>} */
170
9
  cache: Map<number, import("./core/cache/cache").ExpandoStore>;
@@ -189,18 +28,11 @@ export class Angular {
189
28
  /**
190
29
  * Use this function to manually start up AngularJS application.
191
30
  *
192
- * For more information, see the {@link guide/bootstrap Bootstrap guide}.
193
- *
194
31
  * AngularJS will detect if it has been loaded into the browser more than once and only allow the
195
32
  * first loaded script to be bootstrapped and will report a warning to the browser console for
196
33
  * each of the subsequent scripts. This prevents strange results in applications, where otherwise
197
34
  * multiple instances of AngularJS try to work on the DOM.
198
- *
199
- * <div class="alert alert-warning">
200
- * **Note:** Protractor based end-to-end tests cannot use this function to bootstrap manually.
201
- * They must use {@link ng.directive:ngApp ngApp}.
202
- * </div>
203
- *
35
+ * *
204
36
  * <div class="alert alert-warning">
205
37
  * **Note:** Do not bootstrap the app on an element with a directive that uses {@link ng.$compile#transclusion transclusion},
206
38
  * such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and {@link ngRoute.ngView `ngView`}.
@@ -251,16 +83,57 @@ export class Angular {
251
83
  */
252
84
  injector(modules: any[], strictDi: boolean | null): import("./types").InjectorService;
253
85
  /**
254
- * @module angular
255
- * @function reloadWithDebugInfo
256
-
257
- * @description
258
- * Use this function to reload the current application with debug information turned on.
259
- * This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`.
260
- *
261
- * See {@link ng.$compileProvider#debugInfoEnabled} for more.
262
- */
263
- reloadWithDebugInfo(): void;
86
+ * @param {Element|Document} element
87
+ */
88
+ init(element: Element | Document): void;
89
+ /**
90
+ *
91
+ * The `angular.module` is a global place for creating, registering and retrieving AngularJS
92
+ * modules.
93
+ * All modules (AngularJS core or 3rd party) that should be available to an application must be
94
+ * registered using this mechanism.
95
+ *
96
+ * Passing one argument retrieves an existing {@link import('./types').Module},
97
+ * whereas passing more than one argument creates a new {@link import('./types').Module}
98
+ *
99
+ *
100
+ * # Module
101
+ *
102
+ * A module is a collection of services, directives, controllers, filters, and configuration information.
103
+ * `angular.module` is used to configure the {@link auto.$injector $injector}.
104
+ *
105
+ * ```js
106
+ * // Create a new module
107
+ * let myModule = angular.module('myModule', []);
108
+ *
109
+ * // register a new service
110
+ * myModule.value('appName', 'MyCoolApp');
111
+ *
112
+ * // configure existing services inside initialization blocks.
113
+ * myModule.config(['$locationProvider', function($locationProvider) {
114
+ * // Configure existing providers
115
+ * $locationProvider.hashPrefix('!');
116
+ * }]);
117
+ * ```
118
+ *
119
+ * Then you can create an injector and load your modules like this:
120
+ *
121
+ * ```js
122
+ * let injector = angular.injector(['ng', 'myModule'])
123
+ * ```
124
+ *
125
+ * However it's more likely that you'll just use
126
+ * {@link ng.directive:ngApp ngApp} or
127
+ * {@link angular.bootstrap} to simplify this process for you.
128
+ *
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
+ * unspecified then the module is being retrieved for further configuration.
132
+ * @param {Function} [configFn] Optional configuration function for the module. Same as
133
+ * {@link import('./types').Module#config Module#config()}.
134
+ * @returns {NgModule} A newly registered module.
135
+ */
136
+ module(name: string, requires?: Array<string>, configFn?: Function): NgModule;
264
137
  }
265
138
  /**
266
139
  * Configuration option for AngularTS bootstrap process.
@@ -271,3 +144,4 @@ export type AngularBootstrapConfig = {
271
144
  */
272
145
  strictDi?: boolean;
273
146
  };
147
+ import { NgModule } from "./core/di/ng-module";
package/types/public.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  /**
2
2
  * Initializes `ng`, `animate`, `message`, `aria` and `router` modules.
3
+ * @param {import('./loader').Angular} angular
3
4
  * @returns {import('./types').Module} `ng`module
4
5
  */
5
- export function publishExternalAPI(): import("./types").Module;
6
+ export function publishExternalAPI(angular: import("./loader").Angular): import("./types").Module;
7
+ /**
8
+ * @type {string} `version` from `package.json`, injected by Rollup plugin
9
+ */
10
+ export const VERSION: string;
@@ -1 +1 @@
1
- export function initRouter(): void;
1
+ export function initRouter(angular: any): void;
@@ -1,11 +1,12 @@
1
1
  /**
2
- * @param {HTMLElement} element
2
+ * @param {HTMLElement|JQLite} element
3
3
  * @param {string} event
4
4
  */
5
- export function browserTrigger(element: HTMLElement, event: string): void;
5
+ export function browserTrigger(element: HTMLElement | JQLite, event: string): void;
6
6
  /**
7
7
  *
8
8
  * @param {number} t milliseconds to wait
9
9
  * @returns
10
10
  */
11
11
  export function wait(t: number): Promise<any>;
12
+ import { JQLite } from "./jqlite/jqlite";
@@ -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
- * throw error if the argument is falsy.
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;
@@ -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