Files
openidea/src/ui/iconNode.ts
T
Mr0Bread 3d4a1fd387 refactor(ui): move iconNode out of editor/lsp (#3593)
iconNode only depends on ui/icons but lived in editor/lsp/iconMarkup.ts, so agents, database, debugger and viewers imported editor internals to draw an icon. It moves to ui/iconNode.ts. No behaviour change.

Co-authored-by: Mr0Bread <55754540+Mr0Bread@users.noreply.github.com>
2026-11-16 03:33:25 +08:00

11 lines
477 B
TypeScript

/** Design-system icons as DOM nodes for CodeMirror widgets. */
import { iconMarkupOrFallback, type IconName } from "./icons";
export function iconNode(name: IconName | (string & {}), size = 16, className?: string): HTMLElement {
const span = document.createElement("span");
span.className = className ? `cm-openidea-icon ${className}` : "cm-openidea-icon";
span.setAttribute("aria-hidden", "true");
span.innerHTML = iconMarkupOrFallback(name, size);
return span;
}