/** * rNotes applet definitions — Vault Note. */ import type { AppletDefinition, AppletLiveData } from "../../shared/applet-types"; const vaultNote: AppletDefinition = { id: "vault-note", label: "Vault Note", icon: "🗒️", accentColor: "#065f46", ports: [ { name: "note-in", type: "json", direction: "input" }, { name: "content-out", type: "text", direction: "output" }, ], renderCompact(data: AppletLiveData): string { const { snapshot } = data; const title = (snapshot.title as string) || "Note"; const vault = (snapshot.vault as string) || ""; const tags = (snapshot.tags as string[]) || []; const preview = (snapshot.preview as string) || "Empty note"; return `
${title}
${vault ? `
📁 ${vault}
` : ""} ${tags.length > 0 ? `
${tags.map(t => `#${t}`).join(" ")}
` : ""}
${preview}
`; }, onInputReceived(portName, value, ctx) { if (portName === "note-in" && value && typeof value === "object") { const note = value as Record; ctx.emitOutput("content-out", (note.content as string) || ""); } }, }; export const notesApplets: AppletDefinition[] = [vaultNote];