pptz

    PowerPoint Zero: a portable MoonBit PPTX generator driven by TOML deck and page sources.

    pptx
    presentation
    toml
    wasm
    Download zip
    Author
    Version
    0.2.4
    License
    Apache-2.0
    Last updated
    5 months ago
    Downloads
    289

    #Milky2018/pptz

    pptz is PowerPoint Zero, a portable MoonBit presentation compiler. It reads a TOML deck file, validates the deck and referenced page files, and writes a PPTX through a wasm CLI.

    #Usage

    Use the published package:

    moon runwasm Milky2018/pptz <deck.toml> [--out <output.pptx>]

    For reproducible runs, pin the published version:

    moon runwasm Milky2018/pptz@0.2.4 <deck.toml> [--out <output.pptx>]

    Run the command from the deck project directory and use relative paths. The published wasm runs with WASI-style file access, so absolute paths outside the current working tree may not be visible.

    While developing this repository, run the top-level package:

    moon runwasm . examples/minimal/deck.pptz.toml --out examples/minimal/dist/demo.pptx

    If --out is omitted, the output path defaults to output.pptx.

    #Agent Skill

    This repository can also be installed as an agent skill with the Skills CLI. Keep the SKILL.md frontmatter name as pptz.

    npx skills add https://github.com/moonbit-community/pptz.git

    If you are installing from a repository that contains multiple skills, select this skill explicitly:

    npx skills add https://github.com/moonbit-community/pptz.git --skill pptz

    You can also target a specific agent or install globally:

    npx skills add https://github.com/moonbit-community/pptz.git --agent codex npx skills add https://github.com/moonbit-community/pptz.git --global

    After installation, ask your agent to use pptz when you need a PPTX deck generated from TOML sources. The skill will guide the agent to:

    • design a deck directory with deck.pptz.toml, pages/, optional images/, and dist/;
    • keep sources within the writer's supported feature set;
    • compile the deck with moon runwasm Milky2018/pptz;
    • deliver both the TOML sources and generated .pptx.

    #Current Writer Scope

    The current writer supports:

    • explicit deck size and ordered page files;
    • optional solid, gradient, or image page backgrounds;
    • text elements with theme text styles, local overrides, text wrapping, and line breaks;
    • PowerPoint preset auto-shapes, excluding line and connector presets;
    • straight, bent, and curved connectors with coordinate or element endpoints, stroke, dash, and arrowheads;
    • solid fills, gradient fills, no-fill shapes, and solid or dashed borders;
    • outer shadows for shape and connector elements;
    • built-in icon elements for cube, circle, square, star, heart, plus, home, info, help, return, blank, smiley, sun, moon, cloud, lightning, gear6, gear9, funnel, chart_plus, chart_star, chart_x, and no_smoking, with optional fas:-style prefixes;
    • table elements with explicit or evenly distributed column widths and row heights, including cell merge spans;
    • inline chart elements for bar, line, pie, doughnut, area, scatter, bubble, and radar, with title, legend, style, data labels, data table, and rounded-corner options;
    • raster image elements with fit = "stretch", fit = "cover", or fit = "contain";
    • image crop rectangles;
    • SVG image elements, using an internal transparent PNG fallback required by moon-pptx.

    Schema-valid features outside this scope fail with a writer capability error instead of being silently ignored. This includes letter_spacing, unsupported icon names, unsupported connector kinds, line/connector shape presets, and unsupported shape names.

    #Example

    The maintained example deck is in examples/minimal. It is intentionally small but covers the features the writer can render today.

    cd examples/minimal moon runwasm Milky2018/pptz deck.pptz.toml --out dist/demo.pptx

    For local development against the checkout instead of the published wasm:

    moon runwasm . examples/minimal/deck.pptz.toml --out examples/minimal/dist/demo.pptx

    #Validation

    Run the wasm target checks before relying on a change:

    moon check --target wasm moon test --target wasm

    See REFERENCE.md for the source schema, diagnostics, and CLI contract.

    LoadError

    pub(all) suberror LoadError {
    Fatal(String)
    Diagnostics(Array[Diagnostic])
    } derive(
    Debug
    )

    WriteError

    pub(all) suberror WriteError {
    Capability(String)
    Backend(String)
    Io(String)
    } derive(
    Debug
    )

    Align

    pub(all) struct Align {
    horizontal : String
    vertical : String
    } derive(Eq,
    Debug
    )

    Background

    pub(all) enum Background {
    SolidBackground(String)
    GradientBackground(Gradient)
    ImageBackground(ImageFill)
    } derive(Eq,
    Debug
    )

    Border

    pub(all) struct Border {
    style : String
    width : Double
    color : String
    } derive(Eq,
    Debug
    )

    Bounds

    pub(all) struct Bounds {
    x : Double
    y : Double
    width : Double
    height : Double
    } derive(Eq,
    Debug
    )

    ChartSeriesSpec

    pub(all) struct ChartSeriesSpec {
    name : String
    values : Array[Double]
    x_values : Array[Double]?
    bubble_sizes : Array[Double]?
    } derive(Eq,
    Debug
    )

    ChartSpec

    pub(all) struct ChartSpec {
    kind : String
    title : String?
    legend : String?
    style : Int?
    data_labels : String?
    data_table : Bool?
    rounded_corners : Bool?
    categories : Array[String]?
    series : Array[ChartSeriesSpec]
    } derive(Eq,
    Debug
    )

    CliResponse

    pub struct CliResponse {
    exit_code : Int
    stdout : String
    stderr : String
    }

    ConnectorEndpoint

    pub(all) enum ConnectorEndpoint {
    CoordinateEndpoint(Double, Double)
    ElementEndpoint(String)
    } derive(Eq,
    Debug
    )

    ConnectorSpec

    pub(all) struct ConnectorSpec {
    kind : String
    start : ConnectorEndpoint
    end : ConnectorEndpoint
    stroke : Border?
    start_arrow : String?
    end_arrow : String?
    shadow : ShadowSpec?
    } derive(Eq,
    Debug
    )

    CropRect

    pub(all) struct CropRect {
    left : Double
    top : Double
    right : Double
    bottom : Double
    } derive(Eq,
    Debug
    )

    Deck

    pub(all) struct Deck {
    title : String?
    size : Size
    theme : Theme?
    pages : Array[PageRef]
    } derive(Eq,
    Debug
    )

    DeckBundle

    pub(all) struct DeckBundle {
    deck_path : String
    deck_dir : String
    deck : Deck
    pages : Array[ResolvedPage]
    } derive(Eq,
    Debug
    )

    Diagnostic

    pub(all) struct Diagnostic {
    severity : Severity
    code : String
    message : String
    path : String?
    element_id : String?
    field : String?
    } derive(Eq,
    Debug
    )

    Element

    pub(all) enum Element {
    TextElement(ElementBase, TextContent)
    ShapeElement(ElementBase, ShapeSpec)
    ImageElement(ElementBase, ImageSpec)
    ConnectorElement(String, ConnectorSpec)
    IconElement(ElementBase, IconSpec)
    TableElement(ElementBase, TableSpec)
    ChartElement(ElementBase, ChartSpec)
    } derive(Eq,
    Debug
    )

    ElementBase

    pub(all) struct ElementBase {
    id : String
    bounds : Bounds
    } derive(Eq,
    Debug
    )

    Fill

    pub(all) enum Fill {
    SolidFill(String)
    GradientFill(Gradient)
    NoFill
    } derive(Eq,
    Debug
    )

    Gradient

    pub(all) struct Gradient {
    direction : Double?
    stops : Array[GradientStop]
    } derive(Eq,
    Debug
    )

    GradientStop

    pub(all) struct GradientStop {
    at : Double
    color : String
    } derive(Eq,
    Debug
    )

    IconSpec

    pub(all) struct IconSpec {
    name : String
    fill : Fill?
    } derive(Eq,
    Debug
    )

    ImageFill

    pub(all) struct ImageFill {
    path : String
    fit : ImageFit
    } derive(Eq,
    Debug
    )

    ImageFit

    pub(all) enum ImageFit {
    CoverFit
    ContainFit
    StretchFit
    } derive(Eq,
    Debug
    )

    ImageSpec

    pub(all) struct ImageSpec {
    path : String
    fit : ImageFit
    crop : CropRect?
    } derive(Eq,
    Debug
    )

    LoadedDeck

    pub(all) struct LoadedDeck {
    bundle : DeckBundle
    warnings : Array[Diagnostic]
    } derive(Eq,
    Debug
    )

    Page

    pub(all) struct Page {
    page_type : String?
    background : Background?
    elements : Array[Element]
    } derive(Eq,
    Debug
    )

    PageRef

    pub(all) struct PageRef {
    path : String
    } derive(Eq,
    Debug
    )

    ResolvedPage

    pub(all) struct ResolvedPage {
    path : String
    full_path : String
    page : Page
    } derive(Eq,
    Debug
    )

    Severity

    pub(all) enum Severity {
    Error
    Warning
    } derive(Eq,
    Debug
    )

    ShadowSpec

    pub(all) struct ShadowSpec {
    color : String
    blur : Double
    distance : Double
    direction : Double
    } derive(Eq,
    Debug
    )

    ShapeSpec

    pub(all) struct ShapeSpec {
    shape : String
    fill : Fill?
    border : Border?
    shadow : ShadowSpec?
    } derive(Eq,
    Debug
    )

    Size

    pub(all) struct Size {
    width : Double
    height : Double
    } derive(Eq,
    Debug
    )

    TableCellMargin

    pub(all) struct TableCellMargin {
    left : Double?
    right : Double?
    top : Double?
    bottom : Double?
    } derive(Eq,
    Debug
    )

    TableCellSpec

    pub(all) struct TableCellSpec {
    text : String
    fill : Fill?
    border : Border?
    col_span : Int
    row_span : Int
    align : Align?
    margin : TableCellMargin?
    } derive(Eq,
    Debug
    )

    TableRowSpec

    pub(all) struct TableRowSpec {
    cells : Array[TableCellSpec]
    } derive(Eq,
    Debug
    )

    TableSpec

    pub(all) struct TableSpec {
    col_widths : Array[Double]?
    row_heights : Array[Double]?
    rows : Array[TableRowSpec]
    } derive(Eq,
    Debug
    )

    TableStyle

    pub(all) struct TableStyle {
    font_size : Double?
    font_family : String?
    header_fill : String?
    header_color : String?
    body_color : String?
    border : Border?
    } derive(Eq,
    Debug
    )

    TextContent

    pub(all) struct TextContent {
    text : String
    style : String?
    align : Align?
    wrap : Bool?
    font_size : Double?
    font_family : String?
    color : String?
    bold : Bool?
    italic : Bool?
    } derive(Eq,
    Debug
    )

    TextStyle

    pub(all) struct TextStyle {
    font_size : Double?
    font_family : String?
    color : String?
    bold : Bool?
    italic : Bool?
    line_height : Double?
    letter_spacing : Double?
    } derive(Eq,
    Debug
    )

    Theme

    pub(all) struct Theme {
    colors : Map[String, String]
    text_styles : Map[String, TextStyle]
    table_styles : Map[String, TableStyle]
    } derive(Eq,
    Debug
    )

    dispatch

    fn dispatch(args : ArrayView[String]) -> CliResponse

    load_deck

    fn load_deck(input_path : String) -> LoadedDeck raise

    parse_deck_toml

    fn parse_deck_toml(source : String) -> Deck raise

    parse_page_toml

    fn parse_page_toml(source : String) -> Page raise

    render_pptx

    fn render_pptx(loaded : LoadedDeck) -> FixedArray[Byte] raise

    usage

    fn usage() -> String

    version

    fn version() -> String

    write_pptx_file

    fn write_pptx_file(loaded : LoadedDeck, output_path : String) -> Unit raise