node-pptx-templater 1.0.3 → 1.0.5
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 +61 -3
- package/README.md +200 -300
- package/package.json +12 -3
- package/src/core/PPTXTemplater.js +270 -0
- package/src/core/ValidationEngine.js +77 -0
- package/src/index.js +2 -1
- package/src/managers/ZOrderManager.js +434 -0
- package/src/parsers/XMLParser.js +229 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,61 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.5] - 2026-06-02
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Z-Order (Layer Management) System**: Full stacking control for all slide drawing objects — shapes, images, charts, tables, groups, connectors, and SmartArt. Directly manipulates the OpenXML `<p:spTree>` element order, matching PowerPoint's native Bring Forward / Send Backward behavior exactly. New APIs:
|
|
12
|
+
- `getObjectOrder(slideIndex)` — Returns ordered metadata (id, type, zIndex) for every element on a slide, bottom-to-top.
|
|
13
|
+
- `bringForward(options)` — Moves an object one layer up in the stack.
|
|
14
|
+
- `sendBackward(options)` — Moves an object one layer down.
|
|
15
|
+
- `bringToFront(options)` — Moves an object to the very top of the stack.
|
|
16
|
+
- `sendToBack(options)` — Moves an object to the very bottom of the stack.
|
|
17
|
+
- `setZIndex(options)` — Places an object at an exact 1-based stacking position.
|
|
18
|
+
- `moveObjectBefore(options)` — Positions an object immediately below a named target.
|
|
19
|
+
- `moveObjectAfter(options)` — Positions an object immediately above a named target.
|
|
20
|
+
- `reorderObjects(options)` — Full bulk reorder of the slide stack from a given array.
|
|
21
|
+
- `applyZOrder(slideIndex, configs)` — Applies multiple stacking rules sequentially in one call.
|
|
22
|
+
- `swapObjects(slideIndex, id1, id2)` — Exchanges two objects' positions.
|
|
23
|
+
- `sortObjects(slideIndex, compareFn)` — Sorts the stack using a custom comparator.
|
|
24
|
+
- `getTopMostObject(slideIndex)` / `getBottomMostObject(slideIndex)` — Inspection helpers.
|
|
25
|
+
- `normalizeZOrder(slideIndex)` — Re-derives and resets internal Z-order state from the current XML.
|
|
26
|
+
- **Z_ORDER_SYMBOL Export**: The `Z_ORDER_SYMBOL` is now exported from `src/index.js` for advanced integrations.
|
|
27
|
+
- **ZOrderManager**: New dedicated manager class (`src/managers/ZOrderManager.js`) encapsulating all layer logic.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
- **`PPTXTemplater.create()` synchronous readiness**: Added `preloadAll()` call to `#initializeBlank()`. Previously, the blank PPTX template's pre-existing slides were registered but their XML was not cached, causing all synchronous operations (including ZOrderManager) to throw `"Slide N XML not pre-loaded"`.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- **`XMLParser` hybrid parsing**: Added a secondary `preserveOrder: true` fast-xml-parser pass that runs during `parse()` whenever a slide `<p:spTree>` is detected. Extracts DOM element order and attaches it via `Z_ORDER_SYMBOL` to each container. The `build()` method uses a new `serializeContainer()` recursive function to serialize containers in Z_ORDER_SYMBOL order, injecting the result back into the output XML.
|
|
34
|
+
- **`ValidationEngine`**: `validate()` now audits the shape tree for duplicate shape IDs, reporting them as errors.
|
|
35
|
+
|
|
36
|
+
### Tests
|
|
37
|
+
- Added 12 new integration tests in `tests/integration/ZOrder.test.js` covering all Z-order operations.
|
|
38
|
+
- Total test count increased from 96 → 108 (all passing).
|
|
39
|
+
|
|
40
|
+
## [1.0.3] - 2026-06-02
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
- **Dynamic Formatting in updateTable**: Added support for inline cell styling (color fill `fill`, text alignment `align`, and `fontSize`) directly on cell objects passed to `updateTable`.
|
|
44
|
+
- **Comprehensive Tailwind Site**: Overhauled doc builder script to generate a premium Tailwind CSS documentation portal with clientside search, clipboard copying, sitemap.xml, robots.txt, and Schema.org metadata.
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
- **XML Element Ordering**: Enforced strict schema-valid element sequence (`a:pPr` -> runs -> `a:endParaRPr`) in slide table cell paragraphs. This resolves the bug where split cells inheriting from template merged cells had their text runs ignored by PowerPoint's XML compiler.
|
|
48
|
+
- **Template Style Inheritance**: Fixed a bug in `updateTable` where cloned rows always copied the first data row (`trs[1]`). The engine now correctly inherits formatting, alignment, and fill styles from matching indices in the template (`trs[i]`) when available.
|
|
49
|
+
|
|
50
|
+
## [1.0.2] - 2026-06-02
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
- **Table Cell Merging & Unmerging Engine**: Fully implemented horizontal cell spans (`gridSpan`, `hMerge`), vertical cell spans (`rowSpan`, `vMerge`), and rectangular block merges.
|
|
54
|
+
- **PowerPoint Repair Protection**: Implemented unique 32-bit unsigned `rowId` generation inside `<a16:rowId>` XML tags for all cloned and inserted rows, eliminating PowerPoint's "Repair Mode" error prompts.
|
|
55
|
+
- **Merge Integrations**: Integrated template-driven merges (`merge` configs array and cell-level `colSpan`/`rowSpan`) inside the main `updateTable` orchestrator.
|
|
56
|
+
- **Integration Test Suite**: Added a comprehensive merge test script under `tests/integration/PPTXMerge.test.js`.
|
|
57
|
+
|
|
58
|
+
## [1.0.1] - 2026-05-19
|
|
59
|
+
|
|
60
|
+
### Changed
|
|
61
|
+
- **CommonJS Target Conversion**: Converted the source code modules compilation and packaging layout from pure ES Modules (ESM) to CommonJS (CJS) to ensure compatibility with standard Node.js deployment, packaging, and edge runtime environments.
|
|
62
|
+
|
|
8
63
|
## [1.0.0] - 2026-05-17
|
|
9
64
|
|
|
10
65
|
### Added
|
|
@@ -16,7 +71,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
16
71
|
- `ChartManager` — direct chart XML data updates (bar, line, pie, area, scatter)
|
|
17
72
|
- `TableManager` — table row replacement preserving all formatting
|
|
18
73
|
- `HyperlinkManager` — external URL and slide-to-slide hyperlink injection
|
|
19
|
-
- `MediaManager` — image embedding with SHA-1
|
|
74
|
+
- `MediaManager` — image embedding with SHA-1 deduplication
|
|
20
75
|
- `TemplateEngine` — `{{placeholder}}` replacement with fragmented run normalization
|
|
21
76
|
- `OutputWriter` — file, buffer, and stream output
|
|
22
77
|
- CLI: `build`, `validate`, `inspect`, `extract`, `debug` commands
|
|
@@ -29,11 +84,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
29
84
|
- MIT License
|
|
30
85
|
|
|
31
86
|
### Architecture
|
|
32
|
-
- Pure JavaScript ES Modules (no TypeScript)
|
|
33
87
|
- Zero PPTX generation library dependencies
|
|
34
88
|
- Only uses: `jszip`, `fast-xml-parser`, `fs-extra`, `commander`, `chalk`, `ora`
|
|
35
89
|
- Async/await throughout
|
|
36
90
|
- Private class fields (`#field`) for encapsulation
|
|
37
91
|
- Modular architecture following SOLID principles
|
|
38
92
|
|
|
39
|
-
[1.0.
|
|
93
|
+
[1.0.4]: https://github.com/jsuyog2/node-pptx-templater/compare/v1.0.3...v1.0.4
|
|
94
|
+
[1.0.3]: https://github.com/jsuyog2/node-pptx-templater/compare/v1.0.2...v1.0.3
|
|
95
|
+
[1.0.2]: https://github.com/jsuyog2/node-pptx-templater/compare/v1.0.1...v1.0.2
|
|
96
|
+
[1.0.1]: https://github.com/jsuyog2/node-pptx-templater/compare/v1.0.0...v1.0.1
|
|
97
|
+
[1.0.0]: https://github.com/jsuyog2/node-pptx-templater/releases/tag/v1.0.0
|