@angular-wave/angular.ts 0.0.60 → 0.0.62

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 (128) hide show
  1. package/README.md +1 -1
  2. package/dist/angular-ts.esm.js +2 -2
  3. package/dist/angular-ts.umd.js +2 -2
  4. package/package.json +2 -1
  5. package/src/angular.spec.js +2 -2
  6. package/src/core/parser/parse.js +14 -0
  7. package/src/core/parser/parse.spec.js +7 -5
  8. package/src/core/parser/parser.js +1 -1
  9. package/src/core/q/q.js +46 -289
  10. package/src/core/q/q.md +229 -0
  11. package/src/core/sanitize/sanitize-uri.js +2 -3
  12. package/src/core/scope/scope.js +18 -8
  13. package/src/directive/if/if.js +6 -1
  14. package/src/filters/limit-to.js +5 -2
  15. package/src/filters/order-by.js +1 -2
  16. package/src/index.js +1 -1
  17. package/src/loader.js +1 -55
  18. package/src/router/params/param-type.js +2 -1
  19. package/src/router/state/views.js +3 -0
  20. package/src/router/state-provider.js +1 -1
  21. package/src/router/transition/reject-factory.js +1 -0
  22. package/src/router/url/url-rule.js +1 -1
  23. package/src/router/url/url-service.js +4 -4
  24. package/src/router/url/url-service.spec.js +4 -3
  25. package/src/services/http/http.js +7 -5
  26. package/src/services/template-request.js +2 -7
  27. package/src/shared/common.js +1 -1
  28. package/src/shared/utils.js +2 -11
  29. package/src/types.js +9 -1
  30. package/types/core/parser/parse.d.ts +3 -4
  31. package/types/core/parser/parser.d.ts +1 -1
  32. package/types/core/q/q.d.ts +2 -2
  33. package/types/core/sanitize/sanitize-uri.d.ts +4 -5
  34. package/types/core/scope/scope.d.ts +19 -7
  35. package/types/index.d.ts +5 -1
  36. package/types/loader.d.ts +0 -52
  37. package/types/router/params/param-type.d.ts +2 -1
  38. package/types/router/state/views.d.ts +2 -0
  39. package/types/router/state-provider.d.ts +1 -1
  40. package/types/router/transition/reject-factory.d.ts +1 -0
  41. package/types/router/url/url-rule.d.ts +0 -1
  42. package/types/router/url/url-service.d.ts +7 -7
  43. package/types/services/template-request.d.ts +4 -9
  44. package/types/shared/utils.d.ts +1 -7
  45. package/types/types.d.ts +6 -1
  46. package/types-back/README.md +0 -2
  47. package/types-back/angular.d.ts +0 -146
  48. package/types-back/index.d.ts +0 -2126
  49. package/types-back/jqlite.d.ts +0 -374
  50. package/types-back/router/core/common/common.d.ts +0 -416
  51. package/types-back/router/core/common/coreservices.d.ts +0 -77
  52. package/types-back/router/core/common/glob.d.ts +0 -60
  53. package/types-back/router/core/common/hof.d.ts +0 -168
  54. package/types-back/router/core/common/index.d.ts +0 -8
  55. package/types-back/router/core/common/predicates.d.ts +0 -25
  56. package/types-back/router/core/common/queue.d.ts +0 -15
  57. package/types-back/router/core/common/safeConsole.d.ts +0 -5
  58. package/types-back/router/core/common/strings.d.ts +0 -66
  59. package/types-back/router/core/common/trace.d.ts +0 -126
  60. package/types-back/router/core/globals.d.ts +0 -43
  61. package/types-back/router/core/hooks/coreResolvables.d.ts +0 -6
  62. package/types-back/router/core/hooks/ignoredTransition.d.ts +0 -4
  63. package/types-back/router/core/hooks/invalidTransition.d.ts +0 -4
  64. package/types-back/router/core/hooks/lazyLoad.d.ts +0 -17
  65. package/types-back/router/core/hooks/onEnterExitRetain.d.ts +0 -10
  66. package/types-back/router/core/hooks/redirectTo.d.ts +0 -4
  67. package/types-back/router/core/hooks/resolve.d.ts +0 -11
  68. package/types-back/router/core/hooks/updateGlobals.d.ts +0 -4
  69. package/types-back/router/core/hooks/url.d.ts +0 -4
  70. package/types-back/router/core/hooks/views.d.ts +0 -7
  71. package/types-back/router/core/index.d.ts +0 -11
  72. package/types-back/router/core/interface.d.ts +0 -91
  73. package/types-back/router/core/params/index.d.ts +0 -12
  74. package/types-back/router/core/params/interface.d.ts +0 -606
  75. package/types-back/router/core/params/param.d.ts +0 -77
  76. package/types-back/router/core/params/paramType.d.ts +0 -65
  77. package/types-back/router/core/params/paramTypes.d.ts +0 -193
  78. package/types-back/router/core/params/stateParams.d.ts +0 -15
  79. package/types-back/router/core/path/index.d.ts +0 -2
  80. package/types-back/router/core/path/pathNode.d.ts +0 -60
  81. package/types-back/router/core/path/pathUtils.d.ts +0 -105
  82. package/types-back/router/core/resolve/index.d.ts +0 -3
  83. package/types-back/router/core/resolve/interface.d.ts +0 -210
  84. package/types-back/router/core/resolve/resolvable.d.ts +0 -75
  85. package/types-back/router/core/resolve/resolveContext.d.ts +0 -97
  86. package/types-back/router/core/router.d.ts +0 -57
  87. package/types-back/router/core/state/index.d.ts +0 -28
  88. package/types-back/router/core/state/interface.d.ts +0 -732
  89. package/types-back/router/core/state/stateBuilder.d.ts +0 -107
  90. package/types-back/router/core/state/stateMatcher.d.ts +0 -13
  91. package/types-back/router/core/state/stateObject.d.ts +0 -170
  92. package/types-back/router/core/state/stateQueueManager.d.ts +0 -27
  93. package/types-back/router/core/state/stateRegistry.d.ts +0 -138
  94. package/types-back/router/core/state/stateService.d.ts +0 -386
  95. package/types-back/router/core/state/targetState.d.ts +0 -105
  96. package/types-back/router/core/transition/hookBuilder.d.ts +0 -49
  97. package/types-back/router/core/transition/hookRegistry.d.ts +0 -115
  98. package/types-back/router/core/transition/index.d.ts +0 -20
  99. package/types-back/router/core/transition/interface.d.ts +0 -862
  100. package/types-back/router/core/transition/rejectFactory.d.ts +0 -103
  101. package/types-back/router/core/transition/transition.d.ts +0 -575
  102. package/types-back/router/core/transition/transitionEventType.d.ts +0 -26
  103. package/types-back/router/core/transition/transitionHook.d.ts +0 -96
  104. package/types-back/router/core/transition/transitionService.d.ts +0 -253
  105. package/types-back/router/core/url/index.d.ts +0 -8
  106. package/types-back/router/core/url/interface.d.ts +0 -169
  107. package/types-back/router/core/url/urlConfig.d.ts +0 -144
  108. package/types-back/router/core/url/urlMatcher.d.ts +0 -185
  109. package/types-back/router/core/url/urlMatcherFactory.d.ts +0 -56
  110. package/types-back/router/core/url/urlRouter.d.ts +0 -101
  111. package/types-back/router/core/url/urlRule.d.ts +0 -143
  112. package/types-back/router/core/url/urlRules.d.ts +0 -251
  113. package/types-back/router/core/url/urlService.d.ts +0 -205
  114. package/types-back/router/core/view/index.d.ts +0 -2
  115. package/types-back/router/core/view/interface.d.ts +0 -46
  116. package/types-back/router/core/view/view.d.ts +0 -176
  117. package/types-back/router/directives/viewDirective.d.ts +0 -144
  118. package/types-back/router/index.d.ts +0 -17
  119. package/types-back/router/interface.d.ts +0 -500
  120. package/types-back/router/legacy/resolveService.d.ts +0 -47
  121. package/types-back/router/legacy/stateEvents.d.ts +0 -124
  122. package/types-back/router/services.d.ts +0 -15
  123. package/types-back/router/stateFilters.d.ts +0 -10
  124. package/types-back/router/stateProvider.d.ts +0 -258
  125. package/types-back/router/statebuilders/onEnterExitRetain.d.ts +0 -13
  126. package/types-back/router/statebuilders/views.d.ts +0 -53
  127. package/types-back/router/templateFactory.d.ts +0 -104
  128. package/types-back/router/viewScroll.d.ts +0 -9
@@ -1,251 +0,0 @@
1
- import { Router } from "../router";
2
- import { UrlRule, UrlRuleHandlerFn } from "./interface";
3
- import { TargetState, TargetStateDef } from "../state";
4
- import { UrlMatcher } from "./urlMatcher";
5
- import { UrlRuleFactory } from "./urlRule";
6
- /**
7
- * API for managing URL rules
8
- *
9
- * This API is used to create and manage URL rules.
10
- * URL rules are a mechanism to respond to specific URL patterns.
11
- *
12
- * The most commonly used methods are [[otherwise]] and [[when]].
13
- *
14
- * This API is found at `router.urlService.rules` (see: [[Router.urlService]], [[URLService.rules]])
15
- */
16
- export declare class UrlRules {
17
- private router;
18
- /** used to create [[UrlRule]] objects for common cases */
19
- urlRuleFactory: UrlRuleFactory;
20
- /** @internal */ private _sortFn;
21
- /** @internal */ private _otherwiseFn;
22
- /** @internal */ private _sorted;
23
- /** @internal */ private _rules;
24
- /** @internal */ private _id;
25
- /** @internal */
26
- constructor(/** @internal */ router: Router);
27
- /** @internal */
28
- dispose(router?: Router): void;
29
- /**
30
- * Defines the initial state, path, or behavior to use when the app starts.
31
- *
32
- * This rule defines the initial/starting state for the application.
33
- *
34
- * This rule is triggered the first time the URL is checked (when the app initially loads).
35
- * The rule is triggered only when the url matches either `""` or `"/"`.
36
- *
37
- * Note: The rule is intended to be used when the root of the application is directly linked to.
38
- * When the URL is *not* `""` or `"/"` and doesn't match other rules, the [[otherwise]] rule is triggered.
39
- * This allows 404-like behavior when an unknown URL is deep-linked.
40
- *
41
- * #### Example:
42
- * Start app at `home` state.
43
- * ```js
44
- * .initial({ state: 'home' });
45
- * ```
46
- *
47
- * #### Example:
48
- * Start app at `/home` (by url)
49
- * ```js
50
- * .initial('/home');
51
- * ```
52
- *
53
- * #### Example:
54
- * When no other url rule matches, go to `home` state
55
- * ```js
56
- * .initial((matchValue, url, router) => {
57
- * console.log('initial state');
58
- * return { state: 'home' };
59
- * })
60
- * ```
61
- *
62
- * @param handler The initial state or url path, or a function which returns the state or url path (or performs custom logic).
63
- */
64
- initial(
65
- handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef,
66
- ): void;
67
- /**
68
- * Defines the state, url, or behavior to use when no other rule matches the URL.
69
- *
70
- * This rule is matched when *no other rule* matches.
71
- * It is generally used to handle unknown URLs (similar to "404" behavior, but on the client side).
72
- *
73
- * - If `handler` a string, it is treated as a url redirect
74
- *
75
- * #### Example:
76
- * When no other url rule matches, redirect to `/index`
77
- * ```js
78
- * .otherwise('/index');
79
- * ```
80
- *
81
- * - If `handler` is an object with a `state` property, the state is activated.
82
- *
83
- * #### Example:
84
- * When no other url rule matches, redirect to `home` and provide a `dashboard` parameter value.
85
- * ```js
86
- * .otherwise({ state: 'home', params: { dashboard: 'default' } });
87
- * ```
88
- *
89
- * - If `handler` is a function, the function receives the current url ([[UrlParts]]) and the [[Router]] object.
90
- * The function can perform actions, and/or return a value.
91
- *
92
- * #### Example:
93
- * When no other url rule matches, manually trigger a transition to the `home` state
94
- * ```js
95
- * .otherwise((matchValue, urlParts, router) => {
96
- * router.stateService.go('home');
97
- * });
98
- * ```
99
- *
100
- * #### Example:
101
- * When no other url rule matches, go to `home` state
102
- * ```js
103
- * .otherwise((matchValue, urlParts, router) => {
104
- * return { state: 'home' };
105
- * });
106
- * ```
107
- *
108
- * @param handler The url path to redirect to, or a function which returns the url path (or performs custom logic).
109
- */
110
- otherwise(
111
- handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef,
112
- ): void;
113
- /**
114
- * Remove a rule previously registered
115
- *
116
- * @param rule the matcher rule that was previously registered using [[rule]]
117
- */
118
- removeRule(rule: any): void;
119
- /**
120
- * Manually adds a URL Rule.
121
- *
122
- * Usually, a url rule is added using [[StateDeclaration.url]] or [[when]].
123
- * This api can be used directly for more control (to register a [[BaseUrlRule]], for example).
124
- * Rules can be created using [[urlRuleFactory]], or created manually as simple objects.
125
- *
126
- * A rule should have a `match` function which returns truthy if the rule matched.
127
- * It should also have a `handler` function which is invoked if the rule is the best match.
128
- *
129
- * @return a function that deregisters the rule
130
- */
131
- rule(rule: UrlRule): Function;
132
- /**
133
- * Gets all registered rules
134
- *
135
- * @returns an array of all the registered rules
136
- */
137
- rules(): UrlRule[];
138
- /**
139
- * Defines URL Rule priorities
140
- *
141
- * More than one rule ([[UrlRule]]) might match a given URL.
142
- * This `compareFn` is used to sort the rules by priority.
143
- * Higher priority rules should sort earlier.
144
- *
145
- * The [[defaultRuleSortFn]] is used by default.
146
- *
147
- * You only need to call this function once.
148
- * The `compareFn` will be used to sort the rules as each is registered.
149
- *
150
- * If called without any parameter, it will re-sort the rules.
151
- *
152
- * ---
153
- *
154
- * Url rules may come from multiple sources: states's urls ([[StateDeclaration.url]]), [[when]], and [[rule]].
155
- * Each rule has a (user-provided) [[UrlRule.priority]], a [[UrlRule.type]], and a [[UrlRule.$id]]
156
- * The `$id` is is the order in which the rule was registered.
157
- *
158
- * The sort function should use these data, or data found on a specific type
159
- * of [[UrlRule]] (such as [[StateRule.state]]), to order the rules as desired.
160
- *
161
- * #### Example:
162
- * This compare function prioritizes rules by the order in which the rules were registered.
163
- * A rule registered earlier has higher priority.
164
- *
165
- * ```js
166
- * function compareFn(a, b) {
167
- * return a.$id - b.$id;
168
- * }
169
- * ```
170
- *
171
- * @param compareFn a function that compares to [[UrlRule]] objects.
172
- * The `compareFn` should abide by the `Array.sort` compare function rules.
173
- * Given two rules, `a` and `b`, return a negative number if `a` should be higher priority.
174
- * Return a positive number if `b` should be higher priority.
175
- * Return `0` if the rules are identical.
176
- *
177
- * See the [mozilla reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description)
178
- * for details.
179
- */
180
- sort(compareFn?: (a: UrlRule, b: UrlRule) => number): void;
181
- /** @internal */
182
- private ensureSorted;
183
- /** @internal */
184
- private stableSort;
185
- /**
186
- * Registers a `matcher` and `handler` for custom URLs handling.
187
- *
188
- * The `matcher` can be:
189
- *
190
- * - a [[UrlMatcher]]: See: [[UrlMatcherFactory.compile]]
191
- * - a `string`: The string is compiled to a [[UrlMatcher]]
192
- * - a `RegExp`: The regexp is used to match the url.
193
- *
194
- * The `handler` can be:
195
- *
196
- * - a string: The url is redirected to the value of the string.
197
- * - a function: The url is redirected to the return value of the function.
198
- *
199
- * ---
200
- *
201
- * When the `handler` is a `string` and the `matcher` is a `UrlMatcher` (or string), the redirect
202
- * string is interpolated with parameter values.
203
- *
204
- * #### Example:
205
- * When the URL is `/foo/123` the rule will redirect to `/bar/123`.
206
- * ```js
207
- * .when("/foo/:param1", "/bar/:param1")
208
- * ```
209
- *
210
- * ---
211
- *
212
- * When the `handler` is a string and the `matcher` is a `RegExp`, the redirect string is
213
- * interpolated with capture groups from the RegExp.
214
- *
215
- * #### Example:
216
- * When the URL is `/foo/123` the rule will redirect to `/bar/123`.
217
- * ```js
218
- * .when(new RegExp("^/foo/(.*)$"), "/bar/$1");
219
- * ```
220
- *
221
- * ---
222
- *
223
- * When the handler is a function, it receives the matched value, the current URL, and the `Router` object (See [[UrlRuleHandlerFn]]).
224
- * The "matched value" differs based on the `matcher`.
225
- * For [[UrlMatcher]]s, it will be the matched state params.
226
- * For `RegExp`, it will be the match array from `regexp.exec()`.
227
- *
228
- * If the handler returns a string, the URL is redirected to the string.
229
- *
230
- * #### Example:
231
- * When the URL is `/foo/123` the rule will redirect to `/bar/123`.
232
- * ```js
233
- * .when(new RegExp("^/foo/(.*)$"), match => "/bar/" + match[1]);
234
- * ```
235
- *
236
- * Note: the `handler` may also invoke arbitrary code, such as `$state.go()`
237
- *
238
- * @param matcher A pattern `string` to match, compiled as a [[UrlMatcher]], or a `RegExp`.
239
- * @param handler The path to redirect to, or a function that returns the path.
240
- * @param options `{ priority: number }`
241
- *
242
- * @return the registered [[UrlRule]]
243
- */
244
- when(
245
- matcher: RegExp | UrlMatcher | string,
246
- handler: string | UrlRuleHandlerFn,
247
- options?: {
248
- priority: number;
249
- },
250
- ): UrlRule;
251
- }
@@ -1,205 +0,0 @@
1
- import { Router } 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: Router);
27
-
28
- /**
29
- * Gets the current URL parts
30
- *
31
- * This method returns the different parts of the current URL (the [[path]], [[search]], and [[hash]]) as a [[UrlParts]] object.
32
- */
33
- parts(): UrlParts;
34
- /**
35
- * Activates the best rule for the current URL
36
- *
37
- * Checks the current URL for a matching [[UrlRule]], then invokes that rule's handler.
38
- * This method is called internally any time the URL has changed.
39
- *
40
- * This effectively activates the state (or redirect, etc) which matches the current URL.
41
- *
42
- * #### Example:
43
- * ```js
44
- * urlService.deferIntercept();
45
- *
46
- * fetch('/states.json').then(resp => resp.json()).then(data => {
47
- * data.forEach(state => $stateRegistry.register(state));
48
- * urlService.listen();
49
- * // Find the matching URL and invoke the handler.
50
- * urlService.sync();
51
- * });
52
- * ```
53
- */
54
- sync(evt?: any): void;
55
- /**
56
- * Starts or stops listening for URL changes
57
- *
58
- * Call this sometime after calling [[deferIntercept]] to start monitoring the url.
59
- * This causes Router to start listening for changes to the URL, if it wasn't already listening.
60
- *
61
- * If called with `false`, Router will stop listening (call listen(true) to start listening again).
62
- *
63
- * #### Example:
64
- * ```js
65
- * urlService.deferIntercept();
66
- *
67
- * fetch('/states.json').then(resp => resp.json()).then(data => {
68
- * data.forEach(state => $stateRegistry.register(state));
69
- * // Start responding to URL changes
70
- * urlService.listen();
71
- * urlService.sync();
72
- * });
73
- * ```
74
- *
75
- * @param enabled `true` or `false` to start or stop listening to URL changes
76
- */
77
- listen(enabled?: boolean): Function;
78
- /**
79
- * Disables monitoring of the URL.
80
- *
81
- * Call this method before Router has bootstrapped.
82
- * It will stop Router from performing the initial url sync.
83
- *
84
- * This can be useful to perform some asynchronous initialization before the router starts.
85
- * Once the initialization is complete, call [[listen]] to tell Router to start watching and synchronizing the URL.
86
- *
87
- * #### Example:
88
- * ```js
89
- * // Prevent Router from automatically intercepting URL changes when it starts;
90
- * urlService.deferIntercept();
91
- *
92
- * fetch('/states.json').then(resp => resp.json()).then(data => {
93
- * data.forEach(state => $stateRegistry.register(state));
94
- * urlService.listen();
95
- * urlService.sync();
96
- * });
97
- * ```
98
- *
99
- * @param defer Indicates whether to defer location change interception.
100
- * Passing no parameter is equivalent to `true`.
101
- */
102
- deferIntercept(defer?: boolean): void;
103
- /**
104
- * Matches a URL
105
- *
106
- * Given a URL (as a [[UrlParts]] object), check all rules and determine the best matching rule.
107
- * Return the result as a [[MatchResult]].
108
- */
109
- match(url: UrlParts): MatchResult;
110
- /**
111
- * Gets the current url, or updates the url
112
- *
113
- * ### Getting the current URL
114
- *
115
- * When no arguments are passed, returns the current URL.
116
- * The URL is normalized using the internal [[path]]/[[search]]/[[hash]] values.
117
- *
118
- * For example, the URL may be stored in the hash ([[HashLocationServices]]) or
119
- * have a base HREF prepended ([[PushStateLocationServices]]).
120
- *
121
- * The raw URL in the browser might be:
122
- *
123
- * ```
124
- * http://mysite.com/somepath/index.html#/internal/path/123?param1=foo#anchor
125
- * ```
126
- *
127
- * or
128
- *
129
- * ```
130
- * http://mysite.com/basepath/internal/path/123?param1=foo#anchor
131
- * ```
132
- *
133
- * then this method returns:
134
- *
135
- * ```
136
- * /internal/path/123?param1=foo#anchor
137
- * ```
138
- *
139
- *
140
- * #### Example:
141
- * ```js
142
- * locationServices.url(); // "/some/path?query=value#anchor"
143
- * ```
144
- *
145
- * ### Updating the URL
146
- *
147
- * When `newurl` arguments is provided, changes the URL to reflect `newurl`
148
- *
149
- * #### Example:
150
- * ```js
151
- * locationServices.url("/some/path?query=value#anchor", true);
152
- * ```
153
- *
154
- * @param newurl The new value for the URL.
155
- * This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.
156
- * It should not include the protocol, site, port, or base path of an absolute HREF.
157
- * @param replace When true, replaces the current history entry (instead of appending it) with this new url
158
- * @param state The history's state object, i.e., pushState (if the LocationServices implementation supports it)
159
- *
160
- * @return the url (after potentially being processed)
161
- */
162
- url: (newurl?: string, replace?: boolean, state?: any) => string;
163
- /**
164
- * Gets the path part of the current url
165
- *
166
- * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`
167
- *
168
- * @return the path portion of the url
169
- */
170
- path: () => string;
171
- /**
172
- * Gets the search part of the current url as an object
173
- *
174
- * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`
175
- *
176
- * @return the search (query) portion of the url, as an object
177
- */
178
- search: () => {
179
- [key: string]: any;
180
- };
181
- /**
182
- * Gets the hash part of the current url
183
- *
184
- * If the current URL is `/some/path?query=value#anchor`, this returns `anchor`
185
- *
186
- * @return the hash (anchor) portion of the url
187
- */
188
- hash: () => string;
189
- /**
190
- * @internal
191
- *
192
- * Registers a low level url change handler
193
- *
194
- * Note: Because this is a low level handler, it's not recommended for general use.
195
- *
196
- * #### Example:
197
- * ```js
198
- * let deregisterFn = locationServices.onChange((evt) => console.log("url change", evt));
199
- * ```
200
- *
201
- * @param callback a function that will be called when the url is changing
202
- * @return a function that de-registers the callback
203
- */
204
- onChange: (callback: EventListener) => Function;
205
- }
@@ -1,2 +0,0 @@
1
- export * from "./interface";
2
- export * from "./view";
@@ -1,46 +0,0 @@
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 ActiveNGView {
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 `ngViewContextAnchor`, and finding the `ui-view` or child `ui-view` that matches
35
- * the `ngViewName` 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
- }
@@ -1,176 +0,0 @@
1
- import { TypedMap } from "../common/common";
2
- import { PathNode } from "../path/pathNode";
3
- import { ActiveNGView, ViewContext, ViewConfig } from "./interface";
4
- import { _ViewDeclaration } from "../state/interface";
5
- import { Router } from "../router";
6
- export declare type ViewConfigFactory = (
7
- path: PathNode[],
8
- decl: _ViewDeclaration,
9
- ) => ViewConfig | ViewConfig[];
10
- export interface ViewServicePluginAPI {
11
- _rootViewContext(context?: ViewContext): ViewContext;
12
- _viewConfigFactory(viewType: string, factory: ViewConfigFactory): any;
13
- /** @param id router.$id + "." + ngView.id */
14
- _registeredNGView(id: string): ActiveNGView;
15
- _registeredNGViews(): ActiveNGView[];
16
- _activeViewConfigs(): ViewConfig[];
17
- _onSync(listener: ViewSyncListener): Function;
18
- }
19
- export interface ViewTuple {
20
- ngView: ActiveNGView;
21
- viewConfig: ViewConfig;
22
- }
23
- export interface ViewSyncListener {
24
- (viewTuples: ViewTuple[]): void;
25
- }
26
- /**
27
- * The View service
28
- *
29
- * This service pairs existing `ui-view` components (which live in the DOM)
30
- * with view configs (from the state declaration objects: [[StateDeclaration.views]]).
31
- *
32
- * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]].
33
- * The views from exited states are deactivated via [[deactivateViewConfig]].
34
- * (See: the [[registerActivateViews]] Transition Hook)
35
- *
36
- * - As `ui-view` components pop in and out of existence, they register themselves using [[registerNGView]].
37
- *
38
- * - When the [[sync]] function is called, the registered `ui-view`(s) ([[ActiveNGView]])
39
- * are configured with the matching [[ViewConfig]](s)
40
- *
41
- */
42
- export declare class ViewService {
43
- private router;
44
- /** @internal */ private _ngViews;
45
- /** @internal */ private _viewConfigs;
46
- /** @internal */ private _rootContext;
47
- /** @internal */ private _viewConfigFactories;
48
- /** @internal */ private _listeners;
49
- /** @internal */
50
- _pluginapi: ViewServicePluginAPI;
51
- /**
52
- * Given a ui-view and a ViewConfig, determines if they "match".
53
- *
54
- * A ui-view has a fully qualified name (fqn) and a context object. The fqn is built from its overall location in
55
- * the DOM, describing its nesting relationship to any parent ui-view tags it is nested inside of.
56
- *
57
- * A ViewConfig has a target ui-view name and a context anchor. The ui-view name can be a simple name, or
58
- * can be a segmented ui-view path, describing a portion of a ui-view fqn.
59
- *
60
- * In order for a ui-view to match ViewConfig, ui-view's $type must match the ViewConfig's $type
61
- *
62
- * If the ViewConfig's target ui-view name is a simple name (no dots), then a ui-view matches if:
63
- * - the ui-view's name matches the ViewConfig's target name
64
- * - the ui-view's context matches the ViewConfig's anchor
65
- *
66
- * If the ViewConfig's target ui-view name is a segmented name (with dots), then a ui-view matches if:
67
- * - There exists a parent ui-view where:
68
- * - the parent ui-view's name matches the first segment (index 0) of the ViewConfig's target name
69
- * - the parent ui-view's context matches the ViewConfig's anchor
70
- * - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ui-view's fqn
71
- *
72
- * Example:
73
- *
74
- * DOM:
75
- * <ui-view> <!-- created in the root context (name: "") -->
76
- * <ui-view name="foo"> <!-- created in the context named: "A" -->
77
- * <ui-view> <!-- created in the context named: "A.B" -->
78
- * <ui-view name="bar"> <!-- created in the context named: "A.B.C" -->
79
- * </ui-view>
80
- * </ui-view>
81
- * </ui-view>
82
- * </ui-view>
83
- *
84
- * ngViews: [
85
- * { fqn: "$default", creationContext: { name: "" } },
86
- * { fqn: "$default.foo", creationContext: { name: "A" } },
87
- * { fqn: "$default.foo.$default", creationContext: { name: "A.B" } }
88
- * { fqn: "$default.foo.$default.bar", creationContext: { name: "A.B.C" } }
89
- * ]
90
- *
91
- * These four view configs all match the ui-view with the fqn: "$default.foo.$default.bar":
92
- *
93
- * - ViewConfig1: { ngViewName: "bar", ngViewContextAnchor: "A.B.C" }
94
- * - ViewConfig2: { ngViewName: "$default.bar", ngViewContextAnchor: "A.B" }
95
- * - ViewConfig3: { ngViewName: "foo.$default.bar", ngViewContextAnchor: "A" }
96
- * - ViewConfig4: { ngViewName: "$default.foo.$default.bar", ngViewContextAnchor: "" }
97
- *
98
- * Using ViewConfig3 as an example, it matches the ui-view with fqn "$default.foo.$default.bar" because:
99
- * - The ViewConfig's segmented target name is: [ "foo", "$default", "bar" ]
100
- * - There exists a parent ui-view (which has fqn: "$default.foo") where:
101
- * - the parent ui-view's name "foo" matches the first segment "foo" of the ViewConfig's target name
102
- * - the parent ui-view's context "A" matches the ViewConfig's anchor context "A"
103
- * - And the remaining segments [ "$default", "bar" ].join("."_ of the ViewConfig's target name match
104
- * the tail of the ui-view's fqn "default.bar"
105
- *
106
- * @internal
107
- */
108
- static matches: (
109
- ngViewsByFqn: TypedMap<ActiveNGView>,
110
- ngView: ActiveNGView,
111
- ) => (viewConfig: ViewConfig) => boolean;
112
- /**
113
- * Normalizes a view's name from a state.views configuration block.
114
- *
115
- * This should be used by a framework implementation to calculate the values for
116
- * [[_ViewDeclaration.$ngViewName]] and [[_ViewDeclaration.$ngViewContextAnchor]].
117
- *
118
- * @param context the context object (state declaration) that the view belongs to
119
- * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]]
120
- *
121
- * @returns the normalized ngViewName and ngViewContextAnchor that the view targets
122
- */
123
- static normalizeNGViewTarget(
124
- context: ViewContext,
125
- rawViewName?: string,
126
- ): {
127
- ngViewName: string;
128
- ngViewContextAnchor: string;
129
- };
130
- /** @internal */
131
- constructor(/** @internal */ router: Router);
132
- /** @internal */
133
- private _rootViewContext;
134
- /** @internal */
135
- private _viewConfigFactory;
136
- createViewConfig(path: PathNode[], decl: _ViewDeclaration): ViewConfig[];
137
- /**
138
- * Deactivates a ViewConfig.
139
- *
140
- * This function deactivates a `ViewConfig`.
141
- * After calling [[sync]], it will un-pair from any `ui-view` with which it is currently paired.
142
- *
143
- * @param viewConfig The ViewConfig view to deregister.
144
- */
145
- deactivateViewConfig(viewConfig: ViewConfig): void;
146
- activateViewConfig(viewConfig: ViewConfig): void;
147
- sync(): void;
148
- /**
149
- * Registers a `ui-view` component
150
- *
151
- * When a `ui-view` component is created, it uses this method to register itself.
152
- * After registration the [[sync]] method is used to ensure all `ui-view` are configured with the proper [[ViewConfig]].
153
- *
154
- * Note: the `ui-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ui-view`,
155
- * and what the view's state context is.
156
- *
157
- * Note: There is no corresponding `deregisterNGView`.
158
- * A `ui-view` should hang on to the return value of `registerNGView` and invoke it to deregister itself.
159
- *
160
- * @param ngView The metadata for a NGView
161
- * @return a de-registration function used when the view is destroyed.
162
- */
163
- registerNGView(ngView: ActiveNGView): () => void;
164
- /**
165
- * Returns the list of views currently available on the page, by fully-qualified name.
166
- *
167
- * @return {Array} Returns an array of fully-qualified view names.
168
- */
169
- available(): any[];
170
- /**
171
- * Returns the list of views on the page containing loaded content.
172
- *
173
- * @return {Array} Returns an array of fully-qualified view names.
174
- */
175
- active(): any[];
176
- }