@angular-wave/angular.ts 0.0.15 → 0.0.17

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 (294) hide show
  1. package/README.md +5 -3
  2. package/dist/angular-ts.esm.js +1 -1
  3. package/dist/angular-ts.umd.js +1 -1
  4. package/index.html +66 -57
  5. package/package.json +1 -1
  6. package/src/animations/animate-children-directive.js +1 -1
  7. package/src/animations/animate-css-driver.js +1 -1
  8. package/src/animations/animate-css.js +2 -2
  9. package/src/animations/animate-js-driver.js +1 -1
  10. package/src/animations/animate-js.js +2 -2
  11. package/src/animations/animate-queue.js +3 -4
  12. package/src/animations/animation.js +1 -1
  13. package/src/animations/shared.js +4 -4
  14. package/src/core/animate-runner.js +1 -1
  15. package/src/core/animate.js +4 -5
  16. package/src/core/compile.js +5 -6
  17. package/src/core/controller.js +4 -3
  18. package/src/core/filter.js +1 -1
  19. package/src/core/interpolate.js +1 -1
  20. package/src/core/interval-factory.js +1 -1
  21. package/src/core/interval.js +1 -1
  22. package/src/core/location.js +1 -1
  23. package/src/core/parser/parse.js +1 -1
  24. package/src/core/q.js +2 -3
  25. package/src/core/root-scope.js +1 -1
  26. package/src/core/sanitize-uri.js +1 -1
  27. package/src/core/sce.js +1 -1
  28. package/src/core/task-tracker-factory.js +1 -1
  29. package/src/core/timeout.js +1 -1
  30. package/src/core/urlUtils.js +1 -1
  31. package/src/directive/attrs.js +1 -1
  32. package/src/directive/bind.js +1 -1
  33. package/src/directive/class.js +2 -2
  34. package/src/directive/events.js +1 -1
  35. package/src/directive/form.js +1 -1
  36. package/src/directive/include.js +1 -1
  37. package/src/directive/input.js +1 -1
  38. package/src/directive/list.js +2 -2
  39. package/src/directive/model-options.js +1 -1
  40. package/src/directive/model.js +1 -1
  41. package/src/directive/options.js +2 -3
  42. package/src/directive/ref.js +1 -1
  43. package/src/directive/repeat.js +1 -1
  44. package/src/directive/select.js +1 -1
  45. package/src/directive/switch.js +1 -1
  46. package/src/directive/transclude.js +1 -1
  47. package/src/directive/validators.js +1 -1
  48. package/src/exts/aria.js +1 -1
  49. package/src/exts/messages.js +3 -3
  50. package/src/exts/messages.md +28 -31
  51. package/src/filters/filter.js +2 -3
  52. package/src/filters/filters.js +1 -1
  53. package/src/filters/limit-to.js +1 -1
  54. package/src/filters/order-by.js +2 -3
  55. package/src/injector.js +8 -9
  56. package/src/jqLite.js +3 -4
  57. package/src/loader.js +1 -3
  58. package/src/public.js +1 -1
  59. package/src/router/common/coreservices.js +5 -0
  60. package/src/router/{core/common → common}/queue.js +1 -1
  61. package/src/router/{core/common → common}/trace.js +21 -19
  62. package/src/router/{adapter/directives → directives}/stateDirectives.js +24 -28
  63. package/src/router/{adapter/directives → directives}/viewDirective.js +9 -9
  64. package/src/router/{core/globals.js → globals.js} +13 -3
  65. package/src/router/{core/hooks → hooks}/coreResolvables.js +6 -4
  66. package/src/router/{core/hooks → hooks}/lazyLoad.js +5 -2
  67. package/src/router/{core/hooks → hooks}/redirectTo.js +1 -1
  68. package/src/router/{core/hooks → hooks}/resolve.js +2 -2
  69. package/src/router/{core/hooks → hooks}/updateGlobals.js +1 -1
  70. package/src/router/{core/hooks → hooks}/views.js +1 -1
  71. package/src/router/index.js +60 -0
  72. package/src/router/{adapter/injectables.js → injectables.js} +9 -9
  73. package/src/router/{adapter/locationServices.js → locationServices.js} +19 -12
  74. package/src/router/{core/params → params}/param.js +5 -10
  75. package/src/router/{core/params → params}/paramType.js +4 -4
  76. package/src/router/{core/params → params}/paramTypes.js +4 -3
  77. package/src/router/{core/params → params}/stateParams.js +1 -1
  78. package/src/router/{core/path → path}/pathNode.js +2 -2
  79. package/src/router/{core/path → path}/pathUtils.js +13 -7
  80. package/src/router/{core/resolve → resolve}/resolvable.js +5 -5
  81. package/src/router/{core/resolve → resolve}/resolveContext.js +16 -6
  82. package/src/router/router.js +172 -72
  83. package/src/router/{adapter/services.js → services.js} +47 -27
  84. package/src/router/{core/state → state}/stateBuilder.js +14 -10
  85. package/src/router/{core/state → state}/stateMatcher.js +2 -3
  86. package/src/router/{core/state → state}/stateObject.js +8 -6
  87. package/src/router/{core/state → state}/stateQueueManager.js +3 -3
  88. package/src/router/{core/state → state}/stateRegistry.js +6 -7
  89. package/src/router/{core/state → state}/stateService.js +12 -15
  90. package/src/router/{core/state → state}/targetState.js +2 -2
  91. package/src/router/{adapter/statebuilders → state}/views.js +17 -15
  92. package/src/router/{adapter/stateProvider.js → stateProvider.js} +52 -9
  93. package/src/router/{adapter/templateFactory.js → templateFactory.js} +10 -19
  94. package/src/router/{core/transition → transition}/hookBuilder.js +4 -3
  95. package/src/router/{core/transition → transition}/hookRegistry.js +3 -6
  96. package/src/router/{core/transition → transition}/rejectFactory.js +4 -5
  97. package/src/router/{core/transition → transition}/transition.js +10 -12
  98. package/src/router/{core/transition → transition}/transitionHook.js +4 -4
  99. package/src/router/{core/transition → transition}/transitionService.js +13 -13
  100. package/src/router/{core/url → url}/urlConfig.js +28 -19
  101. package/src/router/{core/url → url}/urlMatcher.js +14 -16
  102. package/src/router/{core/url → url}/urlMatcherFactory.js +7 -6
  103. package/src/router/{core/url → url}/urlRouter.js +6 -30
  104. package/src/router/{core/url → url}/urlRule.js +3 -3
  105. package/src/router/{core/url → url}/urlRules.js +10 -11
  106. package/src/router/{core/url → url}/urlService.js +12 -6
  107. package/src/router/{core/view → view}/view.js +32 -27
  108. package/src/router/{adapter/viewScroll.js → viewScroll.js} +3 -0
  109. package/src/services/anchor-scroll.js +1 -1
  110. package/src/services/browser.js +1 -1
  111. package/src/services/cache-factory.js +7 -1
  112. package/src/services/cookie-reader.js +1 -1
  113. package/src/services/http-backend.js +6 -1
  114. package/src/services/http.js +4 -5
  115. package/src/services/log.js +1 -1
  116. package/src/services/template-request.js +2 -2
  117. package/src/{router/core/common → shared}/common.js +35 -16
  118. package/src/{router/core/common → shared}/predicates.js +2 -12
  119. package/src/{router/core/common → shared}/strings.js +5 -13
  120. package/src/{core → shared}/utils.js +13 -29
  121. package/test/angular.spec.js +1 -31
  122. package/test/{ng → core}/animate.spec.js +1 -1
  123. package/test/{ng → core}/compile.spec.js +2 -3
  124. package/test/{ng → core}/http.spec.js +2 -2
  125. package/test/{ng → core}/on.spec.js +1 -1
  126. package/test/{ng → core}/parse.spec.js +1 -1
  127. package/test/{ng → core}/prop.spec.js +1 -1
  128. package/test/{ng → core}/scope.spec.js +1 -1
  129. package/test/{ng/directive → directive}/a.spec.js +4 -4
  130. package/test/{ng/directive → directive}/bind.spec.js +3 -3
  131. package/test/{ng/directive → directive}/boolean.spec.js +2 -2
  132. package/test/{ng/directive → directive}/change.spec.js +3 -3
  133. package/test/{ng/directive → directive}/class.spec.js +4 -4
  134. package/test/{ng/directive → directive}/click.spec.js +3 -3
  135. package/test/{ng/directive → directive}/cloak.spec.js +4 -4
  136. package/test/{ng/directive → directive}/constoller.spec.js +5 -5
  137. package/test/{ng/directive → directive}/element-style.spec.js +3 -3
  138. package/test/{ng/directive → directive}/event.spec.js +4 -4
  139. package/test/{ng/directive → directive}/form.spec.js +5 -5
  140. package/test/{ng/directive → directive}/href.spec.js +4 -4
  141. package/test/{ng/directive → directive}/if.spec.js +5 -5
  142. package/test/{ng/directive → directive}/include.spec.js +5 -5
  143. package/test/{ng/directive → directive}/init.spec.js +4 -4
  144. package/test/{ng/directive → directive}/input.spec.js +5 -5
  145. package/test/{ng/directive → directive}/list.spec.js +3 -3
  146. package/test/{ng/directive → directive}/model-options.spec.js +6 -6
  147. package/test/{ng/directive → directive}/model.spec.js +8 -8
  148. package/test/{ng/directive → directive}/non-bindable.spec.js +3 -3
  149. package/test/{ng/directive → directive}/options.spec.js +5 -5
  150. package/test/{ng/directive → directive}/ref.spec.js +2 -2
  151. package/test/{ng/directive → directive}/repeat.spec.js +5 -5
  152. package/test/{ng/directive → directive}/script.spec.js +3 -3
  153. package/test/{ng/directive → directive}/scrset.spec.js +3 -3
  154. package/test/{ng/directive → directive}/select.spec.js +5 -5
  155. package/test/{ng/directive → directive}/show-hide.spec.js +3 -3
  156. package/test/{ng/directive → directive}/src.spec.js +3 -3
  157. package/test/{ng/directive → directive}/style.spec.js +3 -3
  158. package/test/{ng/directive → directive}/switch.spec.js +3 -3
  159. package/test/{ng/directive → directive}/validators.spec.js +3 -3
  160. package/test/{ng/filter → filter}/filter.spec.js +4 -4
  161. package/test/{ng/filter → filter}/filters.spec.js +3 -3
  162. package/test/{ng/filter → filter}/limit-to.spec.js +3 -3
  163. package/test/{ng/filter → filter}/order-by.spec.js +2 -2
  164. package/test/injector.spec.js +1 -1
  165. package/test/jqlite.spec.js +1 -1
  166. package/test/messages/messages.spec.js +1 -1
  167. package/test/min-err.spec.js +1 -1
  168. package/test/original-test.html +4 -4
  169. package/test/router/glob.spec.js +78 -0
  170. package/test/router/state.spec.js +931 -0
  171. package/test/sanitize/bing-html.spec.js +1 -1
  172. package/test/shared/common.spec.js +283 -0
  173. package/test/shared/hof.spec.js +60 -0
  174. package/test/shared/strings.spec.js +40 -0
  175. package/test/{ng → shared}/utils.spec.js +1 -1
  176. package/types/router/angular.d.ts +1 -0
  177. package/types/router/core/common/common.d.ts +370 -0
  178. package/types/router/core/common/coreservices.d.ts +80 -0
  179. package/types/router/core/common/glob.d.ts +60 -0
  180. package/types/router/core/common/hof.d.ts +160 -0
  181. package/types/router/core/common/index.d.ts +8 -0
  182. package/types/router/core/common/predicates.d.ts +25 -0
  183. package/types/router/core/common/queue.d.ts +15 -0
  184. package/types/router/core/common/safeConsole.d.ts +5 -0
  185. package/types/router/core/common/strings.d.ts +64 -0
  186. package/types/router/core/common/trace.d.ts +114 -0
  187. package/types/router/core/globals.d.ts +45 -0
  188. package/types/router/core/hooks/coreResolvables.d.ts +4 -0
  189. package/types/router/core/hooks/ignoredTransition.d.ts +2 -0
  190. package/types/router/core/hooks/invalidTransition.d.ts +2 -0
  191. package/types/router/core/hooks/lazyLoad.d.ts +12 -0
  192. package/types/router/core/hooks/onEnterExitRetain.d.ts +4 -0
  193. package/types/router/core/hooks/redirectTo.d.ts +2 -0
  194. package/types/router/core/hooks/resolve.d.ts +5 -0
  195. package/types/router/core/hooks/updateGlobals.d.ts +2 -0
  196. package/types/router/core/hooks/url.d.ts +2 -0
  197. package/types/router/core/hooks/views.d.ts +3 -0
  198. package/types/router/core/index.d.ts +12 -0
  199. package/types/router/core/interface.d.ts +102 -0
  200. package/types/router/core/params/index.d.ts +12 -0
  201. package/types/router/core/params/interface.d.ts +606 -0
  202. package/types/router/core/params/param.d.ts +65 -0
  203. package/types/router/core/params/paramType.d.ts +65 -0
  204. package/types/router/core/params/paramTypes.d.ts +190 -0
  205. package/types/router/core/params/stateParams.d.ts +15 -0
  206. package/types/router/core/path/index.d.ts +2 -0
  207. package/types/router/core/path/pathNode.d.ts +60 -0
  208. package/types/router/core/path/pathUtils.d.ts +79 -0
  209. package/types/router/core/resolve/index.d.ts +3 -0
  210. package/types/router/core/resolve/interface.d.ts +210 -0
  211. package/types/router/core/resolve/resolvable.d.ts +69 -0
  212. package/types/router/core/resolve/resolveContext.d.ts +92 -0
  213. package/types/router/core/router.d.ts +95 -0
  214. package/types/router/core/state/index.d.ts +28 -0
  215. package/types/router/core/state/interface.d.ts +708 -0
  216. package/types/router/core/state/stateBuilder.d.ts +104 -0
  217. package/types/router/core/state/stateMatcher.d.ts +11 -0
  218. package/types/router/core/state/stateObject.d.ts +155 -0
  219. package/types/router/core/state/stateQueueManager.d.ts +24 -0
  220. package/types/router/core/state/stateRegistry.d.ts +136 -0
  221. package/types/router/core/state/stateService.d.ts +350 -0
  222. package/types/router/core/state/targetState.d.ts +100 -0
  223. package/types/router/core/transition/hookBuilder.d.ts +45 -0
  224. package/types/router/core/transition/hookRegistry.d.ts +93 -0
  225. package/types/router/core/transition/index.d.ts +20 -0
  226. package/types/router/core/transition/interface.d.ts +819 -0
  227. package/types/router/core/transition/rejectFactory.d.ts +103 -0
  228. package/types/router/core/transition/transition.d.ts +527 -0
  229. package/types/router/core/transition/transitionEventType.d.ts +17 -0
  230. package/types/router/core/transition/transitionHook.d.ts +88 -0
  231. package/types/router/core/transition/transitionService.d.ts +187 -0
  232. package/types/router/core/url/index.d.ts +8 -0
  233. package/types/router/core/url/interface.d.ts +156 -0
  234. package/types/router/core/url/urlConfig.d.ts +141 -0
  235. package/types/router/core/url/urlMatcher.d.ts +180 -0
  236. package/types/router/core/url/urlMatcherFactory.d.ts +52 -0
  237. package/types/router/core/url/urlRouter.d.ts +85 -0
  238. package/types/router/core/url/urlRule.d.ts +120 -0
  239. package/types/router/core/url/urlRules.d.ts +244 -0
  240. package/types/router/core/url/urlService.d.ts +206 -0
  241. package/types/router/core/vanilla.d.ts +1 -0
  242. package/types/router/core/view/index.d.ts +2 -0
  243. package/types/router/core/view/interface.d.ts +46 -0
  244. package/types/router/core/view/view.d.ts +167 -0
  245. package/types/router/directives/stateDirectives.d.ts +3 -0
  246. package/types/router/directives/viewDirective.d.ts +143 -0
  247. package/types/router/index.d.ts +19 -0
  248. package/types/router/interface.d.ts +491 -0
  249. package/types/router/legacy/resolveService.d.ts +44 -0
  250. package/types/router/legacy/stateEvents.d.ts +123 -0
  251. package/types/router/locationServices.d.ts +43 -0
  252. package/types/router/services.d.ts +15 -0
  253. package/types/router/stateFilters.d.ts +11 -0
  254. package/types/router/stateProvider.d.ts +254 -0
  255. package/types/router/statebuilders/onEnterExitRetain.d.ts +12 -0
  256. package/types/router/statebuilders/views.d.ts +41 -0
  257. package/types/router/templateFactory.d.ts +84 -0
  258. package/types/router/viewScroll.d.ts +9 -0
  259. package/src/router/adapter/statebuilders/onEnterExitRetain.js +0 -29
  260. package/src/router/core/common/coreservices.js +0 -15
  261. package/src/router/core/common/safeConsole.js +0 -38
  262. package/src/router/core/interface.js +0 -3
  263. package/src/router/core/resolve/interface.js +0 -10
  264. package/src/router/core/router.js +0 -203
  265. package/src/router/core/url/interface.js +0 -1
  266. package/src/router/core/view/interface.js +0 -1
  267. /package/src/router/{core/common → common}/glob.js +0 -0
  268. /package/src/router/{core/hooks → hooks}/ignoredTransition.js +0 -0
  269. /package/src/router/{core/hooks → hooks}/invalidTransition.js +0 -0
  270. /package/src/router/{core/hooks → hooks}/onEnterExitRetain.js +0 -0
  271. /package/src/router/{core/hooks → hooks}/url.js +0 -0
  272. /package/src/router/{core/params → params}/README.md +0 -0
  273. /package/src/router/{core/state → state}/README.md +0 -0
  274. /package/src/router/{adapter/stateFilters.js → stateFilters.js} +0 -0
  275. /package/src/router/{core/transition → transition}/interface.js +0 -0
  276. /package/src/router/{core/transition → transition}/transitionEventType.js +0 -0
  277. /package/src/{router/core/common → shared}/hof.js +0 -0
  278. /package/test/{ng → core}/cache-factor.spec.js +0 -0
  279. /package/test/{ng → core}/controller-provider.spec.js +0 -0
  280. /package/test/{ng → core}/cookie-reader.spec.js +0 -0
  281. /package/test/{ng → core}/document.spec.js +0 -0
  282. /package/test/{ng → core}/filter.spec.js +0 -0
  283. /package/test/{ng → core}/http-backend.spec.js +0 -0
  284. /package/test/{ng → core}/interpolate.spec.js +0 -0
  285. /package/test/{ng → core}/interval.spec.js +0 -0
  286. /package/test/{ng → core}/location.spec.js +0 -0
  287. /package/test/{ng → core}/q.spec.js +0 -0
  288. /package/test/{ng → core}/root-element.spec.js +0 -0
  289. /package/test/{ng → core}/sanitize-uri.spec.js +0 -0
  290. /package/test/{ng → core}/sce.spec.js +0 -0
  291. /package/test/{ng → core}/template-request.spec.js +0 -0
  292. /package/test/{ng → core}/timeout.spec.js +0 -0
  293. /package/test/{ng → core}/url-utils.spec.js +0 -0
  294. /package/{src/router/adapter/interface.js → types/router/injectables.d.ts} +0 -0
@@ -1,13 +1,12 @@
1
- import { pick, forEach, tail } from "../../core/common/common";
2
- import { isArray, isDefined, isString } from "../../../core/utils";
3
- import { isInjectable } from "../../core/common/predicates";
4
- import { services } from "../../core/common/coreservices";
5
- import { trace } from "../../core/common/trace";
6
- import { ViewService } from "../../core/view/view";
7
- import { ResolveContext } from "../../core/resolve/resolveContext";
8
- import { Resolvable } from "../../core/resolve/resolvable";
1
+ import { pick, forEach, tail } from "../../shared/common";
2
+ import { isDefined, isString } from "../../shared/utils";
3
+ import { isInjectable } from "../../shared/predicates";
4
+ import { services } from "../common/coreservices";
5
+ import { trace } from "../common/trace";
6
+ import { ViewService } from "../view/view";
7
+ import { ResolveContext } from "../resolve/resolveContext";
8
+ import { Resolvable } from "../resolve/resolvable";
9
9
 
10
- /** @internalapi */
11
10
  export function getNg1ViewConfigFactory() {
12
11
  let templateFactory = null;
13
12
  return (path, view) => {
@@ -16,7 +15,7 @@ export function getNg1ViewConfigFactory() {
16
15
  return [new Ng1ViewConfig(path, view, templateFactory)];
17
16
  };
18
17
  }
19
- /** @internalapi */
18
+
20
19
  const hasAnyKey = (keys, obj) =>
21
20
  keys.reduce((acc, key) => acc || isDefined(obj[key]), false);
22
21
  /**
@@ -28,7 +27,6 @@ const hasAnyKey = (keys, obj) =>
28
27
  * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object
29
28
  * and applies the state-level configuration to a view named `$default`.
30
29
  *
31
- * @internalapi
32
30
  */
33
31
  export function ng1ViewsBuilder(state) {
34
32
  // Do not process root state
@@ -89,15 +87,19 @@ export function ng1ViewsBuilder(state) {
89
87
  });
90
88
  return views;
91
89
  }
92
- /** @hidden */
90
+
91
+ /**
92
+ * @type {Number}
93
+ */
93
94
  let id = 0;
94
- /** @internalapi */
95
+
95
96
  export class Ng1ViewConfig {
96
97
  constructor(path, viewDecl, factory) {
97
98
  this.path = path;
98
99
  this.viewDecl = viewDecl;
99
100
  this.factory = factory;
100
- this.$id = id++;
101
+
102
+ /** @type {Number} */ this.$id = id++;
101
103
  this.loaded = false;
102
104
  this.getTemplate = (uiView, context) =>
103
105
  this.component
@@ -138,7 +140,7 @@ export class Ng1ViewConfig {
138
140
  const provider = this.viewDecl.controllerProvider;
139
141
  if (!isInjectable(provider)) return this.viewDecl.controller;
140
142
  const deps = services.$injector.annotate(provider);
141
- const providerFn = isArray(provider) ? tail(provider) : provider;
143
+ const providerFn = Array.isArray(provider) ? tail(provider) : provider;
142
144
  const resolvable = new Resolvable("", providerFn, deps);
143
145
  return resolvable.get(context);
144
146
  }
@@ -1,8 +1,36 @@
1
1
  /** @publicapi @module ng1 */ /** */
2
2
 
3
- import { val } from "../core/common/hof";
4
- import { createProxyFunctions } from "../core/common/common";
5
- import { isObject } from "../../core/utils";
3
+ import { val } from "../shared/hof";
4
+ import { createProxyFunctions } from "../shared/common";
5
+ import { minErr } from "../shared/utils";
6
+
7
+ const err = minErr("$stateProvider");
8
+ const validKeys = [
9
+ "$$state",
10
+ "__stateObjectCache",
11
+ "controller",
12
+ "controllerProvider",
13
+ "data",
14
+ "includes",
15
+ "name",
16
+ "navigable",
17
+ "onEnter",
18
+ "onExit",
19
+ "onRetain",
20
+ "params",
21
+ "parent",
22
+ "path",
23
+ "reloadOnSearch",
24
+ "resolve",
25
+ "resolvables",
26
+ "self",
27
+ "template",
28
+ "templateProvider",
29
+ "templateUrl",
30
+ "url",
31
+ "views",
32
+ ];
33
+
6
34
  /**
7
35
  * The Angular 1 `StateProvider`
8
36
  *
@@ -117,13 +145,28 @@ export class StateProvider {
117
145
  decorator(name, func) {
118
146
  return this.stateRegistry.decorator(name, func) || this;
119
147
  }
120
- state(name, definition) {
121
- if (isObject(name)) {
122
- definition = name;
123
- } else {
124
- definition.name = name;
148
+
149
+ /**
150
+ *
151
+ * @param {angular.Ng1StateDeclaration} definition
152
+ * @returns {StateProvider}
153
+ */
154
+ state(definition) {
155
+ if (!definition.name) {
156
+ throw err("stateinvalid", `'name' required`);
157
+ }
158
+
159
+ const hasInvalidKeys = Object.keys(definition).filter(
160
+ (key) => !validKeys.includes(key),
161
+ );
162
+ if (hasInvalidKeys.length) {
163
+ throw err("stateinvalid", `Invalid key(s): ${hasInvalidKeys.join(", ")}`);
164
+ }
165
+ try {
166
+ this.stateRegistry.register(definition);
167
+ } catch (e) {
168
+ throw err("stateinvalid", e.message);
125
169
  }
126
- this.stateRegistry.register(definition);
127
170
  return this;
128
171
  }
129
172
  /**
@@ -1,21 +1,15 @@
1
1
  /** @publicapi @module view */ /** */
2
- import {
3
- isArray,
4
- isDefined,
5
- isFunction,
6
- isObject,
7
- } from "../core/common/predicates";
8
- import { services } from "../core/common/coreservices";
9
- import { tail, unnestR } from "../core/common/common";
10
- import { Resolvable } from "../core/resolve/resolvable";
11
- import { kebobString } from "../core/common/strings";
2
+ import { isDefined, isFunction, isObject } from "../shared/utils";
3
+ import { services } from "./common/coreservices";
4
+ import { tail, unnestR } from "../shared/common";
5
+ import { Resolvable } from "./resolve/resolvable";
6
+ import { kebobString } from "../shared/strings";
12
7
 
13
8
  /**
14
9
  * Service which manages loading of templates from a ViewConfig.
15
10
  */
16
11
  export class TemplateFactory {
17
12
  constructor() {
18
- /** @hidden */ this._useHttp = true; // TODO investigate
19
13
  /** @hidden */ this.$get = [
20
14
  "$http",
21
15
  "$templateCache",
@@ -31,10 +25,7 @@ export class TemplateFactory {
31
25
  },
32
26
  ];
33
27
  }
34
- /** @hidden */
35
- useHttpService(value) {
36
- this._useHttp = value;
37
- }
28
+
38
29
  /**
39
30
  * Creates a template from a configuration object.
40
31
  *
@@ -120,7 +111,7 @@ export class TemplateFactory {
120
111
  */
121
112
  fromProvider(provider, params, context) {
122
113
  const deps = services.$injector.annotate(provider);
123
- const providerFn = isArray(provider) ? tail(provider) : provider;
114
+ const providerFn = Array.isArray(provider) ? tail(provider) : provider;
124
115
  const resolvable = new Resolvable("", providerFn, deps);
125
116
  return resolvable.get(context);
126
117
  }
@@ -133,7 +124,7 @@ export class TemplateFactory {
133
124
  */
134
125
  fromComponentProvider(provider, params, context) {
135
126
  const deps = services.$injector.annotate(provider);
136
- const providerFn = isArray(provider) ? tail(provider) : provider;
127
+ const providerFn = Array.isArray(provider) ? tail(provider) : provider;
137
128
  const resolvable = new Resolvable("", providerFn, deps);
138
129
  return resolvable.get(context);
139
130
  }
@@ -181,7 +172,7 @@ export class TemplateFactory {
181
172
  const fn = res && res.data;
182
173
  const args = (fn && services.$injector.annotate(fn)) || [];
183
174
  // account for array style injection, i.e., ['foo', function(foo) {}]
184
- const arrayIdxStr = isArray(fn) ? `[${fn.length - 1}]` : "";
175
+ const arrayIdxStr = Array.isArray(fn) ? `[${fn.length - 1}]` : "";
185
176
  return `${attrName}='$resolve.${resolveName}${arrayIdxStr}(${args.join(",")})'`;
186
177
  }
187
178
  // some-attr="::$resolve.someResolveName"
@@ -213,6 +204,6 @@ const scopeBindings = (bindingsObj) =>
213
204
  // [ 'input', [ '=foo', '=', 'foo' ] ]
214
205
  .map((key) => [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])])
215
206
  // skip malformed values
216
- .filter((tuple) => isDefined(tuple) && isArray(tuple[1]))
207
+ .filter((tuple) => isDefined(tuple) && Array.isArray(tuple[1]))
217
208
  // { name: ('foo' || 'input'), type: '=' }
218
209
  .map((tuple) => ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] }));
@@ -1,5 +1,4 @@
1
- import { assertPredicate, unnestR, identity } from "../common/common";
2
- import { isArray } from "../common/predicates";
1
+ import { assertPredicate, unnestR, identity } from "../../shared/common";
3
2
  import { TransitionHookPhase, TransitionHookScope } from "./interface";
4
3
  import { TransitionHook } from "./transitionHook";
5
4
  /**
@@ -103,7 +102,9 @@ export class HookBuilder {
103
102
  : [this.transition, $transitions];
104
103
  return registries
105
104
  .map((reg) => reg.getHooks(hookType.name)) // Get named hooks from registries
106
- .filter(assertPredicate(isArray, `broken event named: ${hookType.name}`)) // Sanity check
105
+ .filter(
106
+ assertPredicate(Array.isArray, `broken event named: ${hookType.name}`),
107
+ ) // Sanity check
107
108
  .reduce(unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array
108
109
  .filter((hook) => hook.matches(treeChanges, transition)); // Only those satisfying matchCriteria
109
110
  }
@@ -1,10 +1,7 @@
1
- import { removeFrom, tail, identity, mapObj } from "../common/common";
2
- import { isString, isFunction } from "../common/predicates";
1
+ import { removeFrom, tail, identity, mapObj } from "../../shared/common";
2
+ import { isString, isFunction } from "../../shared/utils";
3
3
  import { Glob } from "../common/glob";
4
- import {
5
- // has or is using
6
- TransitionHookScope,
7
- } from "./interface";
4
+ import { TransitionHookScope } from "./interface";
8
5
  /**
9
6
  * Determines if the given state matches the matchCriteria
10
7
  *
@@ -1,6 +1,6 @@
1
- import { silentRejection } from "../common/common";
2
- import { stringify } from "../common/strings";
3
- import { is } from "../common/hof";
1
+ import { silentRejection } from "../../shared/common";
2
+ import { stringify } from "../../shared/strings";
3
+ import { is } from "../../shared/hof";
4
4
  /** An enum for Transition Rejection reasons */
5
5
  var RejectType;
6
6
  (function (RejectType) {
@@ -42,7 +42,7 @@ var RejectType;
42
42
  RejectType[(RejectType["ERROR"] = 6)] = "ERROR";
43
43
  })(RejectType || (RejectType = {}));
44
44
  export { RejectType };
45
- /** @internal */
45
+
46
46
  let id = 0;
47
47
  export class Rejection {
48
48
  /** Returns true if the obj is a rejected promise created from the `asPromise` factory */
@@ -100,7 +100,6 @@ export class Rejection {
100
100
  return is(Rejection)(detail) ? detail : Rejection.errored(detail);
101
101
  }
102
102
  constructor(type, message, detail) {
103
- /** @internal */
104
103
  this.$id = id++;
105
104
  this.type = type;
106
105
  this.message = message;
@@ -1,6 +1,6 @@
1
1
  import { trace } from "../common/trace";
2
2
  import { services } from "../common/coreservices";
3
- import { stringify } from "../common/strings";
3
+ import { stringify } from "../../shared/strings";
4
4
  import {
5
5
  map,
6
6
  find,
@@ -13,9 +13,9 @@ import {
13
13
  anyTrueR,
14
14
  flattenR,
15
15
  uniqR,
16
- } from "../common/common";
17
- import { isObject, isUndefined } from "../common/predicates";
18
- import { prop, propEq, val, not, is } from "../common/hof";
16
+ } from "../../shared/common";
17
+ import { isUndefined, isObject } from "../../shared/utils";
18
+ import { prop, propEq, val, not, is } from "../../shared/hof";
19
19
  import { TransitionHookPhase } from "./interface"; // has or is using
20
20
  import { TransitionHook } from "./transitionHook";
21
21
  import { matchState, makeEvent } from "./hookRegistry";
@@ -25,7 +25,7 @@ import { Param } from "../params/param";
25
25
  import { Resolvable } from "../resolve/resolvable";
26
26
  import { ResolveContext } from "../resolve/resolveContext";
27
27
  import { Rejection } from "./rejectFactory";
28
- /** @internal */
28
+
29
29
  const stateSelf = prop("self");
30
30
  /**
31
31
  * Represents a transition between two states.
@@ -36,7 +36,6 @@ const stateSelf = prop("self");
36
36
  * It has information about all states being entered and exited as a result of the transition.
37
37
  */
38
38
  export class Transition {
39
- /** @internal */
40
39
  onBefore(criteria, callback, options) {
41
40
  return;
42
41
  }
@@ -78,7 +77,7 @@ export class Transition {
78
77
  .filter((type) => type.hookPhase !== TransitionHookPhase.CREATE)
79
78
  .forEach((type) => makeEvent(this, this.router.transitionService, type));
80
79
  }
81
- /** @internal */
80
+
82
81
  getHooks(hookName) {
83
82
  return this._registeredHooks[hookName];
84
83
  }
@@ -92,11 +91,10 @@ export class Transition {
92
91
  * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`
93
92
  * encapsulates the "from state".
94
93
  * @param targetState The target state and parameters being transitioned to (also, the transition options)
95
- * @param router The [[UIRouter]] instance
94
+ * @param {import('../router').UIRouter} router The [[UIRouter]] instance
96
95
  * @internal
97
96
  */
98
97
  constructor(fromPath, targetState, router) {
99
- /** @internal */
100
98
  this._deferred = services.$q.defer();
101
99
  /**
102
100
  * This promise is resolved or rejected based on the outcome of the Transition.
@@ -107,7 +105,7 @@ export class Transition {
107
105
  this.promise = this._deferred.promise;
108
106
  /** @internal Holds the hook registration functions such as those passed to Transition.onStart() */
109
107
  this._registeredHooks = {};
110
- /** @internal */
108
+
111
109
  this._hookBuilder = new HookBuilder(this);
112
110
  /** Checks if this transition is currently active/running. */
113
111
  this.isActive = () => this.router.globals.transition === this;
@@ -585,7 +583,7 @@ export class Transition {
585
583
  ignored() {
586
584
  return !!this._ignoredReason();
587
585
  }
588
- /** @internal */
586
+
589
587
  _ignoredReason() {
590
588
  const pending = this.router.globals.transition;
591
589
  const reloadState = this._options.reloadState;
@@ -737,5 +735,5 @@ export class Transition {
737
735
  return `Transition#${id}( '${from}'${fromParams} -> ${toValid}'${to}'${toParams} )`;
738
736
  }
739
737
  }
740
- /** @internal */
738
+
741
739
  Transition.diToken = Transition;
@@ -1,8 +1,8 @@
1
1
  import { TransitionHookPhase } from "./interface";
2
- import { defaults, noop, silentRejection } from "../common/common";
3
- import { fnToString, maxLength } from "../common/strings";
4
- import { isPromise } from "../common/predicates";
5
- import { is, parse } from "../common/hof";
2
+ import { defaults, noop, silentRejection } from "../../shared/common";
3
+ import { fnToString, maxLength } from "../../shared/strings";
4
+ import { isPromise } from "../../shared/predicates";
5
+ import { is, parse } from "../../shared/hof";
6
6
  import { trace } from "../common/trace";
7
7
  import { services } from "../common/coreservices";
8
8
  import { Rejection } from "./rejectFactory";
@@ -25,9 +25,9 @@ import { registerUpdateUrl } from "../hooks/url";
25
25
  import { registerLazyLoadHook } from "../hooks/lazyLoad";
26
26
  import { TransitionEventType } from "./transitionEventType";
27
27
  import { TransitionHook } from "./transitionHook";
28
- import { isDefined } from "../common/predicates";
29
- import { removeFrom, createProxyFunctions } from "../common/common";
30
- import { val } from "../common/hof";
28
+ import { isDefined } from "../../shared/utils";
29
+ import { removeFrom, createProxyFunctions } from "../../shared/common";
30
+ import { val } from "../../shared/hof";
31
31
  import { registerIgnoredTransitionHook } from "../hooks/ignoredTransition";
32
32
  import { registerInvalidTransitionHook } from "../hooks/invalidTransition";
33
33
  /**
@@ -60,9 +60,10 @@ export let defaultTransOpts = {
60
60
  * This API is located at `router.transitionService` ([[UIRouter.transitionService]])
61
61
  */
62
62
  export class TransitionService {
63
- /** @internal */
63
+ /**
64
+ * @param {import('../router').UIRouter} _router
65
+ */
64
66
  constructor(_router) {
65
- /** @internal */
66
67
  this._transitionCount = 0;
67
68
  /** The transition hook types, such as `onEnter`, `onStart`, etc */
68
69
  this._eventTypes = [];
@@ -169,7 +170,7 @@ export class TransitionService {
169
170
  create(fromPath, targetState) {
170
171
  return new Transition(fromPath, targetState, this._router);
171
172
  }
172
- /** @internal */
173
+
173
174
  _defineCoreEvents() {
174
175
  const Phase = TransitionHookPhase;
175
176
  const TH = TransitionHook;
@@ -214,7 +215,7 @@ export class TransitionService {
214
215
  SYNCHRONOUS,
215
216
  );
216
217
  }
217
- /** @internal */
218
+
218
219
  _defineCorePaths() {
219
220
  const { STATE, TRANSITION } = TransitionHookScope;
220
221
  this._definePathType("to", TRANSITION);
@@ -223,7 +224,7 @@ export class TransitionService {
223
224
  this._definePathType("retained", STATE);
224
225
  this._definePathType("entering", STATE);
225
226
  }
226
- /** @internal */
227
+
227
228
  _defineEvent(
228
229
  name,
229
230
  hookPhase,
@@ -247,7 +248,7 @@ export class TransitionService {
247
248
  this._eventTypes.push(eventType);
248
249
  makeEvent(this, this, eventType);
249
250
  }
250
- /** @internal */
251
+
251
252
  _getEvents(phase) {
252
253
  const transitionHookTypes = isDefined(phase)
253
254
  ? this._eventTypes.filter((type) => type.hookPhase === phase)
@@ -273,16 +274,15 @@ export class TransitionService {
273
274
  _definePathType(name, hookScope) {
274
275
  this._criteriaPaths[name] = { name, scope: hookScope };
275
276
  }
276
- /** @internal */
277
- // tslint:disable-next-line
277
+
278
278
  _getPathTypes() {
279
279
  return this._criteriaPaths;
280
280
  }
281
- /** @internal */
281
+
282
282
  getHooks(hookName) {
283
283
  return this._registeredHooks[hookName];
284
284
  }
285
- /** @internal */
285
+
286
286
  _registerCoreTransitionHooks() {
287
287
  const fns = this._deregisterHookFns;
288
288
  fns.addCoreResolves = registerAddCoreResolvables(this);
@@ -1,5 +1,5 @@
1
- import { ParamTypes } from "../../core/params/paramTypes";
2
- import { isDefined, isString } from "../../../core/utils";
1
+ import { ParamTypes } from "../params/paramTypes";
2
+ import { isDefined, isString } from "../../shared/utils";
3
3
  /**
4
4
  * An API to customize the URL behavior and retrieve URL configuration
5
5
  *
@@ -14,21 +14,30 @@ import { isDefined, isString } from "../../../core/utils";
14
14
  * This API is found at `router.urlService.config` (see: [[UIRouter.urlService]], [[URLService.config]])
15
15
  */
16
16
  export class UrlConfig {
17
- /** @internal */ constructor(/** @internal */ router) {
17
+ /**
18
+ * @param {import('../router').UIRouter} router
19
+ */
20
+ constructor(router) {
21
+ /** @type {import('../router').UIRouter} */
18
22
  this.router = router;
19
- /** @internal */ this.paramTypes = new ParamTypes();
20
- /** @internal */ this._decodeParams = true;
21
- /** @internal */ this._isCaseInsensitive = false;
22
- /** @internal */ this._isStrictMode = true;
23
- /** @internal */ this._defaultSquashPolicy = false;
24
- /** @internal */ this.dispose = () => this.paramTypes.dispose();
23
+ /** @type {ParamTypes} */
24
+ this.paramTypes = new ParamTypes();
25
+ /** @type {boolean} */
26
+ this._decodeParams = true;
27
+ /** @type {boolean} */
28
+ this._isCaseInsensitive = false;
29
+ /** @type {boolean} */
30
+ this._isStrictMode = true;
31
+ /** @type {boolean} */
32
+ this._defaultSquashPolicy = false;
33
+ this.dispose = () => this.paramTypes.dispose();
25
34
  // Delegate these calls to the current LocationConfig implementation
26
35
  /**
27
36
  * Gets the base Href, e.g., `http://localhost/approot/`
28
37
  *
29
38
  * @return the application's base href
30
39
  */
31
- this.baseHref = () => this.router.locationConfig.baseHref();
40
+ this.baseHref = () => this.router.locationService.baseHref();
32
41
  /**
33
42
  * Gets or sets the hashPrefix
34
43
  *
@@ -39,31 +48,31 @@ export class UrlConfig {
39
48
  * @return the hash prefix
40
49
  */
41
50
  this.hashPrefix = (newprefix) =>
42
- this.router.locationConfig.hashPrefix(newprefix);
51
+ this.router.locationService.$locationProvider.hashPrefix(newprefix);
43
52
  /**
44
53
  * Gets the host, e.g., `localhost`
45
54
  *
46
- * @return the protocol
55
+ * @return {string} the protocol
47
56
  */
48
- this.host = () => this.router.locationConfig.host();
57
+ this.host = () => this.router.locationService.$location.host();
49
58
  /**
50
59
  * Returns true when running in pushstate mode
51
60
  *
52
- * @return true when running in html5 mode (pushstate mode).
61
+ * @return {boolean} true when running in html5 mode (pushstate mode).
53
62
  */
54
- this.html5Mode = () => this.router.locationConfig.html5Mode();
63
+ this.html5Mode = () => this.router.locationService.html5Mode();
55
64
  /**
56
65
  * Gets the port, e.g., `80`
57
66
  *
58
- * @return the port number
67
+ * @return {number} the port number
59
68
  */
60
- this.port = () => this.router.locationConfig.port();
69
+ this.port = () => this.router.locationService.$location.port();
61
70
  /**
62
71
  * Gets the protocol, e.g., `http`
63
72
  *
64
- * @return the protocol
73
+ * @return {string} the protocol
65
74
  */
66
- this.protocol = () => this.router.locationConfig.protocol();
75
+ this.protocol = () => this.router.locationService.$location.protocol();
67
76
  }
68
77
  /**
69
78
  * Defines whether URL matching should be case sensitive (the default behavior), or not.
@@ -9,11 +9,11 @@ import {
9
9
  unnestR,
10
10
  arrayTuples,
11
11
  defaults,
12
- } from "../common/common";
13
- import { prop, propEq } from "../common/hof";
14
- import { isArray, isString, isDefined } from "../common/predicates";
12
+ } from "../../shared/common";
13
+ import { prop, propEq } from "../../shared/hof";
14
+ import { isDefined, isString } from "../../shared/utils";
15
15
  import { Param, DefType } from "../params/param";
16
- import { joinNeighborsR, splitOnDelim } from "../common/strings";
16
+ import { joinNeighborsR, splitOnDelim } from "../../shared/strings";
17
17
  function quoteRegExp(str, param) {
18
18
  let surroundPattern = ["", ""],
19
19
  result = str.replace(/[\\\[\]\^$*+?.()|{}]/g, "\\$&");
@@ -94,7 +94,6 @@ const defaultConfig = {
94
94
  *
95
95
  */
96
96
  export class UrlMatcher {
97
- /** @internal */
98
97
  static encodeDashes(str) {
99
98
  // Replace dashes with encoded "\-"
100
99
  return encodeURIComponent(str).replace(
@@ -185,15 +184,14 @@ export class UrlMatcher {
185
184
  * @param config A [[UrlMatcherCompileConfig]] configuration object
186
185
  */
187
186
  constructor(pattern, paramTypes, paramFactory, config) {
188
- /** @internal */
189
187
  this._cache = { path: [this] };
190
- /** @internal */
188
+
191
189
  this._children = [];
192
- /** @internal */
190
+
193
191
  this._params = [];
194
- /** @internal */
192
+
195
193
  this._segments = [];
196
- /** @internal */
194
+
197
195
  this._compiled = [];
198
196
  this.config = config = defaults(config, defaultConfig);
199
197
  this.pattern = pattern;
@@ -306,7 +304,7 @@ export class UrlMatcher {
306
304
  };
307
305
  return url;
308
306
  }
309
- /** @internal */
307
+
310
308
  isRoot() {
311
309
  return this._cache.path[0] === this;
312
310
  }
@@ -317,7 +315,7 @@ export class UrlMatcher {
317
315
  _getDecodedParamValue(value, param) {
318
316
  if (isDefined(value)) {
319
317
  if (this.config.decodeParams && !param.type.raw) {
320
- if (isArray(value)) {
318
+ if (Array.isArray(value)) {
321
319
  value = value.map((paramValue) => decodeURIComponent(paramValue));
322
320
  } else {
323
321
  value = decodeURIComponent(value);
@@ -449,7 +447,7 @@ export class UrlMatcher {
449
447
  params = params || {};
450
448
  // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher
451
449
  const paramSchema = this.parameters().filter((paramDef) =>
452
- params.hasOwnProperty(paramDef.id),
450
+ Object.prototype.hasOwnProperty.call(params, paramDef.id),
453
451
  );
454
452
  return paramSchema
455
453
  .map((paramDef) => validParamVal(paramDef, params[paramDef.id]))
@@ -515,7 +513,7 @@ export class UrlMatcher {
515
513
  if (squash !== false) return acc; // ?
516
514
  if (encoded == null) return acc;
517
515
  // If this parameter value is an array, encode the value using encodeDashes
518
- if (isArray(encoded))
516
+ if (Array.isArray(encoded))
519
517
  return acc + map(encoded, UrlMatcher.encodeDashes).join("-");
520
518
  // If the parameter type is "raw", then do not encodeURIComponent
521
519
  if (param.raw) return acc + encoded;
@@ -528,7 +526,7 @@ export class UrlMatcher {
528
526
  .map((paramDetails) => {
529
527
  let { param, squash, encoded, isDefaultValue } = paramDetails;
530
528
  if (encoded == null || (isDefaultValue && squash !== false)) return;
531
- if (!isArray(encoded)) encoded = [encoded];
529
+ if (!Array.isArray(encoded)) encoded = [encoded];
532
530
  if (encoded.length === 0) return;
533
531
  if (!param.raw) encoded = map(encoded, encodeURIComponent);
534
532
  return encoded.map((val) => `${param.id}=${val}`);
@@ -544,5 +542,5 @@ export class UrlMatcher {
544
542
  );
545
543
  }
546
544
  }
547
- /** @internal */
545
+
548
546
  UrlMatcher.nameValidator = /^\w+([-.]+\w+)*(?:\[\])?$/;