including-modules

This commit is contained in:
Kismet Hasanaj
2026-05-03 00:14:08 +02:00
parent ec83a0d879
commit 39a8a128be
20434 changed files with 3906546 additions and 3 deletions
+6
View File
@@ -0,0 +1,6 @@
type PortalProps = {
children: React.ReactNode;
type: string;
};
export declare const Portal: ({ children, type }: PortalProps) => import("react").ReactPortal | null;
export {};
+34
View File
@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Portal", {
enumerable: true,
get: function() {
return Portal;
}
});
const _react = require("react");
const _reactdom = require("react-dom");
const Portal = ({ children, type })=>{
const [portalNode, setPortalNode] = (0, _react.useState)(null);
(0, _react.useEffect)(()=>{
const element = document.createElement(type);
document.body.appendChild(element);
setPortalNode(element);
return ()=>{
document.body.removeChild(element);
};
}, [
type
]);
return portalNode ? /*#__PURE__*/ (0, _reactdom.createPortal)(children, portalNode) : null;
};
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/portal/index.tsx"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\ntype PortalProps = {\n children: React.ReactNode\n type: string\n}\n\nexport const Portal = ({ children, type }: PortalProps) => {\n const [portalNode, setPortalNode] = useState<HTMLElement | null>(null)\n\n useEffect(() => {\n const element = document.createElement(type)\n document.body.appendChild(element)\n setPortalNode(element)\n return () => {\n document.body.removeChild(element)\n }\n }, [type])\n\n return portalNode ? createPortal(children, portalNode) : null\n}\n"],"names":["Portal","children","type","portalNode","setPortalNode","useState","useEffect","element","document","createElement","body","appendChild","removeChild","createPortal"],"mappings":";;;;+BAQaA;;;eAAAA;;;uBARuB;0BACP;AAOtB,MAAMA,SAAS,CAAC,EAAEC,QAAQ,EAAEC,IAAI,EAAe;IACpD,MAAM,CAACC,YAAYC,cAAc,GAAGC,IAAAA,eAAQ,EAAqB;IAEjEC,IAAAA,gBAAS,EAAC;QACR,MAAMC,UAAUC,SAASC,aAAa,CAACP;QACvCM,SAASE,IAAI,CAACC,WAAW,CAACJ;QAC1BH,cAAcG;QACd,OAAO;YACLC,SAASE,IAAI,CAACE,WAAW,CAACL;QAC5B;IACF,GAAG;QAACL;KAAK;IAET,OAAOC,2BAAaU,IAAAA,sBAAY,EAACZ,UAAUE,cAAc;AAC3D","ignoreList":[0]}