first commit

This commit is contained in:
2026-06-24 09:48:54 +02:00
commit 41e62ddcad
33739 changed files with 4266226 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 WorkOS
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.
+5
View File
@@ -0,0 +1,5 @@
# `react-use-is-hydrated`
## Usage
This is an internal utility, not intended for public usage.
+7
View File
@@ -0,0 +1,7 @@
/**
* Determines whether or not the component tree has been hydrated.
*/
declare function useIsHydratedModern(): boolean;
declare const useIsHydrated: typeof useIsHydratedModern;
export { useIsHydrated };
+7
View File
@@ -0,0 +1,7 @@
/**
* Determines whether or not the component tree has been hydrated.
*/
declare function useIsHydratedModern(): boolean;
declare const useIsHydrated: typeof useIsHydratedModern;
export { useIsHydrated };
+68
View File
@@ -0,0 +1,68 @@
"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);
// src/index.ts
var index_exports = {};
__export(index_exports, {
useIsHydrated: () => useIsHydrated2
});
module.exports = __toCommonJS(index_exports);
// src/use-is-hydrated.tsx
var React2 = __toESM(require("react"));
// src/use-is-hydrated-legacy.ts
var React = __toESM(require("react"));
var _isHydrated = false;
function useIsHydrated() {
const [isHydrated, setIsHydrated] = React.useState(_isHydrated);
React.useEffect(() => {
if (!_isHydrated) {
_isHydrated = true;
setIsHydrated(true);
}
}, []);
return isHydrated;
}
// src/use-is-hydrated.tsx
var useReactSyncExternalStore = React2[" useSyncExternalStore ".trim().toString()];
function subscribe() {
return () => {
};
}
function useIsHydratedModern() {
return useReactSyncExternalStore(
subscribe,
() => true,
() => false
);
}
var useIsHydrated2 = typeof useReactSyncExternalStore === "function" ? useIsHydratedModern : useIsHydrated;
//# sourceMappingURL=index.js.map
+7
View File
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/index.ts", "../src/use-is-hydrated.tsx", "../src/use-is-hydrated-legacy.ts"],
"sourcesContent": ["export { useIsHydrated } from './use-is-hydrated';\n", "import * as React from 'react';\nimport { useIsHydrated as useIsHydratedLegacy } from './use-is-hydrated-legacy';\n\nconst useReactSyncExternalStore: typeof React.useSyncExternalStore | undefined = (React as any)[\n ' useSyncExternalStore '.trim().toString()\n];\n\nfunction subscribe() {\n return () => {};\n}\n\n/**\n * Determines whether or not the component tree has been hydrated.\n */\nfunction useIsHydratedModern() {\n return useReactSyncExternalStore!(\n subscribe,\n () => true,\n () => false,\n );\n}\n\nexport const useIsHydrated =\n typeof useReactSyncExternalStore === 'function' ? useIsHydratedModern : useIsHydratedLegacy;\n", "import * as React from 'react';\n\nlet _isHydrated = false;\n\nexport function useIsHydrated() {\n const [isHydrated, setIsHydrated] = React.useState(_isHydrated);\n React.useEffect(() => {\n if (!_isHydrated) {\n _isHydrated = true;\n setIsHydrated(true);\n }\n }, []);\n return isHydrated;\n}\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,uBAAAA;AAAA;AAAA;;;ACAA,IAAAC,SAAuB;;;ACAvB,YAAuB;AAEvB,IAAI,cAAc;AAEX,SAAS,gBAAgB;AAC9B,QAAM,CAAC,YAAY,aAAa,IAAU,eAAS,WAAW;AAC9D,EAAM,gBAAU,MAAM;AACpB,QAAI,CAAC,aAAa;AAChB,oBAAc;AACd,oBAAc,IAAI;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,CAAC;AACL,SAAO;AACT;;;ADVA,IAAM,4BAA4EC,OAChF,yBAAyB,KAAK,EAAE,SAAS,CAC3C;AAEA,SAAS,YAAY;AACnB,SAAO,MAAM;AAAA,EAAC;AAChB;AAKA,SAAS,sBAAsB;AAC7B,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AACF;AAEO,IAAMC,iBACX,OAAO,8BAA8B,aAAa,sBAAsB;",
"names": ["useIsHydrated", "React", "React", "useIsHydrated"]
}
+35
View File
@@ -0,0 +1,35 @@
// src/use-is-hydrated.tsx
import * as React2 from "react";
// src/use-is-hydrated-legacy.ts
import * as React from "react";
var _isHydrated = false;
function useIsHydrated() {
const [isHydrated, setIsHydrated] = React.useState(_isHydrated);
React.useEffect(() => {
if (!_isHydrated) {
_isHydrated = true;
setIsHydrated(true);
}
}, []);
return isHydrated;
}
// src/use-is-hydrated.tsx
var useReactSyncExternalStore = React2[" useSyncExternalStore ".trim().toString()];
function subscribe() {
return () => {
};
}
function useIsHydratedModern() {
return useReactSyncExternalStore(
subscribe,
() => true,
() => false
);
}
var useIsHydrated2 = typeof useReactSyncExternalStore === "function" ? useIsHydratedModern : useIsHydrated;
export {
useIsHydrated2 as useIsHydrated
};
//# sourceMappingURL=index.mjs.map
+7
View File
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/use-is-hydrated.tsx", "../src/use-is-hydrated-legacy.ts"],
"sourcesContent": ["import * as React from 'react';\nimport { useIsHydrated as useIsHydratedLegacy } from './use-is-hydrated-legacy';\n\nconst useReactSyncExternalStore: typeof React.useSyncExternalStore | undefined = (React as any)[\n ' useSyncExternalStore '.trim().toString()\n];\n\nfunction subscribe() {\n return () => {};\n}\n\n/**\n * Determines whether or not the component tree has been hydrated.\n */\nfunction useIsHydratedModern() {\n return useReactSyncExternalStore!(\n subscribe,\n () => true,\n () => false,\n );\n}\n\nexport const useIsHydrated =\n typeof useReactSyncExternalStore === 'function' ? useIsHydratedModern : useIsHydratedLegacy;\n", "import * as React from 'react';\n\nlet _isHydrated = false;\n\nexport function useIsHydrated() {\n const [isHydrated, setIsHydrated] = React.useState(_isHydrated);\n React.useEffect(() => {\n if (!_isHydrated) {\n _isHydrated = true;\n setIsHydrated(true);\n }\n }, []);\n return isHydrated;\n}\n"],
"mappings": ";AAAA,YAAYA,YAAW;;;ACAvB,YAAY,WAAW;AAEvB,IAAI,cAAc;AAEX,SAAS,gBAAgB;AAC9B,QAAM,CAAC,YAAY,aAAa,IAAU,eAAS,WAAW;AAC9D,EAAM,gBAAU,MAAM;AACpB,QAAI,CAAC,aAAa;AAChB,oBAAc;AACd,oBAAc,IAAI;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,CAAC;AACL,SAAO;AACT;;;ADVA,IAAM,4BAA4EC,OAChF,yBAAyB,KAAK,EAAE,SAAS,CAC3C;AAEA,SAAS,YAAY;AACnB,SAAO,MAAM;AAAA,EAAC;AAChB;AAKA,SAAS,sBAAsB;AAC7B,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AACF;AAEO,IAAMC,iBACX,OAAO,8BAA8B,aAAa,sBAAsB;",
"names": ["React", "React", "useIsHydrated"]
}
+61
View File
@@ -0,0 +1,61 @@
{
"name": "@radix-ui/react-use-is-hydrated",
"version": "0.1.1",
"license": "MIT",
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"files": [
"src",
"dist",
"README.md"
],
"sideEffects": false,
"peerDependencies": {
"@types/react": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
},
"devDependencies": {
"@types/react": "^19.2.2",
"@types/react-dom": "^19.2.2",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"typescript": "^5.9.3",
"@repo/builder": "0.0.0",
"@repo/typescript-config": "0.0.0"
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git",
"directory": "packages/react/use-is-hydrated"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
},
"scripts": {
"lint": "oxlint --max-warnings 0 src",
"clean": "rm -rf dist",
"reset": "rm -rf dist node_modules",
"typecheck": "tsc --noEmit",
"build": "radix-build"
},
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
}
}
+1
View File
@@ -0,0 +1 @@
export { useIsHydrated } from './use-is-hydrated';
@@ -0,0 +1,14 @@
import * as React from 'react';
let _isHydrated = false;
export function useIsHydrated() {
const [isHydrated, setIsHydrated] = React.useState(_isHydrated);
React.useEffect(() => {
if (!_isHydrated) {
_isHydrated = true;
setIsHydrated(true);
}
}, []);
return isHydrated;
}
+24
View File
@@ -0,0 +1,24 @@
import * as React from 'react';
import { useIsHydrated as useIsHydratedLegacy } from './use-is-hydrated-legacy';
const useReactSyncExternalStore: typeof React.useSyncExternalStore | undefined = (React as any)[
' useSyncExternalStore '.trim().toString()
];
function subscribe() {
return () => {};
}
/**
* Determines whether or not the component tree has been hydrated.
*/
function useIsHydratedModern() {
return useReactSyncExternalStore!(
subscribe,
() => true,
() => false,
);
}
export const useIsHydrated =
typeof useReactSyncExternalStore === 'function' ? useIsHydratedModern : useIsHydratedLegacy;