srcdev-nuxt-components 9.1.46 → 9.1.47

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.
@@ -24,6 +24,7 @@ For arbitrary slot content — a grid of images, video, markup — use `ScrollRe
24
24
  | `parallaxOffset` | `string` | `"36rem"` | Distance the image travels vertically across the full scroll range. Larger = more dramatic reveal. |
25
25
  | `focalX` | `string` | `"50%"` | Horizontal focal point — CSS `object-position` x-axis value. Controls which horizontal slice stays in view. |
26
26
  | `radius` | `string` | `"0px"` | `border-radius` applied to the clipping frame. |
27
+ | `loading` | `"lazy" \| "eager"` | `"lazy"` | Image loading strategy. Use `"eager"` if this is the LCP image (e.g. partially in view on load). |
27
28
  | `styleClassPassthrough` | `string \| string[]` | `[]` | Extra classes applied to the root `<figure>`. |
28
29
 
29
30
  ## Basic usage
@@ -157,7 +158,7 @@ See `scroll-reveal-frame.md` for the full guide. For portrait images the default
157
158
  ## Notes
158
159
 
159
160
  - The root `<figure>` has `margin: 0` set in the component — browser default `<figure>` margins are neutralised at source.
160
- - `loading="lazy"` and `decoding="async"` are hardcoded on the `<img>`. If this component is the LCP image, override with `loading="eager"` via a CSS-only approach is not possible use `ScrollRevealFrame` with a manual `NuxtImg` instead and set `:loading="'eager'"`.
161
+ - `decoding="async"` is always set on the `<img>`. Use `:loading="'eager'"` if this component is the LCP image (e.g. a hero partially in view on load) the default `"lazy"` is correct for below-fold usage.
161
162
  - Do not place inside a container with `overflow: hidden` or `overflow: clip` — breaks the `view-timeline` scroll detection inherited from `ScrollRevealFrame`.
162
163
  - Reduced-motion: animation is disabled and the image falls back to a static crop centred at `object-position: <focalX> 50%`.
163
164
  - Storybook: the `"none"` image provider is active (`nuxt.config.ts`), so `src` paths pass through unchanged. Always provide explicit `img-width` and `img-height` props to avoid the `w=1536` fallback in deployed Storybook.
@@ -12,7 +12,7 @@
12
12
  :alt="alt"
13
13
  :width="imgWidth"
14
14
  :height="imgHeight"
15
- loading="lazy"
15
+ :loading="loading"
16
16
  decoding="async"
17
17
  />
18
18
  </ScrollRevealFrame>
@@ -51,6 +51,7 @@ interface Props {
51
51
  focalX?: string;
52
52
  /** Optional rounded corners on the frame. */
53
53
  radius?: string;
54
+ loading?: "lazy" | "eager";
54
55
  styleClassPassthrough?: string | string[];
55
56
  }
56
57
 
@@ -62,6 +63,7 @@ withDefaults(defineProps<Props>(), {
62
63
  parallaxOffset: "36rem",
63
64
  focalX: "50%",
64
65
  radius: "0px",
66
+ loading: "lazy",
65
67
  styleClassPassthrough: () => [],
66
68
  });
67
69
  </script>
@@ -32,6 +32,7 @@ describe("ScrollRevealImage", () => {
32
32
  parallaxOffset: "20rem",
33
33
  focalX: "30%",
34
34
  radius: "1.6rem",
35
+ loading: "eager",
35
36
  styleClassPassthrough: ["custom-class"],
36
37
  },
37
38
  });
@@ -179,13 +180,20 @@ describe("ScrollRevealImage", () => {
179
180
  expect(img.attributes("height")).toBe("1920");
180
181
  });
181
182
 
182
- it("sets loading=lazy on the image element", async () => {
183
+ it("sets loading=lazy on the image element by default", async () => {
183
184
  const wrapper = await mountSuspended(ScrollRevealImage, {
184
185
  props: { src: "/images/test.jpg" },
185
186
  });
186
187
  expect(wrapper.find("img[data-nuxt-img]").attributes("loading")).toBe("lazy");
187
188
  });
188
189
 
190
+ it("passes loading=eager to the image element when set", async () => {
191
+ const wrapper = await mountSuspended(ScrollRevealImage, {
192
+ props: { src: "/images/test.jpg", loading: "eager" },
193
+ });
194
+ expect(wrapper.find("img[data-nuxt-img]").attributes("loading")).toBe("eager");
195
+ });
196
+
189
197
  it("sets decoding=async on the image element", async () => {
190
198
  const wrapper = await mountSuspended(ScrollRevealImage, {
191
199
  props: { src: "/images/test.jpg" },
@@ -2,7 +2,7 @@
2
2
 
3
3
  exports[`ScrollRevealImage > renders correct HTML structure (all props set) 1`] = `
4
4
  "<figure class="reveal-frame custom-class" style="--_frame-height: 400px; --_parallax-offset: 20rem; --_radius: 1.6rem; --_focal-x: 30%;">
5
- <div class="reveal-content"><img width="800" height="600" data-nuxt-img="" srcset="/_ipx/s_800x600/images/test.jpg 1x, /_ipx/s_1600x1200/images/test.jpg 2x" class="reveal-image" alt="All props" loading="lazy" decoding="async" src="/_ipx/s_800x600/images/test.jpg"></div>
5
+ <div class="reveal-content"><img width="800" height="600" data-nuxt-img="" srcset="/_ipx/s_800x600/images/test.jpg 1x, /_ipx/s_1600x1200/images/test.jpg 2x" class="reveal-image" alt="All props" loading="eager" decoding="async" src="/_ipx/s_800x600/images/test.jpg"></div>
6
6
  </figure>"
7
7
  `;
8
8
 
@@ -100,11 +100,6 @@ watch(
100
100
  }
101
101
 
102
102
  .profile-info {
103
- display: flex;
104
- flex-direction: column;
105
- gap: 1.5rem;
106
- height: stretch;
107
-
108
103
  .profile-info-content {
109
104
  .profile-info-block {
110
105
  margin-block-end: 1.5rem;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-components",
3
3
  "type": "module",
4
- "version": "9.1.46",
4
+ "version": "9.1.47",
5
5
  "main": "nuxt.config.ts",
6
6
  "types": "types.d.ts",
7
7
  "license": "MIT",