index.d.ts 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237
  1. /**
  2. * @license Angular v19.2.13
  3. * (c) 2010-2025 Google LLC. https://angular.io/
  4. * License: MIT
  5. */
  6. import * as i0 from '@angular/core';
  7. import { ɵNavigation as _Navigation, ɵNavigationHistoryEntry as _NavigationHistoryEntry, ɵNavigationUpdateCurrentEntryOptions as _NavigationUpdateCurrentEntryOptions, ɵNavigationTransition as _NavigationTransition, ɵNavigationNavigateOptions as _NavigationNavigateOptions, ɵNavigationResult as _NavigationResult, ɵNavigationReloadOptions as _NavigationReloadOptions, ɵNavigationOptions as _NavigationOptions, ɵNavigateEvent as _NavigateEvent, ɵNavigationCurrentEntryChangeEvent as _NavigationCurrentEntryChangeEvent, OnDestroy, InjectionToken, Version, Provider, OnInit, OnChanges, SimpleChanges } from '@angular/core';
  8. export { ɵIMAGE_CONFIG as IMAGE_CONFIG, ɵImageConfig as ImageConfig } from '@angular/core';
  9. import { LocationStrategy } from './common_module.d-NEF7UaHr.js';
  10. export { APP_BASE_HREF, AsyncPipe, CommonModule, CurrencyPipe, DATE_PIPE_DEFAULT_OPTIONS, DATE_PIPE_DEFAULT_TIMEZONE, DatePipe, DatePipeConfig, DecimalPipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, KeyValue, KeyValuePipe, Location, LowerCasePipe, NgClass, NgComponentOutlet, NgForOf as NgFor, NgForOf, NgForOfContext, NgIf, NgIfContext, NgLocaleLocalization, NgLocalization, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet, PathLocationStrategy, PercentPipe, PopStateEvent, SlicePipe, TitleCasePipe, UpperCasePipe } from './common_module.d-NEF7UaHr.js';
  11. import { PlatformLocation, LocationChangeListener } from './platform_location.d-Lbv6Ueec.js';
  12. export { BrowserPlatformLocation, LOCATION_INITIALIZED, LocationChangeEvent } from './platform_location.d-Lbv6Ueec.js';
  13. export { XhrFactory } from './xhr.d-D_1kTQR5.js';
  14. import 'rxjs';
  15. declare function getDOM(): DomAdapter;
  16. declare function setRootDomAdapter(adapter: DomAdapter): void;
  17. /**
  18. * Provides DOM operations in an environment-agnostic way.
  19. *
  20. * @security Tread carefully! Interacting with the DOM directly is dangerous and
  21. * can introduce XSS risks.
  22. */
  23. declare abstract class DomAdapter {
  24. abstract dispatchEvent(el: any, evt: any): any;
  25. abstract readonly supportsDOMEvents: boolean;
  26. abstract remove(el: any): void;
  27. abstract createElement(tagName: any, doc?: any): HTMLElement;
  28. abstract createHtmlDocument(): Document;
  29. abstract getDefaultDocument(): Document;
  30. abstract isElementNode(node: any): boolean;
  31. abstract isShadowRoot(node: any): boolean;
  32. abstract onAndCancel(el: any, evt: any, listener: any, options?: any): Function;
  33. abstract getGlobalEventTarget(doc: Document, target: string): any;
  34. abstract getBaseHref(doc: Document): string | null;
  35. abstract resetBaseElement(): void;
  36. abstract getUserAgent(): string;
  37. abstract getCookie(name: string): string | null;
  38. }
  39. /**
  40. * This class wraps the platform Navigation API which allows server-specific and test
  41. * implementations.
  42. */
  43. declare abstract class PlatformNavigation implements _Navigation {
  44. abstract entries(): _NavigationHistoryEntry[];
  45. abstract currentEntry: _NavigationHistoryEntry | null;
  46. abstract updateCurrentEntry(options: _NavigationUpdateCurrentEntryOptions): void;
  47. abstract transition: _NavigationTransition | null;
  48. abstract canGoBack: boolean;
  49. abstract canGoForward: boolean;
  50. abstract navigate(url: string, options?: _NavigationNavigateOptions | undefined): _NavigationResult;
  51. abstract reload(options?: _NavigationReloadOptions | undefined): _NavigationResult;
  52. abstract traverseTo(key: string, options?: _NavigationOptions | undefined): _NavigationResult;
  53. abstract back(options?: _NavigationOptions | undefined): _NavigationResult;
  54. abstract forward(options?: _NavigationOptions | undefined): _NavigationResult;
  55. abstract onnavigate: ((this: _Navigation, ev: _NavigateEvent) => any) | null;
  56. abstract onnavigatesuccess: ((this: _Navigation, ev: Event) => any) | null;
  57. abstract onnavigateerror: ((this: _Navigation, ev: ErrorEvent) => any) | null;
  58. abstract oncurrententrychange: ((this: _Navigation, ev: _NavigationCurrentEntryChangeEvent) => any) | null;
  59. abstract addEventListener(type: unknown, listener: unknown, options?: unknown): void;
  60. abstract removeEventListener(type: unknown, listener: unknown, options?: unknown): void;
  61. abstract dispatchEvent(event: Event): boolean;
  62. static ɵfac: i0.ɵɵFactoryDeclaration<PlatformNavigation, never>;
  63. static ɵprov: i0.ɵɵInjectableDeclaration<PlatformNavigation>;
  64. }
  65. /**
  66. * @description
  67. * A {@link LocationStrategy} used to configure the {@link Location} service to
  68. * represent its state in the
  69. * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax)
  70. * of the browser's URL.
  71. *
  72. * For instance, if you call `location.go('/foo')`, the browser's URL will become
  73. * `example.com#/foo`.
  74. *
  75. * @usageNotes
  76. *
  77. * ### Example
  78. *
  79. * {@example common/location/ts/hash_location_component.ts region='LocationComponent'}
  80. *
  81. * @publicApi
  82. */
  83. declare class HashLocationStrategy extends LocationStrategy implements OnDestroy {
  84. private _platformLocation;
  85. private _baseHref;
  86. private _removeListenerFns;
  87. constructor(_platformLocation: PlatformLocation, _baseHref?: string);
  88. /** @docs-private */
  89. ngOnDestroy(): void;
  90. onPopState(fn: LocationChangeListener): void;
  91. getBaseHref(): string;
  92. path(includeHash?: boolean): string;
  93. prepareExternalUrl(internal: string): string;
  94. pushState(state: any, title: string, path: string, queryParams: string): void;
  95. replaceState(state: any, title: string, path: string, queryParams: string): void;
  96. forward(): void;
  97. back(): void;
  98. getState(): unknown;
  99. historyGo(relativePosition?: number): void;
  100. static ɵfac: i0.ɵɵFactoryDeclaration<HashLocationStrategy, [null, { optional: true; }]>;
  101. static ɵprov: i0.ɵɵInjectableDeclaration<HashLocationStrategy>;
  102. }
  103. /**
  104. * @ngModule CommonModule
  105. * @description
  106. *
  107. * Formats a date according to locale rules.
  108. *
  109. * @param value The date to format, as a Date, or a number (milliseconds since UTC epoch)
  110. * or an [ISO date-time string](https://www.w3.org/TR/NOTE-datetime).
  111. * @param format The date-time components to include. See `DatePipe` for details.
  112. * @param locale A locale code for the locale format rules to use.
  113. * @param timezone The time zone. A time zone offset from GMT (such as `'+0430'`).
  114. * If not specified, uses host system settings.
  115. *
  116. * @returns The formatted date string.
  117. *
  118. * @see {@link DatePipe}
  119. * @see [Internationalization (i18n) Guide](guide/i18n)
  120. *
  121. * @publicApi
  122. */
  123. declare function formatDate(value: string | number | Date, format: string, locale: string, timezone?: string): string;
  124. /**
  125. * @ngModule CommonModule
  126. * @description
  127. *
  128. * Formats a number as currency using locale rules.
  129. *
  130. * @param value The number to format.
  131. * @param locale A locale code for the locale format rules to use.
  132. * @param currency A string containing the currency symbol or its name,
  133. * such as "$" or "Canadian Dollar". Used in output string, but does not affect the operation
  134. * of the function.
  135. * @param currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)
  136. * currency code, such as `USD` for the US dollar and `EUR` for the euro.
  137. * Used to determine the number of digits in the decimal part.
  138. * @param digitsInfo Decimal representation options, specified by a string in the following format:
  139. * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details.
  140. *
  141. * @returns The formatted currency value.
  142. *
  143. * @see {@link formatNumber}
  144. * @see {@link DecimalPipe}
  145. * @see [Internationalization (i18n) Guide](guide/i18n)
  146. *
  147. * @publicApi
  148. */
  149. declare function formatCurrency(value: number, locale: string, currency: string, currencyCode?: string, digitsInfo?: string): string;
  150. /**
  151. * @ngModule CommonModule
  152. * @description
  153. *
  154. * Formats a number as a percentage according to locale rules.
  155. *
  156. * @param value The number to format.
  157. * @param locale A locale code for the locale format rules to use.
  158. * @param digitsInfo Decimal representation options, specified by a string in the following format:
  159. * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details.
  160. *
  161. * @returns The formatted percentage value.
  162. *
  163. * @see {@link formatNumber}
  164. * @see {@link DecimalPipe}
  165. * @see [Internationalization (i18n) Guide](guide/i18n)
  166. * @publicApi
  167. *
  168. */
  169. declare function formatPercent(value: number, locale: string, digitsInfo?: string): string;
  170. /**
  171. * @ngModule CommonModule
  172. * @description
  173. *
  174. * Formats a number as text, with group sizing, separator, and other
  175. * parameters based on the locale.
  176. *
  177. * @param value The number to format.
  178. * @param locale A locale code for the locale format rules to use.
  179. * @param digitsInfo Decimal representation options, specified by a string in the following format:
  180. * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details.
  181. *
  182. * @returns The formatted text string.
  183. * @see [Internationalization (i18n) Guide](guide/i18n)
  184. *
  185. * @publicApi
  186. */
  187. declare function formatNumber(value: number, locale: string, digitsInfo?: string): string;
  188. /**
  189. * Register global data to be used internally by Angular. See the
  190. * ["I18n guide"](guide/i18n/format-data-locale) to know how to import additional locale
  191. * data.
  192. *
  193. * The signature registerLocaleData(data: any, extraData?: any) is deprecated since v5.1
  194. *
  195. * @publicApi
  196. */
  197. declare function registerLocaleData(data: any, localeId?: string | any, extraData?: any): void;
  198. /**
  199. * Format styles that can be used to represent numbers.
  200. * @see {@link getLocaleNumberFormat}
  201. * @see [Internationalization (i18n) Guide](guide/i18n)
  202. *
  203. * @publicApi
  204. *
  205. * @deprecated `getLocaleNumberFormat` is deprecated
  206. */
  207. declare enum NumberFormatStyle {
  208. Decimal = 0,
  209. Percent = 1,
  210. Currency = 2,
  211. Scientific = 3
  212. }
  213. /**
  214. * Plurality cases used for translating plurals to different languages.
  215. *
  216. * @see {@link NgPlural}
  217. * @see {@link NgPluralCase}
  218. * @see [Internationalization (i18n) Guide](guide/i18n)
  219. *
  220. * @publicApi
  221. *
  222. * @deprecated `getLocalePluralCase` is deprecated
  223. */
  224. declare enum Plural {
  225. Zero = 0,
  226. One = 1,
  227. Two = 2,
  228. Few = 3,
  229. Many = 4,
  230. Other = 5
  231. }
  232. /**
  233. * Context-dependant translation forms for strings.
  234. * Typically the standalone version is for the nominative form of the word,
  235. * and the format version is used for the genitive case.
  236. * @see [CLDR website](http://cldr.unicode.org/translation/date-time-1/date-time#TOC-Standalone-vs.-Format-Styles)
  237. * @see [Internationalization (i18n) Guide](guide/i18n)
  238. *
  239. * @publicApi
  240. *
  241. * @deprecated locale data getters are deprecated
  242. */
  243. declare enum FormStyle {
  244. Format = 0,
  245. Standalone = 1
  246. }
  247. /**
  248. * String widths available for translations.
  249. * The specific character widths are locale-specific.
  250. * Examples are given for the word "Sunday" in English.
  251. *
  252. * @publicApi
  253. *
  254. * @deprecated locale data getters are deprecated
  255. */
  256. declare enum TranslationWidth {
  257. /** 1 character for `en-US`. For example: 'S' */
  258. Narrow = 0,
  259. /** 3 characters for `en-US`. For example: 'Sun' */
  260. Abbreviated = 1,
  261. /** Full length for `en-US`. For example: "Sunday" */
  262. Wide = 2,
  263. /** 2 characters for `en-US`, For example: "Su" */
  264. Short = 3
  265. }
  266. /**
  267. * String widths available for date-time formats.
  268. * The specific character widths are locale-specific.
  269. * Examples are given for `en-US`.
  270. *
  271. * @see {@link getLocaleDateFormat}
  272. * @see {@link getLocaleTimeFormat}
  273. * @see {@link getLocaleDateTimeFormat}
  274. * @see [Internationalization (i18n) Guide](guide/i18n)
  275. * @publicApi
  276. *
  277. * @deprecated Date locale data getters are deprecated
  278. */
  279. declare enum FormatWidth {
  280. /**
  281. * For `en-US`, `'M/d/yy, h:mm a'`
  282. * (Example: `6/15/15, 9:03 AM`)
  283. */
  284. Short = 0,
  285. /**
  286. * For `en-US`, `'MMM d, y, h:mm:ss a'`
  287. * (Example: `Jun 15, 2015, 9:03:01 AM`)
  288. */
  289. Medium = 1,
  290. /**
  291. * For `en-US`, `'MMMM d, y, h:mm:ss a z'`
  292. * (Example: `June 15, 2015 at 9:03:01 AM GMT+1`)
  293. */
  294. Long = 2,
  295. /**
  296. * For `en-US`, `'EEEE, MMMM d, y, h:mm:ss a zzzz'`
  297. * (Example: `Monday, June 15, 2015 at 9:03:01 AM GMT+01:00`)
  298. */
  299. Full = 3
  300. }
  301. /**
  302. * Symbols that can be used to replace placeholders in number patterns.
  303. * Examples are based on `en-US` values.
  304. *
  305. * @see {@link getLocaleNumberSymbol}
  306. * @see [Internationalization (i18n) Guide](guide/i18n)
  307. *
  308. * @publicApi
  309. *
  310. * @deprecated `getLocaleNumberSymbol` is deprecated
  311. *
  312. * @object-literal-as-enum
  313. */
  314. declare const NumberSymbol: {
  315. /**
  316. * Decimal separator.
  317. * For `en-US`, the dot character.
  318. * Example: 2,345`.`67
  319. */
  320. readonly Decimal: 0;
  321. /**
  322. * Grouping separator, typically for thousands.
  323. * For `en-US`, the comma character.
  324. * Example: 2`,`345.67
  325. */
  326. readonly Group: 1;
  327. /**
  328. * List-item separator.
  329. * Example: "one, two, and three"
  330. */
  331. readonly List: 2;
  332. /**
  333. * Sign for percentage (out of 100).
  334. * Example: 23.4%
  335. */
  336. readonly PercentSign: 3;
  337. /**
  338. * Sign for positive numbers.
  339. * Example: +23
  340. */
  341. readonly PlusSign: 4;
  342. /**
  343. * Sign for negative numbers.
  344. * Example: -23
  345. */
  346. readonly MinusSign: 5;
  347. /**
  348. * Computer notation for exponential value (n times a power of 10).
  349. * Example: 1.2E3
  350. */
  351. readonly Exponential: 6;
  352. /**
  353. * Human-readable format of exponential.
  354. * Example: 1.2x103
  355. */
  356. readonly SuperscriptingExponent: 7;
  357. /**
  358. * Sign for permille (out of 1000).
  359. * Example: 23.4‰
  360. */
  361. readonly PerMille: 8;
  362. /**
  363. * Infinity, can be used with plus and minus.
  364. * Example: ∞, +∞, -∞
  365. */
  366. readonly Infinity: 9;
  367. /**
  368. * Not a number.
  369. * Example: NaN
  370. */
  371. readonly NaN: 10;
  372. /**
  373. * Symbol used between time units.
  374. * Example: 10:52
  375. */
  376. readonly TimeSeparator: 11;
  377. /**
  378. * Decimal separator for currency values (fallback to `Decimal`).
  379. * Example: $2,345.67
  380. */
  381. readonly CurrencyDecimal: 12;
  382. /**
  383. * Group separator for currency values (fallback to `Group`).
  384. * Example: $2,345.67
  385. */
  386. readonly CurrencyGroup: 13;
  387. };
  388. type NumberSymbol = (typeof NumberSymbol)[keyof typeof NumberSymbol];
  389. /**
  390. * The value for each day of the week, based on the `en-US` locale
  391. *
  392. * @publicApi
  393. *
  394. * @deprecated Week locale getters are deprecated
  395. */
  396. declare enum WeekDay {
  397. Sunday = 0,
  398. Monday = 1,
  399. Tuesday = 2,
  400. Wednesday = 3,
  401. Thursday = 4,
  402. Friday = 5,
  403. Saturday = 6
  404. }
  405. /**
  406. * Retrieves the locale ID from the currently loaded locale.
  407. * The loaded locale could be, for example, a global one rather than a regional one.
  408. * @param locale A locale code, such as `fr-FR`.
  409. * @returns The locale code. For example, `fr`.
  410. * @see [Internationalization (i18n) Guide](guide/i18n)
  411. *
  412. * @publicApi
  413. *
  414. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  415. * This function serves no purpose when relying on the `Intl` API.
  416. */
  417. declare function getLocaleId(locale: string): string;
  418. /**
  419. * Retrieves day period strings for the given locale.
  420. *
  421. * @param locale A locale code for the locale format rules to use.
  422. * @param formStyle The required grammatical form.
  423. * @param width The required character width.
  424. * @returns An array of localized period strings. For example, `[AM, PM]` for `en-US`.
  425. * @see [Internationalization (i18n) Guide](guide/i18n)
  426. *
  427. * @publicApi
  428. *
  429. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  430. * Use `Intl.DateTimeFormat` for date formating instead.
  431. */
  432. declare function getLocaleDayPeriods(locale: string, formStyle: FormStyle, width: TranslationWidth): Readonly<[string, string]>;
  433. /**
  434. * Retrieves days of the week for the given locale, using the Gregorian calendar.
  435. *
  436. * @param locale A locale code for the locale format rules to use.
  437. * @param formStyle The required grammatical form.
  438. * @param width The required character width.
  439. * @returns An array of localized name strings.
  440. * For example,`[Sunday, Monday, ... Saturday]` for `en-US`.
  441. * @see [Internationalization (i18n) Guide](guide/i18n)
  442. *
  443. * @publicApi
  444. *
  445. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  446. * Use `Intl.DateTimeFormat` for date formating instead.
  447. */
  448. declare function getLocaleDayNames(locale: string, formStyle: FormStyle, width: TranslationWidth): ReadonlyArray<string>;
  449. /**
  450. * Retrieves months of the year for the given locale, using the Gregorian calendar.
  451. *
  452. * @param locale A locale code for the locale format rules to use.
  453. * @param formStyle The required grammatical form.
  454. * @param width The required character width.
  455. * @returns An array of localized name strings.
  456. * For example, `[January, February, ...]` for `en-US`.
  457. * @see [Internationalization (i18n) Guide](guide/i18n)
  458. *
  459. * @publicApi
  460. *
  461. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  462. * Use `Intl.DateTimeFormat` for date formating instead.
  463. */
  464. declare function getLocaleMonthNames(locale: string, formStyle: FormStyle, width: TranslationWidth): ReadonlyArray<string>;
  465. /**
  466. * Retrieves Gregorian-calendar eras for the given locale.
  467. * @param locale A locale code for the locale format rules to use.
  468. * @param width The required character width.
  469. * @returns An array of localized era strings.
  470. * For example, `[AD, BC]` for `en-US`.
  471. * @see [Internationalization (i18n) Guide](guide/i18n)
  472. *
  473. * @publicApi
  474. *
  475. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  476. * Use `Intl.DateTimeFormat` for date formating instead.
  477. */
  478. declare function getLocaleEraNames(locale: string, width: TranslationWidth): Readonly<[string, string]>;
  479. /**
  480. * Retrieves the first day of the week for the given locale.
  481. *
  482. * @param locale A locale code for the locale format rules to use.
  483. * @returns A day index number, using the 0-based week-day index for `en-US`
  484. * (Sunday = 0, Monday = 1, ...).
  485. * For example, for `fr-FR`, returns 1 to indicate that the first day is Monday.
  486. * @see [Internationalization (i18n) Guide](guide/i18n)
  487. *
  488. * @publicApi
  489. *
  490. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  491. * Intl's [`getWeekInfo`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo) has partial support (Chromium M99 & Safari 17).
  492. * You may want to rely on the following alternatives:
  493. * - Libraries like [`Luxon`](https://moment.github.io/luxon/#/) rely on `Intl` but fallback on the ISO 8601 definition (monday) if `getWeekInfo` is not supported.
  494. * - Other librairies like [`date-fns`](https://date-fns.org/), [`day.js`](https://day.js.org/en/) or [`weekstart`](https://www.npmjs.com/package/weekstart) library provide their own locale based data for the first day of the week.
  495. */
  496. declare function getLocaleFirstDayOfWeek(locale: string): WeekDay;
  497. /**
  498. * Range of week days that are considered the week-end for the given locale.
  499. *
  500. * @param locale A locale code for the locale format rules to use.
  501. * @returns The range of day values, `[startDay, endDay]`.
  502. * @see [Internationalization (i18n) Guide](guide/i18n)
  503. *
  504. * @publicApi
  505. *
  506. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  507. * Intl's [`getWeekInfo`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo) has partial support (Chromium M99 & Safari 17).
  508. * Libraries like [`Luxon`](https://moment.github.io/luxon/#/) rely on `Intl` but fallback on the ISO 8601 definition (Saturday+Sunday) if `getWeekInfo` is not supported .
  509. */
  510. declare function getLocaleWeekEndRange(locale: string): [WeekDay, WeekDay];
  511. /**
  512. * Retrieves a localized date-value formatting string.
  513. *
  514. * @param locale A locale code for the locale format rules to use.
  515. * @param width The format type.
  516. * @returns The localized formatting string.
  517. * @see {@link FormatWidth}
  518. * @see [Internationalization (i18n) Guide](guide/i18n)
  519. *
  520. * @publicApi
  521. *
  522. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  523. * Use `Intl.DateTimeFormat` for date formating instead.
  524. */
  525. declare function getLocaleDateFormat(locale: string, width: FormatWidth): string;
  526. /**
  527. * Retrieves a localized time-value formatting string.
  528. *
  529. * @param locale A locale code for the locale format rules to use.
  530. * @param width The format type.
  531. * @returns The localized formatting string.
  532. * @see {@link FormatWidth}
  533. * @see [Internationalization (i18n) Guide](guide/i18n)
  534. * @publicApi
  535. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  536. * Use `Intl.DateTimeFormat` for date formating instead.
  537. */
  538. declare function getLocaleTimeFormat(locale: string, width: FormatWidth): string;
  539. /**
  540. * Retrieves a localized date-time formatting string.
  541. *
  542. * @param locale A locale code for the locale format rules to use.
  543. * @param width The format type.
  544. * @returns The localized formatting string.
  545. * @see {@link FormatWidth}
  546. * @see [Internationalization (i18n) Guide](guide/i18n)
  547. *
  548. * @publicApi
  549. *
  550. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  551. * Use `Intl.DateTimeFormat` for date formating instead.
  552. */
  553. declare function getLocaleDateTimeFormat(locale: string, width: FormatWidth): string;
  554. /**
  555. * Retrieves a localized number symbol that can be used to replace placeholders in number formats.
  556. * @param locale The locale code.
  557. * @param symbol The symbol to localize. Must be one of `NumberSymbol`.
  558. * @returns The character for the localized symbol.
  559. * @see {@link NumberSymbol}
  560. * @see [Internationalization (i18n) Guide](guide/i18n)
  561. *
  562. * @publicApi
  563. *
  564. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  565. * Use `Intl.NumberFormat` to format numbers instead.
  566. */
  567. declare function getLocaleNumberSymbol(locale: string, symbol: NumberSymbol): string;
  568. /**
  569. * Retrieves a number format for a given locale.
  570. *
  571. * Numbers are formatted using patterns, like `#,###.00`. For example, the pattern `#,###.00`
  572. * when used to format the number 12345.678 could result in "12'345,678". That would happen if the
  573. * grouping separator for your language is an apostrophe, and the decimal separator is a comma.
  574. *
  575. * <b>Important:</b> The characters `.` `,` `0` `#` (and others below) are special placeholders
  576. * that stand for the decimal separator, and so on, and are NOT real characters.
  577. * You must NOT "translate" the placeholders. For example, don't change `.` to `,` even though in
  578. * your language the decimal point is written with a comma. The symbols should be replaced by the
  579. * local equivalents, using the appropriate `NumberSymbol` for your language.
  580. *
  581. * Here are the special characters used in number patterns:
  582. *
  583. * | Symbol | Meaning |
  584. * |--------|---------|
  585. * | . | Replaced automatically by the character used for the decimal point. |
  586. * | , | Replaced by the "grouping" (thousands) separator. |
  587. * | 0 | Replaced by a digit (or zero if there aren't enough digits). |
  588. * | # | Replaced by a digit (or nothing if there aren't enough). |
  589. * | ¤ | Replaced by a currency symbol, such as $ or USD. |
  590. * | % | Marks a percent format. The % symbol may change position, but must be retained. |
  591. * | E | Marks a scientific format. The E symbol may change position, but must be retained. |
  592. * | ' | Special characters used as literal characters are quoted with ASCII single quotes. |
  593. *
  594. * @param locale A locale code for the locale format rules to use.
  595. * @param type The type of numeric value to be formatted (such as `Decimal` or `Currency`.)
  596. * @returns The localized format string.
  597. * @see {@link NumberFormatStyle}
  598. * @see [CLDR website](http://cldr.unicode.org/translation/number-patterns)
  599. * @see [Internationalization (i18n) Guide](guide/i18n)
  600. *
  601. * @publicApi
  602. *
  603. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  604. * Let `Intl.NumberFormat` determine the number format instead
  605. */
  606. declare function getLocaleNumberFormat(locale: string, type: NumberFormatStyle): string;
  607. /**
  608. * Retrieves the symbol used to represent the currency for the main country
  609. * corresponding to a given locale. For example, '$' for `en-US`.
  610. *
  611. * @param locale A locale code for the locale format rules to use.
  612. * @returns The localized symbol character,
  613. * or `null` if the main country cannot be determined.
  614. * @see [Internationalization (i18n) Guide](guide/i18n)
  615. *
  616. * @publicApi
  617. *
  618. * @deprecated Use the `Intl` API to format a currency with from currency code
  619. */
  620. declare function getLocaleCurrencySymbol(locale: string): string | null;
  621. /**
  622. * Retrieves the name of the currency for the main country corresponding
  623. * to a given locale. For example, 'US Dollar' for `en-US`.
  624. * @param locale A locale code for the locale format rules to use.
  625. * @returns The currency name,
  626. * or `null` if the main country cannot be determined.
  627. * @see [Internationalization (i18n) Guide](guide/i18n)
  628. *
  629. * @publicApi
  630. *
  631. * @deprecated Use the `Intl` API to format a currency with from currency code
  632. */
  633. declare function getLocaleCurrencyName(locale: string): string | null;
  634. /**
  635. * Retrieves the default currency code for the given locale.
  636. *
  637. * The default is defined as the first currency which is still in use.
  638. *
  639. * @param locale The code of the locale whose currency code we want.
  640. * @returns The code of the default currency for the given locale.
  641. *
  642. * @publicApi
  643. *
  644. * @deprecated We recommend you create a map of locale to ISO 4217 currency codes.
  645. * Time relative currency data is provided by the CLDR project. See https://www.unicode.org/cldr/charts/44/supplemental/detailed_territory_currency_information.html
  646. */
  647. declare function getLocaleCurrencyCode(locale: string): string | null;
  648. /**
  649. * @publicApi
  650. *
  651. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  652. * Use `Intl.PluralRules` instead
  653. */
  654. declare const getLocalePluralCase: (locale: string) => (value: number) => Plural;
  655. /**
  656. * Retrieves locale-specific rules used to determine which day period to use
  657. * when more than one period is defined for a locale.
  658. *
  659. * There is a rule for each defined day period. The
  660. * first rule is applied to the first day period and so on.
  661. * Fall back to AM/PM when no rules are available.
  662. *
  663. * A rule can specify a period as time range, or as a single time value.
  664. *
  665. * This functionality is only available when you have loaded the full locale data.
  666. * See the ["I18n guide"](guide/i18n/format-data-locale).
  667. *
  668. * @param locale A locale code for the locale format rules to use.
  669. * @returns The rules for the locale, a single time value or array of *from-time, to-time*,
  670. * or null if no periods are available.
  671. *
  672. * @see {@link getLocaleExtraDayPeriods}
  673. * @see [Internationalization (i18n) Guide](guide/i18n)
  674. *
  675. * @publicApi
  676. *
  677. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  678. * Let `Intl.DateTimeFormat` determine the day period instead.
  679. */
  680. declare function getLocaleExtraDayPeriodRules(locale: string): (Time | [Time, Time])[];
  681. /**
  682. * Retrieves locale-specific day periods, which indicate roughly how a day is broken up
  683. * in different languages.
  684. * For example, for `en-US`, periods are morning, noon, afternoon, evening, and midnight.
  685. *
  686. * This functionality is only available when you have loaded the full locale data.
  687. * See the ["I18n guide"](guide/i18n/format-data-locale).
  688. *
  689. * @param locale A locale code for the locale format rules to use.
  690. * @param formStyle The required grammatical form.
  691. * @param width The required character width.
  692. * @returns The translated day-period strings.
  693. * @see {@link getLocaleExtraDayPeriodRules}
  694. * @see [Internationalization (i18n) Guide](guide/i18n)
  695. *
  696. * @publicApi
  697. *
  698. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  699. * To extract a day period use `Intl.DateTimeFormat` with the `dayPeriod` option instead.
  700. */
  701. declare function getLocaleExtraDayPeriods(locale: string, formStyle: FormStyle, width: TranslationWidth): string[];
  702. /**
  703. * Retrieves the writing direction of a specified locale
  704. * @param locale A locale code for the locale format rules to use.
  705. * @publicApi
  706. * @returns 'rtl' or 'ltr'
  707. * @see [Internationalization (i18n) Guide](guide/i18n)
  708. *
  709. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  710. * For dates and numbers, let `Intl.DateTimeFormat()` and `Intl.NumberFormat()` determine the writing direction.
  711. * The `Intl` alternative [`getTextInfo`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo).
  712. * has only partial support (Chromium M99 & Safari 17).
  713. * 3rd party alternatives like [`rtl-detect`](https://www.npmjs.com/package/rtl-detect) can work around this issue.
  714. */
  715. declare function getLocaleDirection(locale: string): 'ltr' | 'rtl';
  716. /**
  717. * Represents a time value with hours and minutes.
  718. *
  719. * @publicApi
  720. *
  721. * @deprecated Locale date getters are deprecated
  722. */
  723. type Time = {
  724. hours: number;
  725. minutes: number;
  726. };
  727. /**
  728. * Retrieves the currency symbol for a given currency code.
  729. *
  730. * For example, for the default `en-US` locale, the code `USD` can
  731. * be represented by the narrow symbol `$` or the wide symbol `US$`.
  732. *
  733. * @param code The currency code.
  734. * @param format The format, `wide` or `narrow`.
  735. * @param locale A locale code for the locale format rules to use.
  736. *
  737. * @returns The symbol, or the currency code if no symbol is available.
  738. * @see [Internationalization (i18n) Guide](guide/i18n)
  739. *
  740. * @publicApi
  741. *
  742. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  743. * You can use `Intl.NumberFormat().formatToParts()` to extract the currency symbol.
  744. * For example: `Intl.NumberFormat('en', {style:'currency', currency: 'USD'}).formatToParts().find(part => part.type === 'currency').value`
  745. * returns `$` for USD currency code in the `en` locale.
  746. * Note: `US$` is a currency symbol for the `en-ca` locale but not the `en-us` locale.
  747. */
  748. declare function getCurrencySymbol(code: string, format: 'wide' | 'narrow', locale?: string): string;
  749. /**
  750. * Reports the number of decimal digits for a given currency.
  751. * The value depends upon the presence of cents in that particular currency.
  752. *
  753. * @param code The currency code.
  754. * @returns The number of decimal digits, typically 0 or 2.
  755. * @see [Internationalization (i18n) Guide](guide/i18n)
  756. *
  757. * @publicApi
  758. *
  759. * @deprecated Angular recommends relying on the `Intl` API for i18n.
  760. * This function should not be used anymore. Let `Intl.NumberFormat` determine the number of digits to display for the currency
  761. */
  762. declare function getNumberOfCurrencyDigits(code: string): number;
  763. declare function parseCookieValue(cookieStr: string, name: string): string | null;
  764. /**
  765. * A DI Token representing the main rendering context.
  766. * In a browser and SSR this is the DOM Document.
  767. * When using SSR, that document is created by [Domino](https://github.com/angular/domino).
  768. *
  769. * @publicApi
  770. */
  771. declare const DOCUMENT: InjectionToken<Document>;
  772. declare const PLATFORM_BROWSER_ID = "browser";
  773. declare const PLATFORM_SERVER_ID = "server";
  774. /**
  775. * Returns whether a platform id represents a browser platform.
  776. * @publicApi
  777. */
  778. declare function isPlatformBrowser(platformId: Object): boolean;
  779. /**
  780. * Returns whether a platform id represents a server platform.
  781. * @publicApi
  782. */
  783. declare function isPlatformServer(platformId: Object): boolean;
  784. /**
  785. * @module
  786. * @description
  787. * Entry point for all public APIs of the common package.
  788. */
  789. /**
  790. * @publicApi
  791. */
  792. declare const VERSION: Version;
  793. /**
  794. * Defines a scroll position manager. Implemented by `BrowserViewportScroller`.
  795. *
  796. * @publicApi
  797. */
  798. declare abstract class ViewportScroller {
  799. /** @nocollapse */
  800. static ɵprov: unknown;
  801. /**
  802. * Configures the top offset used when scrolling to an anchor.
  803. * @param offset A position in screen coordinates (a tuple with x and y values)
  804. * or a function that returns the top offset position.
  805. *
  806. */
  807. abstract setOffset(offset: [number, number] | (() => [number, number])): void;
  808. /**
  809. * Retrieves the current scroll position.
  810. * @returns A position in screen coordinates (a tuple with x and y values).
  811. */
  812. abstract getScrollPosition(): [number, number];
  813. /**
  814. * Scrolls to a specified position.
  815. * @param position A position in screen coordinates (a tuple with x and y values).
  816. */
  817. abstract scrollToPosition(position: [number, number]): void;
  818. /**
  819. * Scrolls to an anchor element.
  820. * @param anchor The ID of the anchor element.
  821. */
  822. abstract scrollToAnchor(anchor: string): void;
  823. /**
  824. * Disables automatic scroll restoration provided by the browser.
  825. * See also [window.history.scrollRestoration
  826. * info](https://developers.google.com/web/updates/2015/09/history-api-scroll-restoration).
  827. */
  828. abstract setHistoryScrollRestoration(scrollRestoration: 'auto' | 'manual'): void;
  829. }
  830. /**
  831. * Provides an empty implementation of the viewport scroller.
  832. */
  833. declare class NullViewportScroller implements ViewportScroller {
  834. /**
  835. * Empty implementation
  836. */
  837. setOffset(offset: [number, number] | (() => [number, number])): void;
  838. /**
  839. * Empty implementation
  840. */
  841. getScrollPosition(): [number, number];
  842. /**
  843. * Empty implementation
  844. */
  845. scrollToPosition(position: [number, number]): void;
  846. /**
  847. * Empty implementation
  848. */
  849. scrollToAnchor(anchor: string): void;
  850. /**
  851. * Empty implementation
  852. */
  853. setHistoryScrollRestoration(scrollRestoration: 'auto' | 'manual'): void;
  854. }
  855. /**
  856. * Function that generates an ImageLoader for [Cloudflare Image
  857. * Resizing](https://developers.cloudflare.com/images/image-resizing/) and turns it into an Angular
  858. * provider. Note: Cloudflare has multiple image products - this provider is specifically for
  859. * Cloudflare Image Resizing; it will not work with Cloudflare Images or Cloudflare Polish.
  860. *
  861. * @param path Your domain name, e.g. https://mysite.com
  862. * @returns Provider that provides an ImageLoader function
  863. *
  864. * @publicApi
  865. */
  866. declare const provideCloudflareLoader: (path: string) => Provider[];
  867. /**
  868. * Config options recognized by the image loader function.
  869. *
  870. * @see {@link ImageLoader}
  871. * @see {@link NgOptimizedImage}
  872. * @publicApi
  873. */
  874. interface ImageLoaderConfig {
  875. /**
  876. * Image file name to be added to the image request URL.
  877. */
  878. src: string;
  879. /**
  880. * Width of the requested image (to be used when generating srcset).
  881. */
  882. width?: number;
  883. /**
  884. * Whether the loader should generate a URL for a small image placeholder instead of a full-sized
  885. * image.
  886. */
  887. isPlaceholder?: boolean;
  888. /**
  889. * Additional user-provided parameters for use by the ImageLoader.
  890. */
  891. loaderParams?: {
  892. [key: string]: any;
  893. };
  894. }
  895. /**
  896. * Represents an image loader function. Image loader functions are used by the
  897. * NgOptimizedImage directive to produce full image URL based on the image name and its width.
  898. *
  899. * @publicApi
  900. */
  901. type ImageLoader = (config: ImageLoaderConfig) => string;
  902. /**
  903. * Injection token that configures the image loader function.
  904. *
  905. * @see {@link ImageLoader}
  906. * @see {@link NgOptimizedImage}
  907. * @publicApi
  908. */
  909. declare const IMAGE_LOADER: InjectionToken<ImageLoader>;
  910. /**
  911. * Function that generates an ImageLoader for Cloudinary and turns it into an Angular provider.
  912. *
  913. * @param path Base URL of your Cloudinary images
  914. * This URL should match one of the following formats:
  915. * https://res.cloudinary.com/mysite
  916. * https://mysite.cloudinary.com
  917. * https://subdomain.mysite.com
  918. * @returns Set of providers to configure the Cloudinary loader.
  919. *
  920. * @publicApi
  921. */
  922. declare const provideCloudinaryLoader: (path: string) => Provider[];
  923. /**
  924. * Function that generates an ImageLoader for ImageKit and turns it into an Angular provider.
  925. *
  926. * @param path Base URL of your ImageKit images
  927. * This URL should match one of the following formats:
  928. * https://ik.imagekit.io/myaccount
  929. * https://subdomain.mysite.com
  930. * @returns Set of providers to configure the ImageKit loader.
  931. *
  932. * @publicApi
  933. */
  934. declare const provideImageKitLoader: (path: string) => Provider[];
  935. /**
  936. * Function that generates an ImageLoader for Imgix and turns it into an Angular provider.
  937. *
  938. * @param path path to the desired Imgix origin,
  939. * e.g. https://somepath.imgix.net or https://images.mysite.com
  940. * @returns Set of providers to configure the Imgix loader.
  941. *
  942. * @publicApi
  943. */
  944. declare const provideImgixLoader: (path: string) => Provider[];
  945. /**
  946. * Function that generates an ImageLoader for Netlify and turns it into an Angular provider.
  947. *
  948. * @param path optional URL of the desired Netlify site. Defaults to the current site.
  949. * @returns Set of providers to configure the Netlify loader.
  950. *
  951. * @publicApi
  952. */
  953. declare function provideNetlifyLoader(path?: string): Provider[];
  954. /**
  955. * Config options used in rendering placeholder images.
  956. *
  957. * @see {@link NgOptimizedImage}
  958. * @publicApi
  959. */
  960. interface ImagePlaceholderConfig {
  961. blur?: boolean;
  962. }
  963. /**
  964. * Directive that improves image loading performance by enforcing best practices.
  965. *
  966. * `NgOptimizedImage` ensures that the loading of the Largest Contentful Paint (LCP) image is
  967. * prioritized by:
  968. * - Automatically setting the `fetchpriority` attribute on the `<img>` tag
  969. * - Lazy loading non-priority images by default
  970. * - Automatically generating a preconnect link tag in the document head
  971. *
  972. * In addition, the directive:
  973. * - Generates appropriate asset URLs if a corresponding `ImageLoader` function is provided
  974. * - Automatically generates a srcset
  975. * - Requires that `width` and `height` are set
  976. * - Warns if `width` or `height` have been set incorrectly
  977. * - Warns if the image will be visually distorted when rendered
  978. *
  979. * @usageNotes
  980. * The `NgOptimizedImage` directive is marked as [standalone](guide/components/importing) and can
  981. * be imported directly.
  982. *
  983. * Follow the steps below to enable and use the directive:
  984. * 1. Import it into the necessary NgModule or a standalone Component.
  985. * 2. Optionally provide an `ImageLoader` if you use an image hosting service.
  986. * 3. Update the necessary `<img>` tags in templates and replace `src` attributes with `ngSrc`.
  987. * Using a `ngSrc` allows the directive to control when the `src` gets set, which triggers an image
  988. * download.
  989. *
  990. * Step 1: import the `NgOptimizedImage` directive.
  991. *
  992. * ```ts
  993. * import { NgOptimizedImage } from '@angular/common';
  994. *
  995. * // Include it into the necessary NgModule
  996. * @NgModule({
  997. * imports: [NgOptimizedImage],
  998. * })
  999. * class AppModule {}
  1000. *
  1001. * // ... or a standalone Component
  1002. * @Component({
  1003. * imports: [NgOptimizedImage],
  1004. * })
  1005. * class MyStandaloneComponent {}
  1006. * ```
  1007. *
  1008. * Step 2: configure a loader.
  1009. *
  1010. * To use the **default loader**: no additional code changes are necessary. The URL returned by the
  1011. * generic loader will always match the value of "src". In other words, this loader applies no
  1012. * transformations to the resource URL and the value of the `ngSrc` attribute will be used as is.
  1013. *
  1014. * To use an existing loader for a **third-party image service**: add the provider factory for your
  1015. * chosen service to the `providers` array. In the example below, the Imgix loader is used:
  1016. *
  1017. * ```ts
  1018. * import {provideImgixLoader} from '@angular/common';
  1019. *
  1020. * // Call the function and add the result to the `providers` array:
  1021. * providers: [
  1022. * provideImgixLoader("https://my.base.url/"),
  1023. * ],
  1024. * ```
  1025. *
  1026. * The `NgOptimizedImage` directive provides the following functions:
  1027. * - `provideCloudflareLoader`
  1028. * - `provideCloudinaryLoader`
  1029. * - `provideImageKitLoader`
  1030. * - `provideImgixLoader`
  1031. *
  1032. * If you use a different image provider, you can create a custom loader function as described
  1033. * below.
  1034. *
  1035. * To use a **custom loader**: provide your loader function as a value for the `IMAGE_LOADER` DI
  1036. * token.
  1037. *
  1038. * ```ts
  1039. * import {IMAGE_LOADER, ImageLoaderConfig} from '@angular/common';
  1040. *
  1041. * // Configure the loader using the `IMAGE_LOADER` token.
  1042. * providers: [
  1043. * {
  1044. * provide: IMAGE_LOADER,
  1045. * useValue: (config: ImageLoaderConfig) => {
  1046. * return `https://example.com/${config.src}-${config.width}.jpg`;
  1047. * }
  1048. * },
  1049. * ],
  1050. * ```
  1051. *
  1052. * Step 3: update `<img>` tags in templates to use `ngSrc` instead of `src`.
  1053. *
  1054. * ```html
  1055. * <img ngSrc="logo.png" width="200" height="100">
  1056. * ```
  1057. *
  1058. * @publicApi
  1059. */
  1060. declare class NgOptimizedImage implements OnInit, OnChanges {
  1061. private imageLoader;
  1062. private config;
  1063. private renderer;
  1064. private imgElement;
  1065. private injector;
  1066. private lcpObserver?;
  1067. /**
  1068. * Calculate the rewritten `src` once and store it.
  1069. * This is needed to avoid repetitive calculations and make sure the directive cleanup in the
  1070. * `ngOnDestroy` does not rely on the `IMAGE_LOADER` logic (which in turn can rely on some other
  1071. * instance that might be already destroyed).
  1072. */
  1073. private _renderedSrc;
  1074. /**
  1075. * Name of the source image.
  1076. * Image name will be processed by the image loader and the final URL will be applied as the `src`
  1077. * property of the image.
  1078. */
  1079. ngSrc: string;
  1080. /**
  1081. * A comma separated list of width or density descriptors.
  1082. * The image name will be taken from `ngSrc` and combined with the list of width or density
  1083. * descriptors to generate the final `srcset` property of the image.
  1084. *
  1085. * Example:
  1086. * ```html
  1087. * <img ngSrc="hello.jpg" ngSrcset="100w, 200w" /> =>
  1088. * <img src="path/hello.jpg" srcset="path/hello.jpg?w=100 100w, path/hello.jpg?w=200 200w" />
  1089. * ```
  1090. */
  1091. ngSrcset: string;
  1092. /**
  1093. * The base `sizes` attribute passed through to the `<img>` element.
  1094. * Providing sizes causes the image to create an automatic responsive srcset.
  1095. */
  1096. sizes?: string;
  1097. /**
  1098. * For responsive images: the intrinsic width of the image in pixels.
  1099. * For fixed size images: the desired rendered width of the image in pixels.
  1100. */
  1101. width: number | undefined;
  1102. /**
  1103. * For responsive images: the intrinsic height of the image in pixels.
  1104. * For fixed size images: the desired rendered height of the image in pixels.
  1105. */
  1106. height: number | undefined;
  1107. /**
  1108. * The desired loading behavior (lazy, eager, or auto). Defaults to `lazy`,
  1109. * which is recommended for most images.
  1110. *
  1111. * Warning: Setting images as loading="eager" or loading="auto" marks them
  1112. * as non-priority images and can hurt loading performance. For images which
  1113. * may be the LCP element, use the `priority` attribute instead of `loading`.
  1114. */
  1115. loading?: 'lazy' | 'eager' | 'auto';
  1116. /**
  1117. * Indicates whether this image should have a high priority.
  1118. */
  1119. priority: boolean;
  1120. /**
  1121. * Data to pass through to custom loaders.
  1122. */
  1123. loaderParams?: {
  1124. [key: string]: any;
  1125. };
  1126. /**
  1127. * Disables automatic srcset generation for this image.
  1128. */
  1129. disableOptimizedSrcset: boolean;
  1130. /**
  1131. * Sets the image to "fill mode", which eliminates the height/width requirement and adds
  1132. * styles such that the image fills its containing element.
  1133. */
  1134. fill: boolean;
  1135. /**
  1136. * A URL or data URL for an image to be used as a placeholder while this image loads.
  1137. */
  1138. placeholder?: string | boolean;
  1139. /**
  1140. * Configuration object for placeholder settings. Options:
  1141. * * blur: Setting this to false disables the automatic CSS blur.
  1142. */
  1143. placeholderConfig?: ImagePlaceholderConfig;
  1144. constructor();
  1145. /** @docs-private */
  1146. ngOnInit(): void;
  1147. private setHostAttributes;
  1148. /** @docs-private */
  1149. ngOnChanges(changes: SimpleChanges): void;
  1150. private callImageLoader;
  1151. private getLoadingBehavior;
  1152. private getFetchPriority;
  1153. private getRewrittenSrc;
  1154. private getRewrittenSrcset;
  1155. private getAutomaticSrcset;
  1156. private getResponsiveSrcset;
  1157. private updateSrcAndSrcset;
  1158. private getFixedSrcset;
  1159. private shouldGenerateAutomaticSrcset;
  1160. /**
  1161. * Returns an image url formatted for use with the CSS background-image property. Expects one of:
  1162. * * A base64 encoded image, which is wrapped and passed through.
  1163. * * A boolean. If true, calls the image loader to generate a small placeholder url.
  1164. */
  1165. private generatePlaceholder;
  1166. /**
  1167. * Determines if blur should be applied, based on an optional boolean
  1168. * property `blur` within the optional configuration object `placeholderConfig`.
  1169. */
  1170. private shouldBlurPlaceholder;
  1171. private removePlaceholderOnLoad;
  1172. private setHostAttribute;
  1173. static ɵfac: i0.ɵɵFactoryDeclaration<NgOptimizedImage, never>;
  1174. static ɵdir: i0.ɵɵDirectiveDeclaration<NgOptimizedImage, "img[ngSrc]", never, { "ngSrc": { "alias": "ngSrc"; "required": true; }; "ngSrcset": { "alias": "ngSrcset"; "required": false; }; "sizes": { "alias": "sizes"; "required": false; }; "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "priority": { "alias": "priority"; "required": false; }; "loaderParams": { "alias": "loaderParams"; "required": false; }; "disableOptimizedSrcset": { "alias": "disableOptimizedSrcset"; "required": false; }; "fill": { "alias": "fill"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "placeholderConfig": { "alias": "placeholderConfig"; "required": false; }; "src": { "alias": "src"; "required": false; }; "srcset": { "alias": "srcset"; "required": false; }; }, {}, never, never, true, never>;
  1175. static ngAcceptInputType_ngSrc: string | i0.ɵSafeValue;
  1176. static ngAcceptInputType_width: unknown;
  1177. static ngAcceptInputType_height: unknown;
  1178. static ngAcceptInputType_priority: unknown;
  1179. static ngAcceptInputType_disableOptimizedSrcset: unknown;
  1180. static ngAcceptInputType_fill: unknown;
  1181. static ngAcceptInputType_placeholder: boolean | string;
  1182. }
  1183. /**
  1184. * Injection token to configure which origins should be excluded
  1185. * from the preconnect checks. It can either be a single string or an array of strings
  1186. * to represent a group of origins, for example:
  1187. *
  1188. * ```ts
  1189. * {provide: PRECONNECT_CHECK_BLOCKLIST, useValue: 'https://your-domain.com'}
  1190. * ```
  1191. *
  1192. * or:
  1193. *
  1194. * ```ts
  1195. * {provide: PRECONNECT_CHECK_BLOCKLIST,
  1196. * useValue: ['https://your-domain-1.com', 'https://your-domain-2.com']}
  1197. * ```
  1198. *
  1199. * @publicApi
  1200. */
  1201. declare const PRECONNECT_CHECK_BLOCKLIST: InjectionToken<(string | string[])[]>;
  1202. /**
  1203. * Normalizes URL parameters by prepending with `?` if needed.
  1204. *
  1205. * @param params String of URL parameters.
  1206. *
  1207. * @returns The normalized URL parameters string.
  1208. */
  1209. declare function normalizeQueryParams(params: string): string;
  1210. export { DOCUMENT, FormStyle, FormatWidth, HashLocationStrategy, IMAGE_LOADER, LocationChangeListener, LocationStrategy, NgOptimizedImage, NumberFormatStyle, NumberSymbol, PRECONNECT_CHECK_BLOCKLIST, PlatformLocation, Plural, TranslationWidth, VERSION, ViewportScroller, WeekDay, formatCurrency, formatDate, formatNumber, formatPercent, getCurrencySymbol, getLocaleCurrencyCode, getLocaleCurrencyName, getLocaleCurrencySymbol, getLocaleDateFormat, getLocaleDateTimeFormat, getLocaleDayNames, getLocaleDayPeriods, getLocaleDirection, getLocaleEraNames, getLocaleExtraDayPeriodRules, getLocaleExtraDayPeriods, getLocaleFirstDayOfWeek, getLocaleId, getLocaleMonthNames, getLocaleNumberFormat, getLocaleNumberSymbol, getLocalePluralCase, getLocaleTimeFormat, getLocaleWeekEndRange, getNumberOfCurrencyDigits, isPlatformBrowser, isPlatformServer, provideCloudflareLoader, provideCloudinaryLoader, provideImageKitLoader, provideImgixLoader, provideNetlifyLoader, registerLocaleData, DomAdapter as ɵDomAdapter, NullViewportScroller as ɵNullViewportScroller, PLATFORM_BROWSER_ID as ɵPLATFORM_BROWSER_ID, PLATFORM_SERVER_ID as ɵPLATFORM_SERVER_ID, PlatformNavigation as ɵPlatformNavigation, getDOM as ɵgetDOM, normalizeQueryParams as ɵnormalizeQueryParams, parseCookieValue as ɵparseCookieValue, setRootDomAdapter as ɵsetRootDomAdapter };
  1211. export type { ImageLoader, ImageLoaderConfig, ImagePlaceholderConfig, Time };