chore: install prettier

This commit is contained in:
Viet An
2026-05-04 15:22:27 +07:00
parent 93d29ca7d8
commit bd58e2b847
267 changed files with 22950 additions and 13581 deletions

View File

@@ -2,7 +2,7 @@ export async function renderSvg(relativePath) {
const svgRes = await fetch(relativePath);
const svgText = await svgRes.text();
const parser = new DOMParser();
const svgDoc = parser.parseFromString(svgText, 'image/svg+xml');
const svgDoc = parser.parseFromString(svgText, "image/svg+xml");
const svgElement = svgDoc.documentElement;
return svgElement;
@@ -12,21 +12,21 @@ export function html(tag, props = {}, children = []) {
const element = document.createElement(tag);
Object.entries(props).forEach(([key, value]) => {
if (key === 'textContent' || key === 'innerHTML') {
if (key === "textContent" || key === "innerHTML") {
element[key] = value;
} else if (key === 'style' && typeof value === 'object') {
} else if (key === "style" && typeof value === "object") {
Object.assign(element.style, value);
} else if (key === 'class') {
} else if (key === "class") {
element.className = value;
} else if (key.startsWith('on')) {
} else if (key.startsWith("on")) {
element.addEventListener(key.slice(2).toLowerCase(), value);
} else {
element.setAttribute(key, value);
}
});
children.flat().forEach(child => {
if (typeof child === 'string') {
children.flat().forEach((child) => {
if (typeof child === "string") {
element.appendChild(document.createTextNode(child));
} else if (child instanceof Node) {
element.appendChild(child);