calvesca's picture
Upload folder using huggingface_hub
0bd62e5 verified
export type ComponentData = {
id: string;
name: string;
template: string;
author: string;
description: string;
tags: string;
version: string;
subdomain: string;
background_color: string;
likes: number;
};
export const classToEmojiMapping: { [key: string]: string } = {
AnnotatedImage: "πŸ–ΌοΈ",
Audio: "πŸ”Š",
Plot: "πŸ“ˆ",
Button: "πŸ”˜",
Chatbot: "πŸ€–",
Code: "πŸ’»",
ColorPicker: "🎨",
Dataframe: "πŸ“Š",
Dataset: "πŸ“š",
Fallback: "πŸ”„",
File: "πŸ“„",
FileExplorer: "πŸ“‚",
Gallery: "🎨",
HighlightedText: "✨",
HTML: "πŸ”—",
Image: "πŸ–ΌοΈ",
JSON: "πŸ“",
Label: "🏷️",
Markdown: "πŸ“",
Model3D: "πŸ—Ώ",
State: "πŸ”’",
UploadButton: "πŸ“€",
Video: "πŸŽ₯"
};
export function clickOutside(element: HTMLDivElement, callbackFunction: any) {
function onClick(event: any) {
if (
!element.contains(event.target) &&
!(event.target.textContent && event.target.textContent === "Share")
) {
callbackFunction();
}
}
document.body.addEventListener("click", onClick);
return {
update(newCallbackFunction: any) {
callbackFunction = newCallbackFunction;
},
destroy() {
document.body.removeEventListener("click", onClick);
}
};
}