Repository navigation
Added
- Guide pages run their own examples. A code sample marked
ts liveshows 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-reviewand
field-notestocost-transformationandseries-a, the files from
Kestrel_Q3_Business_Review.pptxandField_Notes_Four_Cities.pptxto
AIP_Lodestar_Cost_Transformation.pptxandNightjar_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 itsoutputType.write({ outputType: 'uint8array' })now resolves to
Uint8Array,'arraybuffer'toArrayBuffer,'base64'and'binarystring'tostring, and
nooutputTypetoBlob, instead of the union of all four.'nodebuffer'is typed
Uint8Array, the class Node'sBufferextends, so the declaration needs no Node types. Casts
such as(await pptx.write({ outputType: 'uint8array' })) as Uint8Arraycan go. Code that
annotated'nodebuffer'output asBufferneeds the cast kept, oroutputType: 'uint8array'.
WritePropstakes the output type as an optional type parameter, and the newWriteOutputMap
names each type's result. -
outerBorderaccepts theundefinedholes its own example shows. Under
exactOptionalPropertyTypes,outerBorder: [rule, undefined, rule, undefined]failed to compile,
because the tuple's optional elements did not admit an explicitundefined. Each element now
does. No migration is needed. -
Chart
valuesadmitnullfor a gap.OptsChartData.valuesis now
Array<number | null>. Anullhas always been the gap spelling at run time (an empty workbook
cell, drawn perdisplayBlanksAs), 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.pointandOpcPackage.part
now acceptnulland 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 typednumber | nullor
string | nulland the lookups onlynumberorstring. At run timeshapeById(null)also
matched the first shape whosep:cNvPrhas no@id; it now returnsundefined. No migration
is needed. -
Slide.newAutoPagedSlidesis typed as always present. The interface declared it optional,
though every slide carries the list, empty until an auto-paging table spills. Under
strictNullChecksthe documentedfor (const made of slide.newAutoPagedSlides)did not compile.
Code that guarded with?.or?? []still works; a class implementingSlideitself now has to
provide the property. -
The default branch is now
main, renamed frommaster. The library is unchanged. A
dependency ongithub:shbernal/ts-pptx#mastershould switch to#main, or better, to a pinned
commit sha. GitHub redirects oldblob/master/links, and the repository's own links now point
atmain. -
demos/is gone; demos live on the site. The showcase decks moved towww/showcases/, and
pnpm demos:buildis nowpnpm 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 totest/assets/. None of this was in the
published package. -
Runtime strings name the project
pptx-ts, notts-pptx. Console warnings are prefixed
pptx-ts:, and theInternalErrormessage calls it a bug in pptx-ts. A deck that sets no
document properties is written with author and companypptx-tsand title and subject
pptx-ts Presentation. A generated script's header readsGenerated from a .pptx by pptx-ts/script.Code that matched a warning line onts-pptx:, or detected this library's
decks by their default author, should matchpptx-tsinstead; asetDiagnosticHandlerhandler
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 throwsInvalidOptionError
with codepattern-fill/invalid-preset. Use one of thePatternPresetnames. - A
tableStylethat 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
InvalidOptionErrorwith codetable/invalid-style-id. Pass theTableStylemember
(TableStyle.MEDIUM_STYLE_2_ACCENT_1) instead of its key name. - A table cell's text shadow takes its
transparency. Ashadowon a cell, or on a run inside
a cell'stext, painted at the default 75% opacity whatevertransparencyor RGBA colour it
stated, because the table path skipped the normalizationaddTextruns.TableCellPropsnow
declaresshadow, 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