mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-31 15:49:48 +00:00
Plugin ABI v2: a plugin can show a panel (text, number, checkbox, select, colour, list, notes, buttons) rendered with FigCraft's widgets, react to events with its state kept between calls (each editing callback one undo step, full sandbox limits on every call), and store per-plugin settings (64 KB). plugin.ui / plugin.event / plugin.close drive panels from the CLI and MCP; v1 plugins run unchanged. The Swatch grid example gains a Palettes panel that remembers the last palette.
17 lines
739 B
Rust
17 lines
739 B
Rust
//! FigCraft plugins: the manifest (`figcraft-plugin.json`) and the WebAssembly sandbox a plugin
|
|
//! runs in. The engine decides what a plugin may do (its permissions, which commands it may call,
|
|
//! one undo step per run or panel callback, where settings are kept); this crate only runs modules
|
|
//! safely: a metered interpreter with a memory cap, no WASI and a handful of host functions. See
|
|
//! `docs/plugins.md`.
|
|
|
|
pub mod manifest;
|
|
mod sandbox;
|
|
|
|
pub use manifest::{API_VERSION, Access, MANIFEST_FILE, Manifest, Panel, Param, ParamKind, Permissions, PluginCommand};
|
|
pub use sandbox::{ENTRY, Host, IMPORT_MODULE, Instance, Limits, PluginError, RunOutput, UiChange, check_module, run};
|
|
|
|
#[cfg(test)]
|
|
mod tests;
|
|
#[cfg(test)]
|
|
mod v2_tests;
|