index.d.ts 34 KB

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