Media performance tools: image/video props, upload placeholders, images preset, YouTube facade
Headless helpers for the project's own <Media> (look stays in the project): - mediaImageProps: dimensions from the doc (no CLS), lazy by default, LCP image gets preload + fetchPriority=high + eager (Next 16 replaced 'priority'), focal point → object-position, blur placeholder + dominant colour. - MEDIA_SIZES suggestions for 'sizes' (any string still works). - videoProps: 'background' (muted loop, respects reduced motion) or 'player' (controls, preload=none, poster). - buildMediaPlaceholderHook/Field: tiny WebP blur + dominant colour at upload via the configured sharp (no new dependency). - buildImagesConfig: AVIF/WebP, R2 remotePatterns, 31-day cache. - <YouTubeEmbed> (/client): poster + button, youtube-nocookie iframe on click. - buildCsp youtube allows the i.ytimg.com poster. kod-sekcji Media template uses the helpers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -93,6 +93,7 @@ export function buildCsp(args: BuildCspArgs = {}): { key: string; value: string
|
||||
|
||||
if (youtube) {
|
||||
src['frame-src'].push('https://www.youtube.com', 'https://www.youtube-nocookie.com')
|
||||
src['img-src'].push('https://i.ytimg.com') // YouTubeEmbed poster
|
||||
}
|
||||
|
||||
if (googleMaps) {
|
||||
|
||||
Reference in New Issue
Block a user