pptx-svelte-viewer 0.1.1 → 0.1.3

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.
@@ -554,6 +554,17 @@ declare interface EncryptionOptions {
554
554
  spinCount?: number;
555
555
  }
556
556
 
557
+ /** Options for the multi-slide PDF export (progress + cooperative cancel). */
558
+ declare interface ExportPdfOptions {
559
+ /** Capture-phase progress callback: `(currentSlide, totalSlides)`. */
560
+ onProgress?: ExportProgress;
561
+ /** Abort the export early; the loop checks this between slides. */
562
+ signal?: AbortSignal;
563
+ }
564
+
565
+ /** Per-slide progress callback: `(currentSlideIndex, totalSlides)`. */
566
+ declare type ExportProgress = (current: number, total: number) => void;
567
+
557
568
  declare type FillInput = {
558
569
  type: 'solid';
559
570
  color: string;
@@ -1257,7 +1268,42 @@ declare interface PlaceholderTextLevelStyle {
1257
1268
  * Re-exporting through this annotated constant keeps the published `.d.ts`
1258
1269
  * fully typed regardless of which compiler produced it.
1259
1270
  */
1260
- export declare const PowerPointViewer: Component<PowerPointViewerProps>;
1271
+ export declare const PowerPointViewer: Component<PowerPointViewerProps, PowerPointViewerApi>;
1272
+
1273
+ /**
1274
+ * Imperative editing API exposed on the `<PowerPointViewer>` component
1275
+ * instance (via `bind:this`). Mirrors the vanilla binding's `EditorController`
1276
+ * surface subset the host drives directly.
1277
+ */
1278
+ export declare interface PowerPointViewerApi {
1279
+ /** Undo the last committed edit. */
1280
+ undo(): void;
1281
+ /** Redo the last undone edit. */
1282
+ redo(): void;
1283
+ /** Whether an undo step is available (snapshot; not reactive). */
1284
+ canUndo(): boolean;
1285
+ /** Whether a redo step is available (snapshot; not reactive). */
1286
+ canRedo(): boolean;
1287
+ /** Delete the selected element (no-op when nothing is selected). */
1288
+ deleteSelected(): void;
1289
+ /** The selected top-level element id, or null. */
1290
+ getSelectedElementId(): string | null;
1291
+ /** Serialize the edited slides to `.pptx` bytes via the core handler. */
1292
+ save(): Promise<Uint8Array>;
1293
+ /** Save + trigger a browser download of the `.pptx` (default name). */
1294
+ downloadPptx(fileName?: string): Promise<void>;
1295
+ /**
1296
+ * Export a slide as a PNG download (defaults to the current slide). Renders
1297
+ * the slide off-screen at scale 1 and rasterises it with `html2canvas-pro`
1298
+ * (dynamically imported), so the first call pays a one-time load cost.
1299
+ */
1300
+ exportSlidePng(index?: number): Promise<void>;
1301
+ /**
1302
+ * Export every slide as a multi-page PDF download (one slide per page).
1303
+ * `jspdf` is dynamically imported on first use.
1304
+ */
1305
+ exportPdf(options?: ExportPdfOptions): Promise<void>;
1306
+ }
1261
1307
 
1262
1308
  /** Props for `<PowerPointViewer>`. */
1263
1309
  export declare interface PowerPointViewerProps {
@@ -1277,6 +1323,28 @@ export declare interface PowerPointViewerProps {
1277
1323
  showThumbnails?: boolean;
1278
1324
  /** Show the navigation/zoom toolbar. Default true. */
1279
1325
  showToolbar?: boolean;
1326
+ /**
1327
+ * Show the speaker-notes panel and its toolbar toggle. Default true. The
1328
+ * panel is plain-text only and reads the active slide's notes; pass
1329
+ * `onnotesupdate` to make it editable (omitting it renders read-only).
1330
+ */
1331
+ showNotes?: boolean;
1332
+ /**
1333
+ * Opt in to the experimental Three.js (WebGL) SmartArt renderer for
1334
+ * `smartArt` elements, in place of the default SVG renderer. Requires the
1335
+ * optional `three` peer dependency; when it is unavailable, or a diagram
1336
+ * has no renderable nodes, or the WebGL mount fails, the SVG renderer is
1337
+ * used automatically. Default false.
1338
+ */
1339
+ smartArt3D?: boolean;
1340
+ /**
1341
+ * Enable in-place editing: click to select an element, drag to move, use the
1342
+ * 8 handles to resize (Shift locks aspect) and the rotate handle to rotate,
1343
+ * double-click text/shapes to edit their text, and the keyboard for
1344
+ * delete/duplicate/nudge/undo/redo. Adds an Undo/Redo/Save/Download group to
1345
+ * the toolbar. Default false (read-only viewer).
1346
+ */
1347
+ editable?: boolean;
1280
1348
  /** Optional class name applied to the root element. */
1281
1349
  class?: string;
1282
1350
  /** Fired after a presentation finishes loading. */
@@ -1285,6 +1353,20 @@ export declare interface PowerPointViewerProps {
1285
1353
  onerror?: (message: string) => void;
1286
1354
  /** Fired when the active slide changes (0-based index). */
1287
1355
  onslidechange?: (index: number) => void;
1356
+ /**
1357
+ * Fired with the committed plain-text speaker notes when the user edits
1358
+ * the notes panel (on `change` / `blur`). This binding has no built-in
1359
+ * slide-mutation channel, so the host is responsible for writing the text
1360
+ * back onto its own copy of the slide; omit this to render the notes
1361
+ * panel read-only.
1362
+ */
1363
+ onnotesupdate?: (notes: string) => void;
1364
+ /**
1365
+ * Fired after every committed editing mutation (move / resize / rotate /
1366
+ * delete / duplicate / nudge / inline text / notes) when `editable`. Use it
1367
+ * to track the dirty state or mirror edits into host state.
1368
+ */
1369
+ onchange?: () => void;
1288
1370
  }
1289
1371
 
1290
1372
  /**
@@ -1,4 +1,4 @@
1
- import { a, c as o, i as t, n as r, o as s, r as i, s as n, t as c } from "../component-CacEu31z.js";
1
+ import { a, c as o, i as t, n as r, o as s, r as i, s as n, t as c } from "../component-DxQFSCeR.js";
2
2
  export {
3
3
  c as PowerPointViewer,
4
4
  o as PresentationLoader,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptx-svelte-viewer",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Svelte 5 PowerPoint viewer component: render PPTX slides in the browser.",
5
5
  "keywords": [
6
6
  "office",
@@ -62,12 +62,14 @@
62
62
  "test:watch": "vitest",
63
63
  "pack": "bun run build && bun pm pack"
64
64
  },
65
+ "dependencies": {
66
+ "html2canvas-pro": "^2.0.4",
67
+ "jspdf": "^4.2.1"
68
+ },
65
69
  "devDependencies": {
66
70
  "@microsoft/api-extractor": "^7.53.1",
67
71
  "@sveltejs/vite-plugin-svelte": "^7.2.0",
68
72
  "happy-dom": "^20.10.6",
69
- "pptx-viewer-core": "workspace:*",
70
- "pptx-viewer-shared": "workspace:*",
71
73
  "svelte": "^5.46.4",
72
74
  "svelte-check": "^4.7.2",
73
75
  "typescript": "^6.0.3",
@@ -79,5 +81,8 @@
79
81
  "fast-xml-parser": "^5.8.0",
80
82
  "jszip": "^3.10.1",
81
83
  "svelte": "^5.0.0"
84
+ },
85
+ "optionalDependencies": {
86
+ "three": "^0.185.1"
82
87
  }
83
88
  }