Files
med-notes/.pnpm-store/v10/files/16/163c903f46fda9169b51cc161b3ef25e19a70dd34cbb9a2439ee676aff9f562f41314f13ae77c5026e8da1116f623cb89630dbc0317dddf957b20296655d10
2025-05-09 05:30:08 +02:00

24 lines
1.0 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = StructTreeItem;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const structTreeUtils_js_1 = require("./shared/structTreeUtils.js");
function StructTreeItem({ className, node, }) {
const attributes = (0, react_1.useMemo)(() => (0, structTreeUtils_js_1.getAttributes)(node), [node]);
const children = (0, react_1.useMemo)(() => {
if (!(0, structTreeUtils_js_1.isStructTreeNode)(node)) {
return null;
}
if ((0, structTreeUtils_js_1.isStructTreeNodeWithOnlyContentChild)(node)) {
return null;
}
return node.children.map((child, index) => {
return (
// biome-ignore lint/suspicious/noArrayIndexKey: index is stable here
(0, jsx_runtime_1.jsx)(StructTreeItem, { node: child }, index));
});
}, [node]);
return ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: className }, attributes, { children: children })));
}