@chat-de-hp/site 0.2.9 → 0.3.0
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type CaptureViewportWindow = Pick<Window, "document"
|
|
1
|
+
type CaptureViewportWindow = Pick<Window, "document">;
|
|
2
2
|
export declare function freezeCaptureViewport(targetWindow?: CaptureViewportWindow): () => void;
|
|
3
3
|
export {};
|
|
4
4
|
//# sourceMappingURL=capture-viewport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture-viewport.d.ts","sourceRoot":"","sources":["../../src/runtime/capture-viewport.ts"],"names":[],"mappings":"AAAA,KAAK,qBAAqB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"capture-viewport.d.ts","sourceRoot":"","sources":["../../src/runtime/capture-viewport.ts"],"names":[],"mappings":"AAAA,KAAK,qBAAqB,GAAG,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAEtD,wBAAgB,qBAAqB,CACnC,YAAY,GAAE,qBAA8B,cA0B7C"}
|
|
@@ -1,39 +1,24 @@
|
|
|
1
1
|
export function freezeCaptureViewport(targetWindow = window) {
|
|
2
2
|
const { body, documentElement } = targetWindow.document;
|
|
3
|
-
const scrollX = targetWindow.scrollX;
|
|
4
|
-
const scrollY = targetWindow.scrollY;
|
|
5
3
|
const documentStyles = {
|
|
6
4
|
overflow: documentElement.style.overflow,
|
|
7
5
|
touchAction: documentElement.style.touchAction,
|
|
8
6
|
};
|
|
9
7
|
const bodyStyles = {
|
|
10
|
-
left: body.style.left,
|
|
11
8
|
overflow: body.style.overflow,
|
|
12
9
|
pointerEvents: body.style.pointerEvents,
|
|
13
|
-
position: body.style.position,
|
|
14
|
-
top: body.style.top,
|
|
15
10
|
touchAction: body.style.touchAction,
|
|
16
|
-
width: body.style.width,
|
|
17
11
|
};
|
|
18
12
|
documentElement.style.overflow = "hidden";
|
|
19
13
|
documentElement.style.touchAction = "none";
|
|
20
|
-
body.style.position = "fixed";
|
|
21
|
-
body.style.top = `-${scrollY}px`;
|
|
22
|
-
body.style.left = `-${scrollX}px`;
|
|
23
|
-
body.style.width = "100%";
|
|
24
14
|
body.style.overflow = "hidden";
|
|
25
15
|
body.style.pointerEvents = "none";
|
|
26
16
|
body.style.touchAction = "none";
|
|
27
17
|
return () => {
|
|
28
18
|
documentElement.style.overflow = documentStyles.overflow;
|
|
29
19
|
documentElement.style.touchAction = documentStyles.touchAction;
|
|
30
|
-
body.style.left = bodyStyles.left;
|
|
31
20
|
body.style.overflow = bodyStyles.overflow;
|
|
32
21
|
body.style.pointerEvents = bodyStyles.pointerEvents;
|
|
33
|
-
body.style.position = bodyStyles.position;
|
|
34
|
-
body.style.top = bodyStyles.top;
|
|
35
22
|
body.style.touchAction = bodyStyles.touchAction;
|
|
36
|
-
body.style.width = bodyStyles.width;
|
|
37
|
-
targetWindow.scrollTo(scrollX, scrollY);
|
|
38
23
|
};
|
|
39
24
|
}
|