pptx-angular-viewer 1.29.0 → 1.30.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 +12 -0
- package/README.md +121 -23
- package/fesm2022/pptx-angular-viewer.mjs +28527 -28466
- package/fesm2022/pptx-angular-viewer.mjs.map +1 -1
- package/package.json +2 -2
- package/types/pptx-angular-viewer.d.ts +769 -722
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ 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.30.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-angular-viewer@1.30.0) - 2026-07-18
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- **angular:** Promote RibbonComponent for independent composition (by @ChristopherVR) ([00ab33e](https://github.com/ChristopherVR/pptx-viewer/commit/00ab33e515857cd60a5aef01537c1024297e08e5))
|
|
12
|
+
|
|
13
|
+
## [1.29.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-angular-viewer@1.29.0) - 2026-07-18
|
|
14
|
+
|
|
15
|
+
### Dependencies
|
|
16
|
+
|
|
17
|
+
- **deps:** Update dependencies to latest and migrate core/shared/locales to TypeScript 7 (by @ChristopherVR) ([cc72948](https://github.com/ChristopherVR/pptx-viewer/commit/cc729482cc5ae4ae56e1219f290c2953ec83c12a))
|
|
18
|
+
|
|
7
19
|
## [1.28.1](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-angular-viewer@1.28.1) - 2026-07-18
|
|
8
20
|
|
|
9
21
|
## [1.28.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-angular-viewer@1.28.0) - 2026-07-18
|
package/README.md
CHANGED
|
@@ -14,8 +14,6 @@ The rendering is done by the framework-agnostic [`pptx-viewer-core`](https://www
|
|
|
14
14
|
|
|
15
15
|
<samp>**[▶️ Try the live demo](https://christophervr.github.io/pptx-viewer/demo-angular/)** · **[📦 npm](https://www.npmjs.com/package/pptx-angular-viewer)** · **[📖 Full docs](https://christophervr.github.io/pptx-viewer/)** · **[🧩 Core SDK](https://www.npmjs.com/package/pptx-viewer-core)**</samp>
|
|
16
16
|
|
|
17
|
-
> **[▶️ Try the live demo](https://christophervr.github.io/pptx-viewer/demo-angular/)**: open a `.pptx` and render it in your browser, no install required.
|
|
18
|
-
|
|
19
17
|
## Features
|
|
20
18
|
|
|
21
19
|
- **Standalone component**: `<pptx-viewer>`, no NgModule needed.
|
|
@@ -48,7 +46,18 @@ The rendering is done by the framework-agnostic [`pptx-viewer-core`](https://www
|
|
|
48
46
|
npm install pptx-angular-viewer
|
|
49
47
|
```
|
|
50
48
|
|
|
51
|
-
**Peer requirements:** Angular 22+ (`@angular/core`, `@angular/common`)
|
|
49
|
+
**Peer requirements:** Angular 22+ (`@angular/core`, `@angular/common`), `rxjs`,
|
|
50
|
+
and `@ngx-translate/core` (all UI labels go through it, see
|
|
51
|
+
[Localization](#localization-i18n)):
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install @angular/core @angular/common rxjs @ngx-translate/core
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Optional peers:** `three` enables interactive GLB/GLTF 3D models and the
|
|
58
|
+
`smartArt3D` renderer; `yjs` + `y-websocket` (or `y-webrtc` for serverless
|
|
59
|
+
peer-to-peer) enable real-time collaboration. Without them those features
|
|
60
|
+
degrade gracefully (poster images, no live session).
|
|
52
61
|
|
|
53
62
|
## Usage
|
|
54
63
|
|
|
@@ -141,30 +150,107 @@ async save() {
|
|
|
141
150
|
}
|
|
142
151
|
```
|
|
143
152
|
|
|
153
|
+
### Composing your own custom viewer host
|
|
154
|
+
|
|
155
|
+
`<pptx-viewer>` (`PowerPointViewerComponent`) is the bundled, batteries-included
|
|
156
|
+
chrome, but its building blocks are curated exports too, so you can compose
|
|
157
|
+
your own host component instead: bring your own layout/toolbar and reuse the
|
|
158
|
+
ribbon and slide canvas directly, wired to the same shared DI state via
|
|
159
|
+
`POWER_POINT_VIEWER_PROVIDERS`, the exact provider list `PowerPointViewerComponent`
|
|
160
|
+
itself uses.
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
import { Component, inject, signal } from '@angular/core';
|
|
164
|
+
import {
|
|
165
|
+
DEFAULT_CANVAS_HEIGHT,
|
|
166
|
+
DEFAULT_CANVAS_WIDTH,
|
|
167
|
+
EditorStateService,
|
|
168
|
+
LoadContentService,
|
|
169
|
+
POWER_POINT_VIEWER_PROVIDERS,
|
|
170
|
+
RibbonComponent,
|
|
171
|
+
SlideCanvasComponent,
|
|
172
|
+
} from 'pptx-angular-viewer';
|
|
173
|
+
|
|
174
|
+
@Component({
|
|
175
|
+
selector: 'my-custom-viewer',
|
|
176
|
+
standalone: true,
|
|
177
|
+
providers: [...POWER_POINT_VIEWER_PROVIDERS],
|
|
178
|
+
imports: [RibbonComponent, SlideCanvasComponent],
|
|
179
|
+
template: `
|
|
180
|
+
<pptx-ribbon
|
|
181
|
+
[slideIndex]="loader.activeSlideIndex()"
|
|
182
|
+
[slideCount]="editor.slides().length"
|
|
183
|
+
[canEdit]="true"
|
|
184
|
+
(save)="onSave()"
|
|
185
|
+
/>
|
|
186
|
+
<pptx-slide-canvas
|
|
187
|
+
[slide]="editor.slides()[loader.activeSlideIndex()]"
|
|
188
|
+
[canvasSize]="{ width: DEFAULT_CANVAS_WIDTH, height: DEFAULT_CANVAS_HEIGHT }"
|
|
189
|
+
[editable]="true"
|
|
190
|
+
/>
|
|
191
|
+
`,
|
|
192
|
+
})
|
|
193
|
+
export class MyCustomViewerComponent {
|
|
194
|
+
protected readonly loader = inject(LoadContentService);
|
|
195
|
+
protected readonly editor = inject(EditorStateService);
|
|
196
|
+
protected readonly DEFAULT_CANVAS_WIDTH = DEFAULT_CANVAS_WIDTH;
|
|
197
|
+
protected readonly DEFAULT_CANVAS_HEIGHT = DEFAULT_CANVAS_HEIGHT;
|
|
198
|
+
|
|
199
|
+
onSave() {
|
|
200
|
+
/* ... */
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
`RibbonComponent` and `SlideCanvasComponent` are plain, DI-free `input()`/`output()`
|
|
206
|
+
signal components (the ribbon renders ~90 bindings for the full Office-style tab
|
|
207
|
+
set; the snippet above shows an illustrative subset, not the exhaustive list),
|
|
208
|
+
so this recipe scales down too: provide only the services the pieces you use
|
|
209
|
+
actually need instead of the full `POWER_POINT_VIEWER_PROVIDERS` list, as long
|
|
210
|
+
as you cover whatever `inject()` calls those pieces make (`EditorStateService`
|
|
211
|
+
and `LoadContentService` are the two nearly everything depends on).
|
|
212
|
+
|
|
144
213
|
## API
|
|
145
214
|
|
|
146
215
|
### Inputs
|
|
147
216
|
|
|
148
|
-
| Input
|
|
149
|
-
|
|
|
150
|
-
| `content`
|
|
151
|
-
| `theme`
|
|
152
|
-
| `class`
|
|
153
|
-
| `canEdit`
|
|
154
|
-
| `
|
|
155
|
-
| `
|
|
217
|
+
| Input | Type | Default | Description |
|
|
218
|
+
| ------------------ | ------------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
219
|
+
| `content` | `Uint8Array \| ArrayBuffer \| null` | `null` | The `.pptx` bytes to render. |
|
|
220
|
+
| `theme` | `ViewerTheme` | n/a | Color/radius overrides applied as CSS custom properties. Always wins over the File > Options theme picker. |
|
|
221
|
+
| `class` | `string` | `''` | Class applied to the root element. |
|
|
222
|
+
| `canEdit` | `boolean` | `false` | Enables the editor toolbar, inspector, and drag-and-drop editing. |
|
|
223
|
+
| `filePath` | `string` | n/a | Host file path/identifier keying the version-history store. |
|
|
224
|
+
| `fileName` | `string` | n/a | Display name of the open document, shown in the title bar. |
|
|
225
|
+
| `fonts` | `ViewerFontSource[]` | `[]` | Licensed font sources supplied by the host application. |
|
|
226
|
+
| `authorName` | `string` | n/a | Display name for the local user in collaboration/broadcast sessions and presence avatars. |
|
|
227
|
+
| `collaboration` | `CollaborationConfig` | n/a | Yjs real-time collaboration config (server URL, room, role). |
|
|
228
|
+
| `shareDefaults` | `{ roomId?, userName?, serverUrl? }` | n/a | Seed values for the Share dialog's start form. |
|
|
229
|
+
| `onOpenFile` | `() => void` | n/a | Host override for File > Open; bypasses the built-in file picker. |
|
|
230
|
+
| `smartArt3D` | `boolean` | `false` | Opt-in Three.js 3D SmartArt renderer (needs the optional `three` peer; falls back to SVG without it). |
|
|
231
|
+
| `hiddenActions` | `ToolbarActionId[]` | `[]` | Toolbar buttons/ribbon tabs to hide individually (e.g. `['share', 'broadcast']`), instead of hiding the whole toolbar. |
|
|
232
|
+
| `defaultThemeKey` | `string` | n/a | Initial File > Options > Appearance selection when no persisted preference exists. |
|
|
233
|
+
| `availableThemes` | `ThemeCatalogEntry[]` | n/a | Theme choices offered by File > Options > Appearance (defaults to the built-in catalog). |
|
|
234
|
+
| `onThemeChange` | `(key: string) => void` | n/a | Host hook for the appearance picker; when set, the host owns persisting the choice. |
|
|
235
|
+
| `defaultLocale` | `string` | n/a | Initial locale code when no persisted preference exists. |
|
|
236
|
+
| `availableLocales` | `LocaleCatalogEntry[]` | n/a | Locale choices offered by File > Options > Language (defaults to the registered `TranslateService` languages). |
|
|
237
|
+
| `onLocaleChange` | `(code: string) => void` | n/a | Host hook for the language picker; when set, the host owns applying/persisting the switch. |
|
|
238
|
+
| `accountAuth` | `AccountAuthConfig` | n/a | Optional sign-in hook point for File > Account (disabled unless `enabled: true`). |
|
|
156
239
|
|
|
157
240
|
### Outputs
|
|
158
241
|
|
|
159
|
-
| Output
|
|
160
|
-
|
|
|
161
|
-
| `activeSlideChange`
|
|
162
|
-
| `dirtyChange`
|
|
163
|
-
| `contentChange`
|
|
164
|
-
| `modeChange`
|
|
165
|
-
| `zoomChange`
|
|
166
|
-
| `selectionChange`
|
|
167
|
-
| `slideCountChange`
|
|
242
|
+
| Output | Payload | Description |
|
|
243
|
+
| -------------------- | ----------------------------- | -------------------------------------------------------------------- |
|
|
244
|
+
| `activeSlideChange` | `number` | Emits the active slide index on navigation. |
|
|
245
|
+
| `dirtyChange` | `boolean` | Emits `true`/`false` when the dirty state changes. |
|
|
246
|
+
| `contentChange` | `Uint8Array` | Emits updated bytes after any editing change. |
|
|
247
|
+
| `modeChange` | `string` | Emits the new mode (`'preview'`, `'edit'`, `'present'`, `'master'`). |
|
|
248
|
+
| `zoomChange` | `number` | Emits the new zoom level (1 = 100%). |
|
|
249
|
+
| `selectionChange` | `string[]` | Emits the selected element IDs when selection changes. |
|
|
250
|
+
| `slideCountChange` | `number` | Emits the total slide count when slides change. |
|
|
251
|
+
| `propertiesChange` | `Partial<PptxCoreProperties>` | Emits when the user edits document properties in the Info dialog. |
|
|
252
|
+
| `startCollaboration` | `CollaborationConfig` | Emits when a collaboration/broadcast session starts. |
|
|
253
|
+
| `stopCollaboration` | `void` | Emits when the collaboration/broadcast session stops. |
|
|
168
254
|
|
|
169
255
|
### Methods
|
|
170
256
|
|
|
@@ -192,11 +278,23 @@ async save() {
|
|
|
192
278
|
| `selectElements(ids)` | `void` | Programmatically select elements by ID. |
|
|
193
279
|
| `clearSelection()` | `void` | Clear the current selection. |
|
|
194
280
|
|
|
281
|
+
The component implements the full shared `PowerPointViewerAPI`, so the
|
|
282
|
+
following slide/element manipulation methods are also available:
|
|
283
|
+
`setActiveSlideIndex(index)`, `getSlides()`, `getSlide(index)`,
|
|
284
|
+
`getActiveSlide()`, `addSlide(afterIndex?)`, `deleteSlides(indexes)`,
|
|
285
|
+
`duplicateSlides(indexes)`, `moveSlide(from, to)`, `toggleHideSlides(indexes)`,
|
|
286
|
+
`getElements(slideIndex?)`, `getElementById(id, slideIndex?)`,
|
|
287
|
+
`updateElement(id, patch)`, `deleteElements(ids)`, and
|
|
288
|
+
`duplicateElement(id)`.
|
|
289
|
+
|
|
195
290
|
### Exported components & helpers
|
|
196
291
|
|
|
197
|
-
`PowerPointViewerComponent`, `SlideCanvasComponent`, `
|
|
198
|
-
`
|
|
199
|
-
`
|
|
292
|
+
`PowerPointViewerComponent`, `SlideCanvasComponent`, `RibbonComponent`,
|
|
293
|
+
`ElementRendererComponent`, `LoadContentService`, `POWER_POINT_VIEWER_PROVIDERS`,
|
|
294
|
+
`provideViewerTheme`, `VIEWER_THEME`, and the `ViewerTheme` / `CanvasSize` /
|
|
295
|
+
`CollaborationConfig` types. See "Composing your own custom viewer host" above
|
|
296
|
+
for using `RibbonComponent` and `SlideCanvasComponent` outside
|
|
297
|
+
`PowerPointViewerComponent`.
|
|
200
298
|
|
|
201
299
|
## Localization (i18n)
|
|
202
300
|
|