@lancom/shared 0.0.240 → 0.0.242

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.
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <div class="FaqAsync__wrapper">
3
+ <placeholder
4
+ v-if="!isLoadedComponent"
5
+ style="height: 300px" />
6
+ <faq
7
+ v-else
8
+ v-bind="$attrs">
9
+ <template v-for="(_, slot) of $scopedSlots" v-slot:[slot]="scope">
10
+ <slot :name="slot" v-bind="scope"></slot>
11
+ </template>
12
+ </faq>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ import Vue from 'vue';
18
+ import ComponentAsyncMixin from '@lancom/shared/mixins/component-async';
19
+ import Placeholder from '@lancom/shared/components/placeholder/placeholder';
20
+
21
+ export default {
22
+ name: 'FaqAsync',
23
+ components: {
24
+ Placeholder
25
+ },
26
+ mixins: [ComponentAsyncMixin],
27
+ methods: {
28
+ async importComponents() {
29
+ const component = await import('./faq');
30
+ Vue.component('faq', component.default);
31
+ }
32
+ }
33
+ };
34
+ </script>
@@ -0,0 +1,19 @@
1
+ .Placeholder {
2
+ &__wrapper{
3
+ width: 100%;
4
+ animation-name: backgroundColorPalette;
5
+ animation-duration: 1s;
6
+ animation-iteration-count: infinite;
7
+ animation-direction: alternate;
8
+ margin: 10px 0;
9
+ }
10
+ }
11
+
12
+ @keyframes backgroundColorPalette {
13
+ 0% {
14
+ background: #efefef;
15
+ }
16
+ 100% {
17
+ background: #e4e2e2;
18
+ }
19
+ }
@@ -0,0 +1,13 @@
1
+ <template>
2
+ <div class="Placeholder__wrapper"></div>
3
+ </template>
4
+
5
+ <script>
6
+ export default {
7
+ name: 'Placeholder'
8
+ };
9
+ </script>
10
+
11
+ <style lang="scss" scoped>
12
+ @import 'placeholder';
13
+ </style>
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <div class="PrintedProductImagesAsync__wrapper">
3
+ <placeholder
4
+ v-if="!isLoadedComponent"
5
+ style="height: 200px" />
6
+ <printed-product-images
7
+ v-else
8
+ v-bind="$attrs" />
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ import Vue from 'vue';
14
+ import ComponentAsyncMixin from '@lancom/shared/mixins/component-async';
15
+ import Placeholder from '@lancom/shared/components/placeholder/placeholder';
16
+
17
+ export default {
18
+ name: 'PrintedProductImagesAsync',
19
+ components: {
20
+ Placeholder
21
+ },
22
+ mixins: [ComponentAsyncMixin],
23
+ methods: {
24
+ async importComponents() {
25
+ const component = await import('./printed-product-images');
26
+ Vue.component('printed-product-images', component.default);
27
+ }
28
+ }
29
+ };
30
+ </script>
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <div class="ProductInfoTabsAsync__wrapper">
3
+ <placeholder
4
+ v-if="!isLoadedComponent"
5
+ style="height: 200px" />
6
+ <product-info-tabs
7
+ v-else
8
+ v-bind="$attrs" />
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ import Vue from 'vue';
14
+ import ComponentAsyncMixin from '@lancom/shared/mixins/component-async';
15
+ import Placeholder from '@lancom/shared/components/placeholder/placeholder';
16
+
17
+ export default {
18
+ name: 'ProductInfoTabsAsync',
19
+ components: {
20
+ Placeholder
21
+ },
22
+ mixins: [ComponentAsyncMixin],
23
+ methods: {
24
+ async importComponents() {
25
+ const component = await import('./product-info-tabs');
26
+ Vue.component('product-info-tabs', component.default);
27
+ }
28
+ }
29
+ };
30
+ </script>
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <div class="ProductReviewsAsync__wrapper">
3
+ <placeholder
4
+ v-if="!isLoadedComponent"
5
+ style="height: 200px" />
6
+ <product-reviews
7
+ v-else
8
+ v-bind="$attrs" />
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ import Vue from 'vue';
14
+ import ComponentAsyncMixin from '@lancom/shared/mixins/component-async';
15
+ import Placeholder from '@lancom/shared/components/placeholder/placeholder';
16
+
17
+ export default {
18
+ name: 'ProductReviewsAsync',
19
+ components: {
20
+ Placeholder
21
+ },
22
+ mixins: [ComponentAsyncMixin],
23
+ methods: {
24
+ async importComponents() {
25
+ const component = await import('./product-reviews');
26
+ Vue.component('product-reviews', component.default);
27
+ }
28
+ }
29
+ };
30
+ </script>
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <div class="RelatedProductsAsync__wrapper">
3
+ <placeholder
4
+ v-if="!isLoadedComponent"
5
+ style="height: 200px" />
6
+ <related-products
7
+ v-else
8
+ v-bind="$attrs" />
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ import Vue from 'vue';
14
+ import ComponentAsyncMixin from '@lancom/shared/mixins/component-async';
15
+ import Placeholder from '@lancom/shared/components/placeholder/placeholder';
16
+
17
+ export default {
18
+ name: 'RelatedProductsAsync',
19
+ components: {
20
+ Placeholder
21
+ },
22
+ mixins: [ComponentAsyncMixin],
23
+ methods: {
24
+ async importComponents() {
25
+ const component = await import('./related-products');
26
+ Vue.component('related-products', component.default);
27
+ }
28
+ }
29
+ };
30
+ </script>
@@ -0,0 +1,26 @@
1
+ export default {
2
+ data() {
3
+ return {
4
+ isLoadedComponent: false,
5
+ observer: null
6
+ };
7
+ },
8
+ async mounted() {
9
+ if (process.client && !this.isLoadedComponent) {
10
+ this.observer = new IntersectionObserver(async (entries) => {
11
+ if(entries[0].isIntersecting === true) {
12
+ await this.importComponents();
13
+ this.isLoadedComponent = true;
14
+ }
15
+ }, { threshold: [0.1] });
16
+
17
+ this.observer.observe(this.$el);
18
+ }
19
+ },
20
+ destroyed() {
21
+ this.observer.unobserve(this.$el);
22
+ },
23
+ methods: {
24
+ async importComponents() {}
25
+ }
26
+ };
package/nuxt.config.js CHANGED
@@ -91,9 +91,9 @@ module.exports = (config, axios, { raygunClient, publicPath } = {}) => ({
91
91
  },
92
92
  build: {
93
93
  splitChunks: {
94
- layouts: false,
95
- pages: false,
96
- commons: false
94
+ layouts: true,
95
+ pages: true,
96
+ commons: true
97
97
  },
98
98
  publicPath: publicPath || '/client/',
99
99
  postcss: null,
@@ -111,6 +111,10 @@ module.exports = (config, axios, { raygunClient, publicPath } = {}) => ({
111
111
  analyze: !config.IS_LOCAL,
112
112
  extractCSS: !config.IS_LOCAL,
113
113
  },
114
+ render: {
115
+ asyncScripts: true,
116
+ // resourceHints: false
117
+ },
114
118
  hooks: {
115
119
  render: {
116
120
  errorMiddleware(app) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.240",
3
+ "version": "0.0.242",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {