mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
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>
11 lines
477 B
TypeScript
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;
|
|
}
|