@wix/site-service-above-the-fold 1.0.7 → 1.0.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.
|
@@ -8,8 +8,8 @@ export type IAboveTheFoldServiceConfig = {
|
|
|
8
8
|
[key: CompId | CompPath]: boolean;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
|
-
* Checks whether a component on the current page is above the fold, meaning
|
|
12
|
-
*
|
|
11
|
+
* Checks whether a component on the current page is above the fold, meaning the page's layout places it
|
|
12
|
+
* in the part of the page shown before a site visitor scrolls.
|
|
13
13
|
*/
|
|
14
14
|
export interface IAboveTheFoldService {
|
|
15
15
|
/**
|
|
@@ -44,7 +44,7 @@ export interface IAboveTheFoldService {
|
|
|
44
44
|
*
|
|
45
45
|
* function ProductImage({ id, src, alt }: { id: string; src: string; alt: string }) {
|
|
46
46
|
* const aboveTheFoldService = useService(AboveTheFoldDefinition)
|
|
47
|
-
* const isAboveTheFold = aboveTheFoldService.isInFirstFold(id)
|
|
47
|
+
* const isAboveTheFold = aboveTheFoldService.isInFirstFold(id)
|
|
48
48
|
*
|
|
49
49
|
* return (
|
|
50
50
|
* <img
|
|
@@ -60,13 +60,10 @@ export interface IAboveTheFoldService {
|
|
|
60
60
|
*
|
|
61
61
|
* @example Preload the images of components above the fold
|
|
62
62
|
* ```ts
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* const aboveTheFoldService = servicesManager.getService(AboveTheFoldDefinition)
|
|
66
|
-
*
|
|
63
|
+
* // aboveTheFoldService is resolved from @wix/site-service-above-the-fold, as in the first example.
|
|
67
64
|
* function imagesToPreload(images: { compId: string; src: string }[]) {
|
|
68
65
|
* return images
|
|
69
|
-
* .filter(({ compId }) => aboveTheFoldService.isInFirstFold(compId)
|
|
66
|
+
* .filter(({ compId }) => aboveTheFoldService.isInFirstFold(compId))
|
|
70
67
|
* .map(({ src }) => src)
|
|
71
68
|
* }
|
|
72
69
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/definition/index.ts"],"names":[],"mappings":";;;AAAA,oEAAyD;AA+E5C,QAAA,sBAAsB,GAAG,IAAA,oCAAa,EAClD,kCAAkC,CAClC,CAAA"}
|
|
@@ -8,8 +8,8 @@ export type IAboveTheFoldServiceConfig = {
|
|
|
8
8
|
[key: CompId | CompPath]: boolean;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
|
-
* Checks whether a component on the current page is above the fold, meaning
|
|
12
|
-
*
|
|
11
|
+
* Checks whether a component on the current page is above the fold, meaning the page's layout places it
|
|
12
|
+
* in the part of the page shown before a site visitor scrolls.
|
|
13
13
|
*/
|
|
14
14
|
export interface IAboveTheFoldService {
|
|
15
15
|
/**
|
|
@@ -44,7 +44,7 @@ export interface IAboveTheFoldService {
|
|
|
44
44
|
*
|
|
45
45
|
* function ProductImage({ id, src, alt }: { id: string; src: string; alt: string }) {
|
|
46
46
|
* const aboveTheFoldService = useService(AboveTheFoldDefinition)
|
|
47
|
-
* const isAboveTheFold = aboveTheFoldService.isInFirstFold(id)
|
|
47
|
+
* const isAboveTheFold = aboveTheFoldService.isInFirstFold(id)
|
|
48
48
|
*
|
|
49
49
|
* return (
|
|
50
50
|
* <img
|
|
@@ -60,13 +60,10 @@ export interface IAboveTheFoldService {
|
|
|
60
60
|
*
|
|
61
61
|
* @example Preload the images of components above the fold
|
|
62
62
|
* ```ts
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* const aboveTheFoldService = servicesManager.getService(AboveTheFoldDefinition)
|
|
66
|
-
*
|
|
63
|
+
* // aboveTheFoldService is resolved from @wix/site-service-above-the-fold, as in the first example.
|
|
67
64
|
* function imagesToPreload(images: { compId: string; src: string }[]) {
|
|
68
65
|
* return images
|
|
69
|
-
* .filter(({ compId }) => aboveTheFoldService.isInFirstFold(compId)
|
|
66
|
+
* .filter(({ compId }) => aboveTheFoldService.isInFirstFold(compId))
|
|
70
67
|
* .map(({ src }) => src)
|
|
71
68
|
* }
|
|
72
69
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AA+EzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAClD,kCAAkC,CAClC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/site-service-above-the-fold",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
]
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
-
"falconPackageHash": "
|
|
80
|
+
"falconPackageHash": "1b4966441744c0c4963fa961348392be546f387aed6bf06abacb0b99"
|
|
81
81
|
}
|
package/src/definition/index.ts
CHANGED
|
@@ -12,8 +12,8 @@ export type IAboveTheFoldServiceConfig = {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Checks whether a component on the current page is above the fold, meaning
|
|
16
|
-
*
|
|
15
|
+
* Checks whether a component on the current page is above the fold, meaning the page's layout places it
|
|
16
|
+
* in the part of the page shown before a site visitor scrolls.
|
|
17
17
|
*/
|
|
18
18
|
export interface IAboveTheFoldService {
|
|
19
19
|
/**
|
|
@@ -48,7 +48,7 @@ export interface IAboveTheFoldService {
|
|
|
48
48
|
*
|
|
49
49
|
* function ProductImage({ id, src, alt }: { id: string; src: string; alt: string }) {
|
|
50
50
|
* const aboveTheFoldService = useService(AboveTheFoldDefinition)
|
|
51
|
-
* const isAboveTheFold = aboveTheFoldService.isInFirstFold(id)
|
|
51
|
+
* const isAboveTheFold = aboveTheFoldService.isInFirstFold(id)
|
|
52
52
|
*
|
|
53
53
|
* return (
|
|
54
54
|
* <img
|
|
@@ -64,13 +64,10 @@ export interface IAboveTheFoldService {
|
|
|
64
64
|
*
|
|
65
65
|
* @example Preload the images of components above the fold
|
|
66
66
|
* ```ts
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* const aboveTheFoldService = servicesManager.getService(AboveTheFoldDefinition)
|
|
70
|
-
*
|
|
67
|
+
* // aboveTheFoldService is resolved from @wix/site-service-above-the-fold, as in the first example.
|
|
71
68
|
* function imagesToPreload(images: { compId: string; src: string }[]) {
|
|
72
69
|
* return images
|
|
73
|
-
* .filter(({ compId }) => aboveTheFoldService.isInFirstFold(compId)
|
|
70
|
+
* .filter(({ compId }) => aboveTheFoldService.isInFirstFold(compId))
|
|
74
71
|
* .map(({ src }) => src)
|
|
75
72
|
* }
|
|
76
73
|
* ```
|