@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,6 +1,6 @@
1
- import { Angular } from "../../loader.js";
1
+ import { Angular } from "../../angular.js";
2
2
  import { wait } from "../../shared/test-utils.js";
3
- import { getController } from "../../shared/dom.js";
3
+ import { dealoc, getController } from "../../shared/dom.js";
4
4
 
5
5
  describe("validators", () => {
6
6
  let $rootScope;
@@ -9,6 +9,7 @@ describe("validators", () => {
9
9
  let errors = [];
10
10
 
11
11
  beforeEach(() => {
12
+ dealoc(document.getElementById("app"));
12
13
  errors = [];
13
14
  window.angular = new Angular();
14
15
  window.angular
@@ -27,7 +28,7 @@ describe("validators", () => {
27
28
  });
28
29
 
29
30
  describe("pattern", () => {
30
- it("should validate in-lined pattern", () => {
31
+ it("should validate in-lined pattern", async () => {
31
32
  inputElm = $compile(
32
33
  '<input type="text" ng-model="value" ng-pattern="/^\\d\\d\\d-\\d\\d-\\d\\d\\d\\d$/" />',
33
34
  )($rootScope);
@@ -246,7 +247,7 @@ describe("validators", () => {
246
247
  inputElm.dispatchEvent(new Event("change"));
247
248
  expect($rootScope.form.test.$error.pattern).toBe(true);
248
249
  expect(inputElm.classList.contains("ng-invalid")).toBeTrue();
249
-
250
+ //
250
251
  inputElm.setAttribute("value", "12345");
251
252
  inputElm.dispatchEvent(new Event("change"));
252
253
  expect($rootScope.form.test.$error.pattern).toBe(true);
@@ -5,6 +5,7 @@ const TEST_URL = "src/directive/validators/validators.html";
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(3000);
8
9
  await expect(page.locator(".jasmine-overall-result")).toHaveText(
9
10
  /0 failures/,
10
11
  );
@@ -1,4 +1,4 @@
1
- import { Angular } from "../loader.js";
1
+ import { Angular } from "../angular.js";
2
2
  import { createInjector } from "../core/di/injector.js";
3
3
  import { isString, includes } from "../shared/utils.js";
4
4
  import { createElementFromHTML } from "../shared/dom.js";
@@ -1,4 +1,4 @@
1
- import { Angular } from "../loader.js";
1
+ import { Angular } from "../angular.js";
2
2
  import { createInjector } from "../core/di/injector.js";
3
3
  import { toJson } from "../shared/utils.js";
4
4
 
@@ -4,7 +4,6 @@ import {
4
4
  isNumber,
5
5
  isNumberNaN,
6
6
  isString,
7
- toInt,
8
7
  } from "../shared/utils.js";
9
8
 
10
9
  /**
@@ -23,7 +22,7 @@ export function limitToFilter() {
23
22
  if (Math.abs(Number(limit)) === Infinity) {
24
23
  limit = Number(limit);
25
24
  } else {
26
- limit = toInt(/** @type {string} */ (limit));
25
+ limit = parseInt(/** @type {string} */ (limit), 10);
27
26
  }
28
27
  if (isNumberNaN(limit)) return input;
29
28
 
@@ -33,7 +32,7 @@ export function limitToFilter() {
33
32
  begin =
34
33
  !begin || isNaN(/** @type {any} */ (begin))
35
34
  ? 0
36
- : toInt(/** @type {string} */ (begin));
35
+ : parseInt(/** @type {string} */ (begin), 10);
37
36
  begin =
38
37
  begin < 0 ? Math.max(0, /** @type {[]} */ (input).length + begin) : begin;
39
38
 
@@ -1,4 +1,4 @@
1
- import { Angular } from "../loader.js";
1
+ import { Angular } from "../angular.js";
2
2
  import { createInjector } from "../core/di/injector.js";
3
3
  import { createElementFromHTML } from "../shared/dom.js";
4
4
 
@@ -1,4 +1,4 @@
1
- import { Angular } from "../loader.js";
1
+ import { Angular } from "../angular.js";
2
2
  import { createInjector } from "../core/di/injector.js";
3
3
 
4
4
  describe("Filter: orderBy", () => {
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Angular } from "./loader.js";
1
+ import { Angular } from "./angular.js";
2
2
 
3
3
  export const angular = new Angular();
4
4
  document.addEventListener("DOMContentLoaded", () => angular.init(document), {
@@ -16,6 +16,9 @@
16
16
  * @type Readonly<Record<string, string>>
17
17
  */
18
18
  export const $injectTokens = Object.freeze({
19
+ $attrs: "$attrs",
20
+ $scope: "$scope",
21
+ $element: "$element",
19
22
  $$AnimateRunner: "$$AnimateRunner",
20
23
  $$animateAsyncRun: "$$animateAsyncRun",
21
24
  $$animateCache: "$$animateCache",
@@ -41,10 +44,11 @@ export const $injectTokens = Object.freeze({
41
44
  $interpolate: "$interpolate",
42
45
  $location: "$location",
43
46
  $log: "$log",
44
- $ngViewScroll: "$ngViewScroll",
47
+ $viewScroll: "$viewScroll",
45
48
  $parse: "$parse",
46
49
  $rootScope: "$rootScope",
47
- $routerGlobals: "$routerGlobals",
50
+ $rootElement: "$rootElement",
51
+ $router: "$router",
48
52
  $sce: "$sce",
49
53
  $sceDelegate: "$sceDelegate",
50
54
  $state: "$state",
@@ -54,7 +58,7 @@ export const $injectTokens = Object.freeze({
54
58
  $templateRequest: "$templateRequest",
55
59
  $transitions: "$transitions",
56
60
  $urlConfig: "$urlConfig",
57
- $urlService: "$urlService",
61
+ $url: "$url",
58
62
  $view: "$view",
59
63
  // provide literals
60
64
  $provide: "$provide",
package/src/interface.ts CHANGED
@@ -4,6 +4,8 @@ export * from "./core/di/ng-module.js";
4
4
  export * from "./services/http/interface.ts";
5
5
  export * from "./services/log/interface.ts";
6
6
  export * from "./services/log/log.js";
7
+ export * from "./services/location/interface.ts";
8
+ export * from "./services/location/location.js";
7
9
  export * from "./services/pubsub/pubsub.js";
8
10
  export * from "./services/template-cache/interface.ts";
9
11
  export * from "./services/template-cache/template-cache.js";
@@ -35,6 +37,7 @@ export type ExpandoStore = {
35
37
  * ```
36
38
  */
37
39
  export type AnnotatedFactory = [...string[], (...args: any[]) => any];
40
+ export type InjectableFactory = (...args: any[]) => any;
38
41
 
39
42
  /**
40
43
  * A factory that can be either a standalone function or a dependency-annotated array.
@@ -42,8 +45,6 @@ export type AnnotatedFactory = [...string[], (...args: any[]) => any];
42
45
  * The array form is used to support minification-safe dependency injection.
43
46
  * See {@link AnnotatedFactory}.
44
47
  */
45
- export type InjectableFactory = (...args: any[]) => any;
46
-
47
48
  export type Injectable = AnnotatedFactory | InjectableFactory;
48
49
 
49
50
  /**
@@ -66,7 +67,7 @@ export interface Provider {
66
67
  /**
67
68
  * Register a directive
68
69
  * @param name - The name of the directive.
69
- * @param provider - An object with a `$get` property that defines how the service is created.
70
+ * @param directive - An object with a `$get` property that defines how the service is created.
70
71
  */
71
72
  directive(name: string, directive: DirectiveFactory): Provider;
72
73
 
package/src/loader.md CHANGED
@@ -1,155 +0,0 @@
1
- /\*\*
2
-
3
- - @ngdoc module
4
- - @name ng
5
-
6
- - @installation
7
- - @description
8
- -
9
- - The ng module is loaded by default when an AngularTS application is started. The module itself
10
- - contains the essential components for an AngularTS application to function. The table below
11
- - lists a high level breakdown of each of the services/factories, filters, directives and testing
12
- - components available within this core module.
13
- - \*/
14
-
15
- /\*\*
16
-
17
- - @ngdoc directive
18
- - @name ngApp
19
- -
20
- - @element ANY
21
- - @param {import('./interface.ts').Module} ngApp an optional application
22
- - {@link angular.module module} name to load.
23
- - @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be
24
- - created in "strict-di" mode. This means that the application will fail to invoke functions which
25
- - do not use explicit function annotation (and are thus unsuitable for minification), as described
26
- - in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in
27
- - tracking down the root of these bugs.
28
- -
29
- - @description
30
- -
31
- - Use this directive to **auto-bootstrap** an AngularTS application. The `ngApp` directive
32
- - designates the **root element** of the application and is typically placed near the root element
33
- - of the page - e.g. on the `<body>` or `<html>` tags.
34
- -
35
- - There are a few things to keep in mind when using `ngApp`:
36
- - - only one AngularTS application can be auto-bootstrapped per HTML document. The first `ngApp`
37
- - found in the document will be used to define the root element to auto-bootstrap as an
38
- - application. To run multiple applications in an HTML document you must manually bootstrap them using
39
- - {@link angular.bootstrap} instead.
40
- - - AngularTS applications cannot be nested within each other.
41
- - - Do not use a directive that uses {@link ng.$compile#transclusion transclusion} on the same element as `ngApp`.
42
- - This includes directives such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and
43
- - {@link ngRoute.ngView `ngView`}.
44
- - Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},
45
- - causing animations to stop working and making the injector inaccessible from outside the app.
46
- -
47
- - You can specify an **AngularTS module** to be used as the root module for the application. This
48
- - module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It
49
- - should contain the application code needed or have dependencies on other modules that will
50
- - contain the code. See {@link angular.module} for more information.
51
- -
52
- - In the example below if the `ngApp` directive were not placed on the `html` element then the
53
- - document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`
54
- - would not be resolved to `3`.
55
- -
56
- - @example
57
- -
58
- - ### Simple Usage
59
- -
60
- - `ngApp` is the easiest, and most common way to bootstrap an application.
61
- - <example module="ngAppDemo" name="ng-app">
62
- <file name="index.html">
63
- <div ng-controller="ngAppDemoController">
64
- I can add: {{a}} + {{b}} = {{ a+b }}
65
- </div>
66
- </file>
67
- <file name="script.js">
68
- angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {
69
- $scope.a = 1;
70
- $scope.b = 2;
71
- });
72
- </file>
73
- </example>
74
- -
75
- - @example
76
- -
77
- - ### With `ngStrictDi`
78
- -
79
- - Using `ngStrictDi`, you would see something like this:
80
- - <example ng-app-included="true" name="strict-di">
81
- <file name="index.html">
82
- <div ng-app="ngAppStrictDemo" ng-strict-di>
83
- <div ng-controller="GoodController1">
84
- I can add: {{a}} + {{b}} = {{ a+b }}
85
-
86
- <p>This renders because the controller does not fail to
87
- instantiate, by using explicit annotation style (see
88
- script.js for details)
89
- </p>
90
- </div>
91
-
92
- <div ng-controller="GoodController2">
93
- Name: <input ng-model="name"><br />
94
- Hello, {{name}}!
95
-
96
- <p>This renders because the controller does not fail to
97
- instantiate, by using explicit annotation style
98
- (see script.js for details)
99
- </p>
100
- </div>
101
-
102
- <div ng-controller="BadController">
103
- I can add: {{a}} + {{b}} = {{ a+b }}
104
-
105
- <p>The controller could not be instantiated, due to relying
106
- on automatic function annotations (which are disabled in
107
- strict mode). As such, the content of this section is not
108
- interpolated, and there should be an error in your web console.
109
- </p>
110
- </div>
111
-
112
- </div>
113
- </file>
114
- <file name="script.js">
115
- angular.module('ngAppStrictDemo', [])
116
- // BadController will fail to instantiate, due to relying on automatic function annotation,
117
- // rather than an explicit annotation
118
- .controller('BadController', function($scope) {
119
- $scope.a = 1;
120
- $scope.b = 2;
121
- })
122
- // Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated,
123
- // due to using explicit annotations using the array style and $inject property, respectively.
124
- .controller('GoodController1', ['$scope', function($scope) {
125
- $scope.a = 1;
126
- $scope.b = 2;
127
- }])
128
- .controller('GoodController2', GoodController2);
129
- function GoodController2($scope) {
130
- $scope.name = 'World';
131
- }
132
- GoodController2.$inject = ['$scope'];
133
- </file>
134
- <file name="style.css">
135
- div[ng-controller] {
136
- margin-bottom: 1em;
137
- -webkit-border-radius: 4px;
138
- border-radius: 4px;
139
- border: 1px solid;
140
- padding: .5em;
141
- }
142
- div[ng-controller^=Good] {
143
- border-color: #d6e9c6;
144
- background-color: #dff0d8;
145
- color: #3c763d;
146
- }
147
- div[ng-controller^=Bad] {
148
- border-color: #ebccd1;
149
- background-color: #f2dede;
150
- color: #a94442;
151
- margin-bottom: 0;
152
- }
153
- </file>
154
- </example>
155
- */
@@ -105,7 +105,7 @@ import { AnimateJsDriverProvider } from "./animations/animate-js-driver.js";
105
105
  import { ngAnimateSwapDirective } from "./animations/animate-swap.js";
106
106
  import { $$AnimateChildrenDirective } from "./animations/animate-children-directive.js";
107
107
  import { UrlConfigProvider } from "./router/url/url-config.js";
108
- import { RouterGlobals } from "./router/globals.js";
108
+ import { Router } from "./router/router.js";
109
109
  import { ViewService } from "./router/view/view.js";
110
110
  import { TransitionProvider } from "./router/transition/transition-service.js";
111
111
  import { StateProvider } from "./router/state/state-service.js";
@@ -132,10 +132,11 @@ import {
132
132
  ngPostDirective,
133
133
  ngPutDirective,
134
134
  } from "./directive/http/http.js";
135
+ import { $injectTokens as $t } from "./injection-tokens.js";
135
136
 
136
137
  /**
137
138
  * Initializes core `ng` module.
138
- * @param {import('./loader.js').Angular} angular
139
+ * @param {import('./angular.js').Angular} angular
139
140
  * @returns {import('./core/di/ng-module.js').NgModule} `ng` module
140
141
  */
141
142
  export function registerNgModule(angular) {
@@ -144,7 +145,7 @@ export function registerNgModule(angular) {
144
145
  "ng",
145
146
  [],
146
147
  [
147
- "$provide",
148
+ $t.$provide,
148
149
  /** @param {import("./interface.js").Provider} $provide */
149
150
  ($provide) => {
150
151
  // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
@@ -152,7 +153,7 @@ export function registerNgModule(angular) {
152
153
  $$sanitizeUri: SanitizeUriProvider,
153
154
  });
154
155
  $provide
155
- .provider("$compile", CompileProvider)
156
+ .provider($t.$compile, CompileProvider)
156
157
  .directive({
157
158
  input: inputDirective,
158
159
  textarea: inputDirective,
@@ -258,7 +259,7 @@ export function registerNgModule(angular) {
258
259
  $parse: ParseProvider,
259
260
  $$rAFScheduler: RafSchedulerProvider,
260
261
  $rootScope: RootScopeProvider,
261
- $routerGlobals: RouterGlobals,
262
+ $router: Router,
262
263
  $sce: SceProvider,
263
264
  $sceDelegate: SceDelegateProvider,
264
265
  $templateCache: TemplateCacheProvider,
@@ -267,9 +268,9 @@ export function registerNgModule(angular) {
267
268
  $view: ViewService,
268
269
  $transitions: TransitionProvider,
269
270
  $state: StateProvider,
270
- $ngViewScroll: ViewScrollProvider,
271
+ $viewScroll: ViewScrollProvider,
271
272
  $templateFactory: TemplateFactoryProvider,
272
- $urlService: UrlService,
273
+ $url: UrlService,
273
274
  $stateRegistry: StateRegistryProvider,
274
275
  $eventBus: PubSubProvider,
275
276
  });
@@ -277,14 +278,12 @@ export function registerNgModule(angular) {
277
278
  ],
278
279
  )
279
280
  .factory("$stateParams", [
280
- "$routerGlobals",
281
+ $t.$router,
281
282
  /**
282
- * @param {import('./router/globals.js').RouterGlobals} globals
283
+ * @param {import('./router/router.js').Router} globals
283
284
  * @returns {import('./router/params/state-params.js').StateParams }
284
285
  */
285
- function (globals) {
286
- return globals.params;
287
- },
286
+ (globals) => globals.params,
288
287
  ])
289
288
  .value("$trace", trace);
290
289
  }
@@ -1,5 +1,5 @@
1
1
  import { createInjector } from "./core/di/injector.js";
2
- import { Angular } from "./loader.js";
2
+ import { Angular } from "./angular.js";
3
3
 
4
4
  describe("public", () => {
5
5
  beforeEach(() => {
@@ -9,7 +9,7 @@ describe("public", () => {
9
9
  it("sets up the angular object and the module loader", () => {
10
10
  expect(window.angular).toBeDefined();
11
11
  expect(window.angular.module).toBeDefined();
12
- expect(window.angular.$injectTokens).toBeDefined();
12
+ expect(window.angular.$t).toBeDefined();
13
13
  });
14
14
 
15
15
  it("sets up the ng module", () => {
@@ -245,7 +245,7 @@ export function $StateRefDynamicDirective(
245
245
 
246
246
  $StateRefActiveDirective.$inject = [
247
247
  "$state",
248
- "$routerGlobals",
248
+ "$router",
249
249
  "$interpolate",
250
250
  "$stateRegistry",
251
251
  "$transitions",
@@ -253,7 +253,7 @@ $StateRefActiveDirective.$inject = [
253
253
 
254
254
  /**
255
255
  * @param {*} $state
256
- * @param {import('../globals.js').RouterGlobals} $routerGlobals
256
+ * @param {import('../router.js').Router} $router
257
257
  * @param {*} $interpolate
258
258
  * @param {*} $stateRegistry
259
259
  * @param {*} $transitions
@@ -261,7 +261,7 @@ $StateRefActiveDirective.$inject = [
261
261
  */
262
262
  export function $StateRefActiveDirective(
263
263
  $state,
264
- $routerGlobals,
264
+ $router,
265
265
  $interpolate,
266
266
  $stateRegistry,
267
267
  $transitions,
@@ -300,8 +300,8 @@ export function $StateRefActiveDirective(
300
300
  trans.promise.then(update, () => {});
301
301
  }
302
302
  $scope.$on("$destroy", setupEventListeners());
303
- if ($routerGlobals.transition) {
304
- updateAfterTransition($routerGlobals.transition);
303
+ if ($router.transition) {
304
+ updateAfterTransition($router.transition);
305
305
  }
306
306
  function setupEventListeners() {
307
307
  const deregisterStatesChangedListener =
@@ -1,4 +1,4 @@
1
- import { Angular } from "../../loader.js";
1
+ import { Angular } from "../../angular.js";
2
2
  import { createElementFromHTML, dealoc } from "../../shared/dom.js";
3
3
  import { browserTrigger, wait } from "../../shared/test-utils.js";
4
4
 
@@ -15,7 +15,7 @@ describe("ngStateRef", () => {
15
15
  $injector,
16
16
  $state,
17
17
  $stateParams,
18
- $urlService;
18
+ $url;
19
19
 
20
20
  beforeEach(() => {
21
21
  dealoc(document.getElementById("app"));
@@ -30,7 +30,8 @@ describe("ngStateRef", () => {
30
30
  */
31
31
  ($stateProvider, $locationProvider) => {
32
32
  _locationProvider = $locationProvider;
33
- $locationProvider.setHashPrefix("");
33
+ $locationProvider.html5ModeConf.enabled = false;
34
+ $locationProvider.hashPrefixConf = "";
34
35
  $stateProvider
35
36
  .state({ name: "top", url: "" })
36
37
  .state({ name: "other", url: "/other/:id", template: "other" })
@@ -60,9 +61,9 @@ describe("ngStateRef", () => {
60
61
  $rootScope = $injector.get("$rootScope");
61
62
  $compile = $injector.get("$compile");
62
63
  $state = $injector.get("$state");
63
- $stateParams = $injector.get("$stateParams");
64
- $urlService = $injector.get("$urlService");
65
- $urlService.listen();
64
+ $stateParams = $injector.get("$router").params;
65
+ $url = $injector.get("$url");
66
+ $url.listen();
66
67
  });
67
68
 
68
69
  afterEach(() => (window.location.hash = ""));
@@ -704,7 +705,7 @@ describe("ngSrefActive", () => {
704
705
  $rootScope = $injector.get("$rootScope");
705
706
  $compile = $injector.get("$compile");
706
707
  $state = $injector.get("$state");
707
- $stateParams = $injector.get("$stateParams");
708
+ $stateParams = $injector.get("$router").params;
708
709
  });
709
710
 
710
711
  it("should update class for sibling ngSref", async () => {
@@ -1,10 +1,5 @@
1
1
  import { filter, tail, unnestR } from "../../shared/common.js";
2
- import {
3
- hasAnimate,
4
- isDefined,
5
- isFunction,
6
- // isString,
7
- } from "../../shared/utils.js";
2
+ import { hasAnimate, isDefined, isFunction } from "../../shared/utils.js";
8
3
  // import { kebobString } from "../../shared/strings.js";
9
4
  import { parse } from "../../shared/hof.js";
10
5
  import { ResolveContext } from "../resolve/resolve-context.js";
@@ -29,7 +24,7 @@ import { getLocals } from "../state/state-registry.js";
29
24
  * The ng-view can be targeted in a View using the name ([[StateDeclaration.views]]).
30
25
  *
31
26
  * - `autoscroll`: an expression. When it evaluates to true, the `ng-view` will be scrolled into view when it is activated.
32
- * Uses [[$ngViewScroll]] to do the scrolling.
27
+ * Uses [[$viewScroll]] to do the scrolling.
33
28
  *
34
29
  * - `onload`: Expression to evaluate whenever the view updates.
35
30
  *
@@ -148,16 +143,16 @@ import { getLocals } from "../state/state-registry.js";
148
143
  export let ngView = [
149
144
  "$view",
150
145
  "$animate",
151
- "$ngViewScroll",
146
+ "$viewScroll",
152
147
  "$interpolate",
153
148
  /**
154
149
  * @param {*} $view
155
150
  * @param {*} $animate
156
- * @param {*} $ngViewScroll
151
+ * @param {*} $viewScroll
157
152
  * @param {*} $interpolate
158
153
  * @returns {import("../../interface.js").Directive}
159
154
  */
160
- function $ViewDirective($view, $animate, $ngViewScroll, $interpolate) {
155
+ function $ViewDirective($view, $animate, $viewScroll, $interpolate) {
161
156
  function getRenderer() {
162
157
  return {
163
158
  enter: function (element, target, cb) {
@@ -283,7 +278,7 @@ export let ngView = [
283
278
  * @param {string} viewName Name of the view.
284
279
  */
285
280
  newScope.$emit("$viewContentLoading", name);
286
- const cloned = $transclude(newScope, function (clone) {
281
+ currentEl = $transclude(newScope, function (clone) {
287
282
  setCacheData(clone, "$ngViewAnim", $ngViewAnim);
288
283
  setCacheData(clone, "$ngView", $ngViewData);
289
284
  renderer.enter(clone, $element, function () {
@@ -294,12 +289,11 @@ export let ngView = [
294
289
  (isDefined(autoScrollExp) && !autoScrollExp) ||
295
290
  scope.$eval(autoScrollExp)
296
291
  ) {
297
- $ngViewScroll(clone);
292
+ $viewScroll(clone);
298
293
  }
299
294
  });
300
295
  cleanupLastView();
301
296
  });
302
- currentEl = cloned;
303
297
  currentScope = newScope;
304
298
  /**
305
299
  * Fired once the view is **loaded**, *after* the DOM is rendered.