Skip to content

cupertino-files / KeynoteDocument

Class: KeynoteDocument ​

Defined in: src/keynote/document.ts:449

Extends ​

Properties ​

container ​

readonly container: IWorkContainer

Defined in: src/tsa/document.ts:125

Inherited from ​

IWorkDocument.container


format ​

readonly format: FormatInfo

Defined in: src/tsa/document.ts:127

Inherited from ​

IWorkDocument.format


store ​

readonly store: ObjectStore

Defined in: src/tsa/document.ts:126

Inherited from ​

IWorkDocument.store

Accessors ​

app ​

Get Signature ​

get app(): IWorkApp

Defined in: src/tsa/document.ts:167

Returns ​

IWorkApp

Inherited from ​

IWorkDocument.app


era ​

Get Signature ​

get era(): "iwork13" | "iwork16" | "iwork19" | "modern" | "current" | "future"

Defined in: src/tsa/document.ts:316

Format era this document was written by (see tsp/version.ts).

Returns ​

"iwork13" | "iwork16" | "iwork19" | "modern" | "current" | "future"

Inherited from ​

IWorkDocument.era


loops ​

Get Signature ​

get loops(): boolean

Defined in: src/keynote/document.ts:487

Returns ​

boolean


slideNumbersVisible ​

Get Signature ​

get slideNumbersVisible(): boolean

Defined in: src/keynote/document.ts:483

Returns ​

boolean

Methods ​

addImage() ​

addImage(slideIndex, data, options): object

Defined in: src/keynote/document.ts:849

Put a picture on a slide.

The archive is the measured slide-image shape, unanimous across the corpus's 22: the drawable's parent is the slide, the exterior wrap is the on-page shape, the aspect ratio is locked, stand-in title and caption ride along, and the style is the theme's image-0-imageStyle media style. The image lands in the slide's own package component beside its other content and joins both drawable lists — ownership and paint order. Sized like insertInlineImage: explicit width/height win, otherwise the intrinsic size is fitted to maxWidth (default 400 pt). Unless x/y say otherwise the picture is centered on the slide.

Parameters ​

slideIndex ​

number

data ​

Uint8Array

options ​
fileName ​

string

height? ​

number

maxWidth? ​

number

width? ​

number

x? ​

number

y? ​

number

Returns ​

object

dataId ​

dataId: bigint

imageId ​

imageId: bigint


addSlide() ​

addSlide(options?): KeynoteSlide

Defined in: src/keynote/document.ts:683

Add a slide, copying an existing one.

Keynote slides are not blank canvases — a usable one carries a style, a template-slide reference, placeholders and a transition, and inventing that set from nothing produces a slide the app quietly repairs or rejects. Copying an existing slide inherits a working set, which is also how Keynote's own "new slide" works: it instantiates a master.

after is a slide index; -1 puts the new slide first. By default the copy is emptied of its drawables, giving a fresh slide on the same layout; pass withContent to duplicate outright.

Parameters ​

options? ​
after? ​

number

copyOf? ​

number

withContent? ​

boolean

Returns ​

KeynoteSlide

Agent Tool ​

manage_slides


allNotes() ​

allNotes(): object[]

Defined in: src/keynote/document.ts:1012

Speaker notes of every slide, in order.

Returns ​

object[]


allText() ​

allText(): string

Defined in: src/tsa/document.ts:259

Concatenated plain text of all in-document storages (reading order approximation).

Returns ​

string

Inherited from ​

IWorkDocument.allText


audit() ​

audit(): AuditFinding[]

Defined in: src/tsa/document.ts:239

Every fault this library knows how to recognise offline, across the whole document — the checks a person otherwise performs by opening the file in an app. Each finding names a state some review round has already watched an app refuse, repair destructively, or render against the author's intent. save() refuses the error classes it can see; audit() reports them without saving, warnings included, so a builder can ask "what would a person object to?" before shipping a document.

Returns ​

AuditFinding[]

Agent Tool ​

audit_document

Inherited from ​

IWorkDocument.audit


charts() ​

charts(): ChartModel[]

Defined in: src/tsa/document.ts:207

Every chart, with its plotted data (see ChartModel).

Returns ​

ChartModel[]

Inherited from ​

IWorkDocument.charts


compact() ​

compact(): number

Defined in: src/tsa/document.ts:341

Drop archives nothing can reach, returning how many went.

What this collects today is very little, and that is worth knowing before reaching for it. Removing a sheet or a table unlinks it from the document tree, but the calc engine keeps its own references to every table it ever knew, so those archives stay genuinely reachable. The gap is in removal — unregistering a table's formula owners is calc-engine surgery this library does not do yet — not in the walk. What compaction does reclaim is objects created and then abandoned.

Roots are the package metadata, each component's first object, and every selection archive; see ObjectStore.prune for the scan and for why it errs towards keeping things. It is a no-op on every untouched document in the corpus, which is the property that matters: a collector that trims a file nobody edited is broken.

Returns ​

number

Inherited from ​

IWorkDocument.compact


compatibility() ​

compatibility(): CompatibilityReport

Defined in: src/tsa/document.ts:297

What this library can and cannot do with THIS document: declared versions, the era they place it in, structural probes (unknown type IDs, cell-storage generation, patch archives, collaboration state) and any unsupported features. Loading never fails on version grounds — this is how a caller finds out what to expect.

Returns ​

CompatibilityReport

Inherited from ​

IWorkDocument.compatibility


compatibilitySummary() ​

compatibilitySummary(): string

Defined in: src/tsa/document.ts:311

One-line human summary of compatibility.

Returns ​

string

Inherited from ​

IWorkDocument.compatibilitySummary


drawables() ​

drawables(): DrawableModel[]

Defined in: src/tsa/document.ts:192

Every object that carries drawable geometry (shapes, images, boxes).

Returns ​

DrawableModel[]

Inherited from ​

IWorkDocument.drawables


duplicateSlide() ​

duplicateSlide(index): KeynoteSlide

Defined in: src/keynote/document.ts:831

Duplicate a slide, content and all.

Parameters ​

index ​

number

Returns ​

KeynoteSlide

Agent Tool ​

manage_slides


images() ​

images(): ImageModel[]

Defined in: src/tsa/document.ts:212

Every image, with filter/mask access (see ImageModel).

Returns ​

ImageModel[]

Inherited from ​

IWorkDocument.images


masterSlides() ​

masterSlides(): object[]

Defined in: src/keynote/document.ts:657

Master/layout slides: SlideArchives that are not placed in the slide tree. They carry a name and are referenced by content slides through template_slide.

Returns ​

object[]


moveSlide() ​

moveSlide(from, to): void

Defined in: src/keynote/document.ts:925

Move a slide to a new position in presentation order.

Parameters ​

from ​

number

to ​

number

Returns ​

void

Agent Tool ​

manage_slides


noteStorages() ​

noteStorages(): TextStorage[]

Defined in: src/keynote/document.ts:1017

Every NOTE-kind storage in the document.

Returns ​

TextStorage[]


object() ​

object(id): IwaObject | undefined

Defined in: src/tsa/document.ts:266

Parameters ​

id ​

bigint

Returns ​

IwaObject | undefined

Inherited from ​

IWorkDocument.object


presentation() ​

presentation(): PresentationSettings

Defined in: src/keynote/document.ts:499

How the deck plays: the settings behind Keynote's Document inspector.

Defaults come from the schema, not from zero — every corpus deck omits slideNumbersVisible and relies on the default, and reading an omitted autoplay_transition_delay as 0 rather than 5 would describe a self-playing deck that races through itself.

Returns ​

PresentationSettings


presentedSlides() ​

presentedSlides(): KeynoteSlide[]

Defined in: src/keynote/document.ts:643

Slides that will actually be presented (skipped ones removed).

Returns ​

KeynoteSlide[]


pruneRoots() ​

protected pruneRoots(): bigint[]

Defined in: src/tsa/document.ts:353

Objects that must survive compact.

The package metadata anchors the component and data tables, and each component's first object anchors that component — a component whose objects all vanished would still be listed in the metadata, which is a worse state than a few extra archives.

Returns ​

bigint[]

Inherited from ​

IWorkDocument.pruneRoots


removeSlide() ​

removeSlide(index): void

Defined in: src/keynote/document.ts:912

Remove a slide from the presentation.

Only the tree entry is removed. The slide archive itself is left in the package: other objects may still reference it, and this library never garbage-collects the object graph — an orphan is inert, a dangling reference is not.

Parameters ​

index ​

number

Returns ​

void

Agent Tool ​

manage_slides


save() ​

save(): Uint8Array

Defined in: src/tsa/document.ts:372

Returns ​

Uint8Array

Inherited from ​

IWorkDocument.save


setPresentation() ​

setPresentation(settings): void

Defined in: src/keynote/document.ts:514

Change how the deck plays. Only the properties given are touched.

Parameters ​

settings ​

Partial<PresentationSettings>

Returns ​

void


setSlideSize() ​

setSlideSize(width, height): void

Defined in: src/keynote/document.ts:547

Resize the slide canvas.

Changes the coordinate space every drawable on every slide sits in, and nothing is rescaled to match: a deck resized from 1920×1080 to 1024×768 keeps its objects where they were, which is what Keynote's own "change slide size" does before you rearrange.

Parameters ​

width ​

number

height ​

number

Returns ​

void

Agent Tool ​

manage_slides


slideCount() ​

slideCount(): number

Defined in: src/keynote/document.ts:648

Number of slides reachable from the slide tree.

Returns ​

number


slides() ​

slides(): KeynoteSlide[]

Defined in: src/keynote/document.ts:604

Returns ​

KeynoteSlide[]


slideSize() ​

slideSize(): { height: number; width: number; } | undefined

Defined in: src/keynote/document.ts:476

Slide canvas size in points (e.g. 1920×1080).

Returns ​

{ height: number; width: number; } | undefined


stats() ​

stats(): DocumentStats

Defined in: src/tsa/document.ts:274

Returns ​

DocumentStats

Inherited from ​

IWorkDocument.stats


stylesheets() ​

stylesheets(): StylesheetModel[]

Defined in: src/tsa/document.ts:183

All stylesheets (document + theme).

Returns ​

StylesheetModel[]

Inherited from ​

IWorkDocument.stylesheets


tables() ​

tables(): TableModel[]

Defined in: src/tsa/document.ts:223

Every table (see TableModel).

Lives on the base because tables are not a Numbers feature: Pages documents and Keynote slides embed the same TST archives, and the reading and writing code is identical for all three.

Returns ​

TableModel[]

Inherited from ​

IWorkDocument.tables


textStorages() ​

textStorages(kind?): TextStorage[]

Defined in: src/tsa/document.ts:172

Every text storage in the document (bodies, headers, cells, notes …).

Parameters ​

kind? ​

number

Returns ​

TextStorage[]

Inherited from ​

IWorkDocument.textStorages


typeNameOf() ​

typeNameOf(obj): string | undefined

Defined in: src/tsa/document.ts:270

Parameters ​

obj ​

IwaObject

Returns ​

string | undefined

Inherited from ​

IWorkDocument.typeNameOf


blank() ​

static blank(): KeynoteDocument

Defined in: src/keynote/document.ts:600

A new, empty Keynote deck — one slide, 16:9 (1920 × 1080), no template file needed.

The embedded donor is an Apple-written corpus fixture emptied by blankFrom, so every master, style, and identity in the "new" deck was authored by an Apple app. scripts/make-blanks.ts records its provenance.

Returns ​

KeynoteDocument

Agent Tool ​

create_document


blankFrom() ​

static blankFrom(template): KeynoteDocument

Defined in: src/keynote/document.ts:578

A new, empty deck built from one you supply.

There is no from-nothing constructor, and there will not be one. A deck is dozens of interlinked archives — theme, masters, slide styles — and inventing that graph would produce a file nothing offline could validate. Emptying a real one keeps every identity and master exactly as an Apple app wrote it.

One slide survives, with its text placeholders emptied. Masters are untouched: they are the template.

Parameters ​

template ​

Uint8Array

Returns ​

KeynoteDocument


load() ​

static load(bytes): KeynoteDocument

Defined in: src/keynote/document.ts:457

Parameters ​

bytes ​

Uint8Array

Returns ​

KeynoteDocument


loadStore() ​

protected static loadStore(bytes, app, extractors): object

Defined in: src/tsa/document.ts:152

Parameters ​

bytes ​

Uint8Array

app ​

IWorkApp

extractors ​

ReadonlyMap<number, ReferenceExtractor>

Returns ​

object

container ​

container: IWorkContainer

store ​

store: ObjectStore

Inherited from ​

IWorkDocument.loadStore


open() ​

static open(bytes): IWorkDocument

Defined in: src/tsa/document.ts:139

Load any modern iWork document, auto-detecting the app. Prefer the app subclasses' load when the type is known — they expose richer APIs.

Parameters ​

bytes ​

Uint8Array

Returns ​

IWorkDocument

Inherited from ​

IWorkDocument.open

MIT licensed. Independently made — not by Apple in California. Not affiliated with or endorsed by Apple Inc.