pptx-glimpse 3.0.0 → 3.1.1
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/dist/browser.cjs +5249 -2845
- package/dist/browser.d.cts +77 -8
- package/dist/browser.d.ts +77 -8
- package/dist/browser.js +486 -23
- package/dist/chunk-3UFL5U77.js +83 -0
- package/dist/chunk-5YFLSUKM.js +141 -0
- package/dist/{chunk-KMSN55AE.js → chunk-AQ35JYTB.js} +3351 -1548
- package/dist/{chunk-2AYNMYMC.js → chunk-PGCREQQU.js} +134 -113
- package/dist/{chunk-MWMHSSAD.js → chunk-WAMKNW47.js} +4 -3
- package/dist/cli.cjs +11247 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +195 -0
- package/dist/font-collector-BYuaCG-o.d.cts +547 -0
- package/dist/font-collector-BYuaCG-o.d.ts +547 -0
- package/dist/index.cjs +1962 -1739
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +12 -76
- package/dist/{node-6KTAWUIB.js → node-E6UXPQSQ.js} +2 -2
- package/dist/{node-font-loader-274G445U.js → node-font-loader-OE3OLNDI.js} +2 -2
- package/package.json +8 -5
- package/dist/font-collector-DYooJP6L.d.cts +0 -1345
- package/dist/font-collector-DYooJP6L.d.ts +0 -1345
|
@@ -1,1345 +0,0 @@
|
|
|
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
|
-
/**
|
|
31
|
-
* Stable handle describing a source node's provenance. The writer uses the handle to decide whether a generated
|
|
32
|
-
* node can be spliced into an existing part or whether a broader scope must be regenerated.
|
|
33
|
-
*
|
|
34
|
-
*/
|
|
35
|
-
interface SourceHandle {
|
|
36
|
-
/** Package part that owns this node. */
|
|
37
|
-
readonly partPath: PartPath;
|
|
38
|
-
/** Node id inside the part (when available). */
|
|
39
|
-
readonly nodeId?: SourceNodeId;
|
|
40
|
-
/** The relationship id referencing this node (e.g. `r:embed` in blip). */
|
|
41
|
-
readonly relationshipId?: RelationshipId;
|
|
42
|
-
/** The child's order slot within the parent element. Used to restore order with raw sidecar. */
|
|
43
|
-
readonly orderingSlot?: number;
|
|
44
|
-
/** Raw sidecar ids associated with this node. */
|
|
45
|
-
readonly rawSidecarIds?: readonly RawSidecarId[];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Diagnostics type. Document correctness (round-trip / preservation / reference resolution)
|
|
50
|
-
* and are not warnings about rendering fidelity or UI behavior.
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
type DiagnosticSeverity = "info" | "warning" | "error";
|
|
54
|
-
interface Diagnostic {
|
|
55
|
-
readonly severity: DiagnosticSeverity;
|
|
56
|
-
/** Stable machine-readable code (Example: `unsupported-node-dropped`). */
|
|
57
|
-
readonly code: string;
|
|
58
|
-
readonly message: string;
|
|
59
|
-
/** The source node from which the diagnosis originates, if it can be determined. */
|
|
60
|
-
readonly handle?: SourceHandle;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Types for the raw OOXML escape hatch.
|
|
65
|
-
*
|
|
66
|
-
* PptxSourceModel represents supported semantics as typed fields, while preserving
|
|
67
|
-
* unsupported or partially supported XML as raw sidecars and unedited parts as raw
|
|
68
|
-
* package parts. This enables structural round-tripping; byte equality is not a goal.
|
|
69
|
-
*/
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Partially parsed raw OOXML node. It preserves the namespace-prefixed qualified name,
|
|
73
|
-
* attributes, child nodes, and text for elements that PptxSourceModel does not represent
|
|
74
|
-
* as typed fields, such as vendor extensions, `mc:AlternateContent`, and unknown
|
|
75
|
-
* DrawingML.
|
|
76
|
-
*/
|
|
77
|
-
interface RawOoxmlNode {
|
|
78
|
-
/** Element name including the namespace prefix (Example: `a:extLst`). */
|
|
79
|
-
readonly name: string;
|
|
80
|
-
readonly attributes?: Readonly<Record<string, string>>;
|
|
81
|
-
readonly children?: readonly RawOoxmlNode[];
|
|
82
|
-
/** Element text content (when present). */
|
|
83
|
-
readonly text?: string;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Raw XML sidecar associated with a PptxSourceModel source node. It is attached to the nearest source node
|
|
87
|
-
* and keeps ordering metadata within the parent element to restore order during write-back.
|
|
88
|
-
*/
|
|
89
|
-
interface RawSidecar {
|
|
90
|
-
readonly id: RawSidecarId;
|
|
91
|
-
readonly node: RawOoxmlNode;
|
|
92
|
-
/** Ordering slot within the owning element's child sequence. */
|
|
93
|
-
readonly orderingSlot?: number;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Raw fallback for writing an unedited package part back as-is. It keeps either bytes
|
|
97
|
-
* for binary assets or an XML tree as a discriminated union. The type rules out invalid
|
|
98
|
-
* states with both or neither representation.
|
|
99
|
-
*/
|
|
100
|
-
type RawPackagePart = {
|
|
101
|
-
readonly kind: "binary";
|
|
102
|
-
readonly partPath: PartPath;
|
|
103
|
-
readonly contentType: string;
|
|
104
|
-
/** Original byte string of binary part (image, embedded workbook, etc.). */
|
|
105
|
-
readonly bytes: Uint8Array;
|
|
106
|
-
} | {
|
|
107
|
-
readonly kind: "xml";
|
|
108
|
-
readonly partPath: PartPath;
|
|
109
|
-
readonly contentType: string;
|
|
110
|
-
/** The root node when storing the XML part as a tree. */
|
|
111
|
-
readonly xml: RawOoxmlNode;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Package graph type. package part / relationship / content type / media
|
|
116
|
-
* Represented as source-model data.
|
|
117
|
-
*/
|
|
118
|
-
|
|
119
|
-
/** target mode of relationship. */
|
|
120
|
-
type RelationshipTargetMode = "Internal" | "External";
|
|
121
|
-
/** 1 entry in `_rels/*.rels`. */
|
|
122
|
-
interface Relationship {
|
|
123
|
-
readonly id: RelationshipId;
|
|
124
|
-
/** relationship type URI. */
|
|
125
|
-
readonly type: string;
|
|
126
|
-
/** Target relative to sourcePartPath, or an external URL. */
|
|
127
|
-
readonly target: string;
|
|
128
|
-
readonly targetMode?: RelationshipTargetMode;
|
|
129
|
-
}
|
|
130
|
-
/** Relationships owned by a source part (`<part>/_rels/<part>.rels`). */
|
|
131
|
-
interface PartRelationships {
|
|
132
|
-
readonly sourcePartPath: PartPath;
|
|
133
|
-
readonly relationships: readonly Relationship[];
|
|
134
|
-
}
|
|
135
|
-
/** Default entry in `[Content_Types].xml` (extension -> content type). */
|
|
136
|
-
interface ContentTypeDefault {
|
|
137
|
-
readonly extension: string;
|
|
138
|
-
readonly contentType: string;
|
|
139
|
-
}
|
|
140
|
-
/** Override entry (part name -> content type) in `[Content_Types].xml`. */
|
|
141
|
-
interface ContentTypeOverride {
|
|
142
|
-
readonly partName: PartPath;
|
|
143
|
-
readonly contentType: string;
|
|
144
|
-
}
|
|
145
|
-
interface ContentTypes {
|
|
146
|
-
readonly defaults: readonly ContentTypeDefault[];
|
|
147
|
-
readonly overrides: readonly ContentTypeOverride[];
|
|
148
|
-
}
|
|
149
|
-
/** Package part reference (path + content type). */
|
|
150
|
-
interface PackagePartRef {
|
|
151
|
-
readonly partPath: PartPath;
|
|
152
|
-
readonly contentType: string;
|
|
153
|
-
}
|
|
154
|
-
/** Part of a media asset (image, audio, video, etc.). Keep bytes as is. */
|
|
155
|
-
interface MediaPart {
|
|
156
|
-
readonly partPath: PartPath;
|
|
157
|
-
readonly contentType: string;
|
|
158
|
-
readonly bytes: Uint8Array;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* The overall structure of the package. content types / part list / relationship by part /
|
|
162
|
-
* media, and retain the raw fallback of the unedited part.
|
|
163
|
-
*/
|
|
164
|
-
interface PackageGraph {
|
|
165
|
-
readonly contentTypes: ContentTypes;
|
|
166
|
-
readonly parts: readonly PackagePartRef[];
|
|
167
|
-
readonly relationships: readonly PartRelationships[];
|
|
168
|
-
readonly media: readonly MediaPart[];
|
|
169
|
-
/** Raw fallback for writing back parts that are not typed / were not edited. */
|
|
170
|
-
readonly rawParts?: readonly RawPackagePart[];
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* PptxSourceModel PPTX-native typed units used by source model.
|
|
175
|
-
*
|
|
176
|
-
* The source model does not perform pixel conversion and keeps the units defined by OOXML
|
|
177
|
-
* Hold as a type. The unit type on the renderer side (`@pptx-glimpse/renderer`) is
|
|
178
|
-
* the lower-level foundation `@pptx-glimpse/document` cannot reference, so this module
|
|
179
|
-
* Define branded types independently. Zero runtime cost (JS output is
|
|
180
|
-
* (same as plain number).
|
|
181
|
-
*/
|
|
182
|
-
declare const EmuBrand: unique symbol;
|
|
183
|
-
declare const PtBrand: unique symbol;
|
|
184
|
-
declare const HundredthPtBrand: unique symbol;
|
|
185
|
-
declare const OoxmlPercentBrand: unique symbol;
|
|
186
|
-
declare const OoxmlAngleBrand: unique symbol;
|
|
187
|
-
/** English Metric Units (1 inch = 914,400 EMU). Used for coordinates and size. */
|
|
188
|
-
type Emu = number & {
|
|
189
|
-
readonly [EmuBrand]: typeof EmuBrand;
|
|
190
|
-
};
|
|
191
|
-
/** points (1 pt = 1/72 inch).font size. */
|
|
192
|
-
type Pt = number & {
|
|
193
|
-
readonly [PtBrand]: typeof PtBrand;
|
|
194
|
-
};
|
|
195
|
-
/** 1/100 point (ECMA-376 `a:spcPts` etc.). */
|
|
196
|
-
type HundredthPt = number & {
|
|
197
|
-
readonly [HundredthPtBrand]: typeof HundredthPtBrand;
|
|
198
|
-
};
|
|
199
|
-
/**
|
|
200
|
-
* OOXML percentage (ST_Percentage).Integer value where 1% = 1000.
|
|
201
|
-
* `a:spcPct` / `a:lumMod` / `a:tint` and similar transforms.
|
|
202
|
-
*/
|
|
203
|
-
type OoxmlPercent = number & {
|
|
204
|
-
readonly [OoxmlPercentBrand]: typeof OoxmlPercentBrand;
|
|
205
|
-
};
|
|
206
|
-
/**
|
|
207
|
-
* OOXML angle (ST_Angle).1 degree = 60,000.`a:xfrm@rot` and similar fields.
|
|
208
|
-
*/
|
|
209
|
-
type OoxmlAngle = number & {
|
|
210
|
-
readonly [OoxmlAngleBrand]: typeof OoxmlAngleBrand;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Source node types for simple shapes, text runs, and images.
|
|
215
|
-
*
|
|
216
|
-
* The current supported drawing subset, centered on simple shapes, text, and images, is
|
|
217
|
-
* represented as typed nodes. Theme colors and relationships stay as unresolved source
|
|
218
|
-
* references, and cascade resolution is handled by the computed view. Unsupported nodes
|
|
219
|
-
* are preserved through the raw escape hatch.
|
|
220
|
-
*/
|
|
221
|
-
|
|
222
|
-
/** Source transform from `a:xfrm`. Keep the coordinates and size as EMU. */
|
|
223
|
-
interface SourceTransform {
|
|
224
|
-
readonly offsetX: Emu;
|
|
225
|
-
readonly offsetY: Emu;
|
|
226
|
-
readonly width: Emu;
|
|
227
|
-
readonly height: Emu;
|
|
228
|
-
readonly rotation?: OoxmlAngle;
|
|
229
|
-
readonly flipHorizontal?: boolean;
|
|
230
|
-
readonly flipVertical?: boolean;
|
|
231
|
-
}
|
|
232
|
-
/** Source reference for preset geometry (`a:prstGeom`). Keep only the preset name. */
|
|
233
|
-
interface SourcePresetGeometry {
|
|
234
|
-
/** Preset name (Example: `rect`, `roundRect`). */
|
|
235
|
-
readonly preset: string;
|
|
236
|
-
readonly adjustValues?: Readonly<Record<string, number>>;
|
|
237
|
-
}
|
|
238
|
-
interface SourceCustomGeometryPath {
|
|
239
|
-
readonly width: number;
|
|
240
|
-
readonly height: number;
|
|
241
|
-
readonly commands: string;
|
|
242
|
-
}
|
|
243
|
-
interface SourceCustomGeometry {
|
|
244
|
-
readonly kind: "custom";
|
|
245
|
-
readonly paths: readonly SourceCustomGeometryPath[];
|
|
246
|
-
}
|
|
247
|
-
type SourceGeometry = SourcePresetGeometry | SourceCustomGeometry;
|
|
248
|
-
/**
|
|
249
|
-
* Unresolved source color reference. `schemeClr` keeps the scheme name and resolves to a
|
|
250
|
-
* concrete color through `clrMap` / `colorScheme` in the computed view. `srgbClr` and
|
|
251
|
-
* `sysClr` hold concrete values, but transformations such as lumMod are kept unapplied.
|
|
252
|
-
*/
|
|
253
|
-
type SourceColor = {
|
|
254
|
-
readonly kind: "srgb";
|
|
255
|
-
readonly hex: string;
|
|
256
|
-
readonly transforms?: readonly SourceColorTransform[];
|
|
257
|
-
} | {
|
|
258
|
-
readonly kind: "scheme";
|
|
259
|
-
readonly scheme: string;
|
|
260
|
-
readonly transforms?: readonly SourceColorTransform[];
|
|
261
|
-
} | {
|
|
262
|
-
readonly kind: "system";
|
|
263
|
-
/** `a:sysClr@val` (Example: `windowText`). */
|
|
264
|
-
readonly value: string;
|
|
265
|
-
/** Resolved fallback hex for `a:sysClr@lastClr`, when present. */
|
|
266
|
-
readonly lastColor?: string;
|
|
267
|
-
readonly transforms?: readonly SourceColorTransform[];
|
|
268
|
-
};
|
|
269
|
-
/** Color conversions such as lumMod / tint / shade (values are OOXML percentages). */
|
|
270
|
-
interface SourceColorTransform {
|
|
271
|
-
readonly kind: "lumMod" | "lumOff" | "tint" | "shade" | "alpha";
|
|
272
|
-
readonly value: OoxmlPercent;
|
|
273
|
-
}
|
|
274
|
-
/** shape fill (source level, minimum). Unsupported fills are saved as raw. */
|
|
275
|
-
type SourceFill = {
|
|
276
|
-
readonly kind: "none";
|
|
277
|
-
} | {
|
|
278
|
-
readonly kind: "solid";
|
|
279
|
-
readonly color: SourceColor;
|
|
280
|
-
} | ({
|
|
281
|
-
readonly kind: "gradient";
|
|
282
|
-
readonly stops: readonly SourceGradientStop[];
|
|
283
|
-
} & SourceGradient) | {
|
|
284
|
-
readonly kind: "pattern";
|
|
285
|
-
readonly preset: string;
|
|
286
|
-
readonly foregroundColor: SourceColor;
|
|
287
|
-
readonly backgroundColor: SourceColor;
|
|
288
|
-
} | {
|
|
289
|
-
readonly kind: "image";
|
|
290
|
-
readonly blipRelationshipId?: RelationshipId;
|
|
291
|
-
readonly tile?: SourceImageFillTile;
|
|
292
|
-
} | {
|
|
293
|
-
readonly kind: "raw";
|
|
294
|
-
readonly raw: RawSidecar;
|
|
295
|
-
};
|
|
296
|
-
interface SourceGradientStop {
|
|
297
|
-
readonly position: number;
|
|
298
|
-
readonly color: SourceColor;
|
|
299
|
-
}
|
|
300
|
-
type SourceGradient = {
|
|
301
|
-
readonly gradientType: "linear";
|
|
302
|
-
readonly angle: OoxmlAngle;
|
|
303
|
-
} | {
|
|
304
|
-
readonly gradientType: "radial";
|
|
305
|
-
readonly centerX: number;
|
|
306
|
-
readonly centerY: number;
|
|
307
|
-
};
|
|
308
|
-
type SourceRectangleAlignment = "tl" | "t" | "tr" | "l" | "ctr" | "r" | "bl" | "b" | "br";
|
|
309
|
-
interface SourceImageFillTile {
|
|
310
|
-
readonly tx: Emu;
|
|
311
|
-
readonly ty: Emu;
|
|
312
|
-
readonly sx: number;
|
|
313
|
-
readonly sy: number;
|
|
314
|
-
readonly flip: "none" | "x" | "y" | "xy";
|
|
315
|
-
readonly align: SourceRectangleAlignment;
|
|
316
|
-
}
|
|
317
|
-
interface SourceStyleReference {
|
|
318
|
-
readonly index: number;
|
|
319
|
-
readonly color?: SourceColor;
|
|
320
|
-
}
|
|
321
|
-
interface SourceShapeStyle {
|
|
322
|
-
readonly fillRef?: SourceStyleReference;
|
|
323
|
-
readonly lineRef?: SourceStyleReference;
|
|
324
|
-
readonly effectRef?: SourceStyleReference;
|
|
325
|
-
}
|
|
326
|
-
interface SourceEffectList {
|
|
327
|
-
readonly outerShadow?: SourceOuterShadow;
|
|
328
|
-
readonly innerShadow?: SourceInnerShadow;
|
|
329
|
-
readonly glow?: SourceGlow;
|
|
330
|
-
readonly softEdge?: SourceSoftEdge;
|
|
331
|
-
}
|
|
332
|
-
interface SourceOuterShadow {
|
|
333
|
-
readonly blurRadius: Emu;
|
|
334
|
-
readonly distance: Emu;
|
|
335
|
-
readonly direction: OoxmlAngle;
|
|
336
|
-
readonly color: SourceColor;
|
|
337
|
-
readonly alignment: SourceRectangleAlignment;
|
|
338
|
-
readonly rotateWithShape: boolean;
|
|
339
|
-
}
|
|
340
|
-
interface SourceInnerShadow {
|
|
341
|
-
readonly blurRadius: Emu;
|
|
342
|
-
readonly distance: Emu;
|
|
343
|
-
readonly direction: OoxmlAngle;
|
|
344
|
-
readonly color: SourceColor;
|
|
345
|
-
}
|
|
346
|
-
interface SourceGlow {
|
|
347
|
-
readonly radius: Emu;
|
|
348
|
-
readonly color: SourceColor;
|
|
349
|
-
}
|
|
350
|
-
interface SourceSoftEdge {
|
|
351
|
-
readonly radius: Emu;
|
|
352
|
-
}
|
|
353
|
-
interface SourceBlipEffects {
|
|
354
|
-
readonly grayscale: boolean;
|
|
355
|
-
readonly biLevel?: SourceBiLevelEffect;
|
|
356
|
-
readonly blur?: SourceBlurEffect;
|
|
357
|
-
readonly lum?: SourceLumEffect;
|
|
358
|
-
readonly duotone?: SourceDuotoneEffect;
|
|
359
|
-
readonly clrChange?: SourceColorChangeEffect;
|
|
360
|
-
}
|
|
361
|
-
interface SourceBiLevelEffect {
|
|
362
|
-
readonly threshold: number;
|
|
363
|
-
}
|
|
364
|
-
interface SourceBlurEffect {
|
|
365
|
-
readonly radius: Emu;
|
|
366
|
-
readonly grow: boolean;
|
|
367
|
-
}
|
|
368
|
-
interface SourceLumEffect {
|
|
369
|
-
readonly brightness: number;
|
|
370
|
-
readonly contrast: number;
|
|
371
|
-
}
|
|
372
|
-
interface SourceDuotoneEffect {
|
|
373
|
-
readonly color1: SourceColor;
|
|
374
|
-
readonly color2: SourceColor;
|
|
375
|
-
}
|
|
376
|
-
interface SourceColorChangeEffect {
|
|
377
|
-
readonly from: SourceColor;
|
|
378
|
-
readonly to: SourceColor;
|
|
379
|
-
}
|
|
380
|
-
/** simple solid line outline (`a:ln`). Minimal representation of color and width only. */
|
|
381
|
-
interface SourceOutline {
|
|
382
|
-
readonly width?: Emu;
|
|
383
|
-
readonly fill?: SourceFill;
|
|
384
|
-
readonly dashStyle?: SourceDashStyle;
|
|
385
|
-
readonly customDash?: readonly number[];
|
|
386
|
-
readonly lineCap?: SourceLineCap;
|
|
387
|
-
readonly lineJoin?: SourceLineJoin;
|
|
388
|
-
readonly headEnd?: SourceArrowEndpoint;
|
|
389
|
-
readonly tailEnd?: SourceArrowEndpoint;
|
|
390
|
-
}
|
|
391
|
-
type SourceArrowType = "triangle" | "stealth" | "diamond" | "oval" | "arrow";
|
|
392
|
-
type SourceArrowSize = "sm" | "med" | "lg";
|
|
393
|
-
interface SourceArrowEndpoint {
|
|
394
|
-
readonly type: SourceArrowType;
|
|
395
|
-
readonly width: SourceArrowSize;
|
|
396
|
-
readonly length: SourceArrowSize;
|
|
397
|
-
}
|
|
398
|
-
type SourceDashStyle = "solid" | "dash" | "dot" | "dashDot" | "lgDash" | "lgDashDot" | "sysDash" | "sysDot";
|
|
399
|
-
type SourceLineCap = "butt" | "round" | "square";
|
|
400
|
-
type SourceLineJoin = "miter" | "round" | "bevel";
|
|
401
|
-
/** placeholder declaration (`p:ph`). Keep type / idx unresolved. */
|
|
402
|
-
interface SourcePlaceholder {
|
|
403
|
-
readonly type?: string;
|
|
404
|
-
readonly index?: number;
|
|
405
|
-
}
|
|
406
|
-
/** Minimal subset of run properties (`a:rPr`) of text run (`a:r`). */
|
|
407
|
-
interface SourceRunProperties {
|
|
408
|
-
readonly bold?: boolean;
|
|
409
|
-
readonly italic?: boolean;
|
|
410
|
-
readonly underline?: boolean;
|
|
411
|
-
readonly strikethrough?: boolean;
|
|
412
|
-
readonly baseline?: number;
|
|
413
|
-
/** Font size. Stored as pt in the OOXML domain. */
|
|
414
|
-
readonly fontSize?: Pt;
|
|
415
|
-
/** latin typeface name (kept unresolved including theme token). */
|
|
416
|
-
readonly typeface?: string;
|
|
417
|
-
/** East Asian typeface name (kept unresolved including theme token). */
|
|
418
|
-
readonly typefaceEa?: string;
|
|
419
|
-
/** Complex script typeface name (kept unresolved including theme token). */
|
|
420
|
-
readonly typefaceCs?: string;
|
|
421
|
-
readonly color?: SourceColor;
|
|
422
|
-
}
|
|
423
|
-
type SourceAutoNumScheme = "arabicPeriod" | "arabicParenR" | "romanUcPeriod" | "romanLcPeriod" | "alphaUcPeriod" | "alphaLcPeriod" | "alphaLcParenR" | "alphaUcParenR" | "arabicPlain";
|
|
424
|
-
type SourceBulletType = {
|
|
425
|
-
readonly type: "none";
|
|
426
|
-
} | {
|
|
427
|
-
readonly type: "char";
|
|
428
|
-
readonly char: string;
|
|
429
|
-
} | {
|
|
430
|
-
readonly type: "autoNum";
|
|
431
|
-
readonly scheme: SourceAutoNumScheme;
|
|
432
|
-
readonly startAt: number;
|
|
433
|
-
};
|
|
434
|
-
type SourceSpacingValue = {
|
|
435
|
-
readonly type: "pts";
|
|
436
|
-
readonly value: HundredthPt;
|
|
437
|
-
} | {
|
|
438
|
-
readonly type: "pct";
|
|
439
|
-
readonly value: number;
|
|
440
|
-
};
|
|
441
|
-
/** text run (`a:r`). */
|
|
442
|
-
interface SourceTextRun {
|
|
443
|
-
readonly kind: "textRun";
|
|
444
|
-
readonly text: string;
|
|
445
|
-
readonly properties?: SourceRunProperties;
|
|
446
|
-
readonly handle?: SourceHandle;
|
|
447
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
448
|
-
}
|
|
449
|
-
type SourceTextAlign = "left" | "center" | "right" | "justify";
|
|
450
|
-
interface SourceTabStop {
|
|
451
|
-
readonly position: Emu;
|
|
452
|
-
readonly alignment: "l" | "ctr" | "r" | "dec";
|
|
453
|
-
}
|
|
454
|
-
/** Minimum subset of paragraph properties (`a:pPr`) of paragraph (`a:p`). */
|
|
455
|
-
interface SourceParagraphProperties {
|
|
456
|
-
readonly align?: SourceTextAlign;
|
|
457
|
-
/** Indentation level (`a:pPr@lvl`). */
|
|
458
|
-
readonly level?: number;
|
|
459
|
-
readonly lineSpacing?: SourceSpacingValue;
|
|
460
|
-
readonly spaceBefore?: SourceSpacingValue;
|
|
461
|
-
readonly spaceAfter?: SourceSpacingValue;
|
|
462
|
-
readonly marginLeft?: Emu;
|
|
463
|
-
readonly indent?: Emu;
|
|
464
|
-
readonly bullet?: SourceBulletType;
|
|
465
|
-
readonly bulletFont?: string;
|
|
466
|
-
readonly bulletColor?: SourceColor;
|
|
467
|
-
readonly bulletSizePct?: number;
|
|
468
|
-
readonly tabStops?: readonly SourceTabStop[];
|
|
469
|
-
readonly defaultRunProperties?: SourceRunProperties;
|
|
470
|
-
}
|
|
471
|
-
/** paragraph (`a:p`). */
|
|
472
|
-
interface SourceParagraph {
|
|
473
|
-
readonly runs: readonly SourceTextRun[];
|
|
474
|
-
readonly properties?: SourceParagraphProperties;
|
|
475
|
-
readonly handle?: SourceHandle;
|
|
476
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
477
|
-
}
|
|
478
|
-
/** vertical anchor (`a:bodyPr@anchor`). */
|
|
479
|
-
type SourceVerticalAnchor = "top" | "middle" | "bottom";
|
|
480
|
-
type SourceTextWrap = "square" | "none";
|
|
481
|
-
type SourceTextVerticalType = "horz" | "vert" | "vert270" | "eaVert" | "wordArtVert" | "mongolianVert";
|
|
482
|
-
type SourceTextAutoFit = "noAutofit" | "normAutofit" | "spAutofit";
|
|
483
|
-
/** Minimal subset of text body properties (`a:bodyPr`): insets and vertical anchor. */
|
|
484
|
-
interface SourceTextBodyProperties {
|
|
485
|
-
readonly marginLeft?: Emu;
|
|
486
|
-
readonly marginRight?: Emu;
|
|
487
|
-
readonly marginTop?: Emu;
|
|
488
|
-
readonly marginBottom?: Emu;
|
|
489
|
-
readonly anchor?: SourceVerticalAnchor;
|
|
490
|
-
readonly wrap?: SourceTextWrap;
|
|
491
|
-
readonly autoFit?: SourceTextAutoFit;
|
|
492
|
-
readonly fontScale?: number;
|
|
493
|
-
readonly lnSpcReduction?: number;
|
|
494
|
-
readonly numCol?: number;
|
|
495
|
-
readonly vert?: SourceTextVerticalType;
|
|
496
|
-
}
|
|
497
|
-
/** text body (`p:txBody`). */
|
|
498
|
-
interface SourceTextBody {
|
|
499
|
-
readonly paragraphs: readonly SourceParagraph[];
|
|
500
|
-
readonly properties?: SourceTextBodyProperties;
|
|
501
|
-
readonly listStyle?: SourceTextStyle;
|
|
502
|
-
readonly handle?: SourceHandle;
|
|
503
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
504
|
-
}
|
|
505
|
-
interface SourceTextStyle {
|
|
506
|
-
readonly defaultParagraph?: SourceParagraphProperties;
|
|
507
|
-
readonly levels: readonly (SourceParagraphProperties | undefined)[];
|
|
508
|
-
}
|
|
509
|
-
/** simple shape (`p:sp`). */
|
|
510
|
-
interface SourceShape {
|
|
511
|
-
readonly kind: "shape";
|
|
512
|
-
readonly nodeId?: SourceNodeId;
|
|
513
|
-
readonly name?: string;
|
|
514
|
-
readonly transform?: SourceTransform;
|
|
515
|
-
readonly geometry?: SourceGeometry;
|
|
516
|
-
readonly fill?: SourceFill;
|
|
517
|
-
readonly outline?: SourceOutline;
|
|
518
|
-
readonly effects?: SourceEffectList;
|
|
519
|
-
readonly style?: SourceShapeStyle;
|
|
520
|
-
readonly textBody?: SourceTextBody;
|
|
521
|
-
readonly placeholder?: SourcePlaceholder;
|
|
522
|
-
readonly handle?: SourceHandle;
|
|
523
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
524
|
-
}
|
|
525
|
-
interface SourceConnector {
|
|
526
|
-
readonly kind: "connector";
|
|
527
|
-
readonly nodeId?: SourceNodeId;
|
|
528
|
-
readonly name?: string;
|
|
529
|
-
readonly transform?: SourceTransform;
|
|
530
|
-
readonly geometry?: SourceGeometry;
|
|
531
|
-
readonly outline?: SourceOutline;
|
|
532
|
-
readonly effects?: SourceEffectList;
|
|
533
|
-
readonly style?: SourceShapeStyle;
|
|
534
|
-
readonly handle?: SourceHandle;
|
|
535
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
536
|
-
}
|
|
537
|
-
interface SourceGroup {
|
|
538
|
-
readonly kind: "group";
|
|
539
|
-
readonly nodeId?: SourceNodeId;
|
|
540
|
-
readonly name?: string;
|
|
541
|
-
readonly transform?: SourceTransform;
|
|
542
|
-
readonly childTransform?: SourceTransform;
|
|
543
|
-
readonly fill?: SourceFill;
|
|
544
|
-
readonly effects?: SourceEffectList;
|
|
545
|
-
readonly children: readonly SourceShapeNode[];
|
|
546
|
-
readonly handle?: SourceHandle;
|
|
547
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
548
|
-
}
|
|
549
|
-
/** crop (`a:srcRect`) of image. Preserve insets on each edge as OOXML percentages. */
|
|
550
|
-
interface SourceImageCrop {
|
|
551
|
-
readonly left?: OoxmlPercent;
|
|
552
|
-
readonly top?: OoxmlPercent;
|
|
553
|
-
readonly right?: OoxmlPercent;
|
|
554
|
-
readonly bottom?: OoxmlPercent;
|
|
555
|
-
}
|
|
556
|
-
interface SourceImageStretch {
|
|
557
|
-
readonly left: number;
|
|
558
|
-
readonly top: number;
|
|
559
|
-
readonly right: number;
|
|
560
|
-
readonly bottom: number;
|
|
561
|
-
}
|
|
562
|
-
/** image (`p:pic`). The blip keeps the relationship id (`r:embed`) unresolved. */
|
|
563
|
-
interface SourceImage {
|
|
564
|
-
readonly kind: "image";
|
|
565
|
-
readonly nodeId?: SourceNodeId;
|
|
566
|
-
readonly name?: string;
|
|
567
|
-
readonly transform?: SourceTransform;
|
|
568
|
-
/** Relationship id of `a:blip@r:embed`. The media part is resolved by the computed view. */
|
|
569
|
-
readonly blipRelationshipId?: RelationshipId;
|
|
570
|
-
readonly crop?: SourceImageCrop;
|
|
571
|
-
readonly stretch?: SourceImageStretch;
|
|
572
|
-
readonly tile?: SourceImageFillTile;
|
|
573
|
-
readonly effects?: SourceEffectList;
|
|
574
|
-
readonly blipEffects?: SourceBlipEffects;
|
|
575
|
-
readonly handle?: SourceHandle;
|
|
576
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
577
|
-
}
|
|
578
|
-
interface SourceTable {
|
|
579
|
-
readonly kind: "table";
|
|
580
|
-
readonly nodeId?: SourceNodeId;
|
|
581
|
-
readonly name?: string;
|
|
582
|
-
readonly transform?: SourceTransform;
|
|
583
|
-
readonly table: SourceTableData;
|
|
584
|
-
readonly handle?: SourceHandle;
|
|
585
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
586
|
-
}
|
|
587
|
-
interface SourceTableData {
|
|
588
|
-
readonly columns: readonly SourceTableColumn[];
|
|
589
|
-
readonly rows: readonly SourceTableRow[];
|
|
590
|
-
readonly tableStyleId?: string;
|
|
591
|
-
}
|
|
592
|
-
interface SourceTableColumn {
|
|
593
|
-
readonly width: Emu;
|
|
594
|
-
}
|
|
595
|
-
interface SourceTableRow {
|
|
596
|
-
readonly height: Emu;
|
|
597
|
-
readonly cells: readonly SourceTableCell[];
|
|
598
|
-
}
|
|
599
|
-
interface SourceTableCell {
|
|
600
|
-
readonly textBody?: SourceTextBody;
|
|
601
|
-
readonly fill?: SourceFill;
|
|
602
|
-
readonly borders?: SourceCellBorders;
|
|
603
|
-
readonly gridSpan: number;
|
|
604
|
-
readonly rowSpan: number;
|
|
605
|
-
readonly hMerge: boolean;
|
|
606
|
-
readonly vMerge: boolean;
|
|
607
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
608
|
-
}
|
|
609
|
-
interface SourceCellBorders {
|
|
610
|
-
readonly top?: SourceOutline;
|
|
611
|
-
readonly bottom?: SourceOutline;
|
|
612
|
-
readonly left?: SourceOutline;
|
|
613
|
-
readonly right?: SourceOutline;
|
|
614
|
-
}
|
|
615
|
-
interface SourceChart {
|
|
616
|
-
readonly kind: "chart";
|
|
617
|
-
readonly nodeId?: SourceNodeId;
|
|
618
|
-
readonly name?: string;
|
|
619
|
-
readonly transform?: SourceTransform;
|
|
620
|
-
/** Relationship id of `c:chart@r:id`. The chart part is resolved by the computed view. */
|
|
621
|
-
readonly chartRelationshipId?: RelationshipId;
|
|
622
|
-
readonly handle?: SourceHandle;
|
|
623
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
624
|
-
}
|
|
625
|
-
interface SourceSmartArt {
|
|
626
|
-
readonly kind: "smartArt";
|
|
627
|
-
readonly nodeId?: SourceNodeId;
|
|
628
|
-
readonly name?: string;
|
|
629
|
-
readonly transform?: SourceTransform;
|
|
630
|
-
/** Relationship id of `dgm:relIds@r:dm`. Diagram data/drawing parts are resolved by the computed view. */
|
|
631
|
-
readonly dataRelationshipId?: RelationshipId;
|
|
632
|
-
readonly handle?: SourceHandle;
|
|
633
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
634
|
-
}
|
|
635
|
-
/**
|
|
636
|
-
* Raw escape hatch for shape tree nodes that are not represented as typed nodes. Unsupported shapes,
|
|
637
|
-
* groups, connectors, and similar nodes are saved for round trips.
|
|
638
|
-
*/
|
|
639
|
-
interface SourceRawShapeNode {
|
|
640
|
-
readonly kind: "raw";
|
|
641
|
-
readonly nodeId?: SourceNodeId;
|
|
642
|
-
readonly raw: RawSidecar;
|
|
643
|
-
readonly handle?: SourceHandle;
|
|
644
|
-
}
|
|
645
|
-
/** Shape tree source node union. */
|
|
646
|
-
type SourceShapeNode = SourceShape | SourceConnector | SourceGroup | SourceImage | SourceTable | SourceChart | SourceSmartArt | SourceRawShapeNode;
|
|
647
|
-
|
|
648
|
-
/**
|
|
649
|
-
* Source types for the presentation hierarchy.
|
|
650
|
-
*
|
|
651
|
-
* Slide, layout, master, and theme relationships are represented by part paths. Each
|
|
652
|
-
* part stays separate; resolving the master -> layout -> slide cascade is the computed
|
|
653
|
-
* view's responsibility. Materials needed for that resolution, such as background,
|
|
654
|
-
* clrMap, clrMapOvr, theme scheme, and showMasterSp, are kept as source-local values so
|
|
655
|
-
* the source model can retain them without falling back to raw XML.
|
|
656
|
-
*/
|
|
657
|
-
|
|
658
|
-
/** Slide size (`p:sldSz`), kept in EMUs. */
|
|
659
|
-
interface SlideSize {
|
|
660
|
-
readonly width: Emu;
|
|
661
|
-
readonly height: Emu;
|
|
662
|
-
}
|
|
663
|
-
/**
|
|
664
|
-
* Color map (`p:clrMap`) / color map override (`p:clrMapOvr`). Keeps the mapping from
|
|
665
|
-
* logical names (`bg1` / `tx1` / `accent1`, etc.) to theme scheme slots (`dk1` / `lt1`,
|
|
666
|
-
* etc.) unresolved.
|
|
667
|
-
*/
|
|
668
|
-
interface SourceColorMap {
|
|
669
|
-
readonly mapping: Readonly<Record<string, string>>;
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
* Slide / layout / master background (`p:bg`). This is either a direct fill
|
|
673
|
-
* (`p:bgPr`), a theme style matrix reference (`p:bgRef`), or raw content.
|
|
674
|
-
*/
|
|
675
|
-
type SourceBackground = {
|
|
676
|
-
readonly kind: "fill";
|
|
677
|
-
readonly fill: SourceFill;
|
|
678
|
-
} | {
|
|
679
|
-
readonly kind: "styleReference";
|
|
680
|
-
readonly index: number;
|
|
681
|
-
readonly color: SourceColor;
|
|
682
|
-
} | {
|
|
683
|
-
readonly kind: "raw";
|
|
684
|
-
readonly raw: RawSidecar;
|
|
685
|
-
};
|
|
686
|
-
/** Theme color scheme (`a:clrScheme`). Maps slot names to unconverted concrete colors. */
|
|
687
|
-
interface SourceThemeColorScheme {
|
|
688
|
-
/** `dk1` / `lt1` / `dk2` / `lt2` / `accent1`..`accent6` / `hlink` / `folHlink`. */
|
|
689
|
-
readonly colors: Readonly<Record<string, SourceColor>>;
|
|
690
|
-
}
|
|
691
|
-
/** Minimal subset of the theme font scheme (`a:fontScheme`). */
|
|
692
|
-
interface SourceThemeFontScheme {
|
|
693
|
-
readonly majorLatin?: string;
|
|
694
|
-
readonly minorLatin?: string;
|
|
695
|
-
readonly majorEastAsian?: string;
|
|
696
|
-
readonly minorEastAsian?: string;
|
|
697
|
-
readonly majorComplexScript?: string;
|
|
698
|
-
readonly minorComplexScript?: string;
|
|
699
|
-
readonly majorJapanese?: string;
|
|
700
|
-
readonly minorJapanese?: string;
|
|
701
|
-
}
|
|
702
|
-
/** Subset of the theme format scheme (`a:fmtScheme`) used for shape style ref resolution. */
|
|
703
|
-
interface SourceThemeFormatScheme {
|
|
704
|
-
readonly fillStyles: readonly SourceFill[];
|
|
705
|
-
readonly lineStyles: readonly SourceOutline[];
|
|
706
|
-
readonly effectStyles: readonly (SourceEffectList | undefined)[];
|
|
707
|
-
readonly backgroundFillStyles: readonly SourceFill[];
|
|
708
|
-
}
|
|
709
|
-
/** theme part (`ppt/theme/themeN.xml`). */
|
|
710
|
-
interface SourceTheme {
|
|
711
|
-
readonly partPath: PartPath;
|
|
712
|
-
readonly name?: string;
|
|
713
|
-
readonly colorScheme?: SourceThemeColorScheme;
|
|
714
|
-
readonly fontScheme?: SourceThemeFontScheme;
|
|
715
|
-
readonly formatScheme?: SourceThemeFormatScheme;
|
|
716
|
-
readonly handle?: SourceHandle;
|
|
717
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
718
|
-
}
|
|
719
|
-
/** Slide master part. References the theme and child layouts. */
|
|
720
|
-
interface SourceSlideMaster {
|
|
721
|
-
readonly partPath: PartPath;
|
|
722
|
-
/** Theme part referenced by this master. */
|
|
723
|
-
readonly themePartPath?: PartPath;
|
|
724
|
-
/** Layout parts belonging to this master. */
|
|
725
|
-
readonly layoutPartPaths: readonly PartPath[];
|
|
726
|
-
readonly background?: SourceBackground;
|
|
727
|
-
/** Master `p:clrMap`. */
|
|
728
|
-
readonly colorMap?: SourceColorMap;
|
|
729
|
-
readonly txStyles?: SourceMasterTextStyles;
|
|
730
|
-
readonly shapes: readonly SourceShapeNode[];
|
|
731
|
-
readonly handle?: SourceHandle;
|
|
732
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
733
|
-
}
|
|
734
|
-
interface SourceMasterTextStyles {
|
|
735
|
-
readonly titleStyle?: SourceTextStyle;
|
|
736
|
-
readonly bodyStyle?: SourceTextStyle;
|
|
737
|
-
readonly otherStyle?: SourceTextStyle;
|
|
738
|
-
}
|
|
739
|
-
/** Slide layout part. References the parent master. */
|
|
740
|
-
interface SourceSlideLayout {
|
|
741
|
-
readonly partPath: PartPath;
|
|
742
|
-
/** Parent slide master part for this layout. */
|
|
743
|
-
readonly masterPartPath: PartPath;
|
|
744
|
-
/** layout type (`p:sldLayout@type`). */
|
|
745
|
-
readonly type?: string;
|
|
746
|
-
readonly background?: SourceBackground;
|
|
747
|
-
/** Layout `p:clrMapOvr` (when overridden). */
|
|
748
|
-
readonly colorMapOverride?: SourceColorMap;
|
|
749
|
-
/** `p:sldLayout@showMasterSp` (master shape visibility). */
|
|
750
|
-
readonly showMasterShapes?: boolean;
|
|
751
|
-
readonly shapes: readonly SourceShapeNode[];
|
|
752
|
-
readonly handle?: SourceHandle;
|
|
753
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
754
|
-
}
|
|
755
|
-
/** Slide part. References the applied layout. */
|
|
756
|
-
interface SourceSlide {
|
|
757
|
-
readonly partPath: PartPath;
|
|
758
|
-
/** Layout part referenced by this slide. */
|
|
759
|
-
readonly layoutPartPath: PartPath;
|
|
760
|
-
readonly background?: SourceBackground;
|
|
761
|
-
/** Slide `p:clrMapOvr` (when overridden). */
|
|
762
|
-
readonly colorMapOverride?: SourceColorMap;
|
|
763
|
-
/** `p:sld@showMasterSp` (master shape visibility). */
|
|
764
|
-
readonly showMasterShapes?: boolean;
|
|
765
|
-
readonly shapes: readonly SourceShapeNode[];
|
|
766
|
-
readonly handle?: SourceHandle;
|
|
767
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
768
|
-
}
|
|
769
|
-
/** Presentation part (`ppt/presentation.xml`). Maintains slide order. */
|
|
770
|
-
interface SourcePresentation {
|
|
771
|
-
readonly partPath: PartPath;
|
|
772
|
-
readonly slideSize?: SlideSize;
|
|
773
|
-
readonly defaultTextStyle?: SourceTextStyle;
|
|
774
|
-
/** Slide part paths reflecting `p:sldIdLst` order. */
|
|
775
|
-
readonly slidePartPaths: readonly PartPath[];
|
|
776
|
-
readonly handle?: SourceHandle;
|
|
777
|
-
readonly rawSidecars?: readonly RawSidecar[];
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
/**
|
|
781
|
-
* Top-level types for the PptxSourceModel source model.
|
|
782
|
-
*
|
|
783
|
-
* This is the canonical PPTX document representation owned by
|
|
784
|
-
* `@pptx-glimpse/document`. Rather than exposing package parts directly as the public
|
|
785
|
-
* API, it groups presentation, slides, layouts, masters, themes, relationships, media,
|
|
786
|
-
* and content types as OOXML source semantics. Upper layers such as core, editor-core,
|
|
787
|
-
* and pom may consume this package, but this package must not depend on them. Renderer
|
|
788
|
-
* output is produced by the core adapter, and PptxSourceModel does not know about it.
|
|
789
|
-
*
|
|
790
|
-
* This model is the source of truth for writer, editor, and round-trip workflows. It
|
|
791
|
-
* keeps source-local values, relationship ids, part paths, element ordering, typed
|
|
792
|
-
* PPTX-domain units, stable source handles, diagnostics, and raw preservation hooks.
|
|
793
|
-
* Unsupported OOXML, vendor extensions, mc:AlternateContent, and unsupported DrawingML
|
|
794
|
-
* are not mixed into the typed operation API. They are preserved as raw sidecars or raw
|
|
795
|
-
* package parts for structural round-tripping.
|
|
796
|
-
*
|
|
797
|
-
* PptxSourceModel must not include renderer-specific fallbacks, environment-specific
|
|
798
|
-
* font substitution, SVG/PNG output, pixel-output values, or pom authoring primitives.
|
|
799
|
-
* Slide/layout/master/theme cascades, relationship resolution, theme color resolution,
|
|
800
|
-
* placeholder and text style resolution, and similar effective values are derived from
|
|
801
|
-
* the source as a non-mutating computed view.
|
|
802
|
-
*/
|
|
803
|
-
|
|
804
|
-
interface PptxSourceModel {
|
|
805
|
-
/** Structure of package part / relationship / content type / media. */
|
|
806
|
-
readonly packageGraph: PackageGraph;
|
|
807
|
-
readonly presentation: SourcePresentation;
|
|
808
|
-
readonly slides: readonly SourceSlide[];
|
|
809
|
-
readonly slideLayouts: readonly SourceSlideLayout[];
|
|
810
|
-
readonly slideMasters: readonly SourceSlideMaster[];
|
|
811
|
-
readonly themes: readonly SourceTheme[];
|
|
812
|
-
/** Diagnostics about document correctness. */
|
|
813
|
-
readonly diagnostics: readonly Diagnostic[];
|
|
814
|
-
/** typed PptxSourceModel operation and dirty scope. The writer determines the minimum update range from this. */
|
|
815
|
-
readonly edits?: readonly PptxSourceModelEdit[];
|
|
816
|
-
}
|
|
817
|
-
type PptxSourceModelEdit = PptxSourceModelTextRunEdit | PptxSourceModelParagraphTextEdit | PptxSourceModelShapeTransformEdit;
|
|
818
|
-
interface PptxSourceModelTextRunEdit {
|
|
819
|
-
readonly kind: "replaceTextRunPlainText";
|
|
820
|
-
readonly handle: SourceHandle;
|
|
821
|
-
readonly text: string;
|
|
822
|
-
}
|
|
823
|
-
interface PptxSourceModelParagraphTextEdit {
|
|
824
|
-
readonly kind: "replaceParagraphPlainText";
|
|
825
|
-
readonly handle: SourceHandle;
|
|
826
|
-
readonly text: string;
|
|
827
|
-
}
|
|
828
|
-
interface PptxSourceModelShapeTransformEdit {
|
|
829
|
-
readonly kind: "updateShapeTransform";
|
|
830
|
-
readonly handle: SourceHandle;
|
|
831
|
-
readonly offsetX: Emu;
|
|
832
|
-
readonly offsetY: Emu;
|
|
833
|
-
readonly width: Emu;
|
|
834
|
-
readonly height: Emu;
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
/**
|
|
838
|
-
* Font resolver context for text-to-path conversion.
|
|
839
|
-
* Provides access to a Font object with the opentype.js getPath() method.
|
|
840
|
-
*/
|
|
841
|
-
interface OpentypePath {
|
|
842
|
-
toPathData(decimalPlaces?: number): string;
|
|
843
|
-
}
|
|
844
|
-
interface OpentypeFullFont {
|
|
845
|
-
unitsPerEm: number;
|
|
846
|
-
ascender: number;
|
|
847
|
-
descender: number;
|
|
848
|
-
getPath(text: string, x: number, y: number, fontSize: number): OpentypePath;
|
|
849
|
-
getAdvanceWidth(text: string, fontSize: number): number;
|
|
850
|
-
}
|
|
851
|
-
interface TextPathFontResolver {
|
|
852
|
-
resolveFont(fontFamily: string | null | undefined, fontFamilyEa: string | null | undefined, jpanFallback?: string | null): OpentypeFullFont | null;
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
/**
|
|
856
|
-
* Mapping from PPTX font family names to replacement font family names.
|
|
857
|
-
*
|
|
858
|
-
* Keys are font names found in PPTX files. Values are font names that should be
|
|
859
|
-
* present in the rendering environment, commonly open-source alternatives to
|
|
860
|
-
* proprietary Microsoft Office fonts.
|
|
861
|
-
*/
|
|
862
|
-
type FontMapping = Record<string, string>;
|
|
863
|
-
/**
|
|
864
|
-
* Default replacement mapping for common Microsoft Office fonts.
|
|
865
|
-
*
|
|
866
|
-
* The table maps fonts such as Calibri, Arial, Meiryo, and MS Gothic to
|
|
867
|
-
* open-source alternatives used during text measurement, SVG path generation,
|
|
868
|
-
* and font lookup.
|
|
869
|
-
*/
|
|
870
|
-
declare const DEFAULT_FONT_MAPPING: Readonly<FontMapping>;
|
|
871
|
-
/**
|
|
872
|
-
* Create a font mapping table by merging defaults with user overrides.
|
|
873
|
-
*
|
|
874
|
-
* @param userMapping Custom PPTX font name to replacement font name entries.
|
|
875
|
-
* User-specified entries take precedence over `DEFAULT_FONT_MAPPING`.
|
|
876
|
-
* @returns A new mutable mapping object.
|
|
877
|
-
*/
|
|
878
|
-
declare function createFontMapping(userMapping?: FontMapping): FontMapping;
|
|
879
|
-
/**
|
|
880
|
-
* Look up the replacement font for a PPTX font family.
|
|
881
|
-
*
|
|
882
|
-
* Matching is case-insensitive and normalizes full-width alphanumeric
|
|
883
|
-
* characters used by some Japanese Office font names.
|
|
884
|
-
*
|
|
885
|
-
* @param fontFamily PPTX font family name to resolve.
|
|
886
|
-
* @param mapping Mapping table, usually from `createFontMapping`.
|
|
887
|
-
* @returns The replacement font name, or `null` when no mapping exists.
|
|
888
|
-
*/
|
|
889
|
-
declare function getMappedFont(fontFamily: string | null | undefined, mapping: FontMapping): string | null;
|
|
890
|
-
|
|
891
|
-
/**
|
|
892
|
-
* Interface for measuring text width and line height.
|
|
893
|
-
* By default, measurement uses static font metrics.
|
|
894
|
-
* Users can pass their own implementation to ConvertOptions.textMeasurer
|
|
895
|
-
* Can be replaced with any measurement backend such as Canvas API or opentype.js.
|
|
896
|
-
*/
|
|
897
|
-
interface TextMeasurer {
|
|
898
|
-
/**
|
|
899
|
-
* Returns the estimated width of the text in pixels.
|
|
900
|
-
* @param text - text to measure
|
|
901
|
-
* @param fontSizePt - font size (points)
|
|
902
|
-
* @param bold - whether the text is bold
|
|
903
|
-
* @param fontFamily - font family name for Latin text
|
|
904
|
-
* @param fontFamilyEa - font family name for East Asian text
|
|
905
|
-
*/
|
|
906
|
-
measureTextWidth(text: string, fontSizePt: number, bold: boolean, fontFamily?: string | null, fontFamilyEa?: string | null): number;
|
|
907
|
-
/**
|
|
908
|
-
* Returns the font's natural line height ratio (line height / font size).
|
|
909
|
-
* Returns 1.2 as a fallback value if the metric is unknown.
|
|
910
|
-
* @param fontFamily - font family name for Latin text
|
|
911
|
-
* @param fontFamilyEa - font family name for East Asian text
|
|
912
|
-
*/
|
|
913
|
-
getLineHeightRatio(fontFamily?: string | null, fontFamilyEa?: string | null): number;
|
|
914
|
-
/**
|
|
915
|
-
* Font ascender ratio (ascender / unitsPerEm) .
|
|
916
|
-
* Used for baseline offset calculation in the first row.
|
|
917
|
-
* Returns 1.0 as a fallback value if the metric is unknown.
|
|
918
|
-
* @param fontFamily - font family name for Latin text
|
|
919
|
-
* @param fontFamilyEa - font family name for East Asian text
|
|
920
|
-
*/
|
|
921
|
-
getAscenderRatio(fontFamily?: string | null, fontFamilyEa?: string | null): number;
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
interface OpentypeGlyph {
|
|
925
|
-
advanceWidth?: number;
|
|
926
|
-
}
|
|
927
|
-
interface OpentypeFont {
|
|
928
|
-
unitsPerEm: number;
|
|
929
|
-
ascender: number;
|
|
930
|
-
descender: number;
|
|
931
|
-
stringToGlyphs(text: string): OpentypeGlyph[];
|
|
932
|
-
}
|
|
933
|
-
declare class OpentypeTextMeasurer implements TextMeasurer {
|
|
934
|
-
private fonts;
|
|
935
|
-
private defaultFont;
|
|
936
|
-
private warnedFonts;
|
|
937
|
-
/**
|
|
938
|
-
* @param fonts - font name -> opentype.js Map of Font objects
|
|
939
|
-
* @param defaultFont - fallback font (optional)
|
|
940
|
-
*/
|
|
941
|
-
constructor(fonts: Map<string, OpentypeFont>, defaultFont?: OpentypeFont);
|
|
942
|
-
measureTextWidth(text: string, fontSizePt: number, bold: boolean, fontFamily?: string | null, fontFamilyEa?: string | null): number;
|
|
943
|
-
getLineHeightRatio(fontFamily?: string | null, fontFamilyEa?: string | null): number;
|
|
944
|
-
getAscenderRatio(fontFamily?: string | null, fontFamilyEa?: string | null): number;
|
|
945
|
-
private resolveBoldFont;
|
|
946
|
-
private resolveFont;
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
/**
|
|
950
|
-
* Font file data supplied directly by the caller.
|
|
951
|
-
*
|
|
952
|
-
* Use this when system font scanning is unavailable or undesirable, such as in
|
|
953
|
-
* browsers, Edge Runtime, or serverless environments. `name` can be used to
|
|
954
|
-
* register TTF/OTF buffers under a specific family name; family names from the
|
|
955
|
-
* font names table are also registered when available.
|
|
956
|
-
*/
|
|
957
|
-
interface FontBuffer {
|
|
958
|
-
/**
|
|
959
|
-
* Optional font family name to register for this buffer.
|
|
960
|
-
*/
|
|
961
|
-
name?: string;
|
|
962
|
-
/**
|
|
963
|
-
* Raw TTF, OTF, or TTC font file bytes.
|
|
964
|
-
*/
|
|
965
|
-
data: ArrayBuffer | Uint8Array;
|
|
966
|
-
}
|
|
967
|
-
/**
|
|
968
|
-
* Font services created from OpenType font data.
|
|
969
|
-
*/
|
|
970
|
-
interface OpentypeSetup {
|
|
971
|
-
/**
|
|
972
|
-
* Measures text width for layout and wrapping.
|
|
973
|
-
*/
|
|
974
|
-
measurer: OpentypeTextMeasurer;
|
|
975
|
-
/**
|
|
976
|
-
* Resolves fonts for converting text to SVG path outlines.
|
|
977
|
-
*/
|
|
978
|
-
fontResolver: TextPathFontResolver;
|
|
979
|
-
}
|
|
980
|
-
/**
|
|
981
|
-
* Create a text measurer from caller-provided font buffers.
|
|
982
|
-
*
|
|
983
|
-
* This low-level helper is useful when rendering in an environment where fonts
|
|
984
|
-
* are bundled as bytes instead of discovered from the OS. It dynamically imports
|
|
985
|
-
* `opentype.js` and returns `null` if no fonts can be parsed or the optional
|
|
986
|
-
* dependency is unavailable.
|
|
987
|
-
*
|
|
988
|
-
* @param fontBuffers Font file bytes to parse.
|
|
989
|
-
* @param fontMapping Optional PPTX font name to replacement font mapping.
|
|
990
|
-
* @returns A text measurer, or `null` when setup is not possible.
|
|
991
|
-
*/
|
|
992
|
-
declare function createOpentypeTextMeasurerFromBuffers(fontBuffers: FontBuffer[], fontMapping?: FontMapping): Promise<OpentypeTextMeasurer | null>;
|
|
993
|
-
/**
|
|
994
|
-
* Create font measurement and SVG path resolution services from font buffers.
|
|
995
|
-
*
|
|
996
|
-
* Use this for integrations that need to provide fonts explicitly instead of
|
|
997
|
-
* relying on Node.js system font directories.
|
|
998
|
-
*
|
|
999
|
-
* @param fontBuffers TTF, OTF, or TTC font file bytes.
|
|
1000
|
-
* @param fontMapping Optional PPTX font name to replacement font mapping.
|
|
1001
|
-
* @returns Font services, or `null` when no usable font setup can be created.
|
|
1002
|
-
*/
|
|
1003
|
-
declare function createOpentypeSetupFromBuffers(fontBuffers: FontBuffer[], fontMapping?: FontMapping): Promise<OpentypeSetup | null>;
|
|
1004
|
-
/**
|
|
1005
|
-
* Clear the module-level cache of parsed system fonts.
|
|
1006
|
-
*
|
|
1007
|
-
* Conversion APIs cache parsed font objects for repeated calls with the same
|
|
1008
|
-
* font options. Call this after installing, removing, or replacing fonts in a
|
|
1009
|
-
* long-running process when subsequent conversions must reload font files.
|
|
1010
|
-
*/
|
|
1011
|
-
declare function clearFontCache(): void;
|
|
1012
|
-
|
|
1013
|
-
/**
|
|
1014
|
-
* Controls how unsupported-feature warnings are collected and printed.
|
|
1015
|
-
*
|
|
1016
|
-
* `"off"` disables collection, `"warn"` collects entries and prints summaries,
|
|
1017
|
-
* and `"debug"` also prints each warning as it is recorded.
|
|
1018
|
-
*/
|
|
1019
|
-
type LogLevel = "off" | "warn" | "debug";
|
|
1020
|
-
/**
|
|
1021
|
-
* One unsupported or approximated feature encountered during conversion.
|
|
1022
|
-
*/
|
|
1023
|
-
interface WarningEntry {
|
|
1024
|
-
/**
|
|
1025
|
-
* Stable feature key, for example `"sp.style"` or `"bodyPr@vert"`.
|
|
1026
|
-
*/
|
|
1027
|
-
feature: string;
|
|
1028
|
-
/**
|
|
1029
|
-
* Human-readable warning message.
|
|
1030
|
-
*/
|
|
1031
|
-
message: string;
|
|
1032
|
-
/**
|
|
1033
|
-
* Optional location context, for example `"Slide 1"`.
|
|
1034
|
-
*/
|
|
1035
|
-
context?: string;
|
|
1036
|
-
}
|
|
1037
|
-
/**
|
|
1038
|
-
* Aggregated warnings from the most recent conversion cycle.
|
|
1039
|
-
*/
|
|
1040
|
-
interface WarningSummary {
|
|
1041
|
-
/**
|
|
1042
|
-
* Total number of warning entries.
|
|
1043
|
-
*/
|
|
1044
|
-
totalCount: number;
|
|
1045
|
-
/**
|
|
1046
|
-
* Warning counts grouped by feature key.
|
|
1047
|
-
*/
|
|
1048
|
-
features: {
|
|
1049
|
-
feature: string;
|
|
1050
|
-
message: string;
|
|
1051
|
-
count: number;
|
|
1052
|
-
}[];
|
|
1053
|
-
}
|
|
1054
|
-
/**
|
|
1055
|
-
* Return a grouped summary of currently collected warnings.
|
|
1056
|
-
*
|
|
1057
|
-
* This reads the active warning logger state. The public conversion APIs flush
|
|
1058
|
-
* warnings at the end of a conversion so summaries can be printed; after that
|
|
1059
|
-
* flush, this returns an empty summary until new warnings are recorded. It is
|
|
1060
|
-
* mainly useful for lower-level renderer workflows, tests, and integrations
|
|
1061
|
-
* that manage the warning cycle directly.
|
|
1062
|
-
*/
|
|
1063
|
-
declare function getWarningSummary(): WarningSummary;
|
|
1064
|
-
/**
|
|
1065
|
-
* Return individual warning entries collected in the current warning cycle.
|
|
1066
|
-
*
|
|
1067
|
-
* Entries include optional slide or element context when available. The public
|
|
1068
|
-
* conversion APIs flush entries at the end of a conversion, so this is mainly
|
|
1069
|
-
* useful for lower-level renderer workflows, tests, and integrations that
|
|
1070
|
-
* manage the warning cycle directly.
|
|
1071
|
-
*/
|
|
1072
|
-
declare function getWarningEntries(): readonly WarningEntry[];
|
|
1073
|
-
|
|
1074
|
-
/**
|
|
1075
|
-
* Options shared by PPTX-to-SVG and PPTX-to-PNG conversion.
|
|
1076
|
-
*/
|
|
1077
|
-
interface ConvertOptions {
|
|
1078
|
-
/**
|
|
1079
|
-
* Target slide numbers to convert, using PowerPoint-style 1-based numbering.
|
|
1080
|
-
*
|
|
1081
|
-
* When omitted, every slide in the presentation is converted. Missing or
|
|
1082
|
-
* out-of-range slide numbers produce no output for those entries.
|
|
1083
|
-
*/
|
|
1084
|
-
slides?: number[];
|
|
1085
|
-
/**
|
|
1086
|
-
* Output width in pixels.
|
|
1087
|
-
*
|
|
1088
|
-
* PNG output rasterizes to this width while preserving the slide aspect
|
|
1089
|
-
* ratio. Defaults to 960. SVG output keeps the slide's native pixel size from
|
|
1090
|
-
* the PPTX slide dimensions and does not use this option.
|
|
1091
|
-
*/
|
|
1092
|
-
width?: number;
|
|
1093
|
-
/**
|
|
1094
|
-
* Output height in pixels.
|
|
1095
|
-
*
|
|
1096
|
-
* PNG rasterization currently always uses `width`, either the provided value
|
|
1097
|
-
* or the default width, so this option is ignored by the public conversion
|
|
1098
|
-
* APIs. SVG output keeps the slide's native pixel size and does not use this
|
|
1099
|
-
* option.
|
|
1100
|
-
*/
|
|
1101
|
-
height?: number;
|
|
1102
|
-
/**
|
|
1103
|
-
* Warning log level for unsupported or approximated PPTX features.
|
|
1104
|
-
*
|
|
1105
|
-
* Defaults to `"off"`. Diagnostics are always collected in the conversion
|
|
1106
|
-
* report; this option only controls console output. Use `"warn"` to print
|
|
1107
|
-
* summaries, or `"debug"` to print individual warning entries as they are
|
|
1108
|
-
* recorded.
|
|
1109
|
-
*/
|
|
1110
|
-
logLevel?: LogLevel;
|
|
1111
|
-
/**
|
|
1112
|
-
* Additional directories that are scanned for font files.
|
|
1113
|
-
*
|
|
1114
|
-
* These directories are searched in addition to system font directories unless
|
|
1115
|
-
* `skipSystemFonts` is true. This option uses Node.js filesystem APIs; use
|
|
1116
|
-
* `fonts` when rendering in browsers, Edge Runtime, or other environments
|
|
1117
|
-
* where filesystem access is unavailable.
|
|
1118
|
-
*/
|
|
1119
|
-
fontDirs?: string[];
|
|
1120
|
-
/**
|
|
1121
|
-
* Font file bytes supplied directly by the caller.
|
|
1122
|
-
*
|
|
1123
|
-
* Use this browser-safe option when fonts are fetched from a URL, bundled by
|
|
1124
|
-
* an application, or otherwise loaded without Node.js filesystem APIs. When
|
|
1125
|
-
* provided, these font buffers are used instead of system font scanning.
|
|
1126
|
-
*/
|
|
1127
|
-
fonts?: FontBuffer[];
|
|
1128
|
-
/**
|
|
1129
|
-
* Custom PPTX font name to replacement font name mapping.
|
|
1130
|
-
*
|
|
1131
|
-
* Entries are merged with `DEFAULT_FONT_MAPPING`; user-provided entries take
|
|
1132
|
-
* precedence. This is useful when a PPTX references proprietary or corporate
|
|
1133
|
-
* fonts that should render with installed alternatives.
|
|
1134
|
-
*/
|
|
1135
|
-
fontMapping?: FontMapping;
|
|
1136
|
-
/**
|
|
1137
|
-
* Skip OS system font directories and only scan `fontDirs`.
|
|
1138
|
-
*
|
|
1139
|
-
* This is useful in containers or serverless environments where bundled fonts
|
|
1140
|
-
* should be the only fonts used.
|
|
1141
|
-
*/
|
|
1142
|
-
skipSystemFonts?: boolean;
|
|
1143
|
-
/**
|
|
1144
|
-
* Text output mode for SVG conversion.
|
|
1145
|
-
*
|
|
1146
|
-
* Defaults to `"path"`, which emits glyph outlines as `<path>` elements and
|
|
1147
|
-
* does not require fonts in the SVG viewing environment. `"text"` emits native
|
|
1148
|
-
* `<text>` elements with subset-font `@font-face` data URIs, enabling browser
|
|
1149
|
-
* text selection and native text rendering for inline SVG.
|
|
1150
|
-
*
|
|
1151
|
-
* Embedded fonts and native text may not render as expected when the SVG is
|
|
1152
|
-
* loaded through `<img src="...svg">` or sanitized. `convertPptxToPng` ignores
|
|
1153
|
-
* this option and always renders with `"path"` output because resvg does not
|
|
1154
|
-
* interpret the embedded `@font-face` rules used by SVG text output.
|
|
1155
|
-
*/
|
|
1156
|
-
textOutput?: "path" | "text";
|
|
1157
|
-
}
|
|
1158
|
-
/**
|
|
1159
|
-
* SVG conversion result for one slide.
|
|
1160
|
-
*/
|
|
1161
|
-
interface SlideSvg {
|
|
1162
|
-
/**
|
|
1163
|
-
* Original slide number in the PPTX file, using 1-based numbering.
|
|
1164
|
-
*/
|
|
1165
|
-
slideNumber: number;
|
|
1166
|
-
/**
|
|
1167
|
-
* Complete SVG document string for the slide.
|
|
1168
|
-
*/
|
|
1169
|
-
svg: string;
|
|
1170
|
-
}
|
|
1171
|
-
interface ConversionDiagnostic {
|
|
1172
|
-
readonly source: "document" | "computed-view" | "renderer-adapter" | "renderer";
|
|
1173
|
-
readonly severity: "info" | "warning" | "error";
|
|
1174
|
-
readonly code: string;
|
|
1175
|
-
readonly message: string;
|
|
1176
|
-
readonly slideNumber?: number;
|
|
1177
|
-
readonly sourcePartPath?: string;
|
|
1178
|
-
readonly context?: string;
|
|
1179
|
-
readonly handle?: SourceHandle;
|
|
1180
|
-
}
|
|
1181
|
-
interface SupportCoverageCounts {
|
|
1182
|
-
/**
|
|
1183
|
-
* Number of PPTX source/computed elements considered for rendering.
|
|
1184
|
-
*/
|
|
1185
|
-
readonly inputElements: number;
|
|
1186
|
-
/**
|
|
1187
|
-
* Number of renderer-model elements produced for SVG / PNG output.
|
|
1188
|
-
*/
|
|
1189
|
-
readonly outputElements: number;
|
|
1190
|
-
/**
|
|
1191
|
-
* Elements or raw nodes skipped because they are outside the supported render subset.
|
|
1192
|
-
*/
|
|
1193
|
-
readonly skippedElements: number;
|
|
1194
|
-
/**
|
|
1195
|
-
* Elements skipped because a referenced PPTX part or relationship could not be resolved.
|
|
1196
|
-
*/
|
|
1197
|
-
readonly unresolvedElements: number;
|
|
1198
|
-
/**
|
|
1199
|
-
* Elements or properties rendered with a fallback or ignored unsupported property.
|
|
1200
|
-
*/
|
|
1201
|
-
readonly fallbackElements: number;
|
|
1202
|
-
/**
|
|
1203
|
-
* Diagnostics with warning severity that affect support/renderability confidence.
|
|
1204
|
-
*/
|
|
1205
|
-
readonly warnings: number;
|
|
1206
|
-
}
|
|
1207
|
-
interface SlideSupportCoverage extends SupportCoverageCounts {
|
|
1208
|
-
readonly slideNumber: number;
|
|
1209
|
-
}
|
|
1210
|
-
interface SupportCoverage {
|
|
1211
|
-
/**
|
|
1212
|
-
* Support/renderability coverage summary. This is not a visual-match or pixel accuracy metric.
|
|
1213
|
-
*/
|
|
1214
|
-
readonly overall: SupportCoverageCounts;
|
|
1215
|
-
readonly slides: readonly SlideSupportCoverage[];
|
|
1216
|
-
}
|
|
1217
|
-
interface SvgConversionReport {
|
|
1218
|
-
readonly slides: readonly SlideSvg[];
|
|
1219
|
-
readonly diagnostics: readonly ConversionDiagnostic[];
|
|
1220
|
-
readonly supportCoverage: SupportCoverage;
|
|
1221
|
-
}
|
|
1222
|
-
type SystemFontSetupLoader = (options: ConvertOptions | undefined) => Promise<OpentypeSetup | null>;
|
|
1223
|
-
/**
|
|
1224
|
-
* Convert a PPTX file to SVG documents.
|
|
1225
|
-
*
|
|
1226
|
-
* @param input PPTX binary data.
|
|
1227
|
-
* @param options Conversion options. `slides` uses 1-based slide numbers; when
|
|
1228
|
-
* omitted, all slides are converted.
|
|
1229
|
-
* @returns A conversion report containing converted slides, diagnostics, and support coverage.
|
|
1230
|
-
*
|
|
1231
|
-
* Text is emitted as SVG paths by default for portable rendering. Set
|
|
1232
|
-
* `textOutput: "text"` to emit native `<text>` elements with embedded subset
|
|
1233
|
-
* fonts for inline browser SVG use. Font directories and font mapping options
|
|
1234
|
-
* control how PPTX font names are resolved for text measurement and text output.
|
|
1235
|
-
*/
|
|
1236
|
-
declare function convertPptxToSvg$1(input: Uint8Array, options?: ConvertOptions, loadSystemFontSetup?: SystemFontSetupLoader): Promise<SvgConversionReport>;
|
|
1237
|
-
|
|
1238
|
-
/**
|
|
1239
|
-
* PNG conversion result for one slide.
|
|
1240
|
-
*/
|
|
1241
|
-
interface SlideImage {
|
|
1242
|
-
/**
|
|
1243
|
-
* Original slide number in the PPTX file, using 1-based numbering.
|
|
1244
|
-
*/
|
|
1245
|
-
slideNumber: number;
|
|
1246
|
-
/**
|
|
1247
|
-
* PNG image bytes for the rendered slide.
|
|
1248
|
-
*/
|
|
1249
|
-
png: Uint8Array;
|
|
1250
|
-
/**
|
|
1251
|
-
* Actual output image width in pixels after rasterization.
|
|
1252
|
-
*/
|
|
1253
|
-
width: number;
|
|
1254
|
-
/**
|
|
1255
|
-
* Actual output image height in pixels after rasterization.
|
|
1256
|
-
*/
|
|
1257
|
-
height: number;
|
|
1258
|
-
}
|
|
1259
|
-
interface PngConversionReport {
|
|
1260
|
-
readonly slides: readonly SlideImage[];
|
|
1261
|
-
readonly diagnostics: SvgConversionReport["diagnostics"];
|
|
1262
|
-
readonly supportCoverage: SupportCoverage;
|
|
1263
|
-
}
|
|
1264
|
-
/**
|
|
1265
|
-
* Convert a PPTX file to SVG documents.
|
|
1266
|
-
*
|
|
1267
|
-
* @param input PPTX binary data.
|
|
1268
|
-
* @param options Conversion options. `slides` uses 1-based slide numbers; when
|
|
1269
|
-
* omitted, all slides are converted.
|
|
1270
|
-
* @returns A conversion report containing converted slides, diagnostics, and support coverage.
|
|
1271
|
-
*
|
|
1272
|
-
* Text is emitted as SVG paths by default for portable rendering. Set
|
|
1273
|
-
* `textOutput: "text"` to emit native `<text>` elements with embedded subset
|
|
1274
|
-
* fonts for inline browser SVG use. Font directories and font mapping options
|
|
1275
|
-
* control how PPTX font names are resolved for text measurement and text output.
|
|
1276
|
-
*/
|
|
1277
|
-
declare function convertPptxToSvg(input: Uint8Array, options?: ConvertOptions): Promise<SvgConversionReport>;
|
|
1278
|
-
/**
|
|
1279
|
-
* Convert a PPTX file to PNG images.
|
|
1280
|
-
*
|
|
1281
|
-
* @param input PPTX binary data.
|
|
1282
|
-
* @param options Conversion options. `slides` uses 1-based slide numbers; when
|
|
1283
|
-
* omitted, all slides are converted.
|
|
1284
|
-
* @returns A conversion report containing converted PNG slides, diagnostics, and support coverage.
|
|
1285
|
-
*
|
|
1286
|
-
* PNG conversion first renders each slide to SVG and then rasterizes it with
|
|
1287
|
-
* resvg. The `textOutput` option is intentionally ignored: PNG rendering always
|
|
1288
|
-
* uses path-based text output because resvg does not interpret the embedded
|
|
1289
|
-
* `@font-face` rules used by SVG text mode. Font directories and font mapping
|
|
1290
|
-
* options are still used to resolve glyph outlines and text metrics.
|
|
1291
|
-
*/
|
|
1292
|
-
declare function convertPptxToPng(input: Uint8Array, options?: ConvertOptions): Promise<PngConversionReport>;
|
|
1293
|
-
|
|
1294
|
-
/**
|
|
1295
|
-
* Font names discovered in a PPTX file.
|
|
1296
|
-
*/
|
|
1297
|
-
interface UsedFonts {
|
|
1298
|
-
/**
|
|
1299
|
-
* Theme font slots resolved from the presentation's default theme.
|
|
1300
|
-
*/
|
|
1301
|
-
theme: {
|
|
1302
|
-
/**
|
|
1303
|
-
* Major Latin theme font.
|
|
1304
|
-
*/
|
|
1305
|
-
majorFont: string;
|
|
1306
|
-
/**
|
|
1307
|
-
* Minor Latin theme font.
|
|
1308
|
-
*/
|
|
1309
|
-
minorFont: string;
|
|
1310
|
-
/**
|
|
1311
|
-
* Major East Asian theme font, when present.
|
|
1312
|
-
*/
|
|
1313
|
-
majorFontEa: string | null;
|
|
1314
|
-
/**
|
|
1315
|
-
* Minor East Asian theme font, when present.
|
|
1316
|
-
*/
|
|
1317
|
-
minorFontEa: string | null;
|
|
1318
|
-
/**
|
|
1319
|
-
* Major complex-script theme font, when present.
|
|
1320
|
-
*/
|
|
1321
|
-
majorFontCs: string | null;
|
|
1322
|
-
/**
|
|
1323
|
-
* Minor complex-script theme font, when present.
|
|
1324
|
-
*/
|
|
1325
|
-
minorFontCs: string | null;
|
|
1326
|
-
};
|
|
1327
|
-
/**
|
|
1328
|
-
* Unique sorted font names used by text runs, bullets, and theme font slots.
|
|
1329
|
-
*/
|
|
1330
|
-
fonts: string[];
|
|
1331
|
-
}
|
|
1332
|
-
/**
|
|
1333
|
-
* Parse a PPTX file and collect the font names it references.
|
|
1334
|
-
*
|
|
1335
|
-
* This is a lightweight preflight helper: it reads the document model and text
|
|
1336
|
-
* styles but does not render slides or load font files. Use it to decide which
|
|
1337
|
-
* fonts should be installed, bundled, or mapped before calling the conversion
|
|
1338
|
-
* APIs.
|
|
1339
|
-
*
|
|
1340
|
-
* @param input PPTX binary data.
|
|
1341
|
-
* @returns Theme font slots and a unique sorted list of referenced font names.
|
|
1342
|
-
*/
|
|
1343
|
-
declare function collectUsedFonts(input: Uint8Array): UsedFonts;
|
|
1344
|
-
|
|
1345
|
-
export { type ConversionDiagnostic as C, DEFAULT_FONT_MAPPING as D, type Emu as E, type FontBuffer as F, type LogLevel as L, type OpentypeSetup as O, type PngConversionReport as P, type SlideImage as S, type UsedFonts as U, type WarningEntry as W, type ConvertOptions as a, type FontMapping as b, type PptxSourceModel as c, type SlideSupportCoverage as d, type SlideSvg as e, type SourceHandle as f, type SourceShapeNode as g, type SupportCoverage as h, type SupportCoverageCounts as i, type SvgConversionReport as j, type WarningSummary as k, clearFontCache as l, collectUsedFonts as m, convertPptxToPng as n, convertPptxToSvg$1 as o, convertPptxToSvg as p, createFontMapping as q, createOpentypeSetupFromBuffers as r, createOpentypeTextMeasurerFromBuffers as s, getMappedFont as t, getWarningEntries as u, getWarningSummary as v };
|