cupertino-files / KeynoteDocument
Class: KeynoteDocument
Defined in: src/keynote/document.ts:438
Extends
Properties
container
readonlycontainer:IWorkContainer
Defined in: src/tsa/document.ts:125
Inherited from
format
readonlyformat:FormatInfo
Defined in: src/tsa/document.ts:127
Inherited from
store
readonlystore:ObjectStore
Defined in: src/tsa/document.ts:126
Inherited from
Accessors
app
Get Signature
get app():
IWorkApp
Defined in: src/tsa/document.ts:167
Returns
Inherited from
era
Get Signature
get era():
"iwork13"|"iwork16"|"iwork19"|"modern"|"current"|"future"
Defined in: src/tsa/document.ts:285
Format era this document was written by (see tsp/version.ts).
Returns
"iwork13" | "iwork16" | "iwork19" | "modern" | "current" | "future"
Inherited from
loops
Get Signature
get loops():
boolean
Defined in: src/keynote/document.ts:476
Returns
boolean
slideNumbersVisible
Get Signature
get slideNumbersVisible():
boolean
Defined in: src/keynote/document.ts:472
Returns
boolean
Methods
addSlide()
addSlide(
options?):KeynoteSlide
Defined in: src/keynote/document.ts:672
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
Agent Tool
manage_slides
allNotes()
allNotes():
object[]
Defined in: src/keynote/document.ts:903
Speaker notes of every slide, in order.
Returns
object[]
allText()
allText():
string
Defined in: src/tsa/document.ts:228
Concatenated plain text of all in-document storages (reading order approximation).
Returns
string
Inherited from
charts()
charts():
ChartModel[]
Defined in: src/tsa/document.ts:207
Every chart, with its plotted data (see ChartModel).
Returns
Inherited from
compact()
compact():
number
Defined in: src/tsa/document.ts:310
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
compatibility()
compatibility():
CompatibilityReport
Defined in: src/tsa/document.ts:266
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
Inherited from
compatibilitySummary()
compatibilitySummary():
string
Defined in: src/tsa/document.ts:280
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
Inherited from
duplicateSlide()
duplicateSlide(
index):KeynoteSlide
Defined in: src/keynote/document.ts:790
Duplicate a slide, content and all.
Parameters
index
number
Returns
Agent Tool
manage_slides
images()
images():
ImageModel[]
Defined in: src/tsa/document.ts:212
Every image, with filter/mask access (see ImageModel).
Returns
Inherited from
masterSlides()
masterSlides():
object[]
Defined in: src/keynote/document.ts:646
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:816
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:908
Every NOTE-kind storage in the document.
Returns
object()
object(
id):IwaObject|undefined
Defined in: src/tsa/document.ts:235
Parameters
id
bigint
Returns
IwaObject | undefined
Inherited from
presentation()
presentation():
PresentationSettings
Defined in: src/keynote/document.ts:488
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
presentedSlides()
presentedSlides():
KeynoteSlide[]
Defined in: src/keynote/document.ts:632
Slides that will actually be presented (skipped ones removed).
Returns
pruneRoots()
protectedpruneRoots():bigint[]
Defined in: src/tsa/document.ts:322
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
removeSlide()
removeSlide(
index):void
Defined in: src/keynote/document.ts:803
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:341
Returns
Uint8Array
Inherited from
setPresentation()
setPresentation(
settings):void
Defined in: src/keynote/document.ts:503
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:536
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:637
Number of slides reachable from the slide tree.
Returns
number
slides()
slides():
KeynoteSlide[]
Defined in: src/keynote/document.ts:593
Returns
slideSize()
slideSize(): {
height:number;width:number; } |undefined
Defined in: src/keynote/document.ts:465
Slide canvas size in points (e.g. 1920×1080).
Returns
{ height: number; width: number; } | undefined
stats()
stats():
DocumentStats
Defined in: src/tsa/document.ts:243
Returns
Inherited from
stylesheets()
stylesheets():
StylesheetModel[]
Defined in: src/tsa/document.ts:183
All stylesheets (document + theme).
Returns
Inherited from
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
Inherited from
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
Inherited from
typeNameOf()
typeNameOf(
obj):string|undefined
Defined in: src/tsa/document.ts:239
Parameters
obj
Returns
string | undefined
Inherited from
blank()
staticblank():KeynoteDocument
Defined in: src/keynote/document.ts:589
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()
staticblankFrom(template):KeynoteDocument
Defined in: src/keynote/document.ts:567
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()
staticload(bytes):KeynoteDocument
Defined in: src/keynote/document.ts:446
Parameters
bytes
Uint8Array
Returns
KeynoteDocument
loadStore()
protectedstaticloadStore(bytes,app,extractors):object
Defined in: src/tsa/document.ts:152
Parameters
bytes
Uint8Array
app
extractors
ReadonlyMap<number, ReferenceExtractor>
Returns
object
container
container:
IWorkContainer
store
store:
ObjectStore
Inherited from
open()
staticopen(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