[6a3a178] | 1 | /**
|
---|
| 2 | * @license Angular v12.2.9
|
---|
| 3 | * (c) 2010-2021 Google LLC. https://angular.io/
|
---|
| 4 | * License: MIT
|
---|
| 5 | */
|
---|
| 6 |
|
---|
| 7 | import { HashLocationStrategy } from '@angular/common';
|
---|
| 8 | import { InjectionToken } from '@angular/core';
|
---|
| 9 | import { Location as Location_2 } from '@angular/common';
|
---|
| 10 | import { LocationStrategy } from '@angular/common';
|
---|
| 11 | import { ModuleWithProviders } from '@angular/core';
|
---|
| 12 | import { PathLocationStrategy } from '@angular/common';
|
---|
| 13 | import { PlatformLocation } from '@angular/common';
|
---|
| 14 | import { UpgradeModule } from '@angular/upgrade/static';
|
---|
| 15 |
|
---|
| 16 | /**
|
---|
| 17 | * Location service that provides a drop-in replacement for the $location service
|
---|
| 18 | * provided in AngularJS.
|
---|
| 19 | *
|
---|
| 20 | * @see [Using the Angular Unified Location Service](guide/upgrade#using-the-unified-angular-location-service)
|
---|
| 21 | *
|
---|
| 22 | * @publicApi
|
---|
| 23 | */
|
---|
| 24 | export declare class $locationShim {
|
---|
| 25 | private location;
|
---|
| 26 | private platformLocation;
|
---|
| 27 | private urlCodec;
|
---|
| 28 | private locationStrategy;
|
---|
| 29 | private initalizing;
|
---|
| 30 | private updateBrowser;
|
---|
| 31 | private $$absUrl;
|
---|
| 32 | private $$url;
|
---|
| 33 | private $$protocol;
|
---|
| 34 | private $$host;
|
---|
| 35 | private $$port;
|
---|
| 36 | private $$replace;
|
---|
| 37 | private $$path;
|
---|
| 38 | private $$search;
|
---|
| 39 | private $$hash;
|
---|
| 40 | private $$state;
|
---|
| 41 | private $$changeListeners;
|
---|
| 42 | private cachedState;
|
---|
| 43 | private urlChanges;
|
---|
| 44 | constructor($injector: any, location: Location_2, platformLocation: PlatformLocation, urlCodec: UrlCodec, locationStrategy: LocationStrategy);
|
---|
| 45 | private initialize;
|
---|
| 46 | private resetBrowserUpdate;
|
---|
| 47 | private lastHistoryState;
|
---|
| 48 | private lastBrowserUrl;
|
---|
| 49 | private browserUrl;
|
---|
| 50 | private lastCachedState;
|
---|
| 51 | private cacheState;
|
---|
| 52 | /**
|
---|
| 53 | * This function emulates the $browser.state() function from AngularJS. It will cause
|
---|
| 54 | * history.state to be cached unless changed with deep equality check.
|
---|
| 55 | */
|
---|
| 56 | private browserState;
|
---|
| 57 | private stripBaseUrl;
|
---|
| 58 | private getServerBase;
|
---|
| 59 | private parseAppUrl;
|
---|
| 60 | /**
|
---|
| 61 | * Registers listeners for URL changes. This API is used to catch updates performed by the
|
---|
| 62 | * AngularJS framework. These changes are a subset of the `$locationChangeStart` and
|
---|
| 63 | * `$locationChangeSuccess` events which fire when AngularJS updates its internally-referenced
|
---|
| 64 | * version of the browser URL.
|
---|
| 65 | *
|
---|
| 66 | * It's possible for `$locationChange` events to happen, but for the browser URL
|
---|
| 67 | * (window.location) to remain unchanged. This `onChange` callback will fire only when AngularJS
|
---|
| 68 | * actually updates the browser URL (window.location).
|
---|
| 69 | *
|
---|
| 70 | * @param fn The callback function that is triggered for the listener when the URL changes.
|
---|
| 71 | * @param err The callback function that is triggered when an error occurs.
|
---|
| 72 | */
|
---|
| 73 | onChange(fn: (url: string, state: unknown, oldUrl: string, oldState: unknown) => void, err?: (e: Error) => void): void;
|
---|
| 74 | /**
|
---|
| 75 | * Parses the provided URL, and sets the current URL to the parsed result.
|
---|
| 76 | *
|
---|
| 77 | * @param url The URL string.
|
---|
| 78 | */
|
---|
| 79 | $$parse(url: string): void;
|
---|
| 80 | /**
|
---|
| 81 | * Parses the provided URL and its relative URL.
|
---|
| 82 | *
|
---|
| 83 | * @param url The full URL string.
|
---|
| 84 | * @param relHref A URL string relative to the full URL string.
|
---|
| 85 | */
|
---|
| 86 | $$parseLinkUrl(url: string, relHref?: string | null): boolean;
|
---|
| 87 | private setBrowserUrlWithFallback;
|
---|
| 88 | private composeUrls;
|
---|
| 89 | /**
|
---|
| 90 | * Retrieves the full URL representation with all segments encoded according to
|
---|
| 91 | * rules specified in
|
---|
| 92 | * [RFC 3986](https://tools.ietf.org/html/rfc3986).
|
---|
| 93 | *
|
---|
| 94 | *
|
---|
| 95 | * ```js
|
---|
| 96 | * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
|
---|
| 97 | * let absUrl = $location.absUrl();
|
---|
| 98 | * // => "http://example.com/#/some/path?foo=bar&baz=xoxo"
|
---|
| 99 | * ```
|
---|
| 100 | */
|
---|
| 101 | absUrl(): string;
|
---|
| 102 | /**
|
---|
| 103 | * Retrieves the current URL, or sets a new URL. When setting a URL,
|
---|
| 104 | * changes the path, search, and hash, and returns a reference to its own instance.
|
---|
| 105 | *
|
---|
| 106 | * ```js
|
---|
| 107 | * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
|
---|
| 108 | * let url = $location.url();
|
---|
| 109 | * // => "/some/path?foo=bar&baz=xoxo"
|
---|
| 110 | * ```
|
---|
| 111 | */
|
---|
| 112 | url(): string;
|
---|
| 113 | url(url: string): this;
|
---|
| 114 | /**
|
---|
| 115 | * Retrieves the protocol of the current URL.
|
---|
| 116 | *
|
---|
| 117 | * ```js
|
---|
| 118 | * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
|
---|
| 119 | * let protocol = $location.protocol();
|
---|
| 120 | * // => "http"
|
---|
| 121 | * ```
|
---|
| 122 | */
|
---|
| 123 | protocol(): string;
|
---|
| 124 | /**
|
---|
| 125 | * Retrieves the protocol of the current URL.
|
---|
| 126 | *
|
---|
| 127 | * In contrast to the non-AngularJS version `location.host` which returns `hostname:port`, this
|
---|
| 128 | * returns the `hostname` portion only.
|
---|
| 129 | *
|
---|
| 130 | *
|
---|
| 131 | * ```js
|
---|
| 132 | * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
|
---|
| 133 | * let host = $location.host();
|
---|
| 134 | * // => "example.com"
|
---|
| 135 | *
|
---|
| 136 | * // given URL http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo
|
---|
| 137 | * host = $location.host();
|
---|
| 138 | * // => "example.com"
|
---|
| 139 | * host = location.host;
|
---|
| 140 | * // => "example.com:8080"
|
---|
| 141 | * ```
|
---|
| 142 | */
|
---|
| 143 | host(): string;
|
---|
| 144 | /**
|
---|
| 145 | * Retrieves the port of the current URL.
|
---|
| 146 | *
|
---|
| 147 | * ```js
|
---|
| 148 | * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
|
---|
| 149 | * let port = $location.port();
|
---|
| 150 | * // => 80
|
---|
| 151 | * ```
|
---|
| 152 | */
|
---|
| 153 | port(): number | null;
|
---|
| 154 | /**
|
---|
| 155 | * Retrieves the path of the current URL, or changes the path and returns a reference to its own
|
---|
| 156 | * instance.
|
---|
| 157 | *
|
---|
| 158 | * Paths should always begin with forward slash (/). This method adds the forward slash
|
---|
| 159 | * if it is missing.
|
---|
| 160 | *
|
---|
| 161 | * ```js
|
---|
| 162 | * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
|
---|
| 163 | * let path = $location.path();
|
---|
| 164 | * // => "/some/path"
|
---|
| 165 | * ```
|
---|
| 166 | */
|
---|
| 167 | path(): string;
|
---|
| 168 | path(path: string | number | null): this;
|
---|
| 169 | /**
|
---|
| 170 | * Retrieves a map of the search parameters of the current URL, or changes a search
|
---|
| 171 | * part and returns a reference to its own instance.
|
---|
| 172 | *
|
---|
| 173 | *
|
---|
| 174 | * ```js
|
---|
| 175 | * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
|
---|
| 176 | * let searchObject = $location.search();
|
---|
| 177 | * // => {foo: 'bar', baz: 'xoxo'}
|
---|
| 178 | *
|
---|
| 179 | * // set foo to 'yipee'
|
---|
| 180 | * $location.search('foo', 'yipee');
|
---|
| 181 | * // $location.search() => {foo: 'yipee', baz: 'xoxo'}
|
---|
| 182 | * ```
|
---|
| 183 | *
|
---|
| 184 | * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or
|
---|
| 185 | * hash object.
|
---|
| 186 | *
|
---|
| 187 | * When called with a single argument the method acts as a setter, setting the `search` component
|
---|
| 188 | * of `$location` to the specified value.
|
---|
| 189 | *
|
---|
| 190 | * If the argument is a hash object containing an array of values, these values will be encoded
|
---|
| 191 | * as duplicate search parameters in the URL.
|
---|
| 192 | *
|
---|
| 193 | * @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number,
|
---|
| 194 | * then `paramValue`
|
---|
| 195 | * will override only a single search property.
|
---|
| 196 | *
|
---|
| 197 | * If `paramValue` is an array, it will override the property of the `search` component of
|
---|
| 198 | * `$location` specified via the first argument.
|
---|
| 199 | *
|
---|
| 200 | * If `paramValue` is `null`, the property specified via the first argument will be deleted.
|
---|
| 201 | *
|
---|
| 202 | * If `paramValue` is `true`, the property specified via the first argument will be added with no
|
---|
| 203 | * value nor trailing equal sign.
|
---|
| 204 | *
|
---|
| 205 | * @return {Object} The parsed `search` object of the current URL, or the changed `search` object.
|
---|
| 206 | */
|
---|
| 207 | search(): {
|
---|
| 208 | [key: string]: unknown;
|
---|
| 209 | };
|
---|
| 210 | search(search: string | number | {
|
---|
| 211 | [key: string]: unknown;
|
---|
| 212 | }): this;
|
---|
| 213 | search(search: string | number | {
|
---|
| 214 | [key: string]: unknown;
|
---|
| 215 | }, paramValue: null | undefined | string | number | boolean | string[]): this;
|
---|
| 216 | /**
|
---|
| 217 | * Retrieves the current hash fragment, or changes the hash fragment and returns a reference to
|
---|
| 218 | * its own instance.
|
---|
| 219 | *
|
---|
| 220 | * ```js
|
---|
| 221 | * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue
|
---|
| 222 | * let hash = $location.hash();
|
---|
| 223 | * // => "hashValue"
|
---|
| 224 | * ```
|
---|
| 225 | */
|
---|
| 226 | hash(): string;
|
---|
| 227 | hash(hash: string | number | null): this;
|
---|
| 228 | /**
|
---|
| 229 | * Changes to `$location` during the current `$digest` will replace the current
|
---|
| 230 | * history record, instead of adding a new one.
|
---|
| 231 | */
|
---|
| 232 | replace(): this;
|
---|
| 233 | /**
|
---|
| 234 | * Retrieves the history state object when called without any parameter.
|
---|
| 235 | *
|
---|
| 236 | * Change the history state object when called with one parameter and return `$location`.
|
---|
| 237 | * The state object is later passed to `pushState` or `replaceState`.
|
---|
| 238 | *
|
---|
| 239 | * This method is supported only in HTML5 mode and only in browsers supporting
|
---|
| 240 | * the HTML5 History API methods such as `pushState` and `replaceState`. If you need to support
|
---|
| 241 | * older browsers (like Android < 4.0), don't use this method.
|
---|
| 242 | *
|
---|
| 243 | */
|
---|
| 244 | state(): unknown;
|
---|
| 245 | state(state: unknown): this;
|
---|
| 246 | }
|
---|
| 247 |
|
---|
| 248 | /**
|
---|
| 249 | * The factory function used to create an instance of the `$locationShim` in Angular,
|
---|
| 250 | * and provides an API-compatiable `$locationProvider` for AngularJS.
|
---|
| 251 | *
|
---|
| 252 | * @publicApi
|
---|
| 253 | */
|
---|
| 254 | export declare class $locationShimProvider {
|
---|
| 255 | private ngUpgrade;
|
---|
| 256 | private location;
|
---|
| 257 | private platformLocation;
|
---|
| 258 | private urlCodec;
|
---|
| 259 | private locationStrategy;
|
---|
| 260 | constructor(ngUpgrade: UpgradeModule, location: Location_2, platformLocation: PlatformLocation, urlCodec: UrlCodec, locationStrategy: LocationStrategy);
|
---|
| 261 | /**
|
---|
| 262 | * Factory method that returns an instance of the $locationShim
|
---|
| 263 | */
|
---|
| 264 | $get(): $locationShim;
|
---|
| 265 | /**
|
---|
| 266 | * Stub method used to keep API compatible with AngularJS. This setting is configured through
|
---|
| 267 | * the LocationUpgradeModule's `config` method in your Angular app.
|
---|
| 268 | */
|
---|
| 269 | hashPrefix(prefix?: string): void;
|
---|
| 270 | /**
|
---|
| 271 | * Stub method used to keep API compatible with AngularJS. This setting is configured through
|
---|
| 272 | * the LocationUpgradeModule's `config` method in your Angular app.
|
---|
| 273 | */
|
---|
| 274 | html5Mode(mode?: any): void;
|
---|
| 275 | }
|
---|
| 276 |
|
---|
| 277 | /**
|
---|
| 278 | * A `UrlCodec` that uses logic from AngularJS to serialize and parse URLs
|
---|
| 279 | * and URL parameters.
|
---|
| 280 | *
|
---|
| 281 | * @publicApi
|
---|
| 282 | */
|
---|
| 283 | export declare class AngularJSUrlCodec implements UrlCodec {
|
---|
| 284 | encodePath(path: string): string;
|
---|
| 285 | encodeSearch(search: string | {
|
---|
| 286 | [k: string]: unknown;
|
---|
| 287 | }): string;
|
---|
| 288 | encodeHash(hash: string): string;
|
---|
| 289 | decodePath(path: string, html5Mode?: boolean): string;
|
---|
| 290 | decodeSearch(search: string): {
|
---|
| 291 | [k: string]: unknown;
|
---|
| 292 | };
|
---|
| 293 | decodeHash(hash: string): string;
|
---|
| 294 | normalize(href: string): string;
|
---|
| 295 | normalize(path: string, search: {
|
---|
| 296 | [k: string]: unknown;
|
---|
| 297 | }, hash: string, baseUrl?: string): string;
|
---|
| 298 | areEqual(valA: string, valB: string): boolean;
|
---|
| 299 | parse(url: string, base?: string): {
|
---|
| 300 | href: string;
|
---|
| 301 | protocol: string;
|
---|
| 302 | host: string;
|
---|
| 303 | search: string;
|
---|
| 304 | hash: string;
|
---|
| 305 | hostname: string;
|
---|
| 306 | port: string;
|
---|
| 307 | pathname: string;
|
---|
| 308 | };
|
---|
| 309 | }
|
---|
| 310 |
|
---|
| 311 | /**
|
---|
| 312 | * A provider token used to configure the location upgrade module.
|
---|
| 313 | *
|
---|
| 314 | * @publicApi
|
---|
| 315 | */
|
---|
| 316 | export declare const LOCATION_UPGRADE_CONFIGURATION: InjectionToken<LocationUpgradeConfig>;
|
---|
| 317 |
|
---|
| 318 | /**
|
---|
| 319 | * Configuration options for LocationUpgrade.
|
---|
| 320 | *
|
---|
| 321 | * @publicApi
|
---|
| 322 | */
|
---|
| 323 | export declare interface LocationUpgradeConfig {
|
---|
| 324 | /**
|
---|
| 325 | * Configures whether the location upgrade module should use the `HashLocationStrategy`
|
---|
| 326 | * or the `PathLocationStrategy`
|
---|
| 327 | */
|
---|
| 328 | useHash?: boolean;
|
---|
| 329 | /**
|
---|
| 330 | * Configures the hash prefix used in the URL when using the `HashLocationStrategy`
|
---|
| 331 | */
|
---|
| 332 | hashPrefix?: string;
|
---|
| 333 | /**
|
---|
| 334 | * Configures the URL codec for encoding and decoding URLs. Default is the `AngularJSCodec`
|
---|
| 335 | */
|
---|
| 336 | urlCodec?: typeof UrlCodec;
|
---|
| 337 | /**
|
---|
| 338 | * Configures the base href when used in server-side rendered applications
|
---|
| 339 | */
|
---|
| 340 | serverBaseHref?: string;
|
---|
| 341 | /**
|
---|
| 342 | * Configures the base href when used in client-side rendered applications
|
---|
| 343 | */
|
---|
| 344 | appBaseHref?: string;
|
---|
| 345 | }
|
---|
| 346 |
|
---|
| 347 | /**
|
---|
| 348 | * `NgModule` used for providing and configuring Angular's Unified Location Service for upgrading.
|
---|
| 349 | *
|
---|
| 350 | * @see [Using the Unified Angular Location Service](guide/upgrade#using-the-unified-angular-location-service)
|
---|
| 351 | *
|
---|
| 352 | * @publicApi
|
---|
| 353 | */
|
---|
| 354 | export declare class LocationUpgradeModule {
|
---|
| 355 | static config(config?: LocationUpgradeConfig): ModuleWithProviders<LocationUpgradeModule>;
|
---|
| 356 | }
|
---|
| 357 |
|
---|
| 358 |
|
---|
| 359 | /**
|
---|
| 360 | * A codec for encoding and decoding URL parts.
|
---|
| 361 | *
|
---|
| 362 | * @publicApi
|
---|
| 363 | **/
|
---|
| 364 | export declare abstract class UrlCodec {
|
---|
| 365 | /**
|
---|
| 366 | * Encodes the path from the provided string
|
---|
| 367 | *
|
---|
| 368 | * @param path The path string
|
---|
| 369 | */
|
---|
| 370 | abstract encodePath(path: string): string;
|
---|
| 371 | /**
|
---|
| 372 | * Decodes the path from the provided string
|
---|
| 373 | *
|
---|
| 374 | * @param path The path string
|
---|
| 375 | */
|
---|
| 376 | abstract decodePath(path: string): string;
|
---|
| 377 | /**
|
---|
| 378 | * Encodes the search string from the provided string or object
|
---|
| 379 | *
|
---|
| 380 | * @param path The path string or object
|
---|
| 381 | */
|
---|
| 382 | abstract encodeSearch(search: string | {
|
---|
| 383 | [k: string]: unknown;
|
---|
| 384 | }): string;
|
---|
| 385 | /**
|
---|
| 386 | * Decodes the search objects from the provided string
|
---|
| 387 | *
|
---|
| 388 | * @param path The path string
|
---|
| 389 | */
|
---|
| 390 | abstract decodeSearch(search: string): {
|
---|
| 391 | [k: string]: unknown;
|
---|
| 392 | };
|
---|
| 393 | /**
|
---|
| 394 | * Encodes the hash from the provided string
|
---|
| 395 | *
|
---|
| 396 | * @param path The hash string
|
---|
| 397 | */
|
---|
| 398 | abstract encodeHash(hash: string): string;
|
---|
| 399 | /**
|
---|
| 400 | * Decodes the hash from the provided string
|
---|
| 401 | *
|
---|
| 402 | * @param path The hash string
|
---|
| 403 | */
|
---|
| 404 | abstract decodeHash(hash: string): string;
|
---|
| 405 | /**
|
---|
| 406 | * Normalizes the URL from the provided string
|
---|
| 407 | *
|
---|
| 408 | * @param path The URL string
|
---|
| 409 | */
|
---|
| 410 | abstract normalize(href: string): string;
|
---|
| 411 | /**
|
---|
| 412 | * Normalizes the URL from the provided string, search, hash, and base URL parameters
|
---|
| 413 | *
|
---|
| 414 | * @param path The URL path
|
---|
| 415 | * @param search The search object
|
---|
| 416 | * @param hash The has string
|
---|
| 417 | * @param baseUrl The base URL for the URL
|
---|
| 418 | */
|
---|
| 419 | abstract normalize(path: string, search: {
|
---|
| 420 | [k: string]: unknown;
|
---|
| 421 | }, hash: string, baseUrl?: string): string;
|
---|
| 422 | /**
|
---|
| 423 | * Checks whether the two strings are equal
|
---|
| 424 | * @param valA First string for comparison
|
---|
| 425 | * @param valB Second string for comparison
|
---|
| 426 | */
|
---|
| 427 | abstract areEqual(valA: string, valB: string): boolean;
|
---|
| 428 | /**
|
---|
| 429 | * Parses the URL string based on the base URL
|
---|
| 430 | *
|
---|
| 431 | * @param url The full URL string
|
---|
| 432 | * @param base The base for the URL
|
---|
| 433 | */
|
---|
| 434 | abstract parse(url: string, base?: string): {
|
---|
| 435 | href: string;
|
---|
| 436 | protocol: string;
|
---|
| 437 | host: string;
|
---|
| 438 | search: string;
|
---|
| 439 | hash: string;
|
---|
| 440 | hostname: string;
|
---|
| 441 | port: string;
|
---|
| 442 | pathname: string;
|
---|
| 443 | };
|
---|
| 444 | }
|
---|
| 445 |
|
---|
| 446 | export declare function ɵangular_packages_common_upgrade_upgrade_a(config: LocationUpgradeConfig, appBaseHref?: string): string;
|
---|
| 447 |
|
---|
| 448 | export declare function ɵangular_packages_common_upgrade_upgrade_b(config: LocationUpgradeConfig): any;
|
---|
| 449 |
|
---|
| 450 | export declare function ɵangular_packages_common_upgrade_upgrade_c(platformLocation: PlatformLocation, baseHref: string, options?: LocationUpgradeConfig): HashLocationStrategy | PathLocationStrategy;
|
---|
| 451 |
|
---|
| 452 | export declare function ɵangular_packages_common_upgrade_upgrade_d(ngUpgrade: UpgradeModule, location: Location_2, platformLocation: PlatformLocation, urlCodec: UrlCodec, locationStrategy: LocationStrategy): $locationShim;
|
---|
| 453 |
|
---|
| 454 | export { }
|
---|