@zag-js/remove-scroll 0.10.1 → 0.10.3
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.
- package/dist/index.d.ts +1 -3
- package/dist/index.js +9 -31
- package/dist/index.mjs +5 -6
- package/package.json +3 -5
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,30 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
module.exports = __toCommonJS(src_exports);
|
|
26
|
-
var import_dom_query = require("@zag-js/dom-query");
|
|
27
|
-
var LOCK_CLASSNAME = "data-zag-scroll-lock";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const domQuery = require('@zag-js/dom-query');
|
|
6
|
+
|
|
7
|
+
const LOCK_CLASSNAME = "data-zag-scroll-lock";
|
|
28
8
|
function assignStyle(el, style) {
|
|
29
9
|
if (!el)
|
|
30
10
|
return;
|
|
@@ -84,13 +64,11 @@ function preventBodyScroll(_document) {
|
|
|
84
64
|
win.scrollTo(scrollX, scrollY);
|
|
85
65
|
};
|
|
86
66
|
};
|
|
87
|
-
const cleanups = [setScrollbarWidthProperty(),
|
|
67
|
+
const cleanups = [setScrollbarWidthProperty(), domQuery.isIos() ? setIOSStyle() : setStyle()];
|
|
88
68
|
return () => {
|
|
89
69
|
cleanups.forEach((fn) => fn?.());
|
|
90
70
|
body.removeAttribute(LOCK_CLASSNAME);
|
|
91
71
|
};
|
|
92
72
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
preventBodyScroll
|
|
96
|
-
});
|
|
73
|
+
|
|
74
|
+
exports.preventBodyScroll = preventBodyScroll;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { isIos } from '@zag-js/dom-query';
|
|
2
|
+
|
|
3
|
+
const LOCK_CLASSNAME = "data-zag-scroll-lock";
|
|
4
4
|
function assignStyle(el, style) {
|
|
5
5
|
if (!el)
|
|
6
6
|
return;
|
|
@@ -66,6 +66,5 @@ function preventBodyScroll(_document) {
|
|
|
66
66
|
body.removeAttribute(LOCK_CLASSNAME);
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
};
|
|
69
|
+
|
|
70
|
+
export { preventBodyScroll };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/remove-scroll",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "JavaScript utility to remove scroll on body",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@zag-js/dom-query": "0.10.
|
|
23
|
+
"@zag-js/dom-query": "0.10.3"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"clean-package": "2.2.0"
|
|
@@ -41,9 +41,7 @@
|
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"build
|
|
45
|
-
"start": "pnpm build --watch",
|
|
46
|
-
"build": "tsup src --dts",
|
|
44
|
+
"build": "vite build -c ../../../vite.config.ts",
|
|
47
45
|
"test": "jest --config ../../../jest.config.js --rootDir tests",
|
|
48
46
|
"lint": "eslint src --ext .ts,.tsx",
|
|
49
47
|
"test-ci": "pnpm test --ci --runInBand -u",
|