@shbernal/ts-pptx 3.2.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -20
- package/dist/{autopage-QQyfRtoK.js → autopage-BYlTzX-l.js} +21 -17
- package/dist/autopage-BYlTzX-l.js.map +1 -0
- package/dist/browser.d.ts +6 -6
- package/dist/browser.js +11 -12
- package/dist/browser.js.map +1 -1
- package/dist/{diagnostics-Chjz_4_Q.d.ts → diagnostics-B0OmTOoz.d.ts} +65 -16
- package/dist/diagnostics-B0OmTOoz.d.ts.map +1 -0
- package/dist/{diagnostics-DYQC7xLV.js → diagnostics-CPVADSL1.js} +0 -0
- package/dist/{diagnostics-DYQC7xLV.js.map → diagnostics-CPVADSL1.js.map} +1 -1
- package/dist/{enums-CoXnxiCI.d.ts → enums-CvRYniUA.d.ts} +13 -3
- package/dist/{enums-CoXnxiCI.d.ts.map → enums-CvRYniUA.d.ts.map} +1 -1
- package/dist/{errors-BVLCFr-t.d.ts → errors-fB1KDJKQ.d.ts} +5 -5
- package/dist/{errors-BVLCFr-t.d.ts.map → errors-fB1KDJKQ.d.ts.map} +1 -1
- package/dist/{fit-DhMbQG5O.js → fit-TjpNbMru.js} +0 -0
- package/dist/fit-TjpNbMru.js.map +1 -0
- package/dist/{html-dom-DajBuobe.js → html-dom-yUSdCExA.js} +5 -6
- package/dist/html-dom-yUSdCExA.js.map +1 -0
- package/dist/html.d.ts +3 -3
- package/dist/html.js +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +16 -34
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +1 -1
- package/dist/inspect.js +5 -4
- package/dist/inspect.js.map +1 -1
- package/dist/math.d.ts +1 -1
- package/dist/measure.d.ts +96 -6
- package/dist/measure.d.ts.map +1 -1
- package/dist/measure.js +2 -2
- package/dist/{st-enums-evQG2A7Z.js → namespaces-Sy_m7Nhd.js} +318 -209
- package/dist/namespaces-Sy_m7Nhd.js.map +1 -0
- package/dist/node.d.ts +6 -6
- package/dist/node.js +7 -20
- package/dist/node.js.map +1 -1
- package/dist/notes-bWApshah.js +1727 -0
- package/dist/notes-bWApshah.js.map +1 -0
- package/dist/{pres-C-EU3SkN.d.ts → pres-Dybf7ZUl.d.ts} +4 -4
- package/dist/{pres-C-EU3SkN.d.ts.map → pres-Dybf7ZUl.d.ts.map} +1 -1
- package/dist/{presentation-CxnUVhK9.js → presentation-3rAKKRfm.js} +1247 -743
- package/dist/presentation-3rAKKRfm.js.map +1 -0
- package/dist/{presentation-Osx1cDdJ.d.ts → presentation-types-D7cgT-eG.d.ts} +867 -24
- package/dist/presentation-types-D7cgT-eG.d.ts.map +1 -0
- package/dist/read.d.ts +4 -5
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +3 -3
- package/dist/script.d.ts +2 -2
- package/dist/script.d.ts.map +1 -1
- package/dist/script.js +0 -0
- package/dist/script.js.map +1 -1
- package/dist/{shapes-DoJBPrwN.js → shapes-Dyw5bxwO.js} +371 -52
- package/dist/shapes-Dyw5bxwO.js.map +1 -0
- package/dist/{slide-BTfn1Pyp.d.ts → slide-B_aInw3N.d.ts} +246 -182
- package/dist/slide-B_aInw3N.d.ts.map +1 -0
- package/dist/{text-C4P9MNdf.js → text-DSN3anEh.js} +3609 -4932
- package/dist/text-DSN3anEh.js.map +1 -0
- package/dist/{units-internal-CR8s8YQa.js → units-internal-DNvK2I6o.js} +207 -35
- package/dist/units-internal-DNvK2I6o.js.map +1 -0
- package/dist/zip.d.ts +2 -2
- package/package.json +36 -27
- package/dist/autopage-QQyfRtoK.js.map +0 -1
- package/dist/diagnostics-Chjz_4_Q.d.ts.map +0 -1
- package/dist/embedded-fonts-MaynAHa9.js +0 -94
- package/dist/embedded-fonts-MaynAHa9.js.map +0 -1
- package/dist/fit-DhMbQG5O.js.map +0 -1
- package/dist/html-dom-DajBuobe.js.map +0 -1
- package/dist/presentation-CxnUVhK9.js.map +0 -1
- package/dist/presentation-Osx1cDdJ.d.ts.map +0 -1
- package/dist/presentation-types-Dj4riuDs.d.ts +0 -538
- package/dist/presentation-types-Dj4riuDs.d.ts.map +0 -1
- package/dist/shapes-DoJBPrwN.js.map +0 -1
- package/dist/slide-BTfn1Pyp.d.ts.map +0 -1
- package/dist/st-enums-evQG2A7Z.js.map +0 -1
- package/dist/text-C4P9MNdf.js.map +0 -1
- package/dist/units-C7QM1KgH.js +0 -144
- package/dist/units-C7QM1KgH.js.map +0 -1
- package/dist/units-internal-CR8s8YQa.js.map +0 -1
|
@@ -1,6 +1,28 @@
|
|
|
1
|
-
import { t as CustomPropertyValue } from "./pres-
|
|
2
|
-
import { c as ImportSlideMastersOptions, d as LayoutHandle, f as SlideSize, l as ImportSlideOptions, o as FromTemplateOptions, p as SlideSource, r as EmbeddedFontInfo, s as ImportShapeOptions, t as AppendSlidesOptions, u as ImportedSlideMaster } from "./presentation-types-Dj4riuDs.js";
|
|
1
|
+
import { t as CustomPropertyValue } from "./pres-Dybf7ZUl.js";
|
|
3
2
|
import { a as Part, i as Relationships, n as OpcPackage, o as Element, t as OpcInput } from "./package-CaOLXSNi.js";
|
|
3
|
+
//#region src/embedded-fonts.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The four face slots of `CT_EmbeddedFontListEntry`, in schema child order
|
|
6
|
+
* (`font` first, then these). Iterate in this order everywhere so the read- and
|
|
7
|
+
* write-side emitters agree on element order.
|
|
8
|
+
*/
|
|
9
|
+
declare const EMBEDDED_FONT_SLOTS: readonly ['regular', 'bold', 'italic', 'boldItalic'];
|
|
10
|
+
type EmbeddedFontSlot = (typeof EMBEDDED_FONT_SLOTS)[number];
|
|
11
|
+
/** One embeddable face: a slot plus the raw font bytes (absent in pure read-side merges). */
|
|
12
|
+
interface EmbeddedFontFace {
|
|
13
|
+
slot: EmbeddedFontSlot;
|
|
14
|
+
bytes?: Uint8Array;
|
|
15
|
+
}
|
|
16
|
+
/** A typeface family with 1..4 embedded faces — one `p:embeddedFont` entry. */
|
|
17
|
+
interface EmbeddedFont {
|
|
18
|
+
/** `p:font/@typeface` — MUST match the family name used in run/`fontFace` typefaces or PowerPoint won't bind it. */
|
|
19
|
+
typeface: string;
|
|
20
|
+
panose?: string;
|
|
21
|
+
pitchFamily?: number;
|
|
22
|
+
charset?: number;
|
|
23
|
+
faces: EmbeddedFontFace[];
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
4
26
|
//#region src/read/oxml/theme.d.ts
|
|
5
27
|
/**
|
|
6
28
|
* The colour-resolution context: the two maps that turn a DrawingML colour
|
|
@@ -1121,10 +1143,16 @@ declare abstract class Shape {
|
|
|
1121
1143
|
host: ShapeHost);
|
|
1122
1144
|
/** Which concrete shape kind this is. */
|
|
1123
1145
|
abstract readonly shapeType: ShapeType;
|
|
1124
|
-
/**
|
|
1125
|
-
|
|
1146
|
+
/**
|
|
1147
|
+
* The transform element carrying this shape's geometry, or `null` if inherited.
|
|
1148
|
+
*
|
|
1149
|
+
* Defaults to `p:spPr/a:xfrm`, which is where three of the four shape kinds keep it
|
|
1150
|
+
* (`p:sp`, `p:pic`, `p:cxnSp`). {@link GraphicFrame} overrides it: a `p:graphicFrame`
|
|
1151
|
+
* has no `p:spPr` and carries a `p:xfrm` of its own directly.
|
|
1152
|
+
*/
|
|
1153
|
+
protected xfrm(): Element | null;
|
|
1126
1154
|
/** The transform element, creating it (and its container) in document order if absent. */
|
|
1127
|
-
protected
|
|
1155
|
+
protected getOrAddXfrm(): Element;
|
|
1128
1156
|
/**
|
|
1129
1157
|
* Mark the owning host's part dirty so `save()` reserializes it. Public
|
|
1130
1158
|
* because {@link element_} hands out the live DOM node: the hatch and the
|
|
@@ -1473,8 +1501,6 @@ declare abstract class Shape {
|
|
|
1473
1501
|
/** An auto shape, text box, or placeholder (`p:sp`). The only kind that holds text. */
|
|
1474
1502
|
declare class AutoShape extends Shape {
|
|
1475
1503
|
readonly shapeType: 'autoShape';
|
|
1476
|
-
protected xfrm(): Element | null;
|
|
1477
|
-
protected getOrAddXfrm(): Element;
|
|
1478
1504
|
get hasTextFrame(): boolean;
|
|
1479
1505
|
get textFrame(): TextFrame | null;
|
|
1480
1506
|
/**
|
|
@@ -1499,8 +1525,6 @@ declare class AutoShape extends Shape {
|
|
|
1499
1525
|
declare class Picture extends Shape {
|
|
1500
1526
|
#private;
|
|
1501
1527
|
readonly shapeType: 'picture';
|
|
1502
|
-
protected xfrm(): Element | null;
|
|
1503
|
-
protected getOrAddXfrm(): Element;
|
|
1504
1528
|
protected get supportsFill(): boolean;
|
|
1505
1529
|
/** Relationship id of the embedded image (`p:blipFill/a:blip/@r:embed`), or `null`. */
|
|
1506
1530
|
get imageRelId(): string | null;
|
|
@@ -1611,8 +1635,6 @@ declare class Picture extends Shape {
|
|
|
1611
1635
|
declare class Connector extends Shape {
|
|
1612
1636
|
#private;
|
|
1613
1637
|
readonly shapeType: 'connector';
|
|
1614
|
-
protected xfrm(): Element | null;
|
|
1615
|
-
protected getOrAddXfrm(): Element;
|
|
1616
1638
|
/**
|
|
1617
1639
|
* The connector's **start**-point shape binding (`p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn`),
|
|
1618
1640
|
* or `null` when the start point is unbound (a bare `p:cNvCxnSpPr`, i.e. a
|
|
@@ -1949,6 +1971,158 @@ declare class ChartExAxis {
|
|
|
1949
1971
|
markDirty(): void;
|
|
1950
1972
|
}
|
|
1951
1973
|
//#endregion
|
|
1974
|
+
//#region src/read/api/diagram.d.ts
|
|
1975
|
+
/**
|
|
1976
|
+
* `ST_PtType` — what a `dgm:pt` is.
|
|
1977
|
+
*
|
|
1978
|
+
* - `node` — a user-authored node, and the default when `@type` is absent.
|
|
1979
|
+
* - `asst` — an assistant node (an org chart's off-branch box); user content too.
|
|
1980
|
+
* - `doc` — the data model's single root; carries the layout/style/colour preset ids.
|
|
1981
|
+
* - `pres` — generated by the layout engine to position a node; never user content.
|
|
1982
|
+
* - `parTrans` / `sibTrans` — the two transition points of an edge, which a few layouts
|
|
1983
|
+
* (arrow processes, org-chart branches) let the user type a label into.
|
|
1984
|
+
*/
|
|
1985
|
+
type DiagramPointType = 'node' | 'asst' | 'doc' | 'pres' | 'parTrans' | 'sibTrans';
|
|
1986
|
+
/**
|
|
1987
|
+
* `ST_CxnType` — what a `dgm:cxn` asserts. `parOf` (the default) is the parent/child edge of
|
|
1988
|
+
* the user's tree; `presOf` and `presParOf` bind a node to the generated `pres` point that
|
|
1989
|
+
* draws it, and are the layout engine's bookkeeping rather than structure.
|
|
1990
|
+
*/
|
|
1991
|
+
type DiagramConnectionType = 'parOf' | 'presOf' | 'presParOf' | 'unknownRelationship';
|
|
1992
|
+
/**
|
|
1993
|
+
* One edge of a diagram's data model (`dgm:cxn`) — an attribute-only element, so it reads as
|
|
1994
|
+
* plain data rather than as a proxy.
|
|
1995
|
+
*
|
|
1996
|
+
* The ids are `ST_ModelId` GUIDs matching a {@link DiagramPoint.modelId}. `parOf` edges are
|
|
1997
|
+
* the tree a reader cares about: `sourceId` is the parent, `destinationId` the child, and
|
|
1998
|
+
* `sourceOrder` the child's position among its siblings.
|
|
1999
|
+
*/
|
|
2000
|
+
interface DiagramConnection {
|
|
2001
|
+
/** This edge's own id (`@modelId`). */
|
|
2002
|
+
modelId: string | null;
|
|
2003
|
+
/** What the edge asserts (`@type`); `parOf` when absent, its schema default. */
|
|
2004
|
+
type: DiagramConnectionType;
|
|
2005
|
+
/** The `@srcId` end — the parent, for a `parOf` edge. */
|
|
2006
|
+
sourceId: string | null;
|
|
2007
|
+
/** The `@destId` end — the child, for a `parOf` edge. */
|
|
2008
|
+
destinationId: string | null;
|
|
2009
|
+
/** The child's index among its siblings (`@srcOrd`). */
|
|
2010
|
+
sourceOrder: number | null;
|
|
2011
|
+
/** The parent's index as seen from the child (`@destOrd`). */
|
|
2012
|
+
destinationOrder: number | null;
|
|
2013
|
+
/** The `parTrans` point labelling this edge (`@parTransId`), or `null` when unset. */
|
|
2014
|
+
parentTransitionId: string | null;
|
|
2015
|
+
/** The `sibTrans` point labelling this edge (`@sibTransId`), or `null` when unset. */
|
|
2016
|
+
siblingTransitionId: string | null;
|
|
2017
|
+
/** The layout preset this edge belongs to (`@presId`), set on generated edges only. */
|
|
2018
|
+
presentationId: string | null;
|
|
2019
|
+
}
|
|
2020
|
+
/** One point (`dgm:pt`) of a diagram's data model. */
|
|
2021
|
+
declare class DiagramPoint {
|
|
2022
|
+
#private;
|
|
2023
|
+
private readonly pt;
|
|
2024
|
+
/** The diagram data part, so a text edit marks the right part dirty. */
|
|
2025
|
+
private readonly part;
|
|
2026
|
+
private readonly themeContext?;
|
|
2027
|
+
private readonly relationships?;
|
|
2028
|
+
constructor(pt: Element,
|
|
2029
|
+
/** The diagram data part, so a text edit marks the right part dirty. */
|
|
2030
|
+
part: Part, themeContext?: ThemeContext | undefined, relationships?: Relationships | undefined);
|
|
2031
|
+
/** This point's id (`@modelId`), which connections reference. */
|
|
2032
|
+
get modelId(): string | null;
|
|
2033
|
+
/** What kind of point this is (`@type`); `node` when absent, its schema default. */
|
|
2034
|
+
get type(): DiagramPointType;
|
|
2035
|
+
/**
|
|
2036
|
+
* For a transition point, the edge it labels (`@cxnId`), or `null`. The schema's default
|
|
2037
|
+
* is the literal `0`, which means "none" rather than naming a point, so it reads `null`.
|
|
2038
|
+
*/
|
|
2039
|
+
get connectionId(): string | null;
|
|
2040
|
+
/**
|
|
2041
|
+
* Whether this point is an unfilled prompt (`dgm:prSet/@phldr`) — a node PowerPoint draws
|
|
2042
|
+
* with a grey placeholder string and treats as empty. Excluded from {@link Diagram.text}:
|
|
2043
|
+
* a layout that stores its prompt in `dgm:t` would otherwise extract as content.
|
|
2044
|
+
*/
|
|
2045
|
+
get isPlaceholder(): boolean;
|
|
2046
|
+
/** The prompt string a placeholder point displays (`dgm:prSet/@phldrT`), or `null`. */
|
|
2047
|
+
get placeholderText(): string | null;
|
|
2048
|
+
/**
|
|
2049
|
+
* This point's text body (`dgm:t`) as a {@link TextFrame}, or `null` when the point
|
|
2050
|
+
* carries none. It is an `a:CT_TextBody` like any other, so `paragraphs`, `runs` and the
|
|
2051
|
+
* `resolved*` getters all apply.
|
|
2052
|
+
*/
|
|
2053
|
+
get textFrame(): TextFrame | null;
|
|
2054
|
+
/** This point's text, paragraphs joined by `\n`; `''` when it carries none. */
|
|
2055
|
+
get text(): string;
|
|
2056
|
+
/** Escape hatch: the underlying `dgm:pt` element. After mutating it call {@link Diagram.markDirty}. */
|
|
2057
|
+
get element_(): Element;
|
|
2058
|
+
}
|
|
2059
|
+
/** A SmartArt graphic frame's diagram, backed by its `dgm:dataModel` part. */
|
|
2060
|
+
declare class Diagram {
|
|
2061
|
+
#private;
|
|
2062
|
+
/** The diagram's data part (`/ppt/diagrams/data{N}.xml`), whose root is `dgm:dataModel`. */
|
|
2063
|
+
readonly part: Part;
|
|
2064
|
+
/** The frame's `dgm:relIds`, which names the other three parts by relationship id. */
|
|
2065
|
+
private readonly relIds;
|
|
2066
|
+
private readonly opc;
|
|
2067
|
+
/** Relationships of the part holding the frame — what `dgm:relIds` resolves against. */
|
|
2068
|
+
private readonly frameRelationships;
|
|
2069
|
+
private readonly themeContext?;
|
|
2070
|
+
constructor(
|
|
2071
|
+
/** The diagram's data part (`/ppt/diagrams/data{N}.xml`), whose root is `dgm:dataModel`. */
|
|
2072
|
+
part: Part,
|
|
2073
|
+
/** The frame's `dgm:relIds`, which names the other three parts by relationship id. */
|
|
2074
|
+
relIds: Element, opc: OpcPackage,
|
|
2075
|
+
/** Relationships of the part holding the frame — what `dgm:relIds` resolves against. */
|
|
2076
|
+
frameRelationships: Relationships, themeContext?: ThemeContext | undefined);
|
|
2077
|
+
/** Partname of the diagram data part. */
|
|
2078
|
+
get partName(): string;
|
|
2079
|
+
/**
|
|
2080
|
+
* Every point (`dgm:ptLst/dgm:pt`) in document order, unfiltered — generated `pres`
|
|
2081
|
+
* points and the `doc` root included. Filter on {@link DiagramPoint.type} for the user's
|
|
2082
|
+
* nodes; {@link text} is the shortcut for the common case.
|
|
2083
|
+
*/
|
|
2084
|
+
get points(): DiagramPoint[];
|
|
2085
|
+
/** Every edge (`dgm:cxnLst/dgm:cxn`) in document order. */
|
|
2086
|
+
get connections(): DiagramConnection[];
|
|
2087
|
+
/**
|
|
2088
|
+
* The diagram's text in document order, blocks joined by `\n` — the counterpart to
|
|
2089
|
+
* `TextFrame.text` for a construct that has no single text body.
|
|
2090
|
+
*
|
|
2091
|
+
* Contributing points are the ones a user can type into: everything except the generated
|
|
2092
|
+
* `pres` points, the `doc` root, and any point flagged as an unfilled placeholder. A
|
|
2093
|
+
* point with no text contributes no blank line. Transition labels (`parTrans`/`sibTrans`)
|
|
2094
|
+
* are included where a layout has them, which is why this is not simply the node list.
|
|
2095
|
+
*/
|
|
2096
|
+
get text(): string;
|
|
2097
|
+
/**
|
|
2098
|
+
* The layout preset the diagram is drawn with (the `doc` point's `dgm:prSet/@loTypeId`),
|
|
2099
|
+
* e.g. `urn:microsoft.com/office/officeart/2005/8/layout/hList1`. This is what names the
|
|
2100
|
+
* SmartArt *kind*; {@link layoutPart} is that preset's definition.
|
|
2101
|
+
*/
|
|
2102
|
+
get layoutTypeId(): string | null;
|
|
2103
|
+
/** The quick-style preset (the `doc` point's `dgm:prSet/@qsTypeId`). */
|
|
2104
|
+
get quickStyleTypeId(): string | null;
|
|
2105
|
+
/** The colour preset (the `doc` point's `dgm:prSet/@csTypeId`). */
|
|
2106
|
+
get colorsTypeId(): string | null;
|
|
2107
|
+
/** The layout definition part (`dgm:relIds/@r:lo`), or `null` when missing from the package. */
|
|
2108
|
+
get layoutPart(): Part | null;
|
|
2109
|
+
/** The quick-style part (`dgm:relIds/@r:qs`), or `null` when missing from the package. */
|
|
2110
|
+
get quickStylePart(): Part | null;
|
|
2111
|
+
/** The colours part (`dgm:relIds/@r:cs`), or `null` when missing from the package. */
|
|
2112
|
+
get colorsPart(): Part | null;
|
|
2113
|
+
/**
|
|
2114
|
+
* The fallback drawing part (`dsp:drawing`) that renders the diagram for a consumer with
|
|
2115
|
+
* no SmartArt layout engine, or `null` when the deck carries none. It is named by an MS
|
|
2116
|
+
* extension on the data model rather than by `dgm:relIds`, so a slide holding two
|
|
2117
|
+
* diagrams still resolves each to its own drawing.
|
|
2118
|
+
*/
|
|
2119
|
+
get drawingPart(): Part | null;
|
|
2120
|
+
/** Escape hatch: the underlying `dgm:dataModel` element. After mutating it call {@link markDirty}, or `save()` writes the original bytes. */
|
|
2121
|
+
get element_(): Element | null;
|
|
2122
|
+
/** Mark the diagram data part dirty so `save()` reserializes it. Call after mutating {@link element_}. */
|
|
2123
|
+
markDirty(): void;
|
|
2124
|
+
}
|
|
2125
|
+
//#endregion
|
|
1952
2126
|
//#region src/read/api/table-edit.d.ts
|
|
1953
2127
|
/** The four edges plus the two diagonals, keyed as {@link TableCellEdge} names them. */
|
|
1954
2128
|
declare const EDGE_QNAMES: {
|
|
@@ -2548,7 +2722,7 @@ declare class TableCell {
|
|
|
2548
2722
|
}
|
|
2549
2723
|
//#endregion
|
|
2550
2724
|
//#region src/read/api/shapes/graphic-frame.d.ts
|
|
2551
|
-
/** A graphic frame (`p:graphicFrame`) — host for tables and
|
|
2725
|
+
/** A graphic frame (`p:graphicFrame`) — host for tables, charts and SmartArt diagrams. */
|
|
2552
2726
|
declare class GraphicFrame extends Shape {
|
|
2553
2727
|
#private;
|
|
2554
2728
|
readonly shapeType: 'graphicFrame';
|
|
@@ -2561,6 +2735,18 @@ declare class GraphicFrame extends Shape {
|
|
|
2561
2735
|
get hasChart(): boolean;
|
|
2562
2736
|
/** Whether this frame hosts a chartEx chart (`a:graphicData/@uri` is the chartEx URI). */
|
|
2563
2737
|
get hasChartEx(): boolean;
|
|
2738
|
+
/** Whether this frame hosts a SmartArt diagram (`a:graphicData/@uri` is the diagram URI). */
|
|
2739
|
+
get hasDiagram(): boolean;
|
|
2740
|
+
/**
|
|
2741
|
+
* The `a:graphicData/@uri` verbatim — the namespace naming what this frame hosts, or
|
|
2742
|
+
* `null` when the frame carries no `a:graphicData`.
|
|
2743
|
+
*
|
|
2744
|
+
* Every `has*` predicate is a comparison against this, so a frame whose URI matches none
|
|
2745
|
+
* of them is one the read model does not decode (an OLE object, an ink `p:contentPart`).
|
|
2746
|
+
* Reading the URI is what lets a consumer say *which* construct it could not reach
|
|
2747
|
+
* instead of inferring loss from four `false`s.
|
|
2748
|
+
*/
|
|
2749
|
+
get graphicDataUri(): string | null;
|
|
2564
2750
|
/** The hosted table, or `null` when this frame is not a table. */
|
|
2565
2751
|
get table(): Table | null;
|
|
2566
2752
|
/** The hosted chart, or `null` when this frame is not a chart or its part is missing. */
|
|
@@ -2571,6 +2757,12 @@ declare class GraphicFrame extends Shape {
|
|
|
2571
2757
|
* `cx:chart` (not the classic `c:chart`), carrying the MS `chartEx` rel id.
|
|
2572
2758
|
*/
|
|
2573
2759
|
get chartEx(): ChartEx | null;
|
|
2760
|
+
/**
|
|
2761
|
+
* The hosted SmartArt diagram, or `null` when this frame is not a diagram or its data
|
|
2762
|
+
* part is missing. The payload child is `dgm:relIds`, which names four parts by
|
|
2763
|
+
* relationship id; the `@r:dm` one is the data model this resolves.
|
|
2764
|
+
*/
|
|
2765
|
+
get diagram(): Diagram | null;
|
|
2574
2766
|
}
|
|
2575
2767
|
//#endregion
|
|
2576
2768
|
//#region src/read/api/shapes.d.ts
|
|
@@ -3272,9 +3464,14 @@ declare class Slide implements ShapeHost {
|
|
|
3272
3464
|
* All text on the slide, flattened in document order — the read-model
|
|
3273
3465
|
* counterpart to {@link TextFrame.text} one level up. Every text-bearing shape
|
|
3274
3466
|
* contributes its text, recursing into groups ({@link GroupShape}) and reading
|
|
3275
|
-
* table cells ({@link GraphicFrame.table})
|
|
3276
|
-
*
|
|
3277
|
-
*
|
|
3467
|
+
* table cells ({@link GraphicFrame.table}) and SmartArt node text
|
|
3468
|
+
* ({@link GraphicFrame.diagram}); text-free shapes (pictures, connectors, empty
|
|
3469
|
+
* boxes) contribute nothing. Blocks are joined by `\n`; within a table, cells in
|
|
3470
|
+
* a row are joined by `\t` and rows by `\n`.
|
|
3471
|
+
*
|
|
3472
|
+
* A diagram contributes for the same reason a table does: its nodes are body text
|
|
3473
|
+
* PowerPoint itself searches and spell-checks, so a slide whose whole message is a
|
|
3474
|
+
* SmartArt graphic would otherwise flatten to the empty string.
|
|
3278
3475
|
*
|
|
3279
3476
|
* This is deliberately scoped to the slide's own shape tree. It does **not**
|
|
3280
3477
|
* include speaker notes (read those via {@link notesText}) or chart data labels
|
|
@@ -3435,6 +3632,29 @@ declare class Slide implements ShapeHost {
|
|
|
3435
3632
|
* format is sniffed from the bytes unless `extension`/`contentType` are given.
|
|
3436
3633
|
*/
|
|
3437
3634
|
addPicture(image: Uint8Array, options: AddPictureOptions): Picture;
|
|
3635
|
+
/**
|
|
3636
|
+
* Give this slide the speaker notes `text`, and return the resulting
|
|
3637
|
+
* {@link NotesSlide}. A `
|
|
3638
|
+
` starts a new paragraph, matching the write-side
|
|
3639
|
+
* `addNotes`; the runs carry no formatting of their own, so style them
|
|
3640
|
+
* afterwards through {@link notesTextFrame}.
|
|
3641
|
+
*
|
|
3642
|
+
* The counterpart to the read side's `notesText`/`notesTextFrame`/`notesSlide`
|
|
3643
|
+
* getters, and the way to annotate a slide that has **no notes part at all** —
|
|
3644
|
+
* the state an `importSlide` without `{ importNotes: true }` leaves behind, and
|
|
3645
|
+
* the one a `notesTextFrame` edit cannot reach because there is no frame to
|
|
3646
|
+
* hand back. Calling it on a slide that already has notes replaces the body
|
|
3647
|
+
* text and leaves the rest of the part (its geometry, its other two
|
|
3648
|
+
* placeholders) alone.
|
|
3649
|
+
*
|
|
3650
|
+
* Creating the part pulls in what a notes slide must bind to: a `notesMaster`,
|
|
3651
|
+
* of which a presentation may hold at most one. This deck's own is reused when
|
|
3652
|
+
* it has one; otherwise one is installed, bound to a clone of this deck's theme
|
|
3653
|
+
* so it resolves against the destination palette. That is the same
|
|
3654
|
+
* single-master rule `importSlide({ importNotes: true })` and `appendSlides`
|
|
3655
|
+
* follow, so mixing the three cannot produce a second notes master.
|
|
3656
|
+
*/
|
|
3657
|
+
addNotes(text: string): NotesSlide;
|
|
3438
3658
|
/**
|
|
3439
3659
|
* @internal The slide's shape tree (`p:cSld/p:spTree`), or `null` if absent.
|
|
3440
3660
|
* Exposed for cross-slide composition (`Presentation.importShape`).
|
|
@@ -3609,12 +3829,17 @@ declare class Presentation {
|
|
|
3609
3829
|
* Duplicate the slide at `index` and insert the copy at `options.at` (deck
|
|
3610
3830
|
* order; `0` = first), defaulting to appending at the end when `at` is omitted
|
|
3611
3831
|
* or out of range. Returns the new slide. The new slide part copies the source
|
|
3612
|
-
* bytes verbatim and shares the source's relationship targets
|
|
3613
|
-
*
|
|
3614
|
-
* `p:sldId` entry are wired up. Marks the presentation part
|
|
3832
|
+
* bytes verbatim and shares the source's deck-wide relationship targets
|
|
3833
|
+
* (layout, images, media) by copying its `.rels`; a new presentation→slide
|
|
3834
|
+
* relationship and a `p:sldId` entry are wired up. Marks the presentation part
|
|
3835
|
+
* dirty.
|
|
3615
3836
|
*
|
|
3616
|
-
*
|
|
3617
|
-
*
|
|
3837
|
+
* What the source page *owns* is copied rather than shared: its notes slide,
|
|
3838
|
+
* charts, SmartArt diagrams and OLE embeddings, each with the subtree under it
|
|
3839
|
+
* (a chart's embedded workbook comes along; the image inside its user-shapes
|
|
3840
|
+
* drawing stays shared). PowerPoint refuses to open a deck where two slides
|
|
3841
|
+
* resolve to one chart or diagram, so this is not tidiness — see
|
|
3842
|
+
* `page-owned.ts` for the rule and the evidence behind it.
|
|
3618
3843
|
*/
|
|
3619
3844
|
cloneSlide(index: number, options?: {
|
|
3620
3845
|
at?: number;
|
|
@@ -3646,7 +3871,10 @@ declare class Presentation {
|
|
|
3646
3871
|
* Only the layout(s) actually used by imported slides are copied; the imported
|
|
3647
3872
|
* master's `p:sldLayoutIdLst` is pruned to exactly those, mirroring how
|
|
3648
3873
|
* PowerPoint's "Reuse Slides" brings a slide across. Parts shared by repeated
|
|
3649
|
-
* imports from the same source deck are copied once and reused
|
|
3874
|
+
* imports from the same source deck are copied once and reused — every part
|
|
3875
|
+
* except the page itself. Importing the same source slide twice yields two
|
|
3876
|
+
* independent copies over one shared layout/master/theme, which is what lets a
|
|
3877
|
+
* deck show one page twice (verbatim, then edited).
|
|
3650
3878
|
*
|
|
3651
3879
|
* With `{ theme: 'preserve' }` the slide's source theme is instead *flattened*
|
|
3652
3880
|
* into the slide XML and the slide is bound to this deck's existing
|
|
@@ -3660,6 +3888,53 @@ declare class Presentation {
|
|
|
3660
3888
|
* widths). Source notes are dropped unless you pass `{ importNotes: true }`.
|
|
3661
3889
|
*/
|
|
3662
3890
|
importSlide(source: Presentation, index: number, options?: ImportSlideOptions): Slide;
|
|
3891
|
+
/**
|
|
3892
|
+
* Import selected pages from one or more loaded source presentations as one
|
|
3893
|
+
* batch. Each imported page lands at its `outputIndex` in the complete
|
|
3894
|
+
* destination slide list after the batch, and the returned array is parallel
|
|
3895
|
+
* to `requests` — `result[i]` is the page `requests[i]` asked for, whatever
|
|
3896
|
+
* order the output positions were given in.
|
|
3897
|
+
*
|
|
3898
|
+
* Everything is checked before a single byte of this deck moves: every request
|
|
3899
|
+
* names an existing source page, final output positions are unique, each source
|
|
3900
|
+
* has this deck's slide size, and a read-only dry run of the copy proves every
|
|
3901
|
+
* part it would reach is present. A batch therefore either applies in full or
|
|
3902
|
+
* leaves this deck byte-identical, where a per-page loop of
|
|
3903
|
+
* {@link importSlide} can leave a half-stitched deck behind.
|
|
3904
|
+
*
|
|
3905
|
+
* The batch also decides what a `slide → slide` link means: an internal link
|
|
3906
|
+
* on a selected page must target another **selected** page (or one this deck
|
|
3907
|
+
* already contains via an earlier import from that source), and is rewritten
|
|
3908
|
+
* to the fresh partname — importing page 3 of 10 does not drag pages 1–2
|
|
3909
|
+
* across as dependencies, and never strands the link. This mirrors
|
|
3910
|
+
* `appendSlides`' `import/unresolved-slide-link`, which the write side already
|
|
3911
|
+
* enforces for generator decks.
|
|
3912
|
+
*
|
|
3913
|
+
* One request is one output page, so naming the same source page in several
|
|
3914
|
+
* requests is how you ask for several independent copies of it — the page part
|
|
3915
|
+
* is the one thing an import never shares, exactly as in {@link importSlide}.
|
|
3916
|
+
* Everything under it (layout, master, theme, media) is still copied once and
|
|
3917
|
+
* shared. Where such a page is the target of a `slide → slide` link, the link
|
|
3918
|
+
* resolves to one of its copies: pages duplicated together are copied in
|
|
3919
|
+
* lockstep and link to their round-mates, and a link into a page requested only
|
|
3920
|
+
* once always lands on that single copy.
|
|
3921
|
+
*
|
|
3922
|
+
* Speaker notes travel per request: `{ importNotes: true }` carries that page's
|
|
3923
|
+
* `notesSlide` part across, wired to the new page and bound to a single
|
|
3924
|
+
* `notesMaster` under the same 0..1 rule {@link importSlide} and
|
|
3925
|
+
* {@link appendSlides} follow — the destination's own master wins when it has
|
|
3926
|
+
* one. Notes are part of the up-front dry run too, so a batch that would fail
|
|
3927
|
+
* carrying them is refused with the deck still byte-identical. A page named in
|
|
3928
|
+
* several requests gets its own copy of its notes each time, as of everything
|
|
3929
|
+
* else that page owns.
|
|
3930
|
+
*
|
|
3931
|
+
* Scope: pages come across under `'copy'` theme semantics (their own layout →
|
|
3932
|
+
* master → theme subgraph, shared parts deduped via the copy registry).
|
|
3933
|
+
* Embedded fonts are not carried, and sizes must match, since there is no batch
|
|
3934
|
+
* spelling for `embedFonts` or `rescale`. Use {@link importSlide} when you need
|
|
3935
|
+
* either of those.
|
|
3936
|
+
*/
|
|
3937
|
+
importSlides(requests: readonly ImportSlidesRequest[]): Slide[];
|
|
3663
3938
|
/**
|
|
3664
3939
|
* Graft slide master(s) from another open package into this one and return what
|
|
3665
3940
|
* was copied. Unlike {@link importSlide} — which brings a master across only as
|
|
@@ -3724,7 +3999,10 @@ declare class Presentation {
|
|
|
3724
3999
|
*
|
|
3725
4000
|
* Charts and internal slide-to-slide hyperlinks are carried across: chart parts
|
|
3726
4001
|
* (chart XML + `.rels` + embedded workbook) are injected under fresh names, and a
|
|
3727
|
-
* `slide:N` link is repointed at the Nth appended slide's new partname.
|
|
4002
|
+
* `slide:N` link is repointed at the Nth appended slide's new partname. A chartEx
|
|
4003
|
+
* (Office 2016 — waterfall, funnel, treemap, ...) chart carries too, as its own
|
|
4004
|
+
* `chartEx{N}.xml` part behind the MS chartEx rel, with the style and color-style
|
|
4005
|
+
* sidecars PowerPoint requires alongside it.
|
|
3728
4006
|
*
|
|
3729
4007
|
* The generator's presentation-level embedded fonts (`pptx.embedFont`) are also
|
|
3730
4008
|
* carried into this deck and merged into its `p:embeddedFontLst`, de-duped by
|
|
@@ -3787,5 +4065,570 @@ declare class Presentation {
|
|
|
3787
4065
|
save(): Promise<Uint8Array>;
|
|
3788
4066
|
}
|
|
3789
4067
|
//#endregion
|
|
3790
|
-
|
|
3791
|
-
|
|
4068
|
+
//#region src/read/api/presentation-types.d.ts
|
|
4069
|
+
/** Slide dimensions, in both EMU (the OOXML unit) and inches. */
|
|
4070
|
+
interface SlideSize {
|
|
4071
|
+
widthEmu: number;
|
|
4072
|
+
heightEmu: number;
|
|
4073
|
+
widthIn: number;
|
|
4074
|
+
heightIn: number;
|
|
4075
|
+
}
|
|
4076
|
+
/**
|
|
4077
|
+
* One `p:embeddedFont` entry, read from `presentation.xml`'s `p:embeddedFontLst`
|
|
4078
|
+
* (see {@link Presentation.embeddedFonts}). A read-only view: it names the family
|
|
4079
|
+
* and resolves each embedded face's `r:id` to the absolute partname of its binary
|
|
4080
|
+
* `/ppt/fonts/*.fntdata` part, so a consumer can enumerate the embedded faces and
|
|
4081
|
+
* pull their bytes without hand-parsing the presentation part or its rels.
|
|
4082
|
+
*/
|
|
4083
|
+
interface EmbeddedFontInfo {
|
|
4084
|
+
/** `p:font/@typeface` — the family name PowerPoint binds the embed to. */
|
|
4085
|
+
typeface: string;
|
|
4086
|
+
/** `p:font/@panose`, or `null` when the entry declares none. */
|
|
4087
|
+
panose: string | null;
|
|
4088
|
+
/** The embedded faces, in `regular, bold, italic, boldItalic` schema order. */
|
|
4089
|
+
faces: EmbeddedFontFaceInfo[];
|
|
4090
|
+
}
|
|
4091
|
+
/** One face of an {@link EmbeddedFontInfo}: which slot it fills and the part its `r:id` resolves to. */
|
|
4092
|
+
interface EmbeddedFontFaceInfo {
|
|
4093
|
+
/** Which weight/style slot this face fills. */
|
|
4094
|
+
slot: 'regular' | 'bold' | 'italic' | 'boldItalic';
|
|
4095
|
+
/** Absolute partname of the face's binary `.fntdata` part (e.g. `/ppt/fonts/font1.fntdata`). */
|
|
4096
|
+
partName: string;
|
|
4097
|
+
}
|
|
4098
|
+
/** Options for {@link Presentation.importSlide}. */
|
|
4099
|
+
interface ImportSlideOptions {
|
|
4100
|
+
/**
|
|
4101
|
+
* How the imported slide relates to themes.
|
|
4102
|
+
*
|
|
4103
|
+
* - `'copy'` (default): bring the slide's own `slideLayout → slideMaster →
|
|
4104
|
+
* theme` subgraph across, so the slide renders byte-for-byte as authored.
|
|
4105
|
+
* A deck stitched from N sources then carries N themes/masters.
|
|
4106
|
+
* - `'preserve'`: *flatten then attach* — bake the source theme's colours and
|
|
4107
|
+
* style-matrix fills into the slide XML (so its pixels do not change), then
|
|
4108
|
+
* bind it to this deck's existing master/layout instead of importing the
|
|
4109
|
+
* source theme. The result is a single-theme file whose imported slides are
|
|
4110
|
+
* theme-independent: it fixes renderers that mis-resolve per-slide scheme
|
|
4111
|
+
* colours against the wrong (first) theme, and tidies the deck for handoff.
|
|
4112
|
+
*
|
|
4113
|
+
* To stay faithful across the rebind, `preserve` also bakes the inheritance
|
|
4114
|
+
* the rebind would otherwise break explicitly onto the slide: the slide's
|
|
4115
|
+
* effective background; each placeholder's *inherited* geometry (`a:xfrm`
|
|
4116
|
+
* from the matching source layout/master placeholder) so it cannot shift or
|
|
4117
|
+
* clip; and each placeholder run's *inherited* colour and size/weight
|
|
4118
|
+
* (`sz`/`b`/`i`) from the source layout/master text styles. Typeface
|
|
4119
|
+
* (`a:latin`) is left to re-bind to the destination theme, like `fontRef`.
|
|
4120
|
+
* By default it does **not** carry decorative graphics that live on the source
|
|
4121
|
+
* master/layout shape tree (logos, accent shapes): those belong to the
|
|
4122
|
+
* master `preserve` deliberately drops. Set {@link carryMasterGraphics} to
|
|
4123
|
+
* bake them onto the slide instead.
|
|
4124
|
+
* - `'restyle'`: re-brand to *this* deck. Rebind the slide to this deck's
|
|
4125
|
+
* master/layout exactly like `preserve` but **skip the flatten** — leave every
|
|
4126
|
+
* `a:schemeClr`, style-matrix ref (`fillRef`/`lnRef`/`effectRef`/`fontRef`),
|
|
4127
|
+
* and `p:bg` `bgRef` symbolic so they re-resolve against the *destination*
|
|
4128
|
+
* theme. The slide keeps its geometry, text, and structure but adopts this
|
|
4129
|
+
* deck's colours/fonts: `preserve` makes it "look the same everywhere",
|
|
4130
|
+
* `restyle` makes it "look like mine". The slide's own `p:clrMapOvr` is dropped
|
|
4131
|
+
* so the destination master's `clrMap` governs the re-brand.
|
|
4132
|
+
*
|
|
4133
|
+
* **Load-bearing limitation:** `restyle` can only recolour what is *symbolic*.
|
|
4134
|
+
* Anything the source authored as a literal `a:srgbClr` has no theme reference
|
|
4135
|
+
* to re-resolve and stays exactly that colour, so a slide with a baked literal
|
|
4136
|
+
* palette re-brands little or nothing. Use `restyle` for slides built against
|
|
4137
|
+
* theme colours/style matrices, not hardcoded RGB — or set {@link remapLiterals}
|
|
4138
|
+
* to force-remap literals and copy table styles. Re-brand is inherently a
|
|
4139
|
+
* visual change (a source `accent1` light-on-dark can invert against a dark
|
|
4140
|
+
* destination `accent1`), so its output needs visual QA. A restyled table
|
|
4141
|
+
* resolves its `@tableStyleId` against the *destination* `tableStyles`; if the
|
|
4142
|
+
* destination lacks that id the table falls back (which {@link remapLiterals}
|
|
4143
|
+
* also addresses by copying the source style across).
|
|
4144
|
+
*/
|
|
4145
|
+
theme?: 'copy' | 'preserve' | 'restyle';
|
|
4146
|
+
/**
|
|
4147
|
+
* `restyle` mode only. Push the re-brand past what symbolic references reach, for
|
|
4148
|
+
* slides whose palette is partly hardcoded. When `true` it does two things the
|
|
4149
|
+
* plain re-brand cannot:
|
|
4150
|
+
*
|
|
4151
|
+
* - **Literal colours** — every literal `a:srgbClr` equal to a *source*-theme
|
|
4152
|
+
* `clrScheme` slot is rewritten back to a symbolic `a:schemeClr` (routed through
|
|
4153
|
+
* the source `clrMap`), so it re-resolves against this deck's theme instead of
|
|
4154
|
+
* staying its authored RGB. A literal matching no source slot is left untouched.
|
|
4155
|
+
* - **Table styles** — any `@tableStyleId` the slide references is copied from the
|
|
4156
|
+
* source `tableStyles.xml` into this deck's (same id, idempotent, leaving an id
|
|
4157
|
+
* the destination already defines alone), so a restyled table keeps its style
|
|
4158
|
+
* instead of falling back. The copied definition is itself symbolic, so it
|
|
4159
|
+
* re-brands to this deck's theme.
|
|
4160
|
+
*
|
|
4161
|
+
* Off by default: it deliberately reinterprets authored literals as theme colours,
|
|
4162
|
+
* which is a visual change that needs QA. Ignored unless `theme` is `'restyle'`.
|
|
4163
|
+
*/
|
|
4164
|
+
remapLiterals?: boolean;
|
|
4165
|
+
/**
|
|
4166
|
+
* `preserve`/`restyle` modes only. When `true`, bake the source
|
|
4167
|
+
* `slideLayout`/`slideMaster` shape-tree decorations (everything on those shape
|
|
4168
|
+
* trees *except* placeholders — logos, accent curves, footers drawn as shapes)
|
|
4169
|
+
* onto the imported slide, behind its own content, so master/layout branding
|
|
4170
|
+
* survives the rebind to this deck's master. Their media are copied across.
|
|
4171
|
+
*
|
|
4172
|
+
* Under `preserve` the carried decorations' theme references are flattened like
|
|
4173
|
+
* the slide's own content; under `restyle` they are left symbolic and so
|
|
4174
|
+
* re-brand to the destination palette along with the slide — note a carried
|
|
4175
|
+
* source logo could recolour unexpectedly under a different palette.
|
|
4176
|
+
*
|
|
4177
|
+
* Off by default: it raises fidelity for cover/closer/divider slides at the
|
|
4178
|
+
* cost of duplicating shapes that would otherwise live once on the shared
|
|
4179
|
+
* master, so opt in only when that branding actually needs to travel with the
|
|
4180
|
+
* slide. Ignored unless `theme` is `'preserve'` or `'restyle'`.
|
|
4181
|
+
*/
|
|
4182
|
+
carryMasterGraphics?: boolean;
|
|
4183
|
+
/**
|
|
4184
|
+
* Zero-based insert position in `p:sldIdLst` (deck order). `0` makes the
|
|
4185
|
+
* imported slide first; an `at` past the current slide count — or omitting it —
|
|
4186
|
+
* appends. Use it to place brand bookends (cover at `0`, closer appended)
|
|
4187
|
+
* around generator-authored interior slides regardless of import order.
|
|
4188
|
+
*/
|
|
4189
|
+
at?: number;
|
|
4190
|
+
/**
|
|
4191
|
+
* Carry the *source deck's* embedded fonts (`p:embeddedFontLst` in its
|
|
4192
|
+
* `presentation.xml`) into this deck, so an imported slide that renders with an
|
|
4193
|
+
* embedded face keeps it on machines that lack the font. Off by default —
|
|
4194
|
+
* fonts live on the presentation, not the slide, so they are only worth copying
|
|
4195
|
+
* when you want the embed to travel.
|
|
4196
|
+
*
|
|
4197
|
+
* The font binary parts are copied under fresh `/ppt/fonts/` names (deduped via
|
|
4198
|
+
* the per-source copy registry, so repeated imports copy each face once), the
|
|
4199
|
+
* `application/x-fontdata` Default is added, and entries are merged into this
|
|
4200
|
+
* deck's `p:embeddedFontLst` — de-duplicated by `typeface` + face slot, so a
|
|
4201
|
+
* face this deck already embeds is reused rather than duplicated. The carry is a
|
|
4202
|
+
* whole-deck operation (it copies *all* the source's embedded fonts, not just the
|
|
4203
|
+
* faces this one slide uses), since the source list does not record which slide
|
|
4204
|
+
* uses which face.
|
|
4205
|
+
* @default false
|
|
4206
|
+
*/
|
|
4207
|
+
embedFonts?: boolean;
|
|
4208
|
+
/**
|
|
4209
|
+
* What to do when the source slide size differs from this deck's. By default
|
|
4210
|
+
* (`false`) `importSlide` throws on any mismatch. Set it to rescale the imported
|
|
4211
|
+
* geometry onto this deck's canvas instead:
|
|
4212
|
+
*
|
|
4213
|
+
* - `'fit'` (or `true`): uniform scale by `min(sx, sy)` then center, so aspect
|
|
4214
|
+
* ratio is preserved (circles stay circles, rotations hold) and the slack on
|
|
4215
|
+
* the longer axis becomes a centered margin. Matches PowerPoint's "Ensure Fit".
|
|
4216
|
+
* - `'stretch'`: independent per-axis scale so the content fills the canvas;
|
|
4217
|
+
* distorts shapes and cannot faithfully reposition rotated shapes. Matches
|
|
4218
|
+
* "Maximize".
|
|
4219
|
+
*
|
|
4220
|
+
* Only *geometry* is rescaled — every top-level shape/group/graphicFrame
|
|
4221
|
+
* transform (`a:off`/`a:ext`) and table grid (`a:gridCol@w`, `a:tr@h`). Font
|
|
4222
|
+
* sizes, line widths, and other absolute sizes are left as authored, so heavy
|
|
4223
|
+
* down-scaling can leave text overflowing its (now smaller) box. In `copy` mode
|
|
4224
|
+
* the imported layout and master shape trees are rescaled too, so inherited
|
|
4225
|
+
* placeholder and background geometry stays aligned; in `preserve`/`restyle` the
|
|
4226
|
+
* slide rebinds to this deck's master/layout (already the right size), so only
|
|
4227
|
+
* the slide is touched.
|
|
4228
|
+
* @default false
|
|
4229
|
+
*/
|
|
4230
|
+
rescale?: boolean | 'fit' | 'stretch';
|
|
4231
|
+
/**
|
|
4232
|
+
* Carry the source slide's speaker notes across. By default (`false`) the
|
|
4233
|
+
* `notesSlide` relationship is dropped, so the imported slide has no notes.
|
|
4234
|
+
*
|
|
4235
|
+
* When set, the source `notesSlide` is copied and wired to the imported slide.
|
|
4236
|
+
* Its `slide` back-relationship is repointed at the new slide (the source slide
|
|
4237
|
+
* is *not* copied). A presentation has at most one `notesMaster`: if this deck
|
|
4238
|
+
* already has one, the imported notes reuse it (the source notesMaster and its
|
|
4239
|
+
* theme are not copied); if it has none, the source notesMaster (and its theme)
|
|
4240
|
+
* are copied and registered. The destination's notes styling therefore wins
|
|
4241
|
+
* when both decks define one.
|
|
4242
|
+
* @default false
|
|
4243
|
+
*/
|
|
4244
|
+
importNotes?: boolean;
|
|
4245
|
+
}
|
|
4246
|
+
/** Options for {@link Presentation.importShape} / {@link Presentation.importShapes}. */
|
|
4247
|
+
interface ImportShapeOptions {
|
|
4248
|
+
/**
|
|
4249
|
+
* How the lifted shape relates to themes, mirroring {@link ImportSlideOptions}
|
|
4250
|
+
* but scoped to one shape subtree:
|
|
4251
|
+
*
|
|
4252
|
+
* - `'preserve'` (default): bake the shape's scheme/style-matrix colours (and,
|
|
4253
|
+
* for a lifted placeholder, its inherited geometry/colour/size/anchor/list
|
|
4254
|
+
* style) to literals using the *source* slide's theme, so it keeps its look on
|
|
4255
|
+
* a host slide whose theme differs. A lifted placeholder is also *demoted* to a
|
|
4256
|
+
* plain shape (its `p:ph` stripped) once everything it inherited is baked, so it
|
|
4257
|
+
* neither re-resolves against the host's placeholder of the same type/idx nor
|
|
4258
|
+
* collides with it. The safe default for composing across decks.
|
|
4259
|
+
* - `'restyle'`: leave the shape's theme references symbolic so it re-brands to
|
|
4260
|
+
* the host theme. Only *symbolic* colours re-brand — literal `a:srgbClr` the
|
|
4261
|
+
* source baked in stays put (same limitation as `importSlide` restyle).
|
|
4262
|
+
* - `'copy'`: bring the shape's XML across untouched; only sane when the host
|
|
4263
|
+
* already shares the source theme.
|
|
4264
|
+
*
|
|
4265
|
+
* Unlike a slide import this never runs the slide-scoped background passes — a
|
|
4266
|
+
* background belongs to a slide, not to a composed shape.
|
|
4267
|
+
*/
|
|
4268
|
+
theme?: 'preserve' | 'restyle' | 'copy';
|
|
4269
|
+
/** Override left edge (EMU). Omitted axes keep the shape's source `a:off`/`a:ext`. */
|
|
4270
|
+
left?: number;
|
|
4271
|
+
/** Override top edge (EMU). */
|
|
4272
|
+
top?: number;
|
|
4273
|
+
/** Override width (EMU); must be positive. */
|
|
4274
|
+
width?: number;
|
|
4275
|
+
/** Override height (EMU); must be positive. */
|
|
4276
|
+
height?: number;
|
|
4277
|
+
/**
|
|
4278
|
+
* Insert position among the host shape tree's shape children (z-order, 0 =
|
|
4279
|
+
* backmost). Out-of-range or omitted appends on top. A batch inserts in the
|
|
4280
|
+
* given order starting at this position.
|
|
4281
|
+
*/
|
|
4282
|
+
at?: number;
|
|
4283
|
+
/**
|
|
4284
|
+
* What to do when the source slide size differs from this deck's. Default
|
|
4285
|
+
* (`false`/omitted) throws on any mismatch. Set it to rescale the lifted
|
|
4286
|
+
* shape's geometry onto this deck's canvas instead (mirrors
|
|
4287
|
+
* {@link ImportSlideOptions.rescale}, scoped to one shape):
|
|
4288
|
+
*
|
|
4289
|
+
* - `'fit'` (or `true`): uniform scale by `min(sx, sy)`, slack centered — the
|
|
4290
|
+
* shape keeps its aspect ratio (circles stay circles, rotations hold) and
|
|
4291
|
+
* lands at the position it would occupy on a centered copy of the source
|
|
4292
|
+
* canvas. Matches PowerPoint's "Ensure Fit".
|
|
4293
|
+
* - `'stretch'`: independent per-axis scale; distorts. Matches "Maximize".
|
|
4294
|
+
*
|
|
4295
|
+
* Only *geometry* is rescaled — the shape/group/graphicFrame transform
|
|
4296
|
+
* (`a:off`/`a:ext`) and any table grid (`a:gridCol@w`, `a:tr@h`). Font sizes,
|
|
4297
|
+
* line widths, and other absolute sizes are left as authored, so heavy
|
|
4298
|
+
* down-scaling can leave text overflowing its (now smaller) box. Explicit
|
|
4299
|
+
* `left`/`top`/`width`/`height` overrides are applied *after* rescale and win.
|
|
4300
|
+
* @default false
|
|
4301
|
+
*/
|
|
4302
|
+
rescale?: boolean | 'fit' | 'stretch';
|
|
4303
|
+
/**
|
|
4304
|
+
* Carry the lifted shape's build animation across (default `false`). A shape's
|
|
4305
|
+
* entrance/emphasis/exit build lives in the slide-scoped `p:timing`, not in the
|
|
4306
|
+
* shape subtree, so it is dropped unless opted in. When set, the shape's effect
|
|
4307
|
+
* click-group(s) and `<p:bldP>` are copied into the destination `p:timing`
|
|
4308
|
+
* (created if absent), their `spid` references remapped to the shape's new id and
|
|
4309
|
+
* their `<p:cTn>` ids renumbered to stay collision-free, and appended after any
|
|
4310
|
+
* existing build — mirroring how PowerPoint merges a pasted shape's animation
|
|
4311
|
+
* (see the `import-animation-merge` oracle). @default false
|
|
4312
|
+
*/
|
|
4313
|
+
carryAnimation?: boolean;
|
|
4314
|
+
}
|
|
4315
|
+
/** A master brought across by {@link Presentation.importSlideMasters}. */
|
|
4316
|
+
interface ImportedSlideMaster {
|
|
4317
|
+
/** Partname of the copied master in this (destination) package. */
|
|
4318
|
+
partName: string;
|
|
4319
|
+
/** Partnames of the layouts copied under it, in source `p:sldLayoutIdLst` order. */
|
|
4320
|
+
layoutPartNames: string[];
|
|
4321
|
+
}
|
|
4322
|
+
/** Options for {@link Presentation.importSlideMasters}. */
|
|
4323
|
+
interface ImportSlideMastersOptions {
|
|
4324
|
+
/**
|
|
4325
|
+
* Pick which of the source's masters to graft. Receives the master's `p:cSld`
|
|
4326
|
+
* `name` (`''` when unnamed) and its zero-based index in the source's
|
|
4327
|
+
* `p:sldMasterIdLst`. Default: every master.
|
|
4328
|
+
*/
|
|
4329
|
+
masters?: (name: string, index: number) => boolean;
|
|
4330
|
+
/**
|
|
4331
|
+
* Pick which layouts under each grafted master to bring. Receives the layout's
|
|
4332
|
+
* `p:cSld` `name` and its zero-based index within that master's
|
|
4333
|
+
* `p:sldLayoutIdLst`. Default: the whole family.
|
|
4334
|
+
*/
|
|
4335
|
+
layouts?: (name: string, index: number) => boolean;
|
|
4336
|
+
/**
|
|
4337
|
+
* Require the source and destination slide sizes to match (default `true`).
|
|
4338
|
+
* A grafted master is shipped into the layout gallery, not applied to existing
|
|
4339
|
+
* slides — but a layout authored at a different canvas size shows up mis-scaled
|
|
4340
|
+
* in that gallery, so the guard is on by default. Pass `false` to graft anyway.
|
|
4341
|
+
*/
|
|
4342
|
+
requireEqualSize?: boolean;
|
|
4343
|
+
/**
|
|
4344
|
+
* Carry the *source deck's* embedded fonts (`p:embeddedFontLst` in its
|
|
4345
|
+
* `presentation.xml`) into this deck, so a slide later bound to a grafted layout
|
|
4346
|
+
* keeps that layout's embedded faces on machines that lack the font locally.
|
|
4347
|
+
* Off by default — fonts live on the presentation, not the master, and copying
|
|
4348
|
+
* them can add megabytes — so they are only worth carrying when you want the
|
|
4349
|
+
* embed to travel with the gallery.
|
|
4350
|
+
*
|
|
4351
|
+
* Semantics are identical to {@link ImportSlideOptions.embedFonts}: binaries are
|
|
4352
|
+
* copied under fresh `/ppt/fonts/` names (deduped via the per-source copy
|
|
4353
|
+
* registry, so a re-call carries each face once), the `application/x-fontdata`
|
|
4354
|
+
* Default is added, and entries merge into this deck's `p:embeddedFontLst`
|
|
4355
|
+
* de-duplicated by `typeface` + face slot. The carry is a whole-deck operation —
|
|
4356
|
+
* it copies *all* the source's embedded fonts, not only the faces the grafted
|
|
4357
|
+
* masters use, since the source list does not record which face belongs to which
|
|
4358
|
+
* master.
|
|
4359
|
+
* @default false
|
|
4360
|
+
*/
|
|
4361
|
+
embedFonts?: boolean;
|
|
4362
|
+
/**
|
|
4363
|
+
* Carry the *source deck's* table styles (`ppt/tableStyles.xml`) into this deck,
|
|
4364
|
+
* so a table inserted on a grafted layout picks up the source's table styling
|
|
4365
|
+
* instead of this deck's. Off by default: it rewrites an existing part rather than
|
|
4366
|
+
* only adding new ones, so it is opt-in like {@link embedFonts}.
|
|
4367
|
+
*
|
|
4368
|
+
* Without it a grafted master's layouts arrive but its table styling does not, and
|
|
4369
|
+
* a new table falls back to whatever default this deck carries — for a generated
|
|
4370
|
+
* deck, a stub whose default is the standard *Medium Style 2 - Accent 1*. The
|
|
4371
|
+
* mismatch is visible: the same table renders in a different accent than it would
|
|
4372
|
+
* in the source deck.
|
|
4373
|
+
*
|
|
4374
|
+
* Styles union by `styleId` (a style this deck already defines wins, so a re-call
|
|
4375
|
+
* is idempotent), while `a:tblStyleLst@def` — the default table style — is
|
|
4376
|
+
* **source-wins**. Carrying the styles without the `def` would not fix the
|
|
4377
|
+
* mismatch: the standard default GUID is one most templates *also* define, so the
|
|
4378
|
+
* default would still resolve to the wrong style. The carry is whole-deck — it
|
|
4379
|
+
* copies *all* the source's table styles, not only those the grafted masters use,
|
|
4380
|
+
* since `tableStyles.xml` does not record which style belongs to which master.
|
|
4381
|
+
* @default false
|
|
4382
|
+
*/
|
|
4383
|
+
tableStyles?: boolean;
|
|
4384
|
+
/**
|
|
4385
|
+
* Move the grafted masters to the front of `p:sldMasterIdLst`, ahead of the ones
|
|
4386
|
+
* this deck already had, keeping their import order. Off by default: which master
|
|
4387
|
+
* leads is a statement about what the deck *is*, so it is the caller's call rather
|
|
4388
|
+
* than a side effect of grafting.
|
|
4389
|
+
*
|
|
4390
|
+
* `p:sldMasterIdLst` order is not part of theme resolution — a slide resolves
|
|
4391
|
+
* through its own layout's master, so this changes no existing slide's appearance.
|
|
4392
|
+
* What it changes is the deck's identity in PowerPoint's UI: the list's first entry
|
|
4393
|
+
* becomes `Designs(1)`, which is the theme the Design tab shows and the one
|
|
4394
|
+
* Design ▸ Variants applies. Graft a brand master into a generated deck without
|
|
4395
|
+
* this and the deck still presents as the generator's stock theme, because the
|
|
4396
|
+
* stub master was there first.
|
|
4397
|
+
*
|
|
4398
|
+
* Reordering rewrites nothing but the list: relationships, ids, and every part
|
|
4399
|
+
* outside `presentation.xml` are untouched, and a re-call is a no-op once the
|
|
4400
|
+
* grafted masters already lead.
|
|
4401
|
+
* @default false
|
|
4402
|
+
*/
|
|
4403
|
+
primary?: boolean;
|
|
4404
|
+
}
|
|
4405
|
+
/** A layout in this deck's gallery, addressable as an {@link AppendSlidesOptions} target. */
|
|
4406
|
+
interface LayoutHandle {
|
|
4407
|
+
/** Partname of the layout in this package (e.g. `/ppt/slideLayouts/slideLayout2.xml`). */
|
|
4408
|
+
partName: string;
|
|
4409
|
+
/** The layout's `p:cSld@name` (`''` when unnamed). */
|
|
4410
|
+
name: string;
|
|
4411
|
+
/** Partname of the master this layout belongs to. */
|
|
4412
|
+
masterPartName: string;
|
|
4413
|
+
/** Zero-based index of the master in `p:sldMasterIdLst`. */
|
|
4414
|
+
masterIndex: number;
|
|
4415
|
+
/** Zero-based index of the layout within its master's `p:sldLayoutIdLst`. */
|
|
4416
|
+
layoutIndex: number;
|
|
4417
|
+
}
|
|
4418
|
+
/**
|
|
4419
|
+
* One authored slide, extracted from a generator for injection into an existing
|
|
4420
|
+
* package. The slide body XML references its media/hyperlinks by relationship id
|
|
4421
|
+
* only, so {@link Presentation.appendSlides} preserves each `rId` and only
|
|
4422
|
+
* repoints its target — see {@link SlideSource}.
|
|
4423
|
+
*/
|
|
4424
|
+
interface ExtractedSlide {
|
|
4425
|
+
/** Standalone `<p:sld>` part body (XML declaration + namespaces included). */
|
|
4426
|
+
xml: string;
|
|
4427
|
+
/** Image media the body references, keyed by the `rId` used in {@link xml}. */
|
|
4428
|
+
media: Array<{
|
|
4429
|
+
rId: number;
|
|
4430
|
+
bytes: Uint8Array;
|
|
4431
|
+
extn: string;
|
|
4432
|
+
contentType: string;
|
|
4433
|
+
}>;
|
|
4434
|
+
/** External hyperlink rels, keyed by the `rId` used in {@link xml}. */
|
|
4435
|
+
hyperlinks: Array<{
|
|
4436
|
+
rId: number;
|
|
4437
|
+
target: string;
|
|
4438
|
+
}>;
|
|
4439
|
+
/**
|
|
4440
|
+
* Charts the body references, keyed by the `rId` used in {@link xml}. Each carries
|
|
4441
|
+
* the chart part XML and its embedded workbook bytes; the chart part's own `.rels`
|
|
4442
|
+
* (workbook reference) is rebuilt by {@link Presentation.appendSlides}.
|
|
4443
|
+
*/
|
|
4444
|
+
charts: ExtractedChart[];
|
|
4445
|
+
/** Internal slide-to-slide links: the `rId` used in {@link xml} → 1-based source slide number. */
|
|
4446
|
+
slideLinks: Array<{
|
|
4447
|
+
rId: number;
|
|
4448
|
+
sourceSlideNumber: number;
|
|
4449
|
+
}>;
|
|
4450
|
+
/**
|
|
4451
|
+
* Embedded audio/video the body references. Each item is one media binary backed
|
|
4452
|
+
* by two rels sharing a Target — the ECMA `audio`/`video` rel (`mediaRid`) and the
|
|
4453
|
+
* MS-2007 `media` rel (`msMediaRid`) — plus a separate preview image rel
|
|
4454
|
+
* (`previewRid`). {@link Presentation.appendSlides} reproduces this rel graph.
|
|
4455
|
+
*/
|
|
4456
|
+
avMedia: AvMediaItem[];
|
|
4457
|
+
/**
|
|
4458
|
+
* Online (external-link) video the body references. Each item is two *external*
|
|
4459
|
+
* rels sharing one link Target — the ECMA `video` rel (`mediaRid`) and the MS-2007
|
|
4460
|
+
* `media` rel (`msMediaRid`) — with **no** media binary part. The poster frame is a
|
|
4461
|
+
* normal image rel carried by {@link media}. {@link Presentation.appendSlides}
|
|
4462
|
+
* wires the two external rels without reserving a media part or content type.
|
|
4463
|
+
*/
|
|
4464
|
+
onlineMedia: OnlineMediaItem[];
|
|
4465
|
+
/**
|
|
4466
|
+
* The slide's speaker notes, or `undefined` when it has none. Carried as a ready
|
|
4467
|
+
* `<p:notes>` part body plus its external hyperlink rels;
|
|
4468
|
+
* {@link Presentation.appendSlides} creates the notes part, wires it to the appended
|
|
4469
|
+
* slide, and binds it to a notes master (see {@link ExtractedSlides.notesMaster}).
|
|
4470
|
+
*/
|
|
4471
|
+
notes?: ExtractedNotes;
|
|
4472
|
+
}
|
|
4473
|
+
/** One slide's speaker notes, extracted for {@link Presentation.appendSlides}. */
|
|
4474
|
+
interface ExtractedNotes {
|
|
4475
|
+
/** Standalone `<p:notes>` part body (XML declaration + namespaces included). */
|
|
4476
|
+
xml: string;
|
|
4477
|
+
/**
|
|
4478
|
+
* External hyperlink rels the notes body references, keyed by the `rId` used in
|
|
4479
|
+
* {@link xml}. Notes rels reserve `rId1` for the notes master and `rId2` for the
|
|
4480
|
+
* slide, so these start at `rId3`. Notes support external `url` links only.
|
|
4481
|
+
*/
|
|
4482
|
+
hyperlinks: Array<{
|
|
4483
|
+
rId: number;
|
|
4484
|
+
target: string;
|
|
4485
|
+
}>;
|
|
4486
|
+
}
|
|
4487
|
+
/**
|
|
4488
|
+
* One chart extracted for {@link Presentation.appendSlides}, keyed by the `rId` the slide
|
|
4489
|
+
* body uses to reference it.
|
|
4490
|
+
*
|
|
4491
|
+
* A classic (2007, `c:chartSpace`) chart is one part plus its embedded workbook. A chartEx
|
|
4492
|
+
* (Office 2016 — waterfall, funnel, treemap, ...) chart is a different part in a different
|
|
4493
|
+
* namespace, reached through a different relationship type, and PowerPoint reports it as
|
|
4494
|
+
* corrupt without its two style sidecars — so {@link chartEx} carries them and its presence
|
|
4495
|
+
* is what tells the two shapes apart.
|
|
4496
|
+
*/
|
|
4497
|
+
interface ExtractedChart {
|
|
4498
|
+
/** Body `rId` of the slide's rel pointing at the chart part. */
|
|
4499
|
+
rId: number;
|
|
4500
|
+
/** The chart part body: `<c:chartSpace>` for a classic chart, `<cx:chartSpace>` for a chartEx one. */
|
|
4501
|
+
chartXml: string;
|
|
4502
|
+
/** The chart's embedded `.xlsx` workbook, the data source PowerPoint opens on edit. */
|
|
4503
|
+
embeddingBytes: Uint8Array;
|
|
4504
|
+
/**
|
|
4505
|
+
* Present only for a chartEx chart, and then always with both sidecars. A chartEx part
|
|
4506
|
+
* *requires* a chart-style and a color-style part or PowerPoint reports the deck as
|
|
4507
|
+
* corrupt (`0x80070570`) — schema-valid but unopenable — so these are not optional and
|
|
4508
|
+
* {@link Presentation.appendSlides} injects them alongside the chart part.
|
|
4509
|
+
*/
|
|
4510
|
+
chartEx?: {
|
|
4511
|
+
/** `cs:chartStyle` body for the chart's `style{N}.xml` part. */
|
|
4512
|
+
styleXml: string;
|
|
4513
|
+
/** `cs:colorStyle` body for the chart's `colors{N}.xml` part. */
|
|
4514
|
+
colorsXml: string;
|
|
4515
|
+
};
|
|
4516
|
+
}
|
|
4517
|
+
/** One embedded audio/video item extracted for {@link Presentation.appendSlides}. */
|
|
4518
|
+
interface AvMediaItem {
|
|
4519
|
+
/** Whether the item is `audio` (`<a:audioFile>`) or `video` (`<a:videoFile>`). */
|
|
4520
|
+
mtype: 'audio' | 'video';
|
|
4521
|
+
/** Body `rId` of the ECMA `audio`/`video` rel (`r:link`); points at the media part. */
|
|
4522
|
+
mediaRid: number;
|
|
4523
|
+
/** Body `rId` of the MS-2007 `media` rel (`p14:media r:embed`); shares the media part Target. */
|
|
4524
|
+
msMediaRid: number;
|
|
4525
|
+
/** Body `rId` of the preview image rel (`a:blip r:embed` in the blipFill). */
|
|
4526
|
+
previewRid: number;
|
|
4527
|
+
/** The audio/video binary the media part will hold. */
|
|
4528
|
+
mediaBytes: Uint8Array;
|
|
4529
|
+
/** Media file extension (no dot), e.g. `mp4`, `mp3`. */
|
|
4530
|
+
mediaExtn: string;
|
|
4531
|
+
/** OPC content type for the media part (PowerPoint-authored, e.g. `audio/mpeg`). */
|
|
4532
|
+
mediaContentType: string;
|
|
4533
|
+
/** The preview/poster image bytes. */
|
|
4534
|
+
previewBytes: Uint8Array;
|
|
4535
|
+
/** Preview image extension (no dot), e.g. `png`. */
|
|
4536
|
+
previewExtn: string;
|
|
4537
|
+
/** OPC content type for the preview image part. */
|
|
4538
|
+
previewContentType: string;
|
|
4539
|
+
}
|
|
4540
|
+
/** One online (external-link) video item extracted for {@link Presentation.appendSlides}. */
|
|
4541
|
+
interface OnlineMediaItem {
|
|
4542
|
+
/** Body `rId` of the ECMA `video` rel (`a:videoFile r:link`); External, no part. */
|
|
4543
|
+
mediaRid: number;
|
|
4544
|
+
/** Body `rId` of the MS-2007 `media` rel (`p14:media r:link`); External, shares the link Target. */
|
|
4545
|
+
msMediaRid: number;
|
|
4546
|
+
/** The external video link both rels point at (`TargetMode="External"`). */
|
|
4547
|
+
link: string;
|
|
4548
|
+
}
|
|
4549
|
+
/** A generator's authored slides + canvas size, the input to {@link Presentation.appendSlides}. */
|
|
4550
|
+
interface ExtractedSlides {
|
|
4551
|
+
widthEmu: number;
|
|
4552
|
+
heightEmu: number;
|
|
4553
|
+
slides: ExtractedSlide[];
|
|
4554
|
+
/**
|
|
4555
|
+
* The generator's presentation-level embedded font faces (`pptx.embedFont`),
|
|
4556
|
+
* carried into the destination deck by {@link Presentation.appendSlides}. Each
|
|
4557
|
+
* face carries its raw `bytes`. Empty when the generator embeds no fonts.
|
|
4558
|
+
*/
|
|
4559
|
+
embeddedFonts: EmbeddedFont[];
|
|
4560
|
+
/**
|
|
4561
|
+
* A notes master to fall back on, present only when at least one slide carries notes.
|
|
4562
|
+
*
|
|
4563
|
+
* A notes slide must bind to a notes master, and a destination template often has
|
|
4564
|
+
* none — a deck authored without speaker notes carries no `notesMaster` part. So the
|
|
4565
|
+
* generator's own notes master rides along, and {@link Presentation.appendSlides}
|
|
4566
|
+
* installs it (with its theme) **only** when the destination has none. When the
|
|
4567
|
+
* destination already has one, it wins and this is discarded — matching the
|
|
4568
|
+
* `importNotes` policy, where the destination's notes styling also wins.
|
|
4569
|
+
*/
|
|
4570
|
+
notesMaster?: {
|
|
4571
|
+
xml: string;
|
|
4572
|
+
themeXml: string;
|
|
4573
|
+
};
|
|
4574
|
+
}
|
|
4575
|
+
/**
|
|
4576
|
+
* Structural view of a slide producer (a `TsPptx` instance satisfies this).
|
|
4577
|
+
* Kept structural so the read subsystem never imports the generator at runtime.
|
|
4578
|
+
*/
|
|
4579
|
+
interface SlideSource {
|
|
4580
|
+
extractSlides(opts?: {
|
|
4581
|
+
onMediaError?: 'throw' | 'placeholder';
|
|
4582
|
+
}): Promise<ExtractedSlides>;
|
|
4583
|
+
}
|
|
4584
|
+
/** Options for {@link Presentation.appendSlides}. */
|
|
4585
|
+
interface AppendSlidesOptions {
|
|
4586
|
+
/** Target layout to bind every appended slide to: by `p:cSld@name` or a {@link LayoutHandle}. */
|
|
4587
|
+
layout: string | LayoutHandle;
|
|
4588
|
+
/**
|
|
4589
|
+
* Zero-based `p:sldIdLst` position for the first appended slide; subsequent
|
|
4590
|
+
* slides follow it in order. Omitted/out-of-range appends at the end.
|
|
4591
|
+
*/
|
|
4592
|
+
at?: number;
|
|
4593
|
+
/** How `addImage` media errors surface during extraction (default `'throw'`). */
|
|
4594
|
+
onMediaError?: 'throw' | 'placeholder';
|
|
4595
|
+
}
|
|
4596
|
+
/** One selected native source page and its final zero-based destination position. */
|
|
4597
|
+
interface ImportSlidesRequest {
|
|
4598
|
+
/** Already-loaded source presentation whose immutable package bytes own the page. */
|
|
4599
|
+
source: Presentation;
|
|
4600
|
+
/**
|
|
4601
|
+
* Zero-based source slide index. Naming one source page in several requests is
|
|
4602
|
+
* how a batch asks for several independent copies of it.
|
|
4603
|
+
*/
|
|
4604
|
+
sourceIndex: number;
|
|
4605
|
+
/** Zero-based position in the complete destination slide list after this batch. */
|
|
4606
|
+
outputIndex: number;
|
|
4607
|
+
/**
|
|
4608
|
+
* Carry this page's speaker notes (`notesSlideN.xml`) across, as
|
|
4609
|
+
* `importSlide`'s {@link ImportSlideOptions.importNotes} does. Default false:
|
|
4610
|
+
* the slide copy drops the `notesSlide` relationship, so the imported page
|
|
4611
|
+
* arrives without notes.
|
|
4612
|
+
*
|
|
4613
|
+
* Per request rather than per batch because a stitch mixes sources — the
|
|
4614
|
+
* notes of a library's cover page are worth carrying where a scratch deck's
|
|
4615
|
+
* are not. The deck-wide half of the policy is not per request: a
|
|
4616
|
+
* presentation holds at most one `notesMaster`, so the destination's own is
|
|
4617
|
+
* reused when it has one and the first carried master is installed when it
|
|
4618
|
+
* has none, exactly as `importSlide` and `appendSlides` do.
|
|
4619
|
+
*/
|
|
4620
|
+
importNotes?: boolean;
|
|
4621
|
+
}
|
|
4622
|
+
/** Options for {@link Presentation.fromTemplate}. */
|
|
4623
|
+
interface FromTemplateOptions {
|
|
4624
|
+
/**
|
|
4625
|
+
* Keep a `.potx` main part's `…template.main+xml` content type instead of
|
|
4626
|
+
* normalizing it to the editable `…presentation.main+xml` type. Off by default
|
|
4627
|
+
* (the saved package opens as an editable deck, not a template). No effect on a
|
|
4628
|
+
* `.pptx` input, whose main part is already editable.
|
|
4629
|
+
*/
|
|
4630
|
+
keepTemplateContentType?: boolean;
|
|
4631
|
+
}
|
|
4632
|
+
//#endregion
|
|
4633
|
+
export { CellThreeD as $, ShapeType as $t, Theme as A, AutofitMode as At, ModernCommentAuthor as B, ChildFrame as Bt, TransitionInfo as C, ChartLine as Ct, Placeholder as D, AutoShape as Dt, ColorMapToken as E, Picture as Et, readTagsForPart as F, Paragraph as Ft, isAutoShape as G, Glow as Gt, NotesSlide as H, CustomGeometry as Ht, Comment as I, Run as It, isGroupShape as J, LineEnds as Jt, isConnector as K, InnerShadow as Kt, CommentAuthor as L, RunHyperlink as Lt, ThemeFontFace as M, BulletDetail as Mt, ThemeFontScheme as N, BulletStyle as Nt, SlideLayout as O, Shape as Ot, Tag as P, LineSpacing as Pt, CellBorders as Q, Reflection as Qt, CommentSchema as R, TextFrame as Rt, Slide as S, ChartLegend as St, TransitionSpeed as T, Connector as Tt, AnyShape as U, CustomGeometryPath as Ut, NotesPlaceholder as V, ConnectionSite as Vt, GroupShape as W, GeometryCommand as Wt, GraphicFrame as X, Recolor as Xt, isPicture as Y, OuterShadow as Yt, CellBorder as Z, RecolorColor as Zt, CustomProperty as _, AxisNumberFormat as _t, ExtractedSlides as a, FillRect as an, TableConditionFlags as at, AddPictureOptions as b, ChartDataLabels as bt, ImportSlideMastersOptions as c, GradientFill as cn, DiagramConnection as ct, ImportedSlideMaster as d, resolveColorElement as dn, DiagramPointType as dt, SoftEdge as en, Table as et, LayoutHandle as f, ColorContext as fn, ChartEx as ft, CoreProperties as g, ChartExSeries as gt, Presentation as h, ChartExLegend as ht, ExtractedSlide as i, SlideBackground as in, ResolvedTableStyle as it, ThemeColorSlot as j, BodyProperties as jt, SlideMaster as k, ShapeHost as kt, ImportSlideOptions as l, GradientStop as ln, DiagramConnectionType as lt, SlideSource as m, ChartExDataLabels as mt, EmbeddedFontFaceInfo as n, BackgroundFill as nn, TableCellBorderEdit as nt, FromTemplateOptions as o, PictureFill as on, TableCellEdge as ot, SlideSize as p, EmbeddedFontSlot as pn, ChartExAxis as pt, isGraphicFrame as q, LineEnd as qt, EmbeddedFontInfo as r, BackgroundSource as rn, TableRow as rt, ImportShapeOptions as s, PictureFillTile as sn, Diagram as st, AppendSlidesOptions as t, PatternFill as tn, TableCell as tt, ImportSlidesRequest as u, ResolvedColor as un, DiagramPoint as ut, readCoreProperties as v, Chart as vt, TransitionInput as w, ChartSeries as wt, AddTextBoxOptions as x, ChartFill as xt, readCustomProperties as y, ChartAxis as yt, ModernComment as z, AbsoluteFrame as zt };
|
|
4634
|
+
//# sourceMappingURL=presentation-types-D7cgT-eG.d.ts.map
|