full site update

This commit is contained in:
2025-07-24 18:46:24 +02:00
parent bfe2b90d8d
commit 37a6e0ab31
6912 changed files with 540482 additions and 361712 deletions

View File

@@ -1,5 +1,6 @@
---
import { type LocalImageProps, type RemoteImageProps, getImage } from 'astro:assets';
import { getImage, imageConfig, type LocalImageProps, type RemoteImageProps } from 'astro:assets';
import type { UnresolvedImageTransform } from '../dist/assets/types';
import { AstroError, AstroErrorData } from '../dist/core/errors/index.js';
import type { HTMLAttributes } from '../types';
@@ -23,7 +24,16 @@ if (typeof props.height === 'string') {
props.height = parseInt(props.height);
}
const image = await getImage(props);
const layout = props.layout ?? imageConfig.layout ?? 'none';
if (layout !== 'none') {
// Apply defaults from imageConfig if not provided
props.layout ??= imageConfig.layout;
props.fit ??= imageConfig.objectFit ?? 'cover';
props.position ??= imageConfig.objectPosition ?? 'center';
}
const image = await getImage(props as UnresolvedImageTransform);
const additionalAttributes: HTMLAttributes<'img'> = {};
if (image.srcSet.values.length > 0) {
@@ -33,6 +43,9 @@ if (image.srcSet.values.length > 0) {
if (import.meta.env.DEV) {
additionalAttributes['data-image-component'] = 'true';
}
const { class: className, ...attributes } = { ...additionalAttributes, ...image.attributes };
---
<img src={image.src} {...additionalAttributes} {...image.attributes} />
{/* Applying class outside of the spread prevents it from applying unnecessary astro-* classes */}
<img src={image.src} {...attributes} class={className} />