pptx-react-viewer 1.0.0 → 1.0.7
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/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.mjs +0 -0
- package/node_modules/pptx-viewer-core/package.json +13 -1
- package/package.json +16 -4
|
@@ -194,208 +194,29 @@ const builder = handler.Builder(data);
|
|
|
194
194
|
|
|
195
195
|
The package follows a layered architecture with clear separation of concerns:
|
|
196
196
|
|
|
197
|
-
|
|
198
|
-
flowchart TB
|
|
199
|
-
subgraph "Public API"
|
|
200
|
-
A[PptxHandler]
|
|
201
|
-
B[PptxMarkdownConverter]
|
|
202
|
-
end
|
|
203
|
-
|
|
204
|
-
subgraph "Facade Layer"
|
|
205
|
-
C[PptxHandlerCore]
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
subgraph "Runtime Engine"
|
|
209
|
-
D["IPptxHandlerRuntime<br/>(interface)"]
|
|
210
|
-
E["PptxHandlerRuntime<br/>(50+ mixin modules)"]
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
subgraph "Supporting Modules"
|
|
214
|
-
F[Types -- 22 modules]
|
|
215
|
-
G[Geometry -- 17 modules]
|
|
216
|
-
H[Colour -- 4 modules]
|
|
217
|
-
I[Services -- 21 modules]
|
|
218
|
-
J[Builders -- 11 modules]
|
|
219
|
-
K[Utils -- 32 modules]
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
subgraph "Converter System"
|
|
223
|
-
L[DocumentConverter base]
|
|
224
|
-
M[SlideProcessor]
|
|
225
|
-
N["Element Processors<br/>(11 types)"]
|
|
226
|
-
O[MediaContext]
|
|
227
|
-
end
|
|
228
|
-
|
|
229
|
-
A --> C
|
|
230
|
-
C --> D
|
|
231
|
-
D -.->|implemented by| E
|
|
232
|
-
E --> F
|
|
233
|
-
E --> G
|
|
234
|
-
E --> H
|
|
235
|
-
E --> I
|
|
236
|
-
E --> J
|
|
237
|
-
E --> K
|
|
238
|
-
|
|
239
|
-
B --> L
|
|
240
|
-
L --> M
|
|
241
|
-
M --> N
|
|
242
|
-
M --> O
|
|
243
|
-
```
|
|
197
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/core/README.md) for visual representations._
|
|
244
198
|
|
|
245
199
|
### Module Map
|
|
246
200
|
|
|
247
|
-
|
|
248
|
-
graph TB
|
|
249
|
-
subgraph "Entry Points"
|
|
250
|
-
IDX["src/index.ts<br/>Package entry"]
|
|
251
|
-
CIDX["src/core/index.ts<br/>Core barrel"]
|
|
252
|
-
VIDX["src/converter/index.ts<br/>Converter barrel"]
|
|
253
|
-
end
|
|
254
|
-
|
|
255
|
-
subgraph "Handler Facade"
|
|
256
|
-
PH["PptxHandler.ts<br/>Public class"]
|
|
257
|
-
PHC["PptxHandlerCore.ts<br/>Facade over runtime"]
|
|
258
|
-
end
|
|
259
|
-
|
|
260
|
-
subgraph "Runtime (core/core/)"
|
|
261
|
-
RT["PptxHandlerRuntime.ts<br/>Sealed final class"]
|
|
262
|
-
RTF["PptxHandlerRuntimeFactory.ts<br/>DI factory"]
|
|
263
|
-
RTI["PptxHandlerRuntimeImplementation.ts<br/>Top of mixin chain"]
|
|
264
|
-
RTLP["...LoadPipeline.ts"]
|
|
265
|
-
RTSP["...SavePipeline.ts"]
|
|
266
|
-
RTMS["...50+ mixin modules"]
|
|
267
|
-
end
|
|
268
|
-
|
|
269
|
-
subgraph "Types (core/types/)"
|
|
270
|
-
TE["elements.ts -- PptxElement union"]
|
|
271
|
-
TT["text.ts -- TextStyle, Paragraph"]
|
|
272
|
-
TS["shape-style.ts -- ShapeStyle"]
|
|
273
|
-
TC["chart.ts -- PptxChartData"]
|
|
274
|
-
TH["theme.ts -- PptxTheme"]
|
|
275
|
-
TMORE["...17 more type modules"]
|
|
276
|
-
end
|
|
277
|
-
|
|
278
|
-
subgraph "Geometry (core/geometry/)"
|
|
279
|
-
SG["shape-geometry.ts"]
|
|
280
|
-
CG["connector-geometry.ts"]
|
|
281
|
-
GF["guide-formula.ts"]
|
|
282
|
-
PS["preset-shape-definitions.ts"]
|
|
283
|
-
end
|
|
284
|
-
|
|
285
|
-
subgraph "Services (core/services/)"
|
|
286
|
-
SL["PptxSlideLoaderService"]
|
|
287
|
-
AN["PptxNativeAnimationService"]
|
|
288
|
-
AW["PptxAnimationWriteService"]
|
|
289
|
-
TR["PptxSlideTransitionService"]
|
|
290
|
-
CP["PptxCompatibilityService"]
|
|
291
|
-
end
|
|
292
|
-
|
|
293
|
-
IDX --> CIDX
|
|
294
|
-
IDX --> VIDX
|
|
295
|
-
CIDX --> PH
|
|
296
|
-
PH --> PHC
|
|
297
|
-
PHC --> RT
|
|
298
|
-
RT --> RTI
|
|
299
|
-
RTI --> RTLP
|
|
300
|
-
RTLP --> RTSP
|
|
301
|
-
RTSP --> RTMS
|
|
302
|
-
```
|
|
201
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/core/README.md) for visual representations._
|
|
303
202
|
|
|
304
203
|
### Load Pipeline
|
|
305
204
|
|
|
306
205
|
When `handler.load(buffer)` is called, the following sequence occurs:
|
|
307
206
|
|
|
308
|
-
|
|
309
|
-
sequenceDiagram
|
|
310
|
-
participant C as Caller
|
|
311
|
-
participant H as PptxHandler
|
|
312
|
-
participant R as Runtime
|
|
313
|
-
participant Z as JSZip
|
|
314
|
-
participant X as fast-xml-parser
|
|
315
|
-
|
|
316
|
-
C->>H: load(arrayBuffer)
|
|
317
|
-
H->>H: detectFileFormat(buffer)
|
|
318
|
-
alt Encrypted
|
|
319
|
-
H->>H: decryptOoxml(buffer, password)
|
|
320
|
-
end
|
|
321
|
-
H->>R: load(buffer, options)
|
|
322
|
-
R->>Z: loadAsync(buffer)
|
|
323
|
-
Note over R: ZIP opened in memory
|
|
324
|
-
|
|
325
|
-
R->>R: Parse [Content_Types].xml
|
|
326
|
-
R->>R: Parse ppt/presentation.xml
|
|
327
|
-
R->>X: Parse XML -> JS objects
|
|
328
|
-
|
|
329
|
-
loop For each slide master
|
|
330
|
-
R->>R: Parse theme, colour map, layouts
|
|
331
|
-
end
|
|
332
|
-
|
|
333
|
-
loop For each slide
|
|
334
|
-
R->>R: Parse slide XML
|
|
335
|
-
R->>R: Resolve layout -> master -> theme chain
|
|
336
|
-
R->>R: Parse elements (shapes, images, charts, tables, SmartArt, OLE, 3D models, zoom)
|
|
337
|
-
R->>R: Parse text with style inheritance
|
|
338
|
-
R->>R: Parse animations & transitions
|
|
339
|
-
R->>R: Extract media relationships
|
|
340
|
-
end
|
|
341
|
-
|
|
342
|
-
R->>R: Parse comments, doc properties, embedded fonts
|
|
343
|
-
R-->>C: PptxData { slides, canvasSize, theme, masters, ... }
|
|
344
|
-
```
|
|
207
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/core/README.md) for visual representations._
|
|
345
208
|
|
|
346
209
|
### Save Pipeline
|
|
347
210
|
|
|
348
211
|
When `handler.save(slides)` is called:
|
|
349
212
|
|
|
350
|
-
|
|
351
|
-
sequenceDiagram
|
|
352
|
-
participant C as Caller
|
|
353
|
-
participant H as PptxHandler
|
|
354
|
-
participant R as Runtime
|
|
355
|
-
participant Z as JSZip
|
|
356
|
-
|
|
357
|
-
C->>H: save(slides, options)
|
|
358
|
-
H->>R: save(slides, options)
|
|
359
|
-
|
|
360
|
-
R->>R: Reconcile slide list (added/removed/reordered)
|
|
361
|
-
R->>R: Update ppt/presentation.xml
|
|
362
|
-
|
|
363
|
-
loop For each slide
|
|
364
|
-
R->>R: Build slide XML from element data
|
|
365
|
-
R->>R: Serialise text paragraphs + run properties
|
|
366
|
-
R->>R: Write shape styles, effects, transforms
|
|
367
|
-
R->>R: Update relationships (images, charts, media)
|
|
368
|
-
R->>R: Write animation timing trees
|
|
369
|
-
R->>R: Update slide notes
|
|
370
|
-
end
|
|
371
|
-
|
|
372
|
-
R->>R: Update [Content_Types].xml
|
|
373
|
-
R->>R: Write doc properties, comments
|
|
374
|
-
R->>R: Preserve VBA macros, custom XML parts
|
|
375
|
-
R->>Z: Generate ZIP (compression: DEFLATE)
|
|
376
|
-
R-->>C: Uint8Array (.pptx bytes)
|
|
377
|
-
```
|
|
213
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/core/README.md) for visual representations._
|
|
378
214
|
|
|
379
215
|
### Runtime Mixin Composition
|
|
380
216
|
|
|
381
217
|
The runtime is assembled from 50+ mixin modules using a linear inheritance chain. Each module adds a focused set of capabilities:
|
|
382
218
|
|
|
383
|
-
|
|
384
|
-
graph LR
|
|
385
|
-
A["State<br/>(base fields)"] --> B["ThemeLoading"]
|
|
386
|
-
B --> C["ThemeProcessing"]
|
|
387
|
-
C --> D["ThemeOverrides"]
|
|
388
|
-
D --> E["SlideMasters"]
|
|
389
|
-
E --> F["BackgroundParsing"]
|
|
390
|
-
F --> G["ElementParsing"]
|
|
391
|
-
G --> H["ShapeParsing"]
|
|
392
|
-
H --> I["TextParsing"]
|
|
393
|
-
I --> J["ChartParsing"]
|
|
394
|
-
J --> K["...30+ more"]
|
|
395
|
-
K --> L["SavePipeline"]
|
|
396
|
-
L --> M["LoadPipeline"]
|
|
397
|
-
M --> N["Implementation<br/>(top of chain)"]
|
|
398
|
-
```
|
|
219
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/core/README.md) for visual representations._
|
|
399
220
|
|
|
400
221
|
Each file exports a class named `PptxHandlerRuntime` that extends the previous module's export, adding its own methods. The final `PptxHandlerRuntimeImplementation` aggregates all functionality into the complete runtime.
|
|
401
222
|
|
|
@@ -450,43 +271,7 @@ The runtime uses **jszip** to read/write this archive and **fast-xml-parser** to
|
|
|
450
271
|
|
|
451
272
|
The type system is organised into 22 domain-specific modules with a discriminated union pattern for elements:
|
|
452
273
|
|
|
453
|
-
|
|
454
|
-
graph TB
|
|
455
|
-
subgraph "PptxElement (discriminated union -- 16 types)"
|
|
456
|
-
direction LR
|
|
457
|
-
TX["type: 'text'"]
|
|
458
|
-
SH["type: 'shape'"]
|
|
459
|
-
CN["type: 'connector'"]
|
|
460
|
-
IM["type: 'image'"]
|
|
461
|
-
PC["type: 'picture'"]
|
|
462
|
-
TB["type: 'table'"]
|
|
463
|
-
CH["type: 'chart'"]
|
|
464
|
-
SA["type: 'smartArt'"]
|
|
465
|
-
OL["type: 'ole'"]
|
|
466
|
-
MD["type: 'media'"]
|
|
467
|
-
GR["type: 'group'"]
|
|
468
|
-
IK["type: 'ink'"]
|
|
469
|
-
CP["type: 'contentPart'"]
|
|
470
|
-
ZM["type: 'zoom'"]
|
|
471
|
-
M3["type: 'model3d'"]
|
|
472
|
-
UK["type: 'unknown'"]
|
|
473
|
-
end
|
|
474
|
-
|
|
475
|
-
subgraph "Shared Properties (PptxElementBase)"
|
|
476
|
-
ID["id, name, type"]
|
|
477
|
-
POS["x, y, width, height, rotation"]
|
|
478
|
-
STY["shapeStyle?: ShapeStyle"]
|
|
479
|
-
ACT["action?: ElementAction"]
|
|
480
|
-
ANI["animations?: PptxElementAnimation[]"]
|
|
481
|
-
end
|
|
482
|
-
|
|
483
|
-
SH --> SHARED["+ text, paragraphs, textBody, geometry"]
|
|
484
|
-
IM --> IPROPS["+ imagePath, imageData, imageEffects, crop"]
|
|
485
|
-
TB --> TPROPS["+ tableData (rows, columns, cells, styles)"]
|
|
486
|
-
CH --> CPROPS["+ chartData (type, series, axes, legend)"]
|
|
487
|
-
CN --> CNPROPS["+ connectorType, startConnection, endConnection"]
|
|
488
|
-
M3 --> MPROPS["+ modelPath, modelData, modelMimeType"]
|
|
489
|
-
```
|
|
274
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/core/README.md) for visual representations._
|
|
490
275
|
|
|
491
276
|
**Key type modules:**
|
|
492
277
|
|
|
@@ -515,22 +300,7 @@ graph TB
|
|
|
515
300
|
|
|
516
301
|
PowerPoint elements inherit visual styles through a multi-level chain. The runtime resolves styles in this order:
|
|
517
302
|
|
|
518
|
-
|
|
519
|
-
flowchart TD
|
|
520
|
-
A["Element Direct Formatting<br/>(inline styles in shape XML)"] --> B{"Has property?"}
|
|
521
|
-
B -->|Yes| Z["Use element value"]
|
|
522
|
-
B -->|No| C["Placeholder on Layout<br/>(matching idx + type)"]
|
|
523
|
-
C --> D{"Has property?"}
|
|
524
|
-
D -->|Yes| Z
|
|
525
|
-
D -->|No| E["Placeholder on Master<br/>(matching idx + type)"]
|
|
526
|
-
E --> F{"Has property?"}
|
|
527
|
-
F -->|Yes| Z
|
|
528
|
-
F -->|No| G["Theme Defaults<br/>(a:objectDefaults / lstStyle)"]
|
|
529
|
-
G --> H{"Has property?"}
|
|
530
|
-
H -->|Yes| Z
|
|
531
|
-
H -->|No| I["Hardcoded Fallback<br/>(black text, no fill)"]
|
|
532
|
-
I --> Z
|
|
533
|
-
```
|
|
303
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/core/README.md) for visual representations._
|
|
534
304
|
|
|
535
305
|
**Theme colour references** (e.g. `accent1`, `dk1`, `lt2`) are resolved through the theme's `a:clrScheme`, optionally overridden by the slide master's `p:clrMap` and the layout's `p:clrMapOvr`.
|
|
536
306
|
|
|
@@ -576,15 +346,7 @@ The geometry module (17 files) handles shape path generation and coordinate tran
|
|
|
576
346
|
|
|
577
347
|
The colour module (4 files) handles OOXML colour parsing and transforms:
|
|
578
348
|
|
|
579
|
-
|
|
580
|
-
flowchart LR
|
|
581
|
-
A["OOXML Colour Node<br/>(srgbClr / schemeClr /<br/>sysClr / prstClr)"] --> B["parseDrawingColor()"]
|
|
582
|
-
B --> C["Resolve base hex"]
|
|
583
|
-
C --> D{"Has transforms?"}
|
|
584
|
-
D -->|Yes| E["applyDrawingColorTransforms()<br/>lumMod, lumOff, tint, shade,<br/>satMod, alpha, hueMod, etc."]
|
|
585
|
-
D -->|No| F["Return #RRGGBB"]
|
|
586
|
-
E --> F
|
|
587
|
-
```
|
|
349
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/core/README.md) for visual representations._
|
|
588
350
|
|
|
589
351
|
Supported colour transform operations:
|
|
590
352
|
| Transform | Effect |
|
|
@@ -602,27 +364,7 @@ Supported colour transform operations:
|
|
|
602
364
|
|
|
603
365
|
The PPTX-to-Markdown converter uses a registry pattern for element processing:
|
|
604
366
|
|
|
605
|
-
|
|
606
|
-
flowchart TD
|
|
607
|
-
A["PptxMarkdownConverter<br/>(extends DocumentConverter)"] --> B["Parse PPTX via PptxHandler"]
|
|
608
|
-
B --> C["SlideProcessor<br/>(per-slide orchestration)"]
|
|
609
|
-
C --> D{"Element Type?"}
|
|
610
|
-
|
|
611
|
-
D -->|shape| E["TextElementProcessor"]
|
|
612
|
-
D -->|image| F["ImageElementProcessor"]
|
|
613
|
-
D -->|table| G["TableElementProcessor"]
|
|
614
|
-
D -->|chart| H["ChartElementProcessor"]
|
|
615
|
-
D -->|smartArt| I["SmartArtElementProcessor"]
|
|
616
|
-
D -->|group| J["GroupElementProcessor"]
|
|
617
|
-
D -->|media| K["MediaElementProcessor"]
|
|
618
|
-
D -->|ole| L["OleElementProcessor"]
|
|
619
|
-
D -->|ink| M["InkElementProcessor"]
|
|
620
|
-
D -->|unknown| N["FallbackElementProcessor"]
|
|
621
|
-
|
|
622
|
-
E --> O["Markdown Output"]
|
|
623
|
-
F --> O
|
|
624
|
-
G --> O
|
|
625
|
-
```
|
|
367
|
+
_See the [architecture diagrams on GitHub](https://github.com/ChristopherVR/pptx-viewer/blob/main/packages/core/README.md) for visual representations._
|
|
626
368
|
|
|
627
369
|
The converter supports two output modes:
|
|
628
370
|
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pptx-viewer-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Core PPTX engine — parse, edit, serialize, and convert PowerPoint files.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"converter",
|
|
@@ -11,12 +11,24 @@
|
|
|
11
11
|
"pptx",
|
|
12
12
|
"sdk"
|
|
13
13
|
],
|
|
14
|
+
"homepage": "https://github.com/ChristopherVR/pptx-viewer",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/ChristopherVR/pptx-viewer/issues"
|
|
17
|
+
},
|
|
14
18
|
"license": "MIT",
|
|
19
|
+
"author": "ChristopherVR",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/ChristopherVR/pptx-viewer.git",
|
|
23
|
+
"directory": "packages/core"
|
|
24
|
+
},
|
|
15
25
|
"bin": {
|
|
16
26
|
"pptx": "./dist/cli/index.mjs"
|
|
17
27
|
},
|
|
18
28
|
"files": [
|
|
19
29
|
"dist/",
|
|
30
|
+
"LICENSE",
|
|
31
|
+
"NOTICE",
|
|
20
32
|
"README.md"
|
|
21
33
|
],
|
|
22
34
|
"main": "dist/index.mjs",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pptx-react-viewer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "React-based PowerPoint viewer, editor, and canvas export — depends on pptx-viewer-core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"editor",
|
|
@@ -11,9 +11,21 @@
|
|
|
11
11
|
"react",
|
|
12
12
|
"viewer"
|
|
13
13
|
],
|
|
14
|
+
"homepage": "https://github.com/ChristopherVR/pptx-viewer",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/ChristopherVR/pptx-viewer/issues"
|
|
17
|
+
},
|
|
14
18
|
"license": "MIT",
|
|
19
|
+
"author": "ChristopherVR",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/ChristopherVR/pptx-viewer.git",
|
|
23
|
+
"directory": "packages/react"
|
|
24
|
+
},
|
|
15
25
|
"files": [
|
|
16
26
|
"dist/",
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"NOTICE",
|
|
17
29
|
"README.md"
|
|
18
30
|
],
|
|
19
31
|
"main": "dist/index.mjs",
|
|
@@ -45,10 +57,10 @@
|
|
|
45
57
|
},
|
|
46
58
|
"dependencies": {
|
|
47
59
|
"clsx": "^2.1.1",
|
|
48
|
-
"emf-converter": "^1.0.
|
|
60
|
+
"emf-converter": "^1.0.7",
|
|
49
61
|
"html2canvas-pro": "^2.0.2",
|
|
50
|
-
"mtx-decompressor": "^1.0.
|
|
51
|
-
"pptx-viewer-core": "^1.0.
|
|
62
|
+
"mtx-decompressor": "^1.0.7",
|
|
63
|
+
"pptx-viewer-core": "^1.0.7",
|
|
52
64
|
"tailwind-merge": "^3.5.0"
|
|
53
65
|
},
|
|
54
66
|
"devDependencies": {
|