This commit is contained in:
Iliyan Angelov
2025-09-14 23:24:25 +03:00
commit c67067a2a4
71311 changed files with 6800714 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Mateusz Burzyński
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,26 @@
# use-isomorphic-layout-effect
A React helper hook for scheduling a layout effect with a fallback to a regular effect for environments where layout effects should not be used (such as server-side rendering).
## Installation
```sh
$ npm i use-isomorphic-layout-effect
```
## Usage
You only need to switch `useLayoutEffect` with `useIsomorphicLayoutEffect`
```diff
+ import useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect';
- import { useLayoutEffect } from 'react';
const YourComponent = () => {
+ useIsomorphicLayoutEffect(() => {
- useLayoutEffect(() => {
// your implementation
}, []);
};
```

View File

@@ -0,0 +1,3 @@
import { useLayoutEffect } from 'react';
declare const _default: typeof useLayoutEffect;
export default _default;

View File

@@ -0,0 +1 @@
exports._default = require("./use-isomorphic-layout-effect.browser.cjs.js").default;

View File

@@ -0,0 +1,9 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var react = require('react');
var index = react.useLayoutEffect ;
exports["default"] = index;

View File

@@ -0,0 +1,2 @@
import "./use-isomorphic-layout-effect.browser.cjs.js";
export { _default as default } from "./use-isomorphic-layout-effect.browser.cjs.default.js";

View File

@@ -0,0 +1,5 @@
import { useLayoutEffect } from 'react';
var index = useLayoutEffect ;
export { index as default };

View File

@@ -0,0 +1,3 @@
export * from "./declarations/src/index.js";
export { _default as default } from "./use-isomorphic-layout-effect.cjs.default.js";
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlLWlzb21vcnBoaWMtbGF5b3V0LWVmZmVjdC5janMuZC5tdHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL2RlY2xhcmF0aW9ucy9zcmMvaW5kZXguZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9

View File

@@ -0,0 +1,3 @@
export * from "./declarations/src/index.js";
export { default } from "./declarations/src/index.js";
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlLWlzb21vcnBoaWMtbGF5b3V0LWVmZmVjdC5janMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4vZGVjbGFyYXRpb25zL3NyYy9pbmRleC5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=

View File

@@ -0,0 +1 @@
export { default as _default } from "./declarations/src/index.js"

View File

@@ -0,0 +1 @@
exports._default = require("./use-isomorphic-layout-effect.cjs.js").default;

View File

@@ -0,0 +1,12 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var react = require('react');
var isClient = typeof document !== 'undefined';
var noop = function noop() {};
var index = isClient ? react.useLayoutEffect : noop;
exports["default"] = index;

View File

@@ -0,0 +1,2 @@
import "./use-isomorphic-layout-effect.cjs.js";
export { _default as default } from "./use-isomorphic-layout-effect.cjs.default.js";

View File

@@ -0,0 +1,8 @@
import { useLayoutEffect } from 'react';
var isClient = typeof document !== 'undefined';
var noop = function noop() {};
var index = isClient ? useLayoutEffect : noop;
export { index as default };

View File

@@ -0,0 +1,87 @@
{
"name": "use-isomorphic-layout-effect",
"version": "1.2.1",
"description": "A React helper hook for scheduling a layout effect with a fallback to a regular effect for environments where layout effects should not be used (such as server-side rendering).",
"main": "dist/use-isomorphic-layout-effect.cjs.js",
"module": "dist/use-isomorphic-layout-effect.esm.js",
"react-native": "./dist/use-isomorphic-layout-effect.browser.esm.js",
"browser": {
"./dist/use-isomorphic-layout-effect.esm.js": "./dist/use-isomorphic-layout-effect.browser.esm.js"
},
"types": "./dist/use-isomorphic-layout-effect.cjs.d.ts",
"exports": {
".": {
"types": {
"import": "./dist/use-isomorphic-layout-effect.cjs.mjs",
"default": "./dist/use-isomorphic-layout-effect.cjs.js"
},
"browser": {
"module": "./dist/use-isomorphic-layout-effect.browser.esm.js",
"import": "./dist/use-isomorphic-layout-effect.browser.cjs.mjs",
"default": "./dist/use-isomorphic-layout-effect.browser.cjs.js"
},
"react-native": {
"module": "./dist/use-isomorphic-layout-effect.browser.esm.js",
"import": "./dist/use-isomorphic-layout-effect.browser.cjs.mjs",
"default": "./dist/use-isomorphic-layout-effect.browser.cjs.js"
},
"module": "./dist/use-isomorphic-layout-effect.esm.js",
"import": "./dist/use-isomorphic-layout-effect.cjs.mjs",
"default": "./dist/use-isomorphic-layout-effect.cjs.js"
},
"./package.json": "./package.json"
},
"imports": {
"#is-client": {
"react-native": "./src/conditions/true.ts",
"browser": "./src/conditions/true.ts",
"default": "./src/conditions/is-client.ts"
}
},
"files": [
"dist"
],
"scripts": {
"test": "echo \"Warning: no test specified\"",
"build": "preconstruct build",
"prepare": "npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Andarist/use-isomorphic-layout-effect.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/Andarist/use-isomorphic-layout-effect/issues"
},
"homepage": "https://github.com/Andarist/use-isomorphic-layout-effect#readme",
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@babel/preset-typescript": "^7.26.0",
"@preconstruct/cli": "^2.8.10",
"@types/react": "^19.0.0",
"husky": "^9.1.7",
"lint-staged": "^10.2.11",
"prettier": "^3.4.2",
"react": "^19.0.0",
"typescript": "^5.7.2"
},
"preconstruct": {
"exports": {
"importConditionDefaultExport": "default"
},
"___experimentalFlags_WILL_CHANGE_IN_PATCH": {
"importsConditions": true
}
},
"packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977"
}