| 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); | |
| } | |
| }; | |
| } | |