@angular-wave/angular.ts 0.7.8 → 0.8.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 (308) hide show
  1. package/@types/{loader.d.ts → angular.d.ts} +3 -3
  2. package/@types/core/di/ng-module.d.ts +61 -25
  3. package/@types/core/parse/parse.d.ts +6 -7
  4. package/@types/directive/bind/bind.d.ts +2 -1
  5. package/@types/index.d.ts +1 -1
  6. package/@types/interface.d.ts +4 -2
  7. package/@types/{public.d.ts → ng.d.ts} +2 -2
  8. package/@types/router/directives/state-directives.d.ts +2 -2
  9. package/@types/router/directives/view-directive.d.ts +1 -1
  10. package/@types/router/params/param-type.d.ts +0 -1
  11. package/@types/router/path/path-utils.d.ts +8 -11
  12. package/@types/router/{globals.d.ts → router.d.ts} +2 -2
  13. package/@types/router/state/interface.d.ts +1 -1
  14. package/@types/router/state/state-object.d.ts +1 -1
  15. package/@types/router/state/state-registry.d.ts +2 -2
  16. package/@types/router/state/state-service.d.ts +14 -16
  17. package/@types/router/state-filters.d.ts +24 -2
  18. package/@types/router/transition/transition-service.d.ts +3 -3
  19. package/@types/router/transition/transition.d.ts +16 -19
  20. package/@types/router/url/url-matcher.d.ts +3 -4
  21. package/@types/router/url/url-rule.d.ts +14 -4
  22. package/@types/router/url/url-rules.d.ts +26 -6
  23. package/@types/router/url/url-service.d.ts +28 -38
  24. package/@types/services/http/http.d.ts +48 -1
  25. package/@types/services/http-backend/http-backend.d.ts +48 -35
  26. package/@types/services/location/interface.d.ts +55 -0
  27. package/@types/services/location/location.d.ts +225 -252
  28. package/@types/shared/common.d.ts +0 -2
  29. package/@types/shared/hof.d.ts +0 -6
  30. package/@types/shared/interface.d.ts +0 -4
  31. package/@types/{router/common → shared}/queue.d.ts +2 -2
  32. package/@types/shared/url-utils/interface.d.ts +0 -1
  33. package/@types/shared/url-utils/url-utils.d.ts +0 -5
  34. package/@types/shared/utils.d.ts +29 -6
  35. package/CHANGELOG.md +0 -72
  36. package/CONTRIBUTING.md +0 -1
  37. package/DEVELOPERS.md +0 -1
  38. package/Makefile +6 -3
  39. package/TRIAGING.md +0 -1
  40. package/dist/angular-ts.esm.js +1048 -1150
  41. package/dist/angular-ts.umd.js +1048 -1150
  42. package/dist/angular-ts.umd.min.js +1 -1
  43. package/docs/assets/scss/index.scss +23 -0
  44. package/docs/content/_index.md +9 -8
  45. package/docs/content/docs/_index.md +1 -1
  46. package/docs/content/docs/directive/app.md +1 -1
  47. package/docs/content/docs/directive/bind.md +1 -1
  48. package/docs/content/docs/directive/blur.md +1 -1
  49. package/docs/content/docs/directive/channel.md +2 -2
  50. package/docs/content/docs/directive/class-even.md +1 -1
  51. package/docs/content/docs/directive/class-odd.md +1 -1
  52. package/docs/content/docs/directive/class.md +1 -1
  53. package/docs/content/docs/directive/click.md +1 -1
  54. package/docs/content/docs/directive/copy.md +1 -1
  55. package/docs/content/docs/directive/cut.md +1 -1
  56. package/docs/content/docs/directive/dblclick.md +1 -1
  57. package/docs/content/docs/directive/focus.md +1 -1
  58. package/docs/content/docs/directive/get.md +3 -3
  59. package/docs/content/docs/directive/keydown.md +1 -1
  60. package/docs/content/docs/directive/keyup.md +1 -1
  61. package/docs/content/docs/directive/load.md +1 -1
  62. package/docs/content/docs/directive/mousedown.md +1 -1
  63. package/docs/content/docs/directive/mouseenter.md +1 -1
  64. package/docs/content/docs/directive/mouseleave.md +1 -1
  65. package/docs/content/docs/directive/mousemove.md +1 -1
  66. package/docs/content/docs/directive/mouseout.md +1 -1
  67. package/docs/content/docs/directive/mouseover.md +1 -1
  68. package/docs/content/docs/directive/mouseup.md +1 -1
  69. package/docs/content/docs/directive/non-bindable.md +28 -0
  70. package/docs/content/docs/provider/locationProvider.md +26 -0
  71. package/docs/content/docs/provider/templateCacheProvider.md +2 -2
  72. package/docs/content/docs/service/location.md +57 -0
  73. package/docs/content/docs/service/url.md +5 -0
  74. package/docs/layouts/partials/hooks/head-end.html +1 -1
  75. package/docs/layouts/shortcodes/version.html +1 -0
  76. package/docs/static/examples/counter/counter-test.html +0 -4
  77. package/docs/static/examples/eventbus/eventbus-test.html +0 -4
  78. package/docs/static/examples/ng-non-bindable/ng-non-bindable-test.html +13 -0
  79. package/docs/static/examples/ng-non-bindable/ng-non-bindable.html +3 -0
  80. package/docs/static/examples/ng-non-bindable/ng-non-bindable.test.js +11 -0
  81. package/docs/static/typedoc/assets/hierarchy.js +1 -1
  82. package/docs/static/typedoc/assets/highlight.css +6 -6
  83. package/docs/static/typedoc/assets/navigation.js +1 -1
  84. package/docs/static/typedoc/assets/search.js +1 -1
  85. package/docs/static/typedoc/classes/Location.html +55 -0
  86. package/docs/static/typedoc/classes/LocationProvider.html +20 -0
  87. package/docs/static/typedoc/classes/NgModule.html +3 -3
  88. package/docs/static/typedoc/index.html +1 -1
  89. package/docs/static/typedoc/interfaces/DefaultPorts.html +5 -0
  90. package/docs/static/typedoc/interfaces/Html5Mode.html +23 -0
  91. package/docs/static/typedoc/interfaces/Provider.html +2 -1
  92. package/docs/static/typedoc/interfaces/UrlParts.html +9 -0
  93. package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
  94. package/docs/static/typedoc/types/Expression.html +1 -1
  95. package/docs/static/typedoc/types/Injectable.html +4 -1
  96. package/docs/static/typedoc/types/InjectableFactory.html +1 -4
  97. package/docs/static/typedoc/types/UrlChangeListener.html +5 -0
  98. package/docs/static/version.js +13 -0
  99. package/docs/test-results/.last-run.json +4 -0
  100. package/docs/test-results/static-examples-counter-counter-counter-example/error-context.md +50 -0
  101. package/package.json +2 -2
  102. package/src/{loader.js → angular.js} +11 -11
  103. package/src/angular.spec.js +189 -21
  104. package/src/animations/animate-css.js +17 -18
  105. package/src/animations/animate.spec.js +1 -1
  106. package/src/animations/shared.js +2 -3
  107. package/src/binding.spec.js +1 -1
  108. package/src/core/compile/compile.js +4 -7
  109. package/src/core/compile/compile.spec.js +1 -1
  110. package/src/core/controller/controller.spec.js +1 -1
  111. package/src/core/controller/controller.test.js +1 -0
  112. package/src/core/di/injector.js +7 -8
  113. package/src/core/di/injector.spec.js +2 -2
  114. package/src/core/di/injector.test.js +2 -2
  115. package/src/core/di/internal-injector.js +3 -6
  116. package/src/core/di/ng-module.js +26 -21
  117. package/src/core/filter/filter.js +1 -1
  118. package/src/core/filter/filter.spec.js +1 -1
  119. package/src/core/filter/filter.test.js +1 -0
  120. package/src/core/interpolate/interpolate.js +4 -6
  121. package/src/core/interpolate/interpolate.spec.js +1 -1
  122. package/src/core/interpolate/interpolate.test.js +1 -0
  123. package/src/core/parse/ast/ast.spec.js +1 -1
  124. package/src/core/parse/ast/ast.test.js +1 -1
  125. package/src/core/parse/lexer/lexer.spec.js +1 -1
  126. package/src/core/parse/parse.js +150 -146
  127. package/src/core/parse/parse.spec.js +46 -46
  128. package/src/core/prop.spec.js +1 -1
  129. package/src/core/root-element.spec.js +1 -1
  130. package/src/core/scope/scope.js +10 -11
  131. package/src/core/scope/scope.spec.js +3 -4
  132. package/src/directive/aria/aria.spec.js +1 -1
  133. package/src/directive/aria/aria.test.js +1 -0
  134. package/src/directive/attrs/attrs.spec.js +1 -1
  135. package/src/directive/attrs/attrs.test.js +1 -0
  136. package/src/directive/attrs/boolean.spec.js +1 -1
  137. package/src/directive/attrs/boolean.test.js +1 -0
  138. package/src/directive/attrs/element-style.spec.js +1 -1
  139. package/src/directive/attrs/element-style.test.js +1 -0
  140. package/src/directive/attrs/src.spec.js +1 -1
  141. package/src/directive/attrs/src.test.js +1 -0
  142. package/src/directive/bind/bind-html.spec.js +1 -1
  143. package/src/directive/bind/bind.js +1 -0
  144. package/src/directive/bind/bind.spec.js +1 -1
  145. package/src/directive/bind/bind.test.js +1 -0
  146. package/src/directive/channel/channel.spec.js +1 -1
  147. package/src/directive/channel/channel.test.js +1 -0
  148. package/src/directive/class/class.spec.js +1 -1
  149. package/src/directive/class/class.test.js +1 -0
  150. package/src/directive/cloak/cloak.spec.js +1 -1
  151. package/src/directive/cloak/cloak.test.js +1 -0
  152. package/src/directive/controller/controller.spec.js +1 -1
  153. package/src/directive/controller/controller.test.js +1 -0
  154. package/src/directive/events/click.spec.js +1 -1
  155. package/src/directive/events/event.spec.js +6 -6
  156. package/src/directive/events/events.test.js +1 -0
  157. package/src/directive/form/form.js +8 -5
  158. package/src/directive/form/form.spec.js +1 -1
  159. package/src/directive/form/form.test.js +1 -0
  160. package/src/directive/http/delete.spec.js +1 -1
  161. package/src/directive/http/form-test.html +18 -0
  162. package/src/directive/http/get.spec.js +1 -1
  163. package/src/directive/http/http.js +12 -3
  164. package/src/directive/http/post.spec.js +504 -9
  165. package/src/directive/http/put.spec.js +1 -1
  166. package/src/directive/if/if.spec.js +1 -1
  167. package/src/directive/include/include.spec.js +1 -1
  168. package/src/directive/init/init.spec.js +1 -1
  169. package/src/directive/init/init.test.js +1 -0
  170. package/src/directive/input/input.js +13 -15
  171. package/src/directive/input/input.spec.js +1 -2
  172. package/src/directive/input/input.test.js +1 -0
  173. package/src/directive/messages/messages.md +0 -4
  174. package/src/directive/messages/messages.spec.js +1 -1
  175. package/src/directive/messages/messages.test.js +1 -0
  176. package/src/directive/model/model.js +13 -13
  177. package/src/directive/model/model.spec.js +1 -1
  178. package/src/directive/model/model.test.js +1 -0
  179. package/src/directive/model-options/model-option.test.js +1 -0
  180. package/src/directive/model-options/model-options.js +1 -1
  181. package/src/directive/model-options/model-options.spec.js +1 -1
  182. package/src/directive/non-bindable/non-bindable.spec.js +1 -1
  183. package/src/directive/non-bindable/non-bindable.test.js +1 -0
  184. package/src/directive/observe/observe.spec.js +1 -1
  185. package/src/directive/observe/observe.test.js +1 -0
  186. package/src/directive/on/on.spec.js +1 -1
  187. package/src/directive/on/on.test.js +1 -0
  188. package/src/directive/options/options.spec.js +1 -1
  189. package/src/directive/options/options.test.js +1 -0
  190. package/src/directive/ref/href.spec.js +1 -1
  191. package/src/directive/ref/href.test.js +2 -0
  192. package/src/directive/ref/ref.spec.js +1 -1
  193. package/src/directive/repeat/repeat.js +1 -1
  194. package/src/directive/repeat/repeat.spec.js +2 -3
  195. package/src/directive/repeat/repeat.test.js +1 -0
  196. package/src/directive/script/script.spec.js +1 -1
  197. package/src/directive/script/script.test.js +1 -0
  198. package/src/directive/select/select.js +1 -1
  199. package/src/directive/select/select.spec.js +1 -1
  200. package/src/directive/select/select.test.js +1 -0
  201. package/src/directive/setter/setter.spec.js +1 -1
  202. package/src/directive/setter/setter.test.js +1 -0
  203. package/src/directive/show-hide/show-hide.spec.js +1 -1
  204. package/src/directive/show-hide/show-hide.test.js +1 -0
  205. package/src/directive/style/style.spec.js +1 -1
  206. package/src/directive/style/style.test.js +1 -0
  207. package/src/directive/switch/switch.spec.js +1 -1
  208. package/src/directive/switch/switch.test.js +1 -0
  209. package/src/directive/validators/validators.js +82 -84
  210. package/src/directive/validators/validators.spec.js +5 -4
  211. package/src/directive/validators/validators.test.js +1 -0
  212. package/src/filters/filter.spec.js +1 -1
  213. package/src/filters/filters.spec.js +1 -1
  214. package/src/filters/limit-to.js +2 -3
  215. package/src/filters/limit-to.spec.js +1 -1
  216. package/src/filters/order-by.spec.js +1 -1
  217. package/src/index.js +1 -1
  218. package/src/injection-tokens.js +7 -3
  219. package/src/interface.ts +4 -3
  220. package/src/loader.md +0 -155
  221. package/src/{public.js → ng.js} +11 -12
  222. package/src/{public.spec.js → ng.spec.js} +2 -2
  223. package/src/router/directives/state-directives.js +5 -5
  224. package/src/router/directives/state-directives.spec.js +8 -7
  225. package/src/router/directives/view-directive.js +7 -13
  226. package/src/router/directives/view-directive.spec.js +22 -23
  227. package/src/router/{common/common.html → glob/glob.html} +2 -3
  228. package/src/router/{common/common.test.js → glob/glob.test.js} +2 -1
  229. package/src/router/params/param-type.js +0 -1
  230. package/src/router/params/param.js +1 -1
  231. package/src/router/path/path-utils.js +5 -0
  232. package/src/router/router-test-hashbang.html +45 -0
  233. package/src/router/{globals.js → router.js} +2 -2
  234. package/src/router/services.spec.js +8 -9
  235. package/src/router/state/interface.ts +1 -1
  236. package/src/router/state/state-builder.js +3 -3
  237. package/src/router/state/state-builder.spec.js +1 -1
  238. package/src/router/state/state-object.js +1 -1
  239. package/src/router/state/state-registry.js +4 -4
  240. package/src/router/state/state-service.js +14 -14
  241. package/src/router/state/state.spec.js +23 -22
  242. package/src/router/state/state.test.js +1 -0
  243. package/src/router/state/views.js +1 -1
  244. package/src/router/state-filter.spec.js +1 -1
  245. package/src/router/state-filters.js +13 -9
  246. package/src/router/template-factory.js +5 -4
  247. package/src/router/template-factory.spec.js +7 -7
  248. package/src/router/transition/hook-registry.js +1 -1
  249. package/src/router/transition/transition-service.js +7 -6
  250. package/src/router/transition/transition.js +6 -6
  251. package/src/router/url/url-matcher.js +12 -14
  252. package/src/router/url/url-rule.js +8 -2
  253. package/src/router/url/url-rules.js +8 -5
  254. package/src/router/url/url-service.js +80 -76
  255. package/src/router/url/url-service.spec.js +61 -78
  256. package/src/router/url/url.test.js +1 -0
  257. package/src/router/view/view.js +4 -5
  258. package/src/router/view/view.spec.js +10 -12
  259. package/src/router/view/view.test.js +1 -0
  260. package/src/router/view-hook.spec.js +1 -1
  261. package/src/router/view-scroll.js +3 -1
  262. package/src/router/view-scroll.spec.js +12 -12
  263. package/src/services/anchor-scroll.html +2 -2
  264. package/src/services/anchor-scroll.js +5 -4
  265. package/src/services/http/http.js +9 -4
  266. package/src/services/http/http.spec.js +2 -7
  267. package/src/services/http/template-request.spec.js +1 -1
  268. package/src/services/http-backend/http-backend.js +51 -77
  269. package/src/services/http-backend/http-backend.spec.js +1 -2
  270. package/src/services/http-backend/http-backend.test.js +1 -0
  271. package/src/services/location/interface.ts +62 -0
  272. package/src/services/location/location.js +439 -519
  273. package/src/services/location/location.spec.js +915 -530
  274. package/src/services/location/location.test.js +2 -2
  275. package/src/services/log/log.spec.js +1 -1
  276. package/src/services/log/log.test.js +1 -0
  277. package/src/services/pubsub/pubsub.spec.js +1 -1
  278. package/src/services/sce/sce.js +5 -7
  279. package/src/services/sce/sce.md +2 -2
  280. package/src/services/sce/sce.spec.js +1 -1
  281. package/src/services/template-cache/template-cache.spec.js +1 -1
  282. package/src/services/template-cache/template-cache.test.js +1 -0
  283. package/src/shared/common.js +5 -10
  284. package/src/shared/common.spec.js +1 -1
  285. package/src/shared/hof.js +0 -14
  286. package/src/shared/interface.ts +0 -4
  287. package/src/{router/common → shared}/queue.js +7 -7
  288. package/src/shared/shared.html +1 -0
  289. package/src/shared/shared.test.js +1 -0
  290. package/src/shared/url-utils/interface.ts +0 -2
  291. package/src/shared/url-utils/url-utils.js +6 -30
  292. package/src/shared/url-utils/url-utils.spec.js +10 -9
  293. package/src/shared/utils.js +32 -9
  294. package/src/shared/utils.spec.js +35 -1
  295. package/src/src.html +1 -2
  296. package/typedoc.json +0 -1
  297. package/utils/express.js +27 -1
  298. package/utils/version.cjs +23 -0
  299. package/@types/router/state-provider.d.ts +0 -123
  300. package/src/directive/non-bindable/non-bindable.md +0 -17
  301. package/src/loader.spec.js +0 -169
  302. package/src/router/state-provider.js +0 -146
  303. package/src/services/location/location.md +0 -114
  304. package/src/shared/url-utils/url-utils.md +0 -46
  305. /package/@types/router/{common → glob}/glob.d.ts +0 -0
  306. /package/src/router/{common → glob}/glob.js +0 -0
  307. /package/src/router/{common → glob}/glob.spec.js +0 -0
  308. /package/src/{router/common → shared}/queue.spec.js +0 -0
@@ -1,5 +1,5 @@
1
1
  import { createElementFromHTML, 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("ngView", () => {
@@ -12,7 +12,7 @@ describe("ngView", () => {
12
12
  app,
13
13
  $injector,
14
14
  $state,
15
- $ngViewScroll;
15
+ $viewScroll;
16
16
 
17
17
  const aState = {
18
18
  name: "a",
@@ -129,8 +129,8 @@ describe("ngView", () => {
129
129
  app = window.angular
130
130
  .module("defaultModule", [])
131
131
  .config(($provide, _$stateProvider_) => {
132
- $provide.decorator("$ngViewScroll", () => {
133
- return jasmine.createSpy("$ngViewScroll");
132
+ $provide.decorator("$viewScroll", () => {
133
+ return jasmine.createSpy("$viewScroll");
134
134
  });
135
135
 
136
136
  _$stateProvider_
@@ -156,11 +156,11 @@ describe("ngView", () => {
156
156
  "defaultModule",
157
157
  ]);
158
158
 
159
- $injector.invoke((_$state_, $rootScope, _$compile_, _$ngViewScroll_) => {
159
+ $injector.invoke((_$state_, $rootScope, _$compile_, _$viewScroll_) => {
160
160
  scope = $rootScope.$new();
161
161
  $compile = _$compile_;
162
162
  $state = _$state_;
163
- $ngViewScroll = _$ngViewScroll_;
163
+ $viewScroll = _$viewScroll_;
164
164
  });
165
165
  });
166
166
 
@@ -312,7 +312,7 @@ describe("ngView", () => {
312
312
 
313
313
  $state.transitionTo(aState);
314
314
  await wait(100);
315
- expect($ngViewScroll).not.toHaveBeenCalled();
315
+ expect($viewScroll).not.toHaveBeenCalled();
316
316
  });
317
317
 
318
318
  it("should autoscroll when expression is missing", async () => {
@@ -324,7 +324,7 @@ describe("ngView", () => {
324
324
 
325
325
  // animateFlush($animate);
326
326
 
327
- expect($ngViewScroll).toHaveBeenCalledWith(elem.querySelector("ng-view"));
327
+ expect($viewScroll).toHaveBeenCalledWith(elem.querySelector("ng-view"));
328
328
  });
329
329
 
330
330
  it("should autoscroll based on expression", async () => {
@@ -336,12 +336,12 @@ describe("ngView", () => {
336
336
  $state.transitionTo(aState);
337
337
  await wait(100);
338
338
 
339
- expect($ngViewScroll).not.toHaveBeenCalled();
339
+ expect($viewScroll).not.toHaveBeenCalled();
340
340
 
341
341
  scope.doScroll = true;
342
342
  $state.transitionTo(bState);
343
343
  await wait(100);
344
- expect($ngViewScroll).toHaveBeenCalledWith(elem.querySelector("ng-view"));
344
+ expect($viewScroll).toHaveBeenCalledWith(elem.querySelector("ng-view"));
345
345
  });
346
346
  });
347
347
 
@@ -809,7 +809,7 @@ describe("ngView named", () => {
809
809
  $injector,
810
810
  $state,
811
811
  $rootScope,
812
- $ngViewScroll;
812
+ $viewScroll;
813
813
 
814
814
  beforeEach(() => {
815
815
  window.angular = new Angular();
@@ -831,12 +831,12 @@ describe("ngView named", () => {
831
831
  "defaultModule",
832
832
  ]);
833
833
 
834
- $injector.invoke((_$state_, _$rootScope_, _$compile_, _$ngViewScroll_) => {
834
+ $injector.invoke((_$state_, _$rootScope_, _$compile_, _$viewScroll_) => {
835
835
  $rootScope = _$rootScope_;
836
836
  scope = $rootScope.$new();
837
837
  $compile = _$compile_;
838
838
  $state = _$state_;
839
- $ngViewScroll = _$ngViewScroll_;
839
+ $viewScroll = _$viewScroll_;
840
840
  });
841
841
  });
842
842
 
@@ -852,7 +852,7 @@ describe("ngView named", () => {
852
852
 
853
853
  // Test for https://github.com/angular-ui/ui-router/issues/3355
854
854
  xit("should target weird nested view setups using the view's simple name", async () => {
855
- const tpl = `
855
+ elem.innerHTML = `
856
856
  <div>
857
857
  <div ng-view="main">
858
858
  MAIN-DEFAULT-
@@ -862,7 +862,6 @@ describe("ngView named", () => {
862
862
  </div>
863
863
  </div>
864
864
  `;
865
- elem.innerHTML = tpl;
866
865
  $compile(elem)($rootScope);
867
866
 
868
867
  $state.go("test");
@@ -904,7 +903,7 @@ describe("ngView transclusion", () => {
904
903
  "defaultModule",
905
904
  ]);
906
905
 
907
- $injector.invoke((_$state_, _$rootScope_, _$compile_, _$ngViewScroll_) => {
906
+ $injector.invoke((_$state_, _$rootScope_, _$compile_, _$viewScroll_) => {
908
907
  $rootScope = _$rootScope_;
909
908
  scope = $rootScope.$new();
910
909
  $compile = _$compile_;
@@ -974,7 +973,7 @@ describe("ngView controllers or onEnter handlers", () => {
974
973
  "defaultModule",
975
974
  ]);
976
975
 
977
- $injector.invoke((_$state_, _$rootScope_, _$compile_, _$ngViewScroll_) => {
976
+ $injector.invoke((_$state_, _$rootScope_, _$compile_, _$viewScroll_) => {
978
977
  $rootScope = _$rootScope_;
979
978
  scope = $rootScope.$new();
980
979
  $compile = _$compile_;
@@ -1833,9 +1832,9 @@ describe("angular 1.5+ style .component()", () => {
1833
1832
  name: "ng12-dynamic-directive",
1834
1833
  url: "/ng12dynamicDirective/:type",
1835
1834
  componentProvider: [
1836
- "$stateParams",
1837
- function ($stateParams) {
1838
- return $stateParams.type;
1835
+ "$router",
1836
+ function ($router) {
1837
+ return $router.params.type;
1839
1838
  },
1840
1839
  ],
1841
1840
  });
@@ -1861,9 +1860,9 @@ describe("angular 1.5+ style .component()", () => {
1861
1860
  name: "dynamicComponent",
1862
1861
  url: "/dynamicComponent/:type",
1863
1862
  componentProvider: [
1864
- "$stateParams",
1865
- function ($stateParams) {
1866
- return $stateParams.type;
1863
+ "$router",
1864
+ function ($router) {
1865
+ return $router.params.type;
1867
1866
  },
1868
1867
  ],
1869
1868
  });
@@ -6,13 +6,12 @@
6
6
 
7
7
  <link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
8
8
  <link rel="stylesheet" href="/jasmine/jasmine.css" />
9
- <link rel="stylesheet" href="/public/jasmine-helper.css" />
9
+ <link rel="stylesheet" href="/jasmine-helper.css" />
10
10
  <script src="/jasmine/jasmine.js"></script>
11
11
  <script src="/jasmine/jasmine-html.js"></script>
12
12
  <script src="/jasmine/boot0.js"></script>
13
13
  <script src="/jasmine/boot1.js"></script>
14
- <script type="module" src="/src/router/common/glob.spec.js"></script>
15
- <script type="module" src="/src/router/common/queue.spec.js"></script>
14
+ <script type="module" src="/src/router/glob/glob.spec.js"></script>
16
15
  </head>
17
16
  <body>
18
17
  <div id="app"></div>
@@ -1,10 +1,11 @@
1
1
  import { test, expect } from "@playwright/test";
2
2
 
3
- const TEST_URL = "src/router/common/common.html";
3
+ const TEST_URL = "src/router/glob/glob.html";
4
4
 
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
  );
@@ -27,7 +27,6 @@ export class ParamType {
27
27
  /**
28
28
  * @param def A configuration object which contains the custom type definition. The object's
29
29
  * properties will override the default methods and/or pattern in `ParamType`'s public interface.
30
- * @returns a new ParamType object
31
30
  */
32
31
  constructor(def) {
33
32
  this.pattern = /.*/;
@@ -192,7 +192,7 @@ export class Param {
192
192
  const normalized = this.type.$normalize(value);
193
193
  if (!this.type.is(normalized)) return false;
194
194
  // The value was of the correct type, but when encoded, did not match the ParamType's regexp
195
- const encoded = this.type.encode(normalized);
195
+ const encoded = normalized; // this.type.encode(normalized);
196
196
  return !(isString(encoded) && !this.type.pattern.exec(encoded));
197
197
  }
198
198
  toString() {
@@ -89,8 +89,13 @@ export class PathUtils {
89
89
  // The param keys specified by the incoming toParams
90
90
  return toPath.map(makeInheritedParamsNode);
91
91
  }
92
+
92
93
  /**
93
94
  * Computes the tree changes (entering, exiting) between a fromPath and toPath.
95
+ * @param {PathNode[]} fromPath
96
+ * @param {PathNode[]} toPath
97
+ * @param {boolean} [reloadState]
98
+ * @returns {import("../transition/interface.js").TreeChanges}
94
99
  */
95
100
  static treeChanges(fromPath, toPath, reloadState) {
96
101
  const max = Math.min(fromPath.length, toPath.length);
@@ -0,0 +1,45 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>AngularTS</title>
6
+ <link rel="shortcut icon" type="image/png" href="images/favicon.ico" />
7
+ <script type="module" src="../index.js"></script>
8
+ <script>
9
+ document.addEventListener("DOMContentLoaded", () => {
10
+ window.angular.module("router", []).config([
11
+ "$stateProvider",
12
+ "$locationProvider",
13
+ ($stateProvider, $locationProvider) => {
14
+ $locationProvider.html5ModeConf = {
15
+ enabled: false,
16
+ };
17
+ $stateProvider
18
+ .state({
19
+ name: "home",
20
+ url: "",
21
+ template: `
22
+ <h1>Home</h1>
23
+ <a ng-sref="page1">Page 1</a>
24
+ <a ng-sref="page2">Page 2</a>
25
+ `,
26
+ })
27
+ .state({
28
+ name: "page1",
29
+ url: "/page1",
30
+ template: "<h3>Its the NG-Router hello world app!</h3>",
31
+ })
32
+ .state({
33
+ name: "page2",
34
+ url: "/page2",
35
+ template: "This is another template",
36
+ });
37
+ },
38
+ ]);
39
+ });
40
+ </script>
41
+ </head>
42
+ <body ng-app="router">
43
+ <ng-view></ng-view>
44
+ </body>
45
+ </html>
@@ -1,5 +1,5 @@
1
1
  import { StateParams } from "./params/state-params.js";
2
- import { Queue } from "./common/queue.js";
2
+ import { Queue } from "../shared/queue.js";
3
3
 
4
4
  /** @typedef {import('../interface.ts').ServiceProvider} ServiceProvider } */
5
5
 
@@ -9,7 +9,7 @@ import { Queue } from "./common/queue.js";
9
9
  * This is where we hold the global mutable state such as current state, current
10
10
  * params, current transition, etc.
11
11
  */
12
- export class RouterGlobals {
12
+ export class Router {
13
13
  constructor() {
14
14
  /**
15
15
  * Current parameter values
@@ -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 services", () => {
@@ -11,16 +11,16 @@ describe("router services", () => {
11
11
  let module = window["angular"].module("defaultModule", []);
12
12
  module.config(
13
13
  (
14
- $urlServiceProvider,
14
+ $urlProvider,
15
15
  $stateRegistryProvider,
16
- $routerGlobalsProvider,
16
+ $routerProvider,
17
17
  $transitionsProvider,
18
18
  $stateProvider,
19
19
  ) => {
20
20
  providers = {
21
- $urlServiceProvider,
21
+ $urlProvider,
22
22
  $stateRegistryProvider,
23
- $routerGlobalsProvider,
23
+ $routerProvider,
24
24
  $transitionsProvider,
25
25
  $stateProvider,
26
26
  };
@@ -33,7 +33,7 @@ describe("router services", () => {
33
33
  });
34
34
 
35
35
  it("Should expose ng-router providers from the UIRouter instance", () => {
36
- expect(providers.$urlServiceProvider).toBeDefined();
36
+ expect(providers.$urlProvider).toBeDefined();
37
37
  expect(providers.$stateRegistryProvider).toBeDefined();
38
38
  expect(providers.$stateRegistryProvider).toBeDefined();
39
39
  expect(providers.$transitionsProvider).toBeDefined();
@@ -41,12 +41,11 @@ describe("router services", () => {
41
41
  });
42
42
 
43
43
  it("Should expose ng-router services from the UIRouter instance", () => {
44
- expect($injector.get("$urlService")).toBeDefined();
44
+ expect($injector.get("$url")).toBeDefined();
45
45
  expect($injector.get("$stateRegistry")).toBeDefined();
46
- expect($injector.get("$routerGlobals")).toBeDefined();
46
+ expect($injector.get("$router")).toBeDefined();
47
47
  expect($injector.get("$transitions")).toBeDefined();
48
48
  expect($injector.get("$state")).toBeDefined();
49
- expect($injector.get("$stateParams")).toBeDefined();
50
49
  expect($injector.get("$view")).toBeDefined();
51
50
  expect($injector.get("$trace")).toBeDefined();
52
51
  });
@@ -607,7 +607,7 @@ export interface StateDeclaration {
607
607
  *
608
608
  * An optional object which defines multiple views, or explicitly targets specific named ui-views.
609
609
  *
610
- * - What is a view config
610
+ * - What is a view urlConfig
611
611
  * - What is a ui-view
612
612
  * - Shorthand controller/template
613
613
  * - Incompatible with ^
@@ -30,7 +30,7 @@ function dataBuilder(state) {
30
30
  return state.data;
31
31
  }
32
32
 
33
- function getUrlBuilder($urlService, root) {
33
+ function getUrlBuilder($url, root) {
34
34
  return function (stateObject) {
35
35
  let stateDec = stateObject.self;
36
36
  // For future states, i.e., states whose name ends with `.**`,
@@ -50,9 +50,9 @@ function getUrlBuilder($urlService, root) {
50
50
  const parsed = parseUrl(stateDec.url);
51
51
  const url = !parsed
52
52
  ? stateDec.url
53
- : $urlService.compile(parsed.val, { state: stateDec });
53
+ : $url.compile(parsed.val, { state: stateDec });
54
54
  if (!url) return null;
55
- if (!$urlService.isMatcher(url))
55
+ if (!$url.isMatcher(url))
56
56
  throw new Error(`Invalid url '${url}' in state '${stateObject}'`);
57
57
  return parsed && parsed.root
58
58
  ? url
@@ -1,5 +1,5 @@
1
1
  import { StateBuilder } from "./state-builder.js";
2
- import { Angular } from "../../loader.js";
2
+ import { Angular } from "../../angular.js";
3
3
  import { dealoc } from "../../shared/dom.js";
4
4
 
5
5
  // TODO refactor this to url service as it is using the provider right now
@@ -1,6 +1,6 @@
1
1
  import { defaults, find } from "../../shared/common.js";
2
2
  import { propEq } from "../../shared/hof.js";
3
- import { Glob } from "../common/glob.js";
3
+ import { Glob } from "../glob/glob.js";
4
4
  import { hasOwn, isFunction, isObject } from "../../shared/utils.js";
5
5
 
6
6
  /** @typedef {import('./interface.js').StateDeclaration} StateDeclaration */
@@ -16,17 +16,17 @@ import { $injectTokens, provider } from "../../injection-tokens.js";
16
16
  *
17
17
  */
18
18
  export class StateRegistryProvider {
19
- static $inject = provider([
20
- $injectTokens.$urlService,
19
+ /* @ignore */ static $inject = provider([
20
+ $injectTokens.$url,
21
21
  $injectTokens.$state,
22
- $injectTokens.$routerGlobals,
22
+ $injectTokens.$router,
23
23
  $injectTokens.$view,
24
24
  ]);
25
25
 
26
26
  /**
27
27
  * @param urlService
28
28
  * @param stateService
29
- * @param {import('../globals.js').RouterGlobals} globals
29
+ * @param {import('../router.js').Router} globals
30
30
  * @param viewService
31
31
  */
32
32
  constructor(urlService, stateService, globals, viewService) {
@@ -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";
@@ -30,7 +30,7 @@ export class StateProvider {
30
30
  /**
31
31
  * The latest successful state parameters
32
32
  *
33
- * @deprecated This is a passthrough through to [[RouterGlobals.params]]
33
+ * @deprecated This is a passthrough through to [[Router.params]]
34
34
  */
35
35
  get params() {
36
36
  return this.globals.params;
@@ -38,7 +38,7 @@ export class StateProvider {
38
38
  /**
39
39
  * The current [[StateDeclaration]]
40
40
  *
41
- * @deprecated This is a passthrough through to [[RouterGlobals.current]]
41
+ * @deprecated This is a passthrough through to [[Router.current]]
42
42
  */
43
43
  get current() {
44
44
  return this.globals.current;
@@ -46,18 +46,18 @@ export class StateProvider {
46
46
  /**
47
47
  * The current [[StateObject]] (an internal API)
48
48
  *
49
- * @deprecated This is a passthrough through to [[RouterGlobals.$current]]
49
+ * @deprecated This is a passthrough through to [[Router.$current]]
50
50
  */
51
51
  get $current() {
52
52
  return this.globals.$current;
53
53
  }
54
54
 
55
- static $inject = ["$routerGlobalsProvider", "$transitionsProvider"];
55
+ /* @ignore */ static $inject = ["$routerProvider", "$transitionsProvider"];
56
56
 
57
57
  // Needs access to urlService, stateRegistry
58
58
  /**
59
59
  *
60
- * @param {import('../globals.js').RouterGlobals} globals
60
+ * @param {import('../router.js').Router} globals
61
61
  * @param {*} transitionService
62
62
  */
63
63
  constructor(globals, transitionService) {
@@ -131,9 +131,9 @@ export class StateProvider {
131
131
  * - **params** `{object}` - returns an array of state params that are ensured to
132
132
  * be a super-set of parent's params.
133
133
  * - **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
134
+ * name (i.e. "viewName@stateName") and each value is the urlConfig object
135
135
  * (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.
136
+ * explicitly on a state urlConfig, one is still created for you internally.
137
137
  * So by decorating this builder function you have access to decorating template
138
138
  * and controller properties.
139
139
  * - **ownParams** `{object}` - returns an array of params that belong to the state,
@@ -151,10 +151,10 @@ export class StateProvider {
151
151
  * let result = {},
152
152
  * views = parent(state);
153
153
  *
154
- * angular.forEach(views, function (config, name) {
154
+ * angular.forEach(views, function (urlConfig, name) {
155
155
  * let autoName = (state.name + '.' + name).replace('.', '/');
156
- * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';
157
- * result[name] = config;
156
+ * urlConfig.templateUrl = urlConfig.templateUrl || '/partials/' + autoName + '.html';
157
+ * result[name] = urlConfig;
158
158
  * });
159
159
  * return result;
160
160
  * });
@@ -178,7 +178,7 @@ export class StateProvider {
178
178
  * @param {object} func A function that is responsible for decorating the original
179
179
  * builder function. The function receives two parameters:
180
180
  *
181
- * - `{object}` - state - The state config object.
181
+ * - `{object}` - state - The state urlConfig object.
182
182
  * - `{object}` - super - The original builder function.
183
183
  *
184
184
  * @return {object} $stateProvider - $stateProvider instance
@@ -411,7 +411,7 @@ export class StateProvider {
411
411
  const globals = this.globals;
412
412
  const latestSuccess = globals.successfulTransitions.peekTail();
413
413
  const rootPath = () => [new PathNode(this.stateRegistry.root())];
414
- return latestSuccess ? latestSuccess.treeChanges().to : rootPath();
414
+ return latestSuccess ? latestSuccess._treeChanges.to : rootPath();
415
415
  }
416
416
  /**
417
417
  * 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 () => {