@radix-ui/react-use-layout-effect 0.0.0-20250116175529

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/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # `react-use-layout-effect`
2
+
3
+ ## Installation
4
+
5
+ ```sh
6
+ $ yarn add @radix-ui/react-use-layout-effect
7
+ # or
8
+ $ npm install @radix-ui/react-use-layout-effect
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ This is an internal utility, not intended for public usage.
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+
3
+ /**
4
+ * On the server, React emits a warning when calling `useLayoutEffect`.
5
+ * This is because neither `useLayoutEffect` nor `useEffect` run on the server.
6
+ * We use this safe version which suppresses the warning by replacing it with a noop on the server.
7
+ *
8
+ * See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
9
+ */
10
+ declare const useLayoutEffect: typeof React.useLayoutEffect;
11
+
12
+ export { useLayoutEffect };
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+
3
+ /**
4
+ * On the server, React emits a warning when calling `useLayoutEffect`.
5
+ * This is because neither `useLayoutEffect` nor `useEffect` run on the server.
6
+ * We use this safe version which suppresses the warning by replacing it with a noop on the server.
7
+ *
8
+ * See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
9
+ */
10
+ declare const useLayoutEffect: typeof React.useLayoutEffect;
11
+
12
+ export { useLayoutEffect };
package/dist/index.js ADDED
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/react/use-layout-effect/src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ useLayoutEffect: () => useLayoutEffect2
34
+ });
35
+ module.exports = __toCommonJS(src_exports);
36
+
37
+ // packages/react/use-layout-effect/src/useLayoutEffect.tsx
38
+ var React = __toESM(require("react"));
39
+ var useLayoutEffect2 = Boolean(globalThis?.document) ? React.useLayoutEffect : () => {
40
+ };
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts", "../src/useLayoutEffect.tsx"],
4
+ "sourcesContent": ["export { useLayoutEffect } from './useLayoutEffect';\n", "import * as React from 'react';\n\n/**\n * On the server, React emits a warning when calling `useLayoutEffect`.\n * This is because neither `useLayoutEffect` nor `useEffect` run on the server.\n * We use this safe version which suppresses the warning by replacing it with a noop on the server.\n *\n * See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect\n */\nconst useLayoutEffect = Boolean(globalThis?.document) ? React.useLayoutEffect : () => {};\n\nexport { useLayoutEffect };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAAA;AAAA;AAAA;;;ACAA,YAAuB;AASvB,IAAMC,mBAAkB,QAAQ,YAAY,QAAQ,IAAU,wBAAkB,MAAM;AAAC;",
6
+ "names": ["useLayoutEffect", "useLayoutEffect"]
7
+ }
package/dist/index.mjs ADDED
@@ -0,0 +1,8 @@
1
+ // packages/react/use-layout-effect/src/useLayoutEffect.tsx
2
+ import * as React from "react";
3
+ var useLayoutEffect2 = Boolean(globalThis?.document) ? React.useLayoutEffect : () => {
4
+ };
5
+ export {
6
+ useLayoutEffect2 as useLayoutEffect
7
+ };
8
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/useLayoutEffect.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\n\n/**\n * On the server, React emits a warning when calling `useLayoutEffect`.\n * This is because neither `useLayoutEffect` nor `useEffect` run on the server.\n * We use this safe version which suppresses the warning by replacing it with a noop on the server.\n *\n * See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect\n */\nconst useLayoutEffect = Boolean(globalThis?.document) ? React.useLayoutEffect : () => {};\n\nexport { useLayoutEffect };\n"],
5
+ "mappings": ";AAAA,YAAY,WAAW;AASvB,IAAMA,mBAAkB,QAAQ,YAAY,QAAQ,IAAU,wBAAkB,MAAM;AAAC;",
6
+ "names": ["useLayoutEffect"]
7
+ }
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@radix-ui/react-use-layout-effect",
3
+ "version": "0.0.0-20250116175529",
4
+ "license": "MIT",
5
+ "exports": {
6
+ ".": {
7
+ "import": {
8
+ "types": "./dist/index.d.mts",
9
+ "default": "./dist/index.mjs"
10
+ },
11
+ "require": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ }
15
+ }
16
+ },
17
+ "source": "./src/index.ts",
18
+ "main": "./dist/index.js",
19
+ "module": "./dist/index.mjs",
20
+ "types": "./dist/index.d.ts",
21
+ "files": [
22
+ "dist",
23
+ "README.md"
24
+ ],
25
+ "sideEffects": false,
26
+ "scripts": {
27
+ "clean": "rm -rf dist"
28
+ },
29
+ "peerDependencies": {
30
+ "@types/react": "*",
31
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "@types/react": {
35
+ "optional": true
36
+ }
37
+ },
38
+ "homepage": "https://radix-ui.com/primitives",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/radix-ui/primitives.git"
42
+ },
43
+ "bugs": {
44
+ "url": "https://github.com/radix-ui/primitives/issues"
45
+ }
46
+ }