123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450 |
- /**
- * @license Angular v16.2.9
- * (c) 2010-2022 Google LLC. https://angular.io/
- * License: MIT
- */
- import * as i0 from '@angular/core';
- import * as i1 from '@angular/common';
- import { InjectionToken } from '@angular/core';
- import { Location as Location_2 } from '@angular/common';
- import { LocationStrategy } from '@angular/common';
- import { ModuleWithProviders } from '@angular/core';
- import { PlatformLocation } from '@angular/common';
- import { UpgradeModule } from '@angular/upgrade/static';
- /**
- * Location service that provides a drop-in replacement for the $location service
- * provided in AngularJS.
- *
- * @see [Using the Angular Unified Location Service](guide/upgrade#using-the-unified-angular-location-service)
- *
- * @publicApi
- */
- export declare class $locationShim {
- private location;
- private platformLocation;
- private urlCodec;
- private locationStrategy;
- private initializing;
- private updateBrowser;
- private $$absUrl;
- private $$url;
- private $$protocol;
- private $$host;
- private $$port;
- private $$replace;
- private $$path;
- private $$search;
- private $$hash;
- private $$state;
- private $$changeListeners;
- private cachedState;
- private urlChanges;
- constructor($injector: any, location: Location_2, platformLocation: PlatformLocation, urlCodec: UrlCodec, locationStrategy: LocationStrategy);
- private initialize;
- private resetBrowserUpdate;
- private lastHistoryState;
- private lastBrowserUrl;
- private browserUrl;
- private lastCachedState;
- private cacheState;
- /**
- * This function emulates the $browser.state() function from AngularJS. It will cause
- * history.state to be cached unless changed with deep equality check.
- */
- private browserState;
- private stripBaseUrl;
- private getServerBase;
- private parseAppUrl;
- /**
- * Registers listeners for URL changes. This API is used to catch updates performed by the
- * AngularJS framework. These changes are a subset of the `$locationChangeStart` and
- * `$locationChangeSuccess` events which fire when AngularJS updates its internally-referenced
- * version of the browser URL.
- *
- * It's possible for `$locationChange` events to happen, but for the browser URL
- * (window.location) to remain unchanged. This `onChange` callback will fire only when AngularJS
- * actually updates the browser URL (window.location).
- *
- * @param fn The callback function that is triggered for the listener when the URL changes.
- * @param err The callback function that is triggered when an error occurs.
- */
- onChange(fn: (url: string, state: unknown, oldUrl: string, oldState: unknown) => void, err?: (e: Error) => void): void;
- /**
- * Parses the provided URL, and sets the current URL to the parsed result.
- *
- * @param url The URL string.
- */
- $$parse(url: string): void;
- /**
- * Parses the provided URL and its relative URL.
- *
- * @param url The full URL string.
- * @param relHref A URL string relative to the full URL string.
- */
- $$parseLinkUrl(url: string, relHref?: string | null): boolean;
- private setBrowserUrlWithFallback;
- private composeUrls;
- /**
- * Retrieves the full URL representation with all segments encoded according to
- * rules specified in
- * [RFC 3986](https://tools.ietf.org/html/rfc3986).
- *
- *
- * ```js
- * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
- * let absUrl = $location.absUrl();
- * // => "http://example.com/#/some/path?foo=bar&baz=xoxo"
- * ```
- */
- absUrl(): string;
- /**
- * Retrieves the current URL, or sets a new URL. When setting a URL,
- * changes the path, search, and hash, and returns a reference to its own instance.
- *
- * ```js
- * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
- * let url = $location.url();
- * // => "/some/path?foo=bar&baz=xoxo"
- * ```
- */
- url(): string;
- url(url: string): this;
- /**
- * Retrieves the protocol of the current URL.
- *
- * ```js
- * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
- * let protocol = $location.protocol();
- * // => "http"
- * ```
- */
- protocol(): string;
- /**
- * Retrieves the protocol of the current URL.
- *
- * In contrast to the non-AngularJS version `location.host` which returns `hostname:port`, this
- * returns the `hostname` portion only.
- *
- *
- * ```js
- * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
- * let host = $location.host();
- * // => "example.com"
- *
- * // given URL http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo
- * host = $location.host();
- * // => "example.com"
- * host = location.host;
- * // => "example.com:8080"
- * ```
- */
- host(): string;
- /**
- * Retrieves the port of the current URL.
- *
- * ```js
- * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
- * let port = $location.port();
- * // => 80
- * ```
- */
- port(): number | null;
- /**
- * Retrieves the path of the current URL, or changes the path and returns a reference to its own
- * instance.
- *
- * Paths should always begin with forward slash (/). This method adds the forward slash
- * if it is missing.
- *
- * ```js
- * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
- * let path = $location.path();
- * // => "/some/path"
- * ```
- */
- path(): string;
- path(path: string | number | null): this;
- /**
- * Retrieves a map of the search parameters of the current URL, or changes a search
- * part and returns a reference to its own instance.
- *
- *
- * ```js
- * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
- * let searchObject = $location.search();
- * // => {foo: 'bar', baz: 'xoxo'}
- *
- * // set foo to 'yipee'
- * $location.search('foo', 'yipee');
- * // $location.search() => {foo: 'yipee', baz: 'xoxo'}
- * ```
- *
- * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or
- * hash object.
- *
- * When called with a single argument the method acts as a setter, setting the `search` component
- * of `$location` to the specified value.
- *
- * If the argument is a hash object containing an array of values, these values will be encoded
- * as duplicate search parameters in the URL.
- *
- * @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number,
- * then `paramValue`
- * will override only a single search property.
- *
- * If `paramValue` is an array, it will override the property of the `search` component of
- * `$location` specified via the first argument.
- *
- * If `paramValue` is `null`, the property specified via the first argument will be deleted.
- *
- * If `paramValue` is `true`, the property specified via the first argument will be added with no
- * value nor trailing equal sign.
- *
- * @return {Object} The parsed `search` object of the current URL, or the changed `search` object.
- */
- search(): {
- [key: string]: unknown;
- };
- search(search: string | number | {
- [key: string]: unknown;
- }): this;
- search(search: string | number | {
- [key: string]: unknown;
- }, paramValue: null | undefined | string | number | boolean | string[]): this;
- /**
- * Retrieves the current hash fragment, or changes the hash fragment and returns a reference to
- * its own instance.
- *
- * ```js
- * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue
- * let hash = $location.hash();
- * // => "hashValue"
- * ```
- */
- hash(): string;
- hash(hash: string | number | null): this;
- /**
- * Changes to `$location` during the current `$digest` will replace the current
- * history record, instead of adding a new one.
- */
- replace(): this;
- /**
- * Retrieves the history state object when called without any parameter.
- *
- * Change the history state object when called with one parameter and return `$location`.
- * The state object is later passed to `pushState` or `replaceState`.
- *
- * This method is supported only in HTML5 mode and only in browsers supporting
- * the HTML5 History API methods such as `pushState` and `replaceState`. If you need to support
- * older browsers (like Android < 4.0), don't use this method.
- *
- */
- state(): unknown;
- state(state: unknown): this;
- }
- /**
- * The factory function used to create an instance of the `$locationShim` in Angular,
- * and provides an API-compatible `$locationProvider` for AngularJS.
- *
- * @publicApi
- */
- export declare class $locationShimProvider {
- private ngUpgrade;
- private location;
- private platformLocation;
- private urlCodec;
- private locationStrategy;
- constructor(ngUpgrade: UpgradeModule, location: Location_2, platformLocation: PlatformLocation, urlCodec: UrlCodec, locationStrategy: LocationStrategy);
- /**
- * Factory method that returns an instance of the $locationShim
- */
- $get(): $locationShim;
- /**
- * Stub method used to keep API compatible with AngularJS. This setting is configured through
- * the LocationUpgradeModule's `config` method in your Angular app.
- */
- hashPrefix(prefix?: string): void;
- /**
- * Stub method used to keep API compatible with AngularJS. This setting is configured through
- * the LocationUpgradeModule's `config` method in your Angular app.
- */
- html5Mode(mode?: any): void;
- }
- /**
- * A `UrlCodec` that uses logic from AngularJS to serialize and parse URLs
- * and URL parameters.
- *
- * @publicApi
- */
- export declare class AngularJSUrlCodec implements UrlCodec {
- encodePath(path: string): string;
- encodeSearch(search: string | {
- [k: string]: unknown;
- }): string;
- encodeHash(hash: string): string;
- decodePath(path: string, html5Mode?: boolean): string;
- decodeSearch(search: string): {
- [k: string]: unknown;
- };
- decodeHash(hash: string): string;
- normalize(href: string): string;
- normalize(path: string, search: {
- [k: string]: unknown;
- }, hash: string, baseUrl?: string): string;
- areEqual(valA: string, valB: string): boolean;
- parse(url: string, base?: string): {
- href: string;
- protocol: string;
- host: string;
- search: string;
- hash: string;
- hostname: string;
- port: string;
- pathname: string;
- };
- }
- /**
- * A provider token used to configure the location upgrade module.
- *
- * @publicApi
- */
- export declare const LOCATION_UPGRADE_CONFIGURATION: InjectionToken<LocationUpgradeConfig>;
- /**
- * Configuration options for LocationUpgrade.
- *
- * @publicApi
- */
- export declare interface LocationUpgradeConfig {
- /**
- * Configures whether the location upgrade module should use the `HashLocationStrategy`
- * or the `PathLocationStrategy`
- */
- useHash?: boolean;
- /**
- * Configures the hash prefix used in the URL when using the `HashLocationStrategy`
- */
- hashPrefix?: string;
- /**
- * Configures the URL codec for encoding and decoding URLs. Default is the `AngularJSCodec`
- */
- urlCodec?: typeof UrlCodec;
- /**
- * Configures the base href when used in server-side rendered applications
- */
- serverBaseHref?: string;
- /**
- * Configures the base href when used in client-side rendered applications
- */
- appBaseHref?: string;
- }
- /**
- * `NgModule` used for providing and configuring Angular's Unified Location Service for upgrading.
- *
- * @see [Using the Unified Angular Location Service](guide/upgrade#using-the-unified-angular-location-service)
- *
- * @publicApi
- */
- export declare class LocationUpgradeModule {
- static config(config?: LocationUpgradeConfig): ModuleWithProviders<LocationUpgradeModule>;
- static ɵfac: i0.ɵɵFactoryDeclaration<LocationUpgradeModule, never>;
- static ɵmod: i0.ɵɵNgModuleDeclaration<LocationUpgradeModule, never, [typeof i1.CommonModule], never>;
- static ɵinj: i0.ɵɵInjectorDeclaration<LocationUpgradeModule>;
- }
- /**
- * A codec for encoding and decoding URL parts.
- *
- * @publicApi
- **/
- export declare abstract class UrlCodec {
- /**
- * Encodes the path from the provided string
- *
- * @param path The path string
- */
- abstract encodePath(path: string): string;
- /**
- * Decodes the path from the provided string
- *
- * @param path The path string
- */
- abstract decodePath(path: string): string;
- /**
- * Encodes the search string from the provided string or object
- *
- * @param path The path string or object
- */
- abstract encodeSearch(search: string | {
- [k: string]: unknown;
- }): string;
- /**
- * Decodes the search objects from the provided string
- *
- * @param path The path string
- */
- abstract decodeSearch(search: string): {
- [k: string]: unknown;
- };
- /**
- * Encodes the hash from the provided string
- *
- * @param path The hash string
- */
- abstract encodeHash(hash: string): string;
- /**
- * Decodes the hash from the provided string
- *
- * @param path The hash string
- */
- abstract decodeHash(hash: string): string;
- /**
- * Normalizes the URL from the provided string
- *
- * @param path The URL string
- */
- abstract normalize(href: string): string;
- /**
- * Normalizes the URL from the provided string, search, hash, and base URL parameters
- *
- * @param path The URL path
- * @param search The search object
- * @param hash The has string
- * @param baseUrl The base URL for the URL
- */
- abstract normalize(path: string, search: {
- [k: string]: unknown;
- }, hash: string, baseUrl?: string): string;
- /**
- * Checks whether the two strings are equal
- * @param valA First string for comparison
- * @param valB Second string for comparison
- */
- abstract areEqual(valA: string, valB: string): boolean;
- /**
- * Parses the URL string based on the base URL
- *
- * @param url The full URL string
- * @param base The base for the URL
- */
- abstract parse(url: string, base?: string): {
- href: string;
- protocol: string;
- host: string;
- search: string;
- hash: string;
- hostname: string;
- port: string;
- pathname: string;
- };
- }
- export { }
|