UNPKG

tdesign-react

Version:
132 lines (126 loc) 4.67 kB
/** * tdesign v1.11.6 * (c) 2025 tdesign * @license MIT */ import { _ as _asyncToGenerator, r as regenerator } from '../_chunks/dep-5d4b4c29.js'; import { _ as _typeof } from '../_chunks/dep-9a3c539e.js'; import { _ as _defineProperty } from '../_chunks/dep-fb209a0c.js'; import * as require$$0 from 'react-dom'; import require$$0__default from 'react-dom'; import '../_chunks/dep-49341028.js'; var client = {}; var hydrateRoot; var createRoot$1; 'use strict'; var m = require$$0__default; if (process.env.NODE_ENV === 'production') { createRoot$1 = client.createRoot = m.createRoot; hydrateRoot = client.hydrateRoot = m.hydrateRoot; } else { var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; createRoot$1 = client.createRoot = function (c, o) { i.usingClientEntryPoint = true; try { return m.createRoot(c, o); } finally { i.usingClientEntryPoint = false; } }; hydrateRoot = client.hydrateRoot = function (c, h, o) { i.usingClientEntryPoint = true; try { return m.hydrateRoot(c, h, o); } finally { i.usingClientEntryPoint = false; } }; } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } var fullClone = _objectSpread({}, require$$0); var version = fullClone.version, reactRender = fullClone.render, unmountComponentAtNode = fullClone.unmountComponentAtNode; var createRoot; try { var mainVersion = Number((version || "").split(".")[0]); if (mainVersion >= 18 && mainVersion < 19) { createRoot = fullClone.createRoot; } else if (mainVersion >= 19) { createRoot = createRoot$1; } } catch (e) {} function toggleWarning(skip) { var __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = fullClone.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; if (__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED && _typeof(__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === "object") { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint = skip; } } var MARK = "__td_react_root__"; function modernRender(node, container) { toggleWarning(true); var root = container[MARK] || createRoot(container); toggleWarning(false); root.render(node); container[MARK] = root; } function legacyRender(node, container) { reactRender(node, container); } function render(node, container) { if (createRoot) { modernRender(node, container); return; } legacyRender(node, container); } function modernUnmount(_x) { return _modernUnmount.apply(this, arguments); } function _modernUnmount() { _modernUnmount = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee(container) { return regenerator.wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: return _context.abrupt("return", Promise.resolve().then(function () { var _container$MARK; (_container$MARK = container[MARK]) === null || _container$MARK === void 0 || _container$MARK.unmount(); delete container[MARK]; })); case 1: case "end": return _context.stop(); } }, _callee); })); return _modernUnmount.apply(this, arguments); } function legacyUnmount(container) { unmountComponentAtNode(container); } function unmount(_x2) { return _unmount.apply(this, arguments); } function _unmount() { _unmount = _asyncToGenerator(/*#__PURE__*/regenerator.mark(function _callee2(container) { return regenerator.wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: if (!(createRoot !== void 0)) { _context2.next = 2; break; } return _context2.abrupt("return", modernUnmount(container)); case 2: legacyUnmount(container); case 3: case "end": return _context2.stop(); } }, _callee2); })); return _unmount.apply(this, arguments); } export { render, unmount }; //# sourceMappingURL=react-render.js.map