import { Fragment, isValidElement } from 'react'; import type { ReactElement, ReactNode } from 'react'; import * as iconModule from '@/icons'; /** * Turns what the showcase is rendering back into the code that would render it. * * The registry stores components, not source: `Entry.render` and * `Composition.render` return an element tree and the JSX that produced them is * erased at build time. So the snippet is derived from the tree itself — the * same rule the icons page follows for SVG geometry. Nothing is authored twice * and a snippet cannot drift from what is on screen. * * The load-bearing part is `exportIndex`. No kit component sets `displayName`, * and a production `showcase:build` mangles `fn.name`, so a component's own * identity tells you nothing about what to call it. Instead every component * module is indexed by the *value* it exports, which yields both the exported * name and the published subpath — meaning `