pptx-react-viewer 1.0.0 → 1.0.8
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/LICENSE +21 -0
- package/NOTICE +16 -0
- package/README.md +8 -208
- package/dist/pptx-viewer.css +2 -2
- package/node_modules/emf-converter/LICENSE +21 -0
- package/node_modules/emf-converter/README.md +9 -260
- package/node_modules/emf-converter/package.json +12 -1
- package/node_modules/mtx-decompressor/LICENSE +373 -0
- package/node_modules/mtx-decompressor/README.md +1 -1
- package/node_modules/mtx-decompressor/package.json +8 -1
- package/node_modules/pptx-viewer-core/LICENSE +21 -0
- package/node_modules/pptx-viewer-core/NOTICE +16 -0
- package/node_modules/pptx-viewer-core/README.md +9 -267
- package/node_modules/pptx-viewer-core/dist/cli/index.js +3 -1
- package/node_modules/pptx-viewer-core/dist/cli/index.mjs +3 -1
- package/node_modules/pptx-viewer-core/dist/index.d.mts +3 -6
- package/node_modules/pptx-viewer-core/dist/index.d.ts +3 -6
- package/node_modules/pptx-viewer-core/dist/index.js +181 -1
- package/node_modules/pptx-viewer-core/dist/index.mjs +160 -2
- package/node_modules/pptx-viewer-core/dist/signature-inspection-status-DDKhc1bm.d.mts +209 -0
- package/node_modules/pptx-viewer-core/dist/signature-inspection-status-DDKhc1bm.d.ts +209 -0
- package/node_modules/pptx-viewer-core/dist/signature-node/index.d.mts +177 -0
- package/node_modules/pptx-viewer-core/dist/signature-node/index.d.ts +177 -0
- package/node_modules/pptx-viewer-core/dist/signature-node/index.js +1192 -0
- package/node_modules/pptx-viewer-core/dist/signature-node/index.mjs +1131 -0
- package/node_modules/pptx-viewer-core/package.json +38 -3
- package/package.json +16 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present pptx-viewer contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
pptx-viewer
|
|
2
|
+
Copyright (c) 2025-present pptx-viewer contributors
|
|
3
|
+
|
|
4
|
+
This package is licensed under the MIT License. See the LICENSE file for details.
|
|
5
|
+
|
|
6
|
+
This package bundles the following component under a different license:
|
|
7
|
+
|
|
8
|
+
mtx-decompressor — MicroType Express (MTX) font decompressor
|
|
9
|
+
License: Mozilla Public License 2.0 (MPL-2.0)
|
|
10
|
+
Source: https://github.com/ChristopherVR/pptx-viewer/tree/main/packages/mtx-decompressor
|
|
11
|
+
Origin: Ported from libeot (https://github.com/nicowilliams/libeot)
|
|
12
|
+
by Brennan T. Vincent, licensed under MPL-2.0.
|
|
13
|
+
|
|
14
|
+
Under MPL-2.0, the source code of the mtx-decompressor component remains
|
|
15
|
+
available under the terms of the Mozilla Public License 2.0. The full text
|
|
16
|
+
of the MPL-2.0 can be found at: https://mozilla.org/MPL/2.0/
|
package/README.md
CHANGED
|
@@ -296,123 +296,17 @@ import {
|
|
|
296
296
|
|
|
297
297
|
### High-Level Component Tree
|
|
298
298
|
|
|
299
|
-
|
|
300
|
-
flowchart TB
|
|
301
|
-
PPV["PowerPointViewer<br/>(root orchestrator)"]
|
|
302
|
-
|
|
303
|
-
PPV --> VTS["ViewerToolbarSection<br/>Toolbar + ModeSwitcher"]
|
|
304
|
-
PPV --> VMC["ViewerMainContent<br/>Canvas + sidebars + inspector"]
|
|
305
|
-
PPV --> VBP["ViewerBottomPanels<br/>Notes + status bar"]
|
|
306
|
-
PPV --> VDG["ViewerDialogGroup<br/>All modal dialogs"]
|
|
307
|
-
PPV --> VO["ViewerOverlays<br/>Shortcuts, accessibility, slide sorter"]
|
|
308
|
-
PPV --> VPL["ViewerPresentationLayer<br/>Fullscreen slideshow"]
|
|
309
|
-
|
|
310
|
-
VMC --> VSP["ViewerSidePanels<br/>Slides pane + master pane"]
|
|
311
|
-
VMC --> VCA["ViewerCanvasArea<br/>SlideCanvas + overlays"]
|
|
312
|
-
VMC --> VI["ViewerInspector<br/>Properties panel"]
|
|
313
|
-
|
|
314
|
-
VCA --> SC["SlideCanvas<br/>Main slide rendering"]
|
|
315
|
-
SC --> ER["ElementRenderer<br/>Per-element dispatch"]
|
|
316
|
-
ER --> SH["Shape / Text"]
|
|
317
|
-
ER --> IM["Image"]
|
|
318
|
-
ER --> TB["Table"]
|
|
319
|
-
ER --> CH["Chart (SVG)"]
|
|
320
|
-
ER --> CN["Connector"]
|
|
321
|
-
ER --> SA["SmartArt"]
|
|
322
|
-
ER --> M3["3D Model"]
|
|
323
|
-
ER --> MD["Media (audio/video)"]
|
|
324
|
-
ER --> IK["Ink"]
|
|
325
|
-
```
|
|
299
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/react/README.md) for visual representations._
|
|
326
300
|
|
|
327
301
|
### Hook Composition
|
|
328
302
|
|
|
329
303
|
The viewer's logic is decomposed into 67+ custom hooks, composed in `PowerPointViewer.tsx`:
|
|
330
304
|
|
|
331
|
-
|
|
332
|
-
flowchart TD
|
|
333
|
-
subgraph "Core State"
|
|
334
|
-
VS["useViewerState<br/>All mutable state"]
|
|
335
|
-
VCS["useViewerCoreState<br/>Slides, selection, canvas"]
|
|
336
|
-
VUI["useViewerUIState<br/>Panels, dialogs, UI flags"]
|
|
337
|
-
end
|
|
338
|
-
|
|
339
|
-
subgraph "Derived State"
|
|
340
|
-
DSS["useDerivedSlideState<br/>Visible indexes, sections"]
|
|
341
|
-
DES["useDerivedElementState<br/>Selected element computed props"]
|
|
342
|
-
end
|
|
343
|
-
|
|
344
|
-
subgraph "Core Operations"
|
|
345
|
-
EH["useEditorHistory<br/>Undo/redo snapshot stack"]
|
|
346
|
-
ZV["useZoomViewport<br/>Zoom level + viewport"]
|
|
347
|
-
EO["useEditorOperations<br/>Compose all editor ops"]
|
|
348
|
-
end
|
|
349
|
-
|
|
350
|
-
subgraph "Feature Hooks"
|
|
351
|
-
LC["useLoadContent<br/>Parse PPTX on mount"]
|
|
352
|
-
PM["usePresentationMode<br/>Slideshow navigation"]
|
|
353
|
-
PA["usePresentationAnnotations<br/>Pen/highlighter tools"]
|
|
354
|
-
IE["useInsertElements<br/>Shape/image/table insertion"]
|
|
355
|
-
EM["useElementManipulation<br/>Move/resize/delete"]
|
|
356
|
-
PH["usePointerHandlers<br/>Mouse/touch events"]
|
|
357
|
-
KS["useKeyboardShortcuts<br/>Hotkey bindings"]
|
|
358
|
-
EX["useExportHandlers<br/>PNG/SVG/PDF/video export"]
|
|
359
|
-
PR["usePrintHandlers<br/>Print dialog"]
|
|
360
|
-
SM["useSlideManagement<br/>Add/delete/reorder slides"]
|
|
361
|
-
TO["useTableOperations<br/>Row/column/cell ops"]
|
|
362
|
-
FR["useFindReplace<br/>Text search"]
|
|
363
|
-
CM["useComments<br/>Comment management"]
|
|
364
|
-
end
|
|
365
|
-
|
|
366
|
-
subgraph "Collaboration"
|
|
367
|
-
YJS["useYjsProvider<br/>WebSocket lifecycle"]
|
|
368
|
-
PT["usePresenceTracking<br/>Remote cursors"]
|
|
369
|
-
CS["useCollaborativeState<br/>CRDT shared state"]
|
|
370
|
-
CH2["useCollaborativeHistory<br/>Collab undo/redo"]
|
|
371
|
-
end
|
|
372
|
-
|
|
373
|
-
VS --> VCS
|
|
374
|
-
VS --> VUI
|
|
375
|
-
VCS --> DSS
|
|
376
|
-
VS --> EH
|
|
377
|
-
VS --> ZV
|
|
378
|
-
EH --> EO
|
|
379
|
-
ZV --> EO
|
|
380
|
-
EO --> IE
|
|
381
|
-
EO --> EM
|
|
382
|
-
EO --> PH
|
|
383
|
-
EO --> SM
|
|
384
|
-
EO --> TO
|
|
385
|
-
EO --> FR
|
|
386
|
-
EO --> CM
|
|
387
|
-
```
|
|
305
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/react/README.md) for visual representations._
|
|
388
306
|
|
|
389
307
|
### Data Flow
|
|
390
308
|
|
|
391
|
-
|
|
392
|
-
sequenceDiagram
|
|
393
|
-
participant P as Parent App
|
|
394
|
-
participant V as PowerPointViewer
|
|
395
|
-
participant H as PptxHandler (core)
|
|
396
|
-
participant S as State (hooks)
|
|
397
|
-
participant C as SlideCanvas
|
|
398
|
-
|
|
399
|
-
P->>V: content={arrayBuffer}
|
|
400
|
-
V->>S: useViewerState({ content })
|
|
401
|
-
S->>H: handler.load(buffer)
|
|
402
|
-
H-->>S: PptxData { slides, theme, ... }
|
|
403
|
-
S-->>V: { slides, activeSlide, canvasSize, ... }
|
|
404
|
-
V->>C: Render active slide
|
|
405
|
-
C->>C: Map elements -> React components
|
|
406
|
-
|
|
407
|
-
Note over C: User edits element
|
|
408
|
-
C->>S: setState(updatedSlides)
|
|
409
|
-
S->>S: Push undo snapshot
|
|
410
|
-
S-->>V: Re-render with updated state
|
|
411
|
-
|
|
412
|
-
Note over V: User saves
|
|
413
|
-
V->>H: handler.save(slides)
|
|
414
|
-
H-->>P: Uint8Array via onContentChange
|
|
415
|
-
```
|
|
309
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/react/README.md) for visual representations._
|
|
416
310
|
|
|
417
311
|
### Rendering Pipeline
|
|
418
312
|
|
|
@@ -423,37 +317,7 @@ Slides are rendered using **CSS positioning and transforms**, not HTML Canvas. T
|
|
|
423
317
|
- DOM-based interaction (click, drag, resize)
|
|
424
318
|
- Standard CSS effects (shadows, gradients, borders)
|
|
425
319
|
|
|
426
|
-
|
|
427
|
-
flowchart LR
|
|
428
|
-
subgraph "Data Model"
|
|
429
|
-
E["PptxElement<br/>(from core)"]
|
|
430
|
-
end
|
|
431
|
-
|
|
432
|
-
subgraph "React Components"
|
|
433
|
-
ER["ElementRenderer<br/>Type dispatch"]
|
|
434
|
-
EB["ElementBody<br/>Visual rendering"]
|
|
435
|
-
RH["ResizeHandles<br/>Selection UI"]
|
|
436
|
-
end
|
|
437
|
-
|
|
438
|
-
subgraph "CSS Output"
|
|
439
|
-
POS["position: absolute<br/>left/top/width/height"]
|
|
440
|
-
ROT["transform: rotate()"]
|
|
441
|
-
FIL["background: fill style"]
|
|
442
|
-
BOR["border: stroke style"]
|
|
443
|
-
SHD["box-shadow: effects"]
|
|
444
|
-
TXT["text styling (font, color, align)"]
|
|
445
|
-
end
|
|
446
|
-
|
|
447
|
-
E --> ER
|
|
448
|
-
ER --> EB
|
|
449
|
-
ER --> RH
|
|
450
|
-
EB --> POS
|
|
451
|
-
EB --> ROT
|
|
452
|
-
EB --> FIL
|
|
453
|
-
EB --> BOR
|
|
454
|
-
EB --> SHD
|
|
455
|
-
EB --> TXT
|
|
456
|
-
```
|
|
320
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/react/README.md) for visual representations._
|
|
457
321
|
|
|
458
322
|
---
|
|
459
323
|
|
|
@@ -601,27 +465,7 @@ The right-side inspector (`InspectorPane`) displays contextual property editors:
|
|
|
601
465
|
|
|
602
466
|
Activated by setting `mode` to `"present"`. The `ViewerPresentationLayer` takes over with:
|
|
603
467
|
|
|
604
|
-
|
|
605
|
-
flowchart TD
|
|
606
|
-
PM["usePresentationMode"] --> SN["useSlideNavigation<br/>Next/prev/goto slide"]
|
|
607
|
-
PM --> AP["useAnimationPlayback<br/>Trigger animations in sequence"]
|
|
608
|
-
PM --> PK["usePresentationKeyboard<br/>Arrow keys, Esc, N-key toggle"]
|
|
609
|
-
PM --> RT["useRehearsalTimings<br/>Practice mode with timer"]
|
|
610
|
-
|
|
611
|
-
subgraph "Rendering"
|
|
612
|
-
ST["Slide Transition<br/>(CSS + framer-motion)"]
|
|
613
|
-
AN["Animation Overlays<br/>(keyframe sequences)"]
|
|
614
|
-
AO["Annotation Overlay<br/>(pen/highlighter SVG)"]
|
|
615
|
-
PV["Presenter View<br/>(dual-screen notes + preview + timer)"]
|
|
616
|
-
TB2["Slideshow Toolbar<br/>(auto-hide on mouse idle)"]
|
|
617
|
-
end
|
|
618
|
-
|
|
619
|
-
SN --> ST
|
|
620
|
-
AP --> AN
|
|
621
|
-
PM --> AO
|
|
622
|
-
PM --> PV
|
|
623
|
-
PM --> TB2
|
|
624
|
-
```
|
|
468
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/react/README.md) for visual representations._
|
|
625
469
|
|
|
626
470
|
**Slide transitions** (`slide-transitions.ts`, `transition-keyframes.ts`):
|
|
627
471
|
|
|
@@ -636,25 +480,7 @@ flowchart TD
|
|
|
636
480
|
|
|
637
481
|
The animation system (`viewer/utils/animation*.ts`, ~14 files) processes OOXML timing trees:
|
|
638
482
|
|
|
639
|
-
|
|
640
|
-
flowchart LR
|
|
641
|
-
A["PptxElementAnimation<br/>(from core)"] --> B["animation-timeline.ts<br/>Build timeline"]
|
|
642
|
-
B --> C["animation-sequencer.ts<br/>Resolve triggers:<br/>onClick, afterPrevious,<br/>withPrevious"]
|
|
643
|
-
C --> D["animation-keyframes.ts<br/>Generate CSS @keyframes"]
|
|
644
|
-
D --> E["animation-effects.ts<br/>Apply to DOM elements"]
|
|
645
|
-
|
|
646
|
-
subgraph "Effect Types"
|
|
647
|
-
F["Entrance<br/>(appear, fly in, fade, zoom)"]
|
|
648
|
-
G["Emphasis<br/>(pulse, spin, grow/shrink, color)"]
|
|
649
|
-
H["Exit<br/>(disappear, fly out, fade)"]
|
|
650
|
-
I["Motion Path<br/>(custom path with auto-rotation)"]
|
|
651
|
-
end
|
|
652
|
-
|
|
653
|
-
D --> F
|
|
654
|
-
D --> G
|
|
655
|
-
D --> H
|
|
656
|
-
D --> I
|
|
657
|
-
```
|
|
483
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/react/README.md) for visual representations._
|
|
658
484
|
|
|
659
485
|
Supports 40+ animation presets with configurable duration, delay, repeat, color animations, motion path auto-rotation, and text-build options (by word, by letter, by paragraph).
|
|
660
486
|
|
|
@@ -685,26 +511,7 @@ Chart chrome (axes, legends, titles, gridlines, data labels, data tables, displa
|
|
|
685
511
|
|
|
686
512
|
The export pipeline (`viewer/utils/export*.ts`, `viewer/hooks/useExportHandlers.ts`):
|
|
687
513
|
|
|
688
|
-
|
|
689
|
-
flowchart TD
|
|
690
|
-
A["Export Request"] --> B{Format?}
|
|
691
|
-
|
|
692
|
-
B -->|PNG/JPEG| C["renderToCanvas (html2canvas)<br/>-> canvas.toDataURL()"]
|
|
693
|
-
B -->|SVG| D["DOM -> SVG serialisation<br/>(export-svg.ts)"]
|
|
694
|
-
B -->|PDF| E["jspdf + renderToCanvas<br/>-> multi-page PDF<br/>(with notes pages + overflow)"]
|
|
695
|
-
B -->|GIF| F["export-gif-encoder.ts<br/>-> animated GIF frames"]
|
|
696
|
-
B -->|Video| G["export-video.ts<br/>-> MediaRecorder API"]
|
|
697
|
-
B -->|PPTX| H["PptxHandler.save()<br/>-> Uint8Array download"]
|
|
698
|
-
B -->|Slides| I["PptxHandler.exportSlides()<br/>-> per-slide PPTX files"]
|
|
699
|
-
|
|
700
|
-
C --> J["Download / Blob URL"]
|
|
701
|
-
D --> J
|
|
702
|
-
E --> J
|
|
703
|
-
F --> J
|
|
704
|
-
G --> J
|
|
705
|
-
H --> J
|
|
706
|
-
I --> J
|
|
707
|
-
```
|
|
514
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/react/README.md) for visual representations._
|
|
708
515
|
|
|
709
516
|
The `renderToCanvas` wrapper (`lib/canvas-export.ts`) patches `html2canvas` to work around oklch colour space parsing issues in browsers that don't fully support it.
|
|
710
517
|
|
|
@@ -712,14 +519,7 @@ The `renderToCanvas` wrapper (`lib/canvas-export.ts`) patches `html2canvas` to w
|
|
|
712
519
|
|
|
713
520
|
Connectors between shapes use a graph-based routing algorithm:
|
|
714
521
|
|
|
715
|
-
|
|
716
|
-
flowchart LR
|
|
717
|
-
A["Start Shape<br/>(connection point)"] --> B["connector-router.ts<br/>A* pathfinding"]
|
|
718
|
-
B --> C["connector-router-graph.ts<br/>Build obstacle grid"]
|
|
719
|
-
C --> D["connector-router-astar.ts<br/>Find shortest path"]
|
|
720
|
-
D --> E["connector-path.tsx<br/>SVG path rendering"]
|
|
721
|
-
E --> F["Arrow markers<br/>(start/end heads)"]
|
|
722
|
-
```
|
|
522
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/react/README.md) for visual representations._
|
|
723
523
|
|
|
724
524
|
The router avoids overlapping shapes by building an obstacle grid and using A\* pathfinding with Manhattan distance heuristics. Supports straight, elbow (bent), and curved connector types.
|
|
725
525
|
|