pptx-react-viewer 1.24.0 → 1.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +46 -21
- package/dist/{Model3DScene-QTNGCODM.mjs → Model3DScene-E7YIHJ2R.mjs} +1 -1
- package/dist/Model3DScene-E7YIHJ2R.mjs.br +0 -0
- package/dist/Model3DScene-E7YIHJ2R.mjs.gz +0 -0
- package/dist/{Model3DScene-RD4XEC3F.js → Model3DScene-RYR4SSOM.js} +2 -2
- package/dist/Model3DScene-RYR4SSOM.js.br +0 -0
- package/dist/Model3DScene-RYR4SSOM.js.gz +0 -0
- package/dist/{SurfaceChart3DScene-YR3GX4X6.js → SurfaceChart3DScene-PBSZVNAM.js} +2 -2
- package/dist/SurfaceChart3DScene-PBSZVNAM.js.br +0 -0
- package/dist/SurfaceChart3DScene-PBSZVNAM.js.gz +0 -0
- package/dist/{SurfaceChart3DScene-VKS3ELTU.mjs → SurfaceChart3DScene-ZM3J67VQ.mjs} +1 -1
- package/dist/SurfaceChart3DScene-ZM3J67VQ.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-ZM3J67VQ.mjs.gz +0 -0
- package/dist/{chunk-I5SO5OV4.js → chunk-275WERXZ.js} +2 -1
- package/dist/chunk-275WERXZ.js.br +0 -0
- package/dist/{chunk-I5SO5OV4.js.gz → chunk-275WERXZ.js.gz} +0 -0
- package/dist/{chunk-GKST4OS7.js → chunk-DPTDFK2L.js} +428 -398
- package/dist/chunk-DPTDFK2L.js.br +0 -0
- package/dist/chunk-DPTDFK2L.js.gz +0 -0
- package/dist/{chunk-3YMK5VLS.js → chunk-KVTSERRP.js} +720 -716
- package/dist/chunk-KVTSERRP.js.br +0 -0
- package/dist/chunk-KVTSERRP.js.gz +0 -0
- package/dist/{chunk-KPT54MHG.mjs → chunk-MEVZNYJK.mjs} +2 -1
- package/dist/chunk-MEVZNYJK.mjs.br +0 -0
- package/dist/{chunk-KPT54MHG.mjs.gz → chunk-MEVZNYJK.mjs.gz} +0 -0
- package/dist/{chunk-YJVMOX2Y.mjs → chunk-UCFXE6YS.mjs} +38 -8
- package/dist/chunk-UCFXE6YS.mjs.br +0 -0
- package/dist/chunk-UCFXE6YS.mjs.gz +0 -0
- package/dist/{chunk-PUQ6GIOM.mjs → chunk-UDM2SYE3.mjs} +12 -8
- package/dist/chunk-UDM2SYE3.mjs.br +0 -0
- package/dist/chunk-UDM2SYE3.mjs.gz +0 -0
- package/dist/hooks-unstable.d.ts +24 -2
- package/dist/hooks-unstable.d.ts.map +1 -1
- package/dist/hooks-unstable.js +76 -76
- package/dist/hooks-unstable.js.br +0 -0
- package/dist/hooks-unstable.js.gz +0 -0
- package/dist/hooks-unstable.mjs +2 -2
- package/dist/hooks-unstable.mjs.br +0 -0
- package/dist/hooks-unstable.mjs.gz +0 -0
- package/dist/{index-hm2FF-FU.d.ts → index-waNAYwmr.d.ts} +10 -2
- package/dist/{index-hm2FF-FU.d.ts.map → index-waNAYwmr.d.ts.map} +1 -1
- package/dist/index.js +32 -32
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/viewer/index.js +19 -19
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +3 -3
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +1 -1
- package/dist/Model3DScene-QTNGCODM.mjs.br +0 -0
- package/dist/Model3DScene-QTNGCODM.mjs.gz +0 -0
- package/dist/Model3DScene-RD4XEC3F.js.br +0 -0
- package/dist/Model3DScene-RD4XEC3F.js.gz +0 -0
- package/dist/SurfaceChart3DScene-VKS3ELTU.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-VKS3ELTU.mjs.gz +0 -0
- package/dist/SurfaceChart3DScene-YR3GX4X6.js.br +0 -0
- package/dist/SurfaceChart3DScene-YR3GX4X6.js.gz +0 -0
- package/dist/chunk-3YMK5VLS.js.br +0 -0
- package/dist/chunk-3YMK5VLS.js.gz +0 -0
- package/dist/chunk-GKST4OS7.js.br +0 -0
- package/dist/chunk-GKST4OS7.js.gz +0 -0
- package/dist/chunk-I5SO5OV4.js.br +0 -0
- package/dist/chunk-KPT54MHG.mjs.br +0 -0
- package/dist/chunk-PUQ6GIOM.mjs.br +0 -0
- package/dist/chunk-PUQ6GIOM.mjs.gz +0 -0
- package/dist/chunk-YJVMOX2Y.mjs.br +0 -0
- package/dist/chunk-YJVMOX2Y.mjs.gz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to this project are documented here.
|
|
|
4
4
|
This file is generated from [Conventional Commits](https://www.conventionalcommits.org)
|
|
5
5
|
by [git-cliff](https://git-cliff.org); do not edit it by hand.
|
|
6
6
|
|
|
7
|
+
## [1.24.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-react-viewer@1.24.0) - 2026-07-18
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- **react:** Export Toolbar/SlideCanvas + useViewerBuildingBlocks hook (by @ChristopherVR) ([37220c3](https://github.com/ChristopherVR/pptx-viewer/commit/37220c3afa1f7eaf62ec9eaa6fca72ee6ab19d7d))
|
|
12
|
+
|
|
7
13
|
## [1.23.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-react-viewer@1.23.0) - 2026-07-18
|
|
8
14
|
|
|
9
15
|
### Dependencies
|
package/README.md
CHANGED
|
@@ -12,8 +12,6 @@ Slides render with real **HTML/CSS** (not `<canvas>`), so text stays crisp at an
|
|
|
12
12
|
|
|
13
13
|
<samp>**[▶️ Try the live demo](https://christophervr.github.io/pptx-viewer/demo/)** · **[📦 npm](https://www.npmjs.com/package/pptx-react-viewer)** · **[📖 Full docs](https://christophervr.github.io/pptx-viewer/)** · **[🧩 Core SDK](https://www.npmjs.com/package/pptx-viewer-core)**</samp>
|
|
14
14
|
|
|
15
|
-
> **[▶️ Try the live demo](https://christophervr.github.io/pptx-viewer/demo/)**: open a `.pptx` in your browser and view, edit, present, and export it. No install required.
|
|
16
|
-
|
|
17
15
|
---
|
|
18
16
|
|
|
19
17
|
## Install
|
|
@@ -29,7 +27,7 @@ npm install react react-dom framer-motion lucide-react react-icons jspdf jszip f
|
|
|
29
27
|
```
|
|
30
28
|
|
|
31
29
|
> The package is named **`pptx-react-viewer`** on npm. `pptx-viewer-core` (the engine) is **bundled in**, so you don't install it separately unless you want to call the SDK directly.
|
|
32
|
-
> **Optional:** `three`
|
|
30
|
+
> **Optional:** `three` (3D models/charts, 3D SmartArt) and `yjs` / `y-websocket` / `y-webrtc` (real-time collaboration) are declared as `optionalDependencies`, so npm installs them automatically when possible; the features degrade gracefully if they're absent.
|
|
33
31
|
|
|
34
32
|
## Quick start
|
|
35
33
|
|
|
@@ -40,11 +38,11 @@ import { PowerPointViewer } from 'pptx-react-viewer';
|
|
|
40
38
|
import 'pptx-react-viewer/styles';
|
|
41
39
|
|
|
42
40
|
export default function App() {
|
|
43
|
-
const [content, setContent] = useState<
|
|
41
|
+
const [content, setContent] = useState<Uint8Array | null>(null);
|
|
44
42
|
|
|
45
|
-
// Load any .pptx as
|
|
43
|
+
// Load any .pptx as bytes (fetch, <input type="file">, drag-drop, …)
|
|
46
44
|
const onPick = (e: React.ChangeEvent<HTMLInputElement>) =>
|
|
47
|
-
e.target.files?.[0]?.arrayBuffer().then(setContent);
|
|
45
|
+
e.target.files?.[0]?.arrayBuffer().then((buf) => setContent(new Uint8Array(buf)));
|
|
48
46
|
|
|
49
47
|
return (
|
|
50
48
|
<div style={{ height: '100vh' }}>
|
|
@@ -78,7 +76,7 @@ const bytes = await viewerRef.current?.getContent(); // Uint8Array of a valid .p
|
|
|
78
76
|
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
79
77
|
| **View** | Render slides with 16 element types: shapes, text, images, tables, 23 chart types, SmartArt, connectors, media, ink, OLE, 3D models, zoom |
|
|
80
78
|
| **Edit** | Insert/move/resize/delete elements, edit text inline, modify styles, manage slides |
|
|
81
|
-
| **Present** | Fullscreen slideshow with 40+ animations,
|
|
79
|
+
| **Present** | Fullscreen slideshow with 40+ animations, 46 transitions (including morph), speaker notes, presenter view with timer |
|
|
82
80
|
| **Export** | PNG/JPEG/SVG/PDF/GIF/video slide export, save-as PPTX |
|
|
83
81
|
| **Collaborate** | Real-time multi-user editing (powered by Yjs) with live presence, remote cursors, and user avatars |
|
|
84
82
|
| **Print** | Print dialog with handout layouts and notes page formatting with overflow pagination |
|
|
@@ -93,20 +91,37 @@ const bytes = await viewerRef.current?.getContent(); // Uint8Array of a valid .p
|
|
|
93
91
|
|
|
94
92
|
### `PowerPointViewer` props
|
|
95
93
|
|
|
96
|
-
| Prop
|
|
97
|
-
|
|
|
98
|
-
| `content`
|
|
99
|
-
| `filePath`
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
94
|
+
| Prop | Type | Default | Description |
|
|
95
|
+
| ---------------------- | --------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
96
|
+
| `content` | `Uint8Array` | required | Raw .pptx file bytes |
|
|
97
|
+
| `filePath` | `string` | n/a | Optional file path (for display and autosave recovery) |
|
|
98
|
+
| `fileName` | `string` | n/a | Display name of the open document, shown in the title bar |
|
|
99
|
+
| `className` | `string` | n/a | Class applied to the root element |
|
|
100
|
+
| `canEdit` | `boolean` | `false` | Enable editing mode |
|
|
101
|
+
| `fonts` | `ViewerFontSource[]` | n/a | Licensed font sources supplied by the host application |
|
|
102
|
+
| `authorName` | `string` | n/a | Author name for comments/annotations and collaboration presence |
|
|
103
|
+
| `collaboration` | `CollaborationConfig` | n/a | Yjs real-time collaboration config (server URL, room, role) |
|
|
104
|
+
| `shareDefaults` | `{ roomId?, userName?, serverUrl? }` | n/a | Seed values for the Share dialog fields |
|
|
105
|
+
| `smartArt3D` | `boolean` | `false` | Opt-in Three.js 3D SmartArt renderer (needs the optional `three` dependency; falls back to SVG without it) |
|
|
106
|
+
| `onOpenFile` | `() => void` | n/a | Host override for File > Open; bypasses the built-in file picker |
|
|
107
|
+
| `onContentChange` | `(content: Uint8Array) => void` | n/a | Called with freshly serialised `.pptx` bytes when the content changes |
|
|
108
|
+
| `onDirtyChange` | `(isDirty: boolean) => void` | n/a | Called when dirty state changes |
|
|
109
|
+
| `onActiveSlideChange` | `(index: number) => void` | n/a | Called when the active slide changes |
|
|
110
|
+
| `onModeChange` | `(mode: ViewerMode) => void` | n/a | Called when the viewer mode changes |
|
|
111
|
+
| `onZoomChange` | `(zoom: number) => void` | n/a | Called when the zoom level changes |
|
|
112
|
+
| `onSelectionChange` | `(ids: string[]) => void` | n/a | Called when element selection changes |
|
|
113
|
+
| `onSlideCountChange` | `(count: number) => void` | n/a | Called when the total slide count changes |
|
|
114
|
+
| `onStartCollaboration` | `(config: CollaborationConfig) => void` | n/a | Called when the user starts a collaboration session from the Share dialog |
|
|
115
|
+
| `onStopCollaboration` | `() => void` | n/a | Called when the collaboration session stops |
|
|
116
|
+
| `theme` | `ViewerTheme` | n/a | Theme configuration for customising colours, radius, and CSS vars |
|
|
117
|
+
| `hiddenActions` | `ToolbarActionId[]` | n/a | Hide individual toolbar buttons and/or ribbon tabs (e.g. `['share', 'broadcast']`) instead of the whole toolbar; omitted hides nothing |
|
|
118
|
+
| `defaultThemeKey` | `string` | n/a | Initial File > Options > Appearance selection when no persisted preference exists |
|
|
119
|
+
| `availableThemes` | `ThemeCatalogEntry[]` | n/a | Theme choices offered by File > Options > Appearance (defaults to the built-in catalog) |
|
|
120
|
+
| `onThemeChange` | `(key: string) => void` | n/a | Host hook for the appearance picker; when set, the host owns persisting the choice |
|
|
121
|
+
| `defaultLocale` | `string` | n/a | Initial locale code when no persisted preference exists |
|
|
122
|
+
| `availableLocales` | `LocaleCatalogEntry[]` | n/a | Locale choices offered by File > Options > Language (defaults to the registered i18next locales) |
|
|
123
|
+
| `onLocaleChange` | `(code: string) => void` | n/a | Host hook for the language picker; when set, the host owns applying/persisting the switch |
|
|
124
|
+
| `accountAuth` | `AccountAuthConfig` | n/a | Optional sign-in hook point for File > Account (disabled unless `enabled: true`) |
|
|
110
125
|
|
|
111
126
|
### `PowerPointViewerHandle` (via `ref`)
|
|
112
127
|
|
|
@@ -134,6 +149,15 @@ const bytes = await viewerRef.current?.getContent(); // Uint8Array of a valid .p
|
|
|
134
149
|
| `selectElements` | `(ids: string[]) => void` | Programmatically select elements by ID |
|
|
135
150
|
| `clearSelection` | `() => void` | Clear the current selection |
|
|
136
151
|
|
|
152
|
+
The handle implements the full shared `PowerPointViewerAPI`, so the following
|
|
153
|
+
slide/element manipulation methods are also available:
|
|
154
|
+
`setActiveSlideIndex(index)`, `getSlides()`, `getSlide(index)`,
|
|
155
|
+
`getActiveSlide()`, `addSlide(afterIndex?)`, `deleteSlides(indexes)`,
|
|
156
|
+
`duplicateSlides(indexes)`, `moveSlide(from, to)`, `toggleHideSlides(indexes)`,
|
|
157
|
+
`getElements(slideIndex?)`, `getElementById(id, slideIndex?)`,
|
|
158
|
+
`updateElement(id, patch)`, `deleteElements(ids)`, and
|
|
159
|
+
`duplicateElement(id)`.
|
|
160
|
+
|
|
137
161
|
### `renderToCanvas`
|
|
138
162
|
|
|
139
163
|
Standalone utility for rendering a DOM element to a Canvas (with an oklch colour-space workaround):
|
|
@@ -152,6 +176,7 @@ const canvas = await renderToCanvas(element, options); // => HTMLCanvasElement
|
|
|
152
176
|
import { Toolbar, SlideCanvas, useViewerBuildingBlocks } from 'pptx-react-viewer';
|
|
153
177
|
|
|
154
178
|
function MyCustomViewer({ content }: { content: Uint8Array }) {
|
|
179
|
+
// Also returned: `mode` (current ViewerMode) and `autosaveStatus`
|
|
155
180
|
const { toolbarProps, canvasProps, loading, error } = useViewerBuildingBlocks({
|
|
156
181
|
content,
|
|
157
182
|
canEdit: true,
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk275WERXZ_js = require('./chunk-275WERXZ.js');
|
|
4
4
|
require('./chunk-KV3EOLP3.js');
|
|
5
5
|
require('./chunk-QGM4M3NI.js');
|
|
6
6
|
var react = require('react');
|
|
@@ -15,7 +15,7 @@ function Model3DScene({ modelUrl, interactive, width, height }) {
|
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
let disposed = false;
|
|
18
|
-
void
|
|
18
|
+
void chunk275WERXZ_js.mountModel3D(container, modelUrl, { width, height, interactive }).then((handle) => {
|
|
19
19
|
if (disposed) {
|
|
20
20
|
handle.dispose();
|
|
21
21
|
} else {
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk275WERXZ_js = require('./chunk-275WERXZ.js');
|
|
4
4
|
require('./chunk-KV3EOLP3.js');
|
|
5
5
|
require('./chunk-QGM4M3NI.js');
|
|
6
6
|
var react = require('react');
|
|
@@ -26,7 +26,7 @@ function SurfaceChart3DScene({
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
let disposed = false;
|
|
29
|
-
void
|
|
29
|
+
void chunk275WERXZ_js.mountSurfaceChart3D(container, {
|
|
30
30
|
cols,
|
|
31
31
|
rows,
|
|
32
32
|
heightMap,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -14822,7 +14822,8 @@ function decodeDelta(delta) {
|
|
|
14822
14822
|
} catch {
|
|
14823
14823
|
}
|
|
14824
14824
|
}
|
|
14825
|
-
|
|
14825
|
+
const isBreakMarker = op.insert === "\n" && (a.pb === "1" || a.lb === "1");
|
|
14826
|
+
if (!isBreakMarker && op.insert !== "\u200B") {
|
|
14826
14827
|
seg.text = op.insert;
|
|
14827
14828
|
}
|
|
14828
14829
|
segments.push(seg);
|
|
Binary file
|
|
Binary file
|