Licence
MIT
Version
0.10.0
Deps
0
Size
34 kB
Vulns
0
Weekly
294
@edenapp/tablets
Tiny renderer toolkit for Eden apps. It provides runtime helpers for Eden’s system context menu and file picker without wiring IPC directly.
What it does
- Provides
contextMenuruntime helper for opening/closing menus. - Provides
filePickerasync helpers for opening and saving file paths. - Provides menu builder helpers (
menu,button,title,separator,when).
Install
pnpm add @edenapp/tabletsnpm install @edenapp/tabletsyarn add @edenapp/tabletsBasic usage
import { contextMenu, menu, button, title } from "@edenapp/tablets";
const appMenu = menu((app: { id: string; name: string }) => [
title(app.name),
button("open", "Open", () => console.log("open", app.id)),
button("remove", "Remove", () => console.log("remove", app.id), {
danger: true,
}),
]);
// Build a standard HTML/JS onContextMenu event handler for your component/element
const onContextMenu = appMenu.handler({
id: "com.example.app",
name: "Example",
});
// Example usage (React/Solid/JSX):
// <div onContextMenu={onContextMenu}>Right-click me</div>
// Or open at a specific position
void appMenu.show(
{ id: "com.example.app", name: "Example" },
{ left: 120, top: 80 },
);
// Close the active menu
void contextMenu.close();File picker
import { filePicker } from "@edenapp/tablets";
const path = await filePicker.openFile({
title: "Open Markdown",
filters: [{ name: "Markdown", extensions: ["md", "markdown"] }],
});
const savePath = await filePicker.saveFile({
suggestedName: "notes.md",
filters: [{ name: "Markdown", extensions: ["md"] }],
});