Plugins
A plugin is a package that registers things with the editor. Tools, exporters, side panels, command-palette commands. One package.json entry, one entry-point module. The same plugin runs in the browser and in the desktop build.
What plugins can register
- Exporters. Implement the
ExportPlugininterface (id, name, extensions, description, capabilities, export function). It shows up in the Export dialog. - Tools. A new entry in the tool palette with a cursor, an icon, and pointer-event handlers.
- Panels. A side panel with its own React component. The host gives you access to the current map and the action dispatcher.
- Commands. An entry in the command palette with a label, a hotkey, and a handler.
A worked example
A plugin is a directory with a manifest.json and the entry-point module it points at. The manifest carries the metadata; the module exports activate(api), which is where you register things. Here is a minimal exporter that writes the map's dimensions to a one-line text file.
manifest.json
{
"id": "com.example.size-exporter",
"name": "Size Exporter",
"version": "1.0.0",
"description": "Exports the map size to a text file.",
"entryPoint": "index.js"
}index.js
export function activate(api) {
api.registerExporter({
id: 'com.example.size-exporter',
name: 'Map size (.txt)',
extensions: ['txt'],
description: 'Writes the map width and height to a text file.',
export: (map, baseName) => ({
fileName: `${baseName ?? 'map'}.txt`,
content: `${map.width} x ${map.height} tiles`,
}),
});
api.log.info('Size Exporter ready');
}Once loaded, “Map size (.txt)” appears as a target in the Export dialog. The export function receives the current TileMap and returns a { fileName, content } object (or an array of them for multi-file formats); return a Uint8Array as the content for binary output. The same api object also exposes registerTool, registerPanel, registerCommand, read-only state getters such as getMapState(), and an on(event, handler) event subscription.
Status
The exporter plugin API shown above is what the built-in exporters use, and it's stable. The tool, panel, and command APIs are still settling and may change.