Skip to content

v4.1.0

Latest

Choose a tag to compare

@shbernal shbernal released this 11 Oct 08:54
· 156 commits to main since this release

Added

  • Guide pages run their own examples. A code sample marked ts live shows the slide it builds
    under the code, built in the reader's browser, with a button that downloads the deck. The code on
    the page is the code that runs, and the test suite runs every live sample against the Node build
    and fails on a throw, a warning or a schema error. Fills and
    gradients
    is the first page with them.
  • The demos page shows both showcase decks. The startup pitch deck, with its photographs and
    video, now builds in the browser beside the consulting deck.

Changed

  • The showcase decks are a strategy consulting deck and a startup pitch deck. The quarterly
    review becomes Project Lodestar, a twelve-slide cost-transformation deck by the fictional
    Actionable Insights Partners in navy: action titles, a linked section tracker, a waterfall, an
    issue tree, a 2x2 and Harvey balls, still with nothing loaded. The Field Notes photo essay is
    replaced by Nightjar, an eleven-slide Series A pitch on the Tokyo Night palette that keeps the
    photographs, scrims and video. More of each deck is drawn than charted, because the demos page's
    preview shows a native chart as a placeholder.

    This is only visible if you build the showcases. The slugs change from quarterly-review and
    field-notes to cost-transformation and series-a, the files from
    Kestrel_Q3_Business_Review.pptx and Field_Notes_Four_Cities.pptx to
    AIP_Lodestar_Cost_Transformation.pptx and Nightjar_Series_A.pptx. In
    www/demos/decks/media/, the photographs only Field Notes used, the subway maps, the stock
    video with its clapperboard poster, and the cube model are gone. Two CC0 photographs and a
    rendered recording of the deck's own terminal session replace them.

  • write() is typed by its outputType. write({ outputType: 'uint8array' }) now resolves to
    Uint8Array, 'arraybuffer' to ArrayBuffer, 'base64' and 'binarystring' to string, and
    no outputType to Blob, instead of the union of all four. 'nodebuffer' is typed
    Uint8Array, the class Node's Buffer extends, so the declaration needs no Node types. Casts
    such as (await pptx.write({ outputType: 'uint8array' })) as Uint8Array can go. Code that
    annotated 'nodebuffer' output as Buffer needs the cast kept, or outputType: 'uint8array'.
    WriteProps takes the output type as an optional type parameter, and the new WriteOutputMap
    names each type's result.

  • outerBorder accepts the undefined holes its own example shows. Under
    exactOptionalPropertyTypes, outerBorder: [rule, undefined, rule, undefined] failed to compile,
    because the tuple's optional elements did not admit an explicit undefined. Each element now
    does. No migration is needed.

  • Chart values admit null for a gap. OptsChartData.values is now
    Array<number | null>. A null has always been the gap spelling at run time (an empty workbook
    cell, drawn per displayBlanksAs), but the type rejected it, so typed callers needed a cast.
    No migration is needed.

  • The read model's lookups take the nullable ids its getters return. Slide.shapeById,
    shapeByIdDeep (on slides, layouts, masters and notes), Diagram.point and OpcPackage.part
    now accept null and miss on it, so a value read back can be passed straight in under
    strictNullChecks: slide.shapeById(shape.id), diagram.point(connection.destinationId),
    opc.part(picture.imagePartName). Before, the getters typed number | null or
    string | null and the lookups only number or string. At run time shapeById(null) also
    matched the first shape whose p:cNvPr has no @id; it now returns undefined. No migration
    is needed.

  • Slide.newAutoPagedSlides is typed as always present. The interface declared it optional,
    though every slide carries the list, empty until an auto-paging table spills. Under
    strictNullChecks the documented for (const made of slide.newAutoPagedSlides) did not compile.
    Code that guarded with ?. or ?? [] still works; a class implementing Slide itself now has to
    provide the property.

  • The default branch is now main, renamed from master. The library is unchanged. A
    dependency on github:shbernal/ts-pptx#master should switch to #main, or better, to a pinned
    commit sha. GitHub redirects old blob/master/ links, and the repository's own links now point
    at main.

  • demos/ is gone; demos live on the site. The showcase decks moved to www/showcases/, and
    pnpm demos:build is now pnpm showcases:build, writing to .tmp/showcases/. The Express
    streaming demo became a dependency-free Serving a deck over
    HTTP

    section. The images the test suite reads moved to test/assets/. None of this was in the
    published package.

  • Runtime strings name the project pptx-ts, not ts-pptx. Console warnings are prefixed
    pptx-ts: , and the InternalError message calls it a bug in pptx-ts. A deck that sets no
    document properties is written with author and company pptx-ts and title and subject
    pptx-ts Presentation. A generated script's header reads Generated from a .pptx by pptx-ts/script. Code that matched a warning line on ts-pptx: , or detected this library's
    decks by their default author, should match pptx-ts instead; a setDiagnosticHandler handler
    receives the message without the prefix and is unaffected.

Fixed

  • An unknown pattern preset throws instead of writing a corrupt part.
    fill: { type: 'pattern', pattern: { preset } } with a name outside the 54 presets was written
    verbatim as <a:pattFill prst>, which fails the schema. It now throws InvalidOptionError
    with code pattern-fill/invalid-preset. Use one of the PatternPreset names.
  • A tableStyle that is not a style GUID throws. addTable({ tableStyle }) wrote any string
    into <a:tableStyleId>, so an enum key such as 'MEDIUM_STYLE_2_ACCENT_1' produced a
    schema-invalid table. A value that is not an upper-case GUID in braces now throws
    InvalidOptionError with code table/invalid-style-id. Pass the TableStyle member
    (TableStyle.MEDIUM_STYLE_2_ACCENT_1) instead of its key name.
  • A table cell's text shadow takes its transparency. A shadow on a cell, or on a run inside
    a cell's text, painted at the default 75% opacity whatever transparency or RGBA colour it
    stated, because the table path skipped the normalization addText runs. TableCellProps now
    declares shadow, which the cell's runs inherit, so a typed caller no longer needs a cast to set
    it.

Full changelog: https://github.com/shbernal/pptx-ts/blob/v4.1.0/CHANGELOG.md