@r2digisolutions/components 0.25.7 → 0.25.9
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/dist/components/molecules/ImageGallery/ImageGallery.svelte +26 -11
- package/dist/components/molecules/ImageGallery/ImageGallery.svelte.d.ts +1 -0
- package/dist/components/molecules/ImageLightbox/ImageLightbox.svelte +2 -1
- package/dist/components/molecules/ImageLightbox/ImageLightbox.svelte.d.ts +1 -0
- package/dist/components/organisms/MapExplorer/MapExplorer.svelte +12 -4
- package/dist/components/organisms/MapExplorer/MapExplorer.svelte.d.ts +3 -0
- package/package.json +1 -1
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
export interface GalleryImage {
|
|
9
9
|
id: string;
|
|
10
|
-
src: string;
|
|
10
|
+
src: string; // grid / preview (thumb)
|
|
11
|
+
fullSrc?: string; // lightbox main image (full). Defaults to src
|
|
11
12
|
alt: string;
|
|
12
13
|
caption?: string;
|
|
13
14
|
}
|
|
@@ -40,11 +41,13 @@
|
|
|
40
41
|
let open = $state(false);
|
|
41
42
|
let index = $state(0);
|
|
42
43
|
let failed = $state<Record<string, boolean>>({});
|
|
44
|
+
let usedFallback = $state<Record<string, boolean>>({});
|
|
43
45
|
|
|
44
46
|
const lightboxImages = $derived(
|
|
45
47
|
images.map(
|
|
46
48
|
(img): LightboxImage => ({
|
|
47
|
-
src: img.src,
|
|
49
|
+
src: img.fullSrc ?? img.src,
|
|
50
|
+
thumbSrc: img.fullSrc ? img.src : undefined,
|
|
48
51
|
alt: img.alt,
|
|
49
52
|
caption: img.caption
|
|
50
53
|
})
|
|
@@ -83,6 +86,18 @@
|
|
|
83
86
|
failed = { ...failed, [id]: true };
|
|
84
87
|
}
|
|
85
88
|
|
|
89
|
+
function onImgError(img: GalleryImage) {
|
|
90
|
+
if (img.fullSrc && !usedFallback[img.id]) {
|
|
91
|
+
usedFallback = { ...usedFallback, [img.id]: true };
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
markFailed(img.id);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function tileSrc(img: GalleryImage) {
|
|
98
|
+
return usedFallback[img.id] && img.fullSrc ? img.fullSrc : img.src;
|
|
99
|
+
}
|
|
100
|
+
|
|
86
101
|
const heroGridClass = $derived.by(() => {
|
|
87
102
|
const n = heroVisible.length;
|
|
88
103
|
if (n <= 1) return 'grid-cols-1';
|
|
@@ -115,12 +130,12 @@
|
|
|
115
130
|
</div>
|
|
116
131
|
{:else}
|
|
117
132
|
<img
|
|
118
|
-
src={img
|
|
133
|
+
src={tileSrc(img)}
|
|
119
134
|
alt={img.alt}
|
|
120
|
-
loading="
|
|
135
|
+
loading="lazy"
|
|
121
136
|
decoding="async"
|
|
122
137
|
class="h-full w-full object-cover transition duration-300 group-hover:scale-[1.03]"
|
|
123
|
-
onerror={() =>
|
|
138
|
+
onerror={() => onImgError(img)}
|
|
124
139
|
/>
|
|
125
140
|
{/if}
|
|
126
141
|
|
|
@@ -158,12 +173,12 @@
|
|
|
158
173
|
</div>
|
|
159
174
|
{:else}
|
|
160
175
|
<img
|
|
161
|
-
src={img
|
|
176
|
+
src={tileSrc(img)}
|
|
162
177
|
alt={img.alt}
|
|
163
|
-
loading="
|
|
178
|
+
loading="lazy"
|
|
164
179
|
decoding="async"
|
|
165
180
|
class="h-full w-full object-cover transition duration-300 group-hover:scale-[1.03]"
|
|
166
|
-
onerror={() =>
|
|
181
|
+
onerror={() => onImgError(img)}
|
|
167
182
|
/>
|
|
168
183
|
{/if}
|
|
169
184
|
<div
|
|
@@ -232,13 +247,13 @@
|
|
|
232
247
|
</div>
|
|
233
248
|
{:else}
|
|
234
249
|
<img
|
|
235
|
-
src={img
|
|
250
|
+
src={tileSrc(img)}
|
|
236
251
|
alt={img.alt}
|
|
237
|
-
loading="
|
|
252
|
+
loading="lazy"
|
|
238
253
|
decoding="async"
|
|
239
254
|
class="w-full object-cover transition duration-300 group-hover:scale-[1.02]"
|
|
240
255
|
style:aspect-ratio={i % 3 === 0 ? '4/5' : i % 3 === 1 ? '1/1' : '5/4'}
|
|
241
|
-
onerror={() =>
|
|
256
|
+
onerror={() => onImgError(img)}
|
|
242
257
|
/>
|
|
243
258
|
{/if}
|
|
244
259
|
<span
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
export interface LightboxImage {
|
|
3
3
|
src: string;
|
|
4
|
+
thumbSrc?: string; // filmstrip; defaults to src
|
|
4
5
|
alt?: string;
|
|
5
6
|
caption?: string;
|
|
6
7
|
}
|
|
@@ -565,7 +566,7 @@
|
|
|
565
566
|
]}
|
|
566
567
|
>
|
|
567
568
|
<img
|
|
568
|
-
src={img.src}
|
|
569
|
+
src={img.thumbSrc ?? img.src}
|
|
569
570
|
alt=""
|
|
570
571
|
class="h-14 w-[4.5rem] object-cover sm:h-16 sm:w-24"
|
|
571
572
|
draggable="false"
|
|
@@ -41,6 +41,9 @@
|
|
|
41
41
|
imageUrl?: string | null;
|
|
42
42
|
/** Fallback when `imageUrl` fails (e.g. thumb → full original). */
|
|
43
43
|
imageFallbackUrl?: string | null;
|
|
44
|
+
/** Portrait flyer for flyer view; falls back to `imageUrl`. */
|
|
45
|
+
flyerImageUrl?: string | null;
|
|
46
|
+
flyerImageFallbackUrl?: string | null;
|
|
44
47
|
href?: string;
|
|
45
48
|
badge?: string;
|
|
46
49
|
chip?: string;
|
|
@@ -636,13 +639,18 @@
|
|
|
636
639
|
onclick={() => selectItem(item)}
|
|
637
640
|
>
|
|
638
641
|
{#if listView === 'flyer'}
|
|
642
|
+
{@const flyerSrc = item.flyerImageUrl ?? item.imageUrl}
|
|
643
|
+
{@const flyerFallback =
|
|
644
|
+
item.flyerImageUrl != null
|
|
645
|
+
? (item.flyerImageFallbackUrl ?? item.imageUrl)
|
|
646
|
+
: item.imageFallbackUrl}
|
|
639
647
|
<div
|
|
640
|
-
class="bg-surface-overlay relative aspect-[3/
|
|
648
|
+
class="bg-surface-overlay relative aspect-[3/4] w-full overflow-hidden"
|
|
641
649
|
>
|
|
642
|
-
{#if
|
|
650
|
+
{#if flyerSrc}
|
|
643
651
|
<Image
|
|
644
|
-
src={
|
|
645
|
-
fallbackSrc={
|
|
652
|
+
src={flyerSrc}
|
|
653
|
+
fallbackSrc={flyerFallback ?? undefined}
|
|
646
654
|
alt={item.title}
|
|
647
655
|
class="inset-0 absolute h-full w-full"
|
|
648
656
|
objectFit="contain"
|
|
@@ -17,6 +17,9 @@ export type MapExplorerItem = {
|
|
|
17
17
|
imageUrl?: string | null;
|
|
18
18
|
/** Fallback when `imageUrl` fails (e.g. thumb → full original). */
|
|
19
19
|
imageFallbackUrl?: string | null;
|
|
20
|
+
/** Portrait flyer for flyer view; falls back to `imageUrl`. */
|
|
21
|
+
flyerImageUrl?: string | null;
|
|
22
|
+
flyerImageFallbackUrl?: string | null;
|
|
20
23
|
href?: string;
|
|
21
24
|
badge?: string;
|
|
22
25
|
chip?: string;
|