index.d.ts 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  1. /**
  2. * @license Angular v19.2.4
  3. * (c) 2010-2025 Google LLC. https://angular.io/
  4. * License: MIT
  5. */
  6. import * as i0 from '@angular/core';
  7. import { ApplicationConfig as ApplicationConfig$1, Type, ApplicationRef, StaticProvider, PlatformRef, Provider, ComponentRef, Predicate, DebugNode, DebugElement, InjectionToken, NgZone, ListenerOptions, OnDestroy, RendererFactory2, ɵTracingService as _TracingService, ɵTracingSnapshot as _TracingSnapshot, RendererType2, Renderer2, Injector, Sanitizer, SecurityContext, EnvironmentProviders, GetTestability, TestabilityRegistry, Testability, Version } from '@angular/core';
  8. import * as i1 from '@angular/common';
  9. import { ɵDomAdapter as _DomAdapter } from '@angular/common';
  10. export { ɵgetDOM } from '@angular/common';
  11. import { HttpTransferCacheOptions } from '@angular/common/http';
  12. /**
  13. * Set of config options available during the application bootstrap operation.
  14. *
  15. * @publicApi
  16. *
  17. * @deprecated
  18. * `ApplicationConfig` has moved, please import `ApplicationConfig` from `@angular/core` instead.
  19. */
  20. type ApplicationConfig = ApplicationConfig$1;
  21. /**
  22. * Bootstraps an instance of an Angular application and renders a standalone component as the
  23. * application's root component. More information about standalone components can be found in [this
  24. * guide](guide/components/importing).
  25. *
  26. * @usageNotes
  27. * The root component passed into this function *must* be a standalone one (should have the
  28. * `standalone: true` flag in the `@Component` decorator config).
  29. *
  30. * ```angular-ts
  31. * @Component({
  32. * standalone: true,
  33. * template: 'Hello world!'
  34. * })
  35. * class RootComponent {}
  36. *
  37. * const appRef: ApplicationRef = await bootstrapApplication(RootComponent);
  38. * ```
  39. *
  40. * You can add the list of providers that should be available in the application injector by
  41. * specifying the `providers` field in an object passed as the second argument:
  42. *
  43. * ```ts
  44. * await bootstrapApplication(RootComponent, {
  45. * providers: [
  46. * {provide: BACKEND_URL, useValue: 'https://yourdomain.com/api'}
  47. * ]
  48. * });
  49. * ```
  50. *
  51. * The `importProvidersFrom` helper method can be used to collect all providers from any
  52. * existing NgModule (and transitively from all NgModules that it imports):
  53. *
  54. * ```ts
  55. * await bootstrapApplication(RootComponent, {
  56. * providers: [
  57. * importProvidersFrom(SomeNgModule)
  58. * ]
  59. * });
  60. * ```
  61. *
  62. * Note: the `bootstrapApplication` method doesn't include [Testability](api/core/Testability) by
  63. * default. You can add [Testability](api/core/Testability) by getting the list of necessary
  64. * providers using `provideProtractorTestingSupport()` function and adding them into the `providers`
  65. * array, for example:
  66. *
  67. * ```ts
  68. * import {provideProtractorTestingSupport} from '@angular/platform-browser';
  69. *
  70. * await bootstrapApplication(RootComponent, {providers: [provideProtractorTestingSupport()]});
  71. * ```
  72. *
  73. * @param rootComponent A reference to a standalone component that should be rendered.
  74. * @param options Extra configuration for the bootstrap operation, see `ApplicationConfig` for
  75. * additional info.
  76. * @returns A promise that returns an `ApplicationRef` instance once resolved.
  77. *
  78. * @publicApi
  79. */
  80. declare function bootstrapApplication(rootComponent: Type<unknown>, options?: ApplicationConfig): Promise<ApplicationRef>;
  81. /**
  82. * Create an instance of an Angular application without bootstrapping any components. This is useful
  83. * for the situation where one wants to decouple application environment creation (a platform and
  84. * associated injectors) from rendering components on a screen. Components can be subsequently
  85. * bootstrapped on the returned `ApplicationRef`.
  86. *
  87. * @param options Extra configuration for the application environment, see `ApplicationConfig` for
  88. * additional info.
  89. * @returns A promise that returns an `ApplicationRef` instance once resolved.
  90. *
  91. * @publicApi
  92. */
  93. declare function createApplication(options?: ApplicationConfig): Promise<ApplicationRef>;
  94. /**
  95. * Returns a set of providers required to setup [Testability](api/core/Testability) for an
  96. * application bootstrapped using the `bootstrapApplication` function. The set of providers is
  97. * needed to support testing an application with Protractor (which relies on the Testability APIs
  98. * to be present).
  99. *
  100. * @returns An array of providers required to setup Testability for an application and make it
  101. * available for testing using Protractor.
  102. *
  103. * @publicApi
  104. */
  105. declare function provideProtractorTestingSupport(): Provider[];
  106. /**
  107. * A factory function that returns a `PlatformRef` instance associated with browser service
  108. * providers.
  109. *
  110. * @publicApi
  111. */
  112. declare const platformBrowser: (extraProviders?: StaticProvider[]) => PlatformRef;
  113. /**
  114. * Exports required infrastructure for all Angular apps.
  115. * Included by default in all Angular apps created with the CLI
  116. * `new` command.
  117. * Re-exports `CommonModule` and `ApplicationModule`, making their
  118. * exports and providers available to all apps.
  119. *
  120. * @publicApi
  121. */
  122. declare class BrowserModule {
  123. constructor();
  124. static ɵfac: i0.ɵɵFactoryDeclaration<BrowserModule, never>;
  125. static ɵmod: i0.ɵɵNgModuleDeclaration<BrowserModule, never, never, [typeof i1.CommonModule, typeof i0.ApplicationModule]>;
  126. static ɵinj: i0.ɵɵInjectorDeclaration<BrowserModule>;
  127. }
  128. /**
  129. * Represents the attributes of an HTML `<meta>` element. The element itself is
  130. * represented by the internal `HTMLMetaElement`.
  131. *
  132. * @see [HTML meta tag](https://developer.mozilla.org/docs/Web/HTML/Element/meta)
  133. * @see {@link Meta}
  134. *
  135. * @publicApi
  136. */
  137. type MetaDefinition = {
  138. charset?: string;
  139. content?: string;
  140. httpEquiv?: string;
  141. id?: string;
  142. itemprop?: string;
  143. name?: string;
  144. property?: string;
  145. scheme?: string;
  146. url?: string;
  147. } & {
  148. [prop: string]: string;
  149. };
  150. /**
  151. * A service for managing HTML `<meta>` tags.
  152. *
  153. * Properties of the `MetaDefinition` object match the attributes of the
  154. * HTML `<meta>` tag. These tags define document metadata that is important for
  155. * things like configuring a Content Security Policy, defining browser compatibility
  156. * and security settings, setting HTTP Headers, defining rich content for social sharing,
  157. * and Search Engine Optimization (SEO).
  158. *
  159. * To identify specific `<meta>` tags in a document, use an attribute selection
  160. * string in the format `"tag_attribute='value string'"`.
  161. * For example, an `attrSelector` value of `"name='description'"` matches a tag
  162. * whose `name` attribute has the value `"description"`.
  163. * Selectors are used with the `querySelector()` Document method,
  164. * in the format `meta[{attrSelector}]`.
  165. *
  166. * @see [HTML meta tag](https://developer.mozilla.org/docs/Web/HTML/Element/meta)
  167. * @see [Document.querySelector()](https://developer.mozilla.org/docs/Web/API/Document/querySelector)
  168. *
  169. *
  170. * @publicApi
  171. */
  172. declare class Meta {
  173. private _doc;
  174. private _dom;
  175. constructor(_doc: any);
  176. /**
  177. * Retrieves or creates a specific `<meta>` tag element in the current HTML document.
  178. * In searching for an existing tag, Angular attempts to match the `name` or `property` attribute
  179. * values in the provided tag definition, and verifies that all other attribute values are equal.
  180. * If an existing element is found, it is returned and is not modified in any way.
  181. * @param tag The definition of a `<meta>` element to match or create.
  182. * @param forceCreation True to create a new element without checking whether one already exists.
  183. * @returns The existing element with the same attributes and values if found,
  184. * the new element if no match is found, or `null` if the tag parameter is not defined.
  185. */
  186. addTag(tag: MetaDefinition, forceCreation?: boolean): HTMLMetaElement | null;
  187. /**
  188. * Retrieves or creates a set of `<meta>` tag elements in the current HTML document.
  189. * In searching for an existing tag, Angular attempts to match the `name` or `property` attribute
  190. * values in the provided tag definition, and verifies that all other attribute values are equal.
  191. * @param tags An array of tag definitions to match or create.
  192. * @param forceCreation True to create new elements without checking whether they already exist.
  193. * @returns The matching elements if found, or the new elements.
  194. */
  195. addTags(tags: MetaDefinition[], forceCreation?: boolean): HTMLMetaElement[];
  196. /**
  197. * Retrieves a `<meta>` tag element in the current HTML document.
  198. * @param attrSelector The tag attribute and value to match against, in the format
  199. * `"tag_attribute='value string'"`.
  200. * @returns The matching element, if any.
  201. */
  202. getTag(attrSelector: string): HTMLMetaElement | null;
  203. /**
  204. * Retrieves a set of `<meta>` tag elements in the current HTML document.
  205. * @param attrSelector The tag attribute and value to match against, in the format
  206. * `"tag_attribute='value string'"`.
  207. * @returns The matching elements, if any.
  208. */
  209. getTags(attrSelector: string): HTMLMetaElement[];
  210. /**
  211. * Modifies an existing `<meta>` tag element in the current HTML document.
  212. * @param tag The tag description with which to replace the existing tag content.
  213. * @param selector A tag attribute and value to match against, to identify
  214. * an existing tag. A string in the format `"tag_attribute=`value string`"`.
  215. * If not supplied, matches a tag with the same `name` or `property` attribute value as the
  216. * replacement tag.
  217. * @return The modified element.
  218. */
  219. updateTag(tag: MetaDefinition, selector?: string): HTMLMetaElement | null;
  220. /**
  221. * Removes an existing `<meta>` tag element from the current HTML document.
  222. * @param attrSelector A tag attribute and value to match against, to identify
  223. * an existing tag. A string in the format `"tag_attribute=`value string`"`.
  224. */
  225. removeTag(attrSelector: string): void;
  226. /**
  227. * Removes an existing `<meta>` tag element from the current HTML document.
  228. * @param meta The tag definition to match against to identify an existing tag.
  229. */
  230. removeTagElement(meta: HTMLMetaElement): void;
  231. private _getOrCreateElement;
  232. private _setMetaElementAttributes;
  233. private _parseSelector;
  234. private _containsAttributes;
  235. private _getMetaKeyMap;
  236. static ɵfac: i0.ɵɵFactoryDeclaration<Meta, never>;
  237. static ɵprov: i0.ɵɵInjectableDeclaration<Meta>;
  238. }
  239. /**
  240. * A service that can be used to get and set the title of a current HTML document.
  241. *
  242. * Since an Angular application can't be bootstrapped on the entire HTML document (`<html>` tag)
  243. * it is not possible to bind to the `text` property of the `HTMLTitleElement` elements
  244. * (representing the `<title>` tag). Instead, this service can be used to set and get the current
  245. * title value.
  246. *
  247. * @publicApi
  248. */
  249. declare class Title {
  250. private _doc;
  251. constructor(_doc: any);
  252. /**
  253. * Get the title of the current HTML document.
  254. */
  255. getTitle(): string;
  256. /**
  257. * Set the title of the current HTML document.
  258. * @param newTitle
  259. */
  260. setTitle(newTitle: string): void;
  261. static ɵfac: i0.ɵɵFactoryDeclaration<Title, never>;
  262. static ɵprov: i0.ɵɵInjectableDeclaration<Title>;
  263. }
  264. /**
  265. * Enabled Angular debug tools that are accessible via your browser's
  266. * developer console.
  267. *
  268. * Usage:
  269. *
  270. * 1. Open developer console (e.g. in Chrome Ctrl + Shift + j)
  271. * 1. Type `ng.` (usually the console will show auto-complete suggestion)
  272. * 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
  273. * then hit Enter.
  274. *
  275. * @publicApi
  276. */
  277. declare function enableDebugTools<T>(ref: ComponentRef<T>): ComponentRef<T>;
  278. /**
  279. * Disables Angular tools.
  280. *
  281. * @publicApi
  282. */
  283. declare function disableDebugTools(): void;
  284. /**
  285. * Predicates for use with {@link DebugElement}'s query functions.
  286. *
  287. * @publicApi
  288. */
  289. declare class By {
  290. /**
  291. * Match all nodes.
  292. *
  293. * @usageNotes
  294. * ### Example
  295. *
  296. * {@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
  297. */
  298. static all(): Predicate<DebugNode>;
  299. /**
  300. * Match elements by the given CSS selector.
  301. *
  302. * @usageNotes
  303. * ### Example
  304. *
  305. * {@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
  306. */
  307. static css(selector: string): Predicate<DebugElement>;
  308. /**
  309. * Match nodes that have the given directive present.
  310. *
  311. * @usageNotes
  312. * ### Example
  313. *
  314. * {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
  315. */
  316. static directive(type: Type<any>): Predicate<DebugNode>;
  317. }
  318. /**
  319. * The injection token for plugins of the `EventManager` service.
  320. *
  321. * @publicApi
  322. */
  323. declare const EVENT_MANAGER_PLUGINS: InjectionToken<EventManagerPlugin[]>;
  324. /**
  325. * An injectable service that provides event management for Angular
  326. * through a browser plug-in.
  327. *
  328. * @publicApi
  329. */
  330. declare class EventManager {
  331. private _zone;
  332. private _plugins;
  333. private _eventNameToPlugin;
  334. /**
  335. * Initializes an instance of the event-manager service.
  336. */
  337. constructor(plugins: EventManagerPlugin[], _zone: NgZone);
  338. /**
  339. * Registers a handler for a specific element and event.
  340. *
  341. * @param element The HTML element to receive event notifications.
  342. * @param eventName The name of the event to listen for.
  343. * @param handler A function to call when the notification occurs. Receives the
  344. * event object as an argument.
  345. * @param options Options that configure how the event listener is bound.
  346. * @returns A callback function that can be used to remove the handler.
  347. */
  348. addEventListener(element: HTMLElement, eventName: string, handler: Function, options?: ListenerOptions): Function;
  349. /**
  350. * Retrieves the compilation zone in which event listeners are registered.
  351. */
  352. getZone(): NgZone;
  353. static ɵfac: i0.ɵɵFactoryDeclaration<EventManager, never>;
  354. static ɵprov: i0.ɵɵInjectableDeclaration<EventManager>;
  355. }
  356. /**
  357. * The plugin definition for the `EventManager` class
  358. *
  359. * It can be used as a base class to create custom manager plugins, i.e. you can create your own
  360. * class that extends the `EventManagerPlugin` one.
  361. *
  362. * @publicApi
  363. */
  364. declare abstract class EventManagerPlugin {
  365. private _doc;
  366. constructor(_doc: any);
  367. manager: EventManager;
  368. /**
  369. * Should return `true` for every event name that should be supported by this plugin
  370. */
  371. abstract supports(eventName: string): boolean;
  372. /**
  373. * Implement the behaviour for the supported events
  374. */
  375. abstract addEventListener(element: HTMLElement, eventName: string, handler: Function, options?: ListenerOptions): Function;
  376. }
  377. /**
  378. * A record of usage for a specific style including all elements added to the DOM
  379. * that contain a given style.
  380. */
  381. interface UsageRecord<T> {
  382. elements: T[];
  383. usage: number;
  384. }
  385. declare class SharedStylesHost implements OnDestroy {
  386. private readonly doc;
  387. private readonly appId;
  388. private readonly nonce?;
  389. /**
  390. * Provides usage information for active inline style content and associated HTML <style> elements.
  391. * Embedded styles typically originate from the `styles` metadata of a rendered component.
  392. */
  393. private readonly inline;
  394. /**
  395. * Provides usage information for active external style URLs and the associated HTML <link> elements.
  396. * External styles typically originate from the `ɵɵExternalStylesFeature` of a rendered component.
  397. */
  398. private readonly external;
  399. /**
  400. * Set of host DOM nodes that will have styles attached.
  401. */
  402. private readonly hosts;
  403. /**
  404. * Whether the application code is currently executing on a server.
  405. */
  406. private readonly isServer;
  407. constructor(doc: Document, appId: string, nonce?: string | null | undefined, platformId?: object);
  408. /**
  409. * Adds embedded styles to the DOM via HTML `style` elements.
  410. * @param styles An array of style content strings.
  411. */
  412. addStyles(styles: string[], urls?: string[]): void;
  413. /**
  414. * Removes embedded styles from the DOM that were added as HTML `style` elements.
  415. * @param styles An array of style content strings.
  416. */
  417. removeStyles(styles: string[], urls?: string[]): void;
  418. protected addUsage<T extends HTMLElement>(value: string, usages: Map<string, UsageRecord<T>>, creator: (value: string, doc: Document) => T): void;
  419. protected removeUsage<T extends HTMLElement>(value: string, usages: Map<string, UsageRecord<T>>): void;
  420. ngOnDestroy(): void;
  421. /**
  422. * Adds a host node to the set of style hosts and adds all existing style usage to
  423. * the newly added host node.
  424. *
  425. * This is currently only used for Shadow DOM encapsulation mode.
  426. */
  427. addHost(hostNode: Node): void;
  428. removeHost(hostNode: Node): void;
  429. private addElement;
  430. static ɵfac: i0.ɵɵFactoryDeclaration<SharedStylesHost, [null, null, { optional: true; }, null]>;
  431. static ɵprov: i0.ɵɵInjectableDeclaration<SharedStylesHost>;
  432. }
  433. /**
  434. * A DI token that indicates whether styles
  435. * of destroyed components should be removed from DOM.
  436. *
  437. * By default, the value is set to `true`.
  438. * @publicApi
  439. */
  440. declare const REMOVE_STYLES_ON_COMPONENT_DESTROY: InjectionToken<boolean>;
  441. declare class DomRendererFactory2 implements RendererFactory2, OnDestroy {
  442. private readonly eventManager;
  443. private readonly sharedStylesHost;
  444. private readonly appId;
  445. private removeStylesOnCompDestroy;
  446. private readonly doc;
  447. readonly platformId: Object;
  448. readonly ngZone: NgZone;
  449. private readonly nonce;
  450. private readonly tracingService;
  451. private readonly rendererByCompId;
  452. private readonly defaultRenderer;
  453. private readonly platformIsServer;
  454. constructor(eventManager: EventManager, sharedStylesHost: SharedStylesHost, appId: string, removeStylesOnCompDestroy: boolean, doc: Document, platformId: Object, ngZone: NgZone, nonce?: string | null, tracingService?: _TracingService<_TracingSnapshot> | null);
  455. createRenderer(element: any, type: RendererType2 | null): Renderer2;
  456. private getOrCreateRenderer;
  457. ngOnDestroy(): void;
  458. /**
  459. * Used during HMR to clear any cached data about a component.
  460. * @param componentId ID of the component that is being replaced.
  461. */
  462. protected componentReplaced(componentId: string): void;
  463. static ɵfac: i0.ɵɵFactoryDeclaration<DomRendererFactory2, [null, null, null, null, null, null, null, null, { optional: true; }]>;
  464. static ɵprov: i0.ɵɵInjectableDeclaration<DomRendererFactory2>;
  465. }
  466. /**
  467. * DI token for providing [HammerJS](https://hammerjs.github.io/) support to Angular.
  468. * @see {@link HammerGestureConfig}
  469. *
  470. * @ngModule HammerModule
  471. * @publicApi
  472. */
  473. declare const HAMMER_GESTURE_CONFIG: InjectionToken<HammerGestureConfig>;
  474. /**
  475. * Function that loads HammerJS, returning a promise that is resolved once HammerJs is loaded.
  476. *
  477. * @publicApi
  478. */
  479. type HammerLoader = () => Promise<void>;
  480. /**
  481. * Injection token used to provide a HammerLoader to Angular.
  482. *
  483. * @see {@link HammerLoader}
  484. *
  485. * @publicApi
  486. */
  487. declare const HAMMER_LOADER: InjectionToken<HammerLoader>;
  488. interface HammerInstance {
  489. on(eventName: string, callback?: Function): void;
  490. off(eventName: string, callback?: Function): void;
  491. destroy?(): void;
  492. }
  493. /**
  494. * An injectable [HammerJS Manager](https://hammerjs.github.io/api/#hammermanager)
  495. * for gesture recognition. Configures specific event recognition.
  496. * @publicApi
  497. */
  498. declare class HammerGestureConfig {
  499. /**
  500. * A set of supported event names for gestures to be used in Angular.
  501. * Angular supports all built-in recognizers, as listed in
  502. * [HammerJS documentation](https://hammerjs.github.io/).
  503. */
  504. events: string[];
  505. /**
  506. * Maps gesture event names to a set of configuration options
  507. * that specify overrides to the default values for specific properties.
  508. *
  509. * The key is a supported event name to be configured,
  510. * and the options object contains a set of properties, with override values
  511. * to be applied to the named recognizer event.
  512. * For example, to disable recognition of the rotate event, specify
  513. * `{"rotate": {"enable": false}}`.
  514. *
  515. * Properties that are not present take the HammerJS default values.
  516. * For information about which properties are supported for which events,
  517. * and their allowed and default values, see
  518. * [HammerJS documentation](https://hammerjs.github.io/).
  519. *
  520. */
  521. overrides: {
  522. [key: string]: Object;
  523. };
  524. /**
  525. * Properties whose default values can be overridden for a given event.
  526. * Different sets of properties apply to different events.
  527. * For information about which properties are supported for which events,
  528. * and their allowed and default values, see
  529. * [HammerJS documentation](https://hammerjs.github.io/).
  530. */
  531. options?: {
  532. cssProps?: any;
  533. domEvents?: boolean;
  534. enable?: boolean | ((manager: any) => boolean);
  535. preset?: any[];
  536. touchAction?: string;
  537. recognizers?: any[];
  538. inputClass?: any;
  539. inputTarget?: EventTarget;
  540. };
  541. /**
  542. * Creates a [HammerJS Manager](https://hammerjs.github.io/api/#hammermanager)
  543. * and attaches it to a given HTML element.
  544. * @param element The element that will recognize gestures.
  545. * @returns A HammerJS event-manager object.
  546. */
  547. buildHammer(element: HTMLElement): HammerInstance;
  548. static ɵfac: i0.ɵɵFactoryDeclaration<HammerGestureConfig, never>;
  549. static ɵprov: i0.ɵɵInjectableDeclaration<HammerGestureConfig>;
  550. }
  551. /**
  552. * Event plugin that adds Hammer support to an application.
  553. *
  554. * @ngModule HammerModule
  555. */
  556. declare class HammerGesturesPlugin extends EventManagerPlugin {
  557. private _config;
  558. private _injector;
  559. private loader?;
  560. private _loaderPromise;
  561. constructor(doc: any, _config: HammerGestureConfig, _injector: Injector, loader?: (HammerLoader | null) | undefined);
  562. supports(eventName: string): boolean;
  563. addEventListener(element: HTMLElement, eventName: string, handler: Function): Function;
  564. isCustomEvent(eventName: string): boolean;
  565. static ɵfac: i0.ɵɵFactoryDeclaration<HammerGesturesPlugin, [null, null, null, { optional: true; }]>;
  566. static ɵprov: i0.ɵɵInjectableDeclaration<HammerGesturesPlugin>;
  567. }
  568. /**
  569. * Adds support for HammerJS.
  570. *
  571. * Import this module at the root of your application so that Angular can work with
  572. * HammerJS to detect gesture events.
  573. *
  574. * Note that applications still need to include the HammerJS script itself. This module
  575. * simply sets up the coordination layer between HammerJS and Angular's `EventManager`.
  576. *
  577. * @publicApi
  578. */
  579. declare class HammerModule {
  580. static ɵfac: i0.ɵɵFactoryDeclaration<HammerModule, never>;
  581. static ɵmod: i0.ɵɵNgModuleDeclaration<HammerModule, never, never, never>;
  582. static ɵinj: i0.ɵɵInjectorDeclaration<HammerModule>;
  583. }
  584. /**
  585. * Marker interface for a value that's safe to use in a particular context.
  586. *
  587. * @publicApi
  588. */
  589. interface SafeValue {
  590. }
  591. /**
  592. * Marker interface for a value that's safe to use as HTML.
  593. *
  594. * @publicApi
  595. */
  596. interface SafeHtml extends SafeValue {
  597. }
  598. /**
  599. * Marker interface for a value that's safe to use as style (CSS).
  600. *
  601. * @publicApi
  602. */
  603. interface SafeStyle extends SafeValue {
  604. }
  605. /**
  606. * Marker interface for a value that's safe to use as JavaScript.
  607. *
  608. * @publicApi
  609. */
  610. interface SafeScript extends SafeValue {
  611. }
  612. /**
  613. * Marker interface for a value that's safe to use as a URL linking to a document.
  614. *
  615. * @publicApi
  616. */
  617. interface SafeUrl extends SafeValue {
  618. }
  619. /**
  620. * Marker interface for a value that's safe to use as a URL to load executable code from.
  621. *
  622. * @publicApi
  623. */
  624. interface SafeResourceUrl extends SafeValue {
  625. }
  626. /**
  627. * DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing
  628. * values to be safe to use in the different DOM contexts.
  629. *
  630. * For example, when binding a URL in an `<a [href]="someValue">` hyperlink, `someValue` will be
  631. * sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on
  632. * the website.
  633. *
  634. * In specific situations, it might be necessary to disable sanitization, for example if the
  635. * application genuinely needs to produce a `javascript:` style link with a dynamic value in it.
  636. * Users can bypass security by constructing a value with one of the `bypassSecurityTrust...`
  637. * methods, and then binding to that value from the template.
  638. *
  639. * These situations should be very rare, and extraordinary care must be taken to avoid creating a
  640. * Cross Site Scripting (XSS) security bug!
  641. *
  642. * When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as
  643. * close as possible to the source of the value, to make it easy to verify no security bug is
  644. * created by its use.
  645. *
  646. * It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that
  647. * does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous
  648. * code. The sanitizer leaves safe values intact.
  649. *
  650. * @security Calling any of the `bypassSecurityTrust...` APIs disables Angular's built-in
  651. * sanitization for the value passed in. Carefully check and audit all values and code paths going
  652. * into this call. Make sure any user data is appropriately escaped for this security context.
  653. * For more detail, see the [Security Guide](https://g.co/ng/security).
  654. *
  655. * @publicApi
  656. */
  657. declare abstract class DomSanitizer implements Sanitizer {
  658. /**
  659. * Gets a safe value from either a known safe value or a value with unknown safety.
  660. *
  661. * If the given value is already a `SafeValue`, this method returns the unwrapped value.
  662. * If the security context is HTML and the given value is a plain string, this method
  663. * sanitizes the string, removing any potentially unsafe content.
  664. * For any other security context, this method throws an error if provided
  665. * with a plain string.
  666. */
  667. abstract sanitize(context: SecurityContext, value: SafeValue | string | null): string | null;
  668. /**
  669. * Bypass security and trust the given value to be safe HTML. Only use this when the bound HTML
  670. * is unsafe (e.g. contains `<script>` tags) and the code should be executed. The sanitizer will
  671. * leave safe HTML intact, so in most situations this method should not be used.
  672. *
  673. * **WARNING:** calling this method with untrusted user data exposes your application to XSS
  674. * security risks!
  675. */
  676. abstract bypassSecurityTrustHtml(value: string): SafeHtml;
  677. /**
  678. * Bypass security and trust the given value to be safe style value (CSS).
  679. *
  680. * **WARNING:** calling this method with untrusted user data exposes your application to XSS
  681. * security risks!
  682. */
  683. abstract bypassSecurityTrustStyle(value: string): SafeStyle;
  684. /**
  685. * Bypass security and trust the given value to be safe JavaScript.
  686. *
  687. * **WARNING:** calling this method with untrusted user data exposes your application to XSS
  688. * security risks!
  689. */
  690. abstract bypassSecurityTrustScript(value: string): SafeScript;
  691. /**
  692. * Bypass security and trust the given value to be a safe style URL, i.e. a value that can be used
  693. * in hyperlinks or `<img src>`.
  694. *
  695. * **WARNING:** calling this method with untrusted user data exposes your application to XSS
  696. * security risks!
  697. */
  698. abstract bypassSecurityTrustUrl(value: string): SafeUrl;
  699. /**
  700. * Bypass security and trust the given value to be a safe resource URL, i.e. a location that may
  701. * be used to load executable code from, like `<script src>`, or `<iframe src>`.
  702. *
  703. * **WARNING:** calling this method with untrusted user data exposes your application to XSS
  704. * security risks!
  705. */
  706. abstract bypassSecurityTrustResourceUrl(value: string): SafeResourceUrl;
  707. static ɵfac: i0.ɵɵFactoryDeclaration<DomSanitizer, never>;
  708. static ɵprov: i0.ɵɵInjectableDeclaration<DomSanitizer>;
  709. }
  710. declare class DomSanitizerImpl extends DomSanitizer {
  711. private _doc;
  712. constructor(_doc: any);
  713. sanitize(ctx: SecurityContext, value: SafeValue | string | null): string | null;
  714. bypassSecurityTrustHtml(value: string): SafeHtml;
  715. bypassSecurityTrustStyle(value: string): SafeStyle;
  716. bypassSecurityTrustScript(value: string): SafeScript;
  717. bypassSecurityTrustUrl(value: string): SafeUrl;
  718. bypassSecurityTrustResourceUrl(value: string): SafeResourceUrl;
  719. static ɵfac: i0.ɵɵFactoryDeclaration<DomSanitizerImpl, never>;
  720. static ɵprov: i0.ɵɵInjectableDeclaration<DomSanitizerImpl>;
  721. }
  722. /**
  723. * The list of features as an enum to uniquely type each `HydrationFeature`.
  724. * @see {@link HydrationFeature}
  725. *
  726. * @publicApi
  727. */
  728. declare enum HydrationFeatureKind {
  729. NoHttpTransferCache = 0,
  730. HttpTransferCacheOptions = 1,
  731. I18nSupport = 2,
  732. EventReplay = 3,
  733. IncrementalHydration = 4
  734. }
  735. /**
  736. * Helper type to represent a Hydration feature.
  737. *
  738. * @publicApi
  739. */
  740. interface HydrationFeature<FeatureKind extends HydrationFeatureKind> {
  741. ɵkind: FeatureKind;
  742. ɵproviders: Provider[];
  743. }
  744. /**
  745. * Disables HTTP transfer cache. Effectively causes HTTP requests to be performed twice: once on the
  746. * server and other one on the browser.
  747. *
  748. * @publicApi
  749. */
  750. declare function withNoHttpTransferCache(): HydrationFeature<HydrationFeatureKind.NoHttpTransferCache>;
  751. /**
  752. * The function accepts an object, which allows to configure cache parameters,
  753. * such as which headers should be included (no headers are included by default),
  754. * whether POST requests should be cached or a callback function to determine if a
  755. * particular request should be cached.
  756. *
  757. * @publicApi
  758. */
  759. declare function withHttpTransferCacheOptions(options: HttpTransferCacheOptions): HydrationFeature<HydrationFeatureKind.HttpTransferCacheOptions>;
  760. /**
  761. * Enables support for hydrating i18n blocks.
  762. *
  763. * @developerPreview
  764. * @publicApi
  765. */
  766. declare function withI18nSupport(): HydrationFeature<HydrationFeatureKind.I18nSupport>;
  767. /**
  768. * Enables support for replaying user events (e.g. `click`s) that happened on a page
  769. * before hydration logic has completed. Once an application is hydrated, all captured
  770. * events are replayed and relevant event listeners are executed.
  771. *
  772. * @usageNotes
  773. *
  774. * Basic example of how you can enable event replay in your application when
  775. * `bootstrapApplication` function is used:
  776. * ```ts
  777. * bootstrapApplication(AppComponent, {
  778. * providers: [provideClientHydration(withEventReplay())]
  779. * });
  780. * ```
  781. * @publicApi
  782. * @see {@link provideClientHydration}
  783. */
  784. declare function withEventReplay(): HydrationFeature<HydrationFeatureKind.EventReplay>;
  785. /**
  786. * Enables support for incremental hydration using the `hydrate` trigger syntax.
  787. *
  788. * @usageNotes
  789. *
  790. * Basic example of how you can enable incremental hydration in your application when
  791. * the `bootstrapApplication` function is used:
  792. * ```ts
  793. * bootstrapApplication(AppComponent, {
  794. * providers: [provideClientHydration(withIncrementalHydration())]
  795. * });
  796. * ```
  797. * @experimental
  798. * @publicApi
  799. * @see {@link provideClientHydration}
  800. */
  801. declare function withIncrementalHydration(): HydrationFeature<HydrationFeatureKind.IncrementalHydration>;
  802. /**
  803. * Sets up providers necessary to enable hydration functionality for the application.
  804. *
  805. * By default, the function enables the recommended set of features for the optimal
  806. * performance for most of the applications. It includes the following features:
  807. *
  808. * * Reconciling DOM hydration. Learn more about it [here](guide/hydration).
  809. * * [`HttpClient`](api/common/http/HttpClient) response caching while running on the server and
  810. * transferring this cache to the client to avoid extra HTTP requests. Learn more about data caching
  811. * [here](guide/ssr#caching-data-when-using-httpclient).
  812. *
  813. * These functions allow you to disable some of the default features or enable new ones:
  814. *
  815. * * {@link withNoHttpTransferCache} to disable HTTP transfer cache
  816. * * {@link withHttpTransferCacheOptions} to configure some HTTP transfer cache options
  817. * * {@link withI18nSupport} to enable hydration support for i18n blocks
  818. * * {@link withEventReplay} to enable support for replaying user events
  819. *
  820. * @usageNotes
  821. *
  822. * Basic example of how you can enable hydration in your application when
  823. * `bootstrapApplication` function is used:
  824. * ```ts
  825. * bootstrapApplication(AppComponent, {
  826. * providers: [provideClientHydration()]
  827. * });
  828. * ```
  829. *
  830. * Alternatively if you are using NgModules, you would add `provideClientHydration`
  831. * to your root app module's provider list.
  832. * ```ts
  833. * @NgModule({
  834. * declarations: [RootCmp],
  835. * bootstrap: [RootCmp],
  836. * providers: [provideClientHydration()],
  837. * })
  838. * export class AppModule {}
  839. * ```
  840. *
  841. * @see {@link withNoHttpTransferCache}
  842. * @see {@link withHttpTransferCacheOptions}
  843. * @see {@link withI18nSupport}
  844. * @see {@link withEventReplay}
  845. *
  846. * @param features Optional features to configure additional hydration behaviors.
  847. * @returns A set of providers to enable hydration.
  848. *
  849. * @publicApi
  850. */
  851. declare function provideClientHydration(...features: HydrationFeature<HydrationFeatureKind>[]): EnvironmentProviders;
  852. /**
  853. * Provides DOM operations in any browser environment.
  854. *
  855. * @security Tread carefully! Interacting with the DOM directly is dangerous and
  856. * can introduce XSS risks.
  857. */
  858. declare abstract class GenericBrowserDomAdapter extends _DomAdapter {
  859. readonly supportsDOMEvents: boolean;
  860. }
  861. /**
  862. * A `DomAdapter` powered by full browser DOM APIs.
  863. *
  864. * @security Tread carefully! Interacting with the DOM directly is dangerous and
  865. * can introduce XSS risks.
  866. */
  867. declare class BrowserDomAdapter extends GenericBrowserDomAdapter {
  868. static makeCurrent(): void;
  869. onAndCancel(el: Node, evt: any, listener: any, options: any): Function;
  870. dispatchEvent(el: Node, evt: any): void;
  871. remove(node: Node): void;
  872. createElement(tagName: string, doc?: Document): HTMLElement;
  873. createHtmlDocument(): Document;
  874. getDefaultDocument(): Document;
  875. isElementNode(node: Node): boolean;
  876. isShadowRoot(node: any): boolean;
  877. /** @deprecated No longer being used in Ivy code. To be removed in version 14. */
  878. getGlobalEventTarget(doc: Document, target: string): EventTarget | null;
  879. getBaseHref(doc: Document): string | null;
  880. resetBaseElement(): void;
  881. getUserAgent(): string;
  882. getCookie(name: string): string | null;
  883. }
  884. declare class BrowserGetTestability implements GetTestability {
  885. addToWindow(registry: TestabilityRegistry): void;
  886. findTestabilityInTree(registry: TestabilityRegistry, elem: any, findInAncestors: boolean): Testability | null;
  887. }
  888. declare class DomEventsPlugin extends EventManagerPlugin {
  889. constructor(doc: any);
  890. supports(eventName: string): boolean;
  891. addEventListener(element: HTMLElement, eventName: string, handler: Function, options?: ListenerOptions): Function;
  892. removeEventListener(target: any, eventName: string, callback: Function, options?: ListenerOptions): void;
  893. static ɵfac: i0.ɵɵFactoryDeclaration<DomEventsPlugin, never>;
  894. static ɵprov: i0.ɵɵInjectableDeclaration<DomEventsPlugin>;
  895. }
  896. /**
  897. * A browser plug-in that provides support for handling of key events in Angular.
  898. */
  899. declare class KeyEventsPlugin extends EventManagerPlugin {
  900. /**
  901. * Initializes an instance of the browser plug-in.
  902. * @param doc The document in which key events will be detected.
  903. */
  904. constructor(doc: any);
  905. /**
  906. * Reports whether a named key event is supported.
  907. * @param eventName The event name to query.
  908. * @return True if the named key event is supported.
  909. */
  910. supports(eventName: string): boolean;
  911. /**
  912. * Registers a handler for a specific element and key event.
  913. * @param element The HTML element to receive event notifications.
  914. * @param eventName The name of the key event to listen for.
  915. * @param handler A function to call when the notification occurs. Receives the
  916. * event object as an argument.
  917. * @returns The key event that was registered.
  918. */
  919. addEventListener(element: HTMLElement, eventName: string, handler: Function, options?: ListenerOptions): Function;
  920. /**
  921. * Parses the user provided full keyboard event definition and normalizes it for
  922. * later internal use. It ensures the string is all lowercase, converts special
  923. * characters to a standard spelling, and orders all the values consistently.
  924. *
  925. * @param eventName The name of the key event to listen for.
  926. * @returns an object with the full, normalized string, and the dom event name
  927. * or null in the case when the event doesn't match a keyboard event.
  928. */
  929. static parseEventName(eventName: string): {
  930. fullKey: string;
  931. domEventName: string;
  932. } | null;
  933. /**
  934. * Determines whether the actual keys pressed match the configured key code string.
  935. * The `fullKeyCode` event is normalized in the `parseEventName` method when the
  936. * event is attached to the DOM during the `addEventListener` call. This is unseen
  937. * by the end user and is normalized for internal consistency and parsing.
  938. *
  939. * @param event The keyboard event.
  940. * @param fullKeyCode The normalized user defined expected key event string
  941. * @returns boolean.
  942. */
  943. static matchEventFullKeyCode(event: KeyboardEvent, fullKeyCode: string): boolean;
  944. /**
  945. * Configures a handler callback for a key event.
  946. * @param fullKey The event name that combines all simultaneous keystrokes.
  947. * @param handler The function that responds to the key event.
  948. * @param zone The zone in which the event occurred.
  949. * @returns A callback function.
  950. */
  951. static eventCallback(fullKey: string, handler: Function, zone: NgZone): Function;
  952. static ɵfac: i0.ɵɵFactoryDeclaration<KeyEventsPlugin, never>;
  953. static ɵprov: i0.ɵɵInjectableDeclaration<KeyEventsPlugin>;
  954. }
  955. /**
  956. * The list of error codes used in runtime code of the `platform-browser` package.
  957. * Reserved error code range: 5000-5500.
  958. */
  959. declare const enum RuntimeErrorCode {
  960. UNSUPPORTED_ZONEJS_INSTANCE = -5000,
  961. BROWSER_MODULE_ALREADY_LOADED = 5100,
  962. NO_PLUGIN_FOR_EVENT = 5101,
  963. UNSUPPORTED_EVENT_TARGET = 5102,
  964. TESTABILITY_NOT_FOUND = 5103,
  965. ROOT_NODE_NOT_FOUND = -5104,
  966. UNEXPECTED_SYNTHETIC_PROPERTY = 5105,
  967. SANITIZATION_UNSAFE_SCRIPT = 5200,
  968. SANITIZATION_UNSAFE_RESOURCE_URL = 5201,
  969. SANITIZATION_UNEXPECTED_CTX = 5202,
  970. ANIMATION_RENDERER_ASYNC_LOADING_FAILURE = 5300
  971. }
  972. /**
  973. * @module
  974. * @description
  975. * Entry point for all public APIs of the platform-browser package.
  976. */
  977. /**
  978. * @publicApi
  979. */
  980. declare const VERSION: Version;
  981. export { type ApplicationConfig, BrowserModule, By, DomSanitizer, EVENT_MANAGER_PLUGINS, EventManager, EventManagerPlugin, HAMMER_GESTURE_CONFIG, HAMMER_LOADER, HammerGestureConfig, type HammerLoader, HammerModule, type HydrationFeature, HydrationFeatureKind, Meta, type MetaDefinition, REMOVE_STYLES_ON_COMPONENT_DESTROY, type SafeHtml, type SafeResourceUrl, type SafeScript, type SafeStyle, type SafeUrl, type SafeValue, Title, VERSION, bootstrapApplication, createApplication, disableDebugTools, enableDebugTools, platformBrowser, provideClientHydration, provideProtractorTestingSupport, withEventReplay, withHttpTransferCacheOptions, withI18nSupport, withIncrementalHydration, withNoHttpTransferCache, BrowserDomAdapter as ɵBrowserDomAdapter, BrowserGetTestability as ɵBrowserGetTestability, DomEventsPlugin as ɵDomEventsPlugin, DomRendererFactory2 as ɵDomRendererFactory2, DomSanitizerImpl as ɵDomSanitizerImpl, HammerGesturesPlugin as ɵHammerGesturesPlugin, KeyEventsPlugin as ɵKeyEventsPlugin, RuntimeErrorCode as ɵRuntimeErrorCode, SharedStylesHost as ɵSharedStylesHost };