pptx-ts 0.0.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.
Files changed (78) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +319 -0
  3. package/dist/autopage-DkjYZUFD.js +423 -0
  4. package/dist/autopage-DkjYZUFD.js.map +1 -0
  5. package/dist/browser.d.ts +31 -0
  6. package/dist/browser.d.ts.map +1 -0
  7. package/dist/browser.js +110 -0
  8. package/dist/browser.js.map +1 -0
  9. package/dist/diagnostics-Du_s75MT.d.ts +829 -0
  10. package/dist/diagnostics-Du_s75MT.d.ts.map +1 -0
  11. package/dist/enums-CvRYniUA.d.ts +463 -0
  12. package/dist/enums-CvRYniUA.d.ts.map +1 -0
  13. package/dist/errors-Bvln0H-7.js +112 -0
  14. package/dist/errors-Bvln0H-7.js.map +1 -0
  15. package/dist/errors-PflMPWBn.d.ts +182 -0
  16. package/dist/errors-PflMPWBn.d.ts.map +1 -0
  17. package/dist/fit-BKs0zxMI.js +1356 -0
  18. package/dist/fit-BKs0zxMI.js.map +1 -0
  19. package/dist/html-dom-B0I0QSbU.js +679 -0
  20. package/dist/html-dom-B0I0QSbU.js.map +1 -0
  21. package/dist/html.d.ts +26 -0
  22. package/dist/html.d.ts.map +1 -0
  23. package/dist/html.js +63 -0
  24. package/dist/html.js.map +1 -0
  25. package/dist/index.d.ts +24 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +57 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/inspect.d.ts +197 -0
  30. package/dist/inspect.d.ts.map +1 -0
  31. package/dist/inspect.js +317 -0
  32. package/dist/inspect.js.map +1 -0
  33. package/dist/math.d.ts +37 -0
  34. package/dist/math.d.ts.map +1 -0
  35. package/dist/math.js +203 -0
  36. package/dist/math.js.map +1 -0
  37. package/dist/measure.d.ts +313 -0
  38. package/dist/measure.d.ts.map +1 -0
  39. package/dist/measure.js +3 -0
  40. package/dist/namespaces-BVnNu7sg.js +666 -0
  41. package/dist/namespaces-BVnNu7sg.js.map +1 -0
  42. package/dist/node.d.ts +20 -0
  43. package/dist/node.d.ts.map +1 -0
  44. package/dist/node.js +55 -0
  45. package/dist/node.js.map +1 -0
  46. package/dist/notes-RLCwdlTE.js +1703 -0
  47. package/dist/notes-RLCwdlTE.js.map +1 -0
  48. package/dist/package-CaOLXSNi.d.ts +193 -0
  49. package/dist/package-CaOLXSNi.d.ts.map +1 -0
  50. package/dist/pres-C5__xkDh.d.ts +202 -0
  51. package/dist/pres-C5__xkDh.d.ts.map +1 -0
  52. package/dist/presentation-Cp7vzlAw.js +5427 -0
  53. package/dist/presentation-Cp7vzlAw.js.map +1 -0
  54. package/dist/presentation-types-DP_8jog7.d.ts +4872 -0
  55. package/dist/presentation-types-DP_8jog7.d.ts.map +1 -0
  56. package/dist/read.d.ts +55 -0
  57. package/dist/read.d.ts.map +1 -0
  58. package/dist/read.js +4 -0
  59. package/dist/script.d.ts +581 -0
  60. package/dist/script.d.ts.map +1 -0
  61. package/dist/script.js +3741 -0
  62. package/dist/script.js.map +1 -0
  63. package/dist/shapes-BemroU-z.js +6951 -0
  64. package/dist/shapes-BemroU-z.js.map +1 -0
  65. package/dist/slide-js0QpRV-.d.ts +3873 -0
  66. package/dist/slide-js0QpRV-.d.ts.map +1 -0
  67. package/dist/text-CyetbF6p.js +11278 -0
  68. package/dist/text-CyetbF6p.js.map +1 -0
  69. package/dist/units-1kRzYShk.js +231 -0
  70. package/dist/units-1kRzYShk.js.map +1 -0
  71. package/dist/units-internal-Dg95w_YD.js +753 -0
  72. package/dist/units-internal-Dg95w_YD.js.map +1 -0
  73. package/dist/zip.d.ts +68 -0
  74. package/dist/zip.d.ts.map +1 -0
  75. package/dist/zip.js +163 -0
  76. package/dist/zip.js.map +1 -0
  77. package/package.json +152 -0
  78. package/skills/ts-pptx-upstream/SKILL.md +340 -0
@@ -0,0 +1,581 @@
1
+ import { h as Presentation } from "./presentation-types-DP_8jog7.js";
2
+ import { a as TsPptxError, d as InvalidOptionErrorCode, f as MediaErrorCode, h as UnsupportedFeatureErrorCode, i as PackageReadError, l as ErrorCode, m as TsPptxCode, n as InvalidOptionError, o as TsPptxErrorOptions, p as PackageReadErrorCode, r as MediaError, s as UnsupportedFeatureError, t as InternalError, u as InternalErrorCode } from "./errors-PflMPWBn.js";
3
+ //#region src/script/fidelity.d.ts
4
+ /**
5
+ * Fidelity notes — the declared, machine-checkable list of what a deck loses on the way
6
+ * to a script.
7
+ *
8
+ * A converter that warns about losses to a log has no way to be tested: the warnings are
9
+ * prose, nothing consumes them, and a missing one looks exactly like a clean run. Making
10
+ * the notes part of the IR inverts that. A note says "field X of shape Y will not come
11
+ * back", so a round-trip check can exclude precisely those fields and treat **any**
12
+ * remaining difference as a defect. Both directions then have teeth:
13
+ *
14
+ * - an *undeclared* loss fails the round-trip, because nothing excluded it;
15
+ * - a *declared* loss that actually survives is a stale note, and the check can say so.
16
+ *
17
+ * That is the whole reason notes are first-class rather than a side channel. It also
18
+ * means {@link FidelityNote.construct} is an identifier, not a sentence: it has to be
19
+ * matchable against a field path, so it is a stable dotted key and the human explanation
20
+ * lives in {@link FidelityNote.detail}.
21
+ */
22
+ /** What happened to the construct. */
23
+ type Disposition =
24
+ /** Gone: nothing in the output carries it. */
25
+ 'dropped' |
26
+ /**
27
+ * Present but structurally simplified — a value survives while the structure around
28
+ * it does not (threaded comment replies flattened into separate comments, a per-script
29
+ * font scheme reduced to latin, a placeholder demoted to a plain shape).
30
+ */
31
+ 'flattened' |
32
+ /**
33
+ * Present and structurally intact, but not the same value — a re-encoding that a
34
+ * viewer may or may not be able to tell apart (a modern transition mapped to the
35
+ * nearest named one, a chart rebuilt from cached points rather than its workbook).
36
+ */
37
+ 'approximated';
38
+ /**
39
+ * Which side of the library is responsible. Recording this is what makes the notes
40
+ * actionable rather than merely honest: `unread` and `unwritable` are bugs waiting to be
41
+ * fixed in a specific subsystem, while `unsupported` is a property of OOXML or of the
42
+ * chosen output tier and will not be fixed by more converter work.
43
+ */
44
+ type Cause =
45
+ /** The read API exposes no accessor for it, so the converter never saw it. */
46
+ 'unread' |
47
+ /** Read fine, but the write API has no option that expresses it. */
48
+ 'unwritable' |
49
+ /** Both sides can handle it; this output tier structurally cannot carry it. */
50
+ 'unsupported';
51
+ /** One declared loss. */
52
+ interface FidelityNote {
53
+ /** 1-based source slide, or `null` for a deck-level loss. */
54
+ slideNumber: number | null;
55
+ /** Source shape name (`p:cNvPr/@name`), or `null` when the loss is not shape-scoped. */
56
+ shapeName: string | null;
57
+ /**
58
+ * Stable dotted identifier for the lost construct — `line.width`, `text.tabStops`,
59
+ * `chart.workbook`. Matched mechanically by the round-trip check, so it must name a
60
+ * field path rather than describe one. Reuse an existing key for the same construct
61
+ * instead of coining a synonym.
62
+ */
63
+ construct: string;
64
+ disposition: Disposition;
65
+ cause: Cause;
66
+ /** Why, in a sentence, for a human reading the emitted script's header. */
67
+ detail: string;
68
+ }
69
+ /**
70
+ * Namespace for a loss recorded against a shape on a **slide layout** rather than on a slide,
71
+ * prepended to the construct by {@link layoutShapeScope}.
72
+ *
73
+ * The chrome mapper reuses the slide shape mapper wholesale — a rectangle on a layout is
74
+ * transcribed by the same code that transcribes one on a slide, which is what keeps the two
75
+ * from drifting. That sharing brings the slide vocabulary with it: a themed outline on a
76
+ * layout records `line.width` exactly as a slide's would. Left unmarked, those notes would be
77
+ * wrong twice over. A template-anchored script would report them, though it never rebuilds a
78
+ * layout and loses nothing; and the round trip would let one excuse a *slide* difference,
79
+ * because a layout note carries no slide number and a name like "Rectangle 7" repeats between
80
+ * the tiers. The prefix keeps the shared vocabulary and states which tier it is about.
81
+ *
82
+ * `layout.` rather than `master.`, which is how the other chrome constructs are spelled: those
83
+ * are named after the `defineSlideMaster` call that authors them, while these name the source
84
+ * tier the loss is on — and a master's own decoration is not re-authored at all, so a note
85
+ * under this prefix is always about a layout.
86
+ */
87
+ declare const LAYOUT_NOTE_PREFIX = "layout.";
88
+ //#endregion
89
+ //#region src/script/ir.d.ts
90
+ /**
91
+ * A reference to bytes held in {@link DeckIr.assets}, standing where a write-API option
92
+ * wants image/media data. Printed as a `path` or an inline `data:` literal depending on
93
+ * the print options — an IR-level decision would bake one choice into the IR and force a
94
+ * re-read to change it.
95
+ *
96
+ * The `$asset` sigil is deliberate: no write-API option object has a `$`-prefixed key,
97
+ * so a value carrying one is unambiguously a reference rather than user data.
98
+ */
99
+ interface AssetRef {
100
+ $asset: string;
101
+ }
102
+ /** `true` when `value` is an {@link AssetRef} rather than a plain IR object. */
103
+ declare function isAssetRef(value: unknown): value is AssetRef;
104
+ /**
105
+ * Any value an IR may hold. Deliberately narrower than `unknown`: it excludes `undefined`
106
+ * so that "absent" has exactly one spelling (a missing key), which is what makes two IRs
107
+ * comparable field-by-field in a round-trip diff. `readModelToIr` never writes an
108
+ * `undefined` value.
109
+ */
110
+ type IrValue = null | boolean | number | string | AssetRef | IrValue[] | {
111
+ [key: string]: IrValue;
112
+ };
113
+ /** Bytes referenced by an {@link AssetRef}, plus what a printer needs to name and type them. */
114
+ interface AssetIr {
115
+ /** Stable key an {@link AssetRef} resolves against; also the emitted filename. */
116
+ name: string;
117
+ /** MIME type from the source package's content types, for an inline `data:` URI. */
118
+ contentType: string;
119
+ bytes: Uint8Array;
120
+ }
121
+ /**
122
+ * One write-API call on a slide, in the order it must be made. `method` names a real
123
+ * method on the authored slide and `args` are its positional arguments — so a printer is
124
+ * a formatter, and `readModelToIr` owns every semantic choice.
125
+ *
126
+ * Ordering is z-order: OOXML paints a slide's shape tree front-to-back in document order,
127
+ * and so does the write path, so preserving call order preserves overlap.
128
+ */
129
+ interface CallIr {
130
+ method: 'addText' | 'addShape' | 'addImage' | 'addTable' | 'addChart' | 'addConnector' | 'addGroup' | 'addNotes';
131
+ args: IrValue[];
132
+ /**
133
+ * The source shape's name (`p:cNvPr/@name`), when it had one. Not an argument —
134
+ * carried so a printer can comment the call and a fidelity note can point at it.
135
+ */
136
+ sourceName?: string;
137
+ }
138
+ /**
139
+ * How a slide's content gets into the output deck.
140
+ *
141
+ * `authored` — every shape is transcribed into {@link CallIr}s and regenerated through
142
+ * the write API. This is the goal: the emitted source is editable, and a reader can see
143
+ * what the deck contains.
144
+ *
145
+ * `carried` — the slide holds at least one construct the write API cannot express at all
146
+ * (`chartEx` is the clear case: a full reader, no emitter), so transcribing it would
147
+ * silently produce a different deck. A printer that *can* copy the slide from the source
148
+ * package should do so: fidelity is higher than transcription, though the emitted source then
149
+ * says nothing about what is on the slide, which is a real cost and always carries a
150
+ * {@link FidelityNote}.
151
+ *
152
+ * This is a recommendation, not an erasure. {@link SlideIr.calls} is populated either way, so
153
+ * a printer with no source package to copy from prints them and loses only the unwritable
154
+ * construct rather than the whole slide.
155
+ */
156
+ type SlideSource = 'authored' | 'carried';
157
+ /**
158
+ * A slide's background, already reduced to what the write API's `background` accepts.
159
+ *
160
+ * `data` rather than `image`, because `BackgroundProps` is `DataOrPathProps & ShapeFillProps`
161
+ * and `data` is the key it actually reads — an `image` key would print, typecheck against
162
+ * `IrValue`, and be ignored at run time.
163
+ */
164
+ interface BackgroundIr {
165
+ color?: string;
166
+ transparency?: number;
167
+ data?: AssetRef;
168
+ }
169
+ /**
170
+ * A transition's sound (`p:sndAc`), reduced to what `TransitionSoundProps` accepts.
171
+ *
172
+ * `data` rather than `path`, for the same reason a background image uses `data`: the bytes
173
+ * are the thing the IR carries, and a path would bind the script to a file layout the IR
174
+ * knows nothing about. The stop-previous form has no bytes at all — it silences a sound
175
+ * still playing from the previous slide — so it is the one shape here with no {@link AssetRef}.
176
+ */
177
+ interface TransitionSoundIr {
178
+ /** Bytes of the embedded WAV, for a start sound. Absent for {@link stopPrevious}. */
179
+ data?: AssetRef;
180
+ /** `p:snd@name`, the display name PowerPoint shows for the sound. */
181
+ name?: string;
182
+ /** `p:stSnd@loop` — repeat until the next sound starts. Omitted when false, its default. */
183
+ loop?: boolean;
184
+ /** The `p:endSnd` form: stop the previous slide's sound rather than start one. */
185
+ stopPrevious?: boolean;
186
+ }
187
+ /**
188
+ * A slide's show transition (`p:transition`), as a literal `TransitionProps`.
189
+ *
190
+ * Only the base ECMA-376 transitions reach this type. The read model reports
191
+ * {@link TransitionInfo.type} as an *open string*, because PowerPoint's modern effects
192
+ * (Morph, Vortex, …) live in the `p14`/`p15`/`p159` namespaces and it decodes those too —
193
+ * but the write path names 21 base ones and nothing else, so `from-read/transition.ts`
194
+ * filters against that vocabulary and notes what it drops. Anything that survives is a name
195
+ * the write API's own `TransitionType` union accepts, which is what keeps a printed script
196
+ * compiling.
197
+ */
198
+ interface TransitionIr {
199
+ /** The transition-type element's local name, guaranteed to be a writable one. */
200
+ type: string;
201
+ /** `p:transition@spd`. Always present — see `from-read/transition.ts` for why it is not omitted. */
202
+ speed: 'slow' | 'med' | 'fast';
203
+ /** `p14:dur` in milliseconds, when the source carried an exact duration. */
204
+ durationMs?: number;
205
+ /** `advClick`. Omitted when true, its default. */
206
+ advanceOnClick?: boolean;
207
+ /** `advTm` in milliseconds, when the slide auto-advances. */
208
+ advanceAfterMs?: number;
209
+ /** Type-specific attributes on the type element (`{ dir: 'd' }`, `{ spokes: '2' }`, …). */
210
+ variant?: {
211
+ [key: string]: string;
212
+ };
213
+ sound?: TransitionSoundIr;
214
+ }
215
+ /**
216
+ * The layout a slide should be bound to in the destination deck, identified two ways
217
+ * because neither alone is sufficient.
218
+ *
219
+ * The **name** is the portable identity: it is what lets a script built from one deck be
220
+ * re-pointed at a different template whose layouts happen to be named the same, and it is
221
+ * what a reader recognises. But `p:cSld@name` is not unique — a deck with several masters
222
+ * routinely carries several "Title and Content" layouts, and binding by an ambiguous name
223
+ * is an error, not a coin flip. The **index** into the deck's layout gallery always
224
+ * resolves, so it is the fallback, and {@link nameIsUnique} says which to trust.
225
+ */
226
+ interface SlideLayoutIr {
227
+ /** `p:cSld@name` of the source layout (`''` when the layout is unnamed). */
228
+ name: string;
229
+ /** Zero-based position in the source deck's layout gallery, in master-then-layout order. */
230
+ index: number;
231
+ /** `false` when another layout in that gallery shares {@link name}. */
232
+ nameIsUnique: boolean;
233
+ }
234
+ /** One slide of the deck. */
235
+ interface SlideIr {
236
+ /** 1-based index in the source deck; the identity a {@link FidelityNote} points at. */
237
+ number: number;
238
+ source: SlideSource;
239
+ /** The layout to bind to, or `null` when the source slide resolves none. */
240
+ layout: SlideLayoutIr | null;
241
+ /** `p:sld/@show="0"` — a slide hidden from presentation but present in the deck. */
242
+ hidden: boolean;
243
+ /** `p:cSld/@name`, when the source slide had one. */
244
+ name?: string;
245
+ background?: BackgroundIr;
246
+ /** Speaker notes as plain text. Notes-slide geometry and placeholders do not survive. */
247
+ notesText?: string;
248
+ /**
249
+ * The show transition, when the source has one the write API can name. Slide-scoped
250
+ * rather than a {@link CallIr} because the write API models it as a property assignment
251
+ * on the slide, not a method — the IR's `method` union names real methods only.
252
+ */
253
+ transition?: TransitionIr;
254
+ /**
255
+ * Write-API calls in z-order.
256
+ *
257
+ * Populated for every slide, **including a `carried` one**. A printer that can copy the
258
+ * source slide ignores these; one that cannot — a standalone output has no source package
259
+ * to copy from — prints them and is left with only the unwritable construct missing rather
260
+ * than the whole slide. Marking a slide `carried` is a recommendation, not an erasure.
261
+ */
262
+ calls: CallIr[];
263
+ }
264
+ /**
265
+ * A deck's theme, reduced to what `ThemeProps` accepts — the 12 `a:clrScheme` slots and the
266
+ * major/minor Latin, East-Asian and complex-script faces.
267
+ *
268
+ * What is *not* here is the point of the tier split. `a:fmtScheme` — the three fill, three
269
+ * line and three effect style lists a shape's `p:style` references — has no write-API
270
+ * counterpart and no read accessor, so a theme cannot be reproduced, only approximated.
271
+ */
272
+ interface ThemeIr {
273
+ headFontFace?: string;
274
+ bodyFontFace?: string;
275
+ headFontFaceEA?: string;
276
+ bodyFontFaceEA?: string;
277
+ headFontFaceCS?: string;
278
+ bodyFontFaceCS?: string;
279
+ /** The 12 `a:clrScheme` slots as bare 6-digit hex, omitting any the theme leaves unset. */
280
+ colorScheme?: {
281
+ [slot: string]: string;
282
+ };
283
+ }
284
+ /**
285
+ * One source slide layout approximated as a `defineSlideMaster` call.
286
+ *
287
+ * The naming is the write API's, not OOXML's: `defineSlideMaster` creates a *layout* under
288
+ * the single shared master, which is exactly the granularity a source layout needs. A source
289
+ * deck's masters have no counterpart at all — hence {@link ChromeIr}'s multi-master note.
290
+ */
291
+ interface MasterIr {
292
+ /**
293
+ * Gallery position of the source layout, matching {@link SlideLayoutIr.index}, so a slide
294
+ * finds the master it should bind to without re-deriving a name.
295
+ */
296
+ layoutIndex: number;
297
+ /**
298
+ * A `SlideMasterProps` literal. `props.title` is made unique across the deck, because it
299
+ * doubles as the key `addSlide({ masterTitle })` matches against and source layout names
300
+ * are not unique.
301
+ */
302
+ props: {
303
+ [key: string]: IrValue;
304
+ };
305
+ }
306
+ /**
307
+ * The deck's shared chrome, approximated for an output that has no template to inherit it
308
+ * from. A template-anchored printer ignores this entirely — the source deck *is* the chrome.
309
+ */
310
+ interface ChromeIr {
311
+ theme: ThemeIr;
312
+ /** One entry per source layout, in gallery order. */
313
+ masters: MasterIr[];
314
+ }
315
+ /** Deck-level properties, reduced to the five `docProps` fields the write API sets. */
316
+ interface DeckPropsIr {
317
+ title?: string;
318
+ author?: string;
319
+ company?: string;
320
+ subject?: string;
321
+ revision?: string;
322
+ }
323
+ /**
324
+ * A whole deck, ready to print.
325
+ *
326
+ * `widthEmu`/`heightEmu` are raw EMU rather than inches because that is what the read
327
+ * model reports and what the write API's `Coord` accepts verbatim; converting here would
328
+ * introduce a rounding decision at the wrong layer.
329
+ */
330
+ interface DeckIr {
331
+ slideSize: {
332
+ widthEmu: number;
333
+ heightEmu: number;
334
+ };
335
+ props: DeckPropsIr;
336
+ /**
337
+ * Theme and layouts, approximated. Only a standalone printer reads this; a
338
+ * template-anchored one gets all of it byte-identical from the source deck instead.
339
+ */
340
+ chrome: ChromeIr;
341
+ slides: SlideIr[];
342
+ assets: AssetIr[];
343
+ /**
344
+ * Every construct that did not survive into {@link slides} intact. This is a
345
+ * *contract*, not a log: a round-trip check excludes exactly these fields from its
346
+ * diff, so an unnoted difference is a bug and a note nothing else corroborates is a
347
+ * stale claim. See {@link FidelityNote}.
348
+ */
349
+ fidelity: FidelityNote[];
350
+ }
351
+ //#endregion
352
+ //#region src/script/from-read/deck.d.ts
353
+ /** Convert a loaded deck into its IR. */
354
+ declare function readModelToIr(pres: Presentation): DeckIr;
355
+ //#endregion
356
+ //#region src/script/print/common.d.ts
357
+ /** How image bytes reach the emitted script. */
358
+ type AssetMode =
359
+ /** Written beside the script and read at run time. Keeps the script readable. */
360
+ 'file' |
361
+ /** Inlined as `data:` literals. One self-contained file, at roughly 4/3 the byte size. */
362
+ 'inline';
363
+ interface PrintedScript {
364
+ /** The TypeScript module source. */
365
+ code: string;
366
+ /**
367
+ * Image bytes the script expects to find in its asset directory, keyed by filename.
368
+ * Empty when the print options asked for `'inline'`, since the bytes are then in
369
+ * {@link code}.
370
+ */
371
+ assets: Map<string, Uint8Array>;
372
+ /**
373
+ * The losses that apply to **this** output: the IR's own notes, minus any this tier
374
+ * rescues, plus the ones this tier causes. Reproduced as a comment block at the top of
375
+ * {@link code}, so the artifact carries its own caveats.
376
+ */
377
+ notes: FidelityNote[];
378
+ }
379
+ //#endregion
380
+ //#region src/script/print/script.d.ts
381
+ interface PrintScriptOptions {
382
+ /**
383
+ * Path the emitted script loads its template from, resolved against the script's own
384
+ * location. This is the **source deck unchanged** — `fromTemplate` strips its slides.
385
+ * @default './template.pptx'
386
+ */
387
+ templatePath?: string;
388
+ /** Path the emitted script writes to, resolved against the script's own location. @default './output.pptx' */
389
+ outputPath?: string;
390
+ /** Directory the emitted script reads image assets from, when {@link assets} is `'file'`. @default './assets' */
391
+ assetDir?: string;
392
+ /** @default 'file' */
393
+ assets?: AssetMode;
394
+ /**
395
+ * Import specifier the emitted script uses, with `/read` appended for the read half.
396
+ * Defaults to this package's own published name; override it to point a generated
397
+ * script at a local build or a fork.
398
+ * @default '@shbernal/ts-pptx'
399
+ */
400
+ packageName?: string;
401
+ }
402
+ /** Turn a deck IR into a runnable, template-anchored TypeScript module. */
403
+ declare function printScript(ir: DeckIr, options?: PrintScriptOptions): PrintedScript;
404
+ //#endregion
405
+ //#region src/script/print/standalone.d.ts
406
+ interface PrintStandaloneScriptOptions {
407
+ /** Path the emitted script writes to, resolved against the script's own location. @default './output.pptx' */
408
+ outputPath?: string;
409
+ /** Directory the emitted script reads image assets from, when {@link assets} is `'file'`. @default './assets' */
410
+ assetDir?: string;
411
+ /** @default 'file' */
412
+ assets?: AssetMode;
413
+ /**
414
+ * Import specifier the emitted script uses. Defaults to this package's own published
415
+ * name; override it to point a generated script at a local build or a fork.
416
+ * @default '@shbernal/ts-pptx'
417
+ */
418
+ packageName?: string;
419
+ }
420
+ /** Turn a deck IR into a runnable TypeScript module that needs no template. */
421
+ declare function printStandaloneScript(ir: DeckIr, options?: PrintStandaloneScriptOptions): PrintedScript;
422
+ //#endregion
423
+ //#region src/script/verify/canonical.d.ts
424
+ /** One write-API call, with the source shape name lifted out as an address rather than data. */
425
+ interface CanonicalCall {
426
+ method: string;
427
+ /** `p:cNvPr/@name` of the shape this call came from, used to point a difference at it. */
428
+ shapeName: string | null;
429
+ /**
430
+ * Every `objectName` appearing anywhere inside {@link args}, which for `addGroup` is the
431
+ * group's children.
432
+ *
433
+ * A fidelity note about a group's child is scoped to that child's name, but the child is
434
+ * not a call of its own — it is an argument to the group's. Without this the note and the
435
+ * difference it predicted would carry different names and never match, and a declared loss
436
+ * would be reported as a defect.
437
+ */
438
+ containedNames: string[];
439
+ args: IrValue[];
440
+ }
441
+ interface CanonicalSlide {
442
+ number: number;
443
+ hidden: boolean;
444
+ /**
445
+ * The name of the layout this slide binds to, which is the only part of the binding that
446
+ * is portable — a gallery *index* shifts whenever the output's gallery differs from the
447
+ * source's, which it always does for a standalone output.
448
+ *
449
+ * Here because the binding is otherwise invisible: a printer that bound every slide to the
450
+ * wrong layout, or to none, would produce identical calls and compare clean. The layout
451
+ * governs theme and colour-map resolution, so that is not a cosmetic difference.
452
+ */
453
+ layoutName: string | null;
454
+ background: IrValue | null;
455
+ notesText: string | null;
456
+ /**
457
+ * The show transition, or `null`.
458
+ *
459
+ * Here for the same reason {@link layoutName} is: a printer that stopped emitting
460
+ * transitions altogether would produce identical *calls* and compare clean, so the
461
+ * projection has to carry the slide-level properties the write API sets by assignment
462
+ * rather than by method. It is compared structurally (key by key), not as one opaque
463
+ * value, so a note can declare the loss of a transition's *sound* without also excusing a
464
+ * wrong transition *type*.
465
+ */
466
+ transition: IrValue | null;
467
+ calls: CanonicalCall[];
468
+ }
469
+ /**
470
+ * The deck's chrome, reduced the same way its slides are.
471
+ *
472
+ * Included for one reason: without it the diff cannot see the standalone tier's whole job.
473
+ * That tier re-authors the theme and one master per source layout, and a projection that
474
+ * covers only slides would report a printer emitting *neither* as a clean round trip — the
475
+ * same shape of hole mutation testing found in `added` differences, one level up. A
476
+ * template-anchored output compares equal here by construction, which is the claim that tier
477
+ * makes and is worth checking rather than assuming.
478
+ */
479
+ interface CanonicalChrome {
480
+ theme: IrValue;
481
+ /** Each master's `defineSlideMaster` props, in gallery order. */
482
+ masters: IrValue[];
483
+ }
484
+ interface CanonicalDeck {
485
+ slideSize: {
486
+ widthEmu: number;
487
+ heightEmu: number;
488
+ };
489
+ /** The `docProps` the write API can set. Absent from the projection, a printer that set none would compare clean. */
490
+ props: IrValue;
491
+ chrome: CanonicalChrome;
492
+ slides: CanonicalSlide[];
493
+ }
494
+ /** Reduce a deck IR to the comparable form. */
495
+ declare function canonicalDeckIr(ir: DeckIr): CanonicalDeck;
496
+ //#endregion
497
+ //#region src/script/verify/diff.d.ts
498
+ /**
499
+ * Which way a difference points.
500
+ *
501
+ * `lost` and `changed` are the ones the fidelity contract governs — the source said
502
+ * something the output does not, or says differently. `added` is the write path being
503
+ * explicit where the source was implicit, which is *usually* harmless and is reported
504
+ * separately for a reason worth stating: this diff cannot tell whether the value the write
505
+ * path chose is the one the source was inheriting. An `added` `color` is benign if the
506
+ * shape was inheriting that colour and a silent repaint if it was not.
507
+ */
508
+ type DifferenceKind = 'lost' | 'added' | 'changed';
509
+ interface IrDifference {
510
+ /** 1-based source slide. */
511
+ slideNumber: number;
512
+ /** Source shape name, when the difference sits inside a call that has one. */
513
+ shapeName: string | null;
514
+ /**
515
+ * Shape names nested inside the same call — a group's children. A note scoped to one of
516
+ * these also declares differences reported against the call that carries it.
517
+ */
518
+ nestedNames: string[];
519
+ /** Where in the slide's projection, e.g. `calls[4].args[1].line.width`. */
520
+ path: string;
521
+ /**
522
+ * The option name the difference is about — the last object key on {@link path}, or
523
+ * `'*'` when a whole call is present on one side only. This is what a note's `construct`
524
+ * is matched against, which is why `construct` has to name a field path rather than
525
+ * describe one.
526
+ */
527
+ field: string;
528
+ kind: DifferenceKind;
529
+ /** The source value, JSON-encoded and truncated for reporting. `'—'` when absent. */
530
+ expected: string;
531
+ /** The output value, likewise. */
532
+ actual: string;
533
+ /** The note that declares this difference, when one does. */
534
+ declaredBy: FidelityNote | null;
535
+ }
536
+ interface RoundTripReport {
537
+ slideCount: number;
538
+ /** Every difference found, in deck order. */
539
+ differences: IrDifference[];
540
+ /**
541
+ * Differences neither a note nor a known write-path default accounts for.
542
+ * **These are the defects**, and the number this check gates on.
543
+ */
544
+ undeclared: IrDifference[];
545
+ /** Differences a note declared. The contract working. */
546
+ declared: IrDifference[];
547
+ /** `added` differences: the write path spelling out what the source left implicit. */
548
+ added: IrDifference[];
549
+ /**
550
+ * Notes that matched no difference.
551
+ *
552
+ * **Not a defect signal, despite the obvious reading.** Most notes name constructs the
553
+ * read model cannot see at all — a bullet's `a:buFont`, a shape's theme `effectRef` —
554
+ * so they are absent from *both* IRs and there is nothing for them to match. A note
555
+ * here is a candidate for review, not a stale claim.
556
+ */
557
+ unmatchedNotes: FidelityNote[];
558
+ }
559
+ /**
560
+ * Every note construct this table knows how to match, for a test to check against. The
561
+ * `layout.` spellings are not listed — they resolve through {@link isKnownNoteConstruct},
562
+ * which is what a corpus check should use.
563
+ */
564
+ declare function knownNoteConstructs(): string[];
565
+ /**
566
+ * Compare the deck a script was generated from against the deck it produced.
567
+ *
568
+ * `notes` must be the set that actually applies to the printed output — `printScript`'s
569
+ * returned `notes`, not `DeckIr.fidelity`. The two differ in both directions: the printer
570
+ * suppresses notes its tier rescues and adds ones its tier causes, so diffing against the
571
+ * IR's own list would both over- and under-exclude.
572
+ */
573
+ declare function diffDeckIr(expected: CanonicalDeck, actual: CanonicalDeck, notes: FidelityNote[]): RoundTripReport;
574
+ /**
575
+ * `true` when the coverage table can match this construct — directly or through the
576
+ * layout-shape fallback. The check a corpus test runs over every note both printers emit.
577
+ */
578
+ declare function isKnownNoteConstruct(construct: string): boolean;
579
+ //#endregion
580
+ export { type AssetIr, type AssetMode, type AssetRef, type BackgroundIr, type CallIr, type CanonicalCall, type CanonicalChrome, type CanonicalDeck, type CanonicalSlide, type Cause, type ChromeIr, type DeckIr, type DeckPropsIr, type DifferenceKind, type Disposition, type ErrorCode, type FidelityNote, InternalError, type InternalErrorCode, InvalidOptionError, type InvalidOptionErrorCode, type IrDifference, type IrValue, LAYOUT_NOTE_PREFIX, type MasterIr, MediaError, type MediaErrorCode, PackageReadError, type PackageReadErrorCode, type PrintScriptOptions, type PrintStandaloneScriptOptions, type PrintedScript, type RoundTripReport, type SlideIr, type SlideLayoutIr, type SlideSource, type ThemeIr, type TransitionIr, type TransitionSoundIr, type TsPptxCode, TsPptxError, type TsPptxErrorOptions, UnsupportedFeatureError, type UnsupportedFeatureErrorCode, canonicalDeckIr, diffDeckIr, isAssetRef, isKnownNoteConstruct, knownNoteConstructs, printScript, printStandaloneScript, readModelToIr };
581
+ //# sourceMappingURL=script.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script.d.ts","names":[],"sources":["../src/script/fidelity.ts","../src/script/ir.ts","../src/script/from-read/deck.ts","../src/script/print/common.ts","../src/script/print/script.ts","../src/script/print/standalone.ts","../src/script/verify/canonical.ts","../src/script/verify/diff.ts"],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