pptx-svelte-viewer 1.4.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +470 -0
  2. package/README.md +175 -17
  3. package/dist/AiChatPanel-CkC2py3J.js +1082 -0
  4. package/dist/__vite-browser-external-DOmiXdGM.js +7 -0
  5. package/dist/{dist-DZ-fjucV.js → dist-AHWCPEmj.js} +44226 -40236
  6. package/dist/export-CtfwVh4-.js +97263 -0
  7. package/dist/i18n.js +1 -1
  8. package/dist/index.d.ts +2193 -99
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +22 -22
  11. package/dist/pptx-svelte-viewer.css +1 -1
  12. package/dist/rolldown-runtime--_vEcKDh.js +29 -0
  13. package/dist/{translator-D4a_pxY4.js → translator-Ddi-liGk.js} +251 -7
  14. package/dist/viewer/ai/ai-bridge.d.ts +61 -0
  15. package/dist/viewer/ai/ai-bridge.d.ts.map +1 -0
  16. package/dist/viewer/ai/ai-history-persist.d.ts +13 -0
  17. package/dist/viewer/ai/ai-history-persist.d.ts.map +1 -0
  18. package/dist/viewer/ai/ai-log-export.d.ts +71 -0
  19. package/dist/viewer/ai/ai-log-export.d.ts.map +1 -0
  20. package/dist/viewer/ai/ai-panel-controller.svelte.d.ts +77 -0
  21. package/dist/viewer/ai/ai-panel-controller.svelte.d.ts.map +1 -0
  22. package/dist/viewer/ai/chat.svelte.d.ts +43 -0
  23. package/dist/viewer/ai/chat.svelte.d.ts.map +1 -0
  24. package/dist/viewer/ai/focus-targets.d.ts +36 -0
  25. package/dist/viewer/ai/focus-targets.d.ts.map +1 -0
  26. package/dist/viewer/ai/index.d.ts +11 -0
  27. package/dist/viewer/ai/index.d.ts.map +1 -0
  28. package/dist/viewer/collab/collaboration-deps.d.ts +23 -0
  29. package/dist/viewer/collab/collaboration-deps.d.ts.map +1 -0
  30. package/dist/viewer/collab/collaboration-effects.svelte.d.ts +17 -0
  31. package/dist/viewer/collab/collaboration-effects.svelte.d.ts.map +1 -0
  32. package/dist/viewer/collab/collaboration-provider.d.ts.map +1 -1
  33. package/dist/viewer/collab/collaboration-remote-sync.d.ts +32 -1
  34. package/dist/viewer/collab/collaboration-remote-sync.d.ts.map +1 -1
  35. package/dist/viewer/collab/collaboration.svelte.d.ts +12 -22
  36. package/dist/viewer/collab/collaboration.svelte.d.ts.map +1 -1
  37. package/dist/viewer/collab/components/props.d.ts +12 -0
  38. package/dist/viewer/collab/components/props.d.ts.map +1 -1
  39. package/dist/viewer/collab/components/remote-selection.d.ts +29 -0
  40. package/dist/viewer/collab/components/remote-selection.d.ts.map +1 -0
  41. package/dist/viewer/collab/components/share-helpers.d.ts +7 -28
  42. package/dist/viewer/collab/components/share-helpers.d.ts.map +1 -1
  43. package/dist/viewer/collab/index.d.ts +1 -1
  44. package/dist/viewer/collab/index.d.ts.map +1 -1
  45. package/dist/viewer/components/props.d.ts +68 -2
  46. package/dist/viewer/components/props.d.ts.map +1 -1
  47. package/dist/viewer/components/ribbon/ribbon-types.d.ts +7 -0
  48. package/dist/viewer/components/ribbon/ribbon-types.d.ts.map +1 -1
  49. package/dist/viewer/components/typed-exports.d.ts +19 -0
  50. package/dist/viewer/components/typed-exports.d.ts.map +1 -0
  51. package/dist/viewer/editor/editor-controller-deps.d.ts +15 -0
  52. package/dist/viewer/editor/editor-controller-deps.d.ts.map +1 -1
  53. package/dist/viewer/editor/editor-controller.svelte.d.ts +5 -0
  54. package/dist/viewer/editor/editor-controller.svelte.d.ts.map +1 -1
  55. package/dist/viewer/editor/editor-state.svelte.d.ts +6 -0
  56. package/dist/viewer/editor/editor-state.svelte.d.ts.map +1 -1
  57. package/dist/viewer/export/export-ui.svelte.d.ts +5 -0
  58. package/dist/viewer/export/export-ui.svelte.d.ts.map +1 -1
  59. package/dist/viewer/index.d.ts +2816 -22
  60. package/dist/viewer/index.d.ts.map +1 -1
  61. package/dist/viewer/index.js +392 -14
  62. package/dist/viewer/presentation/animation-playback-helpers.d.ts +43 -0
  63. package/dist/viewer/presentation/animation-playback-helpers.d.ts.map +1 -0
  64. package/dist/viewer/presentation/animation-playback.svelte.d.ts +50 -40
  65. package/dist/viewer/presentation/animation-playback.svelte.d.ts.map +1 -1
  66. package/dist/viewer/presentation/animation-sound.d.ts +20 -0
  67. package/dist/viewer/presentation/animation-sound.d.ts.map +1 -0
  68. package/dist/viewer/presentation/apply-animation-styles.d.ts +6 -5
  69. package/dist/viewer/presentation/apply-animation-styles.d.ts.map +1 -1
  70. package/dist/viewer/presentation/index.d.ts +2 -1
  71. package/dist/viewer/presentation/index.d.ts.map +1 -1
  72. package/dist/viewer/presentation/keyframes.d.ts +9 -0
  73. package/dist/viewer/presentation/keyframes.d.ts.map +1 -1
  74. package/dist/viewer/presentation/presentation-controller.svelte.d.ts +32 -10
  75. package/dist/viewer/presentation/presentation-controller.svelte.d.ts.map +1 -1
  76. package/dist/viewer/presentation/presentation-effects.svelte.d.ts +6 -2
  77. package/dist/viewer/presentation/presentation-effects.svelte.d.ts.map +1 -1
  78. package/dist/viewer/presentation/presentation-triggers.d.ts +18 -0
  79. package/dist/viewer/presentation/presentation-triggers.d.ts.map +1 -0
  80. package/dist/viewer/presentation/transition-overlay.d.ts +23 -0
  81. package/dist/viewer/presentation/transition-overlay.d.ts.map +1 -0
  82. package/dist/viewer/render/smartart-view.d.ts +7 -2
  83. package/dist/viewer/render/smartart-view.d.ts.map +1 -1
  84. package/dist/viewer/state/create-viewer-state-collab.svelte.d.ts +37 -0
  85. package/dist/viewer/state/create-viewer-state-collab.svelte.d.ts.map +1 -0
  86. package/dist/viewer/state/create-viewer-state-editor-ui.svelte.d.ts +42 -0
  87. package/dist/viewer/state/create-viewer-state-editor-ui.svelte.d.ts.map +1 -0
  88. package/dist/viewer/state/create-viewer-state-export-notes.svelte.d.ts +36 -0
  89. package/dist/viewer/state/create-viewer-state-export-notes.svelte.d.ts.map +1 -0
  90. package/dist/viewer/state/create-viewer-state-presentation.svelte.d.ts +30 -0
  91. package/dist/viewer/state/create-viewer-state-presentation.svelte.d.ts.map +1 -0
  92. package/dist/viewer/state/create-viewer-state-types.d.ts +134 -0
  93. package/dist/viewer/state/create-viewer-state-types.d.ts.map +1 -0
  94. package/dist/viewer/state/create-viewer-state.svelte.d.ts +30 -0
  95. package/dist/viewer/state/create-viewer-state.svelte.d.ts.map +1 -0
  96. package/dist/viewer/state/index.d.ts +2 -0
  97. package/dist/viewer/state/index.d.ts.map +1 -1
  98. package/dist/viewer/state/presentation-element-states-context.d.ts +37 -0
  99. package/dist/viewer/state/presentation-element-states-context.d.ts.map +1 -0
  100. package/dist/viewer/state/render-context.d.ts +3 -1
  101. package/dist/viewer/state/render-context.d.ts.map +1 -1
  102. package/dist/viewer/state/viewer-effects.svelte.d.ts +8 -0
  103. package/dist/viewer/state/viewer-effects.svelte.d.ts.map +1 -1
  104. package/dist/viewer/state/viewer-options-context.d.ts +10 -0
  105. package/dist/viewer/state/viewer-options-context.d.ts.map +1 -0
  106. package/dist/viewer/state/viewer-options-wiring.svelte.d.ts +31 -0
  107. package/dist/viewer/state/viewer-options-wiring.svelte.d.ts.map +1 -0
  108. package/dist/viewer/state/viewer-options.svelte.d.ts +55 -0
  109. package/dist/viewer/state/viewer-options.svelte.d.ts.map +1 -0
  110. package/dist/viewer/style/element-style.d.ts +3 -3
  111. package/dist/viewer/style/element-style.d.ts.map +1 -1
  112. package/dist/viewer/types.d.ts +16 -5
  113. package/dist/viewer/types.d.ts.map +1 -1
  114. package/dist/{y-webrtc-BdH40MC6.js → y-webrtc-BiViqyU2.js} +1079 -1101
  115. package/package.json +18 -5
  116. package/dist/export-N-hrLHrd.js +0 -38592
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Component } from 'svelte';
2
+ import { LanguageModel, ChatTransport, UIMessage, ToolSet } from 'ai';
2
3
 
3
4
  //#region src/core/types/actions.d.ts
4
5
  /**
@@ -204,6 +205,13 @@ interface PptxShapeLocks {
204
205
  noAdjustHandles?: boolean;
205
206
  noChangeArrowheads?: boolean;
206
207
  noChangeShapeType?: boolean;
208
+ /**
209
+ * Text-box flag from `p:cNvSpPr/@txBox`. Not a lock in the strict sense,
210
+ * but it lives on the same non-visual-properties node as `a:spLocks`, so
211
+ * it is captured here to round-trip through the model. When `true` the
212
+ * shape is a plain text box (no fill/line by default).
213
+ */
214
+ txBox?: boolean;
207
215
  }
208
216
  /**
209
217
  * A drawing guide parsed from OOXML extension lists.
@@ -793,6 +801,15 @@ interface ShapeStyle {
793
801
  r: number;
794
802
  b: number;
795
803
  };
804
+ /** Raw tileRect LTRB values (0..1 fractions, may be negative) from
805
+ * `a:gradFill/a:tileRect`. Defines the rectangle the gradient tile occupies
806
+ * before any flip/tiling is applied. */
807
+ fillGradientTileRect?: {
808
+ l: number;
809
+ t: number;
810
+ r: number;
811
+ b: number;
812
+ };
796
813
  /** Gradient tile flip mode (`a:gradFill/@flip`).
797
814
  * `none` = no tiling flip (default), `x|y|xy` = mirror in the named axis. */
798
815
  fillGradientFlip?: 'none' | 'x' | 'y' | 'xy';
@@ -810,6 +827,20 @@ interface ShapeStyle {
810
827
  * round-trip serialisation. See {@link fillColorXml} for the rationale.
811
828
  */
812
829
  strokeColorXml?: XmlObject;
830
+ /**
831
+ * Kind of fill painted on the outline (`a:ln` child). Distinguishes a solid
832
+ * outline from a gradient/pattern/none outline so save can emit the correct
833
+ * single line fill instead of collapsing every outline to `a:solidFill`
834
+ * (which, alongside a preserved `a:gradFill`/`a:pattFill`, produces an
835
+ * invalid dual-fill `<a:ln>`).
836
+ */
837
+ strokeFillMode?: 'solid' | 'gradient' | 'pattern' | 'none';
838
+ /** Raw `a:ln/a:gradFill` XML preserved for round-trip when the outline is
839
+ * gradient-filled. Re-emitted verbatim as the line's single fill on save. */
840
+ strokeGradientXml?: XmlObject;
841
+ /** Raw `a:ln/a:pattFill` XML preserved for round-trip when the outline is
842
+ * pattern-filled. Re-emitted verbatim as the line's single fill on save. */
843
+ strokePatternXml?: XmlObject;
813
844
  strokeWidth?: number;
814
845
  strokeOpacity?: number;
815
846
  strokeDash?: StrokeDashType;
@@ -991,6 +1022,14 @@ interface ShapeStyle {
991
1022
  };
992
1023
  /** Fill overlay blend mode from effectDag `a:fillOverlay/@blend`. */
993
1024
  dagFillOverlayBlend?: 'over' | 'mult' | 'screen' | 'darken' | 'lighten';
1025
+ /**
1026
+ * Fill overlay tint colour (hex `#RRGGBB`) from effectDag `a:fillOverlay`'s
1027
+ * `a:solidFill`/`a:gradFill`. Painted as a blended overlay layer over the
1028
+ * element; the blend mode comes from {@link dagFillOverlayBlend}.
1029
+ */
1030
+ dagFillOverlayColor?: string;
1031
+ /** Fill overlay tint opacity (0-1), from the overlay fill colour's alpha. */
1032
+ dagFillOverlayOpacity?: number;
994
1033
  /** `<a:lnRef @idx>` — 1-based index into the theme's lnStyleLst. */
995
1034
  lnRefIdx?: number;
996
1035
  /** Raw XML colour child of `<a:lnRef>` (e.g. `<a:schemeClr>` with transforms). */
@@ -1118,6 +1157,13 @@ interface TextStyle {
1118
1157
  kerning?: number;
1119
1158
  /** Text highlight colour as hex string (`a:highlight`). */
1120
1159
  highlightColor?: string;
1160
+ /**
1161
+ * Raw colour-choice XML preserved from `a:highlight` so a themed highlight
1162
+ * (`a:schemeClr` / `a:sysClr` / `a:prstClr`) re-emits with its original
1163
+ * identity rather than being flattened to `<a:srgbClr/>` on save. On save we
1164
+ * re-emit verbatim when the resolved {@link highlightColor} still matches.
1165
+ */
1166
+ highlightColorXml?: XmlObject;
1121
1167
  /** Text-level gradient fill CSS string (from `a:rPr > a:gradFill`). */
1122
1168
  textFillGradient?: string;
1123
1169
  /** Structured gradient stops for text fill round-trip serialization. */
@@ -1229,10 +1275,36 @@ interface TextStyle {
1229
1275
  eastAsiaFont?: string;
1230
1276
  /** Complex Script font family from `a:cs`. */
1231
1277
  complexScriptFont?: string;
1278
+ /**
1279
+ * Theme-font token (`+mj-lt` / `+mn-lt` / ...) authored on `a:latin`, when
1280
+ * present. {@link fontFamily} holds the resolved concrete face for
1281
+ * rendering; this preserves the token linkage so the writer re-emits the
1282
+ * token rather than the flattened face (see #84).
1283
+ */
1284
+ latinFontThemeToken?: string;
1285
+ /** Theme-font token authored on `a:ea` (e.g. `+mn-ea`), when present. */
1286
+ eastAsiaFontThemeToken?: string;
1287
+ /** Theme-font token authored on `a:cs` (e.g. `+mn-cs`), when present. */
1288
+ complexScriptFontThemeToken?: string;
1289
+ /**
1290
+ * Automatic per-script fallback face resolved from the theme's
1291
+ * `<a:font script="...">` overrides for a run whose text is dominantly
1292
+ * CJK / Arabic / Hebrew / Thai (see #83). A rendering hint only: it is not
1293
+ * serialised back on save, so it never disturbs the round-trip typefaces.
1294
+ */
1295
+ scriptFallbackFont?: string;
1232
1296
  /** Text language from `a:rPr/@lang`. */
1233
1297
  language?: string;
1234
1298
  /** Hyperlink mouse-over target from `a:hlinkMouseOver`. */
1235
1299
  hyperlinkMouseOver?: string;
1300
+ /**
1301
+ * Raw `a:snd` (embedded WAV audio) child of `a:hlinkClick`, preserved
1302
+ * verbatim (carries `@r:embed` + `@name`). Round-tripped on save so the
1303
+ * click sound survives instead of being dropped.
1304
+ */
1305
+ hyperlinkSoundXml?: XmlObject;
1306
+ /** Raw `a:snd` child of `a:hlinkMouseOver`, preserved verbatim for round-trip. */
1307
+ hyperlinkMouseOverSoundXml?: XmlObject;
1236
1308
  /** Hyperlink invalidUrl attribute (`a:hlinkClick/@invalidUrl`). */
1237
1309
  hyperlinkInvalidUrl?: string;
1238
1310
  /** Hyperlink target frame (`a:hlinkClick/@tgtFrame`). */
@@ -1576,6 +1648,15 @@ interface TextSegment {
1576
1648
  * on the first segment of a paragraph.
1577
1649
  */
1578
1650
  endParaRunProperties?: Record<string, unknown>;
1651
+ /**
1652
+ * Per-paragraph properties (alignment, spacing, margins, indent, tab stops,
1653
+ * rtl) authored on this paragraph's own `a:pPr` (#69). Only meaningful on
1654
+ * the first segment of a paragraph. When present, the writer emits these
1655
+ * per paragraph instead of collapsing one shape-level pPr onto every
1656
+ * paragraph. Only the paragraph-geometry keys of {@link TextStyle} are
1657
+ * populated; unrelated fields fall back to the shape-level style.
1658
+ */
1659
+ paragraphProperties?: TextStyle;
1579
1660
  /**
1580
1661
  * Phonetic annotation text from `a:ruby > a:rt` (e.g. furigana, pinyin).
1581
1662
  * When present, the renderer should wrap the base text with an HTML `<ruby>` tag.
@@ -1881,6 +1962,75 @@ interface PptxChartProtection {
1881
1962
  rawXml?: XmlObject;
1882
1963
  }
1883
1964
  //#endregion
1965
+ //#region src/core/types/chart-user-shapes.d.ts
1966
+ /**
1967
+ * Types for chart drawing-overlay shapes (`c:userShapes`).
1968
+ *
1969
+ * A chart's `c:userShapes` element carries an `r:id` that references a
1970
+ * separate drawing part (`ppt/drawings/drawingN.xml`) whose root is a
1971
+ * `c:userShapes` element populated with `cdr:relSizeAnchor` /
1972
+ * `cdr:absSizeAnchor` wrappers around `sp` / `pic` / `cxnSp` shapes drawn on
1973
+ * top of the chart plot. These interfaces describe the parsed, renderable
1974
+ * overlay model. The raw reference is preserved separately on
1975
+ * {@link PptxChartData.userShapesXml} for verbatim round-trip save; this model
1976
+ * is render-only.
1977
+ *
1978
+ * @module pptx-types/chart-user-shapes
1979
+ */
1980
+ /** A single paragraph of overlay-shape text with light formatting. */
1981
+ interface PptxChartUserShapeParagraph {
1982
+ /** Joined run text of the paragraph. */
1983
+ text: string;
1984
+ /** Font size in points (`a:rPr/@sz` divided by 100), when present. */
1985
+ fontSize?: number;
1986
+ /** Whether the first run is bold (`a:rPr/@b`). */
1987
+ bold?: boolean;
1988
+ /** Whether the first run is italic (`a:rPr/@i`). */
1989
+ italic?: boolean;
1990
+ /** Resolved run colour hex (e.g. `"#FF0000"`), when present. */
1991
+ color?: string;
1992
+ /** Paragraph alignment (`a:pPr/@algn`): left / centre / right. */
1993
+ align?: 'l' | 'ctr' | 'r';
1994
+ }
1995
+ /**
1996
+ * A parsed chart-overlay shape positioned by a drawing anchor.
1997
+ *
1998
+ * Position is expressed as chart-relative fractions in {@link from}. For a
1999
+ * `relSizeAnchor` the opposite corner is {@link to} (also fractional); for an
2000
+ * `absSizeAnchor` the extent is {@link ext} in EMU.
2001
+ */
2002
+ interface PptxChartUserShape {
2003
+ /** Shape kind: text/preset shape, connector, or picture. */
2004
+ kind: 'sp' | 'cxnSp' | 'pic';
2005
+ /** Anchor kind that positioned the shape. */
2006
+ anchor: 'rel' | 'abs';
2007
+ /** Top-left corner as chart-relative fractions (0-1). */
2008
+ from: {
2009
+ x: number;
2010
+ y: number;
2011
+ };
2012
+ /** Bottom-right corner as chart-relative fractions (0-1); relSizeAnchor only. */
2013
+ to?: {
2014
+ x: number;
2015
+ y: number;
2016
+ };
2017
+ /** Extent in EMU (cx, cy); absSizeAnchor only. */
2018
+ ext?: {
2019
+ cx: number;
2020
+ cy: number;
2021
+ };
2022
+ /** Preset geometry name (`a:prstGeom/@prst`), defaulting to `"rect"`. */
2023
+ prst?: string;
2024
+ /** Resolved solid-fill hex colour, when present. */
2025
+ fill?: string;
2026
+ /** Resolved line/stroke hex colour, when present. */
2027
+ stroke?: string;
2028
+ /** Line width in points (`a:ln/@w` divided by 12700), when present. */
2029
+ strokeWidth?: number;
2030
+ /** Text paragraphs of the shape's `txBody`, when present. */
2031
+ paragraphs?: PptxChartUserShapeParagraph[];
2032
+ }
2033
+ //#endregion
1884
2034
  //#region src/core/types/chart.d.ts
1885
2035
  /**
1886
2036
  * Supported chart type discriminators.
@@ -2214,6 +2364,15 @@ interface PptxChartTreemapOptions {
2214
2364
  interface PptxChartSeries {
2215
2365
  name: string;
2216
2366
  values: number[];
2367
+ /**
2368
+ * Blank-value mask aligned index-for-index with {@link values}: `true` marks
2369
+ * a category whose numeric cache point (`c:numCache/c:pt`) was absent or
2370
+ * empty, i.e. a genuine blank rather than a real `0`. Present only when the
2371
+ * source series actually contains blanks; when set, blank slots in
2372
+ * {@link values} carry `0` as a placeholder. Renderers honour
2373
+ * `c:dispBlanksAs` (gap / zero / span) using this mask.
2374
+ */
2375
+ blanks?: boolean[];
2217
2376
  color?: string;
2218
2377
  trendlines?: PptxChartTrendline[];
2219
2378
  errBars?: PptxChartErrBars[];
@@ -2221,6 +2380,18 @@ interface PptxChartSeries {
2221
2380
  marker?: PptxChartMarker;
2222
2381
  dataLabels?: PptxChartDataLabel[];
2223
2382
  explosion?: number;
2383
+ /**
2384
+ * Series-level `c:invertIfNegative`: when true, bar/column data points with a
2385
+ * negative value are drawn with an inverted (lightened) fill. A per-point
2386
+ * `c:dPt/c:invertIfNegative` overrides this for that point. Absent when the
2387
+ * source XML omits the flag.
2388
+ */
2389
+ invertIfNegative?: boolean;
2390
+ /**
2391
+ * Whether this line/scatter series is drawn with bezier smoothing
2392
+ * (`c:ser/c:smooth/@val`). Absent when the source XML omits `c:smooth`.
2393
+ */
2394
+ smooth?: boolean;
2224
2395
  /** Axis ID this series is plotted against (links to PptxChartAxisFormatting.axisId). */
2225
2396
  axisId?: number;
2226
2397
  /**
@@ -2423,6 +2594,14 @@ interface PptxChartManualLayout {
2423
2594
  y?: number;
2424
2595
  width?: number;
2425
2596
  height?: number;
2597
+ /**
2598
+ * Raw `c:extLst` (CT_ExtensionList) of the `c:manualLayout`, captured
2599
+ * verbatim so it round-trips through the typed model. Without this, a dirty
2600
+ * write of an edited layout would drop the extension list (the manual node
2601
+ * is rebuilt from the typed fields). Emitted as the trailing child, matching
2602
+ * the CT_ManualLayout schema order.
2603
+ */
2604
+ ext?: XmlObject;
2426
2605
  }
2427
2606
  /**
2428
2607
  * Typed manual layouts for chart regions that accept `c:layout`.
@@ -2487,6 +2666,33 @@ interface PptxChartData {
2487
2666
  style?: PptxChartStyle;
2488
2667
  /** Grouping mode for bar/area/line charts: 'clustered' | 'stacked' | 'percentStacked' */
2489
2668
  grouping?: 'clustered' | 'stacked' | 'percentStacked';
2669
+ /**
2670
+ * Whether the first (or only) series varies its point colours
2671
+ * (`c:varyColors/@val`). Pie/doughnut default this on; single-series
2672
+ * bar/column honour it by giving each point a distinct palette colour.
2673
+ * Absent when the source XML omits `c:varyColors`.
2674
+ */
2675
+ varyColors?: boolean;
2676
+ /**
2677
+ * Pie/doughnut start angle in degrees clockwise from 12 o'clock
2678
+ * (`c:firstSliceAng/@val`, 0 through 360). Absent uses the default 0.
2679
+ */
2680
+ firstSliceAngle?: number;
2681
+ /**
2682
+ * Doughnut hole diameter as a percentage of the outer diameter
2683
+ * (`c:holeSize/@val`, 10 through 90). Absent uses the renderer default.
2684
+ */
2685
+ doughnutHoleSize?: number;
2686
+ /**
2687
+ * Bar/column gap between category clusters as a percentage of bar width
2688
+ * (`c:gapWidth/@val`, 0 through 500). Absent uses the renderer default.
2689
+ */
2690
+ barGapWidth?: number;
2691
+ /**
2692
+ * Clustered bar/column overlap between series within a category as a
2693
+ * percentage (`c:overlap/@val`, -100 through 100). Absent uses 0.
2694
+ */
2695
+ barOverlap?: number;
2490
2696
  /** Internal: path to the chart XML part in the PPTX archive (for round-trip save). */
2491
2697
  chartPartPath?: string;
2492
2698
  /** Internal: relationship ID linking the graphic frame to the chart part. */
@@ -2587,6 +2793,15 @@ interface PptxChartData {
2587
2793
  * attempting to parse the nested drawing tree.
2588
2794
  */
2589
2795
  userShapesXml?: unknown;
2796
+ /**
2797
+ * Parsed, renderable drawing-overlay shapes resolved from the separate
2798
+ * drawing part referenced by `c:userShapes/@r:id`
2799
+ * (`ppt/drawings/drawingN.xml`). Each entry carries chart-relative anchor
2800
+ * geometry plus light shape/text formatting so the viewer can render an
2801
+ * overlay on top of the chart plot. Render-only: {@link userShapesXml}
2802
+ * remains the source of truth for round-trip save.
2803
+ */
2804
+ userShapes?: PptxChartUserShape[];
2590
2805
  /**
2591
2806
  * Raw `c:pivotFmts` XML subtree preserved verbatim.
2592
2807
  *
@@ -3294,6 +3509,18 @@ interface PptxSmartArtColorTransform extends PptxSmartArtDefinitionMetadata {
3294
3509
  fillColors: string[];
3295
3510
  /** Ordered resolved line colors for rendering. */
3296
3511
  lineColors: string[];
3512
+ /** Ordered resolved text-fill colors (primary styleLbl `txFillClrLst`). */
3513
+ textFillColors?: string[];
3514
+ /** Ordered resolved text-line colors (primary styleLbl `txLinClrLst`). */
3515
+ textLineColors?: string[];
3516
+ /** Ordered resolved effect colors (primary styleLbl `effectClrLst`). */
3517
+ effectColors?: string[];
3518
+ /** Ordered resolved text-effect colors (primary styleLbl `txEffectClrLst`). */
3519
+ textEffectColors?: string[];
3520
+ /** Fill-list span/cycle + hue-direction interpolation of the primary styleLbl. */
3521
+ fillInterpolation?: PptxSmartArtColorListMetadata;
3522
+ /** Line-list span/cycle + hue-direction interpolation of the primary styleLbl. */
3523
+ lineInterpolation?: PptxSmartArtColorListMetadata;
3297
3524
  /** Ordered CT_CTStyleLabel metadata. */
3298
3525
  labels?: PptxSmartArtColorStyleLabel[];
3299
3526
  }
@@ -3414,6 +3641,40 @@ interface PptxSmartArtDrawingShape extends PptxCustomPathProperties {
3414
3641
  skewY?: number;
3415
3642
  /** Solid fill colour (hex). */
3416
3643
  fillColor?: string;
3644
+ /**
3645
+ * Gradient fill stops when the cached shape uses `a:gradFill`. Positions are
3646
+ * 0..100 (percent). Renderers emit an SVG/CSS gradient instead of a flat box.
3647
+ */
3648
+ fillGradientStops?: Array<{
3649
+ color: string;
3650
+ position: number;
3651
+ opacity?: number;
3652
+ }>;
3653
+ /** Gradient geometry type (`linear` for `a:lin`, `radial` for `a:path`). */
3654
+ fillGradientType?: 'linear' | 'radial';
3655
+ /** Linear gradient angle in degrees (0..360). */
3656
+ fillGradientAngle?: number;
3657
+ /** Pattern fill preset name from `a:pattFill/@prst` (e.g. "pct50", "cross"). */
3658
+ fillPatternPreset?: string;
3659
+ /** Pattern fill foreground colour (hex) from `a:pattFill/a:fgClr`. */
3660
+ fillPatternForegroundColor?: string;
3661
+ /** Pattern fill background colour (hex) from `a:pattFill/a:bgClr`. */
3662
+ fillPatternBackgroundColor?: string;
3663
+ /**
3664
+ * Relationship id of a picture (blip) fill's embedded image, from
3665
+ * `a:blipFill/a:blip/@r:embed`. The image bytes are resolved separately; see
3666
+ * {@link fillImageUrl}.
3667
+ */
3668
+ fillBlipEmbedId?: string;
3669
+ /**
3670
+ * Resolved data-URI/URL for a picture (blip) fill, when the embedded image
3671
+ * part could be resolved. Absent when only {@link fillBlipEmbedId} is known.
3672
+ */
3673
+ fillImageUrl?: string;
3674
+ /** Whether the cached shape carries an outer-shadow effect (`a:effectLst`). */
3675
+ hasShadow?: boolean;
3676
+ /** Resolved outer-shadow colour (hex), when present. */
3677
+ shadowColor?: string;
3417
3678
  /** Stroke colour (hex). */
3418
3679
  strokeColor?: string;
3419
3680
  /** Stroke width in points. */
@@ -3448,6 +3709,40 @@ interface PptxSmartArtChrome {
3448
3709
  /** Outline stroke width in points. */
3449
3710
  outlineWidth?: number;
3450
3711
  }
3712
+ /**
3713
+ * Presentation layout variables from `dgm:prSet/dgm:presLayoutVars` (data model)
3714
+ * or `dgm:varLst` (layout definition defaults).
3715
+ *
3716
+ * These drive how the DiagramML layout interpreter arranges points: flow
3717
+ * direction, hierarchy branch style, org-chart mode, and child count limits.
3718
+ * The fallback layout engine can consult them for direction/org-chart hints.
3719
+ *
3720
+ * @example
3721
+ * ```ts
3722
+ * const vars: PptxSmartArtPresLayoutVars = { direction: "rev", orgChart: true };
3723
+ * // => satisfies PptxSmartArtPresLayoutVars
3724
+ * ```
3725
+ */
3726
+ interface PptxSmartArtPresLayoutVars {
3727
+ /** Flow direction (`dgm:dir`): "norm" (default) or "rev" (reversed/RTL). */
3728
+ direction?: 'norm' | 'rev';
3729
+ /** Hierarchy branch style (`dgm:hierBranch`): std/init/l/r/hang. */
3730
+ hierarchyBranch?: 'std' | 'init' | 'l' | 'r' | 'hang';
3731
+ /** Org-chart mode enabled (`dgm:orgChart`). */
3732
+ orgChart?: boolean;
3733
+ /** Maximum children per node (`dgm:chMax`, -1 = unbounded). */
3734
+ childMax?: number;
3735
+ /** Preferred children per node (`dgm:chPref`, -1 = unbounded). */
3736
+ childPreferred?: number;
3737
+ /** Whether bullets are enabled (`dgm:bulletEnabled`). */
3738
+ bulletEnabled?: boolean;
3739
+ /** Animation-by-level setting (`dgm:animLvl`). */
3740
+ animationLevel?: string;
3741
+ /** Animate-one setting (`dgm:animOne`). */
3742
+ animateOne?: string;
3743
+ /** Allowed resize handles (`dgm:resizeHandles`). */
3744
+ resizeHandles?: string;
3745
+ }
3451
3746
  /**
3452
3747
  * Complete parsed SmartArt data for a {@link SmartArtPptxElement}.
3453
3748
  *
@@ -3489,6 +3784,12 @@ interface PptxSmartArtData {
3489
3784
  quickStyle?: PptxSmartArtQuickStyle;
3490
3785
  /** Editable metadata from the related DiagramML layout definition. */
3491
3786
  layoutDefinition?: PptxSmartArtLayoutDefinition;
3787
+ /**
3788
+ * Presentation layout variables (direction, hierarchy branch, org-chart,
3789
+ * child limits, bullets) from `dgm:presLayoutVars` / layout `dgm:varLst`.
3790
+ * Consulted by the fallback layout engine for direction/org-chart hints.
3791
+ */
3792
+ presLayoutVars?: PptxSmartArtPresLayoutVars;
3492
3793
  /** Relationship ID for the diagram data part (for round-trip save). */
3493
3794
  dataRelId?: string;
3494
3795
  /** Relationship ID for the diagram layout part. */
@@ -3521,7 +3822,7 @@ interface PptxSmartArtData {
3521
3822
  /**
3522
3823
  * Per-cell visual style for a table cell.
3523
3824
  *
3524
- * All fields are optional unset values inherit from the table style.
3825
+ * All fields are optional - unset values inherit from the table style.
3525
3826
  *
3526
3827
  * @example
3527
3828
  * ```ts
@@ -3649,6 +3950,52 @@ interface PptxTableCellStyle {
3649
3950
  patternFillForeground?: string;
3650
3951
  /** Pattern fill background colour. */
3651
3952
  patternFillBackground?: string;
3953
+ /**
3954
+ * Cell 3D bevel + lighting from `a:tcPr/a:cell3D` (CT_Cell3D,
3955
+ * ECMA-376 §21.1.3.1). Rendered as a CSS bevel treatment.
3956
+ */
3957
+ cell3D?: PptxTableCell3D;
3958
+ /**
3959
+ * `a:tcPr/@anchorCtr` - centre the text block in the direction
3960
+ * perpendicular to the text flow (horizontal centring for horizontal text).
3961
+ */
3962
+ anchorCtr?: boolean;
3963
+ /**
3964
+ * `a:tcPr/@horzOverflow` (ST_TextHorzOverflowType): `clip` clips text at
3965
+ * the cell edge, `overflow` (the default) lets it spill.
3966
+ */
3967
+ horzOverflow?: 'clip' | 'overflow';
3968
+ }
3969
+ /**
3970
+ * Cell 3D bevel + lighting parsed from `a:tcPr/a:cell3D` (CT_Cell3D).
3971
+ *
3972
+ * Only the fields needed to render a plausible bevel treatment are captured;
3973
+ * verbatim round-trip of the full node is handled separately by the save path.
3974
+ *
3975
+ * @example
3976
+ * ```ts
3977
+ * const c3d: PptxTableCell3D = {
3978
+ * bevelWidth: 8,
3979
+ * bevelHeight: 8,
3980
+ * bevelPreset: 'circle',
3981
+ * material: 'plastic',
3982
+ * };
3983
+ * // => satisfies PptxTableCell3D
3984
+ * ```
3985
+ */
3986
+ interface PptxTableCell3D {
3987
+ /** Bevel width in px (from `a:bevel@w`, EMU converted). */
3988
+ bevelWidth?: number;
3989
+ /** Bevel height in px (from `a:bevel@h`, EMU converted). */
3990
+ bevelHeight?: number;
3991
+ /** Bevel preset name (`a:bevel@prst`, e.g. `circle`, `relaxedInset`). */
3992
+ bevelPreset?: string;
3993
+ /** Preset material (`a:cell3D@prstMaterial`, e.g. `plastic`, `metal`). */
3994
+ material?: string;
3995
+ /** Light rig type (`a:lightRig@rig`, e.g. `threePt`, `soft`). */
3996
+ lightRig?: string;
3997
+ /** Light rig direction (`a:lightRig@dir`, e.g. `tl`, `t`, `tr`). */
3998
+ lightRigDirection?: string;
3652
3999
  }
3653
4000
  /**
3654
4001
  * A single table cell with text content, optional style, and merge info.
@@ -3761,12 +4108,50 @@ interface PptxTableData {
3761
4108
  * ```
3762
4109
  */
3763
4110
  interface ParsedTableStyleFill {
3764
- /** Theme colour key (e.g. `accent1`, `dk1`). */
4111
+ /**
4112
+ * Theme colour key (e.g. `accent1`, `dk1`). Empty string when the fill is a
4113
+ * non-scheme fill (explicit sRGB, gradient, pattern, or none) that carries
4114
+ * no theme colour reference; the renderer then resolves {@link color},
4115
+ * {@link gradient}, {@link pattern}, or {@link noFill} instead.
4116
+ */
3765
4117
  schemeColor: string;
3766
4118
  /** Tint value (0-100 000). */
3767
4119
  tint?: number;
3768
4120
  /** Shade value (0-100 000). */
3769
4121
  shade?: number;
4122
+ /** Explicit sRGB hex colour (e.g. `#FF8800`) from `a:srgbClr`. */
4123
+ color?: string;
4124
+ /** The fill was `a:noFill`: renders transparent and clears lower layers. */
4125
+ noFill?: boolean;
4126
+ /** Gradient fill parsed from `a:gradFill`. */
4127
+ gradient?: ParsedTableStyleGradient;
4128
+ /** Preset pattern fill parsed from `a:pattFill`. */
4129
+ pattern?: ParsedTableStylePattern;
4130
+ }
4131
+ /** A single colour stop within a {@link ParsedTableStyleGradient}. */
4132
+ interface ParsedTableStyleGradientStop {
4133
+ /** Stop position as a percentage (0-100). */
4134
+ position: number;
4135
+ /** Stop colour (scheme or explicit sRGB). */
4136
+ fill: ParsedTableStyleFill;
4137
+ }
4138
+ /** A gradient fill parsed from a table style section's `a:gradFill`. */
4139
+ interface ParsedTableStyleGradient {
4140
+ /** Ordered colour stops. */
4141
+ stops: ParsedTableStyleGradientStop[];
4142
+ /** Linear gradient angle in degrees (from `a:lin@ang`, 60000ths -> deg). */
4143
+ angle?: number;
4144
+ /** Gradient family: linear (`a:lin`) or radial (`a:path`). */
4145
+ type: 'linear' | 'radial';
4146
+ }
4147
+ /** A preset pattern fill parsed from a table style section's `a:pattFill`. */
4148
+ interface ParsedTableStylePattern {
4149
+ /** OOXML preset name (e.g. `ltDnDiag`) from `a:pattFill@prst`. */
4150
+ preset: string;
4151
+ /** Foreground colour (`a:fgClr`). */
4152
+ foreground?: ParsedTableStyleFill;
4153
+ /** Background colour (`a:bgClr`). */
4154
+ background?: ParsedTableStyleFill;
3770
4155
  }
3771
4156
  /**
3772
4157
  * A single entry in the parsed table style map.
@@ -3793,12 +4178,67 @@ interface ParsedTableStyleText {
3793
4178
  bold?: boolean;
3794
4179
  /** Font italic. */
3795
4180
  italic?: boolean;
4181
+ /** Font underline (from `a:tcTxStyle@u`, any value other than `none`). */
4182
+ underline?: boolean;
3796
4183
  /** Font colour as theme scheme key. */
3797
4184
  fontSchemeColor?: string;
3798
4185
  /** Font colour tint (0-100 000). */
3799
4186
  fontTint?: number;
3800
4187
  /** Font colour shade (0-100 000). */
3801
4188
  fontShade?: number;
4189
+ /** Explicit sRGB hex font colour (e.g. `#FF0000`) from `a:srgbClr`. */
4190
+ fontColor?: string;
4191
+ /** Typeface from `a:font@typeface` (latin font). */
4192
+ fontFace?: string;
4193
+ /** Font-collection index from `a:fontRef@idx` (`minor`, `major`, `none`). */
4194
+ fontRefIdx?: string;
4195
+ }
4196
+ /**
4197
+ * A single border side within a table style's `a:tcStyle/a:tcBdr`.
4198
+ *
4199
+ * Corresponds to one of `a:left`, `a:right`, `a:top`, `a:bottom`,
4200
+ * `a:insideH`, `a:insideV`, `a:tl2br`, `a:bl2tr` (each a
4201
+ * `CT_ThemeableLineStyle` wrapping an `a:ln`).
4202
+ *
4203
+ * @example
4204
+ * ```ts
4205
+ * const side: ParsedTableStyleBorder = {
4206
+ * width: 1,
4207
+ * dash: 'solid',
4208
+ * fill: { schemeColor: 'lt1' },
4209
+ * };
4210
+ * // => satisfies ParsedTableStyleBorder
4211
+ * ```
4212
+ */
4213
+ interface ParsedTableStyleBorder {
4214
+ /** Line width in px (converted from the `a:ln@w` EMU value). */
4215
+ width?: number;
4216
+ /** OOXML `a:prstDash@val` (e.g. `solid`, `dash`, `sysDot`). */
4217
+ dash?: string;
4218
+ /** Border colour as a theme scheme fill (from `a:ln/a:solidFill/a:schemeClr`). */
4219
+ fill?: ParsedTableStyleFill;
4220
+ /** Explicit hex colour when the line used `a:srgbClr` (e.g. `#808080`). */
4221
+ color?: string;
4222
+ /** The line was `a:noFill` - an explicit "no border" that clears lower layers. */
4223
+ noFill?: boolean;
4224
+ }
4225
+ /**
4226
+ * The set of border sides parsed from a table style section's
4227
+ * `a:tcStyle/a:tcBdr` element.
4228
+ */
4229
+ interface ParsedTableStyleBorders {
4230
+ left?: ParsedTableStyleBorder;
4231
+ right?: ParsedTableStyleBorder;
4232
+ top?: ParsedTableStyleBorder;
4233
+ bottom?: ParsedTableStyleBorder;
4234
+ /** Interior horizontal borders between rows in the region. */
4235
+ insideH?: ParsedTableStyleBorder;
4236
+ /** Interior vertical borders between columns in the region. */
4237
+ insideV?: ParsedTableStyleBorder;
4238
+ /** Top-left to bottom-right diagonal. */
4239
+ tl2br?: ParsedTableStyleBorder;
4240
+ /** Bottom-left to top-right diagonal. */
4241
+ bl2tr?: ParsedTableStyleBorder;
3802
4242
  }
3803
4243
  /**
3804
4244
  * Table background style (CT_TableBackgroundStyle, ECMA-376 §21.1.3.7).
@@ -3834,6 +4274,24 @@ interface ParsedTableStyleEntry {
3834
4274
  swCellFill?: ParsedTableStyleFill;
3835
4275
  neCellFill?: ParsedTableStyleFill;
3836
4276
  nwCellFill?: ParsedTableStyleFill;
4277
+ /**
4278
+ * Per-role border styling from `a:tcStyle/a:tcBdr`. These supply the
4279
+ * gridlines/edges a styled table inherits from its table style when the
4280
+ * cells carry no explicit per-cell `a:lnX` overrides.
4281
+ */
4282
+ wholeTblBorders?: ParsedTableStyleBorders;
4283
+ firstRowBorders?: ParsedTableStyleBorders;
4284
+ lastRowBorders?: ParsedTableStyleBorders;
4285
+ firstColBorders?: ParsedTableStyleBorders;
4286
+ lastColBorders?: ParsedTableStyleBorders;
4287
+ band1HBorders?: ParsedTableStyleBorders;
4288
+ band2HBorders?: ParsedTableStyleBorders;
4289
+ band1VBorders?: ParsedTableStyleBorders;
4290
+ band2VBorders?: ParsedTableStyleBorders;
4291
+ seCellBorders?: ParsedTableStyleBorders;
4292
+ swCellBorders?: ParsedTableStyleBorders;
4293
+ neCellBorders?: ParsedTableStyleBorders;
4294
+ nwCellBorders?: ParsedTableStyleBorders;
3837
4295
  /** Per-role text styling from a:tcTxStyle. */
3838
4296
  wholeTblText?: ParsedTableStyleText;
3839
4297
  firstRowText?: ParsedTableStyleText;
@@ -4631,10 +5089,30 @@ interface PptxNativeAnimation {
4631
5089
  presetClass?: 'entr' | 'exit' | 'emph' | 'path';
4632
5090
  /** Effect preset sub-type identifier. */
4633
5091
  presetId?: number;
5092
+ /**
5093
+ * Effect preset direction/variant code from `p:cTn/@presetSubtype`
5094
+ * (ECMA-376 CT_TLCommonTimeNodeData). For Fly In/Out this encodes the
5095
+ * edge/corner the object travels from as a bitmask (1=top, 2=right,
5096
+ * 4=bottom, 8=left; corners combine bits). Absent means the preset default.
5097
+ */
5098
+ presetSubtype?: number;
4634
5099
  /** Duration in milliseconds. */
4635
5100
  durationMs?: number;
4636
5101
  /** Delay in milliseconds. */
4637
5102
  delayMs?: number;
5103
+ /**
5104
+ * Acceleration fraction in the range 0..1, parsed from `p:cTn/@accel`
5105
+ * (ST_PositiveFixedPercentage, stored as 1000ths of a percent). A non-zero
5106
+ * value means the effect eases in (starts slow). Absent means no easing-in.
5107
+ */
5108
+ accel?: number;
5109
+ /**
5110
+ * Deceleration fraction in the range 0..1, parsed from `p:cTn/@decel`.
5111
+ * A non-zero value means the effect eases out (ends slow). Absent means no
5112
+ * easing-out. When both {@link accel} and {@link decel} are set, the effect
5113
+ * eases in and out.
5114
+ */
5115
+ decel?: number;
4638
5116
  /** Trigger delay in milliseconds (for afterDelay). */
4639
5117
  triggerDelayMs?: number;
4640
5118
  /** SVG path string for motion path animations (`p:animMotion/@path`). */
@@ -4727,6 +5205,14 @@ interface PptxNativeAnimation {
4727
5205
  * that aren't OLE charts).
4728
5206
  */
4729
5207
  graphicBuild?: string;
5208
+ /**
5209
+ * OLE-embedded chart build attribute (`p:bldOleChart/@bld`) when this
5210
+ * animation stages an OLE chart graphic frame. Values follow
5211
+ * ST_TLOleChartBuildType: `allAtOnce`, `series`, `category`, `seriesEl`,
5212
+ * `categoryEl`. Lets a staged-reveal renderer build the chart by series /
5213
+ * category / element to match PowerPoint, rather than as one whole element.
5214
+ */
5215
+ oleChartBuild?: string;
4730
5216
  /** Schema-accurate `p:bldGraphic/p:bldAsOne|p:bldSub` representation. */
4731
5217
  graphicBuildProperties?: PptxGraphicBuild;
4732
5218
  /**
@@ -5216,6 +5702,18 @@ interface PptxAppProperties {
5216
5702
  template?: string;
5217
5703
  /** Hyperlink base URL. */
5218
5704
  hyperlinkBase?: string;
5705
+ /** Document security bitmask (`<DocSecurity>`). */
5706
+ docSecurity?: number;
5707
+ /** Number of multimedia clips (`<MMClips>`). */
5708
+ mmClips?: number;
5709
+ /** Whether thumbnail images were scaled to fit (`<ScaleCrop>`). */
5710
+ scaleCrop?: boolean;
5711
+ /** Whether hyperlinks are current (`<LinksUpToDate>`). */
5712
+ linksUpToDate?: boolean;
5713
+ /** Whether the document is shared (`<SharedDoc>`). */
5714
+ sharedDoc?: boolean;
5715
+ /** Whether hyperlinks changed since last save (`<HyperlinksChanged>`). */
5716
+ hyperlinksChanged?: boolean;
5219
5717
  }
5220
5718
  //#endregion
5221
5719
  //#region src/core/types/presentation-print-properties.d.ts
@@ -5506,7 +6004,7 @@ interface PptxTheme {
5506
6004
  * // => "morph" — one of 40+ transition effects
5507
6005
  * ```
5508
6006
  */
5509
- type PptxTransitionType = 'none' | 'cut' | 'fade' | 'push' | 'wipe' | 'split' | 'randomBar' | 'blinds' | 'checker' | 'circle' | 'comb' | 'cover' | 'diamond' | 'dissolve' | 'plus' | 'pull' | 'random' | 'strips' | 'uncover' | 'wedge' | 'wheel' | 'zoom' | 'newsflash' | 'morph' | 'conveyor' | 'doors' | 'ferris' | 'flash' | 'flythrough' | 'gallery' | 'glitter' | 'honeycomb' | 'pan' | 'prism' | 'reveal' | 'ripple' | 'shred' | 'switch' | 'vortex' | 'warp' | 'wheelReverse' | 'window' | 'cube' | 'flip' | 'rotate' | 'orbit';
6007
+ type PptxTransitionType = 'none' | 'cut' | 'fade' | 'push' | 'wipe' | 'split' | 'randomBar' | 'blinds' | 'checker' | 'circle' | 'comb' | 'cover' | 'diamond' | 'dissolve' | 'plus' | 'pull' | 'random' | 'strips' | 'uncover' | 'wedge' | 'wheel' | 'zoom' | 'newsflash' | 'morph' | 'conveyor' | 'doors' | 'ferris' | 'flash' | 'flythrough' | 'gallery' | 'glitter' | 'honeycomb' | 'pan' | 'prism' | 'reveal' | 'ripple' | 'shred' | 'switch' | 'vortex' | 'warp' | 'wheelReverse' | 'window' | 'cube' | 'flip' | 'rotate' | 'orbit' | 'fallOver' | 'drape' | 'curtains' | 'wind' | 'prestige' | 'fracture' | 'crush' | 'peelOff' | 'pageCurlDouble' | 'pageCurlSingle' | 'airplane' | 'origami';
5510
6008
  /** Split orientation from OOXML `@_orient`. */
5511
6009
  type PptxSplitOrientation = 'horz' | 'vert';
5512
6010
  /** Schema-defined `ST_TransitionSpeed` values. */
@@ -5720,6 +6218,21 @@ interface PptxActiveXControl {
5720
6218
  name?: string;
5721
6219
  /** Shape ID this control is linked to (from @spid). */
5722
6220
  shapeId?: string;
6221
+ /** X position (px) of the control's fallback picture, if present. */
6222
+ x?: number;
6223
+ /** Y position (px) of the control's fallback picture, if present. */
6224
+ y?: number;
6225
+ /** Width (px) of the control's fallback picture, if present. */
6226
+ width?: number;
6227
+ /** Height (px) of the control's fallback picture, if present. */
6228
+ height?: number;
6229
+ /**
6230
+ * Relationship ID of the control's static fallback picture
6231
+ * (`mc:AlternateContent > mc:Fallback > p:pic > p:blipFill > a:blip@r:embed`).
6232
+ * Renderers resolve this to an image so a control shows its last static
6233
+ * frame instead of a blank area (the live ActiveX cannot run in a viewer).
6234
+ */
6235
+ fallbackImageRelId?: string;
5723
6236
  /** Raw XML for round-trip preservation. */
5724
6237
  rawXml?: XmlObject;
5725
6238
  }
@@ -5846,6 +6359,13 @@ interface PptxSlide {
5846
6359
  customerData?: PptxCustomerData[];
5847
6360
  /** ActiveX control references from `p:controls` on this slide. */
5848
6361
  activeXControls?: PptxActiveXControl[];
6362
+ /**
6363
+ * Shapes parsed from a referenced legacy VML drawing part
6364
+ * (`ppt/drawings/vmlDrawing*.vml`, linked via a `legacyDrawing`
6365
+ * relationship). These are read-only render hints: the VML part itself is
6366
+ * preserved verbatim on save, so this field is not re-serialized.
6367
+ */
6368
+ legacyVmlElements?: PptxElement[];
5849
6369
  /** Per-slide header/footer flags from `<p:hf>` (P-H3). */
5850
6370
  headerFooterFlags?: PptxHeaderFooterFlags;
5851
6371
  /** Server-backed slide synchronization metadata stored in a related OPC part. */
@@ -5954,12 +6474,6 @@ interface PptxPresentationProperties {
5954
6474
  showSubtitles?: boolean;
5955
6475
  /** Typed `p:prnPr` settings. Set to null during save to remove the element. */
5956
6476
  printProperties?: PptxPresentationPrintProperties | null;
5957
- /** @deprecated Use `printProperties.printWhat`; retained as a handout compatibility alias. */
5958
- printSlidesPerPage?: number;
5959
- /** @deprecated Use `printProperties.frameSlides`. */
5960
- printFrameSlides?: boolean;
5961
- /** @deprecated Use `printProperties.colorMode`. */
5962
- printColorMode?: 'clr' | 'gray' | 'bw';
5963
6477
  /** Most-recently-used colours from the presentation palette. */
5964
6478
  mruColors?: string[];
5965
6479
  /** Grid spacing in EMUs (cx, cy). Default is 914400 / 8 = 114300. */
@@ -6206,6 +6720,37 @@ interface PptxData {
6206
6720
  */
6207
6721
  conformance?: 'strict' | 'transitional';
6208
6722
  }
6723
+ /**
6724
+ * Target format for slide export.
6725
+ *
6726
+ * @see {@link PptxExportOptions}
6727
+ */
6728
+ type PptxExportFormat = 'pdf' | 'png' | 'svg';
6729
+ /**
6730
+ * Options controlling slide export to raster or vector formats.
6731
+ *
6732
+ * @example
6733
+ * ```ts
6734
+ * const opts: PptxExportOptions = {
6735
+ * format: "png",
6736
+ * slideIndices: [0, 2, 4],
6737
+ * dpi: 300,
6738
+ * };
6739
+ * // => satisfies PptxExportOptions
6740
+ * ```
6741
+ */
6742
+ interface PptxExportOptions {
6743
+ /** Target format. */
6744
+ format: PptxExportFormat;
6745
+ /** Slide indices to export (0-based). If omitted, all slides are exported. */
6746
+ slideIndices?: number[];
6747
+ /** Output width in pixels (for PNG). Height is derived from aspect ratio. */
6748
+ width?: number;
6749
+ /** DPI for raster export (default 150). */
6750
+ dpi?: number;
6751
+ /** Whether to include hidden slides. */
6752
+ includeHidden?: boolean;
6753
+ }
6209
6754
  /**
6210
6755
  * Embedded font data extracted from a PPTX file.
6211
6756
  *
@@ -6281,96 +6826,1415 @@ interface PptxEmbeddedFont {
6281
6826
  originalPartBytes?: Uint8Array;
6282
6827
  }
6283
6828
 
6284
- /** Output format for the save pipeline. */
6285
- type PptxSaveFormat = 'pptx' | 'ppsx' | 'pptm';
6286
6829
  //#endregion
6287
- //#region src/converter/SvgExporter.d.ts
6288
- /**
6289
- * Options controlling SVG export behaviour.
6290
- */
6291
- interface SvgExportOptions {
6292
- /** Include hidden slides when exporting all. Default `false`. */
6293
- includeHidden?: boolean;
6294
- /** Slide indices to export (0-based). If omitted, all slides are exported. */
6295
- slideIndices?: number[];
6296
- /** Default font family when the element does not specify one. */
6297
- defaultFontFamily?: string;
6298
- /** Default font size in points when the element does not specify one. */
6299
- defaultFontSize?: number;
6300
- }
6301
-
6302
- //#region src/theme/types.d.ts
6830
+ //#region src/core/types/theme-presets.d.ts
6303
6831
  /**
6304
- * Theme configuration types for the PowerPoint viewer.
6305
- *
6306
- * All color values accept any valid CSS color string:
6307
- * hex (`#6366f1`), rgb (`rgb(99 102 241)`), hsl (`hsl(239 84% 67%)`),
6308
- * oklch (`oklch(0.585 0.233 277)`), named colors, etc.
6832
+ * A complete theme preset that can be applied to a presentation.
6309
6833
  *
6310
- * Framework-agnostic — shared by the React, Vue, and Angular bindings.
6311
- */
6312
- /**
6313
- * Semantic color tokens for the viewer UI.
6834
+ * @example
6835
+ * ```ts
6836
+ * import { THEME_PRESETS } from "pptx-viewer-core";
6314
6837
  *
6315
- * These map to CSS custom properties (`--pptx-<token>`) and drive all
6316
- * UI component colors. The naming follows the shadcn/ui convention so
6317
- * that Tailwind + shadcn users get a familiar experience.
6838
+ * const office = THEME_PRESETS.find(p => p.id === "office");
6839
+ * await handler.switchTheme(office.colorScheme, office.fontScheme, office.name);
6840
+ * ```
6318
6841
  */
6319
- interface ViewerThemeColors {
6320
- /** Page / root background */
6321
- background: string;
6322
- /** Default text color */
6323
- foreground: string;
6324
- /** Card / panel surface */
6325
- card: string;
6326
- /** Text on card surfaces */
6327
- cardForeground: string;
6328
- /** Popover / dropdown surface */
6329
- popover: string;
6330
- /** Text inside popovers */
6331
- popoverForeground: string;
6332
- /** Primary action color (buttons, active indicators) */
6333
- primary: string;
6334
- /** Text on primary-colored backgrounds */
6335
- primaryForeground: string;
6336
- /** Secondary / subdued action color */
6337
- secondary: string;
6338
- /** Text on secondary backgrounds */
6339
- secondaryForeground: string;
6340
- /** Muted / disabled surface */
6341
- muted: string;
6342
- /** Text on muted surfaces (also used for secondary text) */
6343
- mutedForeground: string;
6344
- /** Accent / hover-highlight surface */
6345
- accent: string;
6346
- /** Text on accent surfaces */
6347
- accentForeground: string;
6348
- /** Destructive / danger action color */
6349
- destructive: string;
6350
- /** Text on destructive backgrounds */
6351
- destructiveForeground: string;
6352
- /** Default border color */
6353
- border: string;
6354
- /** Input field border color */
6355
- input: string;
6356
- /** Focus ring color */
6357
- ring: string;
6842
+ interface PptxThemePreset {
6843
+ /** Unique identifier for the preset. */
6844
+ id: string;
6845
+ /** Human-readable display name. */
6846
+ name: string;
6847
+ /** The 12-colour scheme. */
6848
+ colorScheme: PptxThemeColorScheme;
6849
+ /** Heading and body font families. */
6850
+ fontScheme: PptxThemeFontScheme;
6358
6851
  }
6359
- /**
6360
- * Full viewer theme configuration.
6361
- *
6362
- * Every property is optional — unset values fall back to the built-in
6363
- * dark theme defaults.
6364
- */
6365
- interface ViewerTheme {
6366
- /** Semantic UI colors. Each key maps to a `--pptx-<key>` CSS custom property. */
6367
- colors?: Partial<ViewerThemeColors>;
6368
- /** Base border-radius value (e.g. `"0.5rem"`, `"8px"`). */
6369
- radius?: string;
6370
- /**
6371
- * Escape hatch: arbitrary CSS custom properties to set on the viewer
6372
- * root element. Keys should include the `--` prefix.
6373
- *
6852
+ //#endregion
6853
+ //#region src/core/builders/sdk/types.d.ts
6854
+ /** Position and size in pixels. Converted to EMU internally when needed. */
6855
+ interface ElementPosition {
6856
+ x: number;
6857
+ y: number;
6858
+ width: number;
6859
+ height: number;
6860
+ rotation?: number;
6861
+ }
6862
+ type FillInput = {
6863
+ type: 'solid';
6864
+ color: string;
6865
+ opacity?: number;
6866
+ } | {
6867
+ type: 'gradient';
6868
+ angle?: number;
6869
+ gradientType?: 'linear' | 'radial';
6870
+ stops: Array<{
6871
+ color: string;
6872
+ position: number;
6873
+ opacity?: number;
6874
+ }>;
6875
+ } | {
6876
+ type: 'pattern';
6877
+ preset: string;
6878
+ foreground?: string;
6879
+ background?: string;
6880
+ } | {
6881
+ type: 'image';
6882
+ url: string;
6883
+ mode?: 'stretch' | 'tile';
6884
+ } | {
6885
+ type: 'none';
6886
+ };
6887
+ interface StrokeInput {
6888
+ color?: string;
6889
+ width?: number;
6890
+ dash?: StrokeDashType;
6891
+ opacity?: number;
6892
+ join?: 'round' | 'bevel' | 'miter';
6893
+ cap?: 'flat' | 'rnd' | 'sq';
6894
+ }
6895
+ interface ShadowInput {
6896
+ color?: string;
6897
+ blur?: number;
6898
+ offsetX?: number;
6899
+ offsetY?: number;
6900
+ opacity?: number;
6901
+ }
6902
+ interface TextStyleInput {
6903
+ fontSize?: number;
6904
+ fontFamily?: string;
6905
+ bold?: boolean;
6906
+ italic?: boolean;
6907
+ underline?: boolean;
6908
+ strikethrough?: boolean;
6909
+ color?: string;
6910
+ alignment?: 'left' | 'center' | 'right' | 'justify';
6911
+ verticalAlignment?: 'top' | 'middle' | 'bottom';
6912
+ lineSpacing?: number;
6913
+ spaceBefore?: number;
6914
+ spaceAfter?: number;
6915
+ }
6916
+ interface TextSegmentInput {
6917
+ text: string;
6918
+ style?: Partial<TextStyleInput>;
6919
+ }
6920
+ interface TextOptions extends Partial<ElementPosition> {
6921
+ fontSize?: number;
6922
+ fontFamily?: string;
6923
+ bold?: boolean;
6924
+ italic?: boolean;
6925
+ underline?: boolean;
6926
+ strikethrough?: boolean;
6927
+ color?: string;
6928
+ alignment?: 'left' | 'center' | 'right' | 'justify';
6929
+ verticalAlignment?: 'top' | 'middle' | 'bottom';
6930
+ lineSpacing?: number;
6931
+ fill?: FillInput;
6932
+ stroke?: StrokeInput;
6933
+ shadow?: ShadowInput;
6934
+ opacity?: number;
6935
+ }
6936
+ interface ShapeOptions extends Partial<ElementPosition> {
6937
+ fill?: FillInput;
6938
+ stroke?: StrokeInput;
6939
+ text?: string;
6940
+ textStyle?: Partial<TextStyleInput>;
6941
+ adjustments?: Record<string, number>;
6942
+ shadow?: ShadowInput;
6943
+ opacity?: number;
6944
+ }
6945
+ interface ImageOptions extends Partial<ElementPosition> {
6946
+ altText?: string;
6947
+ cropLeft?: number;
6948
+ cropTop?: number;
6949
+ cropRight?: number;
6950
+ cropBottom?: number;
6951
+ opacity?: number;
6952
+ }
6953
+ interface TableInput {
6954
+ rows: TableRowInput[];
6955
+ columnWidths?: number[];
6956
+ style?: string;
6957
+ bandRows?: boolean;
6958
+ bandColumns?: boolean;
6959
+ firstRow?: boolean;
6960
+ lastRow?: boolean;
6961
+ firstCol?: boolean;
6962
+ lastCol?: boolean;
6963
+ }
6964
+ interface TableRowInput {
6965
+ cells: TableCellInput[];
6966
+ height?: number;
6967
+ }
6968
+ interface TableCellInput {
6969
+ text: string;
6970
+ style?: Partial<TextStyleInput>;
6971
+ fill?: FillInput;
6972
+ gridSpan?: number;
6973
+ rowSpan?: number;
6974
+ }
6975
+ interface TableOptions extends Partial<ElementPosition> {}
6976
+ interface ChartSeriesInput {
6977
+ name: string;
6978
+ values: number[];
6979
+ color?: string;
6980
+ boxWhiskerOptions?: PptxChartBoxWhiskerOptions;
6981
+ histogramOptions?: PptxChartHistogramOptions;
6982
+ waterfallOptions?: PptxChartWaterfallOptions;
6983
+ regionMapOptions?: PptxChartRegionMapOptions;
6984
+ treemapOptions?: PptxChartTreemapOptions;
6985
+ }
6986
+ interface ChartInput {
6987
+ series: ChartSeriesInput[];
6988
+ categories: string[];
6989
+ /** ChartEx hierarchy levels in leaf-to-root XML order. */
6990
+ categoryLevels?: string[][];
6991
+ title?: string;
6992
+ hasLegend?: boolean;
6993
+ legendPosition?: 't' | 'b' | 'l' | 'r' | 'tr';
6994
+ grouping?: 'clustered' | 'stacked' | 'percentStacked';
6995
+ }
6996
+ interface ChartOptions extends Partial<ElementPosition> {}
6997
+ interface ConnectorOptions extends Partial<ElementPosition> {
6998
+ type?: 'straight' | 'bent' | 'curved';
6999
+ stroke?: StrokeInput;
7000
+ startArrow?: ConnectorArrowType;
7001
+ endArrow?: ConnectorArrowType;
7002
+ from?: {
7003
+ elementId: string;
7004
+ site: number;
7005
+ };
7006
+ to?: {
7007
+ elementId: string;
7008
+ site: number;
7009
+ };
7010
+ }
7011
+ interface MediaOptions extends Partial<ElementPosition> {
7012
+ autoPlay?: boolean;
7013
+ loop?: boolean;
7014
+ volume?: number;
7015
+ trimStartMs?: number;
7016
+ trimEndMs?: number;
7017
+ posterFrame?: string;
7018
+ }
7019
+ interface GroupOptions extends Partial<ElementPosition> {}
7020
+ type BackgroundInput = {
7021
+ type: 'solid';
7022
+ color: string;
7023
+ } | {
7024
+ type: 'gradient';
7025
+ angle?: number;
7026
+ stops: Array<{
7027
+ color: string;
7028
+ position: number;
7029
+ }>;
7030
+ } | {
7031
+ type: 'image';
7032
+ source: string;
7033
+ };
7034
+ interface TransitionInput {
7035
+ type: PptxTransitionType;
7036
+ duration?: number;
7037
+ direction?: string;
7038
+ advanceAfterMs?: number;
7039
+ }
7040
+ interface AnimationInput {
7041
+ preset: PptxAnimationPreset;
7042
+ trigger?: PptxAnimationTrigger;
7043
+ duration?: number;
7044
+ delay?: number;
7045
+ }
7046
+ interface PresentationOptions {
7047
+ /** Slide width in EMU. Default: 12192000 (16:9 widescreen). */
7048
+ width?: number;
7049
+ /** Slide height in EMU. Default: 6858000 (16:9 widescreen). */
7050
+ height?: number;
7051
+ /** Theme configuration. */
7052
+ theme?: PresentationThemeInput;
7053
+ /** Presentation title (stored in docProps/core.xml). */
7054
+ title?: string;
7055
+ /** Presentation author. */
7056
+ creator?: string;
7057
+ /**
7058
+ * Number of blank slides to include in the initial presentation.
7059
+ * Default: 0 (no slides). Slides use the "Blank" layout.
7060
+ */
7061
+ initialSlideCount?: number;
7062
+ }
7063
+ interface PresentationThemeInput {
7064
+ name?: string;
7065
+ colors?: {
7066
+ dk1?: string;
7067
+ lt1?: string;
7068
+ dk2?: string;
7069
+ lt2?: string;
7070
+ accent1?: string;
7071
+ accent2?: string;
7072
+ accent3?: string;
7073
+ accent4?: string;
7074
+ accent5?: string;
7075
+ accent6?: string;
7076
+ hlink?: string;
7077
+ folHlink?: string;
7078
+ };
7079
+ fonts?: {
7080
+ majorFont?: string;
7081
+ minorFont?: string;
7082
+ };
7083
+ }
7084
+ //#endregion
7085
+ //#region src/core/builders/sdk/SlideBuilder.d.ts
7086
+ /**
7087
+ * Fluent builder for a single slide.
7088
+ *
7089
+ * @example
7090
+ * ```ts
7091
+ * const slide = new SlideBuilder(1)
7092
+ * .addText("Hello World", { fontSize: 36, bold: true, x: 100, y: 50 })
7093
+ * .addShape("roundRect", { fill: { type: "solid", color: "#4472C4" } })
7094
+ * .setNotes("Remember to mention key points")
7095
+ * .setBackground({ type: "solid", color: "#F5F5F5" })
7096
+ * .build();
7097
+ * ```
7098
+ */
7099
+ declare class SlideBuilder {
7100
+ private readonly slide;
7101
+ /**
7102
+ * @param slideNumber - 1-based slide number.
7103
+ * @param layoutPath - Optional layout archive path.
7104
+ * @param layoutName - Optional layout display name.
7105
+ */
7106
+ constructor(slideNumber: number, layoutPath?: string, layoutName?: string);
7107
+ /** Add a text box to the slide. */
7108
+ addText(text: string | TextSegmentInput[], options?: TextOptions): this;
7109
+ /** Add a shape to the slide. */
7110
+ addShape(shapeType: string, options?: ShapeOptions): this;
7111
+ /** Add a connector (line) to the slide. */
7112
+ addConnector(options?: ConnectorOptions): this;
7113
+ /** Add an image to the slide. */
7114
+ addImage(source: string, options?: ImageOptions): this;
7115
+ /** Add a table to the slide. */
7116
+ addTable(input: TableInput, options?: TableOptions): this;
7117
+ /** Add a chart to the slide. */
7118
+ addChart(chartType: PptxChartType, input: ChartInput, options?: ChartOptions): this;
7119
+ /** Add a media element (video or audio) to the slide. */
7120
+ addMedia(mediaType: 'video' | 'audio', source: string, options?: MediaOptions): this;
7121
+ /** Add a group of elements to the slide. */
7122
+ addGroup(children: PptxElement[], options?: GroupOptions): this;
7123
+ /** Add a pre-built element directly. */
7124
+ addElement(element: PptxElement): this;
7125
+ /** Set slide background. */
7126
+ setBackground(bg: BackgroundInput): this;
7127
+ /** Set slide transition. */
7128
+ setTransition(input: TransitionInput): this;
7129
+ /** Add an animation to an element on this slide. */
7130
+ addAnimation(elementId: string, input: AnimationInput): this;
7131
+ /** Set speaker notes. */
7132
+ setNotes(text: string): this;
7133
+ /** Mark the slide as hidden. */
7134
+ setHidden(hidden: boolean): this;
7135
+ /** Assign the slide to a section. */
7136
+ setSection(name: string, id?: string): this;
7137
+ /**
7138
+ * Add a freeform shape from SVG path data.
7139
+ *
7140
+ * Creates a custom-geometry shape element using the provided SVG path
7141
+ * string and appends it to the slide's element list.
7142
+ *
7143
+ * @param pathData - An SVG path data string (e.g. `"M 0 0 L 100 50 L 50 100 Z"`).
7144
+ * @param options - Optional position, styling, and size overrides.
7145
+ * @returns The builder instance for chaining.
7146
+ *
7147
+ * @example
7148
+ * ```ts
7149
+ * new SlideBuilder(1)
7150
+ * .addFreeform("M 0 0 C 33 0 66 100 100 100", {
7151
+ * stroke: { color: "#FF0000", width: 2 },
7152
+ * })
7153
+ * .build();
7154
+ * ```
7155
+ */
7156
+ addFreeform(pathData: string, options?: ShapeOptions): this;
7157
+ /**
7158
+ * Add a pre-built element from any element builder (calls `.build()` for you).
7159
+ *
7160
+ * Accepts any object with a `build()` method that returns a {@link PptxElement},
7161
+ * such as {@link TextBuilder}, {@link ShapeBuilder}, {@link ImageBuilder}, etc.
7162
+ *
7163
+ * @param builder - An element builder with a `.build()` method.
7164
+ * @returns The builder instance for chaining.
7165
+ *
7166
+ * @example
7167
+ * ```ts
7168
+ * const title = TextBuilder.create("Hello").fontSize(36).bold();
7169
+ * new SlideBuilder(1).addBuilderElement(title).build();
7170
+ * ```
7171
+ */
7172
+ addBuilderElement(builder: {
7173
+ build(): PptxElement;
7174
+ }): this;
7175
+ /**
7176
+ * Remove an element by its ID.
7177
+ *
7178
+ * Filters out the element with the given ID from the slide's element list.
7179
+ * If no element matches, the slide is left unchanged.
7180
+ *
7181
+ * @param elementId - The unique ID of the element to remove.
7182
+ * @returns The builder instance for chaining.
7183
+ *
7184
+ * @example
7185
+ * ```ts
7186
+ * const slide = new SlideBuilder(1)
7187
+ * .addText("temp", { x: 0, y: 0 })
7188
+ * .removeElement("txt_abc123_1")
7189
+ * .build();
7190
+ * ```
7191
+ */
7192
+ removeElement(elementId: string): this;
7193
+ /**
7194
+ * Get the current list of elements on this slide.
7195
+ *
7196
+ * Returns a readonly view of the elements array. Useful for inspecting
7197
+ * what has been added so far during the build process.
7198
+ *
7199
+ * @returns A readonly array of the slide's current elements.
7200
+ *
7201
+ * @example
7202
+ * ```ts
7203
+ * const builder = new SlideBuilder(1).addText("Hi");
7204
+ * console.log(builder.getElements().length); // 1
7205
+ * ```
7206
+ */
7207
+ getElements(): readonly PptxElement[];
7208
+ /**
7209
+ * Get the number of elements on this slide.
7210
+ *
7211
+ * @returns The count of elements currently added to the slide.
7212
+ *
7213
+ * @example
7214
+ * ```ts
7215
+ * const builder = new SlideBuilder(1)
7216
+ * .addText("A").addText("B");
7217
+ * console.log(builder.elementCount); // 2
7218
+ * ```
7219
+ */
7220
+ get elementCount(): number;
7221
+ /**
7222
+ * Get the last added element (useful for getting its ID for animations).
7223
+ *
7224
+ * Returns `undefined` if the slide has no elements yet.
7225
+ *
7226
+ * @returns The most recently added element, or `undefined`.
7227
+ *
7228
+ * @example
7229
+ * ```ts
7230
+ * const builder = new SlideBuilder(1).addShape("rect");
7231
+ * const shape = builder.getLastElement();
7232
+ * if (shape) {
7233
+ * builder.addAnimation(shape.id, { preset: "fadeIn" });
7234
+ * }
7235
+ * ```
7236
+ */
7237
+ getLastElement(): PptxElement | undefined;
7238
+ /**
7239
+ * Set the slide name/title for organizational purposes.
7240
+ *
7241
+ * Stores an arbitrary name string on the slide object. This is useful
7242
+ * for labeling slides in tooling or custom workflows.
7243
+ *
7244
+ * @param name - The display name to assign to the slide.
7245
+ * @returns The builder instance for chaining.
7246
+ *
7247
+ * @example
7248
+ * ```ts
7249
+ * new SlideBuilder(1)
7250
+ * .setName("Introduction")
7251
+ * .addText("Welcome!")
7252
+ * .build();
7253
+ * ```
7254
+ */
7255
+ setName(name: string): this;
7256
+ /** Return the built {@link PptxSlide}. */
7257
+ build(): PptxSlide;
7258
+ }
7259
+ //#endregion
7260
+ //#region src/core/builders/sdk/PresentationBuilder.d.ts
7261
+ /** Result returned by {@link PresentationBuilder.create}. */
7262
+ interface PresentationBuilderResult {
7263
+ /** Initialized handler ready for editing and saving. */
7264
+ handler: PptxHandler;
7265
+ /** Parsed presentation data. */
7266
+ data: PptxData;
7267
+ /** Convenience slide builder factory. */
7268
+ createSlide: (layoutName?: string) => SlideBuilder;
7269
+ }
7270
+ //#endregion
7271
+ //#region src/core/builders/fluent/PptxXmlBuilder.d.ts
7272
+ /**
7273
+ * Fluent interface for navigating and mutating a {@link PptxData} structure.
7274
+ * Provides method-chaining access to slides, elements, and notes.
7275
+ */
7276
+ interface IPptxXmlBuilder {
7277
+ /** Navigate to a slide by zero-based index (Pascal-case alias). */
7278
+ Slides(index: number): PptxSlideBuilder;
7279
+ /** Navigate to a slide by zero-based index. */
7280
+ slide(index: number): PptxSlideBuilder;
7281
+ /** Navigate to a slide by zero-based index (plural alias). */
7282
+ slides(index: number): PptxSlideBuilder;
7283
+ /** Return the underlying presentation data. */
7284
+ project(): PptxData;
7285
+ }
7286
+ /**
7287
+ * Root builder of the fluent PPTX editing API.
7288
+ *
7289
+ * Wraps a {@link PptxData} object and provides chainable accessors
7290
+ * to navigate into slides, elements, and notes for in-place mutation.
7291
+ */
7292
+ declare class PptxXmlBuilder implements IPptxXmlBuilder {
7293
+ /** The presentation data being mutated. */
7294
+ private readonly data;
7295
+ /** @param data - The presentation data to wrap. */
7296
+ constructor(data: PptxData);
7297
+ /**
7298
+ * Factory method to create a builder from presentation data.
7299
+ * @param data - The presentation data to wrap.
7300
+ * @returns A new {@link PptxXmlBuilder} instance.
7301
+ */
7302
+ static from(data: PptxData): PptxXmlBuilder;
7303
+ /** @inheritdoc */
7304
+ Slides(index: number): PptxSlideBuilder;
7305
+ /**
7306
+ * Navigate to a slide by zero-based index.
7307
+ * @param index - Zero-based slide index.
7308
+ * @returns A {@link PptxSlideBuilder} for the requested slide.
7309
+ * @throws Error if index is not an integer or is out of range.
7310
+ */
7311
+ slide(index: number): PptxSlideBuilder;
7312
+ /** @inheritdoc */
7313
+ slides(index: number): PptxSlideBuilder;
7314
+ /** Return the underlying {@link PptxData}. */
7315
+ project(): PptxData;
7316
+ /** Pascal-case alias for {@link project}. */
7317
+ Project(): PptxData;
7318
+ }
7319
+ /**
7320
+ * Fluent builder scoped to a single slide.
7321
+ * Provides navigation to the slide's elements and notes.
7322
+ */
7323
+ declare class PptxSlideBuilder {
7324
+ /** The slide being operated on. */
7325
+ private readonly slideValue;
7326
+ /** Reference back to the root builder for chaining. */
7327
+ private readonly rootBuilder;
7328
+ /**
7329
+ * @param slideValue - The slide data.
7330
+ * @param rootBuilder - The parent builder.
7331
+ */
7332
+ constructor(slideValue: PptxSlide, rootBuilder: PptxXmlBuilder);
7333
+ /** Navigate to the slide's notes builder (getter). */
7334
+ get Notes(): PptxSlideNotesBuilder;
7335
+ /** Navigate to the slide's notes builder. */
7336
+ notes(): PptxSlideNotesBuilder;
7337
+ /** Navigate to the slide's elements builder. */
7338
+ elements(): PptxSlideElementsBuilder;
7339
+ /** Return the underlying slide data. */
7340
+ project(): PptxSlide;
7341
+ /** Pascal-case alias for {@link project}. */
7342
+ Project(): PptxSlide;
7343
+ /** Navigate back to the root builder. */
7344
+ done(): PptxXmlBuilder;
7345
+ /** Pascal-case alias for {@link done}. */
7346
+ Done(): PptxXmlBuilder;
7347
+ }
7348
+ /**
7349
+ * Fluent builder for manipulating the elements array of a single slide.
7350
+ * Supports adding, removing, and updating elements by ID.
7351
+ */
7352
+ declare class PptxSlideElementsBuilder {
7353
+ private readonly slideValue;
7354
+ private readonly slideBuilder;
7355
+ /**
7356
+ * @param slideValue - The slide whose elements are being modified.
7357
+ * @param slideBuilder - The parent slide builder for chaining.
7358
+ */
7359
+ constructor(slideValue: PptxSlide, slideBuilder: PptxSlideBuilder);
7360
+ /**
7361
+ * Append an element to the slide's element list.
7362
+ * @param element - The element to add.
7363
+ * @returns This builder for chaining.
7364
+ */
7365
+ add(element: PptxElement): this;
7366
+ /**
7367
+ * Remove an element from the slide by its ID.
7368
+ * @param elementId - The ID of the element to remove.
7369
+ * @returns This builder for chaining.
7370
+ */
7371
+ removeById(elementId: string): this;
7372
+ /**
7373
+ * Update an element in-place by ID using a transform function.
7374
+ * @param elementId - The ID of the element to update.
7375
+ * @param updater - A function that receives the current element and returns the replacement.
7376
+ * @returns This builder for chaining.
7377
+ */
7378
+ updateById(elementId: string, updater: (current: PptxElement) => PptxElement): this;
7379
+ /** Return the current elements array. */
7380
+ project(): PptxElement[];
7381
+ /** Navigate back to the slide builder. */
7382
+ done(): PptxSlideBuilder;
7383
+ }
7384
+ /**
7385
+ * Fluent builder for manipulating speaker notes on a single slide.
7386
+ * Supports adding, setting, clearing, and retrieving notes text.
7387
+ */
7388
+ declare class PptxSlideNotesBuilder {
7389
+ private readonly slideValue;
7390
+ private readonly slideBuilder;
7391
+ /**
7392
+ * @param slideValue - The slide whose notes are being modified.
7393
+ * @param slideBuilder - The parent slide builder for chaining.
7394
+ */
7395
+ constructor(slideValue: PptxSlide, slideBuilder: PptxSlideBuilder);
7396
+ /**
7397
+ * Append text to existing notes (separated by newline).
7398
+ * @param text - The text to append.
7399
+ * @returns This builder for chaining.
7400
+ */
7401
+ add(text: string): this;
7402
+ /** Pascal-case alias for {@link add}. */
7403
+ Add(text: string): this;
7404
+ /**
7405
+ * Replace all notes with the given text.
7406
+ * @param text - The replacement notes text. Empty string clears notes.
7407
+ * @returns This builder for chaining.
7408
+ */
7409
+ set(text: string): this;
7410
+ /** Pascal-case alias for {@link set}. */
7411
+ Set(text: string): this;
7412
+ /** Remove all notes from the slide. */
7413
+ clear(): this;
7414
+ /** Pascal-case alias for {@link clear}. */
7415
+ Clear(): this;
7416
+ /** Return the current notes text, or `undefined` if none. */
7417
+ get(): string | undefined;
7418
+ /** Pascal-case alias for {@link get}. */
7419
+ Get(): string | undefined;
7420
+ /** Navigate back to the slide builder. */
7421
+ done(): PptxSlideBuilder;
7422
+ /** Pascal-case alias for {@link done}. */
7423
+ Done(): PptxSlideBuilder;
7424
+ /**
7425
+ * Synchronize the `notesSegments` array from the plain-text notes string.
7426
+ * Splits text on newlines and creates corresponding {@link TextSegment} entries
7427
+ * with paragraph break markers between lines.
7428
+ */
7429
+ private syncSegmentsFromNotes;
7430
+ }
7431
+ //#endregion
7432
+ //#region src/core/core/types.d.ts
7433
+ interface PptxHandlerLoadOptions {
7434
+ eagerDecodeImages?: boolean;
7435
+ password?: string;
7436
+ /**
7437
+ * Maximum total uncompressed bytes accepted from the input ZIP archive.
7438
+ * Defaults to 500 MiB. When the sum of `_data.uncompressedSize` across
7439
+ * all archive entries exceeds this cap, `load()` rejects with a
7440
+ * {@link ZipBombError}. A hard cap of 65 536 archive entries also
7441
+ * applies.
7442
+ */
7443
+ maxUncompressedBytes?: number;
7444
+ /**
7445
+ * When `false` (default), relationship targets that resolve to
7446
+ * `http://` or `https://` URLs are dropped from rendered slides
7447
+ * (image, picture, background). Set to `true` to allow external image
7448
+ * URLs to flow through to `<img src>`.
7449
+ *
7450
+ * Disabled by default to mitigate SSRF / privacy-leak vectors in
7451
+ * server-side rendering and headless export pipelines.
7452
+ */
7453
+ allowExternalImages?: boolean;
7454
+ }
7455
+ /** Output format for the save pipeline. */
7456
+ type PptxSaveFormat = 'pptx' | 'ppsx' | 'pptm';
7457
+ interface PptxHandlerSaveOptions {
7458
+ headerFooter?: PptxHeaderFooter;
7459
+ presentationProperties?: PptxPresentationProperties;
7460
+ customShows?: PptxCustomShow[];
7461
+ sections?: PptxSection[];
7462
+ coreProperties?: PptxCoreProperties;
7463
+ appProperties?: PptxAppProperties;
7464
+ customProperties?: PptxCustomProperty[];
7465
+ /** Updated notes master data to save back to notesMaster1.xml. */
7466
+ notesMaster?: PptxNotesMaster;
7467
+ /** Updated handout master data to save back to handoutMaster1.xml. */
7468
+ handoutMaster?: PptxHandoutMaster;
7469
+ /**
7470
+ * Updated slide masters to save back to ppt/slideMasters/slideMaster*.xml.
7471
+ * Each entry in the array applies typed mutations (clrMap, hf flags,
7472
+ * background) to the master at its `path`. Masters not listed here pass
7473
+ * through verbatim from the original load.
7474
+ */
7475
+ slideMasters?: PptxSlideMaster[];
7476
+ /**
7477
+ * Updated slide layouts to save back to ppt/slideLayouts/slideLayout*.xml.
7478
+ * Each entry applies typed mutations (clrMapOverride, attrs, hf flags,
7479
+ * background) to the layout at its `path`. Layouts not listed here pass
7480
+ * through verbatim from the original load.
7481
+ */
7482
+ slideLayouts?: PptxSlideLayout[];
7483
+ /** Updated tag collections to save back to ppt/tags/tag*.xml. */
7484
+ tags?: PptxTagCollection[];
7485
+ /** Presentation-level customer data references to author or update. */
7486
+ customerData?: PptxCustomerData[];
7487
+ /** Photo album metadata to save back to `p:photoAlbum`. */
7488
+ photoAlbum?: PptxPhotoAlbum;
7489
+ /** East Asian line-break settings to save back to `p:kinsoku`. */
7490
+ kinsoku?: PptxKinsoku | null;
7491
+ /** Write-protection verifier. Set to `null` to remove, `undefined` to preserve existing. */
7492
+ modifyVerifier?: PptxModifyVerifier | null;
7493
+ /** View properties to save back to ppt/viewProps.xml. */
7494
+ viewProperties?: PptxViewProperties;
7495
+ /**
7496
+ * Table style edits to save back to `ppt/tableStyles.xml`. Pass the
7497
+ * `tableStyleMap` from `PptxData` (optionally with edited entries)
7498
+ * to persist user edits. The `def` GUID and any unmodelled XML are
7499
+ * preserved verbatim. Omitting the option round-trips the original
7500
+ * part untouched.
7501
+ */
7502
+ tableStyles?: ParsedTableStyleMap;
7503
+ /**
7504
+ * Target output format.
7505
+ * - `'pptx'` (default): Standard presentation.
7506
+ * - `'ppsx'`: Slide-show file (opens in presentation mode).
7507
+ * - `'pptm'`: Macro-enabled presentation (requires VBA data).
7508
+ */
7509
+ outputFormat?: PptxSaveFormat;
7510
+ /**
7511
+ * Embedded fonts to write back (or add) to the saved PPTX.
7512
+ *
7513
+ * Pass the `embeddedFonts` array from `PptxData` to preserve existing
7514
+ * embedded fonts during save. You can also add new fonts by including
7515
+ * entries with `rawFontData` populated.
7516
+ *
7517
+ * When omitted, the save pipeline will automatically re-embed any
7518
+ * fonts that were loaded from the original PPTX and have `rawFontData`
7519
+ * preserved (i.e. the default is lossless round-trip).
7520
+ */
7521
+ embeddedFonts?: PptxEmbeddedFont[];
7522
+ /** Typed embedded-font list metadata. Set to null to remove fonts and relationships. */
7523
+ embeddedFontList?: PptxEmbeddedFontList | null;
7524
+ /**
7525
+ * OOXML conformance class for the saved output.
7526
+ * - `'preserve'` (default): use the same conformance as the loaded file.
7527
+ * - `'strict'`: force Strict Open XML (ISO/IEC 29500) namespace URIs.
7528
+ * - `'transitional'`: force Transitional (ECMA-376) namespace URIs.
7529
+ */
7530
+ conformance?: 'strict' | 'transitional' | 'preserve';
7531
+ }
7532
+ interface IPptxHandlerRuntime {
7533
+ /**
7534
+ * Release all resources held by this runtime (Blob URLs, caches, ZIP).
7535
+ * After calling, the runtime cannot be used further.
7536
+ */
7537
+ dispose(): void;
7538
+ /**
7539
+ * Revoke all Blob URLs created during image loading.
7540
+ */
7541
+ revokeBlobUrls(): void;
7542
+ getCompatibilityWarnings(): PptxCompatibilityWarning[];
7543
+ getLayoutOptions(): PptxLayoutOption[];
7544
+ createXmlBuilder(data: PptxData): PptxXmlBuilder;
7545
+ Builder(data: PptxData): PptxXmlBuilder;
7546
+ setTemplateBackground(path: string, backgroundColor: string | undefined): void;
7547
+ setPresentationTheme(themePath: string, applyToAllMasters?: boolean): Promise<void>;
7548
+ getTemplateBackgroundColor(path: string): string | undefined;
7549
+ updateThemeColorScheme(colorScheme: PptxThemeColorScheme): Promise<void>;
7550
+ updateThemeFontScheme(fontScheme: PptxThemeFontScheme): Promise<void>;
7551
+ updateThemeName(name: string): Promise<void>;
7552
+ applyTheme(colorScheme: PptxThemeColorScheme, fontScheme: PptxThemeFontScheme, themeName?: string): Promise<void>;
7553
+ load(data: ArrayBuffer, options?: PptxHandlerLoadOptions): Promise<PptxData>;
7554
+ getChartDataForGraphicFrame(slidePath: string, graphicFrame: XmlObject | undefined): Promise<PptxChartData | undefined>;
7555
+ getSmartArtDataForGraphicFrame(slidePath: string, graphicFrame: XmlObject | undefined): Promise<PptxSmartArtData | undefined>;
7556
+ getImageData(imagePath: string): Promise<string | undefined>;
7557
+ /**
7558
+ * Extract a media file from the PPTX archive as an ArrayBuffer.
7559
+ * Returns undefined if the file is not found.
7560
+ */
7561
+ getMediaArrayBuffer(mediaPath: string): Promise<ArrayBuffer | undefined>;
7562
+ save(slides: PptxSlide[], options?: PptxHandlerSaveOptions): Promise<Uint8Array>;
7563
+ exportSlides(slides: PptxSlide[], options: PptxExportOptions): Promise<Map<number, Uint8Array>>;
7564
+ /**
7565
+ * Get the available slide layouts for a specific slide, based on the
7566
+ * slide's master. Scans the slide master's relationships to find all
7567
+ * layouts that belong to it.
7568
+ *
7569
+ * @param slideIndex - Zero-based slide index.
7570
+ * @param slides - Current slides array.
7571
+ * @returns Array of layout options belonging to the same slide master.
7572
+ */
7573
+ getAvailableLayoutsForSlide(slideIndex: number, slides: PptxSlide[]): Promise<PptxLayoutOption[]>;
7574
+ /**
7575
+ * Resolve the editable template (master + layout) elements a slide
7576
+ * inherits, each carrying a `master-` / `layout-` prefixed id. Excludes
7577
+ * placeholders; returns only decorative shapes/pictures/graphic frames.
7578
+ *
7579
+ * @param slideId - The slide's archive path (`PptxSlide.id`).
7580
+ */
7581
+ getTemplateElementsForSlide(slideId: string): Promise<PptxElement[]>;
7582
+ /**
7583
+ * Scan the loaded PPTX archive for all theme parts.
7584
+ */
7585
+ getAvailableThemes(): Promise<Array<{
7586
+ path: string;
7587
+ name?: string;
7588
+ }>>;
7589
+ /**
7590
+ * Apply a different layout to an existing slide by updating the slide's
7591
+ * relationship to point to the new layout and re-parsing layout
7592
+ * placeholders / background.
7593
+ *
7594
+ * @param slideIndex - Zero-based slide index.
7595
+ * @param layoutPath - Archive path of the target layout
7596
+ * (e.g. `ppt/slideLayouts/slideLayout2.xml`).
7597
+ * @param slides - Current slides array.
7598
+ * @returns The updated slide with new layout path, name, and background.
7599
+ */
7600
+ applyLayoutToSlide(slideIndex: number, layoutPath: string, slides: PptxSlide[]): Promise<PptxSlide>;
7601
+ }
7602
+ //#endregion
7603
+ //#region src/core/core/PptxHandlerRuntimeFactory.d.ts
7604
+ /**
7605
+ * Abstract factory contract for creating {@link IPptxHandlerRuntime}
7606
+ * instances.
7607
+ *
7608
+ * Implement this interface to supply a custom runtime (e.g. a
7609
+ * WASM-backed or test-double runtime) to {@link PptxHandlerCore}.
7610
+ */
7611
+ interface IPptxHandlerRuntimeFactory {
7612
+ /** Instantiate and return a new runtime implementation. */
7613
+ createRuntime(): IPptxHandlerRuntime;
7614
+ }
7615
+ //#endregion
7616
+ //#region src/core/utils/ooxml-crypto-types.d.ts
7617
+ /**
7618
+ * Type definitions for OOXML encryption and decryption.
7619
+ *
7620
+ * Contains all interfaces and type aliases used by the OOXML crypto modules.
7621
+ *
7622
+ * @module ooxml-crypto-types
7623
+ */
7624
+ /** Supported encryption algorithms. */
7625
+ type EncryptionAlgorithm = 'AES128' | 'AES256';
7626
+ /** Encryption options for creating encrypted files. */
7627
+ interface EncryptionOptions {
7628
+ /** The encryption algorithm to use (defaults to AES256). */
7629
+ algorithm?: EncryptionAlgorithm;
7630
+ /** Number of hash iterations for key derivation (defaults to 100000). Lower values speed up tests. */
7631
+ spinCount?: number;
7632
+ }
7633
+ //#endregion
7634
+ //#region src/core/PptxHandlerCore.d.ts
7635
+ /**
7636
+ * Dependency injection options for {@link PptxHandlerCore}.
7637
+ *
7638
+ * Provide either `runtime` (an already-constructed runtime) or
7639
+ * `runtimeFactory` (a factory that will be called once). When neither
7640
+ * is supplied the default runtime is created automatically.
7641
+ *
7642
+ * @example
7643
+ * ```ts
7644
+ * // Use the default runtime:
7645
+ * const core = new PptxHandlerCore();
7646
+ *
7647
+ * // Inject a custom runtime:
7648
+ * const core = new PptxHandlerCore({ runtime: myRuntime });
7649
+ *
7650
+ * // Supply a factory for lazy creation:
7651
+ * const core = new PptxHandlerCore({ runtimeFactory: myFactory });
7652
+ * // => PptxHandlerCore instance with injected runtime
7653
+ * ```
7654
+ */
7655
+ interface PptxHandlerCoreDependencies {
7656
+ runtime?: IPptxHandlerRuntime;
7657
+ runtimeFactory?: IPptxHandlerRuntimeFactory;
7658
+ }
7659
+ /**
7660
+ * Thin facade over the PPTX runtime implementation.
7661
+ *
7662
+ * All heavy parsing, serialisation, and XML manipulation is delegated to an
7663
+ * {@link IPptxHandlerRuntime}. This surface stays stable and small so that
7664
+ * callers remain decoupled from the runtime internals and host-specific
7665
+ * runtime swaps (e.g. WASM vs Node) can be done transparently.
7666
+ *
7667
+ * @remarks
7668
+ * - Constructed once per open document.
7669
+ * - Errors from encrypted files are caught at `load()` time via
7670
+ * {@link EncryptedFileError}.
7671
+ * - `PptxXmlBuilder` instances returned by `createXmlBuilder()` / `Builder()`
7672
+ * operate directly on the runtime’s in-memory ZIP.
7673
+ *
7674
+ * @example
7675
+ * ```ts
7676
+ * const handler = new PptxHandlerCore();
7677
+ * const data = await handler.load(arrayBuffer);
7678
+ * // ... mutate slides ...
7679
+ * const out = await handler.save(data.slides);
7680
+ * // => Uint8Array of the modified .pptx file
7681
+ * ```
7682
+ */
7683
+ declare class PptxHandlerCore {
7684
+ private readonly runtime;
7685
+ /**
7686
+ * Create a new handler, optionally injecting a custom runtime.
7687
+ *
7688
+ * Resolution order:
7689
+ * 1. `dependencies.runtime` — use as-is.
7690
+ * 2. `dependencies.runtimeFactory` — call `createRuntime()` once.
7691
+ * 3. Fall back to {@link createDefaultPptxHandlerRuntime}.
7692
+ *
7693
+ * @param dependencies - Optional runtime or factory override.
7694
+ *
7695
+ * @example
7696
+ * ```ts
7697
+ * const core = new PptxHandlerCore();
7698
+ * // => PptxHandlerCore instance with default runtime
7699
+ * ```
7700
+ */
7701
+ constructor(dependencies?: PptxHandlerCoreDependencies);
7702
+ /**
7703
+ * Release all resources held by this handler instance.
7704
+ *
7705
+ * Revokes every Blob URL created for images/media, clears all
7706
+ * in-memory caches, and releases the in-memory ZIP archive.
7707
+ *
7708
+ * Call this when the handler is no longer needed (e.g. component
7709
+ * unmount) to free memory immediately rather than waiting for GC.
7710
+ *
7711
+ * After calling `dispose()`, do not call any other methods — create
7712
+ * a new `PptxHandler` instance instead.
7713
+ */
7714
+ dispose(): void;
7715
+ /**
7716
+ * Return any compatibility warnings detected during the most recent load.
7717
+ *
7718
+ * Warnings indicate features the editor cannot fully represent (e.g.
7719
+ * SmartArt, 3-D effects, embedded OLE objects).
7720
+ *
7721
+ * @returns Array of {@link PptxCompatibilityWarning} objects.
7722
+ */
7723
+ getCompatibilityWarnings(): PptxCompatibilityWarning[];
7724
+ /**
7725
+ * Get the slide layout options available in the loaded presentation.
7726
+ *
7727
+ * Each option maps to a `<p:sldLayout>` inside the PPTX archive.
7728
+ *
7729
+ * @returns Array of {@link PptxLayoutOption} entries.
7730
+ */
7731
+ getLayoutOptions(): PptxLayoutOption[];
7732
+ /**
7733
+ * Create a fluent XML builder scoped to the given presentation data.
7734
+ *
7735
+ * The builder provides a chainable API for constructing and inserting
7736
+ * OpenXML nodes directly into the runtime’s in-memory ZIP.
7737
+ *
7738
+ * @param data - The parsed {@link PptxData} to bind the builder to.
7739
+ * @returns A new {@link PptxXmlBuilder} instance.
7740
+ */
7741
+ createXmlBuilder(data: PptxData): PptxXmlBuilder;
7742
+ /**
7743
+ * Shorthand alias for {@link createXmlBuilder}.
7744
+ *
7745
+ * @param data - Parsed presentation data.
7746
+ * @returns A {@link PptxXmlBuilder} instance.
7747
+ */
7748
+ Builder(data: PptxData): PptxXmlBuilder;
7749
+ /**
7750
+ * Register a background image for a specific template layout path.
7751
+ *
7752
+ * @param path - The internal PPTX path (e.g. `ppt/slideLayouts/slideLayout1.xml`).
7753
+ * @param backgroundColor - Optional hex colour to render behind the image.
7754
+ */
7755
+ setTemplateBackground(path: string, backgroundColor: string | undefined): void;
7756
+ /**
7757
+ * Retrieve the background colour previously set for a template layout.
7758
+ *
7759
+ * @param path - The internal PPTX layout path.
7760
+ * @returns Hex colour string, or `undefined` if none was set.
7761
+ */
7762
+ getTemplateBackgroundColor(path: string): string | undefined;
7763
+ /**
7764
+ * Replace the presentation’s theme by loading an external `.thmx` file.
7765
+ *
7766
+ * @param themePath - Absolute or relative path to the `.thmx` file.
7767
+ * @param applyToAllMasters - Apply to every slide master (default `true`).
7768
+ *
7769
+ * @example
7770
+ * ```ts
7771
+ * await handler.setPresentationTheme("./themes/corporate.thmx");
7772
+ * // => void — theme XML replaced in the in-memory ZIP
7773
+ * ```
7774
+ */
7775
+ setPresentationTheme(themePath: string, applyToAllMasters?: boolean): Promise<void>;
7776
+ /**
7777
+ * Modify the theme’s colour scheme (accent colours, background, text, etc.).
7778
+ *
7779
+ * @param colorScheme - A {@link PptxThemeColorScheme} with hex colour values.
7780
+ *
7781
+ * @example
7782
+ * ```ts
7783
+ * await handler.updateThemeColorScheme({
7784
+ * dk1: "#1A1A2E", dk2: "#16213E",
7785
+ * lt1: "#FFFFFF", lt2: "#E8E8E8",
7786
+ * accent1: "#0F3460", accent2: "#533483",
7787
+ * accent3: "#E94560", accent4: "#F0A500",
7788
+ * });
7789
+ * // => void — colour scheme updated in the in-memory theme XML
7790
+ * ```
7791
+ */
7792
+ updateThemeColorScheme(colorScheme: PptxThemeColorScheme): Promise<void>;
7793
+ /**
7794
+ * Update the theme’s font scheme (heading + body typefaces).
7795
+ *
7796
+ * @param fontScheme - A {@link PptxThemeFontScheme} with font family names.
7797
+ *
7798
+ * @example
7799
+ * ```ts
7800
+ * await handler.updateThemeFontScheme({
7801
+ * majorFont: "Montserrat",
7802
+ * minorFont: "Open Sans",
7803
+ * });
7804
+ * // => void — font scheme updated in the in-memory theme XML
7805
+ * ```
7806
+ */
7807
+ updateThemeFontScheme(fontScheme: PptxThemeFontScheme): Promise<void>;
7808
+ /**
7809
+ * Rename the presentation theme.
7810
+ *
7811
+ * @param name - New display name for the theme.
7812
+ */
7813
+ updateThemeName(name: string): Promise<void>;
7814
+ /**
7815
+ * Apply a complete theme in one call (colour scheme + font scheme + optional name).
7816
+ *
7817
+ * This is a convenience wrapper over {@link updateThemeColorScheme},
7818
+ * {@link updateThemeFontScheme}, and {@link updateThemeName}.
7819
+ *
7820
+ * @param colorScheme - Colour definitions.
7821
+ * @param fontScheme - Font definitions.
7822
+ * @param themeName - Optional theme display name.
7823
+ *
7824
+ * @example
7825
+ * ```ts
7826
+ * await handler.applyTheme(
7827
+ * { dk1: "#000", lt1: "#FFF", accent1: "#0066CC", /* … *\/ },
7828
+ * { majorFont: "Helvetica", minorFont: "Arial" },
7829
+ * "Corporate 2025",
7830
+ * );
7831
+ * // => void — colour scheme, font scheme, and name applied atomically
7832
+ * ```
7833
+ */
7834
+ applyTheme(colorScheme: PptxThemeColorScheme, fontScheme: PptxThemeFontScheme, themeName?: string): Promise<void>;
7835
+ /**
7836
+ * Switch the presentation's theme, updating both the underlying XML and
7837
+ * re-resolving all element colours in-place.
7838
+ *
7839
+ * This is the high-level API for theme switching: it updates the theme
7840
+ * data in the ZIP, then patches all resolved colours in the provided
7841
+ * `PptxData` so that elements immediately reflect the new colour scheme
7842
+ * without requiring a re-parse.
7843
+ *
7844
+ * @param data - The current parsed presentation data (mutated in-place for
7845
+ * convenience, but a new `PptxData` object is also returned).
7846
+ * @param colorScheme - New colour scheme (12 colours).
7847
+ * @param fontScheme - Optional new font scheme.
7848
+ * @param themeName - Optional theme display name.
7849
+ * @returns The updated PptxData with re-resolved colours.
7850
+ *
7851
+ * @example
7852
+ * ```ts
7853
+ * import { THEME_PRESETS } from "pptx-viewer-core";
7854
+ *
7855
+ * const ion = THEME_PRESETS.find(p => p.id === "ion")!;
7856
+ * const newData = await handler.switchTheme(
7857
+ * data,
7858
+ * ion.colorScheme,
7859
+ * ion.fontScheme,
7860
+ * ion.name,
7861
+ * );
7862
+ * // => PptxData with all colours updated to the Ion theme
7863
+ * ```
7864
+ */
7865
+ switchTheme(data: PptxData, colorScheme: PptxThemeColorScheme, fontScheme?: PptxThemeFontScheme, themeName?: string): Promise<PptxData>;
7866
+ /**
7867
+ * Apply a built-in theme preset to the presentation.
7868
+ *
7869
+ * Convenience wrapper around {@link switchTheme} that accepts a
7870
+ * {@link PptxThemePreset} directly.
7871
+ *
7872
+ * @param data - The current parsed presentation data.
7873
+ * @param preset - One of the built-in presets from {@link THEME_PRESETS}.
7874
+ * @returns The updated PptxData.
7875
+ *
7876
+ * @example
7877
+ * ```ts
7878
+ * import { THEME_PRESETS } from "pptx-viewer-core";
7879
+ *
7880
+ * const preset = THEME_PRESETS.find(p => p.id === "facet")!;
7881
+ * const newData = await handler.switchThemePreset(data, preset);
7882
+ * ```
7883
+ */
7884
+ switchThemePreset(data: PptxData, preset: PptxThemePreset): Promise<PptxData>;
7885
+ /**
7886
+ * Parse a PPTX file from an `ArrayBuffer` and return structured data.
7887
+ *
7888
+ * If the file is encrypted and a `password` is provided in `options`,
7889
+ * the file will be decrypted before parsing. If no password is provided
7890
+ * for an encrypted file, throws {@link EncryptedFileError}.
7891
+ *
7892
+ * @param data - Raw bytes of the `.pptx` file (may be encrypted OLE2).
7893
+ * @param options - Optional load-time settings, including `password`.
7894
+ * @returns Parsed {@link PptxData} containing slides, theme, layouts, etc.
7895
+ *
7896
+ * @example
7897
+ * ```ts
7898
+ * // Load an unencrypted file:
7899
+ * const pptx = await handler.load(buf.buffer);
7900
+ *
7901
+ * // Load a password-protected file:
7902
+ * const pptx = await handler.load(buf.buffer, { password: "secret" });
7903
+ * console.log(`${pptx.slides.length} slides loaded`);
7904
+ * ```
7905
+ */
7906
+ load(data: ArrayBuffer, options?: PptxHandlerLoadOptions): Promise<PptxData>;
7907
+ /**
7908
+ * Extract chart data from a graphic-frame XML node.
7909
+ *
7910
+ * @param slidePath - Internal archive path of the slide (e.g. `ppt/slides/slide1.xml`).
7911
+ * @param graphicFrame - Parsed XML object for the `<p:graphicFrame>` node.
7912
+ * @returns Chart data, or `undefined` if the frame is not a chart.
7913
+ */
7914
+ getChartDataForGraphicFrame(slidePath: string, graphicFrame: XmlObject | undefined): Promise<PptxChartData | undefined>;
7915
+ /**
7916
+ * Extract SmartArt data from a graphic-frame XML node.
7917
+ *
7918
+ * @param slidePath - Internal archive path of the slide.
7919
+ * @param graphicFrame - Parsed XML object for the `<p:graphicFrame>` node.
7920
+ * @returns SmartArt data, or `undefined` if the frame is not SmartArt.
7921
+ */
7922
+ getSmartArtDataForGraphicFrame(slidePath: string, graphicFrame: XmlObject | undefined): Promise<PptxSmartArtData | undefined>;
7923
+ /**
7924
+ * Get the base64-encoded data URL for an embedded image.
7925
+ *
7926
+ * @param imagePath - Archive-relative path (e.g. `ppt/media/image1.png`).
7927
+ * @returns A `data:image/...;base64,...` string, or `undefined` if not found.
7928
+ */
7929
+ getImageData(imagePath: string): Promise<string | undefined>;
7930
+ /**
7931
+ * Extract a media file from the PPTX archive as an ArrayBuffer.
7932
+ * Avoids the 33% base64 overhead of getImageData — prefer this for
7933
+ * audio/video media that will be played via Blob URLs.
7934
+ */
7935
+ getMediaArrayBuffer(mediaPath: string): Promise<ArrayBuffer | undefined>;
7936
+ /**
7937
+ * Serialise current slides back into a PPTX byte array.
7938
+ *
7939
+ * @param slides - The (possibly mutated) slide array.
7940
+ * @param options - Optional save-time settings (e.g. thumbnail generation).
7941
+ * @returns `Uint8Array` of the complete `.pptx` file.
7942
+ *
7943
+ * @example
7944
+ * ```ts
7945
+ * const bytes = await handler.save(data.slides);
7946
+ * await fs.writeFile("output.pptx", Buffer.from(bytes));
7947
+ * // => Uint8Array written to disk as a valid .pptx file
7948
+ * ```
7949
+ */
7950
+ save(slides: PptxSlide[], options?: PptxHandlerSaveOptions): Promise<Uint8Array>;
7951
+ /**
7952
+ * Serialise slides and then encrypt the output with a password.
7953
+ *
7954
+ * This is a convenience method that calls {@link save} followed by
7955
+ * {@link encryptPptx}. The result is an OLE2 container suitable for
7956
+ * opening in Microsoft PowerPoint with a password prompt.
7957
+ *
7958
+ * @param slides - The (possibly mutated) slide array.
7959
+ * @param password - The password to encrypt with.
7960
+ * @param options - Optional save-time and encryption settings.
7961
+ * @returns `Uint8Array` of the encrypted OLE2 file.
7962
+ *
7963
+ * @example
7964
+ * ```ts
7965
+ * const bytes = await handler.saveEncrypted(data.slides, "secret");
7966
+ * await fs.writeFile("protected.pptx", Buffer.from(bytes));
7967
+ * // => Encrypted OLE2 file requiring password to open
7968
+ * ```
7969
+ */
7970
+ saveEncrypted(slides: PptxSlide[], password: string, options?: PptxHandlerSaveOptions & {
7971
+ encryption?: EncryptionOptions;
7972
+ }): Promise<Uint8Array>;
7973
+ /**
7974
+ * Get the slide layouts available for a specific slide.
7975
+ *
7976
+ * Returns layouts belonging to the same slide master as the given slide.
7977
+ * This is useful for building a layout picker UI scoped to the current
7978
+ * slide's master.
7979
+ *
7980
+ * @param slideIndex - Zero-based slide index.
7981
+ * @param slides - Current slides array.
7982
+ * @returns Array of {@link PptxLayoutOption} entries for the slide's master.
7983
+ *
7984
+ * @example
7985
+ * ```ts
7986
+ * const layouts = await handler.getAvailableLayoutsForSlide(0, data.slides);
7987
+ * console.log(layouts.map(l => l.name));
7988
+ * // => ["Title Slide", "Title and Content", "Blank", ...]
7989
+ * ```
7990
+ */
7991
+ getAvailableLayoutsForSlide(slideIndex: number, slides: PptxSlide[]): Promise<PptxLayoutOption[]>;
7992
+ /**
7993
+ * Resolve the editable template (master + layout) elements a slide
7994
+ * inherits, each carrying a `master-` / `layout-` prefixed id.
7995
+ *
7996
+ * This is the foundation for an "edit template/master" feature. The
7997
+ * returned elements are the decorative master/layout shapes the loader
7998
+ * already merges behind slide-authored content (master shapes behind,
7999
+ * layout shapes on top); placeholders are excluded. The same elements are
8000
+ * shared by every slide inheriting the layout/master, so editing one and
8001
+ * saving updates the shared part.
8002
+ *
8003
+ * To persist an edit, keep the mutated template element inside the
8004
+ * `slide.elements` array passed to {@link save}; the save writer reads
8005
+ * template elements from there and writes their shape XML back into the
8006
+ * owning layout/master `p:spTree`.
8007
+ *
8008
+ * @param slideId - The slide's archive path (the `PptxSlide.id`).
8009
+ * @returns Master + layout elements with prefixed ids (may be empty).
8010
+ *
8011
+ * @example
8012
+ * ```ts
8013
+ * const templateEls = await handler.getTemplateElementsForSlide(slide.id);
8014
+ * const logo = templateEls.find((e) => e.id.startsWith("master-"));
8015
+ * if (logo) {
8016
+ * logo.x += 10;
8017
+ * slide.elements = [...slide.elements, logo];
8018
+ * await handler.save(data.slides);
8019
+ * }
8020
+ * ```
8021
+ */
8022
+ getTemplateElementsForSlide(slideId: string): Promise<PptxElement[]>;
8023
+ /**
8024
+ * Apply a different layout to an existing slide.
8025
+ *
8026
+ * Updates the slide's relationship to point to the new layout and
8027
+ * refreshes layout-derived properties (background, layout name).
8028
+ * The slide's own content elements are preserved.
8029
+ *
8030
+ * @param slideIndex - Zero-based slide index.
8031
+ * @param layoutPath - Archive path of the target layout
8032
+ * (e.g. `ppt/slideLayouts/slideLayout2.xml`).
8033
+ * @param slides - Current slides array (the slide at `slideIndex`
8034
+ * is replaced in-place).
8035
+ * @returns The updated {@link PptxSlide} with new layout metadata.
8036
+ *
8037
+ * @example
8038
+ * ```ts
8039
+ * const updated = await handler.applyLayoutToSlide(
8040
+ * 0,
8041
+ * "ppt/slideLayouts/slideLayout3.xml",
8042
+ * data.slides,
8043
+ * );
8044
+ * console.log(updated.layoutName);
8045
+ * // => "Two Content"
8046
+ * ```
8047
+ */
8048
+ applyLayoutToSlide(slideIndex: number, layoutPath: string, slides: PptxSlide[]): Promise<PptxSlide>;
8049
+ /**
8050
+ * Scan the loaded PPTX archive for all theme parts (`ppt/theme/theme*.xml`)
8051
+ * and return their paths and display names.
8052
+ */
8053
+ getAvailableThemes(): Promise<Array<{
8054
+ path: string;
8055
+ name?: string;
8056
+ }>>;
8057
+ /**
8058
+ * Export selected slides as individual PPTX files.
8059
+ *
8060
+ * Each entry in the returned map is keyed by slide index and contains a
8061
+ * standalone `Uint8Array` PPTX with only that slide.
8062
+ *
8063
+ * @param slides - Full slide array.
8064
+ * @param options - Export options (slide indexes, format, etc.).
8065
+ * @returns A `Map<slideIndex, Uint8Array>` of exported files.
8066
+ *
8067
+ * @example
8068
+ * ```ts
8069
+ * const exports = await handler.exportSlides(data.slides, {
8070
+ * slideIndexes: [0, 2],
8071
+ * });
8072
+ * for (const [idx, bytes] of exports) {
8073
+ * await fs.writeFile(`slide_${idx}.pptx`, Buffer.from(bytes));
8074
+ * }
8075
+ * // => Map<number, Uint8Array> — one standalone .pptx per exported slide
8076
+ * ```
8077
+ */
8078
+ exportSlides(slides: PptxSlide[], options: PptxExportOptions): Promise<Map<number, Uint8Array>>;
8079
+ }
8080
+ //#endregion
8081
+ //#region src/core/PptxHandler.d.ts
8082
+ /**
8083
+ * Public facade for the PPTX editor handler.
8084
+ *
8085
+ * The implementation lives in `PptxHandlerCore` so this surface can stay small,
8086
+ * stable, and easy to replace with alternate implementations in the future.
8087
+ */
8088
+ declare class PptxHandler extends PptxHandlerCore {
8089
+ /**
8090
+ * Create a new blank PPTX presentation from scratch.
8091
+ *
8092
+ * This is a convenience static method that delegates to
8093
+ * {@link PresentationBuilder.create}. The returned handler is fully
8094
+ * initialized and ready for editing, adding slides, and saving.
8095
+ *
8096
+ * @param options - Optional slide dimensions, theme, and metadata.
8097
+ * @returns Handler, parsed data, and a slide builder factory.
8098
+ *
8099
+ * @example
8100
+ * ```ts
8101
+ * const { handler, data, createSlide } = await PptxHandler.createBlank({
8102
+ * title: "My Deck",
8103
+ * theme: { colors: { accent1: "#FF6B6B" } },
8104
+ * });
8105
+ *
8106
+ * data.slides.push(
8107
+ * createSlide("Blank")
8108
+ * .addText("Hello", { fontSize: 36 })
8109
+ * .build()
8110
+ * );
8111
+ *
8112
+ * const bytes = await handler.save(data.slides);
8113
+ * ```
8114
+ */
8115
+ static createBlank(options?: PresentationOptions): Promise<PresentationBuilderResult>;
8116
+ /**
8117
+ * Create a new PPTX presentation from scratch.
8118
+ *
8119
+ * Alias for {@link createBlank}. Generates a valid minimal OpenXML
8120
+ * package and returns a fully initialized handler ready for editing,
8121
+ * adding slides, and saving.
8122
+ *
8123
+ * @param options - Optional slide dimensions, theme, metadata,
8124
+ * and initial slide count.
8125
+ * @returns Handler, parsed data, and a slide builder factory.
8126
+ *
8127
+ * @example
8128
+ * ```ts
8129
+ * const { handler, data, createSlide } = await PptxHandler.create({
8130
+ * title: "Q4 Report",
8131
+ * initialSlideCount: 3,
8132
+ * theme: { colors: { accent1: "#FF6B6B" } },
8133
+ * });
8134
+ *
8135
+ * // The presentation already has 3 blank slides
8136
+ * console.log(data.slides.length); // => 3
8137
+ *
8138
+ * // Add more slides with content
8139
+ * data.slides.push(
8140
+ * createSlide("Blank")
8141
+ * .addText("Hello", { fontSize: 36 })
8142
+ * .build()
8143
+ * );
8144
+ *
8145
+ * const bytes = await handler.save(data.slides);
8146
+ * ```
8147
+ */
8148
+ static create(options?: PresentationOptions): Promise<PresentationBuilderResult>;
8149
+ }
8150
+ //#endregion
8151
+ //#region src/converter/SvgExporter.d.ts
8152
+ /**
8153
+ * Options controlling SVG export behaviour.
8154
+ */
8155
+ interface SvgExportOptions {
8156
+ /** Include hidden slides when exporting all. Default `false`. */
8157
+ includeHidden?: boolean;
8158
+ /** Slide indices to export (0-based). If omitted, all slides are exported. */
8159
+ slideIndices?: number[];
8160
+ /** Default font family when the element does not specify one. */
8161
+ defaultFontFamily?: string;
8162
+ /** Default font size in points when the element does not specify one. */
8163
+ defaultFontSize?: number;
8164
+ }
8165
+
8166
+ //#region src/theme/types.d.ts
8167
+ /**
8168
+ * Theme configuration types for the PowerPoint viewer.
8169
+ *
8170
+ * All color values accept any valid CSS color string:
8171
+ * hex (`#6366f1`), rgb (`rgb(99 102 241)`), hsl (`hsl(239 84% 67%)`),
8172
+ * oklch (`oklch(0.585 0.233 277)`), named colors, etc.
8173
+ *
8174
+ * Framework-agnostic — shared by the React, Vue, and Angular bindings.
8175
+ */
8176
+ /**
8177
+ * Semantic color tokens for the viewer UI.
8178
+ *
8179
+ * These map to CSS custom properties (`--pptx-<token>`) and drive all
8180
+ * UI component colors. The naming follows the shadcn/ui convention so
8181
+ * that Tailwind + shadcn users get a familiar experience.
8182
+ */
8183
+ interface ViewerThemeColors {
8184
+ /** Page / root background */
8185
+ background: string;
8186
+ /** Default text color */
8187
+ foreground: string;
8188
+ /** Card / panel surface */
8189
+ card: string;
8190
+ /** Text on card surfaces */
8191
+ cardForeground: string;
8192
+ /** Popover / dropdown surface */
8193
+ popover: string;
8194
+ /** Text inside popovers */
8195
+ popoverForeground: string;
8196
+ /** Primary action color (buttons, active indicators) */
8197
+ primary: string;
8198
+ /** Text on primary-colored backgrounds */
8199
+ primaryForeground: string;
8200
+ /** Secondary / subdued action color */
8201
+ secondary: string;
8202
+ /** Text on secondary backgrounds */
8203
+ secondaryForeground: string;
8204
+ /** Muted / disabled surface */
8205
+ muted: string;
8206
+ /** Text on muted surfaces (also used for secondary text) */
8207
+ mutedForeground: string;
8208
+ /** Accent / hover-highlight surface */
8209
+ accent: string;
8210
+ /** Text on accent surfaces */
8211
+ accentForeground: string;
8212
+ /** Destructive / danger action color */
8213
+ destructive: string;
8214
+ /** Text on destructive backgrounds */
8215
+ destructiveForeground: string;
8216
+ /** Default border color */
8217
+ border: string;
8218
+ /** Input field border color */
8219
+ input: string;
8220
+ /** Focus ring color */
8221
+ ring: string;
8222
+ }
8223
+ /**
8224
+ * Full viewer theme configuration.
8225
+ *
8226
+ * Every property is optional — unset values fall back to the built-in
8227
+ * dark theme defaults.
8228
+ */
8229
+ interface ViewerTheme {
8230
+ /** Semantic UI colors. Each key maps to a `--pptx-<key>` CSS custom property. */
8231
+ colors?: Partial<ViewerThemeColors>;
8232
+ /** Base border-radius value (e.g. `"0.5rem"`, `"8px"`). */
8233
+ radius?: string;
8234
+ /**
8235
+ * Escape hatch: arbitrary CSS custom properties to set on the viewer
8236
+ * root element. Keys should include the `--` prefix.
8237
+ *
6374
8238
  * @example
6375
8239
  * ```ts
6376
8240
  * { "--my-custom-shadow": "0 4px 12px rgba(0,0,0,0.5)" }
@@ -6721,6 +8585,227 @@ interface PrintSettings {
6721
8585
  customRangeTo: number;
6722
8586
  }
6723
8587
 
8588
+ //#endregion
8589
+ //#region src/ai/change-animator.d.ts
8590
+ /** Host-tunable options for how AI edits are animated on the canvas. */
8591
+ interface AiChangeAnimationConfig {
8592
+ /** Master switch. Default true. */
8593
+ enabled?: boolean;
8594
+ /** How long the motion + glow plays, in ms. Default 900. */
8595
+ durationMs?: number;
8596
+ /** Draw the pulsing glow highlight on changed elements. Default true. */
8597
+ glow?: boolean;
8598
+ /** Glide old->new bounds and cross-fade colours. Default true. */
8599
+ tween?: boolean;
8600
+ /** Accent colour (any CSS colour) for the glow/ghosts. Default a blue. */
8601
+ color?: string;
8602
+ }
8603
+ //#endregion
8604
+ //#region src/ai/config.d.ts
8605
+ /** The UI message shape exchanged with the assistant. Alias of the SDK type. */
8606
+ type PptxAiUIMessage = UIMessage;
8607
+ /**
8608
+ * Canonical name of every tool the assistant can call. Document tools mirror the
8609
+ * `pptx-viewer-mcp` server exactly (they ARE the same functions, run against the
8610
+ * live deck); the viewer-only tools (navigation, deck outline, element/notes
8611
+ * readers, table merge) have no MCP counterpart.
8612
+ */
8613
+ type PptxAiToolName = 'get_deck_overview' | 'get_slide' | 'get_element' | 'get_speaker_notes' | 'find_text' | 'get_theme' | 'go_to_slide' | 'select_elements' | 'merge_tables' | 'get_metadata' | 'get_layouts' | 'find_placeholders' | 'get_presentation_properties' | 'run_accessibility_check' | 'convert_to_markdown' | 'add_element' | 'update_element' | 'delete_elements' | 'arrange_elements' | 'clone_element' | 'set_element_animation' | 'group_elements' | 'ungroup_elements' | 'batch_update_elements' | 'update_element_style' | 'replace_geometry' | 'set_element_lock' | 'manage_hyperlinks' | 'replace_text' | 'manage_comments' | 'update_table_cells' | 'manage_table_structure' | 'create_chart' | 'update_chart' | 'add_chart_series' | 'remove_chart_series' | 'update_chart_series_data' | 'manage_smart_art' | 'apply_template' | 'add_slide' | 'duplicate_slide' | 'delete_slides' | 'reorder_slides' | 'update_slide_properties' | 'set_slide_transition' | 'apply_theme_preset' | 'update_theme_colors' | 'update_theme_fonts' | 'set_canvas_size' | 'update_metadata' | 'manage_sections' | 'update_presentation_properties' | 'apply_layout';
8614
+ type Resolvable<T> = T | (() => T | Promise<T>);
8615
+ /** How the assistant reaches a language model. */
8616
+ type PptxAiConnection =
8617
+ /**
8618
+ * Post messages to a host backend route (recommended for production so the
8619
+ * provider API key stays server-side). Maps to `DefaultChatTransport`.
8620
+ */
8621
+ {
8622
+ kind: 'endpoint';
8623
+ api: string;
8624
+ headers?: Resolvable<Record<string, string>>;
8625
+ body?: Resolvable<Record<string, unknown>>;
8626
+ credentials?: RequestCredentials;
8627
+ fetch?: typeof globalThis.fetch;
8628
+ } |
8629
+ /**
8630
+ * Run a language model in-process in the browser (bring-your-own key /
8631
+ * local model). Maps to a `ToolLoopAgent` behind a `DirectChatTransport`.
8632
+ */
8633
+ {
8634
+ kind: 'model';
8635
+ model: LanguageModel;
8636
+ system?: string;
8637
+ maxSteps?: number;
8638
+ } |
8639
+ /** Provide a fully-constructed transport (advanced / testing escape hatch). */
8640
+ {
8641
+ kind: 'transport';
8642
+ transport: ChatTransport<PptxAiUIMessage>;
8643
+ };
8644
+ /** How writes proposed by the assistant reach the document. */
8645
+ type PptxAiWritePolicy = 'stage' | 'approve' | 'auto';
8646
+ /** Which deck context is fed to the model with each turn. */
8647
+ type PptxAiContextStrategy = 'outline' | 'current-slide' | 'none';
8648
+ /** Optional per-session history persistence hooks. */
8649
+ interface PptxAiHistoryHooks {
8650
+ load?(id: string): Promise<PptxAiUIMessage[]>;
8651
+ save?(id: string, messages: PptxAiUIMessage[]): Promise<void>;
8652
+ }
8653
+ /** Complete host configuration for an AI chat session. */
8654
+ interface PptxAiConfig {
8655
+ connection: PptxAiConnection;
8656
+ /** Extra host instructions appended to the base system prompt. */
8657
+ systemPromptExtras?: string;
8658
+ tools?: {
8659
+ /** Allowlist. When set, only these tools are exposed. */
8660
+ enabled?: PptxAiToolName[];
8661
+ /** Denylist, applied after `enabled`. */
8662
+ disabled?: PptxAiToolName[];
8663
+ /** Additional host-defined tools merged into the tool set. */
8664
+ extra?: ToolSet;
8665
+ };
8666
+ /** Default `'stage'`. */
8667
+ writePolicy?: PptxAiWritePolicy;
8668
+ /** Default `'outline'`. */
8669
+ contextStrategy?: PptxAiContextStrategy;
8670
+ history?: PptxAiHistoryHooks;
8671
+ /**
8672
+ * How AI edits are animated on the canvas so the user can watch them land
8673
+ * (glide old->new, fade/scale in-out, glow-pulse). Omit for the defaults;
8674
+ * set `{ enabled: false }` to turn it off.
8675
+ */
8676
+ changeAnimation?: AiChangeAnimationConfig;
8677
+ onError?(error: Error): void;
8678
+ }
8679
+ //#endregion
8680
+ //#region src/ai/bridge.d.ts
8681
+ /** Lightweight, model-friendly summary of the whole deck. */
8682
+ interface PptxAiDeckMeta {
8683
+ /** Total number of slides. */
8684
+ slideCount: number;
8685
+ /** Zero-based index of the currently active slide. */
8686
+ activeSlideIndex: number;
8687
+ /** Deck title, when known (first slide title / core properties). */
8688
+ title?: string;
8689
+ /** Slide canvas width in CSS pixels. */
8690
+ width: number;
8691
+ /** Slide canvas height in CSS pixels. */
8692
+ height: number;
8693
+ }
8694
+ /** Severity hint for {@link PptxAiBridge.notify}. */
8695
+ type PptxAiNotifyLevel = 'info' | 'success' | 'warning' | 'error';
8696
+ /**
8697
+ * A target the user has scoped the assistant to: either a whole slide or a
8698
+ * single element on a slide. Returned by {@link PptxAiBridge.getFocusedTargets}
8699
+ * so the context builder can tell the model exactly what to focus on.
8700
+ */
8701
+ type PptxAiFocusedTarget = {
8702
+ kind: 'slide';
8703
+ slideIndex: number;
8704
+ } | {
8705
+ kind: 'element';
8706
+ slideIndex: number;
8707
+ elementId: string;
8708
+ };
8709
+ /**
8710
+ * A pure updater over the deck's slides. It receives a deep clone of the
8711
+ * current slides (mutation-safe) and returns the next slides array. The bridge
8712
+ * commits the returned array as ONE history entry.
8713
+ */
8714
+ type PptxAiSlidesUpdater = (slides: PptxSlide[]) => PptxSlide[];
8715
+ /**
8716
+ * A pure updater over the whole parsed deck ({@link PptxData}). Mirrors the
8717
+ * `pptx-viewer-mcp` tool model (data in, mutated data out) so presentation-level
8718
+ * MCP tools (metadata, sections, canvas size, presentation properties, layouts)
8719
+ * can be committed as ONE undoable history entry through {@link
8720
+ * PptxAiBridge.applyDeckData}. Optional: bindings that only track slide/theme
8721
+ * state can omit it, in which case those presentation-level tools report that
8722
+ * they are unavailable in this viewer while every slide/theme tool still works.
8723
+ */
8724
+ type PptxAiDataUpdater = (data: PptxData) => PptxData;
8725
+ /** Field-level updates for a single element, mirroring the MCP update vocab. */
8726
+ interface PptxAiElementUpdate {
8727
+ x?: number;
8728
+ y?: number;
8729
+ width?: number;
8730
+ height?: number;
8731
+ rotation?: number;
8732
+ opacity?: number;
8733
+ hidden?: boolean;
8734
+ flipHorizontal?: boolean;
8735
+ flipVertical?: boolean;
8736
+ text?: string;
8737
+ fontSize?: number;
8738
+ fontFamily?: string;
8739
+ fontColor?: string;
8740
+ bold?: boolean;
8741
+ italic?: boolean;
8742
+ underline?: boolean;
8743
+ align?: 'left' | 'center' | 'right' | 'justify';
8744
+ fillColor?: string;
8745
+ strokeColor?: string;
8746
+ strokeWidth?: number;
8747
+ }
8748
+ /**
8749
+ * Implemented by each binding to expose its live editor to the AI core.
8750
+ *
8751
+ * Read methods must be cheap and synchronous. Write methods must route through
8752
+ * the binding's editor-history layer so AI edits are undoable like manual ones.
8753
+ */
8754
+ interface PptxAiBridge {
8755
+ /** Return a summary of the whole deck. */
8756
+ getDeckMeta(): PptxAiDeckMeta;
8757
+ /** Return the deck's slides. Callers must not mutate the returned array. */
8758
+ getSlides(): PptxSlide[];
8759
+ /** Return the zero-based index of the active slide. */
8760
+ getActiveSlideIndex(): number;
8761
+ /** Return the resolved presentation theme, when available. */
8762
+ getTheme(): PptxTheme | undefined;
8763
+ /** Return the underlying core handler, when the binding exposes one. */
8764
+ getHandler(): PptxHandler | undefined;
8765
+ /** Navigate the viewer to a slide by zero-based index. */
8766
+ goToSlide(index: number): void;
8767
+ /** Select the given elements on a slide (empty array clears selection). */
8768
+ selectElements(slideIndex: number, elementIds: string[]): void;
8769
+ /**
8770
+ * Apply a slides updater as a single, atomic, undoable history entry. The
8771
+ * binding is responsible for cloning current slides before calling
8772
+ * `updater` and for installing the result.
8773
+ */
8774
+ applySlidesUpdate(updater: PptxAiSlidesUpdater, label: string): void;
8775
+ /** Apply field updates to one element as a single history entry. */
8776
+ updateElement(slideIndex: number, elementId: string, updates: PptxAiElementUpdate): void;
8777
+ /** Apply partial theme updates as a single history entry. */
8778
+ applyTheme(updates: Partial<PptxTheme>): void;
8779
+ /**
8780
+ * Return the full parsed {@link PptxData} for the open deck, with the live
8781
+ * (edited) slides and theme overlaid. Enables `pptx-viewer-mcp` tools that
8782
+ * read presentation-level state (metadata, sections, layouts, presentation
8783
+ * properties). Optional: when absent, the AI core synthesises a minimal
8784
+ * PptxData from slides + dimensions, which is enough for every slide/theme
8785
+ * tool but not for presentation-level reads.
8786
+ */
8787
+ getDeckData?(): PptxData | undefined;
8788
+ /**
8789
+ * Commit a whole-deck {@link PptxData} mutation as one undoable history entry.
8790
+ * Used to apply presentation-level MCP tool results (metadata, sections,
8791
+ * canvas size, presentation properties, layouts). Optional: when absent,
8792
+ * those tools report they are not supported in this viewer; slide/theme tools
8793
+ * are unaffected (they route through {@link PptxAiBridge.applySlidesUpdate}
8794
+ * and {@link PptxAiBridge.applyTheme}).
8795
+ */
8796
+ applyDeckData?(updater: PptxAiDataUpdater, label: string): void;
8797
+ /**
8798
+ * Return the slides / elements the user has scoped the assistant to, if any.
8799
+ * When present and non-empty, the context builder tells the model to focus on
8800
+ * exactly these targets. Optional so existing bridges satisfy the contract
8801
+ * without change; a bridge that does not implement it behaves as before (no
8802
+ * focus scoping).
8803
+ */
8804
+ getFocusedTargets?(): PptxAiFocusedTarget[];
8805
+ /** Surface a transient message in the host UI (toast / status line). */
8806
+ notify?(message: string, level?: PptxAiNotifyLevel): void;
8807
+ }
8808
+
6724
8809
  //#endregion
6725
8810
  //#region src/i18n/locale-catalog.d.ts
6726
8811
  /** One selectable entry in the viewer chrome's built-in language picker (File > Options > Language). */
@@ -6943,11 +9028,11 @@ interface PowerPointViewerProps {
6943
9028
  */
6944
9029
  showNotes?: boolean;
6945
9030
  /**
6946
- * Opt in to the experimental Three.js (WebGL) SmartArt renderer for
6947
- * `smartArt` elements, in place of the default SVG renderer. Requires the
6948
- * optional `three` peer dependency; when it is unavailable, or a diagram
6949
- * has no renderable nodes, or the WebGL mount fails, the SVG renderer is
6950
- * used automatically. Default false.
9031
+ * Opt in to the Three.js (WebGL) SmartArt renderer for `smartArt` elements,
9032
+ * in place of the default SVG renderer. Requires the optional `three` peer
9033
+ * dependency; when it is unavailable, or a diagram has no renderable nodes,
9034
+ * or the WebGL mount fails, the SVG renderer is used automatically. Default
9035
+ * false.
6951
9036
  */
6952
9037
  smartArt3D?: boolean;
6953
9038
  /**
@@ -7036,6 +9121,15 @@ interface PowerPointViewerProps {
7036
9121
  userName?: string;
7037
9122
  serverUrl?: string;
7038
9123
  };
9124
+ /**
9125
+ * Optional AI assistant configuration. When provided, a Sparkles toggle
9126
+ * appears in the ribbon's command row and opens a right-side chat panel that
9127
+ * can read the open deck and propose edits through the viewer's undo history.
9128
+ * The panel (and the optional `@ai-sdk/svelte` + `ai` peers it needs) is
9129
+ * lazily loaded only when first opened; leaving this undefined ships no AI UI
9130
+ * and never pulls the SDK. See `pptx-viewer-shared/ai`'s `PptxAiConfig`.
9131
+ */
9132
+ ai?: PptxAiConfig;
7039
9133
  }
7040
9134
  /**
7041
9135
  * Imperative editing API exposed on the `<PowerPointViewer>` component
@@ -7140,4 +9234,4 @@ declare const PowerPointViewer: Component<PowerPointViewerProps, PowerPointViewe
7140
9234
  type AutosaveStatus = 'idle' | 'disabled' | 'saving' | 'saved' | 'error';
7141
9235
 
7142
9236
  export { PowerPointViewer, defaultCssVars, defaultRadius, defaultThemeColors, deleteAutosaveSnapshot, exportAllSlidesToSvg, exportAllSlidesToSvgBlobs, exportSlideAsSvg, exportSlideToSvg, exportSlideToSvgBlob, getAutosaveSnapshot, listAutosaveSnapshots, loadPresentationDeck, parsePresentationSessionId, registerTranslations, themeToCssVars, vermilionDarkColors, vermilionDarkTheme, vermilionLightColors, vermilionLightTheme, vermilionRadius };
7143
- export type { AutosaveRecord, AutosaveStatus, CanvasSize, CollaborationConfig, CollaborationRole, CollaborationTransport, ExportGifOptions, ExportPdfOptions, ExportVideoOptions, PowerPointViewerApi, PowerPointViewerProps, PrintOptions, SvgExportAllOptions, SvgExportSingleSlideOptions, TranslationDictionary, Translator, ViewerLoadDetail, ViewerTheme, ViewerThemeColors };
9237
+ export type { AutosaveRecord, AutosaveStatus, CanvasSize, CollaborationConfig, CollaborationRole, CollaborationTransport, ExportGifOptions, ExportPdfOptions, ExportVideoOptions, PowerPointViewerApi, PowerPointViewerProps, PptxAiBridge, PptxAiConfig, PptxAiConnection, PptxAiContextStrategy, PptxAiToolName, PptxAiUIMessage, PptxAiWritePolicy, PrintOptions, SvgExportAllOptions, SvgExportSingleSlideOptions, TranslationDictionary, Translator, ViewerLoadDetail, ViewerTheme, ViewerThemeColors };