angular/packages/core
Kara Erickson 57f3386e5b feat(common): support custom srcset attributes in NgOptimizedImage (#47082)
This commit adds a `rawSrcset` attribute as a replacement for the
`srcset` attribute. The `srcset` attribute cannot be set statically
on the image directive because it would cause images to start
downloading before the "loading" attribute could be set to "lazy".

Changing the name to `rawSrcset` allows the directive to control
the timing of image loading. It also makes it possible to support
custom loaders for `srcset` file names. Rather than having to repeat
the image origin for each image, the existing `rawSrc` value and
image loader can be composed to generate each full URL string. The
developer must only provide the necessary widths for the `srcset`.

For example, the developer might write:

```markup
<img rawSrc="hermes.jpg" rawSrcset="100w, 200w" ... />
```

with a loader like:

```js
const loader = (config) => `path/${config.src}?w=${config.width}`;
```

and the img tag will ultimately be set up as something like:

```markup
<img src="path/hermes.jpg?w=100" srcset="path/hermes.jpg?w=100 100w, path/hermes.jpg?w=200 200w" .../>
```

PR Close #47082
2022-08-16 17:36:52 +00:00
..
global build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
schematics docs: fix spelling (#46713) 2022-07-08 20:54:52 +00:00
src feat(common): detect LCP images in NgOptimizedImage and assert if priority is set (#47082) 2022-08-16 17:36:52 +00:00
test feat(common): support custom srcset attributes in NgOptimizedImage (#47082) 2022-08-16 17:36:52 +00:00
testing feat(core): support TypeScript 4.8 (#47038) 2022-08-16 16:02:47 +00:00
BUILD.bazel build(bazel): remove tsec patch to enable runfiles on Windows (#46447) 2022-06-21 12:19:53 -07:00
index.ts refactor(core): made comment structure consistent in index.ts (#43684) 2021-10-21 18:39:58 +00:00
package.json feat(core): drop support for Node.js 12 (#45286) 2022-03-08 12:05:03 -08:00
PACKAGE.md docs: add package doc files (#26047) 2018-10-05 15:42:14 -07:00
public_api.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00