@angular-wave/angular.ts 0.0.16 → 0.0.18

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 (299) 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/rollup.config.js +2 -6
  7. package/src/animations/animate-children-directive.js +1 -1
  8. package/src/animations/animate-css-driver.js +1 -1
  9. package/src/animations/animate-css.js +220 -15
  10. package/src/animations/animate-js-driver.js +1 -1
  11. package/src/animations/animate-js.js +2 -2
  12. package/src/animations/animate-queue.js +3 -4
  13. package/src/animations/animation.js +1 -1
  14. package/src/animations/module.js +750 -0
  15. package/src/animations/shared.js +15 -4
  16. package/src/core/animate-runner.js +1 -1
  17. package/src/core/animate.js +4 -5
  18. package/src/core/compile.js +6 -7
  19. package/src/core/controller.js +4 -3
  20. package/src/core/filter.js +1 -1
  21. package/src/core/interpolate.js +1 -1
  22. package/src/core/interval-factory.js +1 -1
  23. package/src/core/interval.js +1 -1
  24. package/src/core/location.js +1 -1
  25. package/src/core/parser/parse.js +1 -1
  26. package/src/core/q.js +2 -3
  27. package/src/core/root-scope.js +1 -1
  28. package/src/core/sanitize-uri.js +1 -1
  29. package/src/core/sce.js +1 -1
  30. package/src/core/task-tracker-factory.js +1 -1
  31. package/src/core/timeout.js +1 -1
  32. package/src/core/urlUtils.js +1 -1
  33. package/src/directive/attrs.js +1 -1
  34. package/src/directive/bind.js +1 -1
  35. package/src/directive/class.js +2 -2
  36. package/src/directive/events.js +1 -1
  37. package/src/directive/form.js +1 -1
  38. package/src/directive/include.js +1 -1
  39. package/src/directive/input.js +1 -1
  40. package/src/directive/list.js +2 -2
  41. package/src/directive/model-options.js +1 -1
  42. package/src/directive/model.js +1 -1
  43. package/src/directive/options.js +2 -3
  44. package/src/directive/ref.js +1 -1
  45. package/src/directive/repeat.js +1 -1
  46. package/src/directive/select.js +1 -1
  47. package/src/directive/switch.js +1 -1
  48. package/src/directive/transclude.js +1 -1
  49. package/src/directive/validators.js +1 -1
  50. package/src/exts/aria.js +1 -1
  51. package/src/exts/messages.js +3 -3
  52. package/src/exts/messages.md +28 -31
  53. package/src/filters/filter.js +2 -3
  54. package/src/filters/filters.js +1 -1
  55. package/src/filters/limit-to.js +1 -1
  56. package/src/filters/order-by.js +2 -3
  57. package/src/injector.js +8 -9
  58. package/src/jqLite.js +3 -4
  59. package/src/loader.js +2 -4
  60. package/src/public.js +1 -1
  61. package/src/router/common/coreservices.js +5 -0
  62. package/src/router/{core/common → common}/queue.js +1 -1
  63. package/src/router/{core/common → common}/trace.js +21 -19
  64. package/src/router/{adapter/directives → directives}/stateDirectives.js +24 -28
  65. package/src/router/{adapter/directives → directives}/viewDirective.js +10 -9
  66. package/src/router/{core/globals.js → globals.js} +13 -3
  67. package/src/router/{core/hooks → hooks}/coreResolvables.js +6 -4
  68. package/src/router/{core/hooks → hooks}/lazyLoad.js +5 -2
  69. package/src/router/{core/hooks → hooks}/redirectTo.js +1 -1
  70. package/src/router/{core/hooks → hooks}/resolve.js +5 -4
  71. package/src/router/{core/hooks → hooks}/updateGlobals.js +1 -1
  72. package/src/router/{core/hooks → hooks}/views.js +2 -3
  73. package/src/router/index.js +60 -0
  74. package/src/router/{adapter/injectables.js → injectables.js} +9 -9
  75. package/src/router/{adapter/locationServices.js → locationServices.js} +19 -12
  76. package/src/router/{core/params → params}/param.js +5 -10
  77. package/src/router/{core/params → params}/paramType.js +4 -4
  78. package/src/router/{core/params → params}/paramTypes.js +4 -3
  79. package/src/router/{core/params → params}/stateParams.js +1 -1
  80. package/src/router/{core/path → path}/pathNode.js +2 -2
  81. package/src/router/{core/path → path}/pathUtils.js +13 -7
  82. package/src/router/{core/resolve → resolve}/resolvable.js +5 -5
  83. package/src/router/{core/resolve → resolve}/resolveContext.js +16 -6
  84. package/src/router/router.js +171 -72
  85. package/src/router/{adapter/services.js → services.js} +47 -27
  86. package/src/router/{core/state → state}/stateBuilder.js +14 -10
  87. package/src/router/{core/state → state}/stateMatcher.js +2 -3
  88. package/src/router/{core/state → state}/stateObject.js +8 -6
  89. package/src/router/{core/state → state}/stateQueueManager.js +3 -3
  90. package/src/router/{core/state → state}/stateRegistry.js +6 -7
  91. package/src/router/{core/state → state}/stateService.js +12 -15
  92. package/src/router/{core/state → state}/targetState.js +2 -2
  93. package/src/router/{adapter/statebuilders → state}/views.js +17 -15
  94. package/src/router/{adapter/stateProvider.js → stateProvider.js} +51 -9
  95. package/src/router/{adapter/templateFactory.js → templateFactory.js} +10 -19
  96. package/src/router/{core/transition → transition}/hookBuilder.js +4 -3
  97. package/src/router/{core/transition → transition}/hookRegistry.js +3 -6
  98. package/src/router/{core/transition → transition}/rejectFactory.js +4 -5
  99. package/src/router/{core/transition → transition}/transition.js +10 -12
  100. package/src/router/{core/transition → transition}/transitionHook.js +4 -4
  101. package/src/router/{core/transition → transition}/transitionService.js +13 -13
  102. package/src/router/{core/url → url}/urlConfig.js +28 -19
  103. package/src/router/{core/url → url}/urlMatcher.js +14 -16
  104. package/src/router/{core/url → url}/urlMatcherFactory.js +7 -6
  105. package/src/router/{core/url → url}/urlRouter.js +6 -30
  106. package/src/router/{core/url → url}/urlRule.js +3 -3
  107. package/src/router/{core/url → url}/urlRules.js +10 -11
  108. package/src/router/{core/url → url}/urlService.js +12 -6
  109. package/src/router/{core/view → view}/view.js +32 -27
  110. package/src/router/{adapter/viewScroll.js → viewScroll.js} +3 -0
  111. package/src/services/anchor-scroll.js +1 -1
  112. package/src/services/browser.js +1 -1
  113. package/src/services/cache-factory.js +7 -1
  114. package/src/services/cookie-reader.js +1 -1
  115. package/src/services/http-backend.js +6 -1
  116. package/src/services/http.js +4 -5
  117. package/src/services/log.js +1 -1
  118. package/src/services/template-request.js +2 -2
  119. package/src/{router/core/common → shared}/common.js +35 -16
  120. package/src/{router/core/common → shared}/predicates.js +2 -12
  121. package/src/{router/core/common → shared}/strings.js +5 -13
  122. package/src/{core → shared}/utils.js +13 -29
  123. package/test/angular.spec.js +1 -31
  124. package/test/{ng → core}/animate.spec.js +1 -1
  125. package/test/{ng → core}/compile.spec.js +2 -3
  126. package/test/{ng → core}/http.spec.js +2 -2
  127. package/test/{ng → core}/on.spec.js +1 -1
  128. package/test/{ng → core}/parse.spec.js +1 -1
  129. package/test/{ng → core}/prop.spec.js +1 -1
  130. package/test/{ng → core}/scope.spec.js +1 -1
  131. package/test/{ng/directive → directive}/a.spec.js +4 -4
  132. package/test/{ng/directive → directive}/bind.spec.js +3 -3
  133. package/test/{ng/directive → directive}/boolean.spec.js +2 -2
  134. package/test/{ng/directive → directive}/change.spec.js +3 -3
  135. package/test/{ng/directive → directive}/class.spec.js +4 -4
  136. package/test/{ng/directive → directive}/click.spec.js +3 -3
  137. package/test/{ng/directive → directive}/cloak.spec.js +4 -4
  138. package/test/{ng/directive → directive}/constoller.spec.js +5 -5
  139. package/test/{ng/directive → directive}/element-style.spec.js +3 -3
  140. package/test/{ng/directive → directive}/event.spec.js +4 -4
  141. package/test/{ng/directive → directive}/form.spec.js +5 -5
  142. package/test/{ng/directive → directive}/href.spec.js +4 -4
  143. package/test/{ng/directive → directive}/if.spec.js +5 -5
  144. package/test/{ng/directive → directive}/include.spec.js +5 -5
  145. package/test/{ng/directive → directive}/init.spec.js +4 -4
  146. package/test/{ng/directive → directive}/input.spec.js +5 -5
  147. package/test/{ng/directive → directive}/list.spec.js +3 -3
  148. package/test/{ng/directive → directive}/model-options.spec.js +6 -6
  149. package/test/{ng/directive → directive}/model.spec.js +8 -8
  150. package/test/{ng/directive → directive}/non-bindable.spec.js +3 -3
  151. package/test/{ng/directive → directive}/options.spec.js +5 -5
  152. package/test/{ng/directive → directive}/ref.spec.js +2 -2
  153. package/test/{ng/directive → directive}/repeat.spec.js +5 -5
  154. package/test/{ng/directive → directive}/script.spec.js +3 -3
  155. package/test/{ng/directive → directive}/scrset.spec.js +3 -3
  156. package/test/{ng/directive → directive}/select.spec.js +5 -5
  157. package/test/{ng/directive → directive}/show-hide.spec.js +3 -3
  158. package/test/{ng/directive → directive}/src.spec.js +3 -3
  159. package/test/{ng/directive → directive}/style.spec.js +3 -3
  160. package/test/{ng/directive → directive}/switch.spec.js +3 -3
  161. package/test/{ng/directive → directive}/validators.spec.js +3 -3
  162. package/test/{ng/filter → filter}/filter.spec.js +4 -4
  163. package/test/{ng/filter → filter}/filters.spec.js +3 -3
  164. package/test/{ng/filter → filter}/limit-to.spec.js +3 -3
  165. package/test/{ng/filter → filter}/order-by.spec.js +2 -2
  166. package/test/injector.spec.js +1 -1
  167. package/test/jqlite.spec.js +1 -1
  168. package/test/messages/messages.spec.js +1 -1
  169. package/test/min-err.spec.js +1 -1
  170. package/test/original-test.html +4 -4
  171. package/test/router/glob.spec.js +78 -0
  172. package/test/router/state.spec.js +1010 -0
  173. package/test/sanitize/bing-html.spec.js +1 -1
  174. package/test/shared/common.spec.js +283 -0
  175. package/test/shared/hof.spec.js +60 -0
  176. package/test/shared/strings.spec.js +40 -0
  177. package/test/{ng → shared}/utils.spec.js +1 -1
  178. package/types/index.d.ts +1 -1
  179. package/types/router/angular.d.ts +1 -0
  180. package/types/router/core/common/common.d.ts +370 -0
  181. package/types/router/core/common/coreservices.d.ts +80 -0
  182. package/types/router/core/common/glob.d.ts +60 -0
  183. package/types/router/core/common/hof.d.ts +160 -0
  184. package/types/router/core/common/index.d.ts +8 -0
  185. package/types/router/core/common/predicates.d.ts +25 -0
  186. package/types/router/core/common/queue.d.ts +15 -0
  187. package/types/router/core/common/safeConsole.d.ts +5 -0
  188. package/types/router/core/common/strings.d.ts +64 -0
  189. package/types/router/core/common/trace.d.ts +114 -0
  190. package/types/router/core/globals.d.ts +45 -0
  191. package/types/router/core/hooks/coreResolvables.d.ts +4 -0
  192. package/types/router/core/hooks/ignoredTransition.d.ts +2 -0
  193. package/types/router/core/hooks/invalidTransition.d.ts +2 -0
  194. package/types/router/core/hooks/lazyLoad.d.ts +12 -0
  195. package/types/router/core/hooks/onEnterExitRetain.d.ts +4 -0
  196. package/types/router/core/hooks/redirectTo.d.ts +2 -0
  197. package/types/router/core/hooks/resolve.d.ts +5 -0
  198. package/types/router/core/hooks/updateGlobals.d.ts +2 -0
  199. package/types/router/core/hooks/url.d.ts +2 -0
  200. package/types/router/core/hooks/views.d.ts +3 -0
  201. package/types/router/core/index.d.ts +12 -0
  202. package/types/router/core/interface.d.ts +102 -0
  203. package/types/router/core/params/index.d.ts +12 -0
  204. package/types/router/core/params/interface.d.ts +606 -0
  205. package/types/router/core/params/param.d.ts +65 -0
  206. package/types/router/core/params/paramType.d.ts +65 -0
  207. package/types/router/core/params/paramTypes.d.ts +190 -0
  208. package/types/router/core/params/stateParams.d.ts +15 -0
  209. package/types/router/core/path/index.d.ts +2 -0
  210. package/types/router/core/path/pathNode.d.ts +60 -0
  211. package/types/router/core/path/pathUtils.d.ts +79 -0
  212. package/types/router/core/resolve/index.d.ts +3 -0
  213. package/types/router/core/resolve/interface.d.ts +210 -0
  214. package/types/router/core/resolve/resolvable.d.ts +69 -0
  215. package/types/router/core/resolve/resolveContext.d.ts +92 -0
  216. package/types/router/core/router.d.ts +95 -0
  217. package/types/router/core/state/index.d.ts +28 -0
  218. package/types/router/core/state/interface.d.ts +708 -0
  219. package/types/router/core/state/stateBuilder.d.ts +104 -0
  220. package/types/router/core/state/stateMatcher.d.ts +11 -0
  221. package/types/router/core/state/stateObject.d.ts +155 -0
  222. package/types/router/core/state/stateQueueManager.d.ts +24 -0
  223. package/types/router/core/state/stateRegistry.d.ts +136 -0
  224. package/types/router/core/state/stateService.d.ts +350 -0
  225. package/types/router/core/state/targetState.d.ts +100 -0
  226. package/types/router/core/transition/hookBuilder.d.ts +45 -0
  227. package/types/router/core/transition/hookRegistry.d.ts +93 -0
  228. package/types/router/core/transition/index.d.ts +20 -0
  229. package/types/router/core/transition/interface.d.ts +819 -0
  230. package/types/router/core/transition/rejectFactory.d.ts +103 -0
  231. package/types/router/core/transition/transition.d.ts +527 -0
  232. package/types/router/core/transition/transitionEventType.d.ts +17 -0
  233. package/types/router/core/transition/transitionHook.d.ts +88 -0
  234. package/types/router/core/transition/transitionService.d.ts +187 -0
  235. package/types/router/core/url/index.d.ts +8 -0
  236. package/types/router/core/url/interface.d.ts +156 -0
  237. package/types/router/core/url/urlConfig.d.ts +141 -0
  238. package/types/router/core/url/urlMatcher.d.ts +180 -0
  239. package/types/router/core/url/urlMatcherFactory.d.ts +52 -0
  240. package/types/router/core/url/urlRouter.d.ts +85 -0
  241. package/types/router/core/url/urlRule.d.ts +120 -0
  242. package/types/router/core/url/urlRules.d.ts +244 -0
  243. package/types/router/core/url/urlService.d.ts +206 -0
  244. package/types/router/core/vanilla.d.ts +1 -0
  245. package/types/router/core/view/index.d.ts +2 -0
  246. package/types/router/core/view/interface.d.ts +46 -0
  247. package/types/router/core/view/view.d.ts +167 -0
  248. package/types/router/directives/stateDirectives.d.ts +3 -0
  249. package/types/router/directives/viewDirective.d.ts +143 -0
  250. package/types/router/index.d.ts +19 -0
  251. package/types/router/interface.d.ts +491 -0
  252. package/types/router/legacy/resolveService.d.ts +44 -0
  253. package/types/router/legacy/stateEvents.d.ts +123 -0
  254. package/types/router/locationServices.d.ts +43 -0
  255. package/types/router/services.d.ts +15 -0
  256. package/types/router/stateFilters.d.ts +11 -0
  257. package/types/router/stateProvider.d.ts +254 -0
  258. package/types/router/statebuilders/onEnterExitRetain.d.ts +12 -0
  259. package/types/router/statebuilders/views.d.ts +41 -0
  260. package/types/router/templateFactory.d.ts +84 -0
  261. package/types/router/viewScroll.d.ts +9 -0
  262. package/src/animations/animate.css.md +0 -263
  263. package/src/animations/animate.md +0 -933
  264. package/src/router/adapter/statebuilders/onEnterExitRetain.js +0 -29
  265. package/src/router/core/common/coreservices.js +0 -15
  266. package/src/router/core/common/safeConsole.js +0 -37
  267. package/src/router/core/interface.js +0 -3
  268. package/src/router/core/resolve/interface.js +0 -10
  269. package/src/router/core/router.js +0 -203
  270. package/src/router/core/url/interface.js +0 -1
  271. package/src/router/core/view/interface.js +0 -1
  272. /package/src/router/{core/common → common}/glob.js +0 -0
  273. /package/src/router/{core/hooks → hooks}/ignoredTransition.js +0 -0
  274. /package/src/router/{core/hooks → hooks}/invalidTransition.js +0 -0
  275. /package/src/router/{core/hooks → hooks}/onEnterExitRetain.js +0 -0
  276. /package/src/router/{core/hooks → hooks}/url.js +0 -0
  277. /package/src/router/{core/params → params}/README.md +0 -0
  278. /package/src/router/{core/state → state}/README.md +0 -0
  279. /package/src/router/{adapter/stateFilters.js → stateFilters.js} +0 -0
  280. /package/src/router/{core/transition → transition}/interface.js +0 -0
  281. /package/src/router/{core/transition → transition}/transitionEventType.js +0 -0
  282. /package/src/{router/core/common → shared}/hof.js +0 -0
  283. /package/test/{ng → core}/cache-factor.spec.js +0 -0
  284. /package/test/{ng → core}/controller-provider.spec.js +0 -0
  285. /package/test/{ng → core}/cookie-reader.spec.js +0 -0
  286. /package/test/{ng → core}/document.spec.js +0 -0
  287. /package/test/{ng → core}/filter.spec.js +0 -0
  288. /package/test/{ng → core}/http-backend.spec.js +0 -0
  289. /package/test/{ng → core}/interpolate.spec.js +0 -0
  290. /package/test/{ng → core}/interval.spec.js +0 -0
  291. /package/test/{ng → core}/location.spec.js +0 -0
  292. /package/test/{ng → core}/q.spec.js +0 -0
  293. /package/test/{ng → core}/root-element.spec.js +0 -0
  294. /package/test/{ng → core}/sanitize-uri.spec.js +0 -0
  295. /package/test/{ng → core}/sce.spec.js +0 -0
  296. /package/test/{ng → core}/template-request.spec.js +0 -0
  297. /package/test/{ng → core}/timeout.spec.js +0 -0
  298. /package/test/{ng → core}/url-utils.spec.js +0 -0
  299. /package/{src/router/adapter/interface.js → types/router/injectables.d.ts} +0 -0
@@ -0,0 +1,491 @@
1
+ /** @publicapi @module ng1 */ /** */
2
+ import { StateDeclaration, _ViewDeclaration, IInjectable, Transition, HookResult } from './core';
3
+ /**
4
+ * The signature for Angular 1 State Transition Hooks.
5
+ *
6
+ * State hooks are registered as onEnter/onRetain/onExit in state declarations.
7
+ * State hooks can additionally be injected with $transition$ and $state$ for
8
+ * the current [[Transition]] and [[StateObject]] in the transition.
9
+ *
10
+ * Transition State Hooks are callback functions that hook into the lifecycle events of specific states during a transition.
11
+ * As a transition runs, it may exit some states, retain (keep) states, and enter states.
12
+ * As each lifecycle event occurs, the hooks which are registered for the event and that state are called (in priority order).
13
+ *
14
+ * #### See also:
15
+ *
16
+ * - [[IHookRegistry.onExit]]
17
+ * - [[IHookRegistry.onRetain]]
18
+ * - [[IHookRegistry.onEnter]]
19
+ *
20
+ * #### Example:
21
+ * ```js
22
+ * onEnter: function() { console.log('Entering'); }
23
+ * ```
24
+ *
25
+ * Not minification-safe
26
+ * ```js
27
+ * onRetain: function($state$) { console.log('Retained ' + $state$.name); }
28
+ * ```
29
+ *
30
+ * Annotated for minification-safety
31
+ * ```js
32
+ * onExit: [ '$transition$', '$state', function($transition$, $state) {
33
+ * // always redirect to 'foo' state when being exited
34
+ * if ($transition$.to().name !== 'foo') {
35
+ * return $state.target('foo');
36
+ * }
37
+ * } ]
38
+ * ```
39
+ *
40
+ * @returns an optional [[HookResult]] which may alter the transition
41
+ */
42
+ export interface Ng1StateTransitionHook {
43
+ (...injectables: any[]): HookResult;
44
+ }
45
+ /**
46
+ * @internalapi
47
+ * an intermediate interface.
48
+ *
49
+ * Used to reset [[StateDeclaration]] typings to `any` so the [[Ng1StateDeclaration]] interface can then narrow them */
50
+ export interface _Ng1StateDeclaration extends StateDeclaration {
51
+ onExit?: any;
52
+ onRetain?: any;
53
+ onEnter?: any;
54
+ views?: any;
55
+ }
56
+ /**
57
+ * The StateDeclaration object is used to define a state or nested state.
58
+ * It should be registered with the [[StateRegistry]].
59
+ *
60
+ * #### Example:
61
+ * ```js
62
+ * // StateDeclaration object
63
+ * var foldersState = {
64
+ * name: 'folders',
65
+ * url: '/folders',
66
+ * resolve: {
67
+ * allfolders: function(FolderService) {
68
+ * return FolderService.list();
69
+ * }
70
+ * },
71
+ * template: "<ul><li ng-repeat='folder in allfolders'>{{folder.name}}</li></ul>",
72
+ * controller: function(allfolders, $scope) {
73
+ * $scope.allfolders = allfolders;
74
+ * }
75
+ * }
76
+ * ```
77
+ *
78
+ * Since this interface extends [[Ng1ViewDeclaration]], any view declaration properties can be set directly
79
+ * on the state declaration and they will be applied to the view with the name `$default`. For example:
80
+ *
81
+ * ```js
82
+ * var state = {
83
+ * name: 'foo',
84
+ * url: '/foo',
85
+ * template: '<h1>foo</h1>',
86
+ * controller: 'FooController'
87
+ * }
88
+ * ```
89
+ *
90
+ * is simply syntactic sugar for:
91
+ *
92
+ * ```js
93
+ * var state = {
94
+ * name: 'foo',
95
+ * url: '/foo',
96
+ * views: {
97
+ * $default: {
98
+ * template: '<h1>foo</h1>',
99
+ * controller: 'FooController'
100
+ * }
101
+ * }
102
+ * }
103
+ * ```
104
+ *
105
+ * If a state definition contains a `views:` object, any view properties set directly on the state are ignored.
106
+ * Thus, this is an invalid state defintion:
107
+ *
108
+ * ```js
109
+ * var state = {
110
+ * name: 'foo',
111
+ * url: '/foo',
112
+ * controller: 'FooController', // invalid because views: exists
113
+ * views: {
114
+ * header: {
115
+ * template: '<h1>header</h1>'
116
+ * }
117
+ * }
118
+ * }
119
+ * ```
120
+ */
121
+ export interface Ng1StateDeclaration extends _Ng1StateDeclaration, Ng1ViewDeclaration {
122
+
123
+ }
124
+ export interface Ng1ViewDeclaration extends _ViewDeclaration {
125
+ /**
126
+ * The name of the component to use for this view.
127
+ *
128
+ * A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
129
+ *
130
+ * The name of an [angular 1.5+ `.component()`](https://docs.angularjs.org/guide/component) (or directive with
131
+ * bindToController and/or scope declaration) which will be used for this view.
132
+ *
133
+ * Resolve data can be provided to the component via the component's `bindings` object (for 1.3+ directives, the
134
+ * `bindToController` is used; for other directives, the `scope` declaration is used). For each binding declared
135
+ * on the component, any resolve with the same name is set on the component's controller instance. The binding
136
+ * is provided to the component as a one-time-binding. In general, components should likewise declare their
137
+ * input bindings as [one-way ("&lt;")](https://docs.angularjs.org/api/ng/service/$compile#-scope-).
138
+ *
139
+ * Note: inside a "views:" block, a bare string `"foo"` is shorthand for `{ component: "foo" }`
140
+ *
141
+ * Note: Mapping from resolve names to component inputs may be specified using [[bindings]].
142
+ *
143
+ * #### Example:
144
+ * ```js
145
+ * .state('profile', {
146
+ * // Use the <my-profile></my-profile> component for the Unnamed view
147
+ * component: 'MyProfile',
148
+ * }
149
+ *
150
+ * .state('messages', {
151
+ * // use the <nav-bar></nav-bar> component for the view named 'header'
152
+ * // use the <message-list></message-list> component for the view named 'content'
153
+ * views: {
154
+ * header: { component: 'NavBar' },
155
+ * content: { component: 'MessageList' }
156
+ * }
157
+ * }
158
+ *
159
+ * .state('contacts', {
160
+ * // Inside a "views:" block, a bare string "NavBar" is shorthand for { component: "NavBar" }
161
+ * // use the <nav-bar></nav-bar> component for the view named 'header'
162
+ * // use the <contact-list></contact-list> component for the view named 'content'
163
+ * views: {
164
+ * header: 'NavBar',
165
+ * content: 'ContactList'
166
+ * }
167
+ * }
168
+ * ```
169
+ *
170
+ *
171
+ * Note: When using `component` to define a view, you may _not_ use any of: `template`, `templateUrl`,
172
+ * `templateProvider`, `controller`, `controllerProvider`, `controllerAs`.
173
+ *
174
+ *
175
+ * See also: Todd Motto's angular 1.3 and 1.4 [backport of .component()](https://github.com/toddmotto/angular-component)
176
+ */
177
+ component?: string;
178
+ /**
179
+ * An object which maps `resolve`s to [[component]] `bindings`.
180
+ *
181
+ * A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
182
+ *
183
+ * When using a [[component]] declaration (`component: 'myComponent'`), each input binding for the component is supplied
184
+ * data from a resolve of the same name, by default. You may supply data from a different resolve name by mapping it here.
185
+ *
186
+ * Each key in this object is the name of one of the component's input bindings.
187
+ * Each value is the name of the resolve that should be provided to that binding.
188
+ *
189
+ * Any component bindings that are omitted from this map get the default behavior of mapping to a resolve of the
190
+ * same name.
191
+ *
192
+ * #### Example:
193
+ * ```js
194
+ * $stateProvider.state('foo', {
195
+ * resolve: {
196
+ * foo: function(FooService) { return FooService.get(); },
197
+ * bar: function(BarService) { return BarService.get(); }
198
+ * },
199
+ * component: 'Baz',
200
+ * // The component's `baz` binding gets data from the `bar` resolve
201
+ * // The component's `foo` binding gets data from the `foo` resolve (default behavior)
202
+ * bindings: {
203
+ * baz: 'bar'
204
+ * }
205
+ * });
206
+ *
207
+ * app.component('Baz', {
208
+ * templateUrl: 'baz.html',
209
+ * controller: 'BazController',
210
+ * bindings: {
211
+ * foo: '<', // foo binding
212
+ * baz: '<' // baz binding
213
+ * }
214
+ * });
215
+ * ```
216
+ *
217
+ */
218
+ bindings?: {
219
+ [key: string]: string;
220
+ };
221
+ /**
222
+ * Dynamic component provider function.
223
+ *
224
+ * A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
225
+ *
226
+ * This is an injectable provider function which returns the name of the component to use.
227
+ * The provider will invoked during a Transition in which the view's state is entered.
228
+ * The provider is called after the resolve data is fetched.
229
+ *
230
+ * #### Example:
231
+ * ```js
232
+ * componentProvider: function(MyResolveData, $transition$) {
233
+ * if (MyResolveData.foo) {
234
+ * return "fooComponent"
235
+ * } else if ($transition$.to().name === 'bar') {
236
+ * return "barComponent";
237
+ * }
238
+ * }
239
+ * ```
240
+ */
241
+ componentProvider?: IInjectable;
242
+ /**
243
+ * The view's controller function or name
244
+ *
245
+ * A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
246
+ *
247
+ * The controller function, or the name of a registered controller. The controller function will be used
248
+ * to control the contents of the [[directives.uiView]] directive.
249
+ *
250
+ * If specified as a string, controllerAs can be declared here, i.e., "FooController as foo" instead of in
251
+ * a separate [[controllerAs]] property.
252
+ *
253
+ * See: [[Ng1Controller]] for information about component-level router hooks.
254
+ */
255
+ controller?: IInjectable | string;
256
+ /**
257
+ * A controller alias name.
258
+ *
259
+ * A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
260
+ *
261
+ * If present, the controller will be published to scope under the `controllerAs` name.
262
+ * See: https://docs.angularjs.org/api/ng/directive/ngController
263
+ */
264
+ controllerAs?: string;
265
+ /**
266
+ * Dynamic controller provider function.
267
+ *
268
+ * A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
269
+ *
270
+ * This is an injectable provider function which returns the actual controller function, or the name
271
+ * of a registered controller. The provider will invoked during a Transition in which the view's state is
272
+ * entered. The provider is called after the resolve data is fetched.
273
+ *
274
+ * #### Example:
275
+ * ```js
276
+ * controllerProvider: function(MyResolveData, $transition$) {
277
+ * if (MyResolveData.foo) {
278
+ * return "FooCtrl"
279
+ * } else if ($transition$.to().name === 'bar') {
280
+ * return "BarCtrl";
281
+ * } else {
282
+ * return function($scope) {
283
+ * $scope.baz = "Qux";
284
+ * }
285
+ * }
286
+ * }
287
+ * ```
288
+ */
289
+ controllerProvider?: IInjectable;
290
+ /**
291
+ * The scope variable name to use for resolve data.
292
+ *
293
+ * A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
294
+ *
295
+ * When a view is activated, the resolved data for the state which the view belongs to is put on the scope.
296
+ * This property sets the name of the scope variable to use for the resolved data.
297
+ *
298
+ * Defaults to `$resolve`.
299
+ */
300
+ resolveAs?: string;
301
+ /**
302
+ * The HTML template for the view.
303
+ *
304
+ * A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
305
+ *
306
+ * HTML template as a string, or a function which returns an html template as a string.
307
+ * This template will be used to render the corresponding [[directives.uiView]] directive.
308
+ *
309
+ * This property takes precedence over templateUrl.
310
+ *
311
+ * If `template` is a function, it will be called with the Transition parameters as the first argument.
312
+ *
313
+ * #### Example:
314
+ * ```js
315
+ * template: "<h1>inline template definition</h1><div ui-view></div>"
316
+ * ```
317
+ *
318
+ * #### Example:
319
+ * ```js
320
+ * template: function(params) {
321
+ * return "<h1>generated template</h1>";
322
+ * }
323
+ * ```
324
+ */
325
+ template?: Function | string;
326
+ /**
327
+ * The URL for the HTML template for the view.
328
+ *
329
+ * A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
330
+ *
331
+ * A path or a function that returns a path to an html template.
332
+ * The template will be fetched and used to render the corresponding [[directives.uiView]] directive.
333
+ *
334
+ * If `templateUrl` is a function, it will be called with the Transition parameters as the first argument.
335
+ *
336
+ * #### Example:
337
+ * ```js
338
+ * templateUrl: "/templates/home.html"
339
+ * ```
340
+ *
341
+ * #### Example:
342
+ * ```js
343
+ * templateUrl: function(params) {
344
+ * return myTemplates[params.pageId];
345
+ * }
346
+ * ```
347
+ */
348
+ templateUrl?: string | Function;
349
+ /**
350
+ * Injected function which returns the HTML template.
351
+ *
352
+ * A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
353
+ *
354
+ * Injected function which returns the HTML template.
355
+ * The template will be used to render the corresponding [[directives.uiView]] directive.
356
+ *
357
+ * #### Example:
358
+ * ```js
359
+ * templateProvider: function(MyTemplateService, $transition$) {
360
+ * return MyTemplateService.getTemplate($transition$.params().pageId);
361
+ * }
362
+ * ```
363
+ */
364
+ templateProvider?: IInjectable;
365
+ }
366
+ /**
367
+ * The shape of a controller for a view (and/or component), defining the controller callbacks.
368
+ *
369
+ * A view in UI-Router is comprised of either a `component` ([[Ng1ViewDeclaration.component]]) or a combination of a
370
+ * `template` (or `templateProvider`) and a `controller` (or `controllerProvider`).
371
+ *
372
+ * The `controller` object (or the `component`'s controller object) can define component-level controller callbacks,
373
+ * which UI-Router will call at the appropriate times. These callbacks are similar to Transition Hooks
374
+ * ([[IHookRegistry]]), but are only called if the view is currently active.
375
+ *
376
+ * This interface defines the UI-Router component callbacks.
377
+ *
378
+ */
379
+ export interface Ng1Controller {
380
+ /** @hidden */
381
+ $onInit(): void;
382
+ /**
383
+ * This callback is called when parameter values have changed.
384
+ *
385
+ * This callback can be used to respond to changing parameter values in the current state, or in parent/child states.
386
+ * This callback is especially handy when using dynamic parameters ([[ParamDeclaration.dynamic]])
387
+ *
388
+ * Called when:
389
+ * - The view is still active
390
+ * - A new transition has completed successfully
391
+ * - The state for the view (controller) was not reloaded
392
+ * - At least one parameter value was changed
393
+ *
394
+ * Called with:
395
+ * @param newValues an object containing the changed parameter values
396
+ * @param $transition$ the new Transition which triggered this callback
397
+ *
398
+ * #### Example:
399
+ * ```js
400
+ * angular.module('foo').controller('FancyCtrl', function() {
401
+ * this.uiOnParamsChanged = function(newParams) {
402
+ * console.log("new params: ", newParams);
403
+ * }
404
+ * });
405
+ * ```
406
+ */
407
+ uiOnParamsChanged(newValues: any, $transition$: Transition): void;
408
+ /**
409
+ * This callback is called when the view's state is about to be exited.
410
+ *
411
+ * This callback is used to inform a view that it is about to be exited, due to a new [[Transition]].
412
+ * The callback can ask for user confirmation, and cancel or alter the new Transition. The callback should
413
+ * return a value, or a promise for a value. If a promise is returned, the new Transition waits until the
414
+ * promise settles.
415
+ *
416
+ *
417
+ * Called when:
418
+ * - The view is still active
419
+ * - A new Transition is about to run
420
+ * - The new Transition will exit the view's state
421
+ *
422
+ * Called with:
423
+ * - The new Transition
424
+ *
425
+ * Relevant return Values:
426
+ * - `false`: The transition is cancelled.
427
+ * - A rejected promise: The transition is cancelled.
428
+ * - [[TargetState]]: The transition is redirected to the new target state.
429
+ * - Anything else: the transition will continue normally (the state and view will be deactivated)
430
+ *
431
+ * #### Example:
432
+ * ```js
433
+ * app.component('myComponent', {
434
+ * template: '<input ng-model="$ctrl.data" type="text">',
435
+ * bindings: { 'data': '<' },
436
+ * controller: function() {
437
+ *
438
+ * this.originalData = angular.copy(this.data);
439
+ *
440
+ * this.uiCanExit = function() {
441
+ * if (!angular.equals(this.data, this.originalData)) {
442
+ * // Note: This could also return a Promise and request async
443
+ * // confirmation using something like ui-bootstrap $modal
444
+ * return window.confirm("Data has changed. Exit anyway and lose changes?");
445
+ * }
446
+ * }
447
+ * }
448
+ * }
449
+ * ```
450
+ *
451
+ * @param transition the new Transition that is about to exit the component's state
452
+ * @return a HookResult, or a promise for a HookResult
453
+ */
454
+ uiCanExit(transition: Transition): HookResult;
455
+ }
456
+ /**
457
+ * Manages which template-loading mechanism to use.
458
+ *
459
+ * Defaults to `$templateRequest` on Angular versions starting from 1.3, `$http` otherwise.
460
+ */
461
+ export interface TemplateFactoryProvider {
462
+ /**
463
+ * Forces $templateFactory to use $http instead of $templateRequest.
464
+ *
465
+ * UI-Router uses `$templateRequest` by default on angular 1.3+.
466
+ * Use this method to choose to use `$http` instead.
467
+ *
468
+ * ---
469
+ *
470
+ * ## Security warning
471
+ *
472
+ * This might cause XSS, as $http doesn't enforce the regular security checks for
473
+ * templates that have been introduced in Angular 1.3.
474
+ *
475
+ * See the $sce documentation, section
476
+ * <a href="https://docs.angularjs.org/api/ng/service/$sce#impact-on-loading-templates">
477
+ * Impact on loading templates</a> for more details about this mechanism.
478
+ *
479
+ * *Note: forcing this to `false` on Angular 1.2.x will crash, because `$templateRequest` is not implemented.*
480
+ *
481
+ * @param useUnsafeHttpService `true` to use `$http` to fetch templates
482
+ */
483
+ useHttpService(useUnsafeHttpService: boolean): any;
484
+ }
485
+ declare module '@uirouter/core/lib/state/stateRegistry' {
486
+ interface StateRegistry {
487
+ register(state: Ng1StateDeclaration | {
488
+ new (): Ng1StateDeclaration;
489
+ }): any;
490
+ }
491
+ }
@@ -0,0 +1,44 @@
1
+ /** @publicapi @module ng1 */ /** */
2
+ import { Obj } from './core';
3
+ /** @hidden */
4
+ export declare const resolveFactory: () => {
5
+ /**
6
+ * Asynchronously injects a resolve block.
7
+ *
8
+ * This emulates most of the behavior of the ui-router 0.2.x $resolve.resolve() service API.
9
+ *
10
+ * ### Not bundled by default
11
+ *
12
+ * This API is no longer not part of the standard `@uirouter/angularjs` bundle.
13
+ * For users of the prebuilt bundles, add the `release/resolveService.min.js` UMD bundle.
14
+ * For bundlers (webpack, browserify, etc), add `@uirouter/angularjs/lib/legacy/resolveService`.
15
+ *
16
+ * ---
17
+ *
18
+ * Given an object `invocables`, where keys are strings and values are injectable functions,
19
+ * injects each function, and waits for the resulting promise to resolve.
20
+ * When all resulting promises are resolved, returns the results as an object.
21
+ *
22
+ * #### Example:
23
+ * ```js
24
+ * let invocables = {
25
+ * foo: [ '$http', ($http) =>
26
+ * $http.get('/api/foo').then(resp => resp.data) ],
27
+ * bar: [ 'foo', '$http', (foo, $http) =>
28
+ * $http.get('/api/bar/' + foo.barId).then(resp => resp.data) ]
29
+ * }
30
+ * $resolve.resolve(invocables)
31
+ * .then(results => console.log(results.foo, results.bar))
32
+ * // Logs foo and bar:
33
+ * // { id: 123, barId: 456, fooData: 'foo data' }
34
+ * // { id: 456, barData: 'bar data' }
35
+ * ```
36
+ *
37
+ * @param invocables an object which looks like an [[StateDeclaration.resolve]] object; keys are resolve names and values are injectable functions
38
+ * @param locals key/value pre-resolved data (locals)
39
+ * @param parent a promise for a "parent resolve"
40
+ */
41
+ resolve: (invocables: {
42
+ [key: string]: Function;
43
+ }, locals?: {}, parent?: Promise<any>) => Promise<Obj>;
44
+ };
@@ -0,0 +1,123 @@
1
+ import { IAngularEvent } from 'angular';
2
+ /**
3
+ * An event broadcast on `$rootScope` when the state transition **begins**.
4
+ *
5
+ * ### Deprecation warning: use [[TransitionService.onStart]] instead
6
+ *
7
+ * You can use `event.preventDefault()`
8
+ * to prevent the transition from happening and then the transition promise will be
9
+ * rejected with a `'transition prevented'` value.
10
+ *
11
+ * Additional arguments to the event handler are provided:
12
+ * - `toState`: the Transition Target state
13
+ * - `toParams`: the Transition Target Params
14
+ * - `fromState`: the state the transition is coming from
15
+ * - `fromParams`: the parameters from the state the transition is coming from
16
+ * - `options`: any Transition Options
17
+ * - `$transition$`: the [[Transition]]
18
+ *
19
+ * #### Example:
20
+ * ```js
21
+ * $rootScope.$on('$stateChangeStart', function(event, transition) {
22
+ * event.preventDefault();
23
+ * // transitionTo() promise will be rejected with
24
+ * // a 'transition prevented' error
25
+ * })
26
+ * ```
27
+ *
28
+ * @event $stateChangeStart
29
+ * @deprecated
30
+ */
31
+ export declare let $stateChangeStart: IAngularEvent;
32
+ /**
33
+ * An event broadcast on `$rootScope` if a transition is **cancelled**.
34
+ *
35
+ * ### Deprecation warning: use [[TransitionService.onStart]] instead
36
+ *
37
+ * Additional arguments to the event handler are provided:
38
+ * - `toState`: the Transition Target state
39
+ * - `toParams`: the Transition Target Params
40
+ * - `fromState`: the state the transition is coming from
41
+ * - `fromParams`: the parameters from the state the transition is coming from
42
+ * - `options`: any Transition Options
43
+ * - `$transition$`: the [[Transition]] that was cancelled
44
+ *
45
+ * @event $stateChangeCancel
46
+ * @deprecated
47
+ */
48
+ export declare let $stateChangeCancel: IAngularEvent;
49
+ /**
50
+ * An event broadcast on `$rootScope` once the state transition is **complete**.
51
+ *
52
+ * ### Deprecation warning: use [[TransitionService.onStart]] and [[Transition.promise]], or [[Transition.onSuccess]]
53
+ *
54
+ * Additional arguments to the event handler are provided:
55
+ * - `toState`: the Transition Target state
56
+ * - `toParams`: the Transition Target Params
57
+ * - `fromState`: the state the transition is coming from
58
+ * - `fromParams`: the parameters from the state the transition is coming from
59
+ * - `options`: any Transition Options
60
+ * - `$transition$`: the [[Transition]] that just succeeded
61
+ *
62
+ * @event $stateChangeSuccess
63
+ * @deprecated
64
+ */
65
+ export declare let $stateChangeSuccess: IAngularEvent;
66
+ /**
67
+ * An event broadcast on `$rootScope` when an **error occurs** during transition.
68
+ *
69
+ * ### Deprecation warning: use [[TransitionService.onStart]] and [[Transition.promise]], or [[Transition.onError]]
70
+ *
71
+ * It's important to note that if you
72
+ * have any errors in your resolve functions (javascript errors, non-existent services, etc)
73
+ * they will not throw traditionally. You must listen for this $stateChangeError event to
74
+ * catch **ALL** errors.
75
+ *
76
+ * Additional arguments to the event handler are provided:
77
+ * - `toState`: the Transition Target state
78
+ * - `toParams`: the Transition Target Params
79
+ * - `fromState`: the state the transition is coming from
80
+ * - `fromParams`: the parameters from the state the transition is coming from
81
+ * - `error`: The reason the transition errored.
82
+ * - `options`: any Transition Options
83
+ * - `$transition$`: the [[Transition]] that errored
84
+ *
85
+ * @event $stateChangeError
86
+ * @deprecated
87
+ */
88
+ export declare let $stateChangeError: IAngularEvent;
89
+ /**
90
+ * An event broadcast on `$rootScope` when a requested state **cannot be found** using the provided state name.
91
+ *
92
+ * ### Deprecation warning: use [[StateService.onInvalid]] instead
93
+ *
94
+ * The event is broadcast allowing any handlers a single chance to deal with the error (usually by
95
+ * lazy-loading the unfound state). A `TargetState` object is passed to the listener handler,
96
+ * you can see its properties in the example. You can use `event.preventDefault()` to abort the
97
+ * transition and the promise returned from `transitionTo()` will be rejected with a
98
+ * `'transition aborted'` error.
99
+ *
100
+ * Additional arguments to the event handler are provided:
101
+ * - `unfoundState` Unfound State information. Contains: `to, toParams, options` properties.
102
+ * - `fromState`: the state the transition is coming from
103
+ * - `fromParams`: the parameters from the state the transition is coming from
104
+ * - `options`: any Transition Options
105
+ *
106
+ * #### Example:
107
+ * ```js
108
+ * // somewhere, assume lazy.state has not been defined
109
+ * $state.go("lazy.state", { a: 1, b: 2 }, { inherit: false });
110
+ *
111
+ * // somewhere else
112
+ * $scope.$on('$stateNotFound', function(event, transition) {
113
+ * function(event, unfoundState, fromState, fromParams){
114
+ * console.log(unfoundState.to); // "lazy.state"
115
+ * console.log(unfoundState.toParams); // {a:1, b:2}
116
+ * console.log(unfoundState.options); // {inherit:false} + default options
117
+ * });
118
+ * ```
119
+ *
120
+ * @event $stateNotFound
121
+ * @deprecated
122
+ */
123
+ export declare let $stateNotFound: IAngularEvent;
@@ -0,0 +1,43 @@
1
+ /** @publicapi @module ng1 */ /** */
2
+ import { LocationConfig, LocationServices, UIRouter } from './core';
3
+ import { ILocationService, ILocationProvider, IWindowService } from '../index';
4
+ /**
5
+ * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service
6
+ * @internalapi
7
+ */
8
+ export declare class Ng1LocationServices implements LocationConfig, LocationServices {
9
+ private $locationProvider;
10
+ private $location;
11
+ private $sniffer;
12
+ private $browser;
13
+ private $window;
14
+ path: any;
15
+ search: any;
16
+ hash: any;
17
+ hashPrefix: any;
18
+ port: any;
19
+ protocol: any;
20
+ host: any;
21
+ private _baseHref;
22
+ private _urlListeners;
23
+ /**
24
+ * Applys ng1-specific path parameter encoding
25
+ *
26
+ * The Angular 1 `$location` service is a bit weird.
27
+ * It doesn't allow slashes to be encoded/decoded bi-directionally.
28
+ *
29
+ * See the writeup at https://github.com/angular-ui/ui-router/issues/2598
30
+ *
31
+ * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F
32
+ *
33
+ * @param router
34
+ */
35
+ static monkeyPatchPathParameterType(router: UIRouter): void;
36
+ dispose(): void;
37
+ constructor($locationProvider: ILocationProvider);
38
+ onChange(callback: Function): () => Function[];
39
+ html5Mode(): any;
40
+ baseHref(): any;
41
+ url(newUrl?: string, replace?: boolean, state?: any): string;
42
+ _runtimeServices($rootScope: any, $location: ILocationService, $sniffer: any, $browser: any, $window: IWindowService): void;
43
+ }