@angular-wave/angular.ts 0.9.1 → 0.9.3
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.
- package/@types/angular.d.ts +150 -0
- package/@types/animations/animate-cache.d.ts +50 -0
- package/@types/animations/animate-children-directive.d.ts +10 -0
- package/@types/animations/animate-css-driver.d.ts +18 -0
- package/@types/animations/animate-css.d.ts +18 -0
- package/@types/animations/animate-js-driver.d.ts +14 -0
- package/@types/animations/animate-js.d.ts +23 -0
- package/@types/animations/animate-queue.d.ts +28 -0
- package/@types/animations/animate-runner.d.ts +31 -0
- package/@types/animations/animate-swap.d.ts +9 -0
- package/@types/animations/animate.d.ts +450 -0
- package/@types/animations/animation.d.ts +14 -0
- package/@types/animations/interface.d.ts +17 -0
- package/@types/animations/raf-scheduler.d.ts +37 -0
- package/@types/animations/shared.d.ts +74 -0
- package/@types/core/compile/compile.d.ts +201 -0
- package/@types/core/controller/controller.d.ts +54 -0
- package/@types/core/di/injector.d.ts +22 -0
- package/@types/core/filter/filter.d.ts +23 -0
- package/@types/core/interpolate/interpolate.d.ts +38 -0
- package/@types/core/parse/ast/ast-node.d.ts +56 -0
- package/@types/core/parse/ast/ast.d.ts +164 -0
- package/@types/core/parse/lexer/lexer.d.ts +119 -0
- package/@types/core/parse/lexer/token.d.ts +17 -0
- package/@types/core/parse/parse.d.ts +33 -0
- package/@types/core/parse/parser/parser.d.ts +41 -0
- package/@types/core/sanitize/sanitize-uri.d.ts +40 -0
- package/@types/directive/aria/aria.d.ts +104 -0
- package/@types/directive/attrs/attrs.d.ts +8 -0
- package/@types/directive/bind/bind.d.ts +18 -0
- package/@types/directive/channel/channel.d.ts +10 -0
- package/@types/directive/class/class.d.ts +3 -0
- package/@types/directive/cloak/cloak.d.ts +4 -0
- package/@types/directive/controller/controller.d.ts +4 -0
- package/@types/directive/events/events.d.ts +21 -0
- package/@types/directive/form/form.d.ts +264 -0
- package/@types/directive/http/http.d.ts +46 -0
- package/@types/directive/if/if.d.ts +10 -0
- package/@types/directive/include/include.d.ts +28 -0
- package/@types/directive/init/init.d.ts +4 -0
- package/@types/directive/input/input.d.ts +70 -0
- package/@types/directive/messages/messages.d.ts +63 -0
- package/@types/directive/model/model.d.ts +515 -0
- package/@types/directive/model-options/model-options.d.ts +56 -0
- package/@types/directive/non-bindable/non-bindable.d.ts +4 -0
- package/@types/directive/observe/observe.d.ts +9 -0
- package/@types/directive/options/options.d.ts +13 -0
- package/@types/directive/ref/ref.d.ts +11 -0
- package/@types/directive/repeat/repeat.d.ts +11 -0
- package/@types/directive/script/script.d.ts +10 -0
- package/@types/directive/select/select.d.ts +15 -0
- package/@types/directive/setter/setter.d.ts +12 -0
- package/@types/directive/show-hide/show-hide.d.ts +19 -0
- package/@types/directive/style/style.d.ts +4 -0
- package/@types/directive/switch/switch.d.ts +18 -0
- package/@types/directive/transclude/transclude.d.ts +10 -0
- package/@types/directive/validators/validators.d.ts +149 -0
- package/@types/filters/filter.d.ts +4 -0
- package/@types/filters/filters.d.ts +38 -0
- package/@types/filters/limit-to.d.ts +4 -0
- package/@types/filters/order-by.d.ts +7 -0
- package/@types/index.d.ts +2 -0
- package/@types/interface.d.ts +5 -4
- package/@types/ng.d.ts +8 -0
- package/@types/router/common/trace.d.ts +66 -0
- package/@types/router/directives/state-directives.d.ts +46 -0
- package/@types/router/directives/view-directive.d.ts +138 -0
- package/@types/router/glob/glob.d.ts +81 -0
- package/@types/router/hooks/core-resolvables.d.ts +2 -0
- package/@types/router/hooks/ignored-transition.d.ts +1 -0
- package/@types/router/hooks/invalid-transition.d.ts +1 -0
- package/@types/router/hooks/lazy-load.d.ts +42 -0
- package/@types/router/hooks/on-enter-exit-retain.d.ts +3 -0
- package/@types/router/hooks/redirect-to.d.ts +4 -0
- package/@types/router/hooks/resolve.d.ts +4 -0
- package/@types/router/hooks/update-globals.d.ts +1 -0
- package/@types/router/hooks/url.d.ts +5 -0
- package/@types/router/hooks/views.d.ts +5 -0
- package/@types/router/params/interface.d.ts +606 -0
- package/@types/router/params/param-factory.d.ts +16 -0
- package/@types/router/params/param-type.d.ts +59 -0
- package/@types/router/params/param.d.ts +71 -0
- package/@types/router/params/state-params.d.ts +12 -0
- package/@types/router/path/path-node.d.ts +38 -0
- package/@types/router/path/path-utils.d.ts +88 -0
- package/@types/router/resolve/interface.d.ts +200 -0
- package/@types/router/resolve/resolvable.d.ts +50 -0
- package/@types/router/resolve/resolve-context.d.ts +93 -0
- package/@types/router/router.d.ts +47 -0
- package/@types/router/state/interface.d.ts +983 -0
- package/@types/router/state/state-builder.d.ts +95 -0
- package/@types/router/state/state-matcher.d.ts +7 -0
- package/@types/router/state/state-object.d.ts +83 -0
- package/@types/router/state/state-queue-manager.d.ts +29 -0
- package/@types/router/state/state-registry.d.ts +133 -0
- package/@types/router/state/state-service.d.ts +425 -0
- package/@types/router/state/target-state.d.ts +102 -0
- package/@types/router/state/views.d.ts +58 -0
- package/@types/router/state-filters.d.ts +39 -0
- package/@types/router/template-factory.d.ts +117 -0
- package/@types/router/transition/hook-builder.d.ts +45 -0
- package/@types/router/transition/hook-registry.d.ts +102 -0
- package/@types/router/transition/interface.d.ts +880 -0
- package/@types/router/transition/reject-factory.d.ts +43 -0
- package/@types/router/transition/transition-event-type.d.ts +24 -0
- package/@types/router/transition/transition-hook.d.ts +86 -0
- package/@types/router/transition/transition-service.d.ts +116 -0
- package/@types/router/transition/transition.d.ts +331 -0
- package/@types/router/url/url-config.d.ts +99 -0
- package/@types/router/url/url-matcher.d.ts +174 -0
- package/@types/router/url/url-rule.d.ts +161 -0
- package/@types/router/url/url-rules.d.ts +249 -0
- package/@types/router/url/url-service.d.ts +254 -0
- package/@types/router/view/interface.d.ts +44 -0
- package/@types/router/view/view.d.ts +149 -0
- package/@types/router/view-scroll.d.ts +10 -0
- package/@types/services/anchor-scroll.d.ts +25 -0
- package/@types/services/cookie-reader.d.ts +4 -0
- package/@types/services/http/http.d.ts +134 -0
- package/@types/services/http-backend/http-backend.d.ts +58 -0
- package/@types/services/sce/sce.d.ts +238 -0
- package/@types/services/template-request.d.ts +55 -0
- package/@types/shared/common.d.ts +197 -0
- package/@types/shared/hof.d.ts +108 -0
- package/@types/shared/predicates.d.ts +17 -0
- package/@types/shared/queue.d.ts +64 -0
- package/@types/shared/strings.d.ts +58 -0
- package/dist/angular-ts.esm.js +2 -3
- package/dist/angular-ts.umd.js +2 -3
- package/dist/angular-ts.umd.min.js +1 -1
- package/docs/layouts/shortcodes/version.html +1 -1
- package/package.json +1 -1
- package/src/interface.ts +5 -4
- package/src/services/pubsub/pubsub.js +0 -1
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API for URL management
|
|
3
|
+
*/
|
|
4
|
+
export class UrlService {
|
|
5
|
+
static $inject: string[];
|
|
6
|
+
/**
|
|
7
|
+
* @param {import("../../services/location/location").LocationProvider} $locationProvider
|
|
8
|
+
* @param {import("../../router/state/state-service.js").StateProvider} stateService
|
|
9
|
+
* @param {import("../router.js").Router} globals
|
|
10
|
+
* @param {import("../../router/url/url-config.js").UrlConfigProvider} urlConfigProvider
|
|
11
|
+
*/
|
|
12
|
+
constructor(
|
|
13
|
+
$locationProvider: any,
|
|
14
|
+
stateService: import("../../router/state/state-service.js").StateProvider,
|
|
15
|
+
globals: import("../router.js").Router,
|
|
16
|
+
urlConfigProvider: import("../../router/url/url-config.js").UrlConfigProvider,
|
|
17
|
+
);
|
|
18
|
+
/** @type {import("../../services/location/location").Location} */
|
|
19
|
+
$location: any;
|
|
20
|
+
$locationProvider: any;
|
|
21
|
+
stateService: import("../../router/state/state-service.js").StateProvider;
|
|
22
|
+
/** Provides services related to the URL */
|
|
23
|
+
urlRuleFactory: UrlRuleFactory;
|
|
24
|
+
/**
|
|
25
|
+
* The nested [[UrlRules]] API for managing URL rules and rewrites
|
|
26
|
+
* @type {UrlRules}
|
|
27
|
+
*/
|
|
28
|
+
rules: UrlRules;
|
|
29
|
+
/**
|
|
30
|
+
* The nested [[UrlConfig]] API to configure the URL and retrieve URL information
|
|
31
|
+
* @type {import("./url-config.js").UrlConfigProvider}
|
|
32
|
+
*/
|
|
33
|
+
config: import("./url-config.js").UrlConfigProvider;
|
|
34
|
+
/** Creates a new [[Param]] for a given location (DefType) */
|
|
35
|
+
paramFactory: ParamFactory;
|
|
36
|
+
_urlListeners: any[];
|
|
37
|
+
/**
|
|
38
|
+
* Gets the path part of the current url
|
|
39
|
+
*
|
|
40
|
+
* If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`
|
|
41
|
+
*
|
|
42
|
+
* @return {string} the path portion of the url
|
|
43
|
+
*/
|
|
44
|
+
getPath(): string;
|
|
45
|
+
/**
|
|
46
|
+
* Gets the search part of the current url as an object
|
|
47
|
+
*
|
|
48
|
+
* If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`
|
|
49
|
+
*
|
|
50
|
+
* @return {Object} the search (query) portion of the url, as an object
|
|
51
|
+
*/
|
|
52
|
+
getSearch(): any;
|
|
53
|
+
/**
|
|
54
|
+
* Gets the hash part of the current url
|
|
55
|
+
*
|
|
56
|
+
* If the current URL is `/some/path?query=value#anchor`, this returns `anchor`
|
|
57
|
+
*
|
|
58
|
+
* @return {string} the hash (anchor) portion of the url
|
|
59
|
+
*/
|
|
60
|
+
getHash(): string;
|
|
61
|
+
$get: (
|
|
62
|
+
| string
|
|
63
|
+
| ((
|
|
64
|
+
$location: import("../../services/location/location.js").Location,
|
|
65
|
+
$rootScope: import("../../core/scope/scope.js").Scope,
|
|
66
|
+
) => UrlService)
|
|
67
|
+
)[];
|
|
68
|
+
/**
|
|
69
|
+
* @returns {string}
|
|
70
|
+
*/
|
|
71
|
+
baseHref(): string;
|
|
72
|
+
_baseHref: string;
|
|
73
|
+
/**
|
|
74
|
+
* Gets the current url, or updates the url
|
|
75
|
+
*
|
|
76
|
+
* ### Getting the current URL
|
|
77
|
+
*
|
|
78
|
+
* When no arguments are passed, returns the current URL.
|
|
79
|
+
* The URL is normalized using the internal [[path]]/[[search]]/[[hash]] values.
|
|
80
|
+
*
|
|
81
|
+
* For example, the URL may be stored in the hash ([[HashLocationServices]]) or
|
|
82
|
+
* have a base HREF prepended ([[PushStateLocationServices]]).
|
|
83
|
+
*
|
|
84
|
+
* The raw URL in the browser might be:
|
|
85
|
+
*
|
|
86
|
+
* ```
|
|
87
|
+
* http://mysite.com/somepath/index.html#/internal/path/123?param1=foo#anchor
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* or
|
|
91
|
+
*
|
|
92
|
+
* ```
|
|
93
|
+
* http://mysite.com/basepath/internal/path/123?param1=foo#anchor
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* then this method returns:
|
|
97
|
+
*
|
|
98
|
+
* ```
|
|
99
|
+
* /internal/path/123?param1=foo#anchor
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
*
|
|
103
|
+
* #### Example:
|
|
104
|
+
* ```js
|
|
105
|
+
* locationServices.url(); // "/some/path?query=value#anchor"
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* ### Updating the URL
|
|
109
|
+
*
|
|
110
|
+
* When `newurl` arguments is provided, changes the URL to reflect `newurl`
|
|
111
|
+
*
|
|
112
|
+
* #### Example:
|
|
113
|
+
* ```js
|
|
114
|
+
* locationServices.url("/some/path?query=value#anchor", true);
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* @param {string} [newUrl] The new value for the URL.
|
|
118
|
+
* This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.
|
|
119
|
+
* It should not include the protocol, site, port, or base path of an absolute HREF.
|
|
120
|
+
* @param {any} [state] The history's state object, i.e., pushState (if the LocationServices implementation supports it)
|
|
121
|
+
*
|
|
122
|
+
* @return the url (after potentially being processed)
|
|
123
|
+
*/
|
|
124
|
+
url(newUrl?: string, state?: any): any;
|
|
125
|
+
/**
|
|
126
|
+
* @private
|
|
127
|
+
*
|
|
128
|
+
* Registers a low level url change handler
|
|
129
|
+
*
|
|
130
|
+
* Note: Because this is a low level handler, it's not recommended for general use.
|
|
131
|
+
*
|
|
132
|
+
* #### Example:
|
|
133
|
+
* ```js
|
|
134
|
+
* let deregisterFn = locationServices.onChange((evt) => console.log("url change", evt));
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* @param {Function} callback a function that will be called when the url is changing
|
|
138
|
+
* @return {Function} a function that de-registers the callback
|
|
139
|
+
*/
|
|
140
|
+
private onChange;
|
|
141
|
+
/**
|
|
142
|
+
* Gets the current URL parts.
|
|
143
|
+
*
|
|
144
|
+
* Returns an object with the `path`, `search`, and `hash` components
|
|
145
|
+
* of the current browser location.
|
|
146
|
+
*
|
|
147
|
+
* @returns {import("../../services/location/interface.ts").UrlParts} The current URL's path, search, and hash.
|
|
148
|
+
*/
|
|
149
|
+
parts(): import("../../services/location/interface.ts").UrlParts;
|
|
150
|
+
/**
|
|
151
|
+
* Activates the best rule for the current URL
|
|
152
|
+
*
|
|
153
|
+
* Checks the current URL for a matching [[UrlRule]], then invokes that rule's handler.
|
|
154
|
+
* This method is called internally any time the URL has changed.
|
|
155
|
+
*
|
|
156
|
+
* This effectively activates the state (or redirect, etc) which matches the current URL.
|
|
157
|
+
*
|
|
158
|
+
* #### Example:
|
|
159
|
+
* ```js
|
|
160
|
+
*
|
|
161
|
+
* fetch('/states.json').then(resp => resp.json()).then(data => {
|
|
162
|
+
* data.forEach(state => $stateRegistry.register(state));
|
|
163
|
+
* urlService.listen();
|
|
164
|
+
* // Find the matching URL and invoke the handler.
|
|
165
|
+
* urlService.sync();
|
|
166
|
+
* });
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
sync(evt: any): void;
|
|
170
|
+
/**
|
|
171
|
+
* Starts or stops listening for URL changes
|
|
172
|
+
*
|
|
173
|
+
* Call this sometime after calling [[deferIntercept]] to start monitoring the url.
|
|
174
|
+
* This causes ng-router to start listening for changes to the URL, if it wasn't already listening.
|
|
175
|
+
*
|
|
176
|
+
* If called with `false`, ng-router will stop listening (call listen(true) to start listening again).
|
|
177
|
+
*
|
|
178
|
+
* #### Example:
|
|
179
|
+
* ```js
|
|
180
|
+
*
|
|
181
|
+
* fetch('/states.json').then(resp => resp.json()).then(data => {
|
|
182
|
+
* data.forEach(state => $stateRegistry.register(state));
|
|
183
|
+
* // Start responding to URL changes
|
|
184
|
+
* urlService.listen();
|
|
185
|
+
* urlService.sync();
|
|
186
|
+
* });
|
|
187
|
+
* ```
|
|
188
|
+
*
|
|
189
|
+
* @param {boolean} enabled `true` or `false` to start or stop listening to URL changes
|
|
190
|
+
*/
|
|
191
|
+
listen(enabled: boolean): any;
|
|
192
|
+
_stopListeningFn: any;
|
|
193
|
+
/**
|
|
194
|
+
* Matches a URL
|
|
195
|
+
*
|
|
196
|
+
* Given a URL (as a [[UrlParts]] object), check all rules and determine the best matching rule.
|
|
197
|
+
* Return the result as a [[MatchResult]].
|
|
198
|
+
* @returns {any}
|
|
199
|
+
*/
|
|
200
|
+
match(url: any): any;
|
|
201
|
+
update(read: any): void;
|
|
202
|
+
location: any;
|
|
203
|
+
/**
|
|
204
|
+
* Internal API.
|
|
205
|
+
*
|
|
206
|
+
* Pushes a new location to the browser history.
|
|
207
|
+
*
|
|
208
|
+
* @internal
|
|
209
|
+
* @param urlMatcher
|
|
210
|
+
* @param params
|
|
211
|
+
* @param options
|
|
212
|
+
*/
|
|
213
|
+
push(urlMatcher: any, params: any, options: any): void;
|
|
214
|
+
/**
|
|
215
|
+
* Builds and returns a URL with interpolated parameters
|
|
216
|
+
*
|
|
217
|
+
* #### Example:
|
|
218
|
+
* ```js
|
|
219
|
+
* matcher = $umf.compile("/about/:person");
|
|
220
|
+
* params = { person: "bob" };
|
|
221
|
+
* $bob = $url.href(matcher, params);
|
|
222
|
+
* // $bob == "/about/bob";
|
|
223
|
+
* ```
|
|
224
|
+
*
|
|
225
|
+
* @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate.
|
|
226
|
+
* @param params An object of parameter values to fill the matcher's required parameters.
|
|
227
|
+
* @param options Options object. The options are:
|
|
228
|
+
*
|
|
229
|
+
* - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl".
|
|
230
|
+
*
|
|
231
|
+
* @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`
|
|
232
|
+
*/
|
|
233
|
+
href(urlMatcher: any, params: any, options: any): any;
|
|
234
|
+
/**
|
|
235
|
+
* Creates a [[UrlMatcher]] for the specified pattern.
|
|
236
|
+
*
|
|
237
|
+
* @param pattern The URL pattern.
|
|
238
|
+
* @param config The config object hash.
|
|
239
|
+
* @returns The UrlMatcher.
|
|
240
|
+
*/
|
|
241
|
+
compile(pattern: any, config: any): UrlMatcher;
|
|
242
|
+
/**
|
|
243
|
+
* Returns true if the specified object is a [[UrlMatcher]], or false otherwise.
|
|
244
|
+
*
|
|
245
|
+
* @param object The object to perform the type check against.
|
|
246
|
+
* @returns `true` if the object matches the `UrlMatcher` interface, by
|
|
247
|
+
* implementing all the same methods.
|
|
248
|
+
*/
|
|
249
|
+
isMatcher(object: any): boolean;
|
|
250
|
+
}
|
|
251
|
+
import { UrlRuleFactory } from "./url-rule.js";
|
|
252
|
+
import { UrlRules } from "./url-rules.js";
|
|
253
|
+
import { ParamFactory } from "../params/param-factory.js";
|
|
254
|
+
import { UrlMatcher } from "./url-matcher.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ViewDeclaration } from "../state/interface.ts";
|
|
2
|
+
import { PathNode } from "../path/path-node.js";
|
|
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
|
+
/** An auto-incremented id */
|
|
10
|
+
id: number;
|
|
11
|
+
/** The ui-view short name */
|
|
12
|
+
name: string;
|
|
13
|
+
/** The ui-view's fully qualified name */
|
|
14
|
+
fqn: string;
|
|
15
|
+
/** The ViewConfig that is currently loaded into the ui-view */
|
|
16
|
+
config: ViewConfig;
|
|
17
|
+
/** The state context in which the ui-view tag was created. */
|
|
18
|
+
creationContext: ViewContext;
|
|
19
|
+
/** A callback that should apply a ViewConfig (or clear the ui-view, if config is undefined) */
|
|
20
|
+
configUpdated: (config: ViewConfig) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* This interface represents a [[_ViewDeclaration]] that is bound to a [[PathNode]].
|
|
24
|
+
*
|
|
25
|
+
* A `ViewConfig` is the runtime definition of a single view.
|
|
26
|
+
*
|
|
27
|
+
* During a transition, `ViewConfig`s are created for each [[_ViewDeclaration]] defined on each "entering" [[StateObject]].
|
|
28
|
+
* Then, the [[ViewService]] finds any matching `ui-view`(s) in the DOM, and supplies the ui-view
|
|
29
|
+
* with the `ViewConfig`. The `ui-view` then loads itself using the information found in the `ViewConfig`.
|
|
30
|
+
*
|
|
31
|
+
* A `ViewConfig` if matched with a `ui-view` by finding all `ui-view`s which were created in the
|
|
32
|
+
* context named by the `uiViewContextAnchor`, and finding the `ui-view` or child `ui-view` that matches
|
|
33
|
+
* the `uiViewName` address.
|
|
34
|
+
*/
|
|
35
|
+
export interface ViewConfig {
|
|
36
|
+
$id: number;
|
|
37
|
+
/** The normalized view declaration from [[State.views]] */
|
|
38
|
+
viewDecl: ViewDeclaration;
|
|
39
|
+
/** The node the ViewConfig is bound to */
|
|
40
|
+
path: PathNode[];
|
|
41
|
+
loaded: boolean;
|
|
42
|
+
/** Fetches templates, runs dynamic (controller|template)Provider code, lazy loads Components, etc */
|
|
43
|
+
load(): Promise<ViewConfig>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The View service
|
|
3
|
+
*
|
|
4
|
+
* This service pairs existing `ng-view` components (which live in the DOM)
|
|
5
|
+
* with view configs (from the state declaration objects: [[StateDeclaration.views]]).
|
|
6
|
+
*
|
|
7
|
+
* - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]].
|
|
8
|
+
* The views from exited states are deactivated via [[deactivateViewConfig]].
|
|
9
|
+
* (See: the [[registerActivateViews]] Transition Hook)
|
|
10
|
+
*
|
|
11
|
+
* - As `ng-view` components pop in and out of existence, they register themselves using [[registerUIView]].
|
|
12
|
+
*
|
|
13
|
+
* - When the [[sync]] function is called, the registered `ng-view`(s) ([[ActiveUIView]])
|
|
14
|
+
* are configured with the matching [[ViewConfig]](s)
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
export class ViewService {
|
|
18
|
+
_ngViews: any[];
|
|
19
|
+
_viewConfigs: any[];
|
|
20
|
+
_viewConfigFactories: {};
|
|
21
|
+
_listeners: any[];
|
|
22
|
+
_pluginapi: {
|
|
23
|
+
_registeredUIView: (id: any) => undefined;
|
|
24
|
+
_registeredUIViews: () => any[];
|
|
25
|
+
_activeViewConfigs: () => any[];
|
|
26
|
+
_onSync: (listener: any) => () => any;
|
|
27
|
+
};
|
|
28
|
+
$get: (() => this)[];
|
|
29
|
+
/**
|
|
30
|
+
* @param {?import('../state/state-object.js').StateObject} context
|
|
31
|
+
* @return {?import('../state/state-object.js').StateObject}
|
|
32
|
+
*/
|
|
33
|
+
rootViewContext(
|
|
34
|
+
context: import("../state/state-object.js").StateObject | null,
|
|
35
|
+
): import("../state/state-object.js").StateObject | null;
|
|
36
|
+
_rootContext: any;
|
|
37
|
+
viewConfigFactory(factory: any): void;
|
|
38
|
+
/**
|
|
39
|
+
* @param path
|
|
40
|
+
* @param decl
|
|
41
|
+
* @return {import("../state/views.js").ViewConfig}
|
|
42
|
+
*/
|
|
43
|
+
createViewConfig(
|
|
44
|
+
path: any,
|
|
45
|
+
decl: any,
|
|
46
|
+
): import("../state/views.js").ViewConfig;
|
|
47
|
+
/**
|
|
48
|
+
* Deactivates a ViewConfig.
|
|
49
|
+
*
|
|
50
|
+
* This function deactivates a `ViewConfig`.
|
|
51
|
+
* After calling [[sync]], it will un-pair from any `ng-view` with which it is currently paired.
|
|
52
|
+
*
|
|
53
|
+
* @param viewConfig The ViewConfig view to deregister.
|
|
54
|
+
*/
|
|
55
|
+
deactivateViewConfig(viewConfig: any): void;
|
|
56
|
+
activateViewConfig(viewConfig: any): void;
|
|
57
|
+
sync(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Registers a `ng-view` component
|
|
60
|
+
*
|
|
61
|
+
* When a `ng-view` component is created, it uses this method to register itself.
|
|
62
|
+
* After registration the [[sync]] method is used to ensure all `ng-view` are configured with the proper [[ViewConfig]].
|
|
63
|
+
*
|
|
64
|
+
* Note: the `ng-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ng-view`,
|
|
65
|
+
* and what the view's state context is.
|
|
66
|
+
*
|
|
67
|
+
* Note: There is no corresponding `deregisterUIView`.
|
|
68
|
+
* A `ng-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself.
|
|
69
|
+
*
|
|
70
|
+
* @param ngView The metadata for a UIView
|
|
71
|
+
* @return a de-registration function used when the view is destroyed.
|
|
72
|
+
*/
|
|
73
|
+
registerUIView(ngView: any): () => void;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the list of views currently available on the page, by fully-qualified name.
|
|
76
|
+
*
|
|
77
|
+
* @return {Array} Returns an array of fully-qualified view names.
|
|
78
|
+
*/
|
|
79
|
+
available(): any[];
|
|
80
|
+
/**
|
|
81
|
+
* Returns the list of views on the page containing loaded content.
|
|
82
|
+
*
|
|
83
|
+
* @return {Array} Returns an array of fully-qualified view names.
|
|
84
|
+
*/
|
|
85
|
+
active(): any[];
|
|
86
|
+
}
|
|
87
|
+
export namespace ViewService {
|
|
88
|
+
/**
|
|
89
|
+
* Given a ng-view and a ViewConfig, determines if they "match".
|
|
90
|
+
*
|
|
91
|
+
* A ng-view has a fully qualified name (fqn) and a context object. The fqn is built from its overall location in
|
|
92
|
+
* the DOM, describing its nesting relationship to any parent ng-view tags it is nested inside of.
|
|
93
|
+
*
|
|
94
|
+
* A ViewConfig has a target ng-view name and a context anchor. The ng-view name can be a simple name, or
|
|
95
|
+
* can be a segmented ng-view path, describing a portion of a ng-view fqn.
|
|
96
|
+
*
|
|
97
|
+
* In order for a ng-view to match ViewConfig, ng-view's $type must match the ViewConfig's $type
|
|
98
|
+
*
|
|
99
|
+
* If the ViewConfig's target ng-view name is a simple name (no dots), then a ng-view matches if:
|
|
100
|
+
* - the ng-view's name matches the ViewConfig's target name
|
|
101
|
+
* - the ng-view's context matches the ViewConfig's anchor
|
|
102
|
+
*
|
|
103
|
+
* If the ViewConfig's target ng-view name is a segmented name (with dots), then a ng-view matches if:
|
|
104
|
+
* - There exists a parent ng-view where:
|
|
105
|
+
* - the parent ng-view's name matches the first segment (index 0) of the ViewConfig's target name
|
|
106
|
+
* - the parent ng-view's context matches the ViewConfig's anchor
|
|
107
|
+
* - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ng-view's fqn
|
|
108
|
+
*
|
|
109
|
+
* Example:
|
|
110
|
+
*
|
|
111
|
+
* DOM:
|
|
112
|
+
* <ng-view> <!-- created in the root context (name: "") -->
|
|
113
|
+
* <ng-view name="foo"> <!-- created in the context named: "A" -->
|
|
114
|
+
* <ng-view> <!-- created in the context named: "A.B" -->
|
|
115
|
+
* <ng-view name="bar"> <!-- created in the context named: "A.B.C" -->
|
|
116
|
+
* </ng-view>
|
|
117
|
+
* </ng-view>
|
|
118
|
+
* </ng-view>
|
|
119
|
+
* </ng-view>
|
|
120
|
+
*
|
|
121
|
+
* ngViews: [
|
|
122
|
+
* { fqn: "$default", creationContext: { name: "" } },
|
|
123
|
+
* { fqn: "$default.foo", creationContext: { name: "A" } },
|
|
124
|
+
* { fqn: "$default.foo.$default", creationContext: { name: "A.B" } }
|
|
125
|
+
* { fqn: "$default.foo.$default.bar", creationContext: { name: "A.B.C" } }
|
|
126
|
+
* ]
|
|
127
|
+
*
|
|
128
|
+
* These four view configs all match the ng-view with the fqn: "$default.foo.$default.bar":
|
|
129
|
+
*
|
|
130
|
+
* - ViewConfig1: { ngViewName: "bar", ngViewContextAnchor: "A.B.C" }
|
|
131
|
+
* - ViewConfig2: { ngViewName: "$default.bar", ngViewContextAnchor: "A.B" }
|
|
132
|
+
* - ViewConfig3: { ngViewName: "foo.$default.bar", ngViewContextAnchor: "A" }
|
|
133
|
+
* - ViewConfig4: { ngViewName: "$default.foo.$default.bar", ngViewContextAnchor: "" }
|
|
134
|
+
*
|
|
135
|
+
* Using ViewConfig3 as an example, it matches the ng-view with fqn "$default.foo.$default.bar" because:
|
|
136
|
+
* - The ViewConfig's segmented target name is: [ "foo", "$default", "bar" ]
|
|
137
|
+
* - There exists a parent ng-view (which has fqn: "$default.foo") where:
|
|
138
|
+
* - the parent ng-view's name "foo" matches the first segment "foo" of the ViewConfig's target name
|
|
139
|
+
* - the parent ng-view's context "A" matches the ViewConfig's anchor context "A"
|
|
140
|
+
* - And the remaining segments [ "$default", "bar" ].join("."_ of the ViewConfig's target name match
|
|
141
|
+
* the tail of the ng-view's fqn "default.bar"
|
|
142
|
+
*
|
|
143
|
+
* @internal
|
|
144
|
+
*/
|
|
145
|
+
function matches(
|
|
146
|
+
ngViewsByFqn: any,
|
|
147
|
+
ngView: any,
|
|
148
|
+
): (viewConfig: any) => boolean;
|
|
149
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class ViewScrollProvider {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
useAnchorScroll(): void;
|
|
4
|
+
$get: (
|
|
5
|
+
| string
|
|
6
|
+
| ((
|
|
7
|
+
$anchorScroll: import("../services/anchor-scroll.js").AnchorScrollObject,
|
|
8
|
+
) => import("../services/anchor-scroll.js").AnchorScrollObject | Function)
|
|
9
|
+
)[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} AnchorScrollObject
|
|
3
|
+
* @property {number|function|Element} yOffset
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {(string) => void} AnchorScrollFunction
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {AnchorScrollFunction | AnchorScrollObject} AnchorScrollService
|
|
10
|
+
*/
|
|
11
|
+
export class AnchorScrollProvider {
|
|
12
|
+
autoScrollingEnabled: boolean;
|
|
13
|
+
$get: (
|
|
14
|
+
| string
|
|
15
|
+
| ((
|
|
16
|
+
$location: import("../services/location/location.js").Location,
|
|
17
|
+
$rootScope: import("../core/scope/scope.js").Scope,
|
|
18
|
+
) => AnchorScrollFunction)
|
|
19
|
+
)[];
|
|
20
|
+
}
|
|
21
|
+
export type AnchorScrollObject = {
|
|
22
|
+
yOffset: number | Function | Element;
|
|
23
|
+
};
|
|
24
|
+
export type AnchorScrollFunction = (string: any) => void;
|
|
25
|
+
export type AnchorScrollService = AnchorScrollFunction | AnchorScrollObject;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default params serializer that converts objects to strings
|
|
3
|
+
* according to the following rules:
|
|
4
|
+
*
|
|
5
|
+
* * `{'foo': 'bar'}` results in `foo=bar`
|
|
6
|
+
* * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object)
|
|
7
|
+
* * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element)
|
|
8
|
+
* * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D` (stringified and encoded representation of an object)
|
|
9
|
+
*
|
|
10
|
+
* Note that serializer will sort the request parameters alphabetically.
|
|
11
|
+
*/
|
|
12
|
+
export function HttpParamSerializerProvider(): void;
|
|
13
|
+
export class HttpParamSerializerProvider {
|
|
14
|
+
$get: () => (params: any) => string;
|
|
15
|
+
}
|
|
16
|
+
export function defaultHttpResponseTransform(data: any, headers: any): any;
|
|
17
|
+
/**
|
|
18
|
+
* Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.
|
|
19
|
+
*/
|
|
20
|
+
export function HttpProvider(): void;
|
|
21
|
+
export class HttpProvider {
|
|
22
|
+
defaults: {
|
|
23
|
+
transformResponse: (typeof defaultHttpResponseTransform)[];
|
|
24
|
+
transformRequest: ((d: any) => any)[];
|
|
25
|
+
headers: {
|
|
26
|
+
common: {
|
|
27
|
+
Accept: string;
|
|
28
|
+
};
|
|
29
|
+
post: any;
|
|
30
|
+
put: any;
|
|
31
|
+
patch: any;
|
|
32
|
+
};
|
|
33
|
+
xsrfCookieName: string;
|
|
34
|
+
xsrfHeaderName: string;
|
|
35
|
+
paramSerializer: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Configure $http service to combine processing of multiple http responses received at around
|
|
39
|
+
* the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in
|
|
40
|
+
* significant performance improvement for bigger applications that make many HTTP requests
|
|
41
|
+
* concurrently (common during application bootstrap).
|
|
42
|
+
*
|
|
43
|
+
* Defaults to false. If no value is specified, returns the current configured value.
|
|
44
|
+
*
|
|
45
|
+
* @param {boolean=} value If true, when requests are loaded, they will schedule a deferred
|
|
46
|
+
* "apply" on the next tick, giving time for subsequent requests in a roughly ~10ms window
|
|
47
|
+
* to load and share the same digest cycle.
|
|
48
|
+
*
|
|
49
|
+
* @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.
|
|
50
|
+
* otherwise, returns the current configured value.
|
|
51
|
+
*/
|
|
52
|
+
useApplyAsync: (value?: boolean | undefined) => boolean | any;
|
|
53
|
+
/**
|
|
54
|
+
* Array containing service factories for all synchronous or asynchronous {@link ng.$http $http}
|
|
55
|
+
* pre-processing of request or postprocessing of responses.
|
|
56
|
+
*
|
|
57
|
+
* These service factories are ordered by request, i.e. they are applied in the same order as the
|
|
58
|
+
* array, on request, but reverse order, on response.
|
|
59
|
+
*
|
|
60
|
+
* {@link ng.$http#interceptors Interceptors detailed info}
|
|
61
|
+
*/
|
|
62
|
+
interceptors: any[];
|
|
63
|
+
/**
|
|
64
|
+
* Array containing URLs whose origins are trusted to receive the XSRF token. See the
|
|
65
|
+
* {@link ng.$http#security-considerations Security Considerations} sections for more details on
|
|
66
|
+
* XSRF.
|
|
67
|
+
*
|
|
68
|
+
* **Note:** An "origin" consists of the [URI scheme](https://en.wikipedia.org/wiki/URI_scheme),
|
|
69
|
+
* the [hostname](https://en.wikipedia.org/wiki/Hostname) and the
|
|
70
|
+
* [port number](https://en.wikipedia.org/wiki/Port_(computer_networking). For `http:` and
|
|
71
|
+
* `https:`, the port number can be omitted if using th default ports (80 and 443 respectively).
|
|
72
|
+
* Examples: `http://example.com`, `https://api.example.com:9876`
|
|
73
|
+
*
|
|
74
|
+
* <div class="alert alert-warning">
|
|
75
|
+
* It is not possible to trust specific URLs/paths. The `path`, `query` and `fragment` parts
|
|
76
|
+
* of a URL will be ignored. For example, `https://foo.com/path/bar?query=baz#fragment` will be
|
|
77
|
+
* treated as `https://foo.com`, meaning that **all** requests to URLs starting with
|
|
78
|
+
* `https://foo.com/` will include the XSRF token.
|
|
79
|
+
* </div>
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
*
|
|
83
|
+
* ```js
|
|
84
|
+
* // App served from `https://example.com/`.
|
|
85
|
+
* angular.
|
|
86
|
+
* module('xsrfTrustedOriginsExample', []).
|
|
87
|
+
* config(['$httpProvider', function($httpProvider) {
|
|
88
|
+
* $httpProvider.xsrfTrustedOrigins.push('https://api.example.com');
|
|
89
|
+
* }]).
|
|
90
|
+
* run(['$http', function($http) {
|
|
91
|
+
* // The XSRF token will be sent.
|
|
92
|
+
* $http.get('https://api.example.com/preferences').then(...);
|
|
93
|
+
*
|
|
94
|
+
* // The XSRF token will NOT be sent.
|
|
95
|
+
* $http.get('https://stats.example.com/activity').then(...);
|
|
96
|
+
* }]);
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @type {string[]}
|
|
100
|
+
*/
|
|
101
|
+
xsrfTrustedOrigins: string[];
|
|
102
|
+
$get: (
|
|
103
|
+
| string
|
|
104
|
+
| ((
|
|
105
|
+
$httpBackend: any,
|
|
106
|
+
$injector: import("../../core/di/internal-injector.js").InjectorService,
|
|
107
|
+
$sce: any,
|
|
108
|
+
) => {
|
|
109
|
+
(requestConfig: any): Promise<any>;
|
|
110
|
+
pendingRequests: any[];
|
|
111
|
+
/**
|
|
112
|
+
* Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of
|
|
113
|
+
* default headers, withCredentials as well as request and response transformations.
|
|
114
|
+
*
|
|
115
|
+
* See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above.
|
|
116
|
+
*/
|
|
117
|
+
defaults: {
|
|
118
|
+
transformResponse: (typeof defaultHttpResponseTransform)[];
|
|
119
|
+
transformRequest: ((d: any) => any)[];
|
|
120
|
+
headers: {
|
|
121
|
+
common: {
|
|
122
|
+
Accept: string;
|
|
123
|
+
};
|
|
124
|
+
post: any;
|
|
125
|
+
put: any;
|
|
126
|
+
patch: any;
|
|
127
|
+
};
|
|
128
|
+
xsrfCookieName: string;
|
|
129
|
+
xsrfHeaderName: string;
|
|
130
|
+
paramSerializer: string;
|
|
131
|
+
};
|
|
132
|
+
})
|
|
133
|
+
)[];
|
|
134
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @returns
|
|
3
|
+
*/
|
|
4
|
+
export function createHttpBackend(): (
|
|
5
|
+
method: string,
|
|
6
|
+
url?: string,
|
|
7
|
+
post?: any,
|
|
8
|
+
callback?: (
|
|
9
|
+
arg0: number,
|
|
10
|
+
arg1: any,
|
|
11
|
+
arg2: string | null,
|
|
12
|
+
arg3: string,
|
|
13
|
+
arg4: string,
|
|
14
|
+
) => void,
|
|
15
|
+
headers?: {
|
|
16
|
+
[x: string]: string;
|
|
17
|
+
},
|
|
18
|
+
timeout?: number | Promise<any>,
|
|
19
|
+
withCredentials?: boolean,
|
|
20
|
+
responseType?: XMLHttpRequestResponseType,
|
|
21
|
+
eventHandlers?: {
|
|
22
|
+
[x: string]: EventListener;
|
|
23
|
+
},
|
|
24
|
+
uploadEventHandlers?: {
|
|
25
|
+
[x: string]: EventListener;
|
|
26
|
+
},
|
|
27
|
+
) => void;
|
|
28
|
+
/**
|
|
29
|
+
* HTTP backend used by the `$http` that delegates to
|
|
30
|
+
* XMLHttpRequest object and deals with browser incompatibilities.
|
|
31
|
+
* You should never need to use this service directly.
|
|
32
|
+
*/
|
|
33
|
+
export class HttpBackendProvider {
|
|
34
|
+
$get: () => (
|
|
35
|
+
method: string,
|
|
36
|
+
url?: string,
|
|
37
|
+
post?: any,
|
|
38
|
+
callback?: (
|
|
39
|
+
arg0: number,
|
|
40
|
+
arg1: any,
|
|
41
|
+
arg2: string | null,
|
|
42
|
+
arg3: string,
|
|
43
|
+
arg4: string,
|
|
44
|
+
) => void,
|
|
45
|
+
headers?: {
|
|
46
|
+
[x: string]: string;
|
|
47
|
+
},
|
|
48
|
+
timeout?: number | Promise<any>,
|
|
49
|
+
withCredentials?: boolean,
|
|
50
|
+
responseType?: XMLHttpRequestResponseType,
|
|
51
|
+
eventHandlers?: {
|
|
52
|
+
[x: string]: EventListener;
|
|
53
|
+
},
|
|
54
|
+
uploadEventHandlers?: {
|
|
55
|
+
[x: string]: EventListener;
|
|
56
|
+
},
|
|
57
|
+
) => void;
|
|
58
|
+
}
|