@zag-js/remove-scroll 0.2.2 → 0.2.4

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.js CHANGED
@@ -23,21 +23,8 @@ __export(src_exports, {
23
23
  preventBodyScroll: () => preventBodyScroll
24
24
  });
25
25
  module.exports = __toCommonJS(src_exports);
26
-
27
- // ../dom/src/platform.ts
28
- var isDom = () => typeof window !== "undefined";
29
- function getPlatform() {
30
- const agent = navigator.userAgentData;
31
- return agent?.platform ?? navigator.platform;
32
- }
33
- var pt = (v) => isDom() && v.test(getPlatform());
34
- var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
35
- var isMac = () => pt(/^Mac/) && !isTouchDevice;
36
- var isApple = () => pt(/mac|iphone|ipad|ipod/i);
37
- var isIos = () => isApple() && !isMac();
38
-
39
- // src/index.ts
40
- var LOCK_CLASSNAME = "data-scroll-lock";
26
+ var import_dom_query = require("@zag-js/dom-query");
27
+ var LOCK_CLASSNAME = "data-zag-scroll-lock";
41
28
  function assignStyle(el, style) {
42
29
  if (!el)
43
30
  return () => {
@@ -99,7 +86,7 @@ function preventBodyScroll(_document) {
99
86
  win.scrollTo(scrollX, scrollY);
100
87
  };
101
88
  };
102
- const cleanups = [setScrollbarWidthProperty(), isIos() ? setIOSStyle() : setStyle()];
89
+ const cleanups = [setScrollbarWidthProperty(), (0, import_dom_query.isIos)() ? setIOSStyle() : setStyle()];
103
90
  return () => {
104
91
  cleanups.forEach((cleanup) => cleanup());
105
92
  body.removeAttribute(LOCK_CLASSNAME);
package/dist/index.mjs CHANGED
@@ -1,17 +1,6 @@
1
- // ../dom/src/platform.ts
2
- var isDom = () => typeof window !== "undefined";
3
- function getPlatform() {
4
- const agent = navigator.userAgentData;
5
- return agent?.platform ?? navigator.platform;
6
- }
7
- var pt = (v) => isDom() && v.test(getPlatform());
8
- var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
9
- var isMac = () => pt(/^Mac/) && !isTouchDevice;
10
- var isApple = () => pt(/mac|iphone|ipad|ipod/i);
11
- var isIos = () => isApple() && !isMac();
12
-
13
1
  // src/index.ts
14
- var LOCK_CLASSNAME = "data-scroll-lock";
2
+ import { isIos } from "@zag-js/dom-query";
3
+ var LOCK_CLASSNAME = "data-zag-scroll-lock";
15
4
  function assignStyle(el, style) {
16
5
  if (!el)
17
6
  return () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/remove-scroll",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "JavaScript utility to remove scroll on body",
5
5
  "keywords": [
6
6
  "js",
@@ -18,9 +18,11 @@
18
18
  "publishConfig": {
19
19
  "access": "public"
20
20
  },
21
+ "dependencies": {
22
+ "@zag-js/dom-query": "0.1.4"
23
+ },
21
24
  "devDependencies": {
22
- "clean-package": "2.2.0",
23
- "@zag-js/dom-utils": "0.2.4"
25
+ "clean-package": "2.2.0"
24
26
  },
25
27
  "bugs": {
26
28
  "url": "https://github.com/chakra-ui/zag/issues"