@angular-wave/angular.ts 0.0.37 → 0.0.39

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 (191) hide show
  1. package/Makefile +6 -5
  2. package/dist/angular-ts.esm.js +2 -1
  3. package/dist/angular-ts.umd.js +1 -1
  4. package/package.json +2 -4
  5. package/rollup.config.js +5 -1
  6. package/src/binding.spec.js +4 -4
  7. package/src/core/location/location.js +1 -1
  8. package/src/core/scope/scope.js +4 -7
  9. package/src/exts/aria/aria.html +1 -4
  10. package/src/exts/messages/messages.html +1 -4
  11. package/src/index.js +307 -1
  12. package/src/loader.js +13 -6
  13. package/src/public.js +7 -2
  14. package/src/router/directives/directives.test.js +19 -0
  15. package/src/router/directives/state-directives.html +21 -0
  16. package/src/router/{state-directives.spec.js → directives/state-directives.spec.js} +2 -1
  17. package/src/router/{view-directive.spec.js → directives/view-directive.spec.js} +2 -1
  18. package/src/router/directives/view-directives.html +21 -0
  19. package/src/router/router.html +22 -0
  20. package/src/router/router.test.js +11 -0
  21. package/src/router/services.spec.js +2 -2
  22. package/src/router/{state-builder.spec.js → state/state-builder.spec.js} +9 -12
  23. package/src/router/state/state.html +22 -0
  24. package/src/router/{state.spec.js → state/state.spec.js} +1 -1
  25. package/src/router/state/state.test.js +11 -0
  26. package/src/router/state-filter.spec.js +2 -2
  27. package/src/router/template-factory.spec.js +4 -4
  28. package/src/router/url/url.html +18 -0
  29. package/src/router/url/url.test.js +11 -0
  30. package/src/router/view/view.html +18 -0
  31. package/src/router/{view.spec.js → view/view.spec.js} +1 -1
  32. package/src/router/view/view.test.js +11 -0
  33. package/src/router/view-hook.spec.js +4 -4
  34. package/src/router/view-scroll.spec.js +4 -4
  35. package/src/services/http/http.html +22 -0
  36. package/src/services/http/http.test.js +11 -0
  37. package/src/services/http-backend/http-backend.html +21 -0
  38. package/src/services/http-backend/http-backend.js +1 -1
  39. package/src/services/http-backend/http-backend.spec.js +1 -1
  40. package/src/services/http-backend/http-backend.test.js +11 -0
  41. package/src/shared/common.spec.js +4 -4
  42. package/src/shared/hof.spec.js +1 -1
  43. package/src/shared/min-err.spec.js +2 -2
  44. package/src/shared/shared.html +22 -0
  45. package/src/shared/shared.test.js +11 -0
  46. package/src/shared/test-utils.js +2 -2
  47. package/src/shared/utils.spec.js +1 -1
  48. package/src/src.html +22 -0
  49. package/src/src.test.js +10 -0
  50. package/tsconfig.json +1 -1
  51. package/tsconfig.types.json +11 -0
  52. package/types/animations/animate-cache.d.ts +7 -7
  53. package/types/animations/animate-children-directive.d.ts +3 -6
  54. package/types/animations/animate-swap.d.ts +7 -16
  55. package/types/animations/animation.d.ts +2 -11
  56. package/types/animations/raf-scheduler.d.ts +3 -3
  57. package/types/animations/shared.d.ts +8 -23
  58. package/types/core/{animate-css.d.ts → animate/animate-css.d.ts} +2 -8
  59. package/types/core/{cache.d.ts → cache/cache.d.ts} +5 -5
  60. package/types/core/compile/compile.d.ts +173 -0
  61. package/types/core/controller/controller.d.ts +32 -0
  62. package/types/core/exception-handler.d.ts +1 -1
  63. package/types/core/filter/filter.d.ts +9 -0
  64. package/types/core/{interpolate.d.ts → interpolate/interpolate.d.ts} +23 -39
  65. package/types/core/interval/interval-factory.d.ts +4 -0
  66. package/types/core/{interval.d.ts → interval/interval.d.ts} +1 -1
  67. package/types/core/location/location.d.ts +209 -0
  68. package/types/core/pubsub/pubsub.d.ts +156 -0
  69. package/types/core/q/q.d.ts +31 -0
  70. package/types/core/sanitize/sanitize-uri.d.ts +53 -0
  71. package/types/core/{sce.d.ts → sce/sce.d.ts} +80 -86
  72. package/types/core/scope/scope.d.ts +727 -0
  73. package/types/core/task-tracker-factory.d.ts +29 -29
  74. package/types/core/timeout/timeout.d.ts +20 -0
  75. package/types/core/{urlUtils.d.ts → url-utils/url-utils.d.ts} +2 -7
  76. package/types/directive/{bind.d.ts → bind/bind.d.ts} +4 -10
  77. package/types/directive/{class.d.ts → class/class.d.ts} +12 -21
  78. package/types/directive/controller/controller.d.ts +6 -0
  79. package/types/directive/events/events.d.ts +5 -0
  80. package/types/directive/form/form.d.ts +200 -0
  81. package/types/directive/if/if.d.ts +8 -0
  82. package/types/directive/include/include.d.ts +14 -0
  83. package/types/directive/{input.d.ts → input/input.d.ts} +20 -69
  84. package/types/directive/{model.d.ts → model/model.d.ts} +256 -279
  85. package/types/directive/options/options.d.ts +9 -0
  86. package/types/directive/ref/ref.d.ts +5 -0
  87. package/types/directive/repeat/repeat.d.ts +8 -0
  88. package/types/directive/{script.d.ts → script/script.d.ts} +5 -8
  89. package/types/directive/{show-hide.d.ts → show-hide/show-hide.d.ts} +10 -16
  90. package/types/directive/switch/switch.d.ts +17 -0
  91. package/types/directive/transclude/transclude.d.ts +4 -0
  92. package/types/directive/{validators.d.ts → validators/validators.d.ts} +20 -35
  93. package/types/filters/filters.d.ts +10 -16
  94. package/types/filters/order-by.d.ts +2 -4
  95. package/types/index.d.ts +117 -0
  96. package/types/injector.d.ts +12 -0
  97. package/types/public.d.ts +5 -0
  98. package/types/router/common/coreservices.d.ts +2 -2
  99. package/types/router/common/glob.d.ts +9 -9
  100. package/types/router/common/queue.d.ts +13 -13
  101. package/types/router/common/trace.d.ts +43 -43
  102. package/types/router/directives/view-directive.d.ts +13 -32
  103. package/types/router/globals.d.ts +20 -20
  104. package/types/router/hooks/lazy-load.d.ts +2 -11
  105. package/types/router/hooks/redirect-to.d.ts +1 -4
  106. package/types/router/hooks/url.d.ts +1 -5
  107. package/types/router/hooks/views.d.ts +1 -4
  108. package/types/router/params/param-factory.d.ts +5 -5
  109. package/types/router/params/param-type.d.ts +35 -35
  110. package/types/router/params/param-types.d.ts +11 -11
  111. package/types/router/params/param.d.ts +38 -38
  112. package/types/router/params/state-params.d.ts +10 -10
  113. package/types/router/path/path-node.d.ts +34 -34
  114. package/types/router/path/path-utils.d.ts +73 -77
  115. package/types/router/resolve/resolvable.d.ts +32 -32
  116. package/types/router/resolve/resolve-context.d.ts +84 -84
  117. package/types/router/services.d.ts +4 -9
  118. package/types/router/state/state-builder.d.ts +27 -27
  119. package/types/router/state/state-matcher.d.ts +5 -5
  120. package/types/router/state/state-object.d.ts +58 -58
  121. package/types/router/state/state-queue-manager.d.ts +10 -16
  122. package/types/router/state/state-registry.d.ts +100 -107
  123. package/types/router/state/state-service.d.ts +411 -411
  124. package/types/router/state/target-state.d.ts +64 -69
  125. package/types/router/state/views.d.ts +31 -37
  126. package/types/router/state-filters.d.ts +7 -7
  127. package/types/router/state-provider.d.ts +105 -105
  128. package/types/router/template-factory.d.ts +83 -112
  129. package/types/router/transition/hook-builder.d.ts +25 -25
  130. package/types/router/transition/hook-registry.d.ts +68 -83
  131. package/types/router/transition/interface.d.ts +7 -7
  132. package/types/router/transition/reject-factory.d.ts +34 -34
  133. package/types/router/transition/transition-event-type.d.ts +9 -18
  134. package/types/router/transition/transition-hook.d.ts +77 -82
  135. package/types/router/transition/transition-service.d.ts +82 -99
  136. package/types/router/transition/transition.d.ts +369 -377
  137. package/types/router/url/url-config.d.ts +84 -84
  138. package/types/router/url/url-matcher.d.ts +115 -119
  139. package/types/router/url/url-rule.d.ts +114 -124
  140. package/types/router/url/url-rules.d.ts +217 -217
  141. package/types/router/url/url-service.d.ts +264 -269
  142. package/types/router/view/view.d.ts +114 -117
  143. package/types/router/view-scroll.d.ts +2 -2
  144. package/types/services/anchor-scroll.d.ts +2 -8
  145. package/types/services/browser.d.ts +122 -130
  146. package/types/services/cache-factory.d.ts +25 -25
  147. package/types/services/cookie-reader.d.ts +2 -2
  148. package/types/services/document.d.ts +2 -2
  149. package/types/services/http/http.d.ts +145 -0
  150. package/types/services/{http-backend.d.ts → http-backend/http-backend.d.ts} +3 -35
  151. package/types/services/log.d.ts +49 -49
  152. package/types/services/template-request.d.ts +44 -53
  153. package/types/shared/common.d.ts +4 -19
  154. package/types/{constants.d.ts → shared/constants.d.ts} +6 -6
  155. package/types/shared/hof.d.ts +1 -1
  156. package/types/{jqLite.d.ts → shared/jqlite/jqlite.d.ts} +11 -11
  157. package/types/shared/test-utils.d.ts +11 -0
  158. package/types/shared/utils.d.ts +7 -24
  159. package/types-back/global.d.ts +3 -1
  160. package/types-back/index.d.ts +2 -221
  161. package/types/core/compile.d.ts +0 -206
  162. package/types/core/controller.d.ts +0 -42
  163. package/types/core/filter.d.ts +0 -9
  164. package/types/core/interval-factory.d.ts +0 -21
  165. package/types/core/location.d.ts +0 -234
  166. package/types/core/pubsub.d.ts +0 -164
  167. package/types/core/q.d.ts +0 -33
  168. package/types/core/root-scope.d.ts +0 -754
  169. package/types/core/sanitize-uri.d.ts +0 -57
  170. package/types/core/timeout.d.ts +0 -31
  171. package/types/directive/controller.d.ts +0 -6
  172. package/types/directive/events.d.ts +0 -12
  173. package/types/directive/form.d.ts +0 -230
  174. package/types/directive/if.d.ts +0 -17
  175. package/types/directive/include.d.ts +0 -33
  176. package/types/directive/options.d.ts +0 -16
  177. package/types/directive/ref.d.ts +0 -11
  178. package/types/directive/repeat.d.ts +0 -23
  179. package/types/directive/switch.d.ts +0 -23
  180. package/types/directive/transclude.d.ts +0 -15
  181. package/types/services/http.d.ts +0 -157
  182. /package/src/router/{url-service.spec.js → url/url-service.spec.js} +0 -0
  183. /package/types/directive/{attrs.d.ts → attrs/attrs.d.ts} +0 -0
  184. /package/types/directive/{change.d.ts → change/change.d.ts} +0 -0
  185. /package/types/directive/{cloak.d.ts → cloak/cloak.d.ts} +0 -0
  186. /package/types/directive/{init.d.ts → init/init.d.ts} +0 -0
  187. /package/types/directive/{list.d.ts → list/list.d.ts} +0 -0
  188. /package/types/directive/{non-bindable.d.ts → non-bindable/non-bindable.d.ts} +0 -0
  189. /package/types/directive/{style.d.ts → style/style.d.ts} +0 -0
  190. /package/types/exts/{aria.d.ts → aria/aria.d.ts} +0 -0
  191. /package/types/exts/{messages.d.ts → messages/messages.d.ts} +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@angular-wave/angular.ts",
3
3
  "license": "MIT",
4
- "version": "0.0.37",
4
+ "version": "0.0.39",
5
5
  "type": "module",
6
6
  "main": "dist/angular-ts.esm.js",
7
7
  "browser": "dist/angular-ts.umd.js",
@@ -37,11 +37,9 @@
37
37
  "playwright": "^1.44.0",
38
38
  "prettier": "latest",
39
39
  "rollup": "latest",
40
+ "rollup-plugin-version-injector": "^1.3.3",
40
41
  "sinon": "latest",
41
42
  "typescript": "latest",
42
43
  "vite": "latest"
43
- },
44
- "dependencies": {
45
-
46
44
  }
47
45
  }
package/rollup.config.js CHANGED
@@ -2,6 +2,7 @@ import resolve from '@rollup/plugin-node-resolve';
2
2
  import commonjs from '@rollup/plugin-commonjs';
3
3
  import pkg from './package.json' assert { type: 'json' };
4
4
  import terser from '@rollup/plugin-terser';
5
+ import versionInjector from 'rollup-plugin-version-injector';
5
6
 
6
7
  export default [
7
8
  // browser-friendly UMD build
@@ -25,6 +26,9 @@ export default [
25
26
  input: 'src/index.js',
26
27
  external: ['ms'],
27
28
  output: { file: pkg.main, format: 'es' },
28
- plugins: [terser()],
29
+ plugins: [
30
+ terser(),
31
+ versionInjector()
32
+ ],
29
33
  },
30
34
  ];
@@ -1,7 +1,7 @@
1
- import { jqLite, dealoc } from "../shared/jqlite/jqlite";
2
- import { publishExternalAPI } from "../public";
3
- import { createInjector } from "../injector";
4
- import { browserTrigger } from "./test-utils";
1
+ import { jqLite, dealoc } from "./shared/jqlite/jqlite";
2
+ import { publishExternalAPI } from "./public";
3
+ import { createInjector } from "./injector";
4
+ import { browserTrigger } from "./shared/test-utils";
5
5
 
6
6
  describe("binding", () => {
7
7
  let element,
@@ -1014,7 +1014,7 @@ export function $LocationProvider() {
1014
1014
  afterLocationChange(oldUrl, oldState);
1015
1015
  }
1016
1016
  });
1017
- if ($rootScope.$$phase !== ScopePhase.NONE) $rootScope.$digest();
1017
+ if ($rootScope.$$phase === ScopePhase.NONE) $rootScope.$digest();
1018
1018
  });
1019
1019
 
1020
1020
  // update browser
@@ -53,7 +53,7 @@ let applyAsyncId = null;
53
53
  /** Services required by each scope instance */
54
54
  /** @type {angular.IParseService} */
55
55
  let $parse;
56
- /** @type {import('../services/browser').Browser} */
56
+ /** @type {import('../../services/browser').Browser} */
57
57
  let $browser;
58
58
  /** @type {angular.IExceptionHandlerService} */
59
59
  let $exceptionHandler;
@@ -123,10 +123,7 @@ export class $RootScopeProvider {
123
123
  * to construct.
124
124
  */
125
125
 
126
- /**
127
- * @type {angular.Scope}
128
- */
129
- class Scope {
126
+ export class Scope {
130
127
  constructor() {
131
128
  /**
132
129
  * @type {number} Unique scope ID (monotonically increasing) useful for debugging.
@@ -142,7 +139,7 @@ class Scope {
142
139
  this.$parent = null;
143
140
 
144
141
  /**
145
- * @type {?angular.Scope}
142
+ * @type {?Scope}
146
143
  */
147
144
  this.$root = this;
148
145
 
@@ -377,7 +374,7 @@ class Scope {
377
374
  *
378
375
  * - `string`: Evaluated as {@link guide/expression expression}
379
376
  * - `function(scope)`: called with current `scope` as a parameter.
380
- * @param {(newVal: any, oldVal: any, scope: angular.Scope) => any} listener Callback called whenever the value
377
+ * @param {(newVal: any, oldVal: any, scope: Scope) => any} listener Callback called whenever the value
381
378
  * of `watchExpression` changes.
382
379
  *
383
380
  * - `newVal` contains the current value of the `watchExpression`
@@ -10,10 +10,7 @@
10
10
  <script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
11
11
  <script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
12
12
  <script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
13
- <script
14
- type="module"
15
- src="/src/exts/aria/aria.spec.js"
16
- ></script>
13
+ <script type="module" src="/src/exts/aria/aria.spec.js"></script>
17
14
  </head>
18
15
  <body>
19
16
  <div id="dummy"></div>
@@ -10,10 +10,7 @@
10
10
  <script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
11
11
  <script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
12
12
  <script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
13
- <script
14
- type="module"
15
- src="/src/exts/messages/messages.spec.js"
16
- ></script>
13
+ <script type="module" src="/src/exts/messages/messages.spec.js"></script>
17
14
  </head>
18
15
  <body>
19
16
  <div id="dummy"></div>
package/src/index.js CHANGED
@@ -2,7 +2,313 @@ import { Angular, angularInit } from "./loader";
2
2
  import { publishExternalAPI } from "./public";
3
3
 
4
4
  /**
5
- * @type {angular.IAngularStatic}
5
+ * @typedef {Object} angular.BootstrapConfig
6
+ * @description Configuration option for AngularTS bootstrap process.
7
+ * @property {boolean} debugInfoEnabled - Indicates whether debug information should be enabled. Setting this to `false` can improve performance but will disable some debugging features.
8
+ * @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`.
9
+ */
10
+
11
+ /**
12
+ * @typedef {Function|Array<string|Function>} angular.Injectable
13
+ * @description Represents a type that can be injected, either as a function or an array of strings/functions.
14
+ * @template T
15
+ */
16
+
17
+ /**
18
+ * @typedef {Object} angular.ComponentOptions
19
+ * @description Component definition object (a simplified directive definition object)
20
+ * @property {string | angular.angular.Injectable<angular.ControllerConstructor>> | undefined} [controller]
21
+ * Controller constructor function or name of a registered controller.
22
+ * Use array form for dependencies (necessary with strictDi).
23
+ * @property {string | undefined} [controllerAs]
24
+ * Identifier name for the controller published to its scope (default: '$ctrl').
25
+ * @property {string | angular.angular.Injectable<(...args: any[]) => string> | undefined} [template]
26
+ * HTML template string or function returning an HTML template.
27
+ * If a function, injects $element and $attrs.
28
+ * Use array form for dependencies (necessary with strictDi).
29
+ * @property {string | angular.angular.Injectable<(...args: any[]) => string> | undefined} [templateUrl]
30
+ * Path or function returning a path to an HTML template.
31
+ * If a function, injects $element and $attrs.
32
+ * Use array form for dependencies (necessary with strictDi).
33
+ * @property {{ [boundProperty: string]: string } | undefined} [bindings]
34
+ * DOM attribute bindings to component properties.
35
+ * Component properties are bound to the controller, not the scope.
36
+ * @property {boolean | { [slot: string]: string } | undefined} [transclude]
37
+ * Whether transclusion is enabled. Disabled by default.
38
+ * @property {{ [controller: string]: string } | undefined} [require]
39
+ * Requires controllers of other directives, binding them to this component's controller.
40
+ * Keys specify property names under which required controllers (object values) are bound.
41
+ * Required controllers available before $onInit method execution.
42
+ */
43
+
44
+ /**
45
+ * @typedef {Function} angular.ControllerConstructor
46
+ * @description Controller constructor type for AngularJS. Note: Instead of classes, plain functions are often used as controller constructors, especially in examples.
47
+ * @param {...any} args Arguments passed to the controller constructor.
48
+ * @returns {void | angular.Controller} Returns nothing or an instance of IController.
49
+ */
50
+
51
+ /**
52
+ * @typedef {Object} angular.OnChangesObject
53
+ * @description Object representing changes in one-way bound properties.
54
+ * Keys are the names of the bound properties that have changed, and values are instances of IChangesObject.
55
+ * @property {angular.ChangesObject<any>} property - Represents a changed property.
56
+ */
57
+
58
+ /**
59
+ * @typedef {Object} angular.ChangesObject
60
+ * @description Object representing changes in a property.
61
+ * @property {*} currentValue - Current value of the property.
62
+ * @property {*} previousValue - Previous value of the property.
63
+ * @property {function(): boolean} isFirstChange - Function to check if it's the first change of the property.
64
+ */
65
+
66
+ /**
67
+ * @typedef {Object} angular.Controller
68
+ * @description Interface representing the lifecycle hooks for AngularJS directive controllers.
69
+ * @see {@link https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks}
70
+ * @see {@link https://docs.angularjs.org/guide/component}
71
+ *
72
+ * @property {function(): void} [$onInit]
73
+ * Called on each controller after all the controllers on an element have been constructed and had their bindings
74
+ * initialized (and before the pre & post linking functions for the directives on this element). This is a good
75
+ * place to put initialization code for your controller.
76
+ *
77
+ * @property {function(): void} [$doCheck]
78
+ * Called on each turn of the digest cycle. Provides an opportunity to detect and act on changes.
79
+ * Any actions that you wish to take in response to the changes that you detect must be invoked from this hook;
80
+ * implementing this has no effect on when `$onChanges` is called. For example, this hook could be useful if you wish
81
+ * to perform a deep equality check, or to check a `Date` object, changes to which would not be detected by Angular's
82
+ * change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments; if detecting changes,
83
+ * you must store the previous value(s) for comparison to the current values.
84
+ *
85
+ * @property {function(angular.OnChangesObject): void} [$onChanges]
86
+ * Called whenever one-way bindings are updated. The onChangesObj is a hash whose keys are the names of the bound
87
+ * properties that have changed, and the values are an {@link IChangesObject} object of the form
88
+ * { currentValue, previousValue, isFirstChange() }. Use this hook to trigger updates within a component such as
89
+ * cloning the bound value to prevent accidental mutation of the outer value.
90
+ *
91
+ * @property {function(): void} [$onDestroy]
92
+ * Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources,
93
+ * watches and event handlers.
94
+ *
95
+ * @property {function(): void} [$postLink]
96
+ * Called after this controller's element and its children have been linked. Similar to the post-link function this
97
+ * hook can be used to set up DOM event handlers and do direct DOM manipulation. Note that child elements that contain
98
+ * templateUrl directives will not have been compiled and linked since they are waiting for their template to load
99
+ * asynchronously and their own compilation and linking has been suspended until that occurs. This hook can be considered
100
+ * analogous to the ngAfterViewInit and ngAfterContentInit hooks in Angular 2. Since the compilation process is rather
101
+ * different in Angular 1 there is no direct mapping and care should be taken when upgrading.
102
+ *
103
+ * @property {*} [s: string]
104
+ * IController implementations frequently do not implement any of its methods.
105
+ * A string indexer indicates to TypeScript not to issue a weak type error in this case.
106
+ */
107
+
108
+ /**
109
+ * @typedef {Object.<string, any>} angular.Attributes
110
+ *
111
+ * @property {(name: string) => string} $normalize
112
+ * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with x- or data-) to its normalized, camelCase form.
113
+ * Also there is special case for Moz prefix starting with upper case letter.
114
+ *
115
+ * @property {(newClasses: string, oldClasses: string) => void} $updateClass
116
+ * Adds and removes the appropriate CSS class values to the element based on the difference between
117
+ * the new and old CSS class values (specified as newClasses and oldClasses).
118
+ *
119
+ * @property {(key: string, value: any) => void} $set
120
+ * Set DOM element attribute value.
121
+ *
122
+ * @property {<T>(name: string, fn: (value?: T) => any) => Function} $observe
123
+ * Observes an interpolated attribute.
124
+ * The observer function will be invoked once during the next $digest
125
+ * following compilation. The observer is then invoked whenever the
126
+ * interpolated value changes.
127
+ *
128
+ * @property {Object.<string, string>} $attr
129
+ * A map of DOM element attribute names to the normalized name. This is needed
130
+ * to do reverse lookup from normalized name back to actual name.
131
+ * @see http://docs.angularjs.org/api/ng/type/$compile.directive.Attributes
132
+ */
133
+
134
+ /**
135
+ * @typedef {import('./core/scope/scope').Scope} TScope
136
+ */
137
+
138
+ /**
139
+ * @typedef {import('./shared/jqlite/jqlite').JQLite} TElement
140
+ */
141
+
142
+ /**
143
+ * @typedef {angular.Attributes} TAttributes
144
+ */
145
+
146
+ /**
147
+ * @typedef {angular.Controller | angular.Controller[] | { [key: string]: angular.Controller }} IDirectiveController
148
+ * @description Represents a directive controller, which can be:
149
+ * - A single instance of {@link angular.Controller}
150
+ * - An array of {@link angular.Controller}
151
+ * - An object where keys are string identifiers and values are {@link IController}
152
+ */
153
+
154
+ /**
155
+ * Compile function for an AngularJS directive.
156
+ *
157
+ * @template TScope - The type of the directive's scope.
158
+ * @template TElement - The type of the directive's element.
159
+ * @template TAttributes - The type of the directive's attributes.
160
+ * @template TController - The type of the directive's controller.
161
+ *
162
+ * @callback angular.DirectiveCompileFn
163
+ * @param {TElement} templateElement - The template element.
164
+ * @param {TAttributes} templateAttributes - The template attributes.
165
+ * @param {ITranscludeFunction} transclude - @deprecated The transclude function. Note: The transclude function that is passed to the compile function is deprecated,
166
+ * as it e.g. does not know about the right outer scope. Please use the transclude function
167
+ * that is passed to the link function instead.
168
+ * @returns {void | angular.DirectiveLinkFn<TScope, TElement, TAttributes, TController> | angular.DirectivePrePost<TScope, TElement, TAttributes, TController>} Returns void, angular.DirectiveLinkFn, or angular.DirectivePrePost.
169
+ */
170
+
171
+ /**
172
+ * Link function for an AngularJS directive.
173
+ *
174
+ * @template TScope - The type of the directive's scope.
175
+ * @template TElement - The type of the directive's element.
176
+ * @template TAttributes - The type of the directive's attributes.
177
+ * @template TController - The type of the directive's controller.
178
+ *
179
+ * @callback angular.DirectiveLinkFn
180
+ * @param {TScope} scope - The scope instance for the directive.
181
+ * @param {TElement} instanceElement - The jqLite-wrapped element that this directive matches.
182
+ * @param {TAttributes} instanceAttributes - The normalized attributes for the element.
183
+ * @param {TController} [controller] - The directive's required controller(s) instance(s) or its name(s).
184
+ * @param {ITranscludeFunction} [transclude] - A transclude linking function pre-bound to the correct transclusion scope.
185
+ * @returns {void}
186
+ */
187
+
188
+ /**
189
+ * Represents the pre and post linking functions of a directive.
190
+ *
191
+ * @template TScope The type of scope associated with the directive.
192
+ * @template TElement The type of element that the directive matches.
193
+ * @template TAttributes The type of attributes of the directive.
194
+ * @template TController The type of controller associated with the directive.
195
+ *
196
+ * @typedef {Object} angular.DirectivePrePost
197
+ * @property {angular.DirectiveLinkFn<TScope, TElement, TAttributes, TController> | undefined} [pre]
198
+ * The pre-linking function of the directive.
199
+ * @property {angular.DirectiveLinkFn<TScope, TElement, TAttributes, TController> | undefined} [post]
200
+ * The post-linking function of the directive.
201
+ */
202
+
203
+ /**
204
+ * Directive definition object.
205
+ *
206
+ * @template TScope - The type of the directive's scope.
207
+ * @template TElement - The type of the directive's element.
208
+ * @template TAttributes - The type of the directive's attributes.
209
+ * @template TController - The type of the directive's controller.
210
+ *
211
+ * @typedef {Object} IDirective
212
+ * @property {angular.DirectiveCompileFn<TScope, TElement, TAttributes, TController> | undefined} [compile]
213
+ * Compile function for the directive.
214
+ * @property {string | angular.Injectable<angular.ControllerConstructor> | undefined} [controller]
215
+ * Controller constructor or name.
216
+ * @property {string | undefined} [controllerAs]
217
+ * Controller alias.
218
+ * @property {boolean | { [boundProperty: string]: string } | undefined} [bindToController]
219
+ * Bindings to controller.
220
+ * @property {angular.DirectiveLinkFn<TScope, TElement, TAttributes, TController> | angular.DirectivePrePost<TScope, TElement, TAttributes, TController> | undefined} [link]
221
+ * Link function.
222
+ * @property {boolean | undefined} [multiElement]
223
+ * Multi-element directive flag.
224
+ * @property {number | undefined} [priority]
225
+ * Directive priority.
226
+ * @property {boolean | undefined} [replace]
227
+ * Deprecated: Replace flag.
228
+ * @property {string | string[] | { [controller: string]: string } | undefined} [require]
229
+ * Required controllers.
230
+ * @property {string | undefined} [restrict]
231
+ * Restriction mode.
232
+ * @property {boolean | { [boundProperty: string]: string } | undefined} [scope]
233
+ * Scope options.
234
+ * @property {string | ((tElement: TElement, tAttrs: TAttributes) => string) | undefined} [template]
235
+ * HTML template.
236
+ * @property {string | undefined} [templateNamespace]
237
+ * Template namespace.
238
+ * @property {string | ((tElement: TElement, tAttrs: TAttributes) => string) | undefined} [templateUrl]
239
+ * HTML template URL.
240
+ * @property {boolean | "element" | { [slot: string]: string } | undefined} [transclude]
241
+ * Transclusion options.
242
+ */
243
+
244
+ /**
245
+ * Factory function for creating directives.
246
+ *
247
+ * @template TScope - The type of the directive's scope.
248
+ * @template TElement - The type of the directive's element.
249
+ * @template TAttributes - The type of the directive's attributes.
250
+ * @template TController - The type of the directive's controller.
251
+ *
252
+ * @typedef {(...args: any[]) => IDirective<TScope, TElement, TAttributes, TController> | angular.DirectiveLinkFn<TScope, TElement, TAttributes, TController>} IDirectiveFactory
253
+ */
254
+
255
+ /**
256
+ * @typedef {Object} angular.Module
257
+ * @description AngularJS module interface for registering components, services, providers, etc.
258
+ * @property {function(string, angular.ComponentOptions): angular.Module} component
259
+ * Use this method to register a component.
260
+ * @property {function({ [componentName: string]: angular.ComponentOptions }): angular.Module} component
261
+ * Use this method to register multiple components.
262
+ * @property {function(Function): angular.Module} config
263
+ * Use this method to register work which needs to be performed on module loading.
264
+ * @property {function(any[]): angular.Module} config
265
+ * Use this method to register work which needs to be performed on module loading.
266
+ * @property {function<T>(string, T): angular.Module} constant
267
+ * Register a constant service with the $injector.
268
+ * @property {function(Object): angular.Module} constant
269
+ * Register multiple constant services.
270
+ * @property {function(string, angular.Injectable<angular.ControllerConstructor>): angular.Module} controller
271
+ * Register a controller with the $controller service.
272
+ * @property {function({ [name: string]: angular.Injectable<angular.ControllerConstructor>> }): angular.Module} controller
273
+ * Register multiple controllers.
274
+ * @property {function<TScope, TElement, TAttributes, TController>(string, angular.Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>): angular.Module} directive
275
+ * Register a directive with the compiler.
276
+ * @property {function<TScope, TElement, TAttributes, TController>(Object.<string, angular.Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>>): angular.Module} directive
277
+ * Register multiple directives.
278
+ * @property {function(string, angular.Injectable<Function>): angular.Module} factory
279
+ * Register a service factory with the $injector.
280
+ * @property {function(Object.<string, angular.Injectable<Function>>): angular.Module} factory
281
+ * Register multiple service factories.
282
+ * @property {function(string, angular.Injectable<FilterFactory>): angular.Module} filter
283
+ * Register a filter service.
284
+ * @property {function(Object.<string, angular.Injectable<FilterFactory>>): angular.Module} filter
285
+ * Register multiple filter services.
286
+ * @property {function(string, IServiceProviderFactory): angular.Module} provider
287
+ * Register a provider service factory.
288
+ * @property {function(string, IServiceProviderClass): angular.Module} provider
289
+ * Register a provider service constructor.
290
+ * @property {function(string, any[]): angular.Module} provider
291
+ * Register a provider service with inline annotated constructor.
292
+ * @property {function(angular.Injectable<Function>): angular.Module} run
293
+ * Register code to be run during module loading.
294
+ * @property {function(string, angular.Injectable<Function>): angular.Module} service
295
+ * Register a service constructor.
296
+ * @property {function(Object.<string, angular.Injectable<Function>>): angular.Module} service
297
+ * Register multiple service constructors.
298
+ * @property {function<T>(string, T): angular.Module} value
299
+ * Register a value service with the $injector.
300
+ * @property {function(Object): angular.Module} value
301
+ * Register multiple value services.
302
+ * @property {function(string, angular.Injectable<Function>): angular.Module} decorator
303
+ * Register a service decorator with the $injector.
304
+ * @property {string} name
305
+ * The name of the AngularJS module.
306
+ * @property {string[]} requires
307
+ * Array of module names that this module depends on.
308
+ */
309
+
310
+ /**
311
+ * @type {Angular}
6
312
  */
7
313
  window.angular = new Angular();
8
314
 
package/src/loader.js CHANGED
@@ -29,11 +29,19 @@ import { CACHE } from "./core/cache/cache";
29
29
 
30
30
  const ngMinErr = minErr("ng");
31
31
 
32
- /** @type {Object.<string, angular.IModule>} */
32
+ /** @type {Object.<string, import('./index.js').angular.Module>} */
33
33
  const moduleCache = {};
34
34
 
35
35
  /**
36
- * @type {ng.IAngularStatic}
36
+ * Configuration option for AngularTS bootstrap process.
37
+ *
38
+ * @typedef {Object} AngularBootstrapConfig
39
+ * @property {boolean} debugInfoEnabled - Indicates whether debug information should be enabled. Setting this to `false` can improve performance but will disable some debugging features.
40
+ * @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`.
41
+ */
42
+
43
+ /**
44
+ * @class
37
45
  */
38
46
  export class Angular {
39
47
  constructor() {
@@ -119,7 +127,7 @@ export class Angular {
119
127
  * Each item in the array should be the name of a predefined module or a (DI annotated)
120
128
  * function that will be invoked by the injector as a `config` block.
121
129
  * See: {@link angular.module modules}
122
- * @param {angular.IAngularBootstrapConfig} config an object for defining configuration options for the application. The
130
+ * @param {AngularBootstrapConfig} [config] an object for defining configuration options for the application. The
123
131
  * following keys are supported:
124
132
  *
125
133
  * * `strictDi` - disable automatic function annotation for the application. This is meant to
@@ -129,11 +137,10 @@ export class Angular {
129
137
  */
130
138
  bootstrap(element, modules, config) {
131
139
  // eslint-disable-next-line no-param-reassign
132
- if (!isObject(config)) config = {};
133
- const defaultConfig = {
140
+ config = config || {
141
+ debugInfoEnabled: false,
134
142
  strictDi: false,
135
143
  };
136
- config = extend(defaultConfig, config);
137
144
  this.doBootstrap = function () {
138
145
  // @ts-ignore
139
146
  element = jqLite(element);
package/src/public.js CHANGED
@@ -104,6 +104,10 @@ import { initMessageModule } from "./exts/messages/messages";
104
104
  import { initAriaModule } from "./exts/aria/aria";
105
105
  import { initRouter } from "./router/index";
106
106
 
107
+ /**
108
+ * Initializes `ng`, `animate`, `message`, `aria` and `router` modules.
109
+ * @returns {import('./index').angular.Module} `ng`module
110
+ */
107
111
  export function publishExternalAPI() {
108
112
  const module = setupModuleLoader(window);
109
113
  const ng = module(
@@ -207,12 +211,13 @@ export function publishExternalAPI() {
207
211
  });
208
212
  },
209
213
  ],
210
- ).info({ angularVersion: '"NG_VERSION_FULL"' });
214
+ )
215
+ // Gets injected by rollup plugin
216
+ .info({ angularVersion: "[VI]{version}[/VI]" });
211
217
 
212
218
  initAnimateModule();
213
219
  initMessageModule();
214
220
  initAriaModule();
215
221
  initRouter();
216
-
217
222
  return ng;
218
223
  }
@@ -0,0 +1,19 @@
1
+ import { test, expect } from "@playwright/test";
2
+
3
+ test("unitstate-directives tests contain no errors", async ({ page }) => {
4
+ await page.goto("src/router/directives/state-directives.html");
5
+ await page.content();
6
+ await page.waitForTimeout(6000);
7
+ await expect(page.locator(".jasmine-overall-result")).toHaveText(
8
+ /0 failures/,
9
+ );
10
+ });
11
+
12
+ test("unit view-directives tests contain no errors", async ({ page }) => {
13
+ await page.goto("src/router/directives/view-directives.html");
14
+ await page.content();
15
+ await page.waitForTimeout(6000);
16
+ await expect(page.locator(".jasmine-overall-result")).toHaveText(
17
+ /0 failures/,
18
+ );
19
+ });
@@ -0,0 +1,21 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>AngularTS Test Runner</title>
6
+
7
+ <link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
8
+ <link rel="stylesheet" href="/jasmine/jasmine-5.1.2/jasmine.css" />
9
+ <script src="/jasmine/jasmine-5.1.2/jasmine.js"></script>
10
+ <script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
11
+ <script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
12
+ <script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
13
+ <script
14
+ type="module"
15
+ src="/src/router/directives/state-directives.spec.js"
16
+ ></script>
17
+ </head>
18
+ <body>
19
+ <div id="dummy"></div>
20
+ </body>
21
+ </html>
@@ -1,7 +1,7 @@
1
1
  import { jqLite } from "../../shared/jqlite/jqlite";
2
2
  import { Angular } from "../../loader";
3
3
  import { publishExternalAPI } from "../../public";
4
- import { browserTrigger, wait } from "../test-utils";
4
+ import { browserTrigger, wait } from "../../shared/test-utils";
5
5
 
6
6
  describe("ngStateRef", () => {
7
7
  window.location.hash = "";
@@ -19,6 +19,7 @@ describe("ngStateRef", () => {
19
19
  $stateParams;
20
20
 
21
21
  beforeEach(() => {
22
+ window.location.hash = "";
22
23
  window.angular = new Angular();
23
24
  publishExternalAPI();
24
25
  let module = window.angular.module("defaultModule", ["ng.router"]);
@@ -9,9 +9,10 @@
9
9
  import { dealoc, jqLite } from "../../shared/jqlite/jqlite";
10
10
  import { Angular } from "../../loader";
11
11
  import { publishExternalAPI } from "../../public";
12
- import { wait } from "../test-utils";
12
+ import { wait } from "../../shared/test-utils";
13
13
 
14
14
  describe("ngView", () => {
15
+ window.location.hash = "";
15
16
  let $stateProvider,
16
17
  scope,
17
18
  $compile,
@@ -0,0 +1,21 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>AngularTS Test Runner</title>
6
+
7
+ <link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
8
+ <link rel="stylesheet" href="/jasmine/jasmine-5.1.2/jasmine.css" />
9
+ <script src="/jasmine/jasmine-5.1.2/jasmine.js"></script>
10
+ <script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
11
+ <script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
12
+ <script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
13
+ <script
14
+ type="module"
15
+ src="/src/router/directives/view-directive.spec.js"
16
+ ></script>
17
+ </head>
18
+ <body>
19
+ <div id="dummy"></div>
20
+ </body>
21
+ </html>
@@ -0,0 +1,22 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>AngularTS Test Runner</title>
6
+
7
+ <link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
8
+ <link rel="stylesheet" href="/jasmine/jasmine-5.1.2/jasmine.css" />
9
+ <script src="/jasmine/jasmine-5.1.2/jasmine.js"></script>
10
+ <script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
11
+ <script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
12
+ <script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
13
+ <script type="module" src="/src/router/services.spec.js"></script>
14
+ <script type="module" src="/src/router/state-filter.spec.js"></script>
15
+ <script type="module" src="/src/router/template-factory.spec.js"></script>
16
+ <script type="module" src="/src/router/view-hook.spec.js"></script>
17
+ <script type="module" src="/src/router/view-scroll.spec.js"></script>
18
+ </head>
19
+ <body>
20
+ <div id="dummy"></div>
21
+ </body>
22
+ </html>
@@ -0,0 +1,11 @@
1
+ import { test, expect } from "@playwright/test";
2
+
3
+ const TEST_URL = "src/router/router.html";
4
+
5
+ test("unit tests contain no errors", async ({ page }) => {
6
+ await page.goto(TEST_URL);
7
+ await page.content();
8
+ await expect(page.locator(".jasmine-overall-result")).toHaveText(
9
+ /0 failures/,
10
+ );
11
+ });
@@ -1,5 +1,5 @@
1
- import { Angular } from "../../loader";
2
- import { publishExternalAPI } from "../../public";
1
+ import { Angular } from "../loader";
2
+ import { publishExternalAPI } from "../public";
3
3
 
4
4
  describe("router services", () => {
5
5
  let providers;