@angular-wave/angular.ts 0.7.5 → 0.7.8

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 (174) hide show
  1. package/@types/animations/raf-scheduler.d.ts +2 -2
  2. package/@types/animations/shared.d.ts +0 -1
  3. package/@types/core/compile/attributes.d.ts +3 -3
  4. package/@types/core/compile/compile.d.ts +1 -1
  5. package/@types/core/di/injector.d.ts +0 -1
  6. package/@types/core/di/internal-injector.d.ts +1 -0
  7. package/@types/core/di/ng-module.d.ts +5 -0
  8. package/@types/core/filter/filter.d.ts +11 -13
  9. package/@types/core/sanitize/sanitize-uri.d.ts +3 -6
  10. package/@types/core/scope/scope.d.ts +1 -3
  11. package/@types/directive/attrs/attrs.d.ts +7 -1
  12. package/@types/directive/events/events.d.ts +9 -3
  13. package/@types/directive/http/http.d.ts +6 -2
  14. package/@types/directive/include/include.d.ts +2 -2
  15. package/@types/directive/input/input.d.ts +2 -12
  16. package/@types/directive/messages/messages.d.ts +9 -48
  17. package/@types/directive/model/model.d.ts +3 -3
  18. package/@types/directive/options/options.d.ts +13 -20
  19. package/@types/directive/setter/setter.d.ts +2 -2
  20. package/@types/directive/switch/switch.d.ts +1 -0
  21. package/@types/directive/transclude/transclude.d.ts +10 -6
  22. package/@types/interface.d.ts +54 -18
  23. package/@types/router/common/glob.d.ts +5 -1
  24. package/@types/router/directives/view-directive.d.ts +2 -19
  25. package/@types/router/globals.d.ts +1 -2
  26. package/@types/router/state/state-registry.d.ts +1 -2
  27. package/@types/router/url/url-service.d.ts +7 -9
  28. package/@types/services/anchor-scroll.d.ts +1 -1
  29. package/@types/{core → services/exception}/exception-handler.d.ts +4 -4
  30. package/@types/{core/error-handler.d.ts → services/exception/interface.d.ts} +1 -1
  31. package/@types/services/http/http.d.ts +0 -2
  32. package/@types/services/http/interface.d.ts +2 -2
  33. package/@types/services/http-backend/http-backend.d.ts +13 -21
  34. package/@types/services/location/interface.d.ts +8 -0
  35. package/@types/{core → services}/location/location.d.ts +52 -12
  36. package/@types/{core → services}/sce/sce.d.ts +1 -1
  37. package/@types/services/template-cache/interface.d.ts +8 -2
  38. package/@types/services/template-cache/template-cache.d.ts +1 -1
  39. package/@types/services/template-request.d.ts +1 -1
  40. package/@types/shared/cache.d.ts +0 -2
  41. package/@types/shared/dom.d.ts +6 -0
  42. package/@types/shared/test-utils.d.ts +1 -0
  43. package/@types/shared/url-utils/interface.d.ts +47 -0
  44. package/@types/{core → shared}/url-utils/url-utils.d.ts +26 -13
  45. package/@types/shared/utils.d.ts +23 -0
  46. package/Makefile +3 -2
  47. package/dist/angular-ts.esm.js +1188 -1364
  48. package/dist/angular-ts.umd.js +1188 -1364
  49. package/dist/angular-ts.umd.min.js +1 -1
  50. package/docs/assets/scss/index.scss +12 -0
  51. package/docs/content/_index.md +15 -4
  52. package/docs/content/docs/directive/bind.md +72 -0
  53. package/docs/content/docs/directive/click.md +3 -0
  54. package/docs/content/docs/directive/dblclick.md +3 -0
  55. package/docs/content/docs/directive/get.md +203 -0
  56. package/docs/content/docs/directive/keydown.md +38 -0
  57. package/docs/content/docs/directive/keyup.md +38 -0
  58. package/docs/content/docs/directive/load.md +43 -0
  59. package/docs/content/docs/provider/templateCacheProvider.md +66 -1
  60. package/docs/content/docs/service/templateCache.md +2 -2
  61. package/docs/layouts/partials/hooks/head-end.html +1 -1
  62. package/docs/layouts/shortcodes/showcss.html +2 -0
  63. package/docs/static/examples/ng-bind/ng-bind.html +9 -0
  64. package/docs/static/examples/ng-keydown/ng-keydown.html +9 -0
  65. package/docs/static/examples/ng-keyup/ng-keyup.html +9 -0
  66. package/docs/static/examples/ng-load/ng-load.html +8 -0
  67. package/docs/static/typedoc/assets/hierarchy.js +1 -1
  68. package/docs/static/typedoc/assets/navigation.js +1 -1
  69. package/docs/static/typedoc/assets/search.js +1 -1
  70. package/docs/static/typedoc/classes/NgModule.html +32 -0
  71. package/docs/static/typedoc/classes/TemplateCacheProvider.html +1 -1
  72. package/docs/static/typedoc/hierarchy.html +1 -1
  73. package/docs/static/typedoc/index.html +1 -1
  74. package/docs/static/typedoc/interfaces/Directive.html +5 -4
  75. package/docs/static/typedoc/interfaces/HttpProviderDefaults.html +1 -1
  76. package/docs/static/typedoc/interfaces/HttpResponse.html +2 -3
  77. package/docs/static/typedoc/interfaces/Provider.html +15 -10
  78. package/docs/static/typedoc/interfaces/RequestConfig.html +1 -1
  79. package/docs/static/typedoc/interfaces/RequestShortcutConfig.html +1 -1
  80. package/docs/static/typedoc/interfaces/TemplateCache.html +7 -0
  81. package/docs/static/typedoc/types/AnnotatedDirectiveFactory.html +1 -0
  82. package/docs/static/typedoc/types/DirectiveFactory.html +1 -2
  83. package/docs/static/typedoc/types/DirectiveFactoryFn.html +1 -0
  84. package/docs/static/typedoc/types/HttpResponseStatus.html +1 -0
  85. package/docs/static/typedoc/types/{TemplateCache.html → SwapModeType.html} +1 -1
  86. package/docs/static/typedoc/variables/SwapMode.html +11 -0
  87. package/legacy.d.ts +0 -14
  88. package/package.json +1 -3
  89. package/src/animations/animate-children-directive.js +2 -2
  90. package/src/animations/raf-scheduler.js +1 -1
  91. package/src/animations/shared.js +0 -9
  92. package/src/core/compile/attributes.js +1 -1
  93. package/src/core/compile/compile.js +3 -3
  94. package/src/core/di/injector.js +4 -17
  95. package/src/core/di/internal-injector.js +4 -1
  96. package/src/core/di/ng-module.js +12 -27
  97. package/src/core/filter/filter.js +28 -28
  98. package/src/core/parse/interpreter.js +32 -38
  99. package/src/core/sanitize/sanitize-uri.js +3 -3
  100. package/src/core/scope/scope.js +2 -7
  101. package/src/directive/attrs/attrs.js +7 -4
  102. package/src/directive/bind/bind.js +16 -4
  103. package/src/directive/bind/bind.spec.js +13 -0
  104. package/src/directive/events/events.js +7 -3
  105. package/src/directive/events/events.md +0 -41
  106. package/src/directive/http/delete.spec.js +2 -0
  107. package/src/directive/http/get.spec.js +280 -3
  108. package/src/directive/http/http.js +100 -12
  109. package/src/directive/http/http.test.js +2 -2
  110. package/src/directive/http/post.spec.js +2 -0
  111. package/src/directive/http/put.spec.js +2 -0
  112. package/src/directive/include/include.js +7 -7
  113. package/src/directive/input/input.js +6 -28
  114. package/src/directive/messages/messages.js +5 -1
  115. package/src/directive/model/model.js +1 -1
  116. package/src/directive/options/options.js +454 -464
  117. package/src/directive/repeat/repeat.js +175 -153
  118. package/src/directive/setter/setter.js +13 -15
  119. package/src/directive/setter/setter.spec.js +39 -16
  120. package/src/directive/switch/switch.js +1 -0
  121. package/src/directive/switch/switch.spec.js +1 -1
  122. package/src/directive/transclude/transclude.js +87 -89
  123. package/src/injection-tokens.js +1 -1
  124. package/src/interface.ts +68 -19
  125. package/src/loader.js +4 -9
  126. package/src/public.js +9 -15
  127. package/src/router/common/glob.js +5 -0
  128. package/src/router/directives/state-directives.js +4 -6
  129. package/src/router/directives/state-directives.spec.js +1 -1
  130. package/src/router/directives/view-directive.js +9 -1
  131. package/src/router/globals.js +0 -1
  132. package/src/router/state/state-registry.js +0 -1
  133. package/src/router/state-filters.js +2 -2
  134. package/src/router/url/url-service.js +5 -9
  135. package/src/services/anchor-scroll.html +0 -7
  136. package/src/services/anchor-scroll.js +2 -2
  137. package/src/{core → services/exception}/exception-handler.js +2 -2
  138. package/src/{core/error-handler.ts → services/exception/interface.ts} +1 -1
  139. package/src/services/http/http.js +2 -13
  140. package/src/services/http/interface.ts +2 -2
  141. package/src/services/http-backend/http-backend.js +4 -14
  142. package/src/services/http-backend/http-backend.spec.js +1 -4
  143. package/src/services/location/interface.ts +8 -0
  144. package/src/{core → services}/location/location.html +4 -1
  145. package/src/{core → services}/location/location.js +129 -27
  146. package/src/{core → services}/location/location.spec.js +2 -2
  147. package/src/{core → services}/location/location.test.js +1 -1
  148. package/src/{core → services}/sce/sce.html +1 -1
  149. package/src/{core → services}/sce/sce.js +9 -3
  150. package/src/{core → services}/sce/sce.spec.js +2 -3
  151. package/src/{core → services}/sce/sce.test.js +1 -1
  152. package/src/services/template-cache/interface.ts +8 -2
  153. package/src/services/template-cache/template-cache.js +3 -1
  154. package/src/services/template-cache/template-cache.spec.js +72 -0
  155. package/src/services/template-request.js +2 -1
  156. package/src/shared/cache.js +0 -2
  157. package/src/shared/dom.js +10 -0
  158. package/src/shared/test-utils.js +1 -0
  159. package/src/shared/url-utils/interface.ts +56 -0
  160. package/src/{core → shared}/url-utils/url-utils.html +4 -1
  161. package/src/{core → shared}/url-utils/url-utils.js +26 -23
  162. package/src/{core → shared}/url-utils/url-utils.spec.js +0 -8
  163. package/src/{core → shared}/url-utils/url-utils.test.js +1 -1
  164. package/src/shared/utils.js +47 -1
  165. package/utils/express.js +9 -1
  166. package/@types/core/task-tracker-factory.d.ts +0 -76
  167. package/@types/services/browser.d.ts +0 -101
  168. package/docs/static/typedoc/types/SwapInsertPosition.html +0 -2
  169. package/jsdoc.json +0 -22
  170. package/src/core/task-tracker-factory.js +0 -145
  171. package/src/services/browser.js +0 -212
  172. /package/src/{core → services}/location/location.md +0 -0
  173. /package/src/{core → services}/sce/sce.md +0 -0
  174. /package/src/{core → shared}/url-utils/url-utils.md +0 -0
@@ -18,107 +18,105 @@ import { emptyElement, startingTag } from "../../shared/dom.js";
18
18
  * or its value is the same as the name of the attribute then the default slot is used.
19
19
  */
20
20
  const ngTranscludeMinErr = minErr("ngTransclude");
21
- export const ngTranscludeDirective = [
22
- "$compile",
23
21
 
24
- /**
25
- * @param {import("../../core/compile/compile.js").CompileFn} $compile
26
- * @returns {import("../../interface.ts").Directive}
27
- */
28
- function ($compile) {
29
- return {
30
- compile: function ngTranscludeCompile(tElement) {
31
- // Remove and cache any original content to act as a fallback
32
- const fallbackLinkFn = $compile(tElement.childNodes);
33
- emptyElement(tElement);
22
+ ngTranscludeDirective.$inject = ["$compile"];
23
+ /**
24
+ * @param {import("../../core/compile/compile.js").CompileFn} $compile
25
+ * @returns {import("../../interface.ts").Directive}
26
+ */
27
+ export function ngTranscludeDirective($compile) {
28
+ return {
29
+ compile: function ngTranscludeCompile(tElement) {
30
+ // Remove and cache any original content to act as a fallback
31
+ const fallbackLinkFn = $compile(tElement.childNodes);
32
+ emptyElement(tElement);
34
33
 
35
- /**
36
- *
37
- * @param {import("../../core/scope/scope.js").Scope} $scope
38
- * @param {Element} $element
39
- * @param {import("../../core/compile/attributes.js").Attributes} $attrs
40
- * @param {*} _controller
41
- * @param {*} $transclude
42
- */
43
- function ngTranscludePostLink(
44
- $scope,
45
- $element,
46
- $attrs,
47
- _controller,
48
- $transclude,
49
- ) {
50
- if (!$transclude) {
51
- throw ngTranscludeMinErr(
52
- "orphan",
53
- "Illegal use of ngTransclude directive in the template! " +
54
- "No parent directive that requires a transclusion found. " +
55
- "Element: {0}",
56
- startingTag($element),
57
- );
58
- }
34
+ /**
35
+ *
36
+ * @param {import("../../core/scope/scope.js").Scope} $scope
37
+ * @param {Element} $element
38
+ * @param {import("../../core/compile/attributes.js").Attributes} $attrs
39
+ * @param {*} _controller
40
+ * @param {*} $transclude
41
+ */
42
+ function ngTranscludePostLink(
43
+ $scope,
44
+ $element,
45
+ $attrs,
46
+ _controller,
47
+ $transclude,
48
+ ) {
49
+ if (!$transclude) {
50
+ throw ngTranscludeMinErr(
51
+ "orphan",
52
+ "Illegal use of ngTransclude directive in the template! " +
53
+ "No parent directive that requires a transclusion found. " +
54
+ "Element: {0}",
55
+ startingTag($element),
56
+ );
57
+ }
59
58
 
60
- // If the attribute is of the form: `ng-transclude="ng-transclude"` then treat it like the default
61
- if ($attrs["ngTransclude"] === $attrs.$attr.ngTransclude) {
62
- $attrs["ngTransclude"] = "";
63
- }
64
- const slotName = $attrs["ngTransclude"] || $attrs["ngTranscludeSlot"];
59
+ // If the attribute is of the form: `ng-transclude="ng-transclude"` then treat it like the default
60
+ if ($attrs["ngTransclude"] === $attrs.$attr.ngTransclude) {
61
+ $attrs["ngTransclude"] = "";
62
+ }
63
+ const slotName = $attrs["ngTransclude"] || $attrs["ngTranscludeSlot"];
65
64
 
66
- // If the slot is required and no transclusion content is provided then this call will throw an error
67
- $transclude(ngTranscludeCloneAttachFn, null, slotName);
65
+ // If the slot is required and no transclusion content is provided then this call will throw an error
66
+ $transclude(ngTranscludeCloneAttachFn, null, slotName);
68
67
 
69
- // If the slot is optional and no transclusion content is provided then use the fallback content
70
- if (slotName && !$transclude.isSlotFilled(slotName)) {
71
- useFallbackContent();
72
- }
68
+ // If the slot is optional and no transclusion content is provided then use the fallback content
69
+ if (slotName && !$transclude.isSlotFilled(slotName)) {
70
+ useFallbackContent();
71
+ }
73
72
 
74
- /**
75
- * @param {NodeList | Node} clone
76
- * @param {import("../../core/scope/scope.js").Scope} transcludedScope
77
- */
78
- function ngTranscludeCloneAttachFn(clone, transcludedScope) {
79
- if (notWhitespace(clone)) {
80
- if (clone instanceof NodeList) {
81
- Array.from(clone).forEach((el) => {
82
- $element.append(el);
83
- });
84
- } else {
85
- $element.append(/** @type {Node} */ (clone));
86
- }
73
+ /**
74
+ * @param {NodeList | Node} clone
75
+ * @param {import("../../core/scope/scope.js").Scope} transcludedScope
76
+ */
77
+ function ngTranscludeCloneAttachFn(clone, transcludedScope) {
78
+ if (notWhitespace(clone)) {
79
+ if (clone instanceof NodeList) {
80
+ Array.from(clone).forEach((el) => {
81
+ $element.append(el);
82
+ });
87
83
  } else {
88
- useFallbackContent();
89
- // There is nothing linked against the transcluded scope since no content was available,
90
- // so it should be safe to clean up the generated scope.
91
- transcludedScope.$destroy();
84
+ $element.append(/** @type {Node} */ (clone));
92
85
  }
86
+ } else {
87
+ useFallbackContent();
88
+ // There is nothing linked against the transcluded scope since no content was available,
89
+ // so it should be safe to clean up the generated scope.
90
+ transcludedScope.$destroy();
93
91
  }
92
+ }
94
93
 
95
- function useFallbackContent() {
96
- // Since this is the fallback content rather than the transcluded content,
97
- // we link against the scope of this directive rather than the transcluded scope
98
- fallbackLinkFn(
99
- $scope,
94
+ function useFallbackContent() {
95
+ // Since this is the fallback content rather than the transcluded content,
96
+ // we link against the scope of this directive rather than the transcluded scope
97
+ fallbackLinkFn(
98
+ $scope,
100
99
 
101
- (clone) => {
102
- // @ts-ignore
103
- $element.append(clone);
104
- },
105
- );
106
- }
100
+ (clone) => {
101
+ // @ts-ignore
102
+ $element.append(clone);
103
+ },
104
+ );
105
+ }
107
106
 
108
- function notWhitespace(node) {
109
- if (node instanceof Array) {
110
- return false;
111
- } else if (
112
- node.nodeType !== Node.TEXT_NODE ||
113
- node.nodeValue.trim()
114
- ) {
115
- return true;
116
- }
107
+ function notWhitespace(node) {
108
+ if (node instanceof Array) {
109
+ return false;
110
+ } else if (
111
+ node.nodeType !== Node.TEXT_NODE ||
112
+ node.nodeValue.trim()
113
+ ) {
114
+ return true;
117
115
  }
118
116
  }
117
+ }
119
118
 
120
- return ngTranscludePostLink;
121
- },
122
- };
123
- },
124
- ];
119
+ return ngTranscludePostLink;
120
+ },
121
+ };
122
+ }
@@ -30,7 +30,7 @@ export const $injectTokens = Object.freeze({
30
30
  $animate: "$animate",
31
31
  $animateCss: "$animateCss",
32
32
  $aria: "$aria",
33
- $browser: "$browser",
33
+ $compile: "$compile",
34
34
  $controller: "$controller",
35
35
  $eventBus: "$eventBus",
36
36
  $exceptionHandler: "$exceptionHandler",
package/src/interface.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Attributes } from "./core/compile/attributes.js";
2
2
  import { Scope } from "./core/scope/scope.js";
3
+ export * from "./core/di/ng-module.js";
3
4
  export * from "./services/http/interface.ts";
4
5
  export * from "./services/log/interface.ts";
5
6
  export * from "./services/log/log.js";
@@ -62,47 +63,66 @@ export interface ServiceProvider {
62
63
  * services, factories, constants, values, decorators, etc.
63
64
  */
64
65
  export interface Provider {
66
+ /**
67
+ * Register a directive
68
+ * @param name - The name of the directive.
69
+ * @param provider - An object with a `$get` property that defines how the service is created.
70
+ */
71
+ directive(name: string, directive: DirectiveFactory): Provider;
72
+
73
+ /**
74
+ * Register multiple directives
75
+ * @param obj
76
+ */
77
+ directive(obj: Record<string, DirectiveFactory>): Provider;
78
+
65
79
  /**
66
80
  * Register a service provider.
67
81
  * @param name - The name of the service.
68
82
  * @param provider - An object with a `$get` property that defines how the service is created.
69
83
  */
70
- provider(name: string, provider: ServiceProvider): ServiceProvider;
84
+ provider(name: string, provider: Function): Provider;
85
+
86
+ /**
87
+ * Register multiple service providers
88
+ * @param obj
89
+ */
90
+ provider(obj: Record<string, Function>): Provider;
71
91
 
72
92
  /**
73
93
  * Register a factory function to create a service.
74
94
  * @param name - The name of the service.
75
95
  * @param factoryFn - A function (or annotated array) that returns the service instance.
76
96
  */
77
- factory(name: string, factoryFn: Injectable): ServiceProvider;
97
+ factory(name: string, factoryFn: Injectable): Provider;
78
98
 
79
99
  /**
80
100
  * Register a constructor function to create a service.
81
101
  * @param name - The name of the service.
82
102
  * @param constructor - A class or function to instantiate.
83
103
  */
84
- service(name: string, constructor: Injectable): ServiceProvider;
104
+ service(name: string, constructor: Injectable): Provider;
85
105
 
86
106
  /**
87
107
  * Register a fixed value as a service.
88
108
  * @param name - The name of the service.
89
109
  * @param val - The value to use.
90
110
  */
91
- value(name: string, val: any): ServiceProvider;
111
+ value(name: string, val: any): Provider;
92
112
 
93
113
  /**
94
114
  * Register a constant value (available during config).
95
115
  * @param name - The name of the constant.
96
116
  * @param val - The constant value.
97
117
  */
98
- constant(name: string, val: any): void;
118
+ constant(name: string, val: any): Provider;
99
119
 
100
120
  /**
101
121
  * Register a decorator function to modify or replace an existing service.
102
122
  * @param name - The name of the service to decorate.
103
123
  * @param fn - A function that takes `$delegate` and returns a decorated service.
104
124
  */
105
- decorator(name: string, fn: Injectable): void;
125
+ decorator(name: string, fn: Function): Provider;
106
126
  }
107
127
 
108
128
  /**
@@ -247,15 +267,19 @@ export interface Directive {
247
267
  /** Template URL for loading from server */
248
268
  templateUrl?: string | ((element: Element, attrs: Attributes) => string);
249
269
  /** Enables transclusion or configures named slots */
250
- transclude?: boolean | "element" | Record<string, string>;
270
+ transclude?: boolean | string | Record<string, string>;
251
271
  /** Internal hook for directive compilation state */
252
272
  $$addStateInfo?: (...args: any[]) => any;
273
+ count?: number;
253
274
  }
254
275
 
255
- /**
256
- * A factory function returning a directive definition.
257
- */
258
- export type DirectiveFactory = (...args: any[]) => Directive | DirectiveLinkFn;
276
+ export type DirectiveFactoryFn = (
277
+ ...args: any[]
278
+ ) => Directive | DirectiveLinkFn;
279
+
280
+ export type AnnotatedDirectiveFactory = Array<string | DirectiveFactoryFn>;
281
+
282
+ export type DirectiveFactory = DirectiveFactoryFn | AnnotatedDirectiveFactory;
259
283
 
260
284
  /**
261
285
  * Represents advanced transclusion functions used in directives.
@@ -339,14 +363,39 @@ export interface NgModelController {
339
363
  /** Current value shown in the view */
340
364
  $viewValue: any;
341
365
  }
342
-
343
366
  /**
344
367
  * Possible values for `data-swap` attribute
345
368
  */
346
- export type SwapInsertPosition =
347
- | InsertPosition
348
- | "textContent"
349
- | "innerHTML"
350
- | "outerHTML"
351
- | "delete"
352
- | "none";
369
+ export const SwapMode = {
370
+ /** (default) Replaces the contents inside the element */
371
+ innerHTML: "innerHTML",
372
+
373
+ /** Replaces the entire element, including the tag itself */
374
+ outerHTML: "outerHTML",
375
+
376
+ /** Inserts plain text (without parsing HTML) */
377
+ textContent: "textContent",
378
+
379
+ /** Inserts HTML immediately before the element itself */
380
+ beforebegin: "beforebegin",
381
+
382
+ /** Inserts HTML inside the element, before its first child */
383
+ afterbegin: "afterbegin",
384
+
385
+ /** Inserts HTML inside the element, after its last child */
386
+ beforeend: "beforeend",
387
+
388
+ /** Inserts HTML immediately after the element itself */
389
+ afterend: "afterend",
390
+
391
+ /** Removes the element entirely */
392
+ delete: "delete",
393
+
394
+ /** Performs no insertion (no-op) */
395
+ none: "none",
396
+ } as const;
397
+
398
+ /**
399
+ * Union type representing all possible DOM insertion modes.
400
+ */
401
+ export type SwapModeType = keyof typeof SwapMode;
package/src/loader.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
- minErr,
3
- getNgAttribute,
4
- ngAttrPrefixes,
5
2
  assertNotHasOwnProperty,
6
3
  errorHandlingConfig,
4
+ getNgAttribute,
7
5
  hasOwn,
6
+ minErr,
7
+ ngAttrPrefixes,
8
8
  } from "./shared/utils.js";
9
9
  import {
10
10
  getController,
@@ -283,12 +283,7 @@ export class Angular {
283
283
  name,
284
284
  );
285
285
  }
286
- const moduleInstance = new NgModule(
287
- name,
288
- requires,
289
- /** @type {Function} */ (configFn),
290
- );
291
- return moduleInstance;
286
+ return new NgModule(name, requires, /** @type {Function} */ (configFn));
292
287
  });
293
288
  }
294
289
  }
package/src/public.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { CompileProvider } from "./core/compile/compile.js";
2
2
  import {
3
+ hiddenInputBrowserCacheDirective,
3
4
  inputDirective,
4
5
  ngValueDirective,
5
- hiddenInputBrowserCacheDirective,
6
6
  } from "./directive/input/input.js";
7
7
  import { formDirective, ngFormDirective } from "./directive/form/form.js";
8
8
  import { scriptDirective } from "./directive/script/script.js";
9
- import { selectDirective, optionDirective } from "./directive/select/select.js";
9
+ import { optionDirective, selectDirective } from "./directive/select/select.js";
10
10
  import {
11
11
  ngBindDirective,
12
12
  ngBindHtmlDirective,
@@ -34,9 +34,9 @@ import { ngRefDirective } from "./directive/ref/ref.js";
34
34
  import { ngRepeatDirective } from "./directive/repeat/repeat.js";
35
35
  import { ngStyleDirective } from "./directive/style/style.js";
36
36
  import {
37
+ ngSwitchDefaultDirective,
37
38
  ngSwitchDirective,
38
39
  ngSwitchWhenDirective,
39
- ngSwitchDefaultDirective,
40
40
  } from "./directive/switch/switch.js";
41
41
  import { ngOptionsDirective } from "./directive/options/options.js";
42
42
  import { ngTranscludeDirective } from "./directive/transclude/transclude.js";
@@ -52,27 +52,25 @@ import { ngAttributeAliasDirectives } from "./directive/attrs/attrs.js";
52
52
  import { ngEventDirectives } from "./directive/events/events.js";
53
53
  import { AnchorScrollProvider } from "./services/anchor-scroll.js";
54
54
  import { AnimateProvider } from "./animations/animate.js";
55
- import { BrowserProvider } from "./services/browser.js";
56
55
  import {
57
56
  AnimateAsyncRunFactoryProvider,
58
57
  AnimateRunnerFactoryProvider,
59
58
  } from "./animations/animate-runner.js";
60
59
  import { TemplateCacheProvider } from "./services/template-cache/template-cache.js";
61
60
  import { ControllerProvider } from "./core/controller/controller.js";
62
- import { ExceptionHandlerProvider } from "./core/exception-handler.js";
61
+ import { ExceptionHandlerProvider } from "./services/exception/exception-handler.js";
63
62
  import { FilterProvider } from "./core/filter/filter.js";
64
63
  import { InterpolateProvider } from "./core/interpolate/interpolate.js";
65
64
  import {
66
- HttpProvider,
67
65
  HttpParamSerializerProvider,
66
+ HttpProvider,
68
67
  } from "./services/http/http.js";
69
68
  import { HttpBackendProvider } from "./services/http-backend/http-backend.js";
70
- import { LocationProvider } from "./core/location/location.js";
69
+ import { LocationProvider } from "./services/location/location.js";
71
70
  import { LogProvider } from "./services/log/log.js";
72
71
  import { ParseProvider } from "./core/parse/parse.js";
73
72
  import { RootScopeProvider } from "./core/scope/scope.js";
74
- import { SceProvider, SceDelegateProvider } from "./core/sce/sce.js";
75
- import { TaskTrackerFactoryProvider } from "./core/task-tracker-factory.js";
73
+ import { SceDelegateProvider, SceProvider } from "./services/sce/sce.js";
76
74
  import { TemplateRequestProvider } from "./services/template-request.js";
77
75
  import { SanitizeUriProvider } from "./core/sanitize/sanitize-uri.js";
78
76
  import {
@@ -141,13 +139,13 @@ import {
141
139
  * @returns {import('./core/di/ng-module.js').NgModule} `ng` module
142
140
  */
143
141
  export function registerNgModule(angular) {
144
- const ng = angular
142
+ return angular
145
143
  .module(
146
144
  "ng",
147
145
  [],
148
146
  [
149
147
  "$provide",
150
- /** @type {import('./interface.js').Provider} */
148
+ /** @param {import("./interface.js").Provider} $provide */
151
149
  ($provide) => {
152
150
  // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
153
151
  $provide.provider({
@@ -248,7 +246,6 @@ export function registerNgModule(angular) {
248
246
  $$animateQueue: AnimateQueueProvider,
249
247
  $$AnimateRunner: AnimateRunnerFactoryProvider,
250
248
  $$animateAsyncRun: AnimateAsyncRunFactoryProvider,
251
- $browser: BrowserProvider,
252
249
  $controller: ControllerProvider,
253
250
  $exceptionHandler: ExceptionHandlerProvider,
254
251
  $filter: FilterProvider,
@@ -264,7 +261,6 @@ export function registerNgModule(angular) {
264
261
  $routerGlobals: RouterGlobals,
265
262
  $sce: SceProvider,
266
263
  $sceDelegate: SceDelegateProvider,
267
- $$taskTrackerFactory: TaskTrackerFactoryProvider,
268
264
  $templateCache: TemplateCacheProvider,
269
265
  $templateRequest: TemplateRequestProvider,
270
266
  $urlConfig: UrlConfigProvider,
@@ -291,6 +287,4 @@ export function registerNgModule(angular) {
291
287
  },
292
288
  ])
293
289
  .value("$trace", trace);
294
-
295
- return ng;
296
290
  }
@@ -83,6 +83,11 @@ export class Glob {
83
83
  */
84
84
  this.regexp = new RegExp("^" + regexpString + "$");
85
85
  }
86
+
87
+ /**
88
+ * @param {string} name
89
+ * @return {boolean}
90
+ */
86
91
  matches(name) {
87
92
  return this.regexp.test("." + name);
88
93
  }
@@ -382,12 +382,10 @@ export function $StateRefActiveDirective(
382
382
  const removeClasses = allClasses.filter(
383
383
  (cls) => !addClasses.includes(cls),
384
384
  );
385
- $scope.$evalAsync(() => {
386
- addClasses.forEach((className) => $element.classList.add(className));
387
- removeClasses.forEach((className) =>
388
- $element.classList.remove(className),
389
- );
390
- });
385
+ addClasses.forEach((className) => $element.classList.add(className));
386
+ removeClasses.forEach((className) =>
387
+ $element.classList.remove(className),
388
+ );
391
389
  }
392
390
  update();
393
391
  },
@@ -26,7 +26,7 @@ describe("ngStateRef", () => {
26
26
  module.config(
27
27
  /**
28
28
  * @param $stateProvider
29
- * @param {import('../../core/location/location.js').LocationProvider} $locationProvider
29
+ * @param {import('../../services/location/location.js').LocationProvider} $locationProvider
30
30
  */
31
31
  ($stateProvider, $locationProvider) => {
32
32
  _locationProvider = $locationProvider;
@@ -143,11 +143,20 @@ import { getLocals } from "../state/state-registry.js";
143
143
  * });
144
144
  * ```
145
145
  */
146
+
147
+ /** @type {import("../../interface.js").AnnotatedDirectiveFactory} */
146
148
  export let ngView = [
147
149
  "$view",
148
150
  "$animate",
149
151
  "$ngViewScroll",
150
152
  "$interpolate",
153
+ /**
154
+ * @param {*} $view
155
+ * @param {*} $animate
156
+ * @param {*} $ngViewScroll
157
+ * @param {*} $interpolate
158
+ * @returns {import("../../interface.js").Directive}
159
+ */
151
160
  function $ViewDirective($view, $animate, $ngViewScroll, $interpolate) {
152
161
  function getRenderer() {
153
162
  return {
@@ -178,7 +187,6 @@ export let ngView = [
178
187
  };
179
188
  const directive = {
180
189
  count: 0,
181
-
182
190
  terminal: true,
183
191
  priority: 400,
184
192
  transclude: "element",
@@ -8,7 +8,6 @@ import { Queue } from "./common/queue.js";
8
8
  *
9
9
  * This is where we hold the global mutable state such as current state, current
10
10
  * params, current transition, etc.
11
- * @implements {ServiceProvider}
12
11
  */
13
12
  export class RouterGlobals {
14
13
  constructor() {
@@ -14,7 +14,6 @@ import { $injectTokens, provider } from "../../injection-tokens.js";
14
14
  *
15
15
  * This API is found at `$stateRegistry` ([[UIRouter.stateRegistry]])
16
16
  *
17
- * @implements {ServiceProvider}
18
17
  */
19
18
  export class StateRegistryProvider {
20
19
  static $inject = provider([
@@ -16,7 +16,7 @@ export function $IsStateFilter($state) {
16
16
  const isFilter = function (state, params, options) {
17
17
  return $state.is(state, params, options);
18
18
  };
19
- //isFilter.$stateful = true;
19
+ isFilter.$stateful = true;
20
20
  return isFilter;
21
21
  }
22
22
  /**
@@ -37,6 +37,6 @@ export function $IncludedByStateFilter($state) {
37
37
  const includesFilter = function (state, params, options) {
38
38
  return $state.includes(state, params, options);
39
39
  };
40
- //includesFilter.$stateful = true;
40
+ includesFilter.$stateful = true;
41
41
  return includesFilter;
42
42
  }
@@ -12,6 +12,7 @@ import { stripLastPathElement } from "../../shared/strings.js";
12
12
  import { UrlMatcher } from "./url-matcher.js";
13
13
  import { ParamFactory } from "../params/param-factory.js";
14
14
  import { UrlRuleFactory } from "./url-rule.js";
15
+ import { getBaseHref } from "../../shared/dom.js";
15
16
 
16
17
  /**
17
18
  * API for URL management
@@ -25,7 +26,7 @@ export class UrlService {
25
26
  ];
26
27
 
27
28
  /**
28
- * @param {import("../../core/location/location").LocationProvider} $locationProvider
29
+ * @param {import("../../services/location/location").LocationProvider} $locationProvider
29
30
  * @param {import("../../router/state/state-service.js").StateProvider} stateService
30
31
  * @param globals
31
32
  * @param {import("../../router/url/url-config.js").UrlConfigProvider} urlConfigProvider
@@ -34,9 +35,7 @@ export class UrlService {
34
35
  this.stateService = stateService;
35
36
  this.stateService.urlService = this; // circular wiring
36
37
  this.$locationProvider = $locationProvider;
37
-
38
38
  this.$location = undefined;
39
- this.$browser = undefined;
40
39
 
41
40
  /** Provides services related to the URL */
42
41
  this.urlRuleFactory = new UrlRuleFactory(this, this.stateService, globals);
@@ -89,18 +88,15 @@ export class UrlService {
89
88
 
90
89
  $get = [
91
90
  "$location",
92
- "$browser",
93
91
  "$rootScope",
94
92
  /**
95
93
  *
96
- * @param {import('../../core/location/location.js').Location} $location
97
- * @param {import('../../services/browser.js').Browser} $browser
94
+ * @param {import('../../services/location/location.js').Location} $location
98
95
  * @param {import('../../core/scope/scope.js').Scope} $rootScope
99
96
  * @returns {UrlService}
100
97
  */
101
- ($location, $browser, $rootScope) => {
98
+ ($location, $rootScope) => {
102
99
  this.$location = $location;
103
- this.$browser = $browser;
104
100
  $rootScope.$on("$locationChangeSuccess", (evt) => {
105
101
  this._urlListeners.forEach((fn) => {
106
102
  fn(evt);
@@ -124,7 +120,7 @@ export class UrlService {
124
120
  baseHref() {
125
121
  return (
126
122
  this._baseHref ||
127
- (this._baseHref = this.$browser.baseHref() || window.location.pathname)
123
+ (this._baseHref = getBaseHref() || window.location.pathname)
128
124
  );
129
125
  }
130
126
 
@@ -3,14 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
5
  <title>AngularTS Test Runner</title>
6
-
7
6
  <link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
8
-
9
- <!--
10
- <script src="https://cdn.jsdelivr.net/npm/angular@1.8.3/angular.js"></script>
11
- <script src="https://cdn.jsdelivr.net/npm/angular-animate@1.8.3/angular-animate.js"></script>
12
- <script>window.angular.module("test", [])</script> -->
13
-
14
7
  <script type="module" src="/src/index.js"></script>
15
8
  <script>
16
9
  document.addEventListener("DOMContentLoaded", () => {