Skip to main content

Crate pinstar

Crate pinstar 

Source
Expand description

pinstar — terminal canvas/diagram editor library.

Host-agnostic engine for Obsidian-compatible .canvas files plus Mermaid, DOT and PlantUML flowcharts. Hosts (the pinstar binary, clin-rs’s canvas view) own keybinds, status lines, dialogs and the system clipboard; everything canvas-related lives here.

Re-exports§

pub use input::ActionCtx;
pub use input::ActionOutcome;
pub use input::MouseOutcome;
pub use input::PinstarAction;
pub use input::apply_action;
pub use input::execute_menu_action;
pub use input::handle_pinstar_event;
pub use input::handle_pinstar_mouse;
pub use menu::MenuItemSpec;
pub use menu::PinstarContextMenu;
pub use menu::PinstarMenuType;
pub use menu::menu_item_shortcut_char;
pub use menu::menu_specs;
pub use overlay::MarqueeState;
pub use overlay::draw_canvas_rect_filled;
pub use overlay::muted_canvas_selection_fill;
pub use render::draw_pinstar_view;
pub use selection::Selection;
pub use state::PinstarHelpTab;
pub use state::PinstarSnapshot;
pub use state::PinstarState;
pub use state::RenameMode;
pub use textsel::MouseTextSelection;
pub use theme::ThemeColors;

Modules§

camera
Viewport math shared by pan/zoom/navigation (ported from clin’s ui::camera, originally salvaged from graf’s viewport module).
data
formats
grid
Adaptive canvas grid renderer (ported from clin’s ui::canvas_grid).
help
image
Async image decode worker + LRU protocol cache (ported from clin’s image_render; only compiled with the images feature).
input
Input handling: host-facing action API (PinstarAction + apply_action), the merged mouse handler, and the standalone bin’s default-keymap router.
menu
Context menu system: specs, state, hit-testing, rendering.
overlay
Marquee drag state + translucent fill (ported from clin’s ui::canvas_overlay).
render
Canvas rendering. Canvas-format passes are clin’s (titles in blocks, image nodes, marquee, multi-select, edge-list overlay); flowchart-format passes are the standalone renderer (shapes, braille borders, box-drawing orthogonal edges, title-above-node). The bottom status row and rename keybind hints are host-owned; this renderer reserves the bottom row.
selection
Multi-select state for canvas nodes (ported from clin’s ui::CanvasSelection).
state
textsel
Mouse-driven text selection for canvas textareas (ported from clin’s text_edit::MouseTextSelection; the clipboard write is surfaced to hosts via the returned text instead of performed here).
theme
Theme colors + color parsing + textarea helpers.

Structs§

Settings
Host capability/behavior switches, stored on PinstarState::settings.

Constants§

COLOR_PICKER_PALETTE
TRANSFORM_SETTLE
After this much idle time following a zoom/pan/resize, the view is considered settled and real pixel images resume rendering.

Functions§

atomic_write
Write content to path atomically (temp file in the same directory + rename), so a crash mid-write never truncates the canvas file.