@designcrowd/library.brand-page 5.17.21-kp-1 → 5.17.21
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/lib/src/{CreatedOnBrandCrowd-de-de-tDfigFsQ.js → CreatedOnBrandCrowd-de-de-Brtp2yWB.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-CdzRfLTq.js → CreatedOnBrandCrowd-en-us-BIJ5VoX4.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-DpBKI4Qi.js → CreatedOnBrandCrowd-es-es-JrKK9K0u.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-8BjTrEak.js → CreatedOnBrandCrowd-fr-ca-D_HvOZe-.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-8BjTrEak.js → CreatedOnBrandCrowd-fr-fr-D_HvOZe-.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-kxnznjPB.js → CreatedOnBrandCrowd-pt-br-SSLb0vlp.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-kxnznjPB.js → CreatedOnBrandCrowd-pt-pt-SSLb0vlp.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-YLebq5nt.js → CreatedOnDcom-de-de-BG39ozFo.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-BCkkX4NC.js → CreatedOnDcom-en-us-D2NzqECZ.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-BlIwjtBb.js → CreatedOnDcom-es-es-C55r2Lb4.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-Cax8GNl7.js → CreatedOnDcom-fr-ca-Bj-sAaJI.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-CKYbDU0-.js → CreatedOnDcom-fr-fr-D8l0r-Tc.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-D_3XGCdM.js → CreatedOnDcom-pt-br-CXHC6E1h.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-D0o7kehp.js → CreatedOnDcom-pt-pt-2dMvgnyi.js} +1 -1
- package/lib/src/brand-page/components/image-gallery/ImageGalleryModal.mixin.d.ts +1 -4
- package/lib/src/brand-page/components/image-gallery/ImageGalleryModal.mixin.js +4 -48
- package/lib/src/css/library.brand-page-brandCrowd.min.css +6 -10
- package/lib/src/css/library.brand-page-brandPage.min.css +6 -10
- package/lib/src/css/library.brand-page-designCom.min.css +6 -10
- package/lib/src/css/library.brand-page-preview.min.css +6 -10
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib--fXSGh_Q.js → lib-CrBvj1a5.js} +3515 -3538
- package/package.json +1 -1
- package/src/brand-page/components/image-gallery/ImageGalleryModal.mixin.ts +6 -61
- package/src/brand-page/components/image-gallery/ImageGalleryModal.vue +4 -17
package/package.json
CHANGED
|
@@ -5,17 +5,6 @@ import ImageModalMixin from '../mixins/image-modal.mixin';
|
|
|
5
5
|
import cloneDeep from 'lodash.clonedeep';
|
|
6
6
|
import type { BrandPageContext, ImageItem } from '@brand-page/models';
|
|
7
7
|
|
|
8
|
-
// Number of slides on each side of the current slide to keep mounted with a
|
|
9
|
-
// real <img>. Slides outside this window render an empty placeholder so the
|
|
10
|
-
// browser does not request full-resolution images for the entire gallery on
|
|
11
|
-
// modal open — required to prevent mobile tab crashes on large galleries.
|
|
12
|
-
const IMAGE_RENDER_WINDOW = 2;
|
|
13
|
-
|
|
14
|
-
// Swiper `loop: true` duplicates slide DOM nodes at both ends. For large
|
|
15
|
-
// galleries this doubles the DOM cost without user benefit, so we disable
|
|
16
|
-
// loop above this threshold.
|
|
17
|
-
const LOOP_DISABLED_ABOVE = 20;
|
|
18
|
-
|
|
19
8
|
export default defineComponent({
|
|
20
9
|
mixins: [ComponentCommonMixin, ImageModalMixin],
|
|
21
10
|
props: {
|
|
@@ -51,7 +40,6 @@ export default defineComponent({
|
|
|
51
40
|
isImageModalLoading: false,
|
|
52
41
|
carouselImages: [] as any[][] | undefined,
|
|
53
42
|
showControl: true,
|
|
54
|
-
carouselComponentRef: 'image-gallery-carousel',
|
|
55
43
|
};
|
|
56
44
|
},
|
|
57
45
|
computed: {
|
|
@@ -77,9 +65,8 @@ export default defineComponent({
|
|
|
77
65
|
|
|
78
66
|
swiperOptions() {
|
|
79
67
|
return {
|
|
80
|
-
initialSlide:
|
|
81
|
-
loop:
|
|
82
|
-
this.images.length > 1 && this.images.length <= LOOP_DISABLED_ABOVE,
|
|
68
|
+
initialSlide: 0,
|
|
69
|
+
loop: this.images.length > 1,
|
|
83
70
|
slidesPerGroup: 1,
|
|
84
71
|
slidesPerView: 1,
|
|
85
72
|
spaceBetween: 10,
|
|
@@ -112,6 +99,10 @@ export default defineComponent({
|
|
|
112
99
|
}
|
|
113
100
|
|
|
114
101
|
this.isImageModalLoading = true;
|
|
102
|
+
|
|
103
|
+
this.swiperOptions.initialSlide = newIndex;
|
|
104
|
+
|
|
105
|
+
// this.$nextTick(() => this.checkImageModalImageComplete());
|
|
115
106
|
},
|
|
116
107
|
|
|
117
108
|
images: {
|
|
@@ -163,51 +154,5 @@ export default defineComponent({
|
|
|
163
154
|
onImageModalClose() {
|
|
164
155
|
this.$emit('close');
|
|
165
156
|
},
|
|
166
|
-
|
|
167
|
-
isSlideInRenderWindow(index: number): boolean {
|
|
168
|
-
if (this.currentImageIndex === undefined) {
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const total = this.images.length;
|
|
173
|
-
|
|
174
|
-
if (total === 0) {
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const direct = Math.abs(index - this.currentImageIndex);
|
|
179
|
-
// For looped galleries, the shortest path between two slides may wrap
|
|
180
|
-
// around the end. Use whichever distance is smaller.
|
|
181
|
-
const wrapped = total - direct;
|
|
182
|
-
const distance = Math.min(direct, wrapped);
|
|
183
|
-
|
|
184
|
-
return distance <= IMAGE_RENDER_WINDOW;
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
onCarouselLoaded() {
|
|
188
|
-
// The shared Carousel doesn't emit slide-change events, so we reach
|
|
189
|
-
// through its ref to bind directly to the underlying Swiper instance.
|
|
190
|
-
// Keeps `currentImageIndex` in sync with user navigation (arrows,
|
|
191
|
-
// swipes, keyboard) so the render window slides with the user.
|
|
192
|
-
const carousel = this.$refs[this.carouselComponentRef] as any;
|
|
193
|
-
const swiper = carousel?.swiper;
|
|
194
|
-
|
|
195
|
-
if (!swiper || typeof swiper.on !== 'function') {
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
swiper.on('slideChange', () => {
|
|
200
|
-
// `realIndex` reflects the underlying slide index when loop mode
|
|
201
|
-
// duplicates slides; `activeIndex` would include those duplicates.
|
|
202
|
-
const next =
|
|
203
|
-
typeof swiper.realIndex === 'number'
|
|
204
|
-
? swiper.realIndex
|
|
205
|
-
: swiper.activeIndex;
|
|
206
|
-
|
|
207
|
-
if (typeof next === 'number') {
|
|
208
|
-
this.currentImageIndex = next;
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
},
|
|
212
157
|
},
|
|
213
158
|
});
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
@modal-closed="onImageModalClose"
|
|
7
7
|
>
|
|
8
8
|
<Carousel
|
|
9
|
-
v-if="isImageModalVisible"
|
|
10
|
-
:ref="carouselComponentRef"
|
|
11
9
|
:classes="['tw-h-full', 'tw-max-h-full', 'tw-justify-center']"
|
|
12
10
|
:cards="carouselImages"
|
|
13
11
|
:options="swiperOptions"
|
|
@@ -15,7 +13,6 @@
|
|
|
15
13
|
:show-bullets="false"
|
|
16
14
|
:show-controls="showCarouselControls"
|
|
17
15
|
:navigation-unique-indexer="navigationUniqueIndexer"
|
|
18
|
-
@on-carousel-load="onCarouselLoaded"
|
|
19
16
|
>
|
|
20
17
|
<template #arrow-left>
|
|
21
18
|
<div id="button-prev" :class="navigationPrevClass">
|
|
@@ -33,7 +30,7 @@
|
|
|
33
30
|
/>
|
|
34
31
|
</div>
|
|
35
32
|
</template>
|
|
36
|
-
<template #slide="{ slide
|
|
33
|
+
<template #slide="{ slide }">
|
|
37
34
|
<div
|
|
38
35
|
class="tw-text-center tw-flex tw-flex-col tw-items-center tw-justify-center tw-overflow-auto tw-h-auto"
|
|
39
36
|
:class="{ 'tw-justify-center': !slide.imageTitle }"
|
|
@@ -44,14 +41,10 @@
|
|
|
44
41
|
>
|
|
45
42
|
{{ slide.imageTitle }}
|
|
46
43
|
</h3>
|
|
47
|
-
<Loader
|
|
48
|
-
v-if="isImageModalLoading && index === currentImageIndex"
|
|
49
|
-
class="tw-m-28"
|
|
50
|
-
/>
|
|
44
|
+
<Loader v-if="isImageModalLoading" class="tw-m-28" />
|
|
51
45
|
<FallbackImage
|
|
52
|
-
|
|
53
|
-
:
|
|
54
|
-
:ref="index === currentImageIndex ? imageModalImageRef : undefined"
|
|
46
|
+
:key="`modal-slide-${currentImageIndex}`"
|
|
47
|
+
:ref="imageModalImageRef"
|
|
55
48
|
:image-url="slide.imageUrl"
|
|
56
49
|
class="c-modal-image"
|
|
57
50
|
:alt="slide.imageTitle || altText"
|
|
@@ -61,7 +54,6 @@
|
|
|
61
54
|
@image-loading="imageLoading"
|
|
62
55
|
@image-error="checkImageLoading(true)"
|
|
63
56
|
/>
|
|
64
|
-
<div v-else class="c-modal-image-placeholder" />
|
|
65
57
|
</div>
|
|
66
58
|
</template>
|
|
67
59
|
<template #arrow-right>
|
|
@@ -123,9 +115,4 @@ export default {
|
|
|
123
115
|
@apply tw-max-w-full;
|
|
124
116
|
max-height: 90vh;
|
|
125
117
|
}
|
|
126
|
-
|
|
127
|
-
.c-modal-image-placeholder {
|
|
128
|
-
@apply tw-w-full;
|
|
129
|
-
height: 90vh;
|
|
130
|
-
}
|
|
131
118
|
</style>
|