@destyler/remove-scroll 0.0.7-beta.9 → 0.2.0-beta.5
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.
|
@@ -24,15 +24,13 @@ function setCSSProperty(el, property, value) {
|
|
|
24
24
|
}
|
|
25
25
|
function getPaddingProperty(documentElement) {
|
|
26
26
|
const documentLeft = documentElement.getBoundingClientRect().left;
|
|
27
|
-
|
|
28
|
-
return scrollbarX ? "paddingLeft" : "paddingRight";
|
|
27
|
+
return Math.round(documentLeft) + documentElement.scrollLeft ? "paddingLeft" : "paddingRight";
|
|
29
28
|
}
|
|
30
29
|
function preventBodyScroll(_document) {
|
|
31
30
|
const doc = _document ?? document;
|
|
32
31
|
const win = doc.defaultView ?? window;
|
|
33
32
|
const { documentElement, body } = doc;
|
|
34
|
-
|
|
35
|
-
if (locked) return;
|
|
33
|
+
if (body.hasAttribute(LOCK_CLASSNAME)) return;
|
|
36
34
|
body.setAttribute(LOCK_CLASSNAME, "");
|
|
37
35
|
const scrollbarWidth = win.innerWidth - documentElement.clientWidth;
|
|
38
36
|
const setScrollbarWidthProperty = () => setCSSProperty(documentElement, "--scrollbar-width", `${scrollbarWidth}px`);
|
package/package.json
CHANGED
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@destyler/remove-scroll",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.2.0-beta.5",
|
|
5
5
|
"description": "remove scroll on body of UI machines",
|
|
6
6
|
"author": "Elone Hoo <elonehoo@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
+
"homepage": "https://github.com/destyler/destyler",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/destyler/destyler.git",
|
|
12
|
+
"directory": "packages/shareds/remove-scroll"
|
|
13
|
+
},
|
|
8
14
|
"exports": {
|
|
9
|
-
".": "./dist/index.
|
|
15
|
+
".": "./dist/index.mjs"
|
|
10
16
|
},
|
|
11
|
-
"main": "dist/index.
|
|
12
|
-
"module": "dist/index.
|
|
13
|
-
"types": "dist/index.d.
|
|
17
|
+
"main": "dist/index.mjs",
|
|
18
|
+
"module": "dist/index.mjs",
|
|
19
|
+
"types": "dist/index.d.mts",
|
|
14
20
|
"files": [
|
|
15
21
|
"*.d.ts",
|
|
16
22
|
"dist"
|
|
17
23
|
],
|
|
18
24
|
"dependencies": {
|
|
19
|
-
"@destyler/dom": "0.0
|
|
25
|
+
"@destyler/dom": "0.2.0-beta.5"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
20
29
|
},
|
|
21
30
|
"scripts": {
|
|
22
31
|
"clear": "rimraf ./dist",
|
|
File without changes
|