/* ============================================================================= * ui_template_elements_base.ts * 공통 컴포넌트의 내부 유틸 — 요소 생성 헬퍼. * * `ui_template_elements.ts` 가 700줄을 넘어 떼어냈다(2026-09-04). 차트·스타일 * 조각과 본체가 함께 쓰므로 순환 임포트를 피하려고 맨 아래층에 둔다. * ========================================================================== */ /** 요소 생성 + 속성/클래스/자식 일괄 설정 헬퍼 */ export function el( tag: K, options: { className?: string; text?: string; attrs?: Record; children?: (HTMLElement | string)[]; } = {}, ): HTMLElementTagNameMap[K] { const node = document.createElement(tag); if (options.className) node.className = options.className; if (options.text !== undefined) node.textContent = options.text; if (options.attrs) { for (const [k, v] of Object.entries(options.attrs)) { node.setAttribute(k, v); } } if (options.children) { for (const child of options.children) { node.append(child); } } return node; }