@pptx-glimpse/document 0.1.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 +88 -0
- package/dist/index.cjs +4677 -0
- package/dist/index.d.cts +1250 -0
- package/dist/index.d.ts +1250 -0
- package/dist/index.js +4633 -0
- package/package.json +47 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source handle related types.
|
|
3
|
+
*
|
|
4
|
+
* PptxSourceModel source node is a writer / editor / round-trip
|
|
5
|
+
* In order to do this, we can use ``which package part and which node it came from'' as a stable handle.
|
|
6
|
+
* A handle is not a direct mutable pointer, but a stable reference
|
|
7
|
+
* (see part path / relationship id / node id / order within siblings / raw sidecar)
|
|
8
|
+
* composes it.
|
|
9
|
+
*/
|
|
10
|
+
declare const PartPathBrand: unique symbol;
|
|
11
|
+
declare const RelationshipIdBrand: unique symbol;
|
|
12
|
+
declare const SourceNodeIdBrand: unique symbol;
|
|
13
|
+
declare const RawSidecarIdBrand: unique symbol;
|
|
14
|
+
/** Part path inside the OOXML package (Example: `ppt/slides/slide1.xml`). */
|
|
15
|
+
type PartPath = string & {
|
|
16
|
+
readonly [PartPathBrand]: typeof PartPathBrand;
|
|
17
|
+
};
|
|
18
|
+
/** Relationship id (Example: `rId1`).`_rels/*.rels` source. */
|
|
19
|
+
type RelationshipId = string & {
|
|
20
|
+
readonly [RelationshipIdBrand]: typeof RelationshipIdBrand;
|
|
21
|
+
};
|
|
22
|
+
/** An id that uniquely points to an element within the source part (spid / generation id, etc.). */
|
|
23
|
+
type SourceNodeId = string & {
|
|
24
|
+
readonly [SourceNodeIdBrand]: typeof SourceNodeIdBrand;
|
|
25
|
+
};
|
|
26
|
+
/** Id pointing to a raw sidecar. */
|
|
27
|
+
type RawSidecarId = string & {
|
|
28
|
+
readonly [RawSidecarIdBrand]: typeof RawSidecarIdBrand;
|
|
29
|
+
};
|
|
30
|
+
declare function asPartPath(value: string): PartPath;
|
|
31
|
+
declare function asRelationshipId(value: string): RelationshipId;
|
|
32
|
+
declare function asSourceNodeId(value: string): SourceNodeId;
|
|
33
|
+
declare function asRawSidecarId(value: string): RawSidecarId;
|
|
34
|
+
/**
|
|
35
|
+
* Stable handle describing a source node's provenance. The writer uses the handle to decide whether a generated
|
|
36
|
+
* node can be spliced into an existing part or whether a broader scope must be regenerated.
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
interface SourceHandle {
|
|
40
|
+
/** Package part that owns this node. */
|
|
41
|
+
readonly partPath: PartPath;
|
|
42
|
+
/** Node id inside the part (when available). */
|
|
43
|
+
readonly nodeId?: SourceNodeId;
|
|
44
|
+
/** The relationship id referencing this node (e.g. `r:embed` in blip). */
|
|
45
|
+
readonly relationshipId?: RelationshipId;
|
|
46
|
+
/** The child's order slot within the parent element. Used to restore order with raw sidecar. */
|
|
47
|
+
readonly orderingSlot?: number;
|
|
48
|
+
/** Raw sidecar ids associated with this node. */
|
|
49
|
+
readonly rawSidecarIds?: readonly RawSidecarId[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Diagnostics type. Document correctness (round-trip / preservation / reference resolution)
|
|
54
|
+
* and are not warnings about rendering fidelity or UI behavior.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
type DiagnosticSeverity = "info" | "warning" | "error";
|
|
58
|
+
interface Diagnostic {
|
|
59
|
+
readonly severity: DiagnosticSeverity;
|
|
60
|
+
/** Stable machine-readable code (Example: `unsupported-node-dropped`). */
|
|
61
|
+
readonly code: string;
|
|
62
|
+
readonly message: string;
|
|
63
|
+
/** The source node from which the diagnosis originates, if it can be determined. */
|
|
64
|
+
readonly handle?: SourceHandle;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
declare function findTextRunBySourceHandle(source: PptxSourceModel, handle: SourceHandle): SourceTextRun | undefined;
|
|
68
|
+
declare function findParagraphBySourceHandle(source: PptxSourceModel, handle: SourceHandle): SourceParagraph | undefined;
|
|
69
|
+
declare function replaceTextRunPlainText(source: PptxSourceModel, handle: SourceHandle, text: string): PptxSourceModel;
|
|
70
|
+
declare function replaceParagraphPlainText(source: PptxSourceModel, handle: SourceHandle, text: string): PptxSourceModel;
|
|
71
|
+
interface UpdateShapeTransformInput {
|
|
72
|
+
readonly offsetX: Emu;
|
|
73
|
+
readonly offsetY: Emu;
|
|
74
|
+
readonly width: Emu;
|
|
75
|
+
readonly height: Emu;
|
|
76
|
+
}
|
|
77
|
+
declare function findShapeNodeBySourceHandle(source: PptxSourceModel, handle: SourceHandle): SourceShapeNode | undefined;
|
|
78
|
+
declare function updateShapeTransform(source: PptxSourceModel, handle: SourceHandle, transform: UpdateShapeTransformInput): PptxSourceModel;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Types for the raw OOXML escape hatch.
|
|
82
|
+
*
|
|
83
|
+
* PptxSourceModel represents supported semantics as typed fields, while preserving
|
|
84
|
+
* unsupported or partially supported XML as raw sidecars and unedited parts as raw
|
|
85
|
+
* package parts. This enables structural round-tripping; byte equality is not a goal.
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Partially parsed raw OOXML node. It preserves the namespace-prefixed qualified name,
|
|
90
|
+
* attributes, child nodes, and text for elements that PptxSourceModel does not represent
|
|
91
|
+
* as typed fields, such as vendor extensions, `mc:AlternateContent`, and unknown
|
|
92
|
+
* DrawingML.
|
|
93
|
+
*/
|
|
94
|
+
interface RawOoxmlNode {
|
|
95
|
+
/** Element name including the namespace prefix (Example: `a:extLst`). */
|
|
96
|
+
readonly name: string;
|
|
97
|
+
readonly attributes?: Readonly<Record<string, string>>;
|
|
98
|
+
readonly children?: readonly RawOoxmlNode[];
|
|
99
|
+
/** Element text content (when present). */
|
|
100
|
+
readonly text?: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Raw XML sidecar associated with a PptxSourceModel source node. It is attached to the nearest source node
|
|
104
|
+
* and keeps ordering metadata within the parent element to restore order during write-back.
|
|
105
|
+
*/
|
|
106
|
+
interface RawSidecar {
|
|
107
|
+
readonly id: RawSidecarId;
|
|
108
|
+
readonly node: RawOoxmlNode;
|
|
109
|
+
/** Ordering slot within the owning element's child sequence. */
|
|
110
|
+
readonly orderingSlot?: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Raw fallback for writing an unedited package part back as-is. It keeps either bytes
|
|
114
|
+
* for binary assets or an XML tree as a discriminated union. The type rules out invalid
|
|
115
|
+
* states with both or neither representation.
|
|
116
|
+
*/
|
|
117
|
+
type RawPackagePart = {
|
|
118
|
+
readonly kind: "binary";
|
|
119
|
+
readonly partPath: PartPath;
|
|
120
|
+
readonly contentType: string;
|
|
121
|
+
/** Original byte string of binary part (image, embedded workbook, etc.). */
|
|
122
|
+
readonly bytes: Uint8Array;
|
|
123
|
+
} | {
|
|
124
|
+
readonly kind: "xml";
|
|
125
|
+
readonly partPath: PartPath;
|
|
126
|
+
readonly contentType: string;
|
|
127
|
+
/** The root node when storing the XML part as a tree. */
|
|
128
|
+
readonly xml: RawOoxmlNode;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Package graph type. package part / relationship / content type / media
|
|
133
|
+
* Represented as source-model data.
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
/** target mode of relationship. */
|
|
137
|
+
type RelationshipTargetMode = "Internal" | "External";
|
|
138
|
+
/** 1 entry in `_rels/*.rels`. */
|
|
139
|
+
interface Relationship {
|
|
140
|
+
readonly id: RelationshipId;
|
|
141
|
+
/** relationship type URI. */
|
|
142
|
+
readonly type: string;
|
|
143
|
+
/** Target relative to sourcePartPath, or an external URL. */
|
|
144
|
+
readonly target: string;
|
|
145
|
+
readonly targetMode?: RelationshipTargetMode;
|
|
146
|
+
}
|
|
147
|
+
/** Relationships owned by a source part (`<part>/_rels/<part>.rels`). */
|
|
148
|
+
interface PartRelationships {
|
|
149
|
+
readonly sourcePartPath: PartPath;
|
|
150
|
+
readonly relationships: readonly Relationship[];
|
|
151
|
+
}
|
|
152
|
+
/** Default entry in `[Content_Types].xml` (extension -> content type). */
|
|
153
|
+
interface ContentTypeDefault {
|
|
154
|
+
readonly extension: string;
|
|
155
|
+
readonly contentType: string;
|
|
156
|
+
}
|
|
157
|
+
/** Override entry (part name -> content type) in `[Content_Types].xml`. */
|
|
158
|
+
interface ContentTypeOverride {
|
|
159
|
+
readonly partName: PartPath;
|
|
160
|
+
readonly contentType: string;
|
|
161
|
+
}
|
|
162
|
+
interface ContentTypes {
|
|
163
|
+
readonly defaults: readonly ContentTypeDefault[];
|
|
164
|
+
readonly overrides: readonly ContentTypeOverride[];
|
|
165
|
+
}
|
|
166
|
+
/** Package part reference (path + content type). */
|
|
167
|
+
interface PackagePartRef {
|
|
168
|
+
readonly partPath: PartPath;
|
|
169
|
+
readonly contentType: string;
|
|
170
|
+
}
|
|
171
|
+
/** Part of a media asset (image, audio, video, etc.). Keep bytes as is. */
|
|
172
|
+
interface MediaPart {
|
|
173
|
+
readonly partPath: PartPath;
|
|
174
|
+
readonly contentType: string;
|
|
175
|
+
readonly bytes: Uint8Array;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The overall structure of the package. content types / part list / relationship by part /
|
|
179
|
+
* media, and retain the raw fallback of the unedited part.
|
|
180
|
+
*/
|
|
181
|
+
interface PackageGraph {
|
|
182
|
+
readonly contentTypes: ContentTypes;
|
|
183
|
+
readonly parts: readonly PackagePartRef[];
|
|
184
|
+
readonly relationships: readonly PartRelationships[];
|
|
185
|
+
readonly media: readonly MediaPart[];
|
|
186
|
+
/** Raw fallback for writing back parts that are not typed / were not edited. */
|
|
187
|
+
readonly rawParts?: readonly RawPackagePart[];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* PptxSourceModel PPTX-native typed units used by source model.
|
|
192
|
+
*
|
|
193
|
+
* The source model does not perform pixel conversion and keeps the units defined by OOXML
|
|
194
|
+
* Hold as a type. The unit type on the renderer side (`@pptx-glimpse/renderer`) is
|
|
195
|
+
* the lower-level foundation `@pptx-glimpse/document` cannot reference, so this module
|
|
196
|
+
* Define branded types independently. Zero runtime cost (JS output is
|
|
197
|
+
* (same as plain number).
|
|
198
|
+
*/
|
|
199
|
+
declare const EmuBrand: unique symbol;
|
|
200
|
+
declare const PtBrand: unique symbol;
|
|
201
|
+
declare const HundredthPtBrand: unique symbol;
|
|
202
|
+
declare const OoxmlPercentBrand: unique symbol;
|
|
203
|
+
declare const OoxmlAngleBrand: unique symbol;
|
|
204
|
+
/** English Metric Units (1 inch = 914,400 EMU). Used for coordinates and size. */
|
|
205
|
+
type Emu = number & {
|
|
206
|
+
readonly [EmuBrand]: typeof EmuBrand;
|
|
207
|
+
};
|
|
208
|
+
/** points (1 pt = 1/72 inch).font size. */
|
|
209
|
+
type Pt = number & {
|
|
210
|
+
readonly [PtBrand]: typeof PtBrand;
|
|
211
|
+
};
|
|
212
|
+
/** 1/100 point (ECMA-376 `a:spcPts` etc.). */
|
|
213
|
+
type HundredthPt = number & {
|
|
214
|
+
readonly [HundredthPtBrand]: typeof HundredthPtBrand;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* OOXML percentage (ST_Percentage).Integer value where 1% = 1000.
|
|
218
|
+
* `a:spcPct` / `a:lumMod` / `a:tint` and similar transforms.
|
|
219
|
+
*/
|
|
220
|
+
type OoxmlPercent = number & {
|
|
221
|
+
readonly [OoxmlPercentBrand]: typeof OoxmlPercentBrand;
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* OOXML angle (ST_Angle).1 degree = 60,000.`a:xfrm@rot` and similar fields.
|
|
225
|
+
*/
|
|
226
|
+
type OoxmlAngle = number & {
|
|
227
|
+
readonly [OoxmlAngleBrand]: typeof OoxmlAngleBrand;
|
|
228
|
+
};
|
|
229
|
+
declare function asEmu(value: number): Emu;
|
|
230
|
+
declare function asPt(value: number): Pt;
|
|
231
|
+
declare function asHundredthPt(value: number): HundredthPt;
|
|
232
|
+
declare function asOoxmlPercent(value: number): OoxmlPercent;
|
|
233
|
+
declare function asOoxmlAngle(value: number): OoxmlAngle;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Source node types for simple shapes, text runs, and images.
|
|
237
|
+
*
|
|
238
|
+
* The current supported drawing subset, centered on simple shapes, text, and images, is
|
|
239
|
+
* represented as typed nodes. Theme colors and relationships stay as unresolved source
|
|
240
|
+
* references, and cascade resolution is handled by the computed view. Unsupported nodes
|
|
241
|
+
* are preserved through the raw escape hatch.
|
|
242
|
+
*/
|
|
243
|
+
|
|
244
|
+
/** Source transform from `a:xfrm`. Keep the coordinates and size as EMU. */
|
|
245
|
+
interface SourceTransform {
|
|
246
|
+
readonly offsetX: Emu;
|
|
247
|
+
readonly offsetY: Emu;
|
|
248
|
+
readonly width: Emu;
|
|
249
|
+
readonly height: Emu;
|
|
250
|
+
readonly rotation?: OoxmlAngle;
|
|
251
|
+
readonly flipHorizontal?: boolean;
|
|
252
|
+
readonly flipVertical?: boolean;
|
|
253
|
+
}
|
|
254
|
+
/** Source reference for preset geometry (`a:prstGeom`). Keep only the preset name. */
|
|
255
|
+
interface SourcePresetGeometry {
|
|
256
|
+
/** Preset name (Example: `rect`, `roundRect`). */
|
|
257
|
+
readonly preset: string;
|
|
258
|
+
readonly adjustValues?: Readonly<Record<string, number>>;
|
|
259
|
+
}
|
|
260
|
+
interface SourceCustomGeometryPath {
|
|
261
|
+
readonly width: number;
|
|
262
|
+
readonly height: number;
|
|
263
|
+
readonly commands: string;
|
|
264
|
+
}
|
|
265
|
+
interface SourceCustomGeometry {
|
|
266
|
+
readonly kind: "custom";
|
|
267
|
+
readonly paths: readonly SourceCustomGeometryPath[];
|
|
268
|
+
}
|
|
269
|
+
type SourceGeometry = SourcePresetGeometry | SourceCustomGeometry;
|
|
270
|
+
/**
|
|
271
|
+
* Unresolved source color reference. `schemeClr` keeps the scheme name and resolves to a
|
|
272
|
+
* concrete color through `clrMap` / `colorScheme` in the computed view. `srgbClr` and
|
|
273
|
+
* `sysClr` hold concrete values, but transformations such as lumMod are kept unapplied.
|
|
274
|
+
*/
|
|
275
|
+
type SourceColor = {
|
|
276
|
+
readonly kind: "srgb";
|
|
277
|
+
readonly hex: string;
|
|
278
|
+
readonly transforms?: readonly SourceColorTransform[];
|
|
279
|
+
} | {
|
|
280
|
+
readonly kind: "scheme";
|
|
281
|
+
readonly scheme: string;
|
|
282
|
+
readonly transforms?: readonly SourceColorTransform[];
|
|
283
|
+
} | {
|
|
284
|
+
readonly kind: "system";
|
|
285
|
+
/** `a:sysClr@val` (Example: `windowText`). */
|
|
286
|
+
readonly value: string;
|
|
287
|
+
/** Resolved fallback hex for `a:sysClr@lastClr`, when present. */
|
|
288
|
+
readonly lastColor?: string;
|
|
289
|
+
readonly transforms?: readonly SourceColorTransform[];
|
|
290
|
+
};
|
|
291
|
+
/** Color conversions such as lumMod / tint / shade (values are OOXML percentages). */
|
|
292
|
+
interface SourceColorTransform {
|
|
293
|
+
readonly kind: "lumMod" | "lumOff" | "tint" | "shade" | "alpha";
|
|
294
|
+
readonly value: OoxmlPercent;
|
|
295
|
+
}
|
|
296
|
+
/** shape fill (source level, minimum). Unsupported fills are saved as raw. */
|
|
297
|
+
type SourceFill = {
|
|
298
|
+
readonly kind: "none";
|
|
299
|
+
} | {
|
|
300
|
+
readonly kind: "solid";
|
|
301
|
+
readonly color: SourceColor;
|
|
302
|
+
} | ({
|
|
303
|
+
readonly kind: "gradient";
|
|
304
|
+
readonly stops: readonly SourceGradientStop[];
|
|
305
|
+
} & SourceGradient) | {
|
|
306
|
+
readonly kind: "pattern";
|
|
307
|
+
readonly preset: string;
|
|
308
|
+
readonly foregroundColor: SourceColor;
|
|
309
|
+
readonly backgroundColor: SourceColor;
|
|
310
|
+
} | {
|
|
311
|
+
readonly kind: "image";
|
|
312
|
+
readonly blipRelationshipId?: RelationshipId;
|
|
313
|
+
readonly tile?: SourceImageFillTile;
|
|
314
|
+
} | {
|
|
315
|
+
readonly kind: "raw";
|
|
316
|
+
readonly raw: RawSidecar;
|
|
317
|
+
};
|
|
318
|
+
interface SourceGradientStop {
|
|
319
|
+
readonly position: number;
|
|
320
|
+
readonly color: SourceColor;
|
|
321
|
+
}
|
|
322
|
+
type SourceGradient = {
|
|
323
|
+
readonly gradientType: "linear";
|
|
324
|
+
readonly angle: OoxmlAngle;
|
|
325
|
+
} | {
|
|
326
|
+
readonly gradientType: "radial";
|
|
327
|
+
readonly centerX: number;
|
|
328
|
+
readonly centerY: number;
|
|
329
|
+
};
|
|
330
|
+
type SourceRectangleAlignment = "tl" | "t" | "tr" | "l" | "ctr" | "r" | "bl" | "b" | "br";
|
|
331
|
+
interface SourceImageFillTile {
|
|
332
|
+
readonly tx: Emu;
|
|
333
|
+
readonly ty: Emu;
|
|
334
|
+
readonly sx: number;
|
|
335
|
+
readonly sy: number;
|
|
336
|
+
readonly flip: "none" | "x" | "y" | "xy";
|
|
337
|
+
readonly align: SourceRectangleAlignment;
|
|
338
|
+
}
|
|
339
|
+
interface SourceStyleReference {
|
|
340
|
+
readonly index: number;
|
|
341
|
+
readonly color?: SourceColor;
|
|
342
|
+
}
|
|
343
|
+
interface SourceShapeStyle {
|
|
344
|
+
readonly fillRef?: SourceStyleReference;
|
|
345
|
+
readonly lineRef?: SourceStyleReference;
|
|
346
|
+
readonly effectRef?: SourceStyleReference;
|
|
347
|
+
}
|
|
348
|
+
interface SourceEffectList {
|
|
349
|
+
readonly outerShadow?: SourceOuterShadow;
|
|
350
|
+
readonly innerShadow?: SourceInnerShadow;
|
|
351
|
+
readonly glow?: SourceGlow;
|
|
352
|
+
readonly softEdge?: SourceSoftEdge;
|
|
353
|
+
}
|
|
354
|
+
interface SourceOuterShadow {
|
|
355
|
+
readonly blurRadius: Emu;
|
|
356
|
+
readonly distance: Emu;
|
|
357
|
+
readonly direction: OoxmlAngle;
|
|
358
|
+
readonly color: SourceColor;
|
|
359
|
+
readonly alignment: SourceRectangleAlignment;
|
|
360
|
+
readonly rotateWithShape: boolean;
|
|
361
|
+
}
|
|
362
|
+
interface SourceInnerShadow {
|
|
363
|
+
readonly blurRadius: Emu;
|
|
364
|
+
readonly distance: Emu;
|
|
365
|
+
readonly direction: OoxmlAngle;
|
|
366
|
+
readonly color: SourceColor;
|
|
367
|
+
}
|
|
368
|
+
interface SourceGlow {
|
|
369
|
+
readonly radius: Emu;
|
|
370
|
+
readonly color: SourceColor;
|
|
371
|
+
}
|
|
372
|
+
interface SourceSoftEdge {
|
|
373
|
+
readonly radius: Emu;
|
|
374
|
+
}
|
|
375
|
+
interface SourceBlipEffects {
|
|
376
|
+
readonly grayscale: boolean;
|
|
377
|
+
readonly biLevel?: SourceBiLevelEffect;
|
|
378
|
+
readonly blur?: SourceBlurEffect;
|
|
379
|
+
readonly lum?: SourceLumEffect;
|
|
380
|
+
readonly duotone?: SourceDuotoneEffect;
|
|
381
|
+
readonly clrChange?: SourceColorChangeEffect;
|
|
382
|
+
}
|
|
383
|
+
interface SourceBiLevelEffect {
|
|
384
|
+
readonly threshold: number;
|
|
385
|
+
}
|
|
386
|
+
interface SourceBlurEffect {
|
|
387
|
+
readonly radius: Emu;
|
|
388
|
+
readonly grow: boolean;
|
|
389
|
+
}
|
|
390
|
+
interface SourceLumEffect {
|
|
391
|
+
readonly brightness: number;
|
|
392
|
+
readonly contrast: number;
|
|
393
|
+
}
|
|
394
|
+
interface SourceDuotoneEffect {
|
|
395
|
+
readonly color1: SourceColor;
|
|
396
|
+
readonly color2: SourceColor;
|
|
397
|
+
}
|
|
398
|
+
interface SourceColorChangeEffect {
|
|
399
|
+
readonly from: SourceColor;
|
|
400
|
+
readonly to: SourceColor;
|
|
401
|
+
}
|
|
402
|
+
/** simple solid line outline (`a:ln`). Minimal representation of color and width only. */
|
|
403
|
+
interface SourceOutline {
|
|
404
|
+
readonly width?: Emu;
|
|
405
|
+
readonly fill?: SourceFill;
|
|
406
|
+
readonly dashStyle?: SourceDashStyle;
|
|
407
|
+
readonly customDash?: readonly number[];
|
|
408
|
+
readonly lineCap?: SourceLineCap;
|
|
409
|
+
readonly lineJoin?: SourceLineJoin;
|
|
410
|
+
readonly headEnd?: SourceArrowEndpoint;
|
|
411
|
+
readonly tailEnd?: SourceArrowEndpoint;
|
|
412
|
+
}
|
|
413
|
+
type SourceArrowType = "triangle" | "stealth" | "diamond" | "oval" | "arrow";
|
|
414
|
+
type SourceArrowSize = "sm" | "med" | "lg";
|
|
415
|
+
interface SourceArrowEndpoint {
|
|
416
|
+
readonly type: SourceArrowType;
|
|
417
|
+
readonly width: SourceArrowSize;
|
|
418
|
+
readonly length: SourceArrowSize;
|
|
419
|
+
}
|
|
420
|
+
type SourceDashStyle = "solid" | "dash" | "dot" | "dashDot" | "lgDash" | "lgDashDot" | "sysDash" | "sysDot";
|
|
421
|
+
type SourceLineCap = "butt" | "round" | "square";
|
|
422
|
+
type SourceLineJoin = "miter" | "round" | "bevel";
|
|
423
|
+
/** placeholder declaration (`p:ph`). Keep type / idx unresolved. */
|
|
424
|
+
interface SourcePlaceholder {
|
|
425
|
+
readonly type?: string;
|
|
426
|
+
readonly index?: number;
|
|
427
|
+
}
|
|
428
|
+
/** Minimal subset of run properties (`a:rPr`) of text run (`a:r`). */
|
|
429
|
+
interface SourceRunProperties {
|
|
430
|
+
readonly bold?: boolean;
|
|
431
|
+
readonly italic?: boolean;
|
|
432
|
+
readonly underline?: boolean;
|
|
433
|
+
readonly strikethrough?: boolean;
|
|
434
|
+
readonly baseline?: number;
|
|
435
|
+
/** Font size. Stored as pt in the OOXML domain. */
|
|
436
|
+
readonly fontSize?: Pt;
|
|
437
|
+
/** latin typeface name (kept unresolved including theme token). */
|
|
438
|
+
readonly typeface?: string;
|
|
439
|
+
/** East Asian typeface name (kept unresolved including theme token). */
|
|
440
|
+
readonly typefaceEa?: string;
|
|
441
|
+
/** Complex script typeface name (kept unresolved including theme token). */
|
|
442
|
+
readonly typefaceCs?: string;
|
|
443
|
+
readonly color?: SourceColor;
|
|
444
|
+
}
|
|
445
|
+
type SourceAutoNumScheme = "arabicPeriod" | "arabicParenR" | "romanUcPeriod" | "romanLcPeriod" | "alphaUcPeriod" | "alphaLcPeriod" | "alphaLcParenR" | "alphaUcParenR" | "arabicPlain";
|
|
446
|
+
type SourceBulletType = {
|
|
447
|
+
readonly type: "none";
|
|
448
|
+
} | {
|
|
449
|
+
readonly type: "char";
|
|
450
|
+
readonly char: string;
|
|
451
|
+
} | {
|
|
452
|
+
readonly type: "autoNum";
|
|
453
|
+
readonly scheme: SourceAutoNumScheme;
|
|
454
|
+
readonly startAt: number;
|
|
455
|
+
};
|
|
456
|
+
type SourceSpacingValue = {
|
|
457
|
+
readonly type: "pts";
|
|
458
|
+
readonly value: HundredthPt;
|
|
459
|
+
} | {
|
|
460
|
+
readonly type: "pct";
|
|
461
|
+
readonly value: number;
|
|
462
|
+
};
|
|
463
|
+
/** text run (`a:r`). */
|
|
464
|
+
interface SourceTextRun {
|
|
465
|
+
readonly kind: "textRun";
|
|
466
|
+
readonly text: string;
|
|
467
|
+
readonly properties?: SourceRunProperties;
|
|
468
|
+
readonly handle?: SourceHandle;
|
|
469
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
470
|
+
}
|
|
471
|
+
type SourceTextAlign = "left" | "center" | "right" | "justify";
|
|
472
|
+
interface SourceTabStop {
|
|
473
|
+
readonly position: Emu;
|
|
474
|
+
readonly alignment: "l" | "ctr" | "r" | "dec";
|
|
475
|
+
}
|
|
476
|
+
/** Minimum subset of paragraph properties (`a:pPr`) of paragraph (`a:p`). */
|
|
477
|
+
interface SourceParagraphProperties {
|
|
478
|
+
readonly align?: SourceTextAlign;
|
|
479
|
+
/** Indentation level (`a:pPr@lvl`). */
|
|
480
|
+
readonly level?: number;
|
|
481
|
+
readonly lineSpacing?: SourceSpacingValue;
|
|
482
|
+
readonly spaceBefore?: SourceSpacingValue;
|
|
483
|
+
readonly spaceAfter?: SourceSpacingValue;
|
|
484
|
+
readonly marginLeft?: Emu;
|
|
485
|
+
readonly indent?: Emu;
|
|
486
|
+
readonly bullet?: SourceBulletType;
|
|
487
|
+
readonly bulletFont?: string;
|
|
488
|
+
readonly bulletColor?: SourceColor;
|
|
489
|
+
readonly bulletSizePct?: number;
|
|
490
|
+
readonly tabStops?: readonly SourceTabStop[];
|
|
491
|
+
readonly defaultRunProperties?: SourceRunProperties;
|
|
492
|
+
}
|
|
493
|
+
/** paragraph (`a:p`). */
|
|
494
|
+
interface SourceParagraph {
|
|
495
|
+
readonly runs: readonly SourceTextRun[];
|
|
496
|
+
readonly properties?: SourceParagraphProperties;
|
|
497
|
+
readonly handle?: SourceHandle;
|
|
498
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
499
|
+
}
|
|
500
|
+
/** vertical anchor (`a:bodyPr@anchor`). */
|
|
501
|
+
type SourceVerticalAnchor = "top" | "middle" | "bottom";
|
|
502
|
+
type SourceTextWrap = "square" | "none";
|
|
503
|
+
type SourceTextVerticalType = "horz" | "vert" | "vert270" | "eaVert" | "wordArtVert" | "mongolianVert";
|
|
504
|
+
type SourceTextAutoFit = "noAutofit" | "normAutofit" | "spAutofit";
|
|
505
|
+
/** Minimal subset of text body properties (`a:bodyPr`): insets and vertical anchor. */
|
|
506
|
+
interface SourceTextBodyProperties {
|
|
507
|
+
readonly marginLeft?: Emu;
|
|
508
|
+
readonly marginRight?: Emu;
|
|
509
|
+
readonly marginTop?: Emu;
|
|
510
|
+
readonly marginBottom?: Emu;
|
|
511
|
+
readonly anchor?: SourceVerticalAnchor;
|
|
512
|
+
readonly wrap?: SourceTextWrap;
|
|
513
|
+
readonly autoFit?: SourceTextAutoFit;
|
|
514
|
+
readonly fontScale?: number;
|
|
515
|
+
readonly lnSpcReduction?: number;
|
|
516
|
+
readonly numCol?: number;
|
|
517
|
+
readonly vert?: SourceTextVerticalType;
|
|
518
|
+
}
|
|
519
|
+
/** text body (`p:txBody`). */
|
|
520
|
+
interface SourceTextBody {
|
|
521
|
+
readonly paragraphs: readonly SourceParagraph[];
|
|
522
|
+
readonly properties?: SourceTextBodyProperties;
|
|
523
|
+
readonly listStyle?: SourceTextStyle;
|
|
524
|
+
readonly handle?: SourceHandle;
|
|
525
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
526
|
+
}
|
|
527
|
+
interface SourceTextStyle {
|
|
528
|
+
readonly defaultParagraph?: SourceParagraphProperties;
|
|
529
|
+
readonly levels: readonly (SourceParagraphProperties | undefined)[];
|
|
530
|
+
}
|
|
531
|
+
/** simple shape (`p:sp`). */
|
|
532
|
+
interface SourceShape {
|
|
533
|
+
readonly kind: "shape";
|
|
534
|
+
readonly nodeId?: SourceNodeId;
|
|
535
|
+
readonly name?: string;
|
|
536
|
+
readonly transform?: SourceTransform;
|
|
537
|
+
readonly geometry?: SourceGeometry;
|
|
538
|
+
readonly fill?: SourceFill;
|
|
539
|
+
readonly outline?: SourceOutline;
|
|
540
|
+
readonly effects?: SourceEffectList;
|
|
541
|
+
readonly style?: SourceShapeStyle;
|
|
542
|
+
readonly textBody?: SourceTextBody;
|
|
543
|
+
readonly placeholder?: SourcePlaceholder;
|
|
544
|
+
readonly handle?: SourceHandle;
|
|
545
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
546
|
+
}
|
|
547
|
+
interface SourceConnector {
|
|
548
|
+
readonly kind: "connector";
|
|
549
|
+
readonly nodeId?: SourceNodeId;
|
|
550
|
+
readonly name?: string;
|
|
551
|
+
readonly transform?: SourceTransform;
|
|
552
|
+
readonly geometry?: SourceGeometry;
|
|
553
|
+
readonly outline?: SourceOutline;
|
|
554
|
+
readonly effects?: SourceEffectList;
|
|
555
|
+
readonly style?: SourceShapeStyle;
|
|
556
|
+
readonly handle?: SourceHandle;
|
|
557
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
558
|
+
}
|
|
559
|
+
interface SourceGroup {
|
|
560
|
+
readonly kind: "group";
|
|
561
|
+
readonly nodeId?: SourceNodeId;
|
|
562
|
+
readonly name?: string;
|
|
563
|
+
readonly transform?: SourceTransform;
|
|
564
|
+
readonly childTransform?: SourceTransform;
|
|
565
|
+
readonly fill?: SourceFill;
|
|
566
|
+
readonly effects?: SourceEffectList;
|
|
567
|
+
readonly children: readonly SourceShapeNode[];
|
|
568
|
+
readonly handle?: SourceHandle;
|
|
569
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
570
|
+
}
|
|
571
|
+
/** crop (`a:srcRect`) of image. Preserve insets on each edge as OOXML percentages. */
|
|
572
|
+
interface SourceImageCrop {
|
|
573
|
+
readonly left?: OoxmlPercent;
|
|
574
|
+
readonly top?: OoxmlPercent;
|
|
575
|
+
readonly right?: OoxmlPercent;
|
|
576
|
+
readonly bottom?: OoxmlPercent;
|
|
577
|
+
}
|
|
578
|
+
interface SourceImageStretch {
|
|
579
|
+
readonly left: number;
|
|
580
|
+
readonly top: number;
|
|
581
|
+
readonly right: number;
|
|
582
|
+
readonly bottom: number;
|
|
583
|
+
}
|
|
584
|
+
/** image (`p:pic`). The blip keeps the relationship id (`r:embed`) unresolved. */
|
|
585
|
+
interface SourceImage {
|
|
586
|
+
readonly kind: "image";
|
|
587
|
+
readonly nodeId?: SourceNodeId;
|
|
588
|
+
readonly name?: string;
|
|
589
|
+
readonly transform?: SourceTransform;
|
|
590
|
+
/** Relationship id of `a:blip@r:embed`. The media part is resolved by the computed view. */
|
|
591
|
+
readonly blipRelationshipId?: RelationshipId;
|
|
592
|
+
readonly crop?: SourceImageCrop;
|
|
593
|
+
readonly stretch?: SourceImageStretch;
|
|
594
|
+
readonly tile?: SourceImageFillTile;
|
|
595
|
+
readonly effects?: SourceEffectList;
|
|
596
|
+
readonly blipEffects?: SourceBlipEffects;
|
|
597
|
+
readonly handle?: SourceHandle;
|
|
598
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
599
|
+
}
|
|
600
|
+
interface SourceTable {
|
|
601
|
+
readonly kind: "table";
|
|
602
|
+
readonly nodeId?: SourceNodeId;
|
|
603
|
+
readonly name?: string;
|
|
604
|
+
readonly transform?: SourceTransform;
|
|
605
|
+
readonly table: SourceTableData;
|
|
606
|
+
readonly handle?: SourceHandle;
|
|
607
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
608
|
+
}
|
|
609
|
+
interface SourceTableData {
|
|
610
|
+
readonly columns: readonly SourceTableColumn[];
|
|
611
|
+
readonly rows: readonly SourceTableRow[];
|
|
612
|
+
readonly tableStyleId?: string;
|
|
613
|
+
}
|
|
614
|
+
interface SourceTableColumn {
|
|
615
|
+
readonly width: Emu;
|
|
616
|
+
}
|
|
617
|
+
interface SourceTableRow {
|
|
618
|
+
readonly height: Emu;
|
|
619
|
+
readonly cells: readonly SourceTableCell[];
|
|
620
|
+
}
|
|
621
|
+
interface SourceTableCell {
|
|
622
|
+
readonly textBody?: SourceTextBody;
|
|
623
|
+
readonly fill?: SourceFill;
|
|
624
|
+
readonly borders?: SourceCellBorders;
|
|
625
|
+
readonly gridSpan: number;
|
|
626
|
+
readonly rowSpan: number;
|
|
627
|
+
readonly hMerge: boolean;
|
|
628
|
+
readonly vMerge: boolean;
|
|
629
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
630
|
+
}
|
|
631
|
+
interface SourceCellBorders {
|
|
632
|
+
readonly top?: SourceOutline;
|
|
633
|
+
readonly bottom?: SourceOutline;
|
|
634
|
+
readonly left?: SourceOutline;
|
|
635
|
+
readonly right?: SourceOutline;
|
|
636
|
+
}
|
|
637
|
+
interface SourceChart {
|
|
638
|
+
readonly kind: "chart";
|
|
639
|
+
readonly nodeId?: SourceNodeId;
|
|
640
|
+
readonly name?: string;
|
|
641
|
+
readonly transform?: SourceTransform;
|
|
642
|
+
/** Relationship id of `c:chart@r:id`. The chart part is resolved by the computed view. */
|
|
643
|
+
readonly chartRelationshipId?: RelationshipId;
|
|
644
|
+
readonly handle?: SourceHandle;
|
|
645
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
646
|
+
}
|
|
647
|
+
interface SourceSmartArt {
|
|
648
|
+
readonly kind: "smartArt";
|
|
649
|
+
readonly nodeId?: SourceNodeId;
|
|
650
|
+
readonly name?: string;
|
|
651
|
+
readonly transform?: SourceTransform;
|
|
652
|
+
/** Relationship id of `dgm:relIds@r:dm`. Diagram data/drawing parts are resolved by the computed view. */
|
|
653
|
+
readonly dataRelationshipId?: RelationshipId;
|
|
654
|
+
readonly handle?: SourceHandle;
|
|
655
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Raw escape hatch for shape tree nodes that are not represented as typed nodes. Unsupported shapes,
|
|
659
|
+
* groups, connectors, and similar nodes are saved for round trips.
|
|
660
|
+
*/
|
|
661
|
+
interface SourceRawShapeNode {
|
|
662
|
+
readonly kind: "raw";
|
|
663
|
+
readonly nodeId?: SourceNodeId;
|
|
664
|
+
readonly raw: RawSidecar;
|
|
665
|
+
readonly handle?: SourceHandle;
|
|
666
|
+
}
|
|
667
|
+
/** Shape tree source node union. */
|
|
668
|
+
type SourceShapeNode = SourceShape | SourceConnector | SourceGroup | SourceImage | SourceTable | SourceChart | SourceSmartArt | SourceRawShapeNode;
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Source types for the presentation hierarchy.
|
|
672
|
+
*
|
|
673
|
+
* Slide, layout, master, and theme relationships are represented by part paths. Each
|
|
674
|
+
* part stays separate; resolving the master -> layout -> slide cascade is the computed
|
|
675
|
+
* view's responsibility. Materials needed for that resolution, such as background,
|
|
676
|
+
* clrMap, clrMapOvr, theme scheme, and showMasterSp, are kept as source-local values so
|
|
677
|
+
* the source model can retain them without falling back to raw XML.
|
|
678
|
+
*/
|
|
679
|
+
|
|
680
|
+
/** Slide size (`p:sldSz`), kept in EMUs. */
|
|
681
|
+
interface SlideSize {
|
|
682
|
+
readonly width: Emu;
|
|
683
|
+
readonly height: Emu;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Color map (`p:clrMap`) / color map override (`p:clrMapOvr`). Keeps the mapping from
|
|
687
|
+
* logical names (`bg1` / `tx1` / `accent1`, etc.) to theme scheme slots (`dk1` / `lt1`,
|
|
688
|
+
* etc.) unresolved.
|
|
689
|
+
*/
|
|
690
|
+
interface SourceColorMap {
|
|
691
|
+
readonly mapping: Readonly<Record<string, string>>;
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Slide / layout / master background (`p:bg`). This is either a direct fill
|
|
695
|
+
* (`p:bgPr`), a theme style matrix reference (`p:bgRef`), or raw content.
|
|
696
|
+
*/
|
|
697
|
+
type SourceBackground = {
|
|
698
|
+
readonly kind: "fill";
|
|
699
|
+
readonly fill: SourceFill;
|
|
700
|
+
} | {
|
|
701
|
+
readonly kind: "styleReference";
|
|
702
|
+
readonly index: number;
|
|
703
|
+
readonly color: SourceColor;
|
|
704
|
+
} | {
|
|
705
|
+
readonly kind: "raw";
|
|
706
|
+
readonly raw: RawSidecar;
|
|
707
|
+
};
|
|
708
|
+
/** Theme color scheme (`a:clrScheme`). Maps slot names to unconverted concrete colors. */
|
|
709
|
+
interface SourceThemeColorScheme {
|
|
710
|
+
/** `dk1` / `lt1` / `dk2` / `lt2` / `accent1`..`accent6` / `hlink` / `folHlink`. */
|
|
711
|
+
readonly colors: Readonly<Record<string, SourceColor>>;
|
|
712
|
+
}
|
|
713
|
+
/** Minimal subset of the theme font scheme (`a:fontScheme`). */
|
|
714
|
+
interface SourceThemeFontScheme {
|
|
715
|
+
readonly majorLatin?: string;
|
|
716
|
+
readonly minorLatin?: string;
|
|
717
|
+
readonly majorEastAsian?: string;
|
|
718
|
+
readonly minorEastAsian?: string;
|
|
719
|
+
readonly majorComplexScript?: string;
|
|
720
|
+
readonly minorComplexScript?: string;
|
|
721
|
+
readonly majorJapanese?: string;
|
|
722
|
+
readonly minorJapanese?: string;
|
|
723
|
+
}
|
|
724
|
+
/** Subset of the theme format scheme (`a:fmtScheme`) used for shape style ref resolution. */
|
|
725
|
+
interface SourceThemeFormatScheme {
|
|
726
|
+
readonly fillStyles: readonly SourceFill[];
|
|
727
|
+
readonly lineStyles: readonly SourceOutline[];
|
|
728
|
+
readonly effectStyles: readonly (SourceEffectList | undefined)[];
|
|
729
|
+
readonly backgroundFillStyles: readonly SourceFill[];
|
|
730
|
+
}
|
|
731
|
+
/** theme part (`ppt/theme/themeN.xml`). */
|
|
732
|
+
interface SourceTheme {
|
|
733
|
+
readonly partPath: PartPath;
|
|
734
|
+
readonly name?: string;
|
|
735
|
+
readonly colorScheme?: SourceThemeColorScheme;
|
|
736
|
+
readonly fontScheme?: SourceThemeFontScheme;
|
|
737
|
+
readonly formatScheme?: SourceThemeFormatScheme;
|
|
738
|
+
readonly handle?: SourceHandle;
|
|
739
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
740
|
+
}
|
|
741
|
+
/** Slide master part. References the theme and child layouts. */
|
|
742
|
+
interface SourceSlideMaster {
|
|
743
|
+
readonly partPath: PartPath;
|
|
744
|
+
/** Theme part referenced by this master. */
|
|
745
|
+
readonly themePartPath?: PartPath;
|
|
746
|
+
/** Layout parts belonging to this master. */
|
|
747
|
+
readonly layoutPartPaths: readonly PartPath[];
|
|
748
|
+
readonly background?: SourceBackground;
|
|
749
|
+
/** Master `p:clrMap`. */
|
|
750
|
+
readonly colorMap?: SourceColorMap;
|
|
751
|
+
readonly txStyles?: SourceMasterTextStyles;
|
|
752
|
+
readonly shapes: readonly SourceShapeNode[];
|
|
753
|
+
readonly handle?: SourceHandle;
|
|
754
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
755
|
+
}
|
|
756
|
+
interface SourceMasterTextStyles {
|
|
757
|
+
readonly titleStyle?: SourceTextStyle;
|
|
758
|
+
readonly bodyStyle?: SourceTextStyle;
|
|
759
|
+
readonly otherStyle?: SourceTextStyle;
|
|
760
|
+
}
|
|
761
|
+
/** Slide layout part. References the parent master. */
|
|
762
|
+
interface SourceSlideLayout {
|
|
763
|
+
readonly partPath: PartPath;
|
|
764
|
+
/** Parent slide master part for this layout. */
|
|
765
|
+
readonly masterPartPath: PartPath;
|
|
766
|
+
/** layout type (`p:sldLayout@type`). */
|
|
767
|
+
readonly type?: string;
|
|
768
|
+
readonly background?: SourceBackground;
|
|
769
|
+
/** Layout `p:clrMapOvr` (when overridden). */
|
|
770
|
+
readonly colorMapOverride?: SourceColorMap;
|
|
771
|
+
/** `p:sldLayout@showMasterSp` (master shape visibility). */
|
|
772
|
+
readonly showMasterShapes?: boolean;
|
|
773
|
+
readonly shapes: readonly SourceShapeNode[];
|
|
774
|
+
readonly handle?: SourceHandle;
|
|
775
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
776
|
+
}
|
|
777
|
+
/** Slide part. References the applied layout. */
|
|
778
|
+
interface SourceSlide {
|
|
779
|
+
readonly partPath: PartPath;
|
|
780
|
+
/** Layout part referenced by this slide. */
|
|
781
|
+
readonly layoutPartPath: PartPath;
|
|
782
|
+
readonly background?: SourceBackground;
|
|
783
|
+
/** Slide `p:clrMapOvr` (when overridden). */
|
|
784
|
+
readonly colorMapOverride?: SourceColorMap;
|
|
785
|
+
/** `p:sld@showMasterSp` (master shape visibility). */
|
|
786
|
+
readonly showMasterShapes?: boolean;
|
|
787
|
+
readonly shapes: readonly SourceShapeNode[];
|
|
788
|
+
readonly handle?: SourceHandle;
|
|
789
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
790
|
+
}
|
|
791
|
+
/** Presentation part (`ppt/presentation.xml`). Maintains slide order. */
|
|
792
|
+
interface SourcePresentation {
|
|
793
|
+
readonly partPath: PartPath;
|
|
794
|
+
readonly slideSize?: SlideSize;
|
|
795
|
+
readonly defaultTextStyle?: SourceTextStyle;
|
|
796
|
+
/** Slide part paths reflecting `p:sldIdLst` order. */
|
|
797
|
+
readonly slidePartPaths: readonly PartPath[];
|
|
798
|
+
readonly handle?: SourceHandle;
|
|
799
|
+
readonly rawSidecars?: readonly RawSidecar[];
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Top-level types for the PptxSourceModel source model.
|
|
804
|
+
*
|
|
805
|
+
* This is the canonical PPTX document representation owned by
|
|
806
|
+
* `@pptx-glimpse/document`. Rather than exposing package parts directly as the public
|
|
807
|
+
* API, it groups presentation, slides, layouts, masters, themes, relationships, media,
|
|
808
|
+
* and content types as OOXML source semantics. Upper layers such as core, editor-core,
|
|
809
|
+
* and pom may consume this package, but this package must not depend on them. Renderer
|
|
810
|
+
* output is produced by the core adapter, and PptxSourceModel does not know about it.
|
|
811
|
+
*
|
|
812
|
+
* This model is the source of truth for writer, editor, and round-trip workflows. It
|
|
813
|
+
* keeps source-local values, relationship ids, part paths, element ordering, typed
|
|
814
|
+
* PPTX-domain units, stable source handles, diagnostics, and raw preservation hooks.
|
|
815
|
+
* Unsupported OOXML, vendor extensions, mc:AlternateContent, and unsupported DrawingML
|
|
816
|
+
* are not mixed into the typed operation API. They are preserved as raw sidecars or raw
|
|
817
|
+
* package parts for structural round-tripping.
|
|
818
|
+
*
|
|
819
|
+
* PptxSourceModel must not include renderer-specific fallbacks, environment-specific
|
|
820
|
+
* font substitution, SVG/PNG output, pixel-output values, or pom authoring primitives.
|
|
821
|
+
* Slide/layout/master/theme cascades, relationship resolution, theme color resolution,
|
|
822
|
+
* placeholder and text style resolution, and similar effective values are derived from
|
|
823
|
+
* the source as a non-mutating computed view.
|
|
824
|
+
*/
|
|
825
|
+
|
|
826
|
+
interface PptxSourceModel {
|
|
827
|
+
/** Structure of package part / relationship / content type / media. */
|
|
828
|
+
readonly packageGraph: PackageGraph;
|
|
829
|
+
readonly presentation: SourcePresentation;
|
|
830
|
+
readonly slides: readonly SourceSlide[];
|
|
831
|
+
readonly slideLayouts: readonly SourceSlideLayout[];
|
|
832
|
+
readonly slideMasters: readonly SourceSlideMaster[];
|
|
833
|
+
readonly themes: readonly SourceTheme[];
|
|
834
|
+
/** Diagnostics about document correctness. */
|
|
835
|
+
readonly diagnostics: readonly Diagnostic[];
|
|
836
|
+
/** typed PptxSourceModel operation and dirty scope. The writer determines the minimum update range from this. */
|
|
837
|
+
readonly edits?: readonly PptxSourceModelEdit[];
|
|
838
|
+
}
|
|
839
|
+
type PptxSourceModelEdit = PptxSourceModelTextRunEdit | PptxSourceModelParagraphTextEdit | PptxSourceModelShapeTransformEdit;
|
|
840
|
+
interface PptxSourceModelTextRunEdit {
|
|
841
|
+
readonly kind: "replaceTextRunPlainText";
|
|
842
|
+
readonly handle: SourceHandle;
|
|
843
|
+
readonly text: string;
|
|
844
|
+
}
|
|
845
|
+
interface PptxSourceModelParagraphTextEdit {
|
|
846
|
+
readonly kind: "replaceParagraphPlainText";
|
|
847
|
+
readonly handle: SourceHandle;
|
|
848
|
+
readonly text: string;
|
|
849
|
+
}
|
|
850
|
+
interface PptxSourceModelShapeTransformEdit {
|
|
851
|
+
readonly kind: "updateShapeTransform";
|
|
852
|
+
readonly handle: SourceHandle;
|
|
853
|
+
readonly offsetX: Emu;
|
|
854
|
+
readonly offsetY: Emu;
|
|
855
|
+
readonly width: Emu;
|
|
856
|
+
readonly height: Emu;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* PptxSourceModel computed view types.
|
|
861
|
+
*
|
|
862
|
+
* This view derives effective document values from the slide / layout / master / theme
|
|
863
|
+
* cascade without mutating the source model. The source keeps each package part's
|
|
864
|
+
* authored state and raw preservation hooks, while this view deterministically resolves
|
|
865
|
+
* presentation order, slide size, the per-slide layout/master/theme chain, relationship
|
|
866
|
+
* targets, background fallback, theme color maps and schemes, placeholder matches, text
|
|
867
|
+
* style cascades, showMasterSp visibility, and computed element ordering.
|
|
868
|
+
*
|
|
869
|
+
* The computed view is a projection of document semantics, not an editable source of
|
|
870
|
+
* truth. It keeps the part path, source node, and source layer needed for source
|
|
871
|
+
* provenance and diagnostics, but it does not materialize renderer-contract-friendly
|
|
872
|
+
* required defaults or `null` fallbacks here. Chart XML type, series, categories,
|
|
873
|
+
* legend, and similar data are projected into parsed chart data as OOXML document
|
|
874
|
+
* semantics, while renderer-specific drawing completion and pixel layout decisions
|
|
875
|
+
* remain in the adapter / renderer.
|
|
876
|
+
*
|
|
877
|
+
* Renderer-specific pixel conversion, system font discovery, font fallback, text
|
|
878
|
+
* measurement / wrapping, text-to-path, SVG/PNG output decisions, and renderer warning
|
|
879
|
+
* policy remain the responsibility of the core adapter or renderer. Raw elements, raw
|
|
880
|
+
* fills, and raw backgrounds are kept for preservation and diagnostics, and the adapter
|
|
881
|
+
* decides direct rendering policy.
|
|
882
|
+
*/
|
|
883
|
+
|
|
884
|
+
interface CreateComputedViewOptions {
|
|
885
|
+
/** 1-based slide numbers. When omitted, all slides in presentation order are used. */
|
|
886
|
+
readonly slides?: readonly number[];
|
|
887
|
+
/** Applies `p:sld@showMasterSp` / `p:sldLayout@showMasterSp`. Defaults to true. */
|
|
888
|
+
readonly applyMasterVisibility?: boolean;
|
|
889
|
+
}
|
|
890
|
+
interface PptxComputedView {
|
|
891
|
+
readonly slideSize?: ComputedSlideSize;
|
|
892
|
+
readonly slides: readonly ComputedSlide[];
|
|
893
|
+
}
|
|
894
|
+
interface ComputedSlideSize {
|
|
895
|
+
readonly width: Emu;
|
|
896
|
+
readonly height: Emu;
|
|
897
|
+
}
|
|
898
|
+
interface ComputedSlide {
|
|
899
|
+
readonly slideNumber: number;
|
|
900
|
+
readonly partPath: PartPath;
|
|
901
|
+
readonly layoutPartPath?: PartPath;
|
|
902
|
+
readonly masterPartPath?: PartPath;
|
|
903
|
+
readonly themePartPath?: PartPath;
|
|
904
|
+
readonly slideSize?: ComputedSlideSize;
|
|
905
|
+
readonly relationships: readonly ComputedRelationship[];
|
|
906
|
+
readonly colorMap: Readonly<Record<string, string>>;
|
|
907
|
+
readonly colorScheme: Readonly<Record<string, string>>;
|
|
908
|
+
readonly background?: ComputedBackground;
|
|
909
|
+
readonly showMasterShapes: boolean;
|
|
910
|
+
readonly layoutShowMasterShapes: boolean;
|
|
911
|
+
readonly elements: readonly ComputedElement[];
|
|
912
|
+
}
|
|
913
|
+
interface ComputedRelationship {
|
|
914
|
+
readonly id: RelationshipId;
|
|
915
|
+
readonly type: string;
|
|
916
|
+
readonly source: Relationship;
|
|
917
|
+
readonly target: string;
|
|
918
|
+
readonly targetMode?: "Internal" | "External";
|
|
919
|
+
readonly targetPartPath?: PartPath;
|
|
920
|
+
readonly media?: MediaPart;
|
|
921
|
+
}
|
|
922
|
+
type ComputedElement = ComputedShapeElement | ComputedConnectorElement | ComputedGroupElement | ComputedImageElement | ComputedTableElement | ComputedChartElement | ComputedSmartArtElement | ComputedRawElement;
|
|
923
|
+
type ComputedElementLayer = "master" | "layout" | "slide";
|
|
924
|
+
interface ComputedElementBase {
|
|
925
|
+
readonly sourceLayer: ComputedElementLayer;
|
|
926
|
+
readonly sourcePartPath: PartPath;
|
|
927
|
+
readonly sourceNode: SourceShapeNode;
|
|
928
|
+
}
|
|
929
|
+
interface ComputedShapeElement extends ComputedElementBase {
|
|
930
|
+
readonly kind: "shape";
|
|
931
|
+
readonly sourceNode: SourceShape;
|
|
932
|
+
readonly transform?: SourceTransform;
|
|
933
|
+
readonly geometry?: SourceShape["geometry"];
|
|
934
|
+
readonly fill?: ComputedFill;
|
|
935
|
+
readonly outline?: ComputedOutline;
|
|
936
|
+
readonly effects?: ComputedEffectList;
|
|
937
|
+
readonly textBody?: ComputedTextBody;
|
|
938
|
+
readonly placeholderMatch?: ComputedPlaceholderMatch;
|
|
939
|
+
}
|
|
940
|
+
interface ComputedImageElement extends ComputedElementBase {
|
|
941
|
+
readonly kind: "image";
|
|
942
|
+
readonly sourceNode: SourceImage;
|
|
943
|
+
readonly transform?: SourceTransform;
|
|
944
|
+
readonly relationship?: ComputedRelationship;
|
|
945
|
+
readonly media?: MediaPart;
|
|
946
|
+
readonly effects?: ComputedEffectList;
|
|
947
|
+
readonly blipEffects?: ComputedBlipEffects;
|
|
948
|
+
}
|
|
949
|
+
interface ComputedConnectorElement extends ComputedElementBase {
|
|
950
|
+
readonly kind: "connector";
|
|
951
|
+
readonly sourceNode: SourceConnector;
|
|
952
|
+
readonly transform?: SourceTransform;
|
|
953
|
+
readonly geometry?: SourceConnector["geometry"];
|
|
954
|
+
readonly outline?: ComputedOutline;
|
|
955
|
+
readonly effects?: ComputedEffectList;
|
|
956
|
+
}
|
|
957
|
+
interface ComputedGroupElement extends ComputedElementBase {
|
|
958
|
+
readonly kind: "group";
|
|
959
|
+
readonly sourceNode: SourceGroup;
|
|
960
|
+
readonly transform?: SourceTransform;
|
|
961
|
+
readonly childTransform?: SourceTransform;
|
|
962
|
+
readonly fill?: ComputedFill;
|
|
963
|
+
readonly effects?: ComputedEffectList;
|
|
964
|
+
readonly children: readonly ComputedElement[];
|
|
965
|
+
}
|
|
966
|
+
interface ComputedTableElement extends ComputedElementBase {
|
|
967
|
+
readonly kind: "table";
|
|
968
|
+
readonly sourceNode: SourceTable;
|
|
969
|
+
readonly transform?: SourceTransform;
|
|
970
|
+
readonly table: ComputedTableData;
|
|
971
|
+
}
|
|
972
|
+
interface ComputedChartElement extends ComputedElementBase {
|
|
973
|
+
readonly kind: "chart";
|
|
974
|
+
readonly sourceNode: SourceChart;
|
|
975
|
+
readonly transform?: SourceTransform;
|
|
976
|
+
readonly relationship?: ComputedRelationship;
|
|
977
|
+
readonly chartXml?: string;
|
|
978
|
+
readonly chartData?: ComputedChartData;
|
|
979
|
+
}
|
|
980
|
+
type ComputedChartType = "bar" | "line" | "pie" | "doughnut" | "scatter" | "bubble" | "area" | "radar" | "stock" | "surface" | "ofPie";
|
|
981
|
+
interface ComputedChartData {
|
|
982
|
+
readonly chartType: ComputedChartType;
|
|
983
|
+
readonly title: string | null;
|
|
984
|
+
readonly series: readonly ComputedChartSeries[];
|
|
985
|
+
readonly categories: readonly string[];
|
|
986
|
+
readonly barDirection?: "col" | "bar";
|
|
987
|
+
readonly holeSize?: number;
|
|
988
|
+
readonly radarStyle?: "standard" | "marker" | "filled";
|
|
989
|
+
readonly ofPieType?: "pie" | "bar";
|
|
990
|
+
readonly secondPieSize?: number;
|
|
991
|
+
readonly splitPos?: number;
|
|
992
|
+
readonly legend: ComputedChartLegend | null;
|
|
993
|
+
}
|
|
994
|
+
interface ComputedChartSeries {
|
|
995
|
+
readonly name: string | null;
|
|
996
|
+
readonly values: readonly number[];
|
|
997
|
+
readonly xValues?: readonly number[];
|
|
998
|
+
readonly bubbleSizes?: readonly number[];
|
|
999
|
+
readonly color: ComputedColor;
|
|
1000
|
+
}
|
|
1001
|
+
interface ComputedChartLegend {
|
|
1002
|
+
readonly position: "b" | "t" | "l" | "r" | "tr";
|
|
1003
|
+
}
|
|
1004
|
+
interface ComputedSmartArtElement extends ComputedElementBase {
|
|
1005
|
+
readonly kind: "smartArt";
|
|
1006
|
+
readonly sourceNode: SourceSmartArt;
|
|
1007
|
+
readonly transform?: SourceTransform;
|
|
1008
|
+
readonly dataRelationship?: ComputedRelationship;
|
|
1009
|
+
readonly drawingRelationship?: ComputedRelationship;
|
|
1010
|
+
readonly drawingPartPath?: PartPath;
|
|
1011
|
+
readonly drawingXml?: string;
|
|
1012
|
+
readonly drawingRelationships: readonly ComputedRelationship[];
|
|
1013
|
+
readonly media: readonly MediaPart[];
|
|
1014
|
+
readonly diagramDrawing?: ComputedDiagramDrawing;
|
|
1015
|
+
}
|
|
1016
|
+
interface ComputedDiagramDrawing {
|
|
1017
|
+
readonly sourcePartPath: PartPath;
|
|
1018
|
+
readonly rawXml: string;
|
|
1019
|
+
readonly rawPart?: RawPackagePart;
|
|
1020
|
+
readonly rawHandle: {
|
|
1021
|
+
readonly partPath: PartPath;
|
|
1022
|
+
};
|
|
1023
|
+
readonly relationships: readonly ComputedRelationship[];
|
|
1024
|
+
readonly media: readonly MediaPart[];
|
|
1025
|
+
readonly childTransform?: SourceTransform;
|
|
1026
|
+
readonly children: readonly ComputedElement[];
|
|
1027
|
+
readonly diagnostics: readonly ComputedDiagramDrawingDiagnostic[];
|
|
1028
|
+
}
|
|
1029
|
+
interface ComputedDiagramDrawingDiagnostic {
|
|
1030
|
+
readonly severity: "warning";
|
|
1031
|
+
readonly code: "diagram-drawing-shape-tree-missing";
|
|
1032
|
+
readonly message: string;
|
|
1033
|
+
readonly sourcePartPath: PartPath;
|
|
1034
|
+
}
|
|
1035
|
+
interface ComputedTableData {
|
|
1036
|
+
readonly columns: readonly SourceTableColumn[];
|
|
1037
|
+
readonly rows: readonly ComputedTableRow[];
|
|
1038
|
+
}
|
|
1039
|
+
interface ComputedTableRow {
|
|
1040
|
+
readonly source: SourceTableRow;
|
|
1041
|
+
readonly height: SourceTableRow["height"];
|
|
1042
|
+
readonly cells: readonly ComputedTableCell[];
|
|
1043
|
+
}
|
|
1044
|
+
interface ComputedTableCell {
|
|
1045
|
+
readonly source: SourceTableCell;
|
|
1046
|
+
readonly textBody?: ComputedTextBody;
|
|
1047
|
+
readonly fill?: ComputedFill;
|
|
1048
|
+
readonly borders?: ComputedCellBorders;
|
|
1049
|
+
readonly gridSpan: number;
|
|
1050
|
+
readonly rowSpan: number;
|
|
1051
|
+
readonly hMerge: boolean;
|
|
1052
|
+
readonly vMerge: boolean;
|
|
1053
|
+
}
|
|
1054
|
+
type ComputedCellBorders = {
|
|
1055
|
+
readonly [K in keyof SourceCellBorders]?: ComputedOutline;
|
|
1056
|
+
};
|
|
1057
|
+
interface ComputedRawElement extends ComputedElementBase {
|
|
1058
|
+
readonly kind: "raw";
|
|
1059
|
+
readonly sourceNode: SourceRawShapeNode;
|
|
1060
|
+
}
|
|
1061
|
+
interface ComputedPlaceholderMatch {
|
|
1062
|
+
readonly layout?: SourceShape;
|
|
1063
|
+
readonly master?: SourceShape;
|
|
1064
|
+
}
|
|
1065
|
+
type ComputedBackground = {
|
|
1066
|
+
readonly kind: "fill";
|
|
1067
|
+
readonly source: SourceBackground;
|
|
1068
|
+
readonly fill: ComputedFill;
|
|
1069
|
+
readonly sourceLayer: ComputedElementLayer;
|
|
1070
|
+
} | {
|
|
1071
|
+
readonly kind: "styleReference";
|
|
1072
|
+
readonly source: SourceBackground;
|
|
1073
|
+
readonly index: number;
|
|
1074
|
+
readonly color?: ComputedColor;
|
|
1075
|
+
readonly sourceLayer: ComputedElementLayer;
|
|
1076
|
+
} | {
|
|
1077
|
+
readonly kind: "raw";
|
|
1078
|
+
readonly source: SourceBackground;
|
|
1079
|
+
readonly sourceLayer: ComputedElementLayer;
|
|
1080
|
+
};
|
|
1081
|
+
type ComputedFill = {
|
|
1082
|
+
readonly kind: "none";
|
|
1083
|
+
readonly source: SourceFill;
|
|
1084
|
+
} | {
|
|
1085
|
+
readonly kind: "solid";
|
|
1086
|
+
readonly source: SourceFill;
|
|
1087
|
+
readonly color: ComputedColor;
|
|
1088
|
+
} | {
|
|
1089
|
+
readonly kind: "gradient";
|
|
1090
|
+
readonly source: SourceFill;
|
|
1091
|
+
readonly stops: readonly ComputedGradientStop[];
|
|
1092
|
+
readonly gradientType: "linear" | "radial";
|
|
1093
|
+
readonly angle?: number;
|
|
1094
|
+
readonly centerX?: number;
|
|
1095
|
+
readonly centerY?: number;
|
|
1096
|
+
} | {
|
|
1097
|
+
readonly kind: "pattern";
|
|
1098
|
+
readonly source: SourceFill;
|
|
1099
|
+
readonly preset: string;
|
|
1100
|
+
readonly foregroundColor: ComputedColor;
|
|
1101
|
+
readonly backgroundColor: ComputedColor;
|
|
1102
|
+
} | {
|
|
1103
|
+
readonly kind: "image";
|
|
1104
|
+
readonly source: SourceFill;
|
|
1105
|
+
readonly relationship?: ComputedRelationship;
|
|
1106
|
+
readonly media?: MediaPart;
|
|
1107
|
+
readonly tile?: Extract<SourceFill, {
|
|
1108
|
+
readonly kind: "image";
|
|
1109
|
+
}>["tile"];
|
|
1110
|
+
} | {
|
|
1111
|
+
readonly kind: "raw";
|
|
1112
|
+
readonly source: SourceFill;
|
|
1113
|
+
};
|
|
1114
|
+
interface ComputedGradientStop {
|
|
1115
|
+
readonly position: number;
|
|
1116
|
+
readonly color: ComputedColor;
|
|
1117
|
+
}
|
|
1118
|
+
interface ComputedOutline {
|
|
1119
|
+
readonly width?: Emu;
|
|
1120
|
+
readonly fill?: ComputedFill;
|
|
1121
|
+
readonly source: SourceOutline;
|
|
1122
|
+
}
|
|
1123
|
+
interface ComputedEffectList {
|
|
1124
|
+
readonly source: SourceEffectList;
|
|
1125
|
+
readonly outerShadow?: ComputedOuterShadow;
|
|
1126
|
+
readonly innerShadow?: ComputedInnerShadow;
|
|
1127
|
+
readonly glow?: ComputedGlow;
|
|
1128
|
+
readonly softEdge?: SourceEffectList["softEdge"];
|
|
1129
|
+
}
|
|
1130
|
+
interface ComputedOuterShadow {
|
|
1131
|
+
readonly blurRadius: Emu;
|
|
1132
|
+
readonly distance: Emu;
|
|
1133
|
+
readonly direction: number;
|
|
1134
|
+
readonly color: ComputedColor;
|
|
1135
|
+
readonly alignment: SourceRectangleAlignment;
|
|
1136
|
+
readonly rotateWithShape: boolean;
|
|
1137
|
+
}
|
|
1138
|
+
interface ComputedInnerShadow {
|
|
1139
|
+
readonly blurRadius: Emu;
|
|
1140
|
+
readonly distance: Emu;
|
|
1141
|
+
readonly direction: number;
|
|
1142
|
+
readonly color: ComputedColor;
|
|
1143
|
+
}
|
|
1144
|
+
interface ComputedGlow {
|
|
1145
|
+
readonly radius: Emu;
|
|
1146
|
+
readonly color: ComputedColor;
|
|
1147
|
+
}
|
|
1148
|
+
interface ComputedBlipEffects {
|
|
1149
|
+
readonly source: SourceBlipEffects;
|
|
1150
|
+
readonly grayscale: boolean;
|
|
1151
|
+
readonly biLevel?: SourceBlipEffects["biLevel"];
|
|
1152
|
+
readonly blur?: SourceBlipEffects["blur"];
|
|
1153
|
+
readonly lum?: SourceBlipEffects["lum"];
|
|
1154
|
+
readonly duotone?: ComputedDuotoneEffect;
|
|
1155
|
+
readonly clrChange?: ComputedColorChangeEffect;
|
|
1156
|
+
}
|
|
1157
|
+
interface ComputedDuotoneEffect {
|
|
1158
|
+
readonly color1: ComputedColor;
|
|
1159
|
+
readonly color2: ComputedColor;
|
|
1160
|
+
}
|
|
1161
|
+
interface ComputedColorChangeEffect {
|
|
1162
|
+
readonly from: ComputedColor;
|
|
1163
|
+
readonly to: ComputedColor;
|
|
1164
|
+
}
|
|
1165
|
+
interface ComputedColor {
|
|
1166
|
+
/** `#rrggbb`. */
|
|
1167
|
+
readonly hex: string;
|
|
1168
|
+
/** Normalized opacity in the 0-1 range. */
|
|
1169
|
+
readonly alpha: number;
|
|
1170
|
+
}
|
|
1171
|
+
interface ComputedTextBody {
|
|
1172
|
+
readonly properties?: SourceTextBodyProperties;
|
|
1173
|
+
readonly paragraphs: readonly ComputedParagraph[];
|
|
1174
|
+
}
|
|
1175
|
+
interface ComputedParagraph {
|
|
1176
|
+
readonly properties?: ComputedParagraphProperties;
|
|
1177
|
+
readonly runs: readonly ComputedTextRun[];
|
|
1178
|
+
}
|
|
1179
|
+
interface ComputedParagraphProperties extends Omit<SourceParagraphProperties, "bulletColor" | "defaultRunProperties"> {
|
|
1180
|
+
readonly bulletColor?: ComputedColor;
|
|
1181
|
+
}
|
|
1182
|
+
interface ComputedTextRun {
|
|
1183
|
+
readonly text: string;
|
|
1184
|
+
readonly properties?: ComputedRunProperties;
|
|
1185
|
+
}
|
|
1186
|
+
type ComputedRunProperties = Omit<SourceRunProperties, "color"> & {
|
|
1187
|
+
readonly color?: ComputedColor;
|
|
1188
|
+
};
|
|
1189
|
+
|
|
1190
|
+
declare function createComputedView(source: PptxSourceModel, options?: CreateComputedViewOptions): PptxComputedView;
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* `readPptx(input)` - initial slice of the PptxSourceModel source reader.
|
|
1194
|
+
*
|
|
1195
|
+
* Reads the PPTX ZIP package, package graph (content types, relationships, and media),
|
|
1196
|
+
* and presentation metadata (slide size and slide order), then returns them as a
|
|
1197
|
+
* PptxSourceModel source. For each slide in presentation order, it follows the
|
|
1198
|
+
* slide -> layout -> master -> theme chain and reads simple shapes, text, and images as
|
|
1199
|
+
* typed source nodes. Unedited or unsupported parts and child elements are retained as
|
|
1200
|
+
* raw package material or raw sidecars and used as the basis for structural round-trip
|
|
1201
|
+
* preservation.
|
|
1202
|
+
*
|
|
1203
|
+
* Slide, layout, master, and theme parts that contain typed nodes also keep their
|
|
1204
|
+
* original bytes through `packageGraph.rawParts` for writeback when the part is
|
|
1205
|
+
* untouched. The typed model is for editing and computed views; the raw part is for
|
|
1206
|
+
* round-tripping.
|
|
1207
|
+
*
|
|
1208
|
+
* Computed view generation and writer output are responsibilities of modules separate from the reader.
|
|
1209
|
+
*/
|
|
1210
|
+
|
|
1211
|
+
/** Input bytes for `readPptx`. */
|
|
1212
|
+
type ReadPptxInput = Uint8Array;
|
|
1213
|
+
/**
|
|
1214
|
+
* Reads a PPTX byte string and returns a PptxSourceModel source.
|
|
1215
|
+
*
|
|
1216
|
+
* @throws If presentation part is not found (= not a valid PPTX).
|
|
1217
|
+
*/
|
|
1218
|
+
declare function readPptx(input: ReadPptxInput): PptxSourceModel;
|
|
1219
|
+
|
|
1220
|
+
/**
|
|
1221
|
+
* `writePptx(source)` - the first round-trip slice of the PptxSourceModel source writer.
|
|
1222
|
+
*
|
|
1223
|
+
* The writer targets structural round-trip preservation rather than byte equality. It is
|
|
1224
|
+
* not a package patcher that preserves XML attribute order, namespace prefix placement,
|
|
1225
|
+
* ZIP metadata, or defaulted OOXML values. Content types and relationships are
|
|
1226
|
+
* regenerated structurally from `packageGraph`; media bytes, unknown parts, and
|
|
1227
|
+
* non-bookkeeping raw parts prefer the raw package material preserved by the reader.
|
|
1228
|
+
* Only dirty scopes are updated according to supported PptxSourceModel operations.
|
|
1229
|
+
*
|
|
1230
|
+
* The current slice supports plain text-run replacement and top-level shape transform
|
|
1231
|
+
* offset/extent edits, reserializing dirty slide XML parts and replacing only the
|
|
1232
|
+
* targeted values via stable source handles.
|
|
1233
|
+
* Node-level XML splicing, precise unsupported raw-sidecar invalidation, and package
|
|
1234
|
+
* topology rewrites belong to later writer slices, but the API and dirty-scope tracking
|
|
1235
|
+
* remain shaped for that extension path.
|
|
1236
|
+
*/
|
|
1237
|
+
|
|
1238
|
+
/** `writePptx` output. */
|
|
1239
|
+
type WritePptxOutput = Uint8Array;
|
|
1240
|
+
/**
|
|
1241
|
+
* Writes a PptxSourceModel source back to PPTX package bytes.
|
|
1242
|
+
*
|
|
1243
|
+
* This initial round-trip writer prefers unedited package material
|
|
1244
|
+
* to create preserved output. If the raw bytes needed to patch a dirty part are unavailable, or
|
|
1245
|
+
* a non-bookkeeping part lacks required raw bytes,
|
|
1246
|
+
* it throws instead of regenerating content implicitly.
|
|
1247
|
+
*/
|
|
1248
|
+
declare function writePptx(source: PptxSourceModel): WritePptxOutput;
|
|
1249
|
+
|
|
1250
|
+
export { type ComputedBackground, type ComputedBlipEffects, type ComputedCellBorders, type ComputedChartData, type ComputedChartElement, type ComputedChartLegend, type ComputedChartSeries, type ComputedChartType, type ComputedColor, type ComputedColorChangeEffect, type ComputedConnectorElement, type ComputedDiagramDrawing, type ComputedDiagramDrawingDiagnostic, type ComputedDuotoneEffect, type ComputedEffectList, type ComputedElement, type ComputedElementLayer, type ComputedFill, type ComputedGroupElement, type ComputedImageElement, type ComputedOutline, type ComputedParagraph, type ComputedPlaceholderMatch, type ComputedRawElement, type ComputedRelationship, type ComputedRunProperties, type ComputedShapeElement, type ComputedSlide, type ComputedSlideSize, type ComputedSmartArtElement, type ComputedTableCell, type ComputedTableData, type ComputedTableElement, type ComputedTableRow, type ComputedTextBody, type ComputedTextRun, type ContentTypeDefault, type ContentTypeOverride, type ContentTypes, type CreateComputedViewOptions, type Diagnostic, type DiagnosticSeverity, type Emu, type HundredthPt, type MediaPart, type OoxmlAngle, type OoxmlPercent, type PackageGraph, type PackagePartRef, type PartPath, type PartRelationships, type PptxComputedView, type PptxSourceModel, type PptxSourceModelEdit, type PptxSourceModelParagraphTextEdit, type PptxSourceModelShapeTransformEdit, type PptxSourceModelTextRunEdit, type Pt, type RawOoxmlNode, type RawPackagePart, type RawSidecar, type RawSidecarId, type ReadPptxInput, type Relationship, type RelationshipId, type RelationshipTargetMode, type SlideSize, type SourceArrowEndpoint, type SourceArrowSize, type SourceArrowType, type SourceAutoNumScheme, type SourceBackground, type SourceBiLevelEffect, type SourceBlipEffects, type SourceBlurEffect, type SourceBulletType, type SourceCellBorders, type SourceChart, type SourceColor, type SourceColorChangeEffect, type SourceColorMap, type SourceColorTransform, type SourceConnector, type SourceCustomGeometry, type SourceCustomGeometryPath, type SourceDashStyle, type SourceDuotoneEffect, type SourceEffectList, type SourceFill, type SourceGeometry, type SourceGlow, type SourceGradient, type SourceGradientStop, type SourceGroup, type SourceHandle, type SourceImage, type SourceImageCrop, type SourceImageFillTile, type SourceImageStretch, type SourceInnerShadow, type SourceLineCap, type SourceLineJoin, type SourceLumEffect, type SourceMasterTextStyles, type SourceNodeId, type SourceOuterShadow, type SourceOutline, type SourceParagraph, type SourceParagraphProperties, type SourcePlaceholder, type SourcePresentation, type SourcePresetGeometry, type SourceRawShapeNode, type SourceRectangleAlignment, type SourceRunProperties, type SourceShape, type SourceShapeNode, type SourceShapeStyle, type SourceSlide, type SourceSlideLayout, type SourceSlideMaster, type SourceSmartArt, type SourceSoftEdge, type SourceSpacingValue, type SourceStyleReference, type SourceTabStop, type SourceTable, type SourceTableCell, type SourceTableColumn, type SourceTableData, type SourceTableRow, type SourceTextAlign, type SourceTextAutoFit, type SourceTextBody, type SourceTextBodyProperties, type SourceTextRun, type SourceTextStyle, type SourceTextVerticalType, type SourceTextWrap, type SourceTheme, type SourceThemeColorScheme, type SourceThemeFontScheme, type SourceThemeFormatScheme, type SourceTransform, type SourceVerticalAnchor, type UpdateShapeTransformInput, type WritePptxOutput, asEmu, asHundredthPt, asOoxmlAngle, asOoxmlPercent, asPartPath, asPt, asRawSidecarId, asRelationshipId, asSourceNodeId, createComputedView, findParagraphBySourceHandle, findShapeNodeBySourceHandle, findTextRunBySourceHandle, readPptx, replaceParagraphPlainText, replaceTextRunPlainText, updateShapeTransform, writePptx };
|