Initial commit

This commit is contained in:
maojindao55
2025-02-12 17:18:18 +08:00
commit 394e5640e9
8002 changed files with 1687177 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
# `react-use-layout-effect`
## Installation
```sh
$ yarn add @radix-ui/react-use-layout-effect
# or
$ npm install @radix-ui/react-use-layout-effect
```
## Usage
This is an internal utility, not intended for public usage.

View File

@@ -0,0 +1,12 @@
import * as React from 'react';
/**
* On the server, React emits a warning when calling `useLayoutEffect`.
* This is because neither `useLayoutEffect` nor `useEffect` run on the server.
* We use this safe version which suppresses the warning by replacing it with a noop on the server.
*
* See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
*/
declare const useLayoutEffect: typeof React.useLayoutEffect;
export { useLayoutEffect };

View File

@@ -0,0 +1,12 @@
import * as React from 'react';
/**
* On the server, React emits a warning when calling `useLayoutEffect`.
* This is because neither `useLayoutEffect` nor `useEffect` run on the server.
* We use this safe version which suppresses the warning by replacing it with a noop on the server.
*
* See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
*/
declare const useLayoutEffect: typeof React.useLayoutEffect;
export { useLayoutEffect };

View File

@@ -0,0 +1,41 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// packages/react/use-layout-effect/src/index.ts
var src_exports = {};
__export(src_exports, {
useLayoutEffect: () => useLayoutEffect2
});
module.exports = __toCommonJS(src_exports);
// packages/react/use-layout-effect/src/useLayoutEffect.tsx
var React = __toESM(require("react"));
var useLayoutEffect2 = Boolean(globalThis?.document) ? React.useLayoutEffect : () => {
};
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/index.ts", "../src/useLayoutEffect.tsx"],
"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"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAAA;AAAA;AAAA;;;ACAA,YAAuB;AASvB,IAAMC,mBAAkB,QAAQ,YAAY,QAAQ,IAAU,wBAAkB,MAAM;AAAC;",
"names": ["useLayoutEffect", "useLayoutEffect"]
}

View File

@@ -0,0 +1,8 @@
// packages/react/use-layout-effect/src/useLayoutEffect.tsx
import * as React from "react";
var useLayoutEffect2 = Boolean(globalThis?.document) ? React.useLayoutEffect : () => {
};
export {
useLayoutEffect2 as useLayoutEffect
};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/useLayoutEffect.tsx"],
"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"],
"mappings": ";AAAA,YAAY,WAAW;AASvB,IAAMA,mBAAkB,QAAQ,YAAY,QAAQ,IAAU,wBAAkB,MAAM;AAAC;",
"names": ["useLayoutEffect"]
}

View File

@@ -0,0 +1,79 @@
{
"_from": "@radix-ui/react-use-layout-effect@1.1.0",
"_id": "@radix-ui/react-use-layout-effect@1.1.0",
"_inBundle": false,
"_integrity": "sha512-+FPE0rOdziWSrH9athwI1R0HDVbWlEhd+FR+aSDk4uWGmSJ9Z54sdZVDQPZAinJhJXwfT+qnj969mCsT2gfm5w==",
"_location": "/@radix-ui/react-use-layout-effect",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@radix-ui/react-use-layout-effect@1.1.0",
"name": "@radix-ui/react-use-layout-effect",
"escapedName": "@radix-ui%2freact-use-layout-effect",
"scope": "@radix-ui",
"rawSpec": "1.1.0",
"saveSpec": null,
"fetchSpec": "1.1.0"
},
"_requiredBy": [
"/@radix-ui/react-id",
"/@radix-ui/react-popper",
"/@radix-ui/react-portal",
"/@radix-ui/react-presence",
"/@radix-ui/react-scroll-area",
"/@radix-ui/react-use-size"
],
"_resolved": "https://registry.npmmirror.com/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.0.tgz",
"_shasum": "3c2c8ce04827b26a39e442ff4888d9212268bd27",
"_spec": "@radix-ui/react-use-layout-effect@1.1.0",
"_where": "/Users/hongbin9/www/botgroup.chat/node_modules/@radix-ui/react-id",
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "## Installation",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"files": [
"dist",
"README.md"
],
"homepage": "https://radix-ui.com/primitives",
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"name": "@radix-ui/react-use-layout-effect",
"peerDependencies": {
"@types/react": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"scripts": {
"clean": "rm -rf dist",
"version": "yarn version"
},
"sideEffects": false,
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"version": "1.1.0"
}