pptx-react-viewer 1.25.5 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +1 -1
- package/dist/AiChatPanel-BRGQCYZM.mjs +1087 -0
- package/dist/AiChatPanel-BRGQCYZM.mjs.br +0 -0
- package/dist/AiChatPanel-BRGQCYZM.mjs.gz +0 -0
- package/dist/AiChatPanel-PW5OT25Z.js +1089 -0
- package/dist/AiChatPanel-PW5OT25Z.js.br +0 -0
- package/dist/AiChatPanel-PW5OT25Z.js.gz +0 -0
- package/dist/{GLTFLoader-NMAS6VRH.mjs → GLTFLoader-374ZNTXW.mjs} +1 -1
- package/dist/GLTFLoader-374ZNTXW.mjs.br +0 -0
- package/dist/GLTFLoader-374ZNTXW.mjs.gz +0 -0
- package/dist/{GLTFLoader-GP55DVVS.js → GLTFLoader-Q7BHCGAW.js} +1 -1
- package/dist/GLTFLoader-Q7BHCGAW.js.br +0 -0
- package/dist/GLTFLoader-Q7BHCGAW.js.gz +0 -0
- package/dist/{Model3DScene-Y5ABLO7K.js → Model3DScene-JCGYRKXM.js} +4 -4
- package/dist/Model3DScene-JCGYRKXM.js.br +0 -0
- package/dist/Model3DScene-JCGYRKXM.js.gz +0 -0
- package/dist/{Model3DScene-XVYOISVJ.mjs → Model3DScene-TEF362W2.mjs} +3 -3
- package/dist/Model3DScene-TEF362W2.mjs.br +0 -0
- package/dist/Model3DScene-TEF362W2.mjs.gz +0 -0
- package/dist/{OrbitControls-VH6KILH7.js → OrbitControls-SMYCPLXO.js} +1 -1
- package/dist/OrbitControls-SMYCPLXO.js.br +3 -0
- package/dist/OrbitControls-SMYCPLXO.js.gz +0 -0
- package/dist/{OrbitControls-F5XPYD2Z.mjs → OrbitControls-ZTGHPI5G.mjs} +1 -1
- package/dist/OrbitControls-ZTGHPI5G.mjs.br +0 -0
- package/dist/{OrbitControls-F5XPYD2Z.mjs.gz → OrbitControls-ZTGHPI5G.mjs.gz} +0 -0
- package/dist/{PowerPointViewer-CnADroqZ.d.ts → PowerPointViewer-gmU5rc7K.d.ts} +2 -2
- package/dist/PowerPointViewer-gmU5rc7K.d.ts.map +1 -0
- package/dist/{SmartArt3DScene-WQIDFZ7X.mjs → SmartArt3DScene-XCFVGCXE.mjs} +1 -1
- package/dist/SmartArt3DScene-XCFVGCXE.mjs.br +0 -0
- package/dist/SmartArt3DScene-XCFVGCXE.mjs.gz +0 -0
- package/dist/{SmartArt3DScene-HCQBDRAM.js → SmartArt3DScene-ZO3KFDI2.js} +1 -1
- package/dist/SmartArt3DScene-ZO3KFDI2.js.br +0 -0
- package/dist/SmartArt3DScene-ZO3KFDI2.js.gz +0 -0
- package/dist/{SurfaceChart3DScene-WMY5JTW4.js → SurfaceChart3DScene-2SHCYZVC.js} +4 -4
- package/dist/{SurfaceChart3DScene-WMY5JTW4.js.br → SurfaceChart3DScene-2SHCYZVC.js.br} +0 -0
- package/dist/SurfaceChart3DScene-2SHCYZVC.js.gz +0 -0
- package/dist/{SurfaceChart3DScene-RXZADECL.mjs → SurfaceChart3DScene-UPDCIMJM.mjs} +3 -3
- package/dist/SurfaceChart3DScene-UPDCIMJM.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-UPDCIMJM.mjs.gz +0 -0
- package/dist/{animation-timeline-CEJJLFqK.d.ts → animation-timeline-eb5z0SHW.d.ts} +250 -8
- package/dist/animation-timeline-eb5z0SHW.d.ts.map +1 -0
- package/dist/{chunk-M3SIFXWD.mjs → chunk-2X72MOPZ.mjs} +65 -0
- package/dist/chunk-2X72MOPZ.mjs.br +0 -0
- package/dist/chunk-2X72MOPZ.mjs.gz +0 -0
- package/dist/{chunk-QGM4M3NI.js → chunk-4VNS5WPM.js} +5 -0
- package/dist/chunk-4VNS5WPM.js.br +0 -0
- package/dist/chunk-4VNS5WPM.js.gz +0 -0
- package/dist/{chunk-F4WPQRZU.mjs → chunk-5XLLRPMV.mjs} +6901 -14355
- package/dist/chunk-5XLLRPMV.mjs.br +0 -0
- package/dist/chunk-5XLLRPMV.mjs.gz +0 -0
- package/dist/{chunk-FOMF7POV.mjs → chunk-6YXLGMTN.mjs} +2493 -1588
- package/dist/chunk-6YXLGMTN.mjs.br +0 -0
- package/dist/chunk-6YXLGMTN.mjs.gz +0 -0
- package/dist/chunk-B6NRDUHJ.mjs +8029 -0
- package/dist/chunk-B6NRDUHJ.mjs.br +0 -0
- package/dist/chunk-B6NRDUHJ.mjs.gz +0 -0
- package/dist/chunk-BHVCED34.mjs +16664 -0
- package/dist/chunk-BHVCED34.mjs.br +0 -0
- package/dist/chunk-BHVCED34.mjs.gz +0 -0
- package/dist/{chunk-IPYAN574.js → chunk-CLNGAVNH.js} +2495 -1587
- package/dist/chunk-CLNGAVNH.js.br +0 -0
- package/dist/chunk-CLNGAVNH.js.gz +0 -0
- package/dist/{chunk-2EFVXYNA.js → chunk-CUUYYYC5.js} +65 -0
- package/dist/chunk-CUUYYYC5.js.br +0 -0
- package/dist/chunk-CUUYYYC5.js.gz +0 -0
- package/dist/{chunk-L4ZADJOM.mjs → chunk-L63RAVM7.mjs} +1285 -150
- package/dist/chunk-L63RAVM7.mjs.br +0 -0
- package/dist/chunk-L63RAVM7.mjs.gz +0 -0
- package/dist/{chunk-7CSBUYRN.js → chunk-LFXG7SGG.js} +2073 -938
- package/dist/chunk-LFXG7SGG.js.br +0 -0
- package/dist/chunk-LFXG7SGG.js.gz +0 -0
- package/dist/{chunk-TEN35NUX.js → chunk-OKOJVSKJ.js} +3512 -403
- package/dist/chunk-OKOJVSKJ.js.br +0 -0
- package/dist/chunk-OKOJVSKJ.js.gz +0 -0
- package/dist/{chunk-FVQDRA5N.mjs → chunk-R2N2UYT7.mjs} +3455 -362
- package/dist/chunk-R2N2UYT7.mjs.br +0 -0
- package/dist/chunk-R2N2UYT7.mjs.gz +0 -0
- package/dist/chunk-SYPHGLIB.js +16701 -0
- package/dist/chunk-SYPHGLIB.js.br +0 -0
- package/dist/chunk-SYPHGLIB.js.gz +0 -0
- package/dist/{chunk-6DZX6EAA.mjs → chunk-XGB3TDIC.mjs} +5 -1
- package/dist/chunk-XGB3TDIC.mjs.br +0 -0
- package/dist/chunk-XGB3TDIC.mjs.gz +0 -0
- package/dist/chunk-ZB4NZRCI.js +11111 -0
- package/dist/chunk-ZB4NZRCI.js.br +0 -0
- package/dist/chunk-ZB4NZRCI.js.gz +0 -0
- package/dist/chunk-ZKDE3HJI.js +8121 -0
- package/dist/chunk-ZKDE3HJI.js.br +0 -0
- package/dist/chunk-ZKDE3HJI.js.gz +0 -0
- package/dist/{dist-755SJ3ZH.js → dist-4LUVI3SW.js} +578 -566
- package/dist/dist-4LUVI3SW.js.br +0 -0
- package/dist/dist-4LUVI3SW.js.gz +0 -0
- package/dist/dist-J6PC54PZ.mjs +2 -0
- package/dist/dist-J6PC54PZ.mjs.br +0 -0
- package/dist/dist-J6PC54PZ.mjs.gz +0 -0
- package/dist/i18n.js +5 -5
- package/dist/i18n.js.br +0 -0
- package/dist/i18n.js.gz +0 -0
- package/dist/i18n.mjs +2 -2
- package/dist/i18n.mjs.br +0 -0
- package/dist/i18n.mjs.gz +0 -0
- package/dist/{index-J6IuHQ2_.d.ts → index-a8wcFjRJ.d.ts} +4 -4
- package/dist/{index-J6IuHQ2_.d.ts.map → index-a8wcFjRJ.d.ts.map} +1 -1
- package/dist/index.d.ts +3030 -220
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -39
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +8 -6
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/{hooks-unstable.d.ts → internals.d.ts} +1238 -974
- package/dist/internals.d.ts.map +1 -0
- package/dist/{hooks-unstable.js → internals.js} +81 -80
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/{hooks-unstable.mjs → internals.mjs} +6 -5
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/pptx-viewer.css +1 -1
- package/dist/pptx-viewer.css.br +0 -0
- package/dist/pptx-viewer.css.gz +0 -0
- package/dist/{three.module-7CXEVRKB.mjs → three.module-AC7ESV4W.mjs} +1 -1
- package/dist/three.module-AC7ESV4W.mjs.br +0 -0
- package/dist/three.module-AC7ESV4W.mjs.gz +0 -0
- package/dist/{three.module-CPZZFD2Q.js → three.module-GNNNRIMK.js} +1 -1
- package/dist/three.module-GNNNRIMK.js.br +0 -0
- package/dist/three.module-GNNNRIMK.js.gz +0 -0
- package/dist/{useViewerBuildingBlocks-ll3_ncCH.d.ts → useViewerBuildingBlocks-CjureTRf.d.ts} +185 -174
- package/dist/useViewerBuildingBlocks-CjureTRf.d.ts.map +1 -0
- package/dist/viewer/index.d.ts +469 -52
- package/dist/viewer/index.d.ts.map +1 -1
- package/dist/viewer/index.js +35 -33
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +8 -6
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/dist/{y-webrtc-6CRYHAXH.mjs → y-webrtc-DGVURJIF.mjs} +1 -1
- package/dist/y-webrtc-DGVURJIF.mjs.br +0 -0
- package/dist/y-webrtc-DGVURJIF.mjs.gz +0 -0
- package/dist/{y-webrtc-QCZF75JW.js → y-webrtc-YN53KW3J.js} +5 -5
- package/dist/y-webrtc-YN53KW3J.js.br +0 -0
- package/dist/y-webrtc-YN53KW3J.js.gz +0 -0
- package/dist/{y-websocket-QJEM6VOB.js → y-websocket-HZCIQLM6.js} +1 -1
- package/dist/y-websocket-HZCIQLM6.js.br +0 -0
- package/dist/y-websocket-HZCIQLM6.js.gz +0 -0
- package/dist/{y-websocket-57Q3RNHC.mjs → y-websocket-P5LTAJ5T.mjs} +1 -1
- package/dist/y-websocket-P5LTAJ5T.mjs.br +0 -0
- package/dist/y-websocket-P5LTAJ5T.mjs.gz +0 -0
- package/dist/{yjs-Y7IYUWOG.mjs → yjs-FKGX4QHS.mjs} +1 -1
- package/dist/yjs-FKGX4QHS.mjs.br +0 -0
- package/dist/yjs-FKGX4QHS.mjs.gz +0 -0
- package/dist/{yjs-UH3EPF3C.js → yjs-HBLSEMHP.js} +1 -1
- package/dist/yjs-HBLSEMHP.js.br +0 -0
- package/dist/yjs-HBLSEMHP.js.gz +0 -0
- package/package.json +19 -7
- package/dist/GLTFLoader-GP55DVVS.js.br +0 -0
- package/dist/GLTFLoader-GP55DVVS.js.gz +0 -0
- package/dist/GLTFLoader-NMAS6VRH.mjs.br +0 -0
- package/dist/GLTFLoader-NMAS6VRH.mjs.gz +0 -0
- package/dist/Model3DScene-XVYOISVJ.mjs.br +0 -0
- package/dist/Model3DScene-XVYOISVJ.mjs.gz +0 -0
- package/dist/Model3DScene-Y5ABLO7K.js.br +0 -0
- package/dist/Model3DScene-Y5ABLO7K.js.gz +0 -0
- package/dist/OrbitControls-F5XPYD2Z.mjs.br +0 -0
- package/dist/OrbitControls-VH6KILH7.js.br +0 -2
- package/dist/OrbitControls-VH6KILH7.js.gz +0 -0
- package/dist/PowerPointViewer-CnADroqZ.d.ts.map +0 -1
- package/dist/SmartArt3DScene-HCQBDRAM.js.br +0 -0
- package/dist/SmartArt3DScene-HCQBDRAM.js.gz +0 -0
- package/dist/SmartArt3DScene-WQIDFZ7X.mjs.br +0 -0
- package/dist/SmartArt3DScene-WQIDFZ7X.mjs.gz +0 -0
- package/dist/SurfaceChart3DScene-RXZADECL.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-RXZADECL.mjs.gz +0 -0
- package/dist/SurfaceChart3DScene-WMY5JTW4.js.gz +0 -0
- package/dist/animation-timeline-CEJJLFqK.d.ts.map +0 -1
- package/dist/chunk-2EFVXYNA.js.br +0 -0
- package/dist/chunk-2EFVXYNA.js.gz +0 -0
- package/dist/chunk-6DZX6EAA.mjs.br +0 -0
- package/dist/chunk-6DZX6EAA.mjs.gz +0 -0
- package/dist/chunk-7CSBUYRN.js.br +0 -0
- package/dist/chunk-7CSBUYRN.js.gz +0 -0
- package/dist/chunk-E55Q4AC7.js +0 -18639
- package/dist/chunk-E55Q4AC7.js.br +0 -0
- package/dist/chunk-E55Q4AC7.js.gz +0 -0
- package/dist/chunk-F4WPQRZU.mjs.br +0 -0
- package/dist/chunk-F4WPQRZU.mjs.gz +0 -0
- package/dist/chunk-FOMF7POV.mjs.br +0 -0
- package/dist/chunk-FOMF7POV.mjs.gz +0 -0
- package/dist/chunk-FVQDRA5N.mjs.br +0 -0
- package/dist/chunk-FVQDRA5N.mjs.gz +0 -0
- package/dist/chunk-IPYAN574.js.br +0 -0
- package/dist/chunk-IPYAN574.js.gz +0 -0
- package/dist/chunk-L4ZADJOM.mjs.br +0 -0
- package/dist/chunk-L4ZADJOM.mjs.gz +0 -0
- package/dist/chunk-M3SIFXWD.mjs.br +0 -0
- package/dist/chunk-M3SIFXWD.mjs.gz +0 -0
- package/dist/chunk-QGM4M3NI.js.br +0 -0
- package/dist/chunk-QGM4M3NI.js.gz +0 -0
- package/dist/chunk-TEN35NUX.js.br +0 -0
- package/dist/chunk-TEN35NUX.js.gz +0 -0
- package/dist/dist-755SJ3ZH.js.br +0 -0
- package/dist/dist-755SJ3ZH.js.gz +0 -0
- package/dist/dist-FFWP5NQZ.mjs +0 -2
- package/dist/dist-FFWP5NQZ.mjs.br +0 -0
- package/dist/dist-FFWP5NQZ.mjs.gz +0 -0
- package/dist/hooks-unstable.d.ts.map +0 -1
- package/dist/hooks-unstable.js.br +0 -0
- package/dist/hooks-unstable.js.gz +0 -0
- package/dist/hooks-unstable.mjs.br +0 -0
- package/dist/hooks-unstable.mjs.gz +0 -0
- package/dist/three.module-7CXEVRKB.mjs.br +0 -0
- package/dist/three.module-7CXEVRKB.mjs.gz +0 -0
- package/dist/three.module-CPZZFD2Q.js.br +0 -0
- package/dist/three.module-CPZZFD2Q.js.gz +0 -0
- package/dist/useViewerBuildingBlocks-ll3_ncCH.d.ts.map +0 -1
- package/dist/y-webrtc-6CRYHAXH.mjs.br +0 -0
- package/dist/y-webrtc-6CRYHAXH.mjs.gz +0 -0
- package/dist/y-webrtc-QCZF75JW.js.br +0 -0
- package/dist/y-webrtc-QCZF75JW.js.gz +0 -0
- package/dist/y-websocket-57Q3RNHC.mjs.br +0 -0
- package/dist/y-websocket-57Q3RNHC.mjs.gz +0 -0
- package/dist/y-websocket-QJEM6VOB.js.br +0 -0
- package/dist/y-websocket-QJEM6VOB.js.gz +0 -0
- package/dist/yjs-UH3EPF3C.js.br +0 -0
- package/dist/yjs-UH3EPF3C.js.gz +0 -0
- package/dist/yjs-Y7IYUWOG.mjs.br +0 -0
- package/dist/yjs-Y7IYUWOG.mjs.gz +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React$1__default from 'react';
|
|
3
|
+
import { LanguageModel, ChatTransport, UIMessage, ToolSet } from 'ai';
|
|
3
4
|
import { Options } from 'html2canvas-pro';
|
|
4
5
|
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/i18n/locale-catalog.d.ts
|
|
8
|
+
/** One selectable entry in the viewer chrome's built-in language picker (File > Options > Language). */
|
|
9
|
+
interface LocaleCatalogEntry {
|
|
10
|
+
/** BCP-47-ish locale code, e.g. `'en'`, `'fr'`. Matches `pptx-viewer-locales`' exports. */
|
|
11
|
+
code: string;
|
|
12
|
+
/** English display name, used before a translation dictionary for the target locale is loaded. */
|
|
13
|
+
label: string;
|
|
14
|
+
/** The locale's own name for itself, e.g. `'Français'` for `fr`. */
|
|
15
|
+
nativeLabel: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Built-in language choices offered by File > Options > Language when a host
|
|
19
|
+
* doesn't supply its own `availableLocales`. Mirrors the locales shipped by
|
|
20
|
+
* the optional `pptx-viewer-locales` package (English needs no dictionary,
|
|
21
|
+
* it's the viewer's own baseline).
|
|
22
|
+
*/
|
|
23
|
+
declare const LOCALE_CATALOG: readonly LocaleCatalogEntry[];
|
|
24
|
+
|
|
5
25
|
//#region src/core/types/actions.d.ts
|
|
6
26
|
/**
|
|
7
27
|
* Action types: hyperlinks, slide jumps, macros, and action buttons.
|
|
@@ -1023,6 +1043,14 @@ interface ShapeStyle {
|
|
|
1023
1043
|
};
|
|
1024
1044
|
/** Fill overlay blend mode from effectDag `a:fillOverlay/@blend`. */
|
|
1025
1045
|
dagFillOverlayBlend?: 'over' | 'mult' | 'screen' | 'darken' | 'lighten';
|
|
1046
|
+
/**
|
|
1047
|
+
* Fill overlay tint colour (hex `#RRGGBB`) from effectDag `a:fillOverlay`'s
|
|
1048
|
+
* `a:solidFill`/`a:gradFill`. Painted as a blended overlay layer over the
|
|
1049
|
+
* element; the blend mode comes from {@link dagFillOverlayBlend}.
|
|
1050
|
+
*/
|
|
1051
|
+
dagFillOverlayColor?: string;
|
|
1052
|
+
/** Fill overlay tint opacity (0-1), from the overlay fill colour's alpha. */
|
|
1053
|
+
dagFillOverlayOpacity?: number;
|
|
1026
1054
|
/** `<a:lnRef @idx>` — 1-based index into the theme's lnStyleLst. */
|
|
1027
1055
|
lnRefIdx?: number;
|
|
1028
1056
|
/** Raw XML colour child of `<a:lnRef>` (e.g. `<a:schemeClr>` with transforms). */
|
|
@@ -1795,6 +1823,47 @@ interface PptxShapeProperties {
|
|
|
1795
1823
|
/** Adjustment handles for interactive shape modification (yellow diamond handles). */
|
|
1796
1824
|
adjustmentHandles?: GeometryAdjustmentHandle[];
|
|
1797
1825
|
}
|
|
1826
|
+
/**
|
|
1827
|
+
* Text styling for a single indent level (0–8) inside a placeholder’s
|
|
1828
|
+
* `a:lstStyle`.
|
|
1829
|
+
*
|
|
1830
|
+
* Used during placeholder inheritance to fill in defaults for font,
|
|
1831
|
+
* bullet, and spacing properties the slide element does not override.
|
|
1832
|
+
*
|
|
1833
|
+
* @example
|
|
1834
|
+
* ```ts
|
|
1835
|
+
* const level0: PlaceholderTextLevelStyle = {
|
|
1836
|
+
* fontSize: 32,
|
|
1837
|
+
* bold: true,
|
|
1838
|
+
* bulletChar: "•",
|
|
1839
|
+
* };
|
|
1840
|
+
* // => satisfies PlaceholderTextLevelStyle
|
|
1841
|
+
* ```
|
|
1842
|
+
*/
|
|
1843
|
+
interface PlaceholderTextLevelStyle {
|
|
1844
|
+
fontFamily?: string;
|
|
1845
|
+
fontSize?: number;
|
|
1846
|
+
bold?: boolean;
|
|
1847
|
+
italic?: boolean;
|
|
1848
|
+
color?: string;
|
|
1849
|
+
bulletChar?: string;
|
|
1850
|
+
bulletAutoNumType?: string;
|
|
1851
|
+
bulletFontFamily?: string;
|
|
1852
|
+
bulletSizePercent?: number;
|
|
1853
|
+
/** Bullet colour from `a:buClr` as hex string. */
|
|
1854
|
+
bulletColor?: string;
|
|
1855
|
+
/** Bullet size in points from `a:buSzPts`. */
|
|
1856
|
+
bulletSizePts?: number;
|
|
1857
|
+
/** True when `a:buNone` is present at this level. */
|
|
1858
|
+
bulletNone?: boolean;
|
|
1859
|
+
marginLeft?: number;
|
|
1860
|
+
indent?: number;
|
|
1861
|
+
alignment?: string;
|
|
1862
|
+
lineSpacing?: number;
|
|
1863
|
+
lineSpacingExactPt?: number;
|
|
1864
|
+
spaceBefore?: number;
|
|
1865
|
+
spaceAfter?: number;
|
|
1866
|
+
}
|
|
1798
1867
|
//#endregion
|
|
1799
1868
|
//#region src/core/types/chart-axis.d.ts
|
|
1800
1869
|
/** Tick-mark placement from ChartML `ST_TickMark`. */
|
|
@@ -1914,6 +1983,75 @@ interface PptxChartProtection {
|
|
|
1914
1983
|
rawXml?: XmlObject;
|
|
1915
1984
|
}
|
|
1916
1985
|
//#endregion
|
|
1986
|
+
//#region src/core/types/chart-user-shapes.d.ts
|
|
1987
|
+
/**
|
|
1988
|
+
* Types for chart drawing-overlay shapes (`c:userShapes`).
|
|
1989
|
+
*
|
|
1990
|
+
* A chart's `c:userShapes` element carries an `r:id` that references a
|
|
1991
|
+
* separate drawing part (`ppt/drawings/drawingN.xml`) whose root is a
|
|
1992
|
+
* `c:userShapes` element populated with `cdr:relSizeAnchor` /
|
|
1993
|
+
* `cdr:absSizeAnchor` wrappers around `sp` / `pic` / `cxnSp` shapes drawn on
|
|
1994
|
+
* top of the chart plot. These interfaces describe the parsed, renderable
|
|
1995
|
+
* overlay model. The raw reference is preserved separately on
|
|
1996
|
+
* {@link PptxChartData.userShapesXml} for verbatim round-trip save; this model
|
|
1997
|
+
* is render-only.
|
|
1998
|
+
*
|
|
1999
|
+
* @module pptx-types/chart-user-shapes
|
|
2000
|
+
*/
|
|
2001
|
+
/** A single paragraph of overlay-shape text with light formatting. */
|
|
2002
|
+
interface PptxChartUserShapeParagraph {
|
|
2003
|
+
/** Joined run text of the paragraph. */
|
|
2004
|
+
text: string;
|
|
2005
|
+
/** Font size in points (`a:rPr/@sz` divided by 100), when present. */
|
|
2006
|
+
fontSize?: number;
|
|
2007
|
+
/** Whether the first run is bold (`a:rPr/@b`). */
|
|
2008
|
+
bold?: boolean;
|
|
2009
|
+
/** Whether the first run is italic (`a:rPr/@i`). */
|
|
2010
|
+
italic?: boolean;
|
|
2011
|
+
/** Resolved run colour hex (e.g. `"#FF0000"`), when present. */
|
|
2012
|
+
color?: string;
|
|
2013
|
+
/** Paragraph alignment (`a:pPr/@algn`): left / centre / right. */
|
|
2014
|
+
align?: 'l' | 'ctr' | 'r';
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2017
|
+
* A parsed chart-overlay shape positioned by a drawing anchor.
|
|
2018
|
+
*
|
|
2019
|
+
* Position is expressed as chart-relative fractions in {@link from}. For a
|
|
2020
|
+
* `relSizeAnchor` the opposite corner is {@link to} (also fractional); for an
|
|
2021
|
+
* `absSizeAnchor` the extent is {@link ext} in EMU.
|
|
2022
|
+
*/
|
|
2023
|
+
interface PptxChartUserShape {
|
|
2024
|
+
/** Shape kind: text/preset shape, connector, or picture. */
|
|
2025
|
+
kind: 'sp' | 'cxnSp' | 'pic';
|
|
2026
|
+
/** Anchor kind that positioned the shape. */
|
|
2027
|
+
anchor: 'rel' | 'abs';
|
|
2028
|
+
/** Top-left corner as chart-relative fractions (0-1). */
|
|
2029
|
+
from: {
|
|
2030
|
+
x: number;
|
|
2031
|
+
y: number;
|
|
2032
|
+
};
|
|
2033
|
+
/** Bottom-right corner as chart-relative fractions (0-1); relSizeAnchor only. */
|
|
2034
|
+
to?: {
|
|
2035
|
+
x: number;
|
|
2036
|
+
y: number;
|
|
2037
|
+
};
|
|
2038
|
+
/** Extent in EMU (cx, cy); absSizeAnchor only. */
|
|
2039
|
+
ext?: {
|
|
2040
|
+
cx: number;
|
|
2041
|
+
cy: number;
|
|
2042
|
+
};
|
|
2043
|
+
/** Preset geometry name (`a:prstGeom/@prst`), defaulting to `"rect"`. */
|
|
2044
|
+
prst?: string;
|
|
2045
|
+
/** Resolved solid-fill hex colour, when present. */
|
|
2046
|
+
fill?: string;
|
|
2047
|
+
/** Resolved line/stroke hex colour, when present. */
|
|
2048
|
+
stroke?: string;
|
|
2049
|
+
/** Line width in points (`a:ln/@w` divided by 12700), when present. */
|
|
2050
|
+
strokeWidth?: number;
|
|
2051
|
+
/** Text paragraphs of the shape's `txBody`, when present. */
|
|
2052
|
+
paragraphs?: PptxChartUserShapeParagraph[];
|
|
2053
|
+
}
|
|
2054
|
+
//#endregion
|
|
1917
2055
|
//#region src/core/types/chart.d.ts
|
|
1918
2056
|
/**
|
|
1919
2057
|
* Supported chart type discriminators.
|
|
@@ -2247,6 +2385,15 @@ interface PptxChartTreemapOptions {
|
|
|
2247
2385
|
interface PptxChartSeries {
|
|
2248
2386
|
name: string;
|
|
2249
2387
|
values: number[];
|
|
2388
|
+
/**
|
|
2389
|
+
* Blank-value mask aligned index-for-index with {@link values}: `true` marks
|
|
2390
|
+
* a category whose numeric cache point (`c:numCache/c:pt`) was absent or
|
|
2391
|
+
* empty, i.e. a genuine blank rather than a real `0`. Present only when the
|
|
2392
|
+
* source series actually contains blanks; when set, blank slots in
|
|
2393
|
+
* {@link values} carry `0` as a placeholder. Renderers honour
|
|
2394
|
+
* `c:dispBlanksAs` (gap / zero / span) using this mask.
|
|
2395
|
+
*/
|
|
2396
|
+
blanks?: boolean[];
|
|
2250
2397
|
color?: string;
|
|
2251
2398
|
trendlines?: PptxChartTrendline[];
|
|
2252
2399
|
errBars?: PptxChartErrBars[];
|
|
@@ -2468,6 +2615,14 @@ interface PptxChartManualLayout {
|
|
|
2468
2615
|
y?: number;
|
|
2469
2616
|
width?: number;
|
|
2470
2617
|
height?: number;
|
|
2618
|
+
/**
|
|
2619
|
+
* Raw `c:extLst` (CT_ExtensionList) of the `c:manualLayout`, captured
|
|
2620
|
+
* verbatim so it round-trips through the typed model. Without this, a dirty
|
|
2621
|
+
* write of an edited layout would drop the extension list (the manual node
|
|
2622
|
+
* is rebuilt from the typed fields). Emitted as the trailing child, matching
|
|
2623
|
+
* the CT_ManualLayout schema order.
|
|
2624
|
+
*/
|
|
2625
|
+
ext?: XmlObject;
|
|
2471
2626
|
}
|
|
2472
2627
|
/**
|
|
2473
2628
|
* Typed manual layouts for chart regions that accept `c:layout`.
|
|
@@ -2659,6 +2814,15 @@ interface PptxChartData {
|
|
|
2659
2814
|
* attempting to parse the nested drawing tree.
|
|
2660
2815
|
*/
|
|
2661
2816
|
userShapesXml?: unknown;
|
|
2817
|
+
/**
|
|
2818
|
+
* Parsed, renderable drawing-overlay shapes resolved from the separate
|
|
2819
|
+
* drawing part referenced by `c:userShapes/@r:id`
|
|
2820
|
+
* (`ppt/drawings/drawingN.xml`). Each entry carries chart-relative anchor
|
|
2821
|
+
* geometry plus light shape/text formatting so the viewer can render an
|
|
2822
|
+
* overlay on top of the chart plot. Render-only: {@link userShapesXml}
|
|
2823
|
+
* remains the source of truth for round-trip save.
|
|
2824
|
+
*/
|
|
2825
|
+
userShapes?: PptxChartUserShape[];
|
|
2662
2826
|
/**
|
|
2663
2827
|
* Raw `c:pivotFmts` XML subtree preserved verbatim.
|
|
2664
2828
|
*
|
|
@@ -3679,7 +3843,7 @@ interface PptxSmartArtData {
|
|
|
3679
3843
|
/**
|
|
3680
3844
|
* Per-cell visual style for a table cell.
|
|
3681
3845
|
*
|
|
3682
|
-
* All fields are optional
|
|
3846
|
+
* All fields are optional - unset values inherit from the table style.
|
|
3683
3847
|
*
|
|
3684
3848
|
* @example
|
|
3685
3849
|
* ```ts
|
|
@@ -3807,6 +3971,52 @@ interface PptxTableCellStyle {
|
|
|
3807
3971
|
patternFillForeground?: string;
|
|
3808
3972
|
/** Pattern fill background colour. */
|
|
3809
3973
|
patternFillBackground?: string;
|
|
3974
|
+
/**
|
|
3975
|
+
* Cell 3D bevel + lighting from `a:tcPr/a:cell3D` (CT_Cell3D,
|
|
3976
|
+
* ECMA-376 §21.1.3.1). Rendered as a CSS bevel treatment.
|
|
3977
|
+
*/
|
|
3978
|
+
cell3D?: PptxTableCell3D;
|
|
3979
|
+
/**
|
|
3980
|
+
* `a:tcPr/@anchorCtr` - centre the text block in the direction
|
|
3981
|
+
* perpendicular to the text flow (horizontal centring for horizontal text).
|
|
3982
|
+
*/
|
|
3983
|
+
anchorCtr?: boolean;
|
|
3984
|
+
/**
|
|
3985
|
+
* `a:tcPr/@horzOverflow` (ST_TextHorzOverflowType): `clip` clips text at
|
|
3986
|
+
* the cell edge, `overflow` (the default) lets it spill.
|
|
3987
|
+
*/
|
|
3988
|
+
horzOverflow?: 'clip' | 'overflow';
|
|
3989
|
+
}
|
|
3990
|
+
/**
|
|
3991
|
+
* Cell 3D bevel + lighting parsed from `a:tcPr/a:cell3D` (CT_Cell3D).
|
|
3992
|
+
*
|
|
3993
|
+
* Only the fields needed to render a plausible bevel treatment are captured;
|
|
3994
|
+
* verbatim round-trip of the full node is handled separately by the save path.
|
|
3995
|
+
*
|
|
3996
|
+
* @example
|
|
3997
|
+
* ```ts
|
|
3998
|
+
* const c3d: PptxTableCell3D = {
|
|
3999
|
+
* bevelWidth: 8,
|
|
4000
|
+
* bevelHeight: 8,
|
|
4001
|
+
* bevelPreset: 'circle',
|
|
4002
|
+
* material: 'plastic',
|
|
4003
|
+
* };
|
|
4004
|
+
* // => satisfies PptxTableCell3D
|
|
4005
|
+
* ```
|
|
4006
|
+
*/
|
|
4007
|
+
interface PptxTableCell3D {
|
|
4008
|
+
/** Bevel width in px (from `a:bevel@w`, EMU converted). */
|
|
4009
|
+
bevelWidth?: number;
|
|
4010
|
+
/** Bevel height in px (from `a:bevel@h`, EMU converted). */
|
|
4011
|
+
bevelHeight?: number;
|
|
4012
|
+
/** Bevel preset name (`a:bevel@prst`, e.g. `circle`, `relaxedInset`). */
|
|
4013
|
+
bevelPreset?: string;
|
|
4014
|
+
/** Preset material (`a:cell3D@prstMaterial`, e.g. `plastic`, `metal`). */
|
|
4015
|
+
material?: string;
|
|
4016
|
+
/** Light rig type (`a:lightRig@rig`, e.g. `threePt`, `soft`). */
|
|
4017
|
+
lightRig?: string;
|
|
4018
|
+
/** Light rig direction (`a:lightRig@dir`, e.g. `tl`, `t`, `tr`). */
|
|
4019
|
+
lightRigDirection?: string;
|
|
3810
4020
|
}
|
|
3811
4021
|
/**
|
|
3812
4022
|
* A single table cell with text content, optional style, and merge info.
|
|
@@ -4030,7 +4240,7 @@ interface ParsedTableStyleBorder {
|
|
|
4030
4240
|
fill?: ParsedTableStyleFill;
|
|
4031
4241
|
/** Explicit hex colour when the line used `a:srgbClr` (e.g. `#808080`). */
|
|
4032
4242
|
color?: string;
|
|
4033
|
-
/** The line was `a:noFill`
|
|
4243
|
+
/** The line was `a:noFill` - an explicit "no border" that clears lower layers. */
|
|
4034
4244
|
noFill?: boolean;
|
|
4035
4245
|
}
|
|
4036
4246
|
/**
|
|
@@ -4601,6 +4811,136 @@ interface UnknownPptxElement extends PptxElementBase {
|
|
|
4601
4811
|
* (shape), or `textSegments` (text/shape).
|
|
4602
4812
|
*/
|
|
4603
4813
|
type PptxElement = TextPptxElement | ShapePptxElement | ConnectorPptxElement | ImagePptxElement | PicturePptxElement | TablePptxElement | ChartPptxElement | SmartArtPptxElement | OlePptxElement | MediaPptxElement | GroupPptxElement | InkPptxElement | ContentPartPptxElement | ZoomPptxElement | Model3DPptxElement | UnknownPptxElement;
|
|
4814
|
+
//#endregion
|
|
4815
|
+
//#region src/core/types/masters.d.ts
|
|
4816
|
+
/**
|
|
4817
|
+
* Parsed notes master from `ppt/notesMasters/notesMaster1.xml`.
|
|
4818
|
+
*
|
|
4819
|
+
* @example
|
|
4820
|
+
* ```ts
|
|
4821
|
+
* const notes: PptxNotesMaster = {
|
|
4822
|
+
* path: "ppt/notesMasters/notesMaster1.xml",
|
|
4823
|
+
* backgroundColor: "#FFFFFF",
|
|
4824
|
+
* placeholders: [{ type: "body" }, { type: "sldImg" }],
|
|
4825
|
+
* };
|
|
4826
|
+
* // => satisfies PptxNotesMaster
|
|
4827
|
+
* ```
|
|
4828
|
+
*/
|
|
4829
|
+
interface PptxNotesMaster {
|
|
4830
|
+
/** File path within the PPTX archive. */
|
|
4831
|
+
path: string;
|
|
4832
|
+
/** Background colour of the notes master. */
|
|
4833
|
+
backgroundColor?: string;
|
|
4834
|
+
/** Background image data URL. */
|
|
4835
|
+
backgroundImage?: string;
|
|
4836
|
+
/** Placeholder shapes found on the notes master. */
|
|
4837
|
+
placeholders?: Array<{
|
|
4838
|
+
type: string;
|
|
4839
|
+
idx?: string;
|
|
4840
|
+
}>;
|
|
4841
|
+
/** Editable elements on the notes master (header, footer, date, page number, slide image, notes body). */
|
|
4842
|
+
elements?: PptxElement[];
|
|
4843
|
+
/** Header/footer flags from `<p:hf>` on the notes master (P-H3). */
|
|
4844
|
+
headerFooter?: PptxHeaderFooterFlags;
|
|
4845
|
+
/** Colour map from `<p:clrMap>` (12 alias attributes). Applied at save time. */
|
|
4846
|
+
clrMap?: Record<string, string>;
|
|
4847
|
+
}
|
|
4848
|
+
/**
|
|
4849
|
+
* Parsed handout master from `ppt/handoutMasters/handoutMaster1.xml`.
|
|
4850
|
+
*
|
|
4851
|
+
* @example
|
|
4852
|
+
* ```ts
|
|
4853
|
+
* const handout: PptxHandoutMaster = {
|
|
4854
|
+
* path: "ppt/handoutMasters/handoutMaster1.xml",
|
|
4855
|
+
* slidesPerPage: 6,
|
|
4856
|
+
* };
|
|
4857
|
+
* // => satisfies PptxHandoutMaster
|
|
4858
|
+
* ```
|
|
4859
|
+
*/
|
|
4860
|
+
interface PptxHandoutMaster {
|
|
4861
|
+
/** File path within the PPTX archive. */
|
|
4862
|
+
path: string;
|
|
4863
|
+
/** Background colour of the handout master. */
|
|
4864
|
+
backgroundColor?: string;
|
|
4865
|
+
/** Background image data URL. */
|
|
4866
|
+
backgroundImage?: string;
|
|
4867
|
+
/** Placeholder shapes found on the handout master. */
|
|
4868
|
+
placeholders?: Array<{
|
|
4869
|
+
type: string;
|
|
4870
|
+
idx?: string;
|
|
4871
|
+
}>;
|
|
4872
|
+
/** Editable elements on the handout master (header, footer, date, page number, slide placeholders). */
|
|
4873
|
+
elements?: PptxElement[];
|
|
4874
|
+
/** Number of slides per page for handout print layout (1, 2, 3, 4, 6, or 9). */
|
|
4875
|
+
slidesPerPage?: number;
|
|
4876
|
+
/** Header/footer flags from `<p:hf>` on the handout master (P-H3). */
|
|
4877
|
+
headerFooter?: PptxHeaderFooterFlags;
|
|
4878
|
+
/** Colour map from `<p:clrMap>` (12 alias attributes). Applied at save time. */
|
|
4879
|
+
clrMap?: Record<string, string>;
|
|
4880
|
+
}
|
|
4881
|
+
/**
|
|
4882
|
+
* Structured slide master data.
|
|
4883
|
+
*
|
|
4884
|
+
* @example
|
|
4885
|
+
* ```ts
|
|
4886
|
+
* const master: PptxSlideMaster = {
|
|
4887
|
+
* path: "ppt/slideMasters/slideMaster1.xml",
|
|
4888
|
+
* name: "Office Theme",
|
|
4889
|
+
* backgroundColor: "#FFFFFF",
|
|
4890
|
+
* themePath: "ppt/theme/theme1.xml",
|
|
4891
|
+
* };
|
|
4892
|
+
* // => satisfies PptxSlideMaster
|
|
4893
|
+
* ```
|
|
4894
|
+
*/
|
|
4895
|
+
interface PptxSlideMaster {
|
|
4896
|
+
/** File path within the PPTX archive. */
|
|
4897
|
+
path: string;
|
|
4898
|
+
/** Human-readable name if available. */
|
|
4899
|
+
name?: string;
|
|
4900
|
+
/** Background colour of the slide master. */
|
|
4901
|
+
backgroundColor?: string;
|
|
4902
|
+
/** Background image data URL for the slide master. */
|
|
4903
|
+
backgroundImage?: string;
|
|
4904
|
+
/** Theme file path this master references. */
|
|
4905
|
+
themePath?: string;
|
|
4906
|
+
/** Layout paths associated with this master. */
|
|
4907
|
+
layoutPaths?: string[];
|
|
4908
|
+
/** Placeholder shapes on the master. */
|
|
4909
|
+
placeholders?: Array<{
|
|
4910
|
+
type: string;
|
|
4911
|
+
idx?: string;
|
|
4912
|
+
}>;
|
|
4913
|
+
/** Parsed element shapes on the master slide (for master view rendering). */
|
|
4914
|
+
elements?: PptxElement[];
|
|
4915
|
+
/** Parsed slide layout objects associated with this master. */
|
|
4916
|
+
layouts?: PptxSlideLayout[];
|
|
4917
|
+
/** Text styles from `p:txStyles` — title, body, and other text defaults. */
|
|
4918
|
+
txStyles?: PptxMasterTextStyles;
|
|
4919
|
+
/** Header/footer flags from `<p:hf>` on this master (P-H3). */
|
|
4920
|
+
headerFooter?: PptxHeaderFooterFlags;
|
|
4921
|
+
/**
|
|
4922
|
+
* Colour map from `<p:clrMap>` (12 alias attributes: bg1/tx1/bg2/tx2,
|
|
4923
|
+
* accent1-6, hlink, folHlink). Applied at save time when present.
|
|
4924
|
+
*/
|
|
4925
|
+
clrMap?: Record<string, string>;
|
|
4926
|
+
}
|
|
4927
|
+
/**
|
|
4928
|
+
* Per-level paragraph properties for a text style category.
|
|
4929
|
+
* Each entry maps a 0-based level index to its style defaults.
|
|
4930
|
+
*/
|
|
4931
|
+
type PptxTextStyleLevels = Record<number, PlaceholderTextLevelStyle>;
|
|
4932
|
+
/**
|
|
4933
|
+
* Text styles parsed from `p:txStyles` on a slide master.
|
|
4934
|
+
* Provides cascading defaults for title, body, and other text.
|
|
4935
|
+
*/
|
|
4936
|
+
interface PptxMasterTextStyles {
|
|
4937
|
+
/** Title text style (`p:titleStyle`). */
|
|
4938
|
+
titleStyle?: PptxTextStyleLevels;
|
|
4939
|
+
/** Body text style (`p:bodyStyle`). */
|
|
4940
|
+
bodyStyle?: PptxTextStyleLevels;
|
|
4941
|
+
/** Other text style (`p:otherStyle`). */
|
|
4942
|
+
otherStyle?: PptxTextStyleLevels;
|
|
4943
|
+
}
|
|
4604
4944
|
/**
|
|
4605
4945
|
* Per-part header/footer flags from `<p:hf>` (CT_HeaderFooter, ECMA-376
|
|
4606
4946
|
* §19.3.1.21). Defaults are "all true" — fields are only set on the typed
|
|
@@ -4617,6 +4957,65 @@ interface PptxHeaderFooterFlags {
|
|
|
4617
4957
|
/** `@sldNum` — show slide-number placeholder. Spec default: `true`. */
|
|
4618
4958
|
hasSlideNumber?: boolean;
|
|
4619
4959
|
}
|
|
4960
|
+
/**
|
|
4961
|
+
* A slide layout associated with a slide master.
|
|
4962
|
+
*
|
|
4963
|
+
* @example
|
|
4964
|
+
* ```ts
|
|
4965
|
+
* const layout: PptxSlideLayout = {
|
|
4966
|
+
* path: "ppt/slideLayouts/slideLayout2.xml",
|
|
4967
|
+
* name: "Title and Content",
|
|
4968
|
+
* };
|
|
4969
|
+
* // => satisfies PptxSlideLayout
|
|
4970
|
+
* ```
|
|
4971
|
+
*/
|
|
4972
|
+
interface PptxSlideLayout {
|
|
4973
|
+
/** File path within the PPTX archive. */
|
|
4974
|
+
path: string;
|
|
4975
|
+
/** Human-readable layout name. */
|
|
4976
|
+
name?: string;
|
|
4977
|
+
/** Background colour of the layout. */
|
|
4978
|
+
backgroundColor?: string;
|
|
4979
|
+
/** Background image data URL for the layout. */
|
|
4980
|
+
backgroundImage?: string;
|
|
4981
|
+
/** Parsed element shapes on the layout. */
|
|
4982
|
+
elements?: PptxElement[];
|
|
4983
|
+
/** Placeholder shapes on the layout. */
|
|
4984
|
+
placeholders?: Array<{
|
|
4985
|
+
type: string;
|
|
4986
|
+
idx?: string;
|
|
4987
|
+
}>;
|
|
4988
|
+
/** Matching name attribute for layout identification (`@matchingName`). */
|
|
4989
|
+
matchingName?: string;
|
|
4990
|
+
/** Whether the layout is marked as preserved (prevent deletion, `@preserve`). */
|
|
4991
|
+
preserve?: boolean;
|
|
4992
|
+
/** Whether master placeholder animations should play (`@showMasterPhAnim`). */
|
|
4993
|
+
showMasterPhAnim?: boolean;
|
|
4994
|
+
/** Whether this layout is user-drawn (`@userDrawn`). */
|
|
4995
|
+
userDrawn?: boolean;
|
|
4996
|
+
/** Colour map override from `p:clrMapOvr`. */
|
|
4997
|
+
clrMapOverride?: Record<string, string>;
|
|
4998
|
+
/** Header/footer flags from `<p:hf>` on this layout (P-H3). */
|
|
4999
|
+
headerFooter?: PptxHeaderFooterFlags;
|
|
5000
|
+
}
|
|
5001
|
+
/**
|
|
5002
|
+
* A theme part available in the presentation package.
|
|
5003
|
+
*
|
|
5004
|
+
* @example
|
|
5005
|
+
* ```ts
|
|
5006
|
+
* const opt: PptxThemeOption = {
|
|
5007
|
+
* path: "ppt/theme/theme1.xml",
|
|
5008
|
+
* name: "Office Theme",
|
|
5009
|
+
* };
|
|
5010
|
+
* // => satisfies PptxThemeOption
|
|
5011
|
+
* ```
|
|
5012
|
+
*/
|
|
5013
|
+
interface PptxThemeOption {
|
|
5014
|
+
/** File path within the PPTX archive (e.g. `ppt/theme/theme2.xml`). */
|
|
5015
|
+
path: string;
|
|
5016
|
+
/** Human-readable theme name from `a:theme/@name`, when present. */
|
|
5017
|
+
name?: string;
|
|
5018
|
+
}
|
|
4620
5019
|
//#endregion
|
|
4621
5020
|
//#region src/core/types/animation.d.ts
|
|
4622
5021
|
/**
|
|
@@ -4827,6 +5226,14 @@ interface PptxNativeAnimation {
|
|
|
4827
5226
|
* that aren't OLE charts).
|
|
4828
5227
|
*/
|
|
4829
5228
|
graphicBuild?: string;
|
|
5229
|
+
/**
|
|
5230
|
+
* OLE-embedded chart build attribute (`p:bldOleChart/@bld`) when this
|
|
5231
|
+
* animation stages an OLE chart graphic frame. Values follow
|
|
5232
|
+
* ST_TLOleChartBuildType: `allAtOnce`, `series`, `category`, `seriesEl`,
|
|
5233
|
+
* `categoryEl`. Lets a staged-reveal renderer build the chart by series /
|
|
5234
|
+
* category / element to match PowerPoint, rather than as one whole element.
|
|
5235
|
+
*/
|
|
5236
|
+
oleChartBuild?: string;
|
|
4830
5237
|
/** Schema-accurate `p:bldGraphic/p:bldAsOne|p:bldSub` representation. */
|
|
4831
5238
|
graphicBuildProperties?: PptxGraphicBuild;
|
|
4832
5239
|
/**
|
|
@@ -5025,6 +5432,34 @@ interface PptxElementAnimation {
|
|
|
5025
5432
|
stopSound?: boolean;
|
|
5026
5433
|
}
|
|
5027
5434
|
//#endregion
|
|
5435
|
+
//#region src/core/types/embedded-font.d.ts
|
|
5436
|
+
interface PptxEmbeddedFontDataId {
|
|
5437
|
+
/** Required relationship identifier from `r:id`. */
|
|
5438
|
+
relationshipId?: string | null;
|
|
5439
|
+
/** Original leaf retained for unknown attribute preservation. */
|
|
5440
|
+
rawXml?: XmlObject;
|
|
5441
|
+
}
|
|
5442
|
+
interface PptxEmbeddedFontDescriptor {
|
|
5443
|
+
typeface?: string | null;
|
|
5444
|
+
panose?: string | null;
|
|
5445
|
+
pitchFamily?: string | null;
|
|
5446
|
+
charset?: string | null;
|
|
5447
|
+
rawXml?: XmlObject;
|
|
5448
|
+
}
|
|
5449
|
+
interface PptxEmbeddedFontListEntry {
|
|
5450
|
+
font: PptxEmbeddedFontDescriptor;
|
|
5451
|
+
regular?: PptxEmbeddedFontDataId | null;
|
|
5452
|
+
bold?: PptxEmbeddedFontDataId | null;
|
|
5453
|
+
italic?: PptxEmbeddedFontDataId | null;
|
|
5454
|
+
boldItalic?: PptxEmbeddedFontDataId | null;
|
|
5455
|
+
rawXml?: XmlObject;
|
|
5456
|
+
}
|
|
5457
|
+
interface PptxEmbeddedFontList {
|
|
5458
|
+
fonts: PptxEmbeddedFontListEntry[];
|
|
5459
|
+
/** Original list retained for unknown attribute and child preservation. */
|
|
5460
|
+
rawXml?: XmlObject;
|
|
5461
|
+
}
|
|
5462
|
+
//#endregion
|
|
5028
5463
|
//#region src/core/types/metadata.d.ts
|
|
5029
5464
|
/**
|
|
5030
5465
|
* A slide comment — may be a legacy positional comment or a modern
|
|
@@ -5078,6 +5513,49 @@ interface PptxComment {
|
|
|
5078
5513
|
/** Original `p:cm` subtree, retained for unknown child and extension preservation. */
|
|
5079
5514
|
rawXml?: XmlObject;
|
|
5080
5515
|
}
|
|
5516
|
+
/** Office 2021 comment author from the p188 Author part. */
|
|
5517
|
+
interface PptxModernCommentAuthor {
|
|
5518
|
+
id: string;
|
|
5519
|
+
name: string;
|
|
5520
|
+
initials?: string;
|
|
5521
|
+
userId: string;
|
|
5522
|
+
providerId: string;
|
|
5523
|
+
rawXml?: XmlObject;
|
|
5524
|
+
}
|
|
5525
|
+
/**
|
|
5526
|
+
* A comment author from `ppt/commentAuthors.xml`.
|
|
5527
|
+
*
|
|
5528
|
+
* Stores all attributes needed for lossless round-trip serialization
|
|
5529
|
+
* of the `p:cmAuthor` element (id, name, initials, lastIdx, clrIdx).
|
|
5530
|
+
*
|
|
5531
|
+
* @see ECMA-376 Part 1, §19.4.2 (cmAuthor)
|
|
5532
|
+
*
|
|
5533
|
+
* @example
|
|
5534
|
+
* ```ts
|
|
5535
|
+
* const author: PptxCommentAuthor = {
|
|
5536
|
+
* id: "0",
|
|
5537
|
+
* name: "John Doe",
|
|
5538
|
+
* initials: "JD",
|
|
5539
|
+
* lastIdx: 3,
|
|
5540
|
+
* clrIdx: 0,
|
|
5541
|
+
* };
|
|
5542
|
+
* // => satisfies PptxCommentAuthor
|
|
5543
|
+
* ```
|
|
5544
|
+
*/
|
|
5545
|
+
interface PptxCommentAuthor {
|
|
5546
|
+
/** Unique numeric author identifier (`@_id`). */
|
|
5547
|
+
id: string;
|
|
5548
|
+
/** Author display name (`@_name`). */
|
|
5549
|
+
name: string;
|
|
5550
|
+
/** Author initials (`@_initials`). */
|
|
5551
|
+
initials: string;
|
|
5552
|
+
/** Last comment index used by this author (`@_lastIdx`). */
|
|
5553
|
+
lastIdx: number;
|
|
5554
|
+
/** Colour index assigned to this author (`@_clrIdx`). */
|
|
5555
|
+
clrIdx: number;
|
|
5556
|
+
/** Original `p:cmAuthor` subtree, retained for unknown attribute preservation. */
|
|
5557
|
+
rawXml?: XmlObject;
|
|
5558
|
+
}
|
|
5081
5559
|
/**
|
|
5082
5560
|
* A compatibility warning generated during parse or save when the
|
|
5083
5561
|
* file uses features not fully supported by the editor.
|
|
@@ -5104,6 +5582,174 @@ interface PptxCompatibilityWarning {
|
|
|
5104
5582
|
elementId?: string;
|
|
5105
5583
|
xmlPath?: string;
|
|
5106
5584
|
}
|
|
5585
|
+
/**
|
|
5586
|
+
* A single name–value tag from `ppt/tags/*.xml`.
|
|
5587
|
+
*
|
|
5588
|
+
* @example
|
|
5589
|
+
* ```ts
|
|
5590
|
+
* const tag: PptxTag = { name: "CUSTOM_ID", value: "12345" };
|
|
5591
|
+
* // => satisfies PptxTag
|
|
5592
|
+
* ```
|
|
5593
|
+
*/
|
|
5594
|
+
interface PptxTag {
|
|
5595
|
+
name: string;
|
|
5596
|
+
value: string;
|
|
5597
|
+
}
|
|
5598
|
+
/**
|
|
5599
|
+
* A collection of tags from a single tags XML part.
|
|
5600
|
+
*
|
|
5601
|
+
* @example
|
|
5602
|
+
* ```ts
|
|
5603
|
+
* const coll: PptxTagCollection = {
|
|
5604
|
+
* path: "ppt/tags/tag1.xml",
|
|
5605
|
+
* tags: [{ name: "CUSTOM_ID", value: "12345" }],
|
|
5606
|
+
* };
|
|
5607
|
+
* // => satisfies PptxTagCollection
|
|
5608
|
+
* ```
|
|
5609
|
+
*/
|
|
5610
|
+
interface PptxTagCollection {
|
|
5611
|
+
/** File path within the PPTX archive. */
|
|
5612
|
+
path?: string;
|
|
5613
|
+
/** Package owner of the tags relationship. New collections default to presentation. */
|
|
5614
|
+
owner?: 'presentation' | 'slide' | 'part';
|
|
5615
|
+
/** Source OPC part that owns the relationship, e.g. ppt/slides/slide1.xml. */
|
|
5616
|
+
sourcePartPath?: string;
|
|
5617
|
+
/** Durable relationship identifier from the owning part. */
|
|
5618
|
+
relationshipId?: string;
|
|
5619
|
+
/** Tags in this collection. */
|
|
5620
|
+
tags: PptxTag[];
|
|
5621
|
+
/** Parsed tag-list XML retained for unknown-node preservation. */
|
|
5622
|
+
rawXml?: XmlObject;
|
|
5623
|
+
}
|
|
5624
|
+
/**
|
|
5625
|
+
* A custom document property from `docProps/custom.xml`.
|
|
5626
|
+
*
|
|
5627
|
+
* @example
|
|
5628
|
+
* ```ts
|
|
5629
|
+
* const prop: PptxCustomProperty = {
|
|
5630
|
+
* name: "Project",
|
|
5631
|
+
* value: "pptx",
|
|
5632
|
+
* type: "lpwstr",
|
|
5633
|
+
* };
|
|
5634
|
+
* // => satisfies PptxCustomProperty
|
|
5635
|
+
* ```
|
|
5636
|
+
*/
|
|
5637
|
+
interface PptxCustomProperty {
|
|
5638
|
+
/** Property name. */
|
|
5639
|
+
name: string;
|
|
5640
|
+
/** Property value (always stringified). */
|
|
5641
|
+
value: string;
|
|
5642
|
+
/** Original VT type (e.g. "lpwstr", "i4", "bool", "filetime"). */
|
|
5643
|
+
type: string;
|
|
5644
|
+
}
|
|
5645
|
+
/**
|
|
5646
|
+
* Core document properties from `docProps/core.xml` (Dublin Core + OOXML).
|
|
5647
|
+
*
|
|
5648
|
+
* @example
|
|
5649
|
+
* ```ts
|
|
5650
|
+
* const core: PptxCoreProperties = {
|
|
5651
|
+
* title: "Q4 Business Review",
|
|
5652
|
+
* creator: "Alice",
|
|
5653
|
+
* created: "2024-01-15T08:00:00Z",
|
|
5654
|
+
* modified: "2024-06-01T12:30:00Z",
|
|
5655
|
+
* lastModifiedBy: "Bob",
|
|
5656
|
+
* };
|
|
5657
|
+
* // => satisfies PptxCoreProperties
|
|
5658
|
+
* ```
|
|
5659
|
+
*/
|
|
5660
|
+
interface PptxCoreProperties {
|
|
5661
|
+
/** dc:title */
|
|
5662
|
+
title?: string;
|
|
5663
|
+
/** dc:subject */
|
|
5664
|
+
subject?: string;
|
|
5665
|
+
/** dc:creator */
|
|
5666
|
+
creator?: string;
|
|
5667
|
+
/** cp:keywords */
|
|
5668
|
+
keywords?: string;
|
|
5669
|
+
/** dc:description */
|
|
5670
|
+
description?: string;
|
|
5671
|
+
/** cp:lastModifiedBy */
|
|
5672
|
+
lastModifiedBy?: string;
|
|
5673
|
+
/** cp:revision */
|
|
5674
|
+
revision?: string;
|
|
5675
|
+
/** dcterms:created (ISO 8601) */
|
|
5676
|
+
created?: string;
|
|
5677
|
+
/** dcterms:modified (ISO 8601) */
|
|
5678
|
+
modified?: string;
|
|
5679
|
+
/** cp:category */
|
|
5680
|
+
category?: string;
|
|
5681
|
+
/** cp:contentStatus */
|
|
5682
|
+
contentStatus?: string;
|
|
5683
|
+
}
|
|
5684
|
+
/**
|
|
5685
|
+
* Extended (application) properties from `docProps/app.xml`.
|
|
5686
|
+
*
|
|
5687
|
+
* @example
|
|
5688
|
+
* ```ts
|
|
5689
|
+
* const app: PptxAppProperties = {
|
|
5690
|
+
* application: "Microsoft Office PowerPoint",
|
|
5691
|
+
* appVersion: "16.0000",
|
|
5692
|
+
* slides: 24,
|
|
5693
|
+
* words: 1500,
|
|
5694
|
+
* company: "Acme Corp",
|
|
5695
|
+
* };
|
|
5696
|
+
* // => satisfies PptxAppProperties
|
|
5697
|
+
* ```
|
|
5698
|
+
*/
|
|
5699
|
+
interface PptxAppProperties {
|
|
5700
|
+
/** Application name (e.g. "Microsoft Office PowerPoint"). */
|
|
5701
|
+
application?: string;
|
|
5702
|
+
/** Application version string. */
|
|
5703
|
+
appVersion?: string;
|
|
5704
|
+
/** Presentation format (e.g. "On-screen Show (16:9)"). */
|
|
5705
|
+
presentationFormat?: string;
|
|
5706
|
+
/** Total number of slides. */
|
|
5707
|
+
slides?: number;
|
|
5708
|
+
/** Number of hidden slides. */
|
|
5709
|
+
hiddenSlides?: number;
|
|
5710
|
+
/** Number of notes slides. */
|
|
5711
|
+
notes?: number;
|
|
5712
|
+
/** Total editing time in minutes. */
|
|
5713
|
+
totalTime?: number;
|
|
5714
|
+
/** Number of words. */
|
|
5715
|
+
words?: number;
|
|
5716
|
+
/** Number of paragraphs. */
|
|
5717
|
+
paragraphs?: number;
|
|
5718
|
+
/** Company name. */
|
|
5719
|
+
company?: string;
|
|
5720
|
+
/** Manager name. */
|
|
5721
|
+
manager?: string;
|
|
5722
|
+
/** Template name. */
|
|
5723
|
+
template?: string;
|
|
5724
|
+
/** Hyperlink base URL. */
|
|
5725
|
+
hyperlinkBase?: string;
|
|
5726
|
+
/** Document security bitmask (`<DocSecurity>`). */
|
|
5727
|
+
docSecurity?: number;
|
|
5728
|
+
/** Number of multimedia clips (`<MMClips>`). */
|
|
5729
|
+
mmClips?: number;
|
|
5730
|
+
/** Whether thumbnail images were scaled to fit (`<ScaleCrop>`). */
|
|
5731
|
+
scaleCrop?: boolean;
|
|
5732
|
+
/** Whether hyperlinks are current (`<LinksUpToDate>`). */
|
|
5733
|
+
linksUpToDate?: boolean;
|
|
5734
|
+
/** Whether the document is shared (`<SharedDoc>`). */
|
|
5735
|
+
sharedDoc?: boolean;
|
|
5736
|
+
/** Whether hyperlinks changed since last save (`<HyperlinksChanged>`). */
|
|
5737
|
+
hyperlinksChanged?: boolean;
|
|
5738
|
+
}
|
|
5739
|
+
//#endregion
|
|
5740
|
+
//#region src/core/types/presentation-print-properties.d.ts
|
|
5741
|
+
type PptxPrintOutput = 'slides' | 'handouts1' | 'handouts2' | 'handouts3' | 'handouts4' | 'handouts6' | 'handouts9' | 'notes' | 'outline';
|
|
5742
|
+
type PptxPrintColorMode = 'bw' | 'gray' | 'clr';
|
|
5743
|
+
/** PresentationML `CT_PrintProperties` (`p:prnPr`). */
|
|
5744
|
+
interface PptxPresentationPrintProperties {
|
|
5745
|
+
printWhat?: PptxPrintOutput | null;
|
|
5746
|
+
colorMode?: PptxPrintColorMode | null;
|
|
5747
|
+
hiddenSlides?: boolean | null;
|
|
5748
|
+
scaleToFitPaper?: boolean | null;
|
|
5749
|
+
frameSlides?: boolean | null;
|
|
5750
|
+
/** Original subtree retained for unknown attributes and `p:extLst`. */
|
|
5751
|
+
rawXml?: XmlObject;
|
|
5752
|
+
}
|
|
5107
5753
|
/**
|
|
5108
5754
|
* Resolved hex values for the 12 theme colour slots.
|
|
5109
5755
|
*
|
|
@@ -5437,6 +6083,125 @@ interface PptxSlideTransition {
|
|
|
5437
6083
|
rawTransition?: XmlObject;
|
|
5438
6084
|
}
|
|
5439
6085
|
//#endregion
|
|
6086
|
+
//#region src/core/types/view-properties.d.ts
|
|
6087
|
+
/**
|
|
6088
|
+
* View properties types parsed from `ppt/viewProps.xml`.
|
|
6089
|
+
*
|
|
6090
|
+
* Models the `p:viewPr` element and its child views:
|
|
6091
|
+
* normalViewPr, slideViewPr, outlineViewPr, notesTextViewPr,
|
|
6092
|
+
* sorterViewPr, notesViewPr.
|
|
6093
|
+
*
|
|
6094
|
+
* @module pptx-types/view-properties
|
|
6095
|
+
*/
|
|
6096
|
+
/**
|
|
6097
|
+
* Scale factor for a view (numerator / denominator percentage).
|
|
6098
|
+
*/
|
|
6099
|
+
interface PptxViewScale {
|
|
6100
|
+
/** Numerator of the scale percentage (e.g. 100 for 100%). */
|
|
6101
|
+
n: number;
|
|
6102
|
+
/** Denominator of the scale percentage (e.g. 100 for 100%). */
|
|
6103
|
+
d: number;
|
|
6104
|
+
/** Optional independent vertical scale. When absent, the X scale is used. */
|
|
6105
|
+
sy?: {
|
|
6106
|
+
n: number;
|
|
6107
|
+
d: number;
|
|
6108
|
+
};
|
|
6109
|
+
}
|
|
6110
|
+
/**
|
|
6111
|
+
* Origin point for a view (x, y in twips or EMU).
|
|
6112
|
+
*/
|
|
6113
|
+
interface PptxViewOrigin {
|
|
6114
|
+
x: number;
|
|
6115
|
+
y: number;
|
|
6116
|
+
}
|
|
6117
|
+
/** A horizontal or vertical drawing guide in slide coordinates. */
|
|
6118
|
+
interface PptxViewGuide {
|
|
6119
|
+
orientation?: 'horz' | 'vert';
|
|
6120
|
+
position?: number;
|
|
6121
|
+
}
|
|
6122
|
+
/** Positive grid spacing from `p:gridSpacing`. */
|
|
6123
|
+
interface PptxGridSpacing {
|
|
6124
|
+
cx: number;
|
|
6125
|
+
cy: number;
|
|
6126
|
+
}
|
|
6127
|
+
/**
|
|
6128
|
+
* Restored region dimensions for normal view splitter.
|
|
6129
|
+
* Represents `p:restoredLeft` or `p:restoredTop`.
|
|
6130
|
+
*/
|
|
6131
|
+
interface PptxRestoredRegion {
|
|
6132
|
+
/** Size as a percentage of the available space (thousandths of a percent). */
|
|
6133
|
+
sz: number;
|
|
6134
|
+
/** Whether auto-adjust is enabled. */
|
|
6135
|
+
autoAdjust?: boolean;
|
|
6136
|
+
}
|
|
6137
|
+
/**
|
|
6138
|
+
* Normal view properties (`p:normalViewPr`).
|
|
6139
|
+
* Controls the splitter positions in normal (editing) view.
|
|
6140
|
+
*/
|
|
6141
|
+
interface PptxNormalViewProperties {
|
|
6142
|
+
/** Whether to show outline icons in the slide panel. */
|
|
6143
|
+
showOutlineIcons?: boolean;
|
|
6144
|
+
/** Whether the outline/slide panel is snapped closed. */
|
|
6145
|
+
snapVertSplitter?: boolean;
|
|
6146
|
+
/** Vertical splitter bar state: 'minimized' | 'maximized' | 'restored'. */
|
|
6147
|
+
vertBarState?: string;
|
|
6148
|
+
/** Horizontal splitter bar state. */
|
|
6149
|
+
horzBarState?: string;
|
|
6150
|
+
/** Whether to prefer single-slide view in the panel. */
|
|
6151
|
+
preferSingleView?: boolean;
|
|
6152
|
+
/** Restored left region (slide panel width). */
|
|
6153
|
+
restoredLeft?: PptxRestoredRegion;
|
|
6154
|
+
/** Restored top region (notes panel height). */
|
|
6155
|
+
restoredTop?: PptxRestoredRegion;
|
|
6156
|
+
}
|
|
6157
|
+
/**
|
|
6158
|
+
* Common slide view properties shared by slideViewPr, outlineViewPr,
|
|
6159
|
+
* notesTextViewPr, and notesViewPr.
|
|
6160
|
+
*/
|
|
6161
|
+
interface PptxCommonSlideViewProperties {
|
|
6162
|
+
/** Whether snap-to-grid is enabled. */
|
|
6163
|
+
snapToGrid?: boolean;
|
|
6164
|
+
/** Whether snap-to-objects is enabled. */
|
|
6165
|
+
snapToObjects?: boolean;
|
|
6166
|
+
/** Whether drawing guides are shown. */
|
|
6167
|
+
showGuides?: boolean;
|
|
6168
|
+
/** Whether the application may vary the scale automatically. */
|
|
6169
|
+
variableScale?: boolean;
|
|
6170
|
+
/** Drawing guides shown in this slide view. */
|
|
6171
|
+
guides?: PptxViewGuide[];
|
|
6172
|
+
/** View origin (scroll position). */
|
|
6173
|
+
origin?: PptxViewOrigin;
|
|
6174
|
+
/** View scale. */
|
|
6175
|
+
scale?: PptxViewScale;
|
|
6176
|
+
}
|
|
6177
|
+
/**
|
|
6178
|
+
* Full view properties from `ppt/viewProps.xml`.
|
|
6179
|
+
*/
|
|
6180
|
+
interface PptxViewProperties {
|
|
6181
|
+
/** Last used view type (`p:viewPr/@lastView`). */
|
|
6182
|
+
lastView?: string;
|
|
6183
|
+
/** Whether comments are shown (`p:viewPr/@showComments`). */
|
|
6184
|
+
showComments?: boolean;
|
|
6185
|
+
/** Normal view properties (splitter positions). */
|
|
6186
|
+
normalViewPr?: PptxNormalViewProperties;
|
|
6187
|
+
/** Slide view properties. */
|
|
6188
|
+
slideViewPr?: PptxCommonSlideViewProperties;
|
|
6189
|
+
/** Outline view properties. */
|
|
6190
|
+
outlineViewPr?: PptxCommonSlideViewProperties;
|
|
6191
|
+
/** Notes text view properties. */
|
|
6192
|
+
notesTextViewPr?: PptxCommonSlideViewProperties;
|
|
6193
|
+
/** Sorter view scale. */
|
|
6194
|
+
sorterViewPr?: {
|
|
6195
|
+
scale?: PptxViewScale;
|
|
6196
|
+
};
|
|
6197
|
+
/** Notes view properties. */
|
|
6198
|
+
notesViewPr?: PptxCommonSlideViewProperties;
|
|
6199
|
+
/** Grid spacing in positive DrawingML coordinates. */
|
|
6200
|
+
gridSpacing?: PptxGridSpacing;
|
|
6201
|
+
/** Raw XML preserved for lossless round-trip of unparsed attributes. */
|
|
6202
|
+
rawXml?: Record<string, unknown>;
|
|
6203
|
+
}
|
|
6204
|
+
//#endregion
|
|
5440
6205
|
//#region src/core/types/presentation.d.ts
|
|
5441
6206
|
/**
|
|
5442
6207
|
* A customer data reference from `p:custDataLst / p:custData`.
|
|
@@ -5474,8 +6239,23 @@ interface PptxActiveXControl {
|
|
|
5474
6239
|
name?: string;
|
|
5475
6240
|
/** Shape ID this control is linked to (from @spid). */
|
|
5476
6241
|
shapeId?: string;
|
|
5477
|
-
/**
|
|
5478
|
-
|
|
6242
|
+
/** X position (px) of the control's fallback picture, if present. */
|
|
6243
|
+
x?: number;
|
|
6244
|
+
/** Y position (px) of the control's fallback picture, if present. */
|
|
6245
|
+
y?: number;
|
|
6246
|
+
/** Width (px) of the control's fallback picture, if present. */
|
|
6247
|
+
width?: number;
|
|
6248
|
+
/** Height (px) of the control's fallback picture, if present. */
|
|
6249
|
+
height?: number;
|
|
6250
|
+
/**
|
|
6251
|
+
* Relationship ID of the control's static fallback picture
|
|
6252
|
+
* (`mc:AlternateContent > mc:Fallback > p:pic > p:blipFill > a:blip@r:embed`).
|
|
6253
|
+
* Renderers resolve this to an image so a control shows its last static
|
|
6254
|
+
* frame instead of a blank area (the live ActiveX cannot run in a viewer).
|
|
6255
|
+
*/
|
|
6256
|
+
fallbackImageRelId?: string;
|
|
6257
|
+
/** Raw XML for round-trip preservation. */
|
|
6258
|
+
rawXml?: XmlObject;
|
|
5479
6259
|
}
|
|
5480
6260
|
/**
|
|
5481
6261
|
* Pattern fill on a slide background.
|
|
@@ -5600,6 +6380,13 @@ interface PptxSlide {
|
|
|
5600
6380
|
customerData?: PptxCustomerData[];
|
|
5601
6381
|
/** ActiveX control references from `p:controls` on this slide. */
|
|
5602
6382
|
activeXControls?: PptxActiveXControl[];
|
|
6383
|
+
/**
|
|
6384
|
+
* Shapes parsed from a referenced legacy VML drawing part
|
|
6385
|
+
* (`ppt/drawings/vmlDrawing*.vml`, linked via a `legacyDrawing`
|
|
6386
|
+
* relationship). These are read-only render hints: the VML part itself is
|
|
6387
|
+
* preserved verbatim on save, so this field is not re-serialized.
|
|
6388
|
+
*/
|
|
6389
|
+
legacyVmlElements?: PptxElement[];
|
|
5603
6390
|
/** Per-slide header/footer flags from `<p:hf>` (P-H3). */
|
|
5604
6391
|
headerFooterFlags?: PptxHeaderFooterFlags;
|
|
5605
6392
|
/** Server-backed slide synchronization metadata stored in a related OPC part. */
|
|
@@ -5622,30 +6409,1764 @@ interface PptxSlideSyncProperties {
|
|
|
5622
6409
|
relationshipId?: string;
|
|
5623
6410
|
}
|
|
5624
6411
|
/**
|
|
5625
|
-
* A
|
|
5626
|
-
*
|
|
5627
|
-
*
|
|
5628
|
-
*
|
|
6412
|
+
* A slide layout available in the loaded presentation.
|
|
6413
|
+
*
|
|
6414
|
+
* Each entry maps to a `<p:sldLayout>` inside `ppt/slideLayouts/`.
|
|
6415
|
+
*
|
|
6416
|
+
* @example
|
|
6417
|
+
* ```ts
|
|
6418
|
+
* const layout: PptxLayoutOption = {
|
|
6419
|
+
* path: "ppt/slideLayouts/slideLayout2.xml",
|
|
6420
|
+
* name: "Title and Content",
|
|
6421
|
+
* };
|
|
6422
|
+
* // => satisfies PptxLayoutOption
|
|
6423
|
+
* ```
|
|
6424
|
+
*/
|
|
6425
|
+
interface PptxLayoutOption {
|
|
6426
|
+
path: string;
|
|
6427
|
+
name: string;
|
|
6428
|
+
/** Standard layout type from `p:sldLayout/@type` (e.g. "obj", "twoColTx", "blank"). */
|
|
6429
|
+
type?: string;
|
|
6430
|
+
/** ZIP path of the slide master this layout belongs to. */
|
|
6431
|
+
masterPath?: string;
|
|
6432
|
+
}
|
|
6433
|
+
/**
|
|
6434
|
+
* Header, footer, date-time, and slide-number placeholders.
|
|
6435
|
+
*
|
|
6436
|
+
* Parsed from `ppt/presProps.xml` and individual slide layouts.
|
|
6437
|
+
*
|
|
6438
|
+
* @example
|
|
6439
|
+
* ```ts
|
|
6440
|
+
* const hf: PptxHeaderFooter = {
|
|
6441
|
+
* hasFooter: true,
|
|
6442
|
+
* footerText: "Confidential",
|
|
6443
|
+
* hasSlideNumber: true,
|
|
6444
|
+
* };
|
|
6445
|
+
* // => satisfies PptxHeaderFooter
|
|
6446
|
+
* ```
|
|
6447
|
+
*/
|
|
6448
|
+
interface PptxHeaderFooter {
|
|
6449
|
+
hasHeader?: boolean;
|
|
6450
|
+
headerText?: string;
|
|
6451
|
+
hasFooter?: boolean;
|
|
6452
|
+
footerText?: string;
|
|
6453
|
+
hasDateTime?: boolean;
|
|
6454
|
+
dateTimeText?: string;
|
|
6455
|
+
dateTimeAuto?: boolean;
|
|
6456
|
+
/** OOXML date format pattern (e.g. "M/d/yyyy", "dddd, MMMM dd, yyyy"). */
|
|
6457
|
+
dateFormat?: string;
|
|
6458
|
+
hasSlideNumber?: boolean;
|
|
6459
|
+
}
|
|
6460
|
+
/**
|
|
6461
|
+
* Presentation-level properties parsed from `presentationPr.xml`.
|
|
6462
|
+
*
|
|
6463
|
+
* Controls slideshow behaviour, print settings, custom colours, and grid.
|
|
6464
|
+
*
|
|
6465
|
+
* @example
|
|
6466
|
+
* ```ts
|
|
6467
|
+
* const props: PptxPresentationProperties = {
|
|
6468
|
+
* showType: "presented",
|
|
6469
|
+
* loopContinuously: false,
|
|
6470
|
+
* advanceMode: "useTimings",
|
|
6471
|
+
* };
|
|
6472
|
+
* // => satisfies PptxPresentationProperties
|
|
6473
|
+
* ```
|
|
6474
|
+
*/
|
|
6475
|
+
interface PptxPresentationProperties {
|
|
6476
|
+
/** Show type: presented, browsed, kiosk. */
|
|
6477
|
+
showType?: 'presented' | 'browsed' | 'kiosk';
|
|
6478
|
+
/** Whether to loop the slideshow continuously. */
|
|
6479
|
+
loopContinuously?: boolean;
|
|
6480
|
+
/** Whether to show without narration. */
|
|
6481
|
+
showWithNarration?: boolean;
|
|
6482
|
+
/** Whether to show without animation. */
|
|
6483
|
+
showWithAnimation?: boolean;
|
|
6484
|
+
/** Advance slides mode: manual click or use stored timings. */
|
|
6485
|
+
advanceMode?: 'manual' | 'useTimings';
|
|
6486
|
+
/** Show slides: 'all', a custom show id, or a from-to range. */
|
|
6487
|
+
showSlidesMode?: 'all' | 'customShow' | 'range';
|
|
6488
|
+
/** Custom show id to use when showSlidesMode is 'customShow'. */
|
|
6489
|
+
showSlidesCustomShowId?: string;
|
|
6490
|
+
/** Slide range start (1-based) when showSlidesMode is 'range'. */
|
|
6491
|
+
showSlidesFrom?: number;
|
|
6492
|
+
/** Slide range end (1-based) when showSlidesMode is 'range'. */
|
|
6493
|
+
showSlidesTo?: number;
|
|
6494
|
+
/** Whether to show subtitles/captions during presentation mode. */
|
|
6495
|
+
showSubtitles?: boolean;
|
|
6496
|
+
/** Typed `p:prnPr` settings. Set to null during save to remove the element. */
|
|
6497
|
+
printProperties?: PptxPresentationPrintProperties | null;
|
|
6498
|
+
/** Most-recently-used colours from the presentation palette. */
|
|
6499
|
+
mruColors?: string[];
|
|
6500
|
+
/** Grid spacing in EMUs (cx, cy). Default is 914400 / 8 = 114300. */
|
|
6501
|
+
gridSpacing?: {
|
|
6502
|
+
cx: number;
|
|
6503
|
+
cy: number;
|
|
6504
|
+
};
|
|
6505
|
+
/** Pen colour for presentation mode annotations (from `p:showPr/p:penClr`). */
|
|
6506
|
+
penColor?: string;
|
|
6507
|
+
/** Kiosk auto-restart interval in milliseconds (from `p:kiosk/@restart`). Only meaningful when showType is "kiosk". */
|
|
6508
|
+
kioskRestartTime?: number;
|
|
6509
|
+
}
|
|
6510
|
+
/**
|
|
6511
|
+
* A named custom slide show (`p:custShowLst / p:custShow`).
|
|
6512
|
+
*
|
|
6513
|
+
* Custom shows define ordered subsets of slides that can be presented
|
|
6514
|
+
* independently of the full deck.
|
|
6515
|
+
*
|
|
6516
|
+
* @example
|
|
6517
|
+
* ```ts
|
|
6518
|
+
* const show: PptxCustomShow = {
|
|
6519
|
+
* name: "Executive Summary",
|
|
6520
|
+
* id: "0",
|
|
6521
|
+
* slideRIds: ["rId2", "rId5", "rId8"],
|
|
6522
|
+
* };
|
|
6523
|
+
* // => satisfies PptxCustomShow
|
|
6524
|
+
* ```
|
|
6525
|
+
*/
|
|
6526
|
+
interface PptxCustomShow {
|
|
6527
|
+
/** Custom show name. */
|
|
6528
|
+
name: string;
|
|
6529
|
+
/** Custom show id. */
|
|
6530
|
+
id: string;
|
|
6531
|
+
/** Ordered list of slide relationship IDs included in this custom show. */
|
|
6532
|
+
slideRIds: string[];
|
|
6533
|
+
/** Original `p:custShow` subtree used to preserve unmodelled attributes and extensions. */
|
|
6534
|
+
rawXml?: XmlObject;
|
|
6535
|
+
}
|
|
6536
|
+
/**
|
|
6537
|
+
* An ordered section in the presentation (from `p:sectionLst` / `p14:sectionLst`).
|
|
6538
|
+
*
|
|
6539
|
+
* Sections group consecutive slides under a named heading (visible
|
|
6540
|
+
* in the PowerPoint slide sorter).
|
|
6541
|
+
*
|
|
6542
|
+
* @example
|
|
6543
|
+
* ```ts
|
|
6544
|
+
* const section: PptxSection = {
|
|
6545
|
+
* id: "sec_1",
|
|
6546
|
+
* name: "Introduction",
|
|
6547
|
+
* slideIds: ["256", "257"],
|
|
6548
|
+
* };
|
|
6549
|
+
* // => satisfies PptxSection
|
|
6550
|
+
* ```
|
|
6551
|
+
*/
|
|
6552
|
+
interface PptxSection {
|
|
6553
|
+
/** Section unique identifier (GUID or synthetic). */
|
|
6554
|
+
id: string;
|
|
6555
|
+
/** Human-readable section name. */
|
|
6556
|
+
name: string;
|
|
6557
|
+
/** Ordered list of numeric slide IDs that belong to this section. */
|
|
6558
|
+
slideIds: string[];
|
|
6559
|
+
/** Whether the section is collapsed in the slide sorter (from p15:sectionPr). */
|
|
6560
|
+
collapsed?: boolean;
|
|
6561
|
+
/** Section highlight color hex (from p15:sectionPr/@clr). */
|
|
6562
|
+
color?: string;
|
|
6563
|
+
/** Original section subtree used to preserve unmodelled attributes and extensions. */
|
|
6564
|
+
rawXml?: XmlObject;
|
|
6565
|
+
}
|
|
6566
|
+
/**
|
|
6567
|
+
* Write-protection hash data parsed from `p:modifyVerifier` in `presentation.xml`.
|
|
6568
|
+
*
|
|
6569
|
+
* When present, the presentation is marked as "read-only recommended" or
|
|
6570
|
+
* write-protected with a password hash. The hash parameters follow the
|
|
6571
|
+
* ECMA-376 Part 1, section 19.2.1.22 specification.
|
|
6572
|
+
*
|
|
6573
|
+
* @example
|
|
6574
|
+
* ```ts
|
|
6575
|
+
* const verifier: PptxModifyVerifier = {
|
|
6576
|
+
* algorithmName: "SHA-512",
|
|
6577
|
+
* hashData: "base64EncodedHash==",
|
|
6578
|
+
* saltData: "base64EncodedSalt==",
|
|
6579
|
+
* spinValue: 100000,
|
|
6580
|
+
* };
|
|
6581
|
+
* // => satisfies PptxModifyVerifier
|
|
6582
|
+
* ```
|
|
6583
|
+
*/
|
|
6584
|
+
interface PptxModifyVerifier {
|
|
6585
|
+
/** Hash algorithm name (e.g. "SHA-512", "SHA-1"). */
|
|
6586
|
+
algorithmName?: string;
|
|
6587
|
+
/** Base64-encoded hash value. */
|
|
6588
|
+
hashData?: string;
|
|
6589
|
+
/** Base64-encoded salt value. */
|
|
6590
|
+
saltData?: string;
|
|
6591
|
+
/** Number of hash iterations (spin count). */
|
|
6592
|
+
spinValue?: number;
|
|
6593
|
+
/** Legacy algorithm ID extension. */
|
|
6594
|
+
algIdExt?: string;
|
|
6595
|
+
/** Legacy algorithm ID. */
|
|
6596
|
+
cryptAlgorithmSid?: number;
|
|
6597
|
+
/** Cryptographic algorithm type (e.g. "typeAny"). */
|
|
6598
|
+
cryptAlgorithmType?: string;
|
|
6599
|
+
/** Cryptographic provider name. */
|
|
6600
|
+
cryptProvider?: string;
|
|
6601
|
+
/** Cryptographic provider type (e.g. "providerTypeRsaFull"). */
|
|
6602
|
+
cryptProviderType?: string;
|
|
6603
|
+
/** Cryptographic algorithm class (e.g. "hash"). */
|
|
6604
|
+
cryptAlgorithmClass?: string;
|
|
6605
|
+
}
|
|
6606
|
+
/**
|
|
6607
|
+
* Photo album metadata from `p:photoAlbum` in `presentation.xml`.
|
|
6608
|
+
*
|
|
6609
|
+
* Stores settings for presentations created via Insert > Photo Album.
|
|
6610
|
+
*
|
|
6611
|
+
* @see ECMA-376 Part 1, §19.2.1.27
|
|
6612
|
+
*/
|
|
6613
|
+
interface PptxPhotoAlbum {
|
|
6614
|
+
/** Whether photos are displayed in black-and-white. */
|
|
6615
|
+
bw?: boolean;
|
|
6616
|
+
/** Whether captions are shown below each photo. */
|
|
6617
|
+
showCaptions?: boolean;
|
|
6618
|
+
/** Photo album layout (e.g. "1pic", "2pic", "4pic", "fitToSlide"). */
|
|
6619
|
+
layout?: string;
|
|
6620
|
+
/** Frame style applied to each photo (e.g. "frameStyle1"). */
|
|
6621
|
+
frame?: string;
|
|
6622
|
+
}
|
|
6623
|
+
/**
|
|
6624
|
+
* East Asian line-break (kinsoku) settings from `p:kinsoku` in `presentation.xml`.
|
|
6625
|
+
*
|
|
6626
|
+
* Defines forbidden start/end characters for a given language so that
|
|
6627
|
+
* line-breaking follows East Asian typographic rules.
|
|
6628
|
+
*
|
|
6629
|
+
* @see ECMA-376 Part 1, §19.2.1.17
|
|
6630
|
+
*/
|
|
6631
|
+
interface PptxKinsoku {
|
|
6632
|
+
/** Language code (e.g. "ja-JP", "zh-CN"). */
|
|
6633
|
+
lang?: string | null;
|
|
6634
|
+
/** Characters that cannot begin a line. */
|
|
6635
|
+
invalStChars?: string;
|
|
6636
|
+
/** Characters that cannot end a line. */
|
|
6637
|
+
invalEndChars?: string;
|
|
6638
|
+
/** Original leaf retained for unknown attribute preservation. */
|
|
6639
|
+
rawXml?: XmlObject;
|
|
6640
|
+
}
|
|
6641
|
+
/**
|
|
6642
|
+
* Root data structure returned by {@link PptxHandlerCore.load}.
|
|
6643
|
+
*
|
|
6644
|
+
* Contains every slide, canvas dimensions, theme data, layout options,
|
|
6645
|
+
* metadata, and optional features (custom shows, sections, macros,
|
|
6646
|
+
* digital signatures, embedded fonts).
|
|
6647
|
+
*
|
|
6648
|
+
* @example
|
|
6649
|
+
* ```ts
|
|
6650
|
+
* const data: PptxData = await handler.load(buffer);
|
|
6651
|
+
* console.log(`${data.slides.length} slides, ${data.width}×${data.height}`);
|
|
6652
|
+
* // => e.g. "24 slides, 960×540"
|
|
6653
|
+
* ```
|
|
6654
|
+
*/
|
|
6655
|
+
interface PptxData {
|
|
6656
|
+
slides: PptxSlide[];
|
|
6657
|
+
width: number;
|
|
6658
|
+
height: number;
|
|
6659
|
+
/** Slide width in EMU (for save round-trip). */
|
|
6660
|
+
widthEmu?: number;
|
|
6661
|
+
/** Slide height in EMU (for save round-trip). */
|
|
6662
|
+
heightEmu?: number;
|
|
6663
|
+
/** Slide size type from `p:sldSz/@type` (e.g. "screen4x3", "screen16x9", "custom"). */
|
|
6664
|
+
slideSizeType?: string;
|
|
6665
|
+
/** Notes page width in EMU (from `p:notesSz`). */
|
|
6666
|
+
notesWidthEmu?: number;
|
|
6667
|
+
/** Notes page height in EMU (from `p:notesSz`). */
|
|
6668
|
+
notesHeightEmu?: number;
|
|
6669
|
+
layoutOptions?: PptxLayoutOption[];
|
|
6670
|
+
headerFooter?: PptxHeaderFooter;
|
|
6671
|
+
/** Presentation-level properties parsed from `presentationPr.xml`. */
|
|
6672
|
+
presentationProperties?: PptxPresentationProperties;
|
|
6673
|
+
/** Named custom slide shows from `p:custShowLst`. */
|
|
6674
|
+
customShows?: PptxCustomShow[];
|
|
6675
|
+
/** Ordered presentation sections from `p:sectionLst` / `p14:sectionLst`. */
|
|
6676
|
+
sections?: PptxSection[];
|
|
6677
|
+
warnings?: PptxCompatibilityWarning[];
|
|
6678
|
+
/** Map of theme colour scheme keys to resolved hex values. */
|
|
6679
|
+
themeColorMap?: Record<string, string>;
|
|
6680
|
+
/** Full parsed theme object with colours, fonts, and name. */
|
|
6681
|
+
theme?: PptxTheme;
|
|
6682
|
+
/** Available theme parts discovered in `ppt/theme/`. */
|
|
6683
|
+
themeOptions?: PptxThemeOption[];
|
|
6684
|
+
/** Parsed table style definitions from `ppt/tableStyles.xml`. */
|
|
6685
|
+
tableStyleMap?: ParsedTableStyleMap;
|
|
6686
|
+
/** Whether the presentation is password-protected. */
|
|
6687
|
+
isPasswordProtected?: boolean;
|
|
6688
|
+
/** Embedded font data (name + binary data URL) extracted from the presentation. */
|
|
6689
|
+
embeddedFonts?: PptxEmbeddedFont[];
|
|
6690
|
+
/** Typed `p:embeddedFontLst` package metadata, including unresolved variants. */
|
|
6691
|
+
embeddedFontList?: PptxEmbeddedFontList;
|
|
6692
|
+
/** Most-recently-used colour list from presentation properties. */
|
|
6693
|
+
mruColors?: string[];
|
|
6694
|
+
/** Parsed notes master data if present in the PPTX. */
|
|
6695
|
+
notesMaster?: PptxNotesMaster;
|
|
6696
|
+
/** Parsed handout master data if present in the PPTX. */
|
|
6697
|
+
handoutMaster?: PptxHandoutMaster;
|
|
6698
|
+
/** Structured slide master data for each master in the presentation. */
|
|
6699
|
+
slideMasters?: PptxSlideMaster[];
|
|
6700
|
+
/** Parsed tag collections attached to the presentation or slides. */
|
|
6701
|
+
tags?: PptxTagCollection[];
|
|
6702
|
+
/** Custom document properties from `docProps/custom.xml`. */
|
|
6703
|
+
customProperties?: PptxCustomProperty[];
|
|
6704
|
+
/** Core document properties from `docProps/core.xml`. */
|
|
6705
|
+
coreProperties?: PptxCoreProperties;
|
|
6706
|
+
/** Extended (application) properties from `docProps/app.xml`. */
|
|
6707
|
+
appProperties?: PptxAppProperties;
|
|
6708
|
+
/** Whether the presentation contains VBA macros (is a .pptm file). */
|
|
6709
|
+
hasMacros?: boolean;
|
|
6710
|
+
/** Whether the presentation contains digital signatures (`_xmlsignatures/` parts). */
|
|
6711
|
+
hasDigitalSignatures?: boolean;
|
|
6712
|
+
/** Number of digital signatures found. */
|
|
6713
|
+
digitalSignatureCount?: number;
|
|
6714
|
+
/** Presentation-level drawing guides from `p:extLst`. */
|
|
6715
|
+
presentationGuides?: PptxDrawingGuide[];
|
|
6716
|
+
/** View properties from `ppt/viewProps.xml`. */
|
|
6717
|
+
viewProperties?: PptxViewProperties;
|
|
6718
|
+
/** Write-protection verifier from `p:modifyVerifier` in `presentation.xml`. */
|
|
6719
|
+
modifyVerifier?: PptxModifyVerifier;
|
|
6720
|
+
/** Photo album metadata from `p:photoAlbum` in `presentation.xml`. */
|
|
6721
|
+
photoAlbum?: PptxPhotoAlbum;
|
|
6722
|
+
/** East Asian line-break settings from `p:kinsoku` in `presentation.xml`. */
|
|
6723
|
+
kinsoku?: PptxKinsoku;
|
|
6724
|
+
/** Custom XML data parts from `customXml/` in the OPC package. */
|
|
6725
|
+
customXmlParts?: PptxCustomXmlPart[];
|
|
6726
|
+
/** Customer data references from `p:custDataLst` in `presentation.xml`. */
|
|
6727
|
+
customerData?: PptxCustomerData[];
|
|
6728
|
+
/** Thumbnail image binary data from `docProps/thumbnail.{jpeg,png}`. */
|
|
6729
|
+
thumbnailData?: Uint8Array;
|
|
6730
|
+
/** Comment authors parsed from `ppt/commentAuthors.xml` for round-trip preservation. */
|
|
6731
|
+
commentAuthors?: PptxCommentAuthor[];
|
|
6732
|
+
/** Office 2021 p188 authors from the modern Author part. */
|
|
6733
|
+
modernCommentAuthors?: PptxModernCommentAuthor[];
|
|
6734
|
+
/**
|
|
6735
|
+
* OOXML conformance class of the loaded file.
|
|
6736
|
+
* - `'strict'` -- ISO/IEC 29500 Strict (uses `purl.oclc.org` namespace URIs)
|
|
6737
|
+
* - `'transitional'` -- ECMA-376 Transitional (uses `schemas.openxmlformats.org` URIs)
|
|
6738
|
+
*
|
|
6739
|
+
* When saving, if the save option `conformance` is `'preserve'` (default),
|
|
6740
|
+
* the file will be saved using the same conformance class as the original.
|
|
6741
|
+
*/
|
|
6742
|
+
conformance?: 'strict' | 'transitional';
|
|
6743
|
+
}
|
|
6744
|
+
/**
|
|
6745
|
+
* Target format for slide export.
|
|
6746
|
+
*
|
|
6747
|
+
* @see {@link PptxExportOptions}
|
|
6748
|
+
*/
|
|
6749
|
+
type PptxExportFormat = 'pdf' | 'png' | 'svg';
|
|
6750
|
+
/**
|
|
6751
|
+
* Options controlling slide export to raster or vector formats.
|
|
6752
|
+
*
|
|
6753
|
+
* @example
|
|
6754
|
+
* ```ts
|
|
6755
|
+
* const opts: PptxExportOptions = {
|
|
6756
|
+
* format: "png",
|
|
6757
|
+
* slideIndices: [0, 2, 4],
|
|
6758
|
+
* dpi: 300,
|
|
6759
|
+
* };
|
|
6760
|
+
* // => satisfies PptxExportOptions
|
|
6761
|
+
* ```
|
|
6762
|
+
*/
|
|
6763
|
+
interface PptxExportOptions {
|
|
6764
|
+
/** Target format. */
|
|
6765
|
+
format: PptxExportFormat;
|
|
6766
|
+
/** Slide indices to export (0-based). If omitted, all slides are exported. */
|
|
6767
|
+
slideIndices?: number[];
|
|
6768
|
+
/** Output width in pixels (for PNG). Height is derived from aspect ratio. */
|
|
6769
|
+
width?: number;
|
|
6770
|
+
/** DPI for raster export (default 150). */
|
|
6771
|
+
dpi?: number;
|
|
6772
|
+
/** Whether to include hidden slides. */
|
|
6773
|
+
includeHidden?: boolean;
|
|
6774
|
+
}
|
|
6775
|
+
/**
|
|
6776
|
+
* Embedded font data extracted from a PPTX file.
|
|
6777
|
+
*
|
|
6778
|
+
* Used to register `@font-face` rules so the renderer can display
|
|
6779
|
+
* the correct typeface even when the system font is missing.
|
|
6780
|
+
*
|
|
6781
|
+
* @example
|
|
6782
|
+
* ```ts
|
|
6783
|
+
* const font: PptxEmbeddedFont = {
|
|
6784
|
+
* name: "CustomSans",
|
|
6785
|
+
* dataUrl: "data:font/truetype;base64,AAEAK...",
|
|
6786
|
+
* format: "truetype",
|
|
6787
|
+
* };
|
|
6788
|
+
* // => satisfies PptxEmbeddedFont
|
|
6789
|
+
* ```
|
|
6790
|
+
*/
|
|
6791
|
+
/**
|
|
6792
|
+
* A single Custom XML Data Part stored in `customXml/` within the OPC package.
|
|
6793
|
+
*
|
|
6794
|
+
* These parts are used by add-ins, data-binding, and enterprise templates
|
|
6795
|
+
* to store structured data alongside the presentation.
|
|
6796
|
+
*
|
|
6797
|
+
* @see ECMA-376 Part 1, §15.2.5
|
|
6798
|
+
*/
|
|
6799
|
+
interface PptxCustomXmlPart {
|
|
6800
|
+
/** Item number (e.g. "1" for `customXml/item1.xml`). */
|
|
6801
|
+
id: string;
|
|
6802
|
+
/** Raw XML string content of the custom XML item. */
|
|
6803
|
+
data: string;
|
|
6804
|
+
/** Schema target namespace URI from `itemProps` (ds:schemaRef/@ds:uri). */
|
|
6805
|
+
schemaUri?: string;
|
|
6806
|
+
/** Raw XML string content of the associated `itemProps` file. */
|
|
6807
|
+
properties?: string;
|
|
6808
|
+
/** Raw XML string content of the OPC relationship file (`customXml/_rels/item{id}.xml.rels`). */
|
|
6809
|
+
rels?: string;
|
|
6810
|
+
}
|
|
6811
|
+
interface PptxEmbeddedFont {
|
|
6812
|
+
name: string;
|
|
6813
|
+
dataUrl: string;
|
|
6814
|
+
bold?: boolean;
|
|
6815
|
+
italic?: boolean;
|
|
6816
|
+
/** CSS font format hint (e.g. "truetype", "opentype"). */
|
|
6817
|
+
format?: 'truetype' | 'opentype' | 'woff' | 'woff2';
|
|
6818
|
+
/**
|
|
6819
|
+
* Deobfuscated (clear-text) font binary data preserved from load
|
|
6820
|
+
* for round-trip re-embedding on save. When present, the save
|
|
6821
|
+
* pipeline will re-obfuscate and write this data back into the ZIP.
|
|
6822
|
+
*/
|
|
6823
|
+
rawFontData?: Uint8Array;
|
|
6824
|
+
/**
|
|
6825
|
+
* Original ZIP path of the font part (e.g. `ppt/fonts/{GUID}.fntdata`).
|
|
6826
|
+
* Preserved from load for round-trip.
|
|
6827
|
+
*/
|
|
6828
|
+
partPath?: string;
|
|
6829
|
+
/**
|
|
6830
|
+
* The GUID used for obfuscation, either from the `fontKey` attribute
|
|
6831
|
+
* or extracted from the part path. Preserved from load for round-trip.
|
|
6832
|
+
*/
|
|
6833
|
+
fontGuid?: string;
|
|
6834
|
+
/**
|
|
6835
|
+
* Relationship ID (e.g. `rId21`) of the font part in
|
|
6836
|
+
* `ppt/_rels/presentation.xml.rels`. Preserved from load so the save
|
|
6837
|
+
* pipeline can reuse the original part/rel instead of minting a new
|
|
6838
|
+
* GUID-named copy alongside the stale original.
|
|
6839
|
+
*/
|
|
6840
|
+
originalRId?: string;
|
|
6841
|
+
/**
|
|
6842
|
+
* Raw bytes of the original obfuscated font part exactly as they were
|
|
6843
|
+
* stored in the source ZIP. When the loader could not determine a
|
|
6844
|
+
* usable GUID (e.g. EOT extraction path), the save pipeline preserves
|
|
6845
|
+
* these bytes verbatim under the original path/rel.
|
|
6846
|
+
*/
|
|
6847
|
+
originalPartBytes?: Uint8Array;
|
|
6848
|
+
}
|
|
6849
|
+
|
|
6850
|
+
//#endregion
|
|
6851
|
+
//#region src/core/types/theme-presets.d.ts
|
|
6852
|
+
/**
|
|
6853
|
+
* A complete theme preset that can be applied to a presentation.
|
|
6854
|
+
*
|
|
6855
|
+
* @example
|
|
6856
|
+
* ```ts
|
|
6857
|
+
* import { THEME_PRESETS } from "pptx-viewer-core";
|
|
6858
|
+
*
|
|
6859
|
+
* const office = THEME_PRESETS.find(p => p.id === "office");
|
|
6860
|
+
* await handler.switchTheme(office.colorScheme, office.fontScheme, office.name);
|
|
6861
|
+
* ```
|
|
6862
|
+
*/
|
|
6863
|
+
interface PptxThemePreset {
|
|
6864
|
+
/** Unique identifier for the preset. */
|
|
6865
|
+
id: string;
|
|
6866
|
+
/** Human-readable display name. */
|
|
6867
|
+
name: string;
|
|
6868
|
+
/** The 12-colour scheme. */
|
|
6869
|
+
colorScheme: PptxThemeColorScheme;
|
|
6870
|
+
/** Heading and body font families. */
|
|
6871
|
+
fontScheme: PptxThemeFontScheme;
|
|
6872
|
+
}
|
|
6873
|
+
//#endregion
|
|
6874
|
+
//#region src/core/builders/sdk/types.d.ts
|
|
6875
|
+
/** Position and size in pixels. Converted to EMU internally when needed. */
|
|
6876
|
+
interface ElementPosition {
|
|
6877
|
+
x: number;
|
|
6878
|
+
y: number;
|
|
6879
|
+
width: number;
|
|
6880
|
+
height: number;
|
|
6881
|
+
rotation?: number;
|
|
6882
|
+
}
|
|
6883
|
+
type FillInput = {
|
|
6884
|
+
type: 'solid';
|
|
6885
|
+
color: string;
|
|
6886
|
+
opacity?: number;
|
|
6887
|
+
} | {
|
|
6888
|
+
type: 'gradient';
|
|
6889
|
+
angle?: number;
|
|
6890
|
+
gradientType?: 'linear' | 'radial';
|
|
6891
|
+
stops: Array<{
|
|
6892
|
+
color: string;
|
|
6893
|
+
position: number;
|
|
6894
|
+
opacity?: number;
|
|
6895
|
+
}>;
|
|
6896
|
+
} | {
|
|
6897
|
+
type: 'pattern';
|
|
6898
|
+
preset: string;
|
|
6899
|
+
foreground?: string;
|
|
6900
|
+
background?: string;
|
|
6901
|
+
} | {
|
|
6902
|
+
type: 'image';
|
|
6903
|
+
url: string;
|
|
6904
|
+
mode?: 'stretch' | 'tile';
|
|
6905
|
+
} | {
|
|
6906
|
+
type: 'none';
|
|
6907
|
+
};
|
|
6908
|
+
interface StrokeInput {
|
|
6909
|
+
color?: string;
|
|
6910
|
+
width?: number;
|
|
6911
|
+
dash?: StrokeDashType;
|
|
6912
|
+
opacity?: number;
|
|
6913
|
+
join?: 'round' | 'bevel' | 'miter';
|
|
6914
|
+
cap?: 'flat' | 'rnd' | 'sq';
|
|
6915
|
+
}
|
|
6916
|
+
interface ShadowInput {
|
|
6917
|
+
color?: string;
|
|
6918
|
+
blur?: number;
|
|
6919
|
+
offsetX?: number;
|
|
6920
|
+
offsetY?: number;
|
|
6921
|
+
opacity?: number;
|
|
6922
|
+
}
|
|
6923
|
+
interface TextStyleInput {
|
|
6924
|
+
fontSize?: number;
|
|
6925
|
+
fontFamily?: string;
|
|
6926
|
+
bold?: boolean;
|
|
6927
|
+
italic?: boolean;
|
|
6928
|
+
underline?: boolean;
|
|
6929
|
+
strikethrough?: boolean;
|
|
6930
|
+
color?: string;
|
|
6931
|
+
alignment?: 'left' | 'center' | 'right' | 'justify';
|
|
6932
|
+
verticalAlignment?: 'top' | 'middle' | 'bottom';
|
|
6933
|
+
lineSpacing?: number;
|
|
6934
|
+
spaceBefore?: number;
|
|
6935
|
+
spaceAfter?: number;
|
|
6936
|
+
}
|
|
6937
|
+
interface TextSegmentInput {
|
|
6938
|
+
text: string;
|
|
6939
|
+
style?: Partial<TextStyleInput>;
|
|
6940
|
+
}
|
|
6941
|
+
interface TextOptions extends Partial<ElementPosition> {
|
|
6942
|
+
fontSize?: number;
|
|
6943
|
+
fontFamily?: string;
|
|
6944
|
+
bold?: boolean;
|
|
6945
|
+
italic?: boolean;
|
|
6946
|
+
underline?: boolean;
|
|
6947
|
+
strikethrough?: boolean;
|
|
6948
|
+
color?: string;
|
|
6949
|
+
alignment?: 'left' | 'center' | 'right' | 'justify';
|
|
6950
|
+
verticalAlignment?: 'top' | 'middle' | 'bottom';
|
|
6951
|
+
lineSpacing?: number;
|
|
6952
|
+
fill?: FillInput;
|
|
6953
|
+
stroke?: StrokeInput;
|
|
6954
|
+
shadow?: ShadowInput;
|
|
6955
|
+
opacity?: number;
|
|
6956
|
+
}
|
|
6957
|
+
interface ShapeOptions extends Partial<ElementPosition> {
|
|
6958
|
+
fill?: FillInput;
|
|
6959
|
+
stroke?: StrokeInput;
|
|
6960
|
+
text?: string;
|
|
6961
|
+
textStyle?: Partial<TextStyleInput>;
|
|
6962
|
+
adjustments?: Record<string, number>;
|
|
6963
|
+
shadow?: ShadowInput;
|
|
6964
|
+
opacity?: number;
|
|
6965
|
+
}
|
|
6966
|
+
interface ImageOptions extends Partial<ElementPosition> {
|
|
6967
|
+
altText?: string;
|
|
6968
|
+
cropLeft?: number;
|
|
6969
|
+
cropTop?: number;
|
|
6970
|
+
cropRight?: number;
|
|
6971
|
+
cropBottom?: number;
|
|
6972
|
+
opacity?: number;
|
|
6973
|
+
}
|
|
6974
|
+
interface TableInput {
|
|
6975
|
+
rows: TableRowInput[];
|
|
6976
|
+
columnWidths?: number[];
|
|
6977
|
+
style?: string;
|
|
6978
|
+
bandRows?: boolean;
|
|
6979
|
+
bandColumns?: boolean;
|
|
6980
|
+
firstRow?: boolean;
|
|
6981
|
+
lastRow?: boolean;
|
|
6982
|
+
firstCol?: boolean;
|
|
6983
|
+
lastCol?: boolean;
|
|
6984
|
+
}
|
|
6985
|
+
interface TableRowInput {
|
|
6986
|
+
cells: TableCellInput[];
|
|
6987
|
+
height?: number;
|
|
6988
|
+
}
|
|
6989
|
+
interface TableCellInput {
|
|
6990
|
+
text: string;
|
|
6991
|
+
style?: Partial<TextStyleInput>;
|
|
6992
|
+
fill?: FillInput;
|
|
6993
|
+
gridSpan?: number;
|
|
6994
|
+
rowSpan?: number;
|
|
6995
|
+
}
|
|
6996
|
+
interface TableOptions extends Partial<ElementPosition> {}
|
|
6997
|
+
interface ChartSeriesInput {
|
|
6998
|
+
name: string;
|
|
6999
|
+
values: number[];
|
|
7000
|
+
color?: string;
|
|
7001
|
+
boxWhiskerOptions?: PptxChartBoxWhiskerOptions;
|
|
7002
|
+
histogramOptions?: PptxChartHistogramOptions;
|
|
7003
|
+
waterfallOptions?: PptxChartWaterfallOptions;
|
|
7004
|
+
regionMapOptions?: PptxChartRegionMapOptions;
|
|
7005
|
+
treemapOptions?: PptxChartTreemapOptions;
|
|
7006
|
+
}
|
|
7007
|
+
interface ChartInput {
|
|
7008
|
+
series: ChartSeriesInput[];
|
|
7009
|
+
categories: string[];
|
|
7010
|
+
/** ChartEx hierarchy levels in leaf-to-root XML order. */
|
|
7011
|
+
categoryLevels?: string[][];
|
|
7012
|
+
title?: string;
|
|
7013
|
+
hasLegend?: boolean;
|
|
7014
|
+
legendPosition?: 't' | 'b' | 'l' | 'r' | 'tr';
|
|
7015
|
+
grouping?: 'clustered' | 'stacked' | 'percentStacked';
|
|
7016
|
+
}
|
|
7017
|
+
interface ChartOptions extends Partial<ElementPosition> {}
|
|
7018
|
+
interface ConnectorOptions extends Partial<ElementPosition> {
|
|
7019
|
+
type?: 'straight' | 'bent' | 'curved';
|
|
7020
|
+
stroke?: StrokeInput;
|
|
7021
|
+
startArrow?: ConnectorArrowType;
|
|
7022
|
+
endArrow?: ConnectorArrowType;
|
|
7023
|
+
from?: {
|
|
7024
|
+
elementId: string;
|
|
7025
|
+
site: number;
|
|
7026
|
+
};
|
|
7027
|
+
to?: {
|
|
7028
|
+
elementId: string;
|
|
7029
|
+
site: number;
|
|
7030
|
+
};
|
|
7031
|
+
}
|
|
7032
|
+
interface MediaOptions extends Partial<ElementPosition> {
|
|
7033
|
+
autoPlay?: boolean;
|
|
7034
|
+
loop?: boolean;
|
|
7035
|
+
volume?: number;
|
|
7036
|
+
trimStartMs?: number;
|
|
7037
|
+
trimEndMs?: number;
|
|
7038
|
+
posterFrame?: string;
|
|
7039
|
+
}
|
|
7040
|
+
interface GroupOptions extends Partial<ElementPosition> {}
|
|
7041
|
+
type BackgroundInput = {
|
|
7042
|
+
type: 'solid';
|
|
7043
|
+
color: string;
|
|
7044
|
+
} | {
|
|
7045
|
+
type: 'gradient';
|
|
7046
|
+
angle?: number;
|
|
7047
|
+
stops: Array<{
|
|
7048
|
+
color: string;
|
|
7049
|
+
position: number;
|
|
7050
|
+
}>;
|
|
7051
|
+
} | {
|
|
7052
|
+
type: 'image';
|
|
7053
|
+
source: string;
|
|
7054
|
+
};
|
|
7055
|
+
interface TransitionInput {
|
|
7056
|
+
type: PptxTransitionType;
|
|
7057
|
+
duration?: number;
|
|
7058
|
+
direction?: string;
|
|
7059
|
+
advanceAfterMs?: number;
|
|
7060
|
+
}
|
|
7061
|
+
interface AnimationInput {
|
|
7062
|
+
preset: PptxAnimationPreset;
|
|
7063
|
+
trigger?: PptxAnimationTrigger;
|
|
7064
|
+
duration?: number;
|
|
7065
|
+
delay?: number;
|
|
7066
|
+
}
|
|
7067
|
+
interface PresentationOptions {
|
|
7068
|
+
/** Slide width in EMU. Default: 12192000 (16:9 widescreen). */
|
|
7069
|
+
width?: number;
|
|
7070
|
+
/** Slide height in EMU. Default: 6858000 (16:9 widescreen). */
|
|
7071
|
+
height?: number;
|
|
7072
|
+
/** Theme configuration. */
|
|
7073
|
+
theme?: PresentationThemeInput;
|
|
7074
|
+
/** Presentation title (stored in docProps/core.xml). */
|
|
7075
|
+
title?: string;
|
|
7076
|
+
/** Presentation author. */
|
|
7077
|
+
creator?: string;
|
|
7078
|
+
/**
|
|
7079
|
+
* Number of blank slides to include in the initial presentation.
|
|
7080
|
+
* Default: 0 (no slides). Slides use the "Blank" layout.
|
|
7081
|
+
*/
|
|
7082
|
+
initialSlideCount?: number;
|
|
7083
|
+
}
|
|
7084
|
+
interface PresentationThemeInput {
|
|
7085
|
+
name?: string;
|
|
7086
|
+
colors?: {
|
|
7087
|
+
dk1?: string;
|
|
7088
|
+
lt1?: string;
|
|
7089
|
+
dk2?: string;
|
|
7090
|
+
lt2?: string;
|
|
7091
|
+
accent1?: string;
|
|
7092
|
+
accent2?: string;
|
|
7093
|
+
accent3?: string;
|
|
7094
|
+
accent4?: string;
|
|
7095
|
+
accent5?: string;
|
|
7096
|
+
accent6?: string;
|
|
7097
|
+
hlink?: string;
|
|
7098
|
+
folHlink?: string;
|
|
7099
|
+
};
|
|
7100
|
+
fonts?: {
|
|
7101
|
+
majorFont?: string;
|
|
7102
|
+
minorFont?: string;
|
|
7103
|
+
};
|
|
7104
|
+
}
|
|
7105
|
+
//#endregion
|
|
7106
|
+
//#region src/core/builders/sdk/SlideBuilder.d.ts
|
|
7107
|
+
/**
|
|
7108
|
+
* Fluent builder for a single slide.
|
|
7109
|
+
*
|
|
7110
|
+
* @example
|
|
7111
|
+
* ```ts
|
|
7112
|
+
* const slide = new SlideBuilder(1)
|
|
7113
|
+
* .addText("Hello World", { fontSize: 36, bold: true, x: 100, y: 50 })
|
|
7114
|
+
* .addShape("roundRect", { fill: { type: "solid", color: "#4472C4" } })
|
|
7115
|
+
* .setNotes("Remember to mention key points")
|
|
7116
|
+
* .setBackground({ type: "solid", color: "#F5F5F5" })
|
|
7117
|
+
* .build();
|
|
7118
|
+
* ```
|
|
7119
|
+
*/
|
|
7120
|
+
declare class SlideBuilder {
|
|
7121
|
+
private readonly slide;
|
|
7122
|
+
/**
|
|
7123
|
+
* @param slideNumber - 1-based slide number.
|
|
7124
|
+
* @param layoutPath - Optional layout archive path.
|
|
7125
|
+
* @param layoutName - Optional layout display name.
|
|
7126
|
+
*/
|
|
7127
|
+
constructor(slideNumber: number, layoutPath?: string, layoutName?: string);
|
|
7128
|
+
/** Add a text box to the slide. */
|
|
7129
|
+
addText(text: string | TextSegmentInput[], options?: TextOptions): this;
|
|
7130
|
+
/** Add a shape to the slide. */
|
|
7131
|
+
addShape(shapeType: string, options?: ShapeOptions): this;
|
|
7132
|
+
/** Add a connector (line) to the slide. */
|
|
7133
|
+
addConnector(options?: ConnectorOptions): this;
|
|
7134
|
+
/** Add an image to the slide. */
|
|
7135
|
+
addImage(source: string, options?: ImageOptions): this;
|
|
7136
|
+
/** Add a table to the slide. */
|
|
7137
|
+
addTable(input: TableInput, options?: TableOptions): this;
|
|
7138
|
+
/** Add a chart to the slide. */
|
|
7139
|
+
addChart(chartType: PptxChartType, input: ChartInput, options?: ChartOptions): this;
|
|
7140
|
+
/** Add a media element (video or audio) to the slide. */
|
|
7141
|
+
addMedia(mediaType: 'video' | 'audio', source: string, options?: MediaOptions): this;
|
|
7142
|
+
/** Add a group of elements to the slide. */
|
|
7143
|
+
addGroup(children: PptxElement[], options?: GroupOptions): this;
|
|
7144
|
+
/** Add a pre-built element directly. */
|
|
7145
|
+
addElement(element: PptxElement): this;
|
|
7146
|
+
/** Set slide background. */
|
|
7147
|
+
setBackground(bg: BackgroundInput): this;
|
|
7148
|
+
/** Set slide transition. */
|
|
7149
|
+
setTransition(input: TransitionInput): this;
|
|
7150
|
+
/** Add an animation to an element on this slide. */
|
|
7151
|
+
addAnimation(elementId: string, input: AnimationInput): this;
|
|
7152
|
+
/** Set speaker notes. */
|
|
7153
|
+
setNotes(text: string): this;
|
|
7154
|
+
/** Mark the slide as hidden. */
|
|
7155
|
+
setHidden(hidden: boolean): this;
|
|
7156
|
+
/** Assign the slide to a section. */
|
|
7157
|
+
setSection(name: string, id?: string): this;
|
|
7158
|
+
/**
|
|
7159
|
+
* Add a freeform shape from SVG path data.
|
|
7160
|
+
*
|
|
7161
|
+
* Creates a custom-geometry shape element using the provided SVG path
|
|
7162
|
+
* string and appends it to the slide's element list.
|
|
7163
|
+
*
|
|
7164
|
+
* @param pathData - An SVG path data string (e.g. `"M 0 0 L 100 50 L 50 100 Z"`).
|
|
7165
|
+
* @param options - Optional position, styling, and size overrides.
|
|
7166
|
+
* @returns The builder instance for chaining.
|
|
7167
|
+
*
|
|
7168
|
+
* @example
|
|
7169
|
+
* ```ts
|
|
7170
|
+
* new SlideBuilder(1)
|
|
7171
|
+
* .addFreeform("M 0 0 C 33 0 66 100 100 100", {
|
|
7172
|
+
* stroke: { color: "#FF0000", width: 2 },
|
|
7173
|
+
* })
|
|
7174
|
+
* .build();
|
|
7175
|
+
* ```
|
|
7176
|
+
*/
|
|
7177
|
+
addFreeform(pathData: string, options?: ShapeOptions): this;
|
|
7178
|
+
/**
|
|
7179
|
+
* Add a pre-built element from any element builder (calls `.build()` for you).
|
|
7180
|
+
*
|
|
7181
|
+
* Accepts any object with a `build()` method that returns a {@link PptxElement},
|
|
7182
|
+
* such as {@link TextBuilder}, {@link ShapeBuilder}, {@link ImageBuilder}, etc.
|
|
7183
|
+
*
|
|
7184
|
+
* @param builder - An element builder with a `.build()` method.
|
|
7185
|
+
* @returns The builder instance for chaining.
|
|
7186
|
+
*
|
|
7187
|
+
* @example
|
|
7188
|
+
* ```ts
|
|
7189
|
+
* const title = TextBuilder.create("Hello").fontSize(36).bold();
|
|
7190
|
+
* new SlideBuilder(1).addBuilderElement(title).build();
|
|
7191
|
+
* ```
|
|
7192
|
+
*/
|
|
7193
|
+
addBuilderElement(builder: {
|
|
7194
|
+
build(): PptxElement;
|
|
7195
|
+
}): this;
|
|
7196
|
+
/**
|
|
7197
|
+
* Remove an element by its ID.
|
|
7198
|
+
*
|
|
7199
|
+
* Filters out the element with the given ID from the slide's element list.
|
|
7200
|
+
* If no element matches, the slide is left unchanged.
|
|
7201
|
+
*
|
|
7202
|
+
* @param elementId - The unique ID of the element to remove.
|
|
7203
|
+
* @returns The builder instance for chaining.
|
|
7204
|
+
*
|
|
7205
|
+
* @example
|
|
7206
|
+
* ```ts
|
|
7207
|
+
* const slide = new SlideBuilder(1)
|
|
7208
|
+
* .addText("temp", { x: 0, y: 0 })
|
|
7209
|
+
* .removeElement("txt_abc123_1")
|
|
7210
|
+
* .build();
|
|
7211
|
+
* ```
|
|
7212
|
+
*/
|
|
7213
|
+
removeElement(elementId: string): this;
|
|
7214
|
+
/**
|
|
7215
|
+
* Get the current list of elements on this slide.
|
|
7216
|
+
*
|
|
7217
|
+
* Returns a readonly view of the elements array. Useful for inspecting
|
|
7218
|
+
* what has been added so far during the build process.
|
|
7219
|
+
*
|
|
7220
|
+
* @returns A readonly array of the slide's current elements.
|
|
7221
|
+
*
|
|
7222
|
+
* @example
|
|
7223
|
+
* ```ts
|
|
7224
|
+
* const builder = new SlideBuilder(1).addText("Hi");
|
|
7225
|
+
* console.log(builder.getElements().length); // 1
|
|
7226
|
+
* ```
|
|
7227
|
+
*/
|
|
7228
|
+
getElements(): readonly PptxElement[];
|
|
7229
|
+
/**
|
|
7230
|
+
* Get the number of elements on this slide.
|
|
7231
|
+
*
|
|
7232
|
+
* @returns The count of elements currently added to the slide.
|
|
7233
|
+
*
|
|
7234
|
+
* @example
|
|
7235
|
+
* ```ts
|
|
7236
|
+
* const builder = new SlideBuilder(1)
|
|
7237
|
+
* .addText("A").addText("B");
|
|
7238
|
+
* console.log(builder.elementCount); // 2
|
|
7239
|
+
* ```
|
|
7240
|
+
*/
|
|
7241
|
+
get elementCount(): number;
|
|
7242
|
+
/**
|
|
7243
|
+
* Get the last added element (useful for getting its ID for animations).
|
|
7244
|
+
*
|
|
7245
|
+
* Returns `undefined` if the slide has no elements yet.
|
|
7246
|
+
*
|
|
7247
|
+
* @returns The most recently added element, or `undefined`.
|
|
7248
|
+
*
|
|
7249
|
+
* @example
|
|
7250
|
+
* ```ts
|
|
7251
|
+
* const builder = new SlideBuilder(1).addShape("rect");
|
|
7252
|
+
* const shape = builder.getLastElement();
|
|
7253
|
+
* if (shape) {
|
|
7254
|
+
* builder.addAnimation(shape.id, { preset: "fadeIn" });
|
|
7255
|
+
* }
|
|
7256
|
+
* ```
|
|
7257
|
+
*/
|
|
7258
|
+
getLastElement(): PptxElement | undefined;
|
|
7259
|
+
/**
|
|
7260
|
+
* Set the slide name/title for organizational purposes.
|
|
7261
|
+
*
|
|
7262
|
+
* Stores an arbitrary name string on the slide object. This is useful
|
|
7263
|
+
* for labeling slides in tooling or custom workflows.
|
|
7264
|
+
*
|
|
7265
|
+
* @param name - The display name to assign to the slide.
|
|
7266
|
+
* @returns The builder instance for chaining.
|
|
7267
|
+
*
|
|
7268
|
+
* @example
|
|
7269
|
+
* ```ts
|
|
7270
|
+
* new SlideBuilder(1)
|
|
7271
|
+
* .setName("Introduction")
|
|
7272
|
+
* .addText("Welcome!")
|
|
7273
|
+
* .build();
|
|
7274
|
+
* ```
|
|
7275
|
+
*/
|
|
7276
|
+
setName(name: string): this;
|
|
7277
|
+
/** Return the built {@link PptxSlide}. */
|
|
7278
|
+
build(): PptxSlide;
|
|
7279
|
+
}
|
|
7280
|
+
//#endregion
|
|
7281
|
+
//#region src/core/builders/sdk/PresentationBuilder.d.ts
|
|
7282
|
+
/** Result returned by {@link PresentationBuilder.create}. */
|
|
7283
|
+
interface PresentationBuilderResult {
|
|
7284
|
+
/** Initialized handler ready for editing and saving. */
|
|
7285
|
+
handler: PptxHandler;
|
|
7286
|
+
/** Parsed presentation data. */
|
|
7287
|
+
data: PptxData;
|
|
7288
|
+
/** Convenience slide builder factory. */
|
|
7289
|
+
createSlide: (layoutName?: string) => SlideBuilder;
|
|
7290
|
+
}
|
|
7291
|
+
//#endregion
|
|
7292
|
+
//#region src/core/builders/fluent/PptxXmlBuilder.d.ts
|
|
7293
|
+
/**
|
|
7294
|
+
* Fluent interface for navigating and mutating a {@link PptxData} structure.
|
|
7295
|
+
* Provides method-chaining access to slides, elements, and notes.
|
|
7296
|
+
*/
|
|
7297
|
+
interface IPptxXmlBuilder {
|
|
7298
|
+
/** Navigate to a slide by zero-based index (Pascal-case alias). */
|
|
7299
|
+
Slides(index: number): PptxSlideBuilder;
|
|
7300
|
+
/** Navigate to a slide by zero-based index. */
|
|
7301
|
+
slide(index: number): PptxSlideBuilder;
|
|
7302
|
+
/** Navigate to a slide by zero-based index (plural alias). */
|
|
7303
|
+
slides(index: number): PptxSlideBuilder;
|
|
7304
|
+
/** Return the underlying presentation data. */
|
|
7305
|
+
project(): PptxData;
|
|
7306
|
+
}
|
|
7307
|
+
/**
|
|
7308
|
+
* Root builder of the fluent PPTX editing API.
|
|
7309
|
+
*
|
|
7310
|
+
* Wraps a {@link PptxData} object and provides chainable accessors
|
|
7311
|
+
* to navigate into slides, elements, and notes for in-place mutation.
|
|
7312
|
+
*/
|
|
7313
|
+
declare class PptxXmlBuilder implements IPptxXmlBuilder {
|
|
7314
|
+
/** The presentation data being mutated. */
|
|
7315
|
+
private readonly data;
|
|
7316
|
+
/** @param data - The presentation data to wrap. */
|
|
7317
|
+
constructor(data: PptxData);
|
|
7318
|
+
/**
|
|
7319
|
+
* Factory method to create a builder from presentation data.
|
|
7320
|
+
* @param data - The presentation data to wrap.
|
|
7321
|
+
* @returns A new {@link PptxXmlBuilder} instance.
|
|
7322
|
+
*/
|
|
7323
|
+
static from(data: PptxData): PptxXmlBuilder;
|
|
7324
|
+
/** @inheritdoc */
|
|
7325
|
+
Slides(index: number): PptxSlideBuilder;
|
|
7326
|
+
/**
|
|
7327
|
+
* Navigate to a slide by zero-based index.
|
|
7328
|
+
* @param index - Zero-based slide index.
|
|
7329
|
+
* @returns A {@link PptxSlideBuilder} for the requested slide.
|
|
7330
|
+
* @throws Error if index is not an integer or is out of range.
|
|
7331
|
+
*/
|
|
7332
|
+
slide(index: number): PptxSlideBuilder;
|
|
7333
|
+
/** @inheritdoc */
|
|
7334
|
+
slides(index: number): PptxSlideBuilder;
|
|
7335
|
+
/** Return the underlying {@link PptxData}. */
|
|
7336
|
+
project(): PptxData;
|
|
7337
|
+
/** Pascal-case alias for {@link project}. */
|
|
7338
|
+
Project(): PptxData;
|
|
7339
|
+
}
|
|
7340
|
+
/**
|
|
7341
|
+
* Fluent builder scoped to a single slide.
|
|
7342
|
+
* Provides navigation to the slide's elements and notes.
|
|
7343
|
+
*/
|
|
7344
|
+
declare class PptxSlideBuilder {
|
|
7345
|
+
/** The slide being operated on. */
|
|
7346
|
+
private readonly slideValue;
|
|
7347
|
+
/** Reference back to the root builder for chaining. */
|
|
7348
|
+
private readonly rootBuilder;
|
|
7349
|
+
/**
|
|
7350
|
+
* @param slideValue - The slide data.
|
|
7351
|
+
* @param rootBuilder - The parent builder.
|
|
7352
|
+
*/
|
|
7353
|
+
constructor(slideValue: PptxSlide, rootBuilder: PptxXmlBuilder);
|
|
7354
|
+
/** Navigate to the slide's notes builder (getter). */
|
|
7355
|
+
get Notes(): PptxSlideNotesBuilder;
|
|
7356
|
+
/** Navigate to the slide's notes builder. */
|
|
7357
|
+
notes(): PptxSlideNotesBuilder;
|
|
7358
|
+
/** Navigate to the slide's elements builder. */
|
|
7359
|
+
elements(): PptxSlideElementsBuilder;
|
|
7360
|
+
/** Return the underlying slide data. */
|
|
7361
|
+
project(): PptxSlide;
|
|
7362
|
+
/** Pascal-case alias for {@link project}. */
|
|
7363
|
+
Project(): PptxSlide;
|
|
7364
|
+
/** Navigate back to the root builder. */
|
|
7365
|
+
done(): PptxXmlBuilder;
|
|
7366
|
+
/** Pascal-case alias for {@link done}. */
|
|
7367
|
+
Done(): PptxXmlBuilder;
|
|
7368
|
+
}
|
|
7369
|
+
/**
|
|
7370
|
+
* Fluent builder for manipulating the elements array of a single slide.
|
|
7371
|
+
* Supports adding, removing, and updating elements by ID.
|
|
7372
|
+
*/
|
|
7373
|
+
declare class PptxSlideElementsBuilder {
|
|
7374
|
+
private readonly slideValue;
|
|
7375
|
+
private readonly slideBuilder;
|
|
7376
|
+
/**
|
|
7377
|
+
* @param slideValue - The slide whose elements are being modified.
|
|
7378
|
+
* @param slideBuilder - The parent slide builder for chaining.
|
|
7379
|
+
*/
|
|
7380
|
+
constructor(slideValue: PptxSlide, slideBuilder: PptxSlideBuilder);
|
|
7381
|
+
/**
|
|
7382
|
+
* Append an element to the slide's element list.
|
|
7383
|
+
* @param element - The element to add.
|
|
7384
|
+
* @returns This builder for chaining.
|
|
7385
|
+
*/
|
|
7386
|
+
add(element: PptxElement): this;
|
|
7387
|
+
/**
|
|
7388
|
+
* Remove an element from the slide by its ID.
|
|
7389
|
+
* @param elementId - The ID of the element to remove.
|
|
7390
|
+
* @returns This builder for chaining.
|
|
7391
|
+
*/
|
|
7392
|
+
removeById(elementId: string): this;
|
|
7393
|
+
/**
|
|
7394
|
+
* Update an element in-place by ID using a transform function.
|
|
7395
|
+
* @param elementId - The ID of the element to update.
|
|
7396
|
+
* @param updater - A function that receives the current element and returns the replacement.
|
|
7397
|
+
* @returns This builder for chaining.
|
|
7398
|
+
*/
|
|
7399
|
+
updateById(elementId: string, updater: (current: PptxElement) => PptxElement): this;
|
|
7400
|
+
/** Return the current elements array. */
|
|
7401
|
+
project(): PptxElement[];
|
|
7402
|
+
/** Navigate back to the slide builder. */
|
|
7403
|
+
done(): PptxSlideBuilder;
|
|
7404
|
+
}
|
|
7405
|
+
/**
|
|
7406
|
+
* Fluent builder for manipulating speaker notes on a single slide.
|
|
7407
|
+
* Supports adding, setting, clearing, and retrieving notes text.
|
|
7408
|
+
*/
|
|
7409
|
+
declare class PptxSlideNotesBuilder {
|
|
7410
|
+
private readonly slideValue;
|
|
7411
|
+
private readonly slideBuilder;
|
|
7412
|
+
/**
|
|
7413
|
+
* @param slideValue - The slide whose notes are being modified.
|
|
7414
|
+
* @param slideBuilder - The parent slide builder for chaining.
|
|
7415
|
+
*/
|
|
7416
|
+
constructor(slideValue: PptxSlide, slideBuilder: PptxSlideBuilder);
|
|
7417
|
+
/**
|
|
7418
|
+
* Append text to existing notes (separated by newline).
|
|
7419
|
+
* @param text - The text to append.
|
|
7420
|
+
* @returns This builder for chaining.
|
|
7421
|
+
*/
|
|
7422
|
+
add(text: string): this;
|
|
7423
|
+
/** Pascal-case alias for {@link add}. */
|
|
7424
|
+
Add(text: string): this;
|
|
7425
|
+
/**
|
|
7426
|
+
* Replace all notes with the given text.
|
|
7427
|
+
* @param text - The replacement notes text. Empty string clears notes.
|
|
7428
|
+
* @returns This builder for chaining.
|
|
7429
|
+
*/
|
|
7430
|
+
set(text: string): this;
|
|
7431
|
+
/** Pascal-case alias for {@link set}. */
|
|
7432
|
+
Set(text: string): this;
|
|
7433
|
+
/** Remove all notes from the slide. */
|
|
7434
|
+
clear(): this;
|
|
7435
|
+
/** Pascal-case alias for {@link clear}. */
|
|
7436
|
+
Clear(): this;
|
|
7437
|
+
/** Return the current notes text, or `undefined` if none. */
|
|
7438
|
+
get(): string | undefined;
|
|
7439
|
+
/** Pascal-case alias for {@link get}. */
|
|
7440
|
+
Get(): string | undefined;
|
|
7441
|
+
/** Navigate back to the slide builder. */
|
|
7442
|
+
done(): PptxSlideBuilder;
|
|
7443
|
+
/** Pascal-case alias for {@link done}. */
|
|
7444
|
+
Done(): PptxSlideBuilder;
|
|
7445
|
+
/**
|
|
7446
|
+
* Synchronize the `notesSegments` array from the plain-text notes string.
|
|
7447
|
+
* Splits text on newlines and creates corresponding {@link TextSegment} entries
|
|
7448
|
+
* with paragraph break markers between lines.
|
|
7449
|
+
*/
|
|
7450
|
+
private syncSegmentsFromNotes;
|
|
7451
|
+
}
|
|
7452
|
+
//#endregion
|
|
7453
|
+
//#region src/core/core/types.d.ts
|
|
7454
|
+
interface PptxHandlerLoadOptions {
|
|
7455
|
+
eagerDecodeImages?: boolean;
|
|
7456
|
+
password?: string;
|
|
7457
|
+
/**
|
|
7458
|
+
* Maximum total uncompressed bytes accepted from the input ZIP archive.
|
|
7459
|
+
* Defaults to 500 MiB. When the sum of `_data.uncompressedSize` across
|
|
7460
|
+
* all archive entries exceeds this cap, `load()` rejects with a
|
|
7461
|
+
* {@link ZipBombError}. A hard cap of 65 536 archive entries also
|
|
7462
|
+
* applies.
|
|
7463
|
+
*/
|
|
7464
|
+
maxUncompressedBytes?: number;
|
|
7465
|
+
/**
|
|
7466
|
+
* When `false` (default), relationship targets that resolve to
|
|
7467
|
+
* `http://` or `https://` URLs are dropped from rendered slides
|
|
7468
|
+
* (image, picture, background). Set to `true` to allow external image
|
|
7469
|
+
* URLs to flow through to `<img src>`.
|
|
7470
|
+
*
|
|
7471
|
+
* Disabled by default to mitigate SSRF / privacy-leak vectors in
|
|
7472
|
+
* server-side rendering and headless export pipelines.
|
|
7473
|
+
*/
|
|
7474
|
+
allowExternalImages?: boolean;
|
|
7475
|
+
}
|
|
7476
|
+
/** Output format for the save pipeline. */
|
|
7477
|
+
type PptxSaveFormat = 'pptx' | 'ppsx' | 'pptm';
|
|
7478
|
+
interface PptxHandlerSaveOptions {
|
|
7479
|
+
headerFooter?: PptxHeaderFooter;
|
|
7480
|
+
presentationProperties?: PptxPresentationProperties;
|
|
7481
|
+
customShows?: PptxCustomShow[];
|
|
7482
|
+
sections?: PptxSection[];
|
|
7483
|
+
coreProperties?: PptxCoreProperties;
|
|
7484
|
+
appProperties?: PptxAppProperties;
|
|
7485
|
+
customProperties?: PptxCustomProperty[];
|
|
7486
|
+
/** Updated notes master data to save back to notesMaster1.xml. */
|
|
7487
|
+
notesMaster?: PptxNotesMaster;
|
|
7488
|
+
/** Updated handout master data to save back to handoutMaster1.xml. */
|
|
7489
|
+
handoutMaster?: PptxHandoutMaster;
|
|
7490
|
+
/**
|
|
7491
|
+
* Updated slide masters to save back to ppt/slideMasters/slideMaster*.xml.
|
|
7492
|
+
* Each entry in the array applies typed mutations (clrMap, hf flags,
|
|
7493
|
+
* background) to the master at its `path`. Masters not listed here pass
|
|
7494
|
+
* through verbatim from the original load.
|
|
7495
|
+
*/
|
|
7496
|
+
slideMasters?: PptxSlideMaster[];
|
|
7497
|
+
/**
|
|
7498
|
+
* Updated slide layouts to save back to ppt/slideLayouts/slideLayout*.xml.
|
|
7499
|
+
* Each entry applies typed mutations (clrMapOverride, attrs, hf flags,
|
|
7500
|
+
* background) to the layout at its `path`. Layouts not listed here pass
|
|
7501
|
+
* through verbatim from the original load.
|
|
7502
|
+
*/
|
|
7503
|
+
slideLayouts?: PptxSlideLayout[];
|
|
7504
|
+
/** Updated tag collections to save back to ppt/tags/tag*.xml. */
|
|
7505
|
+
tags?: PptxTagCollection[];
|
|
7506
|
+
/** Presentation-level customer data references to author or update. */
|
|
7507
|
+
customerData?: PptxCustomerData[];
|
|
7508
|
+
/** Photo album metadata to save back to `p:photoAlbum`. */
|
|
7509
|
+
photoAlbum?: PptxPhotoAlbum;
|
|
7510
|
+
/** East Asian line-break settings to save back to `p:kinsoku`. */
|
|
7511
|
+
kinsoku?: PptxKinsoku | null;
|
|
7512
|
+
/** Write-protection verifier. Set to `null` to remove, `undefined` to preserve existing. */
|
|
7513
|
+
modifyVerifier?: PptxModifyVerifier | null;
|
|
7514
|
+
/** View properties to save back to ppt/viewProps.xml. */
|
|
7515
|
+
viewProperties?: PptxViewProperties;
|
|
7516
|
+
/**
|
|
7517
|
+
* Table style edits to save back to `ppt/tableStyles.xml`. Pass the
|
|
7518
|
+
* `tableStyleMap` from `PptxData` (optionally with edited entries)
|
|
7519
|
+
* to persist user edits. The `def` GUID and any unmodelled XML are
|
|
7520
|
+
* preserved verbatim. Omitting the option round-trips the original
|
|
7521
|
+
* part untouched.
|
|
7522
|
+
*/
|
|
7523
|
+
tableStyles?: ParsedTableStyleMap;
|
|
7524
|
+
/**
|
|
7525
|
+
* Target output format.
|
|
7526
|
+
* - `'pptx'` (default): Standard presentation.
|
|
7527
|
+
* - `'ppsx'`: Slide-show file (opens in presentation mode).
|
|
7528
|
+
* - `'pptm'`: Macro-enabled presentation (requires VBA data).
|
|
7529
|
+
*/
|
|
7530
|
+
outputFormat?: PptxSaveFormat;
|
|
7531
|
+
/**
|
|
7532
|
+
* Embedded fonts to write back (or add) to the saved PPTX.
|
|
7533
|
+
*
|
|
7534
|
+
* Pass the `embeddedFonts` array from `PptxData` to preserve existing
|
|
7535
|
+
* embedded fonts during save. You can also add new fonts by including
|
|
7536
|
+
* entries with `rawFontData` populated.
|
|
7537
|
+
*
|
|
7538
|
+
* When omitted, the save pipeline will automatically re-embed any
|
|
7539
|
+
* fonts that were loaded from the original PPTX and have `rawFontData`
|
|
7540
|
+
* preserved (i.e. the default is lossless round-trip).
|
|
7541
|
+
*/
|
|
7542
|
+
embeddedFonts?: PptxEmbeddedFont[];
|
|
7543
|
+
/** Typed embedded-font list metadata. Set to null to remove fonts and relationships. */
|
|
7544
|
+
embeddedFontList?: PptxEmbeddedFontList | null;
|
|
7545
|
+
/**
|
|
7546
|
+
* OOXML conformance class for the saved output.
|
|
7547
|
+
* - `'preserve'` (default): use the same conformance as the loaded file.
|
|
7548
|
+
* - `'strict'`: force Strict Open XML (ISO/IEC 29500) namespace URIs.
|
|
7549
|
+
* - `'transitional'`: force Transitional (ECMA-376) namespace URIs.
|
|
7550
|
+
*/
|
|
7551
|
+
conformance?: 'strict' | 'transitional' | 'preserve';
|
|
7552
|
+
}
|
|
7553
|
+
interface IPptxHandlerRuntime {
|
|
7554
|
+
/**
|
|
7555
|
+
* Release all resources held by this runtime (Blob URLs, caches, ZIP).
|
|
7556
|
+
* After calling, the runtime cannot be used further.
|
|
7557
|
+
*/
|
|
7558
|
+
dispose(): void;
|
|
7559
|
+
/**
|
|
7560
|
+
* Revoke all Blob URLs created during image loading.
|
|
7561
|
+
*/
|
|
7562
|
+
revokeBlobUrls(): void;
|
|
7563
|
+
getCompatibilityWarnings(): PptxCompatibilityWarning[];
|
|
7564
|
+
getLayoutOptions(): PptxLayoutOption[];
|
|
7565
|
+
createXmlBuilder(data: PptxData): PptxXmlBuilder;
|
|
7566
|
+
Builder(data: PptxData): PptxXmlBuilder;
|
|
7567
|
+
setTemplateBackground(path: string, backgroundColor: string | undefined): void;
|
|
7568
|
+
setPresentationTheme(themePath: string, applyToAllMasters?: boolean): Promise<void>;
|
|
7569
|
+
getTemplateBackgroundColor(path: string): string | undefined;
|
|
7570
|
+
updateThemeColorScheme(colorScheme: PptxThemeColorScheme): Promise<void>;
|
|
7571
|
+
updateThemeFontScheme(fontScheme: PptxThemeFontScheme): Promise<void>;
|
|
7572
|
+
updateThemeName(name: string): Promise<void>;
|
|
7573
|
+
applyTheme(colorScheme: PptxThemeColorScheme, fontScheme: PptxThemeFontScheme, themeName?: string): Promise<void>;
|
|
7574
|
+
load(data: ArrayBuffer, options?: PptxHandlerLoadOptions): Promise<PptxData>;
|
|
7575
|
+
getChartDataForGraphicFrame(slidePath: string, graphicFrame: XmlObject | undefined): Promise<PptxChartData | undefined>;
|
|
7576
|
+
getSmartArtDataForGraphicFrame(slidePath: string, graphicFrame: XmlObject | undefined): Promise<PptxSmartArtData | undefined>;
|
|
7577
|
+
getImageData(imagePath: string): Promise<string | undefined>;
|
|
7578
|
+
/**
|
|
7579
|
+
* Extract a media file from the PPTX archive as an ArrayBuffer.
|
|
7580
|
+
* Returns undefined if the file is not found.
|
|
7581
|
+
*/
|
|
7582
|
+
getMediaArrayBuffer(mediaPath: string): Promise<ArrayBuffer | undefined>;
|
|
7583
|
+
save(slides: PptxSlide[], options?: PptxHandlerSaveOptions): Promise<Uint8Array>;
|
|
7584
|
+
exportSlides(slides: PptxSlide[], options: PptxExportOptions): Promise<Map<number, Uint8Array>>;
|
|
7585
|
+
/**
|
|
7586
|
+
* Get the available slide layouts for a specific slide, based on the
|
|
7587
|
+
* slide's master. Scans the slide master's relationships to find all
|
|
7588
|
+
* layouts that belong to it.
|
|
7589
|
+
*
|
|
7590
|
+
* @param slideIndex - Zero-based slide index.
|
|
7591
|
+
* @param slides - Current slides array.
|
|
7592
|
+
* @returns Array of layout options belonging to the same slide master.
|
|
7593
|
+
*/
|
|
7594
|
+
getAvailableLayoutsForSlide(slideIndex: number, slides: PptxSlide[]): Promise<PptxLayoutOption[]>;
|
|
7595
|
+
/**
|
|
7596
|
+
* Resolve the editable template (master + layout) elements a slide
|
|
7597
|
+
* inherits, each carrying a `master-` / `layout-` prefixed id. Excludes
|
|
7598
|
+
* placeholders; returns only decorative shapes/pictures/graphic frames.
|
|
7599
|
+
*
|
|
7600
|
+
* @param slideId - The slide's archive path (`PptxSlide.id`).
|
|
7601
|
+
*/
|
|
7602
|
+
getTemplateElementsForSlide(slideId: string): Promise<PptxElement[]>;
|
|
7603
|
+
/**
|
|
7604
|
+
* Scan the loaded PPTX archive for all theme parts.
|
|
7605
|
+
*/
|
|
7606
|
+
getAvailableThemes(): Promise<Array<{
|
|
7607
|
+
path: string;
|
|
7608
|
+
name?: string;
|
|
7609
|
+
}>>;
|
|
7610
|
+
/**
|
|
7611
|
+
* Apply a different layout to an existing slide by updating the slide's
|
|
7612
|
+
* relationship to point to the new layout and re-parsing layout
|
|
7613
|
+
* placeholders / background.
|
|
7614
|
+
*
|
|
7615
|
+
* @param slideIndex - Zero-based slide index.
|
|
7616
|
+
* @param layoutPath - Archive path of the target layout
|
|
7617
|
+
* (e.g. `ppt/slideLayouts/slideLayout2.xml`).
|
|
7618
|
+
* @param slides - Current slides array.
|
|
7619
|
+
* @returns The updated slide with new layout path, name, and background.
|
|
7620
|
+
*/
|
|
7621
|
+
applyLayoutToSlide(slideIndex: number, layoutPath: string, slides: PptxSlide[]): Promise<PptxSlide>;
|
|
7622
|
+
}
|
|
7623
|
+
//#endregion
|
|
7624
|
+
//#region src/core/core/PptxHandlerRuntimeFactory.d.ts
|
|
7625
|
+
/**
|
|
7626
|
+
* Abstract factory contract for creating {@link IPptxHandlerRuntime}
|
|
7627
|
+
* instances.
|
|
7628
|
+
*
|
|
7629
|
+
* Implement this interface to supply a custom runtime (e.g. a
|
|
7630
|
+
* WASM-backed or test-double runtime) to {@link PptxHandlerCore}.
|
|
7631
|
+
*/
|
|
7632
|
+
interface IPptxHandlerRuntimeFactory {
|
|
7633
|
+
/** Instantiate and return a new runtime implementation. */
|
|
7634
|
+
createRuntime(): IPptxHandlerRuntime;
|
|
7635
|
+
}
|
|
7636
|
+
//#endregion
|
|
7637
|
+
//#region src/core/utils/ooxml-crypto-types.d.ts
|
|
7638
|
+
/**
|
|
7639
|
+
* Type definitions for OOXML encryption and decryption.
|
|
7640
|
+
*
|
|
7641
|
+
* Contains all interfaces and type aliases used by the OOXML crypto modules.
|
|
7642
|
+
*
|
|
7643
|
+
* @module ooxml-crypto-types
|
|
7644
|
+
*/
|
|
7645
|
+
/** Supported encryption algorithms. */
|
|
7646
|
+
type EncryptionAlgorithm = 'AES128' | 'AES256';
|
|
7647
|
+
/** Encryption options for creating encrypted files. */
|
|
7648
|
+
interface EncryptionOptions {
|
|
7649
|
+
/** The encryption algorithm to use (defaults to AES256). */
|
|
7650
|
+
algorithm?: EncryptionAlgorithm;
|
|
7651
|
+
/** Number of hash iterations for key derivation (defaults to 100000). Lower values speed up tests. */
|
|
7652
|
+
spinCount?: number;
|
|
7653
|
+
}
|
|
7654
|
+
//#endregion
|
|
7655
|
+
//#region src/core/PptxHandlerCore.d.ts
|
|
7656
|
+
/**
|
|
7657
|
+
* Dependency injection options for {@link PptxHandlerCore}.
|
|
7658
|
+
*
|
|
7659
|
+
* Provide either `runtime` (an already-constructed runtime) or
|
|
7660
|
+
* `runtimeFactory` (a factory that will be called once). When neither
|
|
7661
|
+
* is supplied the default runtime is created automatically.
|
|
7662
|
+
*
|
|
7663
|
+
* @example
|
|
7664
|
+
* ```ts
|
|
7665
|
+
* // Use the default runtime:
|
|
7666
|
+
* const core = new PptxHandlerCore();
|
|
7667
|
+
*
|
|
7668
|
+
* // Inject a custom runtime:
|
|
7669
|
+
* const core = new PptxHandlerCore({ runtime: myRuntime });
|
|
7670
|
+
*
|
|
7671
|
+
* // Supply a factory for lazy creation:
|
|
7672
|
+
* const core = new PptxHandlerCore({ runtimeFactory: myFactory });
|
|
7673
|
+
* // => PptxHandlerCore instance with injected runtime
|
|
7674
|
+
* ```
|
|
7675
|
+
*/
|
|
7676
|
+
interface PptxHandlerCoreDependencies {
|
|
7677
|
+
runtime?: IPptxHandlerRuntime;
|
|
7678
|
+
runtimeFactory?: IPptxHandlerRuntimeFactory;
|
|
7679
|
+
}
|
|
7680
|
+
/**
|
|
7681
|
+
* Thin facade over the PPTX runtime implementation.
|
|
7682
|
+
*
|
|
7683
|
+
* All heavy parsing, serialisation, and XML manipulation is delegated to an
|
|
7684
|
+
* {@link IPptxHandlerRuntime}. This surface stays stable and small so that
|
|
7685
|
+
* callers remain decoupled from the runtime internals and host-specific
|
|
7686
|
+
* runtime swaps (e.g. WASM vs Node) can be done transparently.
|
|
7687
|
+
*
|
|
7688
|
+
* @remarks
|
|
7689
|
+
* - Constructed once per open document.
|
|
7690
|
+
* - Errors from encrypted files are caught at `load()` time via
|
|
7691
|
+
* {@link EncryptedFileError}.
|
|
7692
|
+
* - `PptxXmlBuilder` instances returned by `createXmlBuilder()` / `Builder()`
|
|
7693
|
+
* operate directly on the runtime’s in-memory ZIP.
|
|
7694
|
+
*
|
|
7695
|
+
* @example
|
|
7696
|
+
* ```ts
|
|
7697
|
+
* const handler = new PptxHandlerCore();
|
|
7698
|
+
* const data = await handler.load(arrayBuffer);
|
|
7699
|
+
* // ... mutate slides ...
|
|
7700
|
+
* const out = await handler.save(data.slides);
|
|
7701
|
+
* // => Uint8Array of the modified .pptx file
|
|
7702
|
+
* ```
|
|
7703
|
+
*/
|
|
7704
|
+
declare class PptxHandlerCore {
|
|
7705
|
+
private readonly runtime;
|
|
7706
|
+
/**
|
|
7707
|
+
* Create a new handler, optionally injecting a custom runtime.
|
|
7708
|
+
*
|
|
7709
|
+
* Resolution order:
|
|
7710
|
+
* 1. `dependencies.runtime` — use as-is.
|
|
7711
|
+
* 2. `dependencies.runtimeFactory` — call `createRuntime()` once.
|
|
7712
|
+
* 3. Fall back to {@link createDefaultPptxHandlerRuntime}.
|
|
7713
|
+
*
|
|
7714
|
+
* @param dependencies - Optional runtime or factory override.
|
|
7715
|
+
*
|
|
7716
|
+
* @example
|
|
7717
|
+
* ```ts
|
|
7718
|
+
* const core = new PptxHandlerCore();
|
|
7719
|
+
* // => PptxHandlerCore instance with default runtime
|
|
7720
|
+
* ```
|
|
7721
|
+
*/
|
|
7722
|
+
constructor(dependencies?: PptxHandlerCoreDependencies);
|
|
7723
|
+
/**
|
|
7724
|
+
* Release all resources held by this handler instance.
|
|
7725
|
+
*
|
|
7726
|
+
* Revokes every Blob URL created for images/media, clears all
|
|
7727
|
+
* in-memory caches, and releases the in-memory ZIP archive.
|
|
7728
|
+
*
|
|
7729
|
+
* Call this when the handler is no longer needed (e.g. component
|
|
7730
|
+
* unmount) to free memory immediately rather than waiting for GC.
|
|
7731
|
+
*
|
|
7732
|
+
* After calling `dispose()`, do not call any other methods — create
|
|
7733
|
+
* a new `PptxHandler` instance instead.
|
|
7734
|
+
*/
|
|
7735
|
+
dispose(): void;
|
|
7736
|
+
/**
|
|
7737
|
+
* Return any compatibility warnings detected during the most recent load.
|
|
7738
|
+
*
|
|
7739
|
+
* Warnings indicate features the editor cannot fully represent (e.g.
|
|
7740
|
+
* SmartArt, 3-D effects, embedded OLE objects).
|
|
7741
|
+
*
|
|
7742
|
+
* @returns Array of {@link PptxCompatibilityWarning} objects.
|
|
7743
|
+
*/
|
|
7744
|
+
getCompatibilityWarnings(): PptxCompatibilityWarning[];
|
|
7745
|
+
/**
|
|
7746
|
+
* Get the slide layout options available in the loaded presentation.
|
|
7747
|
+
*
|
|
7748
|
+
* Each option maps to a `<p:sldLayout>` inside the PPTX archive.
|
|
7749
|
+
*
|
|
7750
|
+
* @returns Array of {@link PptxLayoutOption} entries.
|
|
7751
|
+
*/
|
|
7752
|
+
getLayoutOptions(): PptxLayoutOption[];
|
|
7753
|
+
/**
|
|
7754
|
+
* Create a fluent XML builder scoped to the given presentation data.
|
|
7755
|
+
*
|
|
7756
|
+
* The builder provides a chainable API for constructing and inserting
|
|
7757
|
+
* OpenXML nodes directly into the runtime’s in-memory ZIP.
|
|
7758
|
+
*
|
|
7759
|
+
* @param data - The parsed {@link PptxData} to bind the builder to.
|
|
7760
|
+
* @returns A new {@link PptxXmlBuilder} instance.
|
|
7761
|
+
*/
|
|
7762
|
+
createXmlBuilder(data: PptxData): PptxXmlBuilder;
|
|
7763
|
+
/**
|
|
7764
|
+
* Shorthand alias for {@link createXmlBuilder}.
|
|
7765
|
+
*
|
|
7766
|
+
* @param data - Parsed presentation data.
|
|
7767
|
+
* @returns A {@link PptxXmlBuilder} instance.
|
|
7768
|
+
*/
|
|
7769
|
+
Builder(data: PptxData): PptxXmlBuilder;
|
|
7770
|
+
/**
|
|
7771
|
+
* Register a background image for a specific template layout path.
|
|
7772
|
+
*
|
|
7773
|
+
* @param path - The internal PPTX path (e.g. `ppt/slideLayouts/slideLayout1.xml`).
|
|
7774
|
+
* @param backgroundColor - Optional hex colour to render behind the image.
|
|
7775
|
+
*/
|
|
7776
|
+
setTemplateBackground(path: string, backgroundColor: string | undefined): void;
|
|
7777
|
+
/**
|
|
7778
|
+
* Retrieve the background colour previously set for a template layout.
|
|
7779
|
+
*
|
|
7780
|
+
* @param path - The internal PPTX layout path.
|
|
7781
|
+
* @returns Hex colour string, or `undefined` if none was set.
|
|
7782
|
+
*/
|
|
7783
|
+
getTemplateBackgroundColor(path: string): string | undefined;
|
|
7784
|
+
/**
|
|
7785
|
+
* Replace the presentation’s theme by loading an external `.thmx` file.
|
|
7786
|
+
*
|
|
7787
|
+
* @param themePath - Absolute or relative path to the `.thmx` file.
|
|
7788
|
+
* @param applyToAllMasters - Apply to every slide master (default `true`).
|
|
7789
|
+
*
|
|
7790
|
+
* @example
|
|
7791
|
+
* ```ts
|
|
7792
|
+
* await handler.setPresentationTheme("./themes/corporate.thmx");
|
|
7793
|
+
* // => void — theme XML replaced in the in-memory ZIP
|
|
7794
|
+
* ```
|
|
7795
|
+
*/
|
|
7796
|
+
setPresentationTheme(themePath: string, applyToAllMasters?: boolean): Promise<void>;
|
|
7797
|
+
/**
|
|
7798
|
+
* Modify the theme’s colour scheme (accent colours, background, text, etc.).
|
|
7799
|
+
*
|
|
7800
|
+
* @param colorScheme - A {@link PptxThemeColorScheme} with hex colour values.
|
|
7801
|
+
*
|
|
7802
|
+
* @example
|
|
7803
|
+
* ```ts
|
|
7804
|
+
* await handler.updateThemeColorScheme({
|
|
7805
|
+
* dk1: "#1A1A2E", dk2: "#16213E",
|
|
7806
|
+
* lt1: "#FFFFFF", lt2: "#E8E8E8",
|
|
7807
|
+
* accent1: "#0F3460", accent2: "#533483",
|
|
7808
|
+
* accent3: "#E94560", accent4: "#F0A500",
|
|
7809
|
+
* });
|
|
7810
|
+
* // => void — colour scheme updated in the in-memory theme XML
|
|
7811
|
+
* ```
|
|
7812
|
+
*/
|
|
7813
|
+
updateThemeColorScheme(colorScheme: PptxThemeColorScheme): Promise<void>;
|
|
7814
|
+
/**
|
|
7815
|
+
* Update the theme’s font scheme (heading + body typefaces).
|
|
7816
|
+
*
|
|
7817
|
+
* @param fontScheme - A {@link PptxThemeFontScheme} with font family names.
|
|
7818
|
+
*
|
|
7819
|
+
* @example
|
|
7820
|
+
* ```ts
|
|
7821
|
+
* await handler.updateThemeFontScheme({
|
|
7822
|
+
* majorFont: "Montserrat",
|
|
7823
|
+
* minorFont: "Open Sans",
|
|
7824
|
+
* });
|
|
7825
|
+
* // => void — font scheme updated in the in-memory theme XML
|
|
7826
|
+
* ```
|
|
7827
|
+
*/
|
|
7828
|
+
updateThemeFontScheme(fontScheme: PptxThemeFontScheme): Promise<void>;
|
|
7829
|
+
/**
|
|
7830
|
+
* Rename the presentation theme.
|
|
7831
|
+
*
|
|
7832
|
+
* @param name - New display name for the theme.
|
|
7833
|
+
*/
|
|
7834
|
+
updateThemeName(name: string): Promise<void>;
|
|
7835
|
+
/**
|
|
7836
|
+
* Apply a complete theme in one call (colour scheme + font scheme + optional name).
|
|
7837
|
+
*
|
|
7838
|
+
* This is a convenience wrapper over {@link updateThemeColorScheme},
|
|
7839
|
+
* {@link updateThemeFontScheme}, and {@link updateThemeName}.
|
|
7840
|
+
*
|
|
7841
|
+
* @param colorScheme - Colour definitions.
|
|
7842
|
+
* @param fontScheme - Font definitions.
|
|
7843
|
+
* @param themeName - Optional theme display name.
|
|
7844
|
+
*
|
|
7845
|
+
* @example
|
|
7846
|
+
* ```ts
|
|
7847
|
+
* await handler.applyTheme(
|
|
7848
|
+
* { dk1: "#000", lt1: "#FFF", accent1: "#0066CC", /* … *\/ },
|
|
7849
|
+
* { majorFont: "Helvetica", minorFont: "Arial" },
|
|
7850
|
+
* "Corporate 2025",
|
|
7851
|
+
* );
|
|
7852
|
+
* // => void — colour scheme, font scheme, and name applied atomically
|
|
7853
|
+
* ```
|
|
7854
|
+
*/
|
|
7855
|
+
applyTheme(colorScheme: PptxThemeColorScheme, fontScheme: PptxThemeFontScheme, themeName?: string): Promise<void>;
|
|
7856
|
+
/**
|
|
7857
|
+
* Switch the presentation's theme, updating both the underlying XML and
|
|
7858
|
+
* re-resolving all element colours in-place.
|
|
7859
|
+
*
|
|
7860
|
+
* This is the high-level API for theme switching: it updates the theme
|
|
7861
|
+
* data in the ZIP, then patches all resolved colours in the provided
|
|
7862
|
+
* `PptxData` so that elements immediately reflect the new colour scheme
|
|
7863
|
+
* without requiring a re-parse.
|
|
7864
|
+
*
|
|
7865
|
+
* @param data - The current parsed presentation data (mutated in-place for
|
|
7866
|
+
* convenience, but a new `PptxData` object is also returned).
|
|
7867
|
+
* @param colorScheme - New colour scheme (12 colours).
|
|
7868
|
+
* @param fontScheme - Optional new font scheme.
|
|
7869
|
+
* @param themeName - Optional theme display name.
|
|
7870
|
+
* @returns The updated PptxData with re-resolved colours.
|
|
7871
|
+
*
|
|
7872
|
+
* @example
|
|
7873
|
+
* ```ts
|
|
7874
|
+
* import { THEME_PRESETS } from "pptx-viewer-core";
|
|
7875
|
+
*
|
|
7876
|
+
* const ion = THEME_PRESETS.find(p => p.id === "ion")!;
|
|
7877
|
+
* const newData = await handler.switchTheme(
|
|
7878
|
+
* data,
|
|
7879
|
+
* ion.colorScheme,
|
|
7880
|
+
* ion.fontScheme,
|
|
7881
|
+
* ion.name,
|
|
7882
|
+
* );
|
|
7883
|
+
* // => PptxData with all colours updated to the Ion theme
|
|
7884
|
+
* ```
|
|
7885
|
+
*/
|
|
7886
|
+
switchTheme(data: PptxData, colorScheme: PptxThemeColorScheme, fontScheme?: PptxThemeFontScheme, themeName?: string): Promise<PptxData>;
|
|
7887
|
+
/**
|
|
7888
|
+
* Apply a built-in theme preset to the presentation.
|
|
7889
|
+
*
|
|
7890
|
+
* Convenience wrapper around {@link switchTheme} that accepts a
|
|
7891
|
+
* {@link PptxThemePreset} directly.
|
|
7892
|
+
*
|
|
7893
|
+
* @param data - The current parsed presentation data.
|
|
7894
|
+
* @param preset - One of the built-in presets from {@link THEME_PRESETS}.
|
|
7895
|
+
* @returns The updated PptxData.
|
|
7896
|
+
*
|
|
7897
|
+
* @example
|
|
7898
|
+
* ```ts
|
|
7899
|
+
* import { THEME_PRESETS } from "pptx-viewer-core";
|
|
7900
|
+
*
|
|
7901
|
+
* const preset = THEME_PRESETS.find(p => p.id === "facet")!;
|
|
7902
|
+
* const newData = await handler.switchThemePreset(data, preset);
|
|
7903
|
+
* ```
|
|
7904
|
+
*/
|
|
7905
|
+
switchThemePreset(data: PptxData, preset: PptxThemePreset): Promise<PptxData>;
|
|
7906
|
+
/**
|
|
7907
|
+
* Parse a PPTX file from an `ArrayBuffer` and return structured data.
|
|
7908
|
+
*
|
|
7909
|
+
* If the file is encrypted and a `password` is provided in `options`,
|
|
7910
|
+
* the file will be decrypted before parsing. If no password is provided
|
|
7911
|
+
* for an encrypted file, throws {@link EncryptedFileError}.
|
|
7912
|
+
*
|
|
7913
|
+
* @param data - Raw bytes of the `.pptx` file (may be encrypted OLE2).
|
|
7914
|
+
* @param options - Optional load-time settings, including `password`.
|
|
7915
|
+
* @returns Parsed {@link PptxData} containing slides, theme, layouts, etc.
|
|
7916
|
+
*
|
|
7917
|
+
* @example
|
|
7918
|
+
* ```ts
|
|
7919
|
+
* // Load an unencrypted file:
|
|
7920
|
+
* const pptx = await handler.load(buf.buffer);
|
|
7921
|
+
*
|
|
7922
|
+
* // Load a password-protected file:
|
|
7923
|
+
* const pptx = await handler.load(buf.buffer, { password: "secret" });
|
|
7924
|
+
* console.log(`${pptx.slides.length} slides loaded`);
|
|
7925
|
+
* ```
|
|
7926
|
+
*/
|
|
7927
|
+
load(data: ArrayBuffer, options?: PptxHandlerLoadOptions): Promise<PptxData>;
|
|
7928
|
+
/**
|
|
7929
|
+
* Extract chart data from a graphic-frame XML node.
|
|
7930
|
+
*
|
|
7931
|
+
* @param slidePath - Internal archive path of the slide (e.g. `ppt/slides/slide1.xml`).
|
|
7932
|
+
* @param graphicFrame - Parsed XML object for the `<p:graphicFrame>` node.
|
|
7933
|
+
* @returns Chart data, or `undefined` if the frame is not a chart.
|
|
7934
|
+
*/
|
|
7935
|
+
getChartDataForGraphicFrame(slidePath: string, graphicFrame: XmlObject | undefined): Promise<PptxChartData | undefined>;
|
|
7936
|
+
/**
|
|
7937
|
+
* Extract SmartArt data from a graphic-frame XML node.
|
|
7938
|
+
*
|
|
7939
|
+
* @param slidePath - Internal archive path of the slide.
|
|
7940
|
+
* @param graphicFrame - Parsed XML object for the `<p:graphicFrame>` node.
|
|
7941
|
+
* @returns SmartArt data, or `undefined` if the frame is not SmartArt.
|
|
7942
|
+
*/
|
|
7943
|
+
getSmartArtDataForGraphicFrame(slidePath: string, graphicFrame: XmlObject | undefined): Promise<PptxSmartArtData | undefined>;
|
|
7944
|
+
/**
|
|
7945
|
+
* Get the base64-encoded data URL for an embedded image.
|
|
7946
|
+
*
|
|
7947
|
+
* @param imagePath - Archive-relative path (e.g. `ppt/media/image1.png`).
|
|
7948
|
+
* @returns A `data:image/...;base64,...` string, or `undefined` if not found.
|
|
7949
|
+
*/
|
|
7950
|
+
getImageData(imagePath: string): Promise<string | undefined>;
|
|
7951
|
+
/**
|
|
7952
|
+
* Extract a media file from the PPTX archive as an ArrayBuffer.
|
|
7953
|
+
* Avoids the 33% base64 overhead of getImageData — prefer this for
|
|
7954
|
+
* audio/video media that will be played via Blob URLs.
|
|
7955
|
+
*/
|
|
7956
|
+
getMediaArrayBuffer(mediaPath: string): Promise<ArrayBuffer | undefined>;
|
|
7957
|
+
/**
|
|
7958
|
+
* Serialise current slides back into a PPTX byte array.
|
|
7959
|
+
*
|
|
7960
|
+
* @param slides - The (possibly mutated) slide array.
|
|
7961
|
+
* @param options - Optional save-time settings (e.g. thumbnail generation).
|
|
7962
|
+
* @returns `Uint8Array` of the complete `.pptx` file.
|
|
7963
|
+
*
|
|
7964
|
+
* @example
|
|
7965
|
+
* ```ts
|
|
7966
|
+
* const bytes = await handler.save(data.slides);
|
|
7967
|
+
* await fs.writeFile("output.pptx", Buffer.from(bytes));
|
|
7968
|
+
* // => Uint8Array written to disk as a valid .pptx file
|
|
7969
|
+
* ```
|
|
7970
|
+
*/
|
|
7971
|
+
save(slides: PptxSlide[], options?: PptxHandlerSaveOptions): Promise<Uint8Array>;
|
|
7972
|
+
/**
|
|
7973
|
+
* Serialise slides and then encrypt the output with a password.
|
|
7974
|
+
*
|
|
7975
|
+
* This is a convenience method that calls {@link save} followed by
|
|
7976
|
+
* {@link encryptPptx}. The result is an OLE2 container suitable for
|
|
7977
|
+
* opening in Microsoft PowerPoint with a password prompt.
|
|
7978
|
+
*
|
|
7979
|
+
* @param slides - The (possibly mutated) slide array.
|
|
7980
|
+
* @param password - The password to encrypt with.
|
|
7981
|
+
* @param options - Optional save-time and encryption settings.
|
|
7982
|
+
* @returns `Uint8Array` of the encrypted OLE2 file.
|
|
7983
|
+
*
|
|
7984
|
+
* @example
|
|
7985
|
+
* ```ts
|
|
7986
|
+
* const bytes = await handler.saveEncrypted(data.slides, "secret");
|
|
7987
|
+
* await fs.writeFile("protected.pptx", Buffer.from(bytes));
|
|
7988
|
+
* // => Encrypted OLE2 file requiring password to open
|
|
7989
|
+
* ```
|
|
7990
|
+
*/
|
|
7991
|
+
saveEncrypted(slides: PptxSlide[], password: string, options?: PptxHandlerSaveOptions & {
|
|
7992
|
+
encryption?: EncryptionOptions;
|
|
7993
|
+
}): Promise<Uint8Array>;
|
|
7994
|
+
/**
|
|
7995
|
+
* Get the slide layouts available for a specific slide.
|
|
7996
|
+
*
|
|
7997
|
+
* Returns layouts belonging to the same slide master as the given slide.
|
|
7998
|
+
* This is useful for building a layout picker UI scoped to the current
|
|
7999
|
+
* slide's master.
|
|
8000
|
+
*
|
|
8001
|
+
* @param slideIndex - Zero-based slide index.
|
|
8002
|
+
* @param slides - Current slides array.
|
|
8003
|
+
* @returns Array of {@link PptxLayoutOption} entries for the slide's master.
|
|
8004
|
+
*
|
|
8005
|
+
* @example
|
|
8006
|
+
* ```ts
|
|
8007
|
+
* const layouts = await handler.getAvailableLayoutsForSlide(0, data.slides);
|
|
8008
|
+
* console.log(layouts.map(l => l.name));
|
|
8009
|
+
* // => ["Title Slide", "Title and Content", "Blank", ...]
|
|
8010
|
+
* ```
|
|
8011
|
+
*/
|
|
8012
|
+
getAvailableLayoutsForSlide(slideIndex: number, slides: PptxSlide[]): Promise<PptxLayoutOption[]>;
|
|
8013
|
+
/**
|
|
8014
|
+
* Resolve the editable template (master + layout) elements a slide
|
|
8015
|
+
* inherits, each carrying a `master-` / `layout-` prefixed id.
|
|
8016
|
+
*
|
|
8017
|
+
* This is the foundation for an "edit template/master" feature. The
|
|
8018
|
+
* returned elements are the decorative master/layout shapes the loader
|
|
8019
|
+
* already merges behind slide-authored content (master shapes behind,
|
|
8020
|
+
* layout shapes on top); placeholders are excluded. The same elements are
|
|
8021
|
+
* shared by every slide inheriting the layout/master, so editing one and
|
|
8022
|
+
* saving updates the shared part.
|
|
8023
|
+
*
|
|
8024
|
+
* To persist an edit, keep the mutated template element inside the
|
|
8025
|
+
* `slide.elements` array passed to {@link save}; the save writer reads
|
|
8026
|
+
* template elements from there and writes their shape XML back into the
|
|
8027
|
+
* owning layout/master `p:spTree`.
|
|
8028
|
+
*
|
|
8029
|
+
* @param slideId - The slide's archive path (the `PptxSlide.id`).
|
|
8030
|
+
* @returns Master + layout elements with prefixed ids (may be empty).
|
|
8031
|
+
*
|
|
8032
|
+
* @example
|
|
8033
|
+
* ```ts
|
|
8034
|
+
* const templateEls = await handler.getTemplateElementsForSlide(slide.id);
|
|
8035
|
+
* const logo = templateEls.find((e) => e.id.startsWith("master-"));
|
|
8036
|
+
* if (logo) {
|
|
8037
|
+
* logo.x += 10;
|
|
8038
|
+
* slide.elements = [...slide.elements, logo];
|
|
8039
|
+
* await handler.save(data.slides);
|
|
8040
|
+
* }
|
|
8041
|
+
* ```
|
|
8042
|
+
*/
|
|
8043
|
+
getTemplateElementsForSlide(slideId: string): Promise<PptxElement[]>;
|
|
8044
|
+
/**
|
|
8045
|
+
* Apply a different layout to an existing slide.
|
|
8046
|
+
*
|
|
8047
|
+
* Updates the slide's relationship to point to the new layout and
|
|
8048
|
+
* refreshes layout-derived properties (background, layout name).
|
|
8049
|
+
* The slide's own content elements are preserved.
|
|
8050
|
+
*
|
|
8051
|
+
* @param slideIndex - Zero-based slide index.
|
|
8052
|
+
* @param layoutPath - Archive path of the target layout
|
|
8053
|
+
* (e.g. `ppt/slideLayouts/slideLayout2.xml`).
|
|
8054
|
+
* @param slides - Current slides array (the slide at `slideIndex`
|
|
8055
|
+
* is replaced in-place).
|
|
8056
|
+
* @returns The updated {@link PptxSlide} with new layout metadata.
|
|
8057
|
+
*
|
|
8058
|
+
* @example
|
|
8059
|
+
* ```ts
|
|
8060
|
+
* const updated = await handler.applyLayoutToSlide(
|
|
8061
|
+
* 0,
|
|
8062
|
+
* "ppt/slideLayouts/slideLayout3.xml",
|
|
8063
|
+
* data.slides,
|
|
8064
|
+
* );
|
|
8065
|
+
* console.log(updated.layoutName);
|
|
8066
|
+
* // => "Two Content"
|
|
8067
|
+
* ```
|
|
8068
|
+
*/
|
|
8069
|
+
applyLayoutToSlide(slideIndex: number, layoutPath: string, slides: PptxSlide[]): Promise<PptxSlide>;
|
|
8070
|
+
/**
|
|
8071
|
+
* Scan the loaded PPTX archive for all theme parts (`ppt/theme/theme*.xml`)
|
|
8072
|
+
* and return their paths and display names.
|
|
8073
|
+
*/
|
|
8074
|
+
getAvailableThemes(): Promise<Array<{
|
|
8075
|
+
path: string;
|
|
8076
|
+
name?: string;
|
|
8077
|
+
}>>;
|
|
8078
|
+
/**
|
|
8079
|
+
* Export selected slides as individual PPTX files.
|
|
8080
|
+
*
|
|
8081
|
+
* Each entry in the returned map is keyed by slide index and contains a
|
|
8082
|
+
* standalone `Uint8Array` PPTX with only that slide.
|
|
8083
|
+
*
|
|
8084
|
+
* @param slides - Full slide array.
|
|
8085
|
+
* @param options - Export options (slide indexes, format, etc.).
|
|
8086
|
+
* @returns A `Map<slideIndex, Uint8Array>` of exported files.
|
|
8087
|
+
*
|
|
8088
|
+
* @example
|
|
8089
|
+
* ```ts
|
|
8090
|
+
* const exports = await handler.exportSlides(data.slides, {
|
|
8091
|
+
* slideIndexes: [0, 2],
|
|
8092
|
+
* });
|
|
8093
|
+
* for (const [idx, bytes] of exports) {
|
|
8094
|
+
* await fs.writeFile(`slide_${idx}.pptx`, Buffer.from(bytes));
|
|
8095
|
+
* }
|
|
8096
|
+
* // => Map<number, Uint8Array> — one standalone .pptx per exported slide
|
|
8097
|
+
* ```
|
|
8098
|
+
*/
|
|
8099
|
+
exportSlides(slides: PptxSlide[], options: PptxExportOptions): Promise<Map<number, Uint8Array>>;
|
|
8100
|
+
}
|
|
8101
|
+
//#endregion
|
|
8102
|
+
//#region src/core/PptxHandler.d.ts
|
|
8103
|
+
/**
|
|
8104
|
+
* Public facade for the PPTX editor handler.
|
|
5629
8105
|
*
|
|
5630
|
-
*
|
|
5631
|
-
*
|
|
5632
|
-
* const show: PptxCustomShow = {
|
|
5633
|
-
* name: "Executive Summary",
|
|
5634
|
-
* id: "0",
|
|
5635
|
-
* slideRIds: ["rId2", "rId5", "rId8"],
|
|
5636
|
-
* };
|
|
5637
|
-
* // => satisfies PptxCustomShow
|
|
5638
|
-
* ```
|
|
8106
|
+
* The implementation lives in `PptxHandlerCore` so this surface can stay small,
|
|
8107
|
+
* stable, and easy to replace with alternate implementations in the future.
|
|
5639
8108
|
*/
|
|
5640
|
-
|
|
5641
|
-
/**
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
8109
|
+
declare class PptxHandler extends PptxHandlerCore {
|
|
8110
|
+
/**
|
|
8111
|
+
* Create a new blank PPTX presentation from scratch.
|
|
8112
|
+
*
|
|
8113
|
+
* This is a convenience static method that delegates to
|
|
8114
|
+
* {@link PresentationBuilder.create}. The returned handler is fully
|
|
8115
|
+
* initialized and ready for editing, adding slides, and saving.
|
|
8116
|
+
*
|
|
8117
|
+
* @param options - Optional slide dimensions, theme, and metadata.
|
|
8118
|
+
* @returns Handler, parsed data, and a slide builder factory.
|
|
8119
|
+
*
|
|
8120
|
+
* @example
|
|
8121
|
+
* ```ts
|
|
8122
|
+
* const { handler, data, createSlide } = await PptxHandler.createBlank({
|
|
8123
|
+
* title: "My Deck",
|
|
8124
|
+
* theme: { colors: { accent1: "#FF6B6B" } },
|
|
8125
|
+
* });
|
|
8126
|
+
*
|
|
8127
|
+
* data.slides.push(
|
|
8128
|
+
* createSlide("Blank")
|
|
8129
|
+
* .addText("Hello", { fontSize: 36 })
|
|
8130
|
+
* .build()
|
|
8131
|
+
* );
|
|
8132
|
+
*
|
|
8133
|
+
* const bytes = await handler.save(data.slides);
|
|
8134
|
+
* ```
|
|
8135
|
+
*/
|
|
8136
|
+
static createBlank(options?: PresentationOptions): Promise<PresentationBuilderResult>;
|
|
8137
|
+
/**
|
|
8138
|
+
* Create a new PPTX presentation from scratch.
|
|
8139
|
+
*
|
|
8140
|
+
* Alias for {@link createBlank}. Generates a valid minimal OpenXML
|
|
8141
|
+
* package and returns a fully initialized handler ready for editing,
|
|
8142
|
+
* adding slides, and saving.
|
|
8143
|
+
*
|
|
8144
|
+
* @param options - Optional slide dimensions, theme, metadata,
|
|
8145
|
+
* and initial slide count.
|
|
8146
|
+
* @returns Handler, parsed data, and a slide builder factory.
|
|
8147
|
+
*
|
|
8148
|
+
* @example
|
|
8149
|
+
* ```ts
|
|
8150
|
+
* const { handler, data, createSlide } = await PptxHandler.create({
|
|
8151
|
+
* title: "Q4 Report",
|
|
8152
|
+
* initialSlideCount: 3,
|
|
8153
|
+
* theme: { colors: { accent1: "#FF6B6B" } },
|
|
8154
|
+
* });
|
|
8155
|
+
*
|
|
8156
|
+
* // The presentation already has 3 blank slides
|
|
8157
|
+
* console.log(data.slides.length); // => 3
|
|
8158
|
+
*
|
|
8159
|
+
* // Add more slides with content
|
|
8160
|
+
* data.slides.push(
|
|
8161
|
+
* createSlide("Blank")
|
|
8162
|
+
* .addText("Hello", { fontSize: 36 })
|
|
8163
|
+
* .build()
|
|
8164
|
+
* );
|
|
8165
|
+
*
|
|
8166
|
+
* const bytes = await handler.save(data.slides);
|
|
8167
|
+
* ```
|
|
8168
|
+
*/
|
|
8169
|
+
static create(options?: PresentationOptions): Promise<PresentationBuilderResult>;
|
|
5649
8170
|
}
|
|
5650
8171
|
|
|
5651
8172
|
//#region src/theme/types.d.ts
|
|
@@ -5962,12 +8483,69 @@ interface CollaborationConfig {
|
|
|
5962
8483
|
*/
|
|
5963
8484
|
writeBackDebounceMs?: number;
|
|
5964
8485
|
}
|
|
8486
|
+
/**
|
|
8487
|
+
* Normalized staged-reveal mode for a chart graphic frame, derived from the
|
|
8488
|
+
* OOXML `a:bldChart/@bld` (or `p:bldOleChart/@bld`) token:
|
|
8489
|
+
* - `asOne` the whole chart appears at once (`allAtOnce`).
|
|
8490
|
+
* - `bySeries` one data series is revealed per stage (`series`).
|
|
8491
|
+
* - `byCategory` one category is revealed per stage (`category`).
|
|
8492
|
+
* - `byElement` one series/category ELEMENT is revealed per stage
|
|
8493
|
+
* (`seriesElement` / `categoryElement`).
|
|
8494
|
+
*/
|
|
8495
|
+
type ChartBuildMode = 'asOne' | 'bySeries' | 'byCategory' | 'byElement';
|
|
8496
|
+
/**
|
|
8497
|
+
* Normalized staged-reveal mode for a SmartArt diagram, derived from the OOXML
|
|
8498
|
+
* `a:bldDgm/@bld` or `p:bldDgm/@bld` token:
|
|
8499
|
+
* - `asOne` the whole diagram appears at once (`whole` / `allAtOnce`).
|
|
8500
|
+
* - `byOne` one node is revealed per stage (`one`, and the assorted
|
|
8501
|
+
* `depthBy*` / `breadthBy*` / directional traversals).
|
|
8502
|
+
* - `byLvl` levels are revealed one element at a time (`lvlOne`).
|
|
8503
|
+
* - `byLvlAtOnce` a whole level is revealed per stage (`lvlAtOnce`).
|
|
8504
|
+
*/
|
|
8505
|
+
type DiagramBuildMode = 'asOne' | 'byOne' | 'byLvl' | 'byLvlAtOnce';
|
|
8506
|
+
/**
|
|
8507
|
+
* Playback-time staged-build state surfaced on {@link ElementAnimationState}.
|
|
8508
|
+
* `progress` is the 0..1 fraction of the build revealed at the current playback
|
|
8509
|
+
* time; a consumer maps it to its own item COUNT (see `revealedStageCount`).
|
|
8510
|
+
*/
|
|
8511
|
+
type ElementBuildState = {
|
|
8512
|
+
kind: 'chart';
|
|
8513
|
+
mode: ChartBuildMode;
|
|
8514
|
+
progress: number;
|
|
8515
|
+
} | {
|
|
8516
|
+
kind: 'diagram';
|
|
8517
|
+
mode: DiagramBuildMode;
|
|
8518
|
+
progress: number;
|
|
8519
|
+
};
|
|
5965
8520
|
/** Snapshot of a single element's animation state at a point in the timeline. */
|
|
5966
8521
|
interface ElementAnimationState {
|
|
5967
8522
|
/** Whether the element should be visible. */
|
|
5968
8523
|
visible: boolean;
|
|
5969
8524
|
/** CSS animation shorthand to apply (undefined = no active animation). */
|
|
5970
8525
|
cssAnimation: string | undefined;
|
|
8526
|
+
/**
|
|
8527
|
+
* Staged-build reveal state, present only when the active animation builds a
|
|
8528
|
+
* chart or SmartArt diagram in stages (`p:bldChart` / `p:bldDgm`) rather than
|
|
8529
|
+
* revealing the whole element at once. A staged renderer multiplies
|
|
8530
|
+
* `build.progress` (0..1) by its own series / category / level COUNT to
|
|
8531
|
+
* decide how many stages are revealed at the current playback time; see
|
|
8532
|
+
* {@link import('./animation-build').revealedStageCount}. Absent for ordinary
|
|
8533
|
+
* whole-element entrances, so existing renderers are unaffected.
|
|
8534
|
+
*/
|
|
8535
|
+
build?: ElementBuildState;
|
|
8536
|
+
/**
|
|
8537
|
+
* True when an active `p:animClr` color animation targets this shape's fill.
|
|
8538
|
+
* A vector renderer should then paint the fill with `fill: inherit` so the
|
|
8539
|
+
* wrapper-level colour keyframes cascade to the SVG path. Absent/false means
|
|
8540
|
+
* no active fill-colour animation.
|
|
8541
|
+
*/
|
|
8542
|
+
animatesFill?: boolean;
|
|
8543
|
+
/**
|
|
8544
|
+
* True when an active `p:animClr` color animation targets this shape's
|
|
8545
|
+
* stroke. A vector renderer should then paint the stroke with
|
|
8546
|
+
* `stroke: inherit`. Absent/false means no active stroke-colour animation.
|
|
8547
|
+
*/
|
|
8548
|
+
animatesStroke?: boolean;
|
|
5971
8549
|
}
|
|
5972
8550
|
/** The unit system used for ruler display. */
|
|
5973
8551
|
type RulerUnit = 'inches' | 'centimetres';
|
|
@@ -6241,25 +8819,6 @@ declare function writeStoredViewerPrefs(patch: Partial<StoredViewerPrefs>): void
|
|
|
6241
8819
|
/** Remove all persisted viewer preferences. Silently no-ops when storage is unavailable. */
|
|
6242
8820
|
declare function clearStoredViewerPrefs(): void;
|
|
6243
8821
|
|
|
6244
|
-
//#endregion
|
|
6245
|
-
//#region src/i18n/locale-catalog.d.ts
|
|
6246
|
-
/** One selectable entry in the viewer chrome's built-in language picker (File > Options > Language). */
|
|
6247
|
-
interface LocaleCatalogEntry {
|
|
6248
|
-
/** BCP-47-ish locale code, e.g. `'en'`, `'fr'`. Matches `pptx-viewer-locales`' exports. */
|
|
6249
|
-
code: string;
|
|
6250
|
-
/** English display name, used before a translation dictionary for the target locale is loaded. */
|
|
6251
|
-
label: string;
|
|
6252
|
-
/** The locale's own name for itself, e.g. `'Français'` for `fr`. */
|
|
6253
|
-
nativeLabel: string;
|
|
6254
|
-
}
|
|
6255
|
-
/**
|
|
6256
|
-
* Built-in language choices offered by File > Options > Language when a host
|
|
6257
|
-
* doesn't supply its own `availableLocales`. Mirrors the locales shipped by
|
|
6258
|
-
* the optional `pptx-viewer-locales` package (English needs no dictionary,
|
|
6259
|
-
* it's the viewer's own baseline).
|
|
6260
|
-
*/
|
|
6261
|
-
declare const LOCALE_CATALOG: readonly LocaleCatalogEntry[];
|
|
6262
|
-
|
|
6263
8822
|
//#region src/viewer/types-core.d.ts
|
|
6264
8823
|
/**
|
|
6265
8824
|
* Union of all shape preset types that the viewer can insert or render.
|
|
@@ -6295,6 +8854,228 @@ declare function ViewerThemeProvider({ theme, children }: ViewerThemeProviderPro
|
|
|
6295
8854
|
*/
|
|
6296
8855
|
declare function useViewerTheme(): ViewerTheme | undefined;
|
|
6297
8856
|
//#endregion
|
|
8857
|
+
//#region ../shared/dist/ai/index.d.ts
|
|
8858
|
+
//#endregion
|
|
8859
|
+
//#region src/ai/change-animator.d.ts
|
|
8860
|
+
/** Host-tunable options for how AI edits are animated on the canvas. */
|
|
8861
|
+
interface AiChangeAnimationConfig {
|
|
8862
|
+
/** Master switch. Default true. */
|
|
8863
|
+
enabled?: boolean;
|
|
8864
|
+
/** How long the motion + glow plays, in ms. Default 900. */
|
|
8865
|
+
durationMs?: number;
|
|
8866
|
+
/** Draw the pulsing glow highlight on changed elements. Default true. */
|
|
8867
|
+
glow?: boolean;
|
|
8868
|
+
/** Glide old->new bounds and cross-fade colours. Default true. */
|
|
8869
|
+
tween?: boolean;
|
|
8870
|
+
/** Accent colour (any CSS colour) for the glow/ghosts. Default a blue. */
|
|
8871
|
+
color?: string;
|
|
8872
|
+
}
|
|
8873
|
+
//#endregion
|
|
8874
|
+
//#region src/ai/config.d.ts
|
|
8875
|
+
/** The UI message shape exchanged with the assistant. Alias of the SDK type. */
|
|
8876
|
+
type PptxAiUIMessage = UIMessage;
|
|
8877
|
+
/**
|
|
8878
|
+
* Canonical name of every tool the assistant can call. Document tools mirror the
|
|
8879
|
+
* `pptx-viewer-mcp` server exactly (they ARE the same functions, run against the
|
|
8880
|
+
* live deck); the viewer-only tools (navigation, deck outline, element/notes
|
|
8881
|
+
* readers, table merge) have no MCP counterpart.
|
|
8882
|
+
*/
|
|
8883
|
+
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';
|
|
8884
|
+
type Resolvable<T> = T | (() => T | Promise<T>);
|
|
8885
|
+
/** How the assistant reaches a language model. */
|
|
8886
|
+
type PptxAiConnection =
|
|
8887
|
+
/**
|
|
8888
|
+
* Post messages to a host backend route (recommended for production so the
|
|
8889
|
+
* provider API key stays server-side). Maps to `DefaultChatTransport`.
|
|
8890
|
+
*/
|
|
8891
|
+
{
|
|
8892
|
+
kind: 'endpoint';
|
|
8893
|
+
api: string;
|
|
8894
|
+
headers?: Resolvable<Record<string, string>>;
|
|
8895
|
+
body?: Resolvable<Record<string, unknown>>;
|
|
8896
|
+
credentials?: RequestCredentials;
|
|
8897
|
+
fetch?: typeof globalThis.fetch;
|
|
8898
|
+
} |
|
|
8899
|
+
/**
|
|
8900
|
+
* Run a language model in-process in the browser (bring-your-own key /
|
|
8901
|
+
* local model). Maps to a `ToolLoopAgent` behind a `DirectChatTransport`.
|
|
8902
|
+
*/
|
|
8903
|
+
{
|
|
8904
|
+
kind: 'model';
|
|
8905
|
+
model: LanguageModel;
|
|
8906
|
+
system?: string;
|
|
8907
|
+
maxSteps?: number;
|
|
8908
|
+
} |
|
|
8909
|
+
/** Provide a fully-constructed transport (advanced / testing escape hatch). */
|
|
8910
|
+
{
|
|
8911
|
+
kind: 'transport';
|
|
8912
|
+
transport: ChatTransport<PptxAiUIMessage>;
|
|
8913
|
+
};
|
|
8914
|
+
/** How writes proposed by the assistant reach the document. */
|
|
8915
|
+
type PptxAiWritePolicy = 'stage' | 'approve' | 'auto';
|
|
8916
|
+
/** Which deck context is fed to the model with each turn. */
|
|
8917
|
+
type PptxAiContextStrategy = 'outline' | 'current-slide' | 'none';
|
|
8918
|
+
/** Optional per-session history persistence hooks. */
|
|
8919
|
+
interface PptxAiHistoryHooks {
|
|
8920
|
+
load?(id: string): Promise<PptxAiUIMessage[]>;
|
|
8921
|
+
save?(id: string, messages: PptxAiUIMessage[]): Promise<void>;
|
|
8922
|
+
}
|
|
8923
|
+
/** Complete host configuration for an AI chat session. */
|
|
8924
|
+
interface PptxAiConfig {
|
|
8925
|
+
connection: PptxAiConnection;
|
|
8926
|
+
/** Extra host instructions appended to the base system prompt. */
|
|
8927
|
+
systemPromptExtras?: string;
|
|
8928
|
+
tools?: {
|
|
8929
|
+
/** Allowlist. When set, only these tools are exposed. */
|
|
8930
|
+
enabled?: PptxAiToolName[];
|
|
8931
|
+
/** Denylist, applied after `enabled`. */
|
|
8932
|
+
disabled?: PptxAiToolName[];
|
|
8933
|
+
/** Additional host-defined tools merged into the tool set. */
|
|
8934
|
+
extra?: ToolSet;
|
|
8935
|
+
};
|
|
8936
|
+
/** Default `'stage'`. */
|
|
8937
|
+
writePolicy?: PptxAiWritePolicy;
|
|
8938
|
+
/** Default `'outline'`. */
|
|
8939
|
+
contextStrategy?: PptxAiContextStrategy;
|
|
8940
|
+
history?: PptxAiHistoryHooks;
|
|
8941
|
+
/**
|
|
8942
|
+
* How AI edits are animated on the canvas so the user can watch them land
|
|
8943
|
+
* (glide old->new, fade/scale in-out, glow-pulse). Omit for the defaults;
|
|
8944
|
+
* set `{ enabled: false }` to turn it off.
|
|
8945
|
+
*/
|
|
8946
|
+
changeAnimation?: AiChangeAnimationConfig;
|
|
8947
|
+
onError?(error: Error): void;
|
|
8948
|
+
}
|
|
8949
|
+
//#endregion
|
|
8950
|
+
//#region src/ai/bridge.d.ts
|
|
8951
|
+
/** Lightweight, model-friendly summary of the whole deck. */
|
|
8952
|
+
interface PptxAiDeckMeta {
|
|
8953
|
+
/** Total number of slides. */
|
|
8954
|
+
slideCount: number;
|
|
8955
|
+
/** Zero-based index of the currently active slide. */
|
|
8956
|
+
activeSlideIndex: number;
|
|
8957
|
+
/** Deck title, when known (first slide title / core properties). */
|
|
8958
|
+
title?: string;
|
|
8959
|
+
/** Slide canvas width in CSS pixels. */
|
|
8960
|
+
width: number;
|
|
8961
|
+
/** Slide canvas height in CSS pixels. */
|
|
8962
|
+
height: number;
|
|
8963
|
+
}
|
|
8964
|
+
/** Severity hint for {@link PptxAiBridge.notify}. */
|
|
8965
|
+
type PptxAiNotifyLevel = 'info' | 'success' | 'warning' | 'error';
|
|
8966
|
+
/**
|
|
8967
|
+
* A target the user has scoped the assistant to: either a whole slide or a
|
|
8968
|
+
* single element on a slide. Returned by {@link PptxAiBridge.getFocusedTargets}
|
|
8969
|
+
* so the context builder can tell the model exactly what to focus on.
|
|
8970
|
+
*/
|
|
8971
|
+
type PptxAiFocusedTarget = {
|
|
8972
|
+
kind: 'slide';
|
|
8973
|
+
slideIndex: number;
|
|
8974
|
+
} | {
|
|
8975
|
+
kind: 'element';
|
|
8976
|
+
slideIndex: number;
|
|
8977
|
+
elementId: string;
|
|
8978
|
+
};
|
|
8979
|
+
/**
|
|
8980
|
+
* A pure updater over the deck's slides. It receives a deep clone of the
|
|
8981
|
+
* current slides (mutation-safe) and returns the next slides array. The bridge
|
|
8982
|
+
* commits the returned array as ONE history entry.
|
|
8983
|
+
*/
|
|
8984
|
+
type PptxAiSlidesUpdater = (slides: PptxSlide[]) => PptxSlide[];
|
|
8985
|
+
/**
|
|
8986
|
+
* A pure updater over the whole parsed deck ({@link PptxData}). Mirrors the
|
|
8987
|
+
* `pptx-viewer-mcp` tool model (data in, mutated data out) so presentation-level
|
|
8988
|
+
* MCP tools (metadata, sections, canvas size, presentation properties, layouts)
|
|
8989
|
+
* can be committed as ONE undoable history entry through {@link
|
|
8990
|
+
* PptxAiBridge.applyDeckData}. Optional: bindings that only track slide/theme
|
|
8991
|
+
* state can omit it, in which case those presentation-level tools report that
|
|
8992
|
+
* they are unavailable in this viewer while every slide/theme tool still works.
|
|
8993
|
+
*/
|
|
8994
|
+
type PptxAiDataUpdater = (data: PptxData) => PptxData;
|
|
8995
|
+
/** Field-level updates for a single element, mirroring the MCP update vocab. */
|
|
8996
|
+
interface PptxAiElementUpdate {
|
|
8997
|
+
x?: number;
|
|
8998
|
+
y?: number;
|
|
8999
|
+
width?: number;
|
|
9000
|
+
height?: number;
|
|
9001
|
+
rotation?: number;
|
|
9002
|
+
opacity?: number;
|
|
9003
|
+
hidden?: boolean;
|
|
9004
|
+
flipHorizontal?: boolean;
|
|
9005
|
+
flipVertical?: boolean;
|
|
9006
|
+
text?: string;
|
|
9007
|
+
fontSize?: number;
|
|
9008
|
+
fontFamily?: string;
|
|
9009
|
+
fontColor?: string;
|
|
9010
|
+
bold?: boolean;
|
|
9011
|
+
italic?: boolean;
|
|
9012
|
+
underline?: boolean;
|
|
9013
|
+
align?: 'left' | 'center' | 'right' | 'justify';
|
|
9014
|
+
fillColor?: string;
|
|
9015
|
+
strokeColor?: string;
|
|
9016
|
+
strokeWidth?: number;
|
|
9017
|
+
}
|
|
9018
|
+
/**
|
|
9019
|
+
* Implemented by each binding to expose its live editor to the AI core.
|
|
9020
|
+
*
|
|
9021
|
+
* Read methods must be cheap and synchronous. Write methods must route through
|
|
9022
|
+
* the binding's editor-history layer so AI edits are undoable like manual ones.
|
|
9023
|
+
*/
|
|
9024
|
+
interface PptxAiBridge {
|
|
9025
|
+
/** Return a summary of the whole deck. */
|
|
9026
|
+
getDeckMeta(): PptxAiDeckMeta;
|
|
9027
|
+
/** Return the deck's slides. Callers must not mutate the returned array. */
|
|
9028
|
+
getSlides(): PptxSlide[];
|
|
9029
|
+
/** Return the zero-based index of the active slide. */
|
|
9030
|
+
getActiveSlideIndex(): number;
|
|
9031
|
+
/** Return the resolved presentation theme, when available. */
|
|
9032
|
+
getTheme(): PptxTheme | undefined;
|
|
9033
|
+
/** Return the underlying core handler, when the binding exposes one. */
|
|
9034
|
+
getHandler(): PptxHandler | undefined;
|
|
9035
|
+
/** Navigate the viewer to a slide by zero-based index. */
|
|
9036
|
+
goToSlide(index: number): void;
|
|
9037
|
+
/** Select the given elements on a slide (empty array clears selection). */
|
|
9038
|
+
selectElements(slideIndex: number, elementIds: string[]): void;
|
|
9039
|
+
/**
|
|
9040
|
+
* Apply a slides updater as a single, atomic, undoable history entry. The
|
|
9041
|
+
* binding is responsible for cloning current slides before calling
|
|
9042
|
+
* `updater` and for installing the result.
|
|
9043
|
+
*/
|
|
9044
|
+
applySlidesUpdate(updater: PptxAiSlidesUpdater, label: string): void;
|
|
9045
|
+
/** Apply field updates to one element as a single history entry. */
|
|
9046
|
+
updateElement(slideIndex: number, elementId: string, updates: PptxAiElementUpdate): void;
|
|
9047
|
+
/** Apply partial theme updates as a single history entry. */
|
|
9048
|
+
applyTheme(updates: Partial<PptxTheme>): void;
|
|
9049
|
+
/**
|
|
9050
|
+
* Return the full parsed {@link PptxData} for the open deck, with the live
|
|
9051
|
+
* (edited) slides and theme overlaid. Enables `pptx-viewer-mcp` tools that
|
|
9052
|
+
* read presentation-level state (metadata, sections, layouts, presentation
|
|
9053
|
+
* properties). Optional: when absent, the AI core synthesises a minimal
|
|
9054
|
+
* PptxData from slides + dimensions, which is enough for every slide/theme
|
|
9055
|
+
* tool but not for presentation-level reads.
|
|
9056
|
+
*/
|
|
9057
|
+
getDeckData?(): PptxData | undefined;
|
|
9058
|
+
/**
|
|
9059
|
+
* Commit a whole-deck {@link PptxData} mutation as one undoable history entry.
|
|
9060
|
+
* Used to apply presentation-level MCP tool results (metadata, sections,
|
|
9061
|
+
* canvas size, presentation properties, layouts). Optional: when absent,
|
|
9062
|
+
* those tools report they are not supported in this viewer; slide/theme tools
|
|
9063
|
+
* are unaffected (they route through {@link PptxAiBridge.applySlidesUpdate}
|
|
9064
|
+
* and {@link PptxAiBridge.applyTheme}).
|
|
9065
|
+
*/
|
|
9066
|
+
applyDeckData?(updater: PptxAiDataUpdater, label: string): void;
|
|
9067
|
+
/**
|
|
9068
|
+
* Return the slides / elements the user has scoped the assistant to, if any.
|
|
9069
|
+
* When present and non-empty, the context builder tells the model to focus on
|
|
9070
|
+
* exactly these targets. Optional so existing bridges satisfy the contract
|
|
9071
|
+
* without change; a bridge that does not implement it behaves as before (no
|
|
9072
|
+
* focus scoping).
|
|
9073
|
+
*/
|
|
9074
|
+
getFocusedTargets?(): PptxAiFocusedTarget[];
|
|
9075
|
+
/** Surface a transient message in the host UI (toast / status line). */
|
|
9076
|
+
notify?(message: string, level?: PptxAiNotifyLevel): void;
|
|
9077
|
+
}
|
|
9078
|
+
//#endregion
|
|
6298
9079
|
//#region src/viewer/types-ui.d.ts
|
|
6299
9080
|
/**
|
|
6300
9081
|
* Base handle interface for file viewer components.
|
|
@@ -6495,11 +9276,11 @@ interface PowerPointViewerProps {
|
|
|
6495
9276
|
serverUrl?: string;
|
|
6496
9277
|
};
|
|
6497
9278
|
/**
|
|
6498
|
-
* Opt in to the
|
|
6499
|
-
*
|
|
6500
|
-
*
|
|
6501
|
-
*
|
|
6502
|
-
*
|
|
9279
|
+
* Opt in to the Three.js SmartArt renderer. When `true`, SmartArt diagrams
|
|
9280
|
+
* render as extruded 3D blocks on a WebGL canvas instead of flat SVG.
|
|
9281
|
+
* Requires the optional `three` peer dependency; when it is not installed
|
|
9282
|
+
* (or the diagram has no geometry), the viewer transparently falls back to
|
|
9283
|
+
* the SVG `SmartArtRenderer`. Default `false`.
|
|
6503
9284
|
*/
|
|
6504
9285
|
smartArt3D?: boolean;
|
|
6505
9286
|
/**
|
|
@@ -6520,163 +9301,44 @@ interface PowerPointViewerProps {
|
|
|
6520
9301
|
* ```
|
|
6521
9302
|
*/
|
|
6522
9303
|
hiddenActions?: ToolbarActionId[];
|
|
6523
|
-
}
|
|
6524
|
-
interface PowerPointViewerHandle extends FileViewerHandle, PowerPointViewerAPI {
|
|
6525
|
-
getContent: () => Promise<Uint8Array>;
|
|
6526
|
-
}
|
|
6527
|
-
|
|
6528
|
-
//#region src/viewer/hooks/useAutosave.d.ts
|
|
6529
|
-
type AutosaveStatus = {
|
|
6530
|
-
state: 'idle';
|
|
6531
|
-
} | {
|
|
6532
|
-
state: 'disabled';
|
|
6533
|
-
reason: string;
|
|
6534
|
-
} | {
|
|
6535
|
-
state: 'saving';
|
|
6536
|
-
} | {
|
|
6537
|
-
state: 'saved';
|
|
6538
|
-
timestamp: number;
|
|
6539
|
-
} | {
|
|
6540
|
-
state: 'error';
|
|
6541
|
-
message: string;
|
|
6542
|
-
};
|
|
6543
|
-
//#endregion
|
|
6544
|
-
//#region src/viewer/utils/table-band-style.d.ts
|
|
6545
|
-
/** Context for resolving table style colours from the theme. */
|
|
6546
|
-
interface TableStyleContext {
|
|
6547
|
-
tableStyleMap?: ParsedTableStyleMap;
|
|
6548
|
-
theme?: PptxTheme;
|
|
6549
|
-
}
|
|
6550
|
-
//#endregion
|
|
6551
|
-
//#region src/viewer/components/canvas/canvas-types.d.ts
|
|
6552
|
-
interface ZoomViewport {
|
|
6553
|
-
canvasViewportRef: React$1__default.RefObject<HTMLDivElement | null>;
|
|
6554
|
-
editWrapperRef: React$1__default.RefObject<HTMLDivElement | null>;
|
|
6555
|
-
canvasStageRef: React$1__default.RefObject<HTMLDivElement | null>;
|
|
6556
|
-
editorScale: number;
|
|
6557
|
-
}
|
|
6558
|
-
interface SlideCanvasProps {
|
|
6559
|
-
activeSlide: PptxSlide | undefined;
|
|
6560
|
-
templateElements: PptxElement[];
|
|
6561
|
-
canvasSize: CanvasSize;
|
|
6562
|
-
zoom: ZoomViewport;
|
|
6563
|
-
mode: ViewerMode;
|
|
6564
|
-
canEdit: boolean;
|
|
6565
|
-
editTemplateMode: boolean;
|
|
6566
|
-
selectedElementIdSet: Set<string>;
|
|
6567
|
-
selectedElement: PptxElement | null;
|
|
6568
|
-
inlineEditingElementId: string | null;
|
|
6569
|
-
inlineEditingText: string;
|
|
6570
|
-
spellCheckEnabled: boolean;
|
|
6571
|
-
mediaDataUrls: Map<string, string>;
|
|
6572
|
-
tableEditorState: TableCellEditorState | null;
|
|
6573
|
-
marqueeSelectionState: MarqueeSelectionState | null;
|
|
6574
|
-
snapLines: Array<{
|
|
6575
|
-
axis: string;
|
|
6576
|
-
position: number;
|
|
6577
|
-
}>;
|
|
6578
|
-
showGrid: boolean;
|
|
6579
|
-
/** Grid spacing in CSS px (derived from PPTX gridSpacing EMUs). */
|
|
6580
|
-
gridSpacingPx?: number;
|
|
6581
|
-
showRulers: boolean;
|
|
6582
|
-
/** Unit system for rulers (default: inches). */
|
|
6583
|
-
rulerUnit?: RulerUnit;
|
|
6584
|
-
guides: Array<{
|
|
6585
|
-
id: string;
|
|
6586
|
-
axis: 'h' | 'v';
|
|
6587
|
-
position: number;
|
|
6588
|
-
}>;
|
|
6589
|
-
presentationElementStates?: Map<string, ElementAnimationState>;
|
|
6590
|
-
presentationKeyframesCss?: string;
|
|
6591
|
-
onClick: (elementId: string, e: React$1__default.MouseEvent) => void;
|
|
6592
|
-
onDoubleClick: (elementId: string, e: React$1__default.MouseEvent) => void;
|
|
6593
|
-
onMouseDown: (elementId: string, e: React$1__default.MouseEvent) => void;
|
|
6594
|
-
onContextMenu: (elementId: string, e: React$1__default.MouseEvent) => void;
|
|
6595
|
-
/** Called when the user presses mouse down on empty canvas space. */
|
|
6596
|
-
onCanvasMouseDown?: (e: React$1__default.MouseEvent) => void;
|
|
6597
|
-
onResizePointerDown: (elementId: string, e: React$1__default.MouseEvent, handle: string) => void;
|
|
6598
|
-
onAdjustmentPointerDown: (elementId: string, e: React$1__default.MouseEvent) => void;
|
|
6599
|
-
/** Commit a new rotation (degrees) when the on-canvas rotate handle is dragged. */
|
|
6600
|
-
onRotate?: (elementId: string, rotationDeg: number) => void;
|
|
6601
|
-
onInlineEditChange: (text: string) => void;
|
|
6602
|
-
onInlineEditCommit: () => void;
|
|
6603
|
-
onInlineEditCancel: () => void;
|
|
6604
|
-
onTableCellSelect: (cell: Omit<TableCellEditorState, 'elementId'> | null, elementId: string) => void;
|
|
6605
|
-
/** Called when an edited table cell should be committed. */
|
|
6606
|
-
onCommitCellEdit?: (elementId: string, rowIndex: number, colIndex: number, text: string) => void;
|
|
6607
|
-
/**
|
|
6608
|
-
* Commit a partial update to a SmartArt element from inline (on-canvas) node
|
|
6609
|
-
* editing. Routed to the same element-update path the inspector uses (undo/redo
|
|
6610
|
-
* + dirty marking). When absent, inline SmartArt editing is disabled.
|
|
6611
|
-
*/
|
|
6612
|
-
onUpdateSmartArtElement?: (elementId: string, updates: Partial<PptxElement>) => void;
|
|
6613
9304
|
/**
|
|
6614
|
-
*
|
|
6615
|
-
*
|
|
6616
|
-
*
|
|
9305
|
+
* Opt in to the built-in AI assistant. When provided, a Sparkles toggle
|
|
9306
|
+
* appears in the toolbar and opens a chat panel wired to this config; when
|
|
9307
|
+
* omitted, no AI icon renders and no AI code is loaded (the panel and its
|
|
9308
|
+
* `@ai-sdk/react` dependency are `React.lazy`-imported only on first open).
|
|
9309
|
+
*
|
|
9310
|
+
* The host supplies the model connection (a backend `endpoint`, an in-browser
|
|
9311
|
+
* `model`, or a custom `transport`) plus optional tool allow/deny lists and a
|
|
9312
|
+
* write policy. Requires the optional `ai` and `@ai-sdk/react` peers.
|
|
9313
|
+
*
|
|
9314
|
+
* @example
|
|
9315
|
+
* ```tsx
|
|
9316
|
+
* <PowerPointViewer content={bytes} ai={{ connection: { kind: 'model', model } }} />
|
|
9317
|
+
* ```
|
|
9318
|
+
*
|
|
9319
|
+
* @see {@link PptxAiConfig}
|
|
6617
9320
|
*/
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
onResizeTableRow?: (elementId: string, rowIndex: number, newHeight: number) => void;
|
|
6623
|
-
/** Find & Replace results (all matches across all slides). */
|
|
6624
|
-
findResults?: Array<{
|
|
6625
|
-
slideIndex: number;
|
|
6626
|
-
elementId: string;
|
|
6627
|
-
segmentIndex: number;
|
|
6628
|
-
startOffset: number;
|
|
6629
|
-
length: number;
|
|
6630
|
-
}>;
|
|
6631
|
-
/** Index of the currently focused find result (-1 for none). */
|
|
6632
|
-
findResultIndex?: number;
|
|
6633
|
-
/** Index of the currently visible slide (needed to filter find results). */
|
|
6634
|
-
activeSlideIndex?: number;
|
|
6635
|
-
/** Currently active drawing tool ("select" means no drawing overlay). */
|
|
6636
|
-
activeTool?: DrawingTool;
|
|
6637
|
-
/** Stroke colour for pen / highlighter. */
|
|
6638
|
-
drawingColor?: string;
|
|
6639
|
-
/** Stroke width for pen / highlighter. */
|
|
6640
|
-
drawingWidth?: number;
|
|
6641
|
-
/** Ref that is true while a pointer stroke is in progress. */
|
|
6642
|
-
isDrawingRef?: React$1__default.RefObject<boolean>;
|
|
6643
|
-
/** Called when a completed ink stroke should be added to the slide. */
|
|
6644
|
-
onAddInkElement?: (ink: InkPptxElement) => void;
|
|
6645
|
-
/** Called when a freeform drawing stroke should be added as a shape element. */
|
|
6646
|
-
onAddFreeformShape?: (shape: ShapePptxElement) => void;
|
|
6647
|
-
/** Called when the eraser tool removes an ink element. */
|
|
6648
|
-
onEraseInkElement?: (elementId: string) => void;
|
|
6649
|
-
/** Called when a shape-level action is clicked (e.g. slide jump, URL). */
|
|
6650
|
-
onActionClick?: (elementId: string, action: PptxAction) => void;
|
|
6651
|
-
/** Called when a text-level hyperlink is clicked. */
|
|
6652
|
-
onHyperlinkClick?: (url: string) => void;
|
|
6653
|
-
/** Comments for the current slide (used for on-canvas markers). */
|
|
6654
|
-
comments?: PptxComment[];
|
|
6655
|
-
/** Whether to show comment markers on the slide canvas. */
|
|
6656
|
-
showCommentMarkers?: boolean;
|
|
6657
|
-
/** Called when a comment marker is clicked. */
|
|
6658
|
-
onCommentMarkerClick?: (commentId: string) => void;
|
|
6659
|
-
onMoveGuide?: (guideId: string, position: number) => void;
|
|
6660
|
-
onDeleteGuide?: (guideId: string) => void;
|
|
6661
|
-
onCreateGuideFromRuler?: (axis: 'h' | 'v', positionPx: number) => void;
|
|
6662
|
-
/** When true, shows connection sites on shapes and enables connector drawing. */
|
|
6663
|
-
connectorCreationMode?: boolean;
|
|
6664
|
-
/** Called when a new connector is created between two shapes. */
|
|
6665
|
-
onCreateConnector?: (connector: ConnectorPptxElement) => void;
|
|
6666
|
-
/** All slides in the presentation (for zoom element thumbnails). */
|
|
6667
|
-
allSlides?: readonly PptxSlide[];
|
|
6668
|
-
/** Callback fired when a zoom element is clicked in presentation mode. */
|
|
6669
|
-
onZoomClick?: (targetSlideIndex: number, returnSlideIndex: number) => void;
|
|
6670
|
-
/** Index of the current slide (for zoom return navigation). */
|
|
6671
|
-
sourceSlideIndex?: number;
|
|
6672
|
-
/** Context for text field placeholder substitution (slide number, header/footer, etc.). */
|
|
6673
|
-
fieldContext?: FieldSubstitutionContext;
|
|
6674
|
-
/** Theme + table style map for resolving table band/header colours. */
|
|
6675
|
-
tableStyleContext?: TableStyleContext;
|
|
6676
|
-
/** Optional collaboration cursor overlay rendered on top of the canvas. */
|
|
6677
|
-
collaborationOverlay?: React$1__default.ReactNode;
|
|
9321
|
+
ai?: PptxAiConfig;
|
|
9322
|
+
}
|
|
9323
|
+
interface PowerPointViewerHandle extends FileViewerHandle, PowerPointViewerAPI {
|
|
9324
|
+
getContent: () => Promise<Uint8Array>;
|
|
6678
9325
|
}
|
|
9326
|
+
|
|
9327
|
+
//#region src/viewer/utils/animation-effects.d.ts
|
|
9328
|
+
declare function getAnimationInitialStyle(preset: PptxAnimationPreset | undefined, nativeAnimation?: PptxNativeAnimation): React$1__default.CSSProperties;
|
|
6679
9329
|
//#endregion
|
|
9330
|
+
//#region src/viewer/PowerPointViewer.d.ts
|
|
9331
|
+
/**
|
|
9332
|
+
* Root React component for the PowerPoint viewer/editor.
|
|
9333
|
+
*
|
|
9334
|
+
* Accepts binary `.pptx` content and renders a full-featured editor with
|
|
9335
|
+
* slide canvas, toolbar, inspector panels, presentation mode, and more.
|
|
9336
|
+
*
|
|
9337
|
+
* Uses `forwardRef` to expose a `PowerPointViewerHandle` for imperative
|
|
9338
|
+
* access (e.g. serialising the current content for saving).
|
|
9339
|
+
*/
|
|
9340
|
+
declare const PowerPointViewer: React$1.ForwardRefExoticComponent<PowerPointViewerProps & React$1.RefAttributes<PowerPointViewerHandle>>;
|
|
9341
|
+
|
|
6680
9342
|
//#region src/viewer/components/toolbar/toolbar-types.d.ts
|
|
6681
9343
|
interface ToolbarProps {
|
|
6682
9344
|
fileName?: string;
|
|
@@ -6828,8 +9490,171 @@ interface ToolbarProps {
|
|
|
6828
9490
|
onApplyTransitionToAll: () => void;
|
|
6829
9491
|
/** Host-supplied list of toolbar buttons/ribbon tabs to hide. See `PowerPointViewerProps.hiddenActions`. */
|
|
6830
9492
|
hiddenActions?: readonly ToolbarActionId[];
|
|
9493
|
+
/** Whether the AI assistant is available (the host passed the `ai` prop). */
|
|
9494
|
+
aiEnabled?: boolean;
|
|
9495
|
+
/** Whether the AI assistant panel is currently open. */
|
|
9496
|
+
isAiPanelOpen?: boolean;
|
|
9497
|
+
/** Toggle the AI assistant panel. */
|
|
9498
|
+
onToggleAiPanel?: () => void;
|
|
9499
|
+
}
|
|
9500
|
+
//#endregion
|
|
9501
|
+
//#region src/viewer/utils/table-band-style.d.ts
|
|
9502
|
+
/** Context for resolving table style colours from the theme. */
|
|
9503
|
+
interface TableStyleContext {
|
|
9504
|
+
tableStyleMap?: ParsedTableStyleMap;
|
|
9505
|
+
theme?: PptxTheme;
|
|
9506
|
+
}
|
|
9507
|
+
//#endregion
|
|
9508
|
+
//#region src/viewer/components/canvas/canvas-types.d.ts
|
|
9509
|
+
interface ZoomViewport {
|
|
9510
|
+
canvasViewportRef: React$1__default.RefObject<HTMLDivElement | null>;
|
|
9511
|
+
editWrapperRef: React$1__default.RefObject<HTMLDivElement | null>;
|
|
9512
|
+
canvasStageRef: React$1__default.RefObject<HTMLDivElement | null>;
|
|
9513
|
+
editorScale: number;
|
|
9514
|
+
}
|
|
9515
|
+
interface SlideCanvasProps {
|
|
9516
|
+
activeSlide: PptxSlide | undefined;
|
|
9517
|
+
templateElements: PptxElement[];
|
|
9518
|
+
canvasSize: CanvasSize;
|
|
9519
|
+
zoom: ZoomViewport;
|
|
9520
|
+
mode: ViewerMode;
|
|
9521
|
+
canEdit: boolean;
|
|
9522
|
+
editTemplateMode: boolean;
|
|
9523
|
+
selectedElementIdSet: Set<string>;
|
|
9524
|
+
selectedElement: PptxElement | null;
|
|
9525
|
+
inlineEditingElementId: string | null;
|
|
9526
|
+
inlineEditingText: string;
|
|
9527
|
+
spellCheckEnabled: boolean;
|
|
9528
|
+
mediaDataUrls: Map<string, string>;
|
|
9529
|
+
tableEditorState: TableCellEditorState | null;
|
|
9530
|
+
marqueeSelectionState: MarqueeSelectionState | null;
|
|
9531
|
+
snapLines: Array<{
|
|
9532
|
+
axis: string;
|
|
9533
|
+
position: number;
|
|
9534
|
+
}>;
|
|
9535
|
+
showGrid: boolean;
|
|
9536
|
+
/** Grid spacing in CSS px (derived from PPTX gridSpacing EMUs). */
|
|
9537
|
+
gridSpacingPx?: number;
|
|
9538
|
+
showRulers: boolean;
|
|
9539
|
+
/** Unit system for rulers (default: inches). */
|
|
9540
|
+
rulerUnit?: RulerUnit;
|
|
9541
|
+
guides: Array<{
|
|
9542
|
+
id: string;
|
|
9543
|
+
axis: 'h' | 'v';
|
|
9544
|
+
position: number;
|
|
9545
|
+
}>;
|
|
9546
|
+
presentationElementStates?: Map<string, ElementAnimationState>;
|
|
9547
|
+
presentationKeyframesCss?: string;
|
|
9548
|
+
onClick: (elementId: string, e: React$1__default.MouseEvent) => void;
|
|
9549
|
+
onDoubleClick: (elementId: string, e: React$1__default.MouseEvent) => void;
|
|
9550
|
+
onMouseDown: (elementId: string, e: React$1__default.MouseEvent) => void;
|
|
9551
|
+
onContextMenu: (elementId: string, e: React$1__default.MouseEvent) => void;
|
|
9552
|
+
/** Called when the user presses mouse down on empty canvas space. */
|
|
9553
|
+
onCanvasMouseDown?: (e: React$1__default.MouseEvent) => void;
|
|
9554
|
+
onResizePointerDown: (elementId: string, e: React$1__default.MouseEvent, handle: string) => void;
|
|
9555
|
+
onAdjustmentPointerDown: (elementId: string, e: React$1__default.MouseEvent) => void;
|
|
9556
|
+
/** Commit a new rotation (degrees) when the on-canvas rotate handle is dragged. */
|
|
9557
|
+
onRotate?: (elementId: string, rotationDeg: number) => void;
|
|
9558
|
+
onInlineEditChange: (text: string) => void;
|
|
9559
|
+
onInlineEditCommit: () => void;
|
|
9560
|
+
onInlineEditCancel: () => void;
|
|
9561
|
+
onTableCellSelect: (cell: Omit<TableCellEditorState, 'elementId'> | null, elementId: string) => void;
|
|
9562
|
+
/** Called when an edited table cell should be committed. */
|
|
9563
|
+
onCommitCellEdit?: (elementId: string, rowIndex: number, colIndex: number, text: string) => void;
|
|
9564
|
+
/**
|
|
9565
|
+
* Commit a partial update to a SmartArt element from inline (on-canvas) node
|
|
9566
|
+
* editing. Routed to the same element-update path the inspector uses (undo/redo
|
|
9567
|
+
* + dirty marking). When absent, inline SmartArt editing is disabled.
|
|
9568
|
+
*/
|
|
9569
|
+
onUpdateSmartArtElement?: (elementId: string, updates: Partial<PptxElement>) => void;
|
|
9570
|
+
/**
|
|
9571
|
+
* Apply a text-style toggle (Ctrl/Cmd+B/I/U) to the element being
|
|
9572
|
+
* inline-edited. Routed to the same updateSelectedTextStyle path as the
|
|
9573
|
+
* toolbar. When absent, the inline formatting shortcuts are inert.
|
|
9574
|
+
*/
|
|
9575
|
+
onFormatText?: (updates: Partial<TextStyle>) => void;
|
|
9576
|
+
/** Called when table column widths are resized. */
|
|
9577
|
+
onResizeTableColumns?: (elementId: string, newWidths: number[]) => void;
|
|
9578
|
+
/** Called when a table row is resized. */
|
|
9579
|
+
onResizeTableRow?: (elementId: string, rowIndex: number, newHeight: number) => void;
|
|
9580
|
+
/** Find & Replace results (all matches across all slides). */
|
|
9581
|
+
findResults?: Array<{
|
|
9582
|
+
slideIndex: number;
|
|
9583
|
+
elementId: string;
|
|
9584
|
+
segmentIndex: number;
|
|
9585
|
+
startOffset: number;
|
|
9586
|
+
length: number;
|
|
9587
|
+
}>;
|
|
9588
|
+
/** Index of the currently focused find result (-1 for none). */
|
|
9589
|
+
findResultIndex?: number;
|
|
9590
|
+
/** Index of the currently visible slide (needed to filter find results). */
|
|
9591
|
+
activeSlideIndex?: number;
|
|
9592
|
+
/** Currently active drawing tool ("select" means no drawing overlay). */
|
|
9593
|
+
activeTool?: DrawingTool;
|
|
9594
|
+
/** Stroke colour for pen / highlighter. */
|
|
9595
|
+
drawingColor?: string;
|
|
9596
|
+
/** Stroke width for pen / highlighter. */
|
|
9597
|
+
drawingWidth?: number;
|
|
9598
|
+
/** Ref that is true while a pointer stroke is in progress. */
|
|
9599
|
+
isDrawingRef?: React$1__default.RefObject<boolean>;
|
|
9600
|
+
/** Called when a completed ink stroke should be added to the slide. */
|
|
9601
|
+
onAddInkElement?: (ink: InkPptxElement) => void;
|
|
9602
|
+
/** Called when a freeform drawing stroke should be added as a shape element. */
|
|
9603
|
+
onAddFreeformShape?: (shape: ShapePptxElement) => void;
|
|
9604
|
+
/** Called when the eraser tool removes an ink element. */
|
|
9605
|
+
onEraseInkElement?: (elementId: string) => void;
|
|
9606
|
+
/** Called when a shape-level action is clicked (e.g. slide jump, URL). */
|
|
9607
|
+
onActionClick?: (elementId: string, action: PptxAction) => void;
|
|
9608
|
+
/** Called when a text-level hyperlink is clicked. */
|
|
9609
|
+
onHyperlinkClick?: (url: string) => void;
|
|
9610
|
+
/** Comments for the current slide (used for on-canvas markers). */
|
|
9611
|
+
comments?: PptxComment[];
|
|
9612
|
+
/** Whether to show comment markers on the slide canvas. */
|
|
9613
|
+
showCommentMarkers?: boolean;
|
|
9614
|
+
/** Called when a comment marker is clicked. */
|
|
9615
|
+
onCommentMarkerClick?: (commentId: string) => void;
|
|
9616
|
+
onMoveGuide?: (guideId: string, position: number) => void;
|
|
9617
|
+
onDeleteGuide?: (guideId: string) => void;
|
|
9618
|
+
onCreateGuideFromRuler?: (axis: 'h' | 'v', positionPx: number) => void;
|
|
9619
|
+
/** When true, shows connection sites on shapes and enables connector drawing. */
|
|
9620
|
+
connectorCreationMode?: boolean;
|
|
9621
|
+
/** Called when a new connector is created between two shapes. */
|
|
9622
|
+
onCreateConnector?: (connector: ConnectorPptxElement) => void;
|
|
9623
|
+
/** All slides in the presentation (for zoom element thumbnails). */
|
|
9624
|
+
allSlides?: readonly PptxSlide[];
|
|
9625
|
+
/** Callback fired when a zoom element is clicked in presentation mode. */
|
|
9626
|
+
onZoomClick?: (targetSlideIndex: number, returnSlideIndex: number) => void;
|
|
9627
|
+
/** Index of the current slide (for zoom return navigation). */
|
|
9628
|
+
sourceSlideIndex?: number;
|
|
9629
|
+
/** Context for text field placeholder substitution (slide number, header/footer, etc.). */
|
|
9630
|
+
fieldContext?: FieldSubstitutionContext;
|
|
9631
|
+
/** Theme + table style map for resolving table band/header colours. */
|
|
9632
|
+
tableStyleContext?: TableStyleContext;
|
|
9633
|
+
/** Optional collaboration cursor overlay rendered on top of the canvas. */
|
|
9634
|
+
collaborationOverlay?: React$1__default.ReactNode;
|
|
9635
|
+
/**
|
|
9636
|
+
* When true, the stage marks itself `data-pptx-ai-active` so element colour
|
|
9637
|
+
* changes tween while the AI assistant is working (see AiFocusHighlightOverlay).
|
|
9638
|
+
*/
|
|
9639
|
+
aiActive?: boolean;
|
|
6831
9640
|
}
|
|
6832
9641
|
//#endregion
|
|
9642
|
+
//#region src/viewer/hooks/useAutosave.d.ts
|
|
9643
|
+
type AutosaveStatus = {
|
|
9644
|
+
state: 'idle';
|
|
9645
|
+
} | {
|
|
9646
|
+
state: 'disabled';
|
|
9647
|
+
reason: string;
|
|
9648
|
+
} | {
|
|
9649
|
+
state: 'saving';
|
|
9650
|
+
} | {
|
|
9651
|
+
state: 'saved';
|
|
9652
|
+
timestamp: number;
|
|
9653
|
+
} | {
|
|
9654
|
+
state: 'error';
|
|
9655
|
+
message: string;
|
|
9656
|
+
};
|
|
9657
|
+
//#endregion
|
|
6833
9658
|
//#region src/viewer/hooks/useViewerBuildingBlocks.d.ts
|
|
6834
9659
|
interface UseViewerBuildingBlocksInput {
|
|
6835
9660
|
/** PPTX content as ArrayBuffer/Uint8Array, or null/undefined while no file is loaded. */
|
|
@@ -6878,26 +9703,11 @@ interface ViewerBuildingBlocksResult {
|
|
|
6878
9703
|
}
|
|
6879
9704
|
declare function useViewerBuildingBlocks(input: UseViewerBuildingBlocksInput): ViewerBuildingBlocksResult;
|
|
6880
9705
|
|
|
6881
|
-
//#region src/viewer/utils/animation-effects.d.ts
|
|
6882
|
-
declare function getAnimationInitialStyle(preset: PptxAnimationPreset | undefined, nativeAnimation?: PptxNativeAnimation): React$1__default.CSSProperties;
|
|
6883
|
-
//#endregion
|
|
6884
|
-
//#region src/viewer/PowerPointViewer.d.ts
|
|
6885
|
-
/**
|
|
6886
|
-
* Root React component for the PowerPoint viewer/editor.
|
|
6887
|
-
*
|
|
6888
|
-
* Accepts binary `.pptx` content and renders a full-featured editor with
|
|
6889
|
-
* slide canvas, toolbar, inspector panels, presentation mode, and more.
|
|
6890
|
-
*
|
|
6891
|
-
* Uses `forwardRef` to expose a `PowerPointViewerHandle` for imperative
|
|
6892
|
-
* access (e.g. serialising the current content for saving).
|
|
6893
|
-
*/
|
|
6894
|
-
declare const PowerPointViewer: React$1.ForwardRefExoticComponent<PowerPointViewerProps & React$1.RefAttributes<PowerPointViewerHandle>>;
|
|
6895
|
-
|
|
6896
9706
|
//#region src/viewer/components/Toolbar.d.ts
|
|
6897
9707
|
declare function Toolbar(p: ToolbarProps): React$1__default.ReactElement;
|
|
6898
9708
|
//#endregion
|
|
6899
9709
|
//#region src/viewer/components/SlideCanvas.d.ts
|
|
6900
|
-
declare function SlideCanvas({ activeSlide, templateElements, canvasSize, zoom, mode, canEdit, editTemplateMode, selectedElementIdSet, selectedElement, inlineEditingElementId, inlineEditingText, spellCheckEnabled, mediaDataUrls, tableEditorState, marqueeSelectionState, snapLines, showGrid, gridSpacingPx, showRulers, rulerUnit, guides, presentationElementStates, presentationKeyframesCss, onClick, onDoubleClick, onMouseDown, onContextMenu, onCanvasMouseDown, onResizePointerDown, onAdjustmentPointerDown, onRotate, onInlineEditChange, onInlineEditCommit, onInlineEditCancel, onTableCellSelect, onCommitCellEdit, onUpdateSmartArtElement, onFormatText, onResizeTableColumns, onResizeTableRow, findResults, findResultIndex, activeSlideIndex, activeTool, drawingColor, drawingWidth, isDrawingRef, onAddInkElement, onAddFreeformShape, onEraseInkElement, onActionClick, onHyperlinkClick, comments, showCommentMarkers, onCommentMarkerClick, onMoveGuide, onDeleteGuide, onCreateGuideFromRuler, connectorCreationMode, onCreateConnector, allSlides, onZoomClick, sourceSlideIndex, fieldContext, tableStyleContext, collaborationOverlay }: SlideCanvasProps): React$1.JSX.Element;
|
|
9710
|
+
declare function SlideCanvas({ activeSlide, templateElements, canvasSize, zoom, mode, canEdit, editTemplateMode, selectedElementIdSet, selectedElement, inlineEditingElementId, inlineEditingText, spellCheckEnabled, mediaDataUrls, tableEditorState, marqueeSelectionState, snapLines, showGrid, gridSpacingPx, showRulers, rulerUnit, guides, presentationElementStates, presentationKeyframesCss, onClick, onDoubleClick, onMouseDown, onContextMenu, onCanvasMouseDown, onResizePointerDown, onAdjustmentPointerDown, onRotate, onInlineEditChange, onInlineEditCommit, onInlineEditCancel, onTableCellSelect, onCommitCellEdit, onUpdateSmartArtElement, onFormatText, onResizeTableColumns, onResizeTableRow, findResults, findResultIndex, activeSlideIndex, activeTool, drawingColor, drawingWidth, isDrawingRef, onAddInkElement, onAddFreeformShape, onEraseInkElement, onActionClick, onHyperlinkClick, comments, showCommentMarkers, onCommentMarkerClick, onMoveGuide, onDeleteGuide, onCreateGuideFromRuler, connectorCreationMode, onCreateConnector, allSlides, onZoomClick, sourceSlideIndex, fieldContext, tableStyleContext, collaborationOverlay, aiActive }: SlideCanvasProps): React$1.JSX.Element;
|
|
6901
9711
|
//#endregion
|
|
6902
9712
|
//#region src/lib/canvas-export.d.ts
|
|
6903
9713
|
/**
|
|
@@ -6919,4 +9729,4 @@ declare function SlideCanvas({ activeSlide, templateElements, canvasSize, zoom,
|
|
|
6919
9729
|
declare function renderToCanvas(element: HTMLElement, options?: Partial<Options>): Promise<HTMLCanvasElement>;
|
|
6920
9730
|
|
|
6921
9731
|
export { AVATAR_COLOR_SWATCHES, DEFAULT_VIEWER_PROFILE, LOCALE_CATALOG, PowerPointViewer, SlideCanvas, THEME_CATALOG, Toolbar, VIEWER_PREFS_STORAGE_KEY, ViewerThemeProvider, clearAllLocalViewerData, clearStoredViewerPrefs, defaultCssVars, defaultRadius, defaultThemeColors, getAnimationInitialStyle, getLocalStorageUsageSummary, readStoredViewerPrefs, renderToCanvas, resolveProfileInitial, resolveThemeCatalogEntry, saveViewerProfile, themeToCssVars, useViewerBuildingBlocks, useViewerTheme, vermilionDarkColors, vermilionDarkTheme, vermilionLightColors, vermilionLightTheme, vermilionRadius, writeStoredViewerPrefs };
|
|
6922
|
-
export type { AccountAuthConfig, LocalStorageUsageSummary, LocaleCatalogEntry, PowerPointViewerAPI, PowerPointViewerHandle, PowerPointViewerProps, SlideCanvasProps, StoredViewerPrefs, ThemeCatalogEntry, ToolbarActionId, ToolbarButtonId, ToolbarProps, ToolbarTabId, UseViewerBuildingBlocksInput, ViewerBuildingBlocksResult, ViewerMode, ViewerProfile, ViewerTheme, ViewerThemeColors };
|
|
9732
|
+
export type { AccountAuthConfig, LocalStorageUsageSummary, LocaleCatalogEntry, PowerPointViewerAPI, PowerPointViewerHandle, PowerPointViewerProps, PptxAiBridge, PptxAiConfig, PptxAiConnection, PptxAiContextStrategy, PptxAiToolName, PptxAiWritePolicy, SlideCanvasProps, StoredViewerPrefs, ThemeCatalogEntry, ToolbarActionId, ToolbarButtonId, ToolbarProps, ToolbarTabId, UseViewerBuildingBlocksInput, ViewerBuildingBlocksResult, ViewerMode, ViewerProfile, ViewerTheme, ViewerThemeColors };
|