@angular-wave/angular.ts 0.0.16 → 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 (298) 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 +1 -3
  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} +52 -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 +931 -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/router/angular.d.ts +1 -0
  179. package/types/router/core/common/common.d.ts +370 -0
  180. package/types/router/core/common/coreservices.d.ts +80 -0
  181. package/types/router/core/common/glob.d.ts +60 -0
  182. package/types/router/core/common/hof.d.ts +160 -0
  183. package/types/router/core/common/index.d.ts +8 -0
  184. package/types/router/core/common/predicates.d.ts +25 -0
  185. package/types/router/core/common/queue.d.ts +15 -0
  186. package/types/router/core/common/safeConsole.d.ts +5 -0
  187. package/types/router/core/common/strings.d.ts +64 -0
  188. package/types/router/core/common/trace.d.ts +114 -0
  189. package/types/router/core/globals.d.ts +45 -0
  190. package/types/router/core/hooks/coreResolvables.d.ts +4 -0
  191. package/types/router/core/hooks/ignoredTransition.d.ts +2 -0
  192. package/types/router/core/hooks/invalidTransition.d.ts +2 -0
  193. package/types/router/core/hooks/lazyLoad.d.ts +12 -0
  194. package/types/router/core/hooks/onEnterExitRetain.d.ts +4 -0
  195. package/types/router/core/hooks/redirectTo.d.ts +2 -0
  196. package/types/router/core/hooks/resolve.d.ts +5 -0
  197. package/types/router/core/hooks/updateGlobals.d.ts +2 -0
  198. package/types/router/core/hooks/url.d.ts +2 -0
  199. package/types/router/core/hooks/views.d.ts +3 -0
  200. package/types/router/core/index.d.ts +12 -0
  201. package/types/router/core/interface.d.ts +102 -0
  202. package/types/router/core/params/index.d.ts +12 -0
  203. package/types/router/core/params/interface.d.ts +606 -0
  204. package/types/router/core/params/param.d.ts +65 -0
  205. package/types/router/core/params/paramType.d.ts +65 -0
  206. package/types/router/core/params/paramTypes.d.ts +190 -0
  207. package/types/router/core/params/stateParams.d.ts +15 -0
  208. package/types/router/core/path/index.d.ts +2 -0
  209. package/types/router/core/path/pathNode.d.ts +60 -0
  210. package/types/router/core/path/pathUtils.d.ts +79 -0
  211. package/types/router/core/resolve/index.d.ts +3 -0
  212. package/types/router/core/resolve/interface.d.ts +210 -0
  213. package/types/router/core/resolve/resolvable.d.ts +69 -0
  214. package/types/router/core/resolve/resolveContext.d.ts +92 -0
  215. package/types/router/core/router.d.ts +95 -0
  216. package/types/router/core/state/index.d.ts +28 -0
  217. package/types/router/core/state/interface.d.ts +708 -0
  218. package/types/router/core/state/stateBuilder.d.ts +104 -0
  219. package/types/router/core/state/stateMatcher.d.ts +11 -0
  220. package/types/router/core/state/stateObject.d.ts +155 -0
  221. package/types/router/core/state/stateQueueManager.d.ts +24 -0
  222. package/types/router/core/state/stateRegistry.d.ts +136 -0
  223. package/types/router/core/state/stateService.d.ts +350 -0
  224. package/types/router/core/state/targetState.d.ts +100 -0
  225. package/types/router/core/transition/hookBuilder.d.ts +45 -0
  226. package/types/router/core/transition/hookRegistry.d.ts +93 -0
  227. package/types/router/core/transition/index.d.ts +20 -0
  228. package/types/router/core/transition/interface.d.ts +819 -0
  229. package/types/router/core/transition/rejectFactory.d.ts +103 -0
  230. package/types/router/core/transition/transition.d.ts +527 -0
  231. package/types/router/core/transition/transitionEventType.d.ts +17 -0
  232. package/types/router/core/transition/transitionHook.d.ts +88 -0
  233. package/types/router/core/transition/transitionService.d.ts +187 -0
  234. package/types/router/core/url/index.d.ts +8 -0
  235. package/types/router/core/url/interface.d.ts +156 -0
  236. package/types/router/core/url/urlConfig.d.ts +141 -0
  237. package/types/router/core/url/urlMatcher.d.ts +180 -0
  238. package/types/router/core/url/urlMatcherFactory.d.ts +52 -0
  239. package/types/router/core/url/urlRouter.d.ts +85 -0
  240. package/types/router/core/url/urlRule.d.ts +120 -0
  241. package/types/router/core/url/urlRules.d.ts +244 -0
  242. package/types/router/core/url/urlService.d.ts +206 -0
  243. package/types/router/core/vanilla.d.ts +1 -0
  244. package/types/router/core/view/index.d.ts +2 -0
  245. package/types/router/core/view/interface.d.ts +46 -0
  246. package/types/router/core/view/view.d.ts +167 -0
  247. package/types/router/directives/stateDirectives.d.ts +3 -0
  248. package/types/router/directives/viewDirective.d.ts +143 -0
  249. package/types/router/index.d.ts +19 -0
  250. package/types/router/interface.d.ts +491 -0
  251. package/types/router/legacy/resolveService.d.ts +44 -0
  252. package/types/router/legacy/stateEvents.d.ts +123 -0
  253. package/types/router/locationServices.d.ts +43 -0
  254. package/types/router/services.d.ts +15 -0
  255. package/types/router/stateFilters.d.ts +11 -0
  256. package/types/router/stateProvider.d.ts +254 -0
  257. package/types/router/statebuilders/onEnterExitRetain.d.ts +12 -0
  258. package/types/router/statebuilders/views.d.ts +41 -0
  259. package/types/router/templateFactory.d.ts +84 -0
  260. package/types/router/viewScroll.d.ts +9 -0
  261. package/src/animations/animate.css.md +0 -263
  262. package/src/animations/animate.md +0 -933
  263. package/src/router/adapter/statebuilders/onEnterExitRetain.js +0 -29
  264. package/src/router/core/common/coreservices.js +0 -15
  265. package/src/router/core/common/safeConsole.js +0 -37
  266. package/src/router/core/interface.js +0 -3
  267. package/src/router/core/resolve/interface.js +0 -10
  268. package/src/router/core/router.js +0 -203
  269. package/src/router/core/url/interface.js +0 -1
  270. package/src/router/core/view/interface.js +0 -1
  271. /package/src/router/{core/common → common}/glob.js +0 -0
  272. /package/src/router/{core/hooks → hooks}/ignoredTransition.js +0 -0
  273. /package/src/router/{core/hooks → hooks}/invalidTransition.js +0 -0
  274. /package/src/router/{core/hooks → hooks}/onEnterExitRetain.js +0 -0
  275. /package/src/router/{core/hooks → hooks}/url.js +0 -0
  276. /package/src/router/{core/params → params}/README.md +0 -0
  277. /package/src/router/{core/state → state}/README.md +0 -0
  278. /package/src/router/{adapter/stateFilters.js → stateFilters.js} +0 -0
  279. /package/src/router/{core/transition → transition}/interface.js +0 -0
  280. /package/src/router/{core/transition → transition}/transitionEventType.js +0 -0
  281. /package/src/{router/core/common → shared}/hof.js +0 -0
  282. /package/test/{ng → core}/cache-factor.spec.js +0 -0
  283. /package/test/{ng → core}/controller-provider.spec.js +0 -0
  284. /package/test/{ng → core}/cookie-reader.spec.js +0 -0
  285. /package/test/{ng → core}/document.spec.js +0 -0
  286. /package/test/{ng → core}/filter.spec.js +0 -0
  287. /package/test/{ng → core}/http-backend.spec.js +0 -0
  288. /package/test/{ng → core}/interpolate.spec.js +0 -0
  289. /package/test/{ng → core}/interval.spec.js +0 -0
  290. /package/test/{ng → core}/location.spec.js +0 -0
  291. /package/test/{ng → core}/q.spec.js +0 -0
  292. /package/test/{ng → core}/root-element.spec.js +0 -0
  293. /package/test/{ng → core}/sanitize-uri.spec.js +0 -0
  294. /package/test/{ng → core}/sce.spec.js +0 -0
  295. /package/test/{ng → core}/template-request.spec.js +0 -0
  296. /package/test/{ng → core}/timeout.spec.js +0 -0
  297. /package/test/{ng → core}/url-utils.spec.js +0 -0
  298. /package/{src/router/adapter/interface.js → types/router/injectables.d.ts} +0 -0
@@ -0,0 +1,206 @@
1
+ import { UIRouter } from '../router';
2
+ import { LocationServices } from '../common';
3
+ import { MatchResult, UrlParts, UrlSyncApi } from './interface';
4
+ import { UrlRules } from './urlRules';
5
+ import { UrlConfig } from './urlConfig';
6
+ /**
7
+ * API for URL management
8
+ */
9
+ export declare class UrlService implements LocationServices, UrlSyncApi {
10
+ private router;
11
+ /** @internal */ private _stopListeningFn;
12
+ /** @internal */ interceptDeferred: boolean;
13
+ /**
14
+ * The nested [[UrlRules]] API for managing URL rules and rewrites
15
+ *
16
+ * See: [[UrlRules]] for details
17
+ */
18
+ rules: UrlRules;
19
+ /**
20
+ * The nested [[UrlConfig]] API to configure the URL and retrieve URL information
21
+ *
22
+ * See: [[UrlConfig]] for details
23
+ */
24
+ config: UrlConfig;
25
+ /** @internal */
26
+ constructor(/** @internal */ router: UIRouter);
27
+ /** @internal */
28
+ dispose(): void;
29
+ /**
30
+ * Gets the current URL parts
31
+ *
32
+ * This method returns the different parts of the current URL (the [[path]], [[search]], and [[hash]]) as a [[UrlParts]] object.
33
+ */
34
+ parts(): UrlParts;
35
+ /**
36
+ * Activates the best rule for the current URL
37
+ *
38
+ * Checks the current URL for a matching [[UrlRule]], then invokes that rule's handler.
39
+ * This method is called internally any time the URL has changed.
40
+ *
41
+ * This effectively activates the state (or redirect, etc) which matches the current URL.
42
+ *
43
+ * #### Example:
44
+ * ```js
45
+ * urlService.deferIntercept();
46
+ *
47
+ * fetch('/states.json').then(resp => resp.json()).then(data => {
48
+ * data.forEach(state => $stateRegistry.register(state));
49
+ * urlService.listen();
50
+ * // Find the matching URL and invoke the handler.
51
+ * urlService.sync();
52
+ * });
53
+ * ```
54
+ */
55
+ sync(evt?: any): void;
56
+ /**
57
+ * Starts or stops listening for URL changes
58
+ *
59
+ * Call this sometime after calling [[deferIntercept]] to start monitoring the url.
60
+ * This causes UI-Router to start listening for changes to the URL, if it wasn't already listening.
61
+ *
62
+ * If called with `false`, UI-Router will stop listening (call listen(true) to start listening again).
63
+ *
64
+ * #### Example:
65
+ * ```js
66
+ * urlService.deferIntercept();
67
+ *
68
+ * fetch('/states.json').then(resp => resp.json()).then(data => {
69
+ * data.forEach(state => $stateRegistry.register(state));
70
+ * // Start responding to URL changes
71
+ * urlService.listen();
72
+ * urlService.sync();
73
+ * });
74
+ * ```
75
+ *
76
+ * @param enabled `true` or `false` to start or stop listening to URL changes
77
+ */
78
+ listen(enabled?: boolean): Function;
79
+ /**
80
+ * Disables monitoring of the URL.
81
+ *
82
+ * Call this method before UI-Router has bootstrapped.
83
+ * It will stop UI-Router from performing the initial url sync.
84
+ *
85
+ * This can be useful to perform some asynchronous initialization before the router starts.
86
+ * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL.
87
+ *
88
+ * #### Example:
89
+ * ```js
90
+ * // Prevent UI-Router from automatically intercepting URL changes when it starts;
91
+ * urlService.deferIntercept();
92
+ *
93
+ * fetch('/states.json').then(resp => resp.json()).then(data => {
94
+ * data.forEach(state => $stateRegistry.register(state));
95
+ * urlService.listen();
96
+ * urlService.sync();
97
+ * });
98
+ * ```
99
+ *
100
+ * @param defer Indicates whether to defer location change interception.
101
+ * Passing no parameter is equivalent to `true`.
102
+ */
103
+ deferIntercept(defer?: boolean): void;
104
+ /**
105
+ * Matches a URL
106
+ *
107
+ * Given a URL (as a [[UrlParts]] object), check all rules and determine the best matching rule.
108
+ * Return the result as a [[MatchResult]].
109
+ */
110
+ match(url: UrlParts): MatchResult;
111
+ /**
112
+ * Gets the current url, or updates the url
113
+ *
114
+ * ### Getting the current URL
115
+ *
116
+ * When no arguments are passed, returns the current URL.
117
+ * The URL is normalized using the internal [[path]]/[[search]]/[[hash]] values.
118
+ *
119
+ * For example, the URL may be stored in the hash ([[HashLocationServices]]) or
120
+ * have a base HREF prepended ([[PushStateLocationServices]]).
121
+ *
122
+ * The raw URL in the browser might be:
123
+ *
124
+ * ```
125
+ * http://mysite.com/somepath/index.html#/internal/path/123?param1=foo#anchor
126
+ * ```
127
+ *
128
+ * or
129
+ *
130
+ * ```
131
+ * http://mysite.com/basepath/internal/path/123?param1=foo#anchor
132
+ * ```
133
+ *
134
+ * then this method returns:
135
+ *
136
+ * ```
137
+ * /internal/path/123?param1=foo#anchor
138
+ * ```
139
+ *
140
+ *
141
+ * #### Example:
142
+ * ```js
143
+ * locationServices.url(); // "/some/path?query=value#anchor"
144
+ * ```
145
+ *
146
+ * ### Updating the URL
147
+ *
148
+ * When `newurl` arguments is provided, changes the URL to reflect `newurl`
149
+ *
150
+ * #### Example:
151
+ * ```js
152
+ * locationServices.url("/some/path?query=value#anchor", true);
153
+ * ```
154
+ *
155
+ * @param newurl The new value for the URL.
156
+ * This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.
157
+ * It should not include the protocol, site, port, or base path of an absolute HREF.
158
+ * @param replace When true, replaces the current history entry (instead of appending it) with this new url
159
+ * @param state The history's state object, i.e., pushState (if the LocationServices implementation supports it)
160
+ *
161
+ * @return the url (after potentially being processed)
162
+ */
163
+ url: (newurl?: string, replace?: boolean, state?: any) => string;
164
+ /**
165
+ * Gets the path part of the current url
166
+ *
167
+ * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`
168
+ *
169
+ * @return the path portion of the url
170
+ */
171
+ path: () => string;
172
+ /**
173
+ * Gets the search part of the current url as an object
174
+ *
175
+ * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`
176
+ *
177
+ * @return the search (query) portion of the url, as an object
178
+ */
179
+ search: () => {
180
+ [key: string]: any;
181
+ };
182
+ /**
183
+ * Gets the hash part of the current url
184
+ *
185
+ * If the current URL is `/some/path?query=value#anchor`, this returns `anchor`
186
+ *
187
+ * @return the hash (anchor) portion of the url
188
+ */
189
+ hash: () => string;
190
+ /**
191
+ * @internal
192
+ *
193
+ * Registers a low level url change handler
194
+ *
195
+ * Note: Because this is a low level handler, it's not recommended for general use.
196
+ *
197
+ * #### Example:
198
+ * ```js
199
+ * let deregisterFn = locationServices.onChange((evt) => console.log("url change", evt));
200
+ * ```
201
+ *
202
+ * @param callback a function that will be called when the url is changing
203
+ * @return a function that de-registers the callback
204
+ */
205
+ onChange: (callback: EventListener) => Function;
206
+ }
@@ -0,0 +1 @@
1
+ export * from './vanilla/index';
@@ -0,0 +1,2 @@
1
+ export * from './interface';
2
+ export * from './view';
@@ -0,0 +1,46 @@
1
+ import { _ViewDeclaration } from '../state/interface';
2
+ import { PathNode } from '../path/pathNode';
3
+ /** The context ref can be anything that has a `name` and a `parent` reference to another IContextRef */
4
+ export interface ViewContext {
5
+ name: string;
6
+ parent: ViewContext;
7
+ }
8
+ export interface ActiveUIView {
9
+ /** type of framework, e.g., "ng1" or "ng2" */
10
+ $type: string;
11
+ /** An auto-incremented id */
12
+ id: number;
13
+ /** The ui-view short name */
14
+ name: string;
15
+ /** The ui-view's fully qualified name */
16
+ fqn: string;
17
+ /** The ViewConfig that is currently loaded into the ui-view */
18
+ config: ViewConfig;
19
+ /** The state context in which the ui-view tag was created. */
20
+ creationContext: ViewContext;
21
+ /** A callback that should apply a ViewConfig (or clear the ui-view, if config is undefined) */
22
+ configUpdated: (config: ViewConfig) => void;
23
+ }
24
+ /**
25
+ * This interface represents a [[_ViewDeclaration]] that is bound to a [[PathNode]].
26
+ *
27
+ * A `ViewConfig` is the runtime definition of a single view.
28
+ *
29
+ * During a transition, `ViewConfig`s are created for each [[_ViewDeclaration]] defined on each "entering" [[StateObject]].
30
+ * Then, the [[ViewService]] finds any matching `ui-view`(s) in the DOM, and supplies the ui-view
31
+ * with the `ViewConfig`. The `ui-view` then loads itself using the information found in the `ViewConfig`.
32
+ *
33
+ * A `ViewConfig` if matched with a `ui-view` by finding all `ui-view`s which were created in the
34
+ * context named by the `uiViewContextAnchor`, and finding the `ui-view` or child `ui-view` that matches
35
+ * the `uiViewName` address.
36
+ */
37
+ export interface ViewConfig {
38
+ $id: number;
39
+ /** The normalized view declaration from [[State.views]] */
40
+ viewDecl: _ViewDeclaration;
41
+ /** The node the ViewConfig is bound to */
42
+ path: PathNode[];
43
+ loaded: boolean;
44
+ /** Fetches templates, runs dynamic (controller|template)Provider code, lazy loads Components, etc */
45
+ load(): Promise<ViewConfig>;
46
+ }
@@ -0,0 +1,167 @@
1
+ import { TypedMap } from '../common/common';
2
+ import { PathNode } from '../path/pathNode';
3
+ import { ActiveUIView, ViewContext, ViewConfig } from './interface';
4
+ import { _ViewDeclaration } from '../state/interface';
5
+ import { UIRouter } from '../router';
6
+ export declare type ViewConfigFactory = (path: PathNode[], decl: _ViewDeclaration) => ViewConfig | ViewConfig[];
7
+ export interface ViewServicePluginAPI {
8
+ _rootViewContext(context?: ViewContext): ViewContext;
9
+ _viewConfigFactory(viewType: string, factory: ViewConfigFactory): any;
10
+ /** @param id router.$id + "." + uiView.id */
11
+ _registeredUIView(id: string): ActiveUIView;
12
+ _registeredUIViews(): ActiveUIView[];
13
+ _activeViewConfigs(): ViewConfig[];
14
+ _onSync(listener: ViewSyncListener): Function;
15
+ }
16
+ export interface ViewTuple {
17
+ uiView: ActiveUIView;
18
+ viewConfig: ViewConfig;
19
+ }
20
+ export interface ViewSyncListener {
21
+ (viewTuples: ViewTuple[]): void;
22
+ }
23
+ /**
24
+ * The View service
25
+ *
26
+ * This service pairs existing `ui-view` components (which live in the DOM)
27
+ * with view configs (from the state declaration objects: [[StateDeclaration.views]]).
28
+ *
29
+ * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]].
30
+ * The views from exited states are deactivated via [[deactivateViewConfig]].
31
+ * (See: the [[registerActivateViews]] Transition Hook)
32
+ *
33
+ * - As `ui-view` components pop in and out of existence, they register themselves using [[registerUIView]].
34
+ *
35
+ * - When the [[sync]] function is called, the registered `ui-view`(s) ([[ActiveUIView]])
36
+ * are configured with the matching [[ViewConfig]](s)
37
+ *
38
+ */
39
+ export declare class ViewService {
40
+ private router;
41
+ /** @internal */ private _uiViews;
42
+ /** @internal */ private _viewConfigs;
43
+ /** @internal */ private _rootContext;
44
+ /** @internal */ private _viewConfigFactories;
45
+ /** @internal */ private _listeners;
46
+ /** @internal */
47
+ _pluginapi: ViewServicePluginAPI;
48
+ /**
49
+ * Given a ui-view and a ViewConfig, determines if they "match".
50
+ *
51
+ * A ui-view has a fully qualified name (fqn) and a context object. The fqn is built from its overall location in
52
+ * the DOM, describing its nesting relationship to any parent ui-view tags it is nested inside of.
53
+ *
54
+ * A ViewConfig has a target ui-view name and a context anchor. The ui-view name can be a simple name, or
55
+ * can be a segmented ui-view path, describing a portion of a ui-view fqn.
56
+ *
57
+ * In order for a ui-view to match ViewConfig, ui-view's $type must match the ViewConfig's $type
58
+ *
59
+ * If the ViewConfig's target ui-view name is a simple name (no dots), then a ui-view matches if:
60
+ * - the ui-view's name matches the ViewConfig's target name
61
+ * - the ui-view's context matches the ViewConfig's anchor
62
+ *
63
+ * If the ViewConfig's target ui-view name is a segmented name (with dots), then a ui-view matches if:
64
+ * - There exists a parent ui-view where:
65
+ * - the parent ui-view's name matches the first segment (index 0) of the ViewConfig's target name
66
+ * - the parent ui-view's context matches the ViewConfig's anchor
67
+ * - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ui-view's fqn
68
+ *
69
+ * Example:
70
+ *
71
+ * DOM:
72
+ * <ui-view> <!-- created in the root context (name: "") -->
73
+ * <ui-view name="foo"> <!-- created in the context named: "A" -->
74
+ * <ui-view> <!-- created in the context named: "A.B" -->
75
+ * <ui-view name="bar"> <!-- created in the context named: "A.B.C" -->
76
+ * </ui-view>
77
+ * </ui-view>
78
+ * </ui-view>
79
+ * </ui-view>
80
+ *
81
+ * uiViews: [
82
+ * { fqn: "$default", creationContext: { name: "" } },
83
+ * { fqn: "$default.foo", creationContext: { name: "A" } },
84
+ * { fqn: "$default.foo.$default", creationContext: { name: "A.B" } }
85
+ * { fqn: "$default.foo.$default.bar", creationContext: { name: "A.B.C" } }
86
+ * ]
87
+ *
88
+ * These four view configs all match the ui-view with the fqn: "$default.foo.$default.bar":
89
+ *
90
+ * - ViewConfig1: { uiViewName: "bar", uiViewContextAnchor: "A.B.C" }
91
+ * - ViewConfig2: { uiViewName: "$default.bar", uiViewContextAnchor: "A.B" }
92
+ * - ViewConfig3: { uiViewName: "foo.$default.bar", uiViewContextAnchor: "A" }
93
+ * - ViewConfig4: { uiViewName: "$default.foo.$default.bar", uiViewContextAnchor: "" }
94
+ *
95
+ * Using ViewConfig3 as an example, it matches the ui-view with fqn "$default.foo.$default.bar" because:
96
+ * - The ViewConfig's segmented target name is: [ "foo", "$default", "bar" ]
97
+ * - There exists a parent ui-view (which has fqn: "$default.foo") where:
98
+ * - the parent ui-view's name "foo" matches the first segment "foo" of the ViewConfig's target name
99
+ * - the parent ui-view's context "A" matches the ViewConfig's anchor context "A"
100
+ * - And the remaining segments [ "$default", "bar" ].join("."_ of the ViewConfig's target name match
101
+ * the tail of the ui-view's fqn "default.bar"
102
+ *
103
+ * @internal
104
+ */
105
+ static matches: (uiViewsByFqn: TypedMap<ActiveUIView>, uiView: ActiveUIView) => (viewConfig: ViewConfig) => boolean;
106
+ /**
107
+ * Normalizes a view's name from a state.views configuration block.
108
+ *
109
+ * This should be used by a framework implementation to calculate the values for
110
+ * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]].
111
+ *
112
+ * @param context the context object (state declaration) that the view belongs to
113
+ * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]]
114
+ *
115
+ * @returns the normalized uiViewName and uiViewContextAnchor that the view targets
116
+ */
117
+ static normalizeUIViewTarget(context: ViewContext, rawViewName?: string): {
118
+ uiViewName: string;
119
+ uiViewContextAnchor: string;
120
+ };
121
+ /** @internal */
122
+ constructor(/** @internal */ router: UIRouter);
123
+ /** @internal */
124
+ private _rootViewContext;
125
+ /** @internal */
126
+ private _viewConfigFactory;
127
+ createViewConfig(path: PathNode[], decl: _ViewDeclaration): ViewConfig[];
128
+ /**
129
+ * Deactivates a ViewConfig.
130
+ *
131
+ * This function deactivates a `ViewConfig`.
132
+ * After calling [[sync]], it will un-pair from any `ui-view` with which it is currently paired.
133
+ *
134
+ * @param viewConfig The ViewConfig view to deregister.
135
+ */
136
+ deactivateViewConfig(viewConfig: ViewConfig): void;
137
+ activateViewConfig(viewConfig: ViewConfig): void;
138
+ sync(): void;
139
+ /**
140
+ * Registers a `ui-view` component
141
+ *
142
+ * When a `ui-view` component is created, it uses this method to register itself.
143
+ * After registration the [[sync]] method is used to ensure all `ui-view` are configured with the proper [[ViewConfig]].
144
+ *
145
+ * Note: the `ui-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ui-view`,
146
+ * and what the view's state context is.
147
+ *
148
+ * Note: There is no corresponding `deregisterUIView`.
149
+ * A `ui-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself.
150
+ *
151
+ * @param uiView The metadata for a UIView
152
+ * @return a de-registration function used when the view is destroyed.
153
+ */
154
+ registerUIView(uiView: ActiveUIView): () => void;
155
+ /**
156
+ * Returns the list of views currently available on the page, by fully-qualified name.
157
+ *
158
+ * @return {Array} Returns an array of fully-qualified view names.
159
+ */
160
+ available(): any[];
161
+ /**
162
+ * Returns the list of views on the page containing loaded content.
163
+ *
164
+ * @return {Array} Returns an array of fully-qualified view names.
165
+ */
166
+ active(): any[];
167
+ }
@@ -0,0 +1,3 @@
1
+ /** @hidden Used for typedoc */
2
+ export interface ng1_directive {
3
+ }
@@ -0,0 +1,143 @@
1
+ /** @publicapi @module directives */ /** */
2
+ import { ActiveUIView } from './core';
3
+ import { Ng1ViewConfig } from '../statebuilders/views';
4
+ import { ng1_directive } from './stateDirectives';
5
+ /** @hidden */
6
+ export declare type UIViewData = {
7
+ $cfg: Ng1ViewConfig;
8
+ $uiView: ActiveUIView;
9
+ };
10
+ /** @hidden */
11
+ export declare type UIViewAnimData = {
12
+ $animEnter: Promise<any>;
13
+ $animLeave: Promise<any>;
14
+ $$animLeave: {
15
+ resolve: () => any;
16
+ };
17
+ };
18
+ /**
19
+ * `ui-view`: A viewport directive which is filled in by a view from the active state.
20
+ *
21
+ * ### Attributes
22
+ *
23
+ * - `name`: (Optional) A view name.
24
+ * The name should be unique amongst the other views in the same state.
25
+ * You can have views of the same name that live in different states.
26
+ * The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]).
27
+ *
28
+ * - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated.
29
+ * Uses [[$uiViewScroll]] to do the scrolling.
30
+ *
31
+ * - `onload`: Expression to evaluate whenever the view updates.
32
+ *
33
+ * #### Example:
34
+ * A view can be unnamed or named.
35
+ * ```html
36
+ * <!-- Unnamed -->
37
+ * <div ui-view></div>
38
+ *
39
+ * <!-- Named -->
40
+ * <div ui-view="viewName"></div>
41
+ *
42
+ * <!-- Named (different style) -->
43
+ * <ui-view name="viewName"></ui-view>
44
+ * ```
45
+ *
46
+ * You can only have one unnamed view within any template (or root html). If you are only using a
47
+ * single view and it is unnamed then you can populate it like so:
48
+ *
49
+ * ```html
50
+ * <div ui-view></div>
51
+ * $stateProvider.state("home", {
52
+ * template: "<h1>HELLO!</h1>"
53
+ * })
54
+ * ```
55
+ *
56
+ * The above is a convenient shortcut equivalent to specifying your view explicitly with the
57
+ * [[Ng1StateDeclaration.views]] config property, by name, in this case an empty name:
58
+ *
59
+ * ```js
60
+ * $stateProvider.state("home", {
61
+ * views: {
62
+ * "": {
63
+ * template: "<h1>HELLO!</h1>"
64
+ * }
65
+ * }
66
+ * })
67
+ * ```
68
+ *
69
+ * But typically you'll only use the views property if you name your view or have more than one view
70
+ * in the same template. There's not really a compelling reason to name a view if its the only one,
71
+ * but you could if you wanted, like so:
72
+ *
73
+ * ```html
74
+ * <div ui-view="main"></div>
75
+ * ```
76
+ *
77
+ * ```js
78
+ * $stateProvider.state("home", {
79
+ * views: {
80
+ * "main": {
81
+ * template: "<h1>HELLO!</h1>"
82
+ * }
83
+ * }
84
+ * })
85
+ * ```
86
+ *
87
+ * Really though, you'll use views to set up multiple views:
88
+ *
89
+ * ```html
90
+ * <div ui-view></div>
91
+ * <div ui-view="chart"></div>
92
+ * <div ui-view="data"></div>
93
+ * ```
94
+ *
95
+ * ```js
96
+ * $stateProvider.state("home", {
97
+ * views: {
98
+ * "": {
99
+ * template: "<h1>HELLO!</h1>"
100
+ * },
101
+ * "chart": {
102
+ * template: "<chart_thing/>"
103
+ * },
104
+ * "data": {
105
+ * template: "<data_thing/>"
106
+ * }
107
+ * }
108
+ * })
109
+ * ```
110
+ *
111
+ * #### Examples for `autoscroll`:
112
+ * ```html
113
+ * <!-- If autoscroll present with no expression,
114
+ * then scroll ui-view into view -->
115
+ * <ui-view autoscroll/>
116
+ *
117
+ * <!-- If autoscroll present with valid expression,
118
+ * then scroll ui-view into view if expression evaluates to true -->
119
+ * <ui-view autoscroll='true'/>
120
+ * <ui-view autoscroll='false'/>
121
+ * <ui-view autoscroll='scopeVariable'/>
122
+ * ```
123
+ *
124
+ * Resolve data:
125
+ *
126
+ * The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this
127
+ * can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template.
128
+ *
129
+ * Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the
130
+ * controller is instantiated. The `$onInit()` hook can be used to perform initialization code which
131
+ * depends on `$resolve` data.
132
+ *
133
+ * #### Example:
134
+ * ```js
135
+ * $stateProvider.state('home', {
136
+ * template: '<my-component user="$resolve.user"></my-component>',
137
+ * resolve: {
138
+ * user: function(UserService) { return UserService.fetchUser(); }
139
+ * }
140
+ * });
141
+ * ```
142
+ */
143
+ export declare let uiView: ng1_directive;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Main entry point for angular 1.x build
3
+ * @publicapi @module ng1
4
+ */ /** */
5
+ export * from './interface';
6
+ export * from './services';
7
+ export * from './statebuilders/views';
8
+ export * from './stateProvider';
9
+ export * from './urlRouterProvider';
10
+ import './injectables';
11
+ import './directives/stateDirectives';
12
+ import './stateFilters';
13
+ import './directives/viewDirective';
14
+ import './viewScroll';
15
+ declare const _default: "router";
16
+ export default _default;
17
+ import * as core from './core/index';
18
+ export { core };
19
+ export * from './core/index';