@lancom/shared 0.0.216 → 0.0.217

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.
@@ -49,10 +49,10 @@ export const getProductOriginCover = (product, type, color) => getProductCover(p
49
49
 
50
50
  export const getBgStyle = img => img && ({ 'background-image': `url("${img}")` });
51
51
 
52
- export function getColorBackgroundStyle(color) {
52
+ export function getColorBackgroundStyle(color, skipPattern) {
53
53
  const { rgb, pattern, name } = color || {};
54
54
 
55
- if (pattern) {
55
+ if (pattern && !skipPattern) {
56
56
  return {
57
57
  'background-image': `url("${staticLink(pattern)}")`
58
58
  };
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <div
3
- class="Gallery__wrapper">
3
+ class="Gallery__wrapper"
4
+ @click="canLoadImages = true">
4
5
  <div class="Gallery__big">
5
6
  <vue-slick-carousel
6
7
  ref="bigCarousel"
@@ -12,14 +13,13 @@
12
13
  :speed="800"
13
14
  @beforeChange="onChange">
14
15
  <div
15
- v-for="image in filteredImages"
16
+ v-for="(image, index) in filteredImages"
16
17
  :key="image.large"
17
18
  v-hammer:press="onPanstart"
18
19
  v-hammer:pan="onPan"
19
20
  v-hammer:pressup="onPanend"
20
21
  v-hammer:panend="onPanend"
21
22
  class="Gallery__big-image"
22
- style="width: 300px; height: 300px;"
23
23
  :style="{
24
24
  // 'background-image': `url(${staticLink(image.large)}`,
25
25
  // 'background-size': backgroundSize,
@@ -31,10 +31,10 @@
31
31
  @mouseleave="onMouseLeave"
32
32
  @mousemove="onMouseMove">
33
33
  <img
34
+ v-if="index === 0 || canLoadImages"
34
35
  :src="staticLink(image.large)"
35
36
  :alt="product.name"
36
- class="Gallery__big-image-src"
37
- />
37
+ class="Gallery__big-image-src" />
38
38
  <div
39
39
  v-if="image.print"
40
40
  class="Gallery__big-print">
@@ -80,10 +80,10 @@
80
80
  // 'background-image': `url(${staticLink(image.small)}`
81
81
  }">
82
82
  <img
83
+ v-if="index < 6 || canLoadImages"
83
84
  :src="staticLink(image.small)"
84
85
  :alt="product.name"
85
- class="Gallery__small-image-src"
86
- />
86
+ class="Gallery__small-image-src" />
87
87
  <div class="Gallery__small-printed">
88
88
  {{ image.printType ? 'Printed' : (product.prePrint ? product.prePrintText : image.colorName || 'Blank') }}
89
89
  </div>
@@ -135,6 +135,7 @@ export default {
135
135
  isTouch: ('ontouchstart' in window),
136
136
  zoomEnable: false,
137
137
  activeIndex: 0,
138
+ canLoadImages: false,
138
139
  updateCarouselTime: Date.now(),
139
140
  filters: [{
140
141
  name: 'FRONT / BACK',
@@ -9,6 +9,7 @@
9
9
  @click="toggleSelection(color)">
10
10
  <product-color-image
11
11
  :color="color"
12
+ :lazy="true"
12
13
  class="ProductColorsSelectorOptions__color-inner">
13
14
  </product-color-image>
14
15
  <div
@@ -2,12 +2,14 @@
2
2
  <div
3
3
  class="ProductColorImage"
4
4
  :class="{ zoomedIn }"
5
- :style="style">
5
+ :style="style"
6
+ v-lazy:background-image="pattern">
6
7
  </div>
7
8
  </template>
8
9
 
9
10
  <script>
10
11
  import { getColorBackgroundStyle } from '@lancom/shared/assets/js/utils/colors';
12
+ import { staticLink } from '@lancom/shared/assets/js/utils/filters';
11
13
 
12
14
  export default {
13
15
  name: 'ProductColorImage',
@@ -19,11 +21,18 @@ export default {
19
21
  zoomedIn: {
20
22
  type: Boolean,
21
23
  default: false
24
+ },
25
+ lazy: {
26
+ type: Boolean,
27
+ default: false
22
28
  }
23
29
  },
24
30
  computed: {
31
+ pattern() {
32
+ return this.color.pattern && staticLink(this.color.pattern);
33
+ },
25
34
  style() {
26
- return getColorBackgroundStyle(this.color);
35
+ return getColorBackgroundStyle(this.color, this.lazy);
27
36
  }
28
37
  }
29
38
  };
@@ -5,7 +5,9 @@
5
5
  <div class="RelatedProducts__title">
6
6
  Related Products
7
7
  </div>
8
- <product-list :products="products" />
8
+ <product-list
9
+ :products="products"
10
+ :lazy="true" />
9
11
  </div>
10
12
  </template>
11
13
 
@@ -1,4 +1,5 @@
1
1
  import { mapGetters } from 'vuex';
2
+ import { staticLink } from '@lancom/shared/assets/js/utils/filters';
2
3
  import { generateShopHeadScripts } from '@lancom/shared/utils/head';
3
4
 
4
5
  const metaInfo = {
@@ -46,6 +47,12 @@ const metaInfo = {
46
47
  content: pageTitle
47
48
  }];
48
49
 
50
+ const link = [{
51
+ hid: 'canonical',
52
+ rel: 'canonical',
53
+ href: `https://${process.env.HOST_NAME}${this.$route.path === '/' ? '' : this.$route.path}`
54
+ }];
55
+
49
56
  if (hasQueryParams) {
50
57
  metaTags.push({
51
58
  hid: 'robots',
@@ -77,12 +84,22 @@ const metaInfo = {
77
84
  });
78
85
  }
79
86
 
80
- const pageImage = this.pageItem?.image || (this.pageItem?.images && this.pageItem?.images[0]) || image;
87
+ const pageImage = this.pageItemImage || this.pageItem?.image || (this.pageItem?.images && this.pageItem?.images[0]) || image;
81
88
  if (pageImage) {
89
+ const pageImageUrl = staticLink(typeof pageImage === 'string' ? pageImage : (pageImage.medium || pageImage.large));
82
90
  metaTags.push({
83
91
  hid: 'og:image',
84
92
  property: 'og:image',
85
- content: typeof pageImage === 'string' ? pageImage : (pageImage.medium || pageImage.large)
93
+ content: pageImageUrl
94
+ });
95
+
96
+ link.push({
97
+ hid: 'preloadImage',
98
+ rel: 'preload',
99
+ fetchpriority: 'high',
100
+ as: 'image',
101
+ type: 'image/webp',
102
+ href: pageImageUrl
86
103
  });
87
104
  }
88
105
 
@@ -100,11 +117,7 @@ const metaInfo = {
100
117
  return {
101
118
  title: pageTitle,
102
119
  meta: metaTags,
103
- link: [{
104
- hid: 'canonical',
105
- rel: 'canonical',
106
- href: `https://${process.env.HOST_NAME}${this.$route.path === '/' ? '' : this.$route.path}`
107
- }],
120
+ link,
108
121
  ...generateShopHeadScripts(this.shop)
109
122
  };
110
123
  },
@@ -20,6 +20,10 @@ const productPreview = {
20
20
  toEditor: {
21
21
  type: Boolean,
22
22
  default: true
23
+ },
24
+ lazy: {
25
+ type: Boolean,
26
+ default: true
23
27
  }
24
28
  },
25
29
  data() {
package/nuxt.config.js CHANGED
@@ -107,6 +107,7 @@ module.exports = (config, axios, { raygunClient, publicPath } = {}) => ({
107
107
  config.devtool = 'source-map';
108
108
  }
109
109
  },
110
+ analyze: !config.IS_LOCAL,
110
111
  extractCSS: !config.IS_LOCAL,
111
112
  },
112
113
  hooks: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.216",
3
+ "version": "0.0.217",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {