@angular-wave/angular.ts 0.7.8 → 0.8.0

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 (285) hide show
  1. package/@types/core/parse/parse.d.ts +6 -7
  2. package/@types/directive/bind/bind.d.ts +2 -1
  3. package/@types/index.d.ts +1 -1
  4. package/@types/interface.d.ts +3 -1
  5. package/@types/{public.d.ts → ng.d.ts} +2 -2
  6. package/@types/router/globals.d.ts +1 -1
  7. package/@types/router/path/path-utils.d.ts +8 -11
  8. package/@types/router/state/interface.d.ts +1 -1
  9. package/@types/router/state/state-object.d.ts +1 -1
  10. package/@types/router/state/state-service.d.ts +8 -7
  11. package/@types/router/state-filters.d.ts +24 -2
  12. package/@types/router/transition/transition.d.ts +12 -15
  13. package/@types/router/url/url-matcher.d.ts +3 -3
  14. package/@types/router/url/url-rule.d.ts +1 -0
  15. package/@types/router/url/url-rules.d.ts +26 -6
  16. package/@types/router/url/url-service.d.ts +28 -38
  17. package/@types/services/http/http.d.ts +48 -1
  18. package/@types/services/http-backend/http-backend.d.ts +48 -35
  19. package/@types/services/location/interface.d.ts +55 -0
  20. package/@types/services/location/location.d.ts +225 -252
  21. package/@types/shared/common.d.ts +0 -2
  22. package/@types/shared/interface.d.ts +0 -4
  23. package/@types/{router/common → shared}/queue.d.ts +2 -2
  24. package/@types/shared/url-utils/interface.d.ts +0 -1
  25. package/@types/shared/url-utils/url-utils.d.ts +0 -5
  26. package/@types/shared/utils.d.ts +29 -6
  27. package/Makefile +6 -3
  28. package/dist/angular-ts.esm.js +960 -1062
  29. package/dist/angular-ts.umd.js +960 -1062
  30. package/dist/angular-ts.umd.min.js +1 -1
  31. package/docs/assets/scss/index.scss +23 -0
  32. package/docs/content/_index.md +9 -8
  33. package/docs/content/docs/_index.md +1 -1
  34. package/docs/content/docs/directive/app.md +1 -1
  35. package/docs/content/docs/directive/bind.md +1 -1
  36. package/docs/content/docs/directive/blur.md +1 -1
  37. package/docs/content/docs/directive/channel.md +2 -2
  38. package/docs/content/docs/directive/class-even.md +1 -1
  39. package/docs/content/docs/directive/class-odd.md +1 -1
  40. package/docs/content/docs/directive/class.md +1 -1
  41. package/docs/content/docs/directive/click.md +1 -1
  42. package/docs/content/docs/directive/copy.md +1 -1
  43. package/docs/content/docs/directive/cut.md +1 -1
  44. package/docs/content/docs/directive/dblclick.md +1 -1
  45. package/docs/content/docs/directive/focus.md +1 -1
  46. package/docs/content/docs/directive/get.md +3 -3
  47. package/docs/content/docs/directive/keydown.md +1 -1
  48. package/docs/content/docs/directive/keyup.md +1 -1
  49. package/docs/content/docs/directive/load.md +1 -1
  50. package/docs/content/docs/directive/mousedown.md +1 -1
  51. package/docs/content/docs/directive/mouseenter.md +1 -1
  52. package/docs/content/docs/directive/mouseleave.md +1 -1
  53. package/docs/content/docs/directive/mousemove.md +1 -1
  54. package/docs/content/docs/directive/mouseout.md +1 -1
  55. package/docs/content/docs/directive/mouseover.md +1 -1
  56. package/docs/content/docs/directive/mouseup.md +1 -1
  57. package/docs/content/docs/directive/non-bindable.md +28 -0
  58. package/docs/content/docs/provider/locationProvider.md +26 -0
  59. package/docs/content/docs/provider/templateCacheProvider.md +2 -2
  60. package/docs/content/docs/service/location.md +57 -0
  61. package/docs/content/docs/service/url.md +5 -0
  62. package/docs/layouts/partials/hooks/head-end.html +1 -1
  63. package/docs/layouts/shortcodes/version.html +1 -0
  64. package/docs/static/examples/counter/counter-test.html +0 -4
  65. package/docs/static/examples/eventbus/eventbus-test.html +0 -4
  66. package/docs/static/examples/ng-non-bindable/ng-non-bindable-test.html +13 -0
  67. package/docs/static/examples/ng-non-bindable/ng-non-bindable.html +3 -0
  68. package/docs/static/examples/ng-non-bindable/ng-non-bindable.test.js +11 -0
  69. package/docs/static/typedoc/assets/highlight.css +6 -6
  70. package/docs/static/typedoc/assets/navigation.js +1 -1
  71. package/docs/static/typedoc/assets/search.js +1 -1
  72. package/docs/static/typedoc/classes/Location.html +55 -0
  73. package/docs/static/typedoc/classes/LocationProvider.html +20 -0
  74. package/docs/static/typedoc/index.html +1 -1
  75. package/docs/static/typedoc/interfaces/DefaultPorts.html +5 -0
  76. package/docs/static/typedoc/interfaces/Html5Mode.html +23 -0
  77. package/docs/static/typedoc/interfaces/Provider.html +2 -1
  78. package/docs/static/typedoc/interfaces/UrlParts.html +9 -0
  79. package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
  80. package/docs/static/typedoc/types/Expression.html +1 -1
  81. package/docs/static/typedoc/types/UrlChangeListener.html +5 -0
  82. package/docs/static/version.js +13 -0
  83. package/docs/test-results/.last-run.json +4 -0
  84. package/docs/test-results/static-examples-counter-counter-counter-example/error-context.md +50 -0
  85. package/package.json +1 -1
  86. package/src/{loader.js → angular.js} +1 -1
  87. package/src/angular.spec.js +189 -21
  88. package/src/animations/animate-css.js +17 -18
  89. package/src/animations/animate.spec.js +1 -1
  90. package/src/animations/shared.js +2 -3
  91. package/src/binding.spec.js +1 -1
  92. package/src/core/compile/compile.js +4 -7
  93. package/src/core/compile/compile.spec.js +1 -1
  94. package/src/core/controller/controller.spec.js +1 -1
  95. package/src/core/controller/controller.test.js +1 -0
  96. package/src/core/di/injector.js +7 -8
  97. package/src/core/di/injector.spec.js +2 -2
  98. package/src/core/di/injector.test.js +2 -2
  99. package/src/core/di/internal-injector.js +3 -6
  100. package/src/core/filter/filter.js +1 -1
  101. package/src/core/filter/filter.spec.js +1 -1
  102. package/src/core/filter/filter.test.js +1 -0
  103. package/src/core/interpolate/interpolate.js +4 -6
  104. package/src/core/interpolate/interpolate.spec.js +1 -1
  105. package/src/core/interpolate/interpolate.test.js +1 -0
  106. package/src/core/parse/ast/ast.spec.js +1 -1
  107. package/src/core/parse/ast/ast.test.js +1 -1
  108. package/src/core/parse/lexer/lexer.spec.js +1 -1
  109. package/src/core/parse/parse.js +150 -146
  110. package/src/core/parse/parse.spec.js +17 -16
  111. package/src/core/prop.spec.js +1 -1
  112. package/src/core/root-element.spec.js +1 -1
  113. package/src/core/scope/scope.js +10 -11
  114. package/src/core/scope/scope.spec.js +3 -4
  115. package/src/directive/aria/aria.spec.js +1 -1
  116. package/src/directive/aria/aria.test.js +1 -0
  117. package/src/directive/attrs/attrs.spec.js +1 -1
  118. package/src/directive/attrs/attrs.test.js +1 -0
  119. package/src/directive/attrs/boolean.spec.js +1 -1
  120. package/src/directive/attrs/boolean.test.js +1 -0
  121. package/src/directive/attrs/element-style.spec.js +1 -1
  122. package/src/directive/attrs/element-style.test.js +1 -0
  123. package/src/directive/attrs/src.spec.js +1 -1
  124. package/src/directive/attrs/src.test.js +1 -0
  125. package/src/directive/bind/bind-html.spec.js +1 -1
  126. package/src/directive/bind/bind.js +1 -0
  127. package/src/directive/bind/bind.spec.js +1 -1
  128. package/src/directive/bind/bind.test.js +1 -0
  129. package/src/directive/channel/channel.spec.js +1 -1
  130. package/src/directive/channel/channel.test.js +1 -0
  131. package/src/directive/class/class.spec.js +1 -1
  132. package/src/directive/class/class.test.js +1 -0
  133. package/src/directive/cloak/cloak.spec.js +1 -1
  134. package/src/directive/cloak/cloak.test.js +1 -0
  135. package/src/directive/controller/controller.spec.js +1 -1
  136. package/src/directive/controller/controller.test.js +1 -0
  137. package/src/directive/events/click.spec.js +1 -1
  138. package/src/directive/events/event.spec.js +1 -1
  139. package/src/directive/events/events.test.js +1 -0
  140. package/src/directive/form/form.js +8 -5
  141. package/src/directive/form/form.spec.js +1 -1
  142. package/src/directive/form/form.test.js +1 -0
  143. package/src/directive/http/delete.spec.js +1 -1
  144. package/src/directive/http/form-test.html +18 -0
  145. package/src/directive/http/get.spec.js +1 -1
  146. package/src/directive/http/http.js +12 -3
  147. package/src/directive/http/post.spec.js +504 -9
  148. package/src/directive/http/put.spec.js +1 -1
  149. package/src/directive/if/if.spec.js +1 -1
  150. package/src/directive/include/include.spec.js +1 -1
  151. package/src/directive/init/init.spec.js +1 -1
  152. package/src/directive/init/init.test.js +1 -0
  153. package/src/directive/input/input.js +13 -15
  154. package/src/directive/input/input.spec.js +1 -2
  155. package/src/directive/input/input.test.js +1 -0
  156. package/src/directive/messages/messages.spec.js +1 -1
  157. package/src/directive/messages/messages.test.js +1 -0
  158. package/src/directive/model/model.js +13 -13
  159. package/src/directive/model/model.spec.js +1 -1
  160. package/src/directive/model/model.test.js +1 -0
  161. package/src/directive/model-options/model-option.test.js +1 -0
  162. package/src/directive/model-options/model-options.js +1 -1
  163. package/src/directive/model-options/model-options.spec.js +1 -1
  164. package/src/directive/non-bindable/non-bindable.spec.js +1 -1
  165. package/src/directive/non-bindable/non-bindable.test.js +1 -0
  166. package/src/directive/observe/observe.spec.js +1 -1
  167. package/src/directive/observe/observe.test.js +1 -0
  168. package/src/directive/on/on.spec.js +1 -1
  169. package/src/directive/on/on.test.js +1 -0
  170. package/src/directive/options/options.spec.js +1 -1
  171. package/src/directive/options/options.test.js +1 -0
  172. package/src/directive/ref/href.spec.js +1 -1
  173. package/src/directive/ref/href.test.js +2 -0
  174. package/src/directive/ref/ref.spec.js +1 -1
  175. package/src/directive/repeat/repeat.spec.js +2 -3
  176. package/src/directive/repeat/repeat.test.js +1 -0
  177. package/src/directive/script/script.spec.js +1 -1
  178. package/src/directive/script/script.test.js +1 -0
  179. package/src/directive/select/select.js +1 -1
  180. package/src/directive/select/select.spec.js +1 -1
  181. package/src/directive/select/select.test.js +1 -0
  182. package/src/directive/setter/setter.spec.js +1 -1
  183. package/src/directive/setter/setter.test.js +1 -0
  184. package/src/directive/show-hide/show-hide.spec.js +1 -1
  185. package/src/directive/show-hide/show-hide.test.js +1 -0
  186. package/src/directive/style/style.spec.js +1 -1
  187. package/src/directive/style/style.test.js +1 -0
  188. package/src/directive/switch/switch.spec.js +1 -1
  189. package/src/directive/switch/switch.test.js +1 -0
  190. package/src/directive/validators/validators.js +82 -84
  191. package/src/directive/validators/validators.spec.js +5 -4
  192. package/src/directive/validators/validators.test.js +1 -0
  193. package/src/filters/filter.spec.js +1 -1
  194. package/src/filters/filters.spec.js +1 -1
  195. package/src/filters/limit-to.js +2 -3
  196. package/src/filters/limit-to.spec.js +1 -1
  197. package/src/filters/order-by.spec.js +1 -1
  198. package/src/index.js +1 -1
  199. package/src/injection-tokens.js +5 -1
  200. package/src/interface.ts +3 -1
  201. package/src/loader.md +0 -155
  202. package/src/{public.js → ng.js} +7 -8
  203. package/src/{public.spec.js → ng.spec.js} +1 -1
  204. package/src/router/directives/state-directives.spec.js +8 -7
  205. package/src/router/directives/view-directive.js +2 -8
  206. package/src/router/directives/view-directive.spec.js +8 -9
  207. package/src/router/{common/common.html → glob/glob.html} +2 -3
  208. package/src/router/{common/common.test.js → glob/glob.test.js} +2 -1
  209. package/src/router/globals.js +1 -1
  210. package/src/router/path/path-utils.js +5 -0
  211. package/src/router/router-test-hashbang.html +45 -0
  212. package/src/router/services.spec.js +5 -6
  213. package/src/router/state/interface.ts +1 -1
  214. package/src/router/state/state-builder.js +3 -3
  215. package/src/router/state/state-builder.spec.js +1 -1
  216. package/src/router/state/state-object.js +1 -1
  217. package/src/router/state/state-registry.js +2 -2
  218. package/src/router/state/state-service.js +13 -10
  219. package/src/router/state/state.spec.js +23 -22
  220. package/src/router/state/state.test.js +1 -0
  221. package/src/router/state/views.js +1 -1
  222. package/src/router/state-filter.spec.js +1 -1
  223. package/src/router/state-filters.js +13 -9
  224. package/src/router/template-factory.js +5 -4
  225. package/src/router/template-factory.spec.js +1 -1
  226. package/src/router/transition/hook-registry.js +1 -1
  227. package/src/router/transition/transition-service.js +6 -5
  228. package/src/router/transition/transition.js +4 -4
  229. package/src/router/url/url-matcher.js +3 -3
  230. package/src/router/url/url-rule.js +1 -0
  231. package/src/router/url/url-rules.js +8 -5
  232. package/src/router/url/url-service.js +77 -76
  233. package/src/router/url/url-service.spec.js +55 -39
  234. package/src/router/url/url.test.js +1 -0
  235. package/src/router/view/view.js +4 -5
  236. package/src/router/view/view.spec.js +10 -12
  237. package/src/router/view/view.test.js +1 -0
  238. package/src/router/view-hook.spec.js +1 -1
  239. package/src/router/view-scroll.spec.js +1 -1
  240. package/src/services/anchor-scroll.html +2 -2
  241. package/src/services/anchor-scroll.js +5 -4
  242. package/src/services/http/http.js +9 -4
  243. package/src/services/http/http.spec.js +2 -7
  244. package/src/services/http/template-request.spec.js +1 -1
  245. package/src/services/http-backend/http-backend.js +51 -77
  246. package/src/services/http-backend/http-backend.spec.js +1 -2
  247. package/src/services/http-backend/http-backend.test.js +1 -0
  248. package/src/services/location/interface.ts +62 -0
  249. package/src/services/location/location.js +433 -520
  250. package/src/services/location/location.spec.js +909 -530
  251. package/src/services/location/location.test.js +2 -2
  252. package/src/services/log/log.spec.js +1 -1
  253. package/src/services/log/log.test.js +1 -0
  254. package/src/services/pubsub/pubsub.spec.js +1 -1
  255. package/src/services/sce/sce.js +5 -7
  256. package/src/services/sce/sce.md +2 -2
  257. package/src/services/sce/sce.spec.js +1 -1
  258. package/src/services/template-cache/template-cache.spec.js +1 -1
  259. package/src/services/template-cache/template-cache.test.js +1 -0
  260. package/src/shared/common.js +0 -5
  261. package/src/shared/common.spec.js +1 -1
  262. package/src/shared/interface.ts +0 -4
  263. package/src/{router/common → shared}/queue.js +7 -7
  264. package/src/shared/shared.html +1 -0
  265. package/src/shared/shared.test.js +1 -0
  266. package/src/shared/url-utils/interface.ts +0 -2
  267. package/src/shared/url-utils/url-utils.js +6 -30
  268. package/src/shared/url-utils/url-utils.spec.js +10 -9
  269. package/src/shared/utils.js +32 -9
  270. package/src/shared/utils.spec.js +35 -1
  271. package/src/src.html +1 -2
  272. package/typedoc.json +0 -1
  273. package/utils/express.js +27 -1
  274. package/utils/version.cjs +23 -0
  275. package/@types/router/state-provider.d.ts +0 -123
  276. package/src/directive/non-bindable/non-bindable.md +0 -17
  277. package/src/loader.spec.js +0 -169
  278. package/src/router/state-provider.js +0 -146
  279. package/src/services/location/location.md +0 -114
  280. package/src/shared/url-utils/url-utils.md +0 -46
  281. /package/@types/{loader.d.ts → angular.d.ts} +0 -0
  282. /package/@types/router/{common → glob}/glob.d.ts +0 -0
  283. /package/src/router/{common → glob}/glob.js +0 -0
  284. /package/src/router/{common → glob}/glob.spec.js +0 -0
  285. /package/src/{router/common → shared}/queue.spec.js +0 -0
@@ -6,14 +6,14 @@ import {
6
6
  silentRejection,
7
7
  } from "../../shared/common.js";
8
8
  import { isDefined, isObject, isString, minErr } from "../../shared/utils.js";
9
- import { Queue } from "../common/queue.js";
9
+ import { Queue } from "../../shared/queue.js";
10
10
  import { makeTargetState } from "../path/path-utils.js";
11
11
  import { PathNode } from "../path/path-node.js";
12
12
  import { defaultTransOpts } from "../transition/transition-service.js";
13
13
  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
- import { Glob } from "../common/glob.js";
16
+ import { Glob } from "../glob/glob.js";
17
17
  import { ResolveContext } from "../resolve/resolve-context.js";
18
18
  import { lazyLoadState } from "../hooks/lazy-load.js";
19
19
  import { val } from "../../shared/hof.js";
@@ -52,7 +52,10 @@ export class StateProvider {
52
52
  return this.globals.$current;
53
53
  }
54
54
 
55
- static $inject = ["$routerGlobalsProvider", "$transitionsProvider"];
55
+ /* @ignore */ static $inject = [
56
+ "$routerGlobalsProvider",
57
+ "$transitionsProvider",
58
+ ];
56
59
 
57
60
  // Needs access to urlService, stateRegistry
58
61
  /**
@@ -131,9 +134,9 @@ export class StateProvider {
131
134
  * - **params** `{object}` - returns an array of state params that are ensured to
132
135
  * be a super-set of parent's params.
133
136
  * - **views** `{object}` - returns a views object where each key is an absolute view
134
- * name (i.e. "viewName@stateName") and each value is the config object
137
+ * name (i.e. "viewName@stateName") and each value is the urlConfig object
135
138
  * (template, controller) for the view. Even when you don't use the views object
136
- * explicitly on a state config, one is still created for you internally.
139
+ * explicitly on a state urlConfig, one is still created for you internally.
137
140
  * So by decorating this builder function you have access to decorating template
138
141
  * and controller properties.
139
142
  * - **ownParams** `{object}` - returns an array of params that belong to the state,
@@ -151,10 +154,10 @@ export class StateProvider {
151
154
  * let result = {},
152
155
  * views = parent(state);
153
156
  *
154
- * angular.forEach(views, function (config, name) {
157
+ * angular.forEach(views, function (urlConfig, name) {
155
158
  * let autoName = (state.name + '.' + name).replace('.', '/');
156
- * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';
157
- * result[name] = config;
159
+ * urlConfig.templateUrl = urlConfig.templateUrl || '/partials/' + autoName + '.html';
160
+ * result[name] = urlConfig;
158
161
  * });
159
162
  * return result;
160
163
  * });
@@ -178,7 +181,7 @@ export class StateProvider {
178
181
  * @param {object} func A function that is responsible for decorating the original
179
182
  * builder function. The function receives two parameters:
180
183
  *
181
- * - `{object}` - state - The state config object.
184
+ * - `{object}` - state - The state urlConfig object.
182
185
  * - `{object}` - super - The original builder function.
183
186
  *
184
187
  * @return {object} $stateProvider - $stateProvider instance
@@ -411,7 +414,7 @@ export class StateProvider {
411
414
  const globals = this.globals;
412
415
  const latestSuccess = globals.successfulTransitions.peekTail();
413
416
  const rootPath = () => [new PathNode(this.stateRegistry.root())];
414
- return latestSuccess ? latestSuccess.treeChanges().to : rootPath();
417
+ return latestSuccess ? latestSuccess._treeChanges.to : rootPath();
415
418
  }
416
419
  /**
417
420
  * Low-level method for transitioning to a new state.
@@ -1,5 +1,5 @@
1
1
  import { dealoc } from "../../shared/dom.js";
2
- import { Angular } from "../../loader.js";
2
+ import { Angular } from "../../angular.js";
3
3
  import { isFunction } from "../../shared/utils.js";
4
4
  import { wait } from "../../shared/test-utils.js";
5
5
 
@@ -101,8 +101,9 @@ describe("$state", () => {
101
101
  // some tests are polluting the cache
102
102
  window.angular = new Angular();
103
103
  module = window.angular.module("defaultModule", []);
104
- module.config((_$stateProvider_, _$provide_) => {
104
+ module.config((_$stateProvider_, _$provide_, _$locationProvider_) => {
105
105
  $stateProvider = _$stateProvider_;
106
+ _$locationProvider_.html5ModeConf.enabled = false;
106
107
  });
107
108
  window.angular.bootstrap(document.getElementById("app"), [
108
109
  "defaultModule",
@@ -143,10 +144,10 @@ describe("$state", () => {
143
144
  dealoc(document.getElementById("app"));
144
145
  window.angular = new Angular();
145
146
  module = window.angular.module("defaultModule", []);
146
- module.config((_$stateProvider_, _$provide_) => {
147
+ module.config((_$stateProvider_, _$provide_, _$locationProvider_) => {
147
148
  $stateProvider = _$stateProvider_;
148
149
  $provide = _$provide_;
149
-
150
+ _$locationProvider_.html5ModeConf.enabled = false;
150
151
  [A, B, C, D, DD, E, H, HH, HHH].forEach(function (state) {
151
152
  state.onEnter = callbackLogger(state, "onEnter");
152
153
  state.onExit = callbackLogger(state, "onExit");
@@ -457,7 +458,7 @@ describe("$state", () => {
457
458
  }).forEach(([k, v]) => {
458
459
  expect($stateParams[k]).toEqual(v);
459
460
  });
460
- expect($location.url()).toEqual(
461
+ expect($location.getUrl()).toEqual(
461
462
  "/dynstate/p1/pd1?search=s1&searchDyn=sd1",
462
463
  );
463
464
  });
@@ -617,14 +618,14 @@ describe("$state", () => {
617
618
  });
618
619
 
619
620
  it("does not exit nor enter a state when only dynamic params change (triggered via url)", async () => {
620
- $location.search({ search: "s1", searchDyn: "sd2" });
621
+ $location.setSearch({ search: "s1", searchDyn: "sd2" });
621
622
  $rootScope.$broadcast("$locationChangeSuccess");
622
623
  await wait(100);
623
624
  expect(dynlog).toBe("success;[searchDyn=sd2];");
624
625
  });
625
626
 
626
627
  it("exits and enters a state when any non-dynamic params change (triggered via url)", async () => {
627
- $location.search({ search: "s2", searchDyn: "sd2" });
628
+ $location.setSearch({ search: "s2", searchDyn: "sd2" });
628
629
  $rootScope.$broadcast("$locationChangeSuccess");
629
630
  await wait(100);
630
631
  expect(dynlog).toBe("exit:dyn;enter:dyn;success;");
@@ -650,23 +651,23 @@ describe("$state", () => {
650
651
  });
651
652
  });
652
653
 
653
- it("updates $stateParams and $location.search when only dynamic params change (triggered via url)", async () => {
654
- $location.search({ search: "s1", searchDyn: "sd2" });
654
+ it("updates $stateParams and $location.setSearch when only dynamic params change (triggered via url)", async () => {
655
+ $location.setSearch({ search: "s1", searchDyn: "sd2" });
655
656
  $rootScope.$broadcast("$locationChangeSuccess");
656
657
  await wait(100);
657
658
  expect($stateParams.search).toBe("s1");
658
659
  expect($stateParams.searchDyn).toBe("sd2");
659
- expect($location.search()).toEqual({
660
+ expect($location.getSearch()).toEqual({
660
661
  search: "s1",
661
662
  searchDyn: "sd2",
662
663
  });
663
664
  });
664
665
 
665
- it("updates $stateParams and $location.search when only dynamic params change (triggered via $state transition)", async () => {
666
+ it("updates $stateParams and $location.setSearch when only dynamic params change (triggered via $state transition)", async () => {
666
667
  await $state.go(".", { searchDyn: "sd2" });
667
668
  expect($stateParams.search).toBe("s1");
668
669
  expect($stateParams.searchDyn).toBe("sd2");
669
- expect($location.search()).toEqual({
670
+ expect($location.getSearch()).toEqual({
670
671
  search: "s1",
671
672
  searchDyn: "sd2",
672
673
  });
@@ -683,7 +684,7 @@ describe("$state", () => {
683
684
  // observedParamValue = newval;
684
685
  // });
685
686
  // await wait(100);
686
- // $location.search({ search: "s1", searchDyn: "sd2" });
687
+ // $location.setSearch({ search: "s1", searchDyn: "sd2" });
687
688
  // $rootScope.$broadcast("$locationChangeSuccess");
688
689
 
689
690
  // await wait(100);
@@ -806,7 +807,7 @@ describe("$state", () => {
806
807
  // this passes in isolation
807
808
  it("updates $stateParams", async () => {
808
809
  await initStateTo(RS);
809
- $location.search({ term: "hello" });
810
+ $location.setSearch({ term: "hello" });
810
811
  $rootScope.$broadcast("$locationChangeSuccess");
811
812
  await wait(100);
812
813
  expect($stateParams.term).toEqual("hello");
@@ -814,10 +815,10 @@ describe("$state", () => {
814
815
  });
815
816
 
816
817
  it("doesn't re-enter state (triggered by url change)", async () => {
817
- $location.search({ term: "hello" });
818
+ $location.setSearch({ term: "hello" });
818
819
  $rootScope.$broadcast("$locationChangeSuccess");
819
820
 
820
- expect($location.search()).toEqual({ term: "hello" });
821
+ expect($location.getSearch()).toEqual({ term: "hello" });
821
822
  expect(entered).toBeFalsy();
822
823
  });
823
824
 
@@ -833,7 +834,7 @@ describe("$state", () => {
833
834
  expect($state.current).toBe(RS);
834
835
  expect(entered).toBeFalsy();
835
836
  expect(success).toBeTruthy();
836
- expect($location.search()).toEqual({ term: "hello" });
837
+ expect($location.getSearch()).toEqual({ term: "hello" });
837
838
  });
838
839
 
839
840
  it("updates URL when (triggered by $state transition)", async () => {
@@ -841,7 +842,7 @@ describe("$state", () => {
841
842
  await $state.go(".", { term: "goodbye" });
842
843
 
843
844
  expect($stateParams.term).toEqual("goodbye");
844
- expect($location.url()).toEqual("/search?term=goodbye");
845
+ expect($location.getUrl()).toEqual("/search?term=goodbye");
845
846
  expect(entered).toBeFalsy();
846
847
  });
847
848
  });
@@ -976,19 +977,19 @@ describe("$state", () => {
976
977
 
977
978
  it("updates the location #fragment", async () => {
978
979
  await $state.transitionTo("home.item", { id: "world", "#": "frag" });
979
- expect($location.url()).toBe("/front/world#frag");
980
- expect($location.hash()).toBe("frag");
980
+ expect($location.getUrl()).toBe("/front/world#frag");
981
+ expect($location.getHash()).toBe("frag");
981
982
  });
982
983
 
983
984
  // passes in isolation. on success callback being polluted
984
985
  it("runs a transition when the location #fragment is updated", async () => {
985
986
  $state.transitionTo("home.item", { id: "world", "#": "frag" });
986
987
  await wait(100);
987
- expect($location.hash()).toBe("frag");
988
+ expect($location.getHash()).toBe("frag");
988
989
 
989
990
  $state.transitionTo("home.item", { id: "world", "#": "blarg" });
990
991
  await wait(100);
991
- expect($location.hash()).toBe("blarg");
992
+ expect($location.getHash()).toBe("blarg");
992
993
  });
993
994
 
994
995
  it("injects $transition$ into resolves", async () => {
@@ -5,6 +5,7 @@ const TEST_URL = "src/router/state/state.html?random=false";
5
5
  test("unit tests contain no errors", async ({ page }) => {
6
6
  await page.goto(TEST_URL);
7
7
  await page.content();
8
+ await page.waitForTimeout(1000);
8
9
  await expect(page.locator(".jasmine-overall-result")).toHaveText(
9
10
  /0 failures/,
10
11
  );
@@ -64,7 +64,7 @@ export function ng1ViewsBuilder(state) {
64
64
  name = name || "$default";
65
65
  // Account for views: { header: "headerComponent" }
66
66
  if (isString(config)) config = { component: config };
67
- // Make a shallow copy of the config object
67
+ // Make a shallow copy of the urlConfig object
68
68
  config = Object.assign({}, config);
69
69
  // Do not allow a view to mix props for component-style view with props for template/controller-style view
70
70
  if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {
@@ -1,4 +1,4 @@
1
- import { Angular } from "../loader.js";
1
+ import { Angular } from "../angular.js";
2
2
  import { dealoc } from "../shared/dom.js";
3
3
 
4
4
  describe("router filters", function () {
@@ -1,3 +1,7 @@
1
+ import { $injectTokens as $t } from "../injection-tokens.js";
2
+
3
+ $IsStateFilter.$inject = [$t.$state];
4
+
1
5
  /**
2
6
  * `isState` Filter: truthy if the current state is the parameter
3
7
  *
@@ -7,18 +11,19 @@
7
11
  * ```html
8
12
  * <div ng-if="'stateName' | isState">show if state is 'stateName'</div>
9
13
  * ```
10
- */
11
- $IsStateFilter.$inject = ["$state"];
12
- /**
14
+ *
15
+ * @param {import('./state/state-service.js').StateProvider} $state
13
16
  * @returns {import('../interface.ts').FilterFn}
14
17
  */
15
18
  export function $IsStateFilter($state) {
16
- const isFilter = function (state, params, options) {
17
- return $state.is(state, params, options);
18
- };
19
+ const isFilter = (state, params, options) =>
20
+ $state.is(state, params, options);
19
21
  isFilter.$stateful = true;
20
22
  return isFilter;
21
23
  }
24
+
25
+ $IncludedByStateFilter.$inject = [$t.$state];
26
+
22
27
  /**
23
28
  * `includedByState` Filter: truthy if the current state includes the parameter
24
29
  *
@@ -28,9 +33,8 @@ export function $IsStateFilter($state) {
28
33
  * ```html
29
34
  * <div ng-if="'fullOrPartialStateName' | includedByState">show if state includes 'fullOrPartialStateName'</div>
30
35
  * ```
31
- */
32
- $IncludedByStateFilter.$inject = ["$state"];
33
- /**
36
+ *
37
+ * @param {import('./state/state-service.js').StateProvider} $state
34
38
  * @returns {import('../interface.ts').FilterFn}
35
39
  */
36
40
  export function $IncludedByStateFilter($state) {
@@ -4,6 +4,7 @@ import { Resolvable } from "./resolve/resolvable.js";
4
4
  import { kebobString } from "../shared/strings.js";
5
5
  import { annotate } from "../core/di/injector.js";
6
6
  import { DirectiveSuffix } from "../core/compile/compile.js";
7
+ import { $injectTokens as $t } from "../injection-tokens.js";
7
8
 
8
9
  /**
9
10
  * @typedef BindingTuple
@@ -21,10 +22,10 @@ export class TemplateFactoryProvider {
21
22
  }
22
23
 
23
24
  $get = [
24
- "$http",
25
- "$templateCache",
26
- "$templateRequest",
27
- "$injector",
25
+ $t.$http,
26
+ $t.$templateCache,
27
+ $t.$templateRequest,
28
+ $t.$injector,
28
29
  /**
29
30
  * @param {import("interface.ts").HttpService} $http
30
31
  * @param {import("../services/template-cache/interface.ts").TemplateCache} $templateCache
@@ -1,5 +1,5 @@
1
1
  import { dealoc } from "../shared/dom.js";
2
- import { Angular } from "../loader.js";
2
+ import { Angular } from "../angular.js";
3
3
  import { wait } from "../shared/test-utils.js";
4
4
 
5
5
  describe("templateFactory", () => {
@@ -1,6 +1,6 @@
1
1
  import { removeFrom, tail, map } from "../../shared/common.js";
2
2
  import { isString, isFunction } from "../../shared/utils.js";
3
- import { Glob } from "../common/glob.js";
3
+ import { Glob } from "../glob/glob.js";
4
4
  import { TransitionHookScope } from "./interface.js";
5
5
  /**
6
6
  * Determines if the given state matches the matchCriteria
@@ -31,6 +31,7 @@ import { registerIgnoredTransitionHook } from "../hooks/ignored-transition.js";
31
31
  import { registerInvalidTransitionHook } from "../hooks/invalid-transition.js";
32
32
  import { registerRedirectToHook } from "../hooks/redirect-to.js";
33
33
  import { registerUpdateUrl } from "../hooks/url.js";
34
+ import { $injectTokens as $t, provider } from "../../injection-tokens.js";
34
35
  /**
35
36
  * The default [[Transition]] options.
36
37
  *
@@ -61,7 +62,7 @@ export let defaultTransOpts = {
61
62
  * This API is located at `router.transitionService` ([[UIRouter.transitionService]])
62
63
  */
63
64
  export class TransitionProvider {
64
- static $inject = ["$routerGlobalsProvider", "$viewProvider"];
65
+ /* @ignore */ static $inject = provider([$t.$routerGlobals, $t.$view]);
65
66
 
66
67
  /**
67
68
  * @param {import('../globals.js').RouterGlobals} globals
@@ -92,10 +93,10 @@ export class TransitionProvider {
92
93
  }
93
94
 
94
95
  $get = [
95
- "$state",
96
- "$urlService",
97
- "$stateRegistry",
98
- "$view",
96
+ $t.$state,
97
+ $t.$url,
98
+ $t.$stateRegistry,
99
+ $t.$view,
99
100
  (stateService, urlService, stateRegistry, viewService) => {
100
101
  // Lazy load state trees
101
102
  this._deregisterHookFns.lazyLoad = registerLazyLoadHook(
@@ -40,9 +40,9 @@ export class Transition {
40
40
  *
41
41
  * If the target state is not valid, an error is thrown.
42
42
  *
43
- * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`
43
+ * @param {Array<import('../path/path-node.js').PathNode>} fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`
44
44
  * encapsulates the "from state".
45
- * @param targetState The target state and parameters being transitioned to (also, the transition options)
45
+ * @param {import('../state/target-state.js').TargetState} targetState The target state and parameters being transitioned to (also, the transition options)
46
46
  * @param {import('../transition/transition-service.js').TransitionProvider} transitionService The [[TransitionService]] instance
47
47
  * @param {import('../globals.js').RouterGlobals} globals
48
48
  */
@@ -586,8 +586,8 @@ export class Transition {
586
586
  ).length
587
587
  );
588
588
  };
589
- const newTC = this.treeChanges();
590
- const pendTC = pending && pending.treeChanges();
589
+ const newTC = this._treeChanges;
590
+ const pendTC = pending && pending._treeChanges;
591
591
  if (
592
592
  pendTC &&
593
593
  same(pendTC.to, newTC.to) &&
@@ -334,9 +334,9 @@ export class UrlMatcher {
334
334
  * // returns { id: 'bob', q: 'hello', r: null }
335
335
  * ```
336
336
  *
337
- * @param path The URL path to match, e.g. `$location.path()`.
338
- * @param search URL search parameters, e.g. `$location.search()`.
339
- * @param hash URL hash e.g. `$location.hash()`.
337
+ * @param path The URL path to match, e.g. `$location.getPath()`.
338
+ * @param search URL search parameters, e.g. `$location.getSearch()`.
339
+ * @param hash URL hash e.g. `$location.getHash()`.
340
340
  *
341
341
  * @returns The captured parameter values.
342
342
  */
@@ -211,6 +211,7 @@ export class BaseUrlRule {
211
211
  this.$id = -1;
212
212
  this._group = undefined;
213
213
  this.handler = handler || ((x) => x);
214
+ this.priority = undefined;
214
215
  }
215
216
 
216
217
  /**
@@ -5,7 +5,9 @@ import { isDefined, isFunction, isString } from "../../shared/utils.js";
5
5
  import { removeFrom } from "../../shared/common.js";
6
6
  import { UrlRuleFactory } from "./url-rule.js";
7
7
 
8
- const prioritySort = (a, b) => (b.priority || 0) - (a.priority || 0);
8
+ function prioritySort(a, b) {
9
+ return (b.priority || 0) - (a.priority || 0);
10
+ }
9
11
 
10
12
  const typeSort = (a, b) => {
11
13
  const weights = { STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1 };
@@ -36,8 +38,7 @@ const idSort = (a, b) => {
36
38
  * - Equally sorted State and UrlMatcher rules will each match the URL.
37
39
  * Then, the *best* match is chosen based on how many parameter values were matched.
38
40
  */
39
- let defaultRuleSortFn;
40
- defaultRuleSortFn = (a, b) => {
41
+ function defaultRuleSortFn(a, b) {
41
42
  let cmp = prioritySort(a, b);
42
43
  if (cmp !== 0) return cmp;
43
44
  cmp = typeSort(a, b);
@@ -45,7 +46,8 @@ defaultRuleSortFn = (a, b) => {
45
46
  cmp = urlMatcherSort(a, b);
46
47
  if (cmp !== 0) return cmp;
47
48
  return idSort(a, b);
48
- };
49
+ }
50
+
49
51
  function getHandlerFn(handler) {
50
52
  if (
51
53
  !isFunction(handler) &&
@@ -67,9 +69,10 @@ function getHandlerFn(handler) {
67
69
  *
68
70
  * The most commonly used methods are [[otherwise]] and [[when]].
69
71
  *
70
- * This API is found at `$urlService.rules` (see: [[UIRouter.urlService]], [[URLService.rules]])
72
+ * This API is found at `$url.rules` (see: [[UIRouter.urlService]], [[URLService.rules]])
71
73
  */
72
74
  export class UrlRules {
75
+ /** @param {UrlRuleFactory} urlRuleFactory */
73
76
  constructor(urlRuleFactory) {
74
77
  this._sortFn = defaultRuleSortFn;
75
78
  this._rules = [];