OPF

Search docs

Loading documentation…
    OpenPresentation/opf
    Browse docs
    On this page

    Upgrade a deck or host to OPF 0.35

    Run opf fix on a 0.34 deck, validate it, then update custom layout records and hosts for the removed keys and renamed layouts and regions.

    Update a deck

    Work on a copy of the deck, with the CLI and runtime packages on the same 0.35 release. opf fix validates the deck, applies each fix its findings mark safe, and validates again until none is left. It lists every fix it applied. A safe fix loses no content and writes valid OPF. A fix that needs a choice, or that restyles content (a new text color, for example), is not safe and is never applied; opf validate reports it with its fixes, and opf fix lists it in fix.unsafe.

    opf fix brings the deck to the 0.35 form, and the 0.35 engine draws it, so a slide may look different than it did in 0.34. A safe fix that can change how a slide draws is marked: changesDrawing in the JSON report, “(changes the drawing)” in the text report, and a summary line such as “applied 3 safe fixes in 1 round (2 change the drawing)”. After running opf fix, look at the slides of the marked fixes.

    By default opf fix applies only the fixes of the checks that repair the document: format, references, policy and layout. The fixes of the audits (accessibility and content) are applied only with --audits; without it the report lists them under fix.audits.

    Fix and check
    npx opf fix deck.opf.json -i
    npx opf validate deck.opf.json --fail-on warning

    What the safe fixes change in a deck:

    • "layout": "auto" is removed. A slide without layout is composed automatically, as "auto" was. The value is now an ordinary layout reference, so it resolves nowhere (opf/unresolved-reference).
    • The flow and vertical-flow layouts are process and vertical-process. The agenda-split layout is agenda with design.titlePosition set to start, which puts the title in a column of two fifths of the width beside the body (agenda-split gave it half). The fix from agenda-split and the fix from flow are marked as changing the drawing: process draws a list that Basic Process cannot hold at its size, such as entries of three or more words, as numbered steps where flow drew boxes. The fix from vertical-flow draws as before.
    • The built-in layouts use seven standard region names: body, lead, aside, media, first, second and third. A block pinned by a 0.34 name such as notes or charts is reported as opf/region-unknown, ignored, and bound by kind. The fix writes the new name; or remove the pin where plain binding already places the block. Every layout draws as before.
    • A slide key that placed content in a cell of the 3×3 grid, such as "top:start": { … }, becomes a block that names the cell: { "region": "top:start", … } in blocks (the fix cells-to-blocks). The blocks compose the same grid of cells. See blocks in cells. A slide that also names a layout keeps it: the fix cells-to-layout-blocks, marked as changing the drawing, moves the content of each cell key into a block without region, in reading order of the cells, so it binds to the layout’s regions by kind and the slide draws on its layout. To keep a grid of cells instead, remove layout and name the cells on the blocks.
    • design.contentDirection and design.chartPrimary are removed, and a deck that still has them fails the schema. opf fix deletes them and marks the fix as changing the drawing: the engine now composes the slide, and an automatic slide gives a short chart among other blocks its own track. For a specific arrangement, set the slide’s composition: mode "row" or "column" for the direction (in a layout record of your own, a region’s flow), and for a chart on one side "composition": { "mode": "row", "weights": [3, 2] } with the chart first in blocks and the other blocks in one group ({ "blocks": [ … ] }). A short text alone beside the chart, in a weighted row or column or in a layout region that takes one block, grows and is centered in its side.

    These are not new in 0.35 for a deck already on 0.34.2: the eight Lucide icons that were renamed (such as lucide:circle-arrow-out-up-right, now lucide:circle-arrow-up-right-exit) and number format sections (positive;negative;zero) arrived in 0.34.2. A deck coming from 0.34.0 or 0.34.1 gets them too, and opf fix applies the icon fix with the others.

    The full migration table covers every changed key and the host API.

    Self-contained decks

    opf embed copies each built-in layout a deck uses into catalogs.default.layouts. 0.35 changed the keys of those records, so a copy made before 0.35 fails the 0.35 layout schema: the deck is invalid and opf convert stops with invalid-document. Run opf fix deck.opf.json -i, or opf embed deck.opf.json -i to refresh the copies alone. opf embed --check exits 1 when a copy would be refreshed.

    • catalogs.default mirrors the built-in records, so each stale copy takes the current record, whatever release wrote it and whether it was edited, and the pins of its slides take the 0.35 region names. Keep a layout you customized in catalogs.custom, which is never replaced.
    • A copy of a removed layout (flow, vertical-flow, agenda-split) moves its slides to the replacement and is dropped.

    The report lists each refreshed copy in embed.refreshed, with how current or renamed, and marks it changesDrawing when the record changed. The 0.35 engine draws the slides, which may look different. Validate again afterward. A deck with other invalid content is refused until that is fixed.

    Update custom layout records

    opf fix also repairs the deck’s own records under catalogs.custom, which opf embed does not change, and lists the fixes that need a choice in fix.unsafe.

    • A region with "flow": "none" is "max": 1 without flow. A region of max: 1 is a single-block region with every rule of none. flow is now auto, grid, row or column; row lays the blocks side by side in one row.
    • "role": "secondary" is supporting or primary. The fix is offered, not applied, because which one keeps the binding depends on the record.
    • sequence is arrangement (steps or numbered). A region has one arrangement. The arrangements flow and vertical-flow are process and vertical-process.
    • pyramidDirection is gone: "down" is "arrangement": "inverted-pyramid", and "up" is dropped.
    • listColumns is removed. A list of more than six entries flows into columns by default in a region without an arrangement. Write "columns": 1 on the list to keep one column.
    • design.contentDirection and design.chartPrimary in a layout or theme record are deleted. Write the direction on the regions instead, "flow": "row" or "column".
    • A record that put its title in a column beside the body with a row direction still draws as before. To let a deck or slide choose, write a column record with "design": { "titlePosition": "start" }.
    • Region names in a record of your own are unchanged. One rule reads a name: the aside of a layout that also has a first region is its closing verdict, the role the comparison layout’s verdict region had. A custom region named verdict loses that rule; name it aside to keep it. The id auto is now allowed for a layout record.

    Compare the output

    Look at the slides of every fix opf fix marked as changing the drawing. The fixed deck keeps every word and draws in the 0.35 form there.

    A short text alone beside a chart, in a row or column sized by composition.weights or in a layout region that takes one block, grows and is centered in its side.

    A process slide whose only body content is one list of two to eight short entries now draws Basic Process, the drawing the flow layout had, as live SmartArt in PowerPoint. A longer list, a description, an icon or other blocks draw as before.

    A list of more than six entries on a layout slide may flow into up to three columns when that sets it at least as large as one column; write "columns": 1 to keep one column. A list in a row of cells sized by composition.weights keeps every word whole, by widening its cell. Neither needs a change to a deck.

    Update a host

    Repair before drawing. The 0.35 renderer’s toSvg throws invalid-opf on a 0.34 deck whose own keys fail the schema (design.contentDirection or design.chartPrimary on the deck or a slide, a cell key such as top:start), and a removed layout or a stale embedded copy draws without its layout until it is fixed. A host that stores decks repairs each one when it loads it, before it draws it: call fix(deck, { catalogs }) and draw result.document.

    What a safe fix promises. fix() applies a fix only when it is marked safe and is a JSON Patch: it loses no content and writes valid OPF. A fix that can change how a slide draws has changesDrawing: true on the finding’s fix and on FixResult.applied[]. The fixed deck keeps every word and draws in the 0.35 form. A host that tells its users how the repair affects their deck lists the slides of the fixes with changesDrawing. By default fix() applies only the fixes of the checks that repair the document (FIX_REPAIR_CATEGORIES: format, references, policy and layout); pass { audits: true } to apply the audits’ safe fixes too. A focus fix is never applied. isSafePatch(fix) is the test fix() uses, for a host that counts the fixes it will apply. use-readable-color (opf/text-contrast) is no longer safe, because it replaced a color the author wrote.

    A host that writes 0.34 cell keys writes blocks with region on a slide without a layout instead. For stored decks, fix(deck) migrates every slide in cells: a slide without a layout with cells-to-blocks, and a slide with a layout with cells-to-layout-blocks, which keeps the layout and moves the content into blocks that bind to its regions by kind (marked changesDrawing). promotedRegionKeys and isPromotedRegionKey are replaced by gridCells and isGridCell, and composeSlide reports the items of those blocks at their own paths.

    Compare slide.layout === undefined where you compared it to AUTO_LAYOUT, which is removed. REGION_ROLES has no secondary; LayoutRegion has one arrangement and no sequence, pyramidDirection or listColumns; REGION_FLOWS is auto, grid, row and column, and a host that tested flow === "none" tests max === 1. contentDirection and chartPrimary are gone from the design options and the composition hints; the editor has a titlePosition option.

    embed() now replaces each stale copy of a built-in layout with the current record and returns it in EmbedResult.refreshed, with how "current" or "renamed" and changesDrawing: true when the record changed. A host that embeds on save heals old decks on their next save; call it when a deck opens to show it valid at once. Take its document whenever added or refreshed is not empty: a host that kept its own copy when added was empty keeps the stale copies.

    PPTX export names the placeholders and the layout tag’s region map after the 0.35 regions, and the SmartArt tags use process, vertical-process and inverted-pyramid. Importing a 0.34 file reads its flow and vertical-flow layouts as the new ones and its agenda-split slides as agenda with titlePosition: "start".

    American spelling. Finding messages, help texts, fix titles and the CLI’s help use American spelling (“Colored text color” where it said “Coloured text colour”); rule ids and fix ids are unchanged, so match those, not the text. Four values are renamed with no alias: the renderer’s text-as-paths-fallback reason "color-font" (was "colour-font"), the editor’s export status state "canceled" (and its data-state attribute), the relabeled field of the change transposeGridData and transposeChart return, and the drag controller’s { canceled }.

    Already in 0.34.2. A host that took 0.34.2 has nothing to do for these: the font peers @expo-google-fonts/noto-color-emoji 0.4.8 and @expo-google-fonts/noto-sans-mongolian 0.4.2 (Mongolian lines measure 0.1% to 4% differently); the renderer’s shaper without HarfBuzz, fontkit 3 (ESM only); no RenderDiagnostic reason shaping (such a run is outlined); the MCP viewer’s resource URI ui://opf/deck/<hash>, which a host reads from DECK_APP_URI instead of comparing with a literal string (ui://opf/deck still reads as the current viewer; see Connect to the MCP server); the Design menu’s bottom sheet on a phone with its layoutTab label; and the optional renamed map of a custom icon set record. A host coming from 0.34.0 or 0.34.1 takes them with 0.35.