ferst-core 0.7.11 → 0.7.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/recipes/Hero.astro +19 -10
- package/package.json +1 -1
|
@@ -46,7 +46,10 @@ const provider = bgLink ? videoEmbed(bgLink)?.provider : undefined;
|
|
|
46
46
|
const watchLabel = media?.linkLabel || (provider ? `Watch the full video on ${provider}` : 'Watch the full video');
|
|
47
47
|
// The still: the image (no motion), or an embed's poster until the player may load.
|
|
48
48
|
const stillSrc = embed ? media?.poster ?? still : !media?.video && !slides.length ? still : undefined;
|
|
49
|
-
|
|
49
|
+
// Drawn as a real <img>, never a CSS background: a picture set through a CSS variable is
|
|
50
|
+
// found late (never by the preload scanner), so the hero sat grey until it arrived, and
|
|
51
|
+
// some browsers kept it grey. A real image, loaded first, is found early and painted.
|
|
52
|
+
const heroImg = isMedia && stillSrc ? stillSrc : undefined;
|
|
50
53
|
---
|
|
51
54
|
|
|
52
55
|
<section
|
|
@@ -58,10 +61,11 @@ const bgImage = isMedia && stillSrc ? `--hero-image: url('${stillSrc}')` : '';
|
|
|
58
61
|
data-linked={bgLink ? 'true' : undefined}
|
|
59
62
|
data-parallax={isMedia && parallax ? 'true' : undefined}
|
|
60
63
|
data-full-bleed={isMedia && fullBleed ? 'true' : undefined}
|
|
61
|
-
style={isMedia ? `--hero-overlay: ${overlay}
|
|
64
|
+
style={isMedia ? `--hero-overlay: ${overlay}${focus ? `; --hero-focus: ${focus}` : ''}` : undefined}
|
|
62
65
|
>
|
|
63
66
|
{isMedia && (
|
|
64
67
|
<div class="b-hero__bg" aria-hidden="true">
|
|
68
|
+
{heroImg && <img class="b-hero__img" src={heroImg} alt="" loading="eager" fetchpriority="high" decoding="async" />}
|
|
65
69
|
{embed && <div class="b-hero__embed" data-embed-url={embed.embedUrl} data-provider={embed.provider}></div>}
|
|
66
70
|
{media?.video && !embed ? (
|
|
67
71
|
<video autoplay muted loop playsinline poster={media.poster} preload="metadata">
|
|
@@ -69,7 +73,7 @@ const bgImage = isMedia && stillSrc ? `--hero-image: url('${stillSrc}')` : '';
|
|
|
69
73
|
</video>
|
|
70
74
|
) : null}
|
|
71
75
|
{slides.map((src, i) => (
|
|
72
|
-
<
|
|
76
|
+
<img class:list={['b-hero__slide', { 'is-on': i === 0 }]} src={src} alt="" loading={i === 0 ? 'eager' : 'lazy'} fetchpriority={i === 0 ? 'high' : undefined} decoding="async" />
|
|
73
77
|
))}
|
|
74
78
|
<span class="b-hero__scrim"></span>
|
|
75
79
|
</div>
|
|
@@ -346,11 +350,20 @@ const bgImage = isMedia && stillSrc ? `--hero-image: url('${stillSrc}')` : '';
|
|
|
346
350
|
position: absolute;
|
|
347
351
|
inset: 0;
|
|
348
352
|
z-index: -1;
|
|
349
|
-
background-image: var(--hero-image, none);
|
|
350
|
-
background-size: cover;
|
|
351
|
-
background-position: var(--hero-focus, center);
|
|
352
353
|
background-color: var(--bg-section);
|
|
353
354
|
}
|
|
355
|
+
/* The picture (and each rotating slide) covers the band, framed by `focus`. */
|
|
356
|
+
.b-hero__img,
|
|
357
|
+
.b-hero__slide {
|
|
358
|
+
position: absolute;
|
|
359
|
+
inset: 0;
|
|
360
|
+
width: 100%;
|
|
361
|
+
height: 100%;
|
|
362
|
+
object-fit: cover;
|
|
363
|
+
object-position: var(--hero-focus, center);
|
|
364
|
+
display: block;
|
|
365
|
+
max-width: none;
|
|
366
|
+
}
|
|
354
367
|
/* Parallax: give the background room to drift without uncovering an edge. */
|
|
355
368
|
.b-hero.is-parallax .b-hero__bg {
|
|
356
369
|
inset: 0 0 -35% 0;
|
|
@@ -390,10 +403,6 @@ const bgImage = isMedia && stillSrc ? `--hero-image: url('${stillSrc}')` : '';
|
|
|
390
403
|
display: none;
|
|
391
404
|
}
|
|
392
405
|
.b-hero__slide {
|
|
393
|
-
position: absolute;
|
|
394
|
-
inset: 0;
|
|
395
|
-
background-size: cover;
|
|
396
|
-
background-position: var(--hero-focus, center);
|
|
397
406
|
opacity: 0;
|
|
398
407
|
transition: opacity 1.6s ease-in-out;
|
|
399
408
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ferst-core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Ferst Core \u2014 the shared, brand-agnostic client-site system: Astro components, layouts, content schemas, the layered config resolver, and a neutral styling architecture that every client overrides.",
|
|
6
6
|
"license": "BUSL-1.1",
|