// MNote debug /tree shell icon templates and small DOM factories.
export const TREE_SHELL_ICONS = {
add: `
`,
more: `
`,
edit: `
`,
up: `
`,
page: `
`,
index: `
`,
mindmap: `
`,
table: `
`,
pdf: `
`,
book: `
`,
image: `
`,
video: `
`,
audio: `
`,
file: `
`,
};
export function createTreeShellKindBadge(kind) {
const badge = document.createElement("span");
badge.className = "tree-kind-badge";
badge.dataset.kind = kind;
badge.innerHTML =
kind === "mindmap"
? TREE_SHELL_ICONS.mindmap
: kind === "table"
? TREE_SHELL_ICONS.table
: kind === "pdf"
? TREE_SHELL_ICONS.pdf
: kind === "book"
? TREE_SHELL_ICONS.book
: kind === "image"
? TREE_SHELL_ICONS.image
: kind === "video"
? TREE_SHELL_ICONS.video
: kind === "audio"
? TREE_SHELL_ICONS.audio
: kind === "index"
? TREE_SHELL_ICONS.index
: kind === "page"
? TREE_SHELL_ICONS.page
: TREE_SHELL_ICONS.file;
return badge;
}
export function createTreeShellActionButton(icon, testId, title, onClick, disabled, busy) {
const button = document.createElement("button");
button.type = "button";
button.className = "tree-action";
button.dataset.testid = testId;
button.title = title;
button.setAttribute("aria-label", title);
button.innerHTML = icon;
button.disabled = disabled || busy;
button.addEventListener("click", (event) => {
event.stopPropagation();
onClick(button);
});
return button;
}