@zag-js/remove-scroll
Advanced tools
Comparing version 0.0.0-dev-20220714012600 to 0.0.0-dev-20220714091855
@@ -1,1 +0,3 @@ | ||
export declare function preventBodyScroll(_document?: Document): () => void; | ||
declare function preventBodyScroll(_document?: Document): (() => void) | undefined; | ||
export { preventBodyScroll }; |
@@ -30,5 +30,4 @@ "use strict"; | ||
function getPlatform() { | ||
var _a; | ||
const agent = navigator.userAgentData; | ||
return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform; | ||
return (agent == null ? void 0 : agent.platform) ?? navigator.platform; | ||
} | ||
@@ -73,5 +72,4 @@ var pt = (v) => isDom() && v.test(getPlatform()); | ||
function preventBodyScroll(_document) { | ||
var _a; | ||
const doc = _document != null ? _document : document; | ||
const win = (_a = doc.defaultView) != null ? _a : window; | ||
const doc = _document ?? document; | ||
const win = doc.defaultView ?? window; | ||
const { documentElement, body } = doc; | ||
@@ -90,6 +88,5 @@ const locked = body.hasAttribute(LOCK_CLASSNAME); | ||
const setIOSStyle = () => { | ||
var _a2, _b; | ||
const { scrollX, scrollY, visualViewport } = win; | ||
const offsetLeft = (_a2 = visualViewport == null ? void 0 : visualViewport.offsetLeft) != null ? _a2 : 0; | ||
const offsetTop = (_b = visualViewport == null ? void 0 : visualViewport.offsetTop) != null ? _b : 0; | ||
const offsetLeft = (visualViewport == null ? void 0 : visualViewport.offsetLeft) ?? 0; | ||
const offsetTop = (visualViewport == null ? void 0 : visualViewport.offsetTop) ?? 0; | ||
const restoreStyle = assignStyle(body, { | ||
@@ -114,1 +111,5 @@ position: "fixed", | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
preventBodyScroll | ||
}); |
{ | ||
"name": "@zag-js/remove-scroll", | ||
"version": "0.0.0-dev-20220714012600", | ||
"version": "0.0.0-dev-20220714091855", | ||
"description": "JavaScript utility to remove scroll on body", | ||
@@ -21,20 +21,20 @@ "keywords": [ | ||
], | ||
"scripts": { | ||
"build:fast": "yarn zag build", | ||
"start": "yarn zag build --watch", | ||
"build": "yarn zag build --prod", | ||
"test": "jest --config ../../../jest.config.js --rootDir tests", | ||
"lint": "eslint src --ext .ts,.tsx", | ||
"test:ci": "yarn test --ci --runInBand --updateSnapshot", | ||
"test:watch": "yarn test --watchAll" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@zag-js/dom-utils": "0.0.0-dev-20220714012600" | ||
"devDependencies": { | ||
"@zag-js/dom-utils": "0.0.0-dev-20220714091855" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/chakra-ui/zag/issues" | ||
}, | ||
"scripts": { | ||
"build-fast": "tsup src/index.ts --format=esm,cjs", | ||
"start": "pnpm build --watch", | ||
"build": "tsup src/index.ts --format=esm,cjs --dts", | ||
"test": "jest --config ../../../jest.config.js --rootDir tests", | ||
"lint": "eslint src --ext .ts,.tsx", | ||
"test-ci": "pnpm test --ci --runInBand -u", | ||
"test-watch": "pnpm test --watchAll" | ||
} | ||
} | ||
} |
# @zag-js/remove-scroll | ||
## Installation | ||
@@ -15,9 +13,6 @@ | ||
Yes please! See the | ||
[contributing guidelines](https://github.com/chakra-ui/zag/blob/main/CONTRIBUTING.md) | ||
for details. | ||
Yes please! See the [contributing guidelines](https://github.com/chakra-ui/zag/blob/main/CONTRIBUTING.md) for details. | ||
## Licence | ||
This project is licensed under the terms of the | ||
[MIT license](https://github.com/chakra-ui/zag/blob/main/LICENSE). | ||
This project is licensed under the terms of the [MIT license](https://github.com/chakra-ui/zag/blob/main/LICENSE). |
Sorry, the diff of this file is not supported yet
9439
0
6
1
193
18
- Removed@zag-js/dom-utils@0.0.0-dev-20220714012600(transitive)
- Removed@zag-js/types@0.0.0-dev-20220714012600(transitive)
- Removed@zag-js/utils@0.1.2(transitive)
- Removedcsstype@3.1.0(transitive)