@angular-wave/angular.ts 0.8.4 → 0.9.1

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 (213) hide show
  1. package/@types/core/scope/scope.d.ts +1 -4
  2. package/@types/interface.d.ts +17 -3
  3. package/@types/shared/interface.d.ts +17 -0
  4. package/@types/shared/utils.d.ts +4 -19
  5. package/dist/angular-ts.esm.js +42 -160
  6. package/dist/angular-ts.umd.js +42 -160
  7. package/dist/angular-ts.umd.min.js +1 -1
  8. package/docs/layouts/shortcodes/version.html +1 -1
  9. package/docs/static/typedoc/assets/hierarchy.js +1 -1
  10. package/docs/static/typedoc/assets/main.js +2 -2
  11. package/docs/static/typedoc/assets/navigation.js +1 -1
  12. package/docs/static/typedoc/assets/search.js +1 -1
  13. package/docs/static/typedoc/assets/style.css +2 -9
  14. package/docs/static/typedoc/classes/Location.html +20 -20
  15. package/docs/static/typedoc/classes/LocationProvider.html +5 -5
  16. package/docs/static/typedoc/classes/LogProvider.html +3 -3
  17. package/docs/static/typedoc/classes/PubSub.html +21 -21
  18. package/docs/static/typedoc/classes/PubSubProvider.html +1 -1
  19. package/docs/static/typedoc/classes/TemplateCacheProvider.html +2 -2
  20. package/docs/static/typedoc/hierarchy.html +1 -1
  21. package/docs/static/typedoc/index.html +1 -1
  22. package/docs/static/typedoc/interfaces/ChangesObject.html +3 -3
  23. package/docs/static/typedoc/interfaces/ComponentOptions.html +8 -8
  24. package/docs/static/typedoc/interfaces/Controller.html +6 -6
  25. package/docs/static/typedoc/interfaces/DefaultPorts.html +1 -1
  26. package/docs/static/typedoc/interfaces/Directive.html +18 -18
  27. package/docs/static/typedoc/interfaces/DirectivePrePost.html +1 -1
  28. package/docs/static/typedoc/interfaces/Html5Mode.html +1 -1
  29. package/docs/static/typedoc/interfaces/HttpProviderDefaults.html +7 -7
  30. package/docs/static/typedoc/interfaces/HttpService.html +21 -21
  31. package/docs/static/typedoc/interfaces/LogService.html +6 -6
  32. package/docs/static/typedoc/interfaces/NgModelController.html +15 -15
  33. package/docs/static/typedoc/interfaces/NgModelOptions.html +8 -8
  34. package/docs/static/typedoc/interfaces/Provider.html +17 -17
  35. package/docs/static/typedoc/interfaces/RequestConfig.html +15 -15
  36. package/docs/static/typedoc/interfaces/RequestShortcutConfig.html +11 -11
  37. package/docs/static/typedoc/interfaces/ServiceProvider.html +1 -1
  38. package/docs/static/typedoc/interfaces/TemplateCache.html +1 -1
  39. package/docs/static/typedoc/interfaces/TranscludeFunctionObject.html +4 -4
  40. package/docs/static/typedoc/interfaces/UrlParts.html +4 -4
  41. package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
  42. package/docs/static/typedoc/types/CloneAttachFunction.html +1 -1
  43. package/docs/static/typedoc/types/ControllerConstructor.html +1 -1
  44. package/docs/static/typedoc/types/DirectiveCompileFn.html +1 -1
  45. package/docs/static/typedoc/types/DirectiveController.html +1 -1
  46. package/docs/static/typedoc/types/DirectiveFactoryFn.html +1 -1
  47. package/docs/static/typedoc/types/DirectiveLinkFn.html +1 -1
  48. package/docs/static/typedoc/types/Expression.html +1 -1
  49. package/docs/static/typedoc/types/FilterFactory.html +1 -1
  50. package/docs/static/typedoc/types/FilterFn.html +1 -1
  51. package/docs/static/typedoc/types/Injectable.html +1 -1
  52. package/docs/static/typedoc/types/InjectableFactory.html +1 -1
  53. package/docs/static/typedoc/types/LogCall.html +1 -1
  54. package/docs/static/typedoc/types/LogServiceFactory.html +1 -1
  55. package/docs/static/typedoc/types/OnChangesObject.html +1 -1
  56. package/docs/static/typedoc/types/SwapModeType.html +1 -1
  57. package/docs/static/typedoc/types/TController.html +1 -1
  58. package/docs/static/typedoc/types/UrlChangeListener.html +4 -4
  59. package/docs/static/typedoc/variables/SwapMode.html +10 -10
  60. package/legacy.d.ts +0 -82
  61. package/package.json +2 -2
  62. package/src/animations/animate-js.js +2 -1
  63. package/src/animations/animate-queue.js +7 -6
  64. package/src/core/parse/interpreter.js +11 -6
  65. package/src/core/parse/parse.spec.js +6 -8
  66. package/src/core/scope/scope.js +10 -12
  67. package/src/core/scope/scope.spec.js +4 -4
  68. package/src/directive/http/form-router-test.html +44 -0
  69. package/src/directive/options/options-example.html +7 -3
  70. package/src/directive/options/options.js +1 -0
  71. package/src/directive/options/options.spec.js +117 -170
  72. package/src/interface.ts +20 -3
  73. package/src/router/directives/view-directive.js +0 -1
  74. package/src/router/directives/view-directive.spec.js +10 -9
  75. package/src/router/resolve/resolve-context.js +0 -19
  76. package/src/router/state/state-registry.js +3 -10
  77. package/src/router/state/state-service.js +5 -5
  78. package/src/router/transition/transition.js +1 -86
  79. package/src/router/view-hook.spec.js +1 -1
  80. package/src/shared/interface.ts +19 -0
  81. package/src/shared/utils.js +3 -12
  82. package/tsconfig.types.json +2 -2
  83. package/@types/angular.d.ts +0 -150
  84. package/@types/animations/animate-cache.d.ts +0 -50
  85. package/@types/animations/animate-children-directive.d.ts +0 -10
  86. package/@types/animations/animate-css-driver.d.ts +0 -18
  87. package/@types/animations/animate-css.d.ts +0 -18
  88. package/@types/animations/animate-js-driver.d.ts +0 -14
  89. package/@types/animations/animate-js.d.ts +0 -23
  90. package/@types/animations/animate-queue.d.ts +0 -28
  91. package/@types/animations/animate-runner.d.ts +0 -31
  92. package/@types/animations/animate-swap.d.ts +0 -9
  93. package/@types/animations/animate.d.ts +0 -450
  94. package/@types/animations/animation.d.ts +0 -14
  95. package/@types/animations/interface.d.ts +0 -17
  96. package/@types/animations/raf-scheduler.d.ts +0 -37
  97. package/@types/animations/shared.d.ts +0 -74
  98. package/@types/core/compile/compile.d.ts +0 -201
  99. package/@types/core/controller/controller.d.ts +0 -54
  100. package/@types/core/di/injector.d.ts +0 -22
  101. package/@types/core/filter/filter.d.ts +0 -23
  102. package/@types/core/interpolate/interpolate.d.ts +0 -38
  103. package/@types/core/parse/ast/ast-node.d.ts +0 -56
  104. package/@types/core/parse/ast/ast.d.ts +0 -164
  105. package/@types/core/parse/lexer/lexer.d.ts +0 -119
  106. package/@types/core/parse/lexer/token.d.ts +0 -17
  107. package/@types/core/parse/parse.d.ts +0 -33
  108. package/@types/core/parse/parser/parser.d.ts +0 -41
  109. package/@types/core/sanitize/interface.d.ts +0 -10
  110. package/@types/core/sanitize/sanitize-uri.d.ts +0 -40
  111. package/@types/directive/aria/aria.d.ts +0 -104
  112. package/@types/directive/attrs/attrs.d.ts +0 -8
  113. package/@types/directive/bind/bind.d.ts +0 -18
  114. package/@types/directive/channel/channel.d.ts +0 -10
  115. package/@types/directive/class/class.d.ts +0 -3
  116. package/@types/directive/cloak/cloak.d.ts +0 -4
  117. package/@types/directive/controller/controller.d.ts +0 -4
  118. package/@types/directive/events/events.d.ts +0 -21
  119. package/@types/directive/form/form.d.ts +0 -264
  120. package/@types/directive/http/http.d.ts +0 -46
  121. package/@types/directive/if/if.d.ts +0 -10
  122. package/@types/directive/include/include.d.ts +0 -28
  123. package/@types/directive/init/init.d.ts +0 -4
  124. package/@types/directive/input/input.d.ts +0 -70
  125. package/@types/directive/messages/messages.d.ts +0 -63
  126. package/@types/directive/model/model.d.ts +0 -515
  127. package/@types/directive/model-options/model-options.d.ts +0 -56
  128. package/@types/directive/non-bindable/non-bindable.d.ts +0 -4
  129. package/@types/directive/observe/observe.d.ts +0 -9
  130. package/@types/directive/options/options.d.ts +0 -13
  131. package/@types/directive/ref/ref.d.ts +0 -11
  132. package/@types/directive/repeat/repeat.d.ts +0 -11
  133. package/@types/directive/script/script.d.ts +0 -10
  134. package/@types/directive/select/select.d.ts +0 -15
  135. package/@types/directive/setter/setter.d.ts +0 -12
  136. package/@types/directive/show-hide/show-hide.d.ts +0 -19
  137. package/@types/directive/style/style.d.ts +0 -4
  138. package/@types/directive/switch/switch.d.ts +0 -18
  139. package/@types/directive/transclude/transclude.d.ts +0 -10
  140. package/@types/directive/validators/validators.d.ts +0 -149
  141. package/@types/filters/filter.d.ts +0 -4
  142. package/@types/filters/filters.d.ts +0 -38
  143. package/@types/filters/limit-to.d.ts +0 -4
  144. package/@types/filters/order-by.d.ts +0 -7
  145. package/@types/index.d.ts +0 -2
  146. package/@types/ng.d.ts +0 -8
  147. package/@types/router/common/trace.d.ts +0 -66
  148. package/@types/router/directives/state-directives.d.ts +0 -46
  149. package/@types/router/directives/view-directive.d.ts +0 -138
  150. package/@types/router/glob/glob.d.ts +0 -81
  151. package/@types/router/hooks/core-resolvables.d.ts +0 -2
  152. package/@types/router/hooks/ignored-transition.d.ts +0 -1
  153. package/@types/router/hooks/invalid-transition.d.ts +0 -1
  154. package/@types/router/hooks/lazy-load.d.ts +0 -42
  155. package/@types/router/hooks/on-enter-exit-retain.d.ts +0 -3
  156. package/@types/router/hooks/redirect-to.d.ts +0 -4
  157. package/@types/router/hooks/resolve.d.ts +0 -4
  158. package/@types/router/hooks/update-globals.d.ts +0 -1
  159. package/@types/router/hooks/url.d.ts +0 -5
  160. package/@types/router/hooks/views.d.ts +0 -5
  161. package/@types/router/params/interface.d.ts +0 -606
  162. package/@types/router/params/param-factory.d.ts +0 -16
  163. package/@types/router/params/param-type.d.ts +0 -59
  164. package/@types/router/params/param-types.d.ts +0 -36
  165. package/@types/router/params/param.d.ts +0 -71
  166. package/@types/router/params/state-params.d.ts +0 -12
  167. package/@types/router/path/path-node.d.ts +0 -38
  168. package/@types/router/path/path-utils.d.ts +0 -88
  169. package/@types/router/resolve/interface.d.ts +0 -200
  170. package/@types/router/resolve/resolvable.d.ts +0 -50
  171. package/@types/router/resolve/resolve-context.d.ts +0 -102
  172. package/@types/router/router.d.ts +0 -47
  173. package/@types/router/state/interface.d.ts +0 -983
  174. package/@types/router/state/state-builder.d.ts +0 -95
  175. package/@types/router/state/state-matcher.d.ts +0 -7
  176. package/@types/router/state/state-object.d.ts +0 -83
  177. package/@types/router/state/state-queue-manager.d.ts +0 -29
  178. package/@types/router/state/state-registry.d.ts +0 -134
  179. package/@types/router/state/state-service.d.ts +0 -419
  180. package/@types/router/state/target-state.d.ts +0 -102
  181. package/@types/router/state/views.d.ts +0 -58
  182. package/@types/router/state-filters.d.ts +0 -39
  183. package/@types/router/template-factory.d.ts +0 -117
  184. package/@types/router/transition/hook-builder.d.ts +0 -45
  185. package/@types/router/transition/hook-registry.d.ts +0 -102
  186. package/@types/router/transition/interface.d.ts +0 -880
  187. package/@types/router/transition/reject-factory.d.ts +0 -43
  188. package/@types/router/transition/transition-event-type.d.ts +0 -24
  189. package/@types/router/transition/transition-hook.d.ts +0 -86
  190. package/@types/router/transition/transition-service.d.ts +0 -116
  191. package/@types/router/transition/transition.d.ts +0 -396
  192. package/@types/router/url/url-config.d.ts +0 -99
  193. package/@types/router/url/url-matcher.d.ts +0 -174
  194. package/@types/router/url/url-rule.d.ts +0 -161
  195. package/@types/router/url/url-rules.d.ts +0 -249
  196. package/@types/router/url/url-service.d.ts +0 -254
  197. package/@types/router/view/interface.d.ts +0 -44
  198. package/@types/router/view/view.d.ts +0 -149
  199. package/@types/router/view-scroll.d.ts +0 -10
  200. package/@types/services/anchor-scroll.d.ts +0 -25
  201. package/@types/services/cookie-reader.d.ts +0 -4
  202. package/@types/services/http/http.d.ts +0 -134
  203. package/@types/services/http-backend/http-backend.d.ts +0 -58
  204. package/@types/services/sce/sce.d.ts +0 -238
  205. package/@types/services/template-request.d.ts +0 -55
  206. package/@types/shared/common.d.ts +0 -197
  207. package/@types/shared/hof.d.ts +0 -108
  208. package/@types/shared/predicates.d.ts +0 -17
  209. package/@types/shared/queue.d.ts +0 -64
  210. package/@types/shared/strings.d.ts +0 -58
  211. package/@types/shared/test-utils.d.ts +0 -18
  212. package/docs/static/typedoc/classes/NgModule.html +0 -32
  213. package/src/router/params/README.md +0 -8
@@ -2,7 +2,7 @@ import { createElementFromHTML, dealoc } from "../../shared/dom.js";
2
2
  import { Angular } from "../../angular.js";
3
3
  import { wait } from "../../shared/test-utils.js";
4
4
 
5
- fdescribe("ngView", () => {
5
+ describe("ngView", () => {
6
6
  window.location.hash = "";
7
7
  let $stateProvider,
8
8
  scope,
@@ -799,7 +799,7 @@ fdescribe("ngView", () => {
799
799
  // });
800
800
  });
801
801
 
802
- fdescribe("ngView named", () => {
802
+ describe("ngView named", () => {
803
803
  let $stateProvider,
804
804
  scope,
805
805
  $compile,
@@ -873,7 +873,7 @@ fdescribe("ngView named", () => {
873
873
  });
874
874
  });
875
875
 
876
- fdescribe("ngView transclusion", () => {
876
+ describe("ngView transclusion", () => {
877
877
  let scope, $compile, elem, $injector, $rootScope, $state;
878
878
 
879
879
  beforeEach(() => {
@@ -929,7 +929,7 @@ fdescribe("ngView transclusion", () => {
929
929
  });
930
930
  });
931
931
 
932
- fdescribe("ngView controllers or onEnter handlers", () => {
932
+ describe("ngView controllers or onEnter handlers", () => {
933
933
  let el, template, scope, count, $rootScope, $compile, $state, elem;
934
934
 
935
935
  beforeEach(() => {
@@ -1006,7 +1006,7 @@ fdescribe("ngView controllers or onEnter handlers", () => {
1006
1006
  });
1007
1007
  });
1008
1008
 
1009
- fdescribe("angular 1.5+ style .component()", () => {
1009
+ describe("angular 1.5+ style .component()", () => {
1010
1010
  let el = document.getElementById("app"),
1011
1011
  app,
1012
1012
  scope,
@@ -1112,8 +1112,9 @@ fdescribe("angular 1.5+ style .component()", () => {
1112
1112
  };
1113
1113
  },
1114
1114
  })
1115
- .config(function (_$stateProvider_) {
1115
+ .config(function (_$stateProvider_, $locationProvider) {
1116
1116
  $stateProvider = _$stateProvider_;
1117
+ $locationProvider.html5ModeConf.enabled = false;
1117
1118
  });
1118
1119
 
1119
1120
  let $injector = window.angular.bootstrap(document.getElementById("app"), [
@@ -1835,9 +1836,9 @@ fdescribe("angular 1.5+ style .component()", () => {
1835
1836
  name: "ng12-dynamic-directive",
1836
1837
  url: "/ng12dynamicDirective/:type",
1837
1838
  componentProvider: [
1838
- "$router",
1839
- function ($router) {
1840
- return $router.params.type;
1839
+ "$stateParams",
1840
+ function ($stateParams) {
1841
+ return $stateParams.type;
1841
1842
  },
1842
1843
  ],
1843
1844
  });
@@ -155,10 +155,6 @@ export class ResolveContext {
155
155
  return Promise.all(promises);
156
156
  }
157
157
 
158
- injector() {
159
- return this._injector || (this._injector = new UIInjectorImpl());
160
- }
161
-
162
158
  findNode(resolvable) {
163
159
  return find(this._path, (node) => node.resolvables.includes(resolvable));
164
160
  }
@@ -192,18 +188,3 @@ export class ResolveContext {
192
188
  });
193
189
  }
194
190
  }
195
-
196
- class UIInjectorImpl {
197
- constructor() {
198
- this.native = window["angular"].$injector;
199
- }
200
- get(token) {
201
- return window["angular"].$injector.get(token);
202
- }
203
- getAsync(token) {
204
- return Promise.resolve(window["angular"].$injector.get(token));
205
- }
206
- getNative(token) {
207
- return window["angular"].$injector.get(token);
208
- }
209
- }
@@ -6,7 +6,7 @@ import { propEq } from "../../shared/hof.js";
6
6
  import { ResolveContext } from "../resolve/resolve-context.js";
7
7
  import { ng1ViewsBuilder } from "./views.js";
8
8
  import { isString } from "../../shared/utils.js";
9
- import { $injectTokens, provider } from "../../injection-tokens.js";
9
+ import { $injectTokens as $t, provider } from "../../injection-tokens.js";
10
10
 
11
11
  /** @typedef {import('../../interface.ts').ServiceProvider} ServiceProvider } */
12
12
  /**
@@ -16,12 +16,7 @@ import { $injectTokens, provider } from "../../injection-tokens.js";
16
16
  *
17
17
  */
18
18
  export class StateRegistryProvider {
19
- /* @ignore */ static $inject = provider([
20
- $injectTokens.$url,
21
- $injectTokens.$state,
22
- $injectTokens.$router,
23
- $injectTokens.$view,
24
- ]);
19
+ static $inject = provider([$t.$url, $t.$state, $t.$router, $t.$view]);
25
20
 
26
21
  /**
27
22
  * @param urlService
@@ -60,11 +55,9 @@ export class StateRegistryProvider {
60
55
  globals.current = globals.$current.self;
61
56
  }
62
57
 
63
- /** @type {import('../../interface.ts').AnnotatedFactory} */
64
58
  $get = [
65
- "$injector",
59
+ $t.$injector,
66
60
  /**
67
- *
68
61
  * @param {import("../../core/di/internal-injector").InjectorService} $injector
69
62
  * @returns {StateRegistryProvider}
70
63
  */
@@ -14,7 +14,6 @@ import { Rejection, RejectType } from "../transition/reject-factory.js";
14
14
  import { TargetState } from "./target-state.js";
15
15
  import { Param } from "../params/param.js";
16
16
  import { Glob } from "../glob/glob.js";
17
- import { ResolveContext } from "../resolve/resolve-context.js";
18
17
  import { lazyLoadState } from "../hooks/lazy-load.js";
19
18
  import { val } from "../../shared/hof.js";
20
19
  import { EventBus } from "../../services/pubsub/pubsub.js";
@@ -52,19 +51,20 @@ export class StateProvider {
52
51
  return this.globals.$current;
53
52
  }
54
53
 
55
- /* @ignore */ static $inject = ["$routerProvider", "$transitionsProvider"];
54
+ static $inject = ["$routerProvider", "$transitionsProvider"];
56
55
 
57
- // Needs access to urlService, stateRegistry
58
56
  /**
59
57
  *
60
58
  * @param {import('../router.js').Router} globals
61
59
  * @param {*} transitionService
60
+ * @param {import('../../core/di/internal-injector.js').InjectorService} $injector
62
61
  */
63
- constructor(globals, transitionService) {
62
+ constructor(globals, transitionService, $injector) {
64
63
  this.stateRegistry = undefined;
65
64
  this.urlService = undefined;
66
65
  this.globals = globals;
67
66
  this.transitionService = transitionService;
67
+ this.$injector = $injector;
68
68
  this.invalidCallbacks = [];
69
69
 
70
70
  this._defaultErrorHandler = function $defaultErrorHandler($error$) {
@@ -221,7 +221,7 @@ export class StateProvider {
221
221
  const latest = latestThing();
222
222
  /** @type {Queue<Function>} */
223
223
  const callbackQueue = new Queue(this.invalidCallbacks.slice());
224
- const injector = new ResolveContext(fromPath).injector();
224
+ const injector = this.$injector;
225
225
  const checkForRedirect = (result) => {
226
226
  if (!(result instanceof TargetState)) {
227
227
  return;
@@ -8,8 +8,6 @@ import {
8
8
  arrayTuples,
9
9
  unnestR,
10
10
  anyTrueR,
11
- flattenR,
12
- uniqR,
13
11
  } from "../../shared/common.js";
14
12
  import { isUndefined, isObject, assert } from "../../shared/utils.js";
15
13
  import { propEq, val, is } from "../../shared/hof.js";
@@ -184,90 +182,7 @@ export class Transition {
184
182
  .reduce((acc, obj) => ({ ...acc, ...obj }), {}),
185
183
  );
186
184
  }
187
- paramsChanged() {
188
- const fromParams = this.params("from");
189
- const toParams = this.params("to");
190
- // All the parameters declared on both the "to" and "from" paths
191
- const allParamDescriptors = []
192
- .concat(this._treeChanges.to)
193
- .concat(this._treeChanges.from)
194
- .map((pathNode) => pathNode.paramSchema)
195
- .reduce(flattenR, [])
196
- .reduce(uniqR, []);
197
- const changedParamDescriptors = Param.changed(
198
- allParamDescriptors,
199
- fromParams,
200
- toParams,
201
- );
202
- return changedParamDescriptors.reduce((changedValues, descriptor) => {
203
- changedValues[descriptor.id] = toParams[descriptor.id];
204
- return changedValues;
205
- }, {});
206
- }
207
- /**
208
- * Creates a [[UIInjector]] Dependency Injector
209
- *
210
- * Returns a Dependency Injector for the Transition's target state (to state).
211
- * The injector provides resolve values which the target state has access to.
212
- *
213
- * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2).
214
- *
215
- * #### Example:
216
- * ```js
217
- * .onEnter({ entering: 'myState' }, trans => {
218
- * var myResolveValue = trans.injector().get('myResolve');
219
- * // Inject a global service from the global/native injector (if it exists)
220
- * var MyService = trans.injector().get('MyService');
221
- * })
222
- * ```
223
- *
224
- * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched.
225
- * You can use [[UIInjector.getAsync]] to get a promise for the data.
226
- * #### Example:
227
- * ```js
228
- * .onBefore({}, trans => {
229
- * return trans.injector().getAsync('myResolve').then(myResolveValue =>
230
- * return myResolveValue !== 'ABORT';
231
- * });
232
- * });
233
- * ```
234
- *
235
- * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to.
236
- * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`.
237
- * #### Example:
238
- * ```js
239
- * .onEnter({ to: 'foo.bar' }, trans => {
240
- * // returns result of `foo` state's `myResolve` resolve
241
- * // even though `foo.bar` also has a `myResolve` resolve
242
- * var fooData = trans.injector('foo').get('myResolve');
243
- * });
244
- * ```
245
- *
246
- * If you need resolve data from the exiting states, pass `'from'` as `pathName`.
247
- * The resolve data from the `from` path will be returned.
248
- * #### Example:
249
- * ```js
250
- * .onExit({ exiting: 'foo.bar' }, trans => {
251
- * // Gets the resolve value of `myResolve` from the state being exited
252
- * var fooData = trans.injector(null, 'from').get('myResolve');
253
- * });
254
- * ```
255
- *
256
- *
257
- * @param state Limits the resolves provided to only the resolves the provided state has access to.
258
- * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states.
259
- *
260
- * @returns a [[UIInjector]]
261
- */
262
- injector(state, pathName = "to") {
263
- let path = this._treeChanges[pathName];
264
- if (state)
265
- path = PathUtils.subPath(
266
- path,
267
- (node) => node.state === state || node.state.name === state,
268
- );
269
- return new ResolveContext(path).injector();
270
- }
185
+
271
186
  /**
272
187
  * Gets all available resolve tokens (keys)
273
188
  *
@@ -174,7 +174,7 @@ describe("view hooks", () => {
174
174
  ctrl.prototype.uiCanExit = function (trans) {
175
175
  log += "canexit;";
176
176
  expect(typeof trans.treeChanges).toBe("function");
177
- expect(trans.injector().get("$state")).toBe(_state);
177
+ // expect(trans.injector().get("$state")).toBe(_state);
178
178
  };
179
179
  await initial();
180
180
 
@@ -1,2 +1,21 @@
1
1
  export type Predicate<X> = (x?: X) => boolean;
2
2
  export type PredicateBinary<X, Y> = (x?: X, y?: Y) => boolean;
3
+
4
+ /**
5
+ * Error configuration object. May only contain the options that need to be updated.
6
+ */
7
+ export interface ErrorHandlingConfig {
8
+ /**
9
+ * The max depth for stringifying objects.
10
+ * Setting to a non-positive or non-numeric value removes the max depth limit.
11
+ * Default: 5.
12
+ */
13
+ objectMaxDepth?: number;
14
+
15
+ /**
16
+ * Specifies whether the generated error URL will contain the parameters
17
+ * of the thrown error. Default: true.
18
+ * When used without argument, it returns the current value.
19
+ */
20
+ urlErrorParamsEnabled?: boolean;
21
+ }
@@ -970,16 +970,7 @@ export function assertArgFn(arg, name, acceptArrayAnnotation) {
970
970
  return arg;
971
971
  }
972
972
 
973
- /**
974
- * @typedef {Object} ErrorHandlingConfig
975
- * Error configuration object. May only contain the options that need to be updated.
976
- * @property {number=} objectMaxDepth - The max depth for stringifying objects. Setting to a
977
- * non-positive or non-numeric value removes the max depth limit. Default: 5.
978
- * @property {boolean=} urlErrorParamsEnabled - Specifies whether the generated error URL will
979
- * contain the parameters of the thrown error. Default: true. When used without argument, it returns the current value.
980
- */
981
-
982
- /** @type {ErrorHandlingConfig} */
973
+ /** @type {import("./interface.js").ErrorHandlingConfig} */
983
974
  const minErrConfig = {
984
975
  objectMaxDepth: 5,
985
976
  urlErrorParamsEnabled: true,
@@ -991,8 +982,8 @@ const minErrConfig = {
991
982
  *
992
983
  * Omitted or undefined options will leave the corresponding configuration values unchanged.
993
984
  *
994
- * @param {ErrorHandlingConfig} [config]
995
- * @returns {ErrorHandlingConfig}
985
+ * @param {import("./interface.ts").ErrorHandlingConfig} [config]
986
+ * @returns {import("./interface.ts").ErrorHandlingConfig}
996
987
  */
997
988
  export function errorHandlingConfig(config) {
998
989
  if (isObject(config)) {
@@ -9,6 +9,6 @@
9
9
  "outDir": "@types",
10
10
  "target": "ES2023"
11
11
  },
12
- "include": ["src"],
13
- "exclude": ["./node_modules/@types/**", "**/*.test.js", "**/*.spec.js"]
12
+ "include": ["src/interface.ts"],
13
+ "exclude": ["**/*.test.js", "**/*.spec.js"]
14
14
  }
@@ -1,150 +0,0 @@
1
- /**
2
- * Configuration option for AngularTS bootstrap process.
3
- *
4
- * @typedef {Object} AngularBootstrapConfig
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`.
6
- */
7
- export class Angular {
8
- $cache: Map<number, import("./interface.ts").ExpandoStore>;
9
- /** @type {import('./services/pubsub/pubsub.js').PubSub} */
10
- $eventBus: import("./services/pubsub/pubsub.js").PubSub;
11
- /**
12
- * @type {string} `version` from `package.json`
13
- */
14
- version: string;
15
- /** @type {!Array<string|any>} */
16
- bootsrappedModules: Array<string | any>;
17
- getController: typeof getController;
18
- getInjector: typeof getInjector;
19
- getScope: typeof getScope;
20
- errorHandlingConfig: typeof errorHandlingConfig;
21
- $t: Readonly<Record<string, string>>;
22
- /**
23
- * Use this function to manually start up AngularTS application.
24
- *
25
- * AngularTS will detect if it has been loaded into the browser more than once and only allow the
26
- * first loaded script to be bootstrapped and will report a warning to the browser console for
27
- * each of the subsequent scripts. This prevents strange results in applications, where otherwise
28
- * multiple instances of AngularTS try to work on the DOM.
29
- * *
30
- * <div class="alert alert-warning">
31
- * **Note:** Do not bootstrap the app on an element with a directive that uses {@link ng.$compile#transclusion transclusion},
32
- * such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and {@link ngRoute.ngView `ngView`}.
33
- * Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},
34
- * causing animations to stop working and making the injector inaccessible from outside the app.
35
- * </div>
36
- *
37
- * ```html
38
- * <!doctype html>
39
- * <html>
40
- * <body>
41
- * <div ng-controller="WelcomeController">
42
- * {{greeting}}
43
- * </div>
44
- *
45
- * <script src="angular.js"></script>
46
- * <script>
47
- * let app = angular.module('demo', [])
48
- * .controller('WelcomeController', function($scope) {
49
- * $scope.greeting = 'Welcome!';
50
- * });
51
- * angular.bootstrap(document, ['demo']);
52
- * </script>
53
- * </body>
54
- * </html>
55
- * ```
56
- *
57
- * @param {string | Element | Document} element DOM element which is the root of AngularTS application.
58
- * @param {Array<String|any>} [modules] an array of modules to load into the application.
59
- * Each item in the array should be the name of a predefined module or a (DI annotated)
60
- * function that will be invoked by the injector as a `config` block.
61
- * See: {@link angular.module modules}
62
- * @param {AngularBootstrapConfig} [config]
63
- * @returns {import('./core/di/internal-injector.js').InjectorService} The created injector instance for this application.
64
- */
65
- bootstrap(
66
- element: string | Element | Document,
67
- modules?: Array<string | any>,
68
- config?: AngularBootstrapConfig,
69
- ): import("./core/di/internal-injector.js").InjectorService;
70
- $injector: import("./core/di/internal-injector.js").InjectorService;
71
- /**
72
- * @param {any[]} modules
73
- * @param {boolean?} strictDi
74
- * @returns {import("./core/di/internal-injector.js").InjectorService}
75
- */
76
- injector(
77
- modules: any[],
78
- strictDi: boolean | null,
79
- ): import("./core/di/internal-injector.js").InjectorService;
80
- /**
81
- * @param {Element|Document} element
82
- */
83
- init(element: Element | Document): void;
84
- /**
85
- *
86
- * The `angular.module` is a global place for creating, registering and retrieving AngularTS
87
- * modules.
88
- * All modules (AngularTS core or 3rd party) that should be available to an application must be
89
- * registered using this mechanism.
90
- *
91
- * Passing one argument retrieves an existing {@link import('./interface.ts').Module},
92
- * whereas passing more than one argument creates a new {@link import('./interface.ts').Module}
93
- *
94
- *
95
- * # Module
96
- *
97
- * A module is a collection of services, directives, controllers, filters, and configuration information.
98
- * `angular.module` is used to configure the {@link auto.$injector $injector}.
99
- *
100
- * ```js
101
- * // Create a new module
102
- * let myModule = angular.module('myModule', []);
103
- *
104
- * // register a new service
105
- * myModule.value('appName', 'MyCoolApp');
106
- *
107
- * // configure existing services inside initialization blocks.
108
- * myModule.config(['$locationProvider', function($locationProvider) {
109
- * // Configure existing providers
110
- * $locationProvider.hashPrefix('!');
111
- * }]);
112
- * ```
113
- *
114
- * Then you can create an injector and load your modules like this:
115
- *
116
- * ```js
117
- * let injector = angular.injector(['ng', 'myModule'])
118
- * ```
119
- *
120
- * However it's more likely that you'll just use
121
- * {@link ng.directive:ngApp ngApp} or
122
- * {@link angular.bootstrap} to simplify this process for you.
123
- *
124
- * @param {string} name The name of the module to create or retrieve.
125
- * @param {Array.<string>} [requires] If specified then new module is being created. If
126
- * unspecified then the module is being retrieved for further configuration.
127
- * @param {import("./interface.js").Injectable} [configFn] Optional configuration function for the module that gets
128
- * passed to {@link NgModule.config NgModule.config()}.
129
- * @returns {NgModule} A newly registered module.
130
- */
131
- module(
132
- name: string,
133
- requires?: Array<string>,
134
- configFn?: import("./interface.js").Injectable,
135
- ): NgModule;
136
- }
137
- /**
138
- * Configuration option for AngularTS bootstrap process.
139
- */
140
- export type AngularBootstrapConfig = {
141
- /**
142
- * - Disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. Defaults to `false`.
143
- */
144
- strictDi?: boolean;
145
- };
146
- import { getController } from "./shared/dom.js";
147
- import { getInjector } from "./shared/dom.js";
148
- import { getScope } from "./shared/dom.js";
149
- import { errorHandlingConfig } from "./shared/utils.js";
150
- import { NgModule } from "./core/di/ng-module.js";
@@ -1,50 +0,0 @@
1
- export function animateCache(): {
2
- /**
3
- * Generates a unique cache key based on the node's parent and other parameters.
4
- * @param {HTMLElement} node - The DOM node to generate the cache key for.
5
- * @param {string} method - The animation method being applied.
6
- * @param {string} [addClass] - Class to add during the animation.
7
- * @param {string} [removeClass] - Class to remove during the animation.
8
- * @returns {string} - The generated cache key.
9
- */
10
- cacheKey(
11
- node: HTMLElement,
12
- method: string,
13
- addClass?: string,
14
- removeClass?: string,
15
- ): string;
16
- /**
17
- * Checks if a cached animation without a duration exists.
18
- * @param {string} key - The cache key to check.
19
- * @returns {boolean} - True if an invalid animation is cached, false otherwise.
20
- */
21
- containsCachedAnimationWithoutDuration(key: string): boolean;
22
- /**
23
- * Clears the cache.
24
- * @returns {void}
25
- */
26
- flush(): void;
27
- /**
28
- * Gets the count of a specific cache entry.
29
- * @param {string} key - The cache key to count.
30
- * @returns {number} - The count of the cache entry.
31
- */
32
- count(key: string): number;
33
- /**
34
- * Retrieves a value associated with a specific cache key.
35
- * @param {string} key - The cache key to retrieve.
36
- * @returns {any} - The value associated with the cache key.
37
- */
38
- get(key: string): any;
39
- /**
40
- * Adds or updates a cache entry.
41
- * @param {string} key - The cache key to add or update.
42
- * @param {any} value - The value to store.
43
- * @param {boolean} isValid - Whether the cache entry is valid.
44
- */
45
- put(key: string, value: any, isValid: boolean): void;
46
- };
47
- export function AnimateCacheProvider(): void;
48
- export class AnimateCacheProvider {
49
- $get: (typeof animateCache)[];
50
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * @param {*} $interpolate
3
- * @returns {import("../interface.ts").Directive}
4
- */
5
- export function $$AnimateChildrenDirective(
6
- $interpolate: any,
7
- ): import("../interface.ts").Directive;
8
- export namespace $$AnimateChildrenDirective {
9
- let $inject: string[];
10
- }
@@ -1,18 +0,0 @@
1
- export function AnimateCssDriverProvider($$animationProvider: any): void;
2
- export class AnimateCssDriverProvider {
3
- constructor($$animationProvider: any);
4
- /**
5
- * @returns {Function}
6
- */
7
- $get: (
8
- | string
9
- | ((
10
- $animateCss: any,
11
- $$AnimateRunner: typeof import("./animate-runner.js").AnimateRunner,
12
- $rootElement: Element,
13
- ) => (animationDetails: any) => any)
14
- )[];
15
- }
16
- export namespace AnimateCssDriverProvider {
17
- let $inject: string[];
18
- }
@@ -1,18 +0,0 @@
1
- export function AnimateCssProvider(): void;
2
- export class AnimateCssProvider {
3
- $get: (
4
- | string
5
- | ((
6
- $$AnimateRunner: any,
7
- $$animateCache: any,
8
- $$rAFScheduler: any,
9
- ) => (
10
- element: any,
11
- initialOptions: any,
12
- ) => {
13
- $$willAnimate: boolean;
14
- start(): any;
15
- end: () => void;
16
- })
17
- )[];
18
- }
@@ -1,14 +0,0 @@
1
- export function AnimateJsDriverProvider($$animationProvider: any): void;
2
- export class AnimateJsDriverProvider {
3
- constructor($$animationProvider: any);
4
- $get: (
5
- | string
6
- | ((
7
- $$animateJs: any,
8
- $$AnimateRunner: any,
9
- ) => (animationDetails: any) => any)
10
- )[];
11
- }
12
- export namespace AnimateJsDriverProvider {
13
- let $inject: string[];
14
- }
@@ -1,23 +0,0 @@
1
- export function AnimateJsProvider($animateProvider: any): void;
2
- export class AnimateJsProvider {
3
- constructor($animateProvider: any);
4
- $get: (
5
- | string
6
- | ((
7
- $injector: any,
8
- $$AnimateRunner: any,
9
- ) => (
10
- element: any,
11
- event: any,
12
- classes: any,
13
- options: any,
14
- ) => {
15
- $$willAnimate: boolean;
16
- end(): any;
17
- start(): any;
18
- })
19
- )[];
20
- }
21
- export namespace AnimateJsProvider {
22
- let $inject: string[];
23
- }
@@ -1,28 +0,0 @@
1
- export function AnimateQueueProvider($animateProvider: any): void;
2
- export class AnimateQueueProvider {
3
- constructor($animateProvider: any);
4
- rules: {
5
- skip: any[];
6
- cancel: any[];
7
- join: any[];
8
- };
9
- $get: (
10
- | string
11
- | ((
12
- $rootScope: import("../core/scope/scope.js").Scope,
13
- $injector: any,
14
- $$animation: any,
15
- $$AnimateRunner: any,
16
- $templateRequest: any,
17
- ) => {
18
- on(event: any, container: any, callback: any): void;
19
- off(event: any, container: any, callback: any, ...args: any[]): void;
20
- pin(element: any, parentElement: any): void;
21
- push(element: any, event: any, options: any, domOperation: any): any;
22
- enabled(element: any, bool: any, ...args: any[]): any;
23
- })
24
- )[];
25
- }
26
- export namespace AnimateQueueProvider {
27
- let $inject: string[];
28
- }